This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Document getopts before getopt, and de-recommend getopt.
[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 May  8 15:28:09 CEST 2013 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 run=''
210 targetarch=''
211 to=''
212 usecrosscompile=''
213 extern_C=''
214 mistrustnm=''
215 usedevel=''
216 perllibs=''
217 dynamic_ext=''
218 extensions=''
219 known_extensions=''
220 nonxs_ext=''
221 static_ext=''
222 useopcode=''
223 useposix=''
224 extras=''
225 d_bsd=''
226 d_eunice=''
227 d_xenix=''
228 eunicefix=''
229 ar=''
230 awk=''
231 bash=''
232 bison=''
233 byacc=''
234 cat=''
235 chgrp=''
236 chmod=''
237 chown=''
238 comm=''
239 compress=''
240 cp=''
241 cpio=''
242 cpp=''
243 csh=''
244 date=''
245 echo=''
246 egrep=''
247 emacs=''
248 expr=''
249 find=''
250 flex=''
251 gmake=''
252 grep=''
253 gzip=''
254 inews=''
255 ksh=''
256 less=''
257 line=''
258 lint=''
259 ln=''
260 lp=''
261 lpr=''
262 ls=''
263 mail=''
264 mailx=''
265 make=''
266 mkdir=''
267 more=''
268 mv=''
269 nm=''
270 nroff=''
271 perl=''
272 pg=''
273 pmake=''
274 pr=''
275 rm=''
276 rmail=''
277 sed=''
278 sendmail=''
279 shar=''
280 sleep=''
281 smail=''
282 sort=''
283 submit=''
284 tail=''
285 tar=''
286 tbl=''
287 tee=''
288 test=''
289 touch=''
290 tr=''
291 troff=''
292 uname=''
293 uniq=''
294 uuname=''
295 vi=''
296 zcat=''
297 zip=''
298 full_ar=''
299 full_sed=''
300 libswanted=''
301 hint=''
302 myuname=''
303 osname=''
304 osvers=''
305 Author=''
306 Date=''
307 Header=''
308 Id=''
309 Locker=''
310 Log=''
311 RCSfile=''
312 Revision=''
313 Source=''
314 State=''
315 _a=''
316 _exe=''
317 _o=''
318 archobjs=''
319 exe_ext=''
320 firstmakefile=''
321 lib_ext=''
322 obj_ext=''
323 path_sep=''
324 rm_try=''
325 afs=''
326 afsroot=''
327 alignbytes=''
328 ansi2knr=''
329 archlib=''
330 archlibexp=''
331 d_archlib=''
332 installarchlib=''
333 archname=''
334 myarchname=''
335 useversionedarchname=''
336 d_atolf=''
337 d_atoll=''
338 baserev=''
339 bin=''
340 binexp=''
341 initialinstalllocation=''
342 installbin=''
343 userelocatableinc=''
344 byteorder=''
345 cc=''
346 ccflags=''
347 cppflags=''
348 ldflags=''
349 lkflags=''
350 locincpth=''
351 optimize=''
352 cf_email=''
353 cf_by=''
354 cf_time=''
355 charbits=''
356 charsize=''
357 contains=''
358 cpp_stuff=''
359 cpplast=''
360 cppminus=''
361 cpprun=''
362 cppstdin=''
363 d__fwalk=''
364 d_access=''
365 d_accessx=''
366 d_aintl=''
367 d_alarm=''
368 asctime_r_proto=''
369 d_asctime_r=''
370 d_attribute_deprecated=''
371 d_attribute_format=''
372 d_attribute_malloc=''
373 d_attribute_nonnull=''
374 d_attribute_noreturn=''
375 d_attribute_pure=''
376 d_attribute_unused=''
377 d_attribute_warn_unused_result=''
378 d_printf_format_null=''
379 d_bcmp=''
380 d_bcopy=''
381 d_builtin_choose_expr=''
382 d_builtin_expect=''
383 d_bzero=''
384 d_c99_variadic_macros=''
385 d_casti32=''
386 castflags=''
387 d_castneg=''
388 d_chown=''
389 d_chroot=''
390 d_chsize=''
391 d_class=''
392 d_clearenv=''
393 d_closedir=''
394 d_void_closedir=''
395 d_cmsghdr_s=''
396 d_const=''
397 d_copysignl=''
398 d_cplusplus=''
399 cryptlib=''
400 d_crypt=''
401 crypt_r_proto=''
402 d_crypt_r=''
403 d_csh=''
404 full_csh=''
405 d_ctermid=''
406 ctermid_r_proto=''
407 d_ctermid_r=''
408 ctime_r_proto=''
409 d_ctime_r=''
410 d_cuserid=''
411 d_dbl_dig=''
412 d_dbminitproto=''
413 d_difftime=''
414 d_dir_dd_fd=''
415 d_dirfd=''
416 d_dlerror=''
417 d_dlopen=''
418 d_dlsymun=''
419 d_dosuid=''
420 d_suidsafe=''
421 d_drand48_r=''
422 drand48_r_proto=''
423 d_drand48proto=''
424 d_dup2=''
425 d_eaccess=''
426 d_endgrent=''
427 d_endgrent_r=''
428 endgrent_r_proto=''
429 d_endhent=''
430 d_endhostent_r=''
431 endhostent_r_proto=''
432 d_endnent=''
433 d_endnetent_r=''
434 endnetent_r_proto=''
435 d_endpent=''
436 d_endprotoent_r=''
437 endprotoent_r_proto=''
438 d_endpwent=''
439 d_endpwent_r=''
440 endpwent_r_proto=''
441 d_endsent=''
442 d_endservent_r=''
443 endservent_r_proto=''
444 d_faststdio=''
445 d_fchdir=''
446 d_fchmod=''
447 d_fchown=''
448 d_fcntl=''
449 d_fcntl_can_lock=''
450 d_fd_macros=''
451 d_fd_set=''
452 d_fds_bits=''
453 d_fgetpos=''
454 d_finite=''
455 d_finitel=''
456 d_flexfnam=''
457 d_flock=''
458 d_flockproto=''
459 d_fork=''
460 d_fp_class=''
461 d_fpclass=''
462 d_fpclassify=''
463 d_fpclassl=''
464 d_fpos64_t=''
465 d_frexpl=''
466 d_fs_data_s=''
467 d_fseeko=''
468 d_fsetpos=''
469 d_fstatfs=''
470 d_fsync=''
471 d_ftello=''
472 d_ftime=''
473 d_gettimeod=''
474 d_futimes=''
475 d_Gconvert=''
476 d_getaddrinfo=''
477 d_getcwd=''
478 d_getespwnam=''
479 d_getfsstat=''
480 d_getgrent=''
481 d_getgrent_r=''
482 getgrent_r_proto=''
483 d_getgrgid_r=''
484 getgrgid_r_proto=''
485 d_getgrnam_r=''
486 getgrnam_r_proto=''
487 d_getgrps=''
488 d_gethbyaddr=''
489 d_gethbyname=''
490 d_gethent=''
491 aphostname=''
492 d_gethname=''
493 d_phostname=''
494 d_uname=''
495 d_gethostbyaddr_r=''
496 gethostbyaddr_r_proto=''
497 d_gethostbyname_r=''
498 gethostbyname_r_proto=''
499 d_gethostent_r=''
500 gethostent_r_proto=''
501 d_gethostprotos=''
502 d_getitimer=''
503 d_getlogin=''
504 d_getlogin_r=''
505 getlogin_r_proto=''
506 d_getmnt=''
507 d_getmntent=''
508 d_getnameinfo=''
509 d_getnbyaddr=''
510 d_getnbyname=''
511 d_getnent=''
512 d_getnetbyaddr_r=''
513 getnetbyaddr_r_proto=''
514 d_getnetbyname_r=''
515 getnetbyname_r_proto=''
516 d_getnetent_r=''
517 getnetent_r_proto=''
518 d_getnetprotos=''
519 d_getpagsz=''
520 d_getpent=''
521 d_getpgid=''
522 d_getpgrp2=''
523 d_bsdgetpgrp=''
524 d_getpgrp=''
525 d_getppid=''
526 d_getprior=''
527 d_getpbyname=''
528 d_getpbynumber=''
529 d_getprotobyname_r=''
530 getprotobyname_r_proto=''
531 d_getprotobynumber_r=''
532 getprotobynumber_r_proto=''
533 d_getprotoent_r=''
534 getprotoent_r_proto=''
535 d_getprotoprotos=''
536 d_getprpwnam=''
537 d_getpwent=''
538 d_getpwent_r=''
539 getpwent_r_proto=''
540 d_getpwnam_r=''
541 getpwnam_r_proto=''
542 d_getpwuid_r=''
543 getpwuid_r_proto=''
544 d_getsent=''
545 d_getservbyname_r=''
546 getservbyname_r_proto=''
547 d_getservbyport_r=''
548 getservbyport_r_proto=''
549 d_getservent_r=''
550 getservent_r_proto=''
551 d_getservprotos=''
552 d_getspnam=''
553 d_getspnam_r=''
554 getspnam_r_proto=''
555 d_getsbyname=''
556 d_getsbyport=''
557 d_gmtime_r=''
558 gmtime_r_proto=''
559 d_gnulibc=''
560 gnulibc_version=''
561 d_hasmntopt=''
562 d_htonl=''
563 d_ilogbl=''
564 d_inetaton=''
565 d_inetntop=''
566 d_inetpton=''
567 d_int64_t=''
568 d_isascii=''
569 d_isblank=''
570 d_isfinite=''
571 d_isinf=''
572 d_isnan=''
573 d_isnanl=''
574 d_killpg=''
575 d_lchown=''
576 d_ldbl_dig=''
577 d_libm_lib_version=''
578 d_link=''
579 d_localtime_r=''
580 d_localtime_r_needs_tzset=''
581 localtime_r_proto=''
582 d_locconv=''
583 d_lockf=''
584 d_longdbl=''
585 longdblsize=''
586 d_longlong=''
587 longlongsize=''
588 d_lseekproto=''
589 d_lstat=''
590 d_madvise=''
591 d_malloc_good_size=''
592 d_malloc_size=''
593 d_mblen=''
594 d_mbstowcs=''
595 d_mbtowc=''
596 d_memchr=''
597 d_memcmp=''
598 d_memcpy=''
599 d_memmove=''
600 d_memset=''
601 d_mkdir=''
602 d_mkdtemp=''
603 d_mkfifo=''
604 d_mkstemp=''
605 d_mkstemps=''
606 d_mktime=''
607 d_mmap=''
608 mmaptype=''
609 d_modfl=''
610 d_modfl_pow32_bug=''
611 d_modflproto=''
612 d_mprotect=''
613 d_msg=''
614 d_msgctl=''
615 d_msgget=''
616 d_msghdr_s=''
617 d_msgrcv=''
618 d_msgsnd=''
619 d_msync=''
620 d_munmap=''
621 d_nice=''
622 d_nl_langinfo=''
623 d_off64_t=''
624 d_open3=''
625 d_fpathconf=''
626 d_pathconf=''
627 d_pause=''
628 d_pipe=''
629 d_poll=''
630 d_portable=''
631 d_prctl=''
632 d_prctl_set_name=''
633 d_procselfexe=''
634 procselfexe=''
635 d_old_pthread_create_joinable=''
636 old_pthread_create_joinable=''
637 d_pthread_atfork=''
638 d_pthread_attr_setscope=''
639 d_pthread_yield=''
640 d_sched_yield=''
641 sched_yield=''
642 d_qgcvt=''
643 d_random_r=''
644 random_r_proto=''
645 d_readdir64_r=''
646 readdir64_r_proto=''
647 d_readdir=''
648 d_rewinddir=''
649 d_seekdir=''
650 d_telldir=''
651 d_readdir_r=''
652 readdir_r_proto=''
653 d_readlink=''
654 d_readv=''
655 d_recvmsg=''
656 d_rename=''
657 d_rmdir=''
658 d_safebcpy=''
659 d_safemcpy=''
660 d_sanemcmp=''
661 d_sbrkproto=''
662 d_scalbnl=''
663 d_select=''
664 d_sem=''
665 d_semctl=''
666 d_semget=''
667 d_semop=''
668 d_sendmsg=''
669 d_setegid=''
670 d_seteuid=''
671 d_setgrent=''
672 d_setgrent_r=''
673 setgrent_r_proto=''
674 d_setgrps=''
675 d_sethent=''
676 d_sethostent_r=''
677 sethostent_r_proto=''
678 d_setitimer=''
679 d_setlinebuf=''
680 d_setlocale=''
681 d_setlocale_r=''
682 setlocale_r_proto=''
683 d_setnent=''
684 d_setnetent_r=''
685 setnetent_r_proto=''
686 d_setpent=''
687 d_setpgid=''
688 d_setpgrp2=''
689 d_bsdsetpgrp=''
690 d_setpgrp=''
691 d_setprior=''
692 d_setproctitle=''
693 d_setprotoent_r=''
694 setprotoent_r_proto=''
695 d_setpwent=''
696 d_setpwent_r=''
697 setpwent_r_proto=''
698 d_setregid=''
699 d_setresgid=''
700 d_setresuid=''
701 d_setreuid=''
702 d_setrgid=''
703 d_setruid=''
704 d_setsent=''
705 d_setservent_r=''
706 setservent_r_proto=''
707 d_setsid=''
708 d_setvbuf=''
709 d_sfio=''
710 usesfio=''
711 d_shm=''
712 d_shmat=''
713 d_shmatprototype=''
714 shmattype=''
715 d_shmctl=''
716 d_shmdt=''
717 d_shmget=''
718 d_sigaction=''
719 d_signbit=''
720 d_sigprocmask=''
721 d_sigsetjmp=''
722 usesitecustomize=''
723 d_snprintf=''
724 d_vsnprintf=''
725 d_sockatmark=''
726 d_sockatmarkproto=''
727 d_ip_mreq=''
728 d_ip_mreq_source=''
729 d_ipv6_mreq=''
730 d_ipv6_mreq_source=''
731 d_msg_ctrunc=''
732 d_msg_dontroute=''
733 d_msg_oob=''
734 d_msg_peek=''
735 d_msg_proxy=''
736 d_oldsock=''
737 d_scm_rights=''
738 d_sin6_scope_id=''
739 d_sockaddr_in6=''
740 d_sockaddr_sa_len=''
741 d_socket=''
742 d_sockpair=''
743 sockethdr=''
744 socketlib=''
745 d_socklen_t=''
746 d_socks5_init=''
747 d_sprintf_returns_strlen=''
748 d_sqrtl=''
749 d_srand48_r=''
750 srand48_r_proto=''
751 d_srandom_r=''
752 srandom_r_proto=''
753 d_sresgproto=''
754 d_sresuproto=''
755 d_statblks=''
756 d_statfs_f_flags=''
757 d_statfs_s=''
758 d_static_inline=''
759 perl_static_inline=''
760 d_fstatvfs=''
761 d_statvfs=''
762 d_stdio_cnt_lval=''
763 d_stdio_ptr_lval=''
764 d_stdio_ptr_lval_nochange_cnt=''
765 d_stdio_ptr_lval_sets_cnt=''
766 d_stdiobase=''
767 d_stdstdio=''
768 stdio_base=''
769 stdio_bufsiz=''
770 stdio_cnt=''
771 stdio_filbuf=''
772 stdio_ptr=''
773 d_index=''
774 d_strchr=''
775 d_strcoll=''
776 d_strctcpy=''
777 d_strerrm=''
778 d_strerror=''
779 d_sysernlst=''
780 d_syserrlst=''
781 d_strerror_r=''
782 strerror_r_proto=''
783 d_strftime=''
784 d_strlcat=''
785 d_strlcpy=''
786 d_strtod=''
787 d_strtol=''
788 d_strtold=''
789 d_strtoll=''
790 d_strtoq=''
791 d_strtoul=''
792 d_strtoull=''
793 d_strtouq=''
794 d_strxfrm=''
795 d_symlink=''
796 d_syscall=''
797 d_syscallproto=''
798 d_sysconf=''
799 d_system=''
800 d_tcgetpgrp=''
801 d_tcsetpgrp=''
802 d_telldirproto=''
803 d_time=''
804 timetype=''
805 d_asctime64=''
806 d_ctime64=''
807 d_difftime64=''
808 d_gmtime64=''
809 d_localtime64=''
810 d_mktime64=''
811 d_timegm=''
812 clocktype=''
813 d_times=''
814 d_tmpnam_r=''
815 tmpnam_r_proto=''
816 d_truncate=''
817 d_ttyname_r=''
818 ttyname_r_proto=''
819 d_tzname=''
820 d_u32align=''
821 d_ualarm=''
822 d_umask=''
823 d_semctl_semid_ds=''
824 d_semctl_semun=''
825 d_union_semun=''
826 d_unordered=''
827 d_unsetenv=''
828 d_usleep=''
829 d_usleepproto=''
830 d_ustat=''
831 d_pseudofork=''
832 d_vfork=''
833 usevfork=''
834 d_voidsig=''
835 signal_t=''
836 d_volatile=''
837 d_charvspr=''
838 d_vprintf=''
839 d_wait4=''
840 d_waitpid=''
841 d_wcstombs=''
842 d_wctomb=''
843 d_writev=''
844 dlext=''
845 bin_ELF=''
846 cccdlflags=''
847 ccdlflags=''
848 dlsrc=''
849 ld=''
850 ld_can_script=''
851 lddlflags=''
852 usedl=''
853 doublesize=''
854 bootstrap_charset=''
855 ebcdic=''
856 fflushNULL=''
857 fflushall=''
858 fpossize=''
859 fpostype=''
860 gccansipedantic=''
861 gccosandvers=''
862 gccversion=''
863 gidformat=''
864 gidsign=''
865 gidsize=''
866 gidtype=''
867 groupstype=''
868 h_fcntl=''
869 h_sysfile=''
870 html1dir=''
871 html1direxp=''
872 installhtml1dir=''
873 html3dir=''
874 html3direxp=''
875 installhtml3dir=''
876 i_arpainet=''
877 i_assert=''
878 i_crypt=''
879 db_hashtype=''
880 db_prefixtype=''
881 db_version_major=''
882 db_version_minor=''
883 db_version_patch=''
884 i_db=''
885 i_dbm=''
886 i_rpcsvcdbm=''
887 d_dirnamlen=''
888 direntrytype=''
889 i_dirent=''
890 i_dld=''
891 i_dlfcn=''
892 i_fcntl=''
893 i_float=''
894 i_fp=''
895 i_fp_class=''
896 i_gdbm=''
897 d_grpasswd=''
898 i_grp=''
899 i_ieeefp=''
900 i_inttypes=''
901 i_langinfo=''
902 i_libutil=''
903 i_limits=''
904 i_locale=''
905 i_machcthr=''
906 i_malloc=''
907 i_mallocmalloc=''
908 i_math=''
909 i_memory=''
910 i_mntent=''
911 d_gdbm_ndbm_h_uses_prototypes=''
912 d_gdbmndbm_h_uses_prototypes=''
913 d_ndbm=''
914 d_ndbm_h_uses_prototypes=''
915 i_gdbm_ndbm=''
916 i_gdbmndbm=''
917 i_ndbm=''
918 i_netdb=''
919 i_neterrno=''
920 i_netinettcp=''
921 i_niin=''
922 i_sysin=''
923 i_poll=''
924 i_prot=''
925 i_pthread=''
926 d_pwage=''
927 d_pwchange=''
928 d_pwclass=''
929 d_pwcomment=''
930 d_pwexpire=''
931 d_pwgecos=''
932 d_pwpasswd=''
933 d_pwquota=''
934 i_pwd=''
935 i_sfio=''
936 i_shadow=''
937 i_socks=''
938 i_stdbool=''
939 i_stddef=''
940 i_stdlib=''
941 i_string=''
942 strings=''
943 i_sunmath=''
944 i_sysaccess=''
945 i_sysdir=''
946 i_sysfile=''
947 d_voidtty=''
948 i_bsdioctl=''
949 i_sysfilio=''
950 i_sysioctl=''
951 i_syssockio=''
952 i_syslog=''
953 i_sysmman=''
954 i_sysmode=''
955 i_sysmount=''
956 i_sysndir=''
957 i_sysparam=''
958 i_syspoll=''
959 i_sysresrc=''
960 i_syssecrt=''
961 i_sysselct=''
962 i_sysstat=''
963 i_sysstatfs=''
964 i_sysstatvfs=''
965 i_systimes=''
966 i_systypes=''
967 i_sysuio=''
968 i_sysun=''
969 i_sysutsname=''
970 i_sysvfs=''
971 i_syswait=''
972 i_sgtty=''
973 i_termio=''
974 i_termios=''
975 d_tm_tm_gmtoff=''
976 d_tm_tm_zone=''
977 i_systime=''
978 i_systimek=''
979 i_time=''
980 timeincl=''
981 i_unistd=''
982 i_ustat=''
983 i_utime=''
984 i_values=''
985 i_stdarg=''
986 i_varargs=''
987 i_varhdr=''
988 i_vfork=''
989 d_inc_version_list=''
990 inc_version_list=''
991 inc_version_list_init=''
992 installprefix=''
993 installprefixexp=''
994 installstyle=''
995 installusrbinperl=''
996 intsize=''
997 longsize=''
998 shortsize=''
999 issymlink=''
1000 libc=''
1001 ldlibpthname=''
1002 libperl=''
1003 shrpenv=''
1004 useshrplib=''
1005 glibpth=''
1006 libpth=''
1007 loclibpth=''
1008 plibpth=''
1009 xlibpth=''
1010 ignore_versioned_solibs=''
1011 libs=''
1012 libsdirs=''
1013 libsfiles=''
1014 libsfound=''
1015 libspath=''
1016 lns=''
1017 d_PRIEUldbl=''
1018 d_PRIFUldbl=''
1019 d_PRIGUldbl=''
1020 d_PRIeldbl=''
1021 d_PRIfldbl=''
1022 d_PRIgldbl=''
1023 d_SCNfldbl=''
1024 sPRIEUldbl=''
1025 sPRIFUldbl=''
1026 sPRIGUldbl=''
1027 sPRIeldbl=''
1028 sPRIfldbl=''
1029 sPRIgldbl=''
1030 sSCNfldbl=''
1031 lseeksize=''
1032 lseektype=''
1033 mad=''
1034 madlyh=''
1035 madlyobj=''
1036 madlysrc=''
1037 make_set_make=''
1038 d_mymalloc=''
1039 freetype=''
1040 mallocobj=''
1041 mallocsrc=''
1042 malloctype=''
1043 usemallocwrap=''
1044 usemymalloc=''
1045 installman1dir=''
1046 man1dir=''
1047 man1direxp=''
1048 man1ext=''
1049 installman3dir=''
1050 man3dir=''
1051 man3direxp=''
1052 man3ext=''
1053 modetype=''
1054 multiarch=''
1055 mydomain=''
1056 myhostname=''
1057 phostname=''
1058 c=''
1059 n=''
1060 d_eofnblk=''
1061 eagain=''
1062 o_nonblock=''
1063 rd_nodata=''
1064 need_va_copy=''
1065 netdb_hlen_type=''
1066 netdb_host_type=''
1067 netdb_name_type=''
1068 netdb_net_type=''
1069 groupcat=''
1070 hostcat=''
1071 passcat=''
1072 orderlib=''
1073 ranlib=''
1074 d_perl_otherlibdirs=''
1075 otherlibdirs=''
1076 package=''
1077 spackage=''
1078 pager=''
1079 api_revision=''
1080 api_subversion=''
1081 api_version=''
1082 api_versionstring=''
1083 patchlevel=''
1084 perl_patchlevel=''
1085 revision=''
1086 subversion=''
1087 version=''
1088 version_patchlevel_string=''
1089 perl5=''
1090 perladmin=''
1091 perlpath=''
1092 d_nv_preserves_uv=''
1093 d_nv_zero_is_allbits_zero=''
1094 i16size=''
1095 i16type=''
1096 i32size=''
1097 i32type=''
1098 i64size=''
1099 i64type=''
1100 i8size=''
1101 i8type=''
1102 ivsize=''
1103 ivtype=''
1104 nv_overflows_integers_at=''
1105 nv_preserves_uv_bits=''
1106 nvsize=''
1107 nvtype=''
1108 u16size=''
1109 u16type=''
1110 u32size=''
1111 u32type=''
1112 u64size=''
1113 u64type=''
1114 u8size=''
1115 u8type=''
1116 uvsize=''
1117 uvtype=''
1118 ivdformat=''
1119 nvEUformat=''
1120 nvFUformat=''
1121 nvGUformat=''
1122 nveformat=''
1123 nvfformat=''
1124 nvgformat=''
1125 uvXUformat=''
1126 uvoformat=''
1127 uvuformat=''
1128 uvxformat=''
1129 pidtype=''
1130 prefix=''
1131 prefixexp=''
1132 installprivlib=''
1133 privlib=''
1134 privlibexp=''
1135 prototype=''
1136 ptrsize=''
1137 d_PRIXU64=''
1138 d_PRId64=''
1139 d_PRIi64=''
1140 d_PRIo64=''
1141 d_PRIu64=''
1142 d_PRIx64=''
1143 sPRIXU64=''
1144 sPRId64=''
1145 sPRIi64=''
1146 sPRIo64=''
1147 sPRIu64=''
1148 sPRIx64=''
1149 d_quad=''
1150 quadkind=''
1151 quadtype=''
1152 uquadtype=''
1153 drand01=''
1154 randbits=''
1155 randfunc=''
1156 randseedtype=''
1157 seedfunc=''
1158 installscript=''
1159 scriptdir=''
1160 scriptdirexp=''
1161 selectminbits=''
1162 selecttype=''
1163 sh=''
1164 sig_count=''
1165 sig_name=''
1166 sig_name_init=''
1167 sig_num=''
1168 sig_num_init=''
1169 sig_size=''
1170 d_sitearch=''
1171 installsitearch=''
1172 sitearch=''
1173 sitearchexp=''
1174 installsitebin=''
1175 sitebin=''
1176 sitebinexp=''
1177 installsitehtml1dir=''
1178 sitehtml1dir=''
1179 sitehtml1direxp=''
1180 installsitehtml3dir=''
1181 sitehtml3dir=''
1182 sitehtml3direxp=''
1183 installsitelib=''
1184 sitelib=''
1185 sitelib_stem=''
1186 sitelibexp=''
1187 installsiteman1dir=''
1188 siteman1dir=''
1189 siteman1direxp=''
1190 installsiteman3dir=''
1191 siteman3dir=''
1192 siteman3direxp=''
1193 siteprefix=''
1194 siteprefixexp=''
1195 installsitescript=''
1196 sitescript=''
1197 sitescriptexp=''
1198 sizesize=''
1199 sizetype=''
1200 so=''
1201 socksizetype=''
1202 sharpbang=''
1203 shsharp=''
1204 spitshell=''
1205 src=''
1206 ssizetype=''
1207 st_ino_sign=''
1208 st_ino_size=''
1209 startperl=''
1210 startsh=''
1211 stdchar=''
1212 d_stdio_stream_array=''
1213 stdio_stream_array=''
1214 sysman=''
1215 sGMTIME_max=''
1216 sGMTIME_min=''
1217 sLOCALTIME_max=''
1218 sLOCALTIME_min=''
1219 trnl=''
1220 uidformat=''
1221 uidsign=''
1222 uidsize=''
1223 uidtype=''
1224 archname64=''
1225 use64bitall=''
1226 use64bitint=''
1227 dtrace=''
1228 usedtrace=''
1229 usefaststdio=''
1230 usekernprocpathname=''
1231 ccflags_uselargefiles=''
1232 ldflags_uselargefiles=''
1233 libswanted_uselargefiles=''
1234 uselargefiles=''
1235 uselongdouble=''
1236 usemorebits=''
1237 usemultiplicity=''
1238 nm_opt=''
1239 nm_so_opt=''
1240 runnm=''
1241 usenm=''
1242 usensgetexecutablepath=''
1243 useperlio=''
1244 usesocks=''
1245 d_oldpthreads=''
1246 use5005threads=''
1247 useithreads=''
1248 usereentrant=''
1249 usethreads=''
1250 incpath=''
1251 mips_type=''
1252 usrinc=''
1253 vaproto=''
1254 d_vendorarch=''
1255 installvendorarch=''
1256 vendorarch=''
1257 vendorarchexp=''
1258 d_vendorbin=''
1259 installvendorbin=''
1260 vendorbin=''
1261 vendorbinexp=''
1262 installvendorhtml1dir=''
1263 vendorhtml1dir=''
1264 vendorhtml1direxp=''
1265 installvendorhtml3dir=''
1266 vendorhtml3dir=''
1267 vendorhtml3direxp=''
1268 d_vendorlib=''
1269 installvendorlib=''
1270 vendorlib=''
1271 vendorlib_stem=''
1272 vendorlibexp=''
1273 installvendorman1dir=''
1274 vendorman1dir=''
1275 vendorman1direxp=''
1276 installvendorman3dir=''
1277 vendorman3dir=''
1278 vendorman3direxp=''
1279 usevendorprefix=''
1280 vendorprefix=''
1281 vendorprefixexp=''
1282 d_vendorscript=''
1283 installvendorscript=''
1284 vendorscript=''
1285 vendorscriptexp=''
1286 versiononly=''
1287 defvoidused=''
1288 voidflags=''
1289 yacc=''
1290 yaccflags=''
1291 CONFIG=''
1292
1293 : Detect odd OSs
1294 define='define'
1295 undef='undef'
1296 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1297 rmlist=''
1298
1299 : We must find out about Eunice early
1300 eunicefix=':'
1301 if test -f /etc/unixtovms; then
1302         eunicefix=/etc/unixtovms
1303 fi
1304 if test -f /etc/unixtovms.exe; then
1305         eunicefix=/etc/unixtovms.exe
1306 fi
1307
1308 : Set executable suffix now -- needed before hints available
1309 if test -f "/libs/version.library"; then
1310 : Amiga OS
1311     _exe=""
1312 elif test -f "/system/gnu_library/bin/ar.pm"; then
1313 : Stratus VOS
1314     _exe=".pm"
1315 elif test -n "$DJGPP"; then
1316 : DOS DJGPP
1317     _exe=".exe"
1318 elif test -d c:/. -o -n "$is_os2" ; then
1319 : OS/2 or cygwin
1320     _exe=".exe"
1321 fi
1322
1323 groupstype=''
1324 i_whoami=''
1325 : Trailing extension.  Override this in a hint file, if needed.
1326 : Extra object files, if any, needed on this platform.
1327 archobjs=''
1328 archname=''
1329 : Possible local include directories to search.
1330 : Set locincpth to "" in a hint file to defeat local include searches.
1331 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1332 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1333 :
1334 : no include file wanted by default
1335 inclwanted=''
1336
1337 : Enable -DEBUGGING and -DDEBUGGING from the command line
1338 EBUGGING=''
1339 DEBUGGING=''
1340
1341 libnames=''
1342 : change the next line if compiling for Xenix/286 on Xenix/386
1343 xlibpth='/usr/lib/386 /lib/386'
1344 : Possible local library directories to search.
1345 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1346 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1347
1348 : general looking path for locating libraries
1349 glibpth="/lib /usr/lib $xlibpth"
1350 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1351 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1352 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1353 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1354
1355 : Private path used by Configure to find libraries.  Its value
1356 : is prepended to libpth. This variable takes care of special
1357 : machines, like the mips.  Usually, it should be empty.
1358 plibpth=''
1359
1360 : default library list
1361 libswanted=''
1362 : some systems want to use only the non-versioned libso:s
1363 ignore_versioned_solibs=''
1364 : set usethreads on the Configure command line to enable threads.
1365 usereentrant='undef'
1366 : full support for void wanted by default
1367 defvoidused=15
1368
1369 ccname=''
1370 ccversion=''
1371 perllibs=''
1372 : set useposix=false in your hint file to disable the POSIX extension.
1373 useposix=true
1374 : set useopcode=false in your hint file to disable the Opcode extension.
1375 useopcode=true
1376 archname64=''
1377 ccflags_uselargefiles=''
1378 ldflags_uselargefiles=''
1379 libswanted_uselargefiles=''
1380 : set usemultiplicity on the Configure command line to enable multiplicity.
1381 : set usesocks on the Configure command line to enable socks.
1382 : List of libraries we want.
1383 : If anyone needs extra -lxxx, put those in a hint file.
1384 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1385 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1386 : We probably want to search /usr/shlib before most other libraries.
1387 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1388 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1389 glibpth="/usr/shlib $glibpth"
1390 : Do not use vfork unless overridden by a hint file.
1391 usevfork=false
1392
1393 : Find the basic shell for Bourne shell scripts
1394 case "$sh" in
1395 '')
1396         case "$SYSTYPE" in
1397         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1398         *) xxx='/bin/sh';;
1399         esac
1400         if test -f "$xxx"; then
1401                 sh="$xxx"
1402         else
1403                 : Build up a list and do a single loop so we can 'break' out.
1404                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1405                 for xxx in sh bash ksh pdksh ash; do
1406                         for p in $pth; do
1407                                 try="$try ${p}/${xxx}"
1408                         done
1409                 done
1410                 for xxx in $try; do
1411                         if test -f "$xxx"; then
1412                                 sh="$xxx";
1413                                 break
1414                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1415                                 sh="$xxx";
1416                                 break
1417                         elif test -f "$xxx.exe"; then
1418                                 sh="$xxx";
1419                                 break
1420                         fi
1421                 done
1422         fi
1423         ;;
1424 esac
1425
1426 case "$sh" in
1427 '')     cat >&2 <<EOM
1428 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1429
1430 Usually it's in /bin/sh.  How did you even get this far?
1431 Please contact me (Perl Maintainers) at perlbug@perl.org and
1432 we'll try to straighten this all out.
1433 EOM
1434         exit 1
1435         ;;
1436 esac
1437
1438 : see if sh knows # comments
1439 if `$sh -c '#' >/dev/null 2>&1`; then
1440         shsharp=true
1441         spitshell=cat
1442         xcat=/bin/cat
1443         test -f $xcat$_exe || xcat=/usr/bin/cat
1444         if test ! -f $xcat$_exe; then
1445                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1446                         if test -f $p/cat$_exe; then
1447                                 xcat=$p/cat
1448                                 break
1449                         fi
1450                 done
1451                 if test ! -f $xcat$_exe; then
1452                         echo "Can't find cat anywhere!"
1453                         exit 1
1454                 fi
1455         fi
1456         echo "#!$xcat" >sharp
1457         $eunicefix sharp
1458         chmod +x sharp
1459         ./sharp > today 2>/dev/null
1460         if test -s today; then
1461                 sharpbang='#!'
1462         else
1463                 echo "#! $xcat" > sharp
1464                 $eunicefix sharp
1465                 chmod +x sharp
1466                 ./sharp > today 2>/dev/null
1467                 if test -s today; then
1468                         sharpbang='#! '
1469                 else
1470                         sharpbang=': use '
1471                 fi
1472         fi
1473 else
1474         echo " "
1475         echo "Your $sh doesn't grok # comments--I will strip them later on."
1476         shsharp=false
1477         cd ..
1478         echo "exec grep -v '^[  ]*#'" >spitshell
1479         chmod +x spitshell
1480         $eunicefix spitshell
1481         spitshell=`pwd`/spitshell
1482         cd UU
1483         echo "I presume that if # doesn't work, #! won't work either!"
1484         sharpbang=': use '
1485 fi
1486 rm -f sharp today
1487
1488 : figure out how to guarantee sh startup
1489 case "$startsh" in
1490 '') startsh=${sharpbang}${sh} ;;
1491 *)
1492 esac
1493 cat >sharp <<EOSS
1494 $startsh
1495 set abc
1496 test "$?abc" != 1
1497 EOSS
1498
1499 chmod +x sharp
1500 $eunicefix sharp
1501 if ./sharp; then
1502         : echo "Yup, it does."
1503 else
1504         echo "Hmm... '$startsh' does not guarantee sh startup..."
1505         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1506 fi
1507 rm -f sharp
1508
1509 : Save command line options in file UU/cmdline.opt for later use in
1510 : generating config.sh.
1511 cat > cmdline.opt <<EOSH
1512 : Configure command line arguments.
1513 config_arg0='$0'
1514 config_args='$*'
1515 config_argc=$#
1516 EOSH
1517 argn=1
1518 args_exp=''
1519 args_sep=''
1520 for arg in "$@"; do
1521         cat >>cmdline.opt <<EOSH
1522 config_arg$argn='$arg'
1523 EOSH
1524         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1525 $arg
1526 EOC
1527         arg_exp=`cat cmdl.opt`
1528         args_exp="$args_exp$args_sep'$arg_exp'"
1529         argn=`expr $argn + 1`
1530         args_sep=' '
1531 done
1532 rm -f cmdl.opt
1533
1534 : produce awk script to parse command line options
1535 cat >options.awk <<'EOF'
1536 BEGIN {
1537         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1538
1539         len = length(optstr);
1540         for (i = 1; i <= len; i++) {
1541                 c = substr(optstr, i, 1);
1542                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1543                 if (a == ":") {
1544                         arg[c] = 1;
1545                         i++;
1546                 }
1547                 opt[c] = 1;
1548         }
1549 }
1550 {
1551         expect = 0;
1552         str = $0;
1553         if (substr(str, 1, 1) != "-") {
1554                 printf("'%s'\n", str);
1555                 next;
1556         }
1557         len = length($0);
1558         for (i = 2; i <= len; i++) {
1559                 c = substr(str, i, 1);
1560                 if (!opt[c]) {
1561                         printf("-%s\n", substr(str, i));
1562                         next;
1563                 }
1564                 printf("-%s\n", c);
1565                 if (arg[c]) {
1566                         if (i < len)
1567                                 printf("'%s'\n", substr(str, i + 1));
1568                         else
1569                                 expect = 1;
1570                         next;
1571                 }
1572         }
1573 }
1574 END {
1575         if (expect)
1576                 print "?";
1577 }
1578 EOF
1579
1580 : process the command line options
1581 set X `for arg in "$@"; do echo "X$arg"; done |
1582         sed -e s/X// | awk -f options.awk`
1583 eval "set $*"
1584 shift
1585 rm -f options.awk
1586
1587 : set up default values
1588 fastread=''
1589 reuseval=false
1590 config_sh=''
1591 alldone=''
1592 error=''
1593 silent=''
1594 extractsh=''
1595 override=''
1596 knowitall=''
1597 rm -f optdef.sh posthint.sh
1598 cat >optdef.sh <<EOS
1599 $startsh
1600 EOS
1601
1602
1603 : option parsing
1604 while test $# -gt 0; do
1605         case "$1" in
1606         -d) shift; fastread=yes;;
1607         -e) shift; alldone=cont;;
1608         -f)
1609                 shift
1610                 cd ..
1611                 if test -r "$1"; then
1612                         config_sh="$1"
1613                 else
1614                         echo "$me: cannot read config file $1." >&2
1615                         error=true
1616                 fi
1617                 cd UU
1618                 shift;;
1619         --help|\
1620         -h) shift; error=true;;
1621         -r) shift; reuseval=true;;
1622         -s) shift; silent=true; realsilent=true;;
1623         -E) shift; alldone=exit;;
1624         -K) shift; knowitall=true;;
1625         -O) shift; override=true;;
1626         -S) shift; silent=true; extractsh=true;;
1627         -D)
1628                 shift
1629                 case "$1" in
1630                 *=)
1631                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1632                         echo "$me: ignoring -D $1" >&2
1633                         ;;
1634                 *=*) echo "$1" | \
1635                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1636                 *) echo "$1='define'" >> optdef.sh;;
1637                 esac
1638                 shift
1639                 ;;
1640         -U)
1641                 shift
1642                 case "$1" in
1643                 *=) echo "$1" >> optdef.sh;;
1644                 *=*)
1645                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1646                         echo "$me: ignoring -U $1" >&2
1647                         ;;
1648                 *) echo "$1='undef'" >> optdef.sh;;
1649                 esac
1650                 shift
1651                 ;;
1652         -A)
1653             shift
1654             xxx=''
1655             yyy="$1"
1656             zzz=''
1657             uuu=undef
1658             case "$yyy" in
1659             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1660                  case "$zzz" in
1661                  *:*) zzz='' ;;
1662                  *)   xxx=append
1663                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1664                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1665                  esac
1666                  ;;
1667             esac
1668             case "$xxx" in
1669             '')  case "$yyy" in
1670                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1671                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1672                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1673                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1674                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1675                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1676                  esac
1677                  ;;
1678             esac
1679             case "$xxx" in
1680             append)
1681                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1682             clear)
1683                 echo "$yyy=''"                  >> posthint.sh ;;
1684             define)
1685                 case "$zzz" in
1686                 '') zzz=define ;;
1687                 esac
1688                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1689             eval)
1690                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1691             prepend)
1692                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1693             undef)
1694                 case "$zzz" in
1695                 '') zzz="$uuu" ;;
1696                 esac
1697                 echo "$yyy=$zzz"                >> posthint.sh ;;
1698             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1699             esac
1700             shift
1701             ;;
1702         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1703             exit 0;;
1704         --) break;;
1705         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1706         *) break;;
1707         esac
1708 done
1709
1710 case "$error" in
1711 true)
1712         cat >&2 <<EOM
1713 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1714                  [-U symbol] [-U symbol=] [-A command:symbol...]
1715   -d : use defaults for all answers.
1716   -e : go on without questioning past the production of config.sh.
1717   -f : specify an alternate default configuration file.
1718   -h : print this help message and exit (with an error status).
1719   -r : reuse C symbols value if possible (skips costly nm extraction).
1720   -s : silent mode, only echoes questions and essential information.
1721   -D : define symbol to have some value:
1722          -D symbol         symbol gets the value 'define'
1723          -D symbol=value   symbol gets the value 'value'
1724        common used examples (see INSTALL for more info):
1725          -Duse64bitint            use 64bit integers
1726          -Duse64bitall            use 64bit integers and pointers
1727          -Dusethreads             use thread support
1728          -Dinc_version_list=none  do not include older perl trees in @INC
1729          -DEBUGGING=none          DEBUGGING options
1730          -Dcc=gcc                 choose your compiler
1731          -Dprefix=/opt/perl5      choose your destination
1732   -E : stop at the end of questions, after having produced config.sh.
1733   -K : do not use unless you know what you are doing.
1734   -O : let -D and -U override definitions from loaded configuration file.
1735   -S : perform variable substitutions on all .SH files (can mix with -f)
1736   -U : undefine symbol:
1737          -U symbol    symbol gets the value 'undef'
1738          -U symbol=   symbol gets completely empty
1739        e.g.:  -Uversiononly
1740   -A : manipulate symbol after the platform specific hints have been applied:
1741          -A append:symbol=value   append value to symbol
1742          -A symbol=value          like append:, but with a separating space
1743          -A define:symbol=value   define symbol to have value
1744          -A clear:symbol          define symbol to be ''
1745          -A define:symbol         define symbol to be 'define'
1746          -A eval:symbol=value     define symbol to be eval of value
1747          -A prepend:symbol=value  prepend value to symbol
1748          -A undef:symbol          define symbol to be 'undef'
1749          -A undef:symbol=         define symbol to be ''
1750        e.g.:  -A prepend:libswanted='cl pthread '
1751               -A ccflags=-DSOME_MACRO
1752   -V : print version number and exit (with a zero status).
1753 EOM
1754         exit 1
1755         ;;
1756 esac
1757
1758 : Sanity checks
1759 case "$fastread$alldone" in
1760 yescont|yesexit) ;;
1761 *)
1762         case "$extractsh" in
1763         true) ;;
1764         *)
1765                 if test ! -t 0; then
1766                         echo "Say 'sh Configure', not 'sh <Configure'"
1767                         exit 1
1768                 fi
1769                 ;;
1770         esac
1771         ;;
1772 esac
1773
1774 exec 4>&1
1775 case "$silent" in
1776 true) exec 1>/dev/null;;
1777 esac
1778
1779 : run the defines and the undefines, if any, but leave the file out there...
1780 touch optdef.sh
1781 . ./optdef.sh
1782 : create the posthint manipulation script and leave the file out there...
1783 touch posthint.sh
1784
1785 : set package name
1786 package='perl5'
1787 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1788 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1789 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1790 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1791 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1792 esac
1793
1794 : Some greps do not return status, grrr.
1795 echo "grimblepritz" >grimble
1796 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1797         contains=contains
1798 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1799         contains=grep
1800 else
1801         contains=contains
1802 fi
1803 rm -f grimble
1804 : the following should work in any shell
1805 case "$contains" in
1806 contains*)
1807         echo " "
1808         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1809         cat >contains <<'EOSS'
1810 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1811 EOSS
1812 chmod +x contains
1813 esac
1814
1815 : Find the path to the source tree
1816 case "$src" in
1817 '') case "$0" in
1818     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1819          case "$src" in
1820          /*)    ;;
1821          .)     ;;
1822          *)     src=`cd ../$src && pwd` ;;
1823          esac
1824          ;;
1825     *)   src='.';;
1826     esac;;
1827 esac
1828 case "$src" in
1829 '')     src=/
1830         rsrc=/
1831         ;;
1832 /*)     rsrc="$src";;
1833 *)      rsrc="../$src";;
1834 esac
1835 if test -f $rsrc/Configure && \
1836         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1837 then
1838    : found it, so we are ok.
1839 else
1840         rsrc=''
1841         for src in . .. ../.. ../../.. ../../../..; do
1842                 if test -f ../$src/Configure && \
1843                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1844                 then
1845                         rsrc=../$src
1846                         break
1847                 fi
1848         done
1849 fi
1850 case "$rsrc" in
1851 '')
1852         cat <<EOM >&4
1853
1854 Sorry, I can't seem to locate the source dir for $package.  Please start
1855 Configure with an explicit path -- i.e. /some/path/Configure.
1856
1857 EOM
1858         exit 1
1859         ;;
1860 ../.)   rsrc='..';;
1861 *)
1862         echo " "
1863         echo "Sources for $package found in \"$src\"." >&4
1864         ;;
1865 esac
1866
1867 : script used to extract .SH files with variable substitutions
1868 cat >extract <<'EOS'
1869 PERL_CONFIG_SH=true
1870 echo "Doing variable substitutions on .SH files..."
1871 if test -f MANIFEST; then
1872         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1873 else
1874         echo "(Looking for .SH files under the source directory.)"
1875         set x `(cd "$src"; find . -name "*.SH" -print)`
1876 fi
1877 shift
1878 case $# in
1879 0) set x `(cd "$src"; echo *.SH)`; shift;;
1880 esac
1881 if test ! -f "$src/$1"; then
1882         shift
1883 fi
1884 mkdir_p='
1885 name=$1;
1886 create="";
1887 while test $name; do
1888         if test ! -d "$name"; then
1889                 create="$name $create";
1890                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1891                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1892         else
1893                 name="";
1894         fi;
1895 done;
1896 for file in $create; do
1897         mkdir $file;
1898 done
1899 '
1900 for file in $*; do
1901         case "$src" in
1902         ".")
1903                 case "$file" in
1904                 */*)
1905                         dir=`expr X$file : 'X\(.*\)/'`
1906                         file=`expr X$file : 'X.*/\(.*\)'`
1907                         (cd "$dir" && . ./$file)
1908                         ;;
1909                 *)
1910                         . ./$file
1911                         ;;
1912                 esac
1913                 ;;
1914         *)
1915                 case "$file" in
1916                 */*)
1917                         dir=`expr X$file : 'X\(.*\)/'`
1918                         file=`expr X$file : 'X.*/\(.*\)'`
1919                         (set x $dir; shift; eval $mkdir_p)
1920                         sh <"$src/$dir/$file"
1921                         ;;
1922                 *)
1923                         sh <"$src/$file"
1924                         ;;
1925                 esac
1926                 ;;
1927         esac
1928 done
1929 if test -f "$src/config_h.SH"; then
1930         if test ! -f config.h; then
1931         : oops, they left it out of MANIFEST, probably, so do it anyway.
1932         . "$src/config_h.SH"
1933         fi
1934 fi
1935 EOS
1936
1937 : extract files and exit if asked to do so
1938 case "$extractsh" in
1939 true)
1940         case "$realsilent" in
1941         true) ;;
1942         *) exec 1>&4;;
1943         esac
1944         case "$config_sh" in
1945         '') config_sh='config.sh';;
1946         esac
1947         echo " "
1948         echo "Fetching answers from $config_sh..."
1949         cd ..
1950         . $config_sh
1951         test "$override" && . ./optdef.sh
1952         echo " "
1953         . UU/extract
1954         rm -rf UU
1955         echo "Extraction done."
1956         exit 0
1957         ;;
1958 esac
1959
1960 : Eunice requires " " instead of "", can you believe it
1961 echo " "
1962 : Here we go...
1963 echo "Beginning of configuration questions for $package."
1964
1965 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1966
1967 : first determine how to suppress newline on echo command
1968 echo " "
1969 echo "Checking echo to see how to suppress newlines..."
1970 (echo "hi there\c" ; echo " ") >.echotmp
1971 if $contains c .echotmp >/dev/null 2>&1 ; then
1972         echo "...using -n."
1973         n='-n'
1974         c=''
1975 else
1976         cat <<'EOM'
1977 ...using \c
1978 EOM
1979         n=''
1980         c='\c'
1981 fi
1982 echo $n "The star should be here-->$c"
1983 echo '*'
1984 rm -f .echotmp
1985
1986 : Now test for existence of everything in MANIFEST
1987 echo " "
1988 if test -f "$rsrc/MANIFEST"; then
1989         echo "First let's make sure your kit is complete.  Checking..." >&4
1990         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1991                 (split -l 50 2>/dev/null || split -50)
1992         rm -f missing
1993         tmppwd=`pwd`
1994         for filelist in x??; do
1995                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1996                         >/dev/null 2>>"$tmppwd/missing")
1997         done
1998         if test -s missing; then
1999                 cat missing >&4
2000                 cat >&4 <<'EOM'
2001
2002 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2003
2004 You have the option of continuing the configuration process, despite the
2005 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2006 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2007 and contact the author (perlbug@perl.org).
2008
2009 EOM
2010                 echo $n "Continue? [n] $c" >&4
2011                 read ans
2012                 case "$ans" in
2013                 y*)
2014                         echo "Continuing..." >&4
2015                         rm -f missing
2016                         ;;
2017                 *)
2018                         echo "ABORTING..." >&4
2019                         kill $$
2020                         ;;
2021                 esac
2022         else
2023                 echo "Looks good..."
2024         fi
2025 else
2026         echo "There is no MANIFEST file.  I hope your kit is complete !"
2027 fi
2028 rm -f missing x??
2029
2030 : Find the appropriate value for a newline for tr
2031 echo " "
2032 if test -n "$DJGPP"; then
2033        trnl='\012'
2034 fi
2035 if test X"$trnl" = X; then
2036         case "`echo foo|tr '\n' x 2>/dev/null`" in
2037         foox) trnl='\n' ;;
2038         esac
2039 fi
2040 if test X"$trnl" = X; then
2041         case "`echo foo|tr '\012' x 2>/dev/null`" in
2042         foox) trnl='\012' ;;
2043         esac
2044 fi
2045 if test X"$trnl" = X; then
2046        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2047        fooxy) trnl='\n\r' ;;
2048        esac
2049 fi
2050 if test X"$trnl" = X; then
2051         cat <<EOM >&2
2052
2053 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2054
2055 EOM
2056         exit 1
2057 fi
2058
2059 : compute the number of columns on the terminal for proper question formatting
2060 case "$COLUMNS" in
2061 '') COLUMNS='80';;
2062 esac
2063
2064 : set up the echo used in my read
2065 myecho="case \"\$xxxm\" in
2066 '') echo $n \"\$rp $c\" >&4;;
2067 *) case \"\$rp\" in
2068         '') echo $n \"[\$xxxm] $c\";;
2069         *)
2070                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2071                         echo \"\$rp\" >&4
2072                         echo $n \"[\$xxxm] $c\" >&4
2073                 else
2074                         echo $n \"\$rp [\$xxxm] $c\" >&4
2075                 fi
2076                 ;;
2077         esac;;
2078 esac"
2079
2080 : now set up to do reads with possible shell escape and default assignment
2081 cat <<EOSC >myread
2082 $startsh
2083 xxxm=\$dflt
2084 $myecho
2085 ans='!'
2086 case "\$fastread" in
2087 yes) case "\$dflt" in
2088         '') ;;
2089         *) ans='';
2090                 case "\$silent-\$rp" in
2091                 true-) ;;
2092                 *) echo " " >&4;;
2093                 esac;;
2094         esac;;
2095 *) case "\$silent" in
2096         true) case "\$rp" in
2097                 '') ans='';;
2098                 esac;;
2099         esac;;
2100 esac
2101 while expr "X\$ans" : "X!" >/dev/null; do
2102         read answ
2103         set x \$xxxm
2104         shift
2105         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2106         case  "\$answ" in
2107         "!")
2108                 sh 1>&4
2109                 echo " "
2110                 $myecho
2111                 ;;
2112         !*)
2113                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2114                 shift
2115                 sh 1>&4 -c "\$*"
2116                 echo " "
2117                 $myecho
2118                 ;;
2119         "\$ans")
2120                 case "\$ans" in
2121                 \\&*)
2122                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2123                         shift
2124                         case "\$1" in
2125                         -d)
2126                                 fastread=yes
2127                                 echo "(OK, I'll run with -d after this question.)" >&4
2128                                 ;;
2129                         -*)
2130                                 echo "*** Sorry, \$1 not supported yet." >&4
2131                                 ;;
2132                         esac
2133                         $myecho
2134                         ans=!
2135                         ;;
2136                 esac;;
2137         *)
2138                 case "\$aok" in
2139                 y)
2140                         echo "*** Substitution done -- please confirm."
2141                         xxxm="\$ans"
2142                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2143                         xxxm="\$ans"
2144                         ans=!
2145                         ;;
2146                 *)
2147                         echo "*** Error -- try again."
2148                         ans=!
2149                         ;;
2150                 esac
2151                 $myecho
2152                 ;;
2153         esac
2154         case "\$ans\$xxxm\$nostick" in
2155         '')
2156                 ans=!
2157                 $myecho
2158                 ;;
2159         esac
2160 done
2161 case "\$ans" in
2162 '') ans="\$xxxm";;
2163 esac
2164 EOSC
2165
2166 : create .config dir to save info across Configure sessions
2167 test -d ../.config || mkdir ../.config
2168 cat >../.config/README <<EOF
2169 This directory created by Configure to save information that should
2170 persist across sessions for $package.
2171
2172 You may safely delete it if you wish.
2173 EOF
2174
2175 : See if we are using a devel version and want that
2176 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2177 case "$usedevel" in
2178 $define|true|[yY]*)
2179     usedevel="$define" ;;
2180 *) case "$xversion" in
2181    *[13579])
2182         cat >&4 <<EOH
2183 *** WHOA THERE!!! ***
2184
2185     This is an UNSTABLE DEVELOPMENT release.
2186     The version of this $package distribution is $xversion, that is, odd,
2187     (as opposed to even) and that signifies a development release.
2188     If you want a maintenance release, you want an even-numbered version.
2189
2190     Do ***NOT*** install this into production use.
2191     Data corruption and crashes are possible.
2192
2193     It is most seriously suggested that you do not continue any further
2194     unless you want to help in developing and debugging Perl.
2195
2196     If you *still* want to build perl, you can answer 'y' now,
2197     or pass -Dusedevel to Configure.
2198
2199 EOH
2200         rp='Do you really want to continue?'
2201         dflt='n'
2202         . ./myread
2203         case "$ans" in
2204         [yY]) echo >&4 "Okay, continuing."
2205               usedevel="$define" ;;
2206         *) echo >&4 "Okay, bye."
2207            exit 1
2208            ;;
2209         esac
2210         ;;
2211     esac
2212     usedevel="$undef"
2213     ;;
2214 esac
2215 case "$usedevel" in
2216 $define|true|[yY]*)
2217         case "$versiononly" in
2218         '') versiononly="$define" ;;
2219         esac
2220         case "$installusrbinperl" in
2221         '') installusrbinperl="$undef" ;;
2222         esac
2223         ;;
2224 esac
2225
2226 : general instructions
2227 needman=true
2228 firsttime=true
2229 user=`(logname) 2>/dev/null`
2230 case "$user" in
2231 '') user=`whoami 2>&1`;;
2232 esac
2233 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2234         firsttime=false
2235         echo " "
2236         rp='Would you like to see the instructions?'
2237         dflt=n
2238         . ./myread
2239         case "$ans" in
2240         [yY]*) ;;
2241         *) needman=false;;
2242         esac
2243 fi
2244 if $needman; then
2245         cat <<EOH
2246
2247 This installation shell script will examine your system and ask you questions
2248 to determine how the perl5 package should be installed. If you get
2249 stuck on a question, you may use a ! shell escape to start a subshell or
2250 execute a command.  Many of the questions will have default answers in square
2251 brackets; typing carriage return will give you the default.
2252
2253 On some of the questions which ask for file or directory names you are allowed
2254 to use the ~name construct to specify the login directory belonging to "name",
2255 even if you don't have a shell which knows about that.  Questions where this is
2256 allowed will be marked "(~name ok)".
2257
2258 EOH
2259         rp=''
2260         dflt='Type carriage return to continue'
2261         . ./myread
2262         cat <<'EOH'
2263
2264 The prompter used in this script allows you to use shell variables and
2265 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2266 in the default answer, as if the default line was a set of arguments given to a
2267 script shell.  This means you may also use $* to repeat the whole default line,
2268 so you do not have to re-type everything to add something to the default.
2269
2270 Every time there is a substitution, you will have to confirm.  If there is an
2271 error (e.g. an unmatched backtick), the default answer will remain unchanged
2272 and you will be prompted again.
2273
2274 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2275 the questions and use the computed defaults (or the previous answers if there
2276 was already a config.sh file). Type 'Configure -h' for a list of options.
2277 You may also start interactively and then answer '& -d' at any prompt to turn
2278 on the non-interactive behaviour for the remainder of the execution.
2279
2280 EOH
2281         . ./myread
2282         cat <<EOH
2283
2284 Much effort has been expended to ensure that this shell script will run on any
2285 Unix system.  If despite that it blows up on yours, your best bet is to edit
2286 Configure and run it again.  If you can't run Configure for some reason,
2287 you'll have to generate a config.sh file by hand.  Whatever problems you
2288 have, let me (perlbug@perl.org) know how I blew it.
2289
2290 This installation script affects things in two ways:
2291
2292 1) it may do direct variable substitutions on some of the files included
2293    in this kit.
2294 2) it builds a config.h file for inclusion in C programs.  You may edit
2295    any of these files as the need arises after running this script.
2296
2297 If you make a mistake on a question, there is no easy way to back up to it
2298 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2299 files.  Configure will offer to let you do this before it runs the SH files.
2300
2301 EOH
2302         dflt='Type carriage return to continue'
2303         . ./myread
2304         case "$firsttime" in
2305         true) echo $user >>../.config/instruct;;
2306         esac
2307 fi
2308
2309 : find out where common programs are
2310 echo " "
2311 echo "Locating common programs..." >&4
2312 cat <<EOSC >loc
2313 $startsh
2314 case \$# in
2315 0) exit 1;;
2316 esac
2317 thing=\$1
2318 shift
2319 dflt=\$1
2320 shift
2321 for dir in \$*; do
2322         case "\$thing" in
2323         .)
2324         if test -d \$dir/\$thing; then
2325                 echo \$dir
2326                 exit 0
2327         fi
2328         ;;
2329         *)
2330         for thisthing in \$dir/\$thing; do
2331                 : just loop through to pick last item
2332         done
2333         if test -f \$thisthing; then
2334                 echo \$thisthing
2335                 exit 0
2336         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2337                 echo \$thisthing
2338                 exit 0
2339         elif test -f \$dir/\$thing.exe; then
2340                 if test -n "$DJGPP"; then
2341                         echo \$dir/\$thing.exe
2342                 elif test "$eunicefix" != ":"; then
2343                         : on Eunice apparently
2344                         echo \$dir/\$thing
2345                 fi
2346                 exit 0
2347         fi
2348         ;;
2349         esac
2350 done
2351 echo \$dflt
2352 exit 1
2353 EOSC
2354 chmod +x loc
2355 $eunicefix loc
2356 loclist="
2357 awk
2358 cat
2359 chmod
2360 comm
2361 cp
2362 echo
2363 expr
2364 grep
2365 ls
2366 mkdir
2367 rm
2368 sed
2369 sort
2370 touch
2371 tr
2372 uniq
2373 "
2374 trylist="
2375 ar
2376 bison
2377 byacc
2378 cpp
2379 csh
2380 date
2381 egrep
2382 gmake
2383 gzip
2384 less
2385 ln
2386 make
2387 more
2388 nm
2389 nroff
2390 perl
2391 pg
2392 test
2393 uname
2394 zip
2395 "
2396 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2397 pth="$pth /lib /usr/lib"
2398 for file in $loclist; do
2399         eval xxx=\$$file
2400         case "$xxx" in
2401         /*|?:[\\/]*)
2402                 if test -f "$xxx"; then
2403                         : ok
2404                 else
2405                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2406                         xxx=`./loc $file $file $pth`
2407                 fi
2408                 ;;
2409         '') xxx=`./loc $file $file $pth`;;
2410         *) xxx=`./loc $xxx $xxx $pth`;;
2411         esac
2412         eval $file=$xxx$_exe
2413         eval _$file=$xxx
2414         case "$xxx" in
2415         /*)
2416                 echo $file is in $xxx.
2417                 ;;
2418         ?:[\\/]*)
2419                 echo $file is in $xxx.
2420                 ;;
2421         *)
2422                 echo "I don't know where '$file' is, and my life depends on it." >&4
2423                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2424                 exit 1
2425                 ;;
2426         esac
2427 done
2428 echo " "
2429 echo "Don't worry if any of the following aren't found..."
2430 say=offhand
2431 for file in $trylist; do
2432         eval xxx=\$$file
2433         case "$xxx" in
2434         /*|?:[\\/]*)
2435                 if test -f "$xxx"; then
2436                         : ok
2437                 else
2438                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2439                         xxx=`./loc $file $file $pth`
2440                 fi
2441                 ;;
2442         '') xxx=`./loc $file $file $pth`;;
2443         *) xxx=`./loc $xxx $xxx $pth`;;
2444         esac
2445         eval $file=$xxx$_exe
2446         eval _$file=$xxx
2447         case "$xxx" in
2448         /*)
2449                 echo $file is in $xxx.
2450                 ;;
2451         ?:[\\/]*)
2452                 echo $file is in $xxx.
2453                 ;;
2454         *)
2455                 echo "I don't see $file out there, $say."
2456                 say=either
2457                 ;;
2458         esac
2459 done
2460 case "$egrep" in
2461 egrep)
2462         echo "Substituting grep for egrep."
2463         egrep=$grep
2464         _egrep=$grep
2465         ;;
2466 esac
2467 case "$less" in
2468 '')     ;;
2469 *)      if $less -R </dev/null >/dev/null; then
2470                echo "Substituting less -R for less."
2471                less="$less -R"
2472                _less=$less
2473         fi
2474         ;;
2475 esac
2476 case "$ln" in
2477 ln)
2478         echo "Substituting cp for ln."
2479         ln=$cp
2480         _ln=$cp
2481         ;;
2482 esac
2483 case "$make" in
2484 make)
2485         case "$gmake" in
2486         gmake)
2487         echo "I can't find make or gmake, and my life depends on it." >&4
2488         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2489         exit 1
2490         ;;
2491         esac
2492         ;;
2493 esac
2494 case "$gmake" in
2495 gmake)  ;;
2496 *)      # We can't have osname yet.
2497         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2498                 # Assume that gmake, if found, is definitely GNU make
2499                 # and prefer it over the system make.
2500                 echo "Substituting gmake for make."
2501                 make=$gmake
2502                 _make=$gmake
2503         fi
2504         ;;
2505 esac
2506 case "$test" in
2507 test)
2508         echo "Hopefully test is built into your sh."
2509         ;;
2510 *)
2511         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2512                 echo "Using the test built into your sh."
2513                 test=test
2514                 _test=test
2515         fi
2516         ;;
2517 esac
2518 case "$echo" in
2519 echo)
2520         echo "Hopefully echo is built into your sh."
2521         ;;
2522 '') ;;
2523 *)
2524         echo " "
2525 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2526         $echo $n "hi there$c" >foo1
2527         echo $n "hi there$c" >foo2
2528         if cmp foo1 foo2 >/dev/null 2>&1; then
2529                 echo "They are compatible.  In fact, they may be identical."
2530         else
2531                 case "$n" in
2532                 '-n') n='' c='\c';;
2533                 *) n='-n' c='';;
2534                 esac
2535                 cat <<FOO
2536 They are not compatible!  You are probably running ksh on a non-USG system.
2537 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2538 have echo built in and we may have to run some Bourne shell scripts.  That
2539 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2540
2541 FOO
2542                 $echo $n "The star should be here-->$c"
2543                 $echo "*"
2544         fi
2545         $rm -f foo1 foo2
2546         ;;
2547 esac
2548
2549 # This question was auctioned at YAPC::Europe-2007 in Vienna
2550 # I never promised you could answer it. I only auctioned the question.
2551 cat <<FOO
2552 The following message is sponsored by
2553
2554   Dresden.pm<--The stars should be here.
2555
2556 Dear Perl user, system administrator or package
2557 maintainer, the Perl community sends greetings to
2558 you. Do you (emblematical) greet back [Y/n]? n
2559
2560 FOO
2561
2562 : Check what type of C compiler we use
2563 cat <<EOS >trygcc
2564 $startsh
2565 EOS
2566 cat <<'EOSC' >>trygcc
2567 case "$cc" in
2568 '') ;;
2569 *)  $rm -f try try.*
2570     $cat >try.c <<EOM
2571 int main(int argc, char *argv[]) {
2572   return 0;
2573 }
2574 EOM
2575     if $cc -o try $ccflags $ldflags try.c; then
2576        :
2577     else
2578         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2579         despair=yes
2580         trygcc=yes
2581         case "$cc" in
2582         *gcc*) trygcc=no ;;
2583         esac
2584         # Skip this test because it gives a false match on output like:
2585         #    ./trygcc: line 23: cc: command not found
2586         # case "`$cc -v -c try.c 2>&1`" in
2587         # *gcc*) trygcc=no ;;
2588         # esac
2589         if $test X"$trygcc" = Xyes; then
2590             if gcc -o try -c try.c; then
2591                 echo " "
2592                 echo "You seem to have a working gcc, though." >&4
2593                 # Switching compilers may undo the work of hints files.
2594                 # The most common problem is -D_REENTRANT for threads.
2595                 # This heuristic catches that case, but gets false positives
2596                 # if -Dusethreads was not actually specified.  Better to
2597                 # bail out here with a useful message than fail 
2598                 # mysteriously later. Should we perhaps just try to
2599                 # re-invoke Configure -Dcc=gcc config_args ?
2600                 if $test -f usethreads.cbu; then
2601                         $cat >&4 <<EOM 
2602
2603 *** However, any setting of the C compiler flags (e.g. for thread support)
2604 *** will be lost.  It may be necessary for you to restart Configure and
2605 *** add -Dcc=gcc to your Configure command line.
2606
2607 EOM
2608                         rp="Would you like to go ahead and try gcc anyway?"
2609                         dflt=n
2610                 else
2611                         rp="Would you like to use it?"
2612                         dflt=y
2613                 fi
2614                 if $test -f myread; then
2615                     . ./myread
2616                 else
2617                     if $test -f UU/myread; then
2618                         . ./UU/myread
2619                     else
2620                         echo "Cannot find myread, sorry.  Aborting." >&2
2621                         exit 1
2622                     fi
2623                 fi  
2624                 case "$ans" in
2625                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2626                 esac
2627             fi
2628         fi
2629     fi
2630     $rm -f try try.*
2631     ;;
2632 esac
2633 EOSC
2634
2635 cat <<EOS >checkcc
2636 $startsh
2637 EOS
2638 cat <<'EOSC' >>checkcc
2639 case "$cc" in        
2640 '') ;;
2641 *)  $rm -f try try.*              
2642     $cat >try.c <<EOM
2643 int main(int argc, char *argv[]) {
2644   return 0;
2645 }
2646 EOM
2647     if $cc -o try $ccflags $ldflags try.c; then
2648        :
2649     else
2650         if $test X"$despair" = Xyes; then
2651            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2652         fi
2653         $cat >&4 <<EOM         
2654 You need to find a working C compiler.
2655 Either (purchase and) install the C compiler supplied by your OS vendor,
2656 or for a free C compiler try http://gcc.gnu.org/
2657 I cannot continue any further, aborting.
2658 EOM
2659         exit 1
2660     fi
2661     $rm -f try try.*
2662     ;;
2663 esac
2664 EOSC
2665
2666 : determine whether symbolic links are supported
2667 echo " "
2668 $touch blurfl
2669 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2670         echo "Symbolic links are supported." >&4
2671         lns="$ln -s"
2672 else
2673         echo "Symbolic links are NOT supported." >&4
2674         lns="$ln"
2675 fi
2676 $rm -f blurfl sym
2677
2678 : determine whether symbolic links are supported
2679 echo " "
2680 case "$lns" in
2681 *"ln"*" -s")
2682         echo "Checking how to test for symbolic links..." >&4
2683         $lns blurfl sym
2684         if $test "X$issymlink" = X; then
2685                 case "$newsh" in
2686                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2687                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2688                 esac
2689                 if test $? = 0; then
2690                         issymlink="test -h"
2691                 else
2692                         echo "Your builtin 'test -h' may be broken." >&4
2693                         case "$test" in
2694                         /*)     ;;
2695                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2696                                 for p in $pth
2697                                 do
2698                                         if test -f "$p/$test"; then
2699                                                 test="$p/$test"
2700                                                 break
2701                                         fi
2702                                 done
2703                                 ;;
2704                         esac
2705                         case "$test" in
2706                         /*)
2707                                 echo "Trying external '$test -h'." >&4
2708                                 issymlink="$test -h"
2709                                 if $test ! -h sym >/dev/null 2>&1; then
2710                                         echo "External '$test -h' is broken, too." >&4
2711                                         issymlink=''
2712                                 fi
2713                                 ;;
2714                         *)      issymlink='' ;;
2715                         esac
2716                 fi
2717         fi
2718         if $test "X$issymlink" = X; then
2719                 if $test -L sym 2>/dev/null; then
2720                         issymlink="$test -L"
2721                         echo "The builtin '$test -L' worked." >&4
2722                 fi
2723         fi
2724         if $test "X$issymlink" != X; then
2725                 echo "You can test for symbolic links with '$issymlink'." >&4
2726         else
2727                 echo "I do not know how you can test for symbolic links." >&4
2728         fi
2729         $rm -f blurfl sym
2730         ;;
2731 *)      echo "No symbolic links, so not testing for their testing..." >&4
2732         ;;
2733 esac
2734 echo " "
2735
2736 : Make symlinks util
2737 case "$mksymlinks" in
2738 $define|true|[yY]*)
2739         case "$src" in
2740         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2741                 exit 1
2742                 ;;
2743         *)      case "$lns:$issymlink" in
2744                 *"ln"*" -s:"*"test -"?)
2745                         echo "Creating the symbolic links..." >&4
2746                         echo "(First creating the subdirectories...)" >&4
2747                         cd ..
2748                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2749                                 read directory
2750                                 test -z "$directory" && break
2751                                 mkdir -p $directory
2752                         done
2753                         # Sanity check 1.
2754                         if test ! -d t/base; then
2755                                 echo "Failed to create the subdirectories.  Aborting." >&4
2756                                 exit 1
2757                         fi
2758                         echo "(Then creating the symlinks...)" >&4
2759                         awk '{print $1}' $src/MANIFEST | while true; do
2760                                 read filename
2761                                 test -z "$filename" && break
2762                                 if test -f $filename; then
2763                                         if $issymlink $filename; then
2764                                                 rm -f $filename
2765                                         fi
2766                                 fi
2767                                 if test -f $filename; then
2768                                         echo "$filename already exists, not symlinking."
2769                                 else
2770                                         ln -s $src/$filename $filename
2771                                 fi
2772                         done
2773                         # Sanity check 2.
2774                         if test ! -f t/base/lex.t; then
2775                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2776                                 exit 1
2777                         fi
2778                         cd UU
2779                         ;;
2780                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2781                         ;;
2782                 esac
2783                 ;;
2784         esac
2785         ;;
2786 esac
2787
2788 : Check for Cross-Compilation
2789 case "$usecrosscompile" in
2790 $define|true|[yY]*)
2791         $echo "Cross-compiling..."
2792         croak=''
2793         case "$cc" in
2794         *-*-gcc) # A cross-compiling gcc, probably.
2795             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2796             ar=$targetarch-ar
2797             # leave out ld, choosing it is more complex
2798             nm=$targetarch-nm
2799             ranlib=$targetarch-ranlib
2800             $echo 'extern int foo;' > try.c
2801             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2802             shift
2803             if $test $# -gt 0; then
2804                 incpth="$incpth $*"
2805                 incpth="`$echo $incpth|$sed 's/^ //'`"
2806                 echo "Guessing incpth '$incpth'." >&4
2807                 for i in $*; do
2808                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2809                     if $test -d $j; then
2810                         libpth="$libpth $j"
2811                     fi
2812                 done   
2813                 libpth="`$echo $libpth|$sed 's/^ //'`"
2814                 echo "Guessing libpth '$libpth'." >&4
2815             fi
2816             $rm -f try.c
2817             ;;
2818         esac
2819         case "$targetarch" in
2820         '') echo "Targetarch not defined." >&4; croak=y ;;
2821         *)  echo "Using targetarch $targetarch." >&4 ;;
2822         esac
2823         case "$incpth" in
2824         '') echo "Incpth not defined." >&4; croak=y ;;
2825         *)  echo "Using incpth '$incpth'." >&4 ;;
2826         esac
2827         case "$libpth" in
2828         '') echo "Libpth not defined." >&4; croak=y ;;
2829         *)  echo "Using libpth '$libpth'." >&4 ;;
2830         esac
2831         case "$usrinc" in
2832         '') for i in $incpth; do
2833                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2834                     usrinc=$i
2835                     echo "Guessing usrinc $usrinc." >&4
2836                     break
2837                 fi
2838             done
2839             case "$usrinc" in
2840             '') echo "Usrinc not defined." >&4; croak=y ;;
2841             esac
2842             ;;
2843         *)  echo "Using usrinc $usrinc." >&4 ;;
2844         esac
2845         case "$targethost" in
2846         '') echo "Targethost not defined." >&4; croak=y ;;
2847         *)  echo "Using targethost $targethost." >&4
2848         esac
2849         locincpth=' '
2850         loclibpth=' '
2851         case "$croak" in
2852         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2853         esac
2854         case "$src" in
2855         /*) run=$src/Cross/run
2856             targetmkdir=$src/Cross/mkdir
2857             to=$src/Cross/to
2858             from=$src/Cross/from
2859             ;;
2860         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2861             run=$pwd/Cross/run
2862             targetmkdir=$pwd/Cross/mkdir
2863             to=$pwd/Cross/to
2864             from=$pwd/Cross/from
2865             ;;
2866         esac
2867         case "$targetrun" in
2868         '') targetrun=ssh ;;
2869         esac
2870         case "$targetto" in
2871         '') targetto=scp ;;
2872         esac
2873         case "$targetfrom" in
2874         '') targetfrom=scp ;;
2875         esac
2876         run=$run-$targetrun
2877         to=$to-$targetto
2878         from=$from-$targetfrom
2879         case "$targetdir" in
2880         '')  targetdir=/tmp
2881              echo "Guessing targetdir $targetdir." >&4
2882              ;;
2883         esac
2884         case "$targetuser" in
2885         '')  targetuser=root
2886              echo "Guessing targetuser $targetuser." >&4
2887              ;;
2888         esac
2889         case "$targetfrom" in
2890         scp)    q=-q ;;
2891         *)      q='' ;;
2892         esac
2893         case "$targetrun" in
2894         ssh|rsh)
2895             cat >$run <<EOF
2896 #!/bin/sh
2897 case "\$1" in
2898 -cwd)
2899   shift
2900   cwd=\$1
2901   shift
2902   ;;
2903 esac
2904 case "\$cwd" in
2905 '') cwd=$targetdir ;;
2906 esac
2907 exe=\$1
2908 shift
2909 if $test ! -f \$exe.xok; then
2910   $to \$exe
2911   $touch \$exe.xok
2912 fi
2913 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2914 EOF
2915             ;;
2916         *)  echo "Unknown targetrun '$targetrun'" >&4
2917             exit 1
2918             ;;
2919         esac
2920         case "$targetmkdir" in
2921         */Cross/mkdir)
2922             cat >$targetmkdir <<EOF
2923 #!/bin/sh
2924 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2925 EOF
2926             $chmod a+rx $targetmkdir
2927             ;;
2928         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2929             exit 1
2930             ;;
2931         esac
2932         case "$targetto" in
2933         scp|rcp)
2934             cat >$to <<EOF
2935 #!/bin/sh
2936 for f in \$@
2937 do
2938   case "\$f" in
2939   /*)
2940     $targetmkdir \`dirname \$f\`
2941     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2942     ;;
2943   *)
2944     $targetmkdir $targetdir/\`dirname \$f\`
2945     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2946     ;;
2947   esac
2948 done
2949 exit 0
2950 EOF
2951             ;;
2952         cp) cat >$to <<EOF
2953 #!/bin/sh
2954 for f in \$@
2955 do
2956   case "\$f" in
2957   /*)
2958     $mkdir -p $targetdir/\`dirname \$f\`
2959     $cp \$f $targetdir/\$f || exit 1
2960     ;;
2961   *)
2962     $targetmkdir $targetdir/\`dirname \$f\`
2963     $cp \$f $targetdir/\$f || exit 1
2964     ;;
2965   esac
2966 done
2967 exit 0
2968 EOF
2969             ;;
2970         *)  echo "Unknown targetto '$targetto'" >&4
2971             exit 1
2972             ;;
2973         esac
2974         case "$targetfrom" in
2975         scp|rcp)
2976           cat >$from <<EOF
2977 #!/bin/sh
2978 for f in \$@
2979 do
2980   $rm -f \$f
2981   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2982 done
2983 exit 0
2984 EOF
2985             ;;
2986         cp) cat >$from <<EOF
2987 #!/bin/sh
2988 for f in \$@
2989 do
2990   $rm -f \$f
2991   cp $targetdir/\$f . || exit 1
2992 done
2993 exit 0
2994 EOF
2995             ;;
2996         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2997             exit 1
2998             ;;
2999         esac
3000         if $test ! -f $run; then
3001             echo "Target 'run' script '$run' not found." >&4
3002         else
3003             $chmod a+rx $run
3004         fi
3005         if $test ! -f $to; then
3006             echo "Target 'to' script '$to' not found." >&4
3007         else
3008             $chmod a+rx $to
3009         fi
3010         if $test ! -f $from; then
3011             echo "Target 'from' script '$from' not found." >&4
3012         else
3013             $chmod a+rx $from
3014         fi
3015         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3016             exit 1
3017         fi
3018         cat >&4 <<EOF
3019 Using '$run' for remote execution,
3020 and '$from' and '$to'
3021 for remote file transfer.
3022 EOF
3023         ;;
3024 *)      run=''
3025         to=:
3026         from=:
3027         usecrosscompile='undef'
3028         targetarch=''
3029         ;;
3030 esac
3031
3032 : see whether [:lower:] and [:upper:] are supported character classes
3033 echo " "
3034 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3035 ABYZ)
3036         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3037         up='[:upper:]'
3038         low='[:lower:]'
3039         ;;
3040 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3041         # (0xd9 and 0xe2), therefore that is a nice testing point.
3042         if test "X$up" = X -o "X$low" = X; then
3043             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3044             rs) up='[A-Z]'
3045                 low='[a-z]'
3046                 ;;
3047             esac
3048         fi
3049         if test "X$up" = X -o "X$low" = X; then
3050             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3051             rs) up='A-Z'
3052                 low='a-z'
3053                 ;;
3054             esac
3055         fi
3056         if test "X$up" = X -o "X$low" = X; then
3057             case "`echo RS | od -x 2>/dev/null`" in
3058             *D9E2*|*d9e2*)
3059                 echo "Hey, this might be EBCDIC." >&4
3060                 if test "X$up" = X -o "X$low" = X; then
3061                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3062                     rs) up='[A-IJ-RS-Z]'
3063                         low='[a-ij-rs-z]'
3064                         ;;
3065                     esac
3066                 fi
3067                 if test "X$up" = X -o "X$low" = X; then
3068                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3069                     rs) up='A-IJ-RS-Z'
3070                         low='a-ij-rs-z'
3071                         ;;
3072                     esac
3073                 fi
3074                 ;;
3075             esac
3076         fi
3077 esac
3078 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3079 rs)
3080     echo "Using $up and $low to convert case." >&4
3081     ;;
3082 *)
3083     echo "I don't know how to translate letters from upper to lower case." >&4
3084     echo "Your tr is not acting any way I know of." >&4
3085     exit 1
3086     ;;
3087 esac
3088 : set up the translation script tr, must be called with ./tr of course
3089 cat >tr <<EOSC
3090 $startsh
3091 case "\$1\$2" in
3092 '[A-Z][a-z]') exec $tr '$up' '$low';;
3093 '[a-z][A-Z]') exec $tr '$low' '$up';;
3094 esac
3095 exec $tr "\$@"
3096 EOSC
3097 chmod +x tr
3098 $eunicefix tr
3099
3100 : Try to determine whether config.sh was made on this system
3101 case "$config_sh" in
3102 '')
3103 myuname=`$uname -a 2>/dev/null`
3104 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3105 # Downcase everything to avoid ambiguity.
3106 # Remove slashes and single quotes so we can use parts of this in
3107 # directory and file names.
3108 # Remove newlines so myuname is sane to use elsewhere.
3109 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3110 # because the A-Z/a-z are not consecutive.
3111 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3112         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3113 newmyuname="$myuname"
3114 dflt=n
3115 case "$knowitall" in
3116 '')
3117         if test -f ../config.sh; then
3118                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3119                         eval "`grep myuname= ../config.sh`"
3120                 fi
3121                 if test "X$myuname" = "X$newmyuname"; then
3122                         dflt=y
3123                 fi
3124         fi
3125         ;;
3126 *) dflt=y;;
3127 esac
3128
3129 : Get old answers from old config file if Configure was run on the
3130 : same system, otherwise use the hints.
3131 hint=default
3132 cd ..
3133 if test -f config.sh; then
3134         echo " "
3135         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3136         . UU/myread
3137         case "$ans" in
3138         n*|N*) echo "OK, I'll ignore it."
3139                 mv config.sh config.sh.old
3140                 myuname="$newmyuname"
3141                 ;;
3142         *)  echo "Fetching default answers from your old config.sh file..." >&4
3143                 tmp_n="$n"
3144                 tmp_c="$c"
3145                 tmp_sh="$sh"
3146                 . ./config.sh
3147                 cp config.sh UU
3148                 n="$tmp_n"
3149                 c="$tmp_c"
3150                 : Older versions did not always set $sh.  Catch re-use of such
3151                 : an old config.sh.
3152                 case "$sh" in
3153                 '') sh="$tmp_sh" ;;
3154                 esac
3155                 hint=previous
3156                 ;;
3157         esac
3158 fi
3159 . ./UU/checkcc
3160 if test ! -f config.sh; then
3161         $cat <<EOM
3162
3163 First time through, eh?  I have some defaults handy for some systems
3164 that need some extra help getting the Configure answers right:
3165
3166 EOM
3167         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3168         dflt=''
3169         : Half the following guesses are probably wrong... If you have better
3170         : tests or hints, please send them to perlbug@perl.org
3171         : The metaconfig authors would also appreciate a copy...
3172         $test -f /irix && osname=irix
3173         $test -f /xenix && osname=sco_xenix
3174         $test -f /dynix && osname=dynix
3175         $test -f /dnix && osname=dnix
3176         $test -f /lynx.os && osname=lynxos
3177         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3178         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3179         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3180         $test -f /bin/mips && /bin/mips && osname=mips
3181         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3182                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3183         $test -d /usr/apollo/bin && osname=apollo
3184         $test -f /etc/saf/_sactab && osname=svr4
3185         $test -d /usr/include/minix && osname=minix
3186         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3187         if $test -d /MachTen -o -d /MachTen_Folder; then
3188                 osname=machten
3189                 if $test -x /sbin/version; then
3190                         osvers=`/sbin/version | $awk '{print $2}' |
3191                         $sed -e 's/[A-Za-z]$//'`
3192                 elif $test -x /usr/etc/version; then
3193                         osvers=`/usr/etc/version | $awk '{print $2}' |
3194                         $sed -e 's/[A-Za-z]$//'`
3195                 else
3196                         osvers="$2.$3"
3197                 fi
3198         fi
3199
3200         $test -f /sys/posix.dll &&
3201                 $test -f /usr/bin/what &&
3202                 set X `/usr/bin/what /sys/posix.dll` &&
3203                 $test "$3" = UWIN &&
3204                 osname=uwin &&
3205                 osvers="$5"
3206
3207         if $test -f $uname; then
3208                 set X $myuname
3209                 shift
3210
3211                 case "$5" in
3212                 fps*) osname=fps ;;
3213                 mips*)
3214                         case "$4" in
3215                         umips) osname=umips ;;
3216                         *) osname=mips ;;
3217                         esac;;
3218                 [23]100) osname=mips ;;
3219                 next*) osname=next ;;
3220                 i386*)
3221                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3222                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3223                                 osname='sco'
3224                                 osvers=$tmp
3225                         elif $test -f /etc/kconfig; then
3226                                 osname=isc
3227                                 if test "$lns" = "$ln -s"; then
3228                                         osvers=4
3229                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3230                                         osvers=3
3231                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3232                                         osvers=2
3233                                 fi
3234                         fi
3235                         tmp=''
3236                         ;;
3237                 pc*)
3238                         if test -n "$DJGPP"; then
3239                                 osname=dos
3240                                 osvers=djgpp
3241                         fi
3242                         ;;
3243                 esac
3244
3245                 case "$1" in
3246                 aix) osname=aix
3247                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3248                         case "$tmp" in
3249                         # oslevel can fail with:
3250                         # oslevel: Unable to acquire lock.
3251                         *not\ found) osvers="$4"."$3" ;;
3252                         '<3240'|'<>3240') osvers=3.2.0 ;;
3253                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3254                         '=3250'|'>3250') osvers=3.2.5 ;;
3255                         *) osvers=$tmp;;
3256                         esac
3257                         ;;
3258                 bsd386) osname=bsd386
3259                         osvers=`$uname -r`
3260                         ;;
3261                 cygwin*) osname=cygwin
3262                         osvers="$3"
3263                         ;;
3264                 *dc.osx) osname=dcosx
3265                         osvers="$3"
3266                         ;;
3267                 dnix) osname=dnix
3268                         osvers="$3"
3269                         ;;
3270                 domainos) osname=apollo
3271                         osvers="$3"
3272                         ;;
3273                 dgux)   osname=dgux
3274                         osvers="$3"
3275                         ;;
3276                 dragonfly) osname=dragonfly
3277                         osvers="$3"
3278                         ;;
3279                 dynixptx*) osname=dynixptx
3280                         osvers=`echo "$4"|sed 's/^v//'`
3281                         ;;
3282                 freebsd) osname=freebsd
3283                         osvers="$3" ;;
3284                 genix)  osname=genix ;;
3285                 gnu)    osname=gnu
3286                         osvers="$3" ;;
3287                 hp*)    osname=hpux
3288                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3289                         ;;
3290                 irix*)  osname=irix
3291                         case "$3" in
3292                         4*) osvers=4 ;;
3293                         5*) osvers=5 ;;
3294                         *)      osvers="$3" ;;
3295                         esac
3296                         ;;
3297                 linux)  osname=linux
3298                         case "$3" in
3299                         *)      osvers="$3" ;;
3300                         esac
3301                         ;;
3302                 MiNT)   osname=mint
3303                         ;;
3304                 netbsd*) osname=netbsd
3305                         osvers="$3"
3306                         ;;
3307                 news-os) osvers="$3"
3308                         case "$3" in
3309                         4*) osname=newsos4 ;;
3310                         *) osname=newsos ;;
3311                         esac
3312                         ;;
3313                 next*) osname=next ;;
3314                 nonstop-ux) osname=nonstopux ;;
3315                 openbsd) osname=openbsd
3316                         osvers="$3"
3317                         ;;
3318                 os2)    osname=os2
3319                         osvers="$4"
3320                         ;;
3321                 POSIX-BC | posix-bc ) osname=posix-bc
3322                         osvers="$3"
3323                         ;;
3324                 powerux | power_ux | powermax_os | powermaxos | \
3325                 powerunix | power_unix) osname=powerux
3326                         osvers="$3"
3327                         ;;
3328                 qnx) osname=qnx
3329                         osvers="$4"
3330                         ;;
3331                 solaris) osname=solaris
3332                         case "$3" in
3333                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3334                         *)      osvers="$3" ;;
3335                         esac
3336                         ;;
3337                 sunos) osname=sunos
3338                         case "$3" in
3339                         5*) osname=solaris
3340                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3341                         *)      osvers="$3" ;;
3342                         esac
3343                         ;;
3344                 titanos) osname=titanos
3345                         case "$3" in
3346                         1*) osvers=1 ;;
3347                         2*) osvers=2 ;;
3348                         3*) osvers=3 ;;
3349                         4*) osvers=4 ;;
3350                         *)      osvers="$3" ;;
3351                         esac
3352                         ;;
3353                 ultrix) osname=ultrix
3354                         osvers="$3"
3355                         ;;
3356                 osf1|mls+)      case "$5" in
3357                                 alpha)
3358                                         osname=dec_osf
3359                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3360                                         case "$osvers" in
3361                                         [1-9].[0-9]*) ;;
3362                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3363                                         esac
3364                                         ;;
3365                         hp*)    osname=hp_osf1  ;;
3366                         mips)   osname=mips_osf1 ;;
3367                         esac
3368                         ;;
3369                 # UnixWare 7.1.2 is known as Open UNIX 8
3370                 openunix|unixware) osname=svr5
3371                         osvers="$4"
3372                         ;;
3373                 uts)    osname=uts
3374                         osvers="$3"
3375                         ;;
3376                 vos) osvers="$3"
3377                         ;;
3378                 $2) case "$osname" in
3379                         *isc*) ;;
3380                         *freebsd*) ;;
3381                         svr*)
3382                                 : svr4.x or possibly later
3383                                 case "svr$3" in
3384                                 ${osname}*)
3385                                         osname=svr$3
3386                                         osvers=$4
3387                                         ;;
3388                                 esac
3389                                 case "$osname" in
3390                                 svr4.0)
3391                                         : Check for ESIX
3392                                         if test -f /stand/boot ; then
3393                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3394                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3395                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3396                                                         if test -n "$isesix"; then
3397                                                                 osname=esix4
3398                                                         fi
3399                                                 fi
3400                                         fi
3401                                         ;;
3402                                 esac
3403                                 ;;
3404                         *)      if test -f /etc/systemid; then
3405                                         osname=sco
3406                                         set `echo $3 | $sed 's/\./ /g'` $4
3407                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3408                                                 osvers=$1.$2.$3
3409                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3410                                                 osvers=$1.$2
3411                                         elif $test -f $src/hints/sco_$1.sh; then
3412                                                 osvers=$1
3413                                         fi
3414                                 else
3415                                         case "$osname" in
3416                                         '') : Still unknown.  Probably a generic Sys V.
3417                                                 osname="sysv"
3418                                                 osvers="$3"
3419                                                 ;;
3420                                         esac
3421                                 fi
3422                                 ;;
3423                         esac
3424                         ;;
3425                 *)      case "$osname" in
3426                         '') : Still unknown.  Probably a generic BSD.
3427                                 osname="$1"
3428                                 osvers="$3"
3429                                 ;;
3430                         esac
3431                         ;;
3432                 esac
3433         else
3434                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3435                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3436                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3437                                 osname=news_os
3438                         fi
3439                         $rm -f UU/kernel.what
3440                 elif test -d c:/. -o -n "$is_os2" ; then
3441                         set X $myuname
3442                         osname=os2
3443                         osvers="$5"
3444                 fi
3445         fi
3446
3447         case "$targetarch" in
3448         '') ;;
3449         *)  hostarch=$osname
3450             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3451             osvers=''
3452             ;;
3453         esac
3454
3455         : Now look for a hint file osname_osvers, unless one has been
3456         : specified already.
3457         case "$hintfile" in
3458         ''|' ')
3459                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3460                 : Also try without trailing minor version numbers.
3461                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3462                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3463                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3464                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3465                 case "$file" in
3466                 '') dflt=none ;;
3467                 *)  case "$osvers" in
3468                         '') dflt=$file
3469                                 ;;
3470                         *)  if $test -f $src/hints/$file.sh ; then
3471                                         dflt=$file
3472                                 elif $test -f $src/hints/$xfile.sh ; then
3473                                         dflt=$xfile
3474                                 elif $test -f $src/hints/$xxfile.sh ; then
3475                                         dflt=$xxfile
3476                                 elif $test -f $src/hints/$xxxfile.sh ; then
3477                                         dflt=$xxxfile
3478                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3479                                         dflt=$xxxxfile
3480                                 elif $test -f "$src/hints/${osname}.sh" ; then
3481                                         dflt="${osname}"
3482                                 else
3483                                         dflt=none
3484                                 fi
3485                                 ;;
3486                         esac
3487                         ;;
3488                 esac
3489                 if $test -f Policy.sh ; then
3490                         case "$dflt" in
3491                         *Policy*) ;;
3492                         none) dflt="Policy" ;;
3493                         *) dflt="Policy $dflt" ;;
3494                         esac
3495                 fi
3496                 ;;
3497         *)
3498                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3499                 ;;
3500         esac
3501
3502         if $test -f Policy.sh ; then
3503                 $cat <<EOM
3504
3505 There's also a Policy hint file available, which should make the
3506 site-specific (policy) questions easier to answer.
3507 EOM
3508
3509         fi
3510
3511         $cat <<EOM
3512
3513 You may give one or more space-separated answers, or "none" if appropriate.
3514 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3515 previous run of Configure, you may specify it as well as or instead of
3516 OS-specific hints.  If hints are provided for your OS, you should use them:
3517 although Perl can probably be built without hints on many platforms, using
3518 hints often improve performance and may enable features that Configure can't
3519 set up on its own. If there are no hints that match your OS, specify "none";
3520 DO NOT give a wrong version or a wrong OS.
3521
3522 EOM
3523
3524         rp="Which of these apply, if any?"
3525         . UU/myread
3526         tans=$ans
3527         for file in $tans; do
3528                 if $test X$file = XPolicy -a -f Policy.sh; then
3529                         . Policy.sh
3530                         $cat Policy.sh >> UU/config.sh
3531                 elif $test -f $src/hints/$file.sh; then
3532                         . $src/hints/$file.sh
3533                         $cat $src/hints/$file.sh >> UU/config.sh
3534                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3535                         : nothing
3536                 else
3537                         : Give one chance to correct a possible typo.
3538                         echo "$file.sh does not exist"
3539                         dflt=$file
3540                         rp="hint to use instead?"
3541                         . UU/myread
3542                         for file in $ans; do
3543                                 if $test -f "$src/hints/$file.sh"; then
3544                                         . $src/hints/$file.sh
3545                                         $cat $src/hints/$file.sh >> UU/config.sh
3546                                 elif $test X$ans = X -o X$ans = Xnone ; then
3547                                         : nothing
3548                                 else
3549                                         echo "$file.sh does not exist -- ignored."
3550                                 fi
3551                         done
3552                 fi
3553         done
3554
3555         hint=recommended
3556         : Remember our hint file for later.
3557         if $test -f "$src/hints/$file.sh" ; then
3558                 hintfile="$file"
3559         else
3560                 hintfile=''
3561         fi
3562 fi
3563 cd UU
3564 ;;
3565 *)
3566         echo " "
3567         echo "Fetching default answers from $config_sh..." >&4
3568         tmp_n="$n"
3569         tmp_c="$c"
3570         cd ..
3571         cp $config_sh config.sh 2>/dev/null
3572         chmod +w config.sh
3573         . ./config.sh
3574         cd UU
3575         cp ../config.sh .
3576         n="$tmp_n"
3577         c="$tmp_c"
3578         hint=previous
3579         ;;
3580 esac
3581 test "$override" && . ./optdef.sh
3582
3583 : Restore computed paths
3584 for file in $loclist $trylist; do
3585         eval $file="\$_$file"
3586 done
3587
3588 cat << EOM
3589
3590 Configure uses the operating system name and version to set some defaults.
3591 The default value is probably right if the name rings a bell. Otherwise,
3592 since spelling matters for me, either accept the default or answer "none"
3593 to leave it blank.
3594
3595 EOM
3596 case "$osname" in
3597         ''|' ')
3598                 case "$hintfile" in
3599                 ''|' '|none) dflt=none ;;
3600                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3601                 esac
3602                 ;;
3603         *) dflt="$osname" ;;
3604 esac
3605 rp="Operating system name?"
3606 . ./myread
3607 case "$ans" in
3608 none)  osname='' ;;
3609 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3610 esac
3611 echo " "
3612 case "$osvers" in
3613         ''|' ')
3614                 case "$hintfile" in
3615                 ''|' '|none) dflt=none ;;
3616                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3617                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3618                         case "$dflt" in
3619                         ''|' ') dflt=none ;;
3620                         esac
3621                         ;;
3622                 esac
3623                 ;;
3624         *) dflt="$osvers" ;;
3625 esac
3626 rp="Operating system version?"
3627 . ./myread
3628 case "$ans" in
3629 none)  osvers='' ;;
3630 *) osvers="$ans" ;;
3631 esac
3632
3633
3634 . ./posthint.sh
3635
3636 : who configured the system
3637 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3638 case "$cf_by" in
3639 "")
3640         cf_by=`(logname) 2>/dev/null`
3641         case "$cf_by" in
3642         "")
3643                 cf_by=`(whoami) 2>/dev/null`
3644                 case "$cf_by" in
3645                 "") cf_by=unknown ;;
3646                 esac ;;
3647         esac ;;
3648 esac
3649
3650 : decide how portable to be.  Allow command line overrides.
3651 case "$d_portable" in
3652 "$undef") ;;
3653 *)      d_portable="$define" ;;
3654 esac
3655
3656 : set up shell script to do ~ expansion
3657 cat >filexp <<EOSS
3658 $startsh
3659 : expand filename
3660 case "\$1" in
3661  \~/*|\~)
3662         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3663         ;;
3664  \~*)
3665         if $test -f /bin/csh; then
3666                 /bin/csh -f -c "glob \$1"
3667                 failed=\$?
3668                 echo ""
3669                 exit \$failed
3670         else
3671                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3672                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3673                 if $test ! -d "\$dir"; then
3674                         me=\`basename \$0\`
3675                         echo "\$me: can't locate home directory for: \$name" >&2
3676                         exit 1
3677                 fi
3678                 case "\$1" in
3679                 */*)
3680                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3681                         ;;
3682                 *)
3683                         echo \$dir
3684                         ;;
3685                 esac
3686         fi
3687         ;;
3688 *)
3689         echo \$1
3690         ;;
3691 esac
3692 EOSS
3693 chmod +x filexp
3694 $eunicefix filexp
3695
3696 : now set up to get a file name
3697 cat <<EOS >getfile
3698 $startsh
3699 EOS
3700 cat <<'EOSC' >>getfile
3701 tilde=''
3702 fullpath=''
3703 already=''
3704 skip=''
3705 none_ok=''
3706 exp_file=''
3707 nopath_ok=''
3708 orig_rp="$rp"
3709 orig_dflt="$dflt"
3710 case "$gfpth" in
3711 '') gfpth='.' ;;
3712 esac
3713
3714 case "$fn" in
3715 *\(*)
3716         : getfile will accept an answer from the comma-separated list
3717         : enclosed in parentheses even if it does not meet other criteria.
3718         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3719         fn=`echo $fn | sed 's/(.*)//'`
3720         ;;
3721 esac
3722
3723 case "$fn" in
3724 *:*)
3725         loc_file=`expr $fn : '.*:\(.*\)'`
3726         fn=`expr $fn : '\(.*\):.*'`
3727         ;;
3728 esac
3729
3730 case "$fn" in
3731 *~*) tilde=true;;
3732 esac
3733 case "$fn" in
3734 */*) fullpath=true;;
3735 esac
3736 case "$fn" in
3737 *+*) skip=true;;
3738 esac
3739 case "$fn" in
3740 *n*) none_ok=true;;
3741 esac
3742 case "$fn" in
3743 *e*) exp_file=true;;
3744 esac
3745 case "$fn" in
3746 *p*) nopath_ok=true;;
3747 esac
3748
3749 case "$fn" in
3750 *f*) type='File';;
3751 *d*) type='Directory';;
3752 *l*) type='Locate';;
3753 esac
3754
3755 what="$type"
3756 case "$what" in
3757 Locate) what='File';;
3758 esac
3759
3760 case "$exp_file" in
3761 '')
3762         case "$d_portable" in
3763         "$define") ;;
3764         *) exp_file=true;;
3765         esac
3766         ;;
3767 esac
3768
3769 cd ..
3770 while test "$type"; do
3771         redo=''
3772         rp="$orig_rp"
3773         dflt="$orig_dflt"
3774         case "$tilde" in
3775         true) rp="$rp (~name ok)";;
3776         esac
3777         . UU/myread
3778         if test -f UU/getfile.ok && \
3779                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3780         then
3781                 value="$ans"
3782                 ansexp="$ans"
3783                 break
3784         fi
3785         case "$ans" in
3786         none)
3787                 value=''
3788                 ansexp=''
3789                 case "$none_ok" in
3790                 true) type='';;
3791                 esac
3792                 ;;
3793         *)
3794                 case "$tilde" in
3795                 '') value="$ans"
3796                         ansexp="$ans";;
3797                 *)
3798                         value=`UU/filexp $ans`
3799                         case $? in
3800                         0)
3801                                 if test "$ans" != "$value"; then
3802                                         echo "(That expands to $value on this system.)"
3803                                 fi
3804                                 ;;
3805                         *) value="$ans";;
3806                         esac
3807                         ansexp="$value"
3808                         case "$exp_file" in
3809                         '') value="$ans";;
3810                         esac
3811                         ;;
3812                 esac
3813                 case "$fullpath" in
3814                 true)
3815                         case "$ansexp" in
3816                         /*) value="$ansexp" ;;
3817                         [a-zA-Z]:/*) value="$ansexp" ;;
3818                         *)
3819                                 redo=true
3820                                 case "$already" in
3821                                 true)
3822                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3823                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3824                                         ;;
3825                                 *)
3826                                 echo "Please give a full path name, starting with slash." >&4
3827                                         case "$tilde" in
3828                                         true)
3829                                 echo "Note that using ~name is ok provided it expands well." >&4
3830                                                 already=true
3831                                                 ;;
3832                                         esac
3833                                 esac
3834                                 ;;
3835                         esac
3836                         ;;
3837                 esac
3838                 case "$redo" in
3839                 '')
3840                         case "$type" in
3841                         File)
3842                                 for fp in $gfpth; do
3843                                         if test "X$fp" = X.; then
3844                                             pf="$ansexp"
3845                                         else    
3846                                             pf="$fp/$ansexp"
3847                                         fi
3848                                         if test -f "$pf"; then
3849                                                 type=''
3850                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3851                                         then
3852                                                 echo "($value is not a plain file, but that's ok.)"
3853                                                 type=''
3854                                         fi
3855                                         if test X"$type" = X; then
3856                                             value="$pf"
3857                                             break
3858                                         fi
3859                                 done
3860                                 ;;
3861                         Directory)
3862                                 for fp in $gfpth; do
3863                                         if test "X$fp" = X.; then
3864                                             dir="$ans"
3865                                             direxp="$ansexp"
3866                                         else    
3867                                             dir="$fp/$ansexp"
3868                                             direxp="$fp/$ansexp"
3869                                         fi
3870                                         if test -d "$direxp"; then
3871                                                 type=''
3872                                                 value="$dir"
3873                                                 break
3874                                         fi
3875                                 done
3876                                 ;;
3877                         Locate)
3878                                 if test -d "$ansexp"; then
3879                                         echo "(Looking for $loc_file in directory $value.)"
3880                                         value="$value/$loc_file"
3881                                         ansexp="$ansexp/$loc_file"
3882                                 fi
3883                                 if test -f "$ansexp"; then
3884                                         type=''
3885                                 fi
3886                                 case "$nopath_ok" in
3887                                 true)   case "$value" in
3888                                         */*) ;;
3889                                         *)      echo "Assuming $value will be in people's path."
3890                                                 type=''
3891                                                 ;;
3892                                         esac
3893                                         ;;
3894                                 esac
3895                                 ;;
3896                         esac
3897
3898                         case "$skip" in
3899                         true) type='';
3900                         esac
3901
3902                         case "$type" in
3903                         '') ;;
3904                         *)
3905                                 if test "$fastread" = yes; then
3906                                         dflt=y
3907                                 else
3908                                         dflt=n
3909                                 fi
3910                                 rp="$what $value doesn't exist.  Use that name anyway?"
3911                                 . UU/myread
3912                                 dflt=''
3913                                 case "$ans" in
3914                                 y*) type='';;
3915                                 *) echo " ";;
3916                                 esac
3917                                 ;;
3918                         esac
3919                         ;;
3920                 esac
3921                 ;;
3922         esac
3923 done
3924 cd UU
3925 ans="$value"
3926 rp="$orig_rp"
3927 dflt="$orig_dflt"
3928 rm -f getfile.ok
3929 test "X$gfpthkeep" != Xy && gfpth=""
3930 EOSC
3931
3932 : determine root of directory hierarchy where package will be installed.
3933 case "$prefix" in
3934 '')
3935         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3936         ;;
3937 *?/)
3938         dflt=`echo "$prefix" | sed 's/.$//'`
3939         ;;
3940 *)
3941         dflt="$prefix"
3942         ;;
3943 esac
3944 $cat <<EOM
3945
3946 By default, $package will be installed in $dflt/bin, manual pages
3947 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3948 installation directories. Typically this is something like /usr/local.
3949 If you wish to have binaries under /usr/bin but other parts of the
3950 installation under /usr/local, that's ok: you will be prompted
3951 separately for each of the installation directories, the prefix being
3952 only used to set the defaults.
3953
3954 EOM
3955 fn=d~
3956 rp='Installation prefix to use?'
3957 . ./getfile
3958 oldprefix=''
3959 case "$prefix" in
3960 '') ;;
3961 *)
3962         case "$ans" in
3963         "$prefix") ;;
3964         *) oldprefix="$prefix";;
3965         esac
3966         ;;
3967 esac
3968 prefix="$ans"
3969 prefixexp="$ansexp"
3970
3971 : allow them to override the AFS root
3972 case "$afsroot" in
3973 '')     afsroot=/afs ;;
3974 *)      afsroot=$afsroot ;;
3975 esac
3976
3977 : is AFS running?
3978 echo " "
3979 case "$afs" in
3980 $define|true)   afs=true ;;
3981 $undef|false)   afs=false ;;
3982 *)      if $test -d $afsroot; then
3983                 afs=true
3984         else
3985                 afs=false
3986         fi
3987         ;;
3988 esac
3989 if $afs; then
3990         echo "AFS may be running... I'll be extra cautious then..." >&4
3991 else
3992         echo "AFS does not seem to be running..." >&4
3993 fi
3994
3995 : determine installation prefix for where package is to be installed.
3996 if $afs; then
3997 $cat <<EOM
3998
3999 Since you are running AFS, I need to distinguish the directory in which
4000 files will reside from the directory in which they are installed (and from
4001 which they are presumably copied to the former directory by occult means).
4002
4003 EOM
4004         case "$installprefix" in
4005         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4006         *) dflt="$installprefix";;
4007         esac
4008 else
4009 $cat <<EOM
4010
4011 In some special cases, particularly when building $package for distribution,
4012 it is convenient to distinguish the directory in which files should be
4013 installed from the directory ($prefix) in which they will
4014 eventually reside.  For most users, these two directories are the same.
4015
4016 EOM
4017         case "$installprefix" in
4018         '') dflt=$prefix ;;
4019         *) dflt=$installprefix;;
4020         esac
4021 fi
4022 fn=d~
4023 rp='What installation prefix should I use for installing files?'
4024 . ./getfile
4025 installprefix="$ans"
4026 installprefixexp="$ansexp"
4027
4028 : Perform the prefixexp/installprefixexp correction if necessary
4029 cat <<EOS >installprefix
4030 $startsh
4031 EOS
4032 cat <<'EOSC' >>installprefix
4033 : Change installation prefix, if necessary.
4034 if $test X"$prefix" != X"$installprefix"; then
4035     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4036 else
4037     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4038 fi
4039 EOSC
4040 chmod +x installprefix
4041 $eunicefix installprefix
4042
4043 : Set variables such as privlib and privlibexp from the output of ./getfile
4044 : performing the prefixexp/installprefixexp correction if necessary.
4045 cat <<EOS >setprefixvar
4046 $startsh
4047 EOS
4048 cat <<'EOSC' >>setprefixvar
4049 eval "${prefixvar}=\"\$ans\""
4050 eval "${prefixvar}exp=\"\$ansexp\""
4051 . ./installprefix
4052 EOSC
4053 chmod +x setprefixvar
4054 $eunicefix setprefixvar
4055
4056 : set up the script used to warn in case of inconsistency
4057 cat <<EOS >whoa
4058 $startsh
4059 EOS
4060 cat <<'EOSC' >>whoa
4061 dflt=y
4062 case "$hint" in
4063     recommended)
4064         case "$hintfile" in
4065         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4066                 ;;
4067         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4068                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4069                 ;;
4070         esac
4071         ;;
4072     *)  echo " "
4073         echo "*** WHOA THERE!!! ***" >&4
4074         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4075         ;;
4076 esac
4077 rp="    Keep the $hint value?"
4078 . ./myread
4079 case "$ans" in
4080 y) td=$was; tu=$was;;
4081 esac
4082 EOSC
4083
4084 : function used to set '$1' to '$val'
4085 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4086 case "$val$was" in
4087 $define$undef) . ./whoa; eval "$var=\$td";;
4088 $undef$define) . ./whoa; eval "$var=\$tu";;
4089 *) eval "$var=$val";;
4090 esac'
4091
4092 : get the patchlevel
4093 echo " "
4094 echo "Getting the current patchlevel..." >&4
4095 if $test -r $rsrc/patchlevel.h;then
4096         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4097         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4098         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4099         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4100         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4101         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4102         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4103 else
4104         revision=0
4105         patchlevel=0
4106         subversion=0
4107         api_revision=0
4108         api_version=0
4109         api_subversion=0
4110         perl_patchlevel=0
4111         $echo "(You do not have patchlevel.h.  Eek.)"
4112 fi
4113 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4114 version_patchlevel_string="version $patchlevel subversion $subversion"
4115 case "$perl_patchlevel" in
4116 0|'') ;;
4117 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4118     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4119     ;;
4120 esac
4121
4122 $echo "(You have $package $version_patchlevel_string.)"
4123
4124 case "$osname" in
4125 dos|vms)
4126         : XXX Should be a Configure test for double-dots in filenames.
4127         version=`echo $revision $patchlevel $subversion | \
4128                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4129         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4130                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4131         ;;
4132 *)
4133         version=`echo $revision $patchlevel $subversion | \
4134                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4135         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4136                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4137         ;;
4138 esac
4139 : Special case the 5.005_xx maintenance series, which used 5.005
4140 : without any subversion label as a subdirectory in $sitelib
4141 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4142         api_versionstring='5.005'
4143 fi
4144
4145 : Do we want threads support and if so, what type
4146 case "$usethreads" in
4147 $define|true|[yY]*)     dflt='y';;
4148 *)     # Catch case where user specified ithreads or 5005threads but
4149        # forgot -Dusethreads (A.D. 4/2002)
4150        case "$useithreads$use5005threads" in
4151        *$define*)       dflt='y';;
4152        *)               dflt='n';;
4153        esac
4154        ;;
4155 esac
4156 cat <<EOM
4157
4158 Perl can be built to take advantage of threads on some systems.
4159 To do so, Configure can be run with -Dusethreads.
4160
4161 Note that Perl built with threading support runs slightly slower
4162 and uses more memory than plain Perl. The current implementation
4163 is believed to be stable, but it is fairly new, and so should be
4164 treated with caution.
4165
4166 If this doesn't make any sense to you, just accept the default '$dflt'.
4167 EOM
4168 rp='Build a threading Perl?'
4169 . ./myread
4170 case "$ans" in
4171 y|Y)    val="$define" ;;
4172 *)      val="$undef" ;;
4173 esac
4174 set usethreads
4175 eval $setvar
4176
4177 if $test $patchlevel -lt 9; then
4178     case "$usethreads" in
4179     $define)
4180         $cat <<EOM
4181
4182 Since release 5.6, Perl has had two different threading implementations,
4183 the newer interpreter-based version (ithreads) with one interpreter per
4184 thread, and the older 5.005 version (5005threads).
4185 The 5005threads version is effectively unmaintained and will probably be
4186 removed in Perl 5.10, so there should be no need to build a Perl using it
4187 unless needed for backwards compatibility with some existing 5.005threads
4188 code.
4189
4190 EOM
4191         : Default to ithreads unless overridden on command line or with
4192         : old config.sh
4193         dflt='y'
4194         case "$use5005threads" in
4195                 $define|true|[yY]*) dflt='n';;
4196         esac
4197         case "$useithreads" in
4198                 $undef|false|[nN]*) dflt='n';;
4199         esac
4200         rp='Use the newer interpreter-based ithreads?'
4201         . ./myread
4202         case "$ans" in
4203         y|Y)    val="$define" ;;
4204         *)      val="$undef" ;;
4205         esac
4206         set useithreads
4207         eval $setvar
4208         : Now set use5005threads to the opposite value.
4209         case "$useithreads" in
4210         $define) val="$undef" ;;
4211         *) val="$define" ;;
4212         esac
4213         set use5005threads
4214         eval $setvar
4215         ;;
4216     *)
4217         useithreads="$undef"
4218         use5005threads="$undef"
4219         ;;
4220     esac
4221
4222     case "$useithreads$use5005threads" in
4223     "$define$define")
4224         $cat >&4 <<EOM
4225
4226 You cannot have both the ithreads and the 5.005 threads enabled
4227 at the same time.  Disabling the 5.005 threads since they are
4228 much less stable than the ithreads.
4229
4230 EOM
4231         use5005threads="$undef"
4232         ;;
4233     esac
4234
4235 else
4236 : perl-5.9.x and later
4237
4238     if test X"$usethreads" = "X$define"; then
4239         case "$use5005threads" in
4240             $define|true|[yY]*)
4241                 $cat >&4 <<EOM
4242
4243 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4244
4245 EOM
4246             ;;
4247         esac
4248     fi
4249
4250     use5005threads="$undef"
4251     useithreads="$usethreads"
4252 fi
4253
4254 case "$d_oldpthreads" in
4255 '')     : Configure tests would be welcome here.  For now, assume undef.
4256         val="$undef" ;;
4257 *)      val="$d_oldpthreads" ;;
4258 esac
4259 set d_oldpthreads
4260 eval $setvar
4261
4262
4263 : Look for a hint-file generated 'call-back-unit'.  If the
4264 : user has specified that a threading perl is to be built,
4265 : we may need to set or change some other defaults.
4266 if $test -f usethreads.cbu; then
4267     echo "Your platform has some specific hints regarding threaded builds, using them..."
4268     . ./usethreads.cbu
4269 else
4270     case "$usethreads" in
4271         "$define"|true|[yY]*)
4272                 $cat <<EOM
4273 (Your platform does not have any specific hints for threaded builds.
4274  Assuming POSIX threads, then.)
4275 EOM
4276         ;;
4277     esac
4278 fi
4279
4280 : Check if multiplicity is required
4281 cat <<EOM
4282
4283 Perl can be built so that multiple Perl interpreters can coexist
4284 within the same Perl executable.
4285 EOM
4286
4287 case "$useithreads" in
4288 $define)
4289         cat <<EOM
4290 This multiple interpreter support is required for interpreter-based threads.
4291 EOM
4292         val="$define"
4293         ;;
4294 *)      case "$usemultiplicity" in
4295         $define|true|[yY]*)     dflt='y';;
4296         *) dflt='n';;
4297         esac
4298         echo " "
4299         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4300         rp='Build Perl for multiplicity?'
4301         . ./myread
4302         case "$ans" in
4303         y|Y)    val="$define" ;;
4304         *)      val="$undef" ;;
4305         esac
4306         ;;
4307 esac
4308 set usemultiplicity
4309 eval $setvar
4310
4311 : Check if morebits is requested
4312 case "$usemorebits" in
4313 "$define"|true|[yY]*)
4314         use64bitint="$define"
4315         uselongdouble="$define"
4316         usemorebits="$define"
4317         ;;
4318 *)      usemorebits="$undef"
4319         ;;
4320 esac
4321
4322 : Determine the C compiler to be used
4323 echo " "
4324 case "$cc" in
4325 '') dflt=cc;;
4326 *) dflt="$cc";;
4327 esac
4328 rp="Use which C compiler?"
4329 . ./myread
4330 cc="$ans"
4331
4332 : See whether they have no cc but they do have gcc
4333 . ./trygcc
4334 if $test -f cc.cbu; then
4335     . ./cc.cbu
4336 fi
4337 . ./checkcc
4338
4339 : make some quick guesses about what we are up against
4340 echo " "
4341 $echo $n "Hmm...  $c"
4342 echo exit 1 >bsd
4343 echo exit 1 >usg
4344 echo exit 1 >v7
4345 echo exit 1 >osf1
4346 echo exit 1 >eunice
4347 echo exit 1 >xenix
4348 echo exit 1 >venix
4349 echo exit 1 >os2
4350 d_bsd="$undef"
4351 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4352 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4353 then
4354         echo "Looks kind of like an OSF/1 system, but we'll see..."
4355         echo exit 0 >osf1
4356 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4357         xxx=`./loc addbib blurfl $pth`
4358         if $test -f $xxx; then
4359         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4360                 echo exit 0 >bsd
4361                 echo exit 0 >usg
4362         else
4363                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4364                         echo "Looks kind of like an extended USG system, but we'll see..."
4365                 else
4366                         echo "Looks kind of like a USG system, but we'll see..."
4367                 fi
4368                 echo exit 0 >usg
4369         fi
4370 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4371         echo "Looks kind of like a BSD system, but we'll see..."
4372         d_bsd="$define"
4373         echo exit 0 >bsd
4374 else
4375         echo "Looks kind of like a Version 7 system, but we'll see..."
4376         echo exit 0 >v7
4377 fi
4378 case "$eunicefix" in
4379 *unixtovms*)
4380         $cat <<'EOI'
4381 There is, however, a strange, musty smell in the air that reminds me of
4382 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4383 EOI
4384         echo exit 0 >eunice
4385         d_eunice="$define"
4386 : it so happens the Eunice I know will not run shell scripts in Unix format
4387         ;;
4388 *)
4389         echo " "
4390         echo "Congratulations.  You aren't running Eunice."
4391         d_eunice="$undef"
4392         ;;
4393 esac
4394 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4395 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4396 : semicolon as a patch separator
4397 case "$p_" in
4398 :) ;;
4399 *)
4400         $cat <<'EOI'
4401 I have the feeling something is not exactly right, however...don't tell me...
4402 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4403 (Or you may be running DOS with DJGPP.)
4404 EOI
4405         echo exit 0 >os2
4406         ;;
4407 esac
4408 if test -f /xenix; then
4409         echo "Actually, this looks more like a XENIX system..."
4410         echo exit 0 >xenix
4411         d_xenix="$define"
4412 else
4413         echo " "
4414         echo "It's not Xenix..."
4415         d_xenix="$undef"
4416 fi
4417 chmod +x xenix
4418 $eunicefix xenix
4419 if test -f /venix; then
4420         echo "Actually, this looks more like a VENIX system..."
4421         echo exit 0 >venix
4422 else
4423         echo " "
4424         if ./xenix; then
4425                 : null
4426         else
4427                 echo "Nor is it Venix..."
4428         fi
4429 fi
4430 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4431 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4432 $rm -f foo
4433
4434 : Check if we are using GNU gcc and what its version is
4435 echo " "
4436 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4437 $cat >try.c <<EOM
4438 #include <stdio.h>
4439 int main() {
4440 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4441 #ifdef __VERSION__
4442         printf("%s\n", __VERSION__);
4443 #else
4444         printf("%s\n", "1");
4445 #endif
4446 #endif
4447         return(0);
4448 }
4449 EOM
4450 if $cc -o try $ccflags $ldflags try.c; then
4451         gccversion=`$run ./try`
4452         case "$gccversion" in
4453         '') echo "You are not using GNU cc." ;;
4454         *)  echo "You are using GNU cc $gccversion."
4455             ccname=gcc
4456             ;;
4457         esac
4458 else
4459         echo " "
4460         echo "*** WHOA THERE!!! ***" >&4
4461         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4462         case "$knowitall" in
4463         '')
4464         echo "    You'd better start hunting for one and let me know about it." >&4
4465                 exit 1
4466                 ;;
4467         esac
4468 fi
4469 $rm -f try try.*
4470 case "$gccversion" in
4471 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4472 esac
4473 case "$gccversion" in
4474 '') gccosandvers='' ;;
4475 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4476    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4477    gccshortvers=''
4478    case "$gccosandvers" in
4479    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4480    $osname$osvers) ;; # looking good
4481    $osname*) cat <<EOM >&4
4482
4483 *** WHOA THERE!!! ***
4484
4485     Your gcc has not been compiled for the exact release of
4486     your operating system ($gccosandvers versus $osname$osvers).
4487
4488     In general it is a good idea to keep gcc synchronized with
4489     the operating system because otherwise serious problems
4490     may ensue when trying to compile software, like Perl.
4491
4492     I'm trying to be optimistic here, though, and will continue.
4493     If later during the configuration and build icky compilation
4494     problems appear (headerfile conflicts being the most common
4495     manifestation), I suggest reinstalling the gcc to match
4496     your operating system release.
4497
4498 EOM
4499       ;;
4500    *) gccosandvers='' ;; # failed to parse, better be silent
4501    esac
4502    ;;
4503 esac
4504 case "$ccname" in
4505 '') ccname="$cc" ;;
4506 esac
4507
4508 # gcc 3.* complain about adding -Idirectories that they already know about,
4509 # so we will take those off from locincpth.
4510 case "$gccversion" in
4511 3*)
4512     echo "main(){}">try.c
4513     for incdir in $locincpth; do
4514        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4515              grep '^c[cp]p*[01]: warning: changing search order '`
4516        if test "X$warn" != X; then
4517            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4518        fi
4519     done
4520     $rm -f try try.*
4521 esac
4522
4523 : What should the include directory be ?
4524 echo " "
4525 $echo $n "Hmm...  $c"
4526 dflt='/usr/include'
4527 incpath=''
4528 mips_type=''
4529 if $test -f /bin/mips && /bin/mips; then
4530         echo "Looks like a MIPS system..."
4531         $cat >usr.c <<'EOCP'
4532 #ifdef SYSTYPE_BSD43
4533 /bsd43
4534 #endif
4535 EOCP
4536         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4537                 dflt='/bsd43/usr/include'
4538                 incpath='/bsd43'
4539                 mips_type='BSD 4.3'
4540         else
4541                 mips_type='System V'
4542         fi
4543         $rm -f usr.c usr.out
4544         echo "and you're compiling with the $mips_type compiler and libraries."
4545         xxx_prompt=y
4546         echo "exit 0" >mips
4547 else
4548         echo "Doesn't look like a MIPS system."
4549         xxx_prompt=n
4550         echo "exit 1" >mips
4551 fi
4552 chmod +x mips
4553 $eunicefix mips
4554 case "$usrinc" in
4555 '') ;;
4556 *) dflt="$usrinc";;
4557 esac
4558 case "$xxx_prompt" in
4559 y)      fn=d/
4560         echo " "
4561         rp='Where are the include files you want to use?'
4562         . ./getfile
4563         usrinc="$ans"
4564         ;;
4565 *)      usrinc="$dflt"
4566         ;;
4567 esac
4568
4569 : see how we invoke the C preprocessor
4570 echo " "
4571 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4572 cat <<'EOT' >testcpp.c
4573 #define ABC abc
4574 #define XYZ xyz
4575 ABC.XYZ
4576 EOT
4577 cd ..
4578 if test ! -f cppstdin; then
4579         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4580                 # AIX cc -E doesn't show the absolute headerfile
4581                 # locations but we'll cheat by using the -M flag.
4582                 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
4583         else
4584                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4585         fi
4586 else
4587         echo "Keeping your $hint cppstdin wrapper."
4588 fi
4589 chmod 755 cppstdin
4590 wrapper=`pwd`/cppstdin
4591 ok='false'
4592 cd UU
4593
4594 if $test "X$cppstdin" != "X" && \
4595         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4596         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4597 then
4598         echo "You used to use $cppstdin $cppminus so we'll use that again."
4599         case "$cpprun" in
4600         '') echo "But let's see if we can live without a wrapper..." ;;
4601         *)
4602                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4603                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4604                 then
4605                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4606                         ok='true'
4607                 else
4608                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4609                 fi
4610                 ;;
4611         esac
4612 else
4613         case "$cppstdin" in
4614         '') ;;
4615         *)
4616                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4617                 ;;
4618         esac
4619 fi
4620
4621 if $ok; then
4622         : nothing
4623 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4624         $cc -E <testcpp.c >testcpp.out 2>&1; \
4625         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4626         echo "Yup, it does."
4627         x_cpp="$cc -E"
4628         x_minus='';
4629 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4630         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4631         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4632         echo "Yup, it does."
4633         x_cpp="$cc -E"
4634         x_minus='-';
4635 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4636         $cc -P <testcpp.c >testcpp.out 2>&1; \
4637         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4638         echo "Yipee, that works!"
4639         x_cpp="$cc -P"
4640         x_minus='';
4641 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4642         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4643         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4644         echo "At long last!"
4645         x_cpp="$cc -P"
4646         x_minus='-';
4647 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4648         $cpp <testcpp.c >testcpp.out 2>&1; \
4649         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4650         echo "It works!"
4651         x_cpp="$cpp"
4652         x_minus='';
4653 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4654         $cpp - <testcpp.c >testcpp.out 2>&1; \
4655         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4656         echo "Hooray, it works!  I was beginning to wonder."
4657         x_cpp="$cpp"
4658         x_minus='-';
4659 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4660         $wrapper <testcpp.c >testcpp.out 2>&1; \
4661         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4662         x_cpp="$wrapper"
4663         x_minus=''
4664         echo "Eureka!"
4665 else
4666         dflt=''
4667         rp="No dice.  I can't find a C preprocessor.  Name one:"
4668         . ./myread
4669         x_cpp="$ans"
4670         x_minus=''
4671         $x_cpp <testcpp.c >testcpp.out 2>&1
4672         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4673                 echo "OK, that will do." >&4
4674         else
4675 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4676                 exit 1
4677         fi
4678 fi
4679
4680 case "$ok" in
4681 false)
4682         cppstdin="$x_cpp"
4683         cppminus="$x_minus"
4684         cpprun="$x_cpp"
4685         cpplast="$x_minus"
4686         set X $x_cpp
4687         shift
4688         case "$1" in
4689         "$cpp")
4690                 echo "Perhaps can we force $cc -E using a wrapper..."
4691                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4692                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4693                 then
4694                         echo "Yup, we can."
4695                         cppstdin="$wrapper"
4696                         cppminus='';
4697                 else
4698                         echo "Nope, we'll have to live without it..."
4699                 fi
4700                 ;;
4701         esac
4702         case "$cpprun" in
4703         "$wrapper")
4704                 cpprun=''
4705                 cpplast=''
4706                 ;;
4707         esac
4708         ;;
4709 esac
4710
4711 case "$cppstdin" in
4712 "$wrapper"|'cppstdin') ;;
4713 *) $rm -f $wrapper;;
4714 esac
4715 $rm -f testcpp.c testcpp.out
4716
4717 : Set private lib path
4718 case "$plibpth" in
4719 '') if ./mips; then
4720                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4721         fi;;
4722 esac
4723 case "$libpth" in
4724 ' ') dlist='';;
4725 '') dlist="$loclibpth $plibpth $glibpth";;
4726 *) dlist="$libpth";;
4727 esac
4728
4729 : Now check and see which directories actually exist, avoiding duplicates
4730 libpth=''
4731 for xxx in $dlist
4732 do
4733     if $test -d $xxx; then
4734                 case " $libpth " in
4735                 *" $xxx "*) ;;
4736                 *) libpth="$libpth $xxx";;
4737                 esac
4738     fi
4739 done
4740 $cat <<'EOM'
4741
4742 Some systems have incompatible or broken versions of libraries.  Among
4743 the directories listed in the question below, please remove any you
4744 know not to be holding relevant libraries, and add any that are needed.
4745 Say "none" for none.
4746
4747 EOM
4748 case "$libpth" in
4749 '') dflt='none';;
4750 *)
4751         set X $libpth
4752         shift
4753         dflt=${1+"$@"}
4754         ;;
4755 esac
4756 rp="Directories to use for library searches?"
4757 . ./myread
4758 case "$ans" in
4759 none) libpth=' ';;
4760 *) libpth="$ans";;
4761 esac
4762
4763 : compute shared library extension
4764 case "$so" in
4765 '')
4766         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4767                 dflt='sl'
4768         else
4769                 dflt='so'
4770         fi
4771         ;;
4772 *) dflt="$so";;
4773 esac
4774 $cat <<EOM
4775
4776 On some systems, shared libraries may be available.  Answer 'none' if
4777 you want to suppress searching of shared libraries for the remainder
4778 of this configuration.
4779
4780 EOM
4781 rp='What is the file extension used for shared libraries?'
4782 . ./myread
4783 so="$ans"
4784
4785 : Define several unixisms.
4786 : Hints files or command line option can be used to override them.
4787 : The convoluted testing is in case hints files set either the old
4788 : or the new name.
4789 case "$_exe" in
4790 '')     case "$exe_ext" in
4791         '')     ;;
4792         *)      _exe="$exe_ext" ;;
4793         esac
4794         ;;
4795 esac
4796 case "$_a" in
4797 '')     case "$lib_ext" in
4798     '') _a='.a';;
4799         *)      _a="$lib_ext" ;;
4800         esac
4801         ;;
4802 esac
4803 case "$_o" in
4804 '') case "$obj_ext" in
4805         '')     _o='.o';;
4806         *)      _o="$obj_ext";;
4807         esac
4808         ;;
4809 esac
4810 case "$p_" in
4811 '') case "$path_sep" in
4812         '')     p_=':';;
4813         *)      p_="$path_sep";;
4814         esac
4815         ;;
4816 esac
4817 exe_ext=$_exe
4818 lib_ext=$_a
4819 obj_ext=$_o
4820 path_sep=$p_
4821
4822 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4823
4824 : Which makefile gets called first.  This is used by make depend.
4825 case "$firstmakefile" in
4826 '') firstmakefile='makefile';;
4827 esac
4828
4829 : Check is we will use socks
4830 case "$usesocks" in
4831 $define|true|[yY]*)     dflt='y';;
4832 *) dflt='n';;
4833 esac
4834 cat <<EOM
4835
4836 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4837 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4838 to use the PerlIO abstraction layer, this will be implicitly selected.
4839
4840 If this doesn't make any sense to you, just accept the default '$dflt'.
4841 EOM
4842 rp='Build Perl for SOCKS?'
4843 . ./myread
4844 case "$ans" in
4845 y|Y)    val="$define" ;;
4846 *)      val="$undef" ;;
4847 esac
4848 set usesocks
4849 eval $setvar
4850
4851 : Check for uselongdouble support
4852 case "$ccflags" in
4853 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4854 esac
4855
4856 case "$uselongdouble" in
4857 $define|true|[yY]*)     dflt='y';;
4858 *) dflt='n';;
4859 esac
4860 cat <<EOM
4861
4862 Perl can be built to take advantage of long doubles which
4863 (if available) may give more accuracy and range for floating point numbers.
4864
4865 If this doesn't make any sense to you, just accept the default '$dflt'.
4866 EOM
4867 rp='Try to use long doubles if available?'
4868 . ./myread
4869 case "$ans" in
4870 y|Y)    val="$define"   ;;
4871 *)      val="$undef"    ;;
4872 esac
4873 set uselongdouble
4874 eval $setvar
4875
4876 case "$uselongdouble" in
4877 true|[yY]*) uselongdouble="$define" ;;
4878 esac
4879
4880 : Look for a hint-file generated 'call-back-unit'.  If the
4881 : user has specified that long doubles should be used,
4882 : we may need to set or change some other defaults.
4883 if $test -f uselongdouble.cbu; then
4884     echo "Your platform has some specific hints regarding long doubles, using them..."
4885     . ./uselongdouble.cbu
4886 else
4887     case "$uselongdouble" in
4888         $define)
4889                 $cat <<EOM
4890 (Your platform does not have any specific hints for long doubles.)
4891 EOM
4892         ;;
4893     esac
4894 fi
4895
4896 : Looking for optional libraries
4897 echo " "
4898 echo "Checking for optional libraries..." >&4
4899 case "$libs" in
4900 ' '|'') dflt='';;
4901 *) dflt="$libs";;
4902 esac
4903 case "$libswanted" in
4904 '') libswanted='c_s';;
4905 esac
4906 case "$usesocks" in
4907 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4908 esac
4909 libsfound=''
4910 libsfiles=''
4911 libsdirs=''
4912 libspath=''
4913 for thisdir in $libpth $xlibpth; do
4914   test -d $thisdir && libspath="$libspath $thisdir"
4915 done
4916 for thislib in $libswanted; do
4917         for thisdir in $libspath; do
4918             xxx=''
4919             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4920                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4921                 $test -f "$xxx" && eval $libscheck
4922                 $test -f "$xxx" && libstyle=shared
4923             fi
4924             if test ! -f "$xxx"; then
4925                 xxx=$thisdir/lib$thislib.$so
4926                 $test -f "$xxx" && eval $libscheck
4927                 $test -f "$xxx" && libstyle=shared
4928             fi
4929             if test ! -f "$xxx"; then
4930                 xxx=$thisdir/lib$thislib$_a
4931                 $test -f "$xxx" && eval $libscheck
4932                 $test -f "$xxx" && libstyle=static
4933             fi
4934             if test ! -f "$xxx"; then
4935                 xxx=$thisdir/$thislib$_a
4936                 $test -f "$xxx" && eval $libscheck
4937                 $test -f "$xxx" && libstyle=static
4938             fi
4939             if test ! -f "$xxx"; then
4940                 xxx=$thisdir/lib${thislib}_s$_a
4941                 $test -f "$xxx" && eval $libscheck
4942                 $test -f "$xxx" && libstyle=static
4943                 $test -f "$xxx" && thislib=${thislib}_s
4944             fi
4945             if test ! -f "$xxx"; then
4946                 xxx=$thisdir/Slib$thislib$_a
4947                 $test -f "$xxx" && eval $libscheck
4948                 $test -f "$xxx" && libstyle=static
4949             fi
4950             if $test -f "$xxx"; then
4951                 case "$libstyle" in
4952                 shared) echo "Found -l$thislib (shared)." ;;
4953                 static) echo "Found -l$thislib." ;;
4954                 *)      echo "Found -l$thislib ($libstyle)." ;;
4955                 esac
4956                 case " $dflt " in
4957                 *"-l$thislib "*);;
4958                 *) dflt="$dflt -l$thislib"
4959                    libsfound="$libsfound $xxx"
4960                    yyy=`basename $xxx`
4961                    libsfiles="$libsfiles $yyy"
4962                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4963                    case " $libsdirs " in
4964                    *" $yyy "*) ;;
4965                    *) libsdirs="$libsdirs $yyy" ;;
4966                    esac
4967                    ;;
4968                 esac
4969                 break
4970             fi
4971         done
4972         if $test ! -f "$xxx"; then
4973             echo "No -l$thislib."
4974         fi
4975 done
4976 set X $dflt
4977 shift
4978 dflt="$*"
4979 case "$libs" in
4980 '') dflt="$dflt";;
4981 *) dflt="$libs";;
4982 esac
4983 case "$dflt" in
4984 ' '|'') dflt='none';;
4985 esac
4986
4987 $cat <<EOM
4988
4989 In order to compile $package on your machine, a number of libraries
4990 are usually needed.  Include any other special libraries here as well.
4991 Say "none" for none.  The default list is almost always right.
4992 EOM
4993
4994 echo " "
4995 rp="What libraries to use?"
4996 . ./myread
4997 case "$ans" in
4998 none) libs=' ';;
4999 *) libs="$ans";;
5000 esac
5001
5002 : determine optimization, if desired, or use for debug flag also
5003 case "$optimize" in
5004 ' '|$undef) dflt='none';;
5005 '') dflt='-O';;
5006 *) dflt="$optimize";;
5007 esac
5008 $cat <<EOH
5009
5010 By default, $package compiles with the -O flag to use the optimizer.
5011 Alternately, you might want to use the symbolic debugger, which uses
5012 the -g flag (on traditional Unix systems).  Either flag can be
5013 specified here.  To use neither flag, specify the word "none".
5014
5015 EOH
5016 rp="What optimizer/debugger flag should be used?"
5017 . ./myread
5018 optimize="$ans"
5019 case "$optimize" in
5020 'none') optimize=" ";;
5021 esac
5022
5023 : Check what DEBUGGING is required from the command line
5024 : -DEBUGGING      or -DDEBUGGING or
5025 : -DEBUGGING=both                       = -g + -DDEBUGGING
5026 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5027 : -DEBUGGING=none or -UDEBUGGING        =
5028 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5029 case "$EBUGGING" in
5030 '')     ;;
5031 *)      DEBUGGING=$EBUGGING ;;
5032 esac
5033
5034 case "$DEBUGGING" in
5035 -g|both|$define)
5036     case "$optimize" in
5037         *-g*) ;;
5038         *)    optimize="$optimize -g" ;;
5039     esac ;;
5040 none|$undef)
5041     case "$optimize" in
5042         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5043                 shift
5044                 optimize="$*"
5045                 ;;
5046     esac ;;
5047 esac
5048
5049 dflt=''
5050 case "$DEBUGGING" in
5051 both|$define) dflt='-DDEBUGGING'
5052 esac
5053
5054 : argument order is deliberate, as the flag will start with - which set could
5055 : think is an option
5056 checkccflag='check=$1; flag=$2; callback=$3;
5057 echo " ";
5058 echo "Checking if your compiler accepts $flag" 2>&1;
5059 echo "int main(void) { return 0; }" > gcctest.c;
5060 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5061     echo "Yes, it does." 2>&1;
5062     if $test -s gcctest.out ; then
5063         echo "But your platform does not like it:";
5064         cat gcctest.out;
5065     else
5066         case "$ccflags" in
5067         *$check*)
5068             echo "Leaving current flags $ccflags alone." 2>&1
5069             ;;
5070         *) dflt="$dflt $flag";
5071             eval $callback
5072             ;;
5073         esac
5074     fi
5075 else
5076     echo "Nope, it does not, but that is ok." 2>&1;
5077 fi
5078 '
5079
5080 : We will not override a previous value, but we might want to
5081 : augment a hint file
5082 case "$hint" in
5083 default|recommended)
5084         case "$gccversion" in
5085         1*) dflt="$dflt -fpcc-struct-return" ;;
5086         esac
5087         case "$optimize:$DEBUGGING" in
5088         *-g*:old) dflt="$dflt -DDEBUGGING";;
5089         esac
5090         case "$gccversion" in
5091         2*) if $test -d /etc/conf/kconfig.d &&
5092                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5093                 then
5094                         # Interactive Systems (ISC) POSIX mode.
5095                         dflt="$dflt -posix"
5096                 fi
5097                 ;;
5098         esac
5099         case "$gccversion" in
5100         1*) ;;
5101         2.[0-8]*) ;;
5102         ?*)     set strict-aliasing -fno-strict-aliasing
5103                 eval $checkccflag
5104                 ;;
5105         esac
5106         # For gcc, adding -pipe speeds up compilations for some, but apparently
5107         # some assemblers can't read from stdin.  (It also slows down compilations
5108         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5109         case "$gccversion" in
5110         ?*)     set pipe -pipe
5111                 eval $checkccflag
5112                 ;;
5113         esac
5114
5115         # on x86_64 (at least) we require an extra library (libssp) in the
5116         # link command line. This library is not named, so I infer that it is
5117         # an implementation detail that may change. Hence the safest approach
5118         # is to add the flag to the flags passed to the compiler at link time,
5119         # as that way the compiler can do the right implementation dependant
5120         # thing. (NWC)
5121         case "$gccversion" in
5122         ?*)     set stack-protector -fstack-protector
5123                 eval $checkccflag
5124                 ;;
5125         esac
5126         ;;
5127 esac
5128
5129 case "$mips_type" in
5130 *BSD*|'') inclwanted="$locincpth $usrinc";;
5131 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5132 esac
5133 for thisincl in $inclwanted; do
5134         if $test -d $thisincl; then
5135                 if $test x$thisincl != x$usrinc; then
5136                         case "$dflt" in
5137                         *" -I$thisincl "*);;
5138                         *) dflt="$dflt -I$thisincl ";;
5139                         esac
5140                 fi
5141         fi
5142 done
5143
5144 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5145         xxx=true;
5146 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5147         xxx=true;
5148 else
5149         xxx=false;
5150 fi;
5151 if $xxx; then
5152         case "$dflt" in
5153         *$2*);;
5154         *) dflt="$dflt -D$2";;
5155         esac;
5156 fi'
5157
5158 set signal.h LANGUAGE_C; eval $inctest
5159
5160 case "$usesocks" in
5161 $define)
5162         ccflags="$ccflags -DSOCKS"
5163         ;;
5164 esac
5165
5166 case "$hint" in
5167 default|recommended) dflt="$ccflags $dflt" ;;
5168 *) dflt="$ccflags";;
5169 esac
5170
5171 case "$dflt" in
5172 ''|' ') dflt=none;;
5173 esac
5174
5175 $cat <<EOH
5176
5177 Your C compiler may want other flags.  For this question you should include
5178 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5179 but you should NOT include libraries or ld flags like -lwhatever.  If you
5180 want $package to honor its debug switch, you should include -DDEBUGGING here.
5181 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5182
5183 To use no flags, specify the word "none".
5184
5185 EOH
5186 set X $dflt
5187 shift
5188 dflt=${1+"$@"}
5189 rp="Any additional cc flags?"
5190 . ./myread
5191 case "$ans" in
5192 none) ccflags='';;
5193 *) ccflags="$ans";;
5194 esac
5195
5196 : the following weeds options from ccflags that are of no interest to cpp
5197 case "$cppflags" in
5198 '') cppflags="$ccflags" ;;
5199 *)  cppflags="$cppflags $ccflags" ;;
5200 esac
5201 case "$gccversion" in
5202 1*) cppflags="$cppflags -D__GNUC__"
5203 esac
5204 case "$mips_type" in
5205 '');;
5206 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5207 esac
5208 case "$cppflags" in
5209 '');;
5210 *)
5211         echo " "
5212         echo "Let me guess what the preprocessor flags are..." >&4
5213         set X $cppflags
5214         shift
5215         cppflags=''
5216         $cat >cpp.c <<'EOM'
5217 #define BLURFL foo
5218
5219 BLURFL xx LFRULB
5220 EOM
5221         previous=''
5222         for flag in $*
5223         do
5224                 case "$flag" in
5225                 -*) ftry="$flag";;
5226                 *) ftry="$previous $flag";;
5227                 esac
5228                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5229                         >cpp1.out 2>/dev/null && \
5230                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5231                         >cpp2.out 2>/dev/null && \
5232                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5233                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5234                 then
5235                         cppflags="$cppflags $ftry"
5236                         previous=''
5237                 else
5238                         previous="$flag"
5239                 fi
5240         done
5241         set X $cppflags
5242         shift
5243         cppflags=${1+"$@"}
5244         case "$cppflags" in
5245         *-*)  echo "They appear to be: $cppflags";;
5246         esac
5247         $rm -f cpp.c cpp?.out
5248         ;;
5249 esac
5250
5251 : flags used in final linking phase
5252 case "$ldflags" in
5253 '') if ./venix; then
5254                 dflt='-i -z'
5255         else
5256                 dflt=''
5257         fi
5258         case "$ccflags" in
5259         *-posix*) dflt="$dflt -posix" ;;
5260         esac
5261         ;;
5262 *) dflt="$ldflags";;
5263 esac
5264 # See note above about -fstack-protector
5265 case "$ccflags" in
5266 *-fstack-protector*)
5267         case "$dflt" in
5268         *-fstack-protector*) ;; # Don't add it again
5269         *) dflt="$dflt -fstack-protector" ;;
5270         esac
5271         ;;
5272 esac
5273
5274 : Try to guess additional flags to pick up local libraries.
5275 for thislibdir in $libpth; do
5276         case " $loclibpth " in
5277         *" $thislibdir "*)
5278                 case "$dflt " in
5279                 *"-L$thislibdir "*) ;;
5280                 *)  dflt="$dflt -L$thislibdir" ;;
5281                 esac
5282                 ;;
5283         esac
5284 done
5285
5286 case "$dflt" in
5287 '') dflt='none' ;;
5288 esac
5289
5290 $cat <<EOH
5291
5292 Your C linker may need flags.  For this question you should
5293 include -L/whatever and any other flags used by the C linker, but you
5294 should NOT include libraries like -lwhatever.
5295
5296 Make sure you include the appropriate -L/path flags if your C linker
5297 does not normally search all of the directories you specified above,
5298 namely
5299         $libpth
5300 To use no flags, specify the word "none".
5301
5302 EOH
5303
5304 rp="Any additional ld flags (NOT including libraries)?"
5305 . ./myread
5306 case "$ans" in
5307 none) ldflags='';;
5308 *) ldflags="$ans";;
5309 esac
5310 rmlist="$rmlist pdp11"
5311
5312 : coherency check
5313 echo " "
5314 echo "Checking your choice of C compiler and flags for coherency..." >&4
5315 $cat > try.c <<'EOF'
5316 #include <stdio.h>
5317 int main() { printf("Ok\n"); return(0); }
5318 EOF
5319 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5320 shift
5321 $cat >try.msg <<'EOM'
5322 I've tried to compile and run the following simple program:
5323
5324 EOM
5325 $cat try.c >> try.msg
5326
5327 $cat >> try.msg <<EOM
5328
5329 I used the command:
5330
5331         $*
5332         $run ./try
5333
5334 and I got the following output:
5335
5336 EOM
5337 dflt=y
5338 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5339         if $sh -c "$run ./try " >>try.msg 2>&1; then
5340                 xxx=`$run ./try`
5341                 case "$xxx" in
5342                 "Ok") dflt=n ;;
5343                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5344                         case " $libs " in
5345                         *" -lsfio "*)
5346                                 cat >> try.msg <<'EOQS'
5347 If $libs contains -lsfio, and sfio is mis-configured, then it
5348 sometimes (apparently) runs and exits with a 0 status, but with no
5349 output!  It may have to do with sfio's use of _exit vs. exit.
5350
5351 EOQS
5352                                 rp="You have a big problem.  Shall I abort Configure"
5353                                 dflt=y
5354                                 ;;
5355                         esac
5356                         ;;
5357                 esac
5358         else
5359                 echo "The program compiled OK, but exited with status $?." >>try.msg
5360                 rp="You have a problem.  Shall I abort Configure"
5361                 dflt=y
5362         fi
5363 else
5364         echo "I can't compile the test program." >>try.msg
5365         rp="You have a BIG problem.  Shall I abort Configure"
5366         dflt=y
5367 fi
5368 case "$dflt" in
5369 y)
5370         $cat try.msg >&4
5371         case "$knowitall" in
5372         '')
5373                 echo "(The supplied flags or libraries might be incorrect.)"
5374                 ;;
5375         *) dflt=n;;
5376         esac
5377         echo " "
5378         . ./myread
5379         case "$ans" in
5380         n*|N*) ;;
5381         *)      echo "Ok.  Stopping Configure." >&4
5382                 exit 1
5383                 ;;
5384         esac
5385         ;;
5386 n) echo "OK, that should do.";;
5387 esac
5388 $rm_try gcctest gcctest.out
5389
5390 : define a shorthand compile call
5391 compile='
5392 mc_file=$1;
5393 shift;
5394 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5395 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5396 exit 1;
5397 fi;
5398 esac;
5399 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5400 : define a shorthand compile call for compilations that should be ok.
5401 compile_ok='
5402 mc_file=$1;
5403 shift;
5404 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5405
5406 : determine filename position in cpp output
5407 echo " "
5408 echo "Computing filename position in cpp output for #include directives..." >&4
5409 case "$osname" in
5410 vos) testaccess=-e ;;
5411 *)   testaccess=-r ;;
5412 esac
5413 echo '#include <stdio.h>' > foo.c
5414 $cat >fieldn <<EOF
5415 $startsh
5416 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5417 $grep '^[       ]*#.*stdio\.h' | \
5418 while read cline; do
5419         pos=1
5420         set \$cline
5421         while $test \$# -gt 0; do
5422                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5423                         echo "\$pos"
5424                         exit 0
5425                 fi
5426                 shift
5427                 pos=\`expr \$pos + 1\`
5428         done
5429 done
5430 EOF
5431 chmod +x fieldn
5432 fieldn=`./fieldn`
5433 $rm -f foo.c fieldn
5434 case $fieldn in
5435 '') pos='???';;
5436 1) pos=first;;
5437 2) pos=second;;
5438 3) pos=third;;
5439 *) pos="${fieldn}th";;
5440 esac
5441 echo "Your cpp writes the filename in the $pos field of the line."
5442
5443 case "$osname" in
5444 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5445 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5446 *)   cppfilter='' ;;
5447 esac
5448 : locate header file
5449 $cat >findhdr <<EOF
5450 $startsh
5451 wanted=\$1
5452 name=''
5453 for usrincdir in $usrinc
5454 do
5455         if test -f \$usrincdir/\$wanted; then
5456                 echo "\$usrincdir/\$wanted"
5457                 exit 0
5458         fi
5459 done
5460 awkprg='{ print \$$fieldn }'
5461 echo "#include <\$wanted>" > foo\$\$.c
5462 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5463 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5464 while read cline; do
5465         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5466         case "\$name" in
5467         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5468         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5469         *) exit 2;;
5470         esac;
5471 done;
5472 #
5473 # status = 0: grep returned 0 lines, case statement not executed
5474 # status = 1: headerfile found
5475 # status = 2: while loop executed, no headerfile found
5476 #
5477 status=\$?
5478 $rm -f foo\$\$.c;
5479 if test \$status -eq 1; then
5480         exit 0;
5481 fi
5482 exit 1
5483 EOF
5484 chmod +x findhdr
5485
5486 : define an alternate in-header-list? function
5487 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5488 cont=true; xxf="echo \"<\$1> found.\" >&4";
5489 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5490 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5491 esac;
5492 case $# in 4) instead=instead;; *) instead="at last";; esac;
5493 while $test "$cont"; do
5494         xxx=`./findhdr $1`
5495         var=$2; eval "was=\$$2";
5496         if $test "$xxx" && $test -r "$xxx";
5497         then eval $xxf;
5498         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5499                 cont="";
5500         else eval $xxnf;
5501         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5502         set $yyy; shift; shift; yyy=$@;
5503         case $# in 0) cont="";;
5504         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5505                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5506         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5507                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5508         esac;
5509 done;
5510 while $test "$yyy";
5511 do set $yyy; var=$2; eval "was=\$$2";
5512         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5513         set $yyy; shift; shift; yyy=$@;
5514 done'
5515
5516 : see if stdlib is available
5517 set stdlib.h i_stdlib
5518 eval $inhdr
5519
5520 : check for lengths of integral types
5521 echo " "
5522 case "$intsize" in
5523 '')
5524         echo "Checking to see how big your integers are..." >&4
5525         $cat >try.c <<EOCP
5526 #include <stdio.h>
5527 #$i_stdlib I_STDLIB
5528 #ifdef I_STDLIB
5529 #include <stdlib.h>
5530 #endif
5531 int main()
5532 {
5533         printf("intsize=%d;\n", (int)sizeof(int));
5534         printf("longsize=%d;\n", (int)sizeof(long));
5535         printf("shortsize=%d;\n", (int)sizeof(short));
5536         exit(0);
5537 }
5538 EOCP
5539         set try
5540         if eval $compile_ok && $run ./try > /dev/null; then
5541                 eval `$run ./try`
5542                 echo "Your integers are $intsize bytes long."
5543                 echo "Your long integers are $longsize bytes long."
5544                 echo "Your short integers are $shortsize bytes long."
5545         else
5546                 $cat >&4 <<EOM
5547 !
5548 Help! I can't compile and run the intsize test program: please enlighten me!
5549 (This is probably a misconfiguration in your system or libraries, and
5550 you really ought to fix it.  Still, I'll try anyway.)
5551 !
5552 EOM
5553                 dflt=4
5554                 rp="What is the size of an integer (in bytes)?"
5555                 . ./myread
5556                 intsize="$ans"
5557                 dflt=$intsize
5558                 rp="What is the size of a long integer (in bytes)?"
5559                 . ./myread
5560                 longsize="$ans"
5561                 dflt=2
5562                 rp="What is the size of a short integer (in bytes)?"
5563                 . ./myread
5564                 shortsize="$ans"
5565         fi
5566         ;;
5567 esac
5568 $rm_try
5569
5570 : check for long long
5571 echo " "
5572 echo "Checking to see if you have long long..." >&4
5573 echo 'int main() { long long x = 7; return 0; }' > try.c
5574 set try
5575 if eval $compile; then
5576         val="$define"
5577         echo "You have long long."
5578 else
5579         val="$undef"
5580         echo "You do not have long long."
5581 fi
5582 $rm_try
5583 set d_longlong
5584 eval $setvar
5585
5586 : check for length of long long
5587 case "${d_longlong}${longlongsize}" in
5588 $define)
5589         echo " "
5590         echo "Checking to see how big your long longs are..." >&4
5591         $cat >try.c <<'EOCP'
5592 #include <stdio.h>
5593 int main()
5594 {
5595     printf("%d\n", (int)sizeof(long long));
5596     return(0);
5597 }
5598 EOCP
5599         set try
5600         if eval $compile_ok; then
5601                 longlongsize=`$run ./try`
5602                 echo "Your long longs are $longlongsize bytes long."
5603         else
5604                 dflt='8'
5605                 echo " "
5606                 echo "(I can't seem to compile the test program.  Guessing...)"
5607                 rp="What is the size of a long long (in bytes)?"
5608                 . ./myread
5609                 longlongsize="$ans"
5610         fi
5611         if $test "X$longsize" = "X$longlongsize"; then
5612                 echo "(That isn't any different from an ordinary long.)"
5613         fi
5614         ;;
5615 esac
5616 $rm_try
5617
5618 : see if inttypes.h is available
5619 : we want a real compile instead of Inhdr because some systems
5620 : have an inttypes.h which includes non-existent headers
5621 echo " "
5622 $cat >try.c <<EOCP
5623 #include <inttypes.h>
5624 int main() {
5625         static int32_t foo32 = 0x12345678;
5626 }
5627 EOCP
5628 set try
5629 if eval $compile; then
5630         echo "<inttypes.h> found." >&4
5631         val="$define"
5632 else
5633         echo "<inttypes.h> NOT found." >&4
5634         val="$undef"
5635 fi
5636 $rm_try
5637 set i_inttypes
5638 eval $setvar
5639
5640 : check for int64_t
5641 echo " "
5642 echo "Checking to see if you have int64_t..." >&4
5643 $cat >try.c <<EOCP
5644 #include <sys/types.h>
5645 #$i_inttypes I_INTTYPES
5646 #ifdef I_INTTYPES
5647 #include <inttypes.h>
5648 #endif
5649 int main() { int64_t x = 7; }
5650 EOCP
5651 set try
5652 if eval $compile; then
5653         val="$define"
5654         echo "You have int64_t."
5655 else
5656         val="$undef"
5657         echo "You do not have int64_t."
5658 fi
5659 $rm_try
5660 set d_int64_t
5661 eval $setvar
5662
5663 : Check if 64bit ints have a quad type
5664 echo " "
5665 echo "Checking which 64-bit integer type we could use..." >&4
5666
5667 case "$intsize" in
5668 8) val=int
5669    set quadtype
5670    eval $setvar
5671    val='"unsigned int"'
5672    set uquadtype
5673    eval $setvar
5674    quadkind=1
5675    ;;
5676 *) case "$longsize" in
5677    8) val=long
5678       set quadtype
5679       eval $setvar
5680       val='"unsigned long"'
5681       set uquadtype
5682       eval $setvar
5683       quadkind=2
5684       ;;
5685    *) case "$d_longlong:$longlongsize" in
5686       define:8)
5687         val='"long long"'
5688         set quadtype
5689         eval $setvar
5690         val='"unsigned long long"'
5691         set uquadtype
5692         eval $setvar
5693         quadkind=3
5694         ;;
5695       *) case "$d_int64_t" in
5696          define)
5697            val=int64_t
5698            set quadtype
5699            eval $setvar
5700            val=uint64_t
5701            set uquadtype
5702            eval $setvar
5703            quadkind=4
5704            ;;
5705          esac
5706          ;;
5707       esac
5708       ;;
5709    esac
5710    ;;
5711 esac
5712
5713 case "$quadtype" in
5714 '')     echo "Alas, no 64-bit integer types in sight." >&4
5715         d_quad="$undef"
5716         ;;
5717 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5718         d_quad="$define"
5719         ;;
5720 esac
5721
5722 : Do we want 64bit support
5723 case "$uselonglong" in
5724 "$define"|true|[yY]*)
5725         cat <<EOM >&4
5726
5727 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5728 EOM
5729         use64bitint="$define"
5730         ;;
5731 esac
5732 case "$use64bits" in
5733 "$define"|true|[yY]*)
5734         cat <<EOM >&4
5735
5736 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5737 EOM
5738         use64bitint="$define"
5739         ;;
5740 esac
5741 case "$use64bitints" in
5742 "$define"|true|[yY]*)
5743         cat <<EOM >&4
5744
5745 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5746 EOM
5747         use64bitint="$define"
5748         ;;
5749 esac
5750 case "$use64bitsint" in
5751 "$define"|true|[yY]*)
5752         cat <<EOM >&4
5753
5754 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5755 EOM
5756         use64bitint="$define"
5757         ;;
5758 esac
5759 case "$uselonglongs" in
5760 "$define"|true|[yY]*)
5761         cat <<EOM >&4
5762
5763 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5764 EOM
5765         use64bitint="$define"
5766         ;;
5767 esac
5768 case "$use64bitsall" in
5769 "$define"|true|[yY]*)
5770         cat <<EOM >&4
5771
5772 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5773 EOM
5774         use64bitall="$define"
5775         ;;
5776 esac
5777
5778 case "$ccflags" in
5779 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5780 esac
5781 case "$use64bitall" in
5782 "$define"|true|[yY]*) use64bitint="$define" ;;
5783 esac
5784
5785 case "$longsize" in
5786 8) cat <<EOM
5787
5788 You have natively 64-bit long integers.
5789 EOM
5790    val="$define"
5791    ;;
5792 *) case "$use64bitint" in
5793    "$define"|true|[yY]*) dflt='y';;
5794    *) dflt='n';;
5795    esac
5796    case "$d_quad" in
5797    "$define") ;;
5798    *) dflt='n' ;;
5799    esac
5800    cat <<EOM
5801
5802 Perl can be built to take advantage of 64-bit integer types
5803 on some systems.  To do so, Configure can be run with -Duse64bitint.
5804 Choosing this option will most probably introduce binary incompatibilities.
5805
5806 If this doesn't make any sense to you, just accept the default '$dflt'.
5807 (The default has been chosen based on your configuration.)
5808 EOM
5809    rp='Try to use 64-bit integers, if available?'
5810    . ./myread
5811    case "$ans" in
5812    [yY]*) val="$define" ;;
5813    *)     val="$undef"  ;;
5814    esac
5815    ;;
5816 esac
5817 set use64bitint
5818 eval $setvar
5819
5820 case "$use64bitall" in
5821 "$define"|true|[yY]*) dflt='y' ;;
5822 *) case "$longsize" in
5823    8) dflt='y' ;;
5824    *) dflt='n' ;;
5825    esac
5826    ;;
5827 esac
5828 cat <<EOM
5829
5830 You may also choose to try maximal 64-bitness.  It means using as much
5831 64-bitness as possible on the platform.  This in turn means even more
5832 binary incompatibilities.  On the other hand, your platform may not
5833 have any more 64-bitness available than what you already have chosen.
5834
5835 If this doesn't make any sense to you, just accept the default '$dflt'.
5836 (The default has been chosen based on your configuration.)
5837 EOM
5838 rp='Try to use maximal 64-bit support, if available?'
5839 . ./myread
5840 case "$ans" in
5841 [yY]*) val="$define" ;;
5842 *)     val="$undef"  ;;
5843 esac
5844 set use64bitall
5845 eval $setvar
5846 case "$use64bitall" in
5847 "$define")
5848         case "$use64bitint" in
5849         "$undef")
5850                 cat <<EOM
5851
5852 Since you have chosen a maximally 64-bit build, I'm also turning on
5853 the use of 64-bit integers.
5854 EOM
5855                 use64bitint="$define" ;;
5856         esac
5857         ;;
5858 esac
5859
5860 : Look for a hint-file generated 'call-back-unit'.  If the
5861 : user has specified that a 64-bit perl is to be built,
5862 : we may need to set or change some other defaults.
5863 if $test -f use64bitint.cbu; then
5864         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5865         . ./use64bitint.cbu
5866 fi
5867 case "$use64bitint" in
5868 "$define"|true|[yY]*)
5869         case "$longsize" in
5870         4) case "$archname64" in
5871            '') archname64=64int ;;
5872            esac
5873            ;;
5874         esac
5875         ;;
5876 esac
5877
5878 : Look for a hint-file generated 'call-back-unit'.  If the
5879 : user has specified that a maximally 64-bit perl is to be built,
5880 : we may need to set or change some other defaults.
5881 if $test -f use64bitall.cbu; then
5882         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5883         . ./use64bitall.cbu
5884 fi
5885 case "$use64bitall" in
5886 "$define"|true|[yY]*)
5887         case "$longsize" in
5888         4) case "$archname64" in
5889            ''|64int) archname64=64all ;;
5890            esac
5891            ;;
5892         esac
5893         ;;
5894 esac
5895
5896 case "$d_quad:$use64bitint" in
5897 $undef:$define)
5898         cat >&4 <<EOF
5899
5900 *** You have chosen to use 64-bit integers,
5901 *** but none can be found.
5902 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5903 *** Cannot continue, aborting.
5904
5905 EOF
5906         exit 1
5907         ;;
5908 esac
5909
5910 : check for length of double
5911 echo " "
5912 case "$doublesize" in
5913 '')
5914         echo "Checking to see how big your double precision numbers are..." >&4
5915         $cat >try.c <<EOCP
5916 #include <stdio.h>
5917 #$i_stdlib I_STDLIB
5918 #ifdef I_STDLIB
5919 #include <stdlib.h>
5920 #endif
5921 int main()
5922 {
5923     printf("%d\n", (int)sizeof(double));
5924     exit(0);
5925 }
5926 EOCP
5927         set try
5928         if eval $compile_ok; then
5929                 doublesize=`$run ./try`
5930                 echo "Your double is $doublesize bytes long."
5931         else
5932                 dflt='8'
5933                 echo "(I can't seem to compile the test program.  Guessing...)"
5934                 rp="What is the size of a double precision number (in bytes)?"
5935                 . ./myread
5936                 doublesize="$ans"
5937         fi
5938         ;;
5939 esac
5940 $rm_try
5941
5942 : check for long doubles
5943 echo " "
5944 echo "Checking to see if you have long double..." >&4
5945 echo 'int main() { long double x = 7.0; }' > try.c
5946 set try
5947 if eval $compile; then
5948         val="$define"
5949         echo "You have long double."
5950 else
5951         val="$undef"
5952         echo "You do not have long double."
5953 fi
5954 $rm_try
5955 set d_longdbl
5956 eval $setvar
5957
5958 : check for length of long double
5959 case "${d_longdbl}${longdblsize}" in
5960 $define)
5961         echo " "
5962         echo "Checking to see how big your long doubles are..." >&4
5963         $cat >try.c <<'EOCP'
5964 #include <stdio.h>
5965 int main()
5966 {
5967         printf("%d\n", sizeof(long double));
5968 }
5969 EOCP
5970         set try
5971         set try
5972         if eval $compile; then
5973                 longdblsize=`$run ./try`
5974                 echo "Your long doubles are $longdblsize bytes long."
5975         else
5976                 dflt='8'
5977                 echo " "
5978                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5979                 rp="What is the size of a long double (in bytes)?"
5980                 . ./myread
5981                 longdblsize="$ans"
5982         fi
5983         if $test "X$doublesize" = "X$longdblsize"; then
5984                 echo "That isn't any different from an ordinary double."
5985                 echo "I'll keep your setting anyway, but you may see some"
5986                 echo "harmless compilation warnings."
5987         fi
5988         ;;
5989 esac
5990 $rm_try
5991
5992 : determine the architecture name
5993 echo " "
5994 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5995         tarch=`arch`"-$osname"
5996 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5997         if uname -m > tmparch 2>&1 ; then
5998                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5999                         -e 's/$/'"-$osname/" tmparch`
6000         else
6001                 tarch="$osname"
6002         fi
6003         $rm -f tmparch
6004 else
6005         tarch="$osname"
6006 fi
6007 case "$myarchname" in
6008 ''|"$tarch") ;;
6009 *)
6010         echo "(Your architecture name used to be $myarchname.)"
6011         archname=''
6012         ;;
6013 esac
6014 case "$targetarch" in
6015 '') ;;
6016 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6017 esac
6018 myarchname="$tarch"
6019 case "$archname" in
6020 '') dflt="$tarch";;
6021 *) dflt="$archname";;
6022 esac
6023 rp='What is your architecture name'
6024 . ./myread
6025 archname="$ans"
6026
6027 : optionally add API version to the architecture for versioned archlibs
6028 case "$useversionedarchname" in
6029 $define|true|[yY]*) dflt='y';;
6030 *)                  dflt='n';;
6031 esac
6032 rp='Add the Perl API version to your archname?'
6033 . ./myread
6034 case "$ans" in
6035 y|Y)    useversionedarchname="$define" ;;
6036 *)      useversionedarchname="$undef" ;;
6037 esac
6038 case "$useversionedarchname" in
6039 $define)
6040         case "$archname" in
6041         *-$api_versionstring)
6042                 echo "...and architecture name already has -$api_versionstring" >&4
6043                 ;;
6044         *)
6045                 archname="$archname-$api_versionstring"
6046                 echo "...setting architecture name to $archname." >&4
6047                 ;;
6048         esac
6049         ;;
6050 esac
6051
6052 case "$usethreads" in
6053 $define)
6054         echo "Threads selected." >&4
6055         case "$archname" in
6056         *-thread*) echo "...and architecture name already has -thread." >&4
6057                 ;;
6058         *)      archname="$archname-thread"
6059                 echo "...setting architecture name to $archname." >&4
6060                 ;;
6061         esac
6062         ;;
6063 esac
6064 case "$usemultiplicity" in
6065 $define)
6066         echo "Multiplicity selected." >&4
6067         case "$archname" in
6068         *-multi*) echo "...and architecture name already has -multi." >&4
6069                 ;;
6070         *)      archname="$archname-multi"
6071                 echo "...setting architecture name to $archname." >&4
6072                 ;;
6073         esac
6074         ;;
6075 esac
6076 case "$use64bitint$use64bitall" in
6077 *"$define"*)
6078         case "$archname64" in
6079         '')
6080                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6081                 ;;
6082         *)
6083                 case "$use64bitint" in
6084                 "$define") echo "64 bit integers selected." >&4 ;;
6085                 esac
6086                 case "$use64bitall" in
6087                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6088                 esac
6089                 case "$archname" in
6090                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6091                         ;;
6092                 *)      archname="$archname-$archname64"
6093                         echo "...setting architecture name to $archname." >&4
6094                         ;;
6095                 esac
6096                 ;;
6097         esac
6098 esac
6099 case "$uselongdouble" in
6100 $define)
6101         echo "Long doubles selected." >&4
6102         case "$longdblsize" in
6103         $doublesize)
6104                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6105                 ;;
6106         *)
6107                 case "$archname" in
6108                 *-ld*) echo "...and architecture name already has -ld." >&4
6109                         ;;
6110                 *)      archname="$archname-ld"
6111                         echo "...setting architecture name to $archname." >&4
6112                         ;;
6113                 esac
6114                 ;;
6115         esac
6116         ;;
6117 esac
6118 if $test -f archname.cbu; then
6119         echo "Your platform has some specific hints for architecture name, using them..."
6120         . ./archname.cbu
6121 fi
6122
6123 : set the prefixit variable, to compute a suitable default value
6124 prefixit='case "$3" in
6125 ""|none)
6126         case "$oldprefix" in
6127         "") eval "$1=\"\$$2\"";;
6128         *)
6129                 case "$3" in
6130                 "") eval "$1=";;
6131                 none)
6132                         eval "tp=\"\$$2\"";
6133                         case "$tp" in
6134                         ""|" ") eval "$1=\"\$$2\"";;
6135                         *) eval "$1=";;
6136                         esac;;
6137                 esac;;
6138         esac;;
6139 *)
6140         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6141         case "$tp" in
6142         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6143         /*-$oldprefix/*|\~*-$oldprefix/*)
6144                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6145         *) eval "$1=\"\$$2\"";;
6146         esac;;
6147 esac'
6148
6149 : determine installation style
6150 : For now, try to deduce it from prefix unless it is already set.
6151 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6152 case "$installstyle" in
6153 '')     case "$prefix" in
6154                 *perl*) dflt='lib';;
6155                 *) dflt='lib/perl5' ;;
6156         esac
6157         ;;
6158 *)      dflt="$installstyle" ;;
6159 esac
6160 : Probably not worth prompting for this since we prompt for all
6161 : the directories individually, and the prompt would be too long and
6162 : confusing anyway.
6163 installstyle=$dflt
6164
6165 : determine where public executables go
6166 echo " "
6167 set dflt bin bin
6168 eval $prefixit
6169 fn=d~
6170 rp='Pathname where the public executables will reside?'
6171 . ./getfile
6172 if $test "X$ansexp" != "X$binexp"; then
6173         installbin=''
6174 fi
6175 prefixvar=bin
6176 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6177 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6178 :     this via initialinstalllocation
6179 . ./setprefixvar
6180
6181 case "$userelocatableinc" in
6182 $define|true|[yY]*)     dflt='y' ;;
6183 *)                      dflt='n' ;;
6184 esac
6185 cat <<EOM
6186
6187 Would you like to build Perl so that the installation is relocatable, so that
6188 library paths in @INC are determined relative to the path of the perl binary?
6189 This is not advised for system Perl installs, or if you need to run setid
6190 scripts or scripts under taint mode.
6191
6192 If this doesn't make any sense to you, just accept the default '$dflt'.
6193 EOM
6194 rp='Use relocatable @INC?'
6195 . ./myread
6196 case "$ans" in
6197 y|Y)    val="$define" ;;
6198 *)      val="$undef"  ;;
6199 esac
6200 set userelocatableinc
6201 eval $setvar
6202
6203 initialinstalllocation="$binexp"
6204 : Default prefix is now "up one level from where the binaries are"
6205 case "$userelocatableinc" in
6206 $define|true|[yY]*)
6207     bin=".../"
6208     binexp=".../"
6209     prefix=".../.."
6210     prefixexp=".../.."
6211     installprefixexp=".../.."
6212     ;;
6213 esac
6214
6215 : determine where private library files go
6216 : Usual default is /usr/local/lib/perl5/$version.
6217 : Also allow things like /opt/perl/lib/$version, since
6218 : /opt/perl/lib/perl5... would be redundant.
6219 : The default "style" setting is made in installstyle.U
6220 case "$installstyle" in
6221 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6222 *)       set dflt privlib lib/$version ;;
6223 esac
6224 eval $prefixit
6225 $cat <<EOM
6226
6227 There are some auxiliary files for $package that need to be put into a
6228 private library directory that is accessible by everyone.
6229
6230 EOM
6231 fn=$binexp
6232 fn=d~+
6233 rp='Pathname where the private library files will reside?'
6234 . ./getfile
6235 prefixvar=privlib
6236 . ./setprefixvar
6237
6238 : set the prefixup variable, to restore leading tilda escape
6239 prefixup='case "$prefixexp" in
6240 "$prefix") ;;
6241 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6242 esac'
6243
6244 : determine where public architecture dependent libraries go
6245 set archlib archlib
6246 eval $prefixit
6247 : privlib default is /usr/local/lib/$package/$version
6248 : archlib default is /usr/local/lib/$package/$version/$archname
6249 : privlib may have an optional trailing /share.
6250 tdflt=`echo $privlib | $sed 's,/share$,,'`
6251 tdflt=$tdflt/$archname
6252 case "$archlib" in
6253 '')     dflt=$tdflt
6254         ;;
6255 *)      dflt="$archlib"
6256     ;;
6257 esac
6258 $cat <<EOM
6259
6260 $spackage contains architecture-dependent library files.  If you are
6261 sharing libraries in a heterogeneous environment, you might store
6262 these files in a separate location.  Otherwise, you can just include
6263 them with the rest of the public library files.
6264
6265 EOM
6266 fn=$binexp
6267 fn=d+~
6268 rp='Where do you want to put the public architecture-dependent libraries?'
6269 . ./getfile
6270 prefixvar=archlib
6271 . ./setprefixvar
6272 if $test X"$archlib" = X"$privlib"; then
6273         d_archlib="$undef"
6274 else
6275         d_archlib="$define"
6276 fi
6277
6278 : see if setuid scripts can be secure
6279 $cat <<EOM
6280
6281 Some kernels have a bug that prevents setuid #! scripts from being
6282 secure.  Some sites have disabled setuid #! scripts because of this.
6283
6284 First let's decide if your kernel supports secure setuid #! scripts.
6285 (If setuid #! scripts would be secure but have been disabled anyway,
6286 don't say that they are secure if asked.)
6287
6288 EOM
6289
6290 val="$undef"
6291 if $test -d /dev/fd; then
6292         echo "#!$ls" >reflect
6293         chmod +x,u+s reflect
6294         ./reflect >flect 2>&1
6295         if $contains "/dev/fd" flect >/dev/null; then
6296                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6297                 val="$define"
6298         else
6299                 $cat <<EOM
6300 If you are not sure if they are secure, I can check but I'll need a
6301 username and password different from the one you are using right now.
6302 If you don't have such a username or don't want me to test, simply
6303 enter 'none'.
6304
6305 EOM
6306                 rp='Other username to test security of setuid scripts with?'
6307                 dflt='none'
6308                 . ./myread
6309                 case "$ans" in
6310                 n|none)
6311                         case "$d_suidsafe" in
6312                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6313                                 dflt=n;;
6314                         "$undef")
6315                                 echo "Well, the $hint value is *not* secure." >&4
6316                                 dflt=n;;
6317                         *)      echo "Well, the $hint value *is* secure." >&4
6318                                 dflt=y;;
6319                         esac
6320                         ;;
6321                 *)
6322                         $rm -f reflect flect
6323                         echo "#!$ls" >reflect
6324                         chmod +x,u+s reflect
6325                         echo >flect
6326                         chmod a+w flect
6327                         echo '"su" will (probably) prompt you for '"$ans's password."
6328                         su $ans -c './reflect >flect'
6329                         if $contains "/dev/fd" flect >/dev/null; then
6330                                 echo "Okay, it looks like setuid scripts are secure." >&4
6331                                 dflt=y
6332                         else
6333                                 echo "I don't think setuid scripts are secure." >&4
6334                                 dflt=n
6335                         fi
6336                         ;;
6337                 esac
6338                 rp='Does your kernel have *secure* setuid scripts?'
6339                 . ./myread
6340                 case "$ans" in
6341                 [yY]*)  val="$define";;
6342                 *)      val="$undef";;
6343                 esac
6344         fi
6345 else
6346         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6347         echo "(That's for file descriptors, not floppy disks.)"
6348         val="$undef"
6349 fi
6350 set d_suidsafe
6351 eval $setvar
6352
6353 $rm -f reflect flect
6354
6355 : now see if they want to do setuid emulation
6356 if $test $patchlevel -lt 11; then
6357 echo " "
6358 val="$undef"
6359 case "$d_suidsafe" in
6360 "$define")
6361         val="$undef"
6362         echo "No need to emulate SUID scripts since they are secure here." >&4
6363         ;;
6364 *)
6365         $cat <<EOM
6366 Some systems have disabled setuid scripts, especially systems where
6367 setuid scripts cannot be secure.  On systems where setuid scripts have
6368 been disabled, the setuid/setgid bits on scripts are currently
6369 useless.  It is possible for $package to detect those bits and emulate
6370 setuid/setgid in a secure fashion.  This emulation will only work if
6371 setuid scripts have been disabled in your kernel.
6372
6373 EOM
6374         case "$d_dosuid" in
6375         "$define") dflt=y ;;
6376         *) dflt=n ;;
6377         esac
6378         rp="Do you want to do setuid/setgid emulation?"
6379         . ./myread
6380         case "$ans" in
6381         [yY]*)  val="$define";;
6382         *)      val="$undef";;
6383         esac
6384         ;;
6385 esac
6386 set d_dosuid
6387 eval $setvar
6388 else
6389     case "$d_dosuid" in
6390         "$define")
6391         cat >&4 <<EOH
6392
6393 SUID emulation has been removed for 5.12
6394 Please re-run Configure without -Dd_dosuid
6395
6396 EOH
6397         exit 1;
6398         ;;
6399     esac
6400     d_dosuid=undef
6401 fi
6402
6403 : Find perl5.005 or later.
6404 echo "Looking for a previously installed perl5.005 or later... "
6405 case "$perl5" in
6406 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6407                 : Check if this perl is recent and can load a simple module
6408                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6409                         perl5=$tdir/perl
6410                         break;
6411                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6412                         perl5=$tdir/perl5
6413                         break;
6414                 fi
6415         done
6416         ;;
6417 *)      perl5="$perl5"
6418         ;;
6419 esac
6420 case "$perl5" in
6421 '')     echo "None found.  That's ok.";;
6422 *)      echo "Using $perl5." ;;
6423 esac
6424
6425 : Set the siteprefix variables
6426 $cat <<EOM
6427
6428 After $package is installed, you may wish to install various
6429 add-on modules and utilities.  Typically, these add-ons will
6430 be installed under $prefix with the rest
6431 of this package.  However, you may wish to install such add-ons
6432 elsewhere under a different prefix.
6433
6434 If you do not wish to put everything under a single prefix, that's
6435 ok.  You will be prompted for the individual locations; this siteprefix
6436 is only used to suggest the defaults.
6437
6438 The default should be fine for most people.
6439
6440 EOM
6441 fn=d~+
6442 rp='Installation prefix to use for add-on modules and utilities?'
6443 : XXX Here might be another good place for an installstyle setting.
6444 case "$siteprefix" in
6445 '') dflt=$prefix ;;
6446 *)  dflt=$siteprefix ;;
6447 esac
6448 . ./getfile
6449 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6450 oldsiteprefix=''
6451 case "$siteprefix" in
6452 '') ;;
6453 *)      case "$ans" in
6454         "$prefix") ;;
6455         *) oldsiteprefix="$prefix";;
6456         esac
6457         ;;
6458 esac
6459 siteprefix="$ans"
6460 siteprefixexp="$ansexp"
6461
6462 : determine where site specific libraries go.
6463 : Usual default is /usr/local/lib/perl5/site_perl/$version
6464 : The default "style" setting is made in installstyle.U
6465 : XXX No longer works with Prefixit stuff.
6466 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6467 case "$sitelib" in
6468 '') case "$installstyle" in
6469         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6470         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6471         esac
6472         ;;
6473 *)      dflt="$sitelib"
6474         ;;
6475 esac
6476 $cat <<EOM
6477
6478 The installation process will create a directory for
6479 site-specific extensions and modules.  Most users find it convenient
6480 to place all site-specific files in this directory rather than in the
6481 main distribution directory.
6482
6483 EOM
6484 fn=d~+
6485 rp='Pathname for the site-specific library files?'
6486 . ./getfile
6487 prefixvar=sitelib
6488 . ./setprefixvar
6489 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6490
6491 : Determine list of previous versions to include in @INC
6492 $cat > getverlist <<EOPL
6493 #!$perl5 -w
6494 use File::Basename;
6495 \$api_versionstring = "$api_versionstring";
6496 \$version = "$version";
6497 \$stem = "$sitelib_stem";
6498 \$archname = "$archname";
6499 EOPL
6500         $cat >> getverlist <<'EOPL'
6501 # The list found is store twice for each entry: the original name, and
6502 # the binary broken down version as pack "sss", so sorting is easy and
6503 # unambiguous. This will work for all versions that have a maximum of
6504 # three digit groups, separate by '.'s or '_'s. Names are extended with
6505 # ".0.0" to ensure at least three elements for the pack.
6506 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6507
6508 # Can't have leading @ because metaconfig interprets it as a command!
6509 ;@inc_version_list=();
6510 # XXX Redo to do opendir/readdir?
6511 if (-d $stem) {
6512     chdir($stem);
6513     ;@candidates = map {
6514         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6515     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6516 }
6517 else {
6518     ;@candidates = ();
6519 }
6520
6521 ($pversion, $aversion, $vsn5005) = map {
6522     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6523 foreach $d (@candidates) {
6524     if ($d->[1] lt $pversion) {
6525         if ($d->[1] ge $aversion) {
6526             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6527         }
6528         elsif ($d->[1] ge $vsn5005) {
6529             unshift(@inc_version_list, grep { -d } $d->[0]);
6530         }
6531     }
6532     else {
6533         # Skip newer version.  I.e. don't look in
6534         # 5.7.0 if we're installing 5.6.1.
6535     }
6536 }
6537
6538 if (@inc_version_list) {
6539     print join(' ', @inc_version_list);
6540 }
6541 else {
6542     # Blank space to preserve value for next Configure run.
6543     print " ";
6544 }
6545 EOPL
6546 chmod +x getverlist
6547 case "$inc_version_list" in
6548 '')     if test -x "$perl5$exe_ext"; then
6549                 dflt=`$perl5 getverlist`
6550         else
6551                 dflt='none'
6552         fi
6553         ;;
6554 $undef) dflt='none' ;;
6555 *)  eval dflt=\"$inc_version_list\" ;;
6556 esac
6557 case "$dflt" in
6558 ''|' ') dflt=none ;;
6559 esac
6560 case "$dflt" in
6561 5.005) dflt=none ;;
6562 esac
6563 $cat <<EOM
6564
6565 In order to ease the process of upgrading, this version of perl
6566 can be configured to use modules built and installed with earlier
6567 versions of perl that were installed under $prefix.  Specify here
6568 the list of earlier versions that this version of perl should check.
6569 If Configure detected no earlier versions of perl installed under
6570 $prefix, then the list will be empty.  Answer 'none' to tell perl
6571 to not search earlier versions.
6572
6573 The default should almost always be sensible, so if you're not sure,
6574 just accept the default.
6575 EOM
6576
6577 rp='List of earlier versions to include in @INC?'
6578 . ./myread
6579 case "$ans" in
6580 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6581 *) inc_version_list="$ans" ;;
6582 esac
6583 case "$inc_version_list" in
6584 ''|' ')
6585         inc_version_list_init='0'
6586         d_inc_version_list="$undef"
6587         ;;
6588 *)      inc_version_list_init=`echo $inc_version_list |
6589                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6590         d_inc_version_list="$define"
6591         ;;
6592 esac
6593 $rm -f getverlist
6594
6595 : see if malloc/malloc.h has to be included
6596 set malloc/malloc.h i_mallocmalloc
6597 eval $inhdr
6598
6599 : see if this is a malloc.h system
6600 : we want a real compile instead of Inhdr because some systems have a
6601 : malloc.h that just gives a compile error saying to use stdlib.h instead
6602 echo " "
6603 $cat >try.c <<EOCP
6604 #include <stdlib.h>
6605 #include <malloc.h>
6606 #$i_mallocmalloc I_MALLOCMALLOC
6607 #ifdef I_MALLOCMALLOC
6608 # include <malloc/malloc.h>
6609 #endif
6610
6611 int main () { return 0; }
6612 EOCP
6613 set try
6614 if eval $compile; then
6615     echo "<malloc.h> found." >&4
6616     val="$define"
6617 else
6618     echo "<malloc.h> NOT found." >&4
6619     val="$undef"
6620 fi
6621 $rm_try
6622 set i_malloc
6623 eval $setvar
6624
6625 : check for void type
6626 echo " "
6627 echo "Checking to see how well your C compiler groks the void type..." >&4
6628 case "$voidflags" in
6629 '')
6630         $cat >try.c <<EOCP
6631 #$i_stdlib I_STDLIB
6632 #ifdef I_STDLIB
6633 #include <stdlib.h>
6634 #endif
6635 #if TRY & 1
6636 void sub() {
6637 #else
6638 sub() {
6639 #endif
6640         extern void moo();      /* function returning void */
6641         void (*goo)();          /* ptr to func returning void */
6642 #if TRY & 8
6643         void *hue;              /* generic ptr */
6644 #endif
6645 #if TRY & 2
6646         void (*foo[10])();
6647 #endif
6648
6649 #if TRY & 4
6650         if(goo == moo) {
6651                 exit(0);
6652         }
6653 #endif
6654         exit(0);
6655 }
6656 int main() { sub(); }
6657 EOCP
6658         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6659                 voidflags=$defvoidused
6660         echo "Good.  It appears to support void to the level $package wants.">&4
6661                 if $contains warning .out >/dev/null 2>&1; then
6662                         echo "However, you might get some warnings that look like this:"
6663                         $cat .out
6664                 fi
6665         else
6666 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6667                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6668                         echo "It supports 1..."
6669                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6670                                 echo "It also supports 2..."
6671                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6672                                         voidflags=7
6673                                         echo "And it supports 4 but not 8 definitely."
6674                                 else
6675                                         echo "It doesn't support 4..."
6676                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6677                                                 voidflags=11
6678                                                 echo "But it supports 8."
6679                                         else
6680                                                 voidflags=3
6681                                                 echo "Neither does it support 8."
6682                                         fi
6683                                 fi
6684                         else
6685                                 echo "It does not support 2..."
6686                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6687                                         voidflags=13
6688                                         echo "But it supports 4 and 8."
6689                                 else
6690                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6691                                                 voidflags=5
6692                                                 echo "And it supports 4 but has not heard about 8."
6693                                         else
6694                                                 echo "However it supports 8 but not 4."
6695                                         fi
6696                                 fi
6697                         fi
6698                 else
6699                         echo "There is no support at all for void."
6700                         voidflags=0
6701                 fi
6702         fi
6703 esac
6704 case "$voidflags" in
6705 "$defvoidused") ;;
6706 *)      $cat >&4 <<'EOM'
6707   Support flag bits are:
6708     1: basic void declarations.
6709     2: arrays of pointers to functions returning void.
6710     4: operations between pointers to and addresses of void functions.
6711     8: generic void pointers.
6712 EOM
6713         dflt="$voidflags";
6714         rp="Your void support flags add up to what?"
6715         . ./myread
6716         voidflags="$ans"
6717         ;;
6718 esac
6719 $rm_try
6720
6721 : check for length of pointer
6722 echo " "
6723 case "$ptrsize" in
6724 '')
6725         echo "Checking to see how big your pointers are..." >&4
6726         if test "$voidflags" -gt 7; then
6727                 echo '#define VOID_PTR char *' > try.c
6728         else
6729                 echo '#define VOID_PTR void *' > try.c
6730         fi
6731         $cat >>try.c <<EOCP
6732 #include <stdio.h>
6733 #$i_stdlib I_STDLIB
6734 #ifdef I_STDLIB
6735 #include <stdlib.h>
6736 #endif
6737 int main()
6738 {
6739     printf("%d\n", (int)sizeof(VOID_PTR));
6740     exit(0);
6741 }
6742 EOCP
6743         set try
6744         if eval $compile_ok; then
6745                 ptrsize=`$run ./try`
6746                 echo "Your pointers are $ptrsize bytes long."
6747         else
6748                 dflt='4'
6749                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6750                 rp="What is the size of a pointer (in bytes)?"
6751                 . ./myread
6752                 ptrsize="$ans"
6753         fi
6754         ;;
6755 esac
6756 $rm_try
6757 case "$use64bitall" in
6758 "$define"|true|[yY]*)
6759         case "$ptrsize" in
6760         4)      cat <<EOM >&4
6761
6762 *** You have chosen a maximally 64-bit build,
6763 *** but your pointers are only 4 bytes wide.
6764 *** Please rerun Configure without -Duse64bitall.
6765 EOM
6766                 case "$d_quad" in
6767                 define)
6768                         cat <<EOM >&4
6769 *** Since you have quads, you could possibly try with -Duse64bitint.
6770 EOM
6771                         ;;
6772                 esac
6773                 cat <<EOM >&4
6774 *** Cannot continue, aborting.
6775
6776 EOM
6777
6778                 exit 1
6779                 ;;
6780         esac
6781         ;;
6782 esac
6783
6784
6785 : determine whether to use malloc wrapping
6786 echo " "
6787 case "$usemallocwrap" in
6788 [yY]*|true|$define)     dflt='y' ;;
6789 [nN]*|false|$undef)     dflt='n' ;;
6790 *)      case "$usedevel" in
6791         [yY]*|true|$define)     dflt='y' ;;
6792         *) dflt='n' ;;
6793         esac
6794         ;;
6795 esac
6796 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6797 . ./myread
6798 usemallocwrap="$ans"
6799 case "$ans" in
6800 y*|true)
6801         usemallocwrap="$define" ;;
6802 *)
6803         usemallocwrap="$undef" ;;
6804 esac
6805
6806 : determine which malloc to compile in
6807 echo " "
6808 case "$usemymalloc" in
6809 [yY]*|true|$define)     dflt='y' ;;
6810 [nN]*|false|$undef)     dflt='n' ;;
6811 *)      case "$ptrsize" in
6812         4) dflt='y' ;;
6813         *) dflt='n' ;;
6814         esac
6815         if test "$useithreads" = "$define"; then dflt='n'; fi
6816         ;;
6817 esac
6818 rp="Do you wish to attempt to use the malloc that comes with $package?"
6819 . ./myread
6820 usemymalloc="$ans"
6821 case "$ans" in
6822 y*|true)
6823         usemymalloc='y'
6824         mallocsrc='malloc.c'
6825         mallocobj="malloc$_o"
6826         d_mymalloc="$define"
6827         case "$libs" in
6828         *-lmalloc*)
6829                 : Remove malloc from list of libraries to use
6830                 echo "Removing unneeded -lmalloc from library list" >&4
6831                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6832                 shift
6833                 libs="$*"
6834                 echo "libs = $libs" >&4
6835                 ;;
6836         esac
6837         ;;
6838 *)
6839         usemymalloc='n'
6840         mallocsrc=''
6841         mallocobj=''
6842         d_mymalloc="$undef"
6843         ;;
6844 esac
6845
6846 : compute the return types of malloc and free
6847 echo " "
6848 $cat >malloc.c <<END
6849 #$i_malloc I_MALLOC
6850 #$i_stdlib I_STDLIB
6851 #include <stdio.h>
6852 #include <sys/types.h>
6853 #ifdef I_MALLOC
6854 #include <malloc.h>
6855 #endif
6856 #ifdef I_STDLIB
6857 #include <stdlib.h>
6858 #endif
6859 #ifdef TRY_MALLOC
6860 void *malloc();
6861 #endif
6862 #ifdef TRY_FREE
6863 void free();
6864 #endif
6865 END
6866 case "$malloctype" in
6867 '')
6868         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6869                 malloctype='void *'
6870         else
6871                 malloctype='char *'
6872         fi
6873         ;;
6874 esac
6875 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6876
6877 case "$freetype" in
6878 '')
6879         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6880                 freetype='void'
6881         else
6882                 freetype='int'
6883         fi
6884         ;;
6885 esac
6886 echo "Your system uses $freetype free(), it would seem." >&4
6887 $rm -f malloc.[co]
6888 : determine where site specific architecture-dependent libraries go.
6889 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6890 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6891 : sitelib may have an optional trailing /share.
6892 case "$sitearch" in
6893 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6894         dflt="$dflt/$archname"
6895         ;;
6896 *)      dflt="$sitearch"
6897         ;;
6898 esac
6899 set sitearch sitearch none
6900 eval $prefixit
6901 $cat <<EOM
6902
6903 The installation process will also create a directory for
6904 architecture-dependent site-specific extensions and modules.
6905
6906 EOM
6907 fn=d~+
6908 rp='Pathname for the site-specific architecture-dependent library files?'
6909 . ./getfile
6910 prefixvar=sitearch
6911 . ./setprefixvar
6912 if $test X"$sitearch" = X"$sitelib"; then
6913         d_sitearch="$undef"
6914 else
6915         d_sitearch="$define"
6916 fi
6917
6918 : Set the vendorprefix variables
6919 $cat <<EOM
6920
6921 The installation process will also create a directory for
6922 vendor-supplied add-ons.  Vendors who supply perl with their system
6923 may find it convenient to place all vendor-supplied files in this
6924 directory rather than in the main distribution directory.  This will
6925 ease upgrades between binary-compatible maintenance versions of perl.
6926
6927 Of course you may also use these directories in whatever way you see
6928 fit.  For example, you might use them to access modules shared over a
6929 company-wide network.
6930
6931 The default answer should be fine for most people.
6932 This causes further questions about vendor add-ons to be skipped
6933 and no vendor-specific directories will be configured for perl.
6934
6935 EOM
6936 rp='Do you want to configure vendor-specific add-on directories?'
6937 case "$usevendorprefix" in
6938 define|true|[yY]*) dflt=y ;;
6939 *)      : User may have set vendorprefix directly on Configure command line.
6940         case "$vendorprefix" in
6941         ''|' ') dflt=n ;;
6942         *)      dflt=y ;;
6943         esac
6944         ;;
6945 esac
6946 . ./myread
6947 case "$ans" in
6948 [yY]*)  fn=d~+
6949         rp='Installation prefix to use for vendor-supplied add-ons?'
6950         case "$vendorprefix" in
6951         '') dflt='' ;;
6952         *)  dflt=$vendorprefix ;;
6953         esac
6954         . ./getfile
6955         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6956         oldvendorprefix=''
6957         case "$vendorprefix" in
6958         '') ;;
6959         *)      case "$ans" in
6960                 "$prefix") ;;
6961                 *) oldvendorprefix="$prefix";;
6962                 esac
6963                 ;;
6964         esac
6965         usevendorprefix="$define"
6966         vendorprefix="$ans"
6967         vendorprefixexp="$ansexp"
6968         ;;
6969 *)      usevendorprefix="$undef"
6970         vendorprefix=''
6971         vendorprefixexp=''
6972         ;;
6973 esac
6974
6975 : Set the vendorlib variables
6976 case "$vendorprefix" in
6977 '')     d_vendorlib="$undef"
6978         vendorlib=''
6979         vendorlibexp=''
6980         ;;
6981 *)      d_vendorlib="$define"
6982         : determine where vendor-supplied modules go.
6983         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6984         case "$vendorlib" in
6985         '')
6986                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6987                 case "$installstyle" in
6988                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6989                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6990                 esac
6991                 ;;
6992         *)      dflt="$vendorlib"
6993                 ;;
6994         esac
6995         fn=d~+
6996         rp='Pathname for the vendor-supplied library files?'
6997         . ./getfile
6998         vendorlib="$ans"
6999         vendorlibexp="$ansexp"
7000         ;;
7001 esac
7002 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7003 prefixvar=vendorlib
7004 . ./installprefix
7005
7006 : Set the vendorarch variables
7007 case "$vendorprefix" in
7008 '')     d_vendorarch="$undef"
7009         vendorarch=''
7010         vendorarchexp=''
7011         ;;
7012 *)      d_vendorarch="$define"
7013         : determine where vendor-supplied architecture-dependent libraries go.
7014         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7015         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7016         : vendorlib may have an optional trailing /share.
7017         case "$vendorarch" in
7018         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7019                 dflt="$dflt/$archname"
7020                 ;;
7021         *)      dflt="$vendorarch" ;;
7022         esac
7023         fn=d~+
7024         rp='Pathname for vendor-supplied architecture-dependent files?'
7025         . ./getfile
7026         vendorarch="$ans"
7027         vendorarchexp="$ansexp"
7028         ;;
7029 esac
7030 prefixvar=vendorarch
7031 . ./installprefix
7032 if $test X"$vendorarch" = X"$vendorlib"; then
7033         d_vendorarch="$undef"
7034 else
7035         d_vendorarch="$define"
7036 fi
7037
7038 : Final catch-all directories to search
7039 $cat <<EOM
7040
7041 Lastly, you can have perl look in other directories for extensions and
7042 modules in addition to those already specified.
7043 These directories will be searched after
7044         $sitearch
7045         $sitelib
7046 EOM
7047 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7048 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7049 echo ' '
7050 case "$otherlibdirs" in
7051 ''|' ') dflt='none' ;;
7052 *)      dflt="$otherlibdirs" ;;
7053 esac
7054 $cat <<EOM
7055 Enter a colon-separated set of extra paths to include in perl's @INC
7056 search path, or enter 'none' for no extra paths.
7057
7058 EOM
7059
7060 rp='Colon-separated list of additional directories for perl to search?'
7061 . ./myread
7062 case "$ans" in
7063 ' '|''|none)    otherlibdirs=' ' ;;
7064 *)      otherlibdirs="$ans" ;;
7065 esac
7066 case "$otherlibdirs" in
7067 ' ') val=$undef ;;
7068 *)      val=$define ;;
7069 esac
7070 set d_perl_otherlibdirs
7071 eval $setvar
7072
7073 : Cruising for prototypes
7074 echo " "
7075 echo "Checking out function prototypes..." >&4
7076 $cat >prototype.c <<EOCP
7077 #$i_stdlib I_STDLIB
7078 #ifdef I_STDLIB
7079 #include <stdlib.h>
7080 #endif
7081 int main(int argc, char *argv[]) {
7082         exit(0);}
7083 EOCP
7084 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7085         echo "Your C compiler appears to support function prototypes."
7086         val="$define"
7087 else
7088         echo "Your C compiler doesn't seem to understand function prototypes."
7089         val="$undef"
7090 fi
7091 set prototype
7092 eval $setvar
7093 $rm -f prototype*
7094
7095 : Check if ansi2knr is required
7096 case "$prototype" in
7097 "$define") ;;
7098 *)      ansi2knr='ansi2knr'
7099         echo " "
7100         cat <<EOM >&4
7101
7102 $me:  FATAL ERROR:
7103 This version of $package can only be compiled by a compiler that 
7104 understands function prototypes.  Unfortunately, your C compiler 
7105         $cc $ccflags
7106 doesn't seem to understand them.  Sorry about that.
7107
7108 If GNU cc is available for your system, perhaps you could try that instead.  
7109
7110 Eventually, we hope to support building Perl with pre-ANSI compilers.
7111 If you would like to help in that effort, please contact <perlbug@perl.org>.
7112
7113 Aborting Configure now.
7114 EOM
7115         exit 2
7116         ;;
7117 esac
7118
7119 : DTrace support
7120 dflt_dtrace='/usr/sbin/dtrace'
7121 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7122
7123 cat <<EOM
7124
7125 Perl can be built to support DTrace on platforms that support it.
7126 DTrace is a diagnosis and performance analysis tool from Sun.
7127
7128 If this doesn't make any sense to you, just accept the default '$dflt'.
7129 EOM
7130
7131 while $test 1 ; do
7132         case "$usedtrace" in
7133         $define|true|[yY]*)
7134                 dflt='y'
7135                 ;;
7136         ?*)
7137                 dflt='y'
7138                 dflt_dtrace=$usedtrace
7139                 ;;
7140         *)
7141                 dflt='n'
7142                 ;;
7143         esac
7144
7145         rp='Support DTrace if available?'
7146         . ./myread
7147         case "$ans" in
7148         y|Y)    val="$define" ;;
7149         *)      val="$undef" ;;
7150         esac
7151         set usedtrace
7152         eval $setvar
7153
7154         test "X$usedtrace" != "X$define" && break
7155
7156         echo " "
7157         rp='Where is the dtrace executable?'
7158         dflt=$dflt_dtrace
7159         . ./getfile
7160         val="$ans"
7161         set dtrace
7162         eval $setvar
7163
7164         if $test -f $dtrace
7165         then
7166                 if $dtrace -h -s ../perldtrace.d \
7167                         -o perldtrace.tmp >/dev/null 2>&1 \
7168                         && rm -f perldtrace.tmp
7169                 then
7170                         echo " "
7171                         echo "Good: your $dtrace knows about the -h flag."
7172                 else
7173                         cat >&2 <<EOM
7174
7175 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7176 ***
7177 *** Your installed dtrace doesn't support the -h switch to compile a D
7178 *** program into a C header. Can't continue.
7179
7180 EOM
7181                         exit 1
7182                 fi
7183                 break;
7184         fi
7185
7186         case "$fastread" in
7187         yes)
7188                 cat >&2 <<EOM
7189
7190 *** $me:  Fatal Error:  $dtrace not found.
7191 *** Can't continue.
7192
7193 EOM
7194                 exit 1
7195                 ;;
7196         *)
7197                 echo "*** $dtrace was not found."
7198                 echo " "
7199                 ;;
7200         esac
7201 done
7202
7203 : See if we want extra modules installed
7204 echo " "
7205 case "$extras" in
7206 '') dflt='n';;
7207 *) dflt='y';;
7208 esac
7209 cat <<EOM
7210 Perl can be built with extra modules or bundles of modules which
7211 will be fetched from the CPAN and installed alongside Perl.
7212
7213 Notice that you will need access to the CPAN; either via the Internet,
7214 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7215 be asked later to configure the CPAN.pm module which will in turn do
7216 the installation of the rest of the extra modules or bundles.)
7217
7218 Notice also that if the modules require any external software such as
7219 libraries and headers (the libz library and the zlib.h header for the
7220 Compress::Zlib module, for example) you MUST have any such software
7221 already installed, this configuration process will NOT install such
7222 things for you.
7223
7224 If this doesn't make any sense to you, just accept the default '$dflt'.
7225 EOM
7226 rp='Install any extra modules (y or n)?'
7227 . ./myread
7228 case "$ans" in
7229 y|Y)
7230         cat <<EOM
7231
7232 Please list any extra modules or bundles to be installed from CPAN,
7233 with spaces between the names.  The names can be in any format the
7234 'install' command of CPAN.pm will understand.  (Answer 'none',
7235 without the quotes, to install no extra modules or bundles.)
7236 EOM
7237         rp='Extras?'
7238         dflt="$extras"
7239         . ./myread
7240         extras="$ans"
7241 esac
7242 case "$extras" in
7243 ''|'none')
7244         val=''
7245         $rm -f ../extras.lst
7246         ;;
7247 *)      echo "(Saving the list of extras for later...)"
7248         echo "$extras" > ../extras.lst
7249         val="'$extras'"
7250         ;;
7251 esac
7252 set extras
7253 eval $setvar
7254 echo " "
7255
7256 : determine where html pages for programs go
7257 set html1dir html1dir none
7258 eval $prefixit
7259 $cat <<EOM
7260
7261 If you wish to install html files for programs in $spackage, indicate
7262 the appropriate directory here.  To skip installing html files,
7263 answer "none".
7264 EOM
7265 case "$html1dir" in
7266 ''|none|$undef|' ') dflt=none ;;
7267 *) dflt=$html1dir ;;
7268 esac
7269 fn=dn+~
7270 rp="Directory for the main $spackage html pages?"
7271 . ./getfile
7272 prefixvar=html1dir
7273 . ./setprefixvar
7274 : Use ' ' for none so value is preserved next time through Configure
7275 $test X"$html1dir" = "X" && html1dir=' '
7276
7277 : determine where html pages for libraries and modules go
7278 set html3dir html3dir none
7279 eval $prefixit
7280 $cat <<EOM
7281
7282 If you wish to install html files for modules associated with $spackage,
7283 indicate the appropriate directory here.  To skip installing html files,
7284 answer "none".
7285 EOM
7286 : There is no obvious default.  If they have specified html1dir, then
7287 : try to key off that, possibly changing .../html1 into .../html3.
7288 case "$html3dir" in
7289 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7290 *) dflt=$html3dir ;;
7291 esac
7292 fn=dn+~
7293 rp="Directory for the $spackage module html pages?"
7294 . ./getfile
7295 prefixvar=html3dir
7296 . ./setprefixvar
7297 : Use ' ' for none so value is preserved next time through Configure
7298 $test X"$html3dir" = "X" && html3dir=' '
7299
7300 : determine whether to install perl also as /usr/bin/perl
7301
7302 echo " "
7303 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7304         $cat <<EOM
7305 Many scripts expect perl to be installed as /usr/bin/perl.
7306
7307 If you want to, I can install the perl you are about to compile
7308 as /usr/bin/perl (in addition to $bin/perl).
7309 EOM
7310         if test -f /usr/bin/perl; then
7311             $cat <<EOM
7312
7313 However, please note that because you already have a /usr/bin/perl,
7314 overwriting that with a new Perl would very probably cause problems.
7315 Therefore I'm assuming you don't want to do that (unless you insist).
7316
7317 EOM
7318             case "$installusrbinperl" in
7319             "$define"|[yY]*)    dflt='y';;
7320             *)                  dflt='n';;
7321             esac
7322         else
7323             $cat <<EOM
7324
7325 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7326
7327 EOM
7328             case "$installusrbinperl" in
7329             "$undef"|[nN]*)     dflt='n';;
7330             *)                  dflt='y';;
7331             esac
7332         fi
7333         rp="Do you want to install perl as /usr/bin/perl?"
7334         . ./myread
7335         case "$ans" in
7336         [yY]*)  val="$define";;
7337         *)      val="$undef" ;;
7338         esac
7339 else
7340         val="$undef"
7341 fi
7342 set installusrbinperl
7343 eval $setvar
7344
7345 : Check if we are using the GNU C library
7346 echo " "
7347 echo "Checking for GNU C Library..." >&4
7348 cat >try.c <<'EOCP'
7349 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7350    alone are insufficient to distinguish different versions, such as
7351    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7352    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7353 */
7354 #include <stdio.h>
7355 int main(void)
7356 {
7357 #ifdef __GLIBC__
7358 #   ifdef __GLIBC_MINOR__
7359 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7360 #           include <gnu/libc-version.h>
7361             printf("%s\n",  gnu_get_libc_version());
7362 #       else
7363             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7364 #       endif
7365 #   else
7366         printf("%d\n",  __GLIBC__);
7367 #   endif
7368     return 0;
7369 #else
7370     return 1;
7371 #endif
7372 }
7373 EOCP
7374 set try
7375 if eval $compile_ok && $run ./try > glibc.ver; then
7376         val="$define"
7377         gnulibc_version=`$cat glibc.ver`
7378         echo "You are using the GNU C Library version $gnulibc_version"
7379 else
7380         val="$undef"
7381         gnulibc_version=''
7382         echo "You are not using the GNU C Library"
7383 fi
7384 $rm_try glibc.ver
7385 set d_gnulibc
7386 eval $setvar
7387
7388 : see if nm is to be used to determine whether a symbol is defined or not
7389 case "$usenm" in
7390 '')
7391         dflt=''
7392         case "$d_gnulibc" in
7393         "$define")
7394                 echo " "
7395                 echo "nm probably won't work on the GNU C Library." >&4
7396                 dflt=n
7397                 ;;
7398         esac
7399         case "$dflt" in
7400         '')
7401                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7402                         echo " "
7403                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7404                         echo "'nm' won't be sufficient on this system." >&4
7405                         dflt=n
7406                 fi
7407                 ;;
7408         esac
7409         case "$dflt" in
7410         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7411                 if $test $dflt -gt 20; then
7412                         dflt=y
7413                 else
7414                         dflt=n
7415                 fi
7416                 ;;
7417         esac
7418         ;;
7419 *)
7420         case "$usenm" in
7421         true|$define) dflt=y;;
7422         *) dflt=n;;
7423         esac
7424         ;;
7425 esac
7426 $cat <<EOM
7427
7428 I can use $nm to extract the symbols from your C libraries. This
7429 is a time consuming task which may generate huge output on the disk (up
7430 to 3 megabytes) but that should make the symbols extraction faster. The
7431 alternative is to skip the 'nm' extraction part and to compile a small
7432 test program instead to determine whether each symbol is present. If
7433 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7434 this may be the best solution.
7435
7436 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7437
7438 EOM
7439 rp="Shall I use $nm to extract C symbols from the libraries?"
7440 . ./myread
7441 case "$ans" in
7442 [Nn]*) usenm=false;;
7443 *) usenm=true;;
7444 esac
7445
7446 runnm=$usenm
7447 case "$reuseval" in
7448 true) runnm=false;;
7449 esac
7450
7451 : nm options which may be necessary
7452 case "$nm_opt" in
7453 '') if $test -f /mach_boot; then
7454                 nm_opt=''       # Mach
7455         elif $test -d /usr/ccs/lib; then
7456                 nm_opt='-p'     # Solaris (and SunOS?)
7457         elif $test -f /dgux; then
7458                 nm_opt='-p'     # DG-UX
7459         elif $test -f /lib64/rld; then
7460                 nm_opt='-p'     # 64-bit Irix
7461         else
7462                 nm_opt=''
7463         fi;;
7464 esac
7465
7466 : nm options which may be necessary for shared libraries but illegal
7467 : for archive libraries.  Thank you, Linux.
7468 case "$nm_so_opt" in
7469 '')     case "$myuname" in
7470         *linux*|gnu*)
7471                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7472                         nm_so_opt='--dynamic'
7473                 fi
7474                 ;;
7475         esac
7476         ;;
7477 esac
7478
7479 : Figure out where the libc is located
7480 case "$runnm" in
7481 true)
7482 : get list of predefined functions in a handy place
7483 echo " "
7484 case "$libc" in
7485 '') libc=unknown
7486         case "$libs" in
7487         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7488         esac
7489         ;;
7490 esac
7491 case "$libs" in
7492 '') ;;
7493 *)  for thislib in $libs; do
7494         case "$thislib" in
7495         -lc|-lc_s)
7496                 : Handle C library specially below.
7497                 ;;
7498         -l*)
7499                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7500                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7501                         :
7502                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7503                         :
7504                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7505                         :
7506                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7507                         :
7508                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7509                         :
7510                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7511                         :
7512                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7513                         :
7514                 else
7515                         try=''
7516                 fi
7517                 libnames="$libnames $try"
7518                 ;;
7519         *) libnames="$libnames $thislib" ;;
7520         esac
7521         done
7522         ;;
7523 esac
7524 xxx=normal
7525 case "$libc" in
7526 unknown)
7527         set /lib/libc.$so
7528         for xxx in $libpth; do
7529                 $test -r $1 || set $xxx/libc.$so
7530                 : The messy sed command sorts on library version numbers.
7531                 $test -r $1 || \
7532                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7533                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7534                                 h
7535                                 s/[0-9][0-9]*/0000&/g
7536                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7537                                 G
7538                                 s/\n/ /' | \
7539                          $sort | $sed -e 's/^.* //'`
7540                 eval set \$$#
7541         done
7542         $test -r $1 || set /usr/ccs/lib/libc.$so
7543         $test -r $1 || set /lib/libsys_s$_a
7544         ;;
7545 *)
7546         set blurfl
7547         ;;
7548 esac
7549 if $test -r "$1"; then
7550         echo "Your (shared) C library seems to be in $1."
7551         libc="$1"
7552 elif $test -r /lib/libc && $test -r /lib/clib; then
7553         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7554         xxx=apollo
7555         libc='/lib/clib /lib/libc'
7556         if $test -r /lib/syslib; then
7557                 echo "(Your math library is in /lib/syslib.)"
7558                 libc="$libc /lib/syslib"
7559         fi
7560 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7561         echo "Your C library seems to be in $libc, as you said before."
7562 elif $test -r $incpath/usr/lib/libc$_a; then
7563         libc=$incpath/usr/lib/libc$_a;
7564         echo "Your C library seems to be in $libc.  That's fine."
7565 elif $test -r /lib/libc$_a; then
7566         libc=/lib/libc$_a;
7567         echo "Your C library seems to be in $libc.  You're normal."
7568 else
7569         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7570                 :
7571         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7572                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7573         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7574                 :
7575         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7576                 :
7577         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7578                 :
7579         else
7580                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7581         fi
7582         if $test -r "$tans"; then
7583                 echo "Your C library seems to be in $tans, of all places."
7584                 libc=$tans
7585         else
7586                 libc='blurfl'
7587         fi
7588 fi
7589 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7590         dflt="$libc"
7591         cat <<EOM
7592
7593 If the guess above is wrong (which it might be if you're using a strange
7594 compiler, or your machine supports multiple models), you can override it here.
7595
7596 EOM
7597 else
7598         dflt=''
7599         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7600         cat >&4 <<EOM
7601 I can't seem to find your C library.  I've looked in the following places:
7602
7603 EOM
7604         $sed 's/^/      /' libpath
7605         cat <<EOM
7606
7607 None of these seems to contain your C library. I need to get its name...
7608
7609 EOM
7610 fi
7611 fn=f
7612 rp='Where is your C library?'
7613 . ./getfile
7614 libc="$ans"
7615
7616 echo " "
7617 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7618 set X `cat libnames`
7619 shift
7620 xxx=files
7621 case $# in 1) xxx=file; esac
7622 echo "Extracting names from the following $xxx for later perusal:" >&4
7623 echo " "
7624 $sed 's/^/      /' libnames >&4
7625 echo " "
7626 $echo $n "This may take a while...$c" >&4
7627
7628 for file in $*; do
7629         case $file in
7630         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7631         *) $nm $nm_opt $file 2>/dev/null;;
7632         esac
7633 done >libc.tmp
7634
7635 $echo $n ".$c"
7636 $grep fprintf libc.tmp > libc.ptf
7637 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7638 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7639 xxx='[ADTSIWi]'
7640 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7641         eval $xscan;\
7642         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7643                 eval $xrun
7644 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7645         eval $xscan;\
7646         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7647                 eval $xrun
7648 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7649         eval $xscan;\
7650         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7651                 eval $xrun
7652 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7653         eval $xscan;\
7654         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7655                 eval $xrun
7656 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7657         eval $xscan;\
7658         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7659                 eval $xrun
7660 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7661         eval $xscan;\
7662         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7663                 eval $xrun
7664 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7665                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7666         eval $xscan;\
7667         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7668                 eval $xrun
7669 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7670         eval $xscan;\
7671         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7672                 eval $xrun
7673 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7674         eval $xscan;\
7675         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7676                 eval $xrun
7677 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7678         eval $xscan;\
7679         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7680                 eval $xrun
7681 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7682         eval $xscan;\
7683         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7684                 eval $xrun
7685 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7686         eval $xscan;\
7687         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7688                 eval $xrun
7689 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7690         eval $xscan;\
7691         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7692                 eval $xrun
7693 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7694         eval $xscan;\
7695         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7696                 eval $xrun
7697 else
7698         $nm -p $* 2>/dev/null >libc.tmp
7699         $grep fprintf libc.tmp > libc.ptf
7700         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7701                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7702         then
7703                 nm_opt='-p'
7704                 eval $xrun
7705         else
7706                 echo " "
7707                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7708                 com=''
7709                 if $ar t $libc > libc.tmp && \
7710                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7711                 then
7712                         for thisname in $libnames $libc; do
7713                                 $ar t $thisname >>libc.tmp
7714                         done
7715                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7716                         echo "Ok." >&4
7717                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7718                         for thisname in $libnames $libc; do
7719                                 $ar tv $thisname >>libc.tmp
7720                                 emximp -o tmp.imp $thisname \
7721                                     2>/dev/null && \
7722                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7723                                     < tmp.imp >>libc.tmp
7724                                 $rm -f tmp.imp
7725                         done
7726                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7727                         echo "Ok." >&4
7728                 else
7729                         echo "$ar didn't seem to work right." >&4
7730                         echo "Maybe this is a Cray...trying bld instead..." >&4
7731                         if  bld t $libc | \
7732                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7733                                 $test -s libc.list
7734                         then
7735                                 for thisname in $libnames; do
7736                                         bld t $libnames | \
7737                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7738                                         $ar t $thisname >>libc.tmp
7739                                 done
7740                                 echo "Ok." >&4
7741                         else
7742                                 echo "That didn't work either.  Giving up." >&4
7743                                 exit 1
7744                         fi
7745                 fi
7746         fi
7747 fi
7748 nm_extract="$com"
7749 case "$PASE" in
7750 define)
7751     echo " "
7752     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7753     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7754     ;;
7755 *)  if $test -f /lib/syscalls.exp; then
7756         echo " "
7757         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7758         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7759                 /lib/syscalls.exp >>libc.list
7760     fi
7761     ;;
7762 esac
7763 ;;
7764 esac
7765 $rm -f libnames libpath
7766
7767 : see if dld is available
7768 set dld.h i_dld
7769 eval $inhdr
7770
7771 : Check if we are using C++
7772 echo " "
7773 echo "Checking for C++..." >&4
7774 $cat >try.c <<'EOCP'
7775 #include <stdio.h>
7776 int main(void)
7777 {
7778 #ifdef __cplusplus
7779     return 0;
7780 #else
7781     return 1;
7782 #endif
7783 }
7784 EOCP
7785 set try
7786 if eval $compile_ok && $run ./try; then
7787         val="$define"
7788         echo "You are using a C++ compiler."
7789 else
7790         val="$undef"
7791         echo "You are not using a C++ compiler."
7792 fi
7793 $rm_try cplusplus$$
7794 set d_cplusplus
7795 eval $setvar
7796
7797 : is a C symbol defined?
7798 csym='tlook=$1;
7799 case "$3" in
7800 -v) tf=libc.tmp; tdc="";;
7801 -a) tf=libc.tmp; tdc="[]";;
7802 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7803 esac;
7804 case "$d_cplusplus" in
7805     $define)    extern_C="extern \"C\"" ;;
7806     *)          extern_C="extern"       ;;
7807 esac;
7808 tx=yes;
7809 case "$reuseval-$4" in
7810 true-) ;;
7811 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7812 esac;
7813 case "$tx" in
7814 yes)
7815         tval=false;
7816         if $test "$runnm" = true; then
7817                 if $contains $tlook $tf >/dev/null 2>&1; then
7818                         tval=true;
7819                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7820                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7821                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7822                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7823                         $rm_try;
7824                 fi;
7825         else
7826                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7827                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7828                 $rm_try;
7829         fi;
7830         ;;
7831 *)
7832         case "$tval" in
7833         $define) tval=true;;
7834         *) tval=false;;
7835         esac;
7836         ;;
7837 esac;
7838 eval "$2=$tval"'
7839
7840 : define an is-in-libc? function
7841 inlibc='echo " "; td=$define; tu=$undef;
7842 sym=$1; var=$2; eval "was=\$$2";
7843 tx=yes;
7844 case "$reuseval$was" in
7845 true) ;;
7846 true*) tx=no;;
7847 esac;
7848 case "$tx" in
7849 yes)
7850         set $sym tres -f;
7851         eval $csym;
7852         case "$tres" in
7853         true)
7854                 echo "$sym() found." >&4;
7855                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7856         *)
7857                 echo "$sym() NOT found." >&4;
7858                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7859         esac;;
7860 *)
7861         case "$was" in
7862         $define) echo "$sym() found." >&4;;
7863         *) echo "$sym() NOT found." >&4;;
7864         esac;;
7865 esac'
7866
7867 : see if dlopen exists
7868 xxx_runnm="$runnm"
7869 xxx_ccflags="$ccflags"
7870 runnm=false
7871 : with g++ one needs -shared to get is-in-libc to work for dlopen
7872 case "$gccversion" in
7873 '')     ;;
7874 *)      case "$d_cplusplus" in
7875         "$define") ccflags="$ccflags -shared" ;;
7876         esac
7877         ;;
7878 esac
7879 set dlopen d_dlopen
7880 eval $inlibc
7881 runnm="$xxx_runnm"
7882 ccflags="$xxx_ccflags"
7883
7884 : see if this is a unistd.h system
7885 set unistd.h i_unistd
7886 eval $inhdr
7887
7888 : determine which dynamic loading, if any, to compile in
7889 echo " "
7890 dldir="ext/DynaLoader"
7891 case "$usedl" in
7892 $define|y|true)
7893         dflt='y'
7894         usedl="$define"
7895         ;;
7896 $undef|n|false)
7897         dflt='n'
7898         usedl="$undef"
7899         ;;
7900 *)
7901         dflt='n'
7902         case "$d_dlopen" in
7903             $define) dflt='y' ;;
7904         esac
7905         case "$i_dld" in
7906             $define) dflt='y' ;;
7907         esac
7908         : Does a dl_xxx.xs file exist for this operating system
7909         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7910         ;;
7911 esac
7912 rp="Do you wish to use dynamic loading?"
7913 . ./myread
7914 usedl="$ans"
7915 bin_ELF="$undef"
7916 case "$ans" in
7917 y*) usedl="$define"
7918         case "$dlsrc" in
7919         '')
7920                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7921                         dflt="$dldir/dl_${osname}.xs"
7922                 elif $test "$d_dlopen" = "$define" ; then
7923                         dflt="$dldir/dl_dlopen.xs"
7924                 elif $test "$i_dld" = "$define" ; then
7925                         dflt="$dldir/dl_dld.xs"
7926                 else
7927                         dflt=''
7928                 fi
7929                 ;;
7930         *)      dflt="$dldir/$dlsrc"
7931                 ;;
7932         esac
7933     echo "The following dynamic loading files are available:"
7934         : Can not go over to $dldir because getfile has path hard-coded in.
7935         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7936         rp="Source file to use for dynamic loading"
7937         fn="fne"
7938         gfpth="$src"
7939         . ./getfile
7940         usedl="$define"
7941         : emulate basename
7942         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7943
7944         $cat << EOM
7945
7946 Some systems may require passing special flags to $cc -c to
7947 compile modules that will be used to create a shared library.
7948 To use no flags, say "none".
7949
7950 EOM
7951     case "$cccdlflags" in
7952     '') case "$gccversion" in
7953                 '') case "$osname" in
7954                         hpux)   dflt='+z' ;;
7955                         next)   dflt='none' ;;
7956                         irix*)  dflt='-KPIC' ;;
7957                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7958                         sunos)  dflt='-pic' ;;
7959                         *)      dflt='none' ;;
7960                     esac
7961                         ;;
7962                 *)  case "$osname" in
7963                         darwin) dflt='none' ;;
7964                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7965                         *)      dflt='-fpic' ;;
7966                     esac ;;
7967             esac ;;
7968         ' ') dflt='none' ;;
7969     *)  dflt="$cccdlflags" ;;
7970     esac
7971     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7972     . ./myread
7973     case "$ans" in
7974     none) cccdlflags=' ' ;;
7975     *) cccdlflags="$ans" ;;
7976     esac
7977
7978     cat << EOM
7979
7980 Some systems use ld to create libraries that can be dynamically loaded,
7981 while other systems (such as those using ELF) use $cc.
7982
7983 EOM
7984
7985 : Determine if this is ELF
7986         $cat >try.c <<EOM
7987 /* Test for whether ELF binaries are produced */
7988 #include <fcntl.h>
7989 #$i_stdlib I_STDLIB
7990 #ifdef I_STDLIB
7991 #include <stdlib.h>
7992 #endif
7993 #$i_unistd I_UNISTD
7994 #ifdef I_UNISTD
7995 #include <unistd.h>
7996 #endif
7997 int main() {
7998         char b[4];
7999         int i = open("a.out",O_RDONLY);
8000         if(i == -1)
8001                 exit(1); /* fail */
8002         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8003                 exit(0); /* succeed (yes, it is ELF) */
8004         else
8005                 exit(1); /* fail */
8006 }
8007 EOM
8008         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8009                 bin_ELF="$define"
8010         fi
8011         $rm_try
8012
8013         case "$ld" in
8014         '')     if $test $bin_ELF = "$define"; then
8015                         cat <<EOM
8016 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8017 EOM
8018                         dflt="$cc"
8019                 else
8020                         echo "I'll use ld to build dynamic libraries."
8021                         dflt='ld'
8022                 fi
8023                 ;;
8024         *)      dflt="$ld"
8025                 ;;
8026         esac
8027
8028     rp="What command should be used to create dynamic libraries?"
8029     . ./myread
8030         ld="$ans"
8031
8032     cat << EOM
8033
8034 Some systems may require passing special flags to $ld to create a
8035 library that can be dynamically loaded.  If your ld flags include
8036 -L/other/path options to locate libraries outside your loader's normal
8037 search path, you may need to specify those -L options here as well.  To
8038 use no flags, say "none".
8039
8040 EOM
8041     case "$lddlflags" in
8042     '') case "$osname" in
8043                         haiku) dflt='-shared' ;;
8044                         hpux) dflt='-b';
8045                               case "$gccversion" in
8046                               '') dflt="$dflt +vnocompatwarnings" ;;
8047                               esac
8048                               ;;
8049                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8050                         next)  dflt='none' ;;
8051                         solaris) # See [perl #66604].  On Solaris 11, gcc -m64 on amd64
8052                                 # appears not to understand -G.  gcc versions at
8053                                 # least as old as 3.4.3 support -shared, so just
8054                                 # use that with Solaris 11 and later, but keep
8055                                 # the old behavior for older Solaris versions.
8056                                 case "$gccversion" in
8057                                         '') dflt='-G' ;;
8058                                         *)      case "$osvers" in
8059                                                         2.?|2.10) dflt='-G' ;;
8060                                                         *) dflt='-shared' ;;
8061                                                 esac
8062                                                 ;;
8063                                 esac
8064                                 ;;
8065                         sunos) dflt='-assert nodefinitions' ;;
8066                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8067                 *)     dflt='none' ;;
8068                         esac
8069                         ;;
8070     *) dflt="$lddlflags" ;;
8071     esac
8072
8073         : Try to guess additional flags to pick up local libraries.
8074         : Be careful not to append to a plain 'none'
8075         case "$dflt" in
8076         none) dflt='' ;;
8077         esac
8078         for thisflag in $ldflags; do
8079                 case "$thisflag" in
8080                 -L*|-R*|-Wl,-R*)
8081                         case " $dflt " in
8082                         *" $thisflag "*) ;;
8083                         *) dflt="$dflt $thisflag" ;;
8084                         esac
8085                         ;;
8086                 esac
8087         done
8088
8089         case "$dflt" in
8090         ''|' ') dflt='none' ;;
8091         esac
8092
8093         case "$ldflags" in
8094         *-fstack-protector*)
8095             case "$dflt" in
8096                         *-fstack-protector*) ;; # Don't add it again
8097                         *) dflt="$dflt -fstack-protector" ;; 
8098                 esac
8099                 ;;
8100         esac
8101
8102
8103     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8104     . ./myread
8105     case "$ans" in
8106     none) lddlflags=' ' ;;
8107     *) lddlflags="$ans" ;;
8108     esac
8109
8110         cat <<EOM
8111
8112 Some systems may require passing special flags to $cc to indicate that
8113 the resulting executable will use dynamic linking.  To use no flags,
8114 say "none".
8115
8116 EOM
8117     case "$ccdlflags" in
8118     '') case "$osname" in
8119             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8120             next|sunos) dflt='none' ;;
8121             *)          dflt='none' ;;
8122             esac ;;
8123     ' ')  dflt='none' ;;
8124     *)  dflt="$ccdlflags" ;;
8125     esac
8126     rp="Any special flags to pass to $cc to use dynamic linking?"
8127     . ./myread
8128     case "$ans" in
8129     none) ccdlflags=' ' ;;
8130     *) ccdlflags="$ans" ;;
8131     esac
8132     ;;
8133 *)  usedl="$undef"
8134         ld='ld'
8135     dlsrc='dl_none.xs'
8136     lddlflags=''
8137     ccdlflags=''
8138     ;;
8139 esac
8140
8141 ld_can_script="$undef"
8142 case "$bin_ELF$usedl" in
8143 $define$define)
8144     # Abuse try.h and a.out names for neat cleanup
8145     $cat >try.c <<EOM
8146 void foo() {}
8147 void bar() {}
8148 EOM
8149     $cat >try.h <<EOM
8150 LIBTEST_42 {
8151  global:
8152   foo;
8153  local: *;
8154  };
8155 EOM
8156     if $cc $cccdlflags $ccdlflags $ccflags \
8157            $ldflags $lddlflags -o a.out try.c \
8158            -Wl,--version-script=try.h >/dev/null 2>&1 \
8159        &&  $test -s a.out ; then
8160         echo "ld supports scripting" >&4
8161         ld_can_script="$define"
8162     else
8163         echo "ld does not support scripting" >&4
8164     fi
8165     $rm_try
8166     ;;
8167 esac
8168
8169 : Do we want a shared libperl?
8170 also=''
8171 case "$usedl" in
8172 $undef)
8173         # No dynamic loading being used, so don't bother even to prompt.
8174         useshrplib='false'
8175         ;;
8176 *)      case "$useshrplib" in
8177         '')     case "$osname" in
8178                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8179                         dflt=y
8180                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8181                         ;;
8182                 next*)
8183                         case "$osvers" in
8184                         4*)     dflt=y
8185                                 also='Building a shared libperl is needed for MAB support.'
8186                                 ;;
8187                         *)      dflt=n
8188                                 ;;
8189                         esac
8190                         ;;
8191                 *)      dflt=n
8192                         ;;
8193                 esac
8194                 ;;
8195         $define|true|[Yy]*)
8196                 dflt=y
8197                 ;;
8198         *)      dflt=n
8199                 ;;
8200         esac
8201         $cat << EOM
8202
8203 The perl executable is normally obtained by linking perlmain.c with
8204 libperl${_a}, any static extensions (usually just DynaLoader), and
8205 any other libraries needed on this system (such as -lm, etc.).  Since
8206 your system supports dynamic loading, it is probably possible to build
8207 a shared libperl.$so.  If you will have more than one executable linked
8208 to libperl.$so, this will significantly reduce the size of each
8209 executable, but it may have a noticeable effect on performance.  The
8210 default is probably sensible for your system.
8211 $also
8212
8213 EOM
8214         rp="Build a shared libperl.$so (y/n)"
8215         . ./myread
8216         case "$ans" in
8217         true|$define|[Yy]*)
8218                 useshrplib='true'  ;;
8219         *)      useshrplib='false' ;;
8220         esac
8221         ;;
8222 esac
8223
8224 case "$useshrplib" in
8225 true)
8226         case "$userelocatableinc" in
8227         true|define)
8228                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8229                 echo "See INSTALL for an explanation why that won't work." >&4
8230                 exit 4
8231                 ;;
8232         esac
8233         case "$libperl" in
8234         '')
8235                 # Figure out a good name for libperl.so.  Since it gets stored in
8236                 # a version-specific architecture-dependent library, the version
8237                 # number isn't really that important, except for making cc/ld happy.
8238                 #
8239                 # A name such as libperl.so.10.1
8240                 majmin="libperl.$so.$patchlevel.$subversion"
8241                 # A name such as libperl.so.100
8242                 majonly=`echo $patchlevel $subversion |
8243                         $awk '{printf "%d%02d", $1, $2}'`
8244                 majonly=libperl.$so.$majonly
8245                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8246                 # rely on figuring it out from the naming of libc.
8247                 case "${osname}${osvers}" in
8248                 next4*)
8249                         dflt=libperl.5.$so
8250                         # XXX How handle the --version stuff for MAB?
8251                         ;;
8252                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8253                         dflt=libperl.$so
8254                         ;;
8255                 cygwin*) # ld links now against the dll directly
8256                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8257                         majonly=`echo $patchlevel $subversion |
8258                                 $awk '{printf "%03d%03d", $1, $2}'`
8259                         majonly=cygperl5.$majonly.$so
8260                         dflt=$majmin
8261                         ;;
8262                 *)      # Try to guess based on whether libc has major.minor.
8263                         case "$libc" in
8264                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8265                         *libc.$so.[0-9]*) dflt=$majonly ;;
8266                         *)      dflt=libperl.$so ;;
8267                         esac
8268                         ;;
8269                 esac
8270                 ;;
8271         *)      dflt=$libperl
8272                 ;;
8273         esac
8274         cat << EOM
8275
8276 I need to select a good name for the shared libperl.  If your system uses
8277 library names with major and minor numbers, then you might want something
8278 like $majmin.  Alternatively, if your system uses a single version
8279 number for shared libraries, then you might want to use $majonly.
8280 Or, your system might be quite happy with a simple libperl.$so.
8281
8282 Since the shared libperl will get installed into a version-specific
8283 architecture-dependent directory, the version number of the shared perl
8284 library probably isn't important, so the default should be o.k.
8285
8286 EOM
8287         rp='What name do you want to give to the shared libperl?'
8288         . ./myread
8289         libperl=$ans
8290         echo "Ok, I'll use $libperl"
8291         ;;
8292 *)
8293         libperl="libperl${_a}"
8294         ;;
8295 esac
8296
8297 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8298 case "$shrpdir" in
8299 '') ;;
8300 *)      $cat >&4 <<EOM
8301 WARNING:  Use of the shrpdir variable for the installation location of
8302 the shared $libperl is not supported.  It was never documented and
8303 will not work in this version.  Let me (perlbug@perl.org)
8304 know of any problems this may cause.
8305
8306 EOM
8307         case "$shrpdir" in
8308         "$archlibexp/CORE")
8309                 $cat >&4 <<EOM
8310 But your current setting of $shrpdir is
8311 the default anyway, so it's harmless.
8312 EOM
8313                 ;;
8314         *)
8315                 $cat >&4 <<EOM
8316 Further, your current attempted setting of $shrpdir
8317 conflicts with the value of $archlibexp/CORE
8318 that installperl will use.
8319 EOM
8320                 ;;
8321         esac
8322         ;;
8323 esac
8324
8325 # How will the perl executable find the installed shared $libperl?
8326 # Add $xxx to ccdlflags.
8327 # If we can't figure out a command-line option, use $shrpenv to
8328 # set env LD_RUN_PATH.  The main perl makefile uses this.
8329 shrpdir=$archlibexp/CORE
8330 xxx=''
8331 tmp_shrpenv=''
8332 if "$useshrplib"; then
8333     case "$osname" in
8334         aix)
8335                 # We'll set it in Makefile.SH...
8336                 ;;
8337         solaris)
8338                 xxx="-R $shrpdir"
8339                 ;;
8340         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8341                 xxx="-Wl,-R$shrpdir"
8342                 ;;
8343         bsdos|linux|irix*|dec_osf|gnu*)
8344                 xxx="-Wl,-rpath,$shrpdir"
8345                 ;;
8346         next)
8347                 # next doesn't like the default...
8348                 ;;
8349         haiku)
8350                 # Haiku doesn't like the default, either.
8351                 ;;
8352         hpux*)
8353                 # hpux doesn't like the default, either.
8354                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8355                 ;;
8356         cygwin)
8357                 # cygwin needs only ldlibpth
8358                 ;;
8359         *)
8360                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8361                 ;;
8362         esac
8363         case "$xxx" in
8364         '') ;;
8365         *)
8366                 # Only add $xxx if it isn't already in ccdlflags.
8367                 case " $ccdlflags " in
8368                 *" $xxx "*)     ;;
8369                 *)      ccdlflags="$ccdlflags $xxx"
8370                         cat <<EOM >&4
8371
8372 Adding $xxx to the flags
8373 passed to $ld so that the perl executable will find the
8374 installed shared $libperl.
8375
8376 EOM
8377                         ;;
8378                 esac
8379                 ;;
8380         esac
8381 fi
8382 # Fix ccdlflags in AIX for building external extensions.
8383 # (For building Perl itself bare -bE:perl.exp is needed,
8384 #  Makefile.SH takes care of this.)
8385 case "$osname" in
8386 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8387 esac
8388 # Respect a hint or command-line value.
8389 case "$shrpenv" in
8390 '') shrpenv="$tmp_shrpenv" ;;
8391 esac
8392 case "$ldlibpthname" in
8393 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8394 none)   ldlibpthname='' ;;
8395 esac
8396
8397 : determine where manual pages are on this system
8398 echo " "
8399 case "$sysman" in
8400 '')
8401         syspath='/usr/share/man/man1 /usr/man/man1'
8402         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8403         syspath="$syspath /usr/man/u_man/man1"
8404         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8405         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8406         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8407         sysman=`./loc . /usr/man/man1 $syspath`
8408         ;;
8409 esac
8410 if $test -d "$sysman"; then
8411         echo "System manual is in $sysman." >&4
8412 else
8413         echo "Could not find manual pages in source form." >&4
8414 fi
8415
8416 : determine where manual pages go
8417 set man1dir man1dir none
8418 eval $prefixit
8419 $cat <<EOM
8420
8421 $spackage has manual pages available in source form.
8422 EOM
8423 case "$nroff" in
8424 nroff)
8425         echo "However, you don't have nroff, so they're probably useless to you."
8426         case "$man1dir" in
8427         '') man1dir="none";;
8428         esac;;
8429 esac
8430 echo "If you don't want the manual sources installed, answer 'none'."
8431 case "$man1dir" in
8432 ' ') dflt=none
8433         ;;
8434 '')
8435         lookpath="$prefixexp/share/man/man1"
8436         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8437         lookpath="$lookpath $prefixexp/man/p_man/man1"
8438         lookpath="$lookpath $prefixexp/man/u_man/man1"
8439         lookpath="$lookpath $prefixexp/man/man.1"
8440         case "$sysman" in
8441         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8442         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8443         esac
8444         set dflt
8445         eval $prefixup
8446         ;;
8447 *)  dflt="$man1dir"
8448         ;;
8449 esac
8450 echo " "
8451 fn=dn+~
8452 rp="Where do the main $spackage manual pages (source) go?"
8453 . ./getfile
8454 if $test "X$man1direxp" != "X$ansexp"; then
8455         installman1dir=''
8456 fi
8457 prefixvar=man1dir
8458 . ./setprefixvar
8459
8460 case "$man1dir" in
8461 '')     man1dir=' '
8462         installman1dir='';;
8463 esac
8464
8465 : What suffix to use on installed man pages
8466
8467 case "$man1dir" in
8468 ' ')
8469         man1ext='0'
8470         ;;
8471 *)
8472         rp="What suffix should be used for the main $spackage man pages?"
8473         case "$man1ext" in
8474         '')     case "$man1dir" in
8475                 *1)  dflt=1 ;;
8476                 *1p) dflt=1p ;;
8477                 *1pm) dflt=1pm ;;
8478                 *l) dflt=l;;
8479                 *n) dflt=n;;
8480                 *o) dflt=o;;
8481                 *p) dflt=p;;
8482                 *C) dflt=C;;
8483                 *L) dflt=L;;
8484                 *L1) dflt=L1;;
8485                 *) dflt=1;;
8486                 esac
8487                 ;;
8488         *)      dflt="$man1ext";;
8489         esac
8490         . ./myread
8491         man1ext="$ans"
8492         ;;
8493 esac
8494
8495 : see if we can have long filenames
8496 echo " "
8497 first=123456789abcdef
8498 $rm -f $first
8499 if (echo hi >$first) 2>/dev/null; then
8500         if $test -f 123456789abcde; then
8501                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8502                 val="$undef"
8503         else
8504                 echo 'You can have filenames longer than 14 characters.'>&4
8505                 val="$define"
8506         fi
8507 else
8508         $cat <<'EOM'
8509 You can't have filenames longer than 14 chars.
8510 You can't even think about them!
8511 EOM
8512         val="$undef"
8513 fi
8514 set d_flexfnam
8515 eval $setvar
8516 $rm -rf 123456789abcde*
8517
8518 : determine where library module manual pages go
8519 set man3dir man3dir none
8520 eval $prefixit
8521 $cat <<EOM
8522
8523 $spackage has manual pages for many of the library modules.
8524 EOM
8525
8526 case "$nroff" in
8527 nroff)
8528         $cat <<'EOM'
8529 However, you don't have nroff, so they're probably useless to you.
8530 EOM
8531         case "$man3dir" in
8532         '') man3dir="none";;
8533         esac;;
8534 esac
8535
8536 case "$d_flexfnam" in
8537 undef)
8538         $cat <<'EOM'
8539 However, your system can't handle the long file names like File::Basename.3.
8540 EOM
8541         case "$man3dir" in
8542         '') man3dir="none";;
8543         esac;;
8544 esac
8545
8546 echo "If you don't want the manual sources installed, answer 'none'."
8547 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8548 case "$man3dir" in
8549 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8550         if $test -d "$privlib/man/man3"; then
8551                 cat <<EOM >&4
8552
8553 WARNING:  Previous versions of perl installed man3 pages into
8554 $privlib/man/man3.  This version will suggest a
8555 new default of $dflt.
8556 EOM
8557                 tdflt=$dflt
8558                 dflt='n'
8559                 rp='Do you wish to preserve the old behavior?(y/n)'
8560                 . ./myread
8561                 case "$ans" in
8562                 y*) dflt="$privlib/man/man3" ;;
8563                 *)  dflt=$tdflt ;;
8564                 esac
8565     fi
8566         ;;
8567 *)      dflt="$man3dir" ;;
8568 esac
8569 case "$dflt" in
8570 ' ') dflt=none ;;
8571 esac
8572 echo " "
8573 fn=dn+~
8574 rp="Where do the $package library man pages (source) go?"
8575 . ./getfile
8576 prefixvar=man3dir
8577 . ./setprefixvar
8578
8579 case "$man3dir" in
8580 '')     man3dir=' '
8581         installman3dir='';;
8582 esac
8583
8584 : What suffix to use on installed man pages
8585 case "$man3dir" in
8586 ' ')
8587         man3ext='0'
8588         ;;
8589 *)
8590         rp="What suffix should be used for the $package library man pages?"
8591         case "$man3ext" in
8592         '')     case "$man3dir" in
8593                 *3)  dflt=3 ;;
8594                 *3p) dflt=3p ;;
8595                 *3pm) dflt=3pm ;;
8596                 *l) dflt=l;;
8597                 *n) dflt=n;;
8598                 *o) dflt=o;;
8599                 *p) dflt=p;;
8600                 *C) dflt=C;;
8601                 *L) dflt=L;;
8602                 *L3) dflt=L3;;
8603                 *) dflt=3;;
8604                 esac
8605                 ;;
8606         *)      dflt="$man3ext";;
8607         esac
8608         . ./myread
8609         man3ext="$ans"
8610         ;;
8611 esac
8612
8613 : see if we have to deal with yellow pages, now NIS.
8614 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8615         if $test -f /usr/etc/nibindd; then
8616                 echo " "
8617                 echo "I'm fairly confident you're on a NeXT."
8618                 echo " "
8619                 rp='Do you get the hosts file via NetInfo?'
8620                 dflt=y
8621                 case "$hostcat" in
8622                 nidump*) ;;
8623                 '') ;;
8624                 *) dflt=n;;
8625                 esac
8626                 . ./myread
8627                 case "$ans" in
8628                 y*) hostcat='nidump hosts .';;
8629                 *)      case "$hostcat" in
8630                         nidump*) hostcat='';;
8631                         esac
8632                         ;;
8633                 esac
8634         fi
8635         case "$hostcat" in
8636         nidump*) ;;
8637         *)
8638                 case "$hostcat" in
8639                 *ypcat*) dflt=y;;
8640                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8641                                 dflt=y
8642                         else
8643                                 dflt=n
8644                         fi;;
8645                 *) dflt=n;;
8646                 esac
8647                 echo " "
8648                 rp='Are you getting the hosts file via yellow pages?'
8649                 . ./myread
8650                 case "$ans" in
8651                 y*) hostcat='ypcat hosts';;
8652                 *) hostcat='cat /etc/hosts';;
8653                 esac
8654                 ;;
8655         esac
8656 fi
8657 case "$hostcat" in
8658 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8659 esac
8660 case "$groupcat" in
8661 '') test -f /etc/group && groupcat='cat /etc/group';;
8662 esac
8663 case "$passcat" in
8664 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8665 esac
8666
8667 : now get the host name
8668 echo " "
8669 echo "Figuring out host name..." >&4
8670 case "$myhostname" in
8671 '') cont=true
8672         echo 'Maybe "hostname" will work...'
8673         if tans=`sh -c hostname 2>&1` ; then
8674                 myhostname=$tans
8675                 phostname=hostname
8676                 cont=''
8677         fi
8678         ;;
8679 *) cont='';;
8680 esac
8681 if $test "$cont"; then
8682         if ./xenix; then
8683                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8684                 if tans=`cat /etc/systemid 2>&1` ; then
8685                         myhostname=$tans
8686                         phostname='cat /etc/systemid'
8687                         echo "Whadyaknow.  Xenix always was a bit strange..."
8688                         cont=''
8689                 fi
8690         elif $test -r /etc/systemid; then
8691                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8692         fi
8693 fi
8694 if $test "$cont"; then
8695         echo 'No, maybe "uuname -l" will work...'
8696         if tans=`sh -c 'uuname -l' 2>&1` ; then
8697                 myhostname=$tans
8698                 phostname='uuname -l'
8699         else
8700                 echo 'Strange.  Maybe "uname -n" will work...'
8701                 if tans=`sh -c 'uname -n' 2>&1` ; then
8702                         myhostname=$tans
8703                         phostname='uname -n'
8704                 else
8705                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8706                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8707                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8708                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8709                         else
8710                                 case "$myhostname" in
8711                                 '') echo "Does this machine have an identity crisis or something?"
8712                                         phostname='';;
8713                                 *)
8714                                         echo "Well, you said $myhostname before..."
8715                                         phostname='echo $myhostname';;
8716                                 esac
8717                         fi
8718                 fi
8719         fi
8720 fi
8721 case "$myhostname" in
8722 '') myhostname=noname ;;
8723 esac
8724 : you do not want to know about this
8725 set $myhostname
8726 myhostname=$1
8727
8728 : verify guess
8729 if $test "$myhostname" ; then
8730         dflt=y
8731         rp='Your host name appears to be "'$myhostname'".'" Right?"
8732         . ./myread
8733         case "$ans" in
8734         y*) ;;
8735         *) myhostname='';;
8736         esac
8737 fi
8738
8739 : bad guess or no guess
8740 while $test "X$myhostname" = X ; do
8741         dflt=''
8742         rp="Please type the (one word) name of your host:"
8743         . ./myread
8744         myhostname="$ans"
8745 done
8746
8747 : translate upper to lower if necessary
8748 case "$myhostname" in
8749 *[A-Z]*)
8750         echo "(Normalizing case in your host name)"
8751         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8752         ;;
8753 esac
8754
8755 case "$myhostname" in
8756 *.*)
8757         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8758         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8759         echo "(Trimming domain name from host name--host name is now $myhostname)"
8760         ;;
8761 *) case "$mydomain" in
8762         '')
8763                 {
8764                         test "X$hostcat" = "Xypcat hosts" &&
8765                         ypmatch "$myhostname" hosts 2>/dev/null |\
8766                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8767                         $test -s hosts
8768                 } || {
8769                         test "X$hostcat" != "X" &&
8770                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8771                                         /[       ]$myhostname[  . ]/p" > hosts
8772                 }
8773                 tmp_re="[       . ]"
8774                 if $test -f hosts; then
8775                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8776                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8777                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8778                                 hosts | $sort | $uniq | \
8779                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8780                         case `$echo X$dflt` in
8781                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8782                                 dflt=.
8783                                 ;;
8784                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8785                                 ;;
8786                         esac
8787                 else
8788                         echo "(I cannot locate a hosts database anywhere)"
8789                         dflt=.
8790                 fi
8791                 case "$dflt" in
8792                 .)
8793                         tans=`./loc resolv.conf X /etc /usr/etc`
8794                         if $test -f "$tans"; then
8795                                 echo "(Attempting domain name extraction from $tans)"
8796                                 dflt=.`$sed -n -e 's/   / /g' \
8797                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8798                                   -e 1q 2>/dev/null`
8799                                 case "$dflt" in
8800                                 .) dflt=.`$sed -n -e 's/        / /g' \
8801                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8802                                      -e 1q 2>/dev/null`
8803                                         ;;
8804                                 esac
8805                         fi
8806                         ;;
8807                 esac
8808                 case "$dflt" in
8809                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8810                         dflt=.`sh -c domainname 2>/dev/null`
8811                         case "$dflt" in
8812                         '') dflt='.';;
8813                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8814                         esac
8815                         ;;
8816                 esac
8817                 case "$dflt$osname" in
8818                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8819                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8820                         ;;
8821                 esac
8822                 case "$dflt" in
8823                 .) echo "(Lost all hope -- silly guess then)"
8824                         dflt='.nonet'
8825                         ;;
8826                 esac
8827                 $rm -f hosts
8828                 ;;
8829         *) dflt="$mydomain";;
8830         esac;;
8831 esac
8832 echo " "
8833 rp="What is your domain name?"
8834 . ./myread
8835 tans="$ans"
8836 case "$ans" in
8837 '') ;;
8838 .*) ;;
8839 *) tans=".$tans";;
8840 esac
8841 mydomain="$tans"
8842
8843 : translate upper to lower if necessary
8844 case "$mydomain" in
8845 *[A-Z]*)
8846         echo "(Normalizing case in your domain name)"
8847         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8848         ;;
8849 esac
8850
8851 : a little sanity check here
8852 case "$phostname" in
8853 '') ;;
8854 *)
8855         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8856         $myhostname$mydomain|$myhostname) ;;
8857         *)
8858                 case "$phostname" in
8859                 sed*)
8860                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8861                         ;;
8862                 *)
8863                         echo "(That doesn't agree with your $phostname command, by the way.)"
8864                         ;;
8865                 esac
8866         ;;
8867         esac
8868         ;;
8869 esac
8870
8871 : determine the e-mail address of the user who is running us
8872 $cat <<EOM
8873
8874 I need to get your e-mail address in Internet format if possible, i.e.
8875 something like user@host.domain. Please answer accurately since I have
8876 no easy means to double check it. The default value provided below
8877 is most probably close to reality but may not be valid from outside
8878 your organization...
8879
8880 EOM
8881 cont=x
8882 while test "$cont"; do
8883         case "$MAILDOMAIN" in
8884         '')
8885                 if $test -s /etc/mailname; then
8886                         maildomain=`$cat /etc/mailname`
8887                 else
8888                         maildomain="$myhostname$mydomain"
8889                 fi
8890                 ;;
8891         *)  maildomain="$MAILDOMAIN";;
8892         esac
8893         case "$cf_email" in
8894         '') dflt="$cf_by@$maildomain";;
8895         *)  dflt="$cf_email";;
8896         esac
8897         rp='What is your e-mail address?'
8898         . ./myread
8899         cf_email="$ans"
8900         case "$cf_email" in
8901         *@*.*) cont='' ;;
8902         *)
8903                 rp='Address does not look like an Internet one.  Use it anyway?'
8904                 case "$fastread" in
8905                 yes) dflt=y ;;
8906                 *) dflt=n ;;
8907                 esac
8908                 . ./myread
8909                 case "$ans" in
8910                 y*) cont='' ;;
8911                 *) echo " " ;;
8912                 esac
8913                 ;;
8914         esac
8915 done
8916
8917 : Ask e-mail of administrator
8918 $cat <<EOM
8919
8920 If you or somebody else will be maintaining perl at your site, please
8921 fill in the correct e-mail address here so that they may be contacted
8922 if necessary. Currently, the "perlbug" program included with perl
8923 will send mail to this address in addition to perlbug@perl.org. You may
8924 enter "none" for no administrator.
8925
8926 EOM
8927 case "$perladmin" in
8928 '') dflt="$cf_email";;
8929 *) dflt="$perladmin";;
8930 esac
8931 rp='Perl administrator e-mail address'
8932 . ./myread
8933 perladmin="$ans"
8934
8935 : determine whether to only install version-specific parts.
8936 echo " "
8937 $cat <<EOM
8938 Do you want to install only the version-specific parts of the perl
8939 distribution?  Usually you do *not* want to do this.
8940 EOM
8941 case "$versiononly" in
8942 "$define"|[Yy]*|true) dflt='y' ;;
8943 *) dflt='n';
8944 esac
8945 rp="Do you want to install only the version-specific parts of perl?"
8946 . ./myread
8947 case "$ans" in
8948 [yY]*)  val="$define";;
8949 *)      val="$undef" ;;
8950 esac
8951 set versiononly
8952 eval $setvar
8953
8954 case "$versiononly" in
8955 "$define") inc_version_list=''
8956            inc_version_list_init=0
8957            ;;
8958 esac
8959
8960 : figure out how to guarantee perl startup
8961 : XXX Note that this currently takes advantage of the bug that binexp ignores
8962 :     the Configure -Dinstallprefix setting, which in turn means that under
8963 :     relocatable @INC, initialinstalllocation is what binexp started as.
8964 case "$startperl" in
8965 '')
8966         case "$sharpbang" in
8967         *!)
8968                 $cat <<EOH
8969
8970 I can use the #! construct to start perl on your system. This will
8971 make startup of perl scripts faster, but may cause problems if you
8972 want to share those scripts and perl is not in a standard place
8973 ($initialinstalllocation/perl) on all your platforms. The alternative
8974 is to force a shell by starting the script with a single ':' character.
8975
8976 EOH
8977                 case "$versiononly" in
8978                 "$define")      dflt="$initialinstalllocation/perl$version";;
8979                 *)              dflt="$initialinstalllocation/perl";;
8980                 esac
8981                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8982                 . ./myread
8983                 case "$ans" in
8984                 none)   startperl=": # use perl";;
8985                 *)      startperl="#!$ans"
8986                         if $test 30 -lt `echo "$ans" | wc -c`; then
8987                                 $cat >&4 <<EOM
8988
8989 WARNING:  Some systems limit the #! command to 32 characters.
8990 If you experience difficulty running Perl scripts with #!, try
8991 installing Perl in a directory with a shorter pathname.
8992
8993 EOM
8994                         fi ;;
8995                 esac
8996                 ;;
8997         *) startperl=": # use perl"
8998                 ;;
8999         esac
9000         ;;
9001 esac
9002 echo "I'll use $startperl to start perl scripts."
9003
9004 : figure best path for perl in scripts
9005 case "$perlpath" in
9006 '')
9007         case "$versiononly" in
9008         "$define")      perlpath="$initialinstalllocation/perl$version";;
9009         *)              perlpath="$initialinstalllocation/perl";;
9010         esac
9011         case "$startperl" in
9012         *!*) ;;
9013         *)
9014                 $cat <<EOH
9015
9016 I will use the "eval 'exec'" idiom to start Perl on your system.
9017 I can use the full path of your Perl binary for this purpose, but
9018 doing so may cause problems if you want to share those scripts and
9019 Perl is not always in a standard place ($initialinstalllocation/perl).
9020
9021 EOH
9022                 dflt="$initialinstalllocation/perl"
9023                 rp="What path shall I use in \"eval 'exec'\"?"
9024                 . ./myread
9025                 perlpath="$ans"
9026                 ;;
9027         esac
9028         ;;
9029 esac
9030 case "$startperl" in
9031 *!*)    ;;
9032 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9033 esac
9034
9035 : determine where public executable scripts go
9036 set scriptdir scriptdir
9037 eval $prefixit
9038 case "$scriptdir" in
9039 '')
9040         dflt="$bin"
9041         : guess some guesses
9042         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9043         $test -d /usr/share/bin     && dflt=/usr/share/bin
9044         $test -d /usr/local/script  && dflt=/usr/local/script
9045         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9046         $test -d $prefixexp/script  && dflt=$prefixexp/script
9047         set dflt
9048         eval $prefixup
9049         ;;
9050 *)  dflt="$scriptdir"
9051         ;;
9052 esac
9053 $cat <<EOM
9054
9055 Some installations have a separate directory just for executable scripts so
9056 that they can mount it across multiple architectures but keep the scripts in
9057 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9058 Or you might just lump your scripts in with all your other executables.
9059
9060 EOM
9061 fn=d~
9062 rp='Where do you keep publicly executable scripts?'
9063 . ./getfile
9064 if $test "X$ansexp" != "X$scriptdirexp"; then
9065         installscript=''
9066 fi
9067 installscriptdir=''
9068 prefixvar=scriptdir
9069 . ./setprefixvar
9070 : A little fix up for an irregularly named variable.
9071 installscript="$installscriptdir"
9072
9073 : determine where add-on public executables go
9074 case "$sitebin" in
9075 '')     dflt=$siteprefix/bin ;;
9076 *)      dflt=$sitebin ;;
9077 esac
9078 fn=d~
9079 rp='Pathname where the add-on public executables should be installed?'
9080 . ./getfile
9081 prefixvar=sitebin
9082 . ./setprefixvar
9083
9084 : determine where add-on html pages go
9085 : There is no standard location, so try to copy the previously-selected
9086 : directory structure for the core html pages.
9087 case "$sitehtml1dir" in
9088 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9089 *)     dflt=$sitehtml1dir ;;
9090 esac
9091 case "$dflt" in
9092 ''|' ') dflt=none ;;
9093 esac
9094 fn=dn+~
9095 rp='Pathname where the site-specific html pages should be installed?'
9096 . ./getfile
9097 prefixvar=sitehtml1dir
9098 . ./setprefixvar
9099
9100 : determine where add-on library html pages go
9101 : There is no standard location, so try to copy the previously-selected
9102 : directory structure for the core html pages.
9103 case "$sitehtml3dir" in
9104 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9105 *)     dflt=$sitehtml3dir ;;
9106 esac
9107 case "$dflt" in
9108 ''|' ') dflt=none ;;
9109 esac
9110 fn=dn+~
9111 rp='Pathname where the site-specific library html pages should be installed?'
9112 . ./getfile
9113 prefixvar=sitehtml3dir
9114 . ./setprefixvar
9115
9116 : determine where add-on manual pages go
9117 case "$siteman1dir" in
9118 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9119 *)      dflt=$siteman1dir ;;
9120 esac
9121 case "$dflt" in
9122 ''|' ') dflt=none ;;
9123 esac
9124 fn=dn+~
9125 rp='Pathname where the site-specific manual pages should be installed?'
9126 . ./getfile
9127 prefixvar=siteman1dir
9128 . ./setprefixvar
9129
9130 : determine where add-on library man pages go
9131 case "$siteman3dir" in
9132 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9133 *)      dflt=$siteman3dir ;;
9134 esac
9135 case "$dflt" in
9136 ''|' ') dflt=none ;;
9137 esac
9138 fn=dn+~
9139 rp='Pathname where the site-specific library manual pages should be installed?'
9140 . ./getfile
9141 prefixvar=siteman3dir
9142 . ./setprefixvar
9143
9144 : determine where add-on public executable scripts go
9145 case "$sitescript" in
9146 '')     dflt=$siteprefix/script
9147         $test -d $dflt || dflt=$sitebin ;;
9148 *)  dflt="$sitescript" ;;
9149 esac
9150 fn=d~+
9151 rp='Pathname where add-on public executable scripts should be installed?'
9152 . ./getfile
9153 prefixvar=sitescript
9154 . ./setprefixvar
9155
9156 : Check if faststdio is requested and available
9157 case "$usefaststdio" in
9158 $define|true|[yY]*|'')
9159         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9160         case "$xversion" in
9161         [68])   dflt='y' ;;
9162         *)      dflt='n' ;;
9163         esac
9164         ;;
9165 *) dflt='n';;
9166 esac
9167 cat <<EOM
9168
9169 Perl can be built to use 'fast stdio', which means using the stdio
9170 library but also directly manipulating the stdio buffers to enable
9171 faster I/O.  Using stdio is better for backward compatibility (especially
9172 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9173 interface has been preferred instead of stdio.
9174
9175 If this doesn't make any sense to you, just accept the default '$dflt'.
9176 EOM
9177 rp='Use the "fast stdio" if available?'
9178 . ./myread
9179 case "$ans" in
9180 y|Y)    val="$define" ;;
9181 *)      val="$undef" ;;
9182 esac
9183 set usefaststdio
9184 eval $setvar
9185
9186
9187 : define an is-a-typedef? function
9188 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9189 case "$inclist" in
9190 "") inclist="sys/types.h";;
9191 esac;
9192 eval "varval=\$$var";
9193 case "$varval" in
9194 "")
9195         $rm -f temp.c;
9196         for inc in $inclist; do
9197                 echo "#include <$inc>" >>temp.c;
9198         done;
9199         echo "#ifdef $type" >> temp.c;
9200         echo "printf(\"We have $type\");" >> temp.c;
9201         echo "#endif" >> temp.c;
9202         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9203         if $contains $type temp.E >/dev/null 2>&1; then
9204                 eval "$var=\$type";
9205         else
9206                 eval "$var=\$def";
9207         fi;
9208         $rm -f temp.?;;
9209 *) eval "$var=\$varval";;
9210 esac'
9211
9212 : define an is-a-typedef? function that prompts if the type is not available.
9213 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9214 case "$inclist" in
9215 "") inclist="sys/types.h";;
9216 esac;
9217 eval "varval=\$$var";
9218 case "$varval" in
9219 "")
9220         $rm -f temp.c;
9221         for inc in $inclist; do
9222                 echo "#include <$inc>" >>temp.c;
9223         done;
9224         echo "#ifdef $type" >> temp.c;
9225         echo "printf(\"We have $type\");" >> temp.c;
9226         echo "#endif" >> temp.c;
9227         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9228         echo " " ;
9229         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9230         if $contains $type temp.E >/dev/null 2>&1; then
9231                 echo "$type found." >&4;
9232                 eval "$var=\$type";
9233         else
9234                 echo "$type NOT found." >&4;
9235                 dflt="$def";
9236                 . ./myread ;
9237                 eval "$var=\$ans";
9238         fi;
9239         $rm -f temp.?;;
9240 *) eval "$var=\$varval";;
9241 esac'
9242
9243 : see what type lseek is declared as in the kernel
9244 rp="What is the type used for lseek's offset on this system?"
9245 set off_t lseektype long stdio.h sys/types.h
9246 eval $typedef_ask
9247
9248 echo " "
9249 echo "Checking to see how big your file offsets are..." >&4
9250 $cat >try.c <<EOCP
9251 #include <sys/types.h>
9252 #include <stdio.h>
9253 int main()
9254 {
9255     printf("%d\n", (int)sizeof($lseektype));
9256     return(0);
9257 }
9258 EOCP
9259 set try
9260 if eval $compile_ok; then
9261         lseeksize=`$run ./try`
9262         echo "Your file offsets are $lseeksize bytes long."
9263 else
9264         dflt=$longsize
9265         echo " "
9266         echo "(I can't seem to compile the test program.  Guessing...)"
9267         rp="What is the size of your file offsets (in bytes)?"
9268         . ./myread
9269         lseeksize="$ans"
9270 fi
9271 $rm_try
9272
9273 : see what type file positions are declared as in the library
9274 rp="What is the type for file position used by fsetpos()?"
9275 set fpos_t fpostype long stdio.h sys/types.h
9276 eval $typedef_ask
9277
9278 : Check size for Fpos_t
9279 echo " "
9280 case "$fpostype" in
9281 *_t) zzz="$fpostype"    ;;
9282 *)   zzz="fpos_t"       ;;
9283 esac
9284 echo "Checking the size of $zzz..." >&4
9285 cat > try.c <<EOCP
9286 #include <sys/types.h>
9287 #include <stdio.h>
9288 #$i_stdlib I_STDLIB
9289 #ifdef I_STDLIB
9290 #include <stdlib.h>
9291 #endif
9292 int main() {
9293     printf("%d\n", (int)sizeof($fpostype));
9294     exit(0);
9295 }
9296 EOCP
9297 set try
9298 if eval $compile_ok; then
9299         yyy=`$run ./try`
9300         case "$yyy" in
9301         '')     fpossize=4
9302                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9303                 ;;
9304         *)      fpossize=$yyy
9305                 echo "Your $zzz is $fpossize bytes long."
9306                 ;;
9307         esac
9308 else
9309         dflt="$longsize"
9310         echo " " >&4
9311         echo "(I can't compile the test program.  Guessing...)" >&4
9312         rp="What is the size of your file positions (in bytes)?"
9313         . ./myread
9314         fpossize="$ans"
9315 fi
9316
9317 : Check for large file support
9318 # Backward compatibility (uselfs is deprecated).
9319 case "$uselfs" in
9320 "$define"|true|[yY]*)
9321         cat <<EOM >&4
9322
9323 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9324 EOM
9325         uselargefiles="$define"
9326         ;;
9327 esac
9328
9329 case "$lseeksize:$fpossize" in
9330 8:8) cat <<EOM
9331
9332 You can have files larger than 2 gigabytes.
9333 EOM
9334    val="$define" ;;
9335 *)    case "$uselargefiles" in
9336    "$undef"|false|[nN]*) dflt='n' ;;
9337    *)   dflt='y' ;;
9338    esac
9339    cat <<EOM
9340
9341 Perl can be built to understand large files (files larger than 2 gigabytes)
9342 on some systems.  To do so, Configure can be run with -Duselargefiles.
9343
9344 If this doesn't make any sense to you, just accept the default '$dflt'.
9345 EOM
9346    rp='Try to understand large files, if available?'
9347    . ./myread
9348    case "$ans" in
9349    y|Y)         val="$define" ;;
9350    *)           val="$undef"  ;;
9351    esac
9352    ;;
9353 esac
9354 set uselargefiles
9355 eval $setvar
9356 : Look for a hint-file generated 'call-back-unit'.  If the
9357 : user has specified that a large files perl is to be built,
9358 : we may need to set or change some other defaults.
9359 if $test -f uselargefiles.cbu; then
9360         echo "Your platform has some specific hints regarding large file builds, using them..."
9361         . ./uselargefiles.cbu
9362 fi
9363 case "$uselargefiles" in
9364 "$define")
9365         if $test -f uselargefiles.cbu; then
9366                 echo " "
9367                 echo "Rechecking to see how big your file offsets are..." >&4
9368                 $cat >try.c <<EOCP
9369 #include <sys/types.h>
9370 #include <stdio.h>
9371 int main()
9372 {
9373     printf("%d\n", (int)sizeof($lseektype));
9374     return(0);
9375 }
9376 EOCP
9377                 set try
9378                 if eval $compile_ok; then
9379                         lseeksize=`$run ./try`
9380                         $echo "Your file offsets are now $lseeksize bytes long."
9381                 else
9382                         dflt="$lseeksize"
9383                         echo " "
9384                         echo "(I can't seem to compile the test program.  Guessing...)"
9385                         rp="What is the size of your file offsets (in bytes)?"
9386                         . ./myread
9387                         lseeksize="$ans"
9388                 fi
9389                 case "$fpostype" in
9390                 *_t) zzz="$fpostype"    ;;
9391                 *)   zzz="fpos_t"       ;;
9392                 esac
9393                 $echo $n "Rechecking the size of $zzz...$c" >&4
9394                 $cat > try.c <<EOCP
9395 #include <sys/types.h>
9396 #include <stdio.h>
9397 #$i_stdlib I_STDLIB
9398 #ifdef I_STDLIB
9399 #include <stdlib.h>
9400 #endif
9401 int main() {
9402     printf("%d\n", (int)sizeof($fpostype));
9403     return(0);
9404 }
9405 EOCP
9406                 set try
9407                 if eval $compile_ok; then
9408                         yyy=`$run ./try`
9409                         dflt="$lseeksize"
9410                         case "$yyy" in
9411                         '')     echo " "
9412                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9413                                 ;;
9414                         *)      fpossize=$yyy
9415                                 echo " $fpossize bytes." >&4
9416                                 ;;
9417                         esac
9418                 else
9419                         dflt="$fpossize"
9420                         echo " "
9421                         echo "(I can't compile the test program.  Guessing...)" >&4
9422                         rp="What is the size of your file positions (in bytes)?"
9423                         . ./myread
9424                         fpossize="$ans"
9425                 fi
9426                 $rm_try
9427         fi
9428         ;;
9429 esac
9430
9431 : Check if we want perlio
9432 useperlio="$define"
9433
9434 : Set the vendorbin variables
9435 case "$vendorprefix" in
9436 '')     d_vendorbin="$undef"
9437         vendorbin=''
9438         vendorbinexp=''
9439         ;;
9440 *)      d_vendorbin="$define"
9441         : determine where vendor-supplied executables go.
9442         case "$vendorbin" in
9443         '') dflt=$vendorprefix/bin ;;
9444         *)      dflt="$vendorbin" ;;
9445         esac
9446         fn=d~+
9447         rp='Pathname for the vendor-supplied executables directory?'
9448         . ./getfile
9449         vendorbin="$ans"
9450         vendorbinexp="$ansexp"
9451         ;;
9452 esac
9453 prefixvar=vendorbin
9454 . ./installprefix
9455
9456 : Set the vendorhtml1dir variables
9457 case "$vendorprefix" in
9458 '')     vendorhtml1dir=''
9459         vendorhtml1direxp=''
9460         ;;
9461 *)      : determine where vendor-supplied html pages go.
9462         : There is no standard location, so try to copy the previously-selected
9463         : directory structure for the core html pages.
9464         : XXX Better default suggestions would be welcome.
9465         case "$vendorhtml1dir" in
9466         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9467         *)      dflt=$vendorhtml1dir ;;
9468         esac
9469         case "$dflt" in
9470         ''|' ') dflt=none ;;
9471         esac
9472         fn=dn+~
9473         rp='Pathname for the vendor-supplied html pages?'
9474         . ./getfile
9475         vendorhtml1dir="$ans"
9476         vendorhtml1direxp="$ansexp"
9477         ;;
9478 esac
9479 : Use ' ' for none so value is preserved next time through Configure
9480 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9481 prefixvar=vendorhtml1dir
9482 . ./installprefix
9483
9484 : Set the vendorhtml3dir variables
9485 case "$vendorprefix" in
9486 '')     vendorhtml3dir=''
9487         vendorhtml3direxp=''
9488         ;;
9489 *)      : determine where vendor-supplied module html pages go.
9490         : There is no standard location, so try to copy the previously-selected
9491         : directory structure for the core html pages.
9492         : XXX Better default suggestions would be welcome.
9493         case "$vendorhtml3dir" in
9494         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9495         *)      dflt=$vendorhtml3dir ;;
9496         esac
9497         case "$dflt" in
9498         ''|' ') dflt=none ;;
9499         esac
9500         fn=dn+~
9501         rp='Pathname for the vendor-supplied html pages?'
9502         . ./getfile
9503         vendorhtml3dir="$ans"
9504         vendorhtml3direxp="$ansexp"
9505         ;;
9506 esac
9507 : Use ' ' for none so value is preserved next time through Configure
9508 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9509 prefixvar=vendorhtml3dir
9510 . ./installprefix
9511
9512 : Set the vendorman1dir variables
9513 case "$vendorprefix" in
9514 '')     vendorman1dir=''
9515         vendorman1direxp=''
9516         ;;
9517 *)      : determine where vendor-supplied manual pages go.
9518         case "$vendorman1dir" in
9519         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9520         *)      dflt=$vendorman1dir ;;
9521         esac
9522         case "$dflt" in
9523         ''|' ') dflt=none ;;
9524         esac
9525         fn=nd~+
9526         rp='Pathname for the vendor-supplied manual section 1 pages?'
9527         . ./getfile
9528         vendorman1dir="$ans"
9529         vendorman1direxp="$ansexp"
9530         ;;
9531 esac
9532 : Use ' ' for none so value is preserved next time through Configure
9533 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9534 prefixvar=vendorman1dir
9535 . ./installprefix
9536
9537 : Set the vendorman3dir variables
9538 case "$vendorprefix" in
9539 '')     vendorman3dir=''
9540         vendorman3direxp=''
9541         ;;
9542 *)      : determine where vendor-supplied module manual pages go.
9543         case "$vendorman3dir" in
9544         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9545         *)      dflt=$vendorman3dir ;;
9546         esac
9547         case "$dflt" in
9548         ''|' ') dflt=none ;;
9549         esac
9550         fn=nd~+
9551         rp='Pathname for the vendor-supplied manual section 3 pages?'
9552         . ./getfile
9553         vendorman3dir="$ans"
9554         vendorman3direxp="$ansexp"
9555         ;;
9556 esac
9557 : Use ' ' for none so value is preserved next time through Configure
9558 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9559 prefixvar=vendorman3dir
9560 . ./installprefix
9561
9562 : Set the vendorscript variables
9563 case "$vendorprefix" in
9564 '')     d_vendorscript="$undef"
9565         vendorscript=''
9566         vendorscriptexp=''
9567         ;;
9568 *)      d_vendorscript="$define"
9569         : determine where vendor-supplied scripts go.
9570         case "$vendorscript" in
9571         '')     dflt=$vendorprefix/script
9572                 $test -d $dflt || dflt=$vendorbin ;;
9573         *)  dflt="$vendorscript" ;;
9574         esac
9575         $cat <<EOM
9576
9577 The installation process will create a directory for
9578 vendor-supplied scripts.
9579
9580 EOM
9581         fn=d~+
9582         rp='Pathname for the vendor-supplied scripts directory?'
9583         . ./getfile
9584         vendorscript="$ans"
9585         vendorscriptexp="$ansexp"
9586         ;;
9587 esac
9588 prefixvar=vendorscript
9589 . ./installprefix
9590
9591 : script used to emit important warnings
9592 cat >warn <<EOS
9593 $startsh
9594 if test \$# -gt 0; then
9595         echo "\$@" >msg
9596 else
9597         cat >msg
9598 fi
9599 echo "*** WARNING:" >&4
9600 sed -e 's/^/*** /' <msg >&4
9601 echo "*** " >&4
9602 cat msg >>config.msg
9603 echo " " >>config.msg
9604 rm -f msg
9605 EOS
9606 chmod +x warn
9607 $eunicefix warn
9608
9609 : see which of string.h or strings.h is needed
9610 echo " "
9611 strings=`./findhdr string.h`
9612 if $test "$strings" && $test -r "$strings"; then
9613         echo "Using <string.h> instead of <strings.h>." >&4
9614         val="$define"
9615 else
9616         val="$undef"
9617         strings=`./findhdr strings.h`
9618         if $test "$strings" && $test -r "$strings"; then
9619                 echo "Using <strings.h> instead of <string.h>." >&4
9620         else
9621                 ./warn "No string header found -- You'll surely have problems."
9622         fi
9623 fi
9624 set i_string
9625 eval $setvar
9626 case "$i_string" in
9627 "$undef") strings=`./findhdr strings.h`;;
9628 *)        strings=`./findhdr string.h`;;
9629 esac
9630
9631 : see if qgcvt exists
9632 set qgcvt d_qgcvt
9633 eval $inlibc
9634
9635 : Check print/scan long double stuff
9636 echo " "
9637
9638 if $test X"$d_longdbl" = X"$define"; then
9639
9640 echo "Checking how to print long doubles..." >&4
9641
9642 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9643         $cat >try.c <<'EOCP'
9644 #include <sys/types.h>
9645 #include <stdio.h>
9646 int main() {
9647   double d = 123.456;
9648   printf("%.3f\n", d);
9649 }
9650 EOCP
9651         set try
9652         if eval $compile; then
9653                 yyy=`$run ./try`
9654                 case "$yyy" in
9655                 123.456)
9656                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9657                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9658                         echo "We will use %f."
9659                         ;;
9660                 esac
9661         fi
9662 fi
9663
9664 if $test X"$sPRIfldbl" = X; then
9665         $cat >try.c <<'EOCP'
9666 #include <sys/types.h>
9667 #include <stdio.h>
9668 int main() {
9669   long double d = 123.456;
9670   printf("%.3Lf\n", d);
9671 }
9672 EOCP
9673         set try
9674         if eval $compile; then
9675                 yyy=`$run ./try`
9676                 case "$yyy" in
9677                 123.456)
9678                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9679                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9680                         echo "We will use %Lf."
9681                         ;;
9682                 esac
9683         fi
9684 fi
9685
9686 if $test X"$sPRIfldbl" = X; then
9687         $cat >try.c <<'EOCP'
9688 #include <sys/types.h>
9689 #include <stdio.h>
9690 int main() {
9691   long double d = 123.456;
9692   printf("%.3llf\n", d);
9693 }
9694 EOCP
9695         set try
9696         if eval $compile; then
9697                 yyy=`$run ./try`
9698                 case "$yyy" in
9699                 123.456)
9700                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9701                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9702                         echo "We will use %llf."
9703                         ;;
9704                 esac
9705         fi
9706 fi
9707
9708 if $test X"$sPRIfldbl" = X; then
9709         $cat >try.c <<'EOCP'
9710 #include <sys/types.h>
9711 #include <stdio.h>
9712 int main() {
9713   long double d = 123.456;
9714   printf("%.3lf\n", d);
9715 }
9716 EOCP
9717         set try
9718         if eval $compile; then
9719                 yyy=`$run ./try`
9720                 case "$yyy" in
9721                 123.456)
9722                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9723                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9724                         echo "We will use %lf."
9725                         ;;
9726                 esac
9727         fi
9728 fi
9729
9730 if $test X"$sPRIfldbl" = X; then
9731         echo "Cannot figure out how to print long doubles." >&4
9732 else
9733         sSCNfldbl=$sPRIfldbl    # expect consistency
9734 fi
9735
9736 $rm_try
9737
9738 fi # d_longdbl
9739
9740 case "$sPRIfldbl" in
9741 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9742         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9743         d_SCNfldbl="$undef";
9744         ;;
9745 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9746         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9747         d_SCNfldbl="$define";
9748         ;;
9749 esac
9750
9751 : Check how to convert floats to strings.
9752
9753 if test "X$d_Gconvert" = X; then
9754
9755 echo " "
9756 echo "Checking for an efficient way to convert floats to strings."
9757 echo " " > try.c
9758 case "$uselongdouble" in
9759 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9760 esac
9761 case "$d_longdbl" in
9762 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9763 esac
9764 case "$d_PRIgldbl" in
9765 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9766 esac
9767 $cat >>try.c <<EOP
9768 #ifdef TRY_gconvert
9769 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9770 char *myname = "gconvert";
9771 #endif
9772 #ifdef TRY_gcvt
9773 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9774 char *myname = "gcvt";
9775 #endif
9776 #ifdef TRY_qgcvt
9777 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9778 char *myname = "qgcvt";
9779 #define DOUBLETYPE long double
9780 #endif
9781 #ifdef TRY_sprintf
9782 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9783 #ifdef HAS_PRIgldbl
9784 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9785 #else
9786 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9787 #endif
9788 #else
9789 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9790 #endif
9791 char *myname = "sprintf";
9792 #endif
9793
9794 #ifndef DOUBLETYPE
9795 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9796 #define DOUBLETYPE long double
9797 #else
9798 #define DOUBLETYPE double
9799 #endif
9800 #endif
9801
9802 #include <stdio.h>
9803
9804 #$i_stdlib I_STDLIB
9805 #ifdef I_STDLIB
9806 #include <stdlib.h>
9807 #endif
9808 #$i_string I_STRING
9809 #ifdef I_STRING
9810 #  include <string.h>
9811 #else
9812 #  include <strings.h>
9813 #endif
9814
9815 int checkit(char *expect, char *got)
9816 {
9817     if (strcmp(expect, got)) {
9818                 printf("%s oddity:  Expected %s, got %s\n",
9819                         myname, expect, got);
9820                 exit(1);
9821         }
9822 }
9823
9824 int main()
9825 {
9826         char buf[64];
9827         buf[63] = '\0';
9828
9829         /* This must be 1st test on (which?) platform */
9830         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9831         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9832         checkit("0.1", buf);
9833
9834         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9835         checkit("0.01", buf);
9836
9837         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9838         checkit("0.001", buf);
9839
9840         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9841         checkit("0.0001", buf);
9842
9843         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9844         if (strlen(buf) > 5)
9845             checkit("9e-005", buf); /* for Microsoft ?? */
9846         else
9847             checkit("9e-05", buf);
9848
9849         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9850         checkit("1", buf);
9851
9852         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9853         checkit("1.1", buf);
9854
9855         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9856         checkit("1.01", buf);
9857
9858         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9859         checkit("1.001", buf);
9860
9861         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9862         checkit("1.0001", buf);
9863
9864         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9865         checkit("1.00001", buf);
9866
9867         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9868         checkit("1.000001", buf);
9869
9870         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9871         checkit("0", buf);
9872
9873         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9874         checkit("-1", buf);
9875
9876         /* Some Linux gcvt's give 1.e+5 here. */
9877         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9878         checkit("100000", buf);
9879
9880         /* Some Linux gcvt's give -1.e+5 here. */
9881         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9882         checkit("-100000", buf);
9883
9884         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9885         checkit("123.456", buf);
9886
9887         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9888         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9889         /* 34 should be enough to scare even long double
9890          * places into using the e notation. */
9891         if (strlen(buf) > 5)
9892             checkit("1e+034", buf); /* for Microsoft */
9893         else
9894             checkit("1e+34", buf);
9895
9896         /* For Perl, if you add additional tests here, also add them to
9897          * t/base/num.t for benefit of platforms not using Configure or
9898          * overriding d_Gconvert */
9899
9900         exit(0);
9901 }
9902 EOP
9903 : first add preferred functions to our list
9904 xxx_list=""
9905 for xxx_convert in $gconvert_preference; do
9906     case $xxx_convert in
9907     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9908     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9909     esac
9910 done
9911 : then add any others
9912 for xxx_convert in gconvert gcvt sprintf; do
9913     case "$xxx_list" in
9914     *$xxx_convert*) ;;
9915     *) xxx_list="$xxx_list $xxx_convert" ;;
9916     esac
9917 done
9918
9919 case "$d_longdbl$uselongdouble" in
9920 "$define$define")
9921     : again, add preferred functions to our list first
9922     xxx_ld_list=""
9923     for xxx_convert in $gconvert_ld_preference; do
9924         case $xxx_convert in
9925         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9926         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9927         esac
9928     done
9929     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9930     for xxx_convert in qgcvt sprintf $xxx_list; do
9931         case "$xxx_ld_list" in
9932         $xxx_convert*|*" $xxx_convert"*) ;;
9933         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9934         esac
9935     done
9936     : if sprintf cannot do long doubles, move it to the end
9937     if test "$d_PRIgldbl" != "$define"; then
9938         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9939     fi
9940     : if no qgcvt, remove it
9941     if test "$d_qgcvt" != "$define"; then
9942         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9943     fi
9944     : use the ld_list
9945     xxx_list="$xxx_ld_list"
9946     ;;
9947 esac
9948
9949 for xxx_convert in $xxx_list; do
9950         echo "Trying $xxx_convert..."
9951         $rm -f try try$_o core
9952         set try -DTRY_$xxx_convert
9953         if eval $compile; then
9954                 echo "$xxx_convert() found." >&4
9955                 if $run ./try; then
9956                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9957                         break;
9958                 else
9959                         echo "...But $xxx_convert didn't work as I expected."
9960                         xxx_convert=''
9961                 fi
9962         else
9963                 echo "$xxx_convert NOT found." >&4
9964         fi
9965 done
9966
9967 if test X$xxx_convert = X; then
9968     echo "*** WHOA THERE!!! ***" >&4
9969     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9970     xxx_convert=sprintf
9971 fi
9972
9973 case "$xxx_convert" in
9974 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9975 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9976 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9977 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9978    "$define$define$define")
9979       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9980    "$define$define$undef")
9981       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9982    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9983    esac
9984    ;;
9985 esac
9986
9987 fi
9988 $rm_try
9989
9990 : see if _fwalk exists
9991 set fwalk d__fwalk
9992 eval $inlibc
9993
9994 : Initialize h_fcntl
9995 h_fcntl=false
9996
9997 : Initialize h_sysfile
9998 h_sysfile=false
9999
10000 : access call always available on UNIX
10001 set access d_access
10002 eval $inlibc
10003
10004 : locate the flags for 'access()'
10005 case "$d_access" in
10006 "$define")
10007         echo " "
10008         $cat >access.c <<EOCP
10009 #include <sys/types.h>
10010 #ifdef I_FCNTL
10011 #include <fcntl.h>
10012 #endif
10013 #ifdef I_SYS_FILE
10014 #include <sys/file.h>
10015 #endif
10016 #ifdef I_UNISTD
10017 #include <unistd.h>
10018 #endif
10019 #$i_stdlib I_STDLIB
10020 #ifdef I_STDLIB
10021 #include <stdlib.h>
10022 #endif
10023 int main() {
10024         exit(R_OK);
10025 }
10026 EOCP
10027         : check sys/file.h first, no particular reason here
10028         if $test `./findhdr sys/file.h` && \
10029                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10030                 h_sysfile=true;
10031                 echo "<sys/file.h> defines the *_OK access constants." >&4
10032         elif $test `./findhdr fcntl.h` && \
10033                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10034                 h_fcntl=true;
10035                 echo "<fcntl.h> defines the *_OK access constants." >&4
10036         elif $test `./findhdr unistd.h` && \
10037                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10038                 echo "<unistd.h> defines the *_OK access constants." >&4
10039         else
10040                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10041         fi
10042         ;;
10043 esac
10044 $rm -f access*
10045
10046 : see if accessx exists
10047 set accessx d_accessx
10048 eval $inlibc
10049
10050 : see if aintl exists
10051 set aintl d_aintl
10052 eval $inlibc
10053
10054 : see if alarm exists
10055 set alarm d_alarm
10056 eval $inlibc
10057
10058 : see if 64bit time functions exists
10059
10060 set ctime64 d_ctime64
10061 eval $inlibc
10062
10063 set localtime64 d_localtime64
10064 eval $inlibc
10065
10066 set gmtime64 d_gmtime64
10067 eval $inlibc
10068
10069 set mktime64 d_mktime64
10070 eval $inlibc
10071
10072 set difftime64 d_difftime64
10073 eval $inlibc
10074
10075 set asctime64 d_asctime64
10076 eval $inlibc
10077
10078 : see if POSIX threads are available
10079 set pthread.h i_pthread
10080 eval $inhdr
10081
10082 : define a function to check prototypes
10083 $cat > protochk <<EOSH
10084 $startsh
10085 cc="$cc"
10086 optimize="$optimize"
10087 ccflags="$ccflags"
10088 prototype="$prototype"
10089 define="$define"
10090 rm_try="$rm_try"
10091 usethreads=$usethreads
10092 i_pthread=$i_pthread
10093 pthread_h_first=$pthread_h_first
10094 EOSH
10095
10096 $cat >> protochk <<'EOSH'
10097
10098 $rm_try
10099 foo="$1"
10100 shift
10101 while test $# -ge 2; do
10102         case "$1" in
10103                 $define) echo "#include <$2>" >> try.c ;;
10104                 literal) echo "$2" >> try.c ;;
10105         esac
10106     # Extra magic for the benefit of systems that need pthread.h
10107     # to be included early to correctly detect threadsafe functions.
10108     # Such functions must guarantee themselves, though, that the usethreads
10109     # and i_pthread have been defined, before calling protochk.
10110     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10111         echo "#include <pthread.h>" >> try.c
10112         pthread_h_done=yes
10113     fi
10114     shift 2
10115 done
10116 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10117 cat >> try.c <<'EOCP'
10118 #ifdef CAN_PROTOTYPE
10119 #define _(args) args
10120 #else
10121 #define _(args) ()
10122 #endif
10123 EOCP
10124 echo "$foo" >> try.c
10125 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10126 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10127 status=$?
10128 $rm_try
10129 exit $status
10130 EOSH
10131 chmod +x protochk
10132 $eunicefix protochk
10133
10134 : Define hasproto macro for Configure internal use
10135 hasproto='varname=$1; func=$2; shift; shift;
10136 while $test $# -ge 2; do
10137         case "$1" in
10138         $define) echo "#include <$2>";;
10139         esac ;
10140     shift 2;
10141 done > try.c;
10142 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10143 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10144         echo "$func() prototype found.";
10145         val="$define";
10146 else
10147         echo "$func() prototype NOT found.";
10148         val="$undef";
10149 fi;
10150 set $varname;
10151 eval $setvar;
10152 $rm_try tryout.c'
10153
10154 : see if sys/types.h has to be included
10155 set sys/types.h i_systypes
10156 eval $inhdr
10157
10158 : see if sys/select.h has to be included
10159 set sys/select.h i_sysselct
10160 eval $inhdr
10161
10162 : Define hasfield macro for Configure internal use
10163 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10164 while $test $# -ge 2; do
10165         case "$1" in
10166         $define) echo "#include <$2>";;
10167         esac ;
10168     shift 2;
10169 done > try.c;
10170 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10171 set try;
10172 if eval $compile; then
10173         val="$define";
10174 else
10175         val="$undef";
10176 fi;
10177 set $varname;
10178 eval $setvar;
10179 $rm_try'
10180
10181 : see if we should include time.h, sys/time.h, or both
10182 echo " "
10183 if test "X$timeincl" = X; then
10184         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10185         $echo $n "I'm now running the test program...$c"
10186         $cat >try.c <<EOCP
10187 #include <sys/types.h>
10188 #ifdef I_TIME
10189 #include <time.h>
10190 #endif
10191 #ifdef I_SYSTIME
10192 #ifdef SYSTIMEKERNEL
10193 #define KERNEL
10194 #endif
10195 #include <sys/time.h>
10196 #endif
10197 #ifdef I_SYSSELECT
10198 #include <sys/select.h>
10199 #endif
10200 #$i_stdlib I_STDLIB
10201 #ifdef I_STDLIB
10202 #include <stdlib.h>
10203 #endif
10204 int main()
10205 {
10206         struct tm foo;
10207 #ifdef S_TIMEVAL
10208         struct timeval bar;
10209 #endif
10210 #ifdef S_TIMEZONE
10211         struct timezone tzp;
10212 #endif
10213         if (foo.tm_sec == foo.tm_sec)
10214                 exit(0);
10215 #ifdef S_TIMEVAL
10216         if (bar.tv_sec == bar.tv_sec)
10217                 exit(0);
10218 #endif
10219         exit(1);
10220 }
10221 EOCP
10222         flags=''
10223         for s_timezone in '-DS_TIMEZONE' ''; do
10224         sysselect=''
10225         for s_timeval in '-DS_TIMEVAL' ''; do
10226         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10227         for i_time in '' '-DI_TIME'; do
10228         for i_systime in '-DI_SYSTIME' ''; do
10229                 case "$flags" in
10230                 '') $echo $n ".$c"
10231                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10232                         if eval $compile; then
10233                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10234                                 shift
10235                                 flags="$*"
10236                                 echo " "
10237                                 $echo $n "Succeeded with $flags$c"
10238                         fi
10239                         ;;
10240                 esac
10241         done
10242         done
10243         done
10244         done
10245         done
10246         timeincl=''
10247         echo " "
10248         case "$flags" in
10249         *SYSTIMEKERNEL*) i_systimek="$define"
10250                 timeincl=`./findhdr sys/time.h`
10251                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10252         *) i_systimek="$undef";;
10253         esac
10254         case "$flags" in
10255         *I_TIME*) i_time="$define"
10256                 timeincl=`./findhdr time.h`" $timeincl"
10257                 echo "We'll include <time.h>." >&4;;
10258         *) i_time="$undef";;
10259         esac
10260         case "$flags" in
10261         *I_SYSTIME*) i_systime="$define"
10262                 timeincl=`./findhdr sys/time.h`" $timeincl"
10263                 echo "We'll include <sys/time.h>." >&4;;
10264         *) i_systime="$undef";;
10265         esac
10266         $rm_try
10267 fi
10268 : see if struct tm knows about tm_zone
10269 case "$i_systime$i_time" in
10270 *$define*)
10271         echo " "
10272         echo "Checking to see if your struct tm has tm_zone field..." >&4
10273         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10274         eval $hasfield
10275         ;;
10276 *)      val="$undef"
10277         set d_tm_tm_zone
10278         eval $setvar
10279         ;;
10280 esac
10281 case "$d_tm_tm_zone" in
10282 "$define")      echo "Yes, it does."   ;;
10283 *)              echo "No, it doesn't." ;;
10284 esac
10285 : see if struct tm knows about tm_gmtoff
10286 case "$i_systime$i_time" in
10287 *$define*)
10288         echo " "
10289         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10290         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10291         eval $hasfield
10292         ;;
10293 *)      val="$undef"
10294         set d_tm_tm_gmtoff
10295         eval $setvar
10296         ;;
10297 esac
10298 case "$d_tm_tm_gmtoff" in
10299 "$define")      echo "Yes, it does."   ;;
10300 *)              echo "No, it doesn't." ;;
10301 esac
10302
10303 : see if asctime_r exists
10304 set asctime_r d_asctime_r
10305 eval $inlibc
10306 case "$d_asctime_r" in
10307 "$define")
10308         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10309         case "$d_asctime_r_proto:$usethreads" in
10310         ":define")      d_asctime_r_proto=define
10311                 set d_asctime_r_proto asctime_r $hdrs
10312                 eval $hasproto ;;
10313         *)      ;;
10314         esac
10315         case "$d_asctime_r_proto" in
10316         define)
10317         case "$asctime_r_proto" in
10318         ''|0) try='char* asctime_r(const struct tm*, char*);'
10319         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10320         esac
10321         case "$asctime_r_proto" in
10322         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10323         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10324         esac
10325         case "$asctime_r_proto" in
10326         ''|0) try='int asctime_r(const struct tm*, char*);'
10327         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10328         esac
10329         case "$asctime_r_proto" in
10330         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10331         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10332         esac
10333         case "$asctime_r_proto" in
10334         ''|0)   d_asctime_r=undef
10335                 asctime_r_proto=0
10336                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10337         * )     case "$asctime_r_proto" in
10338                 REENTRANT_PROTO*) ;;
10339                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10340                 esac
10341                 echo "Prototype: $try" ;;
10342         esac
10343         ;;
10344         *)      case "$usethreads" in
10345                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10346                 esac
10347                 d_asctime_r=undef
10348                 asctime_r_proto=0
10349                 ;;
10350         esac
10351         ;;
10352 *)      asctime_r_proto=0
10353         ;;
10354 esac
10355
10356 : see if atolf exists
10357 set atolf d_atolf
10358 eval $inlibc
10359
10360 : see if atoll exists
10361 set atoll d_atoll
10362 eval $inlibc
10363
10364 : Look for GCC-style attribute format
10365 case "$d_attribute_format" in
10366 '')
10367 echo " "
10368 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10369 $cat >attrib.c <<'EOCP'
10370 #include <stdio.h>
10371 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10372 EOCP
10373 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10374         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10375                 echo "Your C compiler doesn't support __attribute__((format))."
10376                 val="$undef"
10377         else
10378                 echo "Your C compiler supports __attribute__((format))."
10379                 val="$define"
10380         fi
10381 else
10382         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10383         val="$undef"
10384 fi
10385 ;;
10386 *) val="$d_attribute_format" ;;
10387 esac
10388 set d_attribute_format
10389 eval $setvar
10390 $rm -f attrib*
10391
10392 : Look for GCC-style attribute format with null format allowed
10393 case "$d_printf_format_null" in
10394 '') case "$d_attribute_format" in
10395     $define)
10396         echo " "
10397         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10398 $cat >attrib.c <<EOCP
10399 #include <stdio.h>
10400 #$i_stdlib I_STDLIB
10401 #ifdef I_STDLIB
10402 #include <stdlib.h>
10403 #endif
10404 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10405 int null_printf (char* pat,...) { return (int)pat; }
10406 int main () { exit(null_printf(NULL)); }
10407 EOCP
10408         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10409             : run the executable in case it produces a run-time warning
10410             if $run ./attrib >>attrib.out 2>&1; then
10411                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10412                     echo "Your C compiler doesn't allow __printf__ format to be null."
10413                     val="$undef"
10414                 else
10415                     echo "Your C compiler allows __printf__ format to be null."
10416                     val="$define"
10417                 fi
10418             else
10419             echo "Your C compiler executable failed with __printf__ format null."
10420             val="$undef"
10421         fi
10422     else
10423         echo "Your C compiler fails with __printf__ format null."
10424         val="$undef"
10425     fi
10426     ;;
10427     *)  val="$undef" ;;
10428     esac
10429 ;;
10430 *)  val="$d_printf_format_null" ;;
10431 esac
10432 set d_printf_format_null
10433 eval $setvar
10434 $rm -f attrib*
10435
10436 : Look for GCC-style attribute malloc
10437 case "$d_attribute_malloc" in
10438 '')
10439 echo " "
10440 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10441 $cat >attrib.c <<'EOCP'
10442 #include <stdio.h>
10443 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10444 EOCP
10445 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10446         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10447                 echo "Your C compiler doesn't support __attribute__((malloc))."
10448                 val="$undef"
10449         else
10450                 echo "Your C compiler supports __attribute__((malloc))."
10451                 val="$define"
10452         fi
10453 else
10454         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10455         val="$undef"
10456 fi
10457 ;;
10458 *) val="$d_attribute_malloc" ;;
10459 esac
10460 set d_attribute_malloc
10461 eval $setvar
10462 $rm -f attrib*
10463
10464 : Look for GCC-style attribute nonnull
10465 case "$d_attribute_nonnull" in
10466 '')
10467 echo " "
10468 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10469 $cat >attrib.c <<'EOCP'
10470 #include <stdio.h>
10471 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10472 EOCP
10473 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10474         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10475                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10476                 val="$undef"
10477         else
10478                 echo "Your C compiler supports __attribute__((nonnull))."
10479                 val="$define"
10480         fi
10481 else
10482         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10483         val="$undef"
10484 fi
10485 ;;
10486 *) val="$d_attribute_nonnull" ;;
10487 esac
10488 set d_attribute_nonnull
10489 eval $setvar
10490 $rm -f attrib*
10491
10492 : Look for GCC-style attribute noreturn
10493 case "$d_attribute_noreturn" in
10494 '')
10495 echo " "
10496 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10497 $cat >attrib.c <<'EOCP'
10498 #include <stdio.h>
10499 void fall_over_dead( void ) __attribute__((noreturn));
10500 EOCP
10501 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10502         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10503                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10504                 val="$undef"
10505         else
10506                 echo "Your C compiler supports __attribute__((noreturn))."
10507                 val="$define"
10508         fi
10509 else
10510         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10511         val="$undef"
10512 fi
10513 ;;
10514 *) val="$d_attribute_noreturn" ;;
10515 esac
10516 set d_attribute_noreturn
10517 eval $setvar
10518 $rm -f attrib*
10519
10520 : Look for GCC-style attribute pure
10521 case "$d_attribute_pure" in
10522 '')
10523 echo " "
10524 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10525 $cat >attrib.c <<'EOCP'
10526 #include <stdio.h>
10527 int square( int n ) __attribute__((pure));
10528 EOCP
10529 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10530         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10531                 echo "Your C compiler doesn't support __attribute__((pure))."
10532                 val="$undef"
10533         else
10534                 echo "Your C compiler supports __attribute__((pure))."
10535                 val="$define"
10536         fi
10537 else
10538         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10539         val="$undef"
10540 fi
10541 ;;
10542 *) val="$d_attribute_pure" ;;
10543 esac
10544 set d_attribute_pure
10545 eval $setvar
10546 $rm -f attrib*
10547
10548 : Look for GCC-style attribute unused
10549 case "$d_attribute_unused" in
10550 '')
10551 echo " "
10552 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10553 $cat >attrib.c <<'EOCP'
10554 #include <stdio.h>
10555 int do_something( int dummy __attribute__((unused)), int n );
10556 EOCP
10557 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10558         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10559                 echo "Your C compiler doesn't support __attribute__((unused))."
10560                 val="$undef"
10561         else
10562                 echo "Your C compiler supports __attribute__((unused))."
10563                 val="$define"
10564         fi
10565 else
10566         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10567         val="$undef"
10568 fi
10569 ;;
10570 *) val="$d_attribute_unused" ;;
10571 esac
10572 set d_attribute_unused
10573 eval $setvar
10574 $rm -f attrib*
10575
10576 : Look for GCC-style attribute deprecated
10577 case "$d_attribute_deprecated" in
10578 '')
10579 echo " "
10580 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10581 $cat >attrib.c <<'EOCP'
10582 #include <stdio.h>
10583 int I_am_deprecated(void) __attribute__((deprecated));
10584 EOCP
10585 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10586         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10587                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10588                 val="$undef"
10589         else
10590                 echo "Your C compiler supports __attribute__((deprecated))."
10591                 val="$define"
10592         fi
10593 else
10594         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10595         val="$undef"
10596 fi
10597 ;;
10598 *) val="$d_attribute_deprecated" ;;
10599 esac
10600 set d_attribute_deprecated
10601 eval $setvar
10602 $rm -f attrib*
10603
10604 : Look for GCC-style attribute warn_unused_result
10605 case "$d_attribute_warn_unused_result" in
10606 '')
10607 echo " "
10608 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10609 $cat >attrib.c <<'EOCP'
10610 #include <stdio.h>
10611 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10612 EOCP
10613 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10614         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10615                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10616                 val="$undef"
10617         else
10618                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10619                 val="$define"
10620         fi
10621 else
10622         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10623         val="$undef"
10624 fi
10625 ;;
10626 *) val="$d_attribute_warn_unused_result" ;;
10627 esac
10628 set d_attribute_warn_unused_result
10629 eval $setvar
10630 $rm -f attrib*
10631
10632 : see if bcmp exists
10633 set bcmp d_bcmp
10634 eval $inlibc
10635
10636 : see if bcopy exists
10637 set bcopy d_bcopy
10638 eval $inlibc
10639
10640 : see if getpgrp exists
10641 set getpgrp d_getpgrp
10642 eval $inlibc
10643
10644 case "$d_getpgrp" in
10645 "$define")
10646         echo " "
10647         echo "Checking to see which flavor of getpgrp is in use..."
10648         $cat >try.c <<EOP
10649 #$i_unistd I_UNISTD
10650 #include <sys/types.h>
10651 #ifdef I_UNISTD
10652 #  include <unistd.h>
10653 #endif
10654 #$i_stdlib I_STDLIB
10655 #ifdef I_STDLIB
10656 #include <stdlib.h>
10657 #endif
10658 int main()
10659 {
10660         if (getuid() == 0) {
10661                 printf("(I see you are running Configure as super-user...)\n");
10662                 setuid(1);
10663         }
10664 #ifdef TRY_BSD_PGRP
10665         if (getpgrp(1) == 0)
10666                 exit(0);
10667 #else
10668         if (getpgrp() > 0)
10669                 exit(0);
10670 #endif
10671         exit(1);
10672 }
10673 EOP
10674         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10675                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10676                 val="$define"
10677         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10678                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10679                 val="$undef"
10680         else
10681                 echo "I can't seem to compile and run the test program."
10682                 if ./usg; then
10683                         xxx="a USG one, i.e. you use getpgrp()."
10684                 else
10685                         # SVR4 systems can appear rather BSD-ish.
10686                         case "$i_unistd" in
10687                         $undef)
10688                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10689                                 val="$define"
10690                                 ;;
10691                         $define)
10692                                 xxx="probably a USG one, i.e. you use getpgrp()."
10693                                 val="$undef"
10694                                 ;;
10695                         esac
10696                 fi
10697                 echo "Assuming your getpgrp is $xxx" >&4
10698         fi
10699         ;;
10700 *) val="$undef";;
10701 esac
10702 set d_bsdgetpgrp
10703 eval $setvar
10704 $rm_try
10705
10706 : see if setpgrp exists
10707 set setpgrp d_setpgrp
10708 eval $inlibc
10709
10710 case "$d_setpgrp" in
10711 "$define")
10712         echo " "
10713         echo "Checking to see which flavor of setpgrp is in use..."
10714         $cat >try.c <<EOP
10715 #$i_unistd I_UNISTD
10716 #include <sys/types.h>
10717 #ifdef I_UNISTD
10718 #  include <unistd.h>
10719 #endif
10720 #$i_stdlib I_STDLIB
10721 #ifdef I_STDLIB
10722 #include <stdlib.h>
10723 #endif
10724 int main()
10725 {
10726         if (getuid() == 0) {
10727                 printf("(I see you are running Configure as super-user...)\n");
10728                 setuid(1);
10729         }
10730 #ifdef TRY_BSD_PGRP
10731         if (-1 == setpgrp(1, 1))
10732                 exit(0);
10733 #else
10734         if (setpgrp() != -1)
10735                 exit(0);
10736 #endif
10737         exit(1);
10738 }
10739 EOP
10740         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10741                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10742                 val="$define"
10743         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10744                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10745                 val="$undef"
10746         else
10747                 echo "(I can't seem to compile and run the test program.)"
10748                 if ./usg; then
10749                         xxx="a USG one, i.e. you use setpgrp()."
10750                 else
10751                         # SVR4 systems can appear rather BSD-ish.
10752                         case "$i_unistd" in
10753                         $undef)
10754                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10755                                 val="$define"
10756                                 ;;
10757                         $define)
10758                                 xxx="probably a USG one, i.e. you use setpgrp()."
10759                                 val="$undef"
10760                                 ;;
10761                         esac
10762                 fi
10763                 echo "Assuming your setpgrp is $xxx" >&4
10764         fi
10765         ;;
10766 *) val="$undef";;
10767 esac
10768 set d_bsdsetpgrp
10769 eval $setvar
10770 $rm_try
10771
10772 : Look for GCC-style __builtin_choose_expr
10773 case "$d_builtin_choose_expr" in
10774 '')
10775     echo " "
10776     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10777     $cat >try.c <<'EOCP'
10778 #include <assert.h>
10779 #include <stdlib.h>
10780 #include <stdio.h>
10781
10782 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10783
10784 int main(void) {
10785     assert( SYRINX(1) == 2112 );
10786     assert( SYRINX(1) != 5150 );
10787     assert( SYRINX(0) == 5150 );
10788     assert( SYRINX(0) != 2112 );
10789     puts( "All good!" );
10790     exit(0);
10791 }
10792
10793 EOCP
10794     set try
10795     if eval $compile && $run ./try; then
10796         echo "Your C compiler supports __builtin_choose_expr."
10797         val="$define"
10798     else
10799         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10800         val="$undef"
10801     fi
10802 ;;
10803 *) val="$d_builtin_choose_expr" ;;
10804 esac
10805
10806 set d_builtin_choose_expr
10807 eval $setvar
10808 $rm_try
10809
10810 : Look for GCC-style __builtin_expect
10811 case "$d_builtin_expect" in
10812 '')
10813     echo " "
10814     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10815     $cat >try.c <<'EOCP'
10816 int main(void) {
10817     int n = 50;
10818     if ( __builtin_expect(n, 0) ) n = 1;
10819     /* Remember shell exit code truth is 0, C truth is non-zero */
10820     return !(n == 1);
10821 }
10822 EOCP
10823     set try
10824     if eval $compile && $run ./try; then
10825         echo "Your C compiler supports __builtin_expect."
10826         val="$define"
10827     else
10828         echo "Your C compiler doesn't seem to understand __builtin_expect."
10829         val="$undef"
10830     fi
10831     ;;
10832 *) val="$d_builtin_expect" ;;
10833 esac
10834
10835 set d_builtin_expect
10836 eval $setvar
10837 $rm_try
10838
10839 : see if bzero exists
10840 set bzero d_bzero
10841 eval $inlibc
10842
10843 : see if stdarg is available
10844 echo " "
10845 if $test `./findhdr stdarg.h`; then
10846         echo "<stdarg.h> found." >&4
10847         valstd="$define"
10848 else
10849         echo "<stdarg.h> NOT found." >&4
10850         valstd="$undef"
10851 fi
10852
10853 : see if varargs is available
10854 echo " "
10855 if $test `./findhdr varargs.h`; then
10856         echo "<varargs.h> found." >&4
10857 else
10858         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10859 fi
10860
10861 : set up the varargs testing programs
10862 $cat > varargs.c <<EOP
10863 #ifdef I_STDARG
10864 #include <stdarg.h>
10865 #endif
10866 #ifdef I_VARARGS
10867 #include <varargs.h>
10868 #endif
10869
10870 #ifdef I_STDARG
10871 int f(char *p, ...)
10872 #else
10873 int f(va_alist)
10874 va_dcl
10875 #endif
10876 {
10877         va_list ap;
10878 #ifndef I_STDARG
10879         char *p;
10880 #endif
10881 #ifdef I_STDARG
10882         va_start(ap,p);
10883 #else
10884         va_start(ap);
10885         p = va_arg(ap, char *);
10886 #endif
10887         va_end(ap);
10888         return 0;
10889 }
10890 EOP
10891 $cat > varargs <<EOP
10892 $startsh
10893 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10894         echo "true"
10895 else
10896         echo "false"
10897 fi
10898 $rm -f varargs$_o
10899 EOP
10900 chmod +x varargs
10901
10902 : now check which varargs header should be included
10903 echo " "
10904 i_varhdr=''
10905 val=''
10906 case "$valstd" in
10907 "$define")
10908         if `./varargs I_STDARG`; then
10909                 val='stdarg.h'
10910         elif `./varargs I_VARARGS`; then
10911                 val='varargs.h'
10912         fi
10913         ;;
10914 *)
10915         if `./varargs I_VARARGS`; then
10916                 val='varargs.h'
10917         fi
10918         ;;
10919 esac
10920 case "$val" in
10921 '')
10922         echo " "
10923         echo "*** WHOA THERE!!! ***" >&4
10924         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
10925         case "$knowitall" in
10926         '')
10927         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
10928                 exit 1
10929                 ;;
10930         esac
10931 echo "I could not find the definition for va_dcl... You have problems..." >&4
10932         val="$undef"; set i_stdarg; eval $setvar
10933         val="$undef"; set i_varargs; eval $setvar
10934         ;;
10935 *)
10936         set i_varhdr
10937         eval $setvar
10938         case "$i_varhdr" in
10939         stdarg.h)
10940                 val="$define"; set i_stdarg; eval $setvar
10941                 val="$undef"; set i_varargs; eval $setvar
10942                 ;;
10943         varargs.h)
10944                 val="$undef"; set i_stdarg; eval $setvar
10945                 val="$define"; set i_varargs; eval $setvar
10946                 ;;
10947         esac
10948         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10949 esac
10950 $rm -f varargs*
10951
10952 : see if the Compiler supports C99 variadic macros
10953 case "$i_stdarg$i_stdlib" in
10954     "$define$define")
10955     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10956     $cat >try.c <<EOCP
10957 #include <stdio.h>
10958 #include <stdarg.h>
10959
10960 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10961
10962 int main() {
10963   char buf[20];
10964   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10965   puts(buf);
10966   return 0;
10967 }
10968 EOCP
10969     set try
10970     if eval $compile && $run ./try 2>&1 >/dev/null; then
10971         case "`$run ./try`" in
10972             "123 456 789")
10973             echo "You have C99 variadic macros." >&4
10974             d_c99_variadic_macros="$define"
10975             ;;
10976             *)
10977             echo "You don't have functional C99 variadic macros." >&4
10978             d_c99_variadic_macros="$undef"
10979             ;;
10980         esac
10981     else
10982         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10983         d_c99_variadic_macros="$undef"
10984     fi
10985     $rm_try
10986     ;;
10987     *)
10988     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10989     d_c99_variadic_macros="$undef"
10990     ;;
10991 esac
10992
10993 : see if signal is declared as pointer to function returning int or void
10994 echo " "
10995 xxx=`./findhdr signal.h`
10996 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10997 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10998         echo "You have int (*signal())() instead of void." >&4
10999         val="$undef"
11000 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11001         echo "You have void (*signal())()." >&4
11002         val="$define"
11003 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11004         echo "You have int (*signal())() instead of void." >&4
11005         val="$undef"
11006 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11007         echo "You have void (*signal())()." >&4
11008         val="$define"
11009 else
11010         case "$d_voidsig" in
11011         '')
11012         echo "I can't determine whether signal handler returns void or int..." >&4
11013                 dflt=void
11014                 rp="What type does your signal handler return?"
11015                 . ./myread
11016                 case "$ans" in
11017                 v*) val="$define";;
11018                 *) val="$undef";;
11019                 esac;;
11020         "$define")
11021                 echo "As you already told me, signal handler returns void." >&4
11022                 val="$define"
11023                 ;;
11024         *)      echo "As you already told me, signal handler returns int." >&4
11025                 val="$undef"
11026                 ;;
11027         esac
11028 fi
11029 set d_voidsig
11030 eval $setvar
11031 case "$d_voidsig" in
11032 "$define") signal_t="void";;
11033 *) signal_t="int";;
11034 esac
11035 $rm -f $$.tmp
11036
11037 : check for ability to cast large floats to 32-bit ints.
11038 echo " "
11039 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11040 if $test "$intsize" -ge 4; then
11041         xxx=int
11042 else
11043         xxx=long
11044 fi
11045 $cat >try.c <<EOCP
11046 #include <stdio.h>
11047 #$i_stdlib I_STDLIB
11048 #ifdef I_STDLIB
11049 #include <stdlib.h>
11050 #endif
11051 #include <sys/types.h>
11052 #include <signal.h>
11053 $signal_t blech(int s) { exit(3); }
11054 int main()
11055 {
11056         $xxx i32;
11057         double f, g;
11058         int result = 0;
11059         char str[16];
11060         signal(SIGFPE, blech);
11061
11062         /* Don't let compiler optimize the test away.  Store the number
11063            in a writable string for gcc to pass to sscanf under HP-UX.
11064         */
11065         sprintf(str, "2147483647");
11066         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11067         g = 10 * f;
11068         i32  = ($xxx) g;
11069
11070         /* x86 processors will probably give 0x8000 0000, which is a
11071            sign change.  We don't want that.  We want to mimic SPARC
11072            behavior here, which is to preserve the sign and give
11073            back 0x7fff ffff.
11074         */
11075         if (i32 != ($xxx) f)
11076                 result |= 1;
11077         exit(result);
11078 }
11079 EOCP
11080 set try
11081 if eval $compile_ok; then
11082         $run ./try
11083         yyy=$?
11084 else
11085         echo "(I can't seem to compile the test program--assuming it can't)"
11086         yyy=1
11087 fi
11088 case "$yyy" in
11089 0)      val="$define"
11090         echo "Yup, it can."
11091         ;;
11092 *)      val="$undef"
11093         echo "Nope, it can't."
11094         ;;
11095 esac
11096 set d_casti32
11097 eval $setvar
11098 $rm_try
11099
11100 : check for ability to cast negative floats to unsigned
11101 echo " "
11102 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11103 $cat >try.c <<EOCP
11104 #include <stdio.h>
11105 #$i_stdlib I_STDLIB
11106 #ifdef I_STDLIB
11107 #include <stdlib.h>
11108 #endif
11109 #include <sys/types.h>
11110 #include <signal.h>
11111 $signal_t blech(int s) { exit(7); }
11112 $signal_t blech_in_list(int s) { exit(4); }
11113 unsigned long dummy_long(unsigned long p) { return p; }
11114 unsigned int dummy_int(unsigned int p) { return p; }
11115 unsigned short dummy_short(unsigned short p) { return p; }
11116 int main()
11117 {
11118         double f;
11119         unsigned long along;
11120         unsigned int aint;
11121         unsigned short ashort;
11122         int result = 0;
11123         char str[16];
11124
11125         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11126            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11127            optimized the whole file away
11128         */
11129         /* Store the number in a writable string for gcc to pass to
11130            sscanf under HP-UX.
11131         */
11132         sprintf(str, "-123");
11133         sscanf(str, "%lf", &f);  /* f = -123.; */
11134
11135         signal(SIGFPE, blech);
11136         along = (unsigned long)f;
11137         aint = (unsigned int)f;
11138         ashort = (unsigned short)f;
11139         if (along != (unsigned long)-123)
11140                 result |= 1;
11141         if (aint != (unsigned int)-123)
11142                 result |= 1;
11143         if (ashort != (unsigned short)-123)
11144                 result |= 1;
11145         sprintf(str, "1073741824.");
11146         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11147         f = f + f;
11148         along = 0;
11149         along = (unsigned long)f;
11150         if (along != 0x80000000)
11151                 result |= 2;
11152         f -= 1.;
11153         along = 0;
11154         along = (unsigned long)f;
11155         if (along != 0x7fffffff)
11156                 result |= 1;
11157         f += 2.;
11158         along = 0;
11159         along = (unsigned long)f;
11160         if (along != 0x80000001)
11161                 result |= 2;
11162         if (result)
11163                 exit(result);
11164         signal(SIGFPE, blech_in_list);
11165         sprintf(str, "123.");
11166         sscanf(str, "%lf", &f);  /* f = 123.; */
11167         along = dummy_long((unsigned long)f);
11168         aint = dummy_int((unsigned int)f);
11169         ashort = dummy_short((unsigned short)f);
11170         if (along != (unsigned long)123)
11171                 result |= 4;
11172         if (aint != (unsigned int)123)
11173                 result |= 4;
11174         if (ashort != (unsigned short)123)
11175                 result |= 4;
11176         exit(result);
11177
11178 }
11179 EOCP
11180 set try
11181 if eval $compile_ok; then
11182         $run ./try
11183         castflags=$?
11184 else
11185         echo "(I can't seem to compile the test program--assuming it can't)"
11186         castflags=7
11187 fi
11188 case "$castflags" in
11189 0)      val="$define"
11190         echo "Yup, it can."
11191         ;;
11192 *)      val="$undef"
11193         echo "Nope, it can't."
11194         ;;
11195 esac
11196 set d_castneg
11197 eval $setvar
11198 $rm_try
11199
11200 : see if vprintf exists
11201 echo " "
11202 if set vprintf val -f d_vprintf; eval $csym; $val; then
11203         echo 'vprintf() found.' >&4
11204         val="$define"
11205         $cat >try.c <<EOF
11206 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11207 #$i_varargs I_VARARGS
11208
11209 #$i_stdlib I_STDLIB
11210 #$i_unistd I_UNISTD
11211
11212 #ifdef I_STDARG
11213 #  include <stdarg.h>
11214 #else /* I_VARARGS */
11215 #  include <varargs.h>
11216 #endif
11217
11218 #ifdef I_UNISTD
11219 #  include <unistd.h>
11220 #endif
11221
11222 #ifdef I_STDLIB
11223 #  include <stdlib.h>
11224 #endif
11225
11226 #include <stdio.h> /* vsprintf prototype */
11227
11228 #ifdef I_STDARG
11229 void xxx(int n, ...)
11230 {
11231     va_list args;
11232     char buf[10];
11233     va_start(args, n);
11234     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11235 }
11236 int main() { xxx(1, "foo"); }
11237
11238 #else /* I_VARARGS */
11239
11240 xxx(va_alist)
11241 va_dcl
11242 {
11243     va_list args;
11244     char buf[10];
11245     va_start(args);
11246     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11247 }
11248 int main() { xxx("foo"); }
11249
11250 #endif
11251
11252 EOF
11253         set try
11254         if eval $compile_ok; then
11255                 if $run ./try; then
11256                         echo "Your vsprintf() returns (int)." >&4
11257                         val2="$undef"
11258                 else
11259                         echo "Your vsprintf() returns (char*)." >&4
11260                         val2="$define"
11261                 fi
11262         else
11263                 echo 'I am unable to compile the vsprintf() test program.' >&4
11264                 # We shouldn't get here.  If we do, assume the standard signature,
11265                 # not the old BSD one.
11266                 echo 'Guessing that vsprintf() returns (int).' >&4
11267                 val2="$undef"
11268         fi
11269 else
11270         echo 'vprintf() NOT found.' >&4
11271         val="$undef"
11272         val2="$undef"
11273 fi
11274 $rm_try
11275 set d_vprintf
11276 eval $setvar
11277 val=$val2
11278 set d_charvspr
11279 eval $setvar
11280
11281 : see if chown exists
11282 set chown d_chown
11283 eval $inlibc
11284
11285 : see if chroot exists
11286 set chroot d_chroot
11287 eval $inlibc
11288
11289 : see if chsize exists
11290 set chsize d_chsize
11291 eval $inlibc
11292
11293 : see if class exists
11294 set class d_class
11295 eval $inlibc
11296
11297 : see if clearenv exists
11298 set clearenv d_clearenv
11299 eval $inlibc
11300
11301 : Define hasstruct macro for Configure internal use
11302 hasstruct='varname=$1; struct=$2; shift; shift;
11303 while $test $# -ge 2; do
11304         case "$1" in
11305         $define) echo "#include <$2>";;
11306         esac ;
11307     shift 2;
11308 done > try.c;
11309 echo "int main () { struct $struct foo; }" >> try.c;
11310 set try;
11311 if eval $compile; then
11312         val="$define";
11313 else
11314         val="$undef";
11315 fi;
11316 set $varname;
11317 eval $setvar;
11318 $rm_try'
11319
11320 : see whether socket exists
11321 socketlib=''
11322 sockethdr=''
11323 echo " "
11324 $echo $n "Hmm... $c" >&4
11325 if set socket val -f d_socket; eval $csym; $val; then
11326         echo "Looks like you have Berkeley networking support." >&4
11327         d_socket="$define"
11328         if set setsockopt val -f; eval $csym; $val; then
11329                 d_oldsock="$undef"
11330         else
11331                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11332                 d_oldsock="$define"
11333         fi
11334 else
11335         if $contains socklib libc.list >/dev/null 2>&1; then
11336                 echo "Looks like you have Berkeley networking support." >&4
11337                 d_socket="$define"
11338                 : we will have to assume that it supports the 4.2 BSD interface
11339                 d_oldsock="$undef"
11340         else
11341                 echo "You don't have Berkeley networking in libc$_a..." >&4
11342                 if test "X$d_socket" = "X$define"; then
11343                    echo "...but you seem to believe that you have sockets." >&4
11344                 else
11345                         for net in net socket
11346                         do
11347                                 if test -f /usr/lib/lib$net$_a; then
11348                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11349                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11350                                         if $contains socket libc.list >/dev/null 2>&1; then
11351                                                 d_socket="$define"
11352                                                 socketlib="-l$net"
11353                                                 case "$net" in
11354                                                 net)
11355                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11356                                                         sockethdr="-I/usr/netinclude"
11357                                                         ;;
11358                                                 esac
11359                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11360                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11361                                                         d_oldsock="$undef"
11362                                                 else
11363                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11364                                                         d_oldsock="$define"
11365                                                 fi
11366                                                 break
11367                                         fi
11368                                 fi
11369                         done
11370                         if test "X$d_socket" != "X$define"; then
11371                            echo "or anywhere else I see." >&4
11372                            d_socket="$undef"
11373                            d_oldsock="$undef"
11374                         fi
11375                 fi
11376         fi
11377 fi
11378
11379 : see if socketpair exists
11380 set socketpair d_sockpair
11381 eval $inlibc
11382
11383
11384 echo " "
11385 echo "Checking the availability sa_len in the sock struct ..." >&4
11386 $cat >try.c <<EOF
11387 #include <sys/types.h>
11388 #include <sys/socket.h>
11389 int main() {
11390 struct sockaddr sa;
11391 return (sa.sa_len);
11392 }
11393 EOF
11394 val="$undef"
11395 set try; if eval $compile; then
11396         val="$define"
11397 fi
11398 set d_sockaddr_sa_len; eval $setvar
11399 $rm_try
11400
11401 echo " "
11402 echo "Checking the availability struct sockaddr_in6 ..." >&4
11403 $cat >try.c <<EOF
11404 #include <sys/types.h>
11405 #include <sys/socket.h>
11406 #include <netinet/in.h>
11407 int main() {
11408 struct sockaddr_in6 sin6;
11409 return (sin6.sin6_family);
11410 }
11411 EOF
11412 val="$undef"
11413 set try; if eval $compile; then
11414         val="$define"
11415 fi
11416 set d_sockaddr_in6; eval $setvar
11417 $rm_try
11418
11419 echo " "
11420 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11421 $cat >try.c <<EOF
11422 #include <sys/types.h>
11423 #include <sys/socket.h>
11424 #include <netinet/in.h>
11425 int main() {
11426 struct sockaddr_in6 sin6;
11427 return (sin6.sin6_scope_id);
11428 }
11429 EOF
11430 val="$undef"
11431 set try; if eval $compile; then
11432         val="$define"
11433 fi
11434 set d_sin6_scope_id; eval $setvar
11435 $rm_try
11436
11437 echo " "
11438 echo "Checking the availability struct ip_mreq ..." >&4
11439 $cat >try.c <<EOF
11440 #include <sys/types.h>
11441 #include <sys/socket.h>
11442 #include <netinet/in.h>
11443 int main() {
11444 struct ip_mreq mreq;
11445 return (mreq.imr_multiaddr.s_addr);
11446 }
11447 EOF
11448 val="$undef"
11449 set try; if eval $compile; then
11450        val="$define"
11451 fi
11452 set d_ip_mreq; eval $setvar
11453 $rm_try
11454
11455 echo " "
11456 echo "Checking the availability struct ip_mreq_source ..." >&4
11457 $cat >try.c <<EOF
11458 #include <sys/types.h>
11459 #include <sys/socket.h>
11460 #include <netinet/in.h>
11461 int main() {
11462 struct ip_mreq_source mreq;
11463 return (mreq.imr_multiaddr.s_addr);
11464 }
11465 EOF
11466 val="$undef"
11467 set try; if eval $compile; then
11468        val="$define"
11469 fi
11470 set d_ip_mreq_source; eval $setvar
11471 $rm_try
11472
11473 echo " "
11474 echo "Checking the availability struct ipv6_mreq ..." >&4
11475 $cat >try.c <<EOF
11476 #include <sys/types.h>
11477 #include <sys/socket.h>
11478 #include <netinet/in.h>
11479 int main() {
11480 struct ipv6_mreq mreq;
11481 return (mreq.ipv6mr_interface);
11482 }
11483 EOF
11484 val="$undef"
11485 set try; if eval $compile; then
11486         val="$define"
11487 fi
11488 set d_ipv6_mreq; eval $setvar
11489 $rm_try
11490
11491 echo " "
11492 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11493 $cat >try.c <<EOF
11494 #include <sys/types.h>
11495 #include <sys/socket.h>
11496 #include <netinet/in.h>
11497 int main() {
11498 struct ipv6_mreq_source mreq;
11499 return (mreq.imr_multiaddr.s_addr);
11500 }
11501 EOF
11502 val="$undef"
11503 set try; if eval $compile; then
11504        val="$define"
11505 fi
11506 set d_ipv6_mreq_source; eval $setvar
11507 $rm_try
11508
11509 echo " "
11510 echo "Checking the availability of certain socket constants..." >&4
11511 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11512         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11513         $cat >try.c <<EOF
11514 #include <sys/types.h>
11515 #include <sys/socket.h>
11516 int main() {
11517     int i = $ENUM;
11518 }
11519 EOF
11520         val="$undef"
11521         set try; if eval $compile; then
11522                 val="$define"
11523         fi
11524         set d_${enum}; eval $setvar
11525         $rm_try
11526 done
11527
11528 : see if this is a sys/uio.h system
11529 set sys/uio.h i_sysuio
11530 eval $inhdr
11531
11532 : Check for cmsghdr support
11533 echo " "
11534 echo "Checking to see if your system supports struct cmsghdr..." >&4
11535 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11536 eval $hasstruct
11537 case "$d_cmsghdr_s" in
11538 "$define")      echo "Yes, it does."   ;;
11539 *)              echo "No, it doesn't." ;;
11540 esac
11541
11542
11543 : check for const keyword
11544 echo " "
11545 echo 'Checking to see if your C compiler knows about "const"...' >&4
11546 $cat >const.c <<'EOCP'
11547 typedef struct spug { int drokk; } spug;
11548 int main()
11549 {
11550         const char *foo;
11551         const spug y = { 0 };
11552 }
11553 EOCP
11554 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11555         val="$define"
11556         echo "Yup, it does."
11557 else
11558         val="$undef"
11559         echo "Nope, it doesn't."
11560 fi
11561 set d_const
11562 eval $setvar
11563
11564 : see if copysignl exists
11565 set copysignl d_copysignl
11566 eval $inlibc
11567
11568 : see if crypt exists
11569 echo " "
11570 set crypt d_crypt
11571 eval $inlibc
11572 case "$d_crypt" in
11573 $define) cryptlib='' ;;
11574 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11575                 echo 'crypt() found.' >&4
11576                 val="$define"
11577                 cryptlib=''
11578         else
11579                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11580                 if $test -z "$cryptlib"; then
11581                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11582                 else
11583                         cryptlib=-lcrypt
11584                 fi
11585                 if $test -z "$cryptlib"; then
11586                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11587                 else
11588                         cryptlib=-lcrypt
11589                 fi
11590                 if $test -z "$cryptlib"; then
11591                         cryptlib=`./loc libcrypt$_a "" $libpth`
11592                 else
11593                         cryptlib=-lcrypt
11594                 fi
11595                 if $test -z "$cryptlib"; then
11596                         echo 'crypt() NOT found.' >&4
11597                         val="$undef"
11598                 else
11599                         val="$define"
11600                 fi
11601         fi
11602         set d_crypt
11603         eval $setvar
11604         ;;
11605 esac
11606
11607 : see if this is a crypt.h system
11608 set crypt.h i_crypt
11609 eval $inhdr
11610
11611 : see if crypt_r exists
11612 set crypt_r d_crypt_r
11613 eval $inlibc
11614 case "$d_crypt_r" in
11615 "$define")
11616         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11617         case "$d_crypt_r_proto:$usethreads" in
11618         ":define")      d_crypt_r_proto=define
11619                 set d_crypt_r_proto crypt_r $hdrs
11620                 eval $hasproto ;;
11621         *)      ;;
11622         esac
11623         case "$d_crypt_r_proto" in
11624         define)
11625         case "$crypt_r_proto" in
11626         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11627         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11628         esac
11629         case "$crypt_r_proto" in
11630         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11631         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11632         esac
11633         case "$crypt_r_proto" in
11634         ''|0)   d_crypt_r=undef
11635                 crypt_r_proto=0
11636                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11637         * )     case "$crypt_r_proto" in
11638                 REENTRANT_PROTO*) ;;
11639                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11640                 esac
11641                 echo "Prototype: $try" ;;
11642         esac
11643         ;;
11644         *)      case "$usethreads" in
11645                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11646                 esac
11647                 d_crypt_r=undef
11648                 crypt_r_proto=0
11649                 ;;
11650         esac
11651         ;;
11652 *)      crypt_r_proto=0
11653         ;;
11654 esac
11655
11656 : get csh whereabouts
11657 case "$csh" in
11658 'csh') val="$undef" ;;
11659 *) val="$define" ;;
11660 esac
11661 set d_csh
11662 eval $setvar
11663 : Respect a hint or command line value for full_csh.
11664 case "$full_csh" in
11665 '') full_csh=$csh ;;
11666 esac
11667
11668 : see if ctermid exists
11669 set ctermid d_ctermid
11670 eval $inlibc
11671
11672 : see if ctermid_r exists
11673 set ctermid_r d_ctermid_r
11674 eval $inlibc
11675 case "$d_ctermid_r" in
11676 "$define")
11677         hdrs="$i_systypes sys/types.h define stdio.h "
11678         case "$d_ctermid_r_proto:$usethreads" in
11679         ":define")      d_ctermid_r_proto=define
11680                 set d_ctermid_r_proto ctermid_r $hdrs
11681                 eval $hasproto ;;
11682         *)      ;;
11683         esac
11684         case "$d_ctermid_r_proto" in
11685         define)
11686         case "$ctermid_r_proto" in
11687         ''|0) try='char* ctermid_r(char*);'
11688         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11689         esac
11690         case "$ctermid_r_proto" in
11691         ''|0)   d_ctermid_r=undef
11692                 ctermid_r_proto=0
11693                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11694         * )     case "$ctermid_r_proto" in
11695                 REENTRANT_PROTO*) ;;
11696                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11697                 esac
11698                 echo "Prototype: $try" ;;
11699         esac
11700         ;;
11701         *)      case "$usethreads" in
11702                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11703                 esac
11704                 d_ctermid_r=undef
11705                 ctermid_r_proto=0
11706                 ;;
11707         esac
11708         ;;
11709 *)      ctermid_r_proto=0
11710         ;;
11711 esac
11712
11713 : see if ctime_r exists
11714 set ctime_r d_ctime_r
11715 eval $inlibc
11716 case "$d_ctime_r" in
11717 "$define")
11718         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11719         case "$d_ctime_r_proto:$usethreads" in
11720         ":define")      d_ctime_r_proto=define
11721                 set d_ctime_r_proto ctime_r $hdrs
11722                 eval $hasproto ;;
11723         *)      ;;
11724         esac
11725         case "$d_ctime_r_proto" in
11726         define)
11727         case "$ctime_r_proto" in
11728         ''|0) try='char* ctime_r(const time_t*, char*);'
11729         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11730         esac
11731         case "$ctime_r_proto" in
11732         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11733         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11734         esac
11735         case "$ctime_r_proto" in
11736         ''|0) try='int ctime_r(const time_t*, char*);'
11737         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11738         esac
11739         case "$ctime_r_proto" in
11740         ''|0) try='int ctime_r(const time_t*, char*, int);'
11741         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11742         esac
11743         case "$ctime_r_proto" in
11744         ''|0)   d_ctime_r=undef
11745                 ctime_r_proto=0
11746                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11747         * )     case "$ctime_r_proto" in
11748                 REENTRANT_PROTO*) ;;
11749                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11750                 esac
11751                 echo "Prototype: $try" ;;
11752         esac
11753         ;;
11754         *)      case "$usethreads" in
11755                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11756                 esac
11757                 d_ctime_r=undef
11758                 ctime_r_proto=0
11759                 ;;
11760         esac
11761         ;;
11762 *)      ctime_r_proto=0
11763         ;;
11764 esac
11765
11766 : see if cuserid exists
11767 set cuserid d_cuserid
11768 eval $inlibc
11769
11770 : see if this is a limits.h system
11771 set limits.h i_limits
11772 eval $inhdr
11773
11774 : see if this is a float.h system
11775 set float.h i_float
11776 eval $inhdr
11777
11778 : See if number of significant digits in a double precision number is known
11779 echo " "
11780 $cat >dbl_dig.c <<EOM
11781 #$i_limits I_LIMITS
11782 #$i_float I_FLOAT
11783 #ifdef I_LIMITS
11784 #include <limits.h>
11785 #endif
11786 #ifdef I_FLOAT
11787 #include <float.h>
11788 #endif
11789 #ifdef DBL_DIG
11790 printf("Contains DBL_DIG");
11791 #endif
11792 EOM
11793 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11794 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11795         echo "DBL_DIG found." >&4
11796         val="$define"
11797 else
11798         echo "DBL_DIG NOT found." >&4
11799         val="$undef"
11800 fi
11801 $rm -f dbl_dig.?
11802 set d_dbl_dig
11803 eval $setvar
11804
11805 : see if dbm.h is available
11806 : see if dbmclose exists
11807 set dbmclose d_dbmclose
11808 eval $inlibc
11809
11810 case "$d_dbmclose" in
11811 $define)
11812         set dbm.h i_dbm
11813         eval $inhdr
11814         case "$i_dbm" in
11815         $define)
11816                 val="$undef"
11817                 set i_rpcsvcdbm
11818                 eval $setvar
11819                 ;;
11820         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11821                 eval $inhdr
11822                 ;;
11823         esac
11824         ;;
11825 *)      echo "We won't be including <dbm.h>"
11826         val="$undef"
11827         set i_dbm
11828         eval $setvar
11829         val="$undef"
11830         set i_rpcsvcdbm
11831         eval $setvar
11832         ;;
11833 esac
11834
11835 : see if prototype for dbminit is available
11836 echo " "
11837 set d_dbminitproto dbminit $i_dbm dbm.h
11838 eval $hasproto
11839
11840 : see if difftime exists
11841 set difftime d_difftime
11842 eval $inlibc
11843
11844 : see if this is a dirent system
11845 echo " "
11846 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11847         val="$define"
11848         echo "<dirent.h> found." >&4
11849 else
11850         val="$undef"
11851         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11852                 echo "<sys/dir.h> found." >&4
11853                 echo " "
11854         else
11855                 xinc=`./findhdr sys/ndir.h`
11856         fi
11857         echo "<dirent.h> NOT found." >&4
11858 fi
11859 set i_dirent
11860 eval $setvar
11861
11862 : Look for type of directory structure.
11863 echo " "
11864 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11865
11866 case "$direntrytype" in
11867 ''|' ')
11868         case "$i_dirent" in
11869         $define) guess1='struct dirent' ;;
11870         *) guess1='struct direct'  ;;
11871         esac
11872         ;;
11873 *)      guess1="$direntrytype"
11874         ;;
11875 esac
11876
11877 case "$guess1" in
11878 'struct dirent') guess2='struct direct' ;;
11879 *) guess2='struct dirent' ;;
11880 esac
11881
11882 if $contains "$guess1" try.c >/dev/null 2>&1; then
11883         direntrytype="$guess1"
11884         echo "Your directory entries are $direntrytype." >&4
11885 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11886         direntrytype="$guess2"
11887         echo "Your directory entries seem to be $direntrytype." >&4
11888 else
11889         echo "I don't recognize your system's directory entries." >&4
11890         rp="What type is used for directory entries on this system?"
11891         dflt="$guess1"
11892         . ./myread
11893         direntrytype="$ans"
11894 fi
11895 $rm_try
11896
11897 : see if the directory entry stores field length
11898 echo " "
11899 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11900 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11901         echo "Good, your directory entry keeps length information in d_namlen." >&4
11902         val="$define"
11903 else
11904         echo "Your directory entry does not know about the d_namlen field." >&4
11905         val="$undef"
11906 fi
11907 set d_dirnamlen
11908 eval $setvar
11909 $rm_try
11910
11911 : Look for DIR.dd_fd
11912 case "$i_dirent" in
11913 "$define")
11914     echo "Checking to see if DIR has a dd_fd member variable" >&4
11915     $cat >try.c <<EOCP
11916 #$i_stdlib I_STDLIB
11917 #ifdef I_STDLIB
11918 #include <stdlib.h>
11919 #endif
11920 #include <dirent.h>
11921
11922 int main() {
11923     DIR dir;
11924     dir.dd_fd = 1;
11925     return 0;
11926 }
11927 EOCP
11928     val=$undef
11929     set try
11930     if eval $compile; then
11931         echo "Yes, it does."
11932         val="$define"
11933     else
11934         echo "No, it does not."
11935         val="$undef"
11936     fi
11937     ;;
11938 *)
11939     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11940     val="$undef"
11941     ;;
11942 esac
11943 set d_dir_dd_fd
11944 eval $setvar
11945 $rm_try
11946
11947 : see if this is an sysdir system
11948 set sys/dir.h i_sysdir
11949 eval $inhdr
11950
11951 : see if this is an sysndir system
11952 set sys/ndir.h i_sysndir
11953 eval $inhdr
11954
11955 : Look for dirfd
11956 echo " "
11957 $cat >dirfd.c <<EOM
11958 #include <stdio.h>
11959 #$i_stdlib I_STDLIB
11960 #ifdef I_STDLIB
11961 #include <stdlib.h>
11962 #endif
11963 #$i_dirent I_DIRENT             /**/
11964 #$i_sysdir I_SYS_DIR            /**/
11965 #$i_sysndir I_SYS_NDIR          /**/
11966 #$i_systypes I_SYS_TYPES        /**/
11967 #if defined(I_SYS_TYPES)
11968 #include <sys/types.h>
11969 #endif
11970 #if defined(I_DIRENT)
11971 #include <dirent.h>
11972 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11973 #include <sys/dir.h>
11974 #endif
11975 #else
11976 #ifdef I_SYS_NDIR
11977 #include <sys/ndir.h>
11978 #else
11979 #ifdef I_SYS_DIR
11980 #ifdef hp9000s500
11981 #include <ndir.h>       /* may be wrong in the future */
11982 #else
11983 #include <sys/dir.h>
11984 #endif
11985 #endif
11986 #endif
11987 #endif
11988 int main() {
11989         DIR *dirp = opendir(".");
11990         if (dirfd(dirp) >= 0)
11991                 exit(0);
11992         else
11993                 exit(1);
11994 }
11995 EOM
11996 val=$undef
11997 set dirfd
11998 if eval $compile; then
11999         val="$define"
12000 fi
12001 case "$val" in
12002 $define)        echo "dirfd() found." >&4       ;;
12003 *)              echo "dirfd() NOT found." >&4   ;;
12004 esac
12005 set d_dirfd
12006 eval $setvar
12007 $rm -f dirfd*
12008
12009 : see if dlerror exists
12010 xxx_runnm="$runnm"
12011 runnm=false
12012 set dlerror d_dlerror
12013 eval $inlibc
12014 runnm="$xxx_runnm"
12015
12016 : see if dlfcn is available
12017 set dlfcn.h i_dlfcn
12018 eval $inhdr
12019
12020 : Check what extension to use for shared libs
12021 case "$usedl" in
12022 $define|y|true)
12023         $cat << EOM
12024
12025 On a few systems, the dynamically loaded modules that perl generates and uses
12026 will need a different extension than shared libs. The default will probably
12027 be appropriate.
12028
12029 EOM
12030         case "$dlext" in
12031         '')     dflt="$so" ;;
12032         *)      dflt="$dlext" ;;
12033         esac
12034         rp='What is the extension of dynamically loaded modules'
12035         . ./myread
12036         dlext="$ans"
12037         ;;
12038 *)
12039         dlext="none"
12040         ;;
12041 esac
12042
12043 : Check if dlsym need a leading underscore
12044 echo " "
12045 val="$undef"
12046
12047 case "$dlsrc" in
12048 dl_dlopen.xs)
12049         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12050         $cat >dyna.c <<'EOM'
12051 fred () { }
12052 EOM
12053
12054 $cat >fred.c<<EOM
12055
12056 #include <stdio.h>
12057 #$i_stdlib I_STDLIB
12058 #ifdef I_STDLIB
12059 #include <stdlib.h>
12060 #endif
12061 #$i_dlfcn I_DLFCN
12062 #ifdef I_DLFCN
12063 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12064 #else
12065 #include <sys/types.h>
12066 #include <nlist.h>
12067 #include <link.h>
12068 #endif
12069
12070 extern int fred() ;
12071
12072 int main()
12073 {
12074     void * handle ;
12075     void * symbol ;
12076 #ifndef RTLD_LAZY
12077     int mode = 1 ;
12078 #else
12079     int mode = RTLD_LAZY ;
12080 #endif
12081     handle = dlopen("./dyna.$dlext", mode) ;
12082     if (handle == NULL) {
12083         printf ("1\n") ;
12084         fflush (stdout) ;
12085         exit(0);
12086     }
12087     symbol = dlsym(handle, "fred") ;
12088     if (symbol == NULL) {
12089         /* try putting a leading underscore */
12090         symbol = dlsym(handle, "_fred") ;
12091         if (symbol == NULL) {
12092             printf ("2\n") ;
12093             fflush (stdout) ;
12094             exit(0);
12095         }
12096         printf ("3\n") ;
12097     }
12098     else
12099         printf ("4\n") ;
12100     fflush (stdout) ;
12101     exit(0);
12102 }
12103 EOM
12104         : Call the object file tmp-dyna.o in case dlext=o.
12105         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12106                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12107                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12108                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12109                 xxx=`$run ./fred`
12110                 case $xxx in
12111                 1)      echo "Test program failed using dlopen." >&4
12112                         echo "Perhaps you should not use dynamic loading." >&4;;
12113                 2)      echo "Test program failed using dlsym." >&4
12114                         echo "Perhaps you should not use dynamic loading." >&4;;
12115                 3)      echo "dlsym needs a leading underscore" >&4
12116                         val="$define" ;;
12117                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12118                 esac
12119         else
12120                 echo "I can't compile and run the test program." >&4
12121                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12122         fi
12123         ;;
12124 esac
12125
12126 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12127
12128 set d_dlsymun
12129 eval $setvar
12130
12131 : see if drand48_r exists
12132 set drand48_r d_drand48_r
12133 eval $inlibc
12134 case "$d_drand48_r" in
12135 "$define")
12136         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12137         case "$d_drand48_r_proto:$usethreads" in
12138         ":define")      d_drand48_r_proto=define
12139                 set d_drand48_r_proto drand48_r $hdrs
12140                 eval $hasproto ;;
12141         *)      ;;
12142         esac
12143         case "$d_drand48_r_proto" in
12144         define)
12145         case "$drand48_r_proto" in
12146         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12147         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12148         esac
12149         case "$drand48_r_proto" in
12150         ''|0)   d_drand48_r=undef
12151                 drand48_r_proto=0
12152                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12153         * )     case "$drand48_r_proto" in
12154                 REENTRANT_PROTO*) ;;
12155                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12156                 esac
12157                 echo "Prototype: $try" ;;
12158         esac
12159         ;;
12160         *)      case "$usethreads" in
12161                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12162                 esac
12163                 d_drand48_r=undef
12164                 drand48_r_proto=0
12165                 ;;
12166         esac
12167         ;;
12168 *)      drand48_r_proto=0
12169         ;;
12170 esac
12171
12172 : see if prototype for drand48 is available
12173 echo " "
12174 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12175 eval $hasproto
12176
12177 : see if dup2 exists
12178 set dup2 d_dup2
12179 eval $inlibc
12180
12181 : see if eaccess exists
12182 set eaccess d_eaccess
12183 eval $inlibc
12184
12185 : see if endgrent exists
12186 set endgrent d_endgrent
12187 eval $inlibc
12188
12189 : see if this is an grp system
12190 set grp.h i_grp
12191 eval $inhdr
12192
12193 case "$i_grp" in
12194 $define)
12195         xxx=`./findhdr grp.h`
12196         $cppstdin $cppflags $cppminus < $xxx >$$.h
12197
12198         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12199                 val="$define"
12200         else
12201                 val="$undef"
12202         fi
12203         set d_grpasswd
12204         eval $setvar
12205
12206         $rm -f $$.h
12207         ;;
12208 *)
12209         val="$undef";
12210         set d_grpasswd; eval $setvar
12211         ;;
12212 esac
12213
12214 : see if endgrent_r exists
12215 set endgrent_r d_endgrent_r
12216 eval $inlibc
12217 case "$d_endgrent_r" in
12218 "$define")
12219         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12220         case "$d_endgrent_r_proto:$usethreads" in
12221         ":define")      d_endgrent_r_proto=define
12222                 set d_endgrent_r_proto endgrent_r $hdrs
12223                 eval $hasproto ;;
12224         *)      ;;
12225         esac
12226         case "$d_endgrent_r_proto" in
12227         define)
12228         case "$endgrent_r_proto" in
12229         ''|0) try='int endgrent_r(FILE**);'
12230         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12231         esac
12232         case "$endgrent_r_proto" in
12233         ''|0) try='void endgrent_r(FILE**);'
12234         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12235         esac
12236         case "$endgrent_r_proto" in
12237         ''|0)   d_endgrent_r=undef
12238                 endgrent_r_proto=0
12239                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12240         * )     case "$endgrent_r_proto" in
12241                 REENTRANT_PROTO*) ;;
12242                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12243                 esac
12244                 echo "Prototype: $try" ;;
12245         esac
12246         ;;
12247         *)      case "$usethreads" in
12248                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12249                 esac
12250                 d_endgrent_r=undef
12251                 endgrent_r_proto=0
12252                 ;;
12253         esac
12254         ;;
12255 *)      endgrent_r_proto=0
12256         ;;
12257 esac
12258
12259 : see if endhostent exists
12260 set endhostent d_endhent
12261 eval $inlibc
12262
12263 : see if this is a netdb.h system
12264 set netdb.h i_netdb
12265 eval $inhdr
12266
12267 : see if endhostent_r exists
12268 set endhostent_r d_endhostent_r
12269 eval $inlibc
12270 case "$d_endhostent_r" in
12271 "$define")
12272         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12273         case "$d_endhostent_r_proto:$usethreads" in
12274         ":define")      d_endhostent_r_proto=define
12275                 set d_endhostent_r_proto endhostent_r $hdrs
12276                 eval $hasproto ;;
12277         *)      ;;
12278         esac
12279         case "$d_endhostent_r_proto" in
12280         define)
12281         case "$endhostent_r_proto" in
12282         ''|0) try='int endhostent_r(struct hostent_data*);'
12283         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12284         esac
12285         case "$endhostent_r_proto" in
12286         ''|0) try='void endhostent_r(struct hostent_data*);'
12287         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12288         esac
12289         case "$endhostent_r_proto" in
12290         ''|0)   d_endhostent_r=undef
12291                 endhostent_r_proto=0
12292                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12293         * )     case "$endhostent_r_proto" in
12294                 REENTRANT_PROTO*) ;;
12295                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12296                 esac
12297                 echo "Prototype: $try" ;;
12298         esac
12299         ;;
12300         *)      case "$usethreads" in
12301                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12302                 esac
12303                 d_endhostent_r=undef
12304                 endhostent_r_proto=0
12305                 ;;
12306         esac
12307         ;;
12308 *)      endhostent_r_proto=0
12309         ;;
12310 esac
12311
12312 : see if endnetent exists
12313 set endnetent d_endnent
12314 eval $inlibc
12315
12316 : see if endnetent_r exists
12317 set endnetent_r d_endnetent_r
12318 eval $inlibc
12319 case "$d_endnetent_r" in
12320 "$define")
12321         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12322         case "$d_endnetent_r_proto:$usethreads" in
12323         ":define")      d_endnetent_r_proto=define
12324                 set d_endnetent_r_proto endnetent_r $hdrs
12325                 eval $hasproto ;;
12326         *)      ;;
12327         esac
12328         case "$d_endnetent_r_proto" in
12329         define)
12330         case "$endnetent_r_proto" in
12331         ''|0) try='int endnetent_r(struct netent_data*);'
12332         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12333         esac
12334         case "$endnetent_r_proto" in
12335         ''|0) try='void endnetent_r(struct netent_data*);'
12336         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12337         esac
12338         case "$endnetent_r_proto" in
12339         ''|0)   d_endnetent_r=undef
12340                 endnetent_r_proto=0
12341                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12342         * )     case "$endnetent_r_proto" in
12343                 REENTRANT_PROTO*) ;;
12344                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12345                 esac
12346                 echo "Prototype: $try" ;;
12347         esac
12348         ;;
12349         *)      case "$usethreads" in
12350                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12351                 esac
12352                 d_endnetent_r=undef
12353                 endnetent_r_proto=0
12354                 ;;
12355         esac
12356         ;;
12357 *)      endnetent_r_proto=0
12358         ;;
12359 esac
12360
12361 : see if endprotoent exists
12362 set endprotoent d_endpent
12363 eval $inlibc
12364
12365 : see if endprotoent_r exists
12366 set endprotoent_r d_endprotoent_r
12367 eval $inlibc
12368 case "$d_endprotoent_r" in
12369 "$define")
12370         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12371         case "$d_endprotoent_r_proto:$usethreads" in
12372         ":define")      d_endprotoent_r_proto=define
12373                 set d_endprotoent_r_proto endprotoent_r $hdrs
12374                 eval $hasproto ;;
12375         *)      ;;
12376         esac
12377         case "$d_endprotoent_r_proto" in
12378         define)
12379         case "$endprotoent_r_proto" in
12380         ''|0) try='int endprotoent_r(struct protoent_data*);'
12381         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12382         esac
12383         case "$endprotoent_r_proto" in
12384         ''|0) try='void endprotoent_r(struct protoent_data*);'
12385         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12386         esac
12387         case "$endprotoent_r_proto" in
12388         ''|0)   d_endprotoent_r=undef
12389                 endprotoent_r_proto=0
12390                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12391         * )     case "$endprotoent_r_proto" in
12392                 REENTRANT_PROTO*) ;;
12393                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12394                 esac
12395                 echo "Prototype: $try" ;;
12396         esac
12397         ;;
12398         *)      case "$usethreads" in
12399                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12400                 esac
12401                 d_endprotoent_r=undef
12402                 endprotoent_r_proto=0
12403                 ;;
12404         esac
12405         ;;
12406 *)      endprotoent_r_proto=0
12407         ;;
12408 esac
12409
12410 : see if endpwent exists
12411 set endpwent d_endpwent
12412 eval $inlibc
12413
12414 : see if this is a pwd.h system
12415 set pwd.h i_pwd
12416 eval $inhdr
12417
12418 case "$i_pwd" in
12419 $define)
12420         xxx=`./findhdr pwd.h`
12421         $cppstdin $cppflags $cppminus < $xxx >$$.h
12422
12423         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12424                 val="$define"
12425         else
12426                 val="$undef"
12427         fi
12428         set d_pwquota
12429         eval $setvar
12430
12431         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12432                 val="$define"
12433         else
12434                 val="$undef"
12435         fi
12436         set d_pwage
12437         eval $setvar
12438
12439         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12440                 val="$define"
12441         else
12442                 val="$undef"
12443         fi
12444         set d_pwchange
12445         eval $setvar
12446
12447         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12448                 val="$define"
12449         else
12450                 val="$undef"
12451         fi
12452         set d_pwclass
12453         eval $setvar
12454
12455         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12456                 val="$define"
12457         else
12458                 val="$undef"
12459         fi
12460         set d_pwexpire
12461         eval $setvar
12462
12463         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12464                 val="$define"
12465         else
12466                 val="$undef"
12467         fi
12468         set d_pwcomment
12469         eval $setvar
12470
12471         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12472                 val="$define"
12473         else
12474                 val="$undef"
12475         fi
12476         set d_pwgecos
12477         eval $setvar
12478
12479         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12480                 val="$define"
12481         else
12482                 val="$undef"
12483         fi
12484         set d_pwpasswd
12485         eval $setvar
12486
12487         $rm -f $$.h
12488         ;;
12489 *)
12490         val="$undef";
12491         set d_pwquota; eval $setvar
12492         set d_pwage; eval $setvar
12493         set d_pwchange; eval $setvar
12494         set d_pwclass; eval $setvar
12495         set d_pwexpire; eval $setvar
12496         set d_pwcomment; eval $setvar
12497         set d_pwgecos; eval $setvar
12498         set d_pwpasswd; eval $setvar
12499         ;;
12500 esac
12501
12502 : see if endpwent_r exists
12503 set endpwent_r d_endpwent_r
12504 eval $inlibc
12505 case "$d_endpwent_r" in
12506 "$define")
12507         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12508         case "$d_endpwent_r_proto:$usethreads" in
12509         ":define")      d_endpwent_r_proto=define
12510                 set d_endpwent_r_proto endpwent_r $hdrs
12511                 eval $hasproto ;;
12512         *)      ;;
12513         esac
12514         case "$d_endpwent_r_proto" in
12515         define)
12516         case "$endpwent_r_proto" in
12517         ''|0) try='int endpwent_r(FILE**);'
12518         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12519         esac
12520         case "$endpwent_r_proto" in
12521         ''|0) try='void endpwent_r(FILE**);'
12522         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12523         esac
12524         case "$endpwent_r_proto" in
12525         ''|0)   d_endpwent_r=undef
12526                 endpwent_r_proto=0
12527                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12528         * )     case "$endpwent_r_proto" in
12529                 REENTRANT_PROTO*) ;;
12530                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12531                 esac
12532                 echo "Prototype: $try" ;;
12533         esac
12534         ;;
12535         *)      case "$usethreads" in
12536                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12537                 esac
12538                 d_endpwent_r=undef
12539                 endpwent_r_proto=0
12540                 ;;
12541         esac
12542         ;;
12543 *)      endpwent_r_proto=0
12544         ;;
12545 esac
12546
12547 : see if endservent exists
12548 set endservent d_endsent
12549 eval $inlibc
12550
12551 : see if endservent_r exists
12552 set endservent_r d_endservent_r
12553 eval $inlibc
12554 case "$d_endservent_r" in
12555 "$define")
12556         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12557         case "$d_endservent_r_proto:$usethreads" in
12558         ":define")      d_endservent_r_proto=define
12559                 set d_endservent_r_proto endservent_r $hdrs
12560                 eval $hasproto ;;
12561         *)      ;;
12562         esac
12563         case "$d_endservent_r_proto" in
12564         define)
12565         case "$endservent_r_proto" in
12566         ''|0) try='int endservent_r(struct servent_data*);'
12567         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12568         esac
12569         case "$endservent_r_proto" in
12570         ''|0) try='void endservent_r(struct servent_data*);'
12571         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12572         esac
12573         case "$endservent_r_proto" in
12574         ''|0)   d_endservent_r=undef
12575                 endservent_r_proto=0
12576                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12577         * )     case "$endservent_r_proto" in
12578                 REENTRANT_PROTO*) ;;
12579                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12580                 esac
12581                 echo "Prototype: $try" ;;
12582         esac
12583         ;;
12584         *)      case "$usethreads" in
12585                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12586                 esac
12587                 d_endservent_r=undef
12588                 endservent_r_proto=0
12589                 ;;
12590         esac
12591         ;;
12592 *)      endservent_r_proto=0
12593         ;;
12594 esac
12595
12596 : Locate the flags for 'open()'
12597 echo " "
12598 $cat >try.c <<EOCP
12599 #include <sys/types.h>
12600 #ifdef I_FCNTL
12601 #include <fcntl.h>
12602 #endif
12603 #ifdef I_SYS_FILE
12604 #include <sys/file.h>
12605 #endif
12606 #$i_stdlib I_STDLIB
12607 #ifdef I_STDLIB
12608 #include <stdlib.h>
12609 #endif
12610 int main() {
12611         if(O_RDONLY);
12612 #ifdef O_TRUNC
12613         exit(0);
12614 #else
12615         exit(1);
12616 #endif
12617 }
12618 EOCP
12619 : check sys/file.h first to get FREAD on Sun
12620 if $test `./findhdr sys/file.h` && \
12621                 set try -DI_SYS_FILE && eval $compile; then
12622         h_sysfile=true;
12623         echo "<sys/file.h> defines the O_* constants..." >&4
12624         if $run ./try; then
12625                 echo "and you have the 3 argument form of open()." >&4
12626                 val="$define"
12627         else
12628                 echo "but not the 3 argument form of open().  Oh, well." >&4
12629                 val="$undef"
12630         fi
12631 elif $test `./findhdr fcntl.h` && \
12632                 set try -DI_FCNTL && eval $compile; then
12633         h_fcntl=true;
12634         echo "<fcntl.h> defines the O_* constants..." >&4
12635         if $run ./try; then
12636                 echo "and you have the 3 argument form of open()." >&4
12637                 val="$define"
12638         else
12639                 echo "but not the 3 argument form of open().  Oh, well." >&4
12640                 val="$undef"
12641         fi
12642 else
12643         val="$undef"
12644         echo "I can't find the O_* constant definitions!  You got problems." >&4
12645 fi
12646 set d_open3
12647 eval $setvar
12648 $rm_try
12649
12650 : see if this is a sys/file.h system
12651 val=''
12652 set sys/file.h val
12653 eval $inhdr
12654
12655 : do we need to include sys/file.h ?
12656 case "$val" in
12657 "$define")
12658         echo " "
12659         if $h_sysfile; then
12660                 val="$define"
12661                 echo "We'll be including <sys/file.h>." >&4
12662         else
12663                 val="$undef"
12664                 echo "We won't be including <sys/file.h>." >&4
12665         fi
12666         ;;
12667 *)
12668         h_sysfile=false
12669         ;;
12670 esac
12671 set i_sysfile
12672 eval $setvar
12673
12674 : see if fcntl.h is there
12675 val=''
12676 set fcntl.h val
12677 eval $inhdr
12678
12679 : see if we can include fcntl.h
12680 case "$val" in
12681 "$define")
12682         echo " "
12683         if $h_fcntl; then
12684                 val="$define"
12685                 echo "We'll be including <fcntl.h>." >&4
12686         else
12687                 val="$undef"
12688                 if $h_sysfile; then
12689         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12690                 else
12691                         echo "We won't be including <fcntl.h>." >&4
12692                 fi
12693         fi
12694         ;;
12695 *)
12696         h_fcntl=false
12697         val="$undef"
12698         ;;
12699 esac
12700 set i_fcntl
12701 eval $setvar
12702
12703 : see if fork exists
12704 set fork d_fork
12705 eval $inlibc
12706
12707 : see if pipe exists
12708 set pipe d_pipe
12709 eval $inlibc
12710
12711 : check for non-blocking I/O stuff
12712 case "$h_sysfile" in
12713 true) echo "#include <sys/file.h>" > head.c;;
12714 *)
12715        case "$h_fcntl" in
12716        true) echo "#include <fcntl.h>" > head.c;;
12717        *) echo "#include <sys/fcntl.h>" > head.c;;
12718        esac
12719        ;;
12720 esac
12721 echo " "
12722 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12723 case "$o_nonblock" in
12724 '')
12725         $cat head.c > try.c
12726         $cat >>try.c <<EOCP
12727 #include <stdio.h>
12728 #$i_stdlib I_STDLIB
12729 #ifdef I_STDLIB
12730 #include <stdlib.h>
12731 #endif
12732 #$i_fcntl I_FCNTL
12733 #ifdef I_FCNTL
12734 #include <fcntl.h>
12735 #endif
12736 int main() {
12737 #ifdef O_NONBLOCK
12738         printf("O_NONBLOCK\n");
12739         exit(0);
12740 #endif
12741 #ifdef O_NDELAY
12742         printf("O_NDELAY\n");
12743         exit(0);
12744 #endif
12745 #ifdef FNDELAY
12746         printf("FNDELAY\n");
12747         exit(0);
12748 #endif
12749         exit(0);
12750 }
12751 EOCP
12752         set try
12753         if eval $compile_ok; then
12754                 o_nonblock=`$run ./try`
12755                 case "$o_nonblock" in
12756                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12757                 *) echo "Seems like we can use $o_nonblock.";;
12758                 esac
12759         else
12760                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12761         fi
12762         ;;
12763 *) echo "Using $hint value $o_nonblock.";;
12764 esac
12765 $rm_try
12766
12767 echo " "
12768 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12769 case "$eagain" in
12770 '')
12771         case "$d_fork:$d_pipe" in
12772         define:define)
12773         $cat head.c > try.c
12774         $cat >>try.c <<EOCP
12775 #include <errno.h>
12776 #include <sys/types.h>
12777 #include <signal.h>
12778 #include <stdio.h>
12779 #$i_stdlib I_STDLIB
12780 #ifdef I_STDLIB
12781 #include <stdlib.h>
12782 #endif
12783 #$i_fcntl I_FCNTL
12784 #ifdef I_FCNTL
12785 #include <fcntl.h>
12786 #endif
12787 #define MY_O_NONBLOCK $o_nonblock
12788 #ifndef errno  /* XXX need better Configure test */
12789 extern int errno;
12790 #endif
12791 #$i_unistd I_UNISTD
12792 #ifdef I_UNISTD
12793 #include <unistd.h>
12794 #endif
12795 #$i_string I_STRING
12796 #ifdef I_STRING
12797 #include <string.h>
12798 #else
12799 #include <strings.h>
12800 #endif
12801 $signal_t blech(int x) { exit(3); }
12802 EOCP
12803         $cat >> try.c <<'EOCP'
12804 int main()
12805 {
12806         int pd[2];
12807         int pu[2];
12808         char buf[1];
12809         char string[100];
12810
12811         pipe(pd);       /* Down: child -> parent */
12812         pipe(pu);       /* Up: parent -> child */
12813         if (0 != fork()) {
12814                 int ret;
12815                 close(pd[1]);   /* Parent reads from pd[0] */
12816                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12817 #ifdef F_SETFL
12818                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12819                         exit(1);
12820 #else
12821                 exit(4);
12822 #endif
12823                 signal(SIGALRM, blech);
12824                 alarm(5);
12825                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12826                         exit(2);
12827                 sprintf(string, "%d\n", ret);
12828                 write(2, string, strlen(string));
12829                 alarm(0);
12830 #ifdef EAGAIN
12831                 if (errno == EAGAIN) {
12832                         printf("EAGAIN\n");
12833                         goto ok;
12834                 }
12835 #endif
12836 #ifdef EWOULDBLOCK
12837                 if (errno == EWOULDBLOCK)
12838                         printf("EWOULDBLOCK\n");
12839 #endif
12840         ok:
12841                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12842                 sleep(2);                               /* Give it time to close our pipe */
12843                 alarm(5);
12844                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12845                 alarm(0);
12846                 sprintf(string, "%d\n", ret);
12847                 write(4, string, strlen(string));
12848                 exit(0);
12849         }
12850
12851         close(pd[0]);                   /* We write to pd[1] */
12852         close(pu[1]);                   /* We read from pu[0] */
12853         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12854         close(pd[1]);                   /* Pipe pd is now fully closed! */
12855         exit(0);                                /* Bye bye, thank you for playing! */
12856 }
12857 EOCP
12858         set try
12859         if eval $compile_ok; then
12860                 echo "$startsh" >mtry
12861                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12862                 chmod +x mtry
12863                 ./mtry >/dev/null 2>&1
12864                 case $? in
12865                 0) eagain=`$cat try.out`;;
12866                 1) echo "Could not perform non-blocking setting!";;
12867                 2) echo "I did a successful read() for something that was not there!";;
12868                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12869                 4) echo "Could not find F_SETFL!";;
12870                 *) echo "Something terribly wrong happened during testing.";;
12871                 esac
12872                 rd_nodata=`$cat try.ret`
12873                 echo "A read() system call with no data present returns $rd_nodata."
12874                 case "$rd_nodata" in
12875                 0|-1) ;;
12876                 *)
12877                         echo "(That's peculiar, fixing that to be -1.)"
12878                         rd_nodata=-1
12879                         ;;
12880                 esac
12881                 case "$eagain" in
12882                 '')
12883                         echo "Forcing errno EAGAIN on read() with no data available."
12884                         eagain=EAGAIN
12885                         ;;
12886                 *)
12887                         echo "Your read() sets errno to $eagain when no data is available."
12888                         ;;
12889                 esac
12890                 status=`$cat try.err`
12891                 case "$status" in
12892                 0) echo "And it correctly returns 0 to signal EOF.";;
12893                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12894                 *) echo "However, your read() returns '$status' on EOF??";;
12895                 esac
12896                 val="$define"
12897                 if test "$status" = "$rd_nodata"; then
12898                         echo "WARNING: you can't distinguish between EOF and no data!"
12899                         val="$undef"
12900                 fi
12901         else
12902                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12903                 eagain=EAGAIN
12904         fi
12905         ;;
12906         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12907                 eagain=EAGAIN
12908                 val="$define"
12909                 ;;
12910         esac
12911         set d_eofnblk
12912         eval $setvar
12913         ;;
12914 *)
12915         echo "Using $hint value $eagain."
12916         echo "Your read() returns $rd_nodata when no data is present."
12917         case "$d_eofnblk" in
12918         "$define") echo "And you can see EOF because read() returns 0.";;
12919         "$undef") echo "But you can't see EOF status from read() returned value.";;
12920         *)
12921                 echo "(Assuming you can't see EOF status from read anyway.)"
12922                 d_eofnblk=$undef
12923                 ;;
12924         esac
12925         ;;
12926 esac
12927 $rm_try head.c mtry
12928
12929 : see if _ptr and _cnt from stdio act std
12930 echo " "
12931
12932 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12933         echo "(Looks like you have stdio.h from BSD.)"
12934         case "$stdio_ptr" in
12935         '') stdio_ptr='((fp)->_p)'
12936                 ptr_lval=$define
12937                 ;;
12938         *)      ptr_lval=$d_stdio_ptr_lval;;
12939         esac
12940         case "$stdio_cnt" in
12941         '') stdio_cnt='((fp)->_r)'
12942                 cnt_lval=$define
12943                 ;;
12944         *)      cnt_lval=$d_stdio_cnt_lval;;
12945         esac
12946         case "$stdio_base" in
12947         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12948         esac
12949         case "$stdio_bufsiz" in
12950         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12951         esac
12952 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12953         echo "(Looks like you have stdio.h from Linux.)"
12954         case "$stdio_ptr" in
12955         '') stdio_ptr='((fp)->_IO_read_ptr)'
12956                 ptr_lval=$define
12957                 ;;
12958         *)      ptr_lval=$d_stdio_ptr_lval;;
12959         esac
12960         case "$stdio_cnt" in
12961         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12962                 cnt_lval=$undef
12963                 ;;
12964         *)      cnt_lval=$d_stdio_cnt_lval;;
12965         esac
12966         case "$stdio_base" in
12967         '') stdio_base='((fp)->_IO_read_base)';;
12968         esac
12969         case "$stdio_bufsiz" in
12970         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12971         esac
12972 else
12973         case "$stdio_ptr" in
12974         '') stdio_ptr='((fp)->_ptr)'
12975                 ptr_lval=$define
12976                 ;;
12977         *)      ptr_lval=$d_stdio_ptr_lval;;
12978         esac
12979         case "$stdio_cnt" in
12980         '') stdio_cnt='((fp)->_cnt)'
12981                 cnt_lval=$define
12982                 ;;
12983         *)      cnt_lval=$d_stdio_cnt_lval;;
12984         esac
12985         case "$stdio_base" in
12986         '') stdio_base='((fp)->_base)';;
12987         esac
12988         case "$stdio_bufsiz" in
12989         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12990         esac
12991 fi
12992
12993 : test whether _ptr and _cnt really work
12994 echo "Checking how std your stdio is..." >&4
12995 $cat >try.c <<EOP
12996 #include <stdio.h>
12997 #$i_stdlib I_STDLIB
12998 #ifdef I_STDLIB
12999 #include <stdlib.h>
13000 #endif
13001 #define FILE_ptr(fp)    $stdio_ptr
13002 #define FILE_cnt(fp)    $stdio_cnt
13003 int main() {
13004         FILE *fp = fopen("try.c", "r");
13005         char c = getc(fp);
13006         if (
13007                 18 <= FILE_cnt(fp) &&
13008                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13009         )
13010                 exit(0);
13011         exit(1);
13012 }
13013 EOP
13014 val="$undef"
13015 set try
13016 if eval $compile && $to try.c; then
13017         if $run ./try; then
13018                 echo "Your stdio acts pretty std."
13019                 val="$define"
13020         else
13021                 echo "Your stdio isn't very std."
13022         fi
13023 else
13024         echo "Your stdio doesn't appear very std."
13025 fi
13026 $rm_try
13027
13028 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13029 # direct buffer manipulation no longer works.  The Configure tests
13030 # should be changed to correctly detect this, but until then,
13031 # the following check should at least let perl compile and run.
13032 # (This quick fix should be updated before 5.8.1.)
13033 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13034 # A. Dougherty, June 3, 2002.
13035 case "$d_gnulibc" in
13036 $define)
13037         case "$gnulibc_version" in
13038         2.[01]*)  ;;
13039         2.2) ;;
13040         2.2.[0-9]) ;;
13041         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13042                 val="$undef"
13043                 ;;
13044         esac
13045         ;;
13046 esac
13047 set d_stdstdio
13048 eval $setvar
13049
13050 : Can _ptr be used as an lvalue?
13051 case "$d_stdstdio$ptr_lval" in
13052 $define$define) val=$define ;;
13053 *) val=$undef ;;
13054 esac
13055 set d_stdio_ptr_lval
13056 eval $setvar
13057
13058 : Can _cnt be used as an lvalue?
13059 case "$d_stdstdio$cnt_lval" in
13060 $define$define) val=$define ;;
13061 *) val=$undef ;;
13062 esac
13063 set d_stdio_cnt_lval
13064 eval $setvar
13065
13066
13067 : test whether setting _ptr sets _cnt as a side effect
13068 d_stdio_ptr_lval_sets_cnt="$undef"
13069 d_stdio_ptr_lval_nochange_cnt="$undef"
13070 case "$d_stdio_ptr_lval$d_stdstdio" in
13071 $define$define)
13072         echo "Checking to see what happens if we set the stdio ptr..." >&4
13073 $cat >try.c <<EOP
13074 #include <stdio.h>
13075 /* Can we scream? */
13076 /* Eat dust sed :-) */
13077 /* In the buffer space, no one can hear you scream. */
13078 #$i_stdlib I_STDLIB
13079 #ifdef I_STDLIB
13080 #include <stdlib.h>
13081 #endif
13082 #define FILE_ptr(fp)    $stdio_ptr
13083 #define FILE_cnt(fp)    $stdio_cnt
13084 #include <sys/types.h>
13085 int main() {
13086         FILE *fp = fopen("try.c", "r");
13087         int c;
13088         char *ptr;
13089         size_t cnt;
13090         if (!fp) {
13091             puts("Fail even to read");
13092             exit(1);
13093         }
13094         c = getc(fp); /* Read away the first # */
13095         if (c == EOF) {
13096             puts("Fail even to read");
13097             exit(1);
13098         }
13099         if (!(
13100                 18 <= FILE_cnt(fp) &&
13101                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13102         )) {
13103                 puts("Fail even to read");
13104                 exit (1);
13105         }
13106         ptr = (char*) FILE_ptr(fp);
13107         cnt = (size_t)FILE_cnt(fp);
13108
13109         FILE_ptr(fp) += 42;
13110
13111         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13112                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13113                 exit (1);
13114         }
13115         if (FILE_cnt(fp) <= 20) {
13116                 printf ("Fail (<20 chars to test)");
13117                 exit (1);
13118         }
13119         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13120                 puts("Fail compare");
13121                 exit (1);
13122         }
13123         if (cnt == FILE_cnt(fp)) {
13124                 puts("Pass_unchanged");
13125                 exit (0);
13126         }
13127         if (FILE_cnt(fp) == (cnt - 42)) {
13128                 puts("Pass_changed");
13129                 exit (0);
13130         }
13131         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13132         return 1;
13133
13134 }
13135 EOP
13136         set try
13137         if eval $compile && $to try.c; then
13138                 case `$run ./try` in
13139                 Pass_changed)
13140                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13141                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13142                 Pass_unchanged)
13143                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13144                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13145                 Fail*)
13146                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13147                 *)
13148                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13149         esac
13150         else
13151                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13152         fi
13153         $rm_try
13154         ;;
13155 esac
13156
13157 : see if _base is also standard
13158 val="$undef"
13159 case "$d_stdstdio" in
13160 $define)
13161         $cat >try.c <<EOP
13162 #include <stdio.h>
13163 #$i_stdlib I_STDLIB
13164 #ifdef I_STDLIB
13165 #include <stdlib.h>
13166 #endif
13167 #define FILE_base(fp)   $stdio_base
13168 #define FILE_bufsiz(fp) $stdio_bufsiz
13169 int main() {
13170         FILE *fp = fopen("try.c", "r");
13171         char c = getc(fp);
13172         if (
13173                 19 <= FILE_bufsiz(fp) &&
13174                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13175         )
13176                 exit(0);
13177         exit(1);
13178 }
13179 EOP
13180         set try
13181         if eval $compile && $to try.c; then
13182                 if $run ./try; then
13183                         echo "And its _base field acts std."
13184                         val="$define"
13185                 else
13186                         echo "But its _base field isn't std."
13187                 fi
13188         else
13189                 echo "However, it seems to be lacking the _base field."
13190         fi
13191         $rm_try
13192         ;;
13193 esac
13194 set d_stdiobase
13195 eval $setvar
13196
13197 : see if fast_stdio exists
13198 val="$undef"
13199 case "$d_stdstdio:$d_stdio_ptr_lval" in
13200 "$define:$define")
13201         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13202         *$define*)
13203                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13204                 val="$define"
13205                 ;;
13206         esac
13207         ;;
13208 esac
13209 set d_faststdio
13210 eval $setvar
13211
13212
13213
13214 : see if fchdir exists
13215 set fchdir d_fchdir
13216 eval $inlibc
13217
13218 : see if fchmod exists
13219 set fchmod d_fchmod
13220 eval $inlibc
13221
13222 : see if fchown exists
13223 set fchown d_fchown
13224 eval $inlibc
13225
13226 : see if this is an fcntl system
13227 set fcntl d_fcntl
13228 eval $inlibc
13229
13230 : See if fcntl-based locking works.
13231 echo " "
13232 $cat >try.c <<EOCP
13233 #$i_stdlib I_STDLIB
13234 #ifdef I_STDLIB
13235 #include <stdlib.h>
13236 #endif
13237 #include <unistd.h>
13238 #include <fcntl.h>
13239 #include <signal.h>
13240 $signal_t blech(int x) { exit(3); }
13241 int main() {
13242 #if defined(F_SETLK) && defined(F_SETLKW)
13243      struct flock flock;
13244      int retval, fd;
13245      fd = open("try.c", O_RDONLY);
13246      flock.l_type = F_RDLCK;
13247      flock.l_whence = SEEK_SET;
13248      flock.l_start = flock.l_len = 0;
13249      signal(SIGALRM, blech);
13250      alarm(10);
13251      retval = fcntl(fd, F_SETLK, &flock);
13252      close(fd);
13253      (retval < 0 ? exit(2) : exit(0));
13254 #else
13255      exit(2);
13256 #endif
13257 }
13258 EOCP
13259 echo "Checking if fcntl-based file locking works... "
13260 case "$d_fcntl" in
13261 "$define")
13262         set try
13263         if eval $compile_ok; then
13264                 if $run ./try; then
13265                         echo "Yes, it seems to work."
13266                         val="$define"
13267                 else
13268                         echo "Nope, it didn't work."
13269                         val="$undef"
13270                         case "$?" in
13271                         3) $cat >&4 <<EOM
13272 ***
13273 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13274 *** This is (almost) impossible.
13275 *** If your NFS lock daemons are not feeling well, something like
13276 *** this may happen, please investigate.  Cannot continue, aborting.
13277 ***
13278 EOM
13279                                 exit 1
13280                                 ;;
13281                         esac
13282                 fi
13283         else
13284                 echo "I'm unable to compile the test program, so I'll assume not."
13285                 val="$undef"
13286         fi
13287         ;;
13288 *) val="$undef";
13289         echo "Nope, since you don't even have fcntl()."
13290         ;;
13291 esac
13292 set d_fcntl_can_lock
13293 eval $setvar
13294 $rm_try
13295
13296 : check for fd_set items
13297 $cat <<EOM
13298
13299 Checking to see how well your C compiler handles fd_set and friends ...
13300 EOM
13301 $cat >try.c <<EOCP
13302 #$i_stdlib I_STDLIB
13303 #ifdef I_STDLIB
13304 #include <stdlib.h>
13305 #endif
13306 #$i_systime I_SYS_TIME
13307 #$i_sysselct I_SYS_SELECT
13308 #$d_socket HAS_SOCKET
13309 #include <sys/types.h>
13310 #ifdef HAS_SOCKET
13311 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13312 #endif
13313 #ifdef I_SYS_TIME
13314 #include <sys/time.h>
13315 #endif
13316 #ifdef I_SYS_SELECT
13317 #include <sys/select.h>
13318 #endif
13319 int main() {
13320         fd_set fds;
13321
13322 #ifdef TRYBITS
13323         if(fds.fds_bits);
13324 #endif
13325
13326 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13327         exit(0);
13328 #else
13329         exit(1);
13330 #endif
13331 }
13332 EOCP
13333 set try -DTRYBITS
13334 if eval $compile; then
13335         d_fds_bits="$define"
13336         d_fd_set="$define"
13337         echo "Well, your system knows about the normal fd_set typedef..." >&4
13338         if $run ./try; then
13339                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13340                 d_fd_macros="$define"
13341         else
13342                 $cat >&4 <<'EOM'
13343 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13344 EOM
13345                 d_fd_macros="$undef"
13346         fi
13347 else
13348         $cat <<'EOM'
13349 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13350 EOM
13351         set try
13352         if eval $compile; then
13353                 d_fds_bits="$undef"
13354                 d_fd_set="$define"
13355                 echo "Well, your system has some sort of fd_set available..." >&4
13356                 if $run ./try; then
13357                         echo "and you have the normal fd_set macros." >&4
13358                         d_fd_macros="$define"
13359                 else
13360                         $cat <<'EOM'
13361 but not the normal fd_set macros!  Gross!  More work for me...
13362 EOM
13363                         d_fd_macros="$undef"
13364                 fi
13365         else
13366         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13367                 d_fd_set="$undef"
13368                 d_fds_bits="$undef"
13369                 d_fd_macros="$undef"
13370         fi
13371 fi
13372 $rm_try
13373
13374 : see if fgetpos exists
13375 set fgetpos d_fgetpos
13376 eval $inlibc
13377
13378 : see if finite exists
13379 set finite d_finite
13380 eval $inlibc
13381
13382 : see if finitel exists
13383 set finitel d_finitel
13384 eval $inlibc
13385
13386 : see if flock exists
13387 set flock d_flock
13388 eval $inlibc
13389
13390 : see if prototype for flock is available
13391 echo " "
13392 set d_flockproto flock $i_sysfile sys/file.h
13393 eval $hasproto
13394
13395 : see if fp_class exists
13396 set fp_class d_fp_class
13397 eval $inlibc
13398
13399 : see if pathconf exists
13400 set pathconf d_pathconf
13401 eval $inlibc
13402
13403 : see if fpathconf exists
13404 set fpathconf d_fpathconf
13405 eval $inlibc
13406
13407 : see if fpclass exists
13408 set fpclass d_fpclass
13409 eval $inlibc
13410
13411 : see if fpclassify exists
13412 set fpclassify d_fpclassify
13413 eval $inlibc
13414
13415 : see if fpclassl exists
13416 set fpclassl d_fpclassl
13417 eval $inlibc
13418
13419 : check for fpos64_t
13420 echo " "
13421 echo "Checking to see if you have fpos64_t..." >&4
13422 $cat >try.c <<EOCP
13423 #include <stdio.h>
13424 int main() { fpos64_t x = 7; }
13425 EOCP
13426 set try
13427 if eval $compile; then
13428         val="$define"
13429         echo "You have fpos64_t."
13430 else
13431         val="$undef"
13432         echo "You do not have fpos64_t."
13433         case "$fpossize" in
13434         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13435         esac
13436 fi
13437 $rm_try
13438 set d_fpos64_t
13439 eval $setvar
13440
13441 : see if frexpl exists
13442 set frexpl d_frexpl
13443 eval $inlibc
13444
13445 : see if this is a sys/param system
13446 set sys/param.h i_sysparam
13447 eval $inhdr
13448
13449 : see if this is a sys/mount.h system
13450 set sys/mount.h i_sysmount
13451 eval $inhdr
13452
13453 : Check for fs_data_s
13454 echo " "
13455 echo "Checking to see if your system supports struct fs_data..." >&4
13456 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13457 eval $hasstruct
13458 case "$d_fs_data_s" in
13459 "$define")      echo "Yes, it does."   ;;
13460 *)              echo "No, it doesn't." ;;
13461 esac
13462
13463 : see if fseeko exists
13464 set fseeko d_fseeko
13465 eval $inlibc
13466 case "$longsize" in
13467 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13468 esac
13469
13470 : see if fsetpos exists
13471 set fsetpos d_fsetpos
13472 eval $inlibc
13473
13474 : see if fstatfs exists
13475 set fstatfs d_fstatfs
13476 eval $inlibc
13477
13478 : see if statvfs exists
13479 set statvfs d_statvfs
13480 eval $inlibc
13481
13482 : see if fstatvfs exists
13483 set fstatvfs d_fstatvfs
13484 eval $inlibc
13485
13486
13487 : see if fsync exists
13488 set fsync d_fsync
13489 eval $inlibc
13490
13491 : see if ftello exists
13492 set ftello d_ftello
13493 eval $inlibc
13494 case "$longsize" in
13495 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13496 esac
13497
13498 : check for a working futimes
13499 d_futimes="$undef"
13500 echo " "
13501 echo "Checking if you have a working futimes()" >&4
13502 $cat >try.c <<EOCP
13503 #include <stdio.h>
13504 #include <sys/time.h>
13505 #include <errno.h>
13506 #include <fcntl.h>
13507
13508 int main ()
13509 {
13510     int fd, rv;
13511     fd = open ("try.c", O_RDWR);
13512     if (-1 == fd) exit (1);
13513     rv = futimes (fd, NULL);
13514     exit (rv == -1 ? errno : 0);
13515 }
13516 EOCP
13517 set try
13518 if eval $compile; then
13519     `$run ./try`
13520     rc=$?
13521     case "$rc" in
13522         0)  echo "Yes, you have" >&4
13523             d_futimes="$define"
13524             ;;
13525         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13526             ;;
13527     esac
13528 else
13529     echo "No, it does not (probably harmless)" >&4
13530 fi
13531 $rm_try
13532
13533 : see if ndbm.h is available
13534 set ndbm.h i_ndbm
13535 eval $inhdr
13536 : Compatibility location for RedHat 7.1
13537 set gdbm/ndbm.h i_gdbmndbm
13538 eval $inhdr
13539 : Compatibility location for Debian 4.0
13540 set gdbm-ndbm.h i_gdbm_ndbm
13541 eval $inhdr
13542
13543 val="$undef"
13544 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13545         : see if dbm_open exists
13546         set dbm_open d_dbm_open
13547         eval $inlibc
13548         case "$d_dbm_open" in
13549         $undef)
13550                 i_ndbm="$undef"
13551                 i_gdbmndbm="$undef"
13552                 i_gdbm_ndbm="$undef"
13553                 echo "We won't be including <ndbm.h>"
13554                 val="$undef"
13555                 ;;
13556         *) val="$define"
13557            ;;
13558         esac
13559 fi
13560 set d_ndbm
13561 eval $setvar
13562
13563 ndbm_hdr_protochk='name=$1; hdr=$2;
13564 eval "ihdr=\$""i_$name";
13565 val="$undef";
13566 if $test "$ihdr" = "$define"; then
13567         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13568         case "$d_cplusplus" in
13569         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13570         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13571         esac;
13572         case "$val" in
13573         $define) $echo "Your <$hdr> seems to have prototypes";;
13574         *) $echo "Your <$hdr> does not seem to have prototypes";;
13575         esac;
13576 fi;
13577 set "d_${name}_h_uses_prototypes";
13578 eval $setvar'
13579
13580 set ndbm ndbm.h
13581 eval $ndbm_hdr_protochk
13582 set gdbmndbm gdbm/ndbm.h
13583 eval $ndbm_hdr_protochk
13584 set gdbm_ndbm gdbm-ndbm.h
13585 eval $ndbm_hdr_protochk
13586
13587 : see if getaddrinfo exists
13588 set getaddrinfo d_getaddrinfo
13589 eval $inlibc
13590
13591 : see if getcwd exists
13592 set getcwd d_getcwd
13593 eval $inlibc
13594
13595 : see if getespwnam exists
13596 set getespwnam d_getespwnam
13597 eval $inlibc
13598
13599 : see if getfsstat exists
13600 set getfsstat d_getfsstat
13601 eval $inlibc
13602
13603 : see if getgrent exists
13604 set getgrent d_getgrent
13605 eval $inlibc
13606
13607 : see if getgrent_r exists
13608 set getgrent_r d_getgrent_r
13609 eval $inlibc
13610 case "$d_getgrent_r" in
13611 "$define")
13612         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13613         case "$d_getgrent_r_proto:$usethreads" in
13614         ":define")      d_getgrent_r_proto=define
13615                 set d_getgrent_r_proto getgrent_r $hdrs
13616                 eval $hasproto ;;
13617         *)      ;;
13618         esac
13619         case "$d_getgrent_r_proto" in
13620         define)
13621         case "$getgrent_r_proto" in
13622         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13623         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13624         esac
13625         case "$getgrent_r_proto" in
13626         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13627         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13628         esac
13629         case "$getgrent_r_proto" in
13630         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13631         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13632         esac
13633         case "$getgrent_r_proto" in
13634         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13635         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13636         esac
13637         case "$getgrent_r_proto" in
13638         ''|0) try='int getgrent_r(struct group*, char*, int);'
13639         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13640         esac
13641         case "$getgrent_r_proto" in
13642         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13643         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13644         esac
13645         case "$getgrent_r_proto" in
13646         ''|0)   d_getgrent_r=undef
13647                 getgrent_r_proto=0
13648                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13649         * )     case "$getgrent_r_proto" in
13650                 REENTRANT_PROTO*) ;;
13651                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13652                 esac
13653                 echo "Prototype: $try" ;;
13654         esac
13655         ;;
13656         *)      case "$usethreads" in
13657                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13658                 esac
13659                 d_getgrent_r=undef
13660                 getgrent_r_proto=0
13661                 ;;
13662         esac
13663         ;;
13664 *)      getgrent_r_proto=0
13665         ;;
13666 esac
13667
13668 : see if getgrgid_r exists
13669 set getgrgid_r d_getgrgid_r
13670 eval $inlibc
13671 case "$d_getgrgid_r" in
13672 "$define")
13673         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13674         case "$d_getgrgid_r_proto:$usethreads" in
13675         ":define")      d_getgrgid_r_proto=define
13676                 set d_getgrgid_r_proto getgrgid_r $hdrs
13677                 eval $hasproto ;;
13678         *)      ;;
13679         esac
13680         case "$d_getgrgid_r_proto" in
13681         define)
13682         case "$getgrgid_r_proto" in
13683         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13684         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13685         esac
13686         case "$getgrgid_r_proto" in
13687         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13688         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13689         esac
13690         case "$getgrgid_r_proto" in
13691         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13692         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13693         esac
13694         case "$getgrgid_r_proto" in
13695         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13696         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13697         esac
13698         case "$getgrgid_r_proto" in
13699         ''|0)   d_getgrgid_r=undef
13700                 getgrgid_r_proto=0
13701                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13702         * )     case "$getgrgid_r_proto" in
13703                 REENTRANT_PROTO*) ;;
13704                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13705                 esac
13706                 echo "Prototype: $try" ;;
13707         esac
13708         ;;
13709         *)      case "$usethreads" in
13710                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13711                 esac
13712                 d_getgrgid_r=undef
13713                 getgrgid_r_proto=0
13714                 ;;
13715         esac
13716         ;;
13717 *)      getgrgid_r_proto=0
13718         ;;
13719 esac
13720
13721 : see if getgrnam_r exists
13722 set getgrnam_r d_getgrnam_r
13723 eval $inlibc
13724 case "$d_getgrnam_r" in
13725 "$define")
13726         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13727         case "$d_getgrnam_r_proto:$usethreads" in
13728         ":define")      d_getgrnam_r_proto=define
13729                 set d_getgrnam_r_proto getgrnam_r $hdrs
13730                 eval $hasproto ;;
13731         *)      ;;
13732         esac
13733         case "$d_getgrnam_r_proto" in
13734         define)
13735         case "$getgrnam_r_proto" in
13736         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13737         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13738         esac
13739         case "$getgrnam_r_proto" in
13740         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13741         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13742         esac
13743         case "$getgrnam_r_proto" in
13744         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13745         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13746         esac
13747         case "$getgrnam_r_proto" in
13748         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13749         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13750         esac
13751         case "$getgrnam_r_proto" in
13752         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13753         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13754         esac
13755         case "$getgrnam_r_proto" in
13756         ''|0)   d_getgrnam_r=undef
13757                 getgrnam_r_proto=0
13758                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13759         * )     case "$getgrnam_r_proto" in
13760                 REENTRANT_PROTO*) ;;
13761                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13762                 esac
13763                 echo "Prototype: $try" ;;
13764         esac
13765         ;;
13766         *)      case "$usethreads" in
13767                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13768                 esac
13769                 d_getgrnam_r=undef
13770                 getgrnam_r_proto=0
13771                 ;;
13772         esac
13773         ;;
13774 *)      getgrnam_r_proto=0
13775         ;;
13776 esac
13777
13778 : see if gethostbyaddr exists
13779 set gethostbyaddr d_gethbyaddr
13780 eval $inlibc
13781
13782 : see if gethostbyname exists
13783 set gethostbyname d_gethbyname
13784 eval $inlibc
13785
13786 : see if gethostent exists
13787 set gethostent d_gethent
13788 eval $inlibc
13789
13790 : see how we will look up host name
13791 echo " "
13792 call=''
13793 if set gethostname val -f d_gethname; eval $csym; $val; then
13794         echo 'gethostname() found.' >&4
13795         d_gethname="$define"
13796         call=gethostname
13797 fi
13798 if set uname val -f d_uname; eval $csym; $val; then
13799         if ./xenix; then
13800                 $cat <<'EOM'
13801 uname() was found, but you're running xenix, and older versions of xenix
13802 have a broken uname(). If you don't really know whether your xenix is old
13803 enough to have a broken system call, use the default answer.
13804
13805 EOM
13806                 dflt=y
13807                 case "$d_uname" in
13808                 "$define") dflt=n;;
13809                 esac
13810                 rp='Is your uname() broken?'
13811                 . ./myread
13812                 case "$ans" in
13813                 n*) d_uname="$define"; call=uname;;
13814                 esac
13815         else
13816                 echo 'uname() found.' >&4
13817                 d_uname="$define"
13818                 case "$call" in
13819                 '') call=uname ;;
13820                 esac
13821         fi
13822 fi
13823 case "$d_gethname" in
13824 '') d_gethname="$undef";;
13825 esac
13826 case "$d_uname" in
13827 '') d_uname="$undef";;
13828 esac
13829 case "$d_uname$d_gethname" in
13830 *define*)
13831         dflt=n
13832         cat <<EOM
13833
13834 Every now and then someone has a $call() that lies about the hostname
13835 but can't be fixed for political or economic reasons.  If you wish, I can
13836 pretend $call() isn't there and maybe compute hostname at run-time
13837 thanks to the '$phostname' command.
13838
13839 EOM
13840         rp="Shall I ignore $call() from now on?"
13841         . ./myread
13842         case "$ans" in
13843         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13844         esac;;
13845 esac
13846 case "$phostname" in
13847 '') aphostname='';;
13848 *) case "$aphostname" in
13849         /*) ;;
13850         *) set X $phostname
13851                 shift
13852                 file=$1
13853                 shift
13854                 file=`./loc $file $file $pth`
13855                 aphostname=`echo $file $*`
13856                 ;;
13857         esac
13858         ;;
13859 esac
13860 case "$d_uname$d_gethname" in
13861 *define*) ;;
13862 *)
13863         case "$phostname" in
13864         '')
13865                 echo "There will be no way for $package to get your hostname." >&4;;
13866         *)
13867         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13868                 ;;
13869         esac;;
13870 esac
13871 case "$d_phostname" in
13872 '') d_phostname="$undef";;
13873 esac
13874
13875 : see if gethostbyaddr_r exists
13876 set gethostbyaddr_r d_gethostbyaddr_r
13877 eval $inlibc
13878 case "$d_gethostbyaddr_r" in
13879 "$define")
13880         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13881         case "$d_gethostbyaddr_r_proto:$usethreads" in
13882         ":define")      d_gethostbyaddr_r_proto=define
13883                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13884                 eval $hasproto ;;
13885         *)      ;;
13886         esac
13887         case "$d_gethostbyaddr_r_proto" in
13888         define)
13889         case "$gethostbyaddr_r_proto" in
13890         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13891         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13892         esac
13893         case "$gethostbyaddr_r_proto" in
13894         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13895         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13896         esac
13897         case "$gethostbyaddr_r_proto" in
13898         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13899         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13900         esac
13901         case "$gethostbyaddr_r_proto" in
13902         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13903         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13904         esac
13905         case "$gethostbyaddr_r_proto" in
13906         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13907         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13908         esac
13909         case "$gethostbyaddr_r_proto" in
13910         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13911         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13912         esac
13913         case "$gethostbyaddr_r_proto" in
13914         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13915         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13916         esac
13917         case "$gethostbyaddr_r_proto" in
13918         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13919         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13920         esac
13921         case "$gethostbyaddr_r_proto" in
13922         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13923         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13924         esac
13925         case "$gethostbyaddr_r_proto" in
13926         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13927         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13928         esac
13929         case "$gethostbyaddr_r_proto" in
13930         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13931         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13932         esac
13933         case "$gethostbyaddr_r_proto" in
13934         ''|0)   d_gethostbyaddr_r=undef
13935                 gethostbyaddr_r_proto=0
13936                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13937         * )     case "$gethostbyaddr_r_proto" in
13938                 REENTRANT_PROTO*) ;;
13939                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13940                 esac
13941                 echo "Prototype: $try" ;;
13942         esac
13943         ;;
13944         *)      case "$usethreads" in
13945                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13946                 esac
13947                 d_gethostbyaddr_r=undef
13948                 gethostbyaddr_r_proto=0
13949                 ;;
13950         esac
13951         ;;
13952 *)      gethostbyaddr_r_proto=0
13953         ;;
13954 esac
13955
13956 : see if gethostbyname_r exists
13957 set gethostbyname_r d_gethostbyname_r
13958 eval $inlibc
13959 case "$d_gethostbyname_r" in
13960 "$define")
13961         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13962         case "$d_gethostbyname_r_proto:$usethreads" in
13963         ":define")      d_gethostbyname_r_proto=define
13964                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13965                 eval $hasproto ;;
13966         *)      ;;
13967         esac
13968         case "$d_gethostbyname_r_proto" in
13969         define)
13970         case "$gethostbyname_r_proto" in
13971         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13972         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13973         esac
13974         case "$gethostbyname_r_proto" in
13975         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13976         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13977         esac
13978         case "$gethostbyname_r_proto" in
13979         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13980         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13981         esac
13982         case "$gethostbyname_r_proto" in
13983         ''|0)   d_gethostbyname_r=undef
13984                 gethostbyname_r_proto=0
13985                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13986         * )     case "$gethostbyname_r_proto" in
13987                 REENTRANT_PROTO*) ;;
13988                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13989                 esac
13990                 echo "Prototype: $try" ;;
13991         esac
13992         ;;
13993         *)      case "$usethreads" in
13994                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13995                 esac
13996                 d_gethostbyname_r=undef
13997                 gethostbyname_r_proto=0
13998                 ;;
13999         esac
14000         ;;
14001 *)      gethostbyname_r_proto=0
14002         ;;
14003 esac
14004
14005 : see if gethostent_r exists
14006 set gethostent_r d_gethostent_r
14007 eval $inlibc
14008 case "$d_gethostent_r" in
14009 "$define")
14010         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14011         case "$d_gethostent_r_proto:$usethreads" in
14012         ":define")      d_gethostent_r_proto=define
14013                 set d_gethostent_r_proto gethostent_r $hdrs
14014                 eval $hasproto ;;
14015         *)      ;;
14016         esac
14017         case "$d_gethostent_r_proto" in
14018         define)
14019         case "$gethostent_r_proto" in
14020         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14021         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14022         esac
14023         case "$gethostent_r_proto" in
14024         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14025         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14026         esac
14027         case "$gethostent_r_proto" in
14028         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14029         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14030         esac
14031         case "$gethostent_r_proto" in
14032         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14033         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14034         esac
14035         case "$gethostent_r_proto" in
14036         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14037         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14038         esac
14039         case "$gethostent_r_proto" in
14040         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14041         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14042         esac
14043         case "$gethostent_r_proto" in
14044         ''|0)   d_gethostent_r=undef
14045                 gethostent_r_proto=0
14046                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14047         * )     case "$gethostent_r_proto" in
14048                 REENTRANT_PROTO*) ;;
14049                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14050                 esac
14051                 echo "Prototype: $try" ;;
14052         esac
14053         ;;
14054         *)      case "$usethreads" in
14055                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14056                 esac
14057                 d_gethostent_r=undef
14058                 gethostent_r_proto=0
14059                 ;;
14060         esac
14061         ;;
14062 *)      gethostent_r_proto=0
14063         ;;
14064 esac
14065
14066 : see if prototypes for various gethostxxx netdb.h functions are available
14067 echo " "
14068 set d_gethostprotos gethostent $i_netdb netdb.h
14069 eval $hasproto
14070
14071 : see if getitimer exists
14072 set getitimer d_getitimer
14073 eval $inlibc
14074
14075 : see if getlogin exists
14076 set getlogin d_getlogin
14077 eval $inlibc
14078
14079 : see if getlogin_r exists
14080 set getlogin_r d_getlogin_r
14081 eval $inlibc
14082 case "$d_getlogin_r" in
14083 "$define")
14084         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14085         case "$d_getlogin_r_proto:$usethreads" in
14086         ":define")      d_getlogin_r_proto=define
14087                 set d_getlogin_r_proto getlogin_r $hdrs
14088                 eval $hasproto ;;
14089         *)      ;;
14090         esac
14091         case "$d_getlogin_r_proto" in
14092         define)
14093         case "$getlogin_r_proto" in
14094         ''|0) try='int getlogin_r(char*, size_t);'
14095         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14096         esac
14097         case "$getlogin_r_proto" in
14098         ''|0) try='int getlogin_r(char*, int);'
14099         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14100         esac
14101         case "$getlogin_r_proto" in
14102         ''|0) try='char* getlogin_r(char*, size_t);'
14103         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14104         esac
14105         case "$getlogin_r_proto" in
14106         ''|0) try='char* getlogin_r(char*, int);'
14107         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14108         esac
14109         case "$getlogin_r_proto" in
14110         ''|0)   d_getlogin_r=undef
14111                 getlogin_r_proto=0
14112                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14113         * )     case "$getlogin_r_proto" in
14114                 REENTRANT_PROTO*) ;;
14115                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14116                 esac
14117                 echo "Prototype: $try" ;;
14118         esac
14119         ;;
14120         *)      case "$usethreads" in
14121                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14122                 esac
14123                 d_getlogin_r=undef
14124                 getlogin_r_proto=0
14125                 ;;
14126         esac
14127         ;;
14128 *)      getlogin_r_proto=0
14129         ;;
14130 esac
14131
14132 : see if getmnt exists
14133 set getmnt d_getmnt
14134 eval $inlibc
14135
14136 : see if getmntent exists
14137 set getmntent d_getmntent
14138 eval $inlibc
14139
14140 : see if getnameinfo exists
14141 set getnameinfo d_getnameinfo
14142 eval $inlibc
14143
14144 : see if getnetbyaddr exists
14145 set getnetbyaddr d_getnbyaddr
14146 eval $inlibc
14147
14148 : see if getnetbyname exists
14149 set getnetbyname d_getnbyname
14150 eval $inlibc
14151
14152 : see if getnetent exists
14153 set getnetent d_getnent
14154 eval $inlibc
14155
14156 : see if getnetbyaddr_r exists
14157 set getnetbyaddr_r d_getnetbyaddr_r
14158 eval $inlibc
14159 case "$d_getnetbyaddr_r" in
14160 "$define")
14161         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14162         case "$d_getnetbyaddr_r_proto:$usethreads" in
14163         ":define")      d_getnetbyaddr_r_proto=define
14164                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14165                 eval $hasproto ;;
14166         *)      ;;
14167         esac
14168         case "$d_getnetbyaddr_r_proto" in
14169         define)
14170         case "$getnetbyaddr_r_proto" in
14171         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14172         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14173         esac
14174         case "$getnetbyaddr_r_proto" in
14175         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14176         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14177         esac
14178         case "$getnetbyaddr_r_proto" in
14179         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14180         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14181         esac
14182         case "$getnetbyaddr_r_proto" in
14183         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14184         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14185         esac
14186         case "$getnetbyaddr_r_proto" in
14187         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14188         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14189         esac
14190         case "$getnetbyaddr_r_proto" in
14191         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14192         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14193         esac
14194         case "$getnetbyaddr_r_proto" in
14195         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14196         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14197         esac
14198         case "$getnetbyaddr_r_proto" in
14199         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14200         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14201         esac
14202         case "$getnetbyaddr_r_proto" in
14203         ''|0)   d_getnetbyaddr_r=undef
14204                 getnetbyaddr_r_proto=0
14205                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14206         * )     case "$getnetbyaddr_r_proto" in
14207                 REENTRANT_PROTO*) ;;
14208                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14209                 esac
14210                 echo "Prototype: $try" ;;
14211         esac
14212         ;;
14213         *)      case "$usethreads" in
14214                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14215                 esac
14216                 d_getnetbyaddr_r=undef
14217                 getnetbyaddr_r_proto=0
14218                 ;;
14219         esac
14220         ;;
14221 *)      getnetbyaddr_r_proto=0
14222         ;;
14223 esac
14224
14225 : see if getnetbyname_r exists
14226 set getnetbyname_r d_getnetbyname_r
14227 eval $inlibc
14228 case "$d_getnetbyname_r" in
14229 "$define")
14230         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14231         case "$d_getnetbyname_r_proto:$usethreads" in
14232         ":define")      d_getnetbyname_r_proto=define
14233                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14234                 eval $hasproto ;;
14235         *)      ;;
14236         esac
14237         case "$d_getnetbyname_r_proto" in
14238         define)
14239         case "$getnetbyname_r_proto" in
14240         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14241         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14242         esac
14243         case "$getnetbyname_r_proto" in
14244         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14245         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14246         esac
14247         case "$getnetbyname_r_proto" in
14248         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14249         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14250         esac
14251         case "$getnetbyname_r_proto" in
14252         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14253         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14254         esac
14255         case "$getnetbyname_r_proto" in
14256         ''|0)   d_getnetbyname_r=undef
14257                 getnetbyname_r_proto=0
14258                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14259         * )     case "$getnetbyname_r_proto" in
14260                 REENTRANT_PROTO*) ;;
14261                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14262                 esac
14263                 echo "Prototype: $try" ;;
14264         esac
14265         ;;
14266         *)      case "$usethreads" in
14267                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14268                 esac
14269                 d_getnetbyname_r=undef
14270                 getnetbyname_r_proto=0
14271                 ;;
14272         esac
14273         ;;
14274 *)      getnetbyname_r_proto=0
14275         ;;
14276 esac
14277
14278 : see if getnetent_r exists
14279 set getnetent_r d_getnetent_r
14280 eval $inlibc
14281 case "$d_getnetent_r" in
14282 "$define")
14283         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14284         case "$d_getnetent_r_proto:$usethreads" in
14285         ":define")      d_getnetent_r_proto=define
14286                 set d_getnetent_r_proto getnetent_r $hdrs
14287                 eval $hasproto ;;
14288         *)      ;;
14289         esac
14290         case "$d_getnetent_r_proto" in
14291         define)
14292         case "$getnetent_r_proto" in
14293         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14294         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14295         esac
14296         case "$getnetent_r_proto" in
14297         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14298         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14299         esac
14300         case "$getnetent_r_proto" in
14301         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14302         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14303         esac
14304         case "$getnetent_r_proto" in
14305         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14306         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14307         esac
14308         case "$getnetent_r_proto" in
14309         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14310         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14311         esac
14312         case "$getnetent_r_proto" in
14313         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14314         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14315         esac
14316         case "$getnetent_r_proto" in
14317         ''|0)   d_getnetent_r=undef
14318                 getnetent_r_proto=0
14319                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14320         * )     case "$getnetent_r_proto" in
14321                 REENTRANT_PROTO*) ;;
14322                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14323                 esac
14324                 echo "Prototype: $try" ;;
14325         esac
14326         ;;
14327         *)      case "$usethreads" in
14328                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14329                 esac
14330                 d_getnetent_r=undef
14331                 getnetent_r_proto=0
14332                 ;;
14333         esac
14334         ;;
14335 *)      getnetent_r_proto=0
14336         ;;
14337 esac
14338
14339 : see if prototypes for various getnetxxx netdb.h functions are available
14340 echo " "
14341 set d_getnetprotos getnetent $i_netdb netdb.h
14342 eval $hasproto
14343
14344 : see if getpagesize exists
14345 set getpagesize d_getpagsz
14346 eval $inlibc
14347
14348 : Optional checks for getprotobyname and getprotobynumber
14349
14350 : see if getprotobyname exists
14351 set getprotobyname d_getpbyname
14352 eval $inlibc
14353
14354 : see if getprotobynumber exists
14355 set getprotobynumber d_getpbynumber
14356 eval $inlibc
14357
14358 : see if getprotoent exists
14359 set getprotoent d_getpent
14360 eval $inlibc
14361
14362 : see if getpgid exists
14363 set getpgid d_getpgid
14364 eval $inlibc
14365
14366 : see if getpgrp2 exists
14367 set getpgrp2 d_getpgrp2
14368 eval $inlibc
14369
14370 : see if getppid exists
14371 set getppid d_getppid
14372 eval $inlibc
14373
14374 : see if getpriority exists
14375 set getpriority d_getprior
14376 eval $inlibc
14377
14378 : see if getprotobyname_r exists
14379 set getprotobyname_r d_getprotobyname_r
14380 eval $inlibc
14381 case "$d_getprotobyname_r" in
14382 "$define")
14383         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14384         case "$d_getprotobyname_r_proto:$usethreads" in
14385         ":define")      d_getprotobyname_r_proto=define
14386                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14387                 eval $hasproto ;;
14388         *)      ;;
14389         esac
14390         case "$d_getprotobyname_r_proto" in
14391         define)
14392         case "$getprotobyname_r_proto" in
14393         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14394         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14395         esac
14396         case "$getprotobyname_r_proto" in
14397         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14398         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14399         esac
14400         case "$getprotobyname_r_proto" in
14401         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14402         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14403         esac
14404         case "$getprotobyname_r_proto" in
14405         ''|0)   d_getprotobyname_r=undef
14406                 getprotobyname_r_proto=0
14407                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14408         * )     case "$getprotobyname_r_proto" in
14409                 REENTRANT_PROTO*) ;;
14410                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14411                 esac
14412                 echo "Prototype: $try" ;;
14413         esac
14414         ;;
14415         *)      case "$usethreads" in
14416                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14417                 esac
14418                 d_getprotobyname_r=undef
14419                 getprotobyname_r_proto=0
14420                 ;;
14421         esac
14422         ;;
14423 *)      getprotobyname_r_proto=0
14424         ;;
14425 esac
14426
14427 : see if getprotobynumber_r exists
14428 set getprotobynumber_r d_getprotobynumber_r
14429 eval $inlibc
14430 case "$d_getprotobynumber_r" in
14431 "$define")
14432         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14433         case "$d_getprotobynumber_r_proto:$usethreads" in
14434         ":define")      d_getprotobynumber_r_proto=define
14435                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14436                 eval $hasproto ;;
14437         *)      ;;
14438         esac
14439         case "$d_getprotobynumber_r_proto" in
14440         define)
14441         case "$getprotobynumber_r_proto" in
14442         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14443         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14444         esac
14445         case "$getprotobynumber_r_proto" in
14446         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14447         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14448         esac
14449         case "$getprotobynumber_r_proto" in
14450         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14451         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14452         esac
14453         case "$getprotobynumber_r_proto" in
14454         ''|0)   d_getprotobynumber_r=undef
14455                 getprotobynumber_r_proto=0
14456                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14457         * )     case "$getprotobynumber_r_proto" in
14458                 REENTRANT_PROTO*) ;;
14459                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14460                 esac
14461                 echo "Prototype: $try" ;;
14462         esac
14463         ;;
14464         *)      case "$usethreads" in
14465                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14466                 esac
14467                 d_getprotobynumber_r=undef
14468                 getprotobynumber_r_proto=0
14469                 ;;
14470         esac
14471         ;;
14472 *)      getprotobynumber_r_proto=0
14473         ;;
14474 esac
14475
14476 : see if getprotoent_r exists
14477 set getprotoent_r d_getprotoent_r
14478 eval $inlibc
14479 case "$d_getprotoent_r" in
14480 "$define")
14481         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14482         case "$d_getprotoent_r_proto:$usethreads" in
14483         ":define")      d_getprotoent_r_proto=define
14484                 set d_getprotoent_r_proto getprotoent_r $hdrs
14485                 eval $hasproto ;;
14486         *)      ;;
14487         esac
14488         case "$d_getprotoent_r_proto" in
14489         define)
14490         case "$getprotoent_r_proto" in
14491         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14492         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14493         esac
14494         case "$getprotoent_r_proto" in
14495         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14496         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14497         esac
14498         case "$getprotoent_r_proto" in
14499         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14500         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14501         esac
14502         case "$getprotoent_r_proto" in
14503         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14504         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14505         esac
14506         case "$getprotoent_r_proto" in
14507         ''|0)   d_getprotoent_r=undef
14508                 getprotoent_r_proto=0
14509                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14510         * )     case "$getprotoent_r_proto" in
14511                 REENTRANT_PROTO*) ;;
14512                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14513                 esac
14514                 echo "Prototype: $try" ;;
14515         esac
14516         ;;
14517         *)      case "$usethreads" in
14518                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14519                 esac
14520                 d_getprotoent_r=undef
14521                 getprotoent_r_proto=0
14522                 ;;
14523         esac
14524         ;;
14525 *)      getprotoent_r_proto=0
14526         ;;
14527 esac
14528
14529 : see if prototypes for various getprotoxxx netdb.h functions are available
14530 echo " "
14531 set d_getprotoprotos getprotoent $i_netdb netdb.h
14532 eval $hasproto
14533
14534 : see if getprpwnam exists
14535 set getprpwnam d_getprpwnam
14536 eval $inlibc
14537
14538 : see if getpwent exists
14539 set getpwent d_getpwent
14540 eval $inlibc
14541
14542 : see if getpwent_r exists
14543 set getpwent_r d_getpwent_r
14544 eval $inlibc
14545 case "$d_getpwent_r" in
14546 "$define")
14547         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14548         case "$d_getpwent_r_proto:$usethreads" in
14549         ":define")      d_getpwent_r_proto=define
14550                 set d_getpwent_r_proto getpwent_r $hdrs
14551                 eval $hasproto ;;
14552         *)      ;;
14553         esac
14554         case "$d_getpwent_r_proto" in
14555         define)
14556         case "$getpwent_r_proto" in
14557         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14558         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14559         esac
14560         case "$getpwent_r_proto" in
14561         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14562         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14563         esac
14564         case "$getpwent_r_proto" in
14565         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14566         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14567         esac
14568         case "$getpwent_r_proto" in
14569         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14570         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14571         esac
14572         case "$getpwent_r_proto" in
14573         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14574         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14575         esac
14576         case "$getpwent_r_proto" in
14577         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14578         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14579         esac
14580         case "$getpwent_r_proto" in
14581         ''|0)   d_getpwent_r=undef
14582                 getpwent_r_proto=0
14583                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14584         * )     case "$getpwent_r_proto" in
14585                 REENTRANT_PROTO*) ;;
14586                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14587                 esac
14588                 echo "Prototype: $try" ;;
14589         esac
14590         ;;
14591         *)      case "$usethreads" in
14592                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14593                 esac
14594                 d_getpwent_r=undef
14595                 getpwent_r_proto=0
14596                 ;;
14597         esac
14598         ;;
14599 *)      getpwent_r_proto=0
14600         ;;
14601 esac
14602
14603 : see if getpwnam_r exists
14604 set getpwnam_r d_getpwnam_r
14605 eval $inlibc
14606 case "$d_getpwnam_r" in
14607 "$define")
14608         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14609         case "$d_getpwnam_r_proto:$usethreads" in
14610         ":define")      d_getpwnam_r_proto=define
14611                 set d_getpwnam_r_proto getpwnam_r $hdrs
14612                 eval $hasproto ;;
14613         *)      ;;
14614         esac
14615         case "$d_getpwnam_r_proto" in
14616         define)
14617         case "$getpwnam_r_proto" in
14618         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14619         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14620         esac
14621         case "$getpwnam_r_proto" in
14622         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14623         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14624         esac
14625         case "$getpwnam_r_proto" in
14626         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14627         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14628         esac
14629         case "$getpwnam_r_proto" in
14630         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14631         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14632         esac
14633         case "$getpwnam_r_proto" in
14634         ''|0)   d_getpwnam_r=undef
14635                 getpwnam_r_proto=0
14636                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14637         * )     case "$getpwnam_r_proto" in
14638                 REENTRANT_PROTO*) ;;
14639                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14640                 esac
14641                 echo "Prototype: $try" ;;
14642         esac
14643         ;;
14644         *)      case "$usethreads" in
14645                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14646                 esac
14647                 d_getpwnam_r=undef
14648                 getpwnam_r_proto=0
14649                 ;;
14650         esac
14651         ;;
14652 *)      getpwnam_r_proto=0
14653         ;;
14654 esac
14655
14656 : see if getpwuid_r exists
14657 set getpwuid_r d_getpwuid_r
14658 eval $inlibc
14659 case "$d_getpwuid_r" in
14660 "$define")
14661         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14662         case "$d_getpwuid_r_proto:$usethreads" in
14663         ":define")      d_getpwuid_r_proto=define
14664                 set d_getpwuid_r_proto getpwuid_r $hdrs
14665                 eval $hasproto ;;
14666         *)      ;;
14667         esac
14668         case "$d_getpwuid_r_proto" in
14669         define)
14670         case "$getpwuid_r_proto" in
14671         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14672         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14673         esac
14674         case "$getpwuid_r_proto" in
14675         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14676         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14677         esac
14678         case "$getpwuid_r_proto" in
14679         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14680         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14681         esac
14682         case "$getpwuid_r_proto" in
14683         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14684         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14685         esac
14686         case "$getpwuid_r_proto" in
14687         ''|0)   d_getpwuid_r=undef
14688                 getpwuid_r_proto=0
14689                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14690         * )     case "$getpwuid_r_proto" in
14691                 REENTRANT_PROTO*) ;;
14692                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14693                 esac
14694                 echo "Prototype: $try" ;;
14695         esac
14696         ;;
14697         *)      case "$usethreads" in
14698                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14699                 esac
14700                 d_getpwuid_r=undef
14701                 getpwuid_r_proto=0
14702                 ;;
14703         esac
14704         ;;
14705 *)      getpwuid_r_proto=0
14706         ;;
14707 esac
14708
14709 : Optional checks for getsbyname and getsbyport
14710
14711 : see if getservbyname exists
14712 set getservbyname d_getsbyname
14713 eval $inlibc
14714
14715 : see if getservbyport exists
14716 set getservbyport d_getsbyport
14717 eval $inlibc
14718
14719 : see if getservent exists
14720 set getservent d_getsent
14721 eval $inlibc
14722
14723 : see if getservbyname_r exists
14724 set getservbyname_r d_getservbyname_r
14725 eval $inlibc
14726 case "$d_getservbyname_r" in
14727 "$define")
14728         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14729         case "$d_getservbyname_r_proto:$usethreads" in
14730         ":define")      d_getservbyname_r_proto=define
14731                 set d_getservbyname_r_proto getservbyname_r $hdrs
14732                 eval $hasproto ;;
14733         *)      ;;
14734         esac
14735         case "$d_getservbyname_r_proto" in
14736         define)
14737         case "$getservbyname_r_proto" in
14738         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14739         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14740         esac
14741         case "$getservbyname_r_proto" in
14742         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14743         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14744         esac
14745         case "$getservbyname_r_proto" in
14746         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14747         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14748         esac
14749         case "$getservbyname_r_proto" in
14750         ''|0)   d_getservbyname_r=undef
14751                 getservbyname_r_proto=0
14752                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14753         * )     case "$getservbyname_r_proto" in
14754                 REENTRANT_PROTO*) ;;
14755                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14756                 esac
14757                 echo "Prototype: $try" ;;
14758         esac
14759         ;;
14760         *)      case "$usethreads" in
14761                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14762                 esac
14763                 d_getservbyname_r=undef
14764                 getservbyname_r_proto=0
14765                 ;;
14766         esac
14767         ;;
14768 *)      getservbyname_r_proto=0
14769         ;;
14770 esac
14771
14772 : see if getservbyport_r exists
14773 set getservbyport_r d_getservbyport_r
14774 eval $inlibc
14775 case "$d_getservbyport_r" in
14776 "$define")
14777         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14778         case "$d_getservbyport_r_proto:$usethreads" in
14779         ":define")      d_getservbyport_r_proto=define
14780                 set d_getservbyport_r_proto getservbyport_r $hdrs
14781                 eval $hasproto ;;
14782         *)      ;;
14783         esac
14784         case "$d_getservbyport_r_proto" in
14785         define)
14786         case "$getservbyport_r_proto" in
14787         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14788         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14789         esac
14790         case "$getservbyport_r_proto" in
14791         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14792         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14793         esac
14794         case "$getservbyport_r_proto" in
14795         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14796         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14797         esac
14798         case "$getservbyport_r_proto" in
14799         ''|0)   d_getservbyport_r=undef
14800                 getservbyport_r_proto=0
14801                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14802         * )     case "$getservbyport_r_proto" in
14803                 REENTRANT_PROTO*) ;;
14804                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14805                 esac
14806                 echo "Prototype: $try" ;;
14807         esac
14808         ;;
14809         *)      case "$usethreads" in
14810                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14811                 esac
14812                 d_getservbyport_r=undef
14813                 getservbyport_r_proto=0
14814                 ;;
14815         esac
14816         ;;
14817 *)      getservbyport_r_proto=0
14818         ;;
14819 esac
14820
14821 : see if getservent_r exists
14822 set getservent_r d_getservent_r
14823 eval $inlibc
14824 case "$d_getservent_r" in
14825 "$define")
14826         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14827         case "$d_getservent_r_proto:$usethreads" in
14828         ":define")      d_getservent_r_proto=define
14829                 set d_getservent_r_proto getservent_r $hdrs
14830                 eval $hasproto ;;
14831         *)      ;;
14832         esac
14833         case "$d_getservent_r_proto" in
14834         define)
14835         case "$getservent_r_proto" in
14836         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14837         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14838         esac
14839         case "$getservent_r_proto" in
14840         ''|0) try='int getservent_r(struct servent*, char*, int);'
14841         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14842         esac
14843         case "$getservent_r_proto" in
14844         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14845         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14846         esac
14847         case "$getservent_r_proto" in
14848         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14849         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14850         esac
14851         case "$getservent_r_proto" in
14852         ''|0)   d_getservent_r=undef
14853                 getservent_r_proto=0
14854                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14855         * )     case "$getservent_r_proto" in
14856                 REENTRANT_PROTO*) ;;
14857                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14858                 esac
14859                 echo "Prototype: $try" ;;
14860         esac
14861         ;;
14862         *)      case "$usethreads" in
14863                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14864                 esac
14865                 d_getservent_r=undef
14866                 getservent_r_proto=0
14867                 ;;
14868         esac
14869         ;;
14870 *)      getservent_r_proto=0
14871         ;;
14872 esac
14873
14874 : see if prototypes for various getservxxx netdb.h functions are available
14875 echo " "
14876 set d_getservprotos getservent $i_netdb netdb.h
14877 eval $hasproto
14878
14879 : see if getspnam exists
14880 set getspnam d_getspnam
14881 eval $inlibc
14882
14883 : see if this is a shadow.h system
14884 set shadow.h i_shadow
14885 eval $inhdr
14886
14887 : see if getspnam_r exists
14888 set getspnam_r d_getspnam_r
14889 eval $inlibc
14890 case "$d_getspnam_r" in
14891 "$define")
14892         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14893         case "$d_getspnam_r_proto:$usethreads" in
14894         ":define")      d_getspnam_r_proto=define
14895                 set d_getspnam_r_proto getspnam_r $hdrs
14896                 eval $hasproto ;;
14897         *)      ;;
14898         esac
14899         case "$d_getspnam_r_proto" in
14900         define)
14901         case "$getspnam_r_proto" in
14902         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14903         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14904         esac
14905         case "$getspnam_r_proto" in
14906         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14907         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14908         esac
14909         case "$getspnam_r_proto" in
14910         ''|0)   d_getspnam_r=undef
14911                 getspnam_r_proto=0
14912                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14913         * )     case "$getspnam_r_proto" in
14914                 REENTRANT_PROTO*) ;;
14915                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14916                 esac
14917                 echo "Prototype: $try" ;;
14918         esac
14919         ;;
14920         *)      case "$usethreads" in
14921                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14922                 esac
14923                 d_getspnam_r=undef
14924                 getspnam_r_proto=0
14925                 ;;
14926         esac
14927         ;;
14928 *)      getspnam_r_proto=0
14929         ;;
14930 esac
14931
14932 : see if gettimeofday or ftime exists
14933 set gettimeofday d_gettimeod
14934 eval $inlibc
14935 case "$d_gettimeod" in
14936 "$undef")
14937         set ftime d_ftime 
14938         eval $inlibc
14939         ;;
14940 *)
14941         val="$undef"; set d_ftime; eval $setvar
14942         ;;
14943 esac
14944 case "$d_gettimeod$d_ftime" in
14945 "$undef$undef")
14946         echo " "
14947         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14948         ;;
14949 esac
14950
14951 : see if gmtime_r exists
14952 set gmtime_r d_gmtime_r
14953 eval $inlibc
14954 case "$d_gmtime_r" in
14955 "$define")
14956         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14957         case "$d_gmtime_r_proto:$usethreads" in
14958         ":define")      d_gmtime_r_proto=define
14959                 set d_gmtime_r_proto gmtime_r $hdrs
14960                 eval $hasproto ;;
14961         *)      ;;
14962         esac
14963         case "$d_gmtime_r_proto" in
14964         define)
14965         case "$gmtime_r_proto" in
14966         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14967         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14968         esac
14969         case "$gmtime_r_proto" in
14970         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14971         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14972         esac
14973         case "$gmtime_r_proto" in
14974         ''|0)   d_gmtime_r=undef
14975                 gmtime_r_proto=0
14976                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14977         * )     case "$gmtime_r_proto" in
14978                 REENTRANT_PROTO*) ;;
14979                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14980                 esac
14981                 echo "Prototype: $try" ;;
14982         esac
14983         ;;
14984         *)      case "$usethreads" in
14985                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14986                 esac
14987                 d_gmtime_r=undef
14988                 gmtime_r_proto=0
14989                 ;;
14990         esac
14991         ;;
14992 *)      gmtime_r_proto=0
14993         ;;
14994 esac
14995
14996 : see if hasmntopt exists
14997 set hasmntopt d_hasmntopt
14998 eval $inlibc
14999
15000 : see if this is a netinet/in.h or sys/in.h system
15001 set netinet/in.h i_niin sys/in.h i_sysin
15002 eval $inhdr
15003
15004 : see if arpa/inet.h has to be included
15005 set arpa/inet.h i_arpainet
15006 eval $inhdr
15007
15008 : see if htonl --and friends-- exists
15009 val=''
15010 set htonl val
15011 eval $inlibc
15012
15013 : Maybe they are macros.
15014 case "$val" in
15015 $undef)
15016         $cat >htonl.c <<EOM
15017 #include <stdio.h>
15018 #include <sys/types.h>
15019 #$i_niin I_NETINET_IN
15020 #$i_sysin I_SYS_IN
15021 #$i_arpainet I_ARPA_INET
15022 #ifdef I_NETINET_IN
15023 #include <netinet/in.h>
15024 #endif
15025 #ifdef I_SYS_IN
15026 #include <sys/in.h>
15027 #endif
15028 #ifdef I_ARPA_INET
15029 #include <arpa/inet.h>
15030 #endif
15031 #ifdef htonl
15032 printf("Defined as a macro.");
15033 #endif
15034 EOM
15035         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15036         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15037                 val="$define"
15038                 echo "But it seems to be defined as a macro." >&4
15039         fi
15040         $rm -f htonl.?
15041         ;;
15042 esac
15043 set d_htonl
15044 eval $setvar
15045
15046 : see if ilogbl exists
15047 set ilogbl d_ilogbl
15048 eval $inlibc
15049
15050 : index or strchr
15051 echo " "
15052 if set index val -f; eval $csym; $val; then
15053         if set strchr val -f d_strchr; eval $csym; $val; then
15054                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15055                         val="$define"
15056                         vali="$undef"
15057                         echo "strchr() found." >&4
15058                 else
15059                         val="$undef"
15060                         vali="$define"
15061                         echo "index() found." >&4
15062                 fi
15063         else
15064                 val="$undef"
15065                 vali="$define"
15066                 echo "index() found." >&4
15067         fi
15068 else
15069         if set strchr val -f d_strchr; eval $csym; $val; then
15070                 val="$define"
15071                 vali="$undef"
15072                 echo "strchr() found." >&4
15073         else
15074                 echo "No index() or strchr() found!" >&4
15075                 val="$undef"
15076                 vali="$undef"
15077         fi
15078 fi
15079 set d_strchr; eval $setvar
15080 val="$vali"
15081 set d_index; eval $setvar
15082
15083 : check whether inet_aton exists
15084 set inet_aton d_inetaton
15085 eval $inlibc
15086
15087 : see if inet_ntop exists
15088 set inet_ntop d_inetntop
15089 eval $inlibc
15090
15091 : see if inet_pton exists
15092 set inet_pton d_inetpton
15093 eval $inlibc
15094
15095 : Look for isascii
15096 echo " "
15097 $cat >isascii.c <<EOCP
15098 #include <stdio.h>
15099 #include <ctype.h>
15100 #$i_stdlib I_STDLIB
15101 #ifdef I_STDLIB
15102 #include <stdlib.h>
15103 #endif
15104 int main() {
15105         int c = 'A';
15106         if (isascii(c))
15107                 exit(0);
15108         else
15109                 exit(1);
15110 }
15111 EOCP
15112 set isascii
15113 if eval $compile; then
15114         echo "isascii() found." >&4
15115         val="$define"
15116 else
15117         echo "isascii() NOT found." >&4
15118         val="$undef"
15119 fi
15120 set d_isascii
15121 eval $setvar
15122 $rm -f isascii*
15123
15124 : Look for isblank
15125 echo " "
15126 $cat >isblank.c <<'EOCP'
15127 #include <stdio.h>
15128 #include <ctype.h>
15129 int main() {
15130         int c = ' ';
15131         if (isblank(c))
15132                 return 0 ;
15133         else
15134                 return 1 ;
15135 }
15136 EOCP
15137 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15138         echo "isblank() found." >&4
15139         val="$define"
15140 else
15141         echo "isblank() NOT found." >&4
15142         val="$undef"
15143 fi
15144 set d_isblank
15145 eval $setvar
15146 $rm -f isblank*
15147
15148 : see if isfinite exists
15149 set isfinite d_isfinite
15150 eval $inlibc
15151
15152 : see if isinf exists
15153 set isinf d_isinf
15154 eval $inlibc
15155
15156 : see if isnan exists
15157 set isnan d_isnan
15158 eval $inlibc
15159
15160 : see if isnanl exists
15161 set isnanl d_isnanl
15162 eval $inlibc
15163
15164 : see if killpg exists
15165 set killpg d_killpg
15166 eval $inlibc
15167
15168 : see if lchown exists
15169 echo " "
15170 $cat > try.c <<'EOCP'
15171 /* System header to define __stub macros and hopefully few prototypes,
15172     which can conflict with char lchown(); below.  */
15173 #include <assert.h>
15174 /* Override any gcc2 internal prototype to avoid an error.  */
15175 /* We use char because int might match the return type of a gcc2
15176    builtin and then its argument prototype would still apply.  */
15177 char lchown();
15178 int main() {
15179     /*  The GNU C library defines this for functions which it implements
15180         to always fail with ENOSYS.  Some functions are actually named
15181         something starting with __ and the normal name is an alias.  */
15182 #if defined (__stub_lchown) || defined (__stub___lchown)
15183 choke me
15184 #else
15185 lchown();
15186 #endif
15187 ; return 0; }
15188 EOCP
15189 set try
15190 if eval $compile; then
15191     $echo "lchown() found." >&4
15192     val="$define"
15193 else
15194     $echo "lchown() NOT found." >&4
15195     val="$undef"
15196 fi
15197 set d_lchown
15198 eval $setvar
15199
15200 : See if number of significant digits in a double precision number is known
15201 echo " "
15202 $cat >ldbl_dig.c <<EOM
15203 #$i_limits I_LIMITS
15204 #$i_float I_FLOAT
15205 #ifdef I_LIMITS
15206 #include <limits.h>
15207 #endif
15208 #ifdef I_FLOAT
15209 #include <float.h>
15210 #endif
15211 #ifdef LDBL_DIG
15212 printf("Contains LDBL_DIG");
15213 #endif
15214 EOM
15215 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15216 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15217         echo "LDBL_DIG found." >&4
15218         val="$define"
15219 else
15220         echo "LDBL_DIG NOT found." >&4
15221         val="$undef"
15222 fi
15223 $rm -f ldbl_dig.?
15224 set d_ldbl_dig
15225 eval $setvar
15226
15227 : see if this is a math.h system
15228 set math.h i_math
15229 eval $inhdr
15230
15231 : check to see if math.h defines _LIB_VERSION
15232 d_libm_lib_version="$undef"
15233 case $i_math in
15234     $define)
15235         echo " "
15236         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15237         $cat >try.c <<EOCP
15238 #include <unistd.h>
15239 #include <math.h>
15240 int main (int argc, char *argv[])
15241 {
15242     printf ("%d\n", _LIB_VERSION);
15243     return (0);
15244     } /* main */
15245 EOCP
15246         set try
15247         if eval $compile; then
15248             foo=`$run ./try`
15249             echo "Yes, it does ($foo)" >&4
15250             d_libm_lib_version="$define"
15251         else
15252             echo "No, it does not (probably harmless)" >&4
15253             fi
15254         $rm_try
15255         ;;
15256
15257     esac
15258
15259 : see if link exists
15260 set link d_link
15261 eval $inlibc
15262
15263 : see if localtime_r exists
15264 set localtime_r d_localtime_r
15265 eval $inlibc
15266 case "$d_localtime_r" in
15267 "$define")
15268         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15269         case "$d_localtime_r_proto:$usethreads" in
15270         ":define")      d_localtime_r_proto=define
15271                 set d_localtime_r_proto localtime_r $hdrs
15272                 eval $hasproto ;;
15273         *)      ;;
15274         esac
15275         case "$d_localtime_r_proto" in
15276         define)
15277         case "$localtime_r_proto" in
15278         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15279         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15280         esac
15281         case "$localtime_r_proto" in
15282         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15283         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15284         esac
15285         case "$localtime_r_proto" in
15286         ''|0)   d_localtime_r=undef
15287                 localtime_r_proto=0
15288                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15289         * )     case "$localtime_r_proto" in
15290                 REENTRANT_PROTO*) ;;
15291                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15292                 esac
15293                 echo "Prototype: $try" ;;
15294         esac
15295         ;;
15296         *)      case "$usethreads" in
15297                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15298                 esac
15299                 d_localtime_r=undef
15300                 localtime_r_proto=0
15301                 ;;
15302         esac
15303         ;;
15304 *)      localtime_r_proto=0
15305         ;;
15306 esac
15307
15308 : see if localtime_r calls tzset
15309 case "$localtime_r_proto" in
15310 REENTRANT_PROTO*)
15311         $cat >try.c <<EOCP
15312 /*  Does our libc's localtime_r call tzset ?
15313  *  return 0 if so, 1 otherwise.
15314  */
15315 #$i_systypes    I_SYS_TYPES
15316 #$i_unistd      I_UNISTD
15317 #$i_time        I_TIME
15318 #$i_stdlib      I_STDLIB
15319 #$i_string      I_STRING
15320 #$i_malloc      I_MALLOC
15321 #ifdef I_SYS_TYPES
15322 #  include <sys/types.h>
15323 #endif
15324 #ifdef I_UNISTD
15325 #  include <unistd.h>
15326 #endif
15327 #ifdef I_TIME
15328 #  include <time.h>
15329 #endif
15330 #ifdef I_STDLIB
15331 #include <stdlib.h>
15332 #endif
15333 #ifdef I_STRING
15334 #  include <string.h>
15335 #else
15336 #  include <strings.h>
15337 #endif
15338 #ifdef I_MALLOC
15339 #  include <malloc.h>
15340 #endif
15341 int main()
15342 {
15343     time_t t = time(0L);
15344     char w_tz[]="TZ" "=GMT+5",
15345          e_tz[]="TZ" "=GMT-5",
15346         *tz_e = (char*)malloc(16),
15347         *tz_w = (char*)malloc(16);
15348     struct tm tm_e, tm_w;
15349     memset(&tm_e,'\0',sizeof(struct tm));
15350     memset(&tm_w,'\0',sizeof(struct tm));
15351     strcpy(tz_e,e_tz);
15352     strcpy(tz_w,w_tz);
15353
15354     putenv(tz_e);
15355     localtime_r(&t, &tm_e);
15356
15357     putenv(tz_w);
15358     localtime_r(&t, &tm_w);
15359
15360     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15361         return 1;
15362     return 0;
15363 }
15364 EOCP
15365         set try
15366         if eval $compile; then
15367             if $run ./try; then
15368                 d_localtime_r_needs_tzset=undef;
15369             else
15370                 d_localtime_r_needs_tzset=define;
15371             fi;
15372         else
15373             d_localtime_r_needs_tzset=undef;
15374         fi;
15375      ;;
15376   *)
15377      d_localtime_r_needs_tzset=undef;
15378      ;;
15379 esac
15380 $rm_try
15381
15382 : see if localeconv exists
15383 set localeconv d_locconv
15384 eval $inlibc
15385
15386 : see if lockf exists
15387 set lockf d_lockf
15388 eval $inlibc
15389
15390 : see if prototype for lseek is available
15391 echo " "
15392 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15393 eval $hasproto
15394
15395 : see if lstat exists
15396 set lstat d_lstat
15397 eval $inlibc
15398
15399 : see if madvise exists
15400 set madvise d_madvise
15401 eval $inlibc
15402
15403 : see if malloc_size exists
15404 set malloc_size d_malloc_size
15405 eval $inlibc
15406
15407 : see if malloc_size_good exists
15408 set malloc_good_size d_malloc_good_size
15409 eval $inlibc
15410
15411 : see if mblen exists
15412 set mblen d_mblen
15413 eval $inlibc
15414
15415 : see if mbstowcs exists
15416 set mbstowcs d_mbstowcs
15417 eval $inlibc
15418
15419 : see if mbtowc exists
15420 set mbtowc d_mbtowc
15421 eval $inlibc
15422
15423 : see if memchr exists
15424 set memchr d_memchr
15425 eval $inlibc
15426
15427 : see if memcmp exists
15428 set memcmp d_memcmp
15429 eval $inlibc
15430
15431 : see if memcpy exists
15432 set memcpy d_memcpy
15433 eval $inlibc
15434
15435 : see if memmove exists
15436 set memmove d_memmove
15437 eval $inlibc
15438
15439 : see if memset exists
15440 set memset d_memset
15441 eval $inlibc
15442
15443 : see if mkdir exists
15444 set mkdir d_mkdir
15445 eval $inlibc
15446
15447 : see if mkdtemp exists
15448 set mkdtemp d_mkdtemp
15449 eval $inlibc
15450
15451 : see if mkfifo exists
15452 set mkfifo d_mkfifo
15453 eval $inlibc
15454
15455 : see if mkstemp exists
15456 set mkstemp d_mkstemp
15457 eval $inlibc
15458
15459 : see if mkstemps exists
15460 set mkstemps d_mkstemps
15461 eval $inlibc
15462
15463 : see if mktime exists
15464 set mktime d_mktime
15465 eval $inlibc
15466
15467 : see if this is a sys/mman.h system
15468 set sys/mman.h i_sysmman
15469 eval $inhdr
15470
15471 : see if mmap exists
15472 set mmap d_mmap
15473 eval $inlibc
15474 : see what shmat returns
15475 : default to something harmless
15476 mmaptype='void *'
15477 case "$i_sysmman$d_mmap" in
15478 "$define$define")
15479         $cat >mmap.c <<'END'
15480 #include <sys/mman.h>
15481 void *mmap();
15482 END
15483         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15484                 mmaptype='void *'
15485         else
15486                 mmaptype='caddr_t'
15487         fi
15488         echo "and it returns ($mmaptype)." >&4
15489         ;;
15490 esac
15491
15492
15493
15494 : see if sqrtl exists
15495 set sqrtl d_sqrtl
15496 eval $inlibc
15497
15498 : see if scalbnl exists
15499 set scalbnl d_scalbnl
15500 eval $inlibc
15501
15502 : see if modfl exists
15503 set modfl d_modfl
15504 eval $inlibc
15505
15506 : see if prototype for modfl is available
15507 echo " "
15508 set d_modflproto modfl $i_math math.h
15509 eval $hasproto
15510
15511 d_modfl_pow32_bug="$undef"
15512
15513 case "$d_longdbl$d_modfl" in
15514 $define$define)
15515         $cat <<EOM
15516 Checking to see whether your modfl() is okay for large values...
15517 EOM
15518 $cat >try.c <<EOCP
15519 #include <math.h>
15520 #include <stdio.h>
15521 EOCP
15522 if $test "X$d_modflproto" != "X$define"; then
15523         $cat >>try.c <<EOCP
15524 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15525 long double modfl (long double, long double *);
15526 EOCP
15527 fi
15528 $cat >>try.c <<EOCP
15529 int main() {
15530     long double nv = 4294967303.15;
15531     long double v, w;
15532     v = modfl(nv, &w);
15533 #ifdef __GLIBC__
15534     printf("glibc");
15535 #endif
15536     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15537     return 0;
15538 }
15539 EOCP
15540         case "$osname:$gccversion" in
15541         aix:)   saveccflags="$ccflags"
15542                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15543         esac
15544         set try
15545         if eval $compile; then
15546                 foo=`$run ./try`
15547                 case "$foo" in
15548                 *" 4294967303.150000 1.150000 4294967302.000000")
15549                         echo >&4 "Your modfl() is broken for large values."
15550                         d_modfl_pow32_bug="$define"
15551                         case "$foo" in
15552                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15553                         ;;
15554                         esac
15555                         ;;
15556                 *" 4294967303.150000 0.150000 4294967303.000000")
15557                         echo >&4 "Your modfl() seems okay for large values."
15558                         ;;
15559                 *)      echo >&4 "I don't understand your modfl() at all."
15560                         d_modfl="$undef"
15561                         ;;
15562                 esac
15563                 $rm_try
15564         else
15565                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15566                 d_modfl="$undef"
15567         fi
15568         case "$osname:$gccversion" in
15569         aix:)   ccflags="$saveccflags" ;; # restore
15570         esac
15571         ;;
15572 esac
15573
15574 if $test "$uselongdouble" = "$define"; then
15575     message=""
15576     if $test "$d_sqrtl" != "$define"; then
15577         message="$message sqrtl"
15578     fi
15579     if $test "$d_modfl" != "$define"; then
15580         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15581             echo "You have both aintl and copysignl, so I can emulate modfl."
15582         else
15583             message="$message modfl"
15584         fi
15585     fi
15586     if $test "$d_frexpl" != "$define"; then
15587         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15588             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15589         else
15590             message="$message frexpl"
15591         fi
15592     fi
15593
15594     if $test "$message" != ""; then
15595         $cat <<EOM >&4
15596
15597 *** You requested the use of long doubles but you do not seem to have
15598 *** the following mathematical functions needed for long double support:
15599 ***    $message
15600 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15601 *** Cannot continue, aborting.
15602
15603 EOM
15604
15605         exit 1
15606     fi
15607 fi
15608
15609 : see if mprotect exists
15610 set mprotect d_mprotect
15611 eval $inlibc
15612
15613 : see if msgctl exists
15614 set msgctl d_msgctl
15615 eval $inlibc
15616
15617 : see if msgget exists
15618 set msgget d_msgget
15619 eval $inlibc
15620
15621 : see if msgsnd exists
15622 set msgsnd d_msgsnd
15623 eval $inlibc
15624
15625 : see if msgrcv exists
15626 set msgrcv d_msgrcv
15627 eval $inlibc
15628
15629 : see how much of the 'msg*(2)' library is present.
15630 h_msg=true
15631 echo " "
15632 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15633 *"$undef"*) h_msg=false;;
15634 esac
15635 case "$osname" in
15636 freebsd)
15637     case "`ipcs 2>&1`" in
15638     "SVID messages"*"not configured"*)
15639         echo "Your $osname does not have the msg*(2) configured." >&4
15640         h_msg=false
15641         val="$undef"
15642         set msgctl d_msgctl
15643         eval $setvar
15644         set msgget d_msgget
15645         eval $setvar
15646         set msgsnd d_msgsnd
15647         eval $setvar
15648         set msgrcv d_msgrcv
15649         eval $setvar
15650         ;;
15651     esac
15652     ;;
15653 esac
15654 : we could also check for sys/ipc.h ...
15655 if $h_msg && $test `./findhdr sys/msg.h`; then
15656         echo "You have the full msg*(2) library." >&4
15657         val="$define"
15658 else
15659         echo "You don't have the full msg*(2) library." >&4
15660         val="$undef"
15661 fi
15662 set d_msg
15663 eval $setvar
15664
15665 : Check for msghdr_s
15666 echo " "
15667 echo "Checking to see if your system supports struct msghdr..." >&4
15668 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15669 eval $hasstruct
15670 case "$d_msghdr_s" in
15671 "$define")      echo "Yes, it does."   ;;
15672 *)              echo "No, it doesn't." ;;
15673 esac
15674
15675
15676 : see if msync exists
15677 set msync d_msync
15678 eval $inlibc
15679
15680 : see if munmap exists
15681 set munmap d_munmap
15682 eval $inlibc
15683
15684 : see if nice exists
15685 set nice d_nice
15686 eval $inlibc
15687
15688 : see if this is a langinfo.h system
15689 set langinfo.h i_langinfo
15690 eval $inhdr
15691
15692 : see if nl_langinfo exists
15693 set nl_langinfo d_nl_langinfo
15694 eval $inlibc
15695
15696 : check for volatile keyword
15697 echo " "
15698 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15699 $cat >try.c <<'EOCP'
15700 int main()
15701 {
15702         typedef struct _goo_struct goo_struct;
15703         goo_struct * volatile goo = ((goo_struct *)0);
15704         struct _goo_struct {
15705                 long long_int;
15706                 int reg_int;
15707                 char char_var;
15708         };
15709         typedef unsigned short foo_t;
15710         char *volatile foo;
15711         volatile int bar;
15712         volatile foo_t blech;
15713         foo = foo;
15714 }
15715 EOCP
15716 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15717         val="$define"
15718         echo "Yup, it does."
15719 else
15720         val="$undef"
15721         echo "Nope, it doesn't."
15722 fi
15723 set d_volatile
15724 eval $setvar
15725 $rm_try
15726
15727 : Check basic sizes
15728 echo " "
15729 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15730
15731 case "$use64bitint:$d_quad:$quadtype" in
15732 define:define:?*)
15733         ivtype="$quadtype"
15734         uvtype="$uquadtype"
15735         ivsize=8
15736         uvsize=8
15737         ;;
15738 *)      ivtype="long"
15739         uvtype="unsigned long"
15740         ivsize=$longsize
15741         uvsize=$longsize
15742         ;;
15743 esac
15744
15745 case "$uselongdouble:$d_longdbl" in
15746 define:define)
15747         nvtype="long double"
15748         nvsize=$longdblsize
15749         ;;
15750 *)      nvtype=double
15751         nvsize=$doublesize
15752         ;;
15753 esac
15754
15755 $echo "(IV will be "$ivtype", $ivsize bytes)"
15756 $echo "(UV will be "$uvtype", $uvsize bytes)"
15757 $echo "(NV will be "$nvtype", $nvsize bytes)"
15758
15759 $cat >try.c <<EOCP
15760 #$i_inttypes I_INTTYPES
15761 #ifdef I_INTTYPES
15762 #include <inttypes.h>
15763 #endif
15764 #include <stdio.h>
15765 int main() {
15766 #ifdef INT8
15767    int8_t i =  INT8_MAX;
15768   uint8_t u = UINT8_MAX;
15769   printf("int8_t\n");
15770 #endif
15771 #ifdef INT16
15772    int16_t i =  INT16_MAX;
15773   uint16_t i = UINT16_MAX;
15774   printf("int16_t\n");
15775 #endif
15776 #ifdef INT32
15777    int32_t i =  INT32_MAX;
15778   uint32_t u = UINT32_MAX;
15779   printf("int32_t\n");
15780 #endif
15781 }
15782 EOCP
15783
15784 i8type="signed char"
15785 u8type="unsigned char"
15786 i8size=1
15787 u8size=1
15788
15789 case "$i16type" in
15790 '')     case "$shortsize" in
15791         2)      i16type=short
15792                 u16type="unsigned short"
15793                 i16size=$shortsize
15794                 u16size=$shortsize
15795                 ;;
15796         esac
15797         ;;
15798 esac
15799 case "$i16type" in
15800 '')     set try -DINT16
15801         if eval $compile; then
15802                 case "`$run ./try`" in
15803                 int16_t)
15804                         i16type=int16_t
15805                         u16type=uint16_t
15806                         i16size=2
15807                         u16size=2
15808                         ;;
15809                 esac
15810         fi
15811         ;;
15812 esac
15813 case "$i16type" in
15814 '')     if $test $shortsize -ge 2; then
15815                 i16type=short
15816                 u16type="unsigned short"
15817                 i16size=$shortsize
15818                 u16size=$shortsize
15819         fi
15820         ;;
15821 esac
15822
15823 case "$i32type" in
15824 '')     case "$longsize" in
15825         4)      i32type=long
15826                 u32type="unsigned long"
15827                 i32size=$longsize
15828                 u32size=$longsize
15829                 ;;
15830         *)      case "$intsize" in
15831                 4)      i32type=int
15832                         u32type="unsigned int"
15833                         i32size=$intsize
15834                         u32size=$intsize
15835                         ;;
15836                 esac
15837                 ;;
15838         esac
15839         ;;
15840 esac
15841 case "$i32type" in
15842 '')     set try -DINT32
15843         if eval $compile; then
15844                 case "`$run ./try`" in
15845                 int32_t)
15846                         i32type=int32_t
15847                         u32type=uint32_t
15848                         i32size=4
15849                         u32size=4
15850                         ;;
15851                 esac
15852         fi
15853         ;;
15854 esac
15855 case "$i32type" in
15856 '')     if $test $intsize -ge 4; then
15857                 i32type=int
15858                 u32type="unsigned int"
15859                 i32size=$intsize
15860                 u32size=$intsize
15861         fi
15862         ;;
15863 esac
15864
15865 case "$i64type" in
15866 '')     case "$d_quad:$quadtype" in
15867         define:?*)
15868                 i64type="$quadtype"
15869                 u64type="$uquadtype"
15870                 i64size=8
15871                 u64size=8
15872                 ;;
15873         esac
15874         ;;
15875 esac
15876
15877 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15878 : volatile so that the compiler has to store it out to memory.
15879 if test X"$d_volatile" = X"$define"; then
15880         volatile=volatile
15881 fi
15882 $cat <<EOP >try.c
15883 #include <stdio.h>
15884 #$i_stdlib I_STDLIB
15885 #ifdef I_STDLIB
15886 #include <stdlib.h>
15887 #endif
15888 #include <sys/types.h>
15889 #include <signal.h>
15890 #ifdef SIGFPE
15891 $volatile int bletched = 0;
15892 $signal_t blech(int s) { bletched = 1; }
15893 #endif
15894 int main() {
15895     $uvtype u = 0;
15896     $nvtype d;
15897     int     n = 8 * $uvsize;
15898     int     i;
15899 #ifdef SIGFPE
15900     signal(SIGFPE, blech);
15901 #endif
15902
15903     for (i = 0; i < n; i++) {
15904       u = u << 1 | ($uvtype)1;
15905       d = ($nvtype)u;
15906       if (($uvtype)d != u)
15907         break;
15908       if (d <= 0)
15909         break;
15910       d = ($nvtype)(u - 1);
15911       if (($uvtype)d != (u - 1))
15912         break;
15913 #ifdef SIGFPE
15914       if (bletched)
15915         break;
15916 #endif
15917     }
15918     printf("%d\n", ((i == n) ? -n : i));
15919     exit(0);
15920 }
15921 EOP
15922 set try
15923
15924 d_nv_preserves_uv="$undef"
15925 if eval $compile; then
15926         nv_preserves_uv_bits="`$run ./try`"
15927 fi
15928 case "$nv_preserves_uv_bits" in
15929 \-[1-9]*)
15930         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15931         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15932         d_nv_preserves_uv="$define"
15933         ;;
15934 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15935         d_nv_preserves_uv="$undef" ;;
15936 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15937         nv_preserves_uv_bits="0" ;;
15938 esac
15939 $rm_try
15940
15941 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15942 : volatile so that the compiler has to store it out to memory.
15943 if test X"$d_volatile" = X"$define"; then
15944         volatile=volatile
15945 fi
15946 $cat <<EOP >try.c
15947 #include <stdio.h>
15948
15949 typedef $nvtype NV;
15950
15951 int
15952 main() {
15953   NV value = 2;
15954   int count = 1;
15955
15956   while(count < 256) {
15957     $volatile NV up = value + 1.0;
15958     $volatile NV negated = -value;
15959     $volatile NV down = negated - 1.0;
15960     $volatile NV got_up = up - value;
15961     int up_good = got_up == 1.0;
15962     int got_down = down - negated;
15963     int down_good = got_down == -1.0;
15964
15965     if (down_good != up_good) {
15966       fprintf(stderr,
15967               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15968               up_good, (double) got_up, down_good, (double) got_down,
15969               count, (double) value);
15970       return 1;
15971     }
15972     if (!up_good) {
15973       while (1) {
15974         if (count > 8) {
15975           count -= 8;
15976           fputs("256.0", stdout);
15977         } else {
15978           count--;
15979           fputs("2.0", stdout);
15980         }
15981         if (!count) {
15982           puts("");
15983           return 0;
15984         }
15985         fputs("*", stdout);
15986       }
15987     }
15988     value *= 2;
15989     ++count;
15990   }
15991   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15992           count, (double) value);
15993   return 1;
15994 }
15995 EOP
15996 set try
15997
15998 nv_overflows_integers_at='0'
15999 if eval $compile; then
16000     xxx="`$run ./try`"
16001     case "$?" in
16002         0)
16003             case "$xxx" in
16004                 2*)  cat >&4 <<EOM
16005 The largest integer your NVs can preserve is equal to $xxx
16006 EOM
16007                     nv_overflows_integers_at="$xxx"
16008                     ;;
16009                 *)  cat >&4 <<EOM
16010 Cannot determine the largest integer value your NVs can hold, unexpected output
16011 '$xxx'
16012 EOM
16013                     ;;
16014             esac
16015             ;;
16016         *)  cat >&4 <<EOM
16017 Cannot determine the largest integer value your NVs can hold
16018 EOM
16019             ;;
16020     esac
16021 fi
16022 $rm_try
16023
16024 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16025 : volatile so that the compiler has to store it out to memory.
16026 if test X"$d_volatile" = X"$define"; then
16027         volatile=volatile
16028 fi
16029 $cat <<EOP >try.c
16030 #include <stdio.h>
16031 #$i_stdlib I_STDLIB
16032 #ifdef I_STDLIB
16033 #include <stdlib.h>
16034 #endif
16035 #$i_string I_STRING
16036 #ifdef I_STRING
16037 #  include <string.h>
16038 #else
16039 #  include <strings.h>
16040 #endif
16041 #include <sys/types.h>
16042 #include <signal.h>
16043 #ifdef SIGFPE
16044 $volatile int bletched = 0;
16045 $signal_t blech(int s) { bletched = 1; }
16046 #endif
16047
16048 int checkit($nvtype d, char *where) {
16049     unsigned char *p = (char *)&d;
16050     unsigned char *end = p + sizeof(d);
16051     int fail = 0;
16052
16053     while (p < end)
16054         fail += *p++;
16055
16056     if (!fail)
16057         return 0;
16058
16059     p = (char *)&d;
16060     printf("No - %s: 0x", where);
16061     while (p < end)
16062         printf ("%02X", *p++);
16063     printf("\n");
16064     return 1;
16065 }
16066
16067 int main(int argc, char **argv) {
16068     $nvtype d = 0.0;
16069     int fail = 0;
16070     fail += checkit(d, "0.0");
16071
16072     /* The compiler shouldn't be assuming that bletched is 0  */
16073     d = bletched;
16074
16075     fail += checkit(d, "bleched");
16076
16077 #ifdef SIGFPE
16078     signal(SIGFPE, blech);
16079 #endif
16080
16081     /* Paranoia - the compiler should have no way of knowing that ANSI says
16082        that argv[argc] will always be NULL.  Actually, if it did assume this it
16083        would be buggy, as this is C and main() can be called from elsewhere in
16084        the program.  */
16085     d = argv[argc] ? 1 : 0;
16086
16087     if (d) {
16088         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16089     }
16090
16091     fail += checkit(d, "ternary");
16092
16093     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16094
16095     if (d != 0.0) {
16096         printf("No - memset doesn't give 0.0\n");
16097         /* This might just blow up:  */
16098         printf("(gives %g)\n", d);
16099         return 1;
16100     }
16101
16102 #ifdef SIGFPE
16103     if (bletched) {
16104         printf("No - something bleched\n");
16105         return 1;
16106     }
16107 #endif
16108     if (fail) {
16109       printf("No - %d fail(s)\n", fail);
16110       return 1;
16111     }
16112     printf("Yes\n");
16113     return 0;
16114 }
16115 EOP
16116 set try
16117
16118 d_nv_zero_is_allbits_zero="$undef"
16119 if eval $compile; then
16120     xxx="`$run ./try`"
16121     case "$?" in
16122         0)
16123             case "$xxx" in
16124                 Yes)  cat >&4 <<EOM
16125 0.0 is represented as all bits zero in memory
16126 EOM
16127                     d_nv_zero_is_allbits_zero="$define"
16128                     ;;
16129                 *)  cat >&4 <<EOM
16130 0.0 is not represented as all bits zero in memory
16131 EOM
16132                     d_nv_zero_is_allbits_zero="$undef"
16133                     ;;
16134             esac
16135             ;;
16136         *)  cat >&4 <<EOM
16137 0.0 is not represented as all bits zero in memory
16138 EOM
16139             d_nv_zero_is_allbits_zero="$undef"
16140             ;;
16141     esac
16142 fi
16143 $rm_try
16144
16145 : check for off64_t
16146 echo " "
16147 echo "Checking to see if you have off64_t..." >&4
16148 $cat >try.c <<EOCP
16149 #include <sys/types.h>
16150 #include <unistd.h>
16151 int main() { off64_t x = 7; }
16152 EOCP
16153 set try
16154 if eval $compile; then
16155         val="$define"
16156         echo "You have off64_t."
16157 else
16158         val="$undef"
16159         echo "You do not have off64_t."
16160         case "$lseeksize" in
16161         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16162         esac
16163 fi
16164 $rm_try
16165 set d_off64_t
16166 eval $setvar
16167
16168 : how to create joinable pthreads
16169 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16170         echo " "
16171         echo "Checking what constant to use for creating joinable pthreads..." >&4
16172         $cat >try.c <<'EOCP'
16173 #include <pthread.h>
16174 int main() {
16175     int detachstate = JOINABLE;
16176 }
16177 EOCP
16178         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16179         if eval $compile; then
16180                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16181                 val="$undef" # Yes, undef.
16182                 set d_old_pthread_create_joinable
16183                 eval $setvar
16184                 val=""
16185                 set old_pthread_create_joinable
16186                 eval $setvar
16187         else
16188                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16189                 if eval $compile; then
16190                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16191                         val="$define"
16192                         set d_old_pthread_create_joinable
16193                         eval $setvar
16194                         val=PTHREAD_CREATE_UNDETACHED
16195                         set old_pthread_create_joinable
16196                         eval $setvar
16197                 else
16198                         set try -DJOINABLE=__UNDETACHED
16199                         if eval $compile; then
16200                                 echo "You seem to use __UNDETACHED." >&4
16201                                 val="$define"
16202                                 set d_old_pthread_create_joinable
16203                                 eval $setvar
16204                                 val=__UNDETACHED
16205                                 set old_pthread_create_joinable
16206                                 eval $setvar
16207                         else
16208                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16209                                 val="$define"
16210                                 set d_old_pthread_create_joinable
16211                                 eval $setvar
16212                                 val=0
16213                                 set old_pthread_create_joinable
16214                                 eval $setvar
16215                         fi
16216                 fi
16217         fi
16218         $rm_try
16219 else
16220     d_old_pthread_create_joinable="$undef"
16221     old_pthread_create_joinable=""
16222 fi
16223
16224 : see if pause exists
16225 set pause d_pause
16226 eval $inlibc
16227
16228 : see if poll exists
16229 set poll d_poll
16230 eval $inlibc
16231
16232 : see if prctl exists
16233 set prctl d_prctl
16234 eval $inlibc
16235
16236 : see if prctl supports PR_SET_NAME
16237 d_prctl_set_name=$undef
16238 case $d_prctl in
16239     $define)
16240         $cat >try.c <<EOM
16241 #include <sys/prctl.h>
16242
16243 int main (int argc, char *argv[])
16244 {
16245     return (prctl (PR_SET_NAME, "Test"));
16246     } /* main */
16247 EOM
16248         set try
16249         if eval $compile_ok && $run ./try; then
16250             echo "Your prctl (PR_SET_NAME, ...) works"
16251             d_prctl_set_name=$define
16252             fi
16253         $rm_try
16254         ;;
16255     esac
16256
16257 : see if readlink exists
16258 set readlink d_readlink
16259 eval $inlibc
16260
16261 : Check if exe is symlink to abs path of executing program
16262 echo " "
16263 procselfexe=''
16264 val="$undef"
16265 case "$d_readlink" in
16266     "$define")
16267         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16268         : more tidy to avoid an extra level of symlink
16269         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16270         while test $# -gt 0; do
16271             type=$1; try=$2
16272             shift; shift
16273             if $issymlink $try; then
16274                 $ls -l $try > reflect
16275                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16276                     echo "You have $type-like $try."
16277                     procselfexe='"'$try'"'
16278                     val="$define"
16279                     : This will break out of the loop
16280                     set X; shift
16281                 fi
16282             fi
16283         done
16284         ;;
16285 esac
16286 $rm -f reflect
16287 set d_procselfexe
16288 eval $setvar
16289
16290 : backward compatibility for d_hvfork
16291 if test X$d_hvfork != X; then
16292         d_vfork="$d_hvfork"
16293         d_hvfork=''
16294 fi
16295 : see if there is a vfork
16296 val=''
16297 set vfork val
16298 eval $inlibc
16299
16300 d_pseudofork=$undef
16301
16302 : Ok, but do we want to use it. vfork is reportedly unreliable in
16303 : perl on Solaris 2.x, and probably elsewhere.
16304 case "$val" in
16305 $define)
16306         echo " "
16307         case "$usevfork" in
16308         false) dflt='n';;
16309         *) dflt='y';;
16310         esac
16311         cat <<'EOM'
16312
16313 Perl can only use a vfork() that doesn't suffer from strict
16314 restrictions on calling functions or modifying global data in
16315 the child.  For example, glibc-2.1 contains such a vfork()
16316 that is unsuitable.  If your system provides a proper fork()
16317 call, chances are that you do NOT want perl to use vfork().
16318
16319 EOM
16320         rp="Do you still want to use vfork()?"
16321         . ./myread
16322         case "$ans" in
16323         y|Y) ;;
16324         *)
16325                 echo "Ok, we won't use vfork()."
16326                 val="$undef"
16327                 ;;
16328         esac
16329         ;;
16330 esac
16331 set d_vfork
16332 eval $setvar
16333 case "$d_vfork" in
16334 $define) usevfork='true';;
16335 *) usevfork='false';;
16336 esac
16337
16338 : see whether the pthread_atfork exists
16339 $cat >try.c <<EOP
16340 #include <pthread.h>
16341 #include <stdio.h>
16342 int main() {
16343 #ifdef  PTHREAD_ATFORK
16344         pthread_atfork(NULL,NULL,NULL);
16345 #endif
16346 }
16347 EOP
16348
16349 : see if pthread_atfork exists
16350 set try -DPTHREAD_ATFORK
16351 if eval $compile; then
16352     val="$define"
16353 else
16354     val="$undef"
16355 fi
16356 case "$usethreads" in
16357 $define)
16358         case "$val" in
16359         $define) echo 'pthread_atfork found.' >&4        ;;
16360         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16361         esac
16362 esac
16363 set d_pthread_atfork
16364 eval $setvar
16365
16366 : see if pthread_attr_setscope exists
16367 set pthread_attr_setscope d_pthread_attr_setscope
16368 eval $inlibc
16369
16370 : see whether the various POSIXish _yields exist
16371 $cat >try.c <<EOP
16372 #include <pthread.h>
16373 #include <stdio.h>
16374 int main() {
16375 #ifdef SCHED_YIELD
16376         sched_yield();
16377 #else
16378 #ifdef PTHREAD_YIELD
16379         pthread_yield();
16380 #else
16381 #ifdef PTHREAD_YIELD_NULL
16382         pthread_yield(NULL);
16383 #endif
16384 #endif
16385 #endif
16386 }
16387 EOP
16388 : see if sched_yield exists
16389 set try -DSCHED_YIELD
16390 if eval $compile; then
16391     val="$define"
16392     sched_yield='sched_yield()'
16393 else
16394     val="$undef"
16395 fi
16396 case "$usethreads" in
16397 $define)
16398         case "$val" in
16399         $define) echo 'sched_yield() found.' >&4        ;;
16400         *)       echo 'sched_yield() NOT found.' >&4    ;;
16401         esac
16402 esac
16403 set d_sched_yield
16404 eval $setvar
16405
16406 : see if pthread_yield exists
16407 set try -DPTHREAD_YIELD
16408 if eval $compile; then
16409     val="$define"
16410     case "$sched_yield" in
16411     '') sched_yield='pthread_yield()' ;;
16412     esac
16413 else
16414     set try -DPTHREAD_YIELD_NULL
16415     if eval $compile; then
16416         val="$define"
16417         case "$sched_yield" in
16418         '') sched_yield='pthread_yield(NULL)' ;;
16419         esac
16420     else
16421         val="$undef"
16422     fi
16423 fi
16424 case "$usethreads" in
16425 $define)
16426         case "$val" in
16427         $define) echo 'pthread_yield() found.' >&4      ;;
16428         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16429         esac
16430         ;;
16431 esac
16432 set d_pthread_yield
16433 eval $setvar
16434 case "$sched_yield" in
16435 '') sched_yield=undef ;;
16436 esac
16437 $rm_try
16438
16439 : see if random_r exists
16440 set random_r d_random_r
16441 eval $inlibc
16442 case "$d_random_r" in
16443 "$define")
16444         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16445         case "$d_random_r_proto:$usethreads" in
16446         ":define")      d_random_r_proto=define
16447                 set d_random_r_proto random_r $hdrs
16448                 eval $hasproto ;;
16449         *)      ;;
16450         esac
16451         case "$d_random_r_proto" in
16452         define)
16453         case "$random_r_proto" in
16454         ''|0) try='int random_r(int*, struct random_data*);'
16455         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16456         esac
16457         case "$random_r_proto" in
16458         ''|0) try='int random_r(long*, struct random_data*);'
16459         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16460         esac
16461         case "$random_r_proto" in
16462         ''|0) try='int random_r(struct random_data*, int32_t*);'
16463         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16464         esac
16465         case "$random_r_proto" in
16466         ''|0)   d_random_r=undef
16467                 random_r_proto=0
16468                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16469         * )     case "$random_r_proto" in
16470                 REENTRANT_PROTO*) ;;
16471                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16472                 esac
16473                 echo "Prototype: $try" ;;
16474         esac
16475         ;;
16476         *)      case "$usethreads" in
16477                 define) echo "random_r has no prototype, not using it." >&4 ;;
16478                 esac
16479                 d_random_r=undef
16480                 random_r_proto=0
16481                 ;;
16482         esac
16483         ;;
16484 *)      random_r_proto=0
16485         ;;
16486 esac
16487
16488 : see if readdir and friends exist
16489 set readdir d_readdir
16490 eval $inlibc
16491 set seekdir d_seekdir
16492 eval $inlibc
16493 set telldir d_telldir
16494 eval $inlibc
16495 set rewinddir d_rewinddir
16496 eval $inlibc
16497
16498 : see if readdir64_r exists
16499 set readdir64_r d_readdir64_r
16500 eval $inlibc
16501 case "$d_readdir64_r" in
16502 "$define")
16503         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16504         case "$d_readdir64_r_proto:$usethreads" in
16505         ":define")      d_readdir64_r_proto=define
16506                 set d_readdir64_r_proto readdir64_r $hdrs
16507                 eval $hasproto ;;
16508         *)      ;;
16509         esac
16510         case "$d_readdir64_r_proto" in
16511         define)
16512         case "$readdir64_r_proto" in
16513         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16514         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16515         esac
16516         case "$readdir64_r_proto" in
16517         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16518         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16519         esac
16520         case "$readdir64_r_proto" in
16521         ''|0)   d_readdir64_r=undef
16522                 readdir64_r_proto=0
16523                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16524         * )     case "$readdir64_r_proto" in
16525                 REENTRANT_PROTO*) ;;
16526                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16527                 esac
16528                 echo "Prototype: $try" ;;
16529         esac
16530         ;;
16531         *)      case "$usethreads" in
16532                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16533                 esac
16534                 d_readdir64_r=undef
16535                 readdir64_r_proto=0
16536                 ;;
16537         esac
16538         ;;
16539 *)      readdir64_r_proto=0
16540         ;;
16541 esac
16542
16543 : see if readdir_r exists
16544 set readdir_r d_readdir_r
16545 eval $inlibc
16546 case "$d_readdir_r" in
16547 "$define")
16548         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16549         case "$d_readdir_r_proto:$usethreads" in
16550         ":define")      d_readdir_r_proto=define
16551                 set d_readdir_r_proto readdir_r $hdrs
16552                 eval $hasproto ;;
16553         *)      ;;
16554         esac
16555         case "$d_readdir_r_proto" in
16556         define)
16557         case "$readdir_r_proto" in
16558         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16559         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16560         esac
16561         case "$readdir_r_proto" in
16562         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16563         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16564         esac
16565         case "$readdir_r_proto" in
16566         ''|0)   d_readdir_r=undef
16567                 readdir_r_proto=0
16568                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16569         * )     case "$readdir_r_proto" in
16570                 REENTRANT_PROTO*) ;;
16571                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16572                 esac
16573                 echo "Prototype: $try" ;;
16574         esac
16575         ;;
16576         *)      case "$usethreads" in
16577                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16578                 esac
16579                 d_readdir_r=undef
16580                 readdir_r_proto=0
16581                 ;;
16582         esac
16583         ;;
16584 *)      readdir_r_proto=0
16585         ;;
16586 esac
16587
16588 : see if readv exists
16589 set readv d_readv
16590 eval $inlibc
16591
16592 : see if recvmsg exists
16593 set recvmsg d_recvmsg
16594 eval $inlibc
16595
16596 : see if rename exists
16597 set rename d_rename
16598 eval $inlibc
16599
16600 : see if rmdir exists
16601 set rmdir d_rmdir
16602 eval $inlibc
16603
16604 : see if memory.h is available.
16605 val=''
16606 set memory.h val
16607 eval $inhdr
16608
16609 : See if it conflicts with string.h
16610 case "$val" in
16611 $define)
16612         case "$strings" in
16613         '') ;;
16614         *)
16615                 $cppstdin $cppflags $cppminus < $strings > mem.h
16616                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16617                         echo " "
16618                         echo "We won't be including <memory.h>."
16619                         val="$undef"
16620                 fi
16621                 $rm -f mem.h
16622                 ;;
16623         esac
16624 esac
16625 set i_memory
16626 eval $setvar
16627
16628 : can bcopy handle overlapping blocks?
16629 echo " "
16630 val="$undef"
16631 case "$d_memmove" in
16632 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16633 *)      case "$d_bcopy" in
16634         "$define")
16635                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16636                 $cat >try.c <<EOCP
16637 #$i_memory I_MEMORY
16638 #$i_stdlib I_STDLIB
16639 #$i_string I_STRING
16640 #$i_unistd I_UNISTD
16641 EOCP
16642         $cat >>try.c <<'EOCP'
16643 #include <stdio.h>
16644 #ifdef I_MEMORY
16645 #  include <memory.h>
16646 #endif
16647 #ifdef I_STDLIB
16648 #  include <stdlib.h>
16649 #endif
16650 #ifdef I_STRING
16651 #  include <string.h>
16652 #else
16653 #  include <strings.h>
16654 #endif
16655 #ifdef I_UNISTD
16656 #  include <unistd.h>  /* Needed for NetBSD */
16657 #endif
16658 int main()
16659 {
16660 char buf[128], abc[128];
16661 char *b;
16662 int len;
16663 int off;
16664 int align;
16665
16666 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16667    try to store the string in read-only memory. */
16668 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16669
16670 for (align = 7; align >= 0; align--) {
16671         for (len = 36; len; len--) {
16672                 b = buf+align;
16673                 bcopy(abc, b, len);
16674                 for (off = 1; off <= len; off++) {
16675                         bcopy(b, b+off, len);
16676                         bcopy(b+off, b, len);
16677                         if (bcmp(b, abc, len))
16678                                 exit(1);
16679                 }
16680         }
16681 }
16682 exit(0);
16683 }
16684 EOCP
16685                 set try
16686                 if eval $compile_ok; then
16687                         if $run ./try 2>/dev/null; then
16688                                 echo "Yes, it can."
16689                                 val="$define"
16690                         else
16691                                 echo "It can't, sorry."
16692                         fi
16693                 else
16694                         echo "(I can't compile the test program, so we'll assume not...)"
16695                 fi
16696                 ;;
16697         esac
16698         $rm_try
16699         ;;
16700 esac
16701 set d_safebcpy
16702 eval $setvar
16703
16704 : can memcpy handle overlapping blocks?
16705 echo " "
16706 val="$undef"
16707 case "$d_memmove" in
16708 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16709 *)      case "$d_memcpy" in
16710         "$define")
16711                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16712                 $cat >try.c <<EOCP
16713 #$i_memory I_MEMORY
16714 #$i_stdlib I_STDLIB
16715 #$i_string I_STRING
16716 #$i_unistd I_UNISTD
16717 EOCP
16718         $cat >>try.c <<'EOCP'
16719 #include <stdio.h>
16720 #ifdef I_MEMORY
16721 #  include <memory.h>
16722 #endif
16723 #ifdef I_STDLIB
16724 #  include <stdlib.h>
16725 #endif
16726 #ifdef I_STRING
16727 #  include <string.h>
16728 #else
16729 #  include <strings.h>
16730 #endif
16731 #ifdef I_UNISTD
16732 #  include <unistd.h>  /* Needed for NetBSD */
16733 #endif
16734 int main()
16735 {
16736 char buf[128], abc[128];
16737 char *b;
16738 int len;
16739 int off;
16740 int align;
16741
16742 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16743    try to store the string in read-only memory. */
16744 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16745
16746 for (align = 7; align >= 0; align--) {
16747         for (len = 36; len; len--) {
16748                 b = buf+align;
16749                 memcpy(b, abc, len);
16750                 for (off = 1; off <= len; off++) {
16751                         memcpy(b+off, b, len);
16752                         memcpy(b, b+off, len);
16753                         if (memcmp(b, abc, len))
16754                                 exit(1);
16755                 }
16756         }
16757 }
16758 exit(0);
16759 }
16760 EOCP
16761                 set try
16762                 if eval $compile_ok; then
16763                         if $run ./try 2>/dev/null; then
16764                                 echo "Yes, it can."
16765                                 val="$define"
16766                         else
16767                                 echo "It can't, sorry."
16768                         fi
16769                 else
16770                         echo "(I can't compile the test program, so we'll assume not...)"
16771                 fi
16772                 ;;
16773         esac
16774         $rm_try
16775         ;;
16776 esac
16777 set d_safemcpy
16778 eval $setvar
16779
16780 : can memcmp be trusted to compare relative magnitude?
16781 val="$undef"
16782 case "$d_memcmp" in
16783 "$define")
16784         echo " "
16785         echo "Checking if your memcmp() can compare relative magnitude..." >&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 a = -1;
16811 char b = 0;
16812 if ((a < b) && memcmp(&a, &b, 1) < 0)
16813         exit(1);
16814 exit(0);
16815 }
16816 EOCP
16817         set try
16818         if eval $compile_ok; then
16819                 if $run ./try 2>/dev/null; then
16820                         echo "Yes, it can."
16821                         val="$define"
16822                 else
16823                         echo "No, it can't (it uses signed chars)."
16824                 fi
16825         else
16826                 echo "(I can't compile the test program, so we'll assume not...)"
16827         fi
16828         ;;
16829 esac
16830 $rm_try
16831 set d_sanemcmp
16832 eval $setvar
16833
16834 : see if prototype for sbrk is available
16835 echo " "
16836 set d_sbrkproto sbrk $i_unistd unistd.h
16837 eval $hasproto
16838
16839 : see if select exists
16840 set select d_select
16841 eval $inlibc
16842
16843 : see if semctl exists
16844 set semctl d_semctl
16845 eval $inlibc
16846
16847 : see if semget exists
16848 set semget d_semget
16849 eval $inlibc
16850
16851 : see if semop exists
16852 set semop d_semop
16853 eval $inlibc
16854
16855 : see how much of the 'sem*(2)' library is present.
16856 h_sem=true
16857 echo " "
16858 case "$d_semctl$d_semget$d_semop" in
16859 *"$undef"*) h_sem=false;;
16860 esac
16861 case "$osname" in
16862 freebsd)
16863     case "`ipcs 2>&1`" in
16864     "SVID messages"*"not configured"*)
16865         echo "Your $osname does not have the sem*(2) configured." >&4
16866         h_sem=false
16867         val="$undef"
16868         set semctl d_semctl
16869         eval $setvar
16870         set semget d_semget
16871         eval $setvar
16872         set semop d_semop
16873         eval $setvar
16874         ;;
16875     esac
16876     ;;
16877 esac
16878 : we could also check for sys/ipc.h ...
16879 if $h_sem && $test `./findhdr sys/sem.h`; then
16880         echo "You have the full sem*(2) library." >&4
16881         val="$define"
16882 else
16883         echo "You don't have the full sem*(2) library." >&4
16884         val="$undef"
16885 fi
16886 set d_sem
16887 eval $setvar
16888
16889 : see whether sys/sem.h defines union semun
16890 echo " "
16891 $cat > try.c <<'END'
16892 #include <sys/types.h>
16893 #include <sys/ipc.h>
16894 #include <sys/sem.h>
16895 int main () { union semun semun; semun.buf = 0; }
16896 END
16897 set try
16898 if eval $compile; then
16899     echo "You have union semun in <sys/sem.h>." >&4
16900     val="$define"
16901 else
16902     echo "You do not have union semun in <sys/sem.h>." >&4
16903     val="$undef"
16904 fi
16905 $rm_try
16906 set d_union_semun
16907 eval $setvar
16908
16909 : see how to do semctl IPC_STAT
16910 case "$d_sem" in
16911 $define)
16912     echo " "
16913     $cat > tryh.h <<END
16914 #ifndef S_IRUSR
16915 #   ifdef S_IREAD
16916 #       define S_IRUSR S_IREAD
16917 #       define S_IWUSR S_IWRITE
16918 #       define S_IXUSR S_IEXEC
16919 #   else
16920 #       define S_IRUSR 0400
16921 #       define S_IWUSR 0200
16922 #       define S_IXUSR 0100
16923 #   endif
16924 #   define S_IRGRP (S_IRUSR>>3)
16925 #   define S_IWGRP (S_IWUSR>>3)
16926 #   define S_IXGRP (S_IXUSR>>3)
16927 #   define S_IROTH (S_IRUSR>>6)
16928 #   define S_IWOTH (S_IWUSR>>6)
16929 #   define S_IXOTH (S_IXUSR>>6)
16930 #endif
16931 #ifndef S_IRWXU
16932 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16933 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16934 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16935 #endif
16936 END
16937     : see whether semctl IPC_STAT can use union semun
16938     case "$d_semctl_semun" in
16939     '')
16940       val="$undef"
16941       $cat > try.c <<END
16942 #include <sys/types.h>
16943 #include <sys/ipc.h>
16944 #include <sys/sem.h>
16945 #include <sys/stat.h>
16946 #include <stdio.h>
16947 #include <errno.h>
16948 #include "tryh.h"
16949 #ifndef errno
16950 extern int errno;
16951 #endif
16952 #$d_union_semun HAS_UNION_SEMUN
16953 int main() {
16954     union semun
16955 #ifndef HAS_UNION_SEMUN
16956     {
16957         int val;
16958         struct semid_ds *buf;
16959         unsigned short *array;
16960     }
16961 #endif
16962     arg;
16963     int sem, st;
16964
16965 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16966     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16967     if (sem > -1) {
16968         struct semid_ds argbuf;
16969         arg.buf = &argbuf;
16970 #       ifdef IPC_STAT
16971         st = semctl(sem, 0, IPC_STAT, arg);
16972         if (st == 0)
16973             printf("semun\n");
16974         else
16975 #       endif /* IPC_STAT */
16976             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16977 #       ifdef IPC_RMID
16978         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16979 #       endif /* IPC_RMID */
16980             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16981     } else
16982 #endif /* IPC_PRIVATE && ... */
16983         printf("semget failed: errno = %d\n", errno);
16984   return 0;
16985 }
16986 END
16987       set try
16988       if eval $compile; then
16989           xxx=`$run ./try`
16990           case "$xxx" in
16991           semun) val="$define" ;;
16992           esac
16993       fi
16994       $rm_try
16995       set d_semctl_semun
16996       eval $setvar
16997       ;;
16998     esac
16999     case "$d_semctl_semun" in
17000     $define)
17001         echo "You can use union semun for semctl IPC_STAT." >&4
17002         also='also'
17003         ;;
17004     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17005         also=''
17006         ;;
17007     esac
17008
17009     : see whether semctl IPC_STAT can use struct semid_ds pointer
17010     case "$d_semctl_semid_ds" in
17011     '')
17012       val="$undef"
17013       $cat > try.c <<'END'
17014 #include <sys/types.h>
17015 #include <sys/ipc.h>
17016 #include <sys/sem.h>
17017 #include <sys/stat.h>
17018 #include "tryh.h"
17019 #include <stdio.h>
17020 #include <errno.h>
17021 #ifndef errno
17022 extern int errno;
17023 #endif
17024 int main() {
17025     struct semid_ds arg;
17026     int sem, st;
17027
17028 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17029     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17030     if (sem > -1) {
17031 #       ifdef IPC_STAT
17032         st = semctl(sem, 0, IPC_STAT, &arg);
17033         if (st == 0)
17034             printf("semid_ds\n");
17035         else
17036 #       endif /* IPC_STAT */
17037             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17038 #       ifdef IPC_RMID
17039         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17040 #       endif /* IPC_RMID */
17041             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17042     } else
17043 #endif /* IPC_PRIVATE && ... */
17044         printf("semget failed: errno = %d\n", errno);
17045
17046     return 0;
17047 }
17048 END
17049       set try
17050       if eval $compile; then
17051           xxx=`$run ./try`
17052           case "$xxx" in
17053           semid_ds) val="$define" ;;
17054           esac
17055       fi
17056       $rm_try
17057       set d_semctl_semid_ds
17058       eval $setvar
17059       ;;
17060     esac
17061     case "$d_semctl_semid_ds" in
17062     $define)
17063         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17064         ;;
17065     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17066         ;;
17067     esac
17068     ;;
17069 *)  val="$undef"
17070
17071     # We do not have the full sem*(2) library, so assume we can not
17072     # use either.
17073
17074     set d_semctl_semun
17075     eval $setvar
17076
17077     set d_semctl_semid_ds
17078     eval $setvar
17079     ;;
17080 esac
17081 $rm_try tryh.h
17082
17083 : see if sendmsg exists
17084 set sendmsg d_sendmsg
17085 eval $inlibc
17086
17087 : see if setegid exists
17088 set setegid d_setegid
17089 eval $inlibc
17090
17091 : see if seteuid exists
17092 set seteuid d_seteuid
17093 eval $inlibc
17094
17095 : see if setgrent exists
17096 set setgrent d_setgrent
17097 eval $inlibc
17098
17099 : see if setgrent_r exists
17100 set setgrent_r d_setgrent_r
17101 eval $inlibc
17102 case "$d_setgrent_r" in
17103 "$define")
17104         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17105         case "$d_setgrent_r_proto:$usethreads" in
17106         ":define")      d_setgrent_r_proto=define
17107                 set d_setgrent_r_proto setgrent_r $hdrs
17108                 eval $hasproto ;;
17109         *)      ;;
17110         esac
17111         case "$d_setgrent_r_proto" in
17112         define)
17113         case "$setgrent_r_proto" in
17114         ''|0) try='int setgrent_r(FILE**);'
17115         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17116         esac
17117         case "$setgrent_r_proto" in
17118         ''|0) try='void setgrent_r(FILE**);'
17119         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17120         esac
17121         case "$setgrent_r_proto" in
17122         ''|0)   d_setgrent_r=undef
17123                 setgrent_r_proto=0
17124                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17125         * )     case "$setgrent_r_proto" in
17126                 REENTRANT_PROTO*) ;;
17127                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17128                 esac
17129                 echo "Prototype: $try" ;;
17130         esac
17131         ;;
17132         *)      case "$usethreads" in
17133                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17134                 esac
17135                 d_setgrent_r=undef
17136                 setgrent_r_proto=0
17137                 ;;
17138         esac
17139         ;;
17140 *)      setgrent_r_proto=0
17141         ;;
17142 esac
17143
17144 : see if sethostent exists
17145 set sethostent d_sethent
17146 eval $inlibc
17147
17148 : see if sethostent_r exists
17149 set sethostent_r d_sethostent_r
17150 eval $inlibc
17151 case "$d_sethostent_r" in
17152 "$define")
17153         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17154         case "$d_sethostent_r_proto:$usethreads" in
17155         ":define")      d_sethostent_r_proto=define
17156                 set d_sethostent_r_proto sethostent_r $hdrs
17157                 eval $hasproto ;;
17158         *)      ;;
17159         esac
17160         case "$d_sethostent_r_proto" in
17161         define)
17162         case "$sethostent_r_proto" in
17163         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17164         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17165         esac
17166         case "$sethostent_r_proto" in
17167         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17168         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17169         esac
17170         case "$sethostent_r_proto" in
17171         ''|0)   d_sethostent_r=undef
17172                 sethostent_r_proto=0
17173                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17174         * )     case "$sethostent_r_proto" in
17175                 REENTRANT_PROTO*) ;;
17176                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17177                 esac
17178                 echo "Prototype: $try" ;;
17179         esac
17180         ;;
17181         *)      case "$usethreads" in
17182                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17183                 esac
17184                 d_sethostent_r=undef
17185                 sethostent_r_proto=0
17186                 ;;
17187         esac
17188         ;;
17189 *)      sethostent_r_proto=0
17190         ;;
17191 esac
17192
17193 : see if setitimer exists
17194 set setitimer d_setitimer
17195 eval $inlibc
17196
17197 : see if setlinebuf exists
17198 set setlinebuf d_setlinebuf
17199 eval $inlibc
17200
17201 : see if setlocale exists
17202 set setlocale d_setlocale
17203 eval $inlibc
17204
17205 : see if locale.h is available
17206 set locale.h i_locale
17207 eval $inhdr
17208
17209 : see if setlocale_r exists
17210 set setlocale_r d_setlocale_r
17211 eval $inlibc
17212 case "$d_setlocale_r" in
17213 "$define")
17214         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17215         case "$d_setlocale_r_proto:$usethreads" in
17216         ":define")      d_setlocale_r_proto=define
17217                 set d_setlocale_r_proto setlocale_r $hdrs
17218                 eval $hasproto ;;
17219         *)      ;;
17220         esac
17221         case "$d_setlocale_r_proto" in
17222         define)
17223         case "$setlocale_r_proto" in
17224         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17225         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17226         esac
17227         case "$setlocale_r_proto" in
17228         ''|0)   d_setlocale_r=undef
17229                 setlocale_r_proto=0
17230                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17231         * )     case "$setlocale_r_proto" in
17232                 REENTRANT_PROTO*) ;;
17233                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17234                 esac
17235                 echo "Prototype: $try" ;;
17236         esac
17237         ;;
17238         *)      case "$usethreads" in
17239                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17240                 esac
17241                 d_setlocale_r=undef
17242                 setlocale_r_proto=0
17243                 ;;
17244         esac
17245         ;;
17246 *)      setlocale_r_proto=0
17247         ;;
17248 esac
17249
17250 : see if setnetent exists
17251 set setnetent d_setnent
17252 eval $inlibc
17253
17254 : see if setnetent_r exists
17255 set setnetent_r d_setnetent_r
17256 eval $inlibc
17257 case "$d_setnetent_r" in
17258 "$define")
17259         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17260         case "$d_setnetent_r_proto:$usethreads" in
17261         ":define")      d_setnetent_r_proto=define
17262                 set d_setnetent_r_proto setnetent_r $hdrs
17263                 eval $hasproto ;;
17264         *)      ;;
17265         esac
17266         case "$d_setnetent_r_proto" in
17267         define)
17268         case "$setnetent_r_proto" in
17269         ''|0) try='int setnetent_r(int, struct netent_data*);'
17270         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17271         esac
17272         case "$setnetent_r_proto" in
17273         ''|0) try='void setnetent_r(int, struct netent_data*);'
17274         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17275         esac
17276         case "$setnetent_r_proto" in
17277         ''|0)   d_setnetent_r=undef
17278                 setnetent_r_proto=0
17279                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17280         * )     case "$setnetent_r_proto" in
17281                 REENTRANT_PROTO*) ;;
17282                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17283                 esac
17284                 echo "Prototype: $try" ;;
17285         esac
17286         ;;
17287         *)      case "$usethreads" in
17288                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17289                 esac
17290                 d_setnetent_r=undef
17291                 setnetent_r_proto=0
17292                 ;;
17293         esac
17294         ;;
17295 *)      setnetent_r_proto=0
17296         ;;
17297 esac
17298
17299 : see if setprotoent exists
17300 set setprotoent d_setpent
17301 eval $inlibc
17302
17303 : see if setpgid exists
17304 set setpgid d_setpgid
17305 eval $inlibc
17306
17307 : see if setpgrp2 exists
17308 set setpgrp2 d_setpgrp2
17309 eval $inlibc
17310
17311 : see if setpriority exists
17312 set setpriority d_setprior
17313 eval $inlibc
17314
17315 : see if setproctitle exists
17316 set setproctitle d_setproctitle
17317 eval $inlibc
17318
17319 : see if setprotoent_r exists
17320 set setprotoent_r d_setprotoent_r
17321 eval $inlibc
17322 case "$d_setprotoent_r" in
17323 "$define")
17324         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17325         case "$d_setprotoent_r_proto:$usethreads" in
17326         ":define")      d_setprotoent_r_proto=define
17327                 set d_setprotoent_r_proto setprotoent_r $hdrs
17328                 eval $hasproto ;;
17329         *)      ;;
17330         esac
17331         case "$d_setprotoent_r_proto" in
17332         define)
17333         case "$setprotoent_r_proto" in
17334         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17335         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17336         esac
17337         case "$setprotoent_r_proto" in
17338         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17339         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17340         esac
17341         case "$setprotoent_r_proto" in
17342         ''|0)   d_setprotoent_r=undef
17343                 setprotoent_r_proto=0
17344                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17345         * )     case "$setprotoent_r_proto" in
17346                 REENTRANT_PROTO*) ;;
17347                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17348                 esac
17349                 echo "Prototype: $try" ;;
17350         esac
17351         ;;
17352         *)      case "$usethreads" in
17353                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17354                 esac
17355                 d_setprotoent_r=undef
17356                 setprotoent_r_proto=0
17357                 ;;
17358         esac
17359         ;;
17360 *)      setprotoent_r_proto=0
17361         ;;
17362 esac
17363
17364 : see if setpwent exists
17365 set setpwent d_setpwent
17366 eval $inlibc
17367
17368 : see if setpwent_r exists
17369 set setpwent_r d_setpwent_r
17370 eval $inlibc
17371 case "$d_setpwent_r" in
17372 "$define")
17373         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17374         case "$d_setpwent_r_proto:$usethreads" in
17375         ":define")      d_setpwent_r_proto=define
17376                 set d_setpwent_r_proto setpwent_r $hdrs
17377                 eval $hasproto ;;
17378         *)      ;;
17379         esac
17380         case "$d_setpwent_r_proto" in
17381         define)
17382         case "$setpwent_r_proto" in
17383         ''|0) try='int setpwent_r(FILE**);'
17384         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17385         esac
17386         case "$setpwent_r_proto" in
17387         ''|0) try='void setpwent_r(FILE**);'
17388         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17389         esac
17390         case "$setpwent_r_proto" in
17391         ''|0)   d_setpwent_r=undef
17392                 setpwent_r_proto=0
17393                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17394         * )     case "$setpwent_r_proto" in
17395                 REENTRANT_PROTO*) ;;
17396                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17397                 esac
17398                 echo "Prototype: $try" ;;
17399         esac
17400         ;;
17401         *)      case "$usethreads" in
17402                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17403                 esac
17404                 d_setpwent_r=undef
17405                 setpwent_r_proto=0
17406                 ;;
17407         esac
17408         ;;
17409 *)      setpwent_r_proto=0
17410         ;;
17411 esac
17412
17413 : see if setregid exists
17414 set setregid d_setregid
17415 eval $inlibc
17416 set setresgid d_setresgid
17417 eval $inlibc
17418
17419 : see if setreuid exists
17420 set setreuid d_setreuid
17421 eval $inlibc
17422 set setresuid d_setresuid
17423 eval $inlibc
17424
17425 : see if setrgid exists
17426 set setrgid d_setrgid
17427 eval $inlibc
17428
17429 : see if setruid exists
17430 set setruid d_setruid
17431 eval $inlibc
17432
17433 : see if setservent exists
17434 set setservent d_setsent
17435 eval $inlibc
17436
17437 : see if setservent_r exists
17438 set setservent_r d_setservent_r
17439 eval $inlibc
17440 case "$d_setservent_r" in
17441 "$define")
17442         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17443         case "$d_setservent_r_proto:$usethreads" in
17444         ":define")      d_setservent_r_proto=define
17445                 set d_setservent_r_proto setservent_r $hdrs
17446                 eval $hasproto ;;
17447         *)      ;;
17448         esac
17449         case "$d_setservent_r_proto" in
17450         define)
17451         case "$setservent_r_proto" in
17452         ''|0) try='int setservent_r(int, struct servent_data*);'
17453         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17454         esac
17455         case "$setservent_r_proto" in
17456         ''|0) try='void setservent_r(int, struct servent_data*);'
17457         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17458         esac
17459         case "$setservent_r_proto" in
17460         ''|0)   d_setservent_r=undef
17461                 setservent_r_proto=0
17462                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17463         * )     case "$setservent_r_proto" in
17464                 REENTRANT_PROTO*) ;;
17465                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17466                 esac
17467                 echo "Prototype: $try" ;;
17468         esac
17469         ;;
17470         *)      case "$usethreads" in
17471                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17472                 esac
17473                 d_setservent_r=undef
17474                 setservent_r_proto=0
17475                 ;;
17476         esac
17477         ;;
17478 *)      setservent_r_proto=0
17479         ;;
17480 esac
17481
17482 : see if setsid exists
17483 set setsid d_setsid
17484 eval $inlibc
17485
17486 : see if setvbuf exists
17487 set setvbuf d_setvbuf
17488 eval $inlibc
17489
17490 : see if sfio.h is available
17491 set sfio.h i_sfio
17492 eval $inhdr
17493
17494 : see if sfio library is available
17495 case "$i_sfio" in
17496 $define)
17497         val=''
17498         set sfreserve val
17499         eval $inlibc
17500         ;;
17501 *)
17502         val="$undef"
17503         ;;
17504 esac
17505 : Ok, but do we want to use it.
17506 case "$val" in
17507 $define)
17508         case "$usesfio" in
17509         true|$define|[yY]*) dflt='y';;
17510         *) dflt='n';;
17511         esac
17512         echo "$package can use the sfio library, but it is experimental."
17513         rp="You seem to have sfio available, do you want to try using it?"
17514         . ./myread
17515         case "$ans" in
17516         y|Y)    echo "Ok, turning on sfio then."
17517                 val="$define"
17518                 ;;
17519         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17520                 val="$undef"
17521                 ;;
17522         esac
17523         ;;
17524 *)      case "$usesfio" in
17525         true|$define|[yY]*)
17526                 echo "Sorry, cannot find sfio on this machine." >&4
17527                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17528                 val="$undef"
17529                 ;;
17530         esac
17531         ;;
17532 esac
17533 set d_sfio
17534 eval $setvar
17535 case "$d_sfio" in
17536 $define) usesfio='true';;
17537 *) usesfio='false';;
17538 esac
17539 case "$d_sfio" in
17540 $define) ;;
17541 *)      : Remove sfio from list of libraries to use
17542         case "$libs" in
17543         *-lsfio*)
17544                 echo "Removing unneeded -lsfio from library list" >&4
17545                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17546                 shift
17547                 libs="$*"
17548                 echo "libs = $libs" >&4
17549                 ;;
17550         esac
17551 ;;
17552 esac
17553
17554
17555 : see if shmctl exists
17556 set shmctl d_shmctl
17557 eval $inlibc
17558
17559 : see if shmget exists
17560 set shmget d_shmget
17561 eval $inlibc
17562
17563 : see if shmat exists
17564 set shmat d_shmat
17565 eval $inlibc
17566 : see what shmat returns
17567 case "$d_shmat" in
17568 "$define")
17569         $cat >shmat.c <<'END'
17570 #include <sys/shm.h>
17571 void *shmat();
17572 END
17573         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17574                 shmattype='void *'
17575         else
17576                 shmattype='char *'
17577         fi
17578         echo "and it returns ($shmattype)." >&4
17579         : see if a prototype for shmat is available
17580         xxx=`./findhdr sys/shm.h`
17581         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17582         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17583                 val="$define"
17584         else
17585                 val="$undef"
17586         fi
17587         $rm -f shmat.[co]
17588         ;;
17589 *)
17590         val="$undef"
17591         ;;
17592 esac
17593 set d_shmatprototype
17594 eval $setvar
17595
17596 : see if shmdt exists
17597 set shmdt d_shmdt
17598 eval $inlibc
17599
17600 : see how much of the 'shm*(2)' library is present.
17601 h_shm=true
17602 echo " "
17603 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17604 *"$undef"*) h_shm=false;;
17605 esac
17606 case "$osname" in
17607 freebsd)
17608     case "`ipcs 2>&1`" in
17609     "SVID shared memory"*"not configured"*)
17610         echo "Your $osname does not have the shm*(2) configured." >&4
17611         h_shm=false
17612         val="$undef"
17613         set shmctl d_shmctl
17614         evat $setvar
17615         set shmget d_shmget
17616         evat $setvar
17617         set shmat d_shmat
17618         evat $setvar
17619         set shmdt d_shmdt
17620         evat $setvar
17621         ;;
17622     esac
17623     ;;
17624 esac
17625 : we could also check for sys/ipc.h ...
17626 if $h_shm && $test `./findhdr sys/shm.h`; then
17627         echo "You have the full shm*(2) library." >&4
17628         val="$define"
17629 else
17630         echo "You don't have the full shm*(2) library." >&4
17631         val="$undef"
17632 fi
17633 set d_shm
17634 eval $setvar
17635
17636 : see if we have sigaction
17637 echo " "
17638 if set sigaction val -f d_sigaction; eval $csym; $val; then
17639         echo 'sigaction() found.' >&4
17640         $cat > try.c <<EOP
17641 #include <stdio.h>
17642 #include <sys/types.h>
17643 #include <signal.h>
17644 #$i_stdlib I_STDLIB
17645 #ifdef I_STDLIB
17646 #include <stdlib.h>
17647 #endif
17648 int main()
17649 {
17650     struct sigaction act, oact;
17651     act.sa_flags = 0;
17652     oact.sa_handler = 0;
17653     /* so that act and oact are used */
17654     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17655 }
17656 EOP
17657         set try
17658         if eval $compile_ok; then
17659                 val="$define"
17660         else
17661                 echo "But you don't seem to have a usable struct sigaction." >&4
17662                 val="$undef"
17663         fi
17664 else
17665         echo 'sigaction NOT found.' >&4
17666         val="$undef"
17667 fi
17668 set d_sigaction; eval $setvar
17669 $rm_try
17670
17671 : see if this is a sunmath.h system
17672 set sunmath.h i_sunmath
17673 eval $inhdr
17674
17675 : see if signbit exists
17676 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17677 $cat >try.c <<EOCP
17678 #$i_math I_MATH
17679 #$i_sunmath I_SUNMATH
17680 #ifdef I_MATH
17681 #  include <math.h>
17682 #endif
17683 #ifdef I_SUNMATH  /* Solaris special math library */
17684 #  include <sunmath.h>
17685 #endif
17686 #define NV $nvtype
17687 int main(int argc, char **argv)
17688 {
17689     NV x = 0.0;
17690     NV y = -0.0;
17691     if ((signbit(x) == 0) && (signbit(y) != 0))
17692         return 0;
17693     else
17694         return 1;
17695 }
17696 EOCP
17697 val="$undef"
17698 set try
17699 if eval $compile; then
17700     if $run ./try; then
17701         $echo "Yes." >&4
17702         val="$define"
17703     else
17704         $echo "Signbit seems to be available, but doesn't work as I expected."
17705         $echo "I won't use it." >&4
17706         val="$undef"
17707     fi
17708 else
17709     $echo "Nope." >&4
17710     dflt="$undef"
17711 fi
17712 set d_signbit
17713 eval $setvar
17714 $rm_try
17715
17716 : see if sigprocmask exists
17717 set sigprocmask d_sigprocmask
17718 eval $inlibc
17719
17720 : see if sigsetjmp exists
17721 echo " "
17722 case "$d_sigsetjmp" in
17723 '')
17724         $cat >try.c <<EOP
17725 #include <setjmp.h>
17726 #$i_stdlib I_STDLIB
17727 #ifdef I_STDLIB
17728 #include <stdlib.h>
17729 #endif
17730 sigjmp_buf env;
17731 int set = 1;
17732 int main()
17733 {
17734         if (sigsetjmp(env,1))
17735                 exit(set);
17736         set = 0;
17737         siglongjmp(env, 1);
17738         exit(1);
17739 }
17740 EOP
17741         set try
17742         if eval $compile; then
17743                 if $run ./try >/dev/null 2>&1; then
17744                         echo "POSIX sigsetjmp found." >&4
17745                         val="$define"
17746                 else
17747                         $cat >&4 <<EOM
17748 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17749 I'll ignore them.
17750 EOM
17751                         val="$undef"
17752                 fi
17753         else
17754                 echo "sigsetjmp not found." >&4
17755                 val="$undef"
17756         fi
17757         ;;
17758 *) val="$d_sigsetjmp"
17759         case "$d_sigsetjmp" in
17760         $define) echo "POSIX sigsetjmp found." >&4;;
17761         $undef) echo "sigsetjmp not found." >&4;;
17762         esac
17763         ;;
17764 esac
17765 set d_sigsetjmp
17766 eval $setvar
17767 $rm_try
17768
17769 : see if snprintf exists
17770 set snprintf d_snprintf
17771 eval $inlibc
17772
17773 : see if vsnprintf exists
17774 set vsnprintf d_vsnprintf
17775 eval $inlibc
17776
17777 case "$d_snprintf-$d_vsnprintf" in
17778 "$define-$define")
17779     $cat <<EOM
17780 Checking whether your snprintf() and vsnprintf() work okay...
17781 EOM
17782     $cat >try.c <<'EOCP'
17783 /* v?snprintf testing logic courtesy of Russ Allbery.
17784  * According to C99:
17785  * - if the buffer is too short it still must be \0-terminated
17786  * - if the buffer is too short the potentially required length
17787  *   must be returned and not -1
17788  * - if the buffer is NULL the potentially required length
17789  *   must be returned and not -1 or core dump
17790  */
17791 #include <stdio.h>
17792 #include <stdarg.h>
17793
17794 char buf[2];
17795
17796 int test (char *format, ...)
17797 {
17798     va_list args;
17799     int count;
17800
17801     va_start (args, format);
17802     count = vsnprintf (buf, sizeof buf, format, args);
17803     va_end (args);
17804     return count;
17805 }
17806
17807 int main ()
17808 {
17809     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17810              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17811 }
17812 EOCP
17813     set try
17814     if eval $compile; then
17815         `$run ./try`
17816         case "$?" in
17817         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17818         *) cat <<EOM >&4
17819 Your snprintf() and snprintf() don't seem to be working okay.
17820 EOM
17821            d_snprintf="$undef"
17822            d_vsnprintf="$undef"
17823            ;;
17824         esac
17825     else
17826         echo "(I can't seem to compile the test program--assuming they don't)"
17827         d_snprintf="$undef"
17828         d_vsnprintf="$undef"
17829     fi
17830     $rm_try
17831     ;;
17832 esac
17833
17834 : see if sockatmark exists
17835 set sockatmark d_sockatmark
17836 eval $inlibc
17837
17838 : see if prototype for sockatmark is available
17839 echo " "
17840 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17841 eval $hasproto
17842
17843 : see if socks5_init exists
17844 set socks5_init d_socks5_init
17845 eval $inlibc
17846
17847 : see if sprintf returns the length of the string in the buffer as per ANSI
17848 $echo "Checking whether sprintf returns the length of the string..." >&4
17849 $cat <<EOP >try.c
17850 #include <stdio.h>
17851 #$i_stdlib I_STDLIB
17852 #ifdef I_STDLIB
17853 #include <stdlib.h>
17854 #endif
17855 #$i_string I_STRING
17856 #ifdef I_STRING
17857 #  include <string.h>
17858 #else
17859 #  include <strings.h>
17860 #endif
17861 #$i_math I_MATH
17862 #ifdef I_MATH
17863 #include <math.h>
17864 #endif
17865
17866 char buffer[256];
17867
17868 int check (size_t expect, int test) {
17869   size_t got = strlen(buffer);
17870   if (expect == got)
17871     return 0;
17872
17873   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17874        test, buffer);
17875   exit (test);
17876 }
17877
17878 int main(int argc, char **argv) {
17879   int test = 0;
17880
17881   check(sprintf(buffer, ""), ++test);
17882   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17883   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17884
17885   return 0;
17886 }
17887 EOP
17888 set try
17889
17890 if eval $compile; then
17891     xxx="`$run ./try`"
17892     case "$?" in
17893         0) cat >&4 <<EOM
17894 sprintf returns the length of the string (as ANSI says it should)
17895 EOM
17896         d_sprintf_returns_strlen="$define"
17897         ;;
17898         *) cat >&4 <<EOM
17899 sprintf does not return the length of the string (how old is this system?)
17900 EOM
17901         d_sprintf_returns_strlen="$undef"
17902         ;;
17903     esac
17904 else
17905     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17906     d_sprintf_returns_strlen="$undef"
17907 fi
17908 $rm_try
17909
17910 : see if srand48_r exists
17911 set srand48_r d_srand48_r
17912 eval $inlibc
17913 case "$d_srand48_r" in
17914 "$define")
17915         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17916         case "$d_srand48_r_proto:$usethreads" in
17917         ":define")      d_srand48_r_proto=define
17918                 set d_srand48_r_proto srand48_r $hdrs
17919                 eval $hasproto ;;
17920         *)      ;;
17921         esac
17922         case "$d_srand48_r_proto" in
17923         define)
17924         case "$srand48_r_proto" in
17925         ''|0) try='int srand48_r(long, struct drand48_data*);'
17926         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17927         esac
17928         case "$srand48_r_proto" in
17929         ''|0)   d_srand48_r=undef
17930                 srand48_r_proto=0
17931                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17932         * )     case "$srand48_r_proto" in
17933                 REENTRANT_PROTO*) ;;
17934                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17935                 esac
17936                 echo "Prototype: $try" ;;
17937         esac
17938         ;;
17939         *)      case "$usethreads" in
17940                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17941                 esac
17942                 d_srand48_r=undef
17943                 srand48_r_proto=0
17944                 ;;
17945         esac
17946         ;;
17947 *)      srand48_r_proto=0
17948         ;;
17949 esac
17950
17951 : see if srandom_r exists
17952 set srandom_r d_srandom_r
17953 eval $inlibc
17954 case "$d_srandom_r" in
17955 "$define")
17956         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17957         case "$d_srandom_r_proto:$usethreads" in
17958         ":define")      d_srandom_r_proto=define
17959                 set d_srandom_r_proto srandom_r $hdrs
17960                 eval $hasproto ;;
17961         *)      ;;
17962         esac
17963         case "$d_srandom_r_proto" in
17964         define)
17965         case "$srandom_r_proto" in
17966         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17967         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17968         esac
17969         case "$srandom_r_proto" in
17970         ''|0)   d_srandom_r=undef
17971                 srandom_r_proto=0
17972                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17973         * )     case "$srandom_r_proto" in
17974                 REENTRANT_PROTO*) ;;
17975                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17976                 esac
17977                 echo "Prototype: $try" ;;
17978         esac
17979         ;;
17980         *)      case "$usethreads" in
17981                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17982                 esac
17983                 d_srandom_r=undef
17984                 srandom_r_proto=0
17985                 ;;
17986         esac
17987         ;;
17988 *)      srandom_r_proto=0
17989         ;;
17990 esac
17991
17992 : see if prototype for setresgid is available
17993 echo " "
17994 set d_sresgproto setresgid $i_unistd unistd.h
17995 eval $hasproto
17996
17997 : see if prototype for setresuid is available
17998 echo " "
17999 set d_sresuproto setresuid $i_unistd unistd.h
18000 eval $hasproto
18001
18002 : see if sys/stat.h is available
18003 set sys/stat.h i_sysstat
18004 eval $inhdr
18005
18006 : see if stat knows about block sizes
18007 echo " "
18008 echo "Checking to see if your struct stat has st_blocks field..." >&4
18009 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18010 eval $hasfield
18011
18012 : see if this is a sys/vfs.h system
18013 set sys/vfs.h i_sysvfs
18014 eval $inhdr
18015
18016 : see if this is a sys/statfs.h system
18017 set sys/statfs.h i_sysstatfs
18018 eval $inhdr
18019
18020 : Check for statfs_s
18021 echo " "
18022 echo "Checking to see if your system supports struct statfs..." >&4
18023 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
18024 eval $hasstruct
18025 case "$d_statfs_s" in
18026 "$define")      echo "Yes, it does."   ;;
18027 *)              echo "No, it doesn't." ;;
18028 esac
18029
18030
18031 : see if struct statfs knows about f_flags
18032 case "$d_statfs_s" in
18033 define)
18034         echo " "
18035         echo "Checking to see if your struct statfs has f_flags field..." >&4
18036         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
18037         eval $hasfield
18038         ;;
18039 *)      val="$undef"
18040         set d_statfs_f_flags
18041         eval $setvar
18042         ;;
18043 esac
18044 case "$d_statfs_f_flags" in
18045 "$define")      echo "Yes, it does."   ;;
18046 *)              echo "No, it doesn't." ;;
18047 esac
18048
18049 : see what flavor, if any, of static inline is supported
18050 echo " "
18051 echo "Checking to see if your system supports static inline..."
18052 $cat > try.c <<'EOCP'
18053 #include <stdlib.h>
18054 extern int f_via_a(int x);
18055 extern int f_via_b(int x);
18056 int main(int argc, char **argv)
18057 {
18058     int y;
18059
18060     y = f_via_a(0);
18061 #ifdef USE_B
18062     y = f_via_b(0);
18063 #endif
18064     if (y == 42) {
18065         return EXIT_SUCCESS;
18066     }
18067     else {
18068         return EXIT_FAILURE;
18069     }
18070 }
18071 EOCP
18072 $cat > a.c <<'EOCP'
18073 static INLINE int f(int x) {
18074     int y;
18075     y = x + 42;
18076     return y;
18077 }
18078
18079 int f_via_a(int x)
18080 {
18081     return f(x);
18082 }
18083 EOCP
18084 $cat > b.c <<'EOCP'
18085 extern int f(int x);
18086
18087 int f_via_b(int x)
18088 {
18089     return f(x);
18090 }
18091 EOCP
18092
18093 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18094 case "$perl_static_inline" in
18095 '')     # Check the various possibilities, and break out on success.
18096         # For gcc, prefer __inline__, which will still permit
18097         # cflags.SH to add in -ansi.
18098         case "$gccversion" in
18099                 '') xxx="inline __inline__ __inline _inline";;
18100                 *)  xxx="__inline__ inline __inline _inline";;
18101         esac
18102         for inline in $xxx; do
18103                 set try -DINLINE=$inline a.c
18104                 if eval $compile && $run ./try; then
18105                         # Now make sure there is no external linkage of static
18106                         # functions
18107                         set try -DINLINE=$inline -DUSE_B a.c b.c
18108                         if eval $compile && $run ./try; then
18109                                 $echo "Your compiler supports static $inline, " >&4
18110                                 $echo "but it also creates an external definition," >&4
18111                                 $echo "so I won't use it." >&4
18112                                 val=$undef
18113                         else
18114                                 $echo "Your compiler supports static $inline." >&4
18115                                 val=$define
18116                                 perl_static_inline="static $inline";
18117                                 break;
18118                         fi
18119                 else
18120                         $echo "Your compiler does NOT support static $inline." >&4
18121                         val="$undef"
18122                 fi
18123         done
18124         ;;
18125 *inline*) # Some variant of inline exists.
18126         echo "Keeping your $hint value of $perl_static_inline."
18127         val=$define
18128         ;;
18129 static)  # No inline capabilities
18130         echo "Keeping your $hint value of $perl_static_inline."
18131         val=$undef
18132         ;;
18133 *)  # Unrecognized previous value -- blindly trust the supplied
18134         # value and hope it makes sense.  Use old value for
18135         # d_static_inline, if there is one.
18136         echo "Keeping your $hint value of $perl_static_inline."
18137         case "$d_static_inline" in
18138                 '') val=$define ;;
18139                 *)  val=$d_static_inline ;;
18140         esac
18141         ;;
18142 esac
18143 # Fallback to plain 'static' if nothing worked.
18144 case "$perl_static_inline" in
18145 '')
18146         perl_static_inline="static"
18147         val=$undef
18148         ;;
18149 esac
18150 set d_static_inline
18151 eval $setvar
18152 $rm -f a.[co] b.[co]
18153 $rm_try
18154
18155 : Check stream access
18156 $cat >&4 <<EOM
18157 Checking how to access stdio streams by file descriptor number...
18158 EOM
18159 case "$stdio_stream_array" in
18160 '')     $cat >try.c <<EOCP
18161 #include <stdio.h>
18162 int main() {
18163   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18164     printf("yes\n");
18165 }
18166 EOCP
18167         for s in _iob __iob __sF
18168         do
18169                 set try -DSTDIO_STREAM_ARRAY=$s
18170                 if eval $compile; then
18171                         case "`$run ./try`" in
18172                         yes)    stdio_stream_array=$s; break ;;
18173                         esac
18174                 fi
18175         done
18176         $rm_try
18177 esac
18178 case "$stdio_stream_array" in
18179 '')     $cat >&4 <<EOM
18180 I can't figure out how to access stdio streams by file descriptor number.
18181 EOM
18182         d_stdio_stream_array="$undef"
18183         ;;
18184 *)      $cat >&4 <<EOM
18185 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18186 EOM
18187         d_stdio_stream_array="$define"
18188         ;;
18189 esac
18190
18191 : see if strcoll exists
18192 set strcoll d_strcoll
18193 eval $inlibc
18194
18195 : check for structure copying
18196 echo " "
18197 echo "Checking to see if your C compiler can copy structs..." >&4
18198 $cat >try.c <<'EOCP'
18199 int main()
18200 {
18201         struct blurfl {
18202                 int dyick;
18203         } foo, bar;
18204
18205         foo = bar;
18206 }
18207 EOCP
18208 if $cc -c try.c >/dev/null 2>&1 ; then
18209         val="$define"
18210         echo "Yup, it can."
18211 else
18212         val="$undef"
18213         echo "Nope, it can't."
18214 fi
18215 set d_strctcpy
18216 eval $setvar
18217 $rm_try
18218
18219 : see if strerror and/or sys_errlist[] exist
18220 echo " "
18221 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18222     if set strerror val -f d_strerror; eval $csym; $val; then
18223                 echo 'strerror() found.' >&4
18224                 d_strerror="$define"
18225                 d_strerrm='strerror(e)'
18226                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18227                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18228                         d_syserrlst="$define"
18229                 else
18230                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18231                         d_syserrlst="$undef"
18232                 fi
18233     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18234                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18235                 echo 'strerror() found in string header.' >&4
18236                 d_strerror="$define"
18237                 d_strerrm='strerror(e)'
18238                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18239                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18240                                 d_syserrlst="$define"
18241                 else
18242                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18243                         d_syserrlst="$undef"
18244                 fi
18245     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18246                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18247                 d_strerror="$undef"
18248                 d_syserrlst="$define"
18249                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18250     else
18251                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18252                 d_strerror="$undef"
18253                 d_syserrlst="$undef"
18254                 d_strerrm='"unknown"'
18255     fi
18256 fi
18257
18258 : see if strerror_r exists
18259 set strerror_r d_strerror_r
18260 eval $inlibc
18261 case "$d_strerror_r" in
18262 "$define")
18263         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18264         case "$d_strerror_r_proto:$usethreads" in
18265         ":define")      d_strerror_r_proto=define
18266                 set d_strerror_r_proto strerror_r $hdrs
18267                 eval $hasproto ;;
18268         *)      ;;
18269         esac
18270         case "$d_strerror_r_proto" in
18271         define)
18272         case "$strerror_r_proto" in
18273         ''|0) try='int strerror_r(int, char*, size_t);'
18274         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18275         esac
18276         case "$strerror_r_proto" in
18277         ''|0) try='int strerror_r(int, char*, int);'
18278         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18279         esac
18280         case "$strerror_r_proto" in
18281         ''|0) try='char* strerror_r(int, char*, size_t);'
18282         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18283         esac
18284         case "$strerror_r_proto" in
18285         ''|0)   d_strerror_r=undef
18286                 strerror_r_proto=0
18287                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18288         * )     case "$strerror_r_proto" in
18289                 REENTRANT_PROTO*) ;;
18290                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18291                 esac
18292                 echo "Prototype: $try" ;;
18293         esac
18294         ;;
18295         *)      case "$usethreads" in
18296                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18297                 esac
18298                 d_strerror_r=undef
18299                 strerror_r_proto=0
18300                 ;;
18301         esac
18302         ;;
18303 *)      strerror_r_proto=0
18304         ;;
18305 esac
18306
18307 : see if strftime exists
18308 set strftime d_strftime
18309 eval $inlibc
18310
18311 : see if strlcat exists
18312 set strlcat d_strlcat
18313 eval $inlibc
18314
18315 : see if strlcpy exists
18316 set strlcpy d_strlcpy
18317 eval $inlibc
18318
18319 : see if strtod exists
18320 set strtod d_strtod
18321 eval $inlibc
18322
18323 : see if strtol exists
18324 set strtol d_strtol
18325 eval $inlibc
18326
18327 : see if strtold exists
18328 set strtold d_strtold
18329 eval $inlibc
18330
18331 : see if strtoll exists
18332 set strtoll d_strtoll
18333 eval $inlibc
18334
18335 case "$d_longlong-$d_strtoll" in
18336 "$define-$define")
18337         $cat <<EOM
18338 Checking whether your strtoll() works okay...
18339 EOM
18340         $cat >try.c <<'EOCP'
18341 #include <errno.h>
18342 #ifdef __hpux
18343 #define strtoll __strtoll
18344 #endif
18345 #ifdef __EMX__
18346 #define strtoll _strtoll
18347 #endif
18348 #include <stdio.h>
18349 extern long long int strtoll(char *s, char **, int);
18350 static int bad = 0;
18351 int check(char *s, long long ell, int een) {
18352         long long gll;
18353         errno = 0;
18354         gll = strtoll(s, 0, 10);
18355         if (!((gll == ell) && (errno == een)))
18356                 bad++;
18357 }
18358 int main() {
18359         check(" 1",                                      1LL, 0);
18360         check(" 0",                                      0LL, 0);
18361         check("-1",                                     -1LL, 0);
18362         check("-9223372036854775808", -9223372036854775808LL, 0);
18363         check("-9223372036854775808", -9223372036854775808LL, 0);
18364         check(" 9223372036854775807",  9223372036854775807LL, 0);
18365         check("-9223372036854775808", -9223372036854775808LL, 0);
18366         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18367         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18368         if (!bad)
18369                 printf("ok\n");
18370 }
18371 EOCP
18372         set try
18373         if eval $compile; then
18374                 yyy=`$run ./try`
18375                 case "$yyy" in
18376                 ok) echo "Your strtoll() seems to be working okay." ;;
18377                 *) cat <<EOM >&4
18378 Your strtoll() doesn't seem to be working okay.
18379 EOM
18380                    d_strtoll="$undef"
18381                    ;;
18382                 esac
18383         else
18384                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18385                 d_strtoll="$undef"
18386         fi
18387         ;;
18388 esac
18389
18390 : see if strtoq exists
18391 set strtoq d_strtoq
18392 eval $inlibc
18393
18394 : see if strtoul exists
18395 set strtoul d_strtoul
18396 eval $inlibc
18397
18398 case "$d_strtoul" in
18399 "$define")
18400         $cat <<EOM
18401 Checking whether your strtoul() works okay...
18402 EOM
18403         $cat >try.c <<'EOCP'
18404 #include <errno.h>
18405 #include <stdio.h>
18406 extern unsigned long int strtoul(char *s, char **, int);
18407 static int bad = 0;
18408 void check(char *s, unsigned long eul, int een) {
18409         unsigned long gul;
18410         errno = 0;
18411         gul = strtoul(s, 0, 10);
18412         if (!((gul == eul) && (errno == een)))
18413                 bad++;
18414 }
18415 int main() {
18416         check(" 1", 1L, 0);
18417         check(" 0", 0L, 0);
18418 EOCP
18419         case "$longsize" in
18420         8)
18421             $cat >>try.c <<'EOCP'
18422         check("18446744073709551615", 18446744073709551615UL, 0);
18423         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18424 #if 0 /* strtoul() for /^-/ strings is undefined. */
18425         check("-1", 18446744073709551615UL, 0);
18426         check("-18446744073709551614", 2, 0);
18427         check("-18446744073709551615", 1, 0);
18428         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18429         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18430 #endif
18431 EOCP
18432                 ;;
18433         4)
18434                     $cat >>try.c <<'EOCP'
18435         check("4294967295", 4294967295UL, 0);
18436         check("4294967296", 4294967295UL, ERANGE);
18437 #if 0 /* strtoul() for /^-/ strings is undefined. */
18438         check("-1", 4294967295UL, 0);
18439         check("-4294967294", 2, 0);
18440         check("-4294967295", 1, 0);
18441         check("-4294967296", 4294967295UL, ERANGE);
18442         check("-4294967297", 4294967295UL, ERANGE);
18443 #endif
18444 EOCP
18445                 ;;
18446         *)
18447 : Should we write these tests to be more portable by sprintf-ing
18448 : ~0 and then manipulating that char string as input for strtol?
18449                 ;;
18450         esac
18451         $cat >>try.c <<'EOCP'
18452         if (!bad)
18453                 printf("ok\n");
18454         return 0;
18455 }
18456 EOCP
18457         set try
18458         if eval $compile; then
18459                 case "`$run ./try`" in
18460                 ok) echo "Your strtoul() seems to be working okay." ;;
18461                 *) cat <<EOM >&4
18462 Your strtoul() doesn't seem to be working okay.
18463 EOM
18464                    d_strtoul="$undef"
18465                    ;;
18466                 esac
18467         else
18468                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18469                 d_strtoul="$undef"
18470         fi
18471         ;;
18472 esac
18473
18474 : see if strtoull exists
18475 set strtoull d_strtoull
18476 eval $inlibc
18477
18478 case "$d_longlong-$d_strtoull" in
18479 "$define-$define")
18480         $cat <<EOM
18481 Checking whether your strtoull() works okay...
18482 EOM
18483         $cat >try.c <<'EOCP'
18484 #include <errno.h>
18485 #ifdef __hpux
18486 #define strtoull __strtoull
18487 #endif
18488 #include <stdio.h>
18489 extern unsigned long long int strtoull(char *s, char **, int);
18490 static int bad = 0;
18491 int check(char *s, long long eull, int een) {
18492         long long gull;
18493         errno = 0;
18494         gull = strtoull(s, 0, 10);
18495         if (!((gull == eull) && (errno == een)))
18496                 bad++;
18497 }
18498 int main() {
18499         check(" 1",                                        1LL, 0);
18500         check(" 0",                                        0LL, 0);
18501         check("18446744073709551615",  18446744073709551615ULL, 0);
18502         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18503 #if 0 /* strtoull() for /^-/ strings is undefined. */
18504         check("-1",                    18446744073709551615ULL, 0);
18505         check("-18446744073709551614",                     2LL, 0);
18506         check("-18446744073709551615",                     1LL, 0);
18507         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18508         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18509 #endif
18510         if (!bad)
18511                 printf("ok\n");
18512 }
18513 EOCP
18514         set try
18515         if eval $compile; then
18516                 case "`$run ./try`" in
18517                 ok) echo "Your strtoull() seems to be working okay." ;;
18518                 *) cat <<EOM >&4
18519 Your strtoull() doesn't seem to be working okay.
18520 EOM
18521                    d_strtoull="$undef"
18522                    ;;
18523                 esac
18524         else
18525                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18526                 d_strtoull="$undef"
18527         fi
18528         ;;
18529 esac
18530
18531 : see if strtouq exists
18532 set strtouq d_strtouq
18533 eval $inlibc
18534
18535 case "$d_strtouq" in
18536 "$define")
18537         $cat <<EOM
18538 Checking whether your strtouq() works okay...
18539 EOM
18540         $cat >try.c <<'EOCP'
18541 #include <errno.h>
18542 #include <stdio.h>
18543 extern unsigned long long int strtouq(char *s, char **, int);
18544 static int bad = 0;
18545 void check(char *s, unsigned long long eull, int een) {
18546         unsigned long long gull;
18547         errno = 0;
18548         gull = strtouq(s, 0, 10);
18549         if (!((gull == eull) && (errno == een)))
18550                 bad++;
18551 }
18552 int main() {
18553         check(" 1",                                        1LL, 0);
18554         check(" 0",                                        0LL, 0);
18555         check("18446744073709551615",  18446744073709551615ULL, 0);
18556         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18557 #if 0 /* strtouq() for /^-/ strings is undefined. */
18558         check("-1",                    18446744073709551615ULL, 0);
18559         check("-18446744073709551614",                     2LL, 0);
18560         check("-18446744073709551615",                     1LL, 0);
18561         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18562         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18563 #endif
18564         if (!bad)
18565                 printf("ok\n");
18566         return 0;
18567 }
18568 EOCP
18569         set try
18570         if eval $compile; then
18571                 case "`$run ./try`" in
18572                 ok) echo "Your strtouq() seems to be working okay." ;;
18573                 *) cat <<EOM >&4
18574 Your strtouq() doesn't seem to be working okay.
18575 EOM
18576                    d_strtouq="$undef"
18577                    ;;
18578                 esac
18579         else
18580                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18581                 d_strtouq="$undef"
18582         fi
18583         ;;
18584 esac
18585
18586 : see if strxfrm exists
18587 set strxfrm d_strxfrm
18588 eval $inlibc
18589
18590 : see if symlink exists
18591 set symlink d_symlink
18592 eval $inlibc
18593
18594 : see if syscall exists
18595 set syscall d_syscall
18596 eval $inlibc
18597
18598 : see if prototype for syscall is available
18599 echo " "
18600 set d_syscallproto syscall $i_unistd unistd.h
18601 eval $hasproto
18602
18603 : see if sysconf exists
18604 set sysconf d_sysconf
18605 eval $inlibc
18606
18607 : see if system exists
18608 set system d_system
18609 eval $inlibc
18610
18611 : see if tcgetpgrp exists
18612 set tcgetpgrp d_tcgetpgrp
18613 eval $inlibc
18614
18615 : see if tcsetpgrp exists
18616 set tcsetpgrp d_tcsetpgrp
18617 eval $inlibc
18618
18619 : see if prototype for telldir is available
18620 echo " "
18621 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18622 eval $hasproto
18623
18624 : see if time exists
18625 echo " "
18626 if test "X$d_time" = X -o X"$timetype" = X; then
18627     if set time val -f d_time; eval $csym; $val; then
18628                 echo 'time() found.' >&4
18629                 val="$define"
18630                 rp="What is the type returned by time() on this system?"
18631                 set time_t timetype long stdio.h sys/types.h
18632                 eval $typedef_ask
18633     else
18634                 echo 'time() not found, hope that will do.' >&4
18635                 val="$undef"
18636                 timetype='int';
18637     fi
18638     set d_time
18639     eval $setvar
18640 fi
18641
18642 : see if timegm exists
18643 set timegm d_timegm
18644 eval $inlibc
18645
18646 : see if this is a sys/times.h system
18647 set sys/times.h i_systimes
18648 eval $inhdr
18649
18650 : see if times exists
18651 echo " "
18652 if set times val -f d_times; eval $csym; $val; then
18653         echo 'times() found.' >&4
18654         d_times="$define"
18655         inc=''
18656         case "$i_systimes" in
18657         "$define") inc='sys/times.h';;
18658         esac
18659         rp="What is the type returned by times() on this system?"
18660         set clock_t clocktype long stdio.h sys/types.h $inc
18661         eval $typedef_ask
18662 else
18663         echo 'times() NOT found, hope that will do.' >&4
18664         d_times="$undef"
18665         clocktype='int'
18666 fi
18667
18668 : see if tmpnam_r exists
18669 set tmpnam_r d_tmpnam_r
18670 eval $inlibc
18671 case "$d_tmpnam_r" in
18672 "$define")
18673         hdrs="$i_systypes sys/types.h define stdio.h "
18674         case "$d_tmpnam_r_proto:$usethreads" in
18675         ":define")      d_tmpnam_r_proto=define
18676                 set d_tmpnam_r_proto tmpnam_r $hdrs
18677                 eval $hasproto ;;
18678         *)      ;;
18679         esac
18680         case "$d_tmpnam_r_proto" in
18681         define)
18682         case "$tmpnam_r_proto" in
18683         ''|0) try='char* tmpnam_r(char*);'
18684         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18685         esac
18686         case "$tmpnam_r_proto" in
18687         ''|0)   d_tmpnam_r=undef
18688                 tmpnam_r_proto=0
18689                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18690         * )     case "$tmpnam_r_proto" in
18691                 REENTRANT_PROTO*) ;;
18692                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18693                 esac
18694                 echo "Prototype: $try" ;;
18695         esac
18696         ;;
18697         *)      case "$usethreads" in
18698                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18699                 esac
18700                 d_tmpnam_r=undef
18701                 tmpnam_r_proto=0
18702                 ;;
18703         esac
18704         ;;
18705 *)      tmpnam_r_proto=0
18706         ;;
18707 esac
18708
18709 : see if truncate exists
18710 set truncate d_truncate
18711 eval $inlibc
18712
18713 : see if ttyname_r exists
18714 set ttyname_r d_ttyname_r
18715 eval $inlibc
18716 case "$d_ttyname_r" in
18717 "$define")
18718         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18719         case "$d_ttyname_r_proto:$usethreads" in
18720         ":define")      d_ttyname_r_proto=define
18721                 set d_ttyname_r_proto ttyname_r $hdrs
18722                 eval $hasproto ;;
18723         *)      ;;
18724         esac
18725         case "$d_ttyname_r_proto" in
18726         define)
18727         case "$ttyname_r_proto" in
18728         ''|0) try='int ttyname_r(int, char*, size_t);'
18729         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18730         esac
18731         case "$ttyname_r_proto" in
18732         ''|0) try='int ttyname_r(int, char*, int);'
18733         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18734         esac
18735         case "$ttyname_r_proto" in
18736         ''|0) try='char* ttyname_r(int, char*, int);'
18737         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18738         esac
18739         case "$ttyname_r_proto" in
18740         ''|0)   d_ttyname_r=undef
18741                 ttyname_r_proto=0
18742                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18743         * )     case "$ttyname_r_proto" in
18744                 REENTRANT_PROTO*) ;;
18745                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18746                 esac
18747                 echo "Prototype: $try" ;;
18748         esac
18749         ;;
18750         *)      case "$usethreads" in
18751                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18752                 esac
18753                 d_ttyname_r=undef
18754                 ttyname_r_proto=0
18755                 ;;
18756         esac
18757         ;;
18758 *)      ttyname_r_proto=0
18759         ;;
18760 esac
18761
18762 : see if tzname[] exists
18763 echo " "
18764 if set tzname val -a d_tzname; eval $csym; $val; then
18765         val="$define"
18766         echo 'tzname[] found.' >&4
18767 else
18768         val="$undef"
18769         echo 'tzname[] NOT found.' >&4
18770 fi
18771 set d_tzname
18772 eval $setvar
18773
18774 : Check if is a multiplatform env
18775 case "$osname" in
18776 next|darwin) multiarch="$define" ;;
18777 esac
18778 case "$multiarch" in
18779 ''|[nN]*) multiarch="$undef" ;;
18780 esac
18781
18782 : check for ordering of bytes in a UV
18783 echo " "
18784 case "$usecrosscompile$multiarch" in
18785 *$define*)
18786         $cat <<EOM
18787 You seem to be either cross-compiling or doing a multiarchitecture build,
18788 skipping the byteorder check.
18789
18790 EOM
18791         byteorder='ffff'
18792         ;;
18793 *)
18794         case "$byteorder" in
18795         '')
18796                 $cat <<'EOM'
18797 In the following, larger digits indicate more significance.  A big-endian
18798 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18799 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18800 machines may have weird orders like 3412.  A Cray will report 87654321,
18801 an Alpha will report 12345678. If the test program works the default is
18802 probably right.
18803 I'm now running the test program...
18804 EOM
18805                 $cat >try.c <<EOCP
18806 #include <stdio.h>
18807 #$i_stdlib I_STDLIB
18808 #ifdef I_STDLIB
18809 #include <stdlib.h>
18810 #endif
18811 #include <sys/types.h>
18812 typedef $uvtype UV;
18813 int main()
18814 {
18815         int i;
18816         union {
18817                 UV l;
18818                 char c[$uvsize];
18819         } u;
18820
18821         if ($uvsize > 4)
18822                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18823         else
18824                 u.l = (UV)0x04030201;
18825         for (i = 0; i < $uvsize; i++)
18826                 printf("%c", u.c[i]+'0');
18827         printf("\n");
18828         exit(0);
18829 }
18830 EOCP
18831                 xxx_prompt=y
18832                 set try
18833                 if eval $compile && $run ./try > /dev/null; then
18834                         dflt=`$run ./try`
18835                         case "$dflt" in
18836                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18837                                 echo "(The test program ran ok.)"
18838                                 echo "byteorder=$dflt"
18839                                 xxx_prompt=n
18840                         ;;
18841                         ????|????????) echo "(The test program ran ok.)" ;;
18842                         *) echo "(The test program didn't run right for some reason.)" ;;
18843                         esac
18844                 else
18845                         dflt='4321'
18846                         cat <<'EOM'
18847 (I can't seem to compile the test program.  Guessing big-endian...)
18848 EOM
18849                 fi
18850                 case "$xxx_prompt" in
18851                 y)
18852                         rp="What is the order of bytes in $uvtype?"
18853                         . ./myread
18854                         byteorder="$ans"
18855                         ;;
18856                 *)      byteorder=$dflt
18857                         ;;
18858                 esac
18859                 ;;
18860         esac
18861         $rm_try
18862         ;;
18863 esac
18864
18865 : Checking 32bit alignedness
18866 $cat <<EOM
18867
18868 Checking to see whether you can access character data unalignedly...
18869 EOM
18870 case "$d_u32align" in
18871 '')   $cat >try.c <<EOCP
18872 #include <stdio.h>
18873 #$i_stdlib I_STDLIB
18874 #ifdef I_STDLIB
18875 #include <stdlib.h>
18876 #endif
18877 #define U32 $u32type
18878 #define BYTEORDER 0x$byteorder
18879 #define U8 $u8type
18880 #include <signal.h>
18881 #ifdef SIGBUS
18882 $signal_t bletch(int s) { exit(4); }
18883 #endif
18884 int main() {
18885 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18886     volatile U8 buf[8];
18887     volatile U32 *up;
18888     int i;
18889
18890     if (sizeof(U32) != 4) {
18891         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18892         exit(1);
18893     }
18894
18895     fflush(stdout);
18896
18897 #ifdef SIGBUS
18898     signal(SIGBUS, bletch);
18899 #endif
18900
18901     buf[0] = 0;
18902     buf[1] = 0;
18903     buf[2] = 0;
18904     buf[3] = 1;
18905     buf[4] = 0;
18906     buf[5] = 0;
18907     buf[6] = 0;
18908     buf[7] = 1;
18909
18910     for (i = 0; i < 4; i++) {
18911         up = (U32*)(buf + i);
18912         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18913                (*up == 1 << (8*(3-i)))  /* little-endian */
18914               )
18915            )
18916         {
18917             printf("read failed (%x)\n", *up);
18918             exit(2);
18919         }
18920     }
18921
18922     /* write test */
18923     for (i = 0; i < 4; i++) {
18924         up = (U32*)(buf + i);
18925         *up = 0xBeef;
18926         if (*up != 0xBeef) {
18927             printf("write failed (%x)\n", *up);
18928             exit(3);
18929         }
18930     }
18931
18932     exit(0);
18933 #else
18934     printf("1\n");
18935     exit(1);
18936 #endif
18937     return 0;
18938 }
18939 EOCP
18940 set try
18941 if eval $compile_ok; then
18942         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18943         $run ./try 2>&1 >/dev/null
18944         case "$?" in
18945         0)      cat >&4 <<EOM
18946 You can access character data pretty unalignedly.
18947 EOM
18948                 d_u32align="$undef"
18949                 ;;
18950         *)      cat >&4 <<EOM
18951 It seems that you must access character data in an aligned manner.
18952 EOM
18953                 d_u32align="$define"
18954                 ;;
18955         esac
18956 else
18957         rp='Can you access character data at unaligned addresses?'
18958         dflt='n'
18959         . ./myread
18960         case "$ans" in
18961         [yY]*)  d_u32align="$undef"  ;;
18962         *)      d_u32align="$define" ;;
18963         esac
18964 fi
18965 $rm_try
18966 ;;
18967 esac
18968
18969 : see if ualarm exists
18970 set ualarm d_ualarm
18971 eval $inlibc
18972
18973 : see if umask exists
18974 set umask d_umask
18975 eval $inlibc
18976
18977 : see if unordered exists
18978 set unordered d_unordered
18979 eval $inlibc
18980
18981 : see if unsetenv exists
18982 set unsetenv d_unsetenv
18983 eval $inlibc
18984
18985 : see if usleep exists
18986 set usleep d_usleep
18987 eval $inlibc
18988
18989 : see if prototype for usleep is available
18990 echo " "
18991 set d_usleepproto usleep $i_unistd unistd.h
18992 eval $hasproto
18993
18994 : see if ustat exists
18995 set ustat d_ustat
18996 eval $inlibc
18997
18998 : see if closedir exists
18999 set closedir d_closedir
19000 eval $inlibc
19001
19002 case "$d_closedir" in
19003 "$define")
19004         echo " "
19005         echo "Checking whether closedir() returns a status..." >&4
19006         cat > try.c <<EOM
19007 #$i_dirent I_DIRENT             /**/
19008 #$i_sysdir I_SYS_DIR            /**/
19009 #$i_sysndir I_SYS_NDIR          /**/
19010 #$i_systypes I_SYS_TYPES        /**/
19011
19012 #if defined(I_SYS_TYPES)
19013 #include <sys/types.h>
19014 #endif
19015 #if defined(I_DIRENT)
19016 #include <dirent.h>
19017 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19018 #include <sys/dir.h>
19019 #endif
19020 #else
19021 #ifdef I_SYS_NDIR
19022 #include <sys/ndir.h>
19023 #else
19024 #ifdef I_SYS_DIR
19025 #ifdef hp9000s500
19026 #include <ndir.h>       /* may be wrong in the future */
19027 #else
19028 #include <sys/dir.h>
19029 #endif
19030 #endif
19031 #endif
19032 #endif
19033 int main() { return closedir(opendir(".")); }
19034 EOM
19035         set try
19036         if eval $compile_ok; then
19037                 if $run ./try > /dev/null 2>&1 ; then
19038                         echo "Yes, it does."
19039                         val="$undef"
19040                 else
19041                         echo "No, it doesn't."
19042                         val="$define"
19043                 fi
19044         else
19045                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19046                 val="$define"
19047         fi
19048         ;;
19049 *)
19050         val="$undef";
19051         ;;
19052 esac
19053 set d_void_closedir
19054 eval $setvar
19055 $rm_try
19056
19057 : see if there is a wait4
19058 set wait4 d_wait4
19059 eval $inlibc
19060
19061 : see if waitpid exists
19062 set waitpid d_waitpid
19063 eval $inlibc
19064
19065 : see if wcstombs exists
19066 set wcstombs d_wcstombs
19067 eval $inlibc
19068
19069 : see if wctomb exists
19070 set wctomb d_wctomb
19071 eval $inlibc
19072
19073 : see if writev exists
19074 set writev d_writev
19075 eval $inlibc
19076
19077 : preserve RCS keywords in files with variable substitution, grrr
19078 Date='$Date'
19079 Id='$Id'
19080 Log='$Log'
19081 RCSfile='$RCSfile'
19082 Revision='$Revision'
19083
19084 : check for alignment requirements
19085 echo " "
19086 case "$usecrosscompile" in
19087 *$define*)
19088         $cat <<EOM
19089 You seem to be cross-compiling.  Skipping the memory alignment check.
19090
19091 EOM
19092         case "$alignbytes" in
19093         '') alignbytes=8 ;;
19094         esac
19095         ;;
19096 *)
19097         case "$alignbytes" in
19098         '') echo "Checking alignment constraints..." >&4
19099                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19100                         $cat >try.c <<'EOCP'
19101 typedef long double NV;
19102 EOCP
19103                 else
19104                         $cat >try.c <<'EOCP'
19105 typedef double NV;
19106 EOCP
19107                 fi
19108                 $cat >>try.c <<'EOCP'
19109 #include <stdio.h>
19110 struct foobar {
19111         char foo;
19112         NV bar;
19113 } try_algn;
19114 int main()
19115 {
19116     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19117     return(0);
19118 }
19119 EOCP
19120                 set try
19121                 if eval $compile_ok; then
19122                         dflt=`$run ./try`
19123                 else
19124                         dflt='8'
19125                         echo "(I can't seem to compile the test program...)"
19126                 fi
19127                 case "$multiarch" in
19128                 *$define*)
19129                         : The usual safe value is 8, but Darwin with -Duselongdouble
19130                         : needs 16.  Hence, we will take 8 as a minimum, but allow
19131                         : Configure to pick a larger value if needed.
19132                         if $test "$dflt" -lt 8; then
19133                             dflt='8'
19134                                 echo "Setting alignment to 8 for multiarch support.">&4
19135                         fi
19136                         ;;
19137                 esac
19138                 ;;
19139         *) dflt="$alignbytes"
19140                 ;;
19141         esac
19142         rp="Doubles must be aligned on a how-many-byte boundary?"
19143         . ./myread
19144         alignbytes="$ans"
19145         $rm_try
19146         ;;
19147 esac
19148
19149
19150 : set the base revision
19151 baserev=5.0
19152
19153 : Determine if this is an EBCDIC system
19154 echo " "
19155 echo "Determining whether or not we are on an EBCDIC system..." >&4
19156 $cat >try.c <<'EOM'
19157 int main()
19158 {
19159   if ('M'==0xd4) return 0;
19160   return 1;
19161 }
19162 EOM
19163
19164 case "$BOOTSTRAP_CHARSET" in
19165     Y|y|define) bootstrap_charset=$define       ;;
19166     *)          bootstrap_charset=$undef        ;;
19167 esac
19168
19169 val=$undef
19170 set try
19171 if eval $compile_ok; then
19172         if $run ./try; then
19173                 echo "You seem to speak EBCDIC." >&4
19174                 val="$define"
19175         else
19176                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19177         fi
19178 else
19179         echo "I'm unable to compile the test program." >&4
19180         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19181 fi
19182 $rm_try
19183 set ebcdic
19184 eval $setvar
19185
19186 : length of character in bytes. Is always 1, otherwise it is not C
19187 : This used to be a test using sizeof
19188 charsize=1
19189
19190 : Check for the number of bits in a character
19191 case "$charbits" in
19192 '')     echo "Checking how long a character is (in bits)..." >&4
19193         $cat >try.c <<EOCP
19194 #include <stdio.h>
19195 int main ()
19196 {
19197     int n;
19198     unsigned char c;
19199     for (c = 1, n = 0; c; c <<= 1, n++) ;
19200     printf ("%d\n", n);
19201     return (0);
19202     }
19203 EOCP
19204         set try
19205         if eval $compile_ok; then
19206                 dflt=`$run ./try`
19207         else
19208                 dflt='8'
19209                 echo "(I can't seem to compile the test program.  Guessing...)"
19210         fi
19211         ;;
19212 *)
19213         dflt="$charbits"
19214         ;;
19215 esac
19216 rp="What is the length of a character (in bits)?"
19217 . ./myread
19218 charbits="$ans"
19219 $rm_try
19220 case "$charbits" in
19221 8)      ;;
19222 *)      cat >&4 << EOM
19223 Your system has an unsigned character size of $charbits bits, which
19224 is rather unusual (normally it is 8 bits).  Perl likely will not work
19225 correctly on your system, with subtle bugs in various places.
19226 EOM
19227         rp='Do you really want to continue?'
19228         dflt='n'
19229         . ./myread
19230         case "$ans" in
19231                 [yY])   echo >&4 "Okay, continuing."    ;;
19232                 *)      exit 1                          ;;
19233         esac
19234 esac
19235
19236 : how do we concatenate cpp tokens here?
19237 echo " "
19238 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19239 $cat >cpp_stuff.c <<'EOCP'
19240 #define RCAT(a,b)a/**/b
19241 #define ACAT(a,b)a ## b
19242 RCAT(Rei,ser)
19243 ACAT(Cir,cus)
19244 EOCP
19245 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19246 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19247         echo "Oh!  Smells like ANSI's been here." >&4
19248         echo "We can catify or stringify, separately or together!"
19249         cpp_stuff=42
19250 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19251         echo "Ah, yes!  The good old days!" >&4
19252         echo "However, in the good old days we don't know how to stringify and"
19253         echo "catify at the same time."
19254         cpp_stuff=1
19255 else
19256         $cat >&4 <<EOM
19257 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19258 You're going to have to edit the values of CAT[2-5] in config.h...
19259 EOM
19260         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19261 fi
19262 $rm -f cpp_stuff.*
19263
19264 : see if this is a db.h system
19265 set db.h i_db
19266 eval $inhdr
19267
19268 case "$i_db" in
19269 $define)
19270         : Check db version.
19271         echo " "
19272         echo "Checking Berkeley DB version ..." >&4
19273         $cat >try.c <<EOCP
19274 #$d_const HASCONST
19275 #ifndef HASCONST
19276 #define const
19277 #endif
19278 #include <sys/types.h>
19279 #include <stdio.h>
19280 #$i_stdlib I_STDLIB
19281 #ifdef I_STDLIB
19282 #include <stdlib.h>
19283 #endif
19284 #include <db.h>
19285 int main(int argc, char *argv[])
19286 {
19287 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19288     int Major, Minor, Patch ;
19289     unsigned long Version ;
19290     (void)db_version(&Major, &Minor, &Patch) ;
19291     if (argc == 2) {
19292         printf("%d %d %d %d %d %d\n",
19293                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19294                Major, Minor, Patch);
19295         exit(0);
19296     }
19297     printf("You have Berkeley DB Version 2 or greater.\n");
19298
19299     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19300                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19301     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19302                 Major, Minor, Patch) ;
19303
19304     /* check that db.h & libdb are compatible */
19305     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19306         printf("db.h and libdb are incompatible.\n") ;
19307         exit(3);
19308     }
19309
19310     printf("db.h and libdb are compatible.\n") ;
19311
19312     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19313                 + DB_VERSION_PATCH ;
19314
19315     /* needs to be >= 2.3.4 */
19316     if (Version < 2003004) {
19317     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19318         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19319         exit(2);
19320     }
19321
19322     exit(0);
19323 #else
19324 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19325     if (argc == 2) {
19326         printf("1 0 0\n");
19327         exit(0);
19328     }
19329     printf("You have Berkeley DB Version 1.\n");
19330     exit(0);    /* DB version < 2: the coast is clear. */
19331 #else
19332     exit(1);    /* <db.h> not Berkeley DB? */
19333 #endif
19334 #endif
19335 }
19336 EOCP
19337         set try
19338         if eval $compile_ok && $run ./try; then
19339                 echo 'Looks OK.' >&4
19340                 set `$run ./try 1`
19341                 db_version_major=$1
19342                 db_version_minor=$2
19343                 db_version_patch=$3
19344         else
19345                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19346                 i_db=$undef
19347                 case " $libs " in
19348                 *"-ldb "*)
19349                         : Remove db from list of libraries to use
19350                         echo "Removing unusable -ldb from library list" >&4
19351                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19352                         shift
19353                         libs="$*"
19354                         echo "libs = $libs" >&4
19355                         ;;
19356                 esac
19357         fi
19358         $rm_try
19359         ;;
19360 esac
19361
19362 case "$i_db" in
19363 define)
19364         : Check the return type needed for hash
19365         echo " "
19366         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19367         $cat >try.c <<EOCP
19368 #$d_const HASCONST
19369 #ifndef HASCONST
19370 #define const
19371 #endif
19372 #include <sys/types.h>
19373 #include <db.h>
19374
19375 #ifndef DB_VERSION_MAJOR
19376 u_int32_t hash_cb (ptr, size)
19377 const void *ptr;
19378 size_t size;
19379 {
19380 }
19381 HASHINFO info;
19382 int main()
19383 {
19384         info.hash = hash_cb;
19385 }
19386 #endif
19387 EOCP
19388         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19389                 if $contains warning try.out >>/dev/null 2>&1 ; then
19390                         db_hashtype='int'
19391                 else
19392                         db_hashtype='u_int32_t'
19393                 fi
19394         else
19395                 : XXX Maybe we should just give up here.
19396                 db_hashtype=u_int32_t
19397                 $cat try.out >&4
19398                 echo "Help:  I can't seem to compile the db test program." >&4
19399                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19400         fi
19401         $rm_try
19402         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19403         ;;
19404 *)      db_hashtype=u_int32_t
19405         ;;
19406 esac
19407 case "$i_db" in
19408 define)
19409         : Check the return type needed for prefix
19410         echo " "
19411         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19412         cat >try.c <<EOCP
19413 #$d_const HASCONST
19414 #ifndef HASCONST
19415 #define const
19416 #endif
19417 #include <sys/types.h>
19418 #include <db.h>
19419
19420 #ifndef DB_VERSION_MAJOR
19421 size_t prefix_cb (key1, key2)
19422 const DBT *key1;
19423 const DBT *key2;
19424 {
19425 }
19426 BTREEINFO info;
19427 int main()
19428 {
19429         info.prefix = prefix_cb;
19430 }
19431 #endif
19432 EOCP
19433         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19434                 if $contains warning try.out >>/dev/null 2>&1 ; then
19435                         db_prefixtype='int'
19436                 else
19437                         db_prefixtype='size_t'
19438                 fi
19439         else
19440                 db_prefixtype='size_t'
19441                 : XXX Maybe we should just give up here.
19442                 $cat try.out >&4
19443                 echo "Help:  I can't seem to compile the db test program." >&4
19444                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19445         fi
19446         $rm_try
19447         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19448         ;;
19449 *)      db_prefixtype='size_t'
19450         ;;
19451 esac
19452
19453 : How can we generate normalized random numbers ?
19454 echo " "
19455 echo "Looking for a random number function..." >&4
19456 case "$randfunc" in
19457 '')
19458         if set drand48 val -f; eval $csym; $val; then
19459                 dflt="drand48"
19460                 echo "Good, found drand48()." >&4
19461         elif set random val -f; eval $csym; $val; then
19462                 dflt="random"
19463                 echo "OK, found random()." >&4
19464         else
19465                 dflt="rand"
19466                 echo "Yuck, looks like I have to use rand()." >&4
19467         fi
19468         echo " "
19469         ;;
19470 *)
19471         dflt="$randfunc"
19472         ;;
19473 esac
19474 cont=true
19475
19476 case "$ccflags" in
19477 *-Dmy_rand=*|*-Dmy_srand=*)
19478         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19479         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19480         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19481         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19482         ;;
19483 esac
19484
19485 while $test "$cont"; do
19486         rp="Use which function to generate random numbers?"
19487         . ./myread
19488         if $test "$ans" = "$dflt"; then
19489                 : null
19490         else
19491                 randbits=''
19492         fi
19493         randfunc="$ans"
19494         if set $ans val -f; eval $csym; $val; then
19495                 cont=''
19496         else
19497                 dflt=y
19498                 rp="I cannot find function $ans. Use that name anyway?"
19499                 . ./myread
19500                 dflt=rand
19501                 case "$ans" in
19502                         [yY]*) cont='';;
19503                 esac
19504         fi
19505         case "$cont" in
19506         '')
19507                 case "$randfunc" in
19508                 drand48)
19509                         drand01="drand48()"
19510                         seedfunc="srand48"
19511                         randbits=48
19512                         randseedtype=long
19513                         ;;
19514                 rand|random)
19515                         case "$randbits" in
19516                         '')
19517 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19518                                 $cat >try.c <<EOCP
19519 #$i_unistd I_UNISTD
19520 #$i_stdlib I_STDLIB
19521 #include <stdio.h>
19522 #ifdef I_UNISTD
19523 #  include <unistd.h>
19524 #endif
19525 #ifdef I_STDLIB
19526 #  include <stdlib.h>
19527 #endif
19528 int main()
19529 {
19530         int i;
19531         unsigned long tmp;
19532         unsigned long max = 0L;
19533
19534         for (i = 1000; i; i--) {
19535                 tmp = (unsigned long) $randfunc();
19536                 if (tmp > max) max = tmp;
19537         }
19538         for (i = 0; max; i++)
19539                 max /= 2;
19540         printf("%d\n",i);
19541 }
19542 EOCP
19543                                 set try
19544                                 if eval $compile_ok; then
19545                                         dflt=`try`
19546                                 else
19547                                         dflt='?'
19548                                         echo "(I can't seem to compile the test program...)"
19549                                 fi
19550                                 ;;
19551                         *)
19552                                 dflt="$randbits"
19553                                 ;;
19554                         esac
19555                         rp="How many bits does your $randfunc() function produce?"
19556                         . ./myread
19557                         randbits="$ans"
19558                         $rm_try
19559                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19560                         seedfunc="s$randfunc"
19561                         randseedtype=unsigned
19562                         ;;
19563                 *)
19564                         dflt="31"
19565                         rp="How many bits does your $randfunc() function produce?"
19566                         . ./myread
19567                         randbits="$ans"
19568                         seedfunc="s$randfunc"
19569                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19570                         if set $seedfunc val -f; eval $csym; $val; then
19571                                 echo "(Using $seedfunc() to seed random generator)"
19572                         else
19573                                 echo "(Warning: no $seedfunc() to seed random generator)"
19574                                 seedfunc=rand
19575                         fi
19576                         randseedtype=unsigned
19577                         ;;
19578                 esac
19579                 ;;
19580         esac
19581 done
19582
19583 : Check how to flush
19584 echo " "
19585 $cat >&4 <<EOM
19586 Checking how to flush all pending stdio output...
19587 EOM
19588 # I only know how to find the first 32 possibly open files on SunOS.
19589 # See also hints/sunos_4_1.sh and util.c  --AD
19590 case "$osname" in
19591 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19592 esac
19593 $cat >>try.c <<EOCP
19594 #include <stdio.h>
19595 #$i_stdlib I_STDLIB
19596 #ifdef I_STDLIB
19597 #include <stdlib.h>
19598 #endif
19599 #$i_unistd I_UNISTD
19600 #ifdef I_UNISTD
19601 # include <unistd.h>
19602 #endif
19603 #$d_sysconf HAS_SYSCONF
19604 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19605 #ifdef HAS_STDIO_STREAM_ARRAY
19606 # define STDIO_STREAM_ARRAY $stdio_stream_array
19607 #endif
19608 int main() {
19609   FILE* p;
19610   unlink("try.out");
19611   p = fopen("try.out", "w");
19612 #ifdef TRY_FPUTC
19613   fputc('x', p);
19614 #else
19615 # ifdef TRY_FPRINTF
19616   fprintf(p, "x");
19617 # endif
19618 #endif
19619 #ifdef TRY_FFLUSH_NULL
19620   fflush(NULL);
19621 #endif
19622 #ifdef TRY_FFLUSH_ALL
19623   {
19624     long open_max = -1;
19625 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19626     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19627 # else
19628 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19629     open_max = sysconf(_SC_OPEN_MAX);
19630 #  else
19631 #   ifdef FOPEN_MAX
19632     open_max = FOPEN_MAX;
19633 #   else
19634 #    ifdef OPEN_MAX
19635     open_max = OPEN_MAX;
19636 #    else
19637 #     ifdef _NFILE
19638     open_max = _NFILE;
19639 #     endif
19640 #    endif
19641 #   endif
19642 #  endif
19643 # endif
19644 # ifdef HAS_STDIO_STREAM_ARRAY
19645     if (open_max > 0) {
19646       long i;
19647       for (i = 0; i < open_max; i++)
19648             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19649                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19650                 STDIO_STREAM_ARRAY[i]._flag)
19651                 fflush(&STDIO_STREAM_ARRAY[i]);
19652     }
19653   }
19654 # endif
19655 #endif
19656   _exit(42);
19657 }
19658 EOCP
19659 : first we have to find out how _not_ to flush
19660 $to try.c
19661 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19662     output=''
19663     set try -DTRY_FPUTC
19664     if eval $compile; then
19665             $run ./try 2>/dev/null
19666             code="$?"
19667             $from try.out
19668             if $test ! -s try.out -a "X$code" = X42; then
19669                 output=-DTRY_FPUTC
19670             fi
19671     fi
19672     case "$output" in
19673     '')
19674             set try -DTRY_FPRINTF
19675             if eval $compile; then
19676                     $run ./try 2>/dev/null
19677                     code="$?"
19678                     $from try.out
19679                     if $test ! -s try.out -a "X$code" = X42; then
19680                         output=-DTRY_FPRINTF
19681                     fi
19682             fi
19683         ;;
19684     esac
19685 fi
19686 : check for fflush NULL behavior
19687 case "$fflushNULL" in
19688 '')     set try -DTRY_FFLUSH_NULL $output
19689         if eval $compile; then
19690                 $run ./try 2>/dev/null
19691                 code="$?"
19692                 $from try.out
19693                 if $test -s try.out -a "X$code" = X42; then
19694                         fflushNULL="`$cat try.out`"
19695                 else
19696                         if $test "X$code" != X42; then
19697                                 $cat >&4 <<EOM
19698 (If this test failed, don't worry, we'll try another method shortly.)
19699 EOM
19700                         fi
19701                 fi
19702         fi
19703         $rm -f core try.core core.try.*
19704         case "$fflushNULL" in
19705         x)      $cat >&4 <<EOM
19706 Your fflush(NULL) works okay for output streams.
19707 Let's see if it clobbers input pipes...
19708 EOM
19709 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19710 # bug that improperly flushes the input end of pipes.  So we avoid the
19711 # autoflush on fork/system/exec support for now. :-(
19712 $cat >tryp.c <<EOCP
19713 #include <stdio.h>
19714 int
19715 main(int argc, char **argv)
19716 {
19717     char buf[1024];
19718     int i;
19719     char *bp = buf;
19720     while (1) {
19721         while ((i = getc(stdin)) != -1
19722                && (*bp++ = i) != '\n'
19723                && bp < &buf[1024])
19724         /* DO NOTHING */ ;
19725         *bp = '\0';
19726         fprintf(stdout, "%s", buf);
19727         fflush(NULL);
19728         if (i == -1)
19729             return 0;
19730         bp = buf;
19731     }
19732 }
19733 EOCP
19734                 fflushNULL="$define"
19735                 set tryp
19736                 if eval $compile; then
19737                     $rm -f tryp.out
19738                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19739                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19740                        $cat >&4 <<EOM
19741 fflush(NULL) seems to behave okay with input streams.
19742 EOM
19743                         fflushNULL="$define"
19744                     else
19745                         $cat >&4 <<EOM
19746 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19747 EOM
19748                         fflushNULL="$undef"
19749                     fi
19750                 fi
19751                 $rm -f core tryp.c tryp.core core.tryp.*
19752                 ;;
19753         '')     $cat >&4 <<EOM
19754 Your fflush(NULL) isn't working (contrary to ANSI C).
19755 EOM
19756                 fflushNULL="$undef"
19757                 ;;
19758         *)      $cat >&4 <<EOM
19759 Cannot figure out whether your fflush(NULL) works or not.
19760 I'm assuming it doesn't (contrary to ANSI C).
19761 EOM
19762                 fflushNULL="$undef"
19763                 ;;
19764         esac
19765         ;;
19766 $define|true|[yY]*)
19767         fflushNULL="$define"
19768         ;;
19769 *)
19770         fflushNULL="$undef"
19771         ;;
19772 esac
19773 : check explicit looping only if NULL did not work, and if the pipe
19774 : bug does not show up on an explicit flush too
19775 case "$fflushNULL" in
19776 "$undef")
19777         $cat >tryp.c <<EOCP
19778 #include <stdio.h>
19779 int
19780 main(int argc, char **argv)
19781 {
19782     char buf[1024];
19783     int i;
19784     char *bp = buf;
19785     while (1) {
19786         while ((i = getc(stdin)) != -1
19787                && (*bp++ = i) != '\n'
19788                && bp < &buf[1024])
19789         /* DO NOTHING */ ;
19790         *bp = '\0';
19791         fprintf(stdout, "%s", buf);
19792         fflush(stdin);
19793         if (i == -1)
19794             return 0;
19795         bp = buf;
19796     }
19797 }
19798 EOCP
19799         set tryp
19800         if eval $compile; then
19801             $rm -f tryp.out
19802             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19803             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19804                $cat >&4 <<EOM
19805 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19806 EOM
19807                 : now check for fflushall behaviour
19808                 case "$fflushall" in
19809                 '')     set try -DTRY_FFLUSH_ALL $output
19810                         if eval $compile; then
19811                                 $cat >&4 <<EOM
19812 (Now testing the other method--but note that this also may fail.)
19813 EOM
19814                                 $run ./try 2>/dev/null
19815                                 code=$?
19816                                 $from try.out
19817                                 if $test -s try.out -a "X$code" = X42; then
19818                                         fflushall="`$cat try.out`"
19819                                 fi
19820                         fi
19821                         $rm_try
19822                         case "$fflushall" in
19823                         x)      $cat >&4 <<EOM
19824 Whew. Flushing explicitly all the stdio streams works.
19825 EOM
19826                                 fflushall="$define"
19827                                 ;;
19828                         '')     $cat >&4 <<EOM
19829 Sigh. Flushing explicitly all the stdio streams doesn't work.
19830 EOM
19831                                 fflushall="$undef"
19832                                 ;;
19833                         *)      $cat >&4 <<EOM
19834 Cannot figure out whether flushing stdio streams explicitly works or not.
19835 I'm assuming it doesn't.
19836 EOM
19837                                 fflushall="$undef"
19838                                 ;;
19839                         esac
19840                         ;;
19841                 "$define"|true|[yY]*)
19842                         fflushall="$define"
19843                         ;;
19844                 *)
19845                         fflushall="$undef"
19846                         ;;
19847                 esac
19848             else
19849                 $cat >&4 <<EOM
19850 All is futile.  Even fflush(stdin) clobbers input pipes!
19851 EOM
19852                 fflushall="$undef"
19853             fi
19854         else
19855             fflushall="$undef"
19856         fi
19857         $rm -f core tryp.c tryp.core core.tryp.*
19858         ;;
19859 *)      fflushall="$undef"
19860         ;;
19861 esac
19862
19863 case "$fflushNULL$fflushall" in
19864 undefundef)
19865         $cat <<EOM
19866 OK, I give up.  I cannot figure out how to flush pending stdio output.
19867 We won't be flushing handles at all before fork/exec/popen.
19868 EOM
19869         ;;
19870 esac
19871 $rm_try tryp
19872
19873 : Store the full pathname to the ar program for use in the C program
19874 : Respect a hint or command line value for full_ar.
19875 case "$full_ar" in
19876 '') full_ar=$ar ;;
19877 esac
19878
19879 : Store the full pathname to the sed program for use in the C program
19880 full_sed=$sed
19881
19882 : see what type gids are declared as in the kernel
19883 echo " "
19884 echo "Looking for the type for group ids returned by getgid()."
19885 set gid_t gidtype xxx stdio.h sys/types.h
19886 eval $typedef
19887 case "$gidtype" in
19888 xxx)
19889         xxx=`./findhdr sys/user.h`
19890         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19891         case $1 in
19892         unsigned) dflt="$1 $2" ;;
19893         *) dflt="$1" ;;
19894         esac
19895         ;;
19896 *) dflt="$gidtype";;
19897 esac
19898 case "$gidtype" in
19899 gid_t) echo "gid_t found." ;;
19900 *)      rp="What is the type for group ids returned by getgid()?"
19901         . ./myread
19902         gidtype="$ans"
19903         ;;
19904 esac
19905
19906 : Check the size of GID
19907 echo " "
19908 case "$gidtype" in
19909 *_t) zzz="$gidtype"     ;;
19910 *)   zzz="gid"          ;;
19911 esac
19912 echo "Checking the size of $zzz..." >&4
19913 cat > try.c <<EOCP
19914 #include <sys/types.h>
19915 #include <stdio.h>
19916 #$i_stdlib I_STDLIB
19917 #ifdef I_STDLIB
19918 #include <stdlib.h>
19919 #endif
19920 int main() {
19921     printf("%d\n", (int)sizeof($gidtype));
19922     exit(0);
19923 }
19924 EOCP
19925 set try
19926 if eval $compile_ok; then
19927         yyy=`$run ./try`
19928         case "$yyy" in
19929         '')     gidsize=4
19930                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19931                 ;;
19932         *)      gidsize=$yyy
19933                 echo "Your $zzz is $gidsize bytes long."
19934                 ;;
19935         esac
19936 else
19937         gidsize=4
19938         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19939 fi
19940
19941
19942 : Check if GID is signed
19943 echo " "
19944 case "$gidtype" in
19945 *_t) zzz="$gidtype"     ;;
19946 *)   zzz="gid"          ;;
19947 esac
19948 echo "Checking the sign of $zzz..." >&4
19949 cat > try.c <<EOCP
19950 #include <sys/types.h>
19951 #include <stdio.h>
19952 int main() {
19953         $gidtype foo = -1;
19954         if (foo < 0)
19955                 printf("-1\n");
19956         else
19957                 printf("1\n");
19958 }
19959 EOCP
19960 set try
19961 if eval $compile; then
19962         yyy=`$run ./try`
19963         case "$yyy" in
19964         '')     gidsign=1
19965                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19966                 ;;
19967         *)      gidsign=$yyy
19968                 case "$gidsign" in
19969                  1) echo "Your $zzz is unsigned." ;;
19970                 -1) echo "Your $zzz is signed."   ;;
19971                 esac
19972                 ;;
19973         esac
19974 else
19975         gidsign=1
19976         echo "(I can't compile the test program--guessing unsigned.)" >&4
19977 fi
19978
19979
19980 : Check 64bit sizes
19981 echo " "
19982
19983 if $test X"$quadtype" != X; then
19984
19985 echo "Checking how to print 64-bit integers..." >&4
19986
19987 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19988         $cat >try.c <<'EOCP'
19989 #include <sys/types.h>
19990 #include <stdio.h>
19991 int main() {
19992   int q = 12345678901;
19993   printf("%ld\n", q);
19994 }
19995 EOCP
19996         set try
19997         if eval $compile; then
19998                 yyy=`$run ./try`
19999                 case "$yyy" in
20000                 12345678901)
20001                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20002                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20003                         echo "We will use %d."
20004                         ;;
20005                 esac
20006         fi
20007 fi
20008
20009 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20010         $cat >try.c <<'EOCP'
20011 #include <sys/types.h>
20012 #include <stdio.h>
20013 int main() {
20014   long q = 12345678901;
20015   printf("%ld\n", q);
20016 }
20017 EOCP
20018         set try
20019         if eval $compile; then
20020                 yyy=`$run ./try`
20021                 case "$yyy" in
20022                 12345678901)
20023                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20024                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20025                         echo "We will use %ld."
20026                         ;;
20027                 esac
20028         fi
20029 fi
20030
20031 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20032         $cat >try.c <<'EOCP'
20033 #include <sys/types.h>
20034 #include <inttypes.h>
20035 #include <stdio.h>
20036 int main() {
20037   int64_t q = 12345678901;
20038   printf("%" PRId64 "\n", q);
20039 }
20040 EOCP
20041         set try
20042         if eval $compile; then
20043                 yyy=`$run ./try`
20044                 case "$yyy" in
20045                 12345678901)
20046                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20047                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20048                         echo "We will use the C9X style."
20049                         ;;
20050                 esac
20051         fi
20052 fi
20053
20054 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20055         $cat >try.c <<EOCP
20056 #include <sys/types.h>
20057 #include <stdio.h>
20058 int main() {
20059   $quadtype q = 12345678901;
20060   printf("%Ld\n", q);
20061 }
20062 EOCP
20063         set try
20064         if eval $compile; then
20065                 yyy=`$run ./try`
20066                 case "$yyy" in
20067                 12345678901)
20068                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20069                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20070                         echo "We will use %Ld."
20071                         ;;
20072                 esac
20073         fi
20074 fi
20075
20076 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20077         $cat >try.c <<'EOCP'
20078 #include <sys/types.h>
20079 #include <stdio.h>
20080 int main() {
20081   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20082   printf("%lld\n", q);
20083 }
20084 EOCP
20085         set try
20086         if eval $compile; then
20087                 yyy=`$run ./try`
20088                 case "$yyy" in
20089                 12345678901)
20090                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20091                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20092                         echo "We will use the %lld style."
20093                         ;;
20094                 esac
20095         fi
20096 fi
20097
20098 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20099         $cat >try.c <<EOCP
20100 #include <sys/types.h>
20101 #include <stdio.h>
20102 int main() {
20103   $quadtype q = 12345678901;
20104   printf("%qd\n", q);
20105 }
20106 EOCP
20107         set try
20108         if eval $compile; then
20109                 yyy=`$run ./try`
20110                 case "$yyy" in
20111                 12345678901)
20112                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20113                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20114                         echo "We will use %qd."
20115                         ;;
20116                 esac
20117         fi
20118 fi
20119
20120 if $test X"$sPRId64" = X; then
20121         echo "Cannot figure out how to print 64-bit integers." >&4
20122 fi
20123 $rm_try
20124
20125 fi
20126
20127 case "$sPRId64" in
20128 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20129         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20130         ;;
20131 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20132         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20133         ;;
20134 esac
20135
20136 : Check format strings for internal types
20137 echo " "
20138 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20139
20140 if $test X"$ivsize" = X8; then
20141         ivdformat="$sPRId64"
20142         uvuformat="$sPRIu64"
20143         uvoformat="$sPRIo64"
20144         uvxformat="$sPRIx64"
20145         uvXUformat="$sPRIXU64"
20146 else
20147         if $test X"$ivsize" = X"$longsize"; then
20148                 ivdformat='"ld"'
20149                 uvuformat='"lu"'
20150                 uvoformat='"lo"'
20151                 uvxformat='"lx"'
20152                 uvXUformat='"lX"'
20153         else
20154                 if $test X"$ivsize" = X"$intsize"; then
20155                         ivdformat='"d"'
20156                         uvuformat='"u"'
20157                         uvoformat='"o"'
20158                         uvxformat='"x"'
20159                         uvXUformat='"X"'
20160                 else
20161                         : far out
20162                         if $test X"$ivsize" = X"$shortsize"; then
20163                                 ivdformat='"hd"'
20164                                 uvuformat='"hu"'
20165                                 uvoformat='"ho"'
20166                                 uvxformat='"hx"'
20167                                 uvXUformat='"hX"'
20168                         fi
20169                 fi
20170         fi
20171 fi
20172
20173 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20174         nveformat="$sPRIeldbl"
20175         nvfformat="$sPRIfldbl"
20176         nvgformat="$sPRIgldbl"
20177         nvEUformat="$sPRIEUldbl"
20178         nvFUformat="$sPRIFUldbl"
20179         nvGUformat="$sPRIGUldbl"
20180 else
20181         nveformat='"e"'
20182         nvfformat='"f"'
20183         nvgformat='"g"'
20184         nvEUformat='"E"'
20185         nvFUformat='"F"'
20186         nvGUformat='"G"'
20187 fi
20188
20189 case "$ivdformat" in
20190 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20191     exit 1
20192     ;;
20193 esac
20194
20195 : Check format string for GID
20196
20197 echo " "
20198 $echo "Checking the format string to be used for gids..." >&4
20199
20200 case "$gidsign" in
20201 -1)     if $test X"$gidsize" = X"$ivsize"; then
20202                 gidformat="$ivdformat"
20203         else
20204                 if $test X"$gidsize" = X"$longsize"; then
20205                         gidformat='"ld"'
20206                 else
20207                         if $test X"$gidsize" = X"$intsize"; then
20208                                 gidformat='"d"'
20209                         else
20210                                 if $test X"$gidsize" = X"$shortsize"; then
20211                                         gidformat='"hd"'
20212                                 fi
20213                         fi
20214                 fi
20215         fi
20216         ;;
20217 *)      if $test X"$gidsize" = X"$uvsize"; then
20218                 gidformat="$uvuformat"
20219         else
20220                 if $test X"$gidsize" = X"$longsize"; then
20221                         gidformat='"lu"'
20222                 else
20223                         if $test X"$gidsize" = X"$intsize"; then
20224                                 gidformat='"u"'
20225                         else
20226                                 if $test X"$gidsize" = X"$shortsize"; then
20227                                         gidformat='"hu"'
20228                                 fi
20229                         fi
20230                 fi
20231         fi
20232         ;;
20233 esac
20234
20235 : see if getgroups exists
20236 set getgroups d_getgrps
20237 eval $inlibc
20238
20239 : see if setgroups exists
20240 set setgroups d_setgrps
20241 eval $inlibc
20242
20243 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20244 echo " "
20245 case "$d_getgrps$d_setgrps" in
20246 *define*)
20247         case "$groupstype" in
20248         '') dflt="$gidtype" ;;
20249         *)  dflt="$groupstype" ;;
20250         esac
20251         $cat <<EOM
20252 What type of pointer is the second argument to getgroups() and setgroups()?
20253 Usually this is the same as group ids, $gidtype, but not always.
20254
20255 EOM
20256         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20257         . ./myread
20258         groupstype="$ans"
20259         ;;
20260 *)  groupstype="$gidtype";;
20261 esac
20262
20263 : MAD = Misc Attribute Definition
20264
20265 if $test $patchlevel -lt 9; then
20266 : MAD is not available in 5.8.x or earlier.
20267     ans=n;
20268 else
20269     case "$mad" in
20270     $define|true|[yY]*) dflt='y' ;;
20271     *)                  dflt='n' ;;
20272     esac
20273     cat <<EOM
20274
20275 Would you like to build with Misc Attribute Decoration? This is development
20276 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20277 overhead on the interpreter.
20278
20279 If this doesn't make any sense to you, just accept the default '$dflt'.
20280 EOM
20281     rp='Build Perl with MAD?'
20282     . ./myread
20283 fi
20284 case "$ans" in
20285 y|Y)    val="$define"
20286         madlyh='madly.h madly.act madly.tab'
20287         madlysrc='madly.c'
20288         madlyobj="madly$_o" ;;
20289 *)      val="$undef"
20290         madlyh=''
20291         madlysrc=''
20292         madlyobj='' ;;
20293 esac
20294 set mad
20295 eval $setvar
20296
20297 : check whether make sets MAKE
20298 echo " "
20299 echo "Checking if your $make program sets \$(MAKE)..." >&4
20300 case "$make_set_make" in
20301 '')
20302         $sed 's/^X //' > testmake.mak << 'EOF'
20303 Xall:
20304 X       @echo 'maketemp="$(MAKE)"'
20305 EOF
20306         case "`$make -f testmake.mak 2>/dev/null`" in
20307         *maketemp=*) make_set_make='#' ;;
20308         *)      make_set_make="MAKE=$make" ;;
20309         esac
20310         $rm -f testmake.mak
20311         ;;
20312 esac
20313 case "$make_set_make" in
20314 '#') echo "Yup, it does.";;
20315 *) echo "Nope, it doesn't.";;
20316 esac
20317
20318 : see what type is used for mode_t
20319 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20320 set mode_t modetype int stdio.h sys/types.h
20321 eval $typedef_ask
20322
20323 : see if we need va_copy
20324 echo " "
20325 case "$i_stdarg" in
20326 "$define")
20327         $cat >try.c <<EOCP
20328 #include <stdarg.h>
20329 #include <stdio.h>
20330 #$i_stdlib I_STDLIB
20331 #ifdef I_STDLIB
20332 #include <stdlib.h>
20333 #endif
20334 #include <signal.h>
20335
20336 int
20337 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20338 {
20339   return vfprintf(f, fmt, *valp);
20340 }
20341
20342 int
20343 myvfprintf(FILE *f, const  char *fmt, va_list val)
20344 {
20345   return ivfprintf(f, fmt, &val);
20346 }
20347
20348 int
20349 myprintf(char *fmt, ...)
20350 {
20351   va_list val;
20352   va_start(val, fmt);
20353   return myvfprintf(stdout, fmt, val);
20354 }
20355
20356 int
20357 main(int ac, char **av)
20358 {
20359   signal(SIGSEGV, exit);
20360
20361   myprintf("%s%cs all right, then\n", "that", '\'');
20362   exit(0);
20363 }
20364 EOCP
20365         set try
20366         if eval $compile && $run ./try 2>&1 >/dev/null; then
20367                 case "`$run ./try`" in
20368                 "that's all right, then")
20369                         okay=yes
20370                         ;;
20371                 esac
20372         fi
20373         case "$okay" in
20374         yes)    echo "It seems that you don't need va_copy()." >&4
20375                 need_va_copy="$undef"
20376                 ;;
20377         *)      echo "It seems that va_copy() or similar will be needed." >&4
20378                 need_va_copy="$define"
20379                 ;;
20380         esac
20381         $rm_try
20382         ;;
20383 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20384         need_va_copy="$undef"
20385         ;;
20386 esac
20387
20388 : see what type is used for size_t
20389 rp="What is the type used for the length parameter for string functions?"
20390 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20391 eval $typedef_ask
20392
20393 : check for type of arguments to gethostbyaddr. 
20394 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20395         case "$d_gethbyaddr" in
20396         $define)
20397                 $cat <<EOM
20398
20399 Checking to see what type of arguments are accepted by gethostbyaddr().
20400 EOM
20401                 hdrs="$define sys/types.h
20402                         $d_socket sys/socket.h 
20403                         $i_niin netinet/in.h 
20404                         $i_netdb netdb.h
20405                         $i_unistd unistd.h"
20406                 : The first arg can 'char *' or 'void *'
20407                 : The second arg is some of integral type
20408                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20409                         for yyy in size_t long int; do
20410                                 case "$netdb_host_type" in
20411                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20412                                         if ./protochk "$try" $hdrs; then
20413                                                 echo "Your system accepts $xxx for the first arg."
20414                                                 echo "...and $yyy for the second arg."
20415                                                 netdb_host_type="$xxx"
20416                                                 netdb_hlen_type="$yyy"
20417                                         fi
20418                                         ;;
20419                                 esac
20420                         done
20421                 done
20422                 : In case none of those worked, prompt the user.
20423                 case "$netdb_host_type" in
20424                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20425                         dflt='char *'
20426                         . ./myread
20427                         netdb_host_type=$ans
20428                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20429                         dflt="$sizetype"
20430                         . ./myread
20431                         netdb_hlen_type=$ans
20432                         ;;
20433                 esac
20434                 ;;
20435         *)      : no gethostbyaddr, so pick harmless defaults
20436                 netdb_host_type='char *'
20437                 netdb_hlen_type="$sizetype"
20438                 ;;
20439         esac
20440         # Remove the "const" if needed. -- but then we'll have a 
20441         # prototype clash!
20442         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20443 fi
20444
20445 : check for type of argument to gethostbyname. 
20446 if test "X$netdb_name_type" = X ; then
20447         case "$d_gethbyname" in
20448         $define)
20449                 $cat <<EOM
20450
20451 Checking to see what type of argument is accepted by gethostbyname().
20452 EOM
20453                 hdrs="$define sys/types.h
20454                         $d_socket sys/socket.h 
20455                         $i_niin netinet/in.h 
20456                         $i_netdb netdb.h
20457                         $i_unistd unistd.h"
20458                 for xxx in "const char *" "char *"; do
20459                         case "$netdb_name_type" in
20460                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20461                                 if ./protochk "$try" $hdrs; then
20462                                         echo "Your system accepts $xxx."
20463                                         netdb_name_type="$xxx"
20464                                 fi
20465                                 ;;
20466                         esac
20467                 done
20468                 : In case none of those worked, prompt the user.
20469                 case "$netdb_name_type" in
20470                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20471                         dflt='char *'
20472                         . ./myread
20473                         netdb_name_type=$ans
20474                         ;;
20475                 esac
20476                 ;;
20477         *)      : no gethostbyname, so pick harmless default
20478                 netdb_name_type='char *'
20479                 ;;
20480         esac
20481 fi
20482
20483 : check for type of 1st argument to getnetbyaddr. 
20484 if test "X$netdb_net_type" = X ; then
20485         case "$d_getnbyaddr" in
20486         $define)
20487                 $cat <<EOM
20488
20489 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20490 EOM
20491                 hdrs="$define sys/types.h
20492                         $d_socket sys/socket.h 
20493                         $i_niin netinet/in.h 
20494                         $i_netdb netdb.h
20495                         $i_unistd unistd.h"
20496                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20497                         case "$netdb_net_type" in
20498                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20499                                 if ./protochk "$try" $hdrs; then
20500                                         echo "Your system accepts $xxx."
20501                                         netdb_net_type="$xxx"
20502                                 fi
20503                                 ;;
20504                         esac
20505                 done
20506                 : In case none of those worked, prompt the user.
20507                 case "$netdb_net_type" in
20508                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20509                         dflt='long'
20510                         . ./myread
20511                         netdb_net_type=$ans
20512                         ;;
20513                 esac
20514                 ;;
20515         *)      : no getnetbyaddr, so pick harmless default
20516                 netdb_net_type='long'
20517                 ;;
20518         esac
20519 fi
20520 : locate the preferred pager for this system
20521 fn=f/
20522 case "$pager" in
20523 '')
20524         dflt=''
20525         case "$pg" in
20526         /*) dflt=$pg;;
20527         [a-zA-Z]:/*) dflt=$pg;;
20528         esac
20529         case "$more" in
20530         /*) dflt=$more;;
20531         [a-zA-Z]:/*) dflt=$more;;
20532         esac
20533         case "$less" in
20534         /*) dflt=$less;;
20535         [a-zA-Z]:/*) dflt=$less;;
20536         esac
20537         case "$dflt" in
20538         '') dflt=/usr/ucb/more;;
20539         esac
20540         ;;
20541 *)      dflt="$pager"
20542         ;;
20543 esac
20544 fn="f/($dflt)"
20545 echo " "
20546 rp='What pager is used on your system?'
20547 . ./getfile
20548 pager="$ans"
20549
20550 : see what type pids are declared as in the kernel
20551 rp="What is the type of process ids on this system?"
20552 set pid_t pidtype int stdio.h sys/types.h
20553 eval $typedef_ask
20554
20555 : see if ar generates random libraries by itself
20556 echo " "
20557 echo "Checking how to generate random libraries on your machine..." >&4
20558 echo 'int bar1() { return bar2(); }' > bar1.c
20559 echo 'int bar2() { return 2; }' > bar2.c
20560 $cat > foo.c <<EOP
20561 #$i_stdlib I_STDLIB
20562 #ifdef I_STDLIB
20563 #include <stdlib.h>
20564 #endif
20565 int main() { printf("%d\n", bar1()); exit(0); }
20566 EOP
20567 $cc $ccflags -c bar1.c >/dev/null 2>&1
20568 $cc $ccflags -c bar2.c >/dev/null 2>&1
20569 $cc $ccflags -c foo.c >/dev/null 2>&1
20570 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20571 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20572         $run ./foobar >/dev/null 2>&1; then
20573         echo "$ar appears to generate random libraries itself."
20574         orderlib=false
20575         if [ "X$ranlib" = "X" ]; then
20576             ranlib=":"
20577         fi
20578 elif $ar s bar$_a >/dev/null 2>&1 &&
20579         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20580         $run ./foobar >/dev/null 2>&1; then
20581                 echo "a table of contents needs to be added with '$ar s'."
20582                 orderlib=false
20583                 ranlib="$ar s"
20584 elif $ar ts bar$_a >/dev/null 2>&1 &&
20585         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20586         $run ./foobar >/dev/null 2>&1; then
20587                 echo "a table of contents needs to be added with '$ar ts'."
20588                 orderlib=false
20589                 ranlib="$ar ts"
20590 else
20591         case "$ranlib" in
20592         :) ranlib='';;
20593         '')
20594                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20595                 $test -f $ranlib || ranlib=''
20596                 ;;
20597         esac
20598         if $test -n "$ranlib"; then
20599                 echo "your system has '$ranlib'; we'll use that."
20600                 orderlib=false
20601         else
20602                 echo "your system doesn't seem to support random libraries"
20603                 echo "so we'll use lorder and tsort to order the libraries."
20604                 orderlib=true
20605                 ranlib=":"
20606         fi
20607 fi
20608 $rm -f foo* bar*
20609
20610 : see if this is a values.h system
20611 set values.h i_values
20612 eval $inhdr
20613
20614 : Check the max offset that gmtime and localtime accept
20615 echo "Checking max offsets that gmtime () accepts"
20616
20617 case $i_values in
20618     define) yyy="#include <values.h>" ;;
20619     *)      yyy="" ;;
20620     esac
20621
20622 case "$sGMTIME_min/$sGMTIME_max" in
20623     0/0|/)
20624         $cat >try.c <<EOCP
20625 #include <sys/types.h>
20626 #include <stdio.h>
20627 #include <time.h>
20628 $yyy
20629
20630 int i;
20631 struct tm *tmp;
20632 time_t pt;
20633
20634 void gm_check (time_t t, int min_year, int max_year)
20635 {
20636     tmp = gmtime (&t);
20637     if ( tmp == NULL ||
20638         /* Check tm_year overflow */
20639          tmp->tm_year < min_year || tmp->tm_year > max_year)
20640         tmp = NULL;
20641     else
20642         pt = t;
20643     } /* gm_check */
20644
20645 int check_max ()
20646 {
20647     tmp = NULL;
20648     pt  = 0;
20649 #ifdef MAXLONG
20650     gm_check (MAXLONG, 69, 0x7fffffff);
20651 #endif
20652     if (tmp == NULL || tmp->tm_year < 0) {
20653         for (i = 63; i >= 0; i--) {
20654             time_t x = pt | ((time_t)1 << i);
20655             if (x < 0 || x < pt) continue;
20656             gm_check (x, 69, 0x7fffffff);
20657             }
20658         }
20659     printf ("sGMTIME_max=%ld\n", pt);
20660     return (0);
20661     } /* check_max */
20662
20663 int check_min ()
20664 {
20665     tmp = NULL;
20666     pt  = 0;
20667 #ifdef MINLONG
20668     gm_check (MINLONG, -1900, 70);
20669 #endif
20670     if (tmp == NULL) {
20671         for (i = 36; i >= 0; i--) {
20672             time_t x = pt - ((time_t)1 << i);
20673             if (x > 0) continue;
20674             gm_check (x, -1900, 70);
20675             }
20676         }
20677     printf ("sGMTIME_min=%ld\n", pt);
20678     return (0);
20679     } /* check_min */
20680
20681 int main (int argc, char *argv[])
20682 {
20683     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20684     check_max ();
20685     check_min ();
20686     return (0);
20687     } /* main */
20688 EOCP
20689         set try
20690         if eval $compile; then
20691             eval `$run ./try`
20692         else
20693             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20694             fi
20695         $rm_try
20696         ;;
20697     esac
20698
20699 echo "Checking max offsets that localtime () accepts"
20700
20701 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20702     0/0|/)
20703         $cat >try.c <<EOCP
20704 #include <sys/types.h>
20705 #include <stdio.h>
20706 #include <time.h>
20707 $yyy
20708
20709 int i;
20710 struct tm *tmp;
20711 time_t pt;
20712
20713 void local_check (time_t t, int min_year, int max_year)
20714 {
20715     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20716         tmp = NULL;
20717     else
20718         tmp = localtime (&t);
20719     if ( tmp == NULL ||
20720         /* Check tm_year overflow */
20721          tmp->tm_year < min_year || tmp->tm_year > max_year)
20722         tmp = NULL;
20723     else
20724         pt = t;
20725     } /* local_check */
20726
20727 int check_max ()
20728 {
20729     tmp = NULL;
20730     pt  = 0;
20731 #ifdef MAXLONG
20732     local_check (MAXLONG, 69, 0x7fffffff);
20733 #endif
20734     if (tmp == NULL || tmp->tm_year < 0) {
20735         for (i = 63; i >= 0; i--) {
20736             time_t x = pt | ((time_t)1 << i);
20737             if (x < 0 || x < pt) continue;
20738             local_check (x, 69, 0x7fffffff);
20739             }
20740         }
20741     printf ("sLOCALTIME_max=%ld\n", pt);
20742     return (0);
20743    } /* check_max */
20744
20745 int check_min ()
20746 {
20747     tmp = NULL;
20748     pt  = 0;
20749 #ifdef MINLONG
20750     local_check (MINLONG, -1900, 70);
20751 #endif
20752     if (tmp == NULL) {
20753         for (i = 36; i >= 0; i--) {
20754             time_t x = pt - ((time_t)1 << i);
20755             if (x > 0) continue;
20756             local_check (x, -1900, 70);
20757             }
20758         }
20759     printf ("sLOCALTIME_min=%ld\n", pt);
20760     return (0);
20761     } /* check_min */
20762
20763 int main (int argc, char *argv[])
20764 {
20765     check_max ();
20766     check_min ();
20767     return (0);
20768     } /* main */
20769 EOCP
20770         set try
20771         if eval $compile; then
20772             eval `$run ./try`
20773         else
20774             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20775             fi
20776         $rm_try
20777         ;;
20778     esac
20779
20780 : check for type of arguments to select.
20781 case "$selecttype" in
20782 '') case "$d_select" in
20783         $define)
20784                 echo " "
20785                 $cat <<EOM
20786 Checking to see what type of arguments are accepted by select().
20787 EOM
20788                 hdrs="$define sys/types.h
20789                         $i_systime sys/time.h
20790                         $i_sysselct sys/select.h
20791                         $d_socket sys/socket.h"
20792                 : The first arg can be int, unsigned, or size_t
20793                 : The last arg may or may not be 'const'
20794                 val=''
20795                 : void pointer has been seen but using that
20796                 : breaks the selectminbits test
20797                 for xxx in 'fd_set *' 'int *'; do
20798                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20799                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20800                                         case "$val" in
20801                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20802                                                 if ./protochk "$try" $hdrs; then
20803                                                         echo "Your system accepts $xxx."
20804                                                         val="$xxx"
20805                                                 fi
20806                                                 ;;
20807                                         esac
20808                                 done
20809                         done
20810                 done
20811                 case "$val" in
20812                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20813                         case "$d_fd_set" in
20814                                 $define) dflt="fd_set *" ;;
20815                                 *)              dflt="int *" ;;
20816                         esac
20817                         . ./myread
20818                         val=$ans
20819                         ;;
20820                 esac
20821                 selecttype="$val"
20822                 ;;
20823         *)      : no select, so pick a harmless default
20824                 selecttype='int *'
20825                 ;;
20826         esac
20827         ;;
20828 esac
20829
20830 : check for the select 'width'
20831 case "$selectminbits" in
20832 '') safebits=`expr $ptrsize \* 8`
20833     case "$d_select" in
20834         $define)
20835                 $cat <<EOM
20836
20837 Checking to see on how many bits at a time your select() operates...
20838 EOM
20839                 $cat >try.c <<EOCP
20840 #include <sys/types.h>
20841 #$i_time I_TIME
20842 #$i_systime I_SYS_TIME
20843 #$i_systimek I_SYS_TIME_KERNEL
20844 #ifdef I_TIME
20845 #   include <time.h>
20846 #endif
20847 #ifdef I_SYS_TIME
20848 #   ifdef I_SYS_TIME_KERNEL
20849 #       define KERNEL
20850 #   endif
20851 #   include <sys/time.h>
20852 #   ifdef I_SYS_TIME_KERNEL
20853 #       undef KERNEL
20854 #   endif
20855 #endif
20856 #$i_sysselct I_SYS_SELECT
20857 #ifdef I_SYS_SELECT
20858 #include <sys/select.h>
20859 #endif
20860 #$d_socket HAS_SOCKET
20861 #ifdef HAS_SOCKET
20862 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20863 #endif
20864 #include <stdio.h>
20865 #$i_stdlib I_STDLIB
20866 #ifdef I_STDLIB
20867 #include <stdlib.h>
20868 #endif
20869 $selecttype b;
20870 #define S sizeof(*(b))
20871 #define MINBITS 64
20872 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20873 #define NBITS  (NBYTES * 8)
20874 int main() {
20875     char *s = (char *)malloc(NBYTES);
20876     struct timeval t;
20877     int i;
20878     FILE* fp;
20879     int fd;
20880
20881     if (!s)
20882         exit(1);
20883     fclose(stdin);
20884     fp = fopen("try.c", "r");
20885     if (fp == 0)
20886       exit(2);
20887     fd = fileno(fp);
20888     if (fd < 0)
20889       exit(3);
20890     b = ($selecttype)s;
20891     for (i = 0; i < NBITS; i++)
20892         FD_SET(i, b);
20893     t.tv_sec  = 0;
20894     t.tv_usec = 0;
20895     select(fd + 1, b, 0, 0, &t);
20896     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20897     free(s);
20898     printf("%d\n", i + 1);
20899     return 0;
20900 }
20901 EOCP
20902                 set try
20903                 if eval $compile_ok; then
20904                         selectminbits=`$run ./try`
20905                         case "$selectminbits" in
20906                         '')     cat >&4 <<EOM
20907 Cannot figure out on how many bits at a time your select() operates.
20908 I'll play safe and guess it is $safebits bits.
20909 EOM
20910                                 selectminbits=$safebits
20911                                 bits="$safebits bits"
20912                                 ;;
20913                         1)      bits="1 bit" ;;
20914                         *)      bits="$selectminbits bits" ;;
20915                         esac
20916                         echo "Your select() operates on $bits at a time." >&4
20917                 else
20918                         rp='What is the minimum number of bits your select() operates on?'
20919                         case "$byteorder" in
20920                         12345678)       dflt=64 ;;
20921                         1234)           dflt=32 ;;
20922                         *)              dflt=1  ;;
20923                         esac
20924                         . ./myread
20925                         val=$ans
20926                         selectminbits="$val"
20927                 fi
20928                 $rm_try
20929                 ;;
20930         *)      : no select, so pick a harmless default
20931                 selectminbits=$safebits
20932                 ;;
20933         esac
20934         ;;
20935 esac
20936
20937 : Trace out the files included by signal.h, then look for SIGxxx names.
20938 if [ "X$fieldn" = X ]; then
20939         : Just make some guesses.  We check them later.
20940         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20941 else
20942         xxx=`echo '#include <signal.h>' |
20943         $cppstdin $cppminus $cppflags 2>/dev/null |
20944         $grep '^[       ]*#.*include' |
20945         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20946                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20947 fi
20948 xxxfiles=''
20949 for xx in $xxx /dev/null ; do
20950         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20951 done
20952 case "$xxxfiles" in
20953 '')     xxxfiles=`./findhdr signal.h` ;;
20954 esac
20955 xxx=`awk '
20956 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20957         print substr($2, 4, 20)
20958 }
20959 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20960         print substr($3, 4, 20)
20961 }' $xxxfiles`
20962 : Append some common names just in case the awk scan failed.
20963 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20964 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20965 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20966 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20967 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20968
20969 : generate a few handy files for later
20970 $cat > signal.c <<EOCP
20971 #include <sys/types.h>
20972 #include <signal.h>
20973 #$i_stdlib I_STDLIB
20974 #ifdef I_STDLIB
20975 #include <stdlib.h>
20976 #endif
20977 #include <stdio.h>
20978 int main() {
20979
20980 /* Strange style to avoid deeply-nested #if/#else/#endif */
20981 #ifndef NSIG
20982 #  ifdef _NSIG
20983 #    define NSIG (_NSIG)
20984 #  endif
20985 #endif
20986
20987 #ifndef NSIG
20988 #  ifdef SIGMAX
20989 #    define NSIG (SIGMAX+1)
20990 #  endif
20991 #endif
20992
20993 #ifndef NSIG
20994 #  ifdef SIG_MAX
20995 #    define NSIG (SIG_MAX+1)
20996 #  endif
20997 #endif
20998
20999 #ifndef NSIG
21000 #  ifdef _SIG_MAX
21001 #    define NSIG (_SIG_MAX+1)
21002 #  endif
21003 #endif
21004
21005 #ifndef NSIG
21006 #  ifdef MAXSIG
21007 #    define NSIG (MAXSIG+1)
21008 #  endif
21009 #endif
21010
21011 #ifndef NSIG
21012 #  ifdef MAX_SIG
21013 #    define NSIG (MAX_SIG+1)
21014 #  endif
21015 #endif
21016
21017 #ifndef NSIG
21018 #  ifdef SIGARRAYSIZE
21019 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21020 #  endif
21021 #endif
21022
21023 #ifndef NSIG
21024 #  ifdef _sys_nsig
21025 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21026 #  endif
21027 #endif
21028
21029 /* Default to some arbitrary number that's big enough to get most
21030    of the common signals.
21031 */
21032 #ifndef NSIG
21033 #    define NSIG 50
21034 #endif
21035
21036 printf("NSIG %d\n", NSIG);
21037
21038 #ifndef JUST_NSIG
21039
21040 EOCP
21041
21042 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21043 {
21044         printf "#ifdef SIG"; printf $1; printf "\n"
21045         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21046         printf $1; printf ");\n"
21047         printf "#endif\n"
21048 }
21049 END {
21050         printf "#endif /* JUST_NSIG */\n";
21051         printf "exit(0);\n}\n";
21052 }
21053 ' >>signal.c
21054 $cat >signal.awk <<'EOP'
21055 BEGIN { ndups = 0 }
21056 $1 ~ /^NSIG$/ { nsig = $2 }
21057 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21058     if ($2 > maxsig) { maxsig = $2 }
21059     if (sig_name[$2]) {
21060         dup_name[ndups] = $1
21061         dup_num[ndups] = $2
21062         ndups++
21063     }
21064     else {
21065         sig_name[$2] = $1
21066         sig_num[$2] = $2
21067     }
21068 }
21069 END {
21070     if (nsig == 0) {
21071         nsig = maxsig + 1
21072     }
21073     printf("NSIG %d\n", nsig);
21074     for (n = 1; n < nsig; n++) {
21075         if (sig_name[n]) {
21076             printf("%s %d\n", sig_name[n], sig_num[n])
21077         }
21078         else {
21079             printf("NUM%d %d\n", n, n)
21080         }
21081     }
21082     for (n = 0; n < ndups; n++) {
21083         printf("%s %d\n", dup_name[n], dup_num[n])
21084     }
21085 }
21086 EOP
21087 $cat >signal_cmd <<EOS
21088 $startsh
21089 if $test -s signal.lst; then
21090     echo "Using your existing signal.lst file"
21091         exit 0
21092 fi
21093 xxx="$xxx"
21094 EOS
21095 $cat >>signal_cmd <<'EOS'
21096
21097 set signal
21098 if eval $compile_ok; then
21099         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21100                 $uniq | $awk -f signal.awk >signal.lst
21101 else
21102         echo "(I can't seem be able to compile the whole test program)" >&4
21103         echo "(I'll try it in little pieces.)" >&4
21104         set signal -DJUST_NSIG
21105         if eval $compile_ok; then
21106                 $run ./signal$_exe > signal.nsg
21107                 $cat signal.nsg
21108         else
21109                 echo "I can't seem to figure out how many signals you have." >&4
21110                 echo "Guessing 50." >&4
21111                 echo 'NSIG 50' > signal.nsg
21112         fi
21113         : Now look at all the signal names, one at a time.
21114         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21115                 $cat > signal.c <<EOCP
21116 #include <sys/types.h>
21117 #include <signal.h>
21118 #include <stdio.h>
21119 int main() {
21120 printf("$xx %d\n", SIG${xx});
21121 return 0;
21122 }
21123 EOCP
21124                 set signal
21125                 if eval $compile; then
21126                         echo "SIG${xx} found."
21127                         $run ./signal$_exe  >> signal.ls1
21128                 else
21129                         echo "SIG${xx} NOT found."
21130                 fi
21131         done
21132         if $test -s signal.ls1; then
21133                 $cat signal.nsg signal.ls1 |
21134                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21135         fi
21136
21137 fi
21138 if $test -s signal.lst; then
21139         :
21140 else
21141         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21142         echo 'kill -l' >signal
21143         set X `csh -f <signal`
21144         $rm -f signal
21145         shift
21146         case $# in
21147         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21148         esac
21149         echo $@ | $tr ' ' $trnl | \
21150             $awk '{ printf "%s %d\n", $1, ++s; }
21151                   END { printf "NSIG %d\n", ++s }' >signal.lst
21152 fi
21153 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21154 EOS
21155 chmod a+x signal_cmd
21156 $eunicefix signal_cmd
21157
21158 : generate list of signal names
21159 echo " "
21160 case "$sig_name_init" in
21161 '') doinit=yes ;;
21162 *)  case "$sig_num_init" in
21163     ''|*,*) doinit=yes ;;
21164     esac ;;
21165 esac
21166 case "$doinit" in
21167 yes)
21168         echo "Generating a list of signal names and numbers..." >&4
21169         . ./signal_cmd
21170         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21171         sig_name=`$awk 'BEGIN { printf "ZERO " }
21172                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21173         sig_num=`$awk  'BEGIN { printf "0 " }
21174                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21175         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21176                              !/^NSIG/   { printf "\"%s\", ", $1 }
21177                              END        { printf "0\n" }' signal.lst`
21178         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21179                              !/^NSIG/   { printf "%d, ", $2}
21180                              END        { printf "0\n"}' signal.lst`
21181         ;;
21182 esac
21183 echo "The following $sig_count signals are available:"
21184 echo " "
21185 echo $sig_name | $awk \
21186 'BEGIN { linelen = 0 }
21187 {
21188         for (i = 1; i <= NF; i++) {
21189                 name = "SIG" $i " "
21190                 linelen = linelen + length(name)
21191                 if (linelen > 70) {
21192                         printf "\n"
21193                         linelen = length(name)
21194                 }
21195                 printf "%s", name
21196         }
21197         printf "\n"
21198 }'
21199 sig_size=`echo $sig_name | awk '{print NF}'`
21200 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21201
21202 : Check size of size
21203 echo " "
21204 case "$sizetype" in
21205 *_t) zzz="$sizetype"    ;;
21206 *)   zzz="filesize"     ;;
21207 esac
21208 echo "Checking the size of $zzz..." >&4
21209 cat > try.c <<EOCP
21210 #include <sys/types.h>
21211 #include <stdio.h>
21212 #$i_stdlib I_STDLIB
21213 #ifdef I_STDLIB
21214 #include <stdlib.h>
21215 #endif
21216 int main() {
21217     printf("%d\n", (int)sizeof($sizetype));
21218     exit(0);
21219 }
21220 EOCP
21221 set try
21222 if eval $compile_ok; then
21223         yyy=`$run ./try`
21224         case "$yyy" in
21225         '')     sizesize=4
21226                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21227                 ;;
21228         *)      sizesize=$yyy
21229                 echo "Your $zzz size is $sizesize bytes."
21230                 ;;
21231         esac
21232 else
21233         sizesize=4
21234         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21235 fi
21236
21237
21238 : check for socklen_t
21239 echo " "
21240 echo "Checking to see if you have socklen_t..." >&4
21241 $cat >try.c <<EOCP
21242 #include <sys/types.h>
21243 #$d_socket HAS_SOCKET
21244 #ifdef HAS_SOCKET
21245 #include <sys/socket.h>
21246 #endif
21247 int main() { socklen_t x = 16; }
21248 EOCP
21249 set try
21250 if eval $compile; then
21251         val="$define"
21252         echo "You have socklen_t."
21253 else
21254         val="$undef"
21255         echo "You do not have socklen_t."
21256         case "$sizetype" in
21257         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21258         esac
21259 fi
21260 $rm_try
21261 set d_socklen_t
21262 eval $setvar
21263
21264 : see if this is a socks.h system
21265 set socks.h i_socks
21266 eval $inhdr
21267
21268 : check for type of the size argument to socket calls
21269 case "$d_socket" in
21270 "$define")
21271         $cat <<EOM
21272
21273 Checking to see what type is the last argument of accept().
21274 EOM
21275         yyy=''
21276         case "$d_socklen_t" in
21277         "$define") yyy="$yyy socklen_t"
21278         esac
21279         yyy="$yyy $sizetype int long unsigned"
21280         for xxx in $yyy; do
21281                 case "$socksizetype" in
21282                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21283                         case "$usesocks" in
21284                         "$define")
21285                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21286                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21287                                         socksizetype="$xxx"
21288                                 fi
21289                                 ;;
21290                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21291                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21292                                         socksizetype="$xxx"
21293                                 fi
21294                                 ;;
21295                         esac
21296                         ;;
21297                 esac
21298         done
21299 : In case none of those worked, prompt the user.
21300         case "$socksizetype" in
21301         '')     rp='What is the type for socket address structure sizes?'
21302                 dflt='int'
21303                 . ./myread
21304                 socksizetype=$ans
21305                 ;;
21306         esac
21307         ;;
21308 *)      : no sockets, so pick relatively harmless default
21309         socksizetype='int'
21310         ;;
21311 esac
21312
21313 : see what type is used for signed size_t
21314 set ssize_t ssizetype int stdio.h sys/types.h
21315 eval $typedef
21316 dflt="$ssizetype"
21317 $cat > try.c <<EOM
21318 #include <stdio.h>
21319 #$i_stdlib I_STDLIB
21320 #ifdef I_STDLIB
21321 #include <stdlib.h>
21322 #endif
21323 #include <sys/types.h>
21324 #define Size_t $sizetype
21325 #define SSize_t $dflt
21326 int main()
21327 {
21328         if (sizeof(Size_t) == sizeof(SSize_t))
21329                 printf("$dflt\n");
21330         else if (sizeof(Size_t) == sizeof(int))
21331                 printf("int\n");
21332         else
21333                 printf("long\n");
21334         exit(0);
21335 }
21336 EOM
21337 echo " "
21338 set try
21339 if eval $compile_ok && $run ./try > /dev/null; then
21340         ssizetype=`$run ./try`
21341         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21342 else
21343         $cat >&4 <<EOM
21344 Help! I can't compile and run the ssize_t test program: please enlighten me!
21345 (This is probably a misconfiguration in your system or libraries, and
21346 you really ought to fix it.  Still, I'll try anyway.)
21347
21348 I need a type that is the same size as $sizetype, but is guaranteed to
21349 be signed.  Common values are ssize_t, int and long.
21350
21351 EOM
21352         rp="What signed type is the same size as $sizetype?"
21353         . ./myread
21354         ssizetype="$ans"
21355 fi
21356 $rm_try
21357
21358 : Check the size of st_ino
21359 $echo " "
21360 $echo "Checking the size of st_ino..." >&4
21361 $cat > try.c <<EOCP
21362 #include <sys/stat.h>
21363 #include <stdio.h>
21364 #$i_stdlib I_STDLIB
21365 #ifdef I_STDLIB
21366 #include <stdlib.h>
21367 #endif
21368 int main() {
21369     struct stat st;
21370     printf("%d\n", (int)sizeof(st.st_ino));
21371     exit(0);
21372 }
21373 EOCP
21374 set try
21375 if eval $compile_ok; then
21376         val=`$run ./try`
21377         case "$val" in
21378         '')     st_ino_size=4
21379                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21380                 ;;
21381         *)      st_ino_size=$val
21382                 $echo "Your st_ino is $st_ino_size bytes long."
21383                 ;;
21384         esac
21385 else
21386         st_ino_size=4
21387         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21388 fi
21389 $rm_try
21390
21391 : Check if st_ino is signed
21392 $echo " "
21393 $echo "Checking the sign of st_ino..." >&4
21394 $cat > try.c <<EOCP
21395 #include <sys/stat.h>
21396 #include <stdio.h>
21397 int main() {
21398         struct stat foo;
21399         foo.st_ino = -1;
21400         if (foo.st_ino < 0)
21401                 printf("-1\n");
21402         else
21403                 printf("1\n");
21404 }
21405 EOCP
21406 set try
21407 if eval $compile; then
21408         val=`$run ./try`
21409         case "$val" in
21410         '')     st_ino_sign=1
21411                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21412                 ;;
21413         *)      st_ino_sign=$val
21414                 case "$st_ino_sign" in
21415                  1) $echo "Your st_ino is unsigned." ;;
21416                 -1) $echo "Your st_ino is signed."   ;;
21417                 esac
21418                 ;;
21419         esac
21420 else
21421         st_ino_sign=1
21422         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21423 fi
21424 $rm_try
21425
21426 : see what type of char stdio uses.
21427 echo " "
21428 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21429 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21430         echo "Your stdio uses unsigned chars." >&4
21431         stdchar="unsigned char"
21432 else
21433         echo "Your stdio uses signed chars." >&4
21434         stdchar="char"
21435 fi
21436 $rm -f stdioh
21437
21438 : see what type uids are declared as in the kernel
21439 echo " "
21440 echo "Looking for the type for user ids returned by getuid()."
21441 set uid_t uidtype xxx stdio.h sys/types.h
21442 eval $typedef
21443 case "$uidtype" in
21444 xxx)
21445         xxx=`./findhdr sys/user.h`
21446         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21447         case $1 in
21448         unsigned) dflt="$1 $2" ;;
21449         *) dflt="$1" ;;
21450         esac
21451         ;;
21452 *) dflt="$uidtype";;
21453 esac
21454 case "$uidtype" in
21455 uid_t)  echo "uid_t found." ;;
21456 *)      rp="What is the type for user ids returned by getuid()?"
21457         . ./myread
21458         uidtype="$ans"
21459         ;;
21460 esac
21461
21462 : Check size of UID
21463 echo " "
21464 case "$uidtype" in
21465 *_t) zzz="$uidtype"     ;;
21466 *)   zzz="uid"          ;;
21467 esac
21468 echo "Checking the size of $zzz..." >&4
21469 cat > try.c <<EOCP
21470 #include <sys/types.h>
21471 #include <stdio.h>
21472 #$i_stdlib I_STDLIB
21473 #ifdef I_STDLIB
21474 #include <stdlib.h>
21475 #endif
21476 int main() {
21477     printf("%d\n", (int)sizeof($uidtype));
21478     exit(0);
21479 }
21480 EOCP
21481 set try
21482 if eval $compile_ok; then
21483         yyy=`$run ./try`
21484         case "$yyy" in
21485         '')     uidsize=4
21486                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21487                 ;;
21488         *)      uidsize=$yyy
21489                 echo "Your $zzz is $uidsize bytes long."
21490                 ;;
21491         esac
21492 else
21493         uidsize=4
21494         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21495 fi
21496
21497 : Check if UID is signed
21498 echo " "
21499 case "$uidtype" in
21500 *_t) zzz="$uidtype"     ;;
21501 *)   zzz="uid"          ;;
21502 esac
21503 echo "Checking the sign of $zzz..." >&4
21504 cat > try.c <<EOCP
21505 #include <sys/types.h>
21506 #include <stdio.h>
21507 int main() {
21508         $uidtype foo = -1;
21509         if (foo < 0)
21510                 printf("-1\n");
21511         else
21512                 printf("1\n");
21513 }
21514 EOCP
21515 set try
21516 if eval $compile; then
21517         yyy=`$run ./try`
21518         case "$yyy" in
21519         '')     uidsign=1
21520                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21521                 ;;
21522         *)      uidsign=$yyy
21523                 case "$uidsign" in
21524                  1) echo "Your $zzz is unsigned." ;;
21525                 -1) echo "Your $zzz is signed."   ;;
21526                 esac
21527                 ;;
21528         esac
21529 else
21530         uidsign=1
21531         echo "(I can't compile the test program--guessing unsigned.)" >&4
21532 fi
21533
21534
21535 : Check format string for UID
21536 echo " "
21537 $echo "Checking the format string to be used for uids..." >&4
21538
21539 case "$uidsign" in
21540 -1)     if $test X"$uidsize" = X"$ivsize"; then
21541                 uidformat="$ivdformat"
21542         else
21543                 if $test X"$uidsize" = X"$longsize"; then
21544                         uidformat='"ld"'
21545                 else
21546                         if $test X"$uidsize" = X"$intsize"; then
21547                                 uidformat='"d"'
21548                         else
21549                                 if $test X"$uidsize" = X"$shortsize"; then
21550                                         uidformat='"hd"'
21551                                 fi
21552                         fi
21553                 fi
21554         fi
21555         ;;
21556 *)      if $test X"$uidsize" = X"$uvsize"; then
21557                 uidformat="$uvuformat"
21558         else
21559                 if $test X"$uidsize" = X"$longsize"; then
21560                         uidformat='"lu"'
21561                 else
21562                         if $test X"$uidsize" = X"$intsize"; then
21563                                 uidformat='"u"'
21564                         else
21565                                 if $test X"$uidsize" = X"$shortsize"; then
21566                                         uidformat='"hu"'
21567                                 fi
21568                         fi
21569                 fi
21570         fi
21571         ;;
21572 esac
21573
21574 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21575 echo " "
21576 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21577 $cat >try.c <<'EOM'
21578 /* Intentionally a long probe as I'd like to sanity check that the exact
21579    approach is going to work, as thinking it will work, but only having it
21580    part working at runtime is worse than not having it.  */
21581
21582 #include <sys/types.h>
21583 #include <sys/sysctl.h>
21584 #include <sys/param.h>
21585 #include <stdio.h>
21586 #include <string.h>
21587 #include <stdlib.h>
21588 #include <unistd.h>
21589
21590 int
21591 main(int argc, char **argv) {
21592     char *buffer;
21593     char *argv_leaf = strrchr(argv[0], '/');
21594     char *buffer_leaf;
21595     size_t size = 0;
21596     int mib[4];
21597
21598     mib[0] = CTL_KERN;
21599     mib[1] = KERN_PROC;
21600     mib[2] = KERN_PROC_PATHNAME;
21601     mib[3] = -1;
21602
21603     if (!argv_leaf) {
21604         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21605         return 1;
21606     }
21607
21608     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21609         perror("sysctl");
21610         return 2;
21611     }
21612
21613     if (size < strlen(argv_leaf) + 1) {
21614         fprintf(stderr, "size %lu is too short for a path\n",
21615                 (unsigned long) size);
21616         return 3;
21617     }
21618
21619     if (size > MAXPATHLEN * MAXPATHLEN) {
21620         fprintf(stderr, "size %lu is too long for a path\n",
21621                 (unsigned long) size);
21622         return 4;
21623     }
21624
21625     buffer = malloc(size);
21626     if (!buffer) {
21627         perror("malloc");
21628         return 5;
21629     }
21630
21631     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21632         perror("sysctl");
21633         return 6;
21634     }
21635
21636     if (strlen(buffer) + 1 != size) {
21637         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21638                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21639         return 7;
21640     }
21641
21642
21643     if (*buffer != '/') {
21644         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21645         return 8;
21646     }
21647
21648     if (strstr(buffer, "/./")) {
21649         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21650         return 9;
21651     }
21652
21653     if (strstr(buffer, "/../")) {
21654         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21655         return 10;
21656     }
21657
21658     buffer_leaf = strrchr(buffer, '/');
21659     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21660         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21661         return 11;
21662     }
21663
21664     free(buffer);
21665
21666     return 0;
21667 }
21668 EOM
21669
21670 val=$undef
21671 set try
21672 if eval $compile; then
21673         if $run ./try; then
21674                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21675                 val="$define"
21676         else
21677                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21678                 val="$undef"
21679         fi
21680 else
21681         echo "I'm unable to compile the test program." >&4
21682         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21683         val="$undef"
21684 fi
21685 $rm_try
21686 set usekernprocpathname
21687 eval $setvar
21688
21689 : Determine if we can use _NSGetExecutablePath to find executing program
21690 echo " "
21691 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21692 $cat >try.c <<'EOM'
21693 /* Intentionally a long probe as I'd like to sanity check that the exact
21694    approach is going to work, as thinking it will work, but only having it
21695    part working at runtime is worse than not having it.  */
21696 #include <mach-o/dyld.h>
21697 #include <stdio.h>
21698 #include <stdlib.h>
21699 #include <sys/param.h>
21700 #include <string.h>
21701
21702 int
21703 main(int argc, char **argv) {
21704     char buf[1];
21705     uint32_t size = sizeof(buf);
21706     int result;
21707     char *buffer;
21708     char *tidied;
21709     char *argv_leaf = strrchr(argv[0], '/');
21710     char *tidied_leaf;
21711
21712     if (!argv_leaf) {
21713         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21714         return 1;
21715     }
21716
21717     _NSGetExecutablePath(buf, &size);
21718     if (size > MAXPATHLEN * MAXPATHLEN) {
21719         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21720                 (unsigned int) size);
21721         return 2;
21722     }
21723
21724     buffer = malloc(size);
21725     if (!buffer) {
21726         perror("malloc");
21727         return 3;
21728     }
21729
21730     result = _NSGetExecutablePath(buffer, &size);
21731     if (result != 0) {
21732         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21733                 result, (unsigned int) size);
21734         return 4;
21735     }
21736
21737     tidied = realpath(buffer, NULL);
21738     if (!tidied) {
21739         perror("realpath");
21740         return 5;
21741     }
21742
21743     free(buffer);
21744
21745     if (*tidied != '/') {
21746         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21747         return 6;
21748     }
21749
21750     if (strstr(tidied, "/./")) {
21751         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21752         return 7;
21753     }
21754
21755     if (strstr(tidied, "/../")) {
21756         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21757         return 8;
21758     }
21759
21760     tidied_leaf = strrchr(tidied, '/');
21761     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21762         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21763         return 9;
21764     }
21765
21766     free(tidied);
21767
21768     return 0;
21769 }
21770 EOM
21771
21772 val=$undef
21773 set try
21774 if eval $compile; then
21775         if $run ./try; then
21776                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21777                 val="$define"
21778         else
21779                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21780         fi
21781 else
21782         echo "I'm unable to compile the test program." >&4
21783         echo "I'll assume no _NSGetExecutablePath here." >&4
21784 fi
21785 $rm_try
21786 set usensgetexecutablepath
21787 eval $setvar
21788
21789 : Check if site customization support was requested
21790 case "$usesitecustomize" in
21791     $define|true|[Yy]*)
21792         usesitecustomize="$define"
21793         ;;
21794     *)
21795         usesitecustomize="$undef"
21796         ;;
21797     esac
21798
21799 : see if prototypes support variable argument declarations
21800 echo " "
21801 case "$prototype$i_stdarg" in
21802 $define$define)
21803         echo "It appears we'll be able to prototype varargs functions." >&4
21804         val="$define"
21805         ;;
21806 *)
21807         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21808         val="$undef"
21809         ;;
21810 esac
21811 set vaproto
21812 eval $setvar
21813
21814 : determine compiler compiler
21815 case "$yacc" in
21816 '')
21817         dflt=yacc;;
21818 *)
21819         dflt="$yacc";;
21820 esac
21821 echo " "
21822 comp='yacc'
21823 if $test -f "$byacc$_exe"; then
21824         dflt="$byacc"
21825         comp="byacc or $comp"
21826 fi
21827 if $test -f "$bison$_exe"; then
21828         comp="$comp or bison -y"
21829 fi
21830 rp="Which compiler compiler ($comp) shall I use?"
21831 . ./myread
21832 yacc="$ans"
21833 case "$yacc" in
21834 *bis*)
21835         case "$yacc" in
21836         *-y*) ;;
21837         *)
21838                 yacc="$yacc -y"
21839                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21840                 ;;
21841         esac
21842         ;;
21843 esac
21844
21845 : see if this is a assert.h system
21846 set assert.h i_assert
21847 eval $inhdr
21848
21849 : see if this is a fp.h system
21850 set fp.h i_fp
21851 eval $inhdr
21852
21853 : see if this is a fp_class.h system
21854 set fp_class.h i_fp_class
21855 eval $inhdr
21856
21857 : see if gdbm.h is available
21858 set gdbm.h t_gdbm
21859 eval $inhdr
21860 case "$t_gdbm" in
21861 $define)
21862         : see if gdbm_open exists
21863         set gdbm_open d_gdbm_open
21864         eval $inlibc
21865         case "$d_gdbm_open" in
21866         $undef)
21867                 t_gdbm="$undef"
21868                 echo "We won't be including <gdbm.h>"
21869                 ;;
21870         esac
21871         ;;
21872 esac
21873 val="$t_gdbm"
21874 set i_gdbm
21875 eval $setvar
21876
21877 : see if this is a ieeefp.h system
21878 case "$i_ieeefp" in
21879 '' ) set ieeefp.h i_ieeefp
21880      eval $inhdr
21881      ;;
21882 esac
21883
21884 : see if this is a libutil.h system
21885 set libutil.h i_libutil
21886 eval $inhdr
21887
21888 : see if mach cthreads are available
21889 if test "X$usethreads" = "X$define"; then
21890         set mach/cthreads.h i_machcthr
21891         eval $inhdr
21892 else
21893         i_machcthr="$undef"
21894 fi
21895
21896 : see if this is a mntent.h system
21897 set mntent.h i_mntent
21898 eval $inhdr
21899
21900 : see if net/errno.h is available
21901 val=''
21902 set net/errno.h val
21903 eval $inhdr
21904
21905 : Unfortunately, it causes problems on some systems.  Arrgh.
21906 case "$val" in
21907 $define)
21908         cat > try.c <<'EOM'
21909 #include <stdio.h>
21910 #include <errno.h>
21911 #include <net/errno.h>
21912 int func()
21913 {
21914         return ENOTSOCK;
21915 }
21916 EOM
21917         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21918                 echo "We'll be including <net/errno.h>." >&4
21919         else
21920                 echo "We won't be including <net/errno.h>." >&4
21921                 val="$undef"
21922         fi
21923         $rm_try
21924         ;;
21925 esac
21926 set i_neterrno
21927 eval $setvar
21928
21929 : see if netinet/tcp.h is available
21930 set netinet/tcp.h i_netinettcp
21931 eval $inhdr
21932
21933 : see if this is a poll.h system
21934 set poll.h i_poll
21935 eval $inhdr
21936
21937 : see if this is a prot.h system
21938 set prot.h i_prot
21939 eval $inhdr
21940
21941 : Preprocessor symbols
21942 echo " "
21943 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21944 $cat <<'EOSH' > Cppsym.know
21945 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21946 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21947 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21948 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21949 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21950 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21951 bull c cadmus clipper CMU COFF COMPILER_VERSION
21952 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21953 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21954 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21955 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21956 GLIBC GLIBC_MINOR
21957 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21958 H3050R H3050RX hbullx20 hcx host_mips
21959 hp200 hp300 hp700 HP700 hp800 hp9000
21960 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21961 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21962 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21963 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21964 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21965 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21966 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21967 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21968 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21969 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21970 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21971 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21972 MATH_HAS_NO_SIDE_EFFECTS
21973 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21974 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21975 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21976 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21977 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21978 NetBSD news1500 news1700 news1800 news1900 news3700
21979 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21980 ns32016 ns32332 ns32k nsc32000
21981 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21982 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21983 pc532 pdp11 PGC PIC plexus PORTAR posix
21984 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21985 POSIX_C_SOURCE POSIX_SOURCE POWER
21986 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21987 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21988 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21989 sony sony_news sonyrisc sparc sparclite spectrum
21990 stardent stdc STDC_EXT stratos sun sun3 sun386
21991 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21992 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21993 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21994 sysV68 sysV88 Tek4132 Tek4300 titan
21995 TM3200 TM5400 TM5600
21996 tower tower32 tower32_200 tower32_600 tower32_700
21997 tower32_800 tower32_850 tss
21998 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21999 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
22000 unix UNIX95 UNIX99 unixpc unos
22001 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
22002 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
22003 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
22004 USGr4 USGr4_2
22005 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
22006 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
22007 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22008 z8000
22009 EOSH
22010 # Maybe put other stuff here too.
22011 cat <<EOSH >>Cppsym.know
22012 $osname
22013 EOSH
22014 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22015 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22016 $cat Cppsym.know > Cppsym.c
22017 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22018 $rm -f Cppsym.a Cppsym.b Cppsym.c
22019 cat <<EOSH > Cppsym
22020 $startsh
22021 if $test \$# -gt 0; then
22022     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22023     if $test -s Cppsym.got; then
22024         $rm -f Cppsym.got
22025         exit 0
22026     fi
22027     $rm -f Cppsym.got
22028     exit 1
22029 else
22030     $tr " " "$trnl" | ./Cppsym.try
22031     exit 0
22032 fi
22033 EOSH
22034 chmod +x Cppsym
22035 $eunicefix Cppsym
22036 cat <<EOSH > Cppsym.try
22037 $startsh
22038 cat <<'EOCP' > try.c
22039 #include <stdio.h>
22040 #if cpp_stuff == 1
22041 #define STRINGIFY(a)    "a"
22042 #endif
22043 #if cpp_stuff == 42
22044 #define StGiFy(a)  #a
22045 #define STRINGIFY(a)    StGiFy(a)
22046 #endif
22047 #if $cpp_stuff != 1 && $cpp_stuff != 42
22048 #   include "Bletch: How does this C preprocessor stringify macros?"
22049 #endif
22050 int main() {
22051 EOCP
22052 $awk \\
22053 EOSH
22054 cat <<'EOSH' >> Cppsym.try
22055 'length($1) > 0 {
22056     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22057     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22058     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22059     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22060 }'       >> try.c
22061 echo 'return 0;}' >> try.c
22062 EOSH
22063 cat <<EOSH >> Cppsym.try
22064 ccflags="$ccflags"
22065 case "$osname-$gccversion" in
22066 irix-) ccflags="\$ccflags -woff 1178" ;;
22067 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22068 esac
22069 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22070 EOSH
22071 chmod +x Cppsym.try
22072 $eunicefix Cppsym.try
22073 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22074 : Add in any Linux cpp "predefined macros":
22075 case "$osname::$gccversion" in
22076   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22077     tHdrH=_tmpHdr
22078     rm -f $tHdrH'.h' $tHdrH
22079     touch $tHdrH'.h'
22080     # Filter out macro arguments, such as Linux's __INT8_C(c)
22081     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22082        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22083        if [ -s $tHdrH'_cppsym.real' ]; then
22084           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22085        fi
22086     fi
22087     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22088   ;;
22089 esac
22090 : now check the C compiler for additional symbols
22091 postprocess_cc_v=''
22092 case "$osname" in
22093 aix) postprocess_cc_v="|$tr , ' '" ;;
22094 esac
22095 $cat >ccsym <<EOS
22096 $startsh
22097 $cat >tmp.c <<EOF
22098 extern int foo;
22099 EOF
22100 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22101 do
22102         case "\$i" in
22103         -D*) echo "\$i" | $sed 's/^-D//';;
22104         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22105         esac
22106 done
22107 $rm_try
22108 EOS
22109 postprocess_cc_v=''
22110 chmod +x ccsym
22111 $eunicefix ccsym
22112 ./ccsym > ccsym1.raw
22113 if $test -s ccsym1.raw; then
22114        $sort ccsym1.raw | $uniq >ccsym.raw
22115 else
22116        mv ccsym1.raw ccsym.raw
22117 fi
22118
22119 $awk '/\=/ { print $0; next }
22120         { print $0"=1" }' ccsym.raw >ccsym.list
22121 $comm -13 Cppsym.true ccsym.list >ccsym.own
22122 $comm -12 Cppsym.true ccsym.list >ccsym.com
22123 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22124 also=''
22125 if $test -z ccsym.raw; then
22126         echo "Your C compiler doesn't seem to define any symbols!" >&4
22127         echo " "
22128         echo "However, your C preprocessor defines the following symbols:"
22129         $cat Cppsym.true
22130         ccsymbols=''
22131         cppsymbols=`$cat Cppsym.true`
22132         cppsymbols=`echo $cppsymbols`
22133         cppccsymbols="$cppsymbols"
22134 else
22135         if $test -s ccsym.com; then
22136                 echo "Your C compiler and pre-processor define these symbols:"
22137                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22138                 also='also '
22139                 symbols='ones'
22140                 cppccsymbols=`$cat ccsym.com`
22141                 cppccsymbols=`echo $cppccsymbols`
22142                 $test "$silent" || sleep 1
22143         fi
22144         if $test -s ccsym.cpp; then
22145                 $test "$also" && echo " "
22146                 echo "Your C pre-processor ${also}defines the following symbols:"
22147                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22148                 also='further '
22149                 cppsymbols=`$cat ccsym.cpp`
22150                 cppsymbols=`echo $cppsymbols`
22151                 $test "$silent" || sleep 1
22152         fi
22153         if $test -s ccsym.own; then
22154                 $test "$also" && echo " "
22155                 echo "Your C compiler ${also}defines the following cpp symbols:"
22156                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22157                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22158                 ccsymbols=`$cat ccsym.own`
22159                 ccsymbols=`echo $ccsymbols`
22160                 $test "$silent" || sleep 1
22161         fi
22162 fi
22163
22164 : see if this is a termio system
22165 val="$undef"
22166 val2="$undef"
22167 val3="$undef"
22168 if $test `./findhdr termios.h`; then
22169         set tcsetattr i_termios
22170         eval $inlibc
22171         val3="$i_termios"
22172 fi
22173 echo " "
22174 case "$val3" in
22175 "$define") echo "You have POSIX termios.h... good!" >&4;;
22176 *) if ./Cppsym pyr; then
22177                 case "`/bin/universe`" in
22178                 ucb) if $test `./findhdr sgtty.h`; then
22179                                 val2="$define"
22180                                 echo "<sgtty.h> found." >&4
22181                         else
22182                                 echo "System is pyramid with BSD universe."
22183                                 ./warn "<sgtty.h> not found--you could have problems."
22184                         fi;;
22185                 *) if $test `./findhdr termio.h`; then
22186                                 val="$define"
22187                                 echo "<termio.h> found." >&4
22188                         else
22189                                 echo "System is pyramid with USG universe."
22190                                 ./warn "<termio.h> not found--you could have problems."
22191                         fi;;
22192                 esac
22193         elif ./usg; then
22194                 if $test `./findhdr termio.h`; then
22195                         echo "<termio.h> found." >&4
22196                         val="$define"
22197                 elif $test `./findhdr sgtty.h`; then
22198                         echo "<sgtty.h> found." >&4
22199                         val2="$define"
22200                 else
22201                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22202                 fi
22203         else
22204                 if $test `./findhdr sgtty.h`; then
22205                         echo "<sgtty.h> found." >&4
22206                         val2="$define"
22207                 elif $test `./findhdr termio.h`; then
22208                         echo "<termio.h> found." >&4
22209                         val="$define"
22210                 else
22211                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22212                 fi
22213         fi;;
22214 esac
22215 set i_termio; eval $setvar
22216 val=$val2; set i_sgtty; eval $setvar
22217 val=$val3; set i_termios; eval $setvar
22218
22219 : see if stdbool is available
22220 : we want a real compile instead of Inhdr because some Solaris systems
22221 : have stdbool.h, but it can only be used if the compiler indicates it
22222 : is sufficiently c99-compliant.
22223 echo " "
22224 $cat >try.c <<EOCP
22225 #include <stdio.h>
22226 #include <stdbool.h>
22227 int func(bool x)
22228 {
22229     return x ? 1 : 0;
22230 }
22231 int main(int argc, char **argv)
22232 {
22233     return func(0);
22234 }
22235 EOCP
22236 set try
22237 if eval $compile; then
22238         echo "<stdbool.h> found." >&4
22239         val="$define"
22240 else
22241         echo "<stdbool.h> NOT found." >&4
22242         val="$undef"
22243 fi
22244 $rm_try
22245 set i_stdbool
22246 eval $setvar
22247
22248 : see if stddef is available
22249 set stddef.h i_stddef
22250 eval $inhdr
22251
22252 : see if sys/access.h is available
22253 set sys/access.h i_sysaccess
22254 eval $inhdr
22255
22256 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22257 set sys/filio.h i_sysfilio
22258 eval $inhdr
22259 echo " "
22260 if $test `./findhdr sys/ioctl.h`; then
22261         val="$define"
22262         echo '<sys/ioctl.h> found.' >&4
22263 else
22264         val="$undef"
22265         if $test $i_sysfilio = "$define"; then
22266             echo '<sys/ioctl.h> NOT found.' >&4
22267         else
22268                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22269                 $test $i_termio = "$define" && xxx="termio.h"
22270                 $test $i_termios = "$define" && xxx="termios.h"
22271 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22272         fi
22273 fi
22274 set i_sysioctl
22275 eval $setvar
22276
22277 : see if socket ioctl defs are in sys/sockio.h
22278 echo " "
22279 xxx=`./findhdr sys/sockio.h`
22280 if $test "$xxx"; then
22281         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22282                 val="$define"
22283                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22284         else
22285                 val="$undef"
22286                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22287         fi
22288 else
22289         val="$undef"
22290         $cat <<EOM
22291 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22292 EOM
22293 fi
22294 set i_syssockio
22295 eval $setvar
22296
22297 : see if this is a syslog.h system
22298 set syslog.h i_syslog
22299 eval $inhdr
22300
22301 : see if this is a sys/mode.h system
22302 set sys/mode.h i_sysmode
22303 eval $inhdr
22304
22305 : see if there is a sys/poll.h file
22306 set sys/poll.h i_syspoll
22307 eval $inhdr
22308
22309 : see if sys/resource.h has to be included
22310 set sys/resource.h i_sysresrc
22311 eval $inhdr
22312
22313 : see if sys/security.h is available
22314 set sys/security.h i_syssecrt
22315 eval $inhdr
22316
22317 : see if this is a sys/statvfs.h system
22318 set sys/statvfs.h i_sysstatvfs
22319 eval $inhdr
22320
22321 : see if this is a sys/un.h system
22322 set sys/un.h i_sysun
22323 eval $inhdr
22324
22325 : see if this is a sys/utsname.h system
22326 set sys/utsname.h i_sysutsname
22327 eval $inhdr
22328
22329 : see if this is a syswait system
22330 set sys/wait.h i_syswait
22331 eval $inhdr
22332
22333 : see if this is a ustat.h system
22334 set ustat.h i_ustat
22335 eval $inhdr
22336
22337 : see if this is an utime system
22338 set utime.h i_utime
22339 eval $inhdr
22340
22341 : see if this is a vfork system
22342 case "$d_vfork" in
22343 "$define")
22344         set vfork.h i_vfork
22345         eval $inhdr
22346         ;;
22347 *)
22348         i_vfork="$undef"
22349         ;;
22350 esac
22351
22352 : Check extensions
22353 echo " "
22354 echo "Looking for extensions..." >&4
22355 : If we are using the old config.sh, known_extensions may contain
22356 : old or inaccurate or duplicate values.
22357 known_extensions=''
22358 nonxs_extensions=''
22359 : We do not use find because it might not be available.
22360 : We do not just use MANIFEST because the user may have dropped
22361 : some additional extensions into the source tree and expect them
22362 : to be built.
22363
22364 : Function to recursively find available extensions, ignoring DynaLoader
22365 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22366 : In 5.10.1 and later, extensions are stored in directories
22367 : like File-Glob instead of the older File/Glob/.
22368 find_extensions='
22369     for xxx in *; do
22370         case "$xxx" in
22371             DynaLoader|dynaload) ;;
22372             *)
22373             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22374             leaf=`echo $xxx | $sed -e s/.*-//`;
22375             if $test -d File; then
22376                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22377                     known_extensions="$known_extensions $1$this_ext";
22378                 elif $test -f $xxx/Makefile.PL; then
22379                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22380                 else
22381                     if $test -d $xxx -a $# -lt 10; then
22382                         set $1$xxx/ $*;
22383                         cd "$xxx";
22384                         eval $find_extensions;
22385                         cd ..;
22386                         shift;
22387                     fi;
22388                 fi;
22389             else
22390                 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22391                 if $contains " $this_ext " $$.tmp; then
22392                     echo >&4;
22393                     echo "Duplicate directories detected for extension $xxx" >&4;
22394                     echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22395                     case "$knowitall" in
22396                     "") dflt=y;;
22397                     *) dflt=n;;
22398                     esac;
22399                     . ../UU/myread;
22400                     case "$ans" in
22401                     n*|N*) ;;
22402                     *) echo >&4;
22403                        echo "Ok.  Stopping Configure." >&4;
22404                        echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22405                         exit 1;;
22406                     esac;
22407                     echo "Ok.  You will need to correct config.sh before running make." >&4;
22408                 fi;
22409                 $ls -1 $xxx > $$.tmp;
22410                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22411                     known_extensions="$known_extensions $this_ext";
22412                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22413                     known_extensions="$known_extensions $this_ext";
22414                 elif $test -d $xxx; then
22415                     nonxs_extensions="$nonxs_extensions $this_ext";
22416                 fi;
22417                 $rm -f $$.tmp;
22418             fi
22419             ;;
22420         esac;
22421     done'
22422 tdir=`pwd`
22423 cd "$rsrc/cpan"
22424 set X
22425 shift
22426 eval $find_extensions
22427 cd "$rsrc/dist"
22428 set X
22429 shift
22430 eval $find_extensions
22431 cd "$rsrc/ext"
22432 set X
22433 shift
22434 eval $find_extensions
22435 if $test -d File-Glob; then
22436     : All ext/ flattened
22437 else
22438     # Special case:  Add in modules that nest beyond the first level.
22439     # Currently threads/shared and Hash/Util/FieldHash, since they are
22440     # not picked up by the recursive find above (and adding in general
22441     # recursive finding breaks SDBM_File/sdbm).
22442     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22443     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22444 fi
22445 set X $known_extensions
22446 shift
22447 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22448 set X $nonxs_extensions
22449 shift
22450 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22451 cd "$tdir"
22452
22453 : Now see which are supported on this system.
22454 avail_ext=''
22455 for xxx in $known_extensions ; do
22456         case "$xxx" in
22457         DB_File|db_file)
22458                 case "$i_db" in
22459                 $define) avail_ext="$avail_ext $xxx" ;;
22460                 esac
22461                 ;;
22462         GDBM_File|gdbm_fil)
22463                 case "$i_gdbm" in
22464                 $define) avail_ext="$avail_ext $xxx" ;;
22465                 esac
22466                 ;;
22467         I18N/Langinfo|i18n_lan)
22468                 case "$i_langinfo$d_nl_langinfo" in
22469                 $define$define) avail_ext="$avail_ext $xxx" ;;
22470                 esac
22471                 ;;
22472         IPC/SysV|ipc/sysv)
22473                 : XXX Do we need a useipcsysv variable here
22474                 case "${d_msg}${d_sem}${d_shm}" in
22475                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22476                 esac
22477                 ;;
22478         NDBM_File|ndbm_fil)
22479                 case "$d_ndbm" in
22480                 $define)
22481                     case "$osname-$use64bitint" in
22482                     hpux-define)
22483                         case "$libs" in
22484                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22485                         esac
22486                         ;;
22487                     *) avail_ext="$avail_ext $xxx" ;;
22488                     esac
22489                     ;;
22490                 esac
22491                 ;;
22492         ODBM_File|odbm_fil)
22493                 case "${i_dbm}${i_rpcsvcdbm}" in
22494                 *"${define}"*)
22495                     case "$d_cplusplus" in
22496                     define) ;; # delete as a function name will not work
22497                     *)  case "$osname-$use64bitint" in
22498                         hpux-define)
22499                             case "$libs" in
22500                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22501                             esac
22502                             ;;
22503                         *) avail_ext="$avail_ext $xxx" ;;
22504                         esac
22505                         ;;
22506                     esac
22507                     ;;
22508                 esac
22509                 ;;
22510         Opcode|opcode)
22511                 case "$useopcode" in
22512                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22513                 esac
22514                 ;;
22515         POSIX|posix)
22516                 case "$useposix" in
22517                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22518                 esac
22519                 ;;
22520         Socket|socket)
22521                 case "$d_socket" in
22522                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22523                 esac
22524                 ;;
22525         Sys/Syslog|sys/syslog)
22526                 : XXX syslog requires socket
22527                 case "$d_socket" in
22528                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22529                 esac
22530                 ;;
22531         Thread|thread)
22532                 case "$usethreads" in
22533                 true|$define|y)
22534                         case "$use5005threads" in
22535                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22536                         esac
22537                 esac
22538                 ;;
22539         threads|threads/shared)
22540                 # threads and threads::shared are special cases.
22541                 # To stop people from asking "Perl 5.8.0 was supposed
22542                 # to have this new fancy threads implementation but my
22543                 # perl doesn't have it" and from people trying to
22544                 # (re)install the threads module using CPAN.pm and
22545                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22546                 # the threads.pm and threads/shared.pm will always be
22547                 # there, croaking informatively ("you need to rebuild
22548                 # all of Perl with threads, sorry") when threads haven't
22549                 # been compiled in.
22550                 # --jhi
22551                 avail_ext="$avail_ext $xxx"
22552                 ;;
22553         VMS*)
22554                 ;;
22555         Win32*)
22556                 case "$osname" in
22557                 cygwin) avail_ext="$avail_ext $xxx" ;;
22558                 esac
22559                 ;;
22560         XS/APItest|xs/apitest)
22561                 # This is just for testing.  Skip it unless we have dynamic loading.
22562
22563                 case "$usedl" in
22564                 $define) avail_ext="$avail_ext $xxx" ;;
22565                 esac
22566                 ;;
22567         XS/Typemap|xs/typemap)
22568                 # This is just for testing.  Skip it unless we have dynamic loading.
22569                 case "$usedl" in
22570                 $define) avail_ext="$avail_ext $xxx" ;;
22571                 esac
22572                 ;;
22573         *)      avail_ext="$avail_ext $xxx"
22574                 ;;
22575         esac
22576 done
22577
22578 set X $avail_ext
22579 shift
22580 avail_ext="$*"
22581
22582 case "$onlyextensions" in
22583 '') ;;
22584 *)  keepextensions=''
22585     echo "You have requested that only certain extensions be included..." >&4
22586     for i in $onlyextensions; do
22587         case " $avail_ext " in
22588         *" $i "*)
22589             echo "Keeping extension $i."
22590             keepextensions="$keepextensions $i"
22591             ;;
22592         *) echo "Ignoring extension $i." ;;
22593         esac
22594     done
22595     avail_ext="$keepextensions"
22596     ;;
22597 esac
22598
22599 case "$noextensions" in
22600 '') ;;
22601 *)  keepextensions=''
22602     echo "You have requested that certain extensions be ignored..." >&4
22603     for i in $avail_ext; do
22604         case " $noextensions " in
22605         *" $i "*) echo "Ignoring extension $i." ;;
22606         *) echo "Keeping extension $i.";
22607            keepextensions="$keepextensions $i"
22608            ;;
22609         esac
22610     done
22611     avail_ext="$keepextensions"
22612     ;;
22613 esac
22614
22615 : Now see which nonxs extensions are supported on this system.
22616 : For now assume all are.
22617 nonxs_ext=''
22618 for xxx in $nonxs_extensions ; do
22619         case "$xxx" in
22620         *)      nonxs_ext="$nonxs_ext $xxx"
22621                 ;;
22622         esac
22623 done
22624
22625 set X $nonxs_ext
22626 shift
22627 nonxs_ext="$*"
22628
22629 case $usedl in
22630 $define)
22631         $cat <<EOM
22632 A number of extensions are supplied with $package.  You may choose to
22633 compile these extensions for dynamic loading (the default), compile
22634 them into the $package executable (static loading), or not include
22635 them at all.  Answer "none" to include no extensions.
22636 Note that DynaLoader is always built and need not be mentioned here.
22637
22638 EOM
22639         case "$dynamic_ext" in
22640         '')
22641                 : Exclude those listed in static_ext
22642                 dflt=''
22643                 for xxx in $avail_ext; do
22644                         case " $static_ext " in
22645                         *" $xxx "*) ;;
22646                         *) dflt="$dflt $xxx" ;;
22647                         esac
22648                 done
22649                 set X $dflt
22650                 shift
22651                 dflt="$*"
22652                 ;;
22653         *)      dflt="$dynamic_ext"
22654                 # Perhaps we are reusing an old out-of-date config.sh.
22655                 case "$hint" in
22656                 previous)
22657                         if test X"$dynamic_ext" != X"$avail_ext"; then
22658                                 $cat <<EOM
22659 NOTICE:  Your previous config.sh list may be incorrect.
22660 The extensions now available to you are
22661         ${avail_ext}
22662 but the default list from your previous config.sh is
22663         ${dynamic_ext}
22664
22665 EOM
22666                         fi
22667                         ;;
22668                 esac
22669                 ;;
22670         esac
22671         case "$dflt" in
22672         '')     dflt=none;;
22673         esac
22674         rp="What extensions do you wish to load dynamically?"
22675         . ./myread
22676         case "$ans" in
22677         none) dynamic_ext=' ' ;;
22678         *) dynamic_ext="$ans" ;;
22679         esac
22680
22681         case "$static_ext" in
22682         '')
22683                 : Exclude those already listed in dynamic linking
22684                 dflt=''
22685                 for xxx in $avail_ext; do
22686                         case " $dynamic_ext " in
22687                         *" $xxx "*) ;;
22688                         *) dflt="$dflt $xxx" ;;
22689                         esac
22690                 done
22691                 set X $dflt
22692                 shift
22693                 dflt="$*"
22694                 ;;
22695         *)  dflt="$static_ext"
22696                 ;;
22697         esac
22698
22699         case "$dflt" in
22700         '')     dflt=none;;
22701         esac
22702         rp="What extensions do you wish to load statically?"
22703         . ./myread
22704         case "$ans" in
22705         none) static_ext=' ' ;;
22706         *) static_ext="$ans" ;;
22707         esac
22708         ;;
22709 *)
22710         $cat <<EOM
22711 A number of extensions are supplied with $package.  Answer "none"
22712 to include no extensions.
22713 Note that DynaLoader is always built and need not be mentioned here.
22714
22715 EOM
22716         case "$static_ext" in
22717         '') dflt="$avail_ext" ;;
22718         *)      dflt="$static_ext"
22719                 # Perhaps we are reusing an old out-of-date config.sh.
22720                 case "$hint" in
22721                 previous)
22722                         if test X"$static_ext" != X"$avail_ext"; then
22723                                 $cat <<EOM
22724 NOTICE:  Your previous config.sh list may be incorrect.
22725 The extensions now available to you are
22726         ${avail_ext}
22727 but the default list from your previous config.sh is
22728         ${static_ext}
22729
22730 EOM
22731                         fi
22732                         ;;
22733                 esac
22734                 ;;
22735         esac
22736         : Exclude those that are not xs extensions
22737         case "$dflt" in
22738         '')     dflt=none;;
22739         esac
22740         rp="What extensions do you wish to include?"
22741         . ./myread
22742         case "$ans" in
22743         none) static_ext=' ' ;;
22744         *) static_ext="$ans" ;;
22745         esac
22746         ;;
22747 esac
22748 #
22749 # Encode is a special case.  If we are building Encode as a static
22750 # extension, we need to explicitly list its subextensions as well.
22751 # For other nested extensions, this is handled automatically by
22752 # the appropriate Makefile.PL.
22753 case " $static_ext " in
22754         *" Encode "*) # Add the subextensions of Encode
22755         cd "$rsrc/cpan"
22756         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22757                 static_ext="$static_ext Encode/$xxx"
22758         done
22759         cd "$tdir"
22760         ;;
22761 esac
22762
22763 set X $dynamic_ext $static_ext $nonxs_ext
22764 shift
22765 extensions="$*"
22766
22767 # Sanity check:  We require an extension suitable for use with
22768 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22769 # should show up as failures in the test suite, but it's helpful to
22770 # catch them now.) The 'extensions' list is normally sorted
22771 # alphabetically, so we need to accept either
22772 #    DB_File ... Fcntl ... IO  ....
22773 # or something like
22774 #    Fcntl ... NDBM_File ... IO  ....
22775 case " $extensions"  in
22776 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22777 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22778 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22779 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22780    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22781    ;;
22782 esac
22783
22784 : Remove libraries needed only for extensions
22785 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22786 : The exception is SunOS 4.x, which needs them.
22787 case "${osname}X${osvers}" in
22788 sunos*X4*)
22789     perllibs="$libs"
22790     ;;
22791 *) case "$usedl" in
22792     $define|true|[yY]*)
22793             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22794             shift
22795             perllibs="$*"
22796             ;;
22797     *)  perllibs="$libs"
22798             ;;
22799     esac
22800     ;;
22801 esac
22802
22803 : Remove build directory name from cppstdin so it can be used from
22804 : either the present location or the final installed location.
22805 echo " "
22806 : Get out of the UU directory to get correct path name.
22807 cd ..
22808 case "$cppstdin" in
22809 `pwd`/cppstdin)
22810         echo "Stripping down cppstdin path name"
22811         cppstdin=cppstdin
22812         ;;
22813 esac
22814 cd UU
22815
22816 : end of configuration questions
22817 echo " "
22818 echo "End of configuration questions."
22819 echo " "
22820
22821 : back to where it started
22822 if test -d ../UU; then
22823         cd ..
22824 fi
22825
22826 : configuration may be unconditionally patched via a 'config.arch' file
22827 if $test -f config.arch; then
22828         echo "I see a config.arch file, loading it." >&4
22829         . ./config.arch
22830 fi
22831
22832 : configuration may be patched via a 'config.over' file
22833 if $test -f config.over; then
22834         echo " "
22835         dflt=y
22836         rp='I see a config.over file.  Do you wish to load it?'
22837         . UU/myread
22838         case "$ans" in
22839         n*) echo "OK, I'll ignore it.";;
22840         *)      . ./config.over
22841                 echo "Configuration override changes have been loaded."
22842                 ;;
22843         esac
22844 fi
22845
22846 : in case they want portability, strip down executable paths
22847 case "$d_portable" in
22848 "$define")
22849         echo " "
22850         echo "Stripping down executable paths..." >&4
22851         for file in $loclist $trylist; do
22852                 eval temp=\$$file
22853                 eval $file=`basename $temp`
22854         done
22855         ;;
22856 esac
22857
22858 : create config.sh file
22859 echo " "
22860 echo "Creating config.sh..." >&4
22861 $spitshell <<EOT >config.sh
22862 $startsh
22863 #
22864 # This file was produced by running the Configure script. It holds all the
22865 # definitions figured out by Configure. Should you modify one of these values,
22866 # do not forget to propagate your changes by running "Configure -der". You may
22867 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22868 #
22869
22870 # Package name      : $package
22871 # Source directory  : $src
22872 # Configuration time: $cf_time
22873 # Configured by     : $cf_by
22874 # Target system     : $myuname
22875
22876 EOT
22877 : Add in command line options if available
22878 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22879
22880 $spitshell <<EOT >>config.sh
22881
22882 Author='$Author'
22883 Date='$Date'
22884 Header='$Header'
22885 Id='$Id'
22886 Locker='$Locker'
22887 Log='$Log'
22888 RCSfile='$RCSfile'
22889 Revision='$Revision'
22890 Source='$Source'
22891 State='$State'
22892 _a='$_a'
22893 _exe='$_exe'
22894 _o='$_o'
22895 afs='$afs'
22896 afsroot='$afsroot'
22897 alignbytes='$alignbytes'
22898 ansi2knr='$ansi2knr'
22899 aphostname='$aphostname'
22900 api_revision='$api_revision'
22901 api_subversion='$api_subversion'
22902 api_version='$api_version'
22903 api_versionstring='$api_versionstring'
22904 ar='$ar'
22905 archlib='$archlib'
22906 archlibexp='$archlibexp'
22907 archname64='$archname64'
22908 archname='$archname'
22909 archobjs='$archobjs'
22910 asctime_r_proto='$asctime_r_proto'
22911 awk='$awk'
22912 baserev='$baserev'
22913 bash='$bash'
22914 bin='$bin'
22915 bin_ELF='$bin_ELF'
22916 binexp='$binexp'
22917 bison='$bison'
22918 bootstrap_charset='$bootstrap_charset'
22919 byacc='$byacc'
22920 byteorder='$byteorder'
22921 c='$c'
22922 castflags='$castflags'
22923 cat='$cat'
22924 cc='$cc'
22925 cccdlflags='$cccdlflags'
22926 ccdlflags='$ccdlflags'
22927 ccflags='$ccflags'
22928 ccflags_uselargefiles='$ccflags_uselargefiles'
22929 ccname='$ccname'
22930 ccsymbols='$ccsymbols'
22931 ccversion='$ccversion'
22932 cf_by='$cf_by'
22933 cf_email='$cf_email'
22934 cf_time='$cf_time'
22935 charbits='$charbits'
22936 charsize='$charsize'
22937 chgrp='$chgrp'
22938 chmod='$chmod'
22939 chown='$chown'
22940 clocktype='$clocktype'
22941 comm='$comm'
22942 compress='$compress'
22943 contains='$contains'
22944 cp='$cp'
22945 cpio='$cpio'
22946 cpp='$cpp'
22947 cpp_stuff='$cpp_stuff'
22948 cppccsymbols='$cppccsymbols'
22949 cppflags='$cppflags'
22950 cpplast='$cpplast'
22951 cppminus='$cppminus'
22952 cpprun='$cpprun'
22953 cppstdin='$cppstdin'
22954 cppsymbols='$cppsymbols'
22955 crypt_r_proto='$crypt_r_proto'
22956 cryptlib='$cryptlib'
22957 csh='$csh'
22958 ctermid_r_proto='$ctermid_r_proto'
22959 ctime_r_proto='$ctime_r_proto'
22960 d_Gconvert='$d_Gconvert'
22961 d_PRIEUldbl='$d_PRIEUldbl'
22962 d_PRIFUldbl='$d_PRIFUldbl'
22963 d_PRIGUldbl='$d_PRIGUldbl'
22964 d_PRIXU64='$d_PRIXU64'
22965 d_PRId64='$d_PRId64'
22966 d_PRIeldbl='$d_PRIeldbl'
22967 d_PRIfldbl='$d_PRIfldbl'
22968 d_PRIgldbl='$d_PRIgldbl'
22969 d_PRIi64='$d_PRIi64'
22970 d_PRIo64='$d_PRIo64'
22971 d_PRIu64='$d_PRIu64'
22972 d_PRIx64='$d_PRIx64'
22973 d_SCNfldbl='$d_SCNfldbl'
22974 d__fwalk='$d__fwalk'
22975 d_access='$d_access'
22976 d_accessx='$d_accessx'
22977 d_aintl='$d_aintl'
22978 d_alarm='$d_alarm'
22979 d_archlib='$d_archlib'
22980 d_asctime64='$d_asctime64'
22981 d_asctime_r='$d_asctime_r'
22982 d_atolf='$d_atolf'
22983 d_atoll='$d_atoll'
22984 d_attribute_deprecated='$d_attribute_deprecated'
22985 d_attribute_format='$d_attribute_format'
22986 d_attribute_malloc='$d_attribute_malloc'
22987 d_attribute_nonnull='$d_attribute_nonnull'
22988 d_attribute_noreturn='$d_attribute_noreturn'
22989 d_attribute_pure='$d_attribute_pure'
22990 d_attribute_unused='$d_attribute_unused'
22991 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22992 d_bcmp='$d_bcmp'
22993 d_bcopy='$d_bcopy'
22994 d_bsd='$d_bsd'
22995 d_bsdgetpgrp='$d_bsdgetpgrp'
22996 d_bsdsetpgrp='$d_bsdsetpgrp'
22997 d_builtin_choose_expr='$d_builtin_choose_expr'
22998 d_builtin_expect='$d_builtin_expect'
22999 d_bzero='$d_bzero'
23000 d_c99_variadic_macros='$d_c99_variadic_macros'
23001 d_casti32='$d_casti32'
23002 d_castneg='$d_castneg'
23003 d_charvspr='$d_charvspr'
23004 d_chown='$d_chown'
23005 d_chroot='$d_chroot'
23006 d_chsize='$d_chsize'
23007 d_class='$d_class'
23008 d_clearenv='$d_clearenv'
23009 d_closedir='$d_closedir'
23010 d_cmsghdr_s='$d_cmsghdr_s'
23011 d_const='$d_const'
23012 d_copysignl='$d_copysignl'
23013 d_cplusplus='$d_cplusplus'
23014 d_crypt='$d_crypt'
23015 d_crypt_r='$d_crypt_r'
23016 d_csh='$d_csh'
23017 d_ctermid='$d_ctermid'
23018 d_ctermid_r='$d_ctermid_r'
23019 d_ctime64='$d_ctime64'
23020 d_ctime_r='$d_ctime_r'
23021 d_cuserid='$d_cuserid'
23022 d_dbl_dig='$d_dbl_dig'
23023 d_dbminitproto='$d_dbminitproto'
23024 d_difftime64='$d_difftime64'
23025 d_difftime='$d_difftime'
23026 d_dir_dd_fd='$d_dir_dd_fd'
23027 d_dirfd='$d_dirfd'
23028 d_dirnamlen='$d_dirnamlen'
23029 d_dlerror='$d_dlerror'
23030 d_dlopen='$d_dlopen'
23031 d_dlsymun='$d_dlsymun'
23032 d_dosuid='$d_dosuid'
23033 d_drand48_r='$d_drand48_r'
23034 d_drand48proto='$d_drand48proto'
23035 d_dup2='$d_dup2'
23036 d_eaccess='$d_eaccess'
23037 d_endgrent='$d_endgrent'
23038 d_endgrent_r='$d_endgrent_r'
23039 d_endhent='$d_endhent'
23040 d_endhostent_r='$d_endhostent_r'
23041 d_endnent='$d_endnent'
23042 d_endnetent_r='$d_endnetent_r'
23043 d_endpent='$d_endpent'
23044 d_endprotoent_r='$d_endprotoent_r'
23045 d_endpwent='$d_endpwent'
23046 d_endpwent_r='$d_endpwent_r'
23047 d_endsent='$d_endsent'
23048 d_endservent_r='$d_endservent_r'
23049 d_eofnblk='$d_eofnblk'
23050 d_eunice='$d_eunice'
23051 d_faststdio='$d_faststdio'
23052 d_fchdir='$d_fchdir'
23053 d_fchmod='$d_fchmod'
23054 d_fchown='$d_fchown'
23055 d_fcntl='$d_fcntl'
23056 d_fcntl_can_lock='$d_fcntl_can_lock'
23057 d_fd_macros='$d_fd_macros'
23058 d_fd_set='$d_fd_set'
23059 d_fds_bits='$d_fds_bits'
23060 d_fgetpos='$d_fgetpos'
23061 d_finite='$d_finite'
23062 d_finitel='$d_finitel'
23063 d_flexfnam='$d_flexfnam'
23064 d_flock='$d_flock'
23065 d_flockproto='$d_flockproto'
23066 d_fork='$d_fork'
23067 d_fp_class='$d_fp_class'
23068 d_fpathconf='$d_fpathconf'
23069 d_fpclass='$d_fpclass'
23070 d_fpclassify='$d_fpclassify'
23071 d_fpclassl='$d_fpclassl'
23072 d_fpos64_t='$d_fpos64_t'
23073 d_frexpl='$d_frexpl'
23074 d_fs_data_s='$d_fs_data_s'
23075 d_fseeko='$d_fseeko'
23076 d_fsetpos='$d_fsetpos'
23077 d_fstatfs='$d_fstatfs'
23078 d_fstatvfs='$d_fstatvfs'
23079 d_fsync='$d_fsync'
23080 d_ftello='$d_ftello'
23081 d_ftime='$d_ftime'
23082 d_futimes='$d_futimes'
23083 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23084 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23085 d_getaddrinfo='$d_getaddrinfo'
23086 d_getcwd='$d_getcwd'
23087 d_getespwnam='$d_getespwnam'
23088 d_getfsstat='$d_getfsstat'
23089 d_getgrent='$d_getgrent'
23090 d_getgrent_r='$d_getgrent_r'
23091 d_getgrgid_r='$d_getgrgid_r'
23092 d_getgrnam_r='$d_getgrnam_r'
23093 d_getgrps='$d_getgrps'
23094 d_gethbyaddr='$d_gethbyaddr'
23095 d_gethbyname='$d_gethbyname'
23096 d_gethent='$d_gethent'
23097 d_gethname='$d_gethname'
23098 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23099 d_gethostbyname_r='$d_gethostbyname_r'
23100 d_gethostent_r='$d_gethostent_r'
23101 d_gethostprotos='$d_gethostprotos'
23102 d_getitimer='$d_getitimer'
23103 d_getlogin='$d_getlogin'
23104 d_getlogin_r='$d_getlogin_r'
23105 d_getmnt='$d_getmnt'
23106 d_getmntent='$d_getmntent'
23107 d_getnameinfo='$d_getnameinfo'
23108 d_getnbyaddr='$d_getnbyaddr'
23109 d_getnbyname='$d_getnbyname'
23110 d_getnent='$d_getnent'
23111 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23112 d_getnetbyname_r='$d_getnetbyname_r'
23113 d_getnetent_r='$d_getnetent_r'
23114 d_getnetprotos='$d_getnetprotos'
23115 d_getpagsz='$d_getpagsz'
23116 d_getpbyname='$d_getpbyname'
23117 d_getpbynumber='$d_getpbynumber'
23118 d_getpent='$d_getpent'
23119 d_getpgid='$d_getpgid'
23120 d_getpgrp2='$d_getpgrp2'
23121 d_getpgrp='$d_getpgrp'
23122 d_getppid='$d_getppid'
23123 d_getprior='$d_getprior'
23124 d_getprotobyname_r='$d_getprotobyname_r'
23125 d_getprotobynumber_r='$d_getprotobynumber_r'
23126 d_getprotoent_r='$d_getprotoent_r'
23127 d_getprotoprotos='$d_getprotoprotos'
23128 d_getprpwnam='$d_getprpwnam'
23129 d_getpwent='$d_getpwent'
23130 d_getpwent_r='$d_getpwent_r'
23131 d_getpwnam_r='$d_getpwnam_r'
23132 d_getpwuid_r='$d_getpwuid_r'
23133 d_getsbyname='$d_getsbyname'
23134 d_getsbyport='$d_getsbyport'
23135 d_getsent='$d_getsent'
23136 d_getservbyname_r='$d_getservbyname_r'
23137 d_getservbyport_r='$d_getservbyport_r'
23138 d_getservent_r='$d_getservent_r'
23139 d_getservprotos='$d_getservprotos'
23140 d_getspnam='$d_getspnam'
23141 d_getspnam_r='$d_getspnam_r'
23142 d_gettimeod='$d_gettimeod'
23143 d_gmtime64='$d_gmtime64'
23144 d_gmtime_r='$d_gmtime_r'
23145 d_gnulibc='$d_gnulibc'
23146 d_grpasswd='$d_grpasswd'
23147 d_hasmntopt='$d_hasmntopt'
23148 d_htonl='$d_htonl'
23149 d_ilogbl='$d_ilogbl'
23150 d_inc_version_list='$d_inc_version_list'
23151 d_index='$d_index'
23152 d_inetaton='$d_inetaton'
23153 d_inetntop='$d_inetntop'
23154 d_inetpton='$d_inetpton'
23155 d_int64_t='$d_int64_t'
23156 d_ip_mreq='$d_ip_mreq'
23157 d_ip_mreq_source='$d_ip_mreq_source'
23158 d_ipv6_mreq='$d_ipv6_mreq'
23159 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23160 d_isascii='$d_isascii'
23161 d_isblank='$d_isblank'
23162 d_isfinite='$d_isfinite'
23163 d_isinf='$d_isinf'
23164 d_isnan='$d_isnan'
23165 d_isnanl='$d_isnanl'
23166 d_killpg='$d_killpg'
23167 d_lchown='$d_lchown'
23168 d_ldbl_dig='$d_ldbl_dig'
23169 d_libm_lib_version='$d_libm_lib_version'
23170 d_link='$d_link'
23171 d_localtime64='$d_localtime64'
23172 d_localtime_r='$d_localtime_r'
23173 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23174 d_locconv='$d_locconv'
23175 d_lockf='$d_lockf'
23176 d_longdbl='$d_longdbl'
23177 d_longlong='$d_longlong'
23178 d_lseekproto='$d_lseekproto'
23179 d_lstat='$d_lstat'
23180 d_madvise='$d_madvise'
23181 d_malloc_good_size='$d_malloc_good_size'
23182 d_malloc_size='$d_malloc_size'
23183 d_mblen='$d_mblen'
23184 d_mbstowcs='$d_mbstowcs'
23185 d_mbtowc='$d_mbtowc'
23186 d_memchr='$d_memchr'
23187 d_memcmp='$d_memcmp'
23188 d_memcpy='$d_memcpy'
23189 d_memmove='$d_memmove'
23190 d_memset='$d_memset'
23191 d_mkdir='$d_mkdir'
23192 d_mkdtemp='$d_mkdtemp'
23193 d_mkfifo='$d_mkfifo'
23194 d_mkstemp='$d_mkstemp'
23195 d_mkstemps='$d_mkstemps'
23196 d_mktime64='$d_mktime64'
23197 d_mktime='$d_mktime'
23198 d_mmap='$d_mmap'
23199 d_modfl='$d_modfl'
23200 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23201 d_modflproto='$d_modflproto'
23202 d_mprotect='$d_mprotect'
23203 d_msg='$d_msg'
23204 d_msg_ctrunc='$d_msg_ctrunc'
23205 d_msg_dontroute='$d_msg_dontroute'
23206 d_msg_oob='$d_msg_oob'
23207 d_msg_peek='$d_msg_peek'
23208 d_msg_proxy='$d_msg_proxy'
23209 d_msgctl='$d_msgctl'
23210 d_msgget='$d_msgget'
23211 d_msghdr_s='$d_msghdr_s'
23212 d_msgrcv='$d_msgrcv'
23213 d_msgsnd='$d_msgsnd'
23214 d_msync='$d_msync'
23215 d_munmap='$d_munmap'
23216 d_mymalloc='$d_mymalloc'
23217 d_ndbm='$d_ndbm'
23218 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23219 d_nice='$d_nice'
23220 d_nl_langinfo='$d_nl_langinfo'
23221 d_nv_preserves_uv='$d_nv_preserves_uv'
23222 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23223 d_off64_t='$d_off64_t'
23224 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23225 d_oldpthreads='$d_oldpthreads'
23226 d_oldsock='$d_oldsock'
23227 d_open3='$d_open3'
23228 d_pathconf='$d_pathconf'
23229 d_pause='$d_pause'
23230 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23231 d_phostname='$d_phostname'
23232 d_pipe='$d_pipe'
23233 d_poll='$d_poll'
23234 d_portable='$d_portable'
23235 d_prctl='$d_prctl'
23236 d_prctl_set_name='$d_prctl_set_name'
23237 d_printf_format_null='$d_printf_format_null'
23238 d_procselfexe='$d_procselfexe'
23239 d_pseudofork='$d_pseudofork'
23240 d_pthread_atfork='$d_pthread_atfork'
23241 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23242 d_pthread_yield='$d_pthread_yield'
23243 d_pwage='$d_pwage'
23244 d_pwchange='$d_pwchange'
23245 d_pwclass='$d_pwclass'
23246 d_pwcomment='$d_pwcomment'
23247 d_pwexpire='$d_pwexpire'
23248 d_pwgecos='$d_pwgecos'
23249 d_pwpasswd='$d_pwpasswd'
23250 d_pwquota='$d_pwquota'
23251 d_qgcvt='$d_qgcvt'
23252 d_quad='$d_quad'
23253 d_random_r='$d_random_r'
23254 d_readdir64_r='$d_readdir64_r'
23255 d_readdir='$d_readdir'
23256 d_readdir_r='$d_readdir_r'
23257 d_readlink='$d_readlink'
23258 d_readv='$d_readv'
23259 d_recvmsg='$d_recvmsg'
23260 d_rename='$d_rename'
23261 d_rewinddir='$d_rewinddir'
23262 d_rmdir='$d_rmdir'
23263 d_safebcpy='$d_safebcpy'
23264 d_safemcpy='$d_safemcpy'
23265 d_sanemcmp='$d_sanemcmp'
23266 d_sbrkproto='$d_sbrkproto'
23267 d_scalbnl='$d_scalbnl'
23268 d_sched_yield='$d_sched_yield'
23269 d_scm_rights='$d_scm_rights'
23270 d_seekdir='$d_seekdir'
23271 d_select='$d_select'
23272 d_sem='$d_sem'
23273 d_semctl='$d_semctl'
23274 d_semctl_semid_ds='$d_semctl_semid_ds'
23275 d_semctl_semun='$d_semctl_semun'
23276 d_semget='$d_semget'
23277 d_semop='$d_semop'
23278 d_sendmsg='$d_sendmsg'
23279 d_setegid='$d_setegid'
23280 d_seteuid='$d_seteuid'
23281 d_setgrent='$d_setgrent'
23282 d_setgrent_r='$d_setgrent_r'
23283 d_setgrps='$d_setgrps'
23284 d_sethent='$d_sethent'
23285 d_sethostent_r='$d_sethostent_r'
23286 d_setitimer='$d_setitimer'
23287 d_setlinebuf='$d_setlinebuf'
23288 d_setlocale='$d_setlocale'
23289 d_setlocale_r='$d_setlocale_r'
23290 d_setnent='$d_setnent'
23291 d_setnetent_r='$d_setnetent_r'
23292 d_setpent='$d_setpent'
23293 d_setpgid='$d_setpgid'
23294 d_setpgrp2='$d_setpgrp2'
23295 d_setpgrp='$d_setpgrp'
23296 d_setprior='$d_setprior'
23297 d_setproctitle='$d_setproctitle'
23298 d_setprotoent_r='$d_setprotoent_r'
23299 d_setpwent='$d_setpwent'
23300 d_setpwent_r='$d_setpwent_r'
23301 d_setregid='$d_setregid'
23302 d_setresgid='$d_setresgid'
23303 d_setresuid='$d_setresuid'
23304 d_setreuid='$d_setreuid'
23305 d_setrgid='$d_setrgid'
23306 d_setruid='$d_setruid'
23307 d_setsent='$d_setsent'
23308 d_setservent_r='$d_setservent_r'
23309 d_setsid='$d_setsid'
23310 d_setvbuf='$d_setvbuf'
23311 d_sfio='$d_sfio'
23312 d_shm='$d_shm'
23313 d_shmat='$d_shmat'
23314 d_shmatprototype='$d_shmatprototype'
23315 d_shmctl='$d_shmctl'
23316 d_shmdt='$d_shmdt'
23317 d_shmget='$d_shmget'
23318 d_sigaction='$d_sigaction'
23319 d_signbit='$d_signbit'
23320 d_sigprocmask='$d_sigprocmask'
23321 d_sigsetjmp='$d_sigsetjmp'
23322 d_sin6_scope_id='$d_sin6_scope_id'
23323 d_sitearch='$d_sitearch'
23324 d_snprintf='$d_snprintf'
23325 d_sockaddr_in6='$d_sockaddr_in6'
23326 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23327 d_sockatmark='$d_sockatmark'
23328 d_sockatmarkproto='$d_sockatmarkproto'
23329 d_socket='$d_socket'
23330 d_socklen_t='$d_socklen_t'
23331 d_sockpair='$d_sockpair'
23332 d_socks5_init='$d_socks5_init'
23333 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23334 d_sqrtl='$d_sqrtl'
23335 d_srand48_r='$d_srand48_r'
23336 d_srandom_r='$d_srandom_r'
23337 d_sresgproto='$d_sresgproto'
23338 d_sresuproto='$d_sresuproto'
23339 d_statblks='$d_statblks'
23340 d_statfs_f_flags='$d_statfs_f_flags'
23341 d_statfs_s='$d_statfs_s'
23342 d_static_inline='$d_static_inline'
23343 d_statvfs='$d_statvfs'
23344 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23345 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23346 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23347 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23348 d_stdio_stream_array='$d_stdio_stream_array'
23349 d_stdiobase='$d_stdiobase'
23350 d_stdstdio='$d_stdstdio'
23351 d_strchr='$d_strchr'
23352 d_strcoll='$d_strcoll'
23353 d_strctcpy='$d_strctcpy'
23354 d_strerrm='$d_strerrm'
23355 d_strerror='$d_strerror'
23356 d_strerror_r='$d_strerror_r'
23357 d_strftime='$d_strftime'
23358 d_strlcat='$d_strlcat'
23359 d_strlcpy='$d_strlcpy'
23360 d_strtod='$d_strtod'
23361 d_strtol='$d_strtol'
23362 d_strtold='$d_strtold'
23363 d_strtoll='$d_strtoll'
23364 d_strtoq='$d_strtoq'
23365 d_strtoul='$d_strtoul'
23366 d_strtoull='$d_strtoull'
23367 d_strtouq='$d_strtouq'
23368 d_strxfrm='$d_strxfrm'
23369 d_suidsafe='$d_suidsafe'
23370 d_symlink='$d_symlink'
23371 d_syscall='$d_syscall'
23372 d_syscallproto='$d_syscallproto'
23373 d_sysconf='$d_sysconf'
23374 d_sysernlst='$d_sysernlst'
23375 d_syserrlst='$d_syserrlst'
23376 d_system='$d_system'
23377 d_tcgetpgrp='$d_tcgetpgrp'
23378 d_tcsetpgrp='$d_tcsetpgrp'
23379 d_telldir='$d_telldir'
23380 d_telldirproto='$d_telldirproto'
23381 d_time='$d_time'
23382 d_timegm='$d_timegm'
23383 d_times='$d_times'
23384 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23385 d_tm_tm_zone='$d_tm_tm_zone'
23386 d_tmpnam_r='$d_tmpnam_r'
23387 d_truncate='$d_truncate'
23388 d_ttyname_r='$d_ttyname_r'
23389 d_tzname='$d_tzname'
23390 d_u32align='$d_u32align'
23391 d_ualarm='$d_ualarm'
23392 d_umask='$d_umask'
23393 d_uname='$d_uname'
23394 d_union_semun='$d_union_semun'
23395 d_unordered='$d_unordered'
23396 d_unsetenv='$d_unsetenv'
23397 d_usleep='$d_usleep'
23398 d_usleepproto='$d_usleepproto'
23399 d_ustat='$d_ustat'
23400 d_vendorarch='$d_vendorarch'
23401 d_vendorbin='$d_vendorbin'
23402 d_vendorlib='$d_vendorlib'
23403 d_vendorscript='$d_vendorscript'
23404 d_vfork='$d_vfork'
23405 d_void_closedir='$d_void_closedir'
23406 d_voidsig='$d_voidsig'
23407 d_voidtty='$d_voidtty'
23408 d_volatile='$d_volatile'
23409 d_vprintf='$d_vprintf'
23410 d_vsnprintf='$d_vsnprintf'
23411 d_wait4='$d_wait4'
23412 d_waitpid='$d_waitpid'
23413 d_wcstombs='$d_wcstombs'
23414 d_wctomb='$d_wctomb'
23415 d_writev='$d_writev'
23416 d_xenix='$d_xenix'
23417 date='$date'
23418 db_hashtype='$db_hashtype'
23419 db_prefixtype='$db_prefixtype'
23420 db_version_major='$db_version_major'
23421 db_version_minor='$db_version_minor'
23422 db_version_patch='$db_version_patch'
23423 defvoidused='$defvoidused'
23424 direntrytype='$direntrytype'
23425 dlext='$dlext'
23426 dlsrc='$dlsrc'
23427 doublesize='$doublesize'
23428 drand01='$drand01'
23429 drand48_r_proto='$drand48_r_proto'
23430 dtrace='$dtrace'
23431 dynamic_ext='$dynamic_ext'
23432 eagain='$eagain'
23433 ebcdic='$ebcdic'
23434 echo='$echo'
23435 egrep='$egrep'
23436 emacs='$emacs'
23437 endgrent_r_proto='$endgrent_r_proto'
23438 endhostent_r_proto='$endhostent_r_proto'
23439 endnetent_r_proto='$endnetent_r_proto'
23440 endprotoent_r_proto='$endprotoent_r_proto'
23441 endpwent_r_proto='$endpwent_r_proto'
23442 endservent_r_proto='$endservent_r_proto'
23443 eunicefix='$eunicefix'
23444 exe_ext='$exe_ext'
23445 expr='$expr'
23446 extensions='$extensions'
23447 extern_C='$extern_C'
23448 extras='$extras'
23449 fflushNULL='$fflushNULL'
23450 fflushall='$fflushall'
23451 find='$find'
23452 firstmakefile='$firstmakefile'
23453 flex='$flex'
23454 fpossize='$fpossize'
23455 fpostype='$fpostype'
23456 freetype='$freetype'
23457 from='$from'
23458 full_ar='$full_ar'
23459 full_csh='$full_csh'
23460 full_sed='$full_sed'
23461 gccansipedantic='$gccansipedantic'
23462 gccosandvers='$gccosandvers'
23463 gccversion='$gccversion'
23464 getgrent_r_proto='$getgrent_r_proto'
23465 getgrgid_r_proto='$getgrgid_r_proto'
23466 getgrnam_r_proto='$getgrnam_r_proto'
23467 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23468 gethostbyname_r_proto='$gethostbyname_r_proto'
23469 gethostent_r_proto='$gethostent_r_proto'
23470 getlogin_r_proto='$getlogin_r_proto'
23471 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23472 getnetbyname_r_proto='$getnetbyname_r_proto'
23473 getnetent_r_proto='$getnetent_r_proto'
23474 getprotobyname_r_proto='$getprotobyname_r_proto'
23475 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23476 getprotoent_r_proto='$getprotoent_r_proto'
23477 getpwent_r_proto='$getpwent_r_proto'
23478 getpwnam_r_proto='$getpwnam_r_proto'
23479 getpwuid_r_proto='$getpwuid_r_proto'
23480 getservbyname_r_proto='$getservbyname_r_proto'
23481 getservbyport_r_proto='$getservbyport_r_proto'
23482 getservent_r_proto='$getservent_r_proto'
23483 getspnam_r_proto='$getspnam_r_proto'
23484 gidformat='$gidformat'
23485 gidsign='$gidsign'
23486 gidsize='$gidsize'
23487 gidtype='$gidtype'
23488 glibpth='$glibpth'
23489 gmake='$gmake'
23490 gmtime_r_proto='$gmtime_r_proto'
23491 gnulibc_version='$gnulibc_version'
23492 grep='$grep'
23493 groupcat='$groupcat'
23494 groupstype='$groupstype'
23495 gzip='$gzip'
23496 h_fcntl='$h_fcntl'
23497 h_sysfile='$h_sysfile'
23498 hint='$hint'
23499 hostcat='$hostcat'
23500 html1dir='$html1dir'
23501 html1direxp='$html1direxp'
23502 html3dir='$html3dir'
23503 html3direxp='$html3direxp'
23504 i16size='$i16size'
23505 i16type='$i16type'
23506 i32size='$i32size'
23507 i32type='$i32type'
23508 i64size='$i64size'
23509 i64type='$i64type'
23510 i8size='$i8size'
23511 i8type='$i8type'
23512 i_arpainet='$i_arpainet'
23513 i_assert='$i_assert'
23514 i_bsdioctl='$i_bsdioctl'
23515 i_crypt='$i_crypt'
23516 i_db='$i_db'
23517 i_dbm='$i_dbm'
23518 i_dirent='$i_dirent'
23519 i_dld='$i_dld'
23520 i_dlfcn='$i_dlfcn'
23521 i_fcntl='$i_fcntl'
23522 i_float='$i_float'
23523 i_fp='$i_fp'
23524 i_fp_class='$i_fp_class'
23525 i_gdbm='$i_gdbm'
23526 i_gdbm_ndbm='$i_gdbm_ndbm'
23527 i_gdbmndbm='$i_gdbmndbm'
23528 i_grp='$i_grp'
23529 i_ieeefp='$i_ieeefp'
23530 i_inttypes='$i_inttypes'
23531 i_langinfo='$i_langinfo'
23532 i_libutil='$i_libutil'
23533 i_limits='$i_limits'
23534 i_locale='$i_locale'
23535 i_machcthr='$i_machcthr'
23536 i_malloc='$i_malloc'
23537 i_mallocmalloc='$i_mallocmalloc'
23538 i_math='$i_math'
23539 i_memory='$i_memory'
23540 i_mntent='$i_mntent'
23541 i_ndbm='$i_ndbm'
23542 i_netdb='$i_netdb'
23543 i_neterrno='$i_neterrno'
23544 i_netinettcp='$i_netinettcp'
23545 i_niin='$i_niin'
23546 i_poll='$i_poll'
23547 i_prot='$i_prot'
23548 i_pthread='$i_pthread'
23549 i_pwd='$i_pwd'
23550 i_rpcsvcdbm='$i_rpcsvcdbm'
23551 i_sfio='$i_sfio'
23552 i_sgtty='$i_sgtty'
23553 i_shadow='$i_shadow'
23554 i_socks='$i_socks'
23555 i_stdarg='$i_stdarg'
23556 i_stdbool='$i_stdbool'
23557 i_stddef='$i_stddef'
23558 i_stdlib='$i_stdlib'
23559 i_string='$i_string'
23560 i_sunmath='$i_sunmath'
23561 i_sysaccess='$i_sysaccess'
23562 i_sysdir='$i_sysdir'
23563 i_sysfile='$i_sysfile'
23564 i_sysfilio='$i_sysfilio'
23565 i_sysin='$i_sysin'
23566 i_sysioctl='$i_sysioctl'
23567 i_syslog='$i_syslog'
23568 i_sysmman='$i_sysmman'
23569 i_sysmode='$i_sysmode'
23570 i_sysmount='$i_sysmount'
23571 i_sysndir='$i_sysndir'
23572 i_sysparam='$i_sysparam'
23573 i_syspoll='$i_syspoll'
23574 i_sysresrc='$i_sysresrc'
23575 i_syssecrt='$i_syssecrt'
23576 i_sysselct='$i_sysselct'
23577 i_syssockio='$i_syssockio'
23578 i_sysstat='$i_sysstat'
23579 i_sysstatfs='$i_sysstatfs'
23580 i_sysstatvfs='$i_sysstatvfs'
23581 i_systime='$i_systime'
23582 i_systimek='$i_systimek'
23583 i_systimes='$i_systimes'
23584 i_systypes='$i_systypes'
23585 i_sysuio='$i_sysuio'
23586 i_sysun='$i_sysun'
23587 i_sysutsname='$i_sysutsname'
23588 i_sysvfs='$i_sysvfs'
23589 i_syswait='$i_syswait'
23590 i_termio='$i_termio'
23591 i_termios='$i_termios'
23592 i_time='$i_time'
23593 i_unistd='$i_unistd'
23594 i_ustat='$i_ustat'
23595 i_utime='$i_utime'
23596 i_values='$i_values'
23597 i_varargs='$i_varargs'
23598 i_varhdr='$i_varhdr'
23599 i_vfork='$i_vfork'
23600 ignore_versioned_solibs='$ignore_versioned_solibs'
23601 inc_version_list='$inc_version_list'
23602 inc_version_list_init='$inc_version_list_init'
23603 incpath='$incpath'
23604 inews='$inews'
23605 initialinstalllocation='$initialinstalllocation'
23606 installarchlib='$installarchlib'
23607 installbin='$installbin'
23608 installhtml1dir='$installhtml1dir'
23609 installhtml3dir='$installhtml3dir'
23610 installman1dir='$installman1dir'
23611 installman3dir='$installman3dir'
23612 installprefix='$installprefix'
23613 installprefixexp='$installprefixexp'
23614 installprivlib='$installprivlib'
23615 installscript='$installscript'
23616 installsitearch='$installsitearch'
23617 installsitebin='$installsitebin'
23618 installsitehtml1dir='$installsitehtml1dir'
23619 installsitehtml3dir='$installsitehtml3dir'
23620 installsitelib='$installsitelib'
23621 installsiteman1dir='$installsiteman1dir'
23622 installsiteman3dir='$installsiteman3dir'
23623 installsitescript='$installsitescript'
23624 installstyle='$installstyle'
23625 installusrbinperl='$installusrbinperl'
23626 installvendorarch='$installvendorarch'
23627 installvendorbin='$installvendorbin'
23628 installvendorhtml1dir='$installvendorhtml1dir'
23629 installvendorhtml3dir='$installvendorhtml3dir'
23630 installvendorlib='$installvendorlib'
23631 installvendorman1dir='$installvendorman1dir'
23632 installvendorman3dir='$installvendorman3dir'
23633 installvendorscript='$installvendorscript'
23634 intsize='$intsize'
23635 issymlink='$issymlink'
23636 ivdformat='$ivdformat'
23637 ivsize='$ivsize'
23638 ivtype='$ivtype'
23639 known_extensions='$known_extensions'
23640 ksh='$ksh'
23641 ld='$ld'
23642 ld_can_script='$ld_can_script'
23643 lddlflags='$lddlflags'
23644 ldflags='$ldflags'
23645 ldflags_uselargefiles='$ldflags_uselargefiles'
23646 ldlibpthname='$ldlibpthname'
23647 less='$less'
23648 lib_ext='$lib_ext'
23649 libc='$libc'
23650 libperl='$libperl'
23651 libpth='$libpth'
23652 libs='$libs'
23653 libsdirs='$libsdirs'
23654 libsfiles='$libsfiles'
23655 libsfound='$libsfound'
23656 libspath='$libspath'
23657 libswanted='$libswanted'
23658 libswanted_uselargefiles='$libswanted_uselargefiles'
23659 line='$line'
23660 lint='$lint'
23661 lkflags='$lkflags'
23662 ln='$ln'
23663 lns='$lns'
23664 localtime_r_proto='$localtime_r_proto'
23665 locincpth='$locincpth'
23666 loclibpth='$loclibpth'
23667 longdblsize='$longdblsize'
23668 longlongsize='$longlongsize'
23669 longsize='$longsize'
23670 lp='$lp'
23671 lpr='$lpr'
23672 ls='$ls'
23673 lseeksize='$lseeksize'
23674 lseektype='$lseektype'
23675 mad='$mad'
23676 madlyh='$madlyh'
23677 madlyobj='$madlyobj'
23678 madlysrc='$madlysrc'
23679 mail='$mail'
23680 mailx='$mailx'
23681 make='$make'
23682 make_set_make='$make_set_make'
23683 mallocobj='$mallocobj'
23684 mallocsrc='$mallocsrc'
23685 malloctype='$malloctype'
23686 man1dir='$man1dir'
23687 man1direxp='$man1direxp'
23688 man1ext='$man1ext'
23689 man3dir='$man3dir'
23690 man3direxp='$man3direxp'
23691 man3ext='$man3ext'
23692 mips_type='$mips_type'
23693 mistrustnm='$mistrustnm'
23694 mkdir='$mkdir'
23695 mmaptype='$mmaptype'
23696 modetype='$modetype'
23697 more='$more'
23698 multiarch='$multiarch'
23699 mv='$mv'
23700 myarchname='$myarchname'
23701 mydomain='$mydomain'
23702 myhostname='$myhostname'
23703 myuname='$myuname'
23704 n='$n'
23705 need_va_copy='$need_va_copy'
23706 netdb_hlen_type='$netdb_hlen_type'
23707 netdb_host_type='$netdb_host_type'
23708 netdb_name_type='$netdb_name_type'
23709 netdb_net_type='$netdb_net_type'
23710 nm='$nm'
23711 nm_opt='$nm_opt'
23712 nm_so_opt='$nm_so_opt'
23713 nonxs_ext='$nonxs_ext'
23714 nroff='$nroff'
23715 nvEUformat='$nvEUformat'
23716 nvFUformat='$nvFUformat'
23717 nvGUformat='$nvGUformat'
23718 nv_overflows_integers_at='$nv_overflows_integers_at'
23719 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23720 nveformat='$nveformat'
23721 nvfformat='$nvfformat'
23722 nvgformat='$nvgformat'
23723 nvsize='$nvsize'
23724 nvtype='$nvtype'
23725 o_nonblock='$o_nonblock'
23726 obj_ext='$obj_ext'
23727 old_pthread_create_joinable='$old_pthread_create_joinable'
23728 optimize='$optimize'
23729 orderlib='$orderlib'
23730 osname='$osname'
23731 osvers='$osvers'
23732 otherlibdirs='$otherlibdirs'
23733 package='$package'
23734 pager='$pager'
23735 passcat='$passcat'
23736 patchlevel='$patchlevel'
23737 path_sep='$path_sep'
23738 perl5='$perl5'
23739 perl='$perl'
23740 perl_patchlevel='$perl_patchlevel'
23741 perl_static_inline='$perl_static_inline'
23742 perladmin='$perladmin'
23743 perllibs='$perllibs'
23744 perlpath='$perlpath'
23745 pg='$pg'
23746 phostname='$phostname'
23747 pidtype='$pidtype'
23748 plibpth='$plibpth'
23749 pmake='$pmake'
23750 pr='$pr'
23751 prefix='$prefix'
23752 prefixexp='$prefixexp'
23753 privlib='$privlib'
23754 privlibexp='$privlibexp'
23755 procselfexe='$procselfexe'
23756 prototype='$prototype'
23757 ptrsize='$ptrsize'
23758 quadkind='$quadkind'
23759 quadtype='$quadtype'
23760 randbits='$randbits'
23761 randfunc='$randfunc'
23762 random_r_proto='$random_r_proto'
23763 randseedtype='$randseedtype'
23764 ranlib='$ranlib'
23765 rd_nodata='$rd_nodata'
23766 readdir64_r_proto='$readdir64_r_proto'
23767 readdir_r_proto='$readdir_r_proto'
23768 revision='$revision'
23769 rm='$rm'
23770 rm_try='$rm_try'
23771 rmail='$rmail'
23772 run='$run'
23773 runnm='$runnm'
23774 sGMTIME_max='$sGMTIME_max'
23775 sGMTIME_min='$sGMTIME_min'
23776 sLOCALTIME_max='$sLOCALTIME_max'
23777 sLOCALTIME_min='$sLOCALTIME_min'
23778 sPRIEUldbl='$sPRIEUldbl'
23779 sPRIFUldbl='$sPRIFUldbl'
23780 sPRIGUldbl='$sPRIGUldbl'
23781 sPRIXU64='$sPRIXU64'
23782 sPRId64='$sPRId64'
23783 sPRIeldbl='$sPRIeldbl'
23784 sPRIfldbl='$sPRIfldbl'
23785 sPRIgldbl='$sPRIgldbl'
23786 sPRIi64='$sPRIi64'
23787 sPRIo64='$sPRIo64'
23788 sPRIu64='$sPRIu64'
23789 sPRIx64='$sPRIx64'
23790 sSCNfldbl='$sSCNfldbl'
23791 sched_yield='$sched_yield'
23792 scriptdir='$scriptdir'
23793 scriptdirexp='$scriptdirexp'
23794 sed='$sed'
23795 seedfunc='$seedfunc'
23796 selectminbits='$selectminbits'
23797 selecttype='$selecttype'
23798 sendmail='$sendmail'
23799 setgrent_r_proto='$setgrent_r_proto'
23800 sethostent_r_proto='$sethostent_r_proto'
23801 setlocale_r_proto='$setlocale_r_proto'
23802 setnetent_r_proto='$setnetent_r_proto'
23803 setprotoent_r_proto='$setprotoent_r_proto'
23804 setpwent_r_proto='$setpwent_r_proto'
23805 setservent_r_proto='$setservent_r_proto'
23806 sh='$sh'
23807 shar='$shar'
23808 sharpbang='$sharpbang'
23809 shmattype='$shmattype'
23810 shortsize='$shortsize'
23811 shrpenv='$shrpenv'
23812 shsharp='$shsharp'
23813 sig_count='$sig_count'
23814 sig_name='$sig_name'
23815 sig_name_init='$sig_name_init'
23816 sig_num='$sig_num'
23817 sig_num_init='$sig_num_init'
23818 sig_size='$sig_size'
23819 signal_t='$signal_t'
23820 sitearch='$sitearch'
23821 sitearchexp='$sitearchexp'
23822 sitebin='$sitebin'
23823 sitebinexp='$sitebinexp'
23824 sitehtml1dir='$sitehtml1dir'
23825 sitehtml1direxp='$sitehtml1direxp'
23826 sitehtml3dir='$sitehtml3dir'
23827 sitehtml3direxp='$sitehtml3direxp'
23828 sitelib='$sitelib'
23829 sitelib_stem='$sitelib_stem'
23830 sitelibexp='$sitelibexp'
23831 siteman1dir='$siteman1dir'
23832 siteman1direxp='$siteman1direxp'
23833 siteman3dir='$siteman3dir'
23834 siteman3direxp='$siteman3direxp'
23835 siteprefix='$siteprefix'
23836 siteprefixexp='$siteprefixexp'
23837 sitescript='$sitescript'
23838 sitescriptexp='$sitescriptexp'
23839 sizesize='$sizesize'
23840 sizetype='$sizetype'
23841 sleep='$sleep'
23842 smail='$smail'
23843 so='$so'
23844 sockethdr='$sockethdr'
23845 socketlib='$socketlib'
23846 socksizetype='$socksizetype'
23847 sort='$sort'
23848 spackage='$spackage'
23849 spitshell='$spitshell'
23850 srand48_r_proto='$srand48_r_proto'
23851 srandom_r_proto='$srandom_r_proto'
23852 src='$src'
23853 ssizetype='$ssizetype'
23854 st_ino_sign='$st_ino_sign'
23855 st_ino_size='$st_ino_size'
23856 startperl='$startperl'
23857 startsh='$startsh'
23858 static_ext='$static_ext'
23859 stdchar='$stdchar'
23860 stdio_base='$stdio_base'
23861 stdio_bufsiz='$stdio_bufsiz'
23862 stdio_cnt='$stdio_cnt'
23863 stdio_filbuf='$stdio_filbuf'
23864 stdio_ptr='$stdio_ptr'
23865 stdio_stream_array='$stdio_stream_array'
23866 strerror_r_proto='$strerror_r_proto'
23867 strings='$strings'
23868 submit='$submit'
23869 subversion='$subversion'
23870 sysman='$sysman'
23871 tail='$tail'
23872 tar='$tar'
23873 targetarch='$targetarch'
23874 tbl='$tbl'
23875 tee='$tee'
23876 test='$test'
23877 timeincl='$timeincl'
23878 timetype='$timetype'
23879 tmpnam_r_proto='$tmpnam_r_proto'
23880 to='$to'
23881 touch='$touch'
23882 tr='$tr'
23883 trnl='$trnl'
23884 troff='$troff'
23885 ttyname_r_proto='$ttyname_r_proto'
23886 u16size='$u16size'
23887 u16type='$u16type'
23888 u32size='$u32size'
23889 u32type='$u32type'
23890 u64size='$u64size'
23891 u64type='$u64type'
23892 u8size='$u8size'
23893 u8type='$u8type'
23894 uidformat='$uidformat'
23895 uidsign='$uidsign'
23896 uidsize='$uidsize'
23897 uidtype='$uidtype'
23898 uname='$uname'
23899 uniq='$uniq'
23900 uquadtype='$uquadtype'
23901 use5005threads='$use5005threads'
23902 use64bitall='$use64bitall'
23903 use64bitint='$use64bitint'
23904 usecrosscompile='$usecrosscompile'
23905 usedevel='$usedevel'
23906 usedl='$usedl'
23907 usedtrace='$usedtrace'
23908 usefaststdio='$usefaststdio'
23909 useithreads='$useithreads'
23910 usekernprocpathname='$usekernprocpathname'
23911 uselargefiles='$uselargefiles'
23912 uselongdouble='$uselongdouble'
23913 usemallocwrap='$usemallocwrap'
23914 usemorebits='$usemorebits'
23915 usemultiplicity='$usemultiplicity'
23916 usemymalloc='$usemymalloc'
23917 usenm='$usenm'
23918 usensgetexecutablepath='$usensgetexecutablepath'
23919 useopcode='$useopcode'
23920 useperlio='$useperlio'
23921 useposix='$useposix'
23922 usereentrant='$usereentrant'
23923 userelocatableinc='$userelocatableinc'
23924 usesfio='$usesfio'
23925 useshrplib='$useshrplib'
23926 usesitecustomize='$usesitecustomize'
23927 usesocks='$usesocks'
23928 usethreads='$usethreads'
23929 usevendorprefix='$usevendorprefix'
23930 useversionedarchname='$useversionedarchname'
23931 usevfork='$usevfork'
23932 usrinc='$usrinc'
23933 uuname='$uuname'
23934 uvXUformat='$uvXUformat'
23935 uvoformat='$uvoformat'
23936 uvsize='$uvsize'
23937 uvtype='$uvtype'
23938 uvuformat='$uvuformat'
23939 uvxformat='$uvxformat'
23940 vaproto='$vaproto'
23941 vendorarch='$vendorarch'
23942 vendorarchexp='$vendorarchexp'
23943 vendorbin='$vendorbin'
23944 vendorbinexp='$vendorbinexp'
23945 vendorhtml1dir='$vendorhtml1dir'
23946 vendorhtml1direxp='$vendorhtml1direxp'
23947 vendorhtml3dir='$vendorhtml3dir'
23948 vendorhtml3direxp='$vendorhtml3direxp'
23949 vendorlib='$vendorlib'
23950 vendorlib_stem='$vendorlib_stem'
23951 vendorlibexp='$vendorlibexp'
23952 vendorman1dir='$vendorman1dir'
23953 vendorman1direxp='$vendorman1direxp'
23954 vendorman3dir='$vendorman3dir'
23955 vendorman3direxp='$vendorman3direxp'
23956 vendorprefix='$vendorprefix'
23957 vendorprefixexp='$vendorprefixexp'
23958 vendorscript='$vendorscript'
23959 vendorscriptexp='$vendorscriptexp'
23960 version='$version'
23961 version_patchlevel_string='$version_patchlevel_string'
23962 versiononly='$versiononly'
23963 vi='$vi'
23964 voidflags='$voidflags'
23965 xlibpth='$xlibpth'
23966 yacc='$yacc'
23967 yaccflags='$yaccflags'
23968 zcat='$zcat'
23969 zip='$zip'
23970 EOT
23971
23972 : add special variables
23973 $test -f $src/patchlevel.h && \
23974 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23975 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23976 echo "PERL_CONFIG_SH=true" >>config.sh
23977
23978 : propagate old symbols
23979 if $test -f UU/config.sh; then
23980         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23981         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23982                 config.sh config.sh UU/oldconfig.sh |\
23983                 $sort | $uniq -u >UU/oldsyms
23984         set X `$cat UU/oldsyms`
23985         shift
23986         case $# in
23987         0) ;;
23988         *)
23989                 $cat <<EOM
23990 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23991 EOM
23992                 echo ": Variables propagated from previous config.sh file." >>config.sh
23993                 for sym in `$cat UU/oldsyms`; do
23994                         echo "    Propagating $hint variable "'$'"$sym..."
23995                         eval 'tmp="$'"${sym}"'"'
23996                         echo "$tmp" | \
23997                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23998                 done
23999                 ;;
24000         esac
24001 fi
24002
24003 : Finish up by extracting the .SH files
24004 case "$alldone" in
24005 exit)
24006         $rm -rf UU
24007         echo "Extraction done."
24008         exit 0
24009         ;;
24010 cont)
24011         ;;
24012 '')
24013         dflt=''
24014         nostick=true
24015         $cat <<EOM
24016
24017 If you'd like to make any changes to the config.sh file before I begin
24018 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24019
24020 EOM
24021         rp="Press return or use a shell escape to edit config.sh:"
24022         . UU/myread
24023         nostick=''
24024         case "$ans" in
24025         '') ;;
24026         *) : in case they cannot read
24027                 sh 1>&4 -c "$ans";;
24028         esac
24029         ;;
24030 esac
24031
24032 : if this fails, just run all the .SH files by hand
24033 . ./config.sh
24034
24035 echo " "
24036 exec 1>&4
24037 pwd=`pwd`
24038 . ./UU/extract
24039 cd "$pwd"
24040
24041 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24042         dflt=y
24043         case "$silent" in
24044         true) ;;
24045         *)
24046                 $cat <<EOM
24047
24048 Now you need to generate make dependencies by running "$make depend".
24049 You might prefer to run it in background: "$make depend > makedepend.out &"
24050 It can take a while, so you might not want to run it right now.
24051
24052 EOM
24053                 ;;
24054         esac
24055         rp="Run $make depend now?"
24056         . UU/myread
24057         case "$ans" in
24058         y*)
24059                 $make depend && echo "Now you must run '$make'."
24060                 ;;
24061         *)
24062                 echo "You must run '$make depend' then '$make'."
24063                 ;;
24064         esac
24065 elif test -f [Mm]akefile; then
24066         echo " "
24067         echo "Now you must run a $make."
24068 else
24069         echo "Configure done."
24070 fi
24071
24072 if $test -f Policy.sh; then
24073     $cat <<EOM
24074
24075 If you compile $package on a different machine or from a different object
24076 directory, copy the Policy.sh file from this object directory to the
24077 new one before you run Configure -- this will help you with most of
24078 the policy defaults.
24079
24080 EOM
24081 fi
24082 if $test -f config.msg; then
24083     echo "Hmm.  I also noted the following information while running:"
24084     echo " "
24085     $cat config.msg >&4
24086     $rm -f config.msg
24087 fi
24088 $rm -f kit*isdone ark*isdone
24089 $rm -rf UU
24090
24091 : End of Configure
24092