This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Stop op freeing from interfering with sub(){42} mutability
[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 Mon Jul 15 15:52:13 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|*msys) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 run=''
210 targetarch=''
211 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 offer a form of threading support 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 slightly more memory than plain Perl.
4163
4164 If this doesn't make any sense to you, just accept the default '$dflt'.
4165 EOM
4166 rp='Build a threading Perl?'
4167 . ./myread
4168 case "$ans" in
4169 y|Y)    val="$define" ;;
4170 *)      val="$undef" ;;
4171 esac
4172 set usethreads
4173 eval $setvar
4174
4175 if $test $patchlevel -lt 9; then
4176     case "$usethreads" in
4177     $define)
4178         : Default to ithreads unless overridden on command line or with
4179         : old config.sh
4180         dflt='y'
4181         case "$use5005threads" in
4182                 $define|true|[yY]*)
4183                         echo "5.005 threads are no longer supported"
4184                         exit 1
4185                 ;;
4186         esac
4187         case "$useithreads" in
4188                 $undef|false|[nN]*) dflt='n';;
4189         esac
4190         rp='Use the newer interpreter-based ithreads?'
4191         . ./myread
4192         case "$ans" in
4193         y|Y)    val="$define" ;;
4194         *)      val="$undef" ;;
4195         esac
4196         set useithreads
4197         eval $setvar
4198         : Now set use5005threads to the opposite value.
4199         case "$useithreads" in
4200         $define) val="$undef" ;;
4201         *) val="$define" ;;
4202         esac
4203         set use5005threads
4204         eval $setvar
4205         ;;
4206     *)
4207         useithreads="$undef"
4208         use5005threads="$undef"
4209         ;;
4210     esac
4211
4212     case "$useithreads$use5005threads" in
4213     "$define$define")
4214         $cat >&4 <<EOM
4215
4216 You cannot have both the ithreads and the 5.005 threads enabled
4217 at the same time.  Disabling the 5.005 threads since they are
4218 much less stable than the ithreads.
4219
4220 EOM
4221         use5005threads="$undef"
4222         ;;
4223     esac
4224
4225 else
4226 : perl-5.9.x and later
4227
4228     if test X"$usethreads" = "X$define"; then
4229         case "$use5005threads" in
4230             $define|true|[yY]*)
4231                 $cat >&4 <<EOM
4232
4233 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4234
4235 EOM
4236             ;;
4237         esac
4238     fi
4239
4240     use5005threads="$undef"
4241     useithreads="$usethreads"
4242 fi
4243
4244 case "$d_oldpthreads" in
4245 '')     : Configure tests would be welcome here.  For now, assume undef.
4246         val="$undef" ;;
4247 *)      val="$d_oldpthreads" ;;
4248 esac
4249 set d_oldpthreads
4250 eval $setvar
4251
4252
4253 : Look for a hint-file generated 'call-back-unit'.  If the
4254 : user has specified that a threading perl is to be built,
4255 : we may need to set or change some other defaults.
4256 if $test -f usethreads.cbu; then
4257     echo "Your platform has some specific hints regarding threaded builds, using them..."
4258     . ./usethreads.cbu
4259 else
4260     case "$usethreads" in
4261         "$define"|true|[yY]*)
4262                 $cat <<EOM
4263 (Your platform does not have any specific hints for threaded builds.
4264  Assuming POSIX threads, then.)
4265 EOM
4266         ;;
4267     esac
4268 fi
4269
4270 : Check if multiplicity is required
4271 cat <<EOM
4272
4273 Perl can be built so that multiple Perl interpreters can coexist
4274 within the same Perl executable.
4275 EOM
4276
4277 case "$useithreads" in
4278 $define)
4279         cat <<EOM
4280 This multiple interpreter support is required for interpreter-based threads.
4281 EOM
4282         val="$define"
4283         ;;
4284 *)      case "$usemultiplicity" in
4285         $define|true|[yY]*)     dflt='y';;
4286         *) dflt='n';;
4287         esac
4288         echo " "
4289         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4290         rp='Build Perl for multiplicity?'
4291         . ./myread
4292         case "$ans" in
4293         y|Y)    val="$define" ;;
4294         *)      val="$undef" ;;
4295         esac
4296         ;;
4297 esac
4298 set usemultiplicity
4299 eval $setvar
4300
4301 : Check if morebits is requested
4302 case "$usemorebits" in
4303 "$define"|true|[yY]*)
4304         use64bitint="$define"
4305         uselongdouble="$define"
4306         usemorebits="$define"
4307         ;;
4308 *)      usemorebits="$undef"
4309         ;;
4310 esac
4311
4312 : Determine the C compiler to be used
4313 echo " "
4314 case "$cc" in
4315 '') dflt=cc;;
4316 *) dflt="$cc";;
4317 esac
4318 rp="Use which C compiler?"
4319 . ./myread
4320 cc="$ans"
4321
4322 : See whether they have no cc but they do have gcc
4323 . ./trygcc
4324 if $test -f cc.cbu; then
4325     . ./cc.cbu
4326 fi
4327 . ./checkcc
4328
4329 : make some quick guesses about what we are up against
4330 echo " "
4331 $echo $n "Hmm...  $c"
4332 echo exit 1 >bsd
4333 echo exit 1 >usg
4334 echo exit 1 >v7
4335 echo exit 1 >osf1
4336 echo exit 1 >eunice
4337 echo exit 1 >xenix
4338 echo exit 1 >venix
4339 echo exit 1 >os2
4340 d_bsd="$undef"
4341 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4342 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4343 then
4344         echo "Looks kind of like an OSF/1 system, but we'll see..."
4345         echo exit 0 >osf1
4346 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4347         xxx=`./loc addbib blurfl $pth`
4348         if $test -f $xxx; then
4349         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4350                 echo exit 0 >bsd
4351                 echo exit 0 >usg
4352         else
4353                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4354                         echo "Looks kind of like an extended USG system, but we'll see..."
4355                 else
4356                         echo "Looks kind of like a USG system, but we'll see..."
4357                 fi
4358                 echo exit 0 >usg
4359         fi
4360 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4361         echo "Looks kind of like a BSD system, but we'll see..."
4362         d_bsd="$define"
4363         echo exit 0 >bsd
4364 else
4365         echo "Looks kind of like a Version 7 system, but we'll see..."
4366         echo exit 0 >v7
4367 fi
4368 case "$eunicefix" in
4369 *unixtovms*)
4370         $cat <<'EOI'
4371 There is, however, a strange, musty smell in the air that reminds me of
4372 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4373 EOI
4374         echo exit 0 >eunice
4375         d_eunice="$define"
4376 : it so happens the Eunice I know will not run shell scripts in Unix format
4377         ;;
4378 *)
4379         echo " "
4380         echo "Congratulations.  You aren't running Eunice."
4381         d_eunice="$undef"
4382         ;;
4383 esac
4384 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4385 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4386 : semicolon as a patch separator
4387 case "$p_" in
4388 :) ;;
4389 *)
4390         $cat <<'EOI'
4391 I have the feeling something is not exactly right, however...don't tell me...
4392 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4393 (Or you may be running DOS with DJGPP.)
4394 EOI
4395         echo exit 0 >os2
4396         ;;
4397 esac
4398 if test -f /xenix; then
4399         echo "Actually, this looks more like a XENIX system..."
4400         echo exit 0 >xenix
4401         d_xenix="$define"
4402 else
4403         echo " "
4404         echo "It's not Xenix..."
4405         d_xenix="$undef"
4406 fi
4407 chmod +x xenix
4408 $eunicefix xenix
4409 if test -f /venix; then
4410         echo "Actually, this looks more like a VENIX system..."
4411         echo exit 0 >venix
4412 else
4413         echo " "
4414         if ./xenix; then
4415                 : null
4416         else
4417                 echo "Nor is it Venix..."
4418         fi
4419 fi
4420 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4421 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4422 $rm -f foo
4423
4424 : Check if we are using GNU gcc and what its version is
4425 echo " "
4426 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4427 $cat >try.c <<EOM
4428 #include <stdio.h>
4429 int main() {
4430 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4431 #ifdef __VERSION__
4432         printf("%s\n", __VERSION__);
4433 #else
4434         printf("%s\n", "1");
4435 #endif
4436 #endif
4437         return(0);
4438 }
4439 EOM
4440 if $cc -o try $ccflags $ldflags try.c; then
4441         gccversion=`$run ./try`
4442         case "$gccversion" in
4443         '') echo "You are not using GNU cc." ;;
4444         *)  echo "You are using GNU cc $gccversion."
4445             ccname=gcc
4446             ;;
4447         esac
4448 else
4449         echo " "
4450         echo "*** WHOA THERE!!! ***" >&4
4451         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4452         case "$knowitall" in
4453         '')
4454         echo "    You'd better start hunting for one and let me know about it." >&4
4455                 exit 1
4456                 ;;
4457         esac
4458 fi
4459 $rm -f try try.*
4460 case "$gccversion" in
4461 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4462 esac
4463 case "$gccversion" in
4464 '') gccosandvers='' ;;
4465 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4466    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4467    gccshortvers=''
4468    case "$gccosandvers" in
4469    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4470    $osname$osvers) ;; # looking good
4471    $osname*) cat <<EOM >&4
4472
4473 *** WHOA THERE!!! ***
4474
4475     Your gcc has not been compiled for the exact release of
4476     your operating system ($gccosandvers versus $osname$osvers).
4477
4478     In general it is a good idea to keep gcc synchronized with
4479     the operating system because otherwise serious problems
4480     may ensue when trying to compile software, like Perl.
4481
4482     I'm trying to be optimistic here, though, and will continue.
4483     If later during the configuration and build icky compilation
4484     problems appear (headerfile conflicts being the most common
4485     manifestation), I suggest reinstalling the gcc to match
4486     your operating system release.
4487
4488 EOM
4489       ;;
4490    *) gccosandvers='' ;; # failed to parse, better be silent
4491    esac
4492    ;;
4493 esac
4494 case "$ccname" in
4495 '') ccname="$cc" ;;
4496 esac
4497
4498 # gcc 3.* complain about adding -Idirectories that they already know about,
4499 # so we will take those off from locincpth.
4500 case "$gccversion" in
4501 3*)
4502     echo "main(){}">try.c
4503     for incdir in $locincpth; do
4504        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4505              grep '^c[cp]p*[01]: warning: changing search order '`
4506        if test "X$warn" != X; then
4507            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4508        fi
4509     done
4510     $rm -f try try.*
4511 esac
4512
4513 : What should the include directory be ?
4514 echo " "
4515 $echo $n "Hmm...  $c"
4516 dflt='/usr/include'
4517 incpath=''
4518 mips_type=''
4519 if $test -f /bin/mips && /bin/mips; then
4520         echo "Looks like a MIPS system..."
4521         $cat >usr.c <<'EOCP'
4522 #ifdef SYSTYPE_BSD43
4523 /bsd43
4524 #endif
4525 EOCP
4526         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4527                 dflt='/bsd43/usr/include'
4528                 incpath='/bsd43'
4529                 mips_type='BSD 4.3'
4530         else
4531                 mips_type='System V'
4532         fi
4533         $rm -f usr.c usr.out
4534         echo "and you're compiling with the $mips_type compiler and libraries."
4535         xxx_prompt=y
4536         echo "exit 0" >mips
4537 else
4538         echo "Doesn't look like a MIPS system."
4539         xxx_prompt=n
4540         echo "exit 1" >mips
4541 fi
4542 chmod +x mips
4543 $eunicefix mips
4544 case "$usrinc" in
4545 '') ;;
4546 *) dflt="$usrinc";;
4547 esac
4548 case "$xxx_prompt" in
4549 y)      fn=d/
4550         echo " "
4551         rp='Where are the include files you want to use?'
4552         . ./getfile
4553         usrinc="$ans"
4554         ;;
4555 *)      usrinc="$dflt"
4556         ;;
4557 esac
4558
4559 : see how we invoke the C preprocessor
4560 echo " "
4561 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4562 cat <<'EOT' >testcpp.c
4563 #define ABC abc
4564 #define XYZ xyz
4565 ABC.XYZ
4566 EOT
4567 cd ..
4568 if test ! -f cppstdin; then
4569         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4570                 # AIX cc -E doesn't show the absolute headerfile
4571                 # locations but we'll cheat by using the -M flag.
4572                 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
4573         else
4574                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4575         fi
4576 else
4577         echo "Keeping your $hint cppstdin wrapper."
4578 fi
4579 chmod 755 cppstdin
4580 wrapper=`pwd`/cppstdin
4581 ok='false'
4582 cd UU
4583
4584 if $test "X$cppstdin" != "X" && \
4585         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4586         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4587 then
4588         echo "You used to use $cppstdin $cppminus so we'll use that again."
4589         case "$cpprun" in
4590         '') echo "But let's see if we can live without a wrapper..." ;;
4591         *)
4592                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4593                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4594                 then
4595                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4596                         ok='true'
4597                 else
4598                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4599                 fi
4600                 ;;
4601         esac
4602 else
4603         case "$cppstdin" in
4604         '') ;;
4605         *)
4606                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4607                 ;;
4608         esac
4609 fi
4610
4611 if $ok; then
4612         : nothing
4613 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4614         $cc -E <testcpp.c >testcpp.out 2>&1; \
4615         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4616         echo "Yup, it does."
4617         x_cpp="$cc -E"
4618         x_minus='';
4619 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4620         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4621         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4622         echo "Yup, it does."
4623         x_cpp="$cc -E"
4624         x_minus='-';
4625 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4626         $cc -P <testcpp.c >testcpp.out 2>&1; \
4627         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4628         echo "Yipee, that works!"
4629         x_cpp="$cc -P"
4630         x_minus='';
4631 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4632         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4633         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4634         echo "At long last!"
4635         x_cpp="$cc -P"
4636         x_minus='-';
4637 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4638         $cpp <testcpp.c >testcpp.out 2>&1; \
4639         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4640         echo "It works!"
4641         x_cpp="$cpp"
4642         x_minus='';
4643 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4644         $cpp - <testcpp.c >testcpp.out 2>&1; \
4645         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4646         echo "Hooray, it works!  I was beginning to wonder."
4647         x_cpp="$cpp"
4648         x_minus='-';
4649 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4650         $wrapper <testcpp.c >testcpp.out 2>&1; \
4651         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4652         x_cpp="$wrapper"
4653         x_minus=''
4654         echo "Eureka!"
4655 else
4656         dflt=''
4657         rp="No dice.  I can't find a C preprocessor.  Name one:"
4658         . ./myread
4659         x_cpp="$ans"
4660         x_minus=''
4661         $x_cpp <testcpp.c >testcpp.out 2>&1
4662         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4663                 echo "OK, that will do." >&4
4664         else
4665 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4666                 exit 1
4667         fi
4668 fi
4669
4670 case "$ok" in
4671 false)
4672         cppstdin="$x_cpp"
4673         cppminus="$x_minus"
4674         cpprun="$x_cpp"
4675         cpplast="$x_minus"
4676         set X $x_cpp
4677         shift
4678         case "$1" in
4679         "$cpp")
4680                 echo "Perhaps can we force $cc -E using a wrapper..."
4681                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4682                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4683                 then
4684                         echo "Yup, we can."
4685                         cppstdin="$wrapper"
4686                         cppminus='';
4687                 else
4688                         echo "Nope, we'll have to live without it..."
4689                 fi
4690                 ;;
4691         esac
4692         case "$cpprun" in
4693         "$wrapper")
4694                 cpprun=''
4695                 cpplast=''
4696                 ;;
4697         esac
4698         ;;
4699 esac
4700
4701 case "$cppstdin" in
4702 "$wrapper"|'cppstdin') ;;
4703 *) $rm -f $wrapper;;
4704 esac
4705 $rm -f testcpp.c testcpp.out
4706
4707 : Set private lib path
4708 case "$plibpth" in
4709 '') if ./mips; then
4710                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4711         fi;;
4712 esac
4713 case "$libpth" in
4714 ' ') dlist='';;
4715 '') dlist="$loclibpth $plibpth $glibpth";;
4716 *) dlist="$libpth";;
4717 esac
4718
4719 : Now check and see which directories actually exist, avoiding duplicates
4720 libpth=''
4721 for xxx in $dlist
4722 do
4723     if $test -d $xxx; then
4724                 case " $libpth " in
4725                 *" $xxx "*) ;;
4726                 *) libpth="$libpth $xxx";;
4727                 esac
4728     fi
4729 done
4730 $cat <<'EOM'
4731
4732 Some systems have incompatible or broken versions of libraries.  Among
4733 the directories listed in the question below, please remove any you
4734 know not to be holding relevant libraries, and add any that are needed.
4735 Say "none" for none.
4736
4737 EOM
4738 case "$libpth" in
4739 '') dflt='none';;
4740 *)
4741         set X $libpth
4742         shift
4743         dflt=${1+"$@"}
4744         ;;
4745 esac
4746 rp="Directories to use for library searches?"
4747 . ./myread
4748 case "$ans" in
4749 none) libpth=' ';;
4750 *) libpth="$ans";;
4751 esac
4752
4753 : compute shared library extension
4754 case "$so" in
4755 '')
4756         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4757                 dflt='sl'
4758         else
4759                 dflt='so'
4760         fi
4761         ;;
4762 *) dflt="$so";;
4763 esac
4764 $cat <<EOM
4765
4766 On some systems, shared libraries may be available.  Answer 'none' if
4767 you want to suppress searching of shared libraries for the remainder
4768 of this configuration.
4769
4770 EOM
4771 rp='What is the file extension used for shared libraries?'
4772 . ./myread
4773 so="$ans"
4774
4775 : Define several unixisms.
4776 : Hints files or command line option can be used to override them.
4777 : The convoluted testing is in case hints files set either the old
4778 : or the new name.
4779 case "$_exe" in
4780 '')     case "$exe_ext" in
4781         '')     ;;
4782         *)      _exe="$exe_ext" ;;
4783         esac
4784         ;;
4785 esac
4786 case "$_a" in
4787 '')     case "$lib_ext" in
4788     '') _a='.a';;
4789         *)      _a="$lib_ext" ;;
4790         esac
4791         ;;
4792 esac
4793 case "$_o" in
4794 '') case "$obj_ext" in
4795         '')     _o='.o';;
4796         *)      _o="$obj_ext";;
4797         esac
4798         ;;
4799 esac
4800 case "$p_" in
4801 '') case "$path_sep" in
4802         '')     p_=':';;
4803         *)      p_="$path_sep";;
4804         esac
4805         ;;
4806 esac
4807 exe_ext=$_exe
4808 lib_ext=$_a
4809 obj_ext=$_o
4810 path_sep=$p_
4811
4812 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4813
4814 : Which makefile gets called first.  This is used by make depend.
4815 case "$firstmakefile" in
4816 '') firstmakefile='makefile';;
4817 esac
4818
4819 : Check is we will use socks
4820 case "$usesocks" in
4821 $define|true|[yY]*)     dflt='y';;
4822 *) dflt='n';;
4823 esac
4824 cat <<EOM
4825
4826 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4827 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4828 to use the PerlIO abstraction layer, this will be implicitly selected.
4829
4830 If this doesn't make any sense to you, just accept the default '$dflt'.
4831 EOM
4832 rp='Build Perl for SOCKS?'
4833 . ./myread
4834 case "$ans" in
4835 y|Y)    val="$define" ;;
4836 *)      val="$undef" ;;
4837 esac
4838 set usesocks
4839 eval $setvar
4840
4841 : Check for uselongdouble support
4842 case "$ccflags" in
4843 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4844 esac
4845
4846 case "$uselongdouble" in
4847 $define|true|[yY]*)     dflt='y';;
4848 *) dflt='n';;
4849 esac
4850 cat <<EOM
4851
4852 Perl can be built to take advantage of long doubles which
4853 (if available) may give more accuracy and range for floating point numbers.
4854
4855 If this doesn't make any sense to you, just accept the default '$dflt'.
4856 EOM
4857 rp='Try to use long doubles if available?'
4858 . ./myread
4859 case "$ans" in
4860 y|Y)    val="$define"   ;;
4861 *)      val="$undef"    ;;
4862 esac
4863 set uselongdouble
4864 eval $setvar
4865
4866 case "$uselongdouble" in
4867 true|[yY]*) uselongdouble="$define" ;;
4868 esac
4869
4870 : Look for a hint-file generated 'call-back-unit'.  If the
4871 : user has specified that long doubles should be used,
4872 : we may need to set or change some other defaults.
4873 if $test -f uselongdouble.cbu; then
4874     echo "Your platform has some specific hints regarding long doubles, using them..."
4875     . ./uselongdouble.cbu
4876 else
4877     case "$uselongdouble" in
4878         $define)
4879                 $cat <<EOM
4880 (Your platform does not have any specific hints for long doubles.)
4881 EOM
4882         ;;
4883     esac
4884 fi
4885
4886 : Looking for optional libraries
4887 echo " "
4888 echo "Checking for optional libraries..." >&4
4889 case "$libs" in
4890 ' '|'') dflt='';;
4891 *) dflt="$libs";;
4892 esac
4893 case "$libswanted" in
4894 '') libswanted='c_s';;
4895 esac
4896 case "$usesocks" in
4897 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4898 esac
4899 libsfound=''
4900 libsfiles=''
4901 libsdirs=''
4902 libspath=''
4903 for thisdir in $libpth $xlibpth; do
4904   test -d $thisdir && libspath="$libspath $thisdir"
4905 done
4906 for thislib in $libswanted; do
4907         for thisdir in $libspath; do
4908             xxx=''
4909             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4910                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4911                 $test -f "$xxx" && eval $libscheck
4912                 $test -f "$xxx" && libstyle=shared
4913             fi
4914             if test ! -f "$xxx"; then
4915                 xxx=$thisdir/lib$thislib.$so
4916                 $test -f "$xxx" && eval $libscheck
4917                 $test -f "$xxx" && libstyle=shared
4918             fi
4919             if test ! -f "$xxx"; then
4920                 xxx=$thisdir/lib$thislib$_a
4921                 $test -f "$xxx" && eval $libscheck
4922                 $test -f "$xxx" && libstyle=static
4923             fi
4924             if test ! -f "$xxx"; then
4925                 xxx=$thisdir/$thislib$_a
4926                 $test -f "$xxx" && eval $libscheck
4927                 $test -f "$xxx" && libstyle=static
4928             fi
4929             if test ! -f "$xxx"; then
4930                 xxx=$thisdir/lib${thislib}_s$_a
4931                 $test -f "$xxx" && eval $libscheck
4932                 $test -f "$xxx" && libstyle=static
4933                 $test -f "$xxx" && thislib=${thislib}_s
4934             fi
4935             if test ! -f "$xxx"; then
4936                 xxx=$thisdir/Slib$thislib$_a
4937                 $test -f "$xxx" && eval $libscheck
4938                 $test -f "$xxx" && libstyle=static
4939             fi
4940             if $test -f "$xxx"; then
4941                 case "$libstyle" in
4942                 shared) echo "Found -l$thislib (shared)." ;;
4943                 static) echo "Found -l$thislib." ;;
4944                 *)      echo "Found -l$thislib ($libstyle)." ;;
4945                 esac
4946                 case " $dflt " in
4947                 *"-l$thislib "*);;
4948                 *) dflt="$dflt -l$thislib"
4949                    libsfound="$libsfound $xxx"
4950                    yyy=`basename $xxx`
4951                    libsfiles="$libsfiles $yyy"
4952                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4953                    case " $libsdirs " in
4954                    *" $yyy "*) ;;
4955                    *) libsdirs="$libsdirs $yyy" ;;
4956                    esac
4957                    ;;
4958                 esac
4959                 break
4960             fi
4961         done
4962         if $test ! -f "$xxx"; then
4963             echo "No -l$thislib."
4964         fi
4965 done
4966 set X $dflt
4967 shift
4968 dflt="$*"
4969 case "$libs" in
4970 '') dflt="$dflt";;
4971 *) dflt="$libs";;
4972 esac
4973 case "$dflt" in
4974 ' '|'') dflt='none';;
4975 esac
4976
4977 $cat <<EOM
4978
4979 In order to compile $package on your machine, a number of libraries
4980 are usually needed.  Include any other special libraries here as well.
4981 Say "none" for none.  The default list is almost always right.
4982 EOM
4983
4984 echo " "
4985 rp="What libraries to use?"
4986 . ./myread
4987 case "$ans" in
4988 none) libs=' ';;
4989 *) libs="$ans";;
4990 esac
4991
4992 : determine optimization, if desired, or use for debug flag also
4993 case "$optimize" in
4994 ' '|$undef) dflt='none';;
4995 '') dflt='-O';;
4996 *) dflt="$optimize";;
4997 esac
4998 $cat <<EOH
4999
5000 By default, $package compiles with the -O flag to use the optimizer.
5001 Alternately, you might want to use the symbolic debugger, which uses
5002 the -g flag (on traditional Unix systems).  Either flag can be
5003 specified here.  To use neither flag, specify the word "none".
5004
5005 EOH
5006 rp="What optimizer/debugger flag should be used?"
5007 . ./myread
5008 optimize="$ans"
5009 case "$optimize" in
5010 'none') optimize=" ";;
5011 esac
5012
5013 : Check what DEBUGGING is required from the command line
5014 : -DEBUGGING      or -DDEBUGGING or
5015 : -DEBUGGING=both                       = -g + -DDEBUGGING
5016 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5017 : -DEBUGGING=none or -UDEBUGGING        =
5018 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5019 case "$EBUGGING" in
5020 '')     ;;
5021 *)      DEBUGGING=$EBUGGING ;;
5022 esac
5023
5024 case "$DEBUGGING" in
5025 -g|both|$define)
5026     case "$optimize" in
5027         *-g*) ;;
5028         *)    optimize="$optimize -g" ;;
5029     esac ;;
5030 none|$undef)
5031     case "$optimize" in
5032         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5033                 shift
5034                 optimize="$*"
5035                 ;;
5036     esac ;;
5037 esac
5038
5039 dflt=''
5040 case "$DEBUGGING" in
5041 both|$define) dflt='-DDEBUGGING'
5042 esac
5043
5044 : argument order is deliberate, as the flag will start with - which set could
5045 : think is an option
5046 checkccflag='check=$1; flag=$2; callback=$3;
5047 echo " ";
5048 echo "Checking if your compiler accepts $flag" 2>&1;
5049 echo "int main(void) { return 0; }" > gcctest.c;
5050 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5051     echo "Yes, it does." 2>&1;
5052     if $test -s gcctest.out ; then
5053         echo "But your platform does not like it:";
5054         cat gcctest.out;
5055     else
5056         case "$ccflags" in
5057         *$check*)
5058             echo "Leaving current flags $ccflags alone." 2>&1
5059             ;;
5060         *) dflt="$dflt $flag";
5061             eval $callback
5062             ;;
5063         esac
5064     fi
5065 else
5066     echo "Nope, it does not, but that is ok." 2>&1;
5067 fi
5068 '
5069
5070 : We will not override a previous value, but we might want to
5071 : augment a hint file
5072 case "$hint" in
5073 default|recommended)
5074         case "$gccversion" in
5075         1*) dflt="$dflt -fpcc-struct-return" ;;
5076         esac
5077         case "$optimize:$DEBUGGING" in
5078         *-g*:old) dflt="$dflt -DDEBUGGING";;
5079         esac
5080         case "$gccversion" in
5081         2*) if $test -d /etc/conf/kconfig.d &&
5082                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5083                 then
5084                         # Interactive Systems (ISC) POSIX mode.
5085                         dflt="$dflt -posix"
5086                 fi
5087                 ;;
5088         esac
5089         case "$gccversion" in
5090         1*) ;;
5091         2.[0-8]*) ;;
5092         ?*)     set strict-aliasing -fno-strict-aliasing
5093                 eval $checkccflag
5094                 ;;
5095         esac
5096         # For gcc, adding -pipe speeds up compilations for some, but apparently
5097         # some assemblers can't read from stdin.  (It also slows down compilations
5098         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5099         case "$gccversion" in
5100         ?*)     set pipe -pipe
5101                 eval $checkccflag
5102                 ;;
5103         esac
5104
5105         # on x86_64 (at least) we require an extra library (libssp) in the
5106         # link command line. This library is not named, so I infer that it is
5107         # an implementation detail that may change. Hence the safest approach
5108         # is to add the flag to the flags passed to the compiler at link time,
5109         # as that way the compiler can do the right implementation dependant
5110         # thing. (NWC)
5111         case "$gccversion" in
5112         ?*)     set stack-protector -fstack-protector
5113                 eval $checkccflag
5114                 ;;
5115         esac
5116         ;;
5117 esac
5118
5119 case "$mips_type" in
5120 *BSD*|'') inclwanted="$locincpth $usrinc";;
5121 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5122 esac
5123 for thisincl in $inclwanted; do
5124         if $test -d $thisincl; then
5125                 if $test x$thisincl != x$usrinc; then
5126                         case "$dflt" in
5127                         *" -I$thisincl "*);;
5128                         *) dflt="$dflt -I$thisincl ";;
5129                         esac
5130                 fi
5131         fi
5132 done
5133
5134 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5135         xxx=true;
5136 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5137         xxx=true;
5138 else
5139         xxx=false;
5140 fi;
5141 if $xxx; then
5142         case "$dflt" in
5143         *$2*);;
5144         *) dflt="$dflt -D$2";;
5145         esac;
5146 fi'
5147
5148 set signal.h LANGUAGE_C; eval $inctest
5149
5150 case "$usesocks" in
5151 $define)
5152         ccflags="$ccflags -DSOCKS"
5153         ;;
5154 esac
5155
5156 case "$hint" in
5157 default|recommended) dflt="$ccflags $dflt" ;;
5158 *) dflt="$ccflags";;
5159 esac
5160
5161 case "$dflt" in
5162 ''|' ') dflt=none;;
5163 esac
5164
5165 $cat <<EOH
5166
5167 Your C compiler may want other flags.  For this question you should include
5168 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5169 but you should NOT include libraries or ld flags like -lwhatever.  If you
5170 want $package to honor its debug switch, you should include -DDEBUGGING here.
5171 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5172
5173 To use no flags, specify the word "none".
5174
5175 EOH
5176 set X $dflt
5177 shift
5178 dflt=${1+"$@"}
5179 rp="Any additional cc flags?"
5180 . ./myread
5181 case "$ans" in
5182 none) ccflags='';;
5183 *) ccflags="$ans";;
5184 esac
5185
5186 : the following weeds options from ccflags that are of no interest to cpp
5187 case "$cppflags" in
5188 '') cppflags="$ccflags" ;;
5189 *)  cppflags="$cppflags $ccflags" ;;
5190 esac
5191 case "$gccversion" in
5192 1*) cppflags="$cppflags -D__GNUC__"
5193 esac
5194 case "$mips_type" in
5195 '');;
5196 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5197 esac
5198 case "$cppflags" in
5199 '');;
5200 *)
5201         echo " "
5202         echo "Let me guess what the preprocessor flags are..." >&4
5203         set X $cppflags
5204         shift
5205         cppflags=''
5206         $cat >cpp.c <<'EOM'
5207 #define BLURFL foo
5208
5209 BLURFL xx LFRULB
5210 EOM
5211         previous=''
5212         for flag in $*
5213         do
5214                 case "$flag" in
5215                 -*) ftry="$flag";;
5216                 *) ftry="$previous $flag";;
5217                 esac
5218                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5219                         >cpp1.out 2>/dev/null && \
5220                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5221                         >cpp2.out 2>/dev/null && \
5222                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5223                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5224                 then
5225                         cppflags="$cppflags $ftry"
5226                         previous=''
5227                 else
5228                         previous="$flag"
5229                 fi
5230         done
5231         set X $cppflags
5232         shift
5233         cppflags=${1+"$@"}
5234         case "$cppflags" in
5235         *-*)  echo "They appear to be: $cppflags";;
5236         esac
5237         $rm -f cpp.c cpp?.out
5238         ;;
5239 esac
5240
5241 : flags used in final linking phase
5242 case "$ldflags" in
5243 '') if ./venix; then
5244                 dflt='-i -z'
5245         else
5246                 dflt=''
5247         fi
5248         case "$ccflags" in
5249         *-posix*) dflt="$dflt -posix" ;;
5250         esac
5251         ;;
5252 *) dflt="$ldflags";;
5253 esac
5254 # See note above about -fstack-protector
5255 case "$ccflags" in
5256 *-fstack-protector*)
5257         case "$dflt" in
5258         *-fstack-protector*) ;; # Don't add it again
5259         *) dflt="$dflt -fstack-protector" ;;
5260         esac
5261         ;;
5262 esac
5263
5264 : Try to guess additional flags to pick up local libraries.
5265 for thislibdir in $libpth; do
5266         case " $loclibpth " in
5267         *" $thislibdir "*)
5268                 case "$dflt " in
5269                 *"-L$thislibdir "*) ;;
5270                 *)  dflt="$dflt -L$thislibdir" ;;
5271                 esac
5272                 ;;
5273         esac
5274 done
5275
5276 case "$dflt" in
5277 '') dflt='none' ;;
5278 esac
5279
5280 $cat <<EOH
5281
5282 Your C linker may need flags.  For this question you should
5283 include -L/whatever and any other flags used by the C linker, but you
5284 should NOT include libraries like -lwhatever.
5285
5286 Make sure you include the appropriate -L/path flags if your C linker
5287 does not normally search all of the directories you specified above,
5288 namely
5289         $libpth
5290 To use no flags, specify the word "none".
5291
5292 EOH
5293
5294 rp="Any additional ld flags (NOT including libraries)?"
5295 . ./myread
5296 case "$ans" in
5297 none) ldflags='';;
5298 *) ldflags="$ans";;
5299 esac
5300 rmlist="$rmlist pdp11"
5301
5302 : coherency check
5303 echo " "
5304 echo "Checking your choice of C compiler and flags for coherency..." >&4
5305 $cat > try.c <<'EOF'
5306 #include <stdio.h>
5307 int main() { printf("Ok\n"); return(0); }
5308 EOF
5309 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5310 shift
5311 $cat >try.msg <<'EOM'
5312 I've tried to compile and run the following simple program:
5313
5314 EOM
5315 $cat try.c >> try.msg
5316
5317 $cat >> try.msg <<EOM
5318
5319 I used the command:
5320
5321         $*
5322         $run ./try
5323
5324 and I got the following output:
5325
5326 EOM
5327 dflt=y
5328 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5329         if $sh -c "$run ./try " >>try.msg 2>&1; then
5330                 xxx=`$run ./try`
5331                 case "$xxx" in
5332                 "Ok") dflt=n ;;
5333                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5334                         case " $libs " in
5335                         *" -lsfio "*)
5336                                 cat >> try.msg <<'EOQS'
5337 If $libs contains -lsfio, and sfio is mis-configured, then it
5338 sometimes (apparently) runs and exits with a 0 status, but with no
5339 output!  It may have to do with sfio's use of _exit vs. exit.
5340
5341 EOQS
5342                                 rp="You have a big problem.  Shall I abort Configure"
5343                                 dflt=y
5344                                 ;;
5345                         esac
5346                         ;;
5347                 esac
5348         else
5349                 echo "The program compiled OK, but exited with status $?." >>try.msg
5350                 rp="You have a problem.  Shall I abort Configure"
5351                 dflt=y
5352         fi
5353 else
5354         echo "I can't compile the test program." >>try.msg
5355         rp="You have a BIG problem.  Shall I abort Configure"
5356         dflt=y
5357 fi
5358 case "$dflt" in
5359 y)
5360         $cat try.msg >&4
5361         case "$knowitall" in
5362         '')
5363                 echo "(The supplied flags or libraries might be incorrect.)"
5364                 ;;
5365         *) dflt=n;;
5366         esac
5367         echo " "
5368         . ./myread
5369         case "$ans" in
5370         n*|N*) ;;
5371         *)      echo "Ok.  Stopping Configure." >&4
5372                 exit 1
5373                 ;;
5374         esac
5375         ;;
5376 n) echo "OK, that should do.";;
5377 esac
5378 $rm_try gcctest gcctest.out
5379
5380 : define a shorthand compile call
5381 compile='
5382 mc_file=$1;
5383 shift;
5384 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5385 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5386 exit 1;
5387 fi;
5388 esac;
5389 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5390 : define a shorthand compile call for compilations that should be ok.
5391 compile_ok='
5392 mc_file=$1;
5393 shift;
5394 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5395
5396 : determine filename position in cpp output
5397 echo " "
5398 echo "Computing filename position in cpp output for #include directives..." >&4
5399 case "$osname" in
5400 vos) testaccess=-e ;;
5401 *)   testaccess=-r ;;
5402 esac
5403 echo '#include <stdio.h>' > foo.c
5404 $cat >fieldn <<EOF
5405 $startsh
5406 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5407 $grep '^[       ]*#.*stdio\.h' | \
5408 while read cline; do
5409         pos=1
5410         set \$cline
5411         while $test \$# -gt 0; do
5412                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5413                         echo "\$pos"
5414                         exit 0
5415                 fi
5416                 shift
5417                 pos=\`expr \$pos + 1\`
5418         done
5419 done
5420 EOF
5421 chmod +x fieldn
5422 fieldn=`./fieldn`
5423 $rm -f foo.c fieldn
5424 case $fieldn in
5425 '') pos='???';;
5426 1) pos=first;;
5427 2) pos=second;;
5428 3) pos=third;;
5429 *) pos="${fieldn}th";;
5430 esac
5431 echo "Your cpp writes the filename in the $pos field of the line."
5432
5433 case "$osname" in
5434 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5435 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5436 *)   cppfilter='' ;;
5437 esac
5438 : locate header file
5439 $cat >findhdr <<EOF
5440 $startsh
5441 wanted=\$1
5442 name=''
5443 for usrincdir in $usrinc
5444 do
5445         if test -f \$usrincdir/\$wanted; then
5446                 echo "\$usrincdir/\$wanted"
5447                 exit 0
5448         fi
5449 done
5450 awkprg='{ print \$$fieldn }'
5451 echo "#include <\$wanted>" > foo\$\$.c
5452 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5453 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5454 while read cline; do
5455         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5456         case "\$name" in
5457         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5458         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5459         *) exit 2;;
5460         esac;
5461 done;
5462 #
5463 # status = 0: grep returned 0 lines, case statement not executed
5464 # status = 1: headerfile found
5465 # status = 2: while loop executed, no headerfile found
5466 #
5467 status=\$?
5468 $rm -f foo\$\$.c;
5469 if test \$status -eq 1; then
5470         exit 0;
5471 fi
5472 exit 1
5473 EOF
5474 chmod +x findhdr
5475
5476 : define an alternate in-header-list? function
5477 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5478 cont=true; xxf="echo \"<\$1> found.\" >&4";
5479 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5480 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5481 esac;
5482 case $# in 4) instead=instead;; *) instead="at last";; esac;
5483 while $test "$cont"; do
5484         xxx=`./findhdr $1`
5485         var=$2; eval "was=\$$2";
5486         if $test "$xxx" && $test -r "$xxx";
5487         then eval $xxf;
5488         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5489                 cont="";
5490         else eval $xxnf;
5491         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5492         set $yyy; shift; shift; yyy=$@;
5493         case $# in 0) cont="";;
5494         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5495                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5496         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5497                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5498         esac;
5499 done;
5500 while $test "$yyy";
5501 do set $yyy; var=$2; eval "was=\$$2";
5502         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5503         set $yyy; shift; shift; yyy=$@;
5504 done'
5505
5506 : see if stdlib is available
5507 set stdlib.h i_stdlib
5508 eval $inhdr
5509
5510 : check for lengths of integral types
5511 echo " "
5512 case "$intsize" in
5513 '')
5514         echo "Checking to see how big your integers are..." >&4
5515         $cat >try.c <<EOCP
5516 #include <stdio.h>
5517 #$i_stdlib I_STDLIB
5518 #ifdef I_STDLIB
5519 #include <stdlib.h>
5520 #endif
5521 int main()
5522 {
5523         printf("intsize=%d;\n", (int)sizeof(int));
5524         printf("longsize=%d;\n", (int)sizeof(long));
5525         printf("shortsize=%d;\n", (int)sizeof(short));
5526         exit(0);
5527 }
5528 EOCP
5529         set try
5530         if eval $compile_ok && $run ./try > /dev/null; then
5531                 eval `$run ./try`
5532                 echo "Your integers are $intsize bytes long."
5533                 echo "Your long integers are $longsize bytes long."
5534                 echo "Your short integers are $shortsize bytes long."
5535         else
5536                 $cat >&4 <<EOM
5537 !
5538 Help! I can't compile and run the intsize test program: please enlighten me!
5539 (This is probably a misconfiguration in your system or libraries, and
5540 you really ought to fix it.  Still, I'll try anyway.)
5541 !
5542 EOM
5543                 dflt=4
5544                 rp="What is the size of an integer (in bytes)?"
5545                 . ./myread
5546                 intsize="$ans"
5547                 dflt=$intsize
5548                 rp="What is the size of a long integer (in bytes)?"
5549                 . ./myread
5550                 longsize="$ans"
5551                 dflt=2
5552                 rp="What is the size of a short integer (in bytes)?"
5553                 . ./myread
5554                 shortsize="$ans"
5555         fi
5556         ;;
5557 esac
5558 $rm_try
5559
5560 : check for long long
5561 echo " "
5562 echo "Checking to see if you have long long..." >&4
5563 echo 'int main() { long long x = 7; return 0; }' > try.c
5564 set try
5565 if eval $compile; then
5566         val="$define"
5567         echo "You have long long."
5568 else
5569         val="$undef"
5570         echo "You do not have long long."
5571 fi
5572 $rm_try
5573 set d_longlong
5574 eval $setvar
5575
5576 : check for length of long long
5577 case "${d_longlong}${longlongsize}" in
5578 $define)
5579         echo " "
5580         echo "Checking to see how big your long longs are..." >&4
5581         $cat >try.c <<'EOCP'
5582 #include <stdio.h>
5583 int main()
5584 {
5585     printf("%d\n", (int)sizeof(long long));
5586     return(0);
5587 }
5588 EOCP
5589         set try
5590         if eval $compile_ok; then
5591                 longlongsize=`$run ./try`
5592                 echo "Your long longs are $longlongsize bytes long."
5593         else
5594                 dflt='8'
5595                 echo " "
5596                 echo "(I can't seem to compile the test program.  Guessing...)"
5597                 rp="What is the size of a long long (in bytes)?"
5598                 . ./myread
5599                 longlongsize="$ans"
5600         fi
5601         if $test "X$longsize" = "X$longlongsize"; then
5602                 echo "(That isn't any different from an ordinary long.)"
5603         fi
5604         ;;
5605 esac
5606 $rm_try
5607
5608 : see if inttypes.h is available
5609 : we want a real compile instead of Inhdr because some systems
5610 : have an inttypes.h which includes non-existent headers
5611 echo " "
5612 $cat >try.c <<EOCP
5613 #include <inttypes.h>
5614 int main() {
5615         static int32_t foo32 = 0x12345678;
5616 }
5617 EOCP
5618 set try
5619 if eval $compile; then
5620         echo "<inttypes.h> found." >&4
5621         val="$define"
5622 else
5623         echo "<inttypes.h> NOT found." >&4
5624         val="$undef"
5625 fi
5626 $rm_try
5627 set i_inttypes
5628 eval $setvar
5629
5630 : check for int64_t
5631 echo " "
5632 echo "Checking to see if you have int64_t..." >&4
5633 $cat >try.c <<EOCP
5634 #include <sys/types.h>
5635 #$i_inttypes I_INTTYPES
5636 #ifdef I_INTTYPES
5637 #include <inttypes.h>
5638 #endif
5639 int main() { int64_t x = 7; }
5640 EOCP
5641 set try
5642 if eval $compile; then
5643         val="$define"
5644         echo "You have int64_t."
5645 else
5646         val="$undef"
5647         echo "You do not have int64_t."
5648 fi
5649 $rm_try
5650 set d_int64_t
5651 eval $setvar
5652
5653 : Check if 64bit ints have a quad type
5654 echo " "
5655 echo "Checking which 64-bit integer type we could use..." >&4
5656
5657 case "$intsize" in
5658 8) val=int
5659    set quadtype
5660    eval $setvar
5661    val='"unsigned int"'
5662    set uquadtype
5663    eval $setvar
5664    quadkind=1
5665    ;;
5666 *) case "$longsize" in
5667    8) val=long
5668       set quadtype
5669       eval $setvar
5670       val='"unsigned long"'
5671       set uquadtype
5672       eval $setvar
5673       quadkind=2
5674       ;;
5675    *) case "$d_longlong:$longlongsize" in
5676       define:8)
5677         val='"long long"'
5678         set quadtype
5679         eval $setvar
5680         val='"unsigned long long"'
5681         set uquadtype
5682         eval $setvar
5683         quadkind=3
5684         ;;
5685       *) case "$d_int64_t" in
5686          define)
5687            val=int64_t
5688            set quadtype
5689            eval $setvar
5690            val=uint64_t
5691            set uquadtype
5692            eval $setvar
5693            quadkind=4
5694            ;;
5695          esac
5696          ;;
5697       esac
5698       ;;
5699    esac
5700    ;;
5701 esac
5702
5703 case "$quadtype" in
5704 '')     echo "Alas, no 64-bit integer types in sight." >&4
5705         d_quad="$undef"
5706         ;;
5707 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5708         d_quad="$define"
5709         ;;
5710 esac
5711
5712 : Do we want 64bit support
5713 case "$uselonglong" in
5714 "$define"|true|[yY]*)
5715         cat <<EOM >&4
5716
5717 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5718 EOM
5719         use64bitint="$define"
5720         ;;
5721 esac
5722 case "$use64bits" in
5723 "$define"|true|[yY]*)
5724         cat <<EOM >&4
5725
5726 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5727 EOM
5728         use64bitint="$define"
5729         ;;
5730 esac
5731 case "$use64bitints" in
5732 "$define"|true|[yY]*)
5733         cat <<EOM >&4
5734
5735 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5736 EOM
5737         use64bitint="$define"
5738         ;;
5739 esac
5740 case "$use64bitsint" in
5741 "$define"|true|[yY]*)
5742         cat <<EOM >&4
5743
5744 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5745 EOM
5746         use64bitint="$define"
5747         ;;
5748 esac
5749 case "$uselonglongs" in
5750 "$define"|true|[yY]*)
5751         cat <<EOM >&4
5752
5753 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5754 EOM
5755         use64bitint="$define"
5756         ;;
5757 esac
5758 case "$use64bitsall" in
5759 "$define"|true|[yY]*)
5760         cat <<EOM >&4
5761
5762 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5763 EOM
5764         use64bitall="$define"
5765         ;;
5766 esac
5767
5768 case "$ccflags" in
5769 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5770 esac
5771 case "$use64bitall" in
5772 "$define"|true|[yY]*) use64bitint="$define" ;;
5773 esac
5774
5775 case "$longsize" in
5776 8) cat <<EOM
5777
5778 You have natively 64-bit long integers.
5779 EOM
5780    val="$define"
5781    ;;
5782 *) case "$use64bitint" in
5783    "$define"|true|[yY]*) dflt='y';;
5784    *) dflt='n';;
5785    esac
5786    case "$d_quad" in
5787    "$define") ;;
5788    *) dflt='n' ;;
5789    esac
5790    cat <<EOM
5791
5792 Perl can be built to take advantage of 64-bit integer types
5793 on some systems.  To do so, Configure can be run with -Duse64bitint.
5794 Choosing this option will most probably introduce binary incompatibilities.
5795
5796 If this doesn't make any sense to you, just accept the default '$dflt'.
5797 (The default has been chosen based on your configuration.)
5798 EOM
5799    rp='Try to use 64-bit integers, if available?'
5800    . ./myread
5801    case "$ans" in
5802    [yY]*) val="$define" ;;
5803    *)     val="$undef"  ;;
5804    esac
5805    ;;
5806 esac
5807 set use64bitint
5808 eval $setvar
5809
5810 case "$use64bitall" in
5811 "$define"|true|[yY]*) dflt='y' ;;
5812 *) case "$longsize" in
5813    8) dflt='y' ;;
5814    *) dflt='n' ;;
5815    esac
5816    ;;
5817 esac
5818 cat <<EOM
5819
5820 You may also choose to try maximal 64-bitness.  It means using as much
5821 64-bitness as possible on the platform.  This in turn means even more
5822 binary incompatibilities.  On the other hand, your platform may not
5823 have any more 64-bitness available than what you already have chosen.
5824
5825 If this doesn't make any sense to you, just accept the default '$dflt'.
5826 (The default has been chosen based on your configuration.)
5827 EOM
5828 rp='Try to use maximal 64-bit support, if available?'
5829 . ./myread
5830 case "$ans" in
5831 [yY]*) val="$define" ;;
5832 *)     val="$undef"  ;;
5833 esac
5834 set use64bitall
5835 eval $setvar
5836 case "$use64bitall" in
5837 "$define")
5838         case "$use64bitint" in
5839         "$undef")
5840                 cat <<EOM
5841
5842 Since you have chosen a maximally 64-bit build, I'm also turning on
5843 the use of 64-bit integers.
5844 EOM
5845                 use64bitint="$define" ;;
5846         esac
5847         ;;
5848 esac
5849
5850 : Look for a hint-file generated 'call-back-unit'.  If the
5851 : user has specified that a 64-bit perl is to be built,
5852 : we may need to set or change some other defaults.
5853 if $test -f use64bitint.cbu; then
5854         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5855         . ./use64bitint.cbu
5856 fi
5857 case "$use64bitint" in
5858 "$define"|true|[yY]*)
5859         case "$longsize" in
5860         4) case "$archname64" in
5861            '') archname64=64int ;;
5862            esac
5863            ;;
5864         esac
5865         ;;
5866 esac
5867
5868 : Look for a hint-file generated 'call-back-unit'.  If the
5869 : user has specified that a maximally 64-bit perl is to be built,
5870 : we may need to set or change some other defaults.
5871 if $test -f use64bitall.cbu; then
5872         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5873         . ./use64bitall.cbu
5874 fi
5875 case "$use64bitall" in
5876 "$define"|true|[yY]*)
5877         case "$longsize" in
5878         4) case "$archname64" in
5879            ''|64int) archname64=64all ;;
5880            esac
5881            ;;
5882         esac
5883         ;;
5884 esac
5885
5886 case "$d_quad:$use64bitint" in
5887 $undef:$define)
5888         cat >&4 <<EOF
5889
5890 *** You have chosen to use 64-bit integers,
5891 *** but none can be found.
5892 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5893 *** Cannot continue, aborting.
5894
5895 EOF
5896         exit 1
5897         ;;
5898 esac
5899
5900 : check for length of double
5901 echo " "
5902 case "$doublesize" in
5903 '')
5904         echo "Checking to see how big your double precision numbers are..." >&4
5905         $cat >try.c <<EOCP
5906 #include <stdio.h>
5907 #$i_stdlib I_STDLIB
5908 #ifdef I_STDLIB
5909 #include <stdlib.h>
5910 #endif
5911 int main()
5912 {
5913     printf("%d\n", (int)sizeof(double));
5914     exit(0);
5915 }
5916 EOCP
5917         set try
5918         if eval $compile_ok; then
5919                 doublesize=`$run ./try`
5920                 echo "Your double is $doublesize bytes long."
5921         else
5922                 dflt='8'
5923                 echo "(I can't seem to compile the test program.  Guessing...)"
5924                 rp="What is the size of a double precision number (in bytes)?"
5925                 . ./myread
5926                 doublesize="$ans"
5927         fi
5928         ;;
5929 esac
5930 $rm_try
5931
5932 : check for long doubles
5933 echo " "
5934 echo "Checking to see if you have long double..." >&4
5935 echo 'int main() { long double x = 7.0; }' > try.c
5936 set try
5937 if eval $compile; then
5938         val="$define"
5939         echo "You have long double."
5940 else
5941         val="$undef"
5942         echo "You do not have long double."
5943 fi
5944 $rm_try
5945 set d_longdbl
5946 eval $setvar
5947
5948 : check for length of long double
5949 case "${d_longdbl}${longdblsize}" in
5950 $define)
5951         echo " "
5952         echo "Checking to see how big your long doubles are..." >&4
5953         $cat >try.c <<'EOCP'
5954 #include <stdio.h>
5955 int main()
5956 {
5957         printf("%d\n", sizeof(long double));
5958 }
5959 EOCP
5960         set try
5961         set try
5962         if eval $compile; then
5963                 longdblsize=`$run ./try`
5964                 echo "Your long doubles are $longdblsize bytes long."
5965         else
5966                 dflt='8'
5967                 echo " "
5968                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5969                 rp="What is the size of a long double (in bytes)?"
5970                 . ./myread
5971                 longdblsize="$ans"
5972         fi
5973         if $test "X$doublesize" = "X$longdblsize"; then
5974                 echo "That isn't any different from an ordinary double."
5975                 echo "I'll keep your setting anyway, but you may see some"
5976                 echo "harmless compilation warnings."
5977         fi
5978         ;;
5979 esac
5980 $rm_try
5981
5982 : determine the architecture name
5983 echo " "
5984 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5985         tarch=`arch`"-$osname"
5986 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5987         if uname -m > tmparch 2>&1 ; then
5988                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5989                         -e 's/$/'"-$osname/" tmparch`
5990         else
5991                 tarch="$osname"
5992         fi
5993         $rm -f tmparch
5994 else
5995         tarch="$osname"
5996 fi
5997 case "$myarchname" in
5998 ''|"$tarch") ;;
5999 *)
6000         echo "(Your architecture name used to be $myarchname.)"
6001         archname=''
6002         ;;
6003 esac
6004 case "$targetarch" in
6005 '') ;;
6006 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6007 esac
6008 myarchname="$tarch"
6009 case "$archname" in
6010 '') dflt="$tarch";;
6011 *) dflt="$archname";;
6012 esac
6013 rp='What is your architecture name'
6014 . ./myread
6015 archname="$ans"
6016
6017 : optionally add API version to the architecture for versioned archlibs
6018 case "$useversionedarchname" in
6019 $define|true|[yY]*) dflt='y';;
6020 *)                  dflt='n';;
6021 esac
6022 rp='Add the Perl API version to your archname?'
6023 . ./myread
6024 case "$ans" in
6025 y|Y)    useversionedarchname="$define" ;;
6026 *)      useversionedarchname="$undef" ;;
6027 esac
6028 case "$useversionedarchname" in
6029 $define)
6030         case "$archname" in
6031         *-$api_versionstring)
6032                 echo "...and architecture name already has -$api_versionstring" >&4
6033                 ;;
6034         *)
6035                 archname="$archname-$api_versionstring"
6036                 echo "...setting architecture name to $archname." >&4
6037                 ;;
6038         esac
6039         ;;
6040 esac
6041
6042 case "$usethreads" in
6043 $define)
6044         echo "Threads selected." >&4
6045         case "$archname" in
6046         *-thread*) echo "...and architecture name already has -thread." >&4
6047                 ;;
6048         *)      archname="$archname-thread"
6049                 echo "...setting architecture name to $archname." >&4
6050                 ;;
6051         esac
6052         ;;
6053 esac
6054 case "$usemultiplicity" in
6055 $define)
6056         echo "Multiplicity selected." >&4
6057         case "$archname" in
6058         *-multi*) echo "...and architecture name already has -multi." >&4
6059                 ;;
6060         *)      archname="$archname-multi"
6061                 echo "...setting architecture name to $archname." >&4
6062                 ;;
6063         esac
6064         ;;
6065 esac
6066 case "$use64bitint$use64bitall" in
6067 *"$define"*)
6068         case "$archname64" in
6069         '')
6070                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6071                 ;;
6072         *)
6073                 case "$use64bitint" in
6074                 "$define") echo "64 bit integers selected." >&4 ;;
6075                 esac
6076                 case "$use64bitall" in
6077                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6078                 esac
6079                 case "$archname" in
6080                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6081                         ;;
6082                 *)      archname="$archname-$archname64"
6083                         echo "...setting architecture name to $archname." >&4
6084                         ;;
6085                 esac
6086                 ;;
6087         esac
6088 esac
6089 case "$uselongdouble" in
6090 $define)
6091         echo "Long doubles selected." >&4
6092         case "$longdblsize" in
6093         $doublesize)
6094                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6095                 ;;
6096         *)
6097                 case "$archname" in
6098                 *-ld*) echo "...and architecture name already has -ld." >&4
6099                         ;;
6100                 *)      archname="$archname-ld"
6101                         echo "...setting architecture name to $archname." >&4
6102                         ;;
6103                 esac
6104                 ;;
6105         esac
6106         ;;
6107 esac
6108 if $test -f archname.cbu; then
6109         echo "Your platform has some specific hints for architecture name, using them..."
6110         . ./archname.cbu
6111 fi
6112
6113 : set the prefixit variable, to compute a suitable default value
6114 prefixit='case "$3" in
6115 ""|none)
6116         case "$oldprefix" in
6117         "") eval "$1=\"\$$2\"";;
6118         *)
6119                 case "$3" in
6120                 "") eval "$1=";;
6121                 none)
6122                         eval "tp=\"\$$2\"";
6123                         case "$tp" in
6124                         ""|" ") eval "$1=\"\$$2\"";;
6125                         *) eval "$1=";;
6126                         esac;;
6127                 esac;;
6128         esac;;
6129 *)
6130         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6131         case "$tp" in
6132         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6133         /*-$oldprefix/*|\~*-$oldprefix/*)
6134                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6135         *) eval "$1=\"\$$2\"";;
6136         esac;;
6137 esac'
6138
6139 : determine installation style
6140 : For now, try to deduce it from prefix unless it is already set.
6141 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6142 case "$installstyle" in
6143 '')     case "$prefix" in
6144                 *perl*) dflt='lib';;
6145                 *) dflt='lib/perl5' ;;
6146         esac
6147         ;;
6148 *)      dflt="$installstyle" ;;
6149 esac
6150 : Probably not worth prompting for this since we prompt for all
6151 : the directories individually, and the prompt would be too long and
6152 : confusing anyway.
6153 installstyle=$dflt
6154
6155 : determine where public executables go
6156 echo " "
6157 set dflt bin bin
6158 eval $prefixit
6159 fn=d~
6160 rp='Pathname where the public executables will reside?'
6161 . ./getfile
6162 if $test "X$ansexp" != "X$binexp"; then
6163         installbin=''
6164 fi
6165 prefixvar=bin
6166 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6167 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6168 :     this via initialinstalllocation
6169 . ./setprefixvar
6170
6171 case "$userelocatableinc" in
6172 $define|true|[yY]*)     dflt='y' ;;
6173 *)                      dflt='n' ;;
6174 esac
6175 cat <<EOM
6176
6177 Would you like to build Perl so that the installation is relocatable, so that
6178 library paths in @INC are determined relative to the path of the perl binary?
6179 This is not advised for system Perl installs, or if you need to run setid
6180 scripts or scripts under taint mode.
6181
6182 If this doesn't make any sense to you, just accept the default '$dflt'.
6183 EOM
6184 rp='Use relocatable @INC?'
6185 . ./myread
6186 case "$ans" in
6187 y|Y)    val="$define" ;;
6188 *)      val="$undef"  ;;
6189 esac
6190 set userelocatableinc
6191 eval $setvar
6192
6193 initialinstalllocation="$binexp"
6194 : Default prefix is now "up one level from where the binaries are"
6195 case "$userelocatableinc" in
6196 $define|true|[yY]*)
6197     bin=".../"
6198     binexp=".../"
6199     prefix=".../.."
6200     prefixexp=".../.."
6201     installprefixexp=".../.."
6202     ;;
6203 esac
6204
6205 : determine where private library files go
6206 : Usual default is /usr/local/lib/perl5/$version.
6207 : Also allow things like /opt/perl/lib/$version, since
6208 : /opt/perl/lib/perl5... would be redundant.
6209 : The default "style" setting is made in installstyle.U
6210 case "$installstyle" in
6211 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6212 *)       set dflt privlib lib/$version ;;
6213 esac
6214 eval $prefixit
6215 $cat <<EOM
6216
6217 There are some auxiliary files for $package that need to be put into a
6218 private library directory that is accessible by everyone.
6219
6220 EOM
6221 fn=$binexp
6222 fn=d~+
6223 rp='Pathname where the private library files will reside?'
6224 . ./getfile
6225 prefixvar=privlib
6226 . ./setprefixvar
6227
6228 : set the prefixup variable, to restore leading tilda escape
6229 prefixup='case "$prefixexp" in
6230 "$prefix") ;;
6231 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6232 esac'
6233
6234 : determine where public architecture dependent libraries go
6235 set archlib archlib
6236 eval $prefixit
6237 : privlib default is /usr/local/lib/$package/$version
6238 : archlib default is /usr/local/lib/$package/$version/$archname
6239 : privlib may have an optional trailing /share.
6240 tdflt=`echo $privlib | $sed 's,/share$,,'`
6241 tdflt=$tdflt/$archname
6242 case "$archlib" in
6243 '')     dflt=$tdflt
6244         ;;
6245 *)      dflt="$archlib"
6246     ;;
6247 esac
6248 $cat <<EOM
6249
6250 $spackage contains architecture-dependent library files.  If you are
6251 sharing libraries in a heterogeneous environment, you might store
6252 these files in a separate location.  Otherwise, you can just include
6253 them with the rest of the public library files.
6254
6255 EOM
6256 fn=$binexp
6257 fn=d+~
6258 rp='Where do you want to put the public architecture-dependent libraries?'
6259 . ./getfile
6260 prefixvar=archlib
6261 . ./setprefixvar
6262 if $test X"$archlib" = X"$privlib"; then
6263         d_archlib="$undef"
6264 else
6265         d_archlib="$define"
6266 fi
6267
6268 : see if setuid scripts can be secure
6269 $cat <<EOM
6270
6271 Some kernels have a bug that prevents setuid #! scripts from being
6272 secure.  Some sites have disabled setuid #! scripts because of this.
6273
6274 First let's decide if your kernel supports secure setuid #! scripts.
6275 (If setuid #! scripts would be secure but have been disabled anyway,
6276 don't say that they are secure if asked.)
6277
6278 EOM
6279
6280 val="$undef"
6281 if $test -d /dev/fd; then
6282         echo "#!$ls" >reflect
6283         chmod +x,u+s reflect
6284         ./reflect >flect 2>&1
6285         if $contains "/dev/fd" flect >/dev/null; then
6286                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6287                 val="$define"
6288         else
6289                 $cat <<EOM
6290 If you are not sure if they are secure, I can check but I'll need a
6291 username and password different from the one you are using right now.
6292 If you don't have such a username or don't want me to test, simply
6293 enter 'none'.
6294
6295 EOM
6296                 rp='Other username to test security of setuid scripts with?'
6297                 dflt='none'
6298                 . ./myread
6299                 case "$ans" in
6300                 n|none)
6301                         case "$d_suidsafe" in
6302                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6303                                 dflt=n;;
6304                         "$undef")
6305                                 echo "Well, the $hint value is *not* secure." >&4
6306                                 dflt=n;;
6307                         *)      echo "Well, the $hint value *is* secure." >&4
6308                                 dflt=y;;
6309                         esac
6310                         ;;
6311                 *)
6312                         $rm -f reflect flect
6313                         echo "#!$ls" >reflect
6314                         chmod +x,u+s reflect
6315                         echo >flect
6316                         chmod a+w flect
6317                         echo '"su" will (probably) prompt you for '"$ans's password."
6318                         su $ans -c './reflect >flect'
6319                         if $contains "/dev/fd" flect >/dev/null; then
6320                                 echo "Okay, it looks like setuid scripts are secure." >&4
6321                                 dflt=y
6322                         else
6323                                 echo "I don't think setuid scripts are secure." >&4
6324                                 dflt=n
6325                         fi
6326                         ;;
6327                 esac
6328                 rp='Does your kernel have *secure* setuid scripts?'
6329                 . ./myread
6330                 case "$ans" in
6331                 [yY]*)  val="$define";;
6332                 *)      val="$undef";;
6333                 esac
6334         fi
6335 else
6336         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6337         echo "(That's for file descriptors, not floppy disks.)"
6338         val="$undef"
6339 fi
6340 set d_suidsafe
6341 eval $setvar
6342
6343 $rm -f reflect flect
6344
6345 : now see if they want to do setuid emulation
6346 if $test $patchlevel -lt 11; then
6347 echo " "
6348 val="$undef"
6349 case "$d_suidsafe" in
6350 "$define")
6351         val="$undef"
6352         echo "No need to emulate SUID scripts since they are secure here." >&4
6353         ;;
6354 *)
6355         $cat <<EOM
6356 Some systems have disabled setuid scripts, especially systems where
6357 setuid scripts cannot be secure.  On systems where setuid scripts have
6358 been disabled, the setuid/setgid bits on scripts are currently
6359 useless.  It is possible for $package to detect those bits and emulate
6360 setuid/setgid in a secure fashion.  This emulation will only work if
6361 setuid scripts have been disabled in your kernel.
6362
6363 EOM
6364         case "$d_dosuid" in
6365         "$define") dflt=y ;;
6366         *) dflt=n ;;
6367         esac
6368         rp="Do you want to do setuid/setgid emulation?"
6369         . ./myread
6370         case "$ans" in
6371         [yY]*)  val="$define";;
6372         *)      val="$undef";;
6373         esac
6374         ;;
6375 esac
6376 set d_dosuid
6377 eval $setvar
6378 else
6379     case "$d_dosuid" in
6380         "$define")
6381         cat >&4 <<EOH
6382
6383 SUID emulation has been removed for 5.12
6384 Please re-run Configure without -Dd_dosuid
6385
6386 EOH
6387         exit 1;
6388         ;;
6389     esac
6390     d_dosuid=undef
6391 fi
6392
6393 : Find perl5.005 or later.
6394 echo "Looking for a previously installed perl5.005 or later... "
6395 case "$perl5" in
6396 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6397                 : Check if this perl is recent and can load a simple module
6398                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6399                         perl5=$tdir/perl
6400                         break;
6401                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6402                         perl5=$tdir/perl5
6403                         break;
6404                 fi
6405         done
6406         ;;
6407 *)      perl5="$perl5"
6408         ;;
6409 esac
6410 case "$perl5" in
6411 '')     echo "None found.  That's ok.";;
6412 *)      echo "Using $perl5." ;;
6413 esac
6414
6415 : Set the siteprefix variables
6416 $cat <<EOM
6417
6418 After $package is installed, you may wish to install various
6419 add-on modules and utilities.  Typically, these add-ons will
6420 be installed under $prefix with the rest
6421 of this package.  However, you may wish to install such add-ons
6422 elsewhere under a different prefix.
6423
6424 If you do not wish to put everything under a single prefix, that's
6425 ok.  You will be prompted for the individual locations; this siteprefix
6426 is only used to suggest the defaults.
6427
6428 The default should be fine for most people.
6429
6430 EOM
6431 fn=d~+
6432 rp='Installation prefix to use for add-on modules and utilities?'
6433 : XXX Here might be another good place for an installstyle setting.
6434 case "$siteprefix" in
6435 '') dflt=$prefix ;;
6436 *)  dflt=$siteprefix ;;
6437 esac
6438 . ./getfile
6439 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6440 oldsiteprefix=''
6441 case "$siteprefix" in
6442 '') ;;
6443 *)      case "$ans" in
6444         "$prefix") ;;
6445         *) oldsiteprefix="$prefix";;
6446         esac
6447         ;;
6448 esac
6449 siteprefix="$ans"
6450 siteprefixexp="$ansexp"
6451
6452 : determine where site specific libraries go.
6453 : Usual default is /usr/local/lib/perl5/site_perl/$version
6454 : The default "style" setting is made in installstyle.U
6455 : XXX No longer works with Prefixit stuff.
6456 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6457 case "$sitelib" in
6458 '') case "$installstyle" in
6459         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6460         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6461         esac
6462         ;;
6463 *)      dflt="$sitelib"
6464         ;;
6465 esac
6466 $cat <<EOM
6467
6468 The installation process will create a directory for
6469 site-specific extensions and modules.  Most users find it convenient
6470 to place all site-specific files in this directory rather than in the
6471 main distribution directory.
6472
6473 EOM
6474 fn=d~+
6475 rp='Pathname for the site-specific library files?'
6476 . ./getfile
6477 prefixvar=sitelib
6478 . ./setprefixvar
6479 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6480
6481 : Determine list of previous versions to include in @INC
6482 $cat > getverlist <<EOPL
6483 #!$perl5 -w
6484 use File::Basename;
6485 \$api_versionstring = "$api_versionstring";
6486 \$version = "$version";
6487 \$stem = "$sitelib_stem";
6488 \$archname = "$archname";
6489 EOPL
6490         $cat >> getverlist <<'EOPL'
6491 # The list found is store twice for each entry: the original name, and
6492 # the binary broken down version as pack "sss", so sorting is easy and
6493 # unambiguous. This will work for all versions that have a maximum of
6494 # three digit groups, separate by '.'s or '_'s. Names are extended with
6495 # ".0.0" to ensure at least three elements for the pack.
6496 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6497
6498 # Can't have leading @ because metaconfig interprets it as a command!
6499 ;@inc_version_list=();
6500 # XXX Redo to do opendir/readdir?
6501 if (-d $stem) {
6502     chdir($stem);
6503     ;@candidates = map {
6504         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6505     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6506 }
6507 else {
6508     ;@candidates = ();
6509 }
6510
6511 ($pversion, $aversion, $vsn5005) = map {
6512     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6513 foreach $d (@candidates) {
6514     if ($d->[1] lt $pversion) {
6515         if ($d->[1] ge $aversion) {
6516             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6517         }
6518         elsif ($d->[1] ge $vsn5005) {
6519             unshift(@inc_version_list, grep { -d } $d->[0]);
6520         }
6521     }
6522     else {
6523         # Skip newer version.  I.e. don't look in
6524         # 5.7.0 if we're installing 5.6.1.
6525     }
6526 }
6527
6528 if (@inc_version_list) {
6529     print join(' ', @inc_version_list);
6530 }
6531 else {
6532     # Blank space to preserve value for next Configure run.
6533     print " ";
6534 }
6535 EOPL
6536 chmod +x getverlist
6537 case "$inc_version_list" in
6538 '')     if test -x "$perl5$exe_ext"; then
6539                 dflt=`$perl5 getverlist`
6540         else
6541                 dflt='none'
6542         fi
6543         ;;
6544 $undef) dflt='none' ;;
6545 *)  eval dflt=\"$inc_version_list\" ;;
6546 esac
6547 case "$dflt" in
6548 ''|' ') dflt=none ;;
6549 esac
6550 case "$dflt" in
6551 5.005) dflt=none ;;
6552 esac
6553 $cat <<EOM
6554
6555 In order to ease the process of upgrading, this version of perl
6556 can be configured to use modules built and installed with earlier
6557 versions of perl that were installed under $prefix.  Specify here
6558 the list of earlier versions that this version of perl should check.
6559 If Configure detected no earlier versions of perl installed under
6560 $prefix, then the list will be empty.  Answer 'none' to tell perl
6561 to not search earlier versions.
6562
6563 The default should almost always be sensible, so if you're not sure,
6564 just accept the default.
6565 EOM
6566
6567 rp='List of earlier versions to include in @INC?'
6568 . ./myread
6569 case "$ans" in
6570 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6571 *) inc_version_list="$ans" ;;
6572 esac
6573 case "$inc_version_list" in
6574 ''|' ')
6575         inc_version_list_init='0'
6576         d_inc_version_list="$undef"
6577         ;;
6578 *)      inc_version_list_init=`echo $inc_version_list |
6579                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6580         d_inc_version_list="$define"
6581         ;;
6582 esac
6583 $rm -f getverlist
6584
6585 : see if malloc/malloc.h has to be included
6586 set malloc/malloc.h i_mallocmalloc
6587 eval $inhdr
6588
6589 : see if this is a malloc.h system
6590 : we want a real compile instead of Inhdr because some systems have a
6591 : malloc.h that just gives a compile error saying to use stdlib.h instead
6592 echo " "
6593 $cat >try.c <<EOCP
6594 #include <stdlib.h>
6595 #include <malloc.h>
6596 #$i_mallocmalloc I_MALLOCMALLOC
6597 #ifdef I_MALLOCMALLOC
6598 # include <malloc/malloc.h>
6599 #endif
6600
6601 int main () { return 0; }
6602 EOCP
6603 set try
6604 if eval $compile; then
6605     echo "<malloc.h> found." >&4
6606     val="$define"
6607 else
6608     echo "<malloc.h> NOT found." >&4
6609     val="$undef"
6610 fi
6611 $rm_try
6612 set i_malloc
6613 eval $setvar
6614
6615 : check for void type
6616 echo " "
6617 echo "Checking to see how well your C compiler groks the void type..." >&4
6618 case "$voidflags" in
6619 '')
6620         $cat >try.c <<EOCP
6621 #$i_stdlib I_STDLIB
6622 #ifdef I_STDLIB
6623 #include <stdlib.h>
6624 #endif
6625 #if TRY & 1
6626 void sub() {
6627 #else
6628 sub() {
6629 #endif
6630         extern void moo();      /* function returning void */
6631         void (*goo)();          /* ptr to func returning void */
6632 #if TRY & 8
6633         void *hue;              /* generic ptr */
6634 #endif
6635 #if TRY & 2
6636         void (*foo[10])();
6637 #endif
6638
6639 #if TRY & 4
6640         if(goo == moo) {
6641                 exit(0);
6642         }
6643 #endif
6644         exit(0);
6645 }
6646 int main() { sub(); }
6647 EOCP
6648         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6649                 voidflags=$defvoidused
6650         echo "Good.  It appears to support void to the level $package wants.">&4
6651                 if $contains warning .out >/dev/null 2>&1; then
6652                         echo "However, you might get some warnings that look like this:"
6653                         $cat .out
6654                 fi
6655         else
6656 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6657                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6658                         echo "It supports 1..."
6659                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6660                                 echo "It also supports 2..."
6661                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6662                                         voidflags=7
6663                                         echo "And it supports 4 but not 8 definitely."
6664                                 else
6665                                         echo "It doesn't support 4..."
6666                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6667                                                 voidflags=11
6668                                                 echo "But it supports 8."
6669                                         else
6670                                                 voidflags=3
6671                                                 echo "Neither does it support 8."
6672                                         fi
6673                                 fi
6674                         else
6675                                 echo "It does not support 2..."
6676                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6677                                         voidflags=13
6678                                         echo "But it supports 4 and 8."
6679                                 else
6680                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6681                                                 voidflags=5
6682                                                 echo "And it supports 4 but has not heard about 8."
6683                                         else
6684                                                 echo "However it supports 8 but not 4."
6685                                         fi
6686                                 fi
6687                         fi
6688                 else
6689                         echo "There is no support at all for void."
6690                         voidflags=0
6691                 fi
6692         fi
6693 esac
6694 case "$voidflags" in
6695 "$defvoidused") ;;
6696 *)      $cat >&4 <<'EOM'
6697   Support flag bits are:
6698     1: basic void declarations.
6699     2: arrays of pointers to functions returning void.
6700     4: operations between pointers to and addresses of void functions.
6701     8: generic void pointers.
6702 EOM
6703         dflt="$voidflags";
6704         rp="Your void support flags add up to what?"
6705         . ./myread
6706         voidflags="$ans"
6707         ;;
6708 esac
6709 $rm_try
6710
6711 : check for length of pointer
6712 echo " "
6713 case "$ptrsize" in
6714 '')
6715         echo "Checking to see how big your pointers are..." >&4
6716         if test "$voidflags" -gt 7; then
6717                 echo '#define VOID_PTR char *' > try.c
6718         else
6719                 echo '#define VOID_PTR void *' > try.c
6720         fi
6721         $cat >>try.c <<EOCP
6722 #include <stdio.h>
6723 #$i_stdlib I_STDLIB
6724 #ifdef I_STDLIB
6725 #include <stdlib.h>
6726 #endif
6727 int main()
6728 {
6729     printf("%d\n", (int)sizeof(VOID_PTR));
6730     exit(0);
6731 }
6732 EOCP
6733         set try
6734         if eval $compile_ok; then
6735                 ptrsize=`$run ./try`
6736                 echo "Your pointers are $ptrsize bytes long."
6737         else
6738                 dflt='4'
6739                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6740                 rp="What is the size of a pointer (in bytes)?"
6741                 . ./myread
6742                 ptrsize="$ans"
6743         fi
6744         ;;
6745 esac
6746 $rm_try
6747 case "$use64bitall" in
6748 "$define"|true|[yY]*)
6749         case "$ptrsize" in
6750         4)      cat <<EOM >&4
6751
6752 *** You have chosen a maximally 64-bit build,
6753 *** but your pointers are only 4 bytes wide.
6754 *** Please rerun Configure without -Duse64bitall.
6755 EOM
6756                 case "$d_quad" in
6757                 define)
6758                         cat <<EOM >&4
6759 *** Since you have quads, you could possibly try with -Duse64bitint.
6760 EOM
6761                         ;;
6762                 esac
6763                 cat <<EOM >&4
6764 *** Cannot continue, aborting.
6765
6766 EOM
6767
6768                 exit 1
6769                 ;;
6770         esac
6771         ;;
6772 esac
6773
6774
6775 : determine whether to use malloc wrapping
6776 echo " "
6777 case "$usemallocwrap" in
6778 [yY]*|true|$define)     dflt='y' ;;
6779 [nN]*|false|$undef)     dflt='n' ;;
6780 *)      case "$usedevel" in
6781         [yY]*|true|$define)     dflt='y' ;;
6782         *) dflt='n' ;;
6783         esac
6784         ;;
6785 esac
6786 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6787 . ./myread
6788 usemallocwrap="$ans"
6789 case "$ans" in
6790 y*|true)
6791         usemallocwrap="$define" ;;
6792 *)
6793         usemallocwrap="$undef" ;;
6794 esac
6795
6796 : determine which malloc to compile in
6797 echo " "
6798 case "$usemymalloc" in
6799 [yY]*|true|$define)     dflt='y' ;;
6800 [nN]*|false|$undef)     dflt='n' ;;
6801 *)      case "$ptrsize" in
6802         4) dflt='y' ;;
6803         *) dflt='n' ;;
6804         esac
6805         if test "$useithreads" = "$define"; then dflt='n'; fi
6806         ;;
6807 esac
6808 rp="Do you wish to attempt to use the malloc that comes with $package?"
6809 . ./myread
6810 usemymalloc="$ans"
6811 case "$ans" in
6812 y*|true)
6813         usemymalloc='y'
6814         mallocsrc='malloc.c'
6815         mallocobj="malloc$_o"
6816         d_mymalloc="$define"
6817         case "$libs" in
6818         *-lmalloc*)
6819                 : Remove malloc from list of libraries to use
6820                 echo "Removing unneeded -lmalloc from library list" >&4
6821                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6822                 shift
6823                 libs="$*"
6824                 echo "libs = $libs" >&4
6825                 ;;
6826         esac
6827         ;;
6828 *)
6829         usemymalloc='n'
6830         mallocsrc=''
6831         mallocobj=''
6832         d_mymalloc="$undef"
6833         ;;
6834 esac
6835
6836 : compute the return types of malloc and free
6837 echo " "
6838 $cat >malloc.c <<END
6839 #$i_malloc I_MALLOC
6840 #$i_stdlib I_STDLIB
6841 #include <stdio.h>
6842 #include <sys/types.h>
6843 #ifdef I_MALLOC
6844 #include <malloc.h>
6845 #endif
6846 #ifdef I_STDLIB
6847 #include <stdlib.h>
6848 #endif
6849 #ifdef TRY_MALLOC
6850 void *malloc();
6851 #endif
6852 #ifdef TRY_FREE
6853 void free();
6854 #endif
6855 END
6856 case "$malloctype" in
6857 '')
6858         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6859                 malloctype='void *'
6860         else
6861                 malloctype='char *'
6862         fi
6863         ;;
6864 esac
6865 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6866
6867 case "$freetype" in
6868 '')
6869         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6870                 freetype='void'
6871         else
6872                 freetype='int'
6873         fi
6874         ;;
6875 esac
6876 echo "Your system uses $freetype free(), it would seem." >&4
6877 $rm -f malloc.[co]
6878 : determine where site specific architecture-dependent libraries go.
6879 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6880 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6881 : sitelib may have an optional trailing /share.
6882 case "$sitearch" in
6883 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6884         dflt="$dflt/$archname"
6885         ;;
6886 *)      dflt="$sitearch"
6887         ;;
6888 esac
6889 set sitearch sitearch none
6890 eval $prefixit
6891 $cat <<EOM
6892
6893 The installation process will also create a directory for
6894 architecture-dependent site-specific extensions and modules.
6895
6896 EOM
6897 fn=d~+
6898 rp='Pathname for the site-specific architecture-dependent library files?'
6899 . ./getfile
6900 prefixvar=sitearch
6901 . ./setprefixvar
6902 if $test X"$sitearch" = X"$sitelib"; then
6903         d_sitearch="$undef"
6904 else
6905         d_sitearch="$define"
6906 fi
6907
6908 : Set the vendorprefix variables
6909 $cat <<EOM
6910
6911 The installation process will also create a directory for
6912 vendor-supplied add-ons.  Vendors who supply perl with their system
6913 may find it convenient to place all vendor-supplied files in this
6914 directory rather than in the main distribution directory.  This will
6915 ease upgrades between binary-compatible maintenance versions of perl.
6916
6917 Of course you may also use these directories in whatever way you see
6918 fit.  For example, you might use them to access modules shared over a
6919 company-wide network.
6920
6921 The default answer should be fine for most people.
6922 This causes further questions about vendor add-ons to be skipped
6923 and no vendor-specific directories will be configured for perl.
6924
6925 EOM
6926 rp='Do you want to configure vendor-specific add-on directories?'
6927 case "$usevendorprefix" in
6928 define|true|[yY]*) dflt=y ;;
6929 *)      : User may have set vendorprefix directly on Configure command line.
6930         case "$vendorprefix" in
6931         ''|' ') dflt=n ;;
6932         *)      dflt=y ;;
6933         esac
6934         ;;
6935 esac
6936 . ./myread
6937 case "$ans" in
6938 [yY]*)  fn=d~+
6939         rp='Installation prefix to use for vendor-supplied add-ons?'
6940         case "$vendorprefix" in
6941         '') dflt="$prefix" ;;
6942         *)  dflt=$vendorprefix ;;
6943         esac
6944         . ./getfile
6945         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6946         oldvendorprefix=''
6947         case "$vendorprefix" in
6948         '') ;;
6949         *)      case "$ans" in
6950                 "$prefix") ;;
6951                 *) oldvendorprefix="$prefix";;
6952                 esac
6953                 ;;
6954         esac
6955         usevendorprefix="$define"
6956         vendorprefix="$ans"
6957         vendorprefixexp="$ansexp"
6958         ;;
6959 *)      usevendorprefix="$undef"
6960         vendorprefix=''
6961         vendorprefixexp=''
6962         ;;
6963 esac
6964
6965 : Set the vendorlib variables
6966 case "$vendorprefix" in
6967 '')     d_vendorlib="$undef"
6968         vendorlib=''
6969         vendorlibexp=''
6970         ;;
6971 *)      d_vendorlib="$define"
6972         : determine where vendor-supplied modules go.
6973         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6974         case "$vendorlib" in
6975         '')
6976                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6977                 case "$installstyle" in
6978                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6979                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6980                 esac
6981                 ;;
6982         *)      dflt="$vendorlib"
6983                 ;;
6984         esac
6985         fn=d~+
6986         rp='Pathname for the vendor-supplied library files?'
6987         . ./getfile
6988         vendorlib="$ans"
6989         vendorlibexp="$ansexp"
6990         ;;
6991 esac
6992 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6993 prefixvar=vendorlib
6994 . ./installprefix
6995
6996 : Set the vendorarch variables
6997 case "$vendorprefix" in
6998 '')     d_vendorarch="$undef"
6999         vendorarch=''
7000         vendorarchexp=''
7001         ;;
7002 *)      d_vendorarch="$define"
7003         : determine where vendor-supplied architecture-dependent libraries go.
7004         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7005         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7006         : vendorlib may have an optional trailing /share.
7007         case "$vendorarch" in
7008         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7009                 dflt="$dflt/$archname"
7010                 ;;
7011         *)      dflt="$vendorarch" ;;
7012         esac
7013         fn=d~+
7014         rp='Pathname for vendor-supplied architecture-dependent files?'
7015         . ./getfile
7016         vendorarch="$ans"
7017         vendorarchexp="$ansexp"
7018         ;;
7019 esac
7020 prefixvar=vendorarch
7021 . ./installprefix
7022 if $test X"$vendorarch" = X"$vendorlib"; then
7023         d_vendorarch="$undef"
7024 else
7025         d_vendorarch="$define"
7026 fi
7027
7028 : Final catch-all directories to search
7029 $cat <<EOM
7030
7031 Lastly, you can have perl look in other directories for extensions and
7032 modules in addition to those already specified.
7033 These directories will be searched after
7034         $sitearch
7035         $sitelib
7036 EOM
7037 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7038 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7039 echo ' '
7040 case "$otherlibdirs" in
7041 ''|' ') dflt='none' ;;
7042 *)      dflt="$otherlibdirs" ;;
7043 esac
7044 $cat <<EOM
7045 Enter a colon-separated set of extra paths to include in perl's @INC
7046 search path, or enter 'none' for no extra paths.
7047
7048 EOM
7049
7050 rp='Colon-separated list of additional directories for perl to search?'
7051 . ./myread
7052 case "$ans" in
7053 ' '|''|none)    otherlibdirs=' ' ;;
7054 *)      otherlibdirs="$ans" ;;
7055 esac
7056 case "$otherlibdirs" in
7057 ' ') val=$undef ;;
7058 *)      val=$define ;;
7059 esac
7060 set d_perl_otherlibdirs
7061 eval $setvar
7062
7063 : Cruising for prototypes
7064 echo " "
7065 echo "Checking out function prototypes..." >&4
7066 $cat >prototype.c <<EOCP
7067 #$i_stdlib I_STDLIB
7068 #ifdef I_STDLIB
7069 #include <stdlib.h>
7070 #endif
7071 int main(int argc, char *argv[]) {
7072         exit(0);}
7073 EOCP
7074 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7075         echo "Your C compiler appears to support function prototypes."
7076         val="$define"
7077 else
7078         echo "Your C compiler doesn't seem to understand function prototypes."
7079         val="$undef"
7080 fi
7081 set prototype
7082 eval $setvar
7083 $rm -f prototype*
7084
7085 : Check if ansi2knr is required
7086 case "$prototype" in
7087 "$define") ;;
7088 *)      ansi2knr='ansi2knr'
7089         echo " "
7090         cat <<EOM >&4
7091
7092 $me:  FATAL ERROR:
7093 This version of $package can only be compiled by a compiler that 
7094 understands function prototypes.  Unfortunately, your C compiler 
7095         $cc $ccflags
7096 doesn't seem to understand them.  Sorry about that.
7097
7098 If GNU cc is available for your system, perhaps you could try that instead.  
7099
7100 Eventually, we hope to support building Perl with pre-ANSI compilers.
7101 If you would like to help in that effort, please contact <perlbug@perl.org>.
7102
7103 Aborting Configure now.
7104 EOM
7105         exit 2
7106         ;;
7107 esac
7108
7109 : DTrace support
7110 dflt_dtrace='/usr/sbin/dtrace'
7111 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7112
7113 cat <<EOM
7114
7115 Perl can be built to support DTrace on platforms that support it.
7116 DTrace is a diagnosis and performance analysis tool from Sun.
7117
7118 If this doesn't make any sense to you, just accept the default '$dflt'.
7119 EOM
7120
7121 while $test 1 ; do
7122         case "$usedtrace" in
7123         $define|true|[yY]*)
7124                 dflt='y'
7125                 ;;
7126         ?*)
7127                 dflt='y'
7128                 dflt_dtrace=$usedtrace
7129                 ;;
7130         *)
7131                 dflt='n'
7132                 ;;
7133         esac
7134
7135         rp='Support DTrace if available?'
7136         . ./myread
7137         case "$ans" in
7138         y|Y)    val="$define" ;;
7139         *)      val="$undef" ;;
7140         esac
7141         set usedtrace
7142         eval $setvar
7143
7144         test "X$usedtrace" != "X$define" && break
7145
7146         echo " "
7147         rp='Where is the dtrace executable?'
7148         dflt=$dflt_dtrace
7149         . ./getfile
7150         val="$ans"
7151         set dtrace
7152         eval $setvar
7153
7154         if $test -f $dtrace
7155         then
7156                 if $dtrace -h -s ../perldtrace.d \
7157                         -o perldtrace.tmp >/dev/null 2>&1 \
7158                         && rm -f perldtrace.tmp
7159                 then
7160                         echo " "
7161                         echo "Good: your $dtrace knows about the -h flag."
7162                 else
7163                         cat >&2 <<EOM
7164
7165 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7166 ***
7167 *** Your installed dtrace doesn't support the -h switch to compile a D
7168 *** program into a C header. Can't continue.
7169
7170 EOM
7171                         exit 1
7172                 fi
7173                 break;
7174         fi
7175
7176         case "$fastread" in
7177         yes)
7178                 cat >&2 <<EOM
7179
7180 *** $me:  Fatal Error:  $dtrace not found.
7181 *** Can't continue.
7182
7183 EOM
7184                 exit 1
7185                 ;;
7186         *)
7187                 echo "*** $dtrace was not found."
7188                 echo " "
7189                 ;;
7190         esac
7191 done
7192
7193 : See if we want extra modules installed
7194 echo " "
7195 case "$extras" in
7196 '') dflt='n';;
7197 *) dflt='y';;
7198 esac
7199 cat <<EOM
7200 Perl can be built with extra modules or bundles of modules which
7201 will be fetched from the CPAN and installed alongside Perl.
7202
7203 Notice that you will need access to the CPAN; either via the Internet,
7204 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7205 be asked later to configure the CPAN.pm module which will in turn do
7206 the installation of the rest of the extra modules or bundles.)
7207
7208 Notice also that if the modules require any external software such as
7209 libraries and headers (the libz library and the zlib.h header for the
7210 Compress::Zlib module, for example) you MUST have any such software
7211 already installed, this configuration process will NOT install such
7212 things for you.
7213
7214 If this doesn't make any sense to you, just accept the default '$dflt'.
7215 EOM
7216 rp='Install any extra modules (y or n)?'
7217 . ./myread
7218 case "$ans" in
7219 y|Y)
7220         cat <<EOM
7221
7222 Please list any extra modules or bundles to be installed from CPAN,
7223 with spaces between the names.  The names can be in any format the
7224 'install' command of CPAN.pm will understand.  (Answer 'none',
7225 without the quotes, to install no extra modules or bundles.)
7226 EOM
7227         rp='Extras?'
7228         dflt="$extras"
7229         . ./myread
7230         extras="$ans"
7231 esac
7232 case "$extras" in
7233 ''|'none')
7234         val=''
7235         $rm -f ../extras.lst
7236         ;;
7237 *)      echo "(Saving the list of extras for later...)"
7238         echo "$extras" > ../extras.lst
7239         val="'$extras'"
7240         ;;
7241 esac
7242 set extras
7243 eval $setvar
7244 echo " "
7245
7246 : determine where html pages for programs go
7247 set html1dir html1dir none
7248 eval $prefixit
7249 $cat <<EOM
7250
7251 If you wish to install html files for programs in $spackage, indicate
7252 the appropriate directory here.  To skip installing html files,
7253 answer "none".
7254 EOM
7255 case "$html1dir" in
7256 ''|none|$undef|' ') dflt=none ;;
7257 *) dflt=$html1dir ;;
7258 esac
7259 fn=dn+~
7260 rp="Directory for the main $spackage html pages?"
7261 . ./getfile
7262 prefixvar=html1dir
7263 . ./setprefixvar
7264 : Use ' ' for none so value is preserved next time through Configure
7265 $test X"$html1dir" = "X" && html1dir=' '
7266
7267 : determine where html pages for libraries and modules go
7268 set html3dir html3dir none
7269 eval $prefixit
7270 $cat <<EOM
7271
7272 If you wish to install html files for modules associated with $spackage,
7273 indicate the appropriate directory here.  To skip installing html files,
7274 answer "none".
7275 EOM
7276 : There is no obvious default.  If they have specified html1dir, then
7277 : try to key off that, possibly changing .../html1 into .../html3.
7278 case "$html3dir" in
7279 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7280 *) dflt=$html3dir ;;
7281 esac
7282 fn=dn+~
7283 rp="Directory for the $spackage module html pages?"
7284 . ./getfile
7285 prefixvar=html3dir
7286 . ./setprefixvar
7287 : Use ' ' for none so value is preserved next time through Configure
7288 $test X"$html3dir" = "X" && html3dir=' '
7289
7290 : determine whether to install perl also as /usr/bin/perl
7291
7292 echo " "
7293 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7294         $cat <<EOM
7295 Many scripts expect perl to be installed as /usr/bin/perl.
7296
7297 If you want to, I can install the perl you are about to compile
7298 as /usr/bin/perl (in addition to $bin/perl).
7299 EOM
7300         if test -f /usr/bin/perl; then
7301             $cat <<EOM
7302
7303 However, please note that because you already have a /usr/bin/perl,
7304 overwriting that with a new Perl would very probably cause problems.
7305 Therefore I'm assuming you don't want to do that (unless you insist).
7306
7307 EOM
7308             case "$installusrbinperl" in
7309             "$define"|[yY]*)    dflt='y';;
7310             *)                  dflt='n';;
7311             esac
7312         else
7313             $cat <<EOM
7314
7315 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7316
7317 EOM
7318             case "$installusrbinperl" in
7319             "$undef"|[nN]*)     dflt='n';;
7320             *)                  dflt='y';;
7321             esac
7322         fi
7323         rp="Do you want to install perl as /usr/bin/perl?"
7324         . ./myread
7325         case "$ans" in
7326         [yY]*)  val="$define";;
7327         *)      val="$undef" ;;
7328         esac
7329 else
7330         val="$undef"
7331 fi
7332 set installusrbinperl
7333 eval $setvar
7334
7335 : Check if we are using the GNU C library
7336 echo " "
7337 echo "Checking for GNU C Library..." >&4
7338 cat >try.c <<'EOCP'
7339 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7340    alone are insufficient to distinguish different versions, such as
7341    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7342    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7343 */
7344 #include <stdio.h>
7345 int main(void)
7346 {
7347 #ifdef __GLIBC__
7348 #   ifdef __GLIBC_MINOR__
7349 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7350 #           include <gnu/libc-version.h>
7351             printf("%s\n",  gnu_get_libc_version());
7352 #       else
7353             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7354 #       endif
7355 #   else
7356         printf("%d\n",  __GLIBC__);
7357 #   endif
7358     return 0;
7359 #else
7360     return 1;
7361 #endif
7362 }
7363 EOCP
7364 set try
7365 if eval $compile_ok && $run ./try > glibc.ver; then
7366         val="$define"
7367         gnulibc_version=`$cat glibc.ver`
7368         echo "You are using the GNU C Library version $gnulibc_version"
7369 else
7370         val="$undef"
7371         gnulibc_version=''
7372         echo "You are not using the GNU C Library"
7373 fi
7374 $rm_try glibc.ver
7375 set d_gnulibc
7376 eval $setvar
7377
7378 : see if nm is to be used to determine whether a symbol is defined or not
7379 case "$usenm" in
7380 '')
7381         dflt=''
7382         case "$d_gnulibc" in
7383         "$define")
7384                 echo " "
7385                 echo "nm probably won't work on the GNU C Library." >&4
7386                 dflt=n
7387                 ;;
7388         esac
7389         case "$dflt" in
7390         '')
7391                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7392                         echo " "
7393                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7394                         echo "'nm' won't be sufficient on this system." >&4
7395                         dflt=n
7396                 fi
7397                 ;;
7398         esac
7399         case "$dflt" in
7400         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7401                 if $test $dflt -gt 20; then
7402                         dflt=y
7403                 else
7404                         dflt=n
7405                 fi
7406                 ;;
7407         esac
7408         ;;
7409 *)
7410         case "$usenm" in
7411         true|$define) dflt=y;;
7412         *) dflt=n;;
7413         esac
7414         ;;
7415 esac
7416 $cat <<EOM
7417
7418 I can use $nm to extract the symbols from your C libraries. This
7419 is a time consuming task which may generate huge output on the disk (up
7420 to 3 megabytes) but that should make the symbols extraction faster. The
7421 alternative is to skip the 'nm' extraction part and to compile a small
7422 test program instead to determine whether each symbol is present. If
7423 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7424 this may be the best solution.
7425
7426 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7427
7428 EOM
7429 rp="Shall I use $nm to extract C symbols from the libraries?"
7430 . ./myread
7431 case "$ans" in
7432 [Nn]*) usenm=false;;
7433 *) usenm=true;;
7434 esac
7435
7436 runnm=$usenm
7437 case "$reuseval" in
7438 true) runnm=false;;
7439 esac
7440
7441 : nm options which may be necessary
7442 case "$nm_opt" in
7443 '') if $test -f /mach_boot; then
7444                 nm_opt=''       # Mach
7445         elif $test -d /usr/ccs/lib; then
7446                 nm_opt='-p'     # Solaris (and SunOS?)
7447         elif $test -f /dgux; then
7448                 nm_opt='-p'     # DG-UX
7449         elif $test -f /lib64/rld; then
7450                 nm_opt='-p'     # 64-bit Irix
7451         else
7452                 nm_opt=''
7453         fi;;
7454 esac
7455
7456 : nm options which may be necessary for shared libraries but illegal
7457 : for archive libraries.  Thank you, Linux.
7458 case "$nm_so_opt" in
7459 '')     case "$myuname" in
7460         *linux*|gnu*)
7461                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7462                         nm_so_opt='--dynamic'
7463                 fi
7464                 ;;
7465         esac
7466         ;;
7467 esac
7468
7469 : Figure out where the libc is located
7470 case "$runnm" in
7471 true)
7472 : get list of predefined functions in a handy place
7473 echo " "
7474 case "$libc" in
7475 '') libc=unknown
7476         case "$libs" in
7477         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7478         esac
7479         ;;
7480 esac
7481 case "$libs" in
7482 '') ;;
7483 *)  for thislib in $libs; do
7484         case "$thislib" in
7485         -lc|-lc_s)
7486                 : Handle C library specially below.
7487                 ;;
7488         -l*)
7489                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7490                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7491                         :
7492                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7493                         :
7494                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7495                         :
7496                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7497                         :
7498                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7499                         :
7500                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7501                         :
7502                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7503                         :
7504                 else
7505                         try=''
7506                 fi
7507                 libnames="$libnames $try"
7508                 ;;
7509         *) libnames="$libnames $thislib" ;;
7510         esac
7511         done
7512         ;;
7513 esac
7514 xxx=normal
7515 case "$libc" in
7516 unknown)
7517         set /lib/libc.$so
7518         for xxx in $libpth; do
7519                 $test -r $1 || set $xxx/libc.$so
7520                 : The messy sed command sorts on library version numbers.
7521                 $test -r $1 || \
7522                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7523                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7524                                 h
7525                                 s/[0-9][0-9]*/0000&/g
7526                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7527                                 G
7528                                 s/\n/ /' | \
7529                          $sort | $sed -e 's/^.* //'`
7530                 eval set \$$#
7531         done
7532         $test -r $1 || set /usr/ccs/lib/libc.$so
7533         $test -r $1 || set /lib/libsys_s$_a
7534         ;;
7535 *)
7536         set blurfl
7537         ;;
7538 esac
7539 if $test -r "$1"; then
7540         echo "Your (shared) C library seems to be in $1."
7541         libc="$1"
7542 elif $test -r /lib/libc && $test -r /lib/clib; then
7543         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7544         xxx=apollo
7545         libc='/lib/clib /lib/libc'
7546         if $test -r /lib/syslib; then
7547                 echo "(Your math library is in /lib/syslib.)"
7548                 libc="$libc /lib/syslib"
7549         fi
7550 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7551         echo "Your C library seems to be in $libc, as you said before."
7552 elif $test -r $incpath/usr/lib/libc$_a; then
7553         libc=$incpath/usr/lib/libc$_a;
7554         echo "Your C library seems to be in $libc.  That's fine."
7555 elif $test -r /lib/libc$_a; then
7556         libc=/lib/libc$_a;
7557         echo "Your C library seems to be in $libc.  You're normal."
7558 else
7559         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7560                 :
7561         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7562                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7563         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7564                 :
7565         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7566                 :
7567         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7568                 :
7569         else
7570                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7571         fi
7572         if $test -r "$tans"; then
7573                 echo "Your C library seems to be in $tans, of all places."
7574                 libc=$tans
7575         else
7576                 libc='blurfl'
7577         fi
7578 fi
7579 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7580         dflt="$libc"
7581         cat <<EOM
7582
7583 If the guess above is wrong (which it might be if you're using a strange
7584 compiler, or your machine supports multiple models), you can override it here.
7585
7586 EOM
7587 else
7588         dflt=''
7589         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7590         cat >&4 <<EOM
7591 I can't seem to find your C library.  I've looked in the following places:
7592
7593 EOM
7594         $sed 's/^/      /' libpath
7595         cat <<EOM
7596
7597 None of these seems to contain your C library. I need to get its name...
7598
7599 EOM
7600 fi
7601 fn=f
7602 rp='Where is your C library?'
7603 . ./getfile
7604 libc="$ans"
7605
7606 echo " "
7607 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7608 set X `cat libnames`
7609 shift
7610 xxx=files
7611 case $# in 1) xxx=file; esac
7612 echo "Extracting names from the following $xxx for later perusal:" >&4
7613 echo " "
7614 $sed 's/^/      /' libnames >&4
7615 echo " "
7616 $echo $n "This may take a while...$c" >&4
7617
7618 for file in $*; do
7619         case $file in
7620         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7621         *) $nm $nm_opt $file 2>/dev/null;;
7622         esac
7623 done >libc.tmp
7624
7625 $echo $n ".$c"
7626 $grep fprintf libc.tmp > libc.ptf
7627 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7628 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7629 xxx='[ADTSIWi]'
7630 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7631         eval $xscan;\
7632         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7633                 eval $xrun
7634 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7635         eval $xscan;\
7636         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7637                 eval $xrun
7638 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7639         eval $xscan;\
7640         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7641                 eval $xrun
7642 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7643         eval $xscan;\
7644         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7645                 eval $xrun
7646 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7647         eval $xscan;\
7648         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7649                 eval $xrun
7650 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7651         eval $xscan;\
7652         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7653                 eval $xrun
7654 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7655                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7656         eval $xscan;\
7657         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7658                 eval $xrun
7659 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7660         eval $xscan;\
7661         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7662                 eval $xrun
7663 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7664         eval $xscan;\
7665         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7666                 eval $xrun
7667 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7668         eval $xscan;\
7669         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7670                 eval $xrun
7671 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7672         eval $xscan;\
7673         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7674                 eval $xrun
7675 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7676         eval $xscan;\
7677         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7678                 eval $xrun
7679 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7680         eval $xscan;\
7681         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7682                 eval $xrun
7683 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7684         eval $xscan;\
7685         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7686                 eval $xrun
7687 else
7688         $nm -p $* 2>/dev/null >libc.tmp
7689         $grep fprintf libc.tmp > libc.ptf
7690         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7691                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7692         then
7693                 nm_opt='-p'
7694                 eval $xrun
7695         else
7696                 echo " "
7697                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7698                 com=''
7699                 if $ar t $libc > libc.tmp && \
7700                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7701                 then
7702                         for thisname in $libnames $libc; do
7703                                 $ar t $thisname >>libc.tmp
7704                         done
7705                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7706                         echo "Ok." >&4
7707                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7708                         for thisname in $libnames $libc; do
7709                                 $ar tv $thisname >>libc.tmp
7710                                 emximp -o tmp.imp $thisname \
7711                                     2>/dev/null && \
7712                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7713                                     < tmp.imp >>libc.tmp
7714                                 $rm -f tmp.imp
7715                         done
7716                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7717                         echo "Ok." >&4
7718                 else
7719                         echo "$ar didn't seem to work right." >&4
7720                         echo "Maybe this is a Cray...trying bld instead..." >&4
7721                         if  bld t $libc | \
7722                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7723                                 $test -s libc.list
7724                         then
7725                                 for thisname in $libnames; do
7726                                         bld t $libnames | \
7727                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7728                                         $ar t $thisname >>libc.tmp
7729                                 done
7730                                 echo "Ok." >&4
7731                         else
7732                                 echo "That didn't work either.  Giving up." >&4
7733                                 exit 1
7734                         fi
7735                 fi
7736         fi
7737 fi
7738 nm_extract="$com"
7739 case "$PASE" in
7740 define)
7741     echo " "
7742     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7743     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7744     ;;
7745 *)  if $test -f /lib/syscalls.exp; then
7746         echo " "
7747         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7748         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7749                 /lib/syscalls.exp >>libc.list
7750     fi
7751     ;;
7752 esac
7753 ;;
7754 esac
7755 $rm -f libnames libpath
7756
7757 : see if dld is available
7758 set dld.h i_dld
7759 eval $inhdr
7760
7761 : Check if we are using C++
7762 echo " "
7763 echo "Checking for C++..." >&4
7764 $cat >try.c <<'EOCP'
7765 #include <stdio.h>
7766 int main(void)
7767 {
7768 #ifdef __cplusplus
7769     return 0;
7770 #else
7771     return 1;
7772 #endif
7773 }
7774 EOCP
7775 set try
7776 if eval $compile_ok && $run ./try; then
7777         val="$define"
7778         echo "You are using a C++ compiler."
7779 else
7780         val="$undef"
7781         echo "You are not using a C++ compiler."
7782 fi
7783 $rm_try cplusplus$$
7784 set d_cplusplus
7785 eval $setvar
7786
7787 : is a C symbol defined?
7788 csym='tlook=$1;
7789 case "$3" in
7790 -v) tf=libc.tmp; tdc="";;
7791 -a) tf=libc.tmp; tdc="[]";;
7792 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7793 esac;
7794 case "$d_cplusplus" in
7795     $define)    extern_C="extern \"C\"" ;;
7796     *)          extern_C="extern"       ;;
7797 esac;
7798 tx=yes;
7799 case "$reuseval-$4" in
7800 true-) ;;
7801 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7802 esac;
7803 case "$tx" in
7804 yes)
7805         tval=false;
7806         if $test "$runnm" = true; then
7807                 if $contains $tlook $tf >/dev/null 2>&1; then
7808                         tval=true;
7809                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7810                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7811                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7812                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7813                         $rm_try;
7814                 fi;
7815         else
7816                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7817                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7818                 $rm_try;
7819         fi;
7820         ;;
7821 *)
7822         case "$tval" in
7823         $define) tval=true;;
7824         *) tval=false;;
7825         esac;
7826         ;;
7827 esac;
7828 eval "$2=$tval"'
7829
7830 : define an is-in-libc? function
7831 inlibc='echo " "; td=$define; tu=$undef;
7832 sym=$1; var=$2; eval "was=\$$2";
7833 tx=yes;
7834 case "$reuseval$was" in
7835 true) ;;
7836 true*) tx=no;;
7837 esac;
7838 case "$tx" in
7839 yes)
7840         set $sym tres -f;
7841         eval $csym;
7842         case "$tres" in
7843         true)
7844                 echo "$sym() found." >&4;
7845                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7846         *)
7847                 echo "$sym() NOT found." >&4;
7848                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7849         esac;;
7850 *)
7851         case "$was" in
7852         $define) echo "$sym() found." >&4;;
7853         *) echo "$sym() NOT found." >&4;;
7854         esac;;
7855 esac'
7856
7857 : see if dlopen exists
7858 xxx_runnm="$runnm"
7859 xxx_ccflags="$ccflags"
7860 runnm=false
7861 : with g++ one needs -shared to get is-in-libc to work for dlopen
7862 case "$gccversion" in
7863 '')     ;;
7864 *)      case "$d_cplusplus" in
7865         "$define") ccflags="$ccflags -shared" ;;
7866         esac
7867         ;;
7868 esac
7869 set dlopen d_dlopen
7870 eval $inlibc
7871 runnm="$xxx_runnm"
7872 ccflags="$xxx_ccflags"
7873
7874 : see if this is a unistd.h system
7875 set unistd.h i_unistd
7876 eval $inhdr
7877
7878 : determine which dynamic loading, if any, to compile in
7879 echo " "
7880 dldir="ext/DynaLoader"
7881 case "$usedl" in
7882 $define|y|true)
7883         dflt='y'
7884         usedl="$define"
7885         ;;
7886 $undef|n|false)
7887         dflt='n'
7888         usedl="$undef"
7889         ;;
7890 *)
7891         dflt='n'
7892         case "$d_dlopen" in
7893             $define) dflt='y' ;;
7894         esac
7895         case "$i_dld" in
7896             $define) dflt='y' ;;
7897         esac
7898         : Does a dl_xxx.xs file exist for this operating system
7899         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7900         ;;
7901 esac
7902 rp="Do you wish to use dynamic loading?"
7903 . ./myread
7904 usedl="$ans"
7905 bin_ELF="$undef"
7906 case "$ans" in
7907 y*) usedl="$define"
7908         case "$dlsrc" in
7909         '')
7910                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7911                         dflt="$dldir/dl_${osname}.xs"
7912                 elif $test "$d_dlopen" = "$define" ; then
7913                         dflt="$dldir/dl_dlopen.xs"
7914                 elif $test "$i_dld" = "$define" ; then
7915                         dflt="$dldir/dl_dld.xs"
7916                 else
7917                         dflt=''
7918                 fi
7919                 ;;
7920         *)      dflt="$dldir/$dlsrc"
7921                 ;;
7922         esac
7923     echo "The following dynamic loading files are available:"
7924         : Can not go over to $dldir because getfile has path hard-coded in.
7925         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7926         rp="Source file to use for dynamic loading"
7927         fn="fne"
7928         gfpth="$src"
7929         . ./getfile
7930         usedl="$define"
7931         : emulate basename
7932         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7933
7934         $cat << EOM
7935
7936 Some systems may require passing special flags to $cc -c to
7937 compile modules that will be used to create a shared library.
7938 To use no flags, say "none".
7939
7940 EOM
7941     case "$cccdlflags" in
7942     '') case "$gccversion" in
7943                 '') case "$osname" in
7944                         hpux)   dflt='+z' ;;
7945                         next)   dflt='none' ;;
7946                         irix*)  dflt='-KPIC' ;;
7947                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7948                         sunos)  dflt='-pic' ;;
7949                         *)      dflt='none' ;;
7950                     esac
7951                         ;;
7952                 *)  case "$osname" in
7953                         darwin) dflt='none' ;;
7954                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7955                         *)      dflt='-fpic' ;;
7956                     esac ;;
7957             esac ;;
7958         ' ') dflt='none' ;;
7959     *)  dflt="$cccdlflags" ;;
7960     esac
7961     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7962     . ./myread
7963     case "$ans" in
7964     none) cccdlflags=' ' ;;
7965     *) cccdlflags="$ans" ;;
7966     esac
7967
7968     cat << EOM
7969
7970 Some systems use ld to create libraries that can be dynamically loaded,
7971 while other systems (such as those using ELF) use $cc.
7972
7973 EOM
7974
7975 : Determine if this is ELF
7976         $cat >try.c <<EOM
7977 /* Test for whether ELF binaries are produced */
7978 #include <fcntl.h>
7979 #$i_stdlib I_STDLIB
7980 #ifdef I_STDLIB
7981 #include <stdlib.h>
7982 #endif
7983 #$i_unistd I_UNISTD
7984 #ifdef I_UNISTD
7985 #include <unistd.h>
7986 #endif
7987 int main() {
7988         char b[4];
7989         int i = open("a.out",O_RDONLY);
7990         if(i == -1)
7991                 exit(1); /* fail */
7992         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7993                 exit(0); /* succeed (yes, it is ELF) */
7994         else
7995                 exit(1); /* fail */
7996 }
7997 EOM
7998         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7999                 bin_ELF="$define"
8000         fi
8001         $rm_try
8002
8003         case "$ld" in
8004         '')     if $test $bin_ELF = "$define"; then
8005                         cat <<EOM
8006 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8007 EOM
8008                         dflt="$cc"
8009                 else
8010                         echo "I'll use ld to build dynamic libraries."
8011                         dflt='ld'
8012                 fi
8013                 ;;
8014         *)      dflt="$ld"
8015                 ;;
8016         esac
8017
8018     rp="What command should be used to create dynamic libraries?"
8019     . ./myread
8020         ld="$ans"
8021
8022     cat << EOM
8023
8024 Some systems may require passing special flags to $ld to create a
8025 library that can be dynamically loaded.  If your ld flags include
8026 -L/other/path options to locate libraries outside your loader's normal
8027 search path, you may need to specify those -L options here as well.  To
8028 use no flags, say "none".
8029
8030 EOM
8031     case "$lddlflags" in
8032     '') case "$osname" in
8033                         haiku) dflt='-shared' ;;
8034                         hpux) dflt='-b';
8035                               case "$gccversion" in
8036                               '') dflt="$dflt +vnocompatwarnings" ;;
8037                               esac
8038                               ;;
8039                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8040                         next)  dflt='none' ;;
8041                         solaris) # See [perl #66604].
8042                                 # On Solaris 11, gcc -m64 on amd64 
8043                                 # appears not to understand -G.  gcc versions at
8044                                 # least as old as 3.4.3 support -shared, so just
8045                                 # use that with Solaris 11 and later, but keep
8046                                 # the old behavior for older Solaris versions.
8047                                 case "$gccversion" in
8048                                         '') dflt='-G' ;;
8049                                         *)      case "$osvers" in
8050                                                         2.?|2.10) dflt='-G' ;;
8051                                                         *) dflt='-shared' ;;
8052                                                 esac
8053                                                 ;;
8054                                 esac
8055                                 ;;
8056                         sunos) dflt='-assert nodefinitions' ;;
8057                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8058                 *)     dflt='none' ;;
8059                         esac
8060                         ;;
8061     *) dflt="$lddlflags" ;;
8062     esac
8063
8064         : Try to guess additional flags to pick up local libraries.
8065         : Be careful not to append to a plain 'none'
8066         case "$dflt" in
8067         none) dflt='' ;;
8068         esac
8069         for thisflag in $ldflags; do
8070                 case "$thisflag" in
8071                 -L*|-R*|-Wl,-R*)
8072                         case " $dflt " in
8073                         *" $thisflag "*) ;;
8074                         *) dflt="$dflt $thisflag" ;;
8075                         esac
8076                         ;;
8077                 esac
8078         done
8079
8080         case "$dflt" in
8081         ''|' ') dflt='none' ;;
8082         esac
8083
8084         case "$ldflags" in
8085         *-fstack-protector*)
8086             case "$dflt" in
8087                         *-fstack-protector*) ;; # Don't add it again
8088                         *) dflt="$dflt -fstack-protector" ;; 
8089                 esac
8090                 ;;
8091         esac
8092
8093
8094     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8095     . ./myread
8096     case "$ans" in
8097     none) lddlflags=' ' ;;
8098     *) lddlflags="$ans" ;;
8099     esac
8100
8101         cat <<EOM
8102
8103 Some systems may require passing special flags to $cc to indicate that
8104 the resulting executable will use dynamic linking.  To use no flags,
8105 say "none".
8106
8107 EOM
8108     case "$ccdlflags" in
8109     '') case "$osname" in
8110             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8111             next|sunos) dflt='none' ;;
8112             *)          dflt='none' ;;
8113             esac ;;
8114     ' ')  dflt='none' ;;
8115     *)  dflt="$ccdlflags" ;;
8116     esac
8117     rp="Any special flags to pass to $cc to use dynamic linking?"
8118     . ./myread
8119     case "$ans" in
8120     none) ccdlflags=' ' ;;
8121     *) ccdlflags="$ans" ;;
8122     esac
8123     ;;
8124 *)  usedl="$undef"
8125         ld='ld'
8126     dlsrc='dl_none.xs'
8127     lddlflags=''
8128     ccdlflags=''
8129     ;;
8130 esac
8131
8132 ld_can_script="$undef"
8133 case "$bin_ELF$usedl" in
8134 $define$define)
8135     # Abuse try.h and a.out names for neat cleanup
8136     $cat >try.c <<EOM
8137 void foo() {}
8138 void bar() {}
8139 EOM
8140     $cat >try.h <<EOM
8141 LIBTEST_42 {
8142  global:
8143   foo;
8144  local: *;
8145  };
8146 EOM
8147     if $cc $cccdlflags $ccdlflags $ccflags \
8148            $ldflags $lddlflags -o a.out try.c \
8149            -Wl,--version-script=try.h >/dev/null 2>&1 \
8150        &&  $test -s a.out ; then
8151         echo "ld supports scripting" >&4
8152         ld_can_script="$define"
8153     else
8154         echo "ld does not support scripting" >&4
8155     fi
8156     $rm_try
8157     ;;
8158 esac
8159
8160 : Do we want a shared libperl?
8161 also=''
8162 case "$usedl" in
8163 $undef)
8164         # No dynamic loading being used, so don't bother even to prompt.
8165         useshrplib='false'
8166         ;;
8167 *)      case "$useshrplib" in
8168         '')     case "$osname" in
8169                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8170                         dflt=y
8171                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8172                         ;;
8173                 next*)
8174                         case "$osvers" in
8175                         4*)     dflt=y
8176                                 also='Building a shared libperl is needed for MAB support.'
8177                                 ;;
8178                         *)      dflt=n
8179                                 ;;
8180                         esac
8181                         ;;
8182                 *)      dflt=n
8183                         ;;
8184                 esac
8185                 ;;
8186         $define|true|[Yy]*)
8187                 dflt=y
8188                 ;;
8189         *)      dflt=n
8190                 ;;
8191         esac
8192         $cat << EOM
8193
8194 The perl executable is normally obtained by linking perlmain.c with
8195 libperl${_a}, any static extensions (usually just DynaLoader), and
8196 any other libraries needed on this system (such as -lm, etc.).  Since
8197 your system supports dynamic loading, it is probably possible to build
8198 a shared libperl.$so.  If you will have more than one executable linked
8199 to libperl.$so, this will significantly reduce the size of each
8200 executable, but it may have a noticeable effect on performance.  The
8201 default is probably sensible for your system.
8202 $also
8203
8204 EOM
8205         rp="Build a shared libperl.$so (y/n)"
8206         . ./myread
8207         case "$ans" in
8208         true|$define|[Yy]*)
8209                 useshrplib='true'  ;;
8210         *)      useshrplib='false' ;;
8211         esac
8212         ;;
8213 esac
8214
8215 case "$useshrplib" in
8216 true)
8217         case "$userelocatableinc" in
8218         true|define)
8219                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8220                 echo "See INSTALL for an explanation why that won't work." >&4
8221                 exit 4
8222                 ;;
8223         esac
8224         case "$libperl" in
8225         '')
8226                 # Figure out a good name for libperl.so.  Since it gets stored in
8227                 # a version-specific architecture-dependent library, the version
8228                 # number isn't really that important, except for making cc/ld happy.
8229                 #
8230                 # A name such as libperl.so.10.1
8231                 majmin="libperl.$so.$patchlevel.$subversion"
8232                 # A name such as libperl.so.100
8233                 majonly=`echo $patchlevel $subversion |
8234                         $awk '{printf "%d%02d", $1, $2}'`
8235                 majonly=libperl.$so.$majonly
8236                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8237                 # rely on figuring it out from the naming of libc.
8238                 case "${osname}${osvers}" in
8239                 next4*)
8240                         dflt=libperl.5.$so
8241                         # XXX How handle the --version stuff for MAB?
8242                         ;;
8243                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8244                         dflt=libperl.$so
8245                         ;;
8246                 cygwin*) # ld links now against the dll directly
8247                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8248                         majonly=`echo $patchlevel $subversion |
8249                                 $awk '{printf "%03d%03d", $1, $2}'`
8250                         majonly=cygperl5.$majonly.$so
8251                         dflt=$majmin
8252                         ;;
8253                 *)      # Try to guess based on whether libc has major.minor.
8254                         case "$libc" in
8255                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8256                         *libc.$so.[0-9]*) dflt=$majonly ;;
8257                         *)      dflt=libperl.$so ;;
8258                         esac
8259                         ;;
8260                 esac
8261                 ;;
8262         *)      dflt=$libperl
8263                 ;;
8264         esac
8265         cat << EOM
8266
8267 I need to select a good name for the shared libperl.  If your system uses
8268 library names with major and minor numbers, then you might want something
8269 like $majmin.  Alternatively, if your system uses a single version
8270 number for shared libraries, then you might want to use $majonly.
8271 Or, your system might be quite happy with a simple libperl.$so.
8272
8273 Since the shared libperl will get installed into a version-specific
8274 architecture-dependent directory, the version number of the shared perl
8275 library probably isn't important, so the default should be o.k.
8276
8277 EOM
8278         rp='What name do you want to give to the shared libperl?'
8279         . ./myread
8280         libperl=$ans
8281         echo "Ok, I'll use $libperl"
8282         ;;
8283 *)
8284         libperl="libperl${_a}"
8285         ;;
8286 esac
8287
8288 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8289 case "$shrpdir" in
8290 '') ;;
8291 *)      $cat >&4 <<EOM
8292 WARNING:  Use of the shrpdir variable for the installation location of
8293 the shared $libperl is not supported.  It was never documented and
8294 will not work in this version.  Let me (perlbug@perl.org)
8295 know of any problems this may cause.
8296
8297 EOM
8298         case "$shrpdir" in
8299         "$archlibexp/CORE")
8300                 $cat >&4 <<EOM
8301 But your current setting of $shrpdir is
8302 the default anyway, so it's harmless.
8303 EOM
8304                 ;;
8305         *)
8306                 $cat >&4 <<EOM
8307 Further, your current attempted setting of $shrpdir
8308 conflicts with the value of $archlibexp/CORE
8309 that installperl will use.
8310 EOM
8311                 ;;
8312         esac
8313         ;;
8314 esac
8315
8316 # How will the perl executable find the installed shared $libperl?
8317 # Add $xxx to ccdlflags.
8318 # If we can't figure out a command-line option, use $shrpenv to
8319 # set env LD_RUN_PATH.  The main perl makefile uses this.
8320 shrpdir=$archlibexp/CORE
8321 xxx=''
8322 tmp_shrpenv=''
8323 if "$useshrplib"; then
8324     case "$osname" in
8325         aix)
8326                 # We'll set it in Makefile.SH...
8327                 ;;
8328         solaris)
8329                 xxx="-R $shrpdir"
8330                 ;;
8331         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8332                 xxx="-Wl,-R$shrpdir"
8333                 ;;
8334         bsdos|linux|irix*|dec_osf|gnu*)
8335                 xxx="-Wl,-rpath,$shrpdir"
8336                 ;;
8337         next)
8338                 # next doesn't like the default...
8339                 ;;
8340         haiku)
8341                 # Haiku doesn't like the default, either.
8342                 ;;
8343         hpux*)
8344                 # hpux doesn't like the default, either.
8345                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8346                 ;;
8347         cygwin)
8348                 # cygwin needs only ldlibpth
8349                 ;;
8350         *)
8351                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8352                 ;;
8353         esac
8354         case "$xxx" in
8355         '') ;;
8356         *)
8357                 # Only add $xxx if it isn't already in ccdlflags.
8358                 case " $ccdlflags " in
8359                 *" $xxx "*)     ;;
8360                 *)      ccdlflags="$ccdlflags $xxx"
8361                         cat <<EOM >&4
8362
8363 Adding $xxx to the flags
8364 passed to $ld so that the perl executable will find the
8365 installed shared $libperl.
8366
8367 EOM
8368                         ;;
8369                 esac
8370                 ;;
8371         esac
8372 fi
8373 # Fix ccdlflags in AIX for building external extensions.
8374 # (For building Perl itself bare -bE:perl.exp is needed,
8375 #  Makefile.SH takes care of this.)
8376 case "$osname" in
8377 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8378 esac
8379 # Respect a hint or command-line value.
8380 case "$shrpenv" in
8381 '') shrpenv="$tmp_shrpenv" ;;
8382 esac
8383 case "$ldlibpthname" in
8384 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8385 none)   ldlibpthname='' ;;
8386 esac
8387
8388 : determine where manual pages are on this system
8389 echo " "
8390 case "$sysman" in
8391 '')
8392         syspath='/usr/share/man/man1 /usr/man/man1'
8393         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8394         syspath="$syspath /usr/man/u_man/man1"
8395         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8396         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8397         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8398         sysman=`./loc . /usr/man/man1 $syspath`
8399         ;;
8400 esac
8401 if $test -d "$sysman"; then
8402         echo "System manual is in $sysman." >&4
8403 else
8404         echo "Could not find manual pages in source form." >&4
8405 fi
8406
8407 : determine where manual pages go
8408 set man1dir man1dir none
8409 eval $prefixit
8410 $cat <<EOM
8411
8412 $spackage has manual pages available in source form.
8413 EOM
8414 case "$nroff" in
8415 nroff)
8416         echo "However, you don't have nroff, so they're probably useless to you."
8417         case "$man1dir" in
8418         '') man1dir="none";;
8419         esac;;
8420 esac
8421 echo "If you don't want the manual sources installed, answer 'none'."
8422 case "$man1dir" in
8423 ' ') dflt=none
8424         ;;
8425 '')
8426         lookpath="$prefixexp/share/man/man1"
8427         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8428         lookpath="$lookpath $prefixexp/man/p_man/man1"
8429         lookpath="$lookpath $prefixexp/man/u_man/man1"
8430         lookpath="$lookpath $prefixexp/man/man.1"
8431         case "$sysman" in
8432         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8433         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8434         esac
8435         set dflt
8436         eval $prefixup
8437         ;;
8438 *)  dflt="$man1dir"
8439         ;;
8440 esac
8441 echo " "
8442 fn=dn+~
8443 rp="Where do the main $spackage manual pages (source) go?"
8444 . ./getfile
8445 if $test "X$man1direxp" != "X$ansexp"; then
8446         installman1dir=''
8447 fi
8448 prefixvar=man1dir
8449 . ./setprefixvar
8450
8451 case "$man1dir" in
8452 '')     man1dir=' '
8453         installman1dir='';;
8454 esac
8455
8456 : What suffix to use on installed man pages
8457
8458 case "$man1dir" in
8459 ' ')
8460         man1ext='0'
8461         ;;
8462 *)
8463         rp="What suffix should be used for the main $spackage man pages?"
8464         case "$man1ext" in
8465         '')     case "$man1dir" in
8466                 *1)  dflt=1 ;;
8467                 *1p) dflt=1p ;;
8468                 *1pm) dflt=1pm ;;
8469                 *l) dflt=l;;
8470                 *n) dflt=n;;
8471                 *o) dflt=o;;
8472                 *p) dflt=p;;
8473                 *C) dflt=C;;
8474                 *L) dflt=L;;
8475                 *L1) dflt=L1;;
8476                 *) dflt=1;;
8477                 esac
8478                 ;;
8479         *)      dflt="$man1ext";;
8480         esac
8481         . ./myread
8482         man1ext="$ans"
8483         ;;
8484 esac
8485
8486 : see if we can have long filenames
8487 echo " "
8488 first=123456789abcdef
8489 $rm -f $first
8490 if (echo hi >$first) 2>/dev/null; then
8491         if $test -f 123456789abcde; then
8492                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8493                 val="$undef"
8494         else
8495                 echo 'You can have filenames longer than 14 characters.'>&4
8496                 val="$define"
8497         fi
8498 else
8499         $cat <<'EOM'
8500 You can't have filenames longer than 14 chars.
8501 You can't even think about them!
8502 EOM
8503         val="$undef"
8504 fi
8505 set d_flexfnam
8506 eval $setvar
8507 $rm -rf 123456789abcde*
8508
8509 : determine where library module manual pages go
8510 set man3dir man3dir none
8511 eval $prefixit
8512 $cat <<EOM
8513
8514 $spackage has manual pages for many of the library modules.
8515 EOM
8516
8517 case "$nroff" in
8518 nroff)
8519         $cat <<'EOM'
8520 However, you don't have nroff, so they're probably useless to you.
8521 EOM
8522         case "$man3dir" in
8523         '') man3dir="none";;
8524         esac;;
8525 esac
8526
8527 case "$d_flexfnam" in
8528 undef)
8529         $cat <<'EOM'
8530 However, your system can't handle the long file names like File::Basename.3.
8531 EOM
8532         case "$man3dir" in
8533         '') man3dir="none";;
8534         esac;;
8535 esac
8536
8537 echo "If you don't want the manual sources installed, answer 'none'."
8538 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8539 case "$man3dir" in
8540 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8541         if $test -d "$privlib/man/man3"; then
8542                 cat <<EOM >&4
8543
8544 WARNING:  Previous versions of perl installed man3 pages into
8545 $privlib/man/man3.  This version will suggest a
8546 new default of $dflt.
8547 EOM
8548                 tdflt=$dflt
8549                 dflt='n'
8550                 rp='Do you wish to preserve the old behavior?(y/n)'
8551                 . ./myread
8552                 case "$ans" in
8553                 y*) dflt="$privlib/man/man3" ;;
8554                 *)  dflt=$tdflt ;;
8555                 esac
8556     fi
8557         ;;
8558 *)      dflt="$man3dir" ;;
8559 esac
8560 case "$dflt" in
8561 ' ') dflt=none ;;
8562 esac
8563 echo " "
8564 fn=dn+~
8565 rp="Where do the $package library man pages (source) go?"
8566 . ./getfile
8567 prefixvar=man3dir
8568 . ./setprefixvar
8569
8570 case "$man3dir" in
8571 '')     man3dir=' '
8572         installman3dir='';;
8573 esac
8574
8575 : What suffix to use on installed man pages
8576 case "$man3dir" in
8577 ' ')
8578         man3ext='0'
8579         ;;
8580 *)
8581         rp="What suffix should be used for the $package library man pages?"
8582         case "$man3ext" in
8583         '')     case "$man3dir" in
8584                 *3)  dflt=3 ;;
8585                 *3p) dflt=3p ;;
8586                 *3pm) dflt=3pm ;;
8587                 *l) dflt=l;;
8588                 *n) dflt=n;;
8589                 *o) dflt=o;;
8590                 *p) dflt=p;;
8591                 *C) dflt=C;;
8592                 *L) dflt=L;;
8593                 *L3) dflt=L3;;
8594                 *) dflt=3;;
8595                 esac
8596                 ;;
8597         *)      dflt="$man3ext";;
8598         esac
8599         . ./myread
8600         man3ext="$ans"
8601         ;;
8602 esac
8603
8604 : see if we have to deal with yellow pages, now NIS.
8605 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8606         if $test -f /usr/etc/nibindd; then
8607                 echo " "
8608                 echo "I'm fairly confident you're on a NeXT."
8609                 echo " "
8610                 rp='Do you get the hosts file via NetInfo?'
8611                 dflt=y
8612                 case "$hostcat" in
8613                 nidump*) ;;
8614                 '') ;;
8615                 *) dflt=n;;
8616                 esac
8617                 . ./myread
8618                 case "$ans" in
8619                 y*) hostcat='nidump hosts .';;
8620                 *)      case "$hostcat" in
8621                         nidump*) hostcat='';;
8622                         esac
8623                         ;;
8624                 esac
8625         fi
8626         case "$hostcat" in
8627         nidump*) ;;
8628         *)
8629                 case "$hostcat" in
8630                 *ypcat*) dflt=y;;
8631                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8632                                 dflt=y
8633                         else
8634                                 dflt=n
8635                         fi;;
8636                 *) dflt=n;;
8637                 esac
8638                 echo " "
8639                 rp='Are you getting the hosts file via yellow pages?'
8640                 . ./myread
8641                 case "$ans" in
8642                 y*) hostcat='ypcat hosts';;
8643                 *) hostcat='cat /etc/hosts';;
8644                 esac
8645                 ;;
8646         esac
8647 fi
8648 case "$hostcat" in
8649 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8650 esac
8651 case "$groupcat" in
8652 '') test -f /etc/group && groupcat='cat /etc/group';;
8653 esac
8654 case "$passcat" in
8655 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8656 esac
8657
8658 : now get the host name
8659 echo " "
8660 echo "Figuring out host name..." >&4
8661 case "$myhostname" in
8662 '') cont=true
8663         echo 'Maybe "hostname" will work...'
8664         if tans=`sh -c hostname 2>&1` ; then
8665                 myhostname=$tans
8666                 phostname=hostname
8667                 cont=''
8668         fi
8669         ;;
8670 *) cont='';;
8671 esac
8672 if $test "$cont"; then
8673         if ./xenix; then
8674                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8675                 if tans=`cat /etc/systemid 2>&1` ; then
8676                         myhostname=$tans
8677                         phostname='cat /etc/systemid'
8678                         echo "Whadyaknow.  Xenix always was a bit strange..."
8679                         cont=''
8680                 fi
8681         elif $test -r /etc/systemid; then
8682                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8683         fi
8684 fi
8685 if $test "$cont"; then
8686         echo 'No, maybe "uuname -l" will work...'
8687         if tans=`sh -c 'uuname -l' 2>&1` ; then
8688                 myhostname=$tans
8689                 phostname='uuname -l'
8690         else
8691                 echo 'Strange.  Maybe "uname -n" will work...'
8692                 if tans=`sh -c 'uname -n' 2>&1` ; then
8693                         myhostname=$tans
8694                         phostname='uname -n'
8695                 else
8696                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8697                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8698                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8699                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8700                         else
8701                                 case "$myhostname" in
8702                                 '') echo "Does this machine have an identity crisis or something?"
8703                                         phostname='';;
8704                                 *)
8705                                         echo "Well, you said $myhostname before..."
8706                                         phostname='echo $myhostname';;
8707                                 esac
8708                         fi
8709                 fi
8710         fi
8711 fi
8712 case "$myhostname" in
8713 '') myhostname=noname ;;
8714 esac
8715 : you do not want to know about this
8716 set $myhostname
8717 myhostname=$1
8718
8719 : verify guess
8720 if $test "$myhostname" ; then
8721         dflt=y
8722         rp='Your host name appears to be "'$myhostname'".'" Right?"
8723         . ./myread
8724         case "$ans" in
8725         y*) ;;
8726         *) myhostname='';;
8727         esac
8728 fi
8729
8730 : bad guess or no guess
8731 while $test "X$myhostname" = X ; do
8732         dflt=''
8733         rp="Please type the (one word) name of your host:"
8734         . ./myread
8735         myhostname="$ans"
8736 done
8737
8738 : translate upper to lower if necessary
8739 case "$myhostname" in
8740 *[A-Z]*)
8741         echo "(Normalizing case in your host name)"
8742         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8743         ;;
8744 esac
8745
8746 case "$myhostname" in
8747 *.*)
8748         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8749         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8750         echo "(Trimming domain name from host name--host name is now $myhostname)"
8751         ;;
8752 *) case "$mydomain" in
8753         '')
8754                 {
8755                         test "X$hostcat" = "Xypcat hosts" &&
8756                         ypmatch "$myhostname" hosts 2>/dev/null |\
8757                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8758                         $test -s hosts
8759                 } || {
8760                         test "X$hostcat" != "X" &&
8761                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8762                                         /[       ]$myhostname[  . ]/p" > hosts
8763                 }
8764                 tmp_re="[       . ]"
8765                 if $test -f hosts; then
8766                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8767                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8768                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8769                                 hosts | $sort | $uniq | \
8770                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8771                         case `$echo X$dflt` in
8772                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8773                                 dflt=.
8774                                 ;;
8775                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8776                                 ;;
8777                         esac
8778                 else
8779                         echo "(I cannot locate a hosts database anywhere)"
8780                         dflt=.
8781                 fi
8782                 case "$dflt" in
8783                 .)
8784                         tans=`./loc resolv.conf X /etc /usr/etc`
8785                         if $test -f "$tans"; then
8786                                 echo "(Attempting domain name extraction from $tans)"
8787                                 dflt=.`$sed -n -e 's/   / /g' \
8788                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8789                                   -e 1q 2>/dev/null`
8790                                 case "$dflt" in
8791                                 .) dflt=.`$sed -n -e 's/        / /g' \
8792                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8793                                      -e 1q 2>/dev/null`
8794                                         ;;
8795                                 esac
8796                         fi
8797                         ;;
8798                 esac
8799                 case "$dflt" in
8800                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8801                         dflt=.`sh -c domainname 2>/dev/null`
8802                         case "$dflt" in
8803                         '') dflt='.';;
8804                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8805                         esac
8806                         ;;
8807                 esac
8808                 case "$dflt$osname" in
8809                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8810                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8811                         ;;
8812                 esac
8813                 case "$dflt" in
8814                 .) echo "(Lost all hope -- silly guess then)"
8815                         dflt='.nonet'
8816                         ;;
8817                 esac
8818                 $rm -f hosts
8819                 ;;
8820         *) dflt="$mydomain";;
8821         esac;;
8822 esac
8823 echo " "
8824 rp="What is your domain name?"
8825 . ./myread
8826 tans="$ans"
8827 case "$ans" in
8828 '') ;;
8829 .*) ;;
8830 *) tans=".$tans";;
8831 esac
8832 mydomain="$tans"
8833
8834 : translate upper to lower if necessary
8835 case "$mydomain" in
8836 *[A-Z]*)
8837         echo "(Normalizing case in your domain name)"
8838         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8839         ;;
8840 esac
8841
8842 : a little sanity check here
8843 case "$phostname" in
8844 '') ;;
8845 *)
8846         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8847         $myhostname$mydomain|$myhostname) ;;
8848         *)
8849                 case "$phostname" in
8850                 sed*)
8851                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8852                         ;;
8853                 *)
8854                         echo "(That doesn't agree with your $phostname command, by the way.)"
8855                         ;;
8856                 esac
8857         ;;
8858         esac
8859         ;;
8860 esac
8861
8862 : determine the e-mail address of the user who is running us
8863 $cat <<EOM
8864
8865 I need to get your e-mail address in Internet format if possible, i.e.
8866 something like user@host.domain. Please answer accurately since I have
8867 no easy means to double check it. The default value provided below
8868 is most probably close to reality but may not be valid from outside
8869 your organization...
8870
8871 EOM
8872 cont=x
8873 while test "$cont"; do
8874         case "$MAILDOMAIN" in
8875         '')
8876                 if $test -s /etc/mailname; then
8877                         maildomain=`$cat /etc/mailname`
8878                 else
8879                         maildomain="$myhostname$mydomain"
8880                 fi
8881                 ;;
8882         *)  maildomain="$MAILDOMAIN";;
8883         esac
8884         case "$cf_email" in
8885         '') dflt="$cf_by@$maildomain";;
8886         *)  dflt="$cf_email";;
8887         esac
8888         rp='What is your e-mail address?'
8889         . ./myread
8890         cf_email="$ans"
8891         case "$cf_email" in
8892         *@*.*) cont='' ;;
8893         *)
8894                 rp='Address does not look like an Internet one.  Use it anyway?'
8895                 case "$fastread" in
8896                 yes) dflt=y ;;
8897                 *) dflt=n ;;
8898                 esac
8899                 . ./myread
8900                 case "$ans" in
8901                 y*) cont='' ;;
8902                 *) echo " " ;;
8903                 esac
8904                 ;;
8905         esac
8906 done
8907
8908 : Ask e-mail of administrator
8909 $cat <<EOM
8910
8911 If you or somebody else will be maintaining perl at your site, please
8912 fill in the correct e-mail address here so that they may be contacted
8913 if necessary. Currently, the "perlbug" program included with perl
8914 will send mail to this address in addition to perlbug@perl.org. You may
8915 enter "none" for no administrator.
8916
8917 EOM
8918 case "$perladmin" in
8919 '') dflt="$cf_email";;
8920 *) dflt="$perladmin";;
8921 esac
8922 rp='Perl administrator e-mail address'
8923 . ./myread
8924 perladmin="$ans"
8925
8926 : determine whether to only install version-specific parts.
8927 echo " "
8928 $cat <<EOM
8929 Do you want to install only the version-specific parts of the perl
8930 distribution?  Usually you do *not* want to do this.
8931 EOM
8932 case "$versiononly" in
8933 "$define"|[Yy]*|true) dflt='y' ;;
8934 *) dflt='n';
8935 esac
8936 rp="Do you want to install only the version-specific parts of perl?"
8937 . ./myread
8938 case "$ans" in
8939 [yY]*)  val="$define";;
8940 *)      val="$undef" ;;
8941 esac
8942 set versiononly
8943 eval $setvar
8944
8945 case "$versiononly" in
8946 "$define") inc_version_list=''
8947            inc_version_list_init=0
8948            ;;
8949 esac
8950
8951 : figure out how to guarantee perl startup
8952 : XXX Note that this currently takes advantage of the bug that binexp ignores
8953 :     the Configure -Dinstallprefix setting, which in turn means that under
8954 :     relocatable @INC, initialinstalllocation is what binexp started as.
8955 case "$startperl" in
8956 '')
8957         case "$sharpbang" in
8958         *!)
8959                 $cat <<EOH
8960
8961 I can use the #! construct to start perl on your system. This will
8962 make startup of perl scripts faster, but may cause problems if you
8963 want to share those scripts and perl is not in a standard place
8964 ($initialinstalllocation/perl) on all your platforms. The alternative
8965 is to force a shell by starting the script with a single ':' character.
8966
8967 EOH
8968                 case "$versiononly" in
8969                 "$define")      dflt="$initialinstalllocation/perl$version";;
8970                 *)              dflt="$initialinstalllocation/perl";;
8971                 esac
8972                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8973                 . ./myread
8974                 case "$ans" in
8975                 none)   startperl=": # use perl";;
8976                 *)      startperl="#!$ans"
8977                         if $test 30 -lt `echo "$ans" | wc -c`; then
8978                                 $cat >&4 <<EOM
8979
8980 WARNING:  Some systems limit the #! command to 32 characters.
8981 If you experience difficulty running Perl scripts with #!, try
8982 installing Perl in a directory with a shorter pathname.
8983
8984 EOM
8985                         fi ;;
8986                 esac
8987                 ;;
8988         *) startperl=": # use perl"
8989                 ;;
8990         esac
8991         ;;
8992 esac
8993 echo "I'll use $startperl to start perl scripts."
8994
8995 : figure best path for perl in scripts
8996 case "$perlpath" in
8997 '')
8998         case "$versiononly" in
8999         "$define")      perlpath="$initialinstalllocation/perl$version";;
9000         *)              perlpath="$initialinstalllocation/perl";;
9001         esac
9002         case "$startperl" in
9003         *!*) ;;
9004         *)
9005                 $cat <<EOH
9006
9007 I will use the "eval 'exec'" idiom to start Perl on your system.
9008 I can use the full path of your Perl binary for this purpose, but
9009 doing so may cause problems if you want to share those scripts and
9010 Perl is not always in a standard place ($initialinstalllocation/perl).
9011
9012 EOH
9013                 dflt="$initialinstalllocation/perl"
9014                 rp="What path shall I use in \"eval 'exec'\"?"
9015                 . ./myread
9016                 perlpath="$ans"
9017                 ;;
9018         esac
9019         ;;
9020 esac
9021 case "$startperl" in
9022 *!*)    ;;
9023 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9024 esac
9025
9026 : determine where public executable scripts go
9027 set scriptdir scriptdir
9028 eval $prefixit
9029 case "$scriptdir" in
9030 '')
9031         dflt="$bin"
9032         : guess some guesses
9033         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9034         $test -d /usr/share/bin     && dflt=/usr/share/bin
9035         $test -d /usr/local/script  && dflt=/usr/local/script
9036         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9037         $test -d $prefixexp/script  && dflt=$prefixexp/script
9038         set dflt
9039         eval $prefixup
9040         ;;
9041 *)  dflt="$scriptdir"
9042         ;;
9043 esac
9044 $cat <<EOM
9045
9046 Some installations have a separate directory just for executable scripts so
9047 that they can mount it across multiple architectures but keep the scripts in
9048 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9049 Or you might just lump your scripts in with all your other executables.
9050
9051 EOM
9052 fn=d~
9053 rp='Where do you keep publicly executable scripts?'
9054 . ./getfile
9055 if $test "X$ansexp" != "X$scriptdirexp"; then
9056         installscript=''
9057 fi
9058 installscriptdir=''
9059 prefixvar=scriptdir
9060 . ./setprefixvar
9061 : A little fix up for an irregularly named variable.
9062 installscript="$installscriptdir"
9063
9064 : determine where add-on public executables go
9065 case "$sitebin" in
9066 '')     dflt=$siteprefix/bin ;;
9067 *)      dflt=$sitebin ;;
9068 esac
9069 fn=d~
9070 rp='Pathname where the add-on public executables should be installed?'
9071 . ./getfile
9072 prefixvar=sitebin
9073 . ./setprefixvar
9074
9075 : determine where add-on html pages go
9076 : There is no standard location, so try to copy the previously-selected
9077 : directory structure for the core html pages.
9078 case "$sitehtml1dir" in
9079 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9080 *)     dflt=$sitehtml1dir ;;
9081 esac
9082 case "$dflt" in
9083 ''|' ') dflt=none ;;
9084 esac
9085 fn=dn+~
9086 rp='Pathname where the site-specific html pages should be installed?'
9087 . ./getfile
9088 prefixvar=sitehtml1dir
9089 . ./setprefixvar
9090
9091 : determine where add-on library html pages go
9092 : There is no standard location, so try to copy the previously-selected
9093 : directory structure for the core html pages.
9094 case "$sitehtml3dir" in
9095 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9096 *)     dflt=$sitehtml3dir ;;
9097 esac
9098 case "$dflt" in
9099 ''|' ') dflt=none ;;
9100 esac
9101 fn=dn+~
9102 rp='Pathname where the site-specific library html pages should be installed?'
9103 . ./getfile
9104 prefixvar=sitehtml3dir
9105 . ./setprefixvar
9106
9107 : determine where add-on manual pages go
9108 case "$siteman1dir" in
9109 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9110 *)      dflt=$siteman1dir ;;
9111 esac
9112 case "$dflt" in
9113 ''|' ') dflt=none ;;
9114 esac
9115 fn=dn+~
9116 rp='Pathname where the site-specific manual pages should be installed?'
9117 . ./getfile
9118 prefixvar=siteman1dir
9119 . ./setprefixvar
9120
9121 : determine where add-on library man pages go
9122 case "$siteman3dir" in
9123 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9124 *)      dflt=$siteman3dir ;;
9125 esac
9126 case "$dflt" in
9127 ''|' ') dflt=none ;;
9128 esac
9129 fn=dn+~
9130 rp='Pathname where the site-specific library manual pages should be installed?'
9131 . ./getfile
9132 prefixvar=siteman3dir
9133 . ./setprefixvar
9134
9135 : determine where add-on public executable scripts go
9136 case "$sitescript" in
9137 '')     dflt=$siteprefix/script
9138         $test -d $dflt || dflt=$sitebin ;;
9139 *)  dflt="$sitescript" ;;
9140 esac
9141 fn=d~+
9142 rp='Pathname where add-on public executable scripts should be installed?'
9143 . ./getfile
9144 prefixvar=sitescript
9145 . ./setprefixvar
9146
9147 : Check if faststdio is requested and available
9148 case "$usefaststdio" in
9149 $define|true|[yY]*|'')
9150         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9151         case "$xversion" in
9152         [68])   dflt='y' ;;
9153         *)      dflt='n' ;;
9154         esac
9155         ;;
9156 *) dflt='n';;
9157 esac
9158 cat <<EOM
9159
9160 Perl can be built to use 'fast stdio', which means using the stdio
9161 library but also directly manipulating the stdio buffers to enable
9162 faster I/O.  Using stdio is better for backward compatibility (especially
9163 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9164 interface has been preferred instead of stdio.
9165
9166 If this doesn't make any sense to you, just accept the default '$dflt'.
9167 EOM
9168 rp='Use the "fast stdio" if available?'
9169 . ./myread
9170 case "$ans" in
9171 y|Y)    val="$define" ;;
9172 *)      val="$undef" ;;
9173 esac
9174 set usefaststdio
9175 eval $setvar
9176
9177
9178 : define an is-a-typedef? function
9179 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9180 case "$inclist" in
9181 "") inclist="sys/types.h";;
9182 esac;
9183 eval "varval=\$$var";
9184 case "$varval" in
9185 "")
9186         $rm -f temp.c;
9187         for inc in $inclist; do
9188                 echo "#include <$inc>" >>temp.c;
9189         done;
9190         echo "#ifdef $type" >> temp.c;
9191         echo "printf(\"We have $type\");" >> temp.c;
9192         echo "#endif" >> temp.c;
9193         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9194         if $contains $type temp.E >/dev/null 2>&1; then
9195                 eval "$var=\$type";
9196         else
9197                 eval "$var=\$def";
9198         fi;
9199         $rm -f temp.?;;
9200 *) eval "$var=\$varval";;
9201 esac'
9202
9203 : define an is-a-typedef? function that prompts if the type is not available.
9204 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9205 case "$inclist" in
9206 "") inclist="sys/types.h";;
9207 esac;
9208 eval "varval=\$$var";
9209 case "$varval" in
9210 "")
9211         $rm -f temp.c;
9212         for inc in $inclist; do
9213                 echo "#include <$inc>" >>temp.c;
9214         done;
9215         echo "#ifdef $type" >> temp.c;
9216         echo "printf(\"We have $type\");" >> temp.c;
9217         echo "#endif" >> temp.c;
9218         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9219         echo " " ;
9220         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9221         if $contains $type temp.E >/dev/null 2>&1; then
9222                 echo "$type found." >&4;
9223                 eval "$var=\$type";
9224         else
9225                 echo "$type NOT found." >&4;
9226                 dflt="$def";
9227                 . ./myread ;
9228                 eval "$var=\$ans";
9229         fi;
9230         $rm -f temp.?;;
9231 *) eval "$var=\$varval";;
9232 esac'
9233
9234 : see what type lseek is declared as in the kernel
9235 rp="What is the type used for lseek's offset on this system?"
9236 set off_t lseektype long stdio.h sys/types.h
9237 eval $typedef_ask
9238
9239 echo " "
9240 echo "Checking to see how big your file offsets are..." >&4
9241 $cat >try.c <<EOCP
9242 #include <sys/types.h>
9243 #include <stdio.h>
9244 int main()
9245 {
9246     printf("%d\n", (int)sizeof($lseektype));
9247     return(0);
9248 }
9249 EOCP
9250 set try
9251 if eval $compile_ok; then
9252         lseeksize=`$run ./try`
9253         echo "Your file offsets are $lseeksize bytes long."
9254 else
9255         dflt=$longsize
9256         echo " "
9257         echo "(I can't seem to compile the test program.  Guessing...)"
9258         rp="What is the size of your file offsets (in bytes)?"
9259         . ./myread
9260         lseeksize="$ans"
9261 fi
9262 $rm_try
9263
9264 : see what type file positions are declared as in the library
9265 rp="What is the type for file position used by fsetpos()?"
9266 set fpos_t fpostype long stdio.h sys/types.h
9267 eval $typedef_ask
9268
9269 : Check size for Fpos_t
9270 echo " "
9271 case "$fpostype" in
9272 *_t) zzz="$fpostype"    ;;
9273 *)   zzz="fpos_t"       ;;
9274 esac
9275 echo "Checking the size of $zzz..." >&4
9276 cat > try.c <<EOCP
9277 #include <sys/types.h>
9278 #include <stdio.h>
9279 #$i_stdlib I_STDLIB
9280 #ifdef I_STDLIB
9281 #include <stdlib.h>
9282 #endif
9283 int main() {
9284     printf("%d\n", (int)sizeof($fpostype));
9285     exit(0);
9286 }
9287 EOCP
9288 set try
9289 if eval $compile_ok; then
9290         yyy=`$run ./try`
9291         case "$yyy" in
9292         '')     fpossize=4
9293                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9294                 ;;
9295         *)      fpossize=$yyy
9296                 echo "Your $zzz is $fpossize bytes long."
9297                 ;;
9298         esac
9299 else
9300         dflt="$longsize"
9301         echo " " >&4
9302         echo "(I can't compile the test program.  Guessing...)" >&4
9303         rp="What is the size of your file positions (in bytes)?"
9304         . ./myread
9305         fpossize="$ans"
9306 fi
9307
9308 : Check for large file support
9309 # Backward compatibility (uselfs is deprecated).
9310 case "$uselfs" in
9311 "$define"|true|[yY]*)
9312         cat <<EOM >&4
9313
9314 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9315 EOM
9316         uselargefiles="$define"
9317         ;;
9318 esac
9319
9320 case "$lseeksize:$fpossize" in
9321 8:8) cat <<EOM
9322
9323 You can have files larger than 2 gigabytes.
9324 EOM
9325    val="$define" ;;
9326 *)    case "$uselargefiles" in
9327    "$undef"|false|[nN]*) dflt='n' ;;
9328    *)   dflt='y' ;;
9329    esac
9330    cat <<EOM
9331
9332 Perl can be built to understand large files (files larger than 2 gigabytes)
9333 on some systems.  To do so, Configure can be run with -Duselargefiles.
9334
9335 If this doesn't make any sense to you, just accept the default '$dflt'.
9336 EOM
9337    rp='Try to understand large files, if available?'
9338    . ./myread
9339    case "$ans" in
9340    y|Y)         val="$define" ;;
9341    *)           val="$undef"  ;;
9342    esac
9343    ;;
9344 esac
9345 set uselargefiles
9346 eval $setvar
9347 : Look for a hint-file generated 'call-back-unit'.  If the
9348 : user has specified that a large files perl is to be built,
9349 : we may need to set or change some other defaults.
9350 if $test -f uselargefiles.cbu; then
9351         echo "Your platform has some specific hints regarding large file builds, using them..."
9352         . ./uselargefiles.cbu
9353 fi
9354 case "$uselargefiles" in
9355 "$define")
9356         if $test -f uselargefiles.cbu; then
9357                 echo " "
9358                 echo "Rechecking to see how big your file offsets are..." >&4
9359                 $cat >try.c <<EOCP
9360 #include <sys/types.h>
9361 #include <stdio.h>
9362 int main()
9363 {
9364     printf("%d\n", (int)sizeof($lseektype));
9365     return(0);
9366 }
9367 EOCP
9368                 set try
9369                 if eval $compile_ok; then
9370                         lseeksize=`$run ./try`
9371                         $echo "Your file offsets are now $lseeksize bytes long."
9372                 else
9373                         dflt="$lseeksize"
9374                         echo " "
9375                         echo "(I can't seem to compile the test program.  Guessing...)"
9376                         rp="What is the size of your file offsets (in bytes)?"
9377                         . ./myread
9378                         lseeksize="$ans"
9379                 fi
9380                 case "$fpostype" in
9381                 *_t) zzz="$fpostype"    ;;
9382                 *)   zzz="fpos_t"       ;;
9383                 esac
9384                 $echo $n "Rechecking the size of $zzz...$c" >&4
9385                 $cat > try.c <<EOCP
9386 #include <sys/types.h>
9387 #include <stdio.h>
9388 #$i_stdlib I_STDLIB
9389 #ifdef I_STDLIB
9390 #include <stdlib.h>
9391 #endif
9392 int main() {
9393     printf("%d\n", (int)sizeof($fpostype));
9394     return(0);
9395 }
9396 EOCP
9397                 set try
9398                 if eval $compile_ok; then
9399                         yyy=`$run ./try`
9400                         dflt="$lseeksize"
9401                         case "$yyy" in
9402                         '')     echo " "
9403                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9404                                 ;;
9405                         *)      fpossize=$yyy
9406                                 echo " $fpossize bytes." >&4
9407                                 ;;
9408                         esac
9409                 else
9410                         dflt="$fpossize"
9411                         echo " "
9412                         echo "(I can't compile the test program.  Guessing...)" >&4
9413                         rp="What is the size of your file positions (in bytes)?"
9414                         . ./myread
9415                         fpossize="$ans"
9416                 fi
9417                 $rm_try
9418         fi
9419         ;;
9420 esac
9421
9422 : Check if we want perlio
9423 useperlio="$define"
9424
9425 : Set the vendorbin variables
9426 case "$vendorprefix" in
9427 '')     d_vendorbin="$undef"
9428         vendorbin=''
9429         vendorbinexp=''
9430         ;;
9431 *)      d_vendorbin="$define"
9432         : determine where vendor-supplied executables go.
9433         case "$vendorbin" in
9434         '') dflt=$vendorprefix/bin ;;
9435         *)      dflt="$vendorbin" ;;
9436         esac
9437         fn=d~+
9438         rp='Pathname for the vendor-supplied executables directory?'
9439         . ./getfile
9440         vendorbin="$ans"
9441         vendorbinexp="$ansexp"
9442         ;;
9443 esac
9444 prefixvar=vendorbin
9445 . ./installprefix
9446
9447 : Set the vendorhtml1dir variables
9448 case "$vendorprefix" in
9449 '')     vendorhtml1dir=''
9450         vendorhtml1direxp=''
9451         ;;
9452 *)      : determine where vendor-supplied html pages go.
9453         : There is no standard location, so try to copy the previously-selected
9454         : directory structure for the core html pages.
9455         : XXX Better default suggestions would be welcome.
9456         case "$vendorhtml1dir" in
9457         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9458         *)      dflt=$vendorhtml1dir ;;
9459         esac
9460         case "$dflt" in
9461         ''|' ') dflt=none ;;
9462         esac
9463         fn=dn+~
9464         rp='Pathname for the vendor-supplied html pages?'
9465         . ./getfile
9466         vendorhtml1dir="$ans"
9467         vendorhtml1direxp="$ansexp"
9468         ;;
9469 esac
9470 : Use ' ' for none so value is preserved next time through Configure
9471 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9472 prefixvar=vendorhtml1dir
9473 . ./installprefix
9474
9475 : Set the vendorhtml3dir variables
9476 case "$vendorprefix" in
9477 '')     vendorhtml3dir=''
9478         vendorhtml3direxp=''
9479         ;;
9480 *)      : determine where vendor-supplied module html pages go.
9481         : There is no standard location, so try to copy the previously-selected
9482         : directory structure for the core html pages.
9483         : XXX Better default suggestions would be welcome.
9484         case "$vendorhtml3dir" in
9485         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9486         *)      dflt=$vendorhtml3dir ;;
9487         esac
9488         case "$dflt" in
9489         ''|' ') dflt=none ;;
9490         esac
9491         fn=dn+~
9492         rp='Pathname for the vendor-supplied html pages?'
9493         . ./getfile
9494         vendorhtml3dir="$ans"
9495         vendorhtml3direxp="$ansexp"
9496         ;;
9497 esac
9498 : Use ' ' for none so value is preserved next time through Configure
9499 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9500 prefixvar=vendorhtml3dir
9501 . ./installprefix
9502
9503 : Set the vendorman1dir variables
9504 case "$vendorprefix" in
9505 '')     vendorman1dir=''
9506         vendorman1direxp=''
9507         ;;
9508 *)      : determine where vendor-supplied manual pages go.
9509         case "$vendorman1dir" in
9510         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9511         *)      dflt=$vendorman1dir ;;
9512         esac
9513         case "$dflt" in
9514         ''|' ') dflt=none ;;
9515         esac
9516         fn=nd~+
9517         rp='Pathname for the vendor-supplied manual section 1 pages?'
9518         . ./getfile
9519         vendorman1dir="$ans"
9520         vendorman1direxp="$ansexp"
9521         ;;
9522 esac
9523 : Use ' ' for none so value is preserved next time through Configure
9524 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9525 prefixvar=vendorman1dir
9526 . ./installprefix
9527
9528 : Set the vendorman3dir variables
9529 case "$vendorprefix" in
9530 '')     vendorman3dir=''
9531         vendorman3direxp=''
9532         ;;
9533 *)      : determine where vendor-supplied module manual pages go.
9534         case "$vendorman3dir" in
9535         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9536         *)      dflt=$vendorman3dir ;;
9537         esac
9538         case "$dflt" in
9539         ''|' ') dflt=none ;;
9540         esac
9541         fn=nd~+
9542         rp='Pathname for the vendor-supplied manual section 3 pages?'
9543         . ./getfile
9544         vendorman3dir="$ans"
9545         vendorman3direxp="$ansexp"
9546         ;;
9547 esac
9548 : Use ' ' for none so value is preserved next time through Configure
9549 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9550 prefixvar=vendorman3dir
9551 . ./installprefix
9552
9553 : Set the vendorscript variables
9554 case "$vendorprefix" in
9555 '')     d_vendorscript="$undef"
9556         vendorscript=''
9557         vendorscriptexp=''
9558         ;;
9559 *)      d_vendorscript="$define"
9560         : determine where vendor-supplied scripts go.
9561         case "$vendorscript" in
9562         '')     dflt=$vendorprefix/script
9563                 $test -d $dflt || dflt=$vendorbin ;;
9564         *)  dflt="$vendorscript" ;;
9565         esac
9566         $cat <<EOM
9567
9568 The installation process will create a directory for
9569 vendor-supplied scripts.
9570
9571 EOM
9572         fn=d~+
9573         rp='Pathname for the vendor-supplied scripts directory?'
9574         . ./getfile
9575         vendorscript="$ans"
9576         vendorscriptexp="$ansexp"
9577         ;;
9578 esac
9579 prefixvar=vendorscript
9580 . ./installprefix
9581
9582 : script used to emit important warnings
9583 cat >warn <<EOS
9584 $startsh
9585 if test \$# -gt 0; then
9586         echo "\$@" >msg
9587 else
9588         cat >msg
9589 fi
9590 echo "*** WARNING:" >&4
9591 sed -e 's/^/*** /' <msg >&4
9592 echo "*** " >&4
9593 cat msg >>config.msg
9594 echo " " >>config.msg
9595 rm -f msg
9596 EOS
9597 chmod +x warn
9598 $eunicefix warn
9599
9600 : see which of string.h or strings.h is needed
9601 echo " "
9602 strings=`./findhdr string.h`
9603 if $test "$strings" && $test -r "$strings"; then
9604         echo "Using <string.h> instead of <strings.h>." >&4
9605         val="$define"
9606 else
9607         val="$undef"
9608         strings=`./findhdr strings.h`
9609         if $test "$strings" && $test -r "$strings"; then
9610                 echo "Using <strings.h> instead of <string.h>." >&4
9611         else
9612                 ./warn "No string header found -- You'll surely have problems."
9613         fi
9614 fi
9615 set i_string
9616 eval $setvar
9617 case "$i_string" in
9618 "$undef") strings=`./findhdr strings.h`;;
9619 *)        strings=`./findhdr string.h`;;
9620 esac
9621
9622 : see if qgcvt exists
9623 set qgcvt d_qgcvt
9624 eval $inlibc
9625
9626 : Check print/scan long double stuff
9627 echo " "
9628
9629 if $test X"$d_longdbl" = X"$define"; then
9630
9631 echo "Checking how to print long doubles..." >&4
9632
9633 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9634         $cat >try.c <<'EOCP'
9635 #include <sys/types.h>
9636 #include <stdio.h>
9637 int main() {
9638   double d = 123.456;
9639   printf("%.3f\n", d);
9640 }
9641 EOCP
9642         set try
9643         if eval $compile; then
9644                 yyy=`$run ./try`
9645                 case "$yyy" in
9646                 123.456)
9647                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9648                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9649                         echo "We will use %f."
9650                         ;;
9651                 esac
9652         fi
9653 fi
9654
9655 if $test X"$sPRIfldbl" = X; then
9656         $cat >try.c <<'EOCP'
9657 #include <sys/types.h>
9658 #include <stdio.h>
9659 int main() {
9660   long double d = 123.456;
9661   printf("%.3Lf\n", d);
9662 }
9663 EOCP
9664         set try
9665         if eval $compile; then
9666                 yyy=`$run ./try`
9667                 case "$yyy" in
9668                 123.456)
9669                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9670                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9671                         echo "We will use %Lf."
9672                         ;;
9673                 esac
9674         fi
9675 fi
9676
9677 if $test X"$sPRIfldbl" = X; then
9678         $cat >try.c <<'EOCP'
9679 #include <sys/types.h>
9680 #include <stdio.h>
9681 int main() {
9682   long double d = 123.456;
9683   printf("%.3llf\n", d);
9684 }
9685 EOCP
9686         set try
9687         if eval $compile; then
9688                 yyy=`$run ./try`
9689                 case "$yyy" in
9690                 123.456)
9691                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9692                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9693                         echo "We will use %llf."
9694                         ;;
9695                 esac
9696         fi
9697 fi
9698
9699 if $test X"$sPRIfldbl" = X; then
9700         $cat >try.c <<'EOCP'
9701 #include <sys/types.h>
9702 #include <stdio.h>
9703 int main() {
9704   long double d = 123.456;
9705   printf("%.3lf\n", d);
9706 }
9707 EOCP
9708         set try
9709         if eval $compile; then
9710                 yyy=`$run ./try`
9711                 case "$yyy" in
9712                 123.456)
9713                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9714                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9715                         echo "We will use %lf."
9716                         ;;
9717                 esac
9718         fi
9719 fi
9720
9721 if $test X"$sPRIfldbl" = X; then
9722         echo "Cannot figure out how to print long doubles." >&4
9723 else
9724         sSCNfldbl=$sPRIfldbl    # expect consistency
9725 fi
9726
9727 $rm_try
9728
9729 fi # d_longdbl
9730
9731 case "$sPRIfldbl" in
9732 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9733         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9734         d_SCNfldbl="$undef";
9735         ;;
9736 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9737         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9738         d_SCNfldbl="$define";
9739         ;;
9740 esac
9741
9742 : Check how to convert floats to strings.
9743
9744 if test "X$d_Gconvert" = X; then
9745
9746 echo " "
9747 echo "Checking for an efficient way to convert floats to strings."
9748 echo " " > try.c
9749 case "$uselongdouble" in
9750 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9751 esac
9752 case "$d_longdbl" in
9753 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9754 esac
9755 case "$d_PRIgldbl" in
9756 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9757 esac
9758 $cat >>try.c <<EOP
9759 #ifdef TRY_gconvert
9760 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9761 char *myname = "gconvert";
9762 #endif
9763 #ifdef TRY_gcvt
9764 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9765 char *myname = "gcvt";
9766 #endif
9767 #ifdef TRY_qgcvt
9768 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9769 char *myname = "qgcvt";
9770 #define DOUBLETYPE long double
9771 #endif
9772 #ifdef TRY_sprintf
9773 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9774 #ifdef HAS_PRIgldbl
9775 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9776 #else
9777 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9778 #endif
9779 #else
9780 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9781 #endif
9782 char *myname = "sprintf";
9783 #endif
9784
9785 #ifndef DOUBLETYPE
9786 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9787 #define DOUBLETYPE long double
9788 #else
9789 #define DOUBLETYPE double
9790 #endif
9791 #endif
9792
9793 #include <stdio.h>
9794
9795 #$i_stdlib I_STDLIB
9796 #ifdef I_STDLIB
9797 #include <stdlib.h>
9798 #endif
9799 #$i_string I_STRING
9800 #ifdef I_STRING
9801 #  include <string.h>
9802 #else
9803 #  include <strings.h>
9804 #endif
9805
9806 int checkit(char *expect, char *got)
9807 {
9808     if (strcmp(expect, got)) {
9809                 printf("%s oddity:  Expected %s, got %s\n",
9810                         myname, expect, got);
9811                 exit(1);
9812         }
9813 }
9814
9815 int main()
9816 {
9817         char buf[64];
9818         buf[63] = '\0';
9819
9820         /* This must be 1st test on (which?) platform */
9821         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9822         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9823         checkit("0.1", buf);
9824
9825         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9826         checkit("0.01", buf);
9827
9828         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9829         checkit("0.001", buf);
9830
9831         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9832         checkit("0.0001", buf);
9833
9834         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9835         if (strlen(buf) > 5)
9836             checkit("9e-005", buf); /* for Microsoft ?? */
9837         else
9838             checkit("9e-05", buf);
9839
9840         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9841         checkit("1", buf);
9842
9843         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9844         checkit("1.1", buf);
9845
9846         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9847         checkit("1.01", buf);
9848
9849         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9850         checkit("1.001", buf);
9851
9852         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9853         checkit("1.0001", buf);
9854
9855         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9856         checkit("1.00001", buf);
9857
9858         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9859         checkit("1.000001", buf);
9860
9861         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9862         checkit("0", buf);
9863
9864         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9865         checkit("-1", buf);
9866
9867         /* Some Linux gcvt's give 1.e+5 here. */
9868         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9869         checkit("100000", buf);
9870
9871         /* Some Linux gcvt's give -1.e+5 here. */
9872         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9873         checkit("-100000", buf);
9874
9875         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9876         checkit("123.456", buf);
9877
9878         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9879         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9880         /* 34 should be enough to scare even long double
9881          * places into using the e notation. */
9882         if (strlen(buf) > 5)
9883             checkit("1e+034", buf); /* for Microsoft */
9884         else
9885             checkit("1e+34", buf);
9886
9887         /* For Perl, if you add additional tests here, also add them to
9888          * t/base/num.t for benefit of platforms not using Configure or
9889          * overriding d_Gconvert */
9890
9891         exit(0);
9892 }
9893 EOP
9894 : first add preferred functions to our list
9895 xxx_list=""
9896 for xxx_convert in $gconvert_preference; do
9897     case $xxx_convert in
9898     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9899     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9900     esac
9901 done
9902 : then add any others
9903 for xxx_convert in gconvert gcvt sprintf; do
9904     case "$xxx_list" in
9905     *$xxx_convert*) ;;
9906     *) xxx_list="$xxx_list $xxx_convert" ;;
9907     esac
9908 done
9909
9910 case "$d_longdbl$uselongdouble" in
9911 "$define$define")
9912     : again, add preferred functions to our list first
9913     xxx_ld_list=""
9914     for xxx_convert in $gconvert_ld_preference; do
9915         case $xxx_convert in
9916         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9917         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9918         esac
9919     done
9920     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9921     for xxx_convert in qgcvt sprintf $xxx_list; do
9922         case "$xxx_ld_list" in
9923         $xxx_convert*|*" $xxx_convert"*) ;;
9924         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9925         esac
9926     done
9927     : if sprintf cannot do long doubles, move it to the end
9928     if test "$d_PRIgldbl" != "$define"; then
9929         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9930     fi
9931     : if no qgcvt, remove it
9932     if test "$d_qgcvt" != "$define"; then
9933         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9934     fi
9935     : use the ld_list
9936     xxx_list="$xxx_ld_list"
9937     ;;
9938 esac
9939
9940 for xxx_convert in $xxx_list; do
9941         echo "Trying $xxx_convert..."
9942         $rm -f try try$_o core
9943         set try -DTRY_$xxx_convert
9944         if eval $compile; then
9945                 echo "$xxx_convert() found." >&4
9946                 if $run ./try; then
9947                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9948                         break;
9949                 else
9950                         echo "...But $xxx_convert didn't work as I expected."
9951                         xxx_convert=''
9952                 fi
9953         else
9954                 echo "$xxx_convert NOT found." >&4
9955         fi
9956 done
9957
9958 if test X$xxx_convert = X; then
9959     echo "*** WHOA THERE!!! ***" >&4
9960     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9961     xxx_convert=sprintf
9962 fi
9963
9964 case "$xxx_convert" in
9965 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9966 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9967 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9968 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9969    "$define$define$define")
9970       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9971    "$define$define$undef")
9972       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9973    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9974    esac
9975    ;;
9976 esac
9977
9978 fi
9979 $rm_try
9980
9981 : see if _fwalk exists
9982 set fwalk d__fwalk
9983 eval $inlibc
9984
9985 : Initialize h_fcntl
9986 h_fcntl=false
9987
9988 : Initialize h_sysfile
9989 h_sysfile=false
9990
9991 : access call always available on UNIX
9992 set access d_access
9993 eval $inlibc
9994
9995 : locate the flags for 'access()'
9996 case "$d_access" in
9997 "$define")
9998         echo " "
9999         $cat >access.c <<EOCP
10000 #include <sys/types.h>
10001 #ifdef I_FCNTL
10002 #include <fcntl.h>
10003 #endif
10004 #ifdef I_SYS_FILE
10005 #include <sys/file.h>
10006 #endif
10007 #ifdef I_UNISTD
10008 #include <unistd.h>
10009 #endif
10010 #$i_stdlib I_STDLIB
10011 #ifdef I_STDLIB
10012 #include <stdlib.h>
10013 #endif
10014 int main() {
10015         exit(R_OK);
10016 }
10017 EOCP
10018         : check sys/file.h first, no particular reason here
10019         if $test `./findhdr sys/file.h` && \
10020                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10021                 h_sysfile=true;
10022                 echo "<sys/file.h> defines the *_OK access constants." >&4
10023         elif $test `./findhdr fcntl.h` && \
10024                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10025                 h_fcntl=true;
10026                 echo "<fcntl.h> defines the *_OK access constants." >&4
10027         elif $test `./findhdr unistd.h` && \
10028                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10029                 echo "<unistd.h> defines the *_OK access constants." >&4
10030         else
10031                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10032         fi
10033         ;;
10034 esac
10035 $rm -f access*
10036
10037 : see if accessx exists
10038 set accessx d_accessx
10039 eval $inlibc
10040
10041 : see if aintl exists
10042 set aintl d_aintl
10043 eval $inlibc
10044
10045 : see if alarm exists
10046 set alarm d_alarm
10047 eval $inlibc
10048
10049 : see if 64bit time functions exists
10050
10051 set ctime64 d_ctime64
10052 eval $inlibc
10053
10054 set localtime64 d_localtime64
10055 eval $inlibc
10056
10057 set gmtime64 d_gmtime64
10058 eval $inlibc
10059
10060 set mktime64 d_mktime64
10061 eval $inlibc
10062
10063 set difftime64 d_difftime64
10064 eval $inlibc
10065
10066 set asctime64 d_asctime64
10067 eval $inlibc
10068
10069 : see if POSIX threads are available
10070 set pthread.h i_pthread
10071 eval $inhdr
10072
10073 : define a function to check prototypes
10074 $cat > protochk <<EOSH
10075 $startsh
10076 cc="$cc"
10077 optimize="$optimize"
10078 ccflags="$ccflags"
10079 prototype="$prototype"
10080 define="$define"
10081 rm_try="$rm_try"
10082 usethreads=$usethreads
10083 i_pthread=$i_pthread
10084 pthread_h_first=$pthread_h_first
10085 EOSH
10086
10087 $cat >> protochk <<'EOSH'
10088
10089 $rm_try
10090 foo="$1"
10091 shift
10092 while test $# -ge 2; do
10093         case "$1" in
10094                 $define) echo "#include <$2>" >> try.c ;;
10095                 literal) echo "$2" >> try.c ;;
10096         esac
10097     # Extra magic for the benefit of systems that need pthread.h
10098     # to be included early to correctly detect threadsafe functions.
10099     # Such functions must guarantee themselves, though, that the usethreads
10100     # and i_pthread have been defined, before calling protochk.
10101     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10102         echo "#include <pthread.h>" >> try.c
10103         pthread_h_done=yes
10104     fi
10105     shift 2
10106 done
10107 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10108 cat >> try.c <<'EOCP'
10109 #ifdef CAN_PROTOTYPE
10110 #define _(args) args
10111 #else
10112 #define _(args) ()
10113 #endif
10114 EOCP
10115 echo "$foo" >> try.c
10116 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10117 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10118 status=$?
10119 $rm_try
10120 exit $status
10121 EOSH
10122 chmod +x protochk
10123 $eunicefix protochk
10124
10125 : Define hasproto macro for Configure internal use
10126 hasproto='varname=$1; func=$2; shift; shift;
10127 while $test $# -ge 2; do
10128         case "$1" in
10129         $define) echo "#include <$2>";;
10130         esac ;
10131     shift 2;
10132 done > try.c;
10133 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10134 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10135         echo "$func() prototype found.";
10136         val="$define";
10137 else
10138         echo "$func() prototype NOT found.";
10139         val="$undef";
10140 fi;
10141 set $varname;
10142 eval $setvar;
10143 $rm_try tryout.c'
10144
10145 : see if sys/types.h has to be included
10146 set sys/types.h i_systypes
10147 eval $inhdr
10148
10149 : see if sys/select.h has to be included
10150 set sys/select.h i_sysselct
10151 eval $inhdr
10152
10153 : Define hasfield macro for Configure internal use
10154 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10155 while $test $# -ge 2; do
10156         case "$1" in
10157         $define) echo "#include <$2>";;
10158         esac ;
10159     shift 2;
10160 done > try.c;
10161 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10162 set try;
10163 if eval $compile; then
10164         val="$define";
10165 else
10166         val="$undef";
10167 fi;
10168 set $varname;
10169 eval $setvar;
10170 $rm_try'
10171
10172 : see if we should include time.h, sys/time.h, or both
10173 echo " "
10174 if test "X$timeincl" = X; then
10175         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10176         $echo $n "I'm now running the test program...$c"
10177         $cat >try.c <<EOCP
10178 #include <sys/types.h>
10179 #ifdef I_TIME
10180 #include <time.h>
10181 #endif
10182 #ifdef I_SYSTIME
10183 #ifdef SYSTIMEKERNEL
10184 #define KERNEL
10185 #endif
10186 #include <sys/time.h>
10187 #endif
10188 #ifdef I_SYSSELECT
10189 #include <sys/select.h>
10190 #endif
10191 #$i_stdlib I_STDLIB
10192 #ifdef I_STDLIB
10193 #include <stdlib.h>
10194 #endif
10195 int main()
10196 {
10197         struct tm foo;
10198 #ifdef S_TIMEVAL
10199         struct timeval bar;
10200 #endif
10201 #ifdef S_TIMEZONE
10202         struct timezone tzp;
10203 #endif
10204         if (foo.tm_sec == foo.tm_sec)
10205                 exit(0);
10206 #ifdef S_TIMEVAL
10207         if (bar.tv_sec == bar.tv_sec)
10208                 exit(0);
10209 #endif
10210         exit(1);
10211 }
10212 EOCP
10213         flags=''
10214         for s_timezone in '-DS_TIMEZONE' ''; do
10215         sysselect=''
10216         for s_timeval in '-DS_TIMEVAL' ''; do
10217         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10218         for i_time in '' '-DI_TIME'; do
10219         for i_systime in '-DI_SYSTIME' ''; do
10220                 case "$flags" in
10221                 '') $echo $n ".$c"
10222                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10223                         if eval $compile; then
10224                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10225                                 shift
10226                                 flags="$*"
10227                                 echo " "
10228                                 $echo $n "Succeeded with $flags$c"
10229                         fi
10230                         ;;
10231                 esac
10232         done
10233         done
10234         done
10235         done
10236         done
10237         timeincl=''
10238         echo " "
10239         case "$flags" in
10240         *SYSTIMEKERNEL*) i_systimek="$define"
10241                 timeincl=`./findhdr sys/time.h`
10242                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10243         *) i_systimek="$undef";;
10244         esac
10245         case "$flags" in
10246         *I_TIME*) i_time="$define"
10247                 timeincl=`./findhdr time.h`" $timeincl"
10248                 echo "We'll include <time.h>." >&4;;
10249         *) i_time="$undef";;
10250         esac
10251         case "$flags" in
10252         *I_SYSTIME*) i_systime="$define"
10253                 timeincl=`./findhdr sys/time.h`" $timeincl"
10254                 echo "We'll include <sys/time.h>." >&4;;
10255         *) i_systime="$undef";;
10256         esac
10257         $rm_try
10258 fi
10259 : see if struct tm knows about tm_zone
10260 case "$i_systime$i_time" in
10261 *$define*)
10262         echo " "
10263         echo "Checking to see if your struct tm has tm_zone field..." >&4
10264         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10265         eval $hasfield
10266         ;;
10267 *)      val="$undef"
10268         set d_tm_tm_zone
10269         eval $setvar
10270         ;;
10271 esac
10272 case "$d_tm_tm_zone" in
10273 "$define")      echo "Yes, it does."   ;;
10274 *)              echo "No, it doesn't." ;;
10275 esac
10276 : see if struct tm knows about tm_gmtoff
10277 case "$i_systime$i_time" in
10278 *$define*)
10279         echo " "
10280         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10281         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10282         eval $hasfield
10283         ;;
10284 *)      val="$undef"
10285         set d_tm_tm_gmtoff
10286         eval $setvar
10287         ;;
10288 esac
10289 case "$d_tm_tm_gmtoff" in
10290 "$define")      echo "Yes, it does."   ;;
10291 *)              echo "No, it doesn't." ;;
10292 esac
10293
10294 : see if asctime_r exists
10295 set asctime_r d_asctime_r
10296 eval $inlibc
10297 case "$d_asctime_r" in
10298 "$define")
10299         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10300         case "$d_asctime_r_proto:$usethreads" in
10301         ":define")      d_asctime_r_proto=define
10302                 set d_asctime_r_proto asctime_r $hdrs
10303                 eval $hasproto ;;
10304         *)      ;;
10305         esac
10306         case "$d_asctime_r_proto" in
10307         define)
10308         case "$asctime_r_proto" in
10309         ''|0) try='char* asctime_r(const struct tm*, char*);'
10310         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10311         esac
10312         case "$asctime_r_proto" in
10313         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10314         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10315         esac
10316         case "$asctime_r_proto" in
10317         ''|0) try='int asctime_r(const struct tm*, char*);'
10318         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10319         esac
10320         case "$asctime_r_proto" in
10321         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10322         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10323         esac
10324         case "$asctime_r_proto" in
10325         ''|0)   d_asctime_r=undef
10326                 asctime_r_proto=0
10327                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10328         * )     case "$asctime_r_proto" in
10329                 REENTRANT_PROTO*) ;;
10330                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10331                 esac
10332                 echo "Prototype: $try" ;;
10333         esac
10334         ;;
10335         *)      case "$usethreads" in
10336                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10337                 esac
10338                 d_asctime_r=undef
10339                 asctime_r_proto=0
10340                 ;;
10341         esac
10342         ;;
10343 *)      asctime_r_proto=0
10344         ;;
10345 esac
10346
10347 : see if atolf exists
10348 set atolf d_atolf
10349 eval $inlibc
10350
10351 : see if atoll exists
10352 set atoll d_atoll
10353 eval $inlibc
10354
10355 : Look for GCC-style attribute format
10356 case "$d_attribute_format" in
10357 '')
10358 echo " "
10359 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10360 $cat >attrib.c <<'EOCP'
10361 #include <stdio.h>
10362 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10363 EOCP
10364 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10365         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10366                 echo "Your C compiler doesn't support __attribute__((format))."
10367                 val="$undef"
10368         else
10369                 echo "Your C compiler supports __attribute__((format))."
10370                 val="$define"
10371         fi
10372 else
10373         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10374         val="$undef"
10375 fi
10376 ;;
10377 *) val="$d_attribute_format" ;;
10378 esac
10379 set d_attribute_format
10380 eval $setvar
10381 $rm -f attrib*
10382
10383 : Look for GCC-style attribute format with null format allowed
10384 case "$d_printf_format_null" in
10385 '') case "$d_attribute_format" in
10386     $define)
10387         echo " "
10388         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10389 $cat >attrib.c <<EOCP
10390 #include <stdio.h>
10391 #$i_stdlib I_STDLIB
10392 #ifdef I_STDLIB
10393 #include <stdlib.h>
10394 #endif
10395 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10396 int null_printf (char* pat,...) { return (int)pat; }
10397 int main () { exit(null_printf(NULL)); }
10398 EOCP
10399         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10400             : run the executable in case it produces a run-time warning
10401             if $run ./attrib >>attrib.out 2>&1; then
10402                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10403                     echo "Your C compiler doesn't allow __printf__ format to be null."
10404                     val="$undef"
10405                 else
10406                     echo "Your C compiler allows __printf__ format to be null."
10407                     val="$define"
10408                 fi
10409             else
10410             echo "Your C compiler executable failed with __printf__ format null."
10411             val="$undef"
10412         fi
10413     else
10414         echo "Your C compiler fails with __printf__ format null."
10415         val="$undef"
10416     fi
10417     ;;
10418     *)  val="$undef" ;;
10419     esac
10420 ;;
10421 *)  val="$d_printf_format_null" ;;
10422 esac
10423 set d_printf_format_null
10424 eval $setvar
10425 $rm -f attrib*
10426
10427 : Look for GCC-style attribute malloc
10428 case "$d_attribute_malloc" in
10429 '')
10430 echo " "
10431 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10432 $cat >attrib.c <<'EOCP'
10433 #include <stdio.h>
10434 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10435 EOCP
10436 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10437         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10438                 echo "Your C compiler doesn't support __attribute__((malloc))."
10439                 val="$undef"
10440         else
10441                 echo "Your C compiler supports __attribute__((malloc))."
10442                 val="$define"
10443         fi
10444 else
10445         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10446         val="$undef"
10447 fi
10448 ;;
10449 *) val="$d_attribute_malloc" ;;
10450 esac
10451 set d_attribute_malloc
10452 eval $setvar
10453 $rm -f attrib*
10454
10455 : Look for GCC-style attribute nonnull
10456 case "$d_attribute_nonnull" in
10457 '')
10458 echo " "
10459 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10460 $cat >attrib.c <<'EOCP'
10461 #include <stdio.h>
10462 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10463 EOCP
10464 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10465         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10466                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10467                 val="$undef"
10468         else
10469                 echo "Your C compiler supports __attribute__((nonnull))."
10470                 val="$define"
10471         fi
10472 else
10473         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10474         val="$undef"
10475 fi
10476 ;;
10477 *) val="$d_attribute_nonnull" ;;
10478 esac
10479 set d_attribute_nonnull
10480 eval $setvar
10481 $rm -f attrib*
10482
10483 : Look for GCC-style attribute noreturn
10484 case "$d_attribute_noreturn" in
10485 '')
10486 echo " "
10487 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10488 $cat >attrib.c <<'EOCP'
10489 #include <stdio.h>
10490 void fall_over_dead( void ) __attribute__((noreturn));
10491 EOCP
10492 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10493         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10494                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10495                 val="$undef"
10496         else
10497                 echo "Your C compiler supports __attribute__((noreturn))."
10498                 val="$define"
10499         fi
10500 else
10501         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10502         val="$undef"
10503 fi
10504 ;;
10505 *) val="$d_attribute_noreturn" ;;
10506 esac
10507 set d_attribute_noreturn
10508 eval $setvar
10509 $rm -f attrib*
10510
10511 : Look for GCC-style attribute pure
10512 case "$d_attribute_pure" in
10513 '')
10514 echo " "
10515 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10516 $cat >attrib.c <<'EOCP'
10517 #include <stdio.h>
10518 int square( int n ) __attribute__((pure));
10519 EOCP
10520 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10521         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10522                 echo "Your C compiler doesn't support __attribute__((pure))."
10523                 val="$undef"
10524         else
10525                 echo "Your C compiler supports __attribute__((pure))."
10526                 val="$define"
10527         fi
10528 else
10529         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10530         val="$undef"
10531 fi
10532 ;;
10533 *) val="$d_attribute_pure" ;;
10534 esac
10535 set d_attribute_pure
10536 eval $setvar
10537 $rm -f attrib*
10538
10539 : Look for GCC-style attribute unused
10540 case "$d_attribute_unused" in
10541 '')
10542 echo " "
10543 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10544 $cat >attrib.c <<'EOCP'
10545 #include <stdio.h>
10546 int do_something( int dummy __attribute__((unused)), int n );
10547 EOCP
10548 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10549         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10550                 echo "Your C compiler doesn't support __attribute__((unused))."
10551                 val="$undef"
10552         else
10553                 echo "Your C compiler supports __attribute__((unused))."
10554                 val="$define"
10555         fi
10556 else
10557         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10558         val="$undef"
10559 fi
10560 ;;
10561 *) val="$d_attribute_unused" ;;
10562 esac
10563 set d_attribute_unused
10564 eval $setvar
10565 $rm -f attrib*
10566
10567 : Look for GCC-style attribute deprecated
10568 case "$d_attribute_deprecated" in
10569 '')
10570 echo " "
10571 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10572 $cat >attrib.c <<'EOCP'
10573 #include <stdio.h>
10574 int I_am_deprecated(void) __attribute__((deprecated));
10575 EOCP
10576 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10577         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10578                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10579                 val="$undef"
10580         else
10581                 echo "Your C compiler supports __attribute__((deprecated))."
10582                 val="$define"
10583         fi
10584 else
10585         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10586         val="$undef"
10587 fi
10588 ;;
10589 *) val="$d_attribute_deprecated" ;;
10590 esac
10591 set d_attribute_deprecated
10592 eval $setvar
10593 $rm -f attrib*
10594
10595 : Look for GCC-style attribute warn_unused_result
10596 case "$d_attribute_warn_unused_result" in
10597 '')
10598 echo " "
10599 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10600 $cat >attrib.c <<'EOCP'
10601 #include <stdio.h>
10602 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10603 EOCP
10604 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10605         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10606                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10607                 val="$undef"
10608         else
10609                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10610                 val="$define"
10611         fi
10612 else
10613         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10614         val="$undef"
10615 fi
10616 ;;
10617 *) val="$d_attribute_warn_unused_result" ;;
10618 esac
10619 set d_attribute_warn_unused_result
10620 eval $setvar
10621 $rm -f attrib*
10622
10623 : see if bcmp exists
10624 set bcmp d_bcmp
10625 eval $inlibc
10626
10627 : see if bcopy exists
10628 set bcopy d_bcopy
10629 eval $inlibc
10630
10631 : see if getpgrp exists
10632 set getpgrp d_getpgrp
10633 eval $inlibc
10634
10635 case "$d_getpgrp" in
10636 "$define")
10637         echo " "
10638         echo "Checking to see which flavor of getpgrp is in use..."
10639         $cat >try.c <<EOP
10640 #$i_unistd I_UNISTD
10641 #include <sys/types.h>
10642 #ifdef I_UNISTD
10643 #  include <unistd.h>
10644 #endif
10645 #$i_stdlib I_STDLIB
10646 #ifdef I_STDLIB
10647 #include <stdlib.h>
10648 #endif
10649 int main()
10650 {
10651         if (getuid() == 0) {
10652                 printf("(I see you are running Configure as super-user...)\n");
10653                 setuid(1);
10654         }
10655 #ifdef TRY_BSD_PGRP
10656         if (getpgrp(1) == 0)
10657                 exit(0);
10658 #else
10659         if (getpgrp() > 0)
10660                 exit(0);
10661 #endif
10662         exit(1);
10663 }
10664 EOP
10665         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10666                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10667                 val="$define"
10668         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10669                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10670                 val="$undef"
10671         else
10672                 echo "I can't seem to compile and run the test program."
10673                 if ./usg; then
10674                         xxx="a USG one, i.e. you use getpgrp()."
10675                 else
10676                         # SVR4 systems can appear rather BSD-ish.
10677                         case "$i_unistd" in
10678                         $undef)
10679                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10680                                 val="$define"
10681                                 ;;
10682                         $define)
10683                                 xxx="probably a USG one, i.e. you use getpgrp()."
10684                                 val="$undef"
10685                                 ;;
10686                         esac
10687                 fi
10688                 echo "Assuming your getpgrp is $xxx" >&4
10689         fi
10690         ;;
10691 *) val="$undef";;
10692 esac
10693 set d_bsdgetpgrp
10694 eval $setvar
10695 $rm_try
10696
10697 : see if setpgrp exists
10698 set setpgrp d_setpgrp
10699 eval $inlibc
10700
10701 case "$d_setpgrp" in
10702 "$define")
10703         echo " "
10704         echo "Checking to see which flavor of setpgrp is in use..."
10705         $cat >try.c <<EOP
10706 #$i_unistd I_UNISTD
10707 #include <sys/types.h>
10708 #ifdef I_UNISTD
10709 #  include <unistd.h>
10710 #endif
10711 #$i_stdlib I_STDLIB
10712 #ifdef I_STDLIB
10713 #include <stdlib.h>
10714 #endif
10715 int main()
10716 {
10717         if (getuid() == 0) {
10718                 printf("(I see you are running Configure as super-user...)\n");
10719                 setuid(1);
10720         }
10721 #ifdef TRY_BSD_PGRP
10722         if (-1 == setpgrp(1, 1))
10723                 exit(0);
10724 #else
10725         if (setpgrp() != -1)
10726                 exit(0);
10727 #endif
10728         exit(1);
10729 }
10730 EOP
10731         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10732                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10733                 val="$define"
10734         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10735                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10736                 val="$undef"
10737         else
10738                 echo "(I can't seem to compile and run the test program.)"
10739                 if ./usg; then
10740                         xxx="a USG one, i.e. you use setpgrp()."
10741                 else
10742                         # SVR4 systems can appear rather BSD-ish.
10743                         case "$i_unistd" in
10744                         $undef)
10745                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10746                                 val="$define"
10747                                 ;;
10748                         $define)
10749                                 xxx="probably a USG one, i.e. you use setpgrp()."
10750                                 val="$undef"
10751                                 ;;
10752                         esac
10753                 fi
10754                 echo "Assuming your setpgrp is $xxx" >&4
10755         fi
10756         ;;
10757 *) val="$undef";;
10758 esac
10759 set d_bsdsetpgrp
10760 eval $setvar
10761 $rm_try
10762
10763 : Look for GCC-style __builtin_choose_expr
10764 case "$d_builtin_choose_expr" in
10765 '')
10766     echo " "
10767     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10768     $cat >try.c <<'EOCP'
10769 #include <assert.h>
10770 #include <stdlib.h>
10771 #include <stdio.h>
10772
10773 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10774
10775 int main(void) {
10776     assert( SYRINX(1) == 2112 );
10777     assert( SYRINX(1) != 5150 );
10778     assert( SYRINX(0) == 5150 );
10779     assert( SYRINX(0) != 2112 );
10780     puts( "All good!" );
10781     exit(0);
10782 }
10783
10784 EOCP
10785     set try
10786     if eval $compile && $run ./try; then
10787         echo "Your C compiler supports __builtin_choose_expr."
10788         val="$define"
10789     else
10790         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10791         val="$undef"
10792     fi
10793 ;;
10794 *) val="$d_builtin_choose_expr" ;;
10795 esac
10796
10797 set d_builtin_choose_expr
10798 eval $setvar
10799 $rm_try
10800
10801 : Look for GCC-style __builtin_expect
10802 case "$d_builtin_expect" in
10803 '')
10804     echo " "
10805     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10806     $cat >try.c <<'EOCP'
10807 int main(void) {
10808     int n = 50;
10809     if ( __builtin_expect(n, 0) ) n = 1;
10810     /* Remember shell exit code truth is 0, C truth is non-zero */
10811     return !(n == 1);
10812 }
10813 EOCP
10814     set try
10815     if eval $compile && $run ./try; then
10816         echo "Your C compiler supports __builtin_expect."
10817         val="$define"
10818     else
10819         echo "Your C compiler doesn't seem to understand __builtin_expect."
10820         val="$undef"
10821     fi
10822     ;;
10823 *) val="$d_builtin_expect" ;;
10824 esac
10825
10826 set d_builtin_expect
10827 eval $setvar
10828 $rm_try
10829
10830 : see if bzero exists
10831 set bzero d_bzero
10832 eval $inlibc
10833
10834 : see if stdarg is available
10835 echo " "
10836 if $test `./findhdr stdarg.h`; then
10837         echo "<stdarg.h> found." >&4
10838         valstd="$define"
10839 else
10840         echo "<stdarg.h> NOT found." >&4
10841         valstd="$undef"
10842 fi
10843
10844 : see if varargs is available
10845 echo " "
10846 if $test `./findhdr varargs.h`; then
10847         echo "<varargs.h> found." >&4
10848 else
10849         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10850 fi
10851
10852 : set up the varargs testing programs
10853 $cat > varargs.c <<EOP
10854 #ifdef I_STDARG
10855 #include <stdarg.h>
10856 #endif
10857 #ifdef I_VARARGS
10858 #include <varargs.h>
10859 #endif
10860
10861 #ifdef I_STDARG
10862 int f(char *p, ...)
10863 #else
10864 int f(va_alist)
10865 va_dcl
10866 #endif
10867 {
10868         va_list ap;
10869 #ifndef I_STDARG
10870         char *p;
10871 #endif
10872 #ifdef I_STDARG
10873         va_start(ap,p);
10874 #else
10875         va_start(ap);
10876         p = va_arg(ap, char *);
10877 #endif
10878         va_end(ap);
10879         return 0;
10880 }
10881 EOP
10882 $cat > varargs <<EOP
10883 $startsh
10884 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10885         echo "true"
10886 else
10887         echo "false"
10888 fi
10889 $rm -f varargs$_o
10890 EOP
10891 chmod +x varargs
10892
10893 : now check which varargs header should be included
10894 echo " "
10895 i_varhdr=''
10896 val=''
10897 case "$valstd" in
10898 "$define")
10899         if `./varargs I_STDARG`; then
10900                 val='stdarg.h'
10901         elif `./varargs I_VARARGS`; then
10902                 val='varargs.h'
10903         fi
10904         ;;
10905 *)
10906         if `./varargs I_VARARGS`; then
10907                 val='varargs.h'
10908         fi
10909         ;;
10910 esac
10911 case "$val" in
10912 '')
10913         echo " "
10914         echo "*** WHOA THERE!!! ***" >&4
10915         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
10916         case "$knowitall" in
10917         '')
10918         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
10919                 exit 1
10920                 ;;
10921         esac
10922 echo "I could not find the definition for va_dcl... You have problems..." >&4
10923         val="$undef"; set i_stdarg; eval $setvar
10924         val="$undef"; set i_varargs; eval $setvar
10925         ;;
10926 *)
10927         set i_varhdr
10928         eval $setvar
10929         case "$i_varhdr" in
10930         stdarg.h)
10931                 val="$define"; set i_stdarg; eval $setvar
10932                 val="$undef"; set i_varargs; eval $setvar
10933                 ;;
10934         varargs.h)
10935                 val="$undef"; set i_stdarg; eval $setvar
10936                 val="$define"; set i_varargs; eval $setvar
10937                 ;;
10938         esac
10939         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10940 esac
10941 $rm -f varargs*
10942
10943 : see if the Compiler supports C99 variadic macros
10944 case "$i_stdarg$i_stdlib" in
10945     "$define$define")
10946     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10947     $cat >try.c <<EOCP
10948 #include <stdio.h>
10949 #include <stdarg.h>
10950
10951 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10952
10953 int main() {
10954   char buf[20];
10955   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10956   puts(buf);
10957   return 0;
10958 }
10959 EOCP
10960     set try
10961     if eval $compile && $run ./try 2>&1 >/dev/null; then
10962         case "`$run ./try`" in
10963             "123 456 789")
10964             echo "You have C99 variadic macros." >&4
10965             d_c99_variadic_macros="$define"
10966             ;;
10967             *)
10968             echo "You don't have functional C99 variadic macros." >&4
10969             d_c99_variadic_macros="$undef"
10970             ;;
10971         esac
10972     else
10973         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10974         d_c99_variadic_macros="$undef"
10975     fi
10976     $rm_try
10977     ;;
10978     *)
10979     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10980     d_c99_variadic_macros="$undef"
10981     ;;
10982 esac
10983
10984 : see if signal is declared as pointer to function returning int or void
10985 echo " "
10986 xxx=`./findhdr signal.h`
10987 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10988 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10989         echo "You have int (*signal())() instead of void." >&4
10990         val="$undef"
10991 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10992         echo "You have void (*signal())()." >&4
10993         val="$define"
10994 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10995         echo "You have int (*signal())() instead of void." >&4
10996         val="$undef"
10997 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10998         echo "You have void (*signal())()." >&4
10999         val="$define"
11000 else
11001         case "$d_voidsig" in
11002         '')
11003         echo "I can't determine whether signal handler returns void or int..." >&4
11004                 dflt=void
11005                 rp="What type does your signal handler return?"
11006                 . ./myread
11007                 case "$ans" in
11008                 v*) val="$define";;
11009                 *) val="$undef";;
11010                 esac;;
11011         "$define")
11012                 echo "As you already told me, signal handler returns void." >&4
11013                 val="$define"
11014                 ;;
11015         *)      echo "As you already told me, signal handler returns int." >&4
11016                 val="$undef"
11017                 ;;
11018         esac
11019 fi
11020 set d_voidsig
11021 eval $setvar
11022 case "$d_voidsig" in
11023 "$define") signal_t="void";;
11024 *) signal_t="int";;
11025 esac
11026 $rm -f $$.tmp
11027
11028 : check for ability to cast large floats to 32-bit ints.
11029 echo " "
11030 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11031 if $test "$intsize" -ge 4; then
11032         xxx=int
11033 else
11034         xxx=long
11035 fi
11036 $cat >try.c <<EOCP
11037 #include <stdio.h>
11038 #$i_stdlib I_STDLIB
11039 #ifdef I_STDLIB
11040 #include <stdlib.h>
11041 #endif
11042 #include <sys/types.h>
11043 #include <signal.h>
11044 $signal_t blech(int s) { exit(3); }
11045 int main()
11046 {
11047         $xxx i32;
11048         double f, g;
11049         int result = 0;
11050         char str[16];
11051         signal(SIGFPE, blech);
11052
11053         /* Don't let compiler optimize the test away.  Store the number
11054            in a writable string for gcc to pass to sscanf under HP-UX.
11055         */
11056         sprintf(str, "2147483647");
11057         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11058         g = 10 * f;
11059         i32  = ($xxx) g;
11060
11061         /* x86 processors will probably give 0x8000 0000, which is a
11062            sign change.  We don't want that.  We want to mimic SPARC
11063            behavior here, which is to preserve the sign and give
11064            back 0x7fff ffff.
11065         */
11066         if (i32 != ($xxx) f)
11067                 result |= 1;
11068         exit(result);
11069 }
11070 EOCP
11071 set try
11072 if eval $compile_ok; then
11073         $run ./try
11074         yyy=$?
11075 else
11076         echo "(I can't seem to compile the test program--assuming it can't)"
11077         yyy=1
11078 fi
11079 case "$yyy" in
11080 0)      val="$define"
11081         echo "Yup, it can."
11082         ;;
11083 *)      val="$undef"
11084         echo "Nope, it can't."
11085         ;;
11086 esac
11087 set d_casti32
11088 eval $setvar
11089 $rm_try
11090
11091 : check for ability to cast negative floats to unsigned
11092 echo " "
11093 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11094 $cat >try.c <<EOCP
11095 #include <stdio.h>
11096 #$i_stdlib I_STDLIB
11097 #ifdef I_STDLIB
11098 #include <stdlib.h>
11099 #endif
11100 #include <sys/types.h>
11101 #include <signal.h>
11102 $signal_t blech(int s) { exit(7); }
11103 $signal_t blech_in_list(int s) { exit(4); }
11104 unsigned long dummy_long(unsigned long p) { return p; }
11105 unsigned int dummy_int(unsigned int p) { return p; }
11106 unsigned short dummy_short(unsigned short p) { return p; }
11107 int main()
11108 {
11109         double f;
11110         unsigned long along;
11111         unsigned int aint;
11112         unsigned short ashort;
11113         int result = 0;
11114         char str[16];
11115
11116         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11117            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11118            optimized the whole file away
11119         */
11120         /* Store the number in a writable string for gcc to pass to
11121            sscanf under HP-UX.
11122         */
11123         sprintf(str, "-123");
11124         sscanf(str, "%lf", &f);  /* f = -123.; */
11125
11126         signal(SIGFPE, blech);
11127         along = (unsigned long)f;
11128         aint = (unsigned int)f;
11129         ashort = (unsigned short)f;
11130         if (along != (unsigned long)-123)
11131                 result |= 1;
11132         if (aint != (unsigned int)-123)
11133                 result |= 1;
11134         if (ashort != (unsigned short)-123)
11135                 result |= 1;
11136         sprintf(str, "1073741824.");
11137         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11138         f = f + f;
11139         along = 0;
11140         along = (unsigned long)f;
11141         if (along != 0x80000000)
11142                 result |= 2;
11143         f -= 1.;
11144         along = 0;
11145         along = (unsigned long)f;
11146         if (along != 0x7fffffff)
11147                 result |= 1;
11148         f += 2.;
11149         along = 0;
11150         along = (unsigned long)f;
11151         if (along != 0x80000001)
11152                 result |= 2;
11153         if (result)
11154                 exit(result);
11155         signal(SIGFPE, blech_in_list);
11156         sprintf(str, "123.");
11157         sscanf(str, "%lf", &f);  /* f = 123.; */
11158         along = dummy_long((unsigned long)f);
11159         aint = dummy_int((unsigned int)f);
11160         ashort = dummy_short((unsigned short)f);
11161         if (along != (unsigned long)123)
11162                 result |= 4;
11163         if (aint != (unsigned int)123)
11164                 result |= 4;
11165         if (ashort != (unsigned short)123)
11166                 result |= 4;
11167         exit(result);
11168
11169 }
11170 EOCP
11171 set try
11172 if eval $compile_ok; then
11173         $run ./try
11174         castflags=$?
11175 else
11176         echo "(I can't seem to compile the test program--assuming it can't)"
11177         castflags=7
11178 fi
11179 case "$castflags" in
11180 0)      val="$define"
11181         echo "Yup, it can."
11182         ;;
11183 *)      val="$undef"
11184         echo "Nope, it can't."
11185         ;;
11186 esac
11187 set d_castneg
11188 eval $setvar
11189 $rm_try
11190
11191 : see if vprintf exists
11192 echo " "
11193 if set vprintf val -f d_vprintf; eval $csym; $val; then
11194         echo 'vprintf() found.' >&4
11195         val="$define"
11196         $cat >try.c <<EOF
11197 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11198 #$i_varargs I_VARARGS
11199
11200 #$i_stdlib I_STDLIB
11201 #$i_unistd I_UNISTD
11202
11203 #ifdef I_STDARG
11204 #  include <stdarg.h>
11205 #else /* I_VARARGS */
11206 #  include <varargs.h>
11207 #endif
11208
11209 #ifdef I_UNISTD
11210 #  include <unistd.h>
11211 #endif
11212
11213 #ifdef I_STDLIB
11214 #  include <stdlib.h>
11215 #endif
11216
11217 #include <stdio.h> /* vsprintf prototype */
11218
11219 #ifdef I_STDARG
11220 void xxx(int n, ...)
11221 {
11222     va_list args;
11223     char buf[10];
11224     va_start(args, n);
11225     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11226 }
11227 int main() { xxx(1, "foo"); }
11228
11229 #else /* I_VARARGS */
11230
11231 xxx(va_alist)
11232 va_dcl
11233 {
11234     va_list args;
11235     char buf[10];
11236     va_start(args);
11237     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11238 }
11239 int main() { xxx("foo"); }
11240
11241 #endif
11242
11243 EOF
11244         set try
11245         if eval $compile_ok; then
11246                 if $run ./try; then
11247                         echo "Your vsprintf() returns (int)." >&4
11248                         val2="$undef"
11249                 else
11250                         echo "Your vsprintf() returns (char*)." >&4
11251                         val2="$define"
11252                 fi
11253         else
11254                 echo 'I am unable to compile the vsprintf() test program.' >&4
11255                 # We shouldn't get here.  If we do, assume the standard signature,
11256                 # not the old BSD one.
11257                 echo 'Guessing that vsprintf() returns (int).' >&4
11258                 val2="$undef"
11259         fi
11260 else
11261         echo 'vprintf() NOT found.' >&4
11262         val="$undef"
11263         val2="$undef"
11264 fi
11265 $rm_try
11266 set d_vprintf
11267 eval $setvar
11268 val=$val2
11269 set d_charvspr
11270 eval $setvar
11271
11272 : see if chown exists
11273 set chown d_chown
11274 eval $inlibc
11275
11276 : see if chroot exists
11277 set chroot d_chroot
11278 eval $inlibc
11279
11280 : see if chsize exists
11281 set chsize d_chsize
11282 eval $inlibc
11283
11284 : see if class exists
11285 set class d_class
11286 eval $inlibc
11287
11288 : see if clearenv exists
11289 set clearenv d_clearenv
11290 eval $inlibc
11291
11292 : Define hasstruct macro for Configure internal use
11293 hasstruct='varname=$1; struct=$2; shift; shift;
11294 while $test $# -ge 2; do
11295         case "$1" in
11296         $define) echo "#include <$2>";;
11297         esac ;
11298     shift 2;
11299 done > try.c;
11300 echo "int main () { struct $struct foo; }" >> try.c;
11301 set try;
11302 if eval $compile; then
11303         val="$define";
11304 else
11305         val="$undef";
11306 fi;
11307 set $varname;
11308 eval $setvar;
11309 $rm_try'
11310
11311 : see whether socket exists
11312 socketlib=''
11313 sockethdr=''
11314 echo " "
11315 $echo $n "Hmm... $c" >&4
11316 if set socket val -f d_socket; eval $csym; $val; then
11317         echo "Looks like you have Berkeley networking support." >&4
11318         d_socket="$define"
11319         if set setsockopt val -f; eval $csym; $val; then
11320                 d_oldsock="$undef"
11321         else
11322                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11323                 d_oldsock="$define"
11324         fi
11325 else
11326         if $contains socklib libc.list >/dev/null 2>&1; then
11327                 echo "Looks like you have Berkeley networking support." >&4
11328                 d_socket="$define"
11329                 : we will have to assume that it supports the 4.2 BSD interface
11330                 d_oldsock="$undef"
11331         else
11332                 echo "You don't have Berkeley networking in libc$_a..." >&4
11333                 if test "X$d_socket" = "X$define"; then
11334                    echo "...but you seem to believe that you have sockets." >&4
11335                 else
11336                         for net in net socket
11337                         do
11338                                 if test -f /usr/lib/lib$net$_a; then
11339                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11340                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11341                                         if $contains socket libc.list >/dev/null 2>&1; then
11342                                                 d_socket="$define"
11343                                                 socketlib="-l$net"
11344                                                 case "$net" in
11345                                                 net)
11346                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11347                                                         sockethdr="-I/usr/netinclude"
11348                                                         ;;
11349                                                 esac
11350                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11351                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11352                                                         d_oldsock="$undef"
11353                                                 else
11354                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11355                                                         d_oldsock="$define"
11356                                                 fi
11357                                                 break
11358                                         fi
11359                                 fi
11360                         done
11361                         if test "X$d_socket" != "X$define"; then
11362                            echo "or anywhere else I see." >&4
11363                            d_socket="$undef"
11364                            d_oldsock="$undef"
11365                         fi
11366                 fi
11367         fi
11368 fi
11369
11370 : see if socketpair exists
11371 set socketpair d_sockpair
11372 eval $inlibc
11373
11374
11375 echo " "
11376 echo "Checking the availability sa_len in the sock struct ..." >&4
11377 $cat >try.c <<EOF
11378 #include <sys/types.h>
11379 #include <sys/socket.h>
11380 int main() {
11381 struct sockaddr sa;
11382 return (sa.sa_len);
11383 }
11384 EOF
11385 val="$undef"
11386 set try; if eval $compile; then
11387         val="$define"
11388 fi
11389 set d_sockaddr_sa_len; eval $setvar
11390 $rm_try
11391
11392 echo " "
11393 echo "Checking the availability struct sockaddr_in6 ..." >&4
11394 $cat >try.c <<EOF
11395 #include <sys/types.h>
11396 #include <sys/socket.h>
11397 #include <netinet/in.h>
11398 int main() {
11399 struct sockaddr_in6 sin6;
11400 return (sin6.sin6_family);
11401 }
11402 EOF
11403 val="$undef"
11404 set try; if eval $compile; then
11405         val="$define"
11406 fi
11407 set d_sockaddr_in6; eval $setvar
11408 $rm_try
11409
11410 echo " "
11411 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11412 $cat >try.c <<EOF
11413 #include <sys/types.h>
11414 #include <sys/socket.h>
11415 #include <netinet/in.h>
11416 int main() {
11417 struct sockaddr_in6 sin6;
11418 return (sin6.sin6_scope_id);
11419 }
11420 EOF
11421 val="$undef"
11422 set try; if eval $compile; then
11423         val="$define"
11424 fi
11425 set d_sin6_scope_id; eval $setvar
11426 $rm_try
11427
11428 echo " "
11429 echo "Checking the availability struct ip_mreq ..." >&4
11430 $cat >try.c <<EOF
11431 #include <sys/types.h>
11432 #include <sys/socket.h>
11433 #include <netinet/in.h>
11434 int main() {
11435 struct ip_mreq mreq;
11436 return (mreq.imr_multiaddr.s_addr);
11437 }
11438 EOF
11439 val="$undef"
11440 set try; if eval $compile; then
11441        val="$define"
11442 fi
11443 set d_ip_mreq; eval $setvar
11444 $rm_try
11445
11446 echo " "
11447 echo "Checking the availability struct ip_mreq_source ..." >&4
11448 $cat >try.c <<EOF
11449 #include <sys/types.h>
11450 #include <sys/socket.h>
11451 #include <netinet/in.h>
11452 int main() {
11453 struct ip_mreq_source mreq;
11454 return (mreq.imr_multiaddr.s_addr);
11455 }
11456 EOF
11457 val="$undef"
11458 set try; if eval $compile; then
11459        val="$define"
11460 fi
11461 set d_ip_mreq_source; eval $setvar
11462 $rm_try
11463
11464 echo " "
11465 echo "Checking the availability struct ipv6_mreq ..." >&4
11466 $cat >try.c <<EOF
11467 #include <sys/types.h>
11468 #include <sys/socket.h>
11469 #include <netinet/in.h>
11470 int main() {
11471 struct ipv6_mreq mreq;
11472 return (mreq.ipv6mr_interface);
11473 }
11474 EOF
11475 val="$undef"
11476 set try; if eval $compile; then
11477         val="$define"
11478 fi
11479 set d_ipv6_mreq; eval $setvar
11480 $rm_try
11481
11482 echo " "
11483 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11484 $cat >try.c <<EOF
11485 #include <sys/types.h>
11486 #include <sys/socket.h>
11487 #include <netinet/in.h>
11488 int main() {
11489 struct ipv6_mreq_source mreq;
11490 return (mreq.imr_multiaddr.s_addr);
11491 }
11492 EOF
11493 val="$undef"
11494 set try; if eval $compile; then
11495        val="$define"
11496 fi
11497 set d_ipv6_mreq_source; eval $setvar
11498 $rm_try
11499
11500 echo " "
11501 echo "Checking the availability of certain socket constants..." >&4
11502 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11503         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11504         $cat >try.c <<EOF
11505 #include <sys/types.h>
11506 #include <sys/socket.h>
11507 int main() {
11508     int i = $ENUM;
11509 }
11510 EOF
11511         val="$undef"
11512         set try; if eval $compile; then
11513                 val="$define"
11514         fi
11515         set d_${enum}; eval $setvar
11516         $rm_try
11517 done
11518
11519 : see if this is a sys/uio.h system
11520 set sys/uio.h i_sysuio
11521 eval $inhdr
11522
11523 : Check for cmsghdr support
11524 echo " "
11525 echo "Checking to see if your system supports struct cmsghdr..." >&4
11526 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11527 eval $hasstruct
11528 case "$d_cmsghdr_s" in
11529 "$define")      echo "Yes, it does."   ;;
11530 *)              echo "No, it doesn't." ;;
11531 esac
11532
11533
11534 : check for const keyword
11535 echo " "
11536 echo 'Checking to see if your C compiler knows about "const"...' >&4
11537 $cat >const.c <<'EOCP'
11538 typedef struct spug { int drokk; } spug;
11539 int main()
11540 {
11541         const char *foo;
11542         const spug y = { 0 };
11543 }
11544 EOCP
11545 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11546         val="$define"
11547         echo "Yup, it does."
11548 else
11549         val="$undef"
11550         echo "Nope, it doesn't."
11551 fi
11552 set d_const
11553 eval $setvar
11554
11555 : see if copysignl exists
11556 set copysignl d_copysignl
11557 eval $inlibc
11558
11559 : see if crypt exists
11560 echo " "
11561 set crypt d_crypt
11562 eval $inlibc
11563 case "$d_crypt" in
11564 $define) cryptlib='' ;;
11565 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11566                 echo 'crypt() found.' >&4
11567                 val="$define"
11568                 cryptlib=''
11569         else
11570                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11571                 if $test -z "$cryptlib"; then
11572                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11573                 else
11574                         cryptlib=-lcrypt
11575                 fi
11576                 if $test -z "$cryptlib"; then
11577                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11578                 else
11579                         cryptlib=-lcrypt
11580                 fi
11581                 if $test -z "$cryptlib"; then
11582                         cryptlib=`./loc libcrypt$_a "" $libpth`
11583                 else
11584                         cryptlib=-lcrypt
11585                 fi
11586                 if $test -z "$cryptlib"; then
11587                         echo 'crypt() NOT found.' >&4
11588                         val="$undef"
11589                 else
11590                         val="$define"
11591                 fi
11592         fi
11593         set d_crypt
11594         eval $setvar
11595         ;;
11596 esac
11597
11598 : see if this is a crypt.h system
11599 set crypt.h i_crypt
11600 eval $inhdr
11601
11602 : see if crypt_r exists
11603 set crypt_r d_crypt_r
11604 eval $inlibc
11605 case "$d_crypt_r" in
11606 "$define")
11607         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11608         case "$d_crypt_r_proto:$usethreads" in
11609         ":define")      d_crypt_r_proto=define
11610                 set d_crypt_r_proto crypt_r $hdrs
11611                 eval $hasproto ;;
11612         *)      ;;
11613         esac
11614         case "$d_crypt_r_proto" in
11615         define)
11616         case "$crypt_r_proto" in
11617         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11618         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11619         esac
11620         case "$crypt_r_proto" in
11621         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11622         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11623         esac
11624         case "$crypt_r_proto" in
11625         ''|0)   d_crypt_r=undef
11626                 crypt_r_proto=0
11627                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11628         * )     case "$crypt_r_proto" in
11629                 REENTRANT_PROTO*) ;;
11630                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11631                 esac
11632                 echo "Prototype: $try" ;;
11633         esac
11634         ;;
11635         *)      case "$usethreads" in
11636                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11637                 esac
11638                 d_crypt_r=undef
11639                 crypt_r_proto=0
11640                 ;;
11641         esac
11642         ;;
11643 *)      crypt_r_proto=0
11644         ;;
11645 esac
11646
11647 : get csh whereabouts
11648 case "$csh" in
11649 'csh') val="$undef" ;;
11650 *) val="$define" ;;
11651 esac
11652 set d_csh
11653 eval $setvar
11654 : Respect a hint or command line value for full_csh.
11655 case "$full_csh" in
11656 '') full_csh=$csh ;;
11657 esac
11658
11659 : see if ctermid exists
11660 set ctermid d_ctermid
11661 eval $inlibc
11662
11663 : see if ctermid_r exists
11664 set ctermid_r d_ctermid_r
11665 eval $inlibc
11666 case "$d_ctermid_r" in
11667 "$define")
11668         hdrs="$i_systypes sys/types.h define stdio.h "
11669         case "$d_ctermid_r_proto:$usethreads" in
11670         ":define")      d_ctermid_r_proto=define
11671                 set d_ctermid_r_proto ctermid_r $hdrs
11672                 eval $hasproto ;;
11673         *)      ;;
11674         esac
11675         case "$d_ctermid_r_proto" in
11676         define)
11677         case "$ctermid_r_proto" in
11678         ''|0) try='char* ctermid_r(char*);'
11679         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11680         esac
11681         case "$ctermid_r_proto" in
11682         ''|0)   d_ctermid_r=undef
11683                 ctermid_r_proto=0
11684                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11685         * )     case "$ctermid_r_proto" in
11686                 REENTRANT_PROTO*) ;;
11687                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11688                 esac
11689                 echo "Prototype: $try" ;;
11690         esac
11691         ;;
11692         *)      case "$usethreads" in
11693                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11694                 esac
11695                 d_ctermid_r=undef
11696                 ctermid_r_proto=0
11697                 ;;
11698         esac
11699         ;;
11700 *)      ctermid_r_proto=0
11701         ;;
11702 esac
11703
11704 : see if ctime_r exists
11705 set ctime_r d_ctime_r
11706 eval $inlibc
11707 case "$d_ctime_r" in
11708 "$define")
11709         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11710         case "$d_ctime_r_proto:$usethreads" in
11711         ":define")      d_ctime_r_proto=define
11712                 set d_ctime_r_proto ctime_r $hdrs
11713                 eval $hasproto ;;
11714         *)      ;;
11715         esac
11716         case "$d_ctime_r_proto" in
11717         define)
11718         case "$ctime_r_proto" in
11719         ''|0) try='char* ctime_r(const time_t*, char*);'
11720         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11721         esac
11722         case "$ctime_r_proto" in
11723         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11724         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11725         esac
11726         case "$ctime_r_proto" in
11727         ''|0) try='int ctime_r(const time_t*, char*);'
11728         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11729         esac
11730         case "$ctime_r_proto" in
11731         ''|0) try='int ctime_r(const time_t*, char*, int);'
11732         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11733         esac
11734         case "$ctime_r_proto" in
11735         ''|0)   d_ctime_r=undef
11736                 ctime_r_proto=0
11737                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11738         * )     case "$ctime_r_proto" in
11739                 REENTRANT_PROTO*) ;;
11740                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11741                 esac
11742                 echo "Prototype: $try" ;;
11743         esac
11744         ;;
11745         *)      case "$usethreads" in
11746                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11747                 esac
11748                 d_ctime_r=undef
11749                 ctime_r_proto=0
11750                 ;;
11751         esac
11752         ;;
11753 *)      ctime_r_proto=0
11754         ;;
11755 esac
11756
11757 : see if cuserid exists
11758 set cuserid d_cuserid
11759 eval $inlibc
11760
11761 : see if this is a limits.h system
11762 set limits.h i_limits
11763 eval $inhdr
11764
11765 : see if this is a float.h system
11766 set float.h i_float
11767 eval $inhdr
11768
11769 : See if number of significant digits in a double precision number is known
11770 echo " "
11771 $cat >dbl_dig.c <<EOM
11772 #$i_limits I_LIMITS
11773 #$i_float I_FLOAT
11774 #ifdef I_LIMITS
11775 #include <limits.h>
11776 #endif
11777 #ifdef I_FLOAT
11778 #include <float.h>
11779 #endif
11780 #ifdef DBL_DIG
11781 printf("Contains DBL_DIG");
11782 #endif
11783 EOM
11784 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11785 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11786         echo "DBL_DIG found." >&4
11787         val="$define"
11788 else
11789         echo "DBL_DIG NOT found." >&4
11790         val="$undef"
11791 fi
11792 $rm -f dbl_dig.?
11793 set d_dbl_dig
11794 eval $setvar
11795
11796 : see if dbm.h is available
11797 : see if dbmclose exists
11798 set dbmclose d_dbmclose
11799 eval $inlibc
11800
11801 case "$d_dbmclose" in
11802 $define)
11803         set dbm.h i_dbm
11804         eval $inhdr
11805         case "$i_dbm" in
11806         $define)
11807                 val="$undef"
11808                 set i_rpcsvcdbm
11809                 eval $setvar
11810                 ;;
11811         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11812                 eval $inhdr
11813                 ;;
11814         esac
11815         ;;
11816 *)      echo "We won't be including <dbm.h>"
11817         val="$undef"
11818         set i_dbm
11819         eval $setvar
11820         val="$undef"
11821         set i_rpcsvcdbm
11822         eval $setvar
11823         ;;
11824 esac
11825
11826 : see if prototype for dbminit is available
11827 echo " "
11828 set d_dbminitproto dbminit $i_dbm dbm.h
11829 eval $hasproto
11830
11831 : see if difftime exists
11832 set difftime d_difftime
11833 eval $inlibc
11834
11835 : see if this is a dirent system
11836 echo " "
11837 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11838         val="$define"
11839         echo "<dirent.h> found." >&4
11840 else
11841         val="$undef"
11842         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11843                 echo "<sys/dir.h> found." >&4
11844                 echo " "
11845         else
11846                 xinc=`./findhdr sys/ndir.h`
11847         fi
11848         echo "<dirent.h> NOT found." >&4
11849 fi
11850 set i_dirent
11851 eval $setvar
11852
11853 : Look for type of directory structure.
11854 echo " "
11855 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11856
11857 case "$direntrytype" in
11858 ''|' ')
11859         case "$i_dirent" in
11860         $define) guess1='struct dirent' ;;
11861         *) guess1='struct direct'  ;;
11862         esac
11863         ;;
11864 *)      guess1="$direntrytype"
11865         ;;
11866 esac
11867
11868 case "$guess1" in
11869 'struct dirent') guess2='struct direct' ;;
11870 *) guess2='struct dirent' ;;
11871 esac
11872
11873 if $contains "$guess1" try.c >/dev/null 2>&1; then
11874         direntrytype="$guess1"
11875         echo "Your directory entries are $direntrytype." >&4
11876 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11877         direntrytype="$guess2"
11878         echo "Your directory entries seem to be $direntrytype." >&4
11879 else
11880         echo "I don't recognize your system's directory entries." >&4
11881         rp="What type is used for directory entries on this system?"
11882         dflt="$guess1"
11883         . ./myread
11884         direntrytype="$ans"
11885 fi
11886 $rm_try
11887
11888 : see if the directory entry stores field length
11889 echo " "
11890 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11891 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11892         echo "Good, your directory entry keeps length information in d_namlen." >&4
11893         val="$define"
11894 else
11895         echo "Your directory entry does not know about the d_namlen field." >&4
11896         val="$undef"
11897 fi
11898 set d_dirnamlen
11899 eval $setvar
11900 $rm_try
11901
11902 : Look for DIR.dd_fd
11903 case "$i_dirent" in
11904 "$define")
11905     echo "Checking to see if DIR has a dd_fd member variable" >&4
11906     $cat >try.c <<EOCP
11907 #$i_stdlib I_STDLIB
11908 #ifdef I_STDLIB
11909 #include <stdlib.h>
11910 #endif
11911 #include <dirent.h>
11912
11913 int main() {
11914     DIR dir;
11915     dir.dd_fd = 1;
11916     return 0;
11917 }
11918 EOCP
11919     val=$undef
11920     set try
11921     if eval $compile; then
11922         echo "Yes, it does."
11923         val="$define"
11924     else
11925         echo "No, it does not."
11926         val="$undef"
11927     fi
11928     ;;
11929 *)
11930     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11931     val="$undef"
11932     ;;
11933 esac
11934 set d_dir_dd_fd
11935 eval $setvar
11936 $rm_try
11937
11938 : see if this is an sysdir system
11939 set sys/dir.h i_sysdir
11940 eval $inhdr
11941
11942 : see if this is an sysndir system
11943 set sys/ndir.h i_sysndir
11944 eval $inhdr
11945
11946 : Look for dirfd
11947 echo " "
11948 $cat >dirfd.c <<EOM
11949 #include <stdio.h>
11950 #$i_stdlib I_STDLIB
11951 #ifdef I_STDLIB
11952 #include <stdlib.h>
11953 #endif
11954 #$i_dirent I_DIRENT             /**/
11955 #$i_sysdir I_SYS_DIR            /**/
11956 #$i_sysndir I_SYS_NDIR          /**/
11957 #$i_systypes I_SYS_TYPES        /**/
11958 #if defined(I_SYS_TYPES)
11959 #include <sys/types.h>
11960 #endif
11961 #if defined(I_DIRENT)
11962 #include <dirent.h>
11963 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11964 #include <sys/dir.h>
11965 #endif
11966 #else
11967 #ifdef I_SYS_NDIR
11968 #include <sys/ndir.h>
11969 #else
11970 #ifdef I_SYS_DIR
11971 #ifdef hp9000s500
11972 #include <ndir.h>       /* may be wrong in the future */
11973 #else
11974 #include <sys/dir.h>
11975 #endif
11976 #endif
11977 #endif
11978 #endif
11979 int main() {
11980         DIR *dirp = opendir(".");
11981         if (dirfd(dirp) >= 0)
11982                 exit(0);
11983         else
11984                 exit(1);
11985 }
11986 EOM
11987 val=$undef
11988 set dirfd
11989 if eval $compile; then
11990         val="$define"
11991 fi
11992 case "$val" in
11993 $define)        echo "dirfd() found." >&4       ;;
11994 *)              echo "dirfd() NOT found." >&4   ;;
11995 esac
11996 set d_dirfd
11997 eval $setvar
11998 $rm -f dirfd*
11999
12000 : see if dlerror exists
12001 xxx_runnm="$runnm"
12002 runnm=false
12003 set dlerror d_dlerror
12004 eval $inlibc
12005 runnm="$xxx_runnm"
12006
12007 : see if dlfcn is available
12008 set dlfcn.h i_dlfcn
12009 eval $inhdr
12010
12011 : Check what extension to use for shared libs
12012 case "$usedl" in
12013 $define|y|true)
12014         $cat << EOM
12015
12016 On a few systems, the dynamically loaded modules that perl generates and uses
12017 will need a different extension than shared libs. The default will probably
12018 be appropriate.
12019
12020 EOM
12021         case "$dlext" in
12022         '')     dflt="$so" ;;
12023         *)      dflt="$dlext" ;;
12024         esac
12025         rp='What is the extension of dynamically loaded modules'
12026         . ./myread
12027         dlext="$ans"
12028         ;;
12029 *)
12030         dlext="none"
12031         ;;
12032 esac
12033
12034 : Check if dlsym need a leading underscore
12035 echo " "
12036 val="$undef"
12037
12038 case "$dlsrc" in
12039 dl_dlopen.xs)
12040         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12041         $cat >dyna.c <<'EOM'
12042 fred () { }
12043 EOM
12044
12045 $cat >fred.c<<EOM
12046
12047 #include <stdio.h>
12048 #$i_stdlib I_STDLIB
12049 #ifdef I_STDLIB
12050 #include <stdlib.h>
12051 #endif
12052 #$i_dlfcn I_DLFCN
12053 #ifdef I_DLFCN
12054 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12055 #else
12056 #include <sys/types.h>
12057 #include <nlist.h>
12058 #include <link.h>
12059 #endif
12060
12061 extern int fred() ;
12062
12063 int main()
12064 {
12065     void * handle ;
12066     void * symbol ;
12067 #ifndef RTLD_LAZY
12068     int mode = 1 ;
12069 #else
12070     int mode = RTLD_LAZY ;
12071 #endif
12072     handle = dlopen("./dyna.$dlext", mode) ;
12073     if (handle == NULL) {
12074         printf ("1\n") ;
12075         fflush (stdout) ;
12076         exit(0);
12077     }
12078     symbol = dlsym(handle, "fred") ;
12079     if (symbol == NULL) {
12080         /* try putting a leading underscore */
12081         symbol = dlsym(handle, "_fred") ;
12082         if (symbol == NULL) {
12083             printf ("2\n") ;
12084             fflush (stdout) ;
12085             exit(0);
12086         }
12087         printf ("3\n") ;
12088     }
12089     else
12090         printf ("4\n") ;
12091     fflush (stdout) ;
12092     exit(0);
12093 }
12094 EOM
12095         : Call the object file tmp-dyna.o in case dlext=o.
12096         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12097                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12098                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12099                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12100                 xxx=`$run ./fred`
12101                 case $xxx in
12102                 1)      echo "Test program failed using dlopen." >&4
12103                         echo "Perhaps you should not use dynamic loading." >&4;;
12104                 2)      echo "Test program failed using dlsym." >&4
12105                         echo "Perhaps you should not use dynamic loading." >&4;;
12106                 3)      echo "dlsym needs a leading underscore" >&4
12107                         val="$define" ;;
12108                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12109                 esac
12110         else
12111                 echo "I can't compile and run the test program." >&4
12112                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12113         fi
12114         ;;
12115 esac
12116
12117 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12118
12119 set d_dlsymun
12120 eval $setvar
12121
12122 : see if drand48_r exists
12123 set drand48_r d_drand48_r
12124 eval $inlibc
12125 case "$d_drand48_r" in
12126 "$define")
12127         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12128         case "$d_drand48_r_proto:$usethreads" in
12129         ":define")      d_drand48_r_proto=define
12130                 set d_drand48_r_proto drand48_r $hdrs
12131                 eval $hasproto ;;
12132         *)      ;;
12133         esac
12134         case "$d_drand48_r_proto" in
12135         define)
12136         case "$drand48_r_proto" in
12137         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12138         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12139         esac
12140         case "$drand48_r_proto" in
12141         ''|0)   d_drand48_r=undef
12142                 drand48_r_proto=0
12143                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12144         * )     case "$drand48_r_proto" in
12145                 REENTRANT_PROTO*) ;;
12146                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12147                 esac
12148                 echo "Prototype: $try" ;;
12149         esac
12150         ;;
12151         *)      case "$usethreads" in
12152                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12153                 esac
12154                 d_drand48_r=undef
12155                 drand48_r_proto=0
12156                 ;;
12157         esac
12158         ;;
12159 *)      drand48_r_proto=0
12160         ;;
12161 esac
12162
12163 : see if prototype for drand48 is available
12164 echo " "
12165 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12166 eval $hasproto
12167
12168 : see if dup2 exists
12169 set dup2 d_dup2
12170 eval $inlibc
12171
12172 : see if eaccess exists
12173 set eaccess d_eaccess
12174 eval $inlibc
12175
12176 : see if endgrent exists
12177 set endgrent d_endgrent
12178 eval $inlibc
12179
12180 : see if this is an grp system
12181 set grp.h i_grp
12182 eval $inhdr
12183
12184 case "$i_grp" in
12185 $define)
12186         xxx=`./findhdr grp.h`
12187         $cppstdin $cppflags $cppminus < $xxx >$$.h
12188
12189         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12190                 val="$define"
12191         else
12192                 val="$undef"
12193         fi
12194         set d_grpasswd
12195         eval $setvar
12196
12197         $rm -f $$.h
12198         ;;
12199 *)
12200         val="$undef";
12201         set d_grpasswd; eval $setvar
12202         ;;
12203 esac
12204
12205 : see if endgrent_r exists
12206 set endgrent_r d_endgrent_r
12207 eval $inlibc
12208 case "$d_endgrent_r" in
12209 "$define")
12210         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12211         case "$d_endgrent_r_proto:$usethreads" in
12212         ":define")      d_endgrent_r_proto=define
12213                 set d_endgrent_r_proto endgrent_r $hdrs
12214                 eval $hasproto ;;
12215         *)      ;;
12216         esac
12217         case "$d_endgrent_r_proto" in
12218         define)
12219         case "$endgrent_r_proto" in
12220         ''|0) try='int endgrent_r(FILE**);'
12221         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12222         esac
12223         case "$endgrent_r_proto" in
12224         ''|0) try='void endgrent_r(FILE**);'
12225         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12226         esac
12227         case "$endgrent_r_proto" in
12228         ''|0)   d_endgrent_r=undef
12229                 endgrent_r_proto=0
12230                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12231         * )     case "$endgrent_r_proto" in
12232                 REENTRANT_PROTO*) ;;
12233                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12234                 esac
12235                 echo "Prototype: $try" ;;
12236         esac
12237         ;;
12238         *)      case "$usethreads" in
12239                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12240                 esac
12241                 d_endgrent_r=undef
12242                 endgrent_r_proto=0
12243                 ;;
12244         esac
12245         ;;
12246 *)      endgrent_r_proto=0
12247         ;;
12248 esac
12249
12250 : see if endhostent exists
12251 set endhostent d_endhent
12252 eval $inlibc
12253
12254 : see if this is a netdb.h system
12255 set netdb.h i_netdb
12256 eval $inhdr
12257
12258 : see if endhostent_r exists
12259 set endhostent_r d_endhostent_r
12260 eval $inlibc
12261 case "$d_endhostent_r" in
12262 "$define")
12263         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12264         case "$d_endhostent_r_proto:$usethreads" in
12265         ":define")      d_endhostent_r_proto=define
12266                 set d_endhostent_r_proto endhostent_r $hdrs
12267                 eval $hasproto ;;
12268         *)      ;;
12269         esac
12270         case "$d_endhostent_r_proto" in
12271         define)
12272         case "$endhostent_r_proto" in
12273         ''|0) try='int endhostent_r(struct hostent_data*);'
12274         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12275         esac
12276         case "$endhostent_r_proto" in
12277         ''|0) try='void endhostent_r(struct hostent_data*);'
12278         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12279         esac
12280         case "$endhostent_r_proto" in
12281         ''|0)   d_endhostent_r=undef
12282                 endhostent_r_proto=0
12283                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12284         * )     case "$endhostent_r_proto" in
12285                 REENTRANT_PROTO*) ;;
12286                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12287                 esac
12288                 echo "Prototype: $try" ;;
12289         esac
12290         ;;
12291         *)      case "$usethreads" in
12292                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12293                 esac
12294                 d_endhostent_r=undef
12295                 endhostent_r_proto=0
12296                 ;;
12297         esac
12298         ;;
12299 *)      endhostent_r_proto=0
12300         ;;
12301 esac
12302
12303 : see if endnetent exists
12304 set endnetent d_endnent
12305 eval $inlibc
12306
12307 : see if endnetent_r exists
12308 set endnetent_r d_endnetent_r
12309 eval $inlibc
12310 case "$d_endnetent_r" in
12311 "$define")
12312         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12313         case "$d_endnetent_r_proto:$usethreads" in
12314         ":define")      d_endnetent_r_proto=define
12315                 set d_endnetent_r_proto endnetent_r $hdrs
12316                 eval $hasproto ;;
12317         *)      ;;
12318         esac
12319         case "$d_endnetent_r_proto" in
12320         define)
12321         case "$endnetent_r_proto" in
12322         ''|0) try='int endnetent_r(struct netent_data*);'
12323         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12324         esac
12325         case "$endnetent_r_proto" in
12326         ''|0) try='void endnetent_r(struct netent_data*);'
12327         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12328         esac
12329         case "$endnetent_r_proto" in
12330         ''|0)   d_endnetent_r=undef
12331                 endnetent_r_proto=0
12332                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12333         * )     case "$endnetent_r_proto" in
12334                 REENTRANT_PROTO*) ;;
12335                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12336                 esac
12337                 echo "Prototype: $try" ;;
12338         esac
12339         ;;
12340         *)      case "$usethreads" in
12341                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12342                 esac
12343                 d_endnetent_r=undef
12344                 endnetent_r_proto=0
12345                 ;;
12346         esac
12347         ;;
12348 *)      endnetent_r_proto=0
12349         ;;
12350 esac
12351
12352 : see if endprotoent exists
12353 set endprotoent d_endpent
12354 eval $inlibc
12355
12356 : see if endprotoent_r exists
12357 set endprotoent_r d_endprotoent_r
12358 eval $inlibc
12359 case "$d_endprotoent_r" in
12360 "$define")
12361         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12362         case "$d_endprotoent_r_proto:$usethreads" in
12363         ":define")      d_endprotoent_r_proto=define
12364                 set d_endprotoent_r_proto endprotoent_r $hdrs
12365                 eval $hasproto ;;
12366         *)      ;;
12367         esac
12368         case "$d_endprotoent_r_proto" in
12369         define)
12370         case "$endprotoent_r_proto" in
12371         ''|0) try='int endprotoent_r(struct protoent_data*);'
12372         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12373         esac
12374         case "$endprotoent_r_proto" in
12375         ''|0) try='void endprotoent_r(struct protoent_data*);'
12376         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12377         esac
12378         case "$endprotoent_r_proto" in
12379         ''|0)   d_endprotoent_r=undef
12380                 endprotoent_r_proto=0
12381                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12382         * )     case "$endprotoent_r_proto" in
12383                 REENTRANT_PROTO*) ;;
12384                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12385                 esac
12386                 echo "Prototype: $try" ;;
12387         esac
12388         ;;
12389         *)      case "$usethreads" in
12390                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12391                 esac
12392                 d_endprotoent_r=undef
12393                 endprotoent_r_proto=0
12394                 ;;
12395         esac
12396         ;;
12397 *)      endprotoent_r_proto=0
12398         ;;
12399 esac
12400
12401 : see if endpwent exists
12402 set endpwent d_endpwent
12403 eval $inlibc
12404
12405 : see if this is a pwd.h system
12406 set pwd.h i_pwd
12407 eval $inhdr
12408
12409 case "$i_pwd" in
12410 $define)
12411         xxx=`./findhdr pwd.h`
12412         $cppstdin $cppflags $cppminus < $xxx >$$.h
12413
12414         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12415                 val="$define"
12416         else
12417                 val="$undef"
12418         fi
12419         set d_pwquota
12420         eval $setvar
12421
12422         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12423                 val="$define"
12424         else
12425                 val="$undef"
12426         fi
12427         set d_pwage
12428         eval $setvar
12429
12430         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12431                 val="$define"
12432         else
12433                 val="$undef"
12434         fi
12435         set d_pwchange
12436         eval $setvar
12437
12438         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12439                 val="$define"
12440         else
12441                 val="$undef"
12442         fi
12443         set d_pwclass
12444         eval $setvar
12445
12446         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12447                 val="$define"
12448         else
12449                 val="$undef"
12450         fi
12451         set d_pwexpire
12452         eval $setvar
12453
12454         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12455                 val="$define"
12456         else
12457                 val="$undef"
12458         fi
12459         set d_pwcomment
12460         eval $setvar
12461
12462         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12463                 val="$define"
12464         else
12465                 val="$undef"
12466         fi
12467         set d_pwgecos
12468         eval $setvar
12469
12470         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12471                 val="$define"
12472         else
12473                 val="$undef"
12474         fi
12475         set d_pwpasswd
12476         eval $setvar
12477
12478         $rm -f $$.h
12479         ;;
12480 *)
12481         val="$undef";
12482         set d_pwquota; eval $setvar
12483         set d_pwage; eval $setvar
12484         set d_pwchange; eval $setvar
12485         set d_pwclass; eval $setvar
12486         set d_pwexpire; eval $setvar
12487         set d_pwcomment; eval $setvar
12488         set d_pwgecos; eval $setvar
12489         set d_pwpasswd; eval $setvar
12490         ;;
12491 esac
12492
12493 : see if endpwent_r exists
12494 set endpwent_r d_endpwent_r
12495 eval $inlibc
12496 case "$d_endpwent_r" in
12497 "$define")
12498         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12499         case "$d_endpwent_r_proto:$usethreads" in
12500         ":define")      d_endpwent_r_proto=define
12501                 set d_endpwent_r_proto endpwent_r $hdrs
12502                 eval $hasproto ;;
12503         *)      ;;
12504         esac
12505         case "$d_endpwent_r_proto" in
12506         define)
12507         case "$endpwent_r_proto" in
12508         ''|0) try='int endpwent_r(FILE**);'
12509         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12510         esac
12511         case "$endpwent_r_proto" in
12512         ''|0) try='void endpwent_r(FILE**);'
12513         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12514         esac
12515         case "$endpwent_r_proto" in
12516         ''|0)   d_endpwent_r=undef
12517                 endpwent_r_proto=0
12518                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12519         * )     case "$endpwent_r_proto" in
12520                 REENTRANT_PROTO*) ;;
12521                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12522                 esac
12523                 echo "Prototype: $try" ;;
12524         esac
12525         ;;
12526         *)      case "$usethreads" in
12527                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12528                 esac
12529                 d_endpwent_r=undef
12530                 endpwent_r_proto=0
12531                 ;;
12532         esac
12533         ;;
12534 *)      endpwent_r_proto=0
12535         ;;
12536 esac
12537
12538 : see if endservent exists
12539 set endservent d_endsent
12540 eval $inlibc
12541
12542 : see if endservent_r exists
12543 set endservent_r d_endservent_r
12544 eval $inlibc
12545 case "$d_endservent_r" in
12546 "$define")
12547         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12548         case "$d_endservent_r_proto:$usethreads" in
12549         ":define")      d_endservent_r_proto=define
12550                 set d_endservent_r_proto endservent_r $hdrs
12551                 eval $hasproto ;;
12552         *)      ;;
12553         esac
12554         case "$d_endservent_r_proto" in
12555         define)
12556         case "$endservent_r_proto" in
12557         ''|0) try='int endservent_r(struct servent_data*);'
12558         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12559         esac
12560         case "$endservent_r_proto" in
12561         ''|0) try='void endservent_r(struct servent_data*);'
12562         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12563         esac
12564         case "$endservent_r_proto" in
12565         ''|0)   d_endservent_r=undef
12566                 endservent_r_proto=0
12567                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12568         * )     case "$endservent_r_proto" in
12569                 REENTRANT_PROTO*) ;;
12570                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12571                 esac
12572                 echo "Prototype: $try" ;;
12573         esac
12574         ;;
12575         *)      case "$usethreads" in
12576                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12577                 esac
12578                 d_endservent_r=undef
12579                 endservent_r_proto=0
12580                 ;;
12581         esac
12582         ;;
12583 *)      endservent_r_proto=0
12584         ;;
12585 esac
12586
12587 : Locate the flags for 'open()'
12588 echo " "
12589 $cat >try.c <<EOCP
12590 #include <sys/types.h>
12591 #ifdef I_FCNTL
12592 #include <fcntl.h>
12593 #endif
12594 #ifdef I_SYS_FILE
12595 #include <sys/file.h>
12596 #endif
12597 #$i_stdlib I_STDLIB
12598 #ifdef I_STDLIB
12599 #include <stdlib.h>
12600 #endif
12601 int main() {
12602         if(O_RDONLY);
12603 #ifdef O_TRUNC
12604         exit(0);
12605 #else
12606         exit(1);
12607 #endif
12608 }
12609 EOCP
12610 : check sys/file.h first to get FREAD on Sun
12611 if $test `./findhdr sys/file.h` && \
12612                 set try -DI_SYS_FILE && eval $compile; then
12613         h_sysfile=true;
12614         echo "<sys/file.h> defines the O_* constants..." >&4
12615         if $run ./try; then
12616                 echo "and you have the 3 argument form of open()." >&4
12617                 val="$define"
12618         else
12619                 echo "but not the 3 argument form of open().  Oh, well." >&4
12620                 val="$undef"
12621         fi
12622 elif $test `./findhdr fcntl.h` && \
12623                 set try -DI_FCNTL && eval $compile; then
12624         h_fcntl=true;
12625         echo "<fcntl.h> defines the O_* constants..." >&4
12626         if $run ./try; then
12627                 echo "and you have the 3 argument form of open()." >&4
12628                 val="$define"
12629         else
12630                 echo "but not the 3 argument form of open().  Oh, well." >&4
12631                 val="$undef"
12632         fi
12633 else
12634         val="$undef"
12635         echo "I can't find the O_* constant definitions!  You got problems." >&4
12636 fi
12637 set d_open3
12638 eval $setvar
12639 $rm_try
12640
12641 : see if this is a sys/file.h system
12642 val=''
12643 set sys/file.h val
12644 eval $inhdr
12645
12646 : do we need to include sys/file.h ?
12647 case "$val" in
12648 "$define")
12649         echo " "
12650         if $h_sysfile; then
12651                 val="$define"
12652                 echo "We'll be including <sys/file.h>." >&4
12653         else
12654                 val="$undef"
12655                 echo "We won't be including <sys/file.h>." >&4
12656         fi
12657         ;;
12658 *)
12659         h_sysfile=false
12660         ;;
12661 esac
12662 set i_sysfile
12663 eval $setvar
12664
12665 : see if fcntl.h is there
12666 val=''
12667 set fcntl.h val
12668 eval $inhdr
12669
12670 : see if we can include fcntl.h
12671 case "$val" in
12672 "$define")
12673         echo " "
12674         if $h_fcntl; then
12675                 val="$define"
12676                 echo "We'll be including <fcntl.h>." >&4
12677         else
12678                 val="$undef"
12679                 if $h_sysfile; then
12680         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12681                 else
12682                         echo "We won't be including <fcntl.h>." >&4
12683                 fi
12684         fi
12685         ;;
12686 *)
12687         h_fcntl=false
12688         val="$undef"
12689         ;;
12690 esac
12691 set i_fcntl
12692 eval $setvar
12693
12694 : see if fork exists
12695 set fork d_fork
12696 eval $inlibc
12697
12698 : see if pipe exists
12699 set pipe d_pipe
12700 eval $inlibc
12701
12702 : check for non-blocking I/O stuff
12703 case "$h_sysfile" in
12704 true) echo "#include <sys/file.h>" > head.c;;
12705 *)
12706        case "$h_fcntl" in
12707        true) echo "#include <fcntl.h>" > head.c;;
12708        *) echo "#include <sys/fcntl.h>" > head.c;;
12709        esac
12710        ;;
12711 esac
12712 echo " "
12713 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12714 case "$o_nonblock" in
12715 '')
12716         $cat head.c > try.c
12717         $cat >>try.c <<EOCP
12718 #include <stdio.h>
12719 #$i_stdlib I_STDLIB
12720 #ifdef I_STDLIB
12721 #include <stdlib.h>
12722 #endif
12723 #$i_fcntl I_FCNTL
12724 #ifdef I_FCNTL
12725 #include <fcntl.h>
12726 #endif
12727 int main() {
12728 #ifdef O_NONBLOCK
12729         printf("O_NONBLOCK\n");
12730         exit(0);
12731 #endif
12732 #ifdef O_NDELAY
12733         printf("O_NDELAY\n");
12734         exit(0);
12735 #endif
12736 #ifdef FNDELAY
12737         printf("FNDELAY\n");
12738         exit(0);
12739 #endif
12740         exit(0);
12741 }
12742 EOCP
12743         set try
12744         if eval $compile_ok; then
12745                 o_nonblock=`$run ./try`
12746                 case "$o_nonblock" in
12747                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12748                 *) echo "Seems like we can use $o_nonblock.";;
12749                 esac
12750         else
12751                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12752         fi
12753         ;;
12754 *) echo "Using $hint value $o_nonblock.";;
12755 esac
12756 $rm_try
12757
12758 echo " "
12759 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12760 case "$eagain" in
12761 '')
12762         case "$d_fork:$d_pipe" in
12763         define:define)
12764         $cat head.c > try.c
12765         $cat >>try.c <<EOCP
12766 #include <errno.h>
12767 #include <sys/types.h>
12768 #include <signal.h>
12769 #include <stdio.h>
12770 #$i_stdlib I_STDLIB
12771 #ifdef I_STDLIB
12772 #include <stdlib.h>
12773 #endif
12774 #$i_fcntl I_FCNTL
12775 #ifdef I_FCNTL
12776 #include <fcntl.h>
12777 #endif
12778 #define MY_O_NONBLOCK $o_nonblock
12779 #ifndef errno  /* XXX need better Configure test */
12780 extern int errno;
12781 #endif
12782 #$i_unistd I_UNISTD
12783 #ifdef I_UNISTD
12784 #include <unistd.h>
12785 #endif
12786 #$i_string I_STRING
12787 #ifdef I_STRING
12788 #include <string.h>
12789 #else
12790 #include <strings.h>
12791 #endif
12792 $signal_t blech(int x) { exit(3); }
12793 EOCP
12794         $cat >> try.c <<'EOCP'
12795 int main()
12796 {
12797         int pd[2];
12798         int pu[2];
12799         char buf[1];
12800         char string[100];
12801
12802         pipe(pd);       /* Down: child -> parent */
12803         pipe(pu);       /* Up: parent -> child */
12804         if (0 != fork()) {
12805                 int ret;
12806                 close(pd[1]);   /* Parent reads from pd[0] */
12807                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12808 #ifdef F_SETFL
12809                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12810                         exit(1);
12811 #else
12812                 exit(4);
12813 #endif
12814                 signal(SIGALRM, blech);
12815                 alarm(5);
12816                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12817                         exit(2);
12818                 sprintf(string, "%d\n", ret);
12819                 write(2, string, strlen(string));
12820                 alarm(0);
12821 #ifdef EAGAIN
12822                 if (errno == EAGAIN) {
12823                         printf("EAGAIN\n");
12824                         goto ok;
12825                 }
12826 #endif
12827 #ifdef EWOULDBLOCK
12828                 if (errno == EWOULDBLOCK)
12829                         printf("EWOULDBLOCK\n");
12830 #endif
12831         ok:
12832                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12833                 sleep(2);                               /* Give it time to close our pipe */
12834                 alarm(5);
12835                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12836                 alarm(0);
12837                 sprintf(string, "%d\n", ret);
12838                 write(4, string, strlen(string));
12839                 exit(0);
12840         }
12841
12842         close(pd[0]);                   /* We write to pd[1] */
12843         close(pu[1]);                   /* We read from pu[0] */
12844         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12845         close(pd[1]);                   /* Pipe pd is now fully closed! */
12846         exit(0);                                /* Bye bye, thank you for playing! */
12847 }
12848 EOCP
12849         set try
12850         if eval $compile_ok; then
12851                 echo "$startsh" >mtry
12852                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12853                 chmod +x mtry
12854                 ./mtry >/dev/null 2>&1
12855                 case $? in
12856                 0) eagain=`$cat try.out`;;
12857                 1) echo "Could not perform non-blocking setting!";;
12858                 2) echo "I did a successful read() for something that was not there!";;
12859                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12860                 4) echo "Could not find F_SETFL!";;
12861                 *) echo "Something terribly wrong happened during testing.";;
12862                 esac
12863                 rd_nodata=`$cat try.ret`
12864                 echo "A read() system call with no data present returns $rd_nodata."
12865                 case "$rd_nodata" in
12866                 0|-1) ;;
12867                 *)
12868                         echo "(That's peculiar, fixing that to be -1.)"
12869                         rd_nodata=-1
12870                         ;;
12871                 esac
12872                 case "$eagain" in
12873                 '')
12874                         echo "Forcing errno EAGAIN on read() with no data available."
12875                         eagain=EAGAIN
12876                         ;;
12877                 *)
12878                         echo "Your read() sets errno to $eagain when no data is available."
12879                         ;;
12880                 esac
12881                 status=`$cat try.err`
12882                 case "$status" in
12883                 0) echo "And it correctly returns 0 to signal EOF.";;
12884                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12885                 *) echo "However, your read() returns '$status' on EOF??";;
12886                 esac
12887                 val="$define"
12888                 if test "$status" = "$rd_nodata"; then
12889                         echo "WARNING: you can't distinguish between EOF and no data!"
12890                         val="$undef"
12891                 fi
12892         else
12893                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12894                 eagain=EAGAIN
12895         fi
12896         ;;
12897         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12898                 eagain=EAGAIN
12899                 val="$define"
12900                 ;;
12901         esac
12902         set d_eofnblk
12903         eval $setvar
12904         ;;
12905 *)
12906         echo "Using $hint value $eagain."
12907         echo "Your read() returns $rd_nodata when no data is present."
12908         case "$d_eofnblk" in
12909         "$define") echo "And you can see EOF because read() returns 0.";;
12910         "$undef") echo "But you can't see EOF status from read() returned value.";;
12911         *)
12912                 echo "(Assuming you can't see EOF status from read anyway.)"
12913                 d_eofnblk=$undef
12914                 ;;
12915         esac
12916         ;;
12917 esac
12918 $rm_try head.c mtry
12919
12920 : see if _ptr and _cnt from stdio act std
12921 echo " "
12922
12923 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12924         echo "(Looks like you have stdio.h from BSD.)"
12925         case "$stdio_ptr" in
12926         '') stdio_ptr='((fp)->_p)'
12927                 ptr_lval=$define
12928                 ;;
12929         *)      ptr_lval=$d_stdio_ptr_lval;;
12930         esac
12931         case "$stdio_cnt" in
12932         '') stdio_cnt='((fp)->_r)'
12933                 cnt_lval=$define
12934                 ;;
12935         *)      cnt_lval=$d_stdio_cnt_lval;;
12936         esac
12937         case "$stdio_base" in
12938         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12939         esac
12940         case "$stdio_bufsiz" in
12941         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12942         esac
12943 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12944         echo "(Looks like you have stdio.h from Linux.)"
12945         case "$stdio_ptr" in
12946         '') stdio_ptr='((fp)->_IO_read_ptr)'
12947                 ptr_lval=$define
12948                 ;;
12949         *)      ptr_lval=$d_stdio_ptr_lval;;
12950         esac
12951         case "$stdio_cnt" in
12952         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12953                 cnt_lval=$undef
12954                 ;;
12955         *)      cnt_lval=$d_stdio_cnt_lval;;
12956         esac
12957         case "$stdio_base" in
12958         '') stdio_base='((fp)->_IO_read_base)';;
12959         esac
12960         case "$stdio_bufsiz" in
12961         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12962         esac
12963 else
12964         case "$stdio_ptr" in
12965         '') stdio_ptr='((fp)->_ptr)'
12966                 ptr_lval=$define
12967                 ;;
12968         *)      ptr_lval=$d_stdio_ptr_lval;;
12969         esac
12970         case "$stdio_cnt" in
12971         '') stdio_cnt='((fp)->_cnt)'
12972                 cnt_lval=$define
12973                 ;;
12974         *)      cnt_lval=$d_stdio_cnt_lval;;
12975         esac
12976         case "$stdio_base" in
12977         '') stdio_base='((fp)->_base)';;
12978         esac
12979         case "$stdio_bufsiz" in
12980         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12981         esac
12982 fi
12983
12984 : test whether _ptr and _cnt really work
12985 echo "Checking how std your stdio is..." >&4
12986 $cat >try.c <<EOP
12987 #include <stdio.h>
12988 #$i_stdlib I_STDLIB
12989 #ifdef I_STDLIB
12990 #include <stdlib.h>
12991 #endif
12992 #define FILE_ptr(fp)    $stdio_ptr
12993 #define FILE_cnt(fp)    $stdio_cnt
12994 int main() {
12995         FILE *fp = fopen("try.c", "r");
12996         char c = getc(fp);
12997         if (
12998                 18 <= FILE_cnt(fp) &&
12999                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13000         )
13001                 exit(0);
13002         exit(1);
13003 }
13004 EOP
13005 val="$undef"
13006 set try
13007 if eval $compile && $to try.c; then
13008         if $run ./try; then
13009                 echo "Your stdio acts pretty std."
13010                 val="$define"
13011         else
13012                 echo "Your stdio isn't very std."
13013         fi
13014 else
13015         echo "Your stdio doesn't appear very std."
13016 fi
13017 $rm_try
13018
13019 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13020 # direct buffer manipulation no longer works.  The Configure tests
13021 # should be changed to correctly detect this, but until then,
13022 # the following check should at least let perl compile and run.
13023 # (This quick fix should be updated before 5.8.1.)
13024 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13025 # A. Dougherty, June 3, 2002.
13026 case "$d_gnulibc" in
13027 $define)
13028         case "$gnulibc_version" in
13029         2.[01]*)  ;;
13030         2.2) ;;
13031         2.2.[0-9]) ;;
13032         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13033                 val="$undef"
13034                 ;;
13035         esac
13036         ;;
13037 esac
13038 set d_stdstdio
13039 eval $setvar
13040
13041 : Can _ptr be used as an lvalue?
13042 case "$d_stdstdio$ptr_lval" in
13043 $define$define) val=$define ;;
13044 *) val=$undef ;;
13045 esac
13046 set d_stdio_ptr_lval
13047 eval $setvar
13048
13049 : Can _cnt be used as an lvalue?
13050 case "$d_stdstdio$cnt_lval" in
13051 $define$define) val=$define ;;
13052 *) val=$undef ;;
13053 esac
13054 set d_stdio_cnt_lval
13055 eval $setvar
13056
13057
13058 : test whether setting _ptr sets _cnt as a side effect
13059 d_stdio_ptr_lval_sets_cnt="$undef"
13060 d_stdio_ptr_lval_nochange_cnt="$undef"
13061 case "$d_stdio_ptr_lval$d_stdstdio" in
13062 $define$define)
13063         echo "Checking to see what happens if we set the stdio ptr..." >&4
13064 $cat >try.c <<EOP
13065 #include <stdio.h>
13066 /* Can we scream? */
13067 /* Eat dust sed :-) */
13068 /* In the buffer space, no one can hear you scream. */
13069 #$i_stdlib I_STDLIB
13070 #ifdef I_STDLIB
13071 #include <stdlib.h>
13072 #endif
13073 #define FILE_ptr(fp)    $stdio_ptr
13074 #define FILE_cnt(fp)    $stdio_cnt
13075 #include <sys/types.h>
13076 int main() {
13077         FILE *fp = fopen("try.c", "r");
13078         int c;
13079         char *ptr;
13080         size_t cnt;
13081         if (!fp) {
13082             puts("Fail even to read");
13083             exit(1);
13084         }
13085         c = getc(fp); /* Read away the first # */
13086         if (c == EOF) {
13087             puts("Fail even to read");
13088             exit(1);
13089         }
13090         if (!(
13091                 18 <= FILE_cnt(fp) &&
13092                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13093         )) {
13094                 puts("Fail even to read");
13095                 exit (1);
13096         }
13097         ptr = (char*) FILE_ptr(fp);
13098         cnt = (size_t)FILE_cnt(fp);
13099
13100         FILE_ptr(fp) += 42;
13101
13102         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13103                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13104                 exit (1);
13105         }
13106         if (FILE_cnt(fp) <= 20) {
13107                 printf ("Fail (<20 chars to test)");
13108                 exit (1);
13109         }
13110         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13111                 puts("Fail compare");
13112                 exit (1);
13113         }
13114         if (cnt == FILE_cnt(fp)) {
13115                 puts("Pass_unchanged");
13116                 exit (0);
13117         }
13118         if (FILE_cnt(fp) == (cnt - 42)) {
13119                 puts("Pass_changed");
13120                 exit (0);
13121         }
13122         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13123         return 1;
13124
13125 }
13126 EOP
13127         set try
13128         if eval $compile && $to try.c; then
13129                 case `$run ./try` in
13130                 Pass_changed)
13131                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13132                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13133                 Pass_unchanged)
13134                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13135                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13136                 Fail*)
13137                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13138                 *)
13139                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13140         esac
13141         else
13142                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13143         fi
13144         $rm_try
13145         ;;
13146 esac
13147
13148 : see if _base is also standard
13149 val="$undef"
13150 case "$d_stdstdio" in
13151 $define)
13152         $cat >try.c <<EOP
13153 #include <stdio.h>
13154 #$i_stdlib I_STDLIB
13155 #ifdef I_STDLIB
13156 #include <stdlib.h>
13157 #endif
13158 #define FILE_base(fp)   $stdio_base
13159 #define FILE_bufsiz(fp) $stdio_bufsiz
13160 int main() {
13161         FILE *fp = fopen("try.c", "r");
13162         char c = getc(fp);
13163         if (
13164                 19 <= FILE_bufsiz(fp) &&
13165                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13166         )
13167                 exit(0);
13168         exit(1);
13169 }
13170 EOP
13171         set try
13172         if eval $compile && $to try.c; then
13173                 if $run ./try; then
13174                         echo "And its _base field acts std."
13175                         val="$define"
13176                 else
13177                         echo "But its _base field isn't std."
13178                 fi
13179         else
13180                 echo "However, it seems to be lacking the _base field."
13181         fi
13182         $rm_try
13183         ;;
13184 esac
13185 set d_stdiobase
13186 eval $setvar
13187
13188 : see if fast_stdio exists
13189 val="$undef"
13190 case "$d_stdstdio:$d_stdio_ptr_lval" in
13191 "$define:$define")
13192         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13193         *$define*)
13194                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13195                 val="$define"
13196                 ;;
13197         esac
13198         ;;
13199 esac
13200 set d_faststdio
13201 eval $setvar
13202
13203
13204
13205 : see if fchdir exists
13206 set fchdir d_fchdir
13207 eval $inlibc
13208
13209 : see if fchmod exists
13210 set fchmod d_fchmod
13211 eval $inlibc
13212
13213 : see if fchown exists
13214 set fchown d_fchown
13215 eval $inlibc
13216
13217 : see if this is an fcntl system
13218 set fcntl d_fcntl
13219 eval $inlibc
13220
13221 : See if fcntl-based locking works.
13222 echo " "
13223 $cat >try.c <<EOCP
13224 #$i_stdlib I_STDLIB
13225 #ifdef I_STDLIB
13226 #include <stdlib.h>
13227 #endif
13228 #include <unistd.h>
13229 #include <fcntl.h>
13230 #include <signal.h>
13231 $signal_t blech(int x) { exit(3); }
13232 int main() {
13233 #if defined(F_SETLK) && defined(F_SETLKW)
13234      struct flock flock;
13235      int retval, fd;
13236      fd = open("try.c", O_RDONLY);
13237      flock.l_type = F_RDLCK;
13238      flock.l_whence = SEEK_SET;
13239      flock.l_start = flock.l_len = 0;
13240      signal(SIGALRM, blech);
13241      alarm(10);
13242      retval = fcntl(fd, F_SETLK, &flock);
13243      close(fd);
13244      (retval < 0 ? exit(2) : exit(0));
13245 #else
13246      exit(2);
13247 #endif
13248 }
13249 EOCP
13250 echo "Checking if fcntl-based file locking works... "
13251 case "$d_fcntl" in
13252 "$define")
13253         set try
13254         if eval $compile_ok; then
13255                 if $run ./try; then
13256                         echo "Yes, it seems to work."
13257                         val="$define"
13258                 else
13259                         echo "Nope, it didn't work."
13260                         val="$undef"
13261                         case "$?" in
13262                         3) $cat >&4 <<EOM
13263 ***
13264 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13265 *** This is (almost) impossible.
13266 *** If your NFS lock daemons are not feeling well, something like
13267 *** this may happen, please investigate.  Cannot continue, aborting.
13268 ***
13269 EOM
13270                                 exit 1
13271                                 ;;
13272                         esac
13273                 fi
13274         else
13275                 echo "I'm unable to compile the test program, so I'll assume not."
13276                 val="$undef"
13277         fi
13278         ;;
13279 *) val="$undef";
13280         echo "Nope, since you don't even have fcntl()."
13281         ;;
13282 esac
13283 set d_fcntl_can_lock
13284 eval $setvar
13285 $rm_try
13286
13287 : check for fd_set items
13288 $cat <<EOM
13289
13290 Checking to see how well your C compiler handles fd_set and friends ...
13291 EOM
13292 $cat >try.c <<EOCP
13293 #$i_stdlib I_STDLIB
13294 #ifdef I_STDLIB
13295 #include <stdlib.h>
13296 #endif
13297 #$i_systime I_SYS_TIME
13298 #$i_sysselct I_SYS_SELECT
13299 #$d_socket HAS_SOCKET
13300 #include <sys/types.h>
13301 #ifdef HAS_SOCKET
13302 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13303 #endif
13304 #ifdef I_SYS_TIME
13305 #include <sys/time.h>
13306 #endif
13307 #ifdef I_SYS_SELECT
13308 #include <sys/select.h>
13309 #endif
13310 int main() {
13311         fd_set fds;
13312
13313 #ifdef TRYBITS
13314         if(fds.fds_bits);
13315 #endif
13316
13317 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13318         exit(0);
13319 #else
13320         exit(1);
13321 #endif
13322 }
13323 EOCP
13324 set try -DTRYBITS
13325 if eval $compile; then
13326         d_fds_bits="$define"
13327         d_fd_set="$define"
13328         echo "Well, your system knows about the normal fd_set typedef..." >&4
13329         if $run ./try; then
13330                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13331                 d_fd_macros="$define"
13332         else
13333                 $cat >&4 <<'EOM'
13334 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13335 EOM
13336                 d_fd_macros="$undef"
13337         fi
13338 else
13339         $cat <<'EOM'
13340 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13341 EOM
13342         set try
13343         if eval $compile; then
13344                 d_fds_bits="$undef"
13345                 d_fd_set="$define"
13346                 echo "Well, your system has some sort of fd_set available..." >&4
13347                 if $run ./try; then
13348                         echo "and you have the normal fd_set macros." >&4
13349                         d_fd_macros="$define"
13350                 else
13351                         $cat <<'EOM'
13352 but not the normal fd_set macros!  Gross!  More work for me...
13353 EOM
13354                         d_fd_macros="$undef"
13355                 fi
13356         else
13357         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13358                 d_fd_set="$undef"
13359                 d_fds_bits="$undef"
13360                 d_fd_macros="$undef"
13361         fi
13362 fi
13363 $rm_try
13364
13365 : see if fgetpos exists
13366 set fgetpos d_fgetpos
13367 eval $inlibc
13368
13369 : see if finite exists
13370 set finite d_finite
13371 eval $inlibc
13372
13373 : see if finitel exists
13374 set finitel d_finitel
13375 eval $inlibc
13376
13377 : see if flock exists
13378 set flock d_flock
13379 eval $inlibc
13380
13381 : see if prototype for flock is available
13382 echo " "
13383 set d_flockproto flock $i_sysfile sys/file.h
13384 eval $hasproto
13385
13386 : see if fp_class exists
13387 set fp_class d_fp_class
13388 eval $inlibc
13389
13390 : see if pathconf exists
13391 set pathconf d_pathconf
13392 eval $inlibc
13393
13394 : see if fpathconf exists
13395 set fpathconf d_fpathconf
13396 eval $inlibc
13397
13398 : see if fpclass exists
13399 set fpclass d_fpclass
13400 eval $inlibc
13401
13402 : see if fpclassify exists
13403 set fpclassify d_fpclassify
13404 eval $inlibc
13405
13406 : see if fpclassl exists
13407 set fpclassl d_fpclassl
13408 eval $inlibc
13409
13410 : check for fpos64_t
13411 echo " "
13412 echo "Checking to see if you have fpos64_t..." >&4
13413 $cat >try.c <<EOCP
13414 #include <stdio.h>
13415 int main() { fpos64_t x = 7; }
13416 EOCP
13417 set try
13418 if eval $compile; then
13419         val="$define"
13420         echo "You have fpos64_t."
13421 else
13422         val="$undef"
13423         echo "You do not have fpos64_t."
13424         case "$fpossize" in
13425         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13426         esac
13427 fi
13428 $rm_try
13429 set d_fpos64_t
13430 eval $setvar
13431
13432 : see if frexpl exists
13433 set frexpl d_frexpl
13434 eval $inlibc
13435
13436 : see if this is a sys/param system
13437 set sys/param.h i_sysparam
13438 eval $inhdr
13439
13440 : see if this is a sys/mount.h system
13441 set sys/mount.h i_sysmount
13442 eval $inhdr
13443
13444 : Check for fs_data_s
13445 echo " "
13446 echo "Checking to see if your system supports struct fs_data..." >&4
13447 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13448 eval $hasstruct
13449 case "$d_fs_data_s" in
13450 "$define")      echo "Yes, it does."   ;;
13451 *)              echo "No, it doesn't." ;;
13452 esac
13453
13454 : see if fseeko exists
13455 set fseeko d_fseeko
13456 eval $inlibc
13457 case "$longsize" in
13458 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13459 esac
13460
13461 : see if fsetpos exists
13462 set fsetpos d_fsetpos
13463 eval $inlibc
13464
13465 : see if fstatfs exists
13466 set fstatfs d_fstatfs
13467 eval $inlibc
13468
13469 : see if statvfs exists
13470 set statvfs d_statvfs
13471 eval $inlibc
13472
13473 : see if fstatvfs exists
13474 set fstatvfs d_fstatvfs
13475 eval $inlibc
13476
13477
13478 : see if fsync exists
13479 set fsync d_fsync
13480 eval $inlibc
13481
13482 : see if ftello exists
13483 set ftello d_ftello
13484 eval $inlibc
13485 case "$longsize" in
13486 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13487 esac
13488
13489 : check for a working futimes
13490 d_futimes="$undef"
13491 echo " "
13492 echo "Checking if you have a working futimes()" >&4
13493 $cat >try.c <<EOCP
13494 #include <stdio.h>
13495 #include <sys/time.h>
13496 #include <errno.h>
13497 #include <fcntl.h>
13498
13499 int main ()
13500 {
13501     int fd, rv;
13502     fd = open ("try.c", O_RDWR);
13503     if (-1 == fd) exit (1);
13504     rv = futimes (fd, NULL);
13505     exit (rv == -1 ? errno : 0);
13506 }
13507 EOCP
13508 set try
13509 if eval $compile; then
13510     `$run ./try`
13511     rc=$?
13512     case "$rc" in
13513         0)  echo "Yes, you have" >&4
13514             d_futimes="$define"
13515             ;;
13516         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13517             ;;
13518     esac
13519 else
13520     echo "No, it does not (probably harmless)" >&4
13521 fi
13522 $rm_try
13523
13524 : see if ndbm.h is available
13525 set ndbm.h i_ndbm
13526 eval $inhdr
13527 : Compatibility location for RedHat 7.1
13528 set gdbm/ndbm.h i_gdbmndbm
13529 eval $inhdr
13530 : Compatibility location for Debian 4.0
13531 set gdbm-ndbm.h i_gdbm_ndbm
13532 eval $inhdr
13533
13534 val="$undef"
13535 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13536         : see if dbm_open exists
13537         set dbm_open d_dbm_open
13538         eval $inlibc
13539         case "$d_dbm_open" in
13540         $undef)
13541                 i_ndbm="$undef"
13542                 i_gdbmndbm="$undef"
13543                 i_gdbm_ndbm="$undef"
13544                 echo "We won't be including <ndbm.h>"
13545                 val="$undef"
13546                 ;;
13547         *) val="$define"
13548            ;;
13549         esac
13550 fi
13551 set d_ndbm
13552 eval $setvar
13553
13554 ndbm_hdr_protochk='name=$1; hdr=$2;
13555 eval "ihdr=\$""i_$name";
13556 val="$undef";
13557 if $test "$ihdr" = "$define"; then
13558         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13559         case "$d_cplusplus" in
13560         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13561         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13562         esac;
13563         case "$val" in
13564         $define) $echo "Your <$hdr> seems to have prototypes";;
13565         *) $echo "Your <$hdr> does not seem to have prototypes";;
13566         esac;
13567 fi;
13568 set "d_${name}_h_uses_prototypes";
13569 eval $setvar'
13570
13571 set ndbm ndbm.h
13572 eval $ndbm_hdr_protochk
13573 set gdbmndbm gdbm/ndbm.h
13574 eval $ndbm_hdr_protochk
13575 set gdbm_ndbm gdbm-ndbm.h
13576 eval $ndbm_hdr_protochk
13577
13578 : see if getaddrinfo exists
13579 set getaddrinfo d_getaddrinfo
13580 eval $inlibc
13581
13582 : see if getcwd exists
13583 set getcwd d_getcwd
13584 eval $inlibc
13585
13586 : see if getespwnam exists
13587 set getespwnam d_getespwnam
13588 eval $inlibc
13589
13590 : see if getfsstat exists
13591 set getfsstat d_getfsstat
13592 eval $inlibc
13593
13594 : see if getgrent exists
13595 set getgrent d_getgrent
13596 eval $inlibc
13597
13598 : see if getgrent_r exists
13599 set getgrent_r d_getgrent_r
13600 eval $inlibc
13601 case "$d_getgrent_r" in
13602 "$define")
13603         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13604         case "$d_getgrent_r_proto:$usethreads" in
13605         ":define")      d_getgrent_r_proto=define
13606                 set d_getgrent_r_proto getgrent_r $hdrs
13607                 eval $hasproto ;;
13608         *)      ;;
13609         esac
13610         case "$d_getgrent_r_proto" in
13611         define)
13612         case "$getgrent_r_proto" in
13613         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13614         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13615         esac
13616         case "$getgrent_r_proto" in
13617         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13618         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13619         esac
13620         case "$getgrent_r_proto" in
13621         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13622         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13623         esac
13624         case "$getgrent_r_proto" in
13625         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13626         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13627         esac
13628         case "$getgrent_r_proto" in
13629         ''|0) try='int getgrent_r(struct group*, char*, int);'
13630         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13631         esac
13632         case "$getgrent_r_proto" in
13633         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13634         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13635         esac
13636         case "$getgrent_r_proto" in
13637         ''|0)   d_getgrent_r=undef
13638                 getgrent_r_proto=0
13639                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13640         * )     case "$getgrent_r_proto" in
13641                 REENTRANT_PROTO*) ;;
13642                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13643                 esac
13644                 echo "Prototype: $try" ;;
13645         esac
13646         ;;
13647         *)      case "$usethreads" in
13648                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13649                 esac
13650                 d_getgrent_r=undef
13651                 getgrent_r_proto=0
13652                 ;;
13653         esac
13654         ;;
13655 *)      getgrent_r_proto=0
13656         ;;
13657 esac
13658
13659 : see if getgrgid_r exists
13660 set getgrgid_r d_getgrgid_r
13661 eval $inlibc
13662 case "$d_getgrgid_r" in
13663 "$define")
13664         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13665         case "$d_getgrgid_r_proto:$usethreads" in
13666         ":define")      d_getgrgid_r_proto=define
13667                 set d_getgrgid_r_proto getgrgid_r $hdrs
13668                 eval $hasproto ;;
13669         *)      ;;
13670         esac
13671         case "$d_getgrgid_r_proto" in
13672         define)
13673         case "$getgrgid_r_proto" in
13674         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13675         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13676         esac
13677         case "$getgrgid_r_proto" in
13678         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13679         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13680         esac
13681         case "$getgrgid_r_proto" in
13682         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13683         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13684         esac
13685         case "$getgrgid_r_proto" in
13686         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13687         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13688         esac
13689         case "$getgrgid_r_proto" in
13690         ''|0)   d_getgrgid_r=undef
13691                 getgrgid_r_proto=0
13692                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13693         * )     case "$getgrgid_r_proto" in
13694                 REENTRANT_PROTO*) ;;
13695                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13696                 esac
13697                 echo "Prototype: $try" ;;
13698         esac
13699         ;;
13700         *)      case "$usethreads" in
13701                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13702                 esac
13703                 d_getgrgid_r=undef
13704                 getgrgid_r_proto=0
13705                 ;;
13706         esac
13707         ;;
13708 *)      getgrgid_r_proto=0
13709         ;;
13710 esac
13711
13712 : see if getgrnam_r exists
13713 set getgrnam_r d_getgrnam_r
13714 eval $inlibc
13715 case "$d_getgrnam_r" in
13716 "$define")
13717         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13718         case "$d_getgrnam_r_proto:$usethreads" in
13719         ":define")      d_getgrnam_r_proto=define
13720                 set d_getgrnam_r_proto getgrnam_r $hdrs
13721                 eval $hasproto ;;
13722         *)      ;;
13723         esac
13724         case "$d_getgrnam_r_proto" in
13725         define)
13726         case "$getgrnam_r_proto" in
13727         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13728         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13729         esac
13730         case "$getgrnam_r_proto" in
13731         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13732         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13733         esac
13734         case "$getgrnam_r_proto" in
13735         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13736         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13737         esac
13738         case "$getgrnam_r_proto" in
13739         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13740         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13741         esac
13742         case "$getgrnam_r_proto" in
13743         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13744         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13745         esac
13746         case "$getgrnam_r_proto" in
13747         ''|0)   d_getgrnam_r=undef
13748                 getgrnam_r_proto=0
13749                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13750         * )     case "$getgrnam_r_proto" in
13751                 REENTRANT_PROTO*) ;;
13752                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13753                 esac
13754                 echo "Prototype: $try" ;;
13755         esac
13756         ;;
13757         *)      case "$usethreads" in
13758                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13759                 esac
13760                 d_getgrnam_r=undef
13761                 getgrnam_r_proto=0
13762                 ;;
13763         esac
13764         ;;
13765 *)      getgrnam_r_proto=0
13766         ;;
13767 esac
13768
13769 : see if gethostbyaddr exists
13770 set gethostbyaddr d_gethbyaddr
13771 eval $inlibc
13772
13773 : see if gethostbyname exists
13774 set gethostbyname d_gethbyname
13775 eval $inlibc
13776
13777 : see if gethostent exists
13778 set gethostent d_gethent
13779 eval $inlibc
13780
13781 : see how we will look up host name
13782 echo " "
13783 call=''
13784 if set gethostname val -f d_gethname; eval $csym; $val; then
13785         echo 'gethostname() found.' >&4
13786         d_gethname="$define"
13787         call=gethostname
13788 fi
13789 if set uname val -f d_uname; eval $csym; $val; then
13790         if ./xenix; then
13791                 $cat <<'EOM'
13792 uname() was found, but you're running xenix, and older versions of xenix
13793 have a broken uname(). If you don't really know whether your xenix is old
13794 enough to have a broken system call, use the default answer.
13795
13796 EOM
13797                 dflt=y
13798                 case "$d_uname" in
13799                 "$define") dflt=n;;
13800                 esac
13801                 rp='Is your uname() broken?'
13802                 . ./myread
13803                 case "$ans" in
13804                 n*) d_uname="$define"; call=uname;;
13805                 esac
13806         else
13807                 echo 'uname() found.' >&4
13808                 d_uname="$define"
13809                 case "$call" in
13810                 '') call=uname ;;
13811                 esac
13812         fi
13813 fi
13814 case "$d_gethname" in
13815 '') d_gethname="$undef";;
13816 esac
13817 case "$d_uname" in
13818 '') d_uname="$undef";;
13819 esac
13820 case "$d_uname$d_gethname" in
13821 *define*)
13822         dflt=n
13823         cat <<EOM
13824
13825 Every now and then someone has a $call() that lies about the hostname
13826 but can't be fixed for political or economic reasons.  If you wish, I can
13827 pretend $call() isn't there and maybe compute hostname at run-time
13828 thanks to the '$phostname' command.
13829
13830 EOM
13831         rp="Shall I ignore $call() from now on?"
13832         . ./myread
13833         case "$ans" in
13834         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13835         esac;;
13836 esac
13837 case "$phostname" in
13838 '') aphostname='';;
13839 *) case "$aphostname" in
13840         /*) ;;
13841         *) set X $phostname
13842                 shift
13843                 file=$1
13844                 shift
13845                 file=`./loc $file $file $pth`
13846                 aphostname=`echo $file $*`
13847                 ;;
13848         esac
13849         ;;
13850 esac
13851 case "$d_uname$d_gethname" in
13852 *define*) ;;
13853 *)
13854         case "$phostname" in
13855         '')
13856                 echo "There will be no way for $package to get your hostname." >&4;;
13857         *)
13858         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13859                 ;;
13860         esac;;
13861 esac
13862 case "$d_phostname" in
13863 '') d_phostname="$undef";;
13864 esac
13865
13866 : see if gethostbyaddr_r exists
13867 set gethostbyaddr_r d_gethostbyaddr_r
13868 eval $inlibc
13869 case "$d_gethostbyaddr_r" in
13870 "$define")
13871         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13872         case "$d_gethostbyaddr_r_proto:$usethreads" in
13873         ":define")      d_gethostbyaddr_r_proto=define
13874                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13875                 eval $hasproto ;;
13876         *)      ;;
13877         esac
13878         case "$d_gethostbyaddr_r_proto" in
13879         define)
13880         case "$gethostbyaddr_r_proto" in
13881         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13882         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13883         esac
13884         case "$gethostbyaddr_r_proto" in
13885         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13886         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13887         esac
13888         case "$gethostbyaddr_r_proto" in
13889         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13890         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13891         esac
13892         case "$gethostbyaddr_r_proto" in
13893         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13894         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13895         esac
13896         case "$gethostbyaddr_r_proto" in
13897         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13898         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13899         esac
13900         case "$gethostbyaddr_r_proto" in
13901         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13902         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13903         esac
13904         case "$gethostbyaddr_r_proto" in
13905         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13906         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13907         esac
13908         case "$gethostbyaddr_r_proto" in
13909         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13910         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13911         esac
13912         case "$gethostbyaddr_r_proto" in
13913         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13914         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13915         esac
13916         case "$gethostbyaddr_r_proto" in
13917         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13918         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13919         esac
13920         case "$gethostbyaddr_r_proto" in
13921         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13922         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13923         esac
13924         case "$gethostbyaddr_r_proto" in
13925         ''|0)   d_gethostbyaddr_r=undef
13926                 gethostbyaddr_r_proto=0
13927                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13928         * )     case "$gethostbyaddr_r_proto" in
13929                 REENTRANT_PROTO*) ;;
13930                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13931                 esac
13932                 echo "Prototype: $try" ;;
13933         esac
13934         ;;
13935         *)      case "$usethreads" in
13936                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13937                 esac
13938                 d_gethostbyaddr_r=undef
13939                 gethostbyaddr_r_proto=0
13940                 ;;
13941         esac
13942         ;;
13943 *)      gethostbyaddr_r_proto=0
13944         ;;
13945 esac
13946
13947 : see if gethostbyname_r exists
13948 set gethostbyname_r d_gethostbyname_r
13949 eval $inlibc
13950 case "$d_gethostbyname_r" in
13951 "$define")
13952         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13953         case "$d_gethostbyname_r_proto:$usethreads" in
13954         ":define")      d_gethostbyname_r_proto=define
13955                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13956                 eval $hasproto ;;
13957         *)      ;;
13958         esac
13959         case "$d_gethostbyname_r_proto" in
13960         define)
13961         case "$gethostbyname_r_proto" in
13962         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13963         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13964         esac
13965         case "$gethostbyname_r_proto" in
13966         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13967         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13968         esac
13969         case "$gethostbyname_r_proto" in
13970         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13971         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13972         esac
13973         case "$gethostbyname_r_proto" in
13974         ''|0)   d_gethostbyname_r=undef
13975                 gethostbyname_r_proto=0
13976                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13977         * )     case "$gethostbyname_r_proto" in
13978                 REENTRANT_PROTO*) ;;
13979                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13980                 esac
13981                 echo "Prototype: $try" ;;
13982         esac
13983         ;;
13984         *)      case "$usethreads" in
13985                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13986                 esac
13987                 d_gethostbyname_r=undef
13988                 gethostbyname_r_proto=0
13989                 ;;
13990         esac
13991         ;;
13992 *)      gethostbyname_r_proto=0
13993         ;;
13994 esac
13995
13996 : see if gethostent_r exists
13997 set gethostent_r d_gethostent_r
13998 eval $inlibc
13999 case "$d_gethostent_r" in
14000 "$define")
14001         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14002         case "$d_gethostent_r_proto:$usethreads" in
14003         ":define")      d_gethostent_r_proto=define
14004                 set d_gethostent_r_proto gethostent_r $hdrs
14005                 eval $hasproto ;;
14006         *)      ;;
14007         esac
14008         case "$d_gethostent_r_proto" in
14009         define)
14010         case "$gethostent_r_proto" in
14011         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14012         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14013         esac
14014         case "$gethostent_r_proto" in
14015         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14016         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14017         esac
14018         case "$gethostent_r_proto" in
14019         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14020         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14021         esac
14022         case "$gethostent_r_proto" in
14023         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14024         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14025         esac
14026         case "$gethostent_r_proto" in
14027         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14028         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14029         esac
14030         case "$gethostent_r_proto" in
14031         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14032         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14033         esac
14034         case "$gethostent_r_proto" in
14035         ''|0)   d_gethostent_r=undef
14036                 gethostent_r_proto=0
14037                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14038         * )     case "$gethostent_r_proto" in
14039                 REENTRANT_PROTO*) ;;
14040                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14041                 esac
14042                 echo "Prototype: $try" ;;
14043         esac
14044         ;;
14045         *)      case "$usethreads" in
14046                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14047                 esac
14048                 d_gethostent_r=undef
14049                 gethostent_r_proto=0
14050                 ;;
14051         esac
14052         ;;
14053 *)      gethostent_r_proto=0
14054         ;;
14055 esac
14056
14057 : see if prototypes for various gethostxxx netdb.h functions are available
14058 echo " "
14059 set d_gethostprotos gethostent $i_netdb netdb.h
14060 eval $hasproto
14061
14062 : see if getitimer exists
14063 set getitimer d_getitimer
14064 eval $inlibc
14065
14066 : see if getlogin exists
14067 set getlogin d_getlogin
14068 eval $inlibc
14069
14070 : see if getlogin_r exists
14071 set getlogin_r d_getlogin_r
14072 eval $inlibc
14073 case "$d_getlogin_r" in
14074 "$define")
14075         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14076         case "$d_getlogin_r_proto:$usethreads" in
14077         ":define")      d_getlogin_r_proto=define
14078                 set d_getlogin_r_proto getlogin_r $hdrs
14079                 eval $hasproto ;;
14080         *)      ;;
14081         esac
14082         case "$d_getlogin_r_proto" in
14083         define)
14084         case "$getlogin_r_proto" in
14085         ''|0) try='int getlogin_r(char*, size_t);'
14086         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14087         esac
14088         case "$getlogin_r_proto" in
14089         ''|0) try='int getlogin_r(char*, int);'
14090         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14091         esac
14092         case "$getlogin_r_proto" in
14093         ''|0) try='char* getlogin_r(char*, size_t);'
14094         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14095         esac
14096         case "$getlogin_r_proto" in
14097         ''|0) try='char* getlogin_r(char*, int);'
14098         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14099         esac
14100         case "$getlogin_r_proto" in
14101         ''|0)   d_getlogin_r=undef
14102                 getlogin_r_proto=0
14103                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14104         * )     case "$getlogin_r_proto" in
14105                 REENTRANT_PROTO*) ;;
14106                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14107                 esac
14108                 echo "Prototype: $try" ;;
14109         esac
14110         ;;
14111         *)      case "$usethreads" in
14112                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14113                 esac
14114                 d_getlogin_r=undef
14115                 getlogin_r_proto=0
14116                 ;;
14117         esac
14118         ;;
14119 *)      getlogin_r_proto=0
14120         ;;
14121 esac
14122
14123 : see if getmnt exists
14124 set getmnt d_getmnt
14125 eval $inlibc
14126
14127 : see if getmntent exists
14128 set getmntent d_getmntent
14129 eval $inlibc
14130
14131 : see if getnameinfo exists
14132 set getnameinfo d_getnameinfo
14133 eval $inlibc
14134
14135 : see if getnetbyaddr exists
14136 set getnetbyaddr d_getnbyaddr
14137 eval $inlibc
14138
14139 : see if getnetbyname exists
14140 set getnetbyname d_getnbyname
14141 eval $inlibc
14142
14143 : see if getnetent exists
14144 set getnetent d_getnent
14145 eval $inlibc
14146
14147 : see if getnetbyaddr_r exists
14148 set getnetbyaddr_r d_getnetbyaddr_r
14149 eval $inlibc
14150 case "$d_getnetbyaddr_r" in
14151 "$define")
14152         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14153         case "$d_getnetbyaddr_r_proto:$usethreads" in
14154         ":define")      d_getnetbyaddr_r_proto=define
14155                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14156                 eval $hasproto ;;
14157         *)      ;;
14158         esac
14159         case "$d_getnetbyaddr_r_proto" in
14160         define)
14161         case "$getnetbyaddr_r_proto" in
14162         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14163         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14164         esac
14165         case "$getnetbyaddr_r_proto" in
14166         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14167         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14168         esac
14169         case "$getnetbyaddr_r_proto" in
14170         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14171         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14172         esac
14173         case "$getnetbyaddr_r_proto" in
14174         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14175         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14176         esac
14177         case "$getnetbyaddr_r_proto" in
14178         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14179         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14180         esac
14181         case "$getnetbyaddr_r_proto" in
14182         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14183         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14184         esac
14185         case "$getnetbyaddr_r_proto" in
14186         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14187         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14188         esac
14189         case "$getnetbyaddr_r_proto" in
14190         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14191         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14192         esac
14193         case "$getnetbyaddr_r_proto" in
14194         ''|0)   d_getnetbyaddr_r=undef
14195                 getnetbyaddr_r_proto=0
14196                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14197         * )     case "$getnetbyaddr_r_proto" in
14198                 REENTRANT_PROTO*) ;;
14199                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14200                 esac
14201                 echo "Prototype: $try" ;;
14202         esac
14203         ;;
14204         *)      case "$usethreads" in
14205                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14206                 esac
14207                 d_getnetbyaddr_r=undef
14208                 getnetbyaddr_r_proto=0
14209                 ;;
14210         esac
14211         ;;
14212 *)      getnetbyaddr_r_proto=0
14213         ;;
14214 esac
14215
14216 : see if getnetbyname_r exists
14217 set getnetbyname_r d_getnetbyname_r
14218 eval $inlibc
14219 case "$d_getnetbyname_r" in
14220 "$define")
14221         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14222         case "$d_getnetbyname_r_proto:$usethreads" in
14223         ":define")      d_getnetbyname_r_proto=define
14224                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14225                 eval $hasproto ;;
14226         *)      ;;
14227         esac
14228         case "$d_getnetbyname_r_proto" in
14229         define)
14230         case "$getnetbyname_r_proto" in
14231         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14232         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14233         esac
14234         case "$getnetbyname_r_proto" in
14235         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14236         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14237         esac
14238         case "$getnetbyname_r_proto" in
14239         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14240         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14241         esac
14242         case "$getnetbyname_r_proto" in
14243         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14244         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14245         esac
14246         case "$getnetbyname_r_proto" in
14247         ''|0)   d_getnetbyname_r=undef
14248                 getnetbyname_r_proto=0
14249                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14250         * )     case "$getnetbyname_r_proto" in
14251                 REENTRANT_PROTO*) ;;
14252                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14253                 esac
14254                 echo "Prototype: $try" ;;
14255         esac
14256         ;;
14257         *)      case "$usethreads" in
14258                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14259                 esac
14260                 d_getnetbyname_r=undef
14261                 getnetbyname_r_proto=0
14262                 ;;
14263         esac
14264         ;;
14265 *)      getnetbyname_r_proto=0
14266         ;;
14267 esac
14268
14269 : see if getnetent_r exists
14270 set getnetent_r d_getnetent_r
14271 eval $inlibc
14272 case "$d_getnetent_r" in
14273 "$define")
14274         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14275         case "$d_getnetent_r_proto:$usethreads" in
14276         ":define")      d_getnetent_r_proto=define
14277                 set d_getnetent_r_proto getnetent_r $hdrs
14278                 eval $hasproto ;;
14279         *)      ;;
14280         esac
14281         case "$d_getnetent_r_proto" in
14282         define)
14283         case "$getnetent_r_proto" in
14284         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14285         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14286         esac
14287         case "$getnetent_r_proto" in
14288         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14289         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14290         esac
14291         case "$getnetent_r_proto" in
14292         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14293         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14294         esac
14295         case "$getnetent_r_proto" in
14296         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14297         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14298         esac
14299         case "$getnetent_r_proto" in
14300         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14301         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14302         esac
14303         case "$getnetent_r_proto" in
14304         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14305         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14306         esac
14307         case "$getnetent_r_proto" in
14308         ''|0)   d_getnetent_r=undef
14309                 getnetent_r_proto=0
14310                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14311         * )     case "$getnetent_r_proto" in
14312                 REENTRANT_PROTO*) ;;
14313                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14314                 esac
14315                 echo "Prototype: $try" ;;
14316         esac
14317         ;;
14318         *)      case "$usethreads" in
14319                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14320                 esac
14321                 d_getnetent_r=undef
14322                 getnetent_r_proto=0
14323                 ;;
14324         esac
14325         ;;
14326 *)      getnetent_r_proto=0
14327         ;;
14328 esac
14329
14330 : see if prototypes for various getnetxxx netdb.h functions are available
14331 echo " "
14332 set d_getnetprotos getnetent $i_netdb netdb.h
14333 eval $hasproto
14334
14335 : see if getpagesize exists
14336 set getpagesize d_getpagsz
14337 eval $inlibc
14338
14339 : Optional checks for getprotobyname and getprotobynumber
14340
14341 : see if getprotobyname exists
14342 set getprotobyname d_getpbyname
14343 eval $inlibc
14344
14345 : see if getprotobynumber exists
14346 set getprotobynumber d_getpbynumber
14347 eval $inlibc
14348
14349 : see if getprotoent exists
14350 set getprotoent d_getpent
14351 eval $inlibc
14352
14353 : see if getpgid exists
14354 set getpgid d_getpgid
14355 eval $inlibc
14356
14357 : see if getpgrp2 exists
14358 set getpgrp2 d_getpgrp2
14359 eval $inlibc
14360
14361 : see if getppid exists
14362 set getppid d_getppid
14363 eval $inlibc
14364
14365 : see if getpriority exists
14366 set getpriority d_getprior
14367 eval $inlibc
14368
14369 : see if getprotobyname_r exists
14370 set getprotobyname_r d_getprotobyname_r
14371 eval $inlibc
14372 case "$d_getprotobyname_r" in
14373 "$define")
14374         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14375         case "$d_getprotobyname_r_proto:$usethreads" in
14376         ":define")      d_getprotobyname_r_proto=define
14377                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14378                 eval $hasproto ;;
14379         *)      ;;
14380         esac
14381         case "$d_getprotobyname_r_proto" in
14382         define)
14383         case "$getprotobyname_r_proto" in
14384         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14385         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14386         esac
14387         case "$getprotobyname_r_proto" in
14388         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14389         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14390         esac
14391         case "$getprotobyname_r_proto" in
14392         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14393         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14394         esac
14395         case "$getprotobyname_r_proto" in
14396         ''|0)   d_getprotobyname_r=undef
14397                 getprotobyname_r_proto=0
14398                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14399         * )     case "$getprotobyname_r_proto" in
14400                 REENTRANT_PROTO*) ;;
14401                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14402                 esac
14403                 echo "Prototype: $try" ;;
14404         esac
14405         ;;
14406         *)      case "$usethreads" in
14407                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14408                 esac
14409                 d_getprotobyname_r=undef
14410                 getprotobyname_r_proto=0
14411                 ;;
14412         esac
14413         ;;
14414 *)      getprotobyname_r_proto=0
14415         ;;
14416 esac
14417
14418 : see if getprotobynumber_r exists
14419 set getprotobynumber_r d_getprotobynumber_r
14420 eval $inlibc
14421 case "$d_getprotobynumber_r" in
14422 "$define")
14423         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14424         case "$d_getprotobynumber_r_proto:$usethreads" in
14425         ":define")      d_getprotobynumber_r_proto=define
14426                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14427                 eval $hasproto ;;
14428         *)      ;;
14429         esac
14430         case "$d_getprotobynumber_r_proto" in
14431         define)
14432         case "$getprotobynumber_r_proto" in
14433         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14434         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14435         esac
14436         case "$getprotobynumber_r_proto" in
14437         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14438         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14439         esac
14440         case "$getprotobynumber_r_proto" in
14441         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14442         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14443         esac
14444         case "$getprotobynumber_r_proto" in
14445         ''|0)   d_getprotobynumber_r=undef
14446                 getprotobynumber_r_proto=0
14447                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14448         * )     case "$getprotobynumber_r_proto" in
14449                 REENTRANT_PROTO*) ;;
14450                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14451                 esac
14452                 echo "Prototype: $try" ;;
14453         esac
14454         ;;
14455         *)      case "$usethreads" in
14456                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14457                 esac
14458                 d_getprotobynumber_r=undef
14459                 getprotobynumber_r_proto=0
14460                 ;;
14461         esac
14462         ;;
14463 *)      getprotobynumber_r_proto=0
14464         ;;
14465 esac
14466
14467 : see if getprotoent_r exists
14468 set getprotoent_r d_getprotoent_r
14469 eval $inlibc
14470 case "$d_getprotoent_r" in
14471 "$define")
14472         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14473         case "$d_getprotoent_r_proto:$usethreads" in
14474         ":define")      d_getprotoent_r_proto=define
14475                 set d_getprotoent_r_proto getprotoent_r $hdrs
14476                 eval $hasproto ;;
14477         *)      ;;
14478         esac
14479         case "$d_getprotoent_r_proto" in
14480         define)
14481         case "$getprotoent_r_proto" in
14482         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14483         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14484         esac
14485         case "$getprotoent_r_proto" in
14486         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14487         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14488         esac
14489         case "$getprotoent_r_proto" in
14490         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14491         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14492         esac
14493         case "$getprotoent_r_proto" in
14494         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14495         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14496         esac
14497         case "$getprotoent_r_proto" in
14498         ''|0)   d_getprotoent_r=undef
14499                 getprotoent_r_proto=0
14500                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14501         * )     case "$getprotoent_r_proto" in
14502                 REENTRANT_PROTO*) ;;
14503                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14504                 esac
14505                 echo "Prototype: $try" ;;
14506         esac
14507         ;;
14508         *)      case "$usethreads" in
14509                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14510                 esac
14511                 d_getprotoent_r=undef
14512                 getprotoent_r_proto=0
14513                 ;;
14514         esac
14515         ;;
14516 *)      getprotoent_r_proto=0
14517         ;;
14518 esac
14519
14520 : see if prototypes for various getprotoxxx netdb.h functions are available
14521 echo " "
14522 set d_getprotoprotos getprotoent $i_netdb netdb.h
14523 eval $hasproto
14524
14525 : see if getprpwnam exists
14526 set getprpwnam d_getprpwnam
14527 eval $inlibc
14528
14529 : see if getpwent exists
14530 set getpwent d_getpwent
14531 eval $inlibc
14532
14533 : see if getpwent_r exists
14534 set getpwent_r d_getpwent_r
14535 eval $inlibc
14536 case "$d_getpwent_r" in
14537 "$define")
14538         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14539         case "$d_getpwent_r_proto:$usethreads" in
14540         ":define")      d_getpwent_r_proto=define
14541                 set d_getpwent_r_proto getpwent_r $hdrs
14542                 eval $hasproto ;;
14543         *)      ;;
14544         esac
14545         case "$d_getpwent_r_proto" in
14546         define)
14547         case "$getpwent_r_proto" in
14548         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14549         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14550         esac
14551         case "$getpwent_r_proto" in
14552         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14553         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14554         esac
14555         case "$getpwent_r_proto" in
14556         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14557         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14558         esac
14559         case "$getpwent_r_proto" in
14560         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14561         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14562         esac
14563         case "$getpwent_r_proto" in
14564         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14565         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14566         esac
14567         case "$getpwent_r_proto" in
14568         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14569         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14570         esac
14571         case "$getpwent_r_proto" in
14572         ''|0)   d_getpwent_r=undef
14573                 getpwent_r_proto=0
14574                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14575         * )     case "$getpwent_r_proto" in
14576                 REENTRANT_PROTO*) ;;
14577                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14578                 esac
14579                 echo "Prototype: $try" ;;
14580         esac
14581         ;;
14582         *)      case "$usethreads" in
14583                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14584                 esac
14585                 d_getpwent_r=undef
14586                 getpwent_r_proto=0
14587                 ;;
14588         esac
14589         ;;
14590 *)      getpwent_r_proto=0
14591         ;;
14592 esac
14593
14594 : see if getpwnam_r exists
14595 set getpwnam_r d_getpwnam_r
14596 eval $inlibc
14597 case "$d_getpwnam_r" in
14598 "$define")
14599         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14600         case "$d_getpwnam_r_proto:$usethreads" in
14601         ":define")      d_getpwnam_r_proto=define
14602                 set d_getpwnam_r_proto getpwnam_r $hdrs
14603                 eval $hasproto ;;
14604         *)      ;;
14605         esac
14606         case "$d_getpwnam_r_proto" in
14607         define)
14608         case "$getpwnam_r_proto" in
14609         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14610         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14611         esac
14612         case "$getpwnam_r_proto" in
14613         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14614         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14615         esac
14616         case "$getpwnam_r_proto" in
14617         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14618         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14619         esac
14620         case "$getpwnam_r_proto" in
14621         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14622         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14623         esac
14624         case "$getpwnam_r_proto" in
14625         ''|0)   d_getpwnam_r=undef
14626                 getpwnam_r_proto=0
14627                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14628         * )     case "$getpwnam_r_proto" in
14629                 REENTRANT_PROTO*) ;;
14630                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14631                 esac
14632                 echo "Prototype: $try" ;;
14633         esac
14634         ;;
14635         *)      case "$usethreads" in
14636                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14637                 esac
14638                 d_getpwnam_r=undef
14639                 getpwnam_r_proto=0
14640                 ;;
14641         esac
14642         ;;
14643 *)      getpwnam_r_proto=0
14644         ;;
14645 esac
14646
14647 : see if getpwuid_r exists
14648 set getpwuid_r d_getpwuid_r
14649 eval $inlibc
14650 case "$d_getpwuid_r" in
14651 "$define")
14652         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14653         case "$d_getpwuid_r_proto:$usethreads" in
14654         ":define")      d_getpwuid_r_proto=define
14655                 set d_getpwuid_r_proto getpwuid_r $hdrs
14656                 eval $hasproto ;;
14657         *)      ;;
14658         esac
14659         case "$d_getpwuid_r_proto" in
14660         define)
14661         case "$getpwuid_r_proto" in
14662         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14663         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14664         esac
14665         case "$getpwuid_r_proto" in
14666         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14667         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14668         esac
14669         case "$getpwuid_r_proto" in
14670         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14671         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14672         esac
14673         case "$getpwuid_r_proto" in
14674         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14675         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14676         esac
14677         case "$getpwuid_r_proto" in
14678         ''|0)   d_getpwuid_r=undef
14679                 getpwuid_r_proto=0
14680                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14681         * )     case "$getpwuid_r_proto" in
14682                 REENTRANT_PROTO*) ;;
14683                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14684                 esac
14685                 echo "Prototype: $try" ;;
14686         esac
14687         ;;
14688         *)      case "$usethreads" in
14689                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14690                 esac
14691                 d_getpwuid_r=undef
14692                 getpwuid_r_proto=0
14693                 ;;
14694         esac
14695         ;;
14696 *)      getpwuid_r_proto=0
14697         ;;
14698 esac
14699
14700 : Optional checks for getsbyname and getsbyport
14701
14702 : see if getservbyname exists
14703 set getservbyname d_getsbyname
14704 eval $inlibc
14705
14706 : see if getservbyport exists
14707 set getservbyport d_getsbyport
14708 eval $inlibc
14709
14710 : see if getservent exists
14711 set getservent d_getsent
14712 eval $inlibc
14713
14714 : see if getservbyname_r exists
14715 set getservbyname_r d_getservbyname_r
14716 eval $inlibc
14717 case "$d_getservbyname_r" in
14718 "$define")
14719         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14720         case "$d_getservbyname_r_proto:$usethreads" in
14721         ":define")      d_getservbyname_r_proto=define
14722                 set d_getservbyname_r_proto getservbyname_r $hdrs
14723                 eval $hasproto ;;
14724         *)      ;;
14725         esac
14726         case "$d_getservbyname_r_proto" in
14727         define)
14728         case "$getservbyname_r_proto" in
14729         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14730         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14731         esac
14732         case "$getservbyname_r_proto" in
14733         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14734         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14735         esac
14736         case "$getservbyname_r_proto" in
14737         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14738         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14739         esac
14740         case "$getservbyname_r_proto" in
14741         ''|0)   d_getservbyname_r=undef
14742                 getservbyname_r_proto=0
14743                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14744         * )     case "$getservbyname_r_proto" in
14745                 REENTRANT_PROTO*) ;;
14746                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14747                 esac
14748                 echo "Prototype: $try" ;;
14749         esac
14750         ;;
14751         *)      case "$usethreads" in
14752                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14753                 esac
14754                 d_getservbyname_r=undef
14755                 getservbyname_r_proto=0
14756                 ;;
14757         esac
14758         ;;
14759 *)      getservbyname_r_proto=0
14760         ;;
14761 esac
14762
14763 : see if getservbyport_r exists
14764 set getservbyport_r d_getservbyport_r
14765 eval $inlibc
14766 case "$d_getservbyport_r" in
14767 "$define")
14768         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14769         case "$d_getservbyport_r_proto:$usethreads" in
14770         ":define")      d_getservbyport_r_proto=define
14771                 set d_getservbyport_r_proto getservbyport_r $hdrs
14772                 eval $hasproto ;;
14773         *)      ;;
14774         esac
14775         case "$d_getservbyport_r_proto" in
14776         define)
14777         case "$getservbyport_r_proto" in
14778         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14779         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14780         esac
14781         case "$getservbyport_r_proto" in
14782         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14783         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14784         esac
14785         case "$getservbyport_r_proto" in
14786         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14787         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14788         esac
14789         case "$getservbyport_r_proto" in
14790         ''|0)   d_getservbyport_r=undef
14791                 getservbyport_r_proto=0
14792                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14793         * )     case "$getservbyport_r_proto" in
14794                 REENTRANT_PROTO*) ;;
14795                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14796                 esac
14797                 echo "Prototype: $try" ;;
14798         esac
14799         ;;
14800         *)      case "$usethreads" in
14801                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14802                 esac
14803                 d_getservbyport_r=undef
14804                 getservbyport_r_proto=0
14805                 ;;
14806         esac
14807         ;;
14808 *)      getservbyport_r_proto=0
14809         ;;
14810 esac
14811
14812 : see if getservent_r exists
14813 set getservent_r d_getservent_r
14814 eval $inlibc
14815 case "$d_getservent_r" in
14816 "$define")
14817         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14818         case "$d_getservent_r_proto:$usethreads" in
14819         ":define")      d_getservent_r_proto=define
14820                 set d_getservent_r_proto getservent_r $hdrs
14821                 eval $hasproto ;;
14822         *)      ;;
14823         esac
14824         case "$d_getservent_r_proto" in
14825         define)
14826         case "$getservent_r_proto" in
14827         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14828         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14829         esac
14830         case "$getservent_r_proto" in
14831         ''|0) try='int getservent_r(struct servent*, char*, int);'
14832         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14833         esac
14834         case "$getservent_r_proto" in
14835         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14836         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14837         esac
14838         case "$getservent_r_proto" in
14839         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14840         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14841         esac
14842         case "$getservent_r_proto" in
14843         ''|0)   d_getservent_r=undef
14844                 getservent_r_proto=0
14845                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14846         * )     case "$getservent_r_proto" in
14847                 REENTRANT_PROTO*) ;;
14848                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14849                 esac
14850                 echo "Prototype: $try" ;;
14851         esac
14852         ;;
14853         *)      case "$usethreads" in
14854                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14855                 esac
14856                 d_getservent_r=undef
14857                 getservent_r_proto=0
14858                 ;;
14859         esac
14860         ;;
14861 *)      getservent_r_proto=0
14862         ;;
14863 esac
14864
14865 : see if prototypes for various getservxxx netdb.h functions are available
14866 echo " "
14867 set d_getservprotos getservent $i_netdb netdb.h
14868 eval $hasproto
14869
14870 : see if getspnam exists
14871 set getspnam d_getspnam
14872 eval $inlibc
14873
14874 : see if this is a shadow.h system
14875 set shadow.h i_shadow
14876 eval $inhdr
14877
14878 : see if getspnam_r exists
14879 set getspnam_r d_getspnam_r
14880 eval $inlibc
14881 case "$d_getspnam_r" in
14882 "$define")
14883         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14884         case "$d_getspnam_r_proto:$usethreads" in
14885         ":define")      d_getspnam_r_proto=define
14886                 set d_getspnam_r_proto getspnam_r $hdrs
14887                 eval $hasproto ;;
14888         *)      ;;
14889         esac
14890         case "$d_getspnam_r_proto" in
14891         define)
14892         case "$getspnam_r_proto" in
14893         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14894         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14895         esac
14896         case "$getspnam_r_proto" in
14897         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14898         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14899         esac
14900         case "$getspnam_r_proto" in
14901         ''|0)   d_getspnam_r=undef
14902                 getspnam_r_proto=0
14903                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14904         * )     case "$getspnam_r_proto" in
14905                 REENTRANT_PROTO*) ;;
14906                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14907                 esac
14908                 echo "Prototype: $try" ;;
14909         esac
14910         ;;
14911         *)      case "$usethreads" in
14912                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14913                 esac
14914                 d_getspnam_r=undef
14915                 getspnam_r_proto=0
14916                 ;;
14917         esac
14918         ;;
14919 *)      getspnam_r_proto=0
14920         ;;
14921 esac
14922
14923 : see if gettimeofday or ftime exists
14924 set gettimeofday d_gettimeod
14925 eval $inlibc
14926 case "$d_gettimeod" in
14927 "$undef")
14928         set ftime d_ftime 
14929         eval $inlibc
14930         ;;
14931 *)
14932         val="$undef"; set d_ftime; eval $setvar
14933         ;;
14934 esac
14935 case "$d_gettimeod$d_ftime" in
14936 "$undef$undef")
14937         echo " "
14938         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14939         ;;
14940 esac
14941
14942 : see if gmtime_r exists
14943 set gmtime_r d_gmtime_r
14944 eval $inlibc
14945 case "$d_gmtime_r" in
14946 "$define")
14947         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14948         case "$d_gmtime_r_proto:$usethreads" in
14949         ":define")      d_gmtime_r_proto=define
14950                 set d_gmtime_r_proto gmtime_r $hdrs
14951                 eval $hasproto ;;
14952         *)      ;;
14953         esac
14954         case "$d_gmtime_r_proto" in
14955         define)
14956         case "$gmtime_r_proto" in
14957         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14958         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14959         esac
14960         case "$gmtime_r_proto" in
14961         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14962         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14963         esac
14964         case "$gmtime_r_proto" in
14965         ''|0)   d_gmtime_r=undef
14966                 gmtime_r_proto=0
14967                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14968         * )     case "$gmtime_r_proto" in
14969                 REENTRANT_PROTO*) ;;
14970                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14971                 esac
14972                 echo "Prototype: $try" ;;
14973         esac
14974         ;;
14975         *)      case "$usethreads" in
14976                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14977                 esac
14978                 d_gmtime_r=undef
14979                 gmtime_r_proto=0
14980                 ;;
14981         esac
14982         ;;
14983 *)      gmtime_r_proto=0
14984         ;;
14985 esac
14986
14987 : see if hasmntopt exists
14988 set hasmntopt d_hasmntopt
14989 eval $inlibc
14990
14991 : see if this is a netinet/in.h or sys/in.h system
14992 set netinet/in.h i_niin sys/in.h i_sysin
14993 eval $inhdr
14994
14995 : see if arpa/inet.h has to be included
14996 set arpa/inet.h i_arpainet
14997 eval $inhdr
14998
14999 : see if htonl --and friends-- exists
15000 val=''
15001 set htonl val
15002 eval $inlibc
15003
15004 : Maybe they are macros.
15005 case "$val" in
15006 $undef)
15007         $cat >htonl.c <<EOM
15008 #include <stdio.h>
15009 #include <sys/types.h>
15010 #$i_niin I_NETINET_IN
15011 #$i_sysin I_SYS_IN
15012 #$i_arpainet I_ARPA_INET
15013 #ifdef I_NETINET_IN
15014 #include <netinet/in.h>
15015 #endif
15016 #ifdef I_SYS_IN
15017 #include <sys/in.h>
15018 #endif
15019 #ifdef I_ARPA_INET
15020 #include <arpa/inet.h>
15021 #endif
15022 #ifdef htonl
15023 printf("Defined as a macro.");
15024 #endif
15025 EOM
15026         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15027         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15028                 val="$define"
15029                 echo "But it seems to be defined as a macro." >&4
15030         fi
15031         $rm -f htonl.?
15032         ;;
15033 esac
15034 set d_htonl
15035 eval $setvar
15036
15037 : see if ilogbl exists
15038 set ilogbl d_ilogbl
15039 eval $inlibc
15040
15041 : index or strchr
15042 echo " "
15043 if set index val -f; eval $csym; $val; then
15044         if set strchr val -f d_strchr; eval $csym; $val; then
15045                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15046                         val="$define"
15047                         vali="$undef"
15048                         echo "strchr() found." >&4
15049                 else
15050                         val="$undef"
15051                         vali="$define"
15052                         echo "index() found." >&4
15053                 fi
15054         else
15055                 val="$undef"
15056                 vali="$define"
15057                 echo "index() found." >&4
15058         fi
15059 else
15060         if set strchr val -f d_strchr; eval $csym; $val; then
15061                 val="$define"
15062                 vali="$undef"
15063                 echo "strchr() found." >&4
15064         else
15065                 echo "No index() or strchr() found!" >&4
15066                 val="$undef"
15067                 vali="$undef"
15068         fi
15069 fi
15070 set d_strchr; eval $setvar
15071 val="$vali"
15072 set d_index; eval $setvar
15073
15074 : check whether inet_aton exists
15075 set inet_aton d_inetaton
15076 eval $inlibc
15077
15078 : see if inet_ntop exists
15079 set inet_ntop d_inetntop
15080 eval $inlibc
15081
15082 : see if inet_pton exists
15083 set inet_pton d_inetpton
15084 eval $inlibc
15085
15086 : Look for isascii
15087 echo " "
15088 $cat >isascii.c <<EOCP
15089 #include <stdio.h>
15090 #include <ctype.h>
15091 #$i_stdlib I_STDLIB
15092 #ifdef I_STDLIB
15093 #include <stdlib.h>
15094 #endif
15095 int main() {
15096         int c = 'A';
15097         if (isascii(c))
15098                 exit(0);
15099         else
15100                 exit(1);
15101 }
15102 EOCP
15103 set isascii
15104 if eval $compile; then
15105         echo "isascii() found." >&4
15106         val="$define"
15107 else
15108         echo "isascii() NOT found." >&4
15109         val="$undef"
15110 fi
15111 set d_isascii
15112 eval $setvar
15113 $rm -f isascii*
15114
15115 : Look for isblank
15116 echo " "
15117 $cat >isblank.c <<'EOCP'
15118 #include <stdio.h>
15119 #include <ctype.h>
15120 int main() {
15121         int c = ' ';
15122         if (isblank(c))
15123                 return 0 ;
15124         else
15125                 return 1 ;
15126 }
15127 EOCP
15128 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15129         echo "isblank() found." >&4
15130         val="$define"
15131 else
15132         echo "isblank() NOT found." >&4
15133         val="$undef"
15134 fi
15135 set d_isblank
15136 eval $setvar
15137 $rm -f isblank*
15138
15139 : see if isfinite exists
15140 set isfinite d_isfinite
15141 eval $inlibc
15142
15143 : see if isinf exists
15144 set isinf d_isinf
15145 eval $inlibc
15146
15147 : see if isnan exists
15148 set isnan d_isnan
15149 eval $inlibc
15150
15151 : see if isnanl exists
15152 set isnanl d_isnanl
15153 eval $inlibc
15154
15155 : see if killpg exists
15156 set killpg d_killpg
15157 eval $inlibc
15158
15159 : see if lchown exists
15160 echo " "
15161 $cat > try.c <<'EOCP'
15162 /* System header to define __stub macros and hopefully few prototypes,
15163     which can conflict with char lchown(); below.  */
15164 #include <assert.h>
15165 /* Override any gcc2 internal prototype to avoid an error.  */
15166 /* We use char because int might match the return type of a gcc2
15167    builtin and then its argument prototype would still apply.  */
15168 char lchown();
15169 int main() {
15170     /*  The GNU C library defines this for functions which it implements
15171         to always fail with ENOSYS.  Some functions are actually named
15172         something starting with __ and the normal name is an alias.  */
15173 #if defined (__stub_lchown) || defined (__stub___lchown)
15174 choke me
15175 #else
15176 lchown();
15177 #endif
15178 ; return 0; }
15179 EOCP
15180 set try
15181 if eval $compile; then
15182     $echo "lchown() found." >&4
15183     val="$define"
15184 else
15185     $echo "lchown() NOT found." >&4
15186     val="$undef"
15187 fi
15188 set d_lchown
15189 eval $setvar
15190
15191 : See if number of significant digits in a double precision number is known
15192 echo " "
15193 $cat >ldbl_dig.c <<EOM
15194 #$i_limits I_LIMITS
15195 #$i_float I_FLOAT
15196 #ifdef I_LIMITS
15197 #include <limits.h>
15198 #endif
15199 #ifdef I_FLOAT
15200 #include <float.h>
15201 #endif
15202 #ifdef LDBL_DIG
15203 printf("Contains LDBL_DIG");
15204 #endif
15205 EOM
15206 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15207 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15208         echo "LDBL_DIG found." >&4
15209         val="$define"
15210 else
15211         echo "LDBL_DIG NOT found." >&4
15212         val="$undef"
15213 fi
15214 $rm -f ldbl_dig.?
15215 set d_ldbl_dig
15216 eval $setvar
15217
15218 : see if this is a math.h system
15219 set math.h i_math
15220 eval $inhdr
15221
15222 : check to see if math.h defines _LIB_VERSION
15223 d_libm_lib_version="$undef"
15224 case $i_math in
15225     $define)
15226         echo " "
15227         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15228         $cat >try.c <<EOCP
15229 #include <unistd.h>
15230 #include <math.h>
15231 int main (int argc, char *argv[])
15232 {
15233     printf ("%d\n", _LIB_VERSION);
15234     return (0);
15235     } /* main */
15236 EOCP
15237         set try
15238         if eval $compile; then
15239             foo=`$run ./try`
15240             echo "Yes, it does ($foo)" >&4
15241             d_libm_lib_version="$define"
15242         else
15243             echo "No, it does not (probably harmless)" >&4
15244             fi
15245         $rm_try
15246         ;;
15247
15248     esac
15249
15250 : see if link exists
15251 set link d_link
15252 eval $inlibc
15253
15254 : see if localtime_r exists
15255 set localtime_r d_localtime_r
15256 eval $inlibc
15257 case "$d_localtime_r" in
15258 "$define")
15259         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15260         case "$d_localtime_r_proto:$usethreads" in
15261         ":define")      d_localtime_r_proto=define
15262                 set d_localtime_r_proto localtime_r $hdrs
15263                 eval $hasproto ;;
15264         *)      ;;
15265         esac
15266         case "$d_localtime_r_proto" in
15267         define)
15268         case "$localtime_r_proto" in
15269         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15270         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15271         esac
15272         case "$localtime_r_proto" in
15273         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15274         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15275         esac
15276         case "$localtime_r_proto" in
15277         ''|0)   d_localtime_r=undef
15278                 localtime_r_proto=0
15279                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15280         * )     case "$localtime_r_proto" in
15281                 REENTRANT_PROTO*) ;;
15282                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15283                 esac
15284                 echo "Prototype: $try" ;;
15285         esac
15286         ;;
15287         *)      case "$usethreads" in
15288                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15289                 esac
15290                 d_localtime_r=undef
15291                 localtime_r_proto=0
15292                 ;;
15293         esac
15294         ;;
15295 *)      localtime_r_proto=0
15296         ;;
15297 esac
15298
15299 : see if localtime_r calls tzset
15300 case "$localtime_r_proto" in
15301 REENTRANT_PROTO*)
15302         $cat >try.c <<EOCP
15303 /*  Does our libc's localtime_r call tzset ?
15304  *  return 0 if so, 1 otherwise.
15305  */
15306 #$i_systypes    I_SYS_TYPES
15307 #$i_unistd      I_UNISTD
15308 #$i_time        I_TIME
15309 #$i_stdlib      I_STDLIB
15310 #$i_string      I_STRING
15311 #$i_malloc      I_MALLOC
15312 #ifdef I_SYS_TYPES
15313 #  include <sys/types.h>
15314 #endif
15315 #ifdef I_UNISTD
15316 #  include <unistd.h>
15317 #endif
15318 #ifdef I_TIME
15319 #  include <time.h>
15320 #endif
15321 #ifdef I_STDLIB
15322 #include <stdlib.h>
15323 #endif
15324 #ifdef I_STRING
15325 #  include <string.h>
15326 #else
15327 #  include <strings.h>
15328 #endif
15329 #ifdef I_MALLOC
15330 #  include <malloc.h>
15331 #endif
15332 int main()
15333 {
15334     time_t t = time(0L);
15335     char w_tz[]="TZ" "=GMT+5",
15336          e_tz[]="TZ" "=GMT-5",
15337         *tz_e = (char*)malloc(16),
15338         *tz_w = (char*)malloc(16);
15339     struct tm tm_e, tm_w;
15340     memset(&tm_e,'\0',sizeof(struct tm));
15341     memset(&tm_w,'\0',sizeof(struct tm));
15342     strcpy(tz_e,e_tz);
15343     strcpy(tz_w,w_tz);
15344
15345     putenv(tz_e);
15346     localtime_r(&t, &tm_e);
15347
15348     putenv(tz_w);
15349     localtime_r(&t, &tm_w);
15350
15351     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15352         return 1;
15353     return 0;
15354 }
15355 EOCP
15356         set try
15357         if eval $compile; then
15358             if $run ./try; then
15359                 d_localtime_r_needs_tzset=undef;
15360             else
15361                 d_localtime_r_needs_tzset=define;
15362             fi;
15363         else
15364             d_localtime_r_needs_tzset=undef;
15365         fi;
15366      ;;
15367   *)
15368      d_localtime_r_needs_tzset=undef;
15369      ;;
15370 esac
15371 $rm_try
15372
15373 : see if localeconv exists
15374 set localeconv d_locconv
15375 eval $inlibc
15376
15377 : see if lockf exists
15378 set lockf d_lockf
15379 eval $inlibc
15380
15381 : see if prototype for lseek is available
15382 echo " "
15383 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15384 eval $hasproto
15385
15386 : see if lstat exists
15387 set lstat d_lstat
15388 eval $inlibc
15389
15390 : see if madvise exists
15391 set madvise d_madvise
15392 eval $inlibc
15393
15394 : see if malloc_size exists
15395 set malloc_size d_malloc_size
15396 eval $inlibc
15397
15398 : see if malloc_size_good exists
15399 set malloc_good_size d_malloc_good_size
15400 eval $inlibc
15401
15402 : see if mblen exists
15403 set mblen d_mblen
15404 eval $inlibc
15405
15406 : see if mbstowcs exists
15407 set mbstowcs d_mbstowcs
15408 eval $inlibc
15409
15410 : see if mbtowc exists
15411 set mbtowc d_mbtowc
15412 eval $inlibc
15413
15414 : see if memchr exists
15415 set memchr d_memchr
15416 eval $inlibc
15417
15418 : see if memcmp exists
15419 set memcmp d_memcmp
15420 eval $inlibc
15421
15422 : see if memcpy exists
15423 set memcpy d_memcpy
15424 eval $inlibc
15425
15426 : see if memmove exists
15427 set memmove d_memmove
15428 eval $inlibc
15429
15430 : see if memset exists
15431 set memset d_memset
15432 eval $inlibc
15433
15434 : see if mkdir exists
15435 set mkdir d_mkdir
15436 eval $inlibc
15437
15438 : see if mkdtemp exists
15439 set mkdtemp d_mkdtemp
15440 eval $inlibc
15441
15442 : see if mkfifo exists
15443 set mkfifo d_mkfifo
15444 eval $inlibc
15445
15446 : see if mkstemp exists
15447 set mkstemp d_mkstemp
15448 eval $inlibc
15449
15450 : see if mkstemps exists
15451 set mkstemps d_mkstemps
15452 eval $inlibc
15453
15454 : see if mktime exists
15455 set mktime d_mktime
15456 eval $inlibc
15457
15458 : see if this is a sys/mman.h system
15459 set sys/mman.h i_sysmman
15460 eval $inhdr
15461
15462 : see if mmap exists
15463 set mmap d_mmap
15464 eval $inlibc
15465 : see what shmat returns
15466 : default to something harmless
15467 mmaptype='void *'
15468 case "$i_sysmman$d_mmap" in
15469 "$define$define")
15470         $cat >mmap.c <<'END'
15471 #include <sys/mman.h>
15472 void *mmap();
15473 END
15474         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15475                 mmaptype='void *'
15476         else
15477                 mmaptype='caddr_t'
15478         fi
15479         echo "and it returns ($mmaptype)." >&4
15480         ;;
15481 esac
15482
15483
15484
15485 : see if sqrtl exists
15486 set sqrtl d_sqrtl
15487 eval $inlibc
15488
15489 : see if scalbnl exists
15490 set scalbnl d_scalbnl
15491 eval $inlibc
15492
15493 : see if modfl exists
15494 set modfl d_modfl
15495 eval $inlibc
15496
15497 : see if prototype for modfl is available
15498 echo " "
15499 set d_modflproto modfl $i_math math.h
15500 eval $hasproto
15501
15502 d_modfl_pow32_bug="$undef"
15503
15504 case "$d_longdbl$d_modfl" in
15505 $define$define)
15506         $cat <<EOM
15507 Checking to see whether your modfl() is okay for large values...
15508 EOM
15509 $cat >try.c <<EOCP
15510 #include <math.h>
15511 #include <stdio.h>
15512 EOCP
15513 if $test "X$d_modflproto" != "X$define"; then
15514         $cat >>try.c <<EOCP
15515 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15516 long double modfl (long double, long double *);
15517 EOCP
15518 fi
15519 $cat >>try.c <<EOCP
15520 int main() {
15521     long double nv = 4294967303.15;
15522     long double v, w;
15523     v = modfl(nv, &w);
15524 #ifdef __GLIBC__
15525     printf("glibc");
15526 #endif
15527     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15528     return 0;
15529 }
15530 EOCP
15531         case "$osname:$gccversion" in
15532         aix:)   saveccflags="$ccflags"
15533                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15534         esac
15535         set try
15536         if eval $compile; then
15537                 foo=`$run ./try`
15538                 case "$foo" in
15539                 *" 4294967303.150000 1.150000 4294967302.000000")
15540                         echo >&4 "Your modfl() is broken for large values."
15541                         d_modfl_pow32_bug="$define"
15542                         case "$foo" in
15543                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15544                         ;;
15545                         esac
15546                         ;;
15547                 *" 4294967303.150000 0.150000 4294967303.000000")
15548                         echo >&4 "Your modfl() seems okay for large values."
15549                         ;;
15550                 *)      echo >&4 "I don't understand your modfl() at all."
15551                         d_modfl="$undef"
15552                         ;;
15553                 esac
15554                 $rm_try
15555         else
15556                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15557                 d_modfl="$undef"
15558         fi
15559         case "$osname:$gccversion" in
15560         aix:)   ccflags="$saveccflags" ;; # restore
15561         esac
15562         ;;
15563 esac
15564
15565 if $test "$uselongdouble" = "$define"; then
15566     message=""
15567     if $test "$d_sqrtl" != "$define"; then
15568         message="$message sqrtl"
15569     fi
15570     if $test "$d_modfl" != "$define"; then
15571         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15572             echo "You have both aintl and copysignl, so I can emulate modfl."
15573         else
15574             message="$message modfl"
15575         fi
15576     fi
15577     if $test "$d_frexpl" != "$define"; then
15578         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15579             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15580         else
15581             message="$message frexpl"
15582         fi
15583     fi
15584
15585     if $test "$message" != ""; then
15586         $cat <<EOM >&4
15587
15588 *** You requested the use of long doubles but you do not seem to have
15589 *** the following mathematical functions needed for long double support:
15590 ***    $message
15591 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15592 *** Cannot continue, aborting.
15593
15594 EOM
15595
15596         exit 1
15597     fi
15598 fi
15599
15600 : see if mprotect exists
15601 set mprotect d_mprotect
15602 eval $inlibc
15603
15604 : see if msgctl exists
15605 set msgctl d_msgctl
15606 eval $inlibc
15607
15608 : see if msgget exists
15609 set msgget d_msgget
15610 eval $inlibc
15611
15612 : see if msgsnd exists
15613 set msgsnd d_msgsnd
15614 eval $inlibc
15615
15616 : see if msgrcv exists
15617 set msgrcv d_msgrcv
15618 eval $inlibc
15619
15620 : see how much of the 'msg*(2)' library is present.
15621 h_msg=true
15622 echo " "
15623 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15624 *"$undef"*) h_msg=false;;
15625 esac
15626 case "$osname" in
15627 freebsd)
15628     case "`ipcs 2>&1`" in
15629     "SVID messages"*"not configured"*)
15630         echo "Your $osname does not have the msg*(2) configured." >&4
15631         h_msg=false
15632         val="$undef"
15633         set msgctl d_msgctl
15634         eval $setvar
15635         set msgget d_msgget
15636         eval $setvar
15637         set msgsnd d_msgsnd
15638         eval $setvar
15639         set msgrcv d_msgrcv
15640         eval $setvar
15641         ;;
15642     esac
15643     ;;
15644 esac
15645 : we could also check for sys/ipc.h ...
15646 if $h_msg && $test `./findhdr sys/msg.h`; then
15647         echo "You have the full msg*(2) library." >&4
15648         val="$define"
15649 else
15650         echo "You don't have the full msg*(2) library." >&4
15651         val="$undef"
15652 fi
15653 set d_msg
15654 eval $setvar
15655
15656 : Check for msghdr_s
15657 echo " "
15658 echo "Checking to see if your system supports struct msghdr..." >&4
15659 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15660 eval $hasstruct
15661 case "$d_msghdr_s" in
15662 "$define")      echo "Yes, it does."   ;;
15663 *)              echo "No, it doesn't." ;;
15664 esac
15665
15666
15667 : see if msync exists
15668 set msync d_msync
15669 eval $inlibc
15670
15671 : see if munmap exists
15672 set munmap d_munmap
15673 eval $inlibc
15674
15675 : see if nice exists
15676 set nice d_nice
15677 eval $inlibc
15678
15679 : see if this is a langinfo.h system
15680 set langinfo.h i_langinfo
15681 eval $inhdr
15682
15683 : see if nl_langinfo exists
15684 set nl_langinfo d_nl_langinfo
15685 eval $inlibc
15686
15687 : check for volatile keyword
15688 echo " "
15689 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15690 $cat >try.c <<'EOCP'
15691 int main()
15692 {
15693         typedef struct _goo_struct goo_struct;
15694         goo_struct * volatile goo = ((goo_struct *)0);
15695         struct _goo_struct {
15696                 long long_int;
15697                 int reg_int;
15698                 char char_var;
15699         };
15700         typedef unsigned short foo_t;
15701         char *volatile foo;
15702         volatile int bar;
15703         volatile foo_t blech;
15704         foo = foo;
15705 }
15706 EOCP
15707 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15708         val="$define"
15709         echo "Yup, it does."
15710 else
15711         val="$undef"
15712         echo "Nope, it doesn't."
15713 fi
15714 set d_volatile
15715 eval $setvar
15716 $rm_try
15717
15718 : Check basic sizes
15719 echo " "
15720 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15721
15722 case "$use64bitint:$d_quad:$quadtype" in
15723 define:define:?*)
15724         ivtype="$quadtype"
15725         uvtype="$uquadtype"
15726         ivsize=8
15727         uvsize=8
15728         ;;
15729 *)      ivtype="long"
15730         uvtype="unsigned long"
15731         ivsize=$longsize
15732         uvsize=$longsize
15733         ;;
15734 esac
15735
15736 case "$uselongdouble:$d_longdbl" in
15737 define:define)
15738         nvtype="long double"
15739         nvsize=$longdblsize
15740         ;;
15741 *)      nvtype=double
15742         nvsize=$doublesize
15743         ;;
15744 esac
15745
15746 $echo "(IV will be "$ivtype", $ivsize bytes)"
15747 $echo "(UV will be "$uvtype", $uvsize bytes)"
15748 $echo "(NV will be "$nvtype", $nvsize bytes)"
15749
15750 $cat >try.c <<EOCP
15751 #$i_inttypes I_INTTYPES
15752 #ifdef I_INTTYPES
15753 #include <inttypes.h>
15754 #endif
15755 #include <stdio.h>
15756 int main() {
15757 #ifdef INT8
15758    int8_t i =  INT8_MAX;
15759   uint8_t u = UINT8_MAX;
15760   printf("int8_t\n");
15761 #endif
15762 #ifdef INT16
15763    int16_t i =  INT16_MAX;
15764   uint16_t i = UINT16_MAX;
15765   printf("int16_t\n");
15766 #endif
15767 #ifdef INT32
15768    int32_t i =  INT32_MAX;
15769   uint32_t u = UINT32_MAX;
15770   printf("int32_t\n");
15771 #endif
15772 }
15773 EOCP
15774
15775 i8type="signed char"
15776 u8type="unsigned char"
15777 i8size=1
15778 u8size=1
15779
15780 case "$i16type" in
15781 '')     case "$shortsize" in
15782         2)      i16type=short
15783                 u16type="unsigned short"
15784                 i16size=$shortsize
15785                 u16size=$shortsize
15786                 ;;
15787         esac
15788         ;;
15789 esac
15790 case "$i16type" in
15791 '')     set try -DINT16
15792         if eval $compile; then
15793                 case "`$run ./try`" in
15794                 int16_t)
15795                         i16type=int16_t
15796                         u16type=uint16_t
15797                         i16size=2
15798                         u16size=2
15799                         ;;
15800                 esac
15801         fi
15802         ;;
15803 esac
15804 case "$i16type" in
15805 '')     if $test $shortsize -ge 2; then
15806                 i16type=short
15807                 u16type="unsigned short"
15808                 i16size=$shortsize
15809                 u16size=$shortsize
15810         fi
15811         ;;
15812 esac
15813
15814 case "$i32type" in
15815 '')     case "$longsize" in
15816         4)      i32type=long
15817                 u32type="unsigned long"
15818                 i32size=$longsize
15819                 u32size=$longsize
15820                 ;;
15821         *)      case "$intsize" in
15822                 4)      i32type=int
15823                         u32type="unsigned int"
15824                         i32size=$intsize
15825                         u32size=$intsize
15826                         ;;
15827                 esac
15828                 ;;
15829         esac
15830         ;;
15831 esac
15832 case "$i32type" in
15833 '')     set try -DINT32
15834         if eval $compile; then
15835                 case "`$run ./try`" in
15836                 int32_t)
15837                         i32type=int32_t
15838                         u32type=uint32_t
15839                         i32size=4
15840                         u32size=4
15841                         ;;
15842                 esac
15843         fi
15844         ;;
15845 esac
15846 case "$i32type" in
15847 '')     if $test $intsize -ge 4; then
15848                 i32type=int
15849                 u32type="unsigned int"
15850                 i32size=$intsize
15851                 u32size=$intsize
15852         fi
15853         ;;
15854 esac
15855
15856 case "$i64type" in
15857 '')     case "$d_quad:$quadtype" in
15858         define:?*)
15859                 i64type="$quadtype"
15860                 u64type="$uquadtype"
15861                 i64size=8
15862                 u64size=8
15863                 ;;
15864         esac
15865         ;;
15866 esac
15867
15868 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15869 : volatile so that the compiler has to store it out to memory.
15870 if test X"$d_volatile" = X"$define"; then
15871         volatile=volatile
15872 fi
15873 $cat <<EOP >try.c
15874 #include <stdio.h>
15875 #$i_stdlib I_STDLIB
15876 #ifdef I_STDLIB
15877 #include <stdlib.h>
15878 #endif
15879 #include <sys/types.h>
15880 #include <signal.h>
15881 #ifdef SIGFPE
15882 $volatile int bletched = 0;
15883 $signal_t blech(int s) { bletched = 1; }
15884 #endif
15885 int main() {
15886     $uvtype u = 0;
15887     $nvtype d;
15888     int     n = 8 * $uvsize;
15889     int     i;
15890 #ifdef SIGFPE
15891     signal(SIGFPE, blech);
15892 #endif
15893
15894     for (i = 0; i < n; i++) {
15895       u = u << 1 | ($uvtype)1;
15896       d = ($nvtype)u;
15897       if (($uvtype)d != u)
15898         break;
15899       if (d <= 0)
15900         break;
15901       d = ($nvtype)(u - 1);
15902       if (($uvtype)d != (u - 1))
15903         break;
15904 #ifdef SIGFPE
15905       if (bletched)
15906         break;
15907 #endif
15908     }
15909     printf("%d\n", ((i == n) ? -n : i));
15910     exit(0);
15911 }
15912 EOP
15913 set try
15914
15915 d_nv_preserves_uv="$undef"
15916 if eval $compile; then
15917         nv_preserves_uv_bits="`$run ./try`"
15918 fi
15919 case "$nv_preserves_uv_bits" in
15920 \-[1-9]*)
15921         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15922         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15923         d_nv_preserves_uv="$define"
15924         ;;
15925 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15926         d_nv_preserves_uv="$undef" ;;
15927 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15928         nv_preserves_uv_bits="0" ;;
15929 esac
15930 $rm_try
15931
15932 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15933 : volatile so that the compiler has to store it out to memory.
15934 if test X"$d_volatile" = X"$define"; then
15935         volatile=volatile
15936 fi
15937 $cat <<EOP >try.c
15938 #include <stdio.h>
15939
15940 typedef $nvtype NV;
15941
15942 int
15943 main() {
15944   NV value = 2;
15945   int count = 1;
15946
15947   while(count < 256) {
15948     $volatile NV up = value + 1.0;
15949     $volatile NV negated = -value;
15950     $volatile NV down = negated - 1.0;
15951     $volatile NV got_up = up - value;
15952     int up_good = got_up == 1.0;
15953     int got_down = down - negated;
15954     int down_good = got_down == -1.0;
15955
15956     if (down_good != up_good) {
15957       fprintf(stderr,
15958               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15959               up_good, (double) got_up, down_good, (double) got_down,
15960               count, (double) value);
15961       return 1;
15962     }
15963     if (!up_good) {
15964       while (1) {
15965         if (count > 8) {
15966           count -= 8;
15967           fputs("256.0", stdout);
15968         } else {
15969           count--;
15970           fputs("2.0", stdout);
15971         }
15972         if (!count) {
15973           puts("");
15974           return 0;
15975         }
15976         fputs("*", stdout);
15977       }
15978     }
15979     value *= 2;
15980     ++count;
15981   }
15982   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15983           count, (double) value);
15984   return 1;
15985 }
15986 EOP
15987 set try
15988
15989 nv_overflows_integers_at='0'
15990 if eval $compile; then
15991     xxx="`$run ./try`"
15992     case "$?" in
15993         0)
15994             case "$xxx" in
15995                 2*)  cat >&4 <<EOM
15996 The largest integer your NVs can preserve is equal to $xxx
15997 EOM
15998                     nv_overflows_integers_at="$xxx"
15999                     ;;
16000                 *)  cat >&4 <<EOM
16001 Cannot determine the largest integer value your NVs can hold, unexpected output
16002 '$xxx'
16003 EOM
16004                     ;;
16005             esac
16006             ;;
16007         *)  cat >&4 <<EOM
16008 Cannot determine the largest integer value your NVs can hold
16009 EOM
16010             ;;
16011     esac
16012 fi
16013 $rm_try
16014
16015 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16016 : volatile so that the compiler has to store it out to memory.
16017 if test X"$d_volatile" = X"$define"; then
16018         volatile=volatile
16019 fi
16020 $cat <<EOP >try.c
16021 #include <stdio.h>
16022 #$i_stdlib I_STDLIB
16023 #ifdef I_STDLIB
16024 #include <stdlib.h>
16025 #endif
16026 #$i_string I_STRING
16027 #ifdef I_STRING
16028 #  include <string.h>
16029 #else
16030 #  include <strings.h>
16031 #endif
16032 #include <sys/types.h>
16033 #include <signal.h>
16034 #ifdef SIGFPE
16035 $volatile int bletched = 0;
16036 $signal_t blech(int s) { bletched = 1; }
16037 #endif
16038
16039 int checkit($nvtype d, char *where) {
16040     unsigned char *p = (char *)&d;
16041     unsigned char *end = p + sizeof(d);
16042     int fail = 0;
16043
16044     while (p < end)
16045         fail += *p++;
16046
16047     if (!fail)
16048         return 0;
16049
16050     p = (char *)&d;
16051     printf("No - %s: 0x", where);
16052     while (p < end)
16053         printf ("%02X", *p++);
16054     printf("\n");
16055     return 1;
16056 }
16057
16058 int main(int argc, char **argv) {
16059     $nvtype d = 0.0;
16060     int fail = 0;
16061     fail += checkit(d, "0.0");
16062
16063     /* The compiler shouldn't be assuming that bletched is 0  */
16064     d = bletched;
16065
16066     fail += checkit(d, "bleched");
16067
16068 #ifdef SIGFPE
16069     signal(SIGFPE, blech);
16070 #endif
16071
16072     /* Paranoia - the compiler should have no way of knowing that ANSI says
16073        that argv[argc] will always be NULL.  Actually, if it did assume this it
16074        would be buggy, as this is C and main() can be called from elsewhere in
16075        the program.  */
16076     d = argv[argc] ? 1 : 0;
16077
16078     if (d) {
16079         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16080     }
16081
16082     fail += checkit(d, "ternary");
16083
16084     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16085
16086     if (d != 0.0) {
16087         printf("No - memset doesn't give 0.0\n");
16088         /* This might just blow up:  */
16089         printf("(gives %g)\n", d);
16090         return 1;
16091     }
16092
16093 #ifdef SIGFPE
16094     if (bletched) {
16095         printf("No - something bleched\n");
16096         return 1;
16097     }
16098 #endif
16099     if (fail) {
16100       printf("No - %d fail(s)\n", fail);
16101       return 1;
16102     }
16103     printf("Yes\n");
16104     return 0;
16105 }
16106 EOP
16107 set try
16108
16109 d_nv_zero_is_allbits_zero="$undef"
16110 if eval $compile; then
16111     xxx="`$run ./try`"
16112     case "$?" in
16113         0)
16114             case "$xxx" in
16115                 Yes)  cat >&4 <<EOM
16116 0.0 is represented as all bits zero in memory
16117 EOM
16118                     d_nv_zero_is_allbits_zero="$define"
16119                     ;;
16120                 *)  cat >&4 <<EOM
16121 0.0 is not represented as all bits zero in memory
16122 EOM
16123                     d_nv_zero_is_allbits_zero="$undef"
16124                     ;;
16125             esac
16126             ;;
16127         *)  cat >&4 <<EOM
16128 0.0 is not represented as all bits zero in memory
16129 EOM
16130             d_nv_zero_is_allbits_zero="$undef"
16131             ;;
16132     esac
16133 fi
16134 $rm_try
16135
16136 : check for off64_t
16137 echo " "
16138 echo "Checking to see if you have off64_t..." >&4
16139 $cat >try.c <<EOCP
16140 #include <sys/types.h>
16141 #include <unistd.h>
16142 int main() { off64_t x = 7; }
16143 EOCP
16144 set try
16145 if eval $compile; then
16146         val="$define"
16147         echo "You have off64_t."
16148 else
16149         val="$undef"
16150         echo "You do not have off64_t."
16151         case "$lseeksize" in
16152         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16153         esac
16154 fi
16155 $rm_try
16156 set d_off64_t
16157 eval $setvar
16158
16159 : how to create joinable pthreads
16160 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16161         echo " "
16162         echo "Checking what constant to use for creating joinable pthreads..." >&4
16163         $cat >try.c <<'EOCP'
16164 #include <pthread.h>
16165 int main() {
16166     int detachstate = JOINABLE;
16167 }
16168 EOCP
16169         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16170         if eval $compile; then
16171                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16172                 val="$undef" # Yes, undef.
16173                 set d_old_pthread_create_joinable
16174                 eval $setvar
16175                 val=""
16176                 set old_pthread_create_joinable
16177                 eval $setvar
16178         else
16179                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16180                 if eval $compile; then
16181                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16182                         val="$define"
16183                         set d_old_pthread_create_joinable
16184                         eval $setvar
16185                         val=PTHREAD_CREATE_UNDETACHED
16186                         set old_pthread_create_joinable
16187                         eval $setvar
16188                 else
16189                         set try -DJOINABLE=__UNDETACHED
16190                         if eval $compile; then
16191                                 echo "You seem to use __UNDETACHED." >&4
16192                                 val="$define"
16193                                 set d_old_pthread_create_joinable
16194                                 eval $setvar
16195                                 val=__UNDETACHED
16196                                 set old_pthread_create_joinable
16197                                 eval $setvar
16198                         else
16199                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16200                                 val="$define"
16201                                 set d_old_pthread_create_joinable
16202                                 eval $setvar
16203                                 val=0
16204                                 set old_pthread_create_joinable
16205                                 eval $setvar
16206                         fi
16207                 fi
16208         fi
16209         $rm_try
16210 else
16211     d_old_pthread_create_joinable="$undef"
16212     old_pthread_create_joinable=""
16213 fi
16214
16215 : see if pause exists
16216 set pause d_pause
16217 eval $inlibc
16218
16219 : see if poll exists
16220 set poll d_poll
16221 eval $inlibc
16222
16223 : see if prctl exists
16224 set prctl d_prctl
16225 eval $inlibc
16226
16227 : see if prctl supports PR_SET_NAME
16228 d_prctl_set_name=$undef
16229 case $d_prctl in
16230     $define)
16231         $cat >try.c <<EOM
16232 #include <sys/prctl.h>
16233
16234 int main (int argc, char *argv[])
16235 {
16236     return (prctl (PR_SET_NAME, "Test"));
16237     } /* main */
16238 EOM
16239         set try
16240         if eval $compile_ok && $run ./try; then
16241             echo "Your prctl (PR_SET_NAME, ...) works"
16242             d_prctl_set_name=$define
16243             fi
16244         $rm_try
16245         ;;
16246     esac
16247
16248 : see if readlink exists
16249 set readlink d_readlink
16250 eval $inlibc
16251
16252 : Check if exe is symlink to abs path of executing program
16253 echo " "
16254 procselfexe=''
16255 val="$undef"
16256 case "$d_readlink" in
16257     "$define")
16258         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16259         : more tidy to avoid an extra level of symlink
16260         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16261         while test $# -gt 0; do
16262             type=$1; try=$2
16263             shift; shift
16264             if $issymlink $try; then
16265                 $ls -l $try > reflect
16266                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16267                     echo "You have $type-like $try."
16268                     procselfexe='"'$try'"'
16269                     val="$define"
16270                     : This will break out of the loop
16271                     set X; shift
16272                 fi
16273             fi
16274         done
16275         ;;
16276 esac
16277 $rm -f reflect
16278 set d_procselfexe
16279 eval $setvar
16280
16281 : backward compatibility for d_hvfork
16282 if test X$d_hvfork != X; then
16283         d_vfork="$d_hvfork"
16284         d_hvfork=''
16285 fi
16286 : see if there is a vfork
16287 val=''
16288 set vfork val
16289 eval $inlibc
16290
16291 d_pseudofork=$undef
16292
16293 : Ok, but do we want to use it. vfork is reportedly unreliable in
16294 : perl on Solaris 2.x, and probably elsewhere.
16295 case "$val" in
16296 $define)
16297         echo " "
16298         case "$usevfork" in
16299         false) dflt='n';;
16300         *) dflt='y';;
16301         esac
16302         cat <<'EOM'
16303
16304 Perl can only use a vfork() that doesn't suffer from strict
16305 restrictions on calling functions or modifying global data in
16306 the child.  For example, glibc-2.1 contains such a vfork()
16307 that is unsuitable.  If your system provides a proper fork()
16308 call, chances are that you do NOT want perl to use vfork().
16309
16310 EOM
16311         rp="Do you still want to use vfork()?"
16312         . ./myread
16313         case "$ans" in
16314         y|Y) ;;
16315         *)
16316                 echo "Ok, we won't use vfork()."
16317                 val="$undef"
16318                 ;;
16319         esac
16320         ;;
16321 esac
16322 set d_vfork
16323 eval $setvar
16324 case "$d_vfork" in
16325 $define) usevfork='true';;
16326 *) usevfork='false';;
16327 esac
16328
16329 : see whether the pthread_atfork exists
16330 $cat >try.c <<EOP
16331 #include <pthread.h>
16332 #include <stdio.h>
16333 int main() {
16334 #ifdef  PTHREAD_ATFORK
16335         pthread_atfork(NULL,NULL,NULL);
16336 #endif
16337 }
16338 EOP
16339
16340 : see if pthread_atfork exists
16341 set try -DPTHREAD_ATFORK
16342 if eval $compile; then
16343     val="$define"
16344 else
16345     val="$undef"
16346 fi
16347 case "$usethreads" in
16348 $define)
16349         case "$val" in
16350         $define) echo 'pthread_atfork found.' >&4        ;;
16351         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16352         esac
16353 esac
16354 set d_pthread_atfork
16355 eval $setvar
16356
16357 : see if pthread_attr_setscope exists
16358 set pthread_attr_setscope d_pthread_attr_setscope
16359 eval $inlibc
16360
16361 : see whether the various POSIXish _yields exist
16362 $cat >try.c <<EOP
16363 #include <pthread.h>
16364 #include <stdio.h>
16365 int main() {
16366 #ifdef SCHED_YIELD
16367         sched_yield();
16368 #else
16369 #ifdef PTHREAD_YIELD
16370         pthread_yield();
16371 #else
16372 #ifdef PTHREAD_YIELD_NULL
16373         pthread_yield(NULL);
16374 #endif
16375 #endif
16376 #endif
16377 }
16378 EOP
16379 : see if sched_yield exists
16380 set try -DSCHED_YIELD
16381 if eval $compile; then
16382     val="$define"
16383     sched_yield='sched_yield()'
16384 else
16385     val="$undef"
16386 fi
16387 case "$usethreads" in
16388 $define)
16389         case "$val" in
16390         $define) echo 'sched_yield() found.' >&4        ;;
16391         *)       echo 'sched_yield() NOT found.' >&4    ;;
16392         esac
16393 esac
16394 set d_sched_yield
16395 eval $setvar
16396
16397 : see if pthread_yield exists
16398 set try -DPTHREAD_YIELD
16399 if eval $compile; then
16400     val="$define"
16401     case "$sched_yield" in
16402     '') sched_yield='pthread_yield()' ;;
16403     esac
16404 else
16405     set try -DPTHREAD_YIELD_NULL
16406     if eval $compile; then
16407         val="$define"
16408         case "$sched_yield" in
16409         '') sched_yield='pthread_yield(NULL)' ;;
16410         esac
16411     else
16412         val="$undef"
16413     fi
16414 fi
16415 case "$usethreads" in
16416 $define)
16417         case "$val" in
16418         $define) echo 'pthread_yield() found.' >&4      ;;
16419         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16420         esac
16421         ;;
16422 esac
16423 set d_pthread_yield
16424 eval $setvar
16425 case "$sched_yield" in
16426 '') sched_yield=undef ;;
16427 esac
16428 $rm_try
16429
16430 : see if random_r exists
16431 set random_r d_random_r
16432 eval $inlibc
16433 case "$d_random_r" in
16434 "$define")
16435         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16436         case "$d_random_r_proto:$usethreads" in
16437         ":define")      d_random_r_proto=define
16438                 set d_random_r_proto random_r $hdrs
16439                 eval $hasproto ;;
16440         *)      ;;
16441         esac
16442         case "$d_random_r_proto" in
16443         define)
16444         case "$random_r_proto" in
16445         ''|0) try='int random_r(int*, struct random_data*);'
16446         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16447         esac
16448         case "$random_r_proto" in
16449         ''|0) try='int random_r(long*, struct random_data*);'
16450         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16451         esac
16452         case "$random_r_proto" in
16453         ''|0) try='int random_r(struct random_data*, int32_t*);'
16454         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16455         esac
16456         case "$random_r_proto" in
16457         ''|0)   d_random_r=undef
16458                 random_r_proto=0
16459                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16460         * )     case "$random_r_proto" in
16461                 REENTRANT_PROTO*) ;;
16462                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16463                 esac
16464                 echo "Prototype: $try" ;;
16465         esac
16466         ;;
16467         *)      case "$usethreads" in
16468                 define) echo "random_r has no prototype, not using it." >&4 ;;
16469                 esac
16470                 d_random_r=undef
16471                 random_r_proto=0
16472                 ;;
16473         esac
16474         ;;
16475 *)      random_r_proto=0
16476         ;;
16477 esac
16478
16479 : see if readdir and friends exist
16480 set readdir d_readdir
16481 eval $inlibc
16482 set seekdir d_seekdir
16483 eval $inlibc
16484 set telldir d_telldir
16485 eval $inlibc
16486 set rewinddir d_rewinddir
16487 eval $inlibc
16488
16489 : see if readdir64_r exists
16490 set readdir64_r d_readdir64_r
16491 eval $inlibc
16492 case "$d_readdir64_r" in
16493 "$define")
16494         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16495         case "$d_readdir64_r_proto:$usethreads" in
16496         ":define")      d_readdir64_r_proto=define
16497                 set d_readdir64_r_proto readdir64_r $hdrs
16498                 eval $hasproto ;;
16499         *)      ;;
16500         esac
16501         case "$d_readdir64_r_proto" in
16502         define)
16503         case "$readdir64_r_proto" in
16504         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16505         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16506         esac
16507         case "$readdir64_r_proto" in
16508         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16509         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16510         esac
16511         case "$readdir64_r_proto" in
16512         ''|0)   d_readdir64_r=undef
16513                 readdir64_r_proto=0
16514                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16515         * )     case "$readdir64_r_proto" in
16516                 REENTRANT_PROTO*) ;;
16517                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16518                 esac
16519                 echo "Prototype: $try" ;;
16520         esac
16521         ;;
16522         *)      case "$usethreads" in
16523                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16524                 esac
16525                 d_readdir64_r=undef
16526                 readdir64_r_proto=0
16527                 ;;
16528         esac
16529         ;;
16530 *)      readdir64_r_proto=0
16531         ;;
16532 esac
16533
16534 : see if readdir_r exists
16535 set readdir_r d_readdir_r
16536 eval $inlibc
16537 case "$d_readdir_r" in
16538 "$define")
16539         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16540         case "$d_readdir_r_proto:$usethreads" in
16541         ":define")      d_readdir_r_proto=define
16542                 set d_readdir_r_proto readdir_r $hdrs
16543                 eval $hasproto ;;
16544         *)      ;;
16545         esac
16546         case "$d_readdir_r_proto" in
16547         define)
16548         case "$readdir_r_proto" in
16549         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16550         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16551         esac
16552         case "$readdir_r_proto" in
16553         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16554         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16555         esac
16556         case "$readdir_r_proto" in
16557         ''|0)   d_readdir_r=undef
16558                 readdir_r_proto=0
16559                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16560         * )     case "$readdir_r_proto" in
16561                 REENTRANT_PROTO*) ;;
16562                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16563                 esac
16564                 echo "Prototype: $try" ;;
16565         esac
16566         ;;
16567         *)      case "$usethreads" in
16568                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16569                 esac
16570                 d_readdir_r=undef
16571                 readdir_r_proto=0
16572                 ;;
16573         esac
16574         ;;
16575 *)      readdir_r_proto=0
16576         ;;
16577 esac
16578
16579 : see if readv exists
16580 set readv d_readv
16581 eval $inlibc
16582
16583 : see if recvmsg exists
16584 set recvmsg d_recvmsg
16585 eval $inlibc
16586
16587 : see if rename exists
16588 set rename d_rename
16589 eval $inlibc
16590
16591 : see if rmdir exists
16592 set rmdir d_rmdir
16593 eval $inlibc
16594
16595 : see if memory.h is available.
16596 val=''
16597 set memory.h val
16598 eval $inhdr
16599
16600 : See if it conflicts with string.h
16601 case "$val" in
16602 $define)
16603         case "$strings" in
16604         '') ;;
16605         *)
16606                 $cppstdin $cppflags $cppminus < $strings > mem.h
16607                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16608                         echo " "
16609                         echo "We won't be including <memory.h>."
16610                         val="$undef"
16611                 fi
16612                 $rm -f mem.h
16613                 ;;
16614         esac
16615 esac
16616 set i_memory
16617 eval $setvar
16618
16619 : can bcopy handle overlapping blocks?
16620 echo " "
16621 val="$undef"
16622 case "$d_memmove" in
16623 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16624 *)      case "$d_bcopy" in
16625         "$define")
16626                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16627                 $cat >try.c <<EOCP
16628 #$i_memory I_MEMORY
16629 #$i_stdlib I_STDLIB
16630 #$i_string I_STRING
16631 #$i_unistd I_UNISTD
16632 EOCP
16633         $cat >>try.c <<'EOCP'
16634 #include <stdio.h>
16635 #ifdef I_MEMORY
16636 #  include <memory.h>
16637 #endif
16638 #ifdef I_STDLIB
16639 #  include <stdlib.h>
16640 #endif
16641 #ifdef I_STRING
16642 #  include <string.h>
16643 #else
16644 #  include <strings.h>
16645 #endif
16646 #ifdef I_UNISTD
16647 #  include <unistd.h>  /* Needed for NetBSD */
16648 #endif
16649 int main()
16650 {
16651 char buf[128], abc[128];
16652 char *b;
16653 int len;
16654 int off;
16655 int align;
16656
16657 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16658    try to store the string in read-only memory. */
16659 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16660
16661 for (align = 7; align >= 0; align--) {
16662         for (len = 36; len; len--) {
16663                 b = buf+align;
16664                 bcopy(abc, b, len);
16665                 for (off = 1; off <= len; off++) {
16666                         bcopy(b, b+off, len);
16667                         bcopy(b+off, b, len);
16668                         if (bcmp(b, abc, len))
16669                                 exit(1);
16670                 }
16671         }
16672 }
16673 exit(0);
16674 }
16675 EOCP
16676                 set try
16677                 if eval $compile_ok; then
16678                         if $run ./try 2>/dev/null; then
16679                                 echo "Yes, it can."
16680                                 val="$define"
16681                         else
16682                                 echo "It can't, sorry."
16683                         fi
16684                 else
16685                         echo "(I can't compile the test program, so we'll assume not...)"
16686                 fi
16687                 ;;
16688         esac
16689         $rm_try
16690         ;;
16691 esac
16692 set d_safebcpy
16693 eval $setvar
16694
16695 : can memcpy handle overlapping blocks?
16696 echo " "
16697 val="$undef"
16698 case "$d_memmove" in
16699 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16700 *)      case "$d_memcpy" in
16701         "$define")
16702                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16703                 $cat >try.c <<EOCP
16704 #$i_memory I_MEMORY
16705 #$i_stdlib I_STDLIB
16706 #$i_string I_STRING
16707 #$i_unistd I_UNISTD
16708 EOCP
16709         $cat >>try.c <<'EOCP'
16710 #include <stdio.h>
16711 #ifdef I_MEMORY
16712 #  include <memory.h>
16713 #endif
16714 #ifdef I_STDLIB
16715 #  include <stdlib.h>
16716 #endif
16717 #ifdef I_STRING
16718 #  include <string.h>
16719 #else
16720 #  include <strings.h>
16721 #endif
16722 #ifdef I_UNISTD
16723 #  include <unistd.h>  /* Needed for NetBSD */
16724 #endif
16725 int main()
16726 {
16727 char buf[128], abc[128];
16728 char *b;
16729 int len;
16730 int off;
16731 int align;
16732
16733 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16734    try to store the string in read-only memory. */
16735 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16736
16737 for (align = 7; align >= 0; align--) {
16738         for (len = 36; len; len--) {
16739                 b = buf+align;
16740                 memcpy(b, abc, len);
16741                 for (off = 1; off <= len; off++) {
16742                         memcpy(b+off, b, len);
16743                         memcpy(b, b+off, len);
16744                         if (memcmp(b, abc, len))
16745                                 exit(1);
16746                 }
16747         }
16748 }
16749 exit(0);
16750 }
16751 EOCP
16752                 set try
16753                 if eval $compile_ok; then
16754                         if $run ./try 2>/dev/null; then
16755                                 echo "Yes, it can."
16756                                 val="$define"
16757                         else
16758                                 echo "It can't, sorry."
16759                         fi
16760                 else
16761                         echo "(I can't compile the test program, so we'll assume not...)"
16762                 fi
16763                 ;;
16764         esac
16765         $rm_try
16766         ;;
16767 esac
16768 set d_safemcpy
16769 eval $setvar
16770
16771 : can memcmp be trusted to compare relative magnitude?
16772 val="$undef"
16773 case "$d_memcmp" in
16774 "$define")
16775         echo " "
16776         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16777         $cat >try.c <<EOCP
16778 #$i_memory I_MEMORY
16779 #$i_stdlib I_STDLIB
16780 #$i_string I_STRING
16781 #$i_unistd I_UNISTD
16782 EOCP
16783         $cat >>try.c <<'EOCP'
16784 #include <stdio.h>
16785 #ifdef I_MEMORY
16786 #  include <memory.h>
16787 #endif
16788 #ifdef I_STDLIB
16789 #  include <stdlib.h>
16790 #endif
16791 #ifdef I_STRING
16792 #  include <string.h>
16793 #else
16794 #  include <strings.h>
16795 #endif
16796 #ifdef I_UNISTD
16797 #  include <unistd.h>  /* Needed for NetBSD */
16798 #endif
16799 int main()
16800 {
16801 char a = -1;
16802 char b = 0;
16803 if ((a < b) && memcmp(&a, &b, 1) < 0)
16804         exit(1);
16805 exit(0);
16806 }
16807 EOCP
16808         set try
16809         if eval $compile_ok; then
16810                 if $run ./try 2>/dev/null; then
16811                         echo "Yes, it can."
16812                         val="$define"
16813                 else
16814                         echo "No, it can't (it uses signed chars)."
16815                 fi
16816         else
16817                 echo "(I can't compile the test program, so we'll assume not...)"
16818         fi
16819         ;;
16820 esac
16821 $rm_try
16822 set d_sanemcmp
16823 eval $setvar
16824
16825 : see if prototype for sbrk is available
16826 echo " "
16827 set d_sbrkproto sbrk $i_unistd unistd.h
16828 eval $hasproto
16829
16830 : see if select exists
16831 set select d_select
16832 eval $inlibc
16833
16834 : see if semctl exists
16835 set semctl d_semctl
16836 eval $inlibc
16837
16838 : see if semget exists
16839 set semget d_semget
16840 eval $inlibc
16841
16842 : see if semop exists
16843 set semop d_semop
16844 eval $inlibc
16845
16846 : see how much of the 'sem*(2)' library is present.
16847 h_sem=true
16848 echo " "
16849 case "$d_semctl$d_semget$d_semop" in
16850 *"$undef"*) h_sem=false;;
16851 esac
16852 case "$osname" in
16853 freebsd)
16854     case "`ipcs 2>&1`" in
16855     "SVID messages"*"not configured"*)
16856         echo "Your $osname does not have the sem*(2) configured." >&4
16857         h_sem=false
16858         val="$undef"
16859         set semctl d_semctl
16860         eval $setvar
16861         set semget d_semget
16862         eval $setvar
16863         set semop d_semop
16864         eval $setvar
16865         ;;
16866     esac
16867     ;;
16868 esac
16869 : we could also check for sys/ipc.h ...
16870 if $h_sem && $test `./findhdr sys/sem.h`; then
16871         echo "You have the full sem*(2) library." >&4
16872         val="$define"
16873 else
16874         echo "You don't have the full sem*(2) library." >&4
16875         val="$undef"
16876 fi
16877 set d_sem
16878 eval $setvar
16879
16880 : see whether sys/sem.h defines union semun
16881 echo " "
16882 $cat > try.c <<'END'
16883 #include <sys/types.h>
16884 #include <sys/ipc.h>
16885 #include <sys/sem.h>
16886 int main () { union semun semun; semun.buf = 0; }
16887 END
16888 set try
16889 if eval $compile; then
16890     echo "You have union semun in <sys/sem.h>." >&4
16891     val="$define"
16892 else
16893     echo "You do not have union semun in <sys/sem.h>." >&4
16894     val="$undef"
16895 fi
16896 $rm_try
16897 set d_union_semun
16898 eval $setvar
16899
16900 : see how to do semctl IPC_STAT
16901 case "$d_sem" in
16902 $define)
16903     echo " "
16904     $cat > tryh.h <<END
16905 #ifndef S_IRUSR
16906 #   ifdef S_IREAD
16907 #       define S_IRUSR S_IREAD
16908 #       define S_IWUSR S_IWRITE
16909 #       define S_IXUSR S_IEXEC
16910 #   else
16911 #       define S_IRUSR 0400
16912 #       define S_IWUSR 0200
16913 #       define S_IXUSR 0100
16914 #   endif
16915 #   define S_IRGRP (S_IRUSR>>3)
16916 #   define S_IWGRP (S_IWUSR>>3)
16917 #   define S_IXGRP (S_IXUSR>>3)
16918 #   define S_IROTH (S_IRUSR>>6)
16919 #   define S_IWOTH (S_IWUSR>>6)
16920 #   define S_IXOTH (S_IXUSR>>6)
16921 #endif
16922 #ifndef S_IRWXU
16923 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16924 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16925 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16926 #endif
16927 END
16928     : see whether semctl IPC_STAT can use union semun
16929     case "$d_semctl_semun" in
16930     '')
16931       val="$undef"
16932       $cat > try.c <<END
16933 #include <sys/types.h>
16934 #include <sys/ipc.h>
16935 #include <sys/sem.h>
16936 #include <sys/stat.h>
16937 #include <stdio.h>
16938 #include <errno.h>
16939 #include "tryh.h"
16940 #ifndef errno
16941 extern int errno;
16942 #endif
16943 #$d_union_semun HAS_UNION_SEMUN
16944 int main() {
16945     union semun
16946 #ifndef HAS_UNION_SEMUN
16947     {
16948         int val;
16949         struct semid_ds *buf;
16950         unsigned short *array;
16951     }
16952 #endif
16953     arg;
16954     int sem, st;
16955
16956 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16957     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16958     if (sem > -1) {
16959         struct semid_ds argbuf;
16960         arg.buf = &argbuf;
16961 #       ifdef IPC_STAT
16962         st = semctl(sem, 0, IPC_STAT, arg);
16963         if (st == 0)
16964             printf("semun\n");
16965         else
16966 #       endif /* IPC_STAT */
16967             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16968 #       ifdef IPC_RMID
16969         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16970 #       endif /* IPC_RMID */
16971             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16972     } else
16973 #endif /* IPC_PRIVATE && ... */
16974         printf("semget failed: errno = %d\n", errno);
16975   return 0;
16976 }
16977 END
16978       set try
16979       if eval $compile; then
16980           xxx=`$run ./try`
16981           case "$xxx" in
16982           semun) val="$define" ;;
16983           esac
16984       fi
16985       $rm_try
16986       set d_semctl_semun
16987       eval $setvar
16988       ;;
16989     esac
16990     case "$d_semctl_semun" in
16991     $define)
16992         echo "You can use union semun for semctl IPC_STAT." >&4
16993         also='also'
16994         ;;
16995     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16996         also=''
16997         ;;
16998     esac
16999
17000     : see whether semctl IPC_STAT can use struct semid_ds pointer
17001     case "$d_semctl_semid_ds" in
17002     '')
17003       val="$undef"
17004       $cat > try.c <<'END'
17005 #include <sys/types.h>
17006 #include <sys/ipc.h>
17007 #include <sys/sem.h>
17008 #include <sys/stat.h>
17009 #include "tryh.h"
17010 #include <stdio.h>
17011 #include <errno.h>
17012 #ifndef errno
17013 extern int errno;
17014 #endif
17015 int main() {
17016     struct semid_ds arg;
17017     int sem, st;
17018
17019 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17020     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17021     if (sem > -1) {
17022 #       ifdef IPC_STAT
17023         st = semctl(sem, 0, IPC_STAT, &arg);
17024         if (st == 0)
17025             printf("semid_ds\n");
17026         else
17027 #       endif /* IPC_STAT */
17028             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17029 #       ifdef IPC_RMID
17030         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17031 #       endif /* IPC_RMID */
17032             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17033     } else
17034 #endif /* IPC_PRIVATE && ... */
17035         printf("semget failed: errno = %d\n", errno);
17036
17037     return 0;
17038 }
17039 END
17040       set try
17041       if eval $compile; then
17042           xxx=`$run ./try`
17043           case "$xxx" in
17044           semid_ds) val="$define" ;;
17045           esac
17046       fi
17047       $rm_try
17048       set d_semctl_semid_ds
17049       eval $setvar
17050       ;;
17051     esac
17052     case "$d_semctl_semid_ds" in
17053     $define)
17054         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17055         ;;
17056     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17057         ;;
17058     esac
17059     ;;
17060 *)  val="$undef"
17061
17062     # We do not have the full sem*(2) library, so assume we can not
17063     # use either.
17064
17065     set d_semctl_semun
17066     eval $setvar
17067
17068     set d_semctl_semid_ds
17069     eval $setvar
17070     ;;
17071 esac
17072 $rm_try tryh.h
17073
17074 : see if sendmsg exists
17075 set sendmsg d_sendmsg
17076 eval $inlibc
17077
17078 : see if setegid exists
17079 set setegid d_setegid
17080 eval $inlibc
17081
17082 : see if seteuid exists
17083 set seteuid d_seteuid
17084 eval $inlibc
17085
17086 : see if setgrent exists
17087 set setgrent d_setgrent
17088 eval $inlibc
17089
17090 : see if setgrent_r exists
17091 set setgrent_r d_setgrent_r
17092 eval $inlibc
17093 case "$d_setgrent_r" in
17094 "$define")
17095         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17096         case "$d_setgrent_r_proto:$usethreads" in
17097         ":define")      d_setgrent_r_proto=define
17098                 set d_setgrent_r_proto setgrent_r $hdrs
17099                 eval $hasproto ;;
17100         *)      ;;
17101         esac
17102         case "$d_setgrent_r_proto" in
17103         define)
17104         case "$setgrent_r_proto" in
17105         ''|0) try='int setgrent_r(FILE**);'
17106         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17107         esac
17108         case "$setgrent_r_proto" in
17109         ''|0) try='void setgrent_r(FILE**);'
17110         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17111         esac
17112         case "$setgrent_r_proto" in
17113         ''|0)   d_setgrent_r=undef
17114                 setgrent_r_proto=0
17115                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17116         * )     case "$setgrent_r_proto" in
17117                 REENTRANT_PROTO*) ;;
17118                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17119                 esac
17120                 echo "Prototype: $try" ;;
17121         esac
17122         ;;
17123         *)      case "$usethreads" in
17124                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17125                 esac
17126                 d_setgrent_r=undef
17127                 setgrent_r_proto=0
17128                 ;;
17129         esac
17130         ;;
17131 *)      setgrent_r_proto=0
17132         ;;
17133 esac
17134
17135 : see if sethostent exists
17136 set sethostent d_sethent
17137 eval $inlibc
17138
17139 : see if sethostent_r exists
17140 set sethostent_r d_sethostent_r
17141 eval $inlibc
17142 case "$d_sethostent_r" in
17143 "$define")
17144         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17145         case "$d_sethostent_r_proto:$usethreads" in
17146         ":define")      d_sethostent_r_proto=define
17147                 set d_sethostent_r_proto sethostent_r $hdrs
17148                 eval $hasproto ;;
17149         *)      ;;
17150         esac
17151         case "$d_sethostent_r_proto" in
17152         define)
17153         case "$sethostent_r_proto" in
17154         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17155         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17156         esac
17157         case "$sethostent_r_proto" in
17158         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17159         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17160         esac
17161         case "$sethostent_r_proto" in
17162         ''|0)   d_sethostent_r=undef
17163                 sethostent_r_proto=0
17164                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17165         * )     case "$sethostent_r_proto" in
17166                 REENTRANT_PROTO*) ;;
17167                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17168                 esac
17169                 echo "Prototype: $try" ;;
17170         esac
17171         ;;
17172         *)      case "$usethreads" in
17173                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17174                 esac
17175                 d_sethostent_r=undef
17176                 sethostent_r_proto=0
17177                 ;;
17178         esac
17179         ;;
17180 *)      sethostent_r_proto=0
17181         ;;
17182 esac
17183
17184 : see if setitimer exists
17185 set setitimer d_setitimer
17186 eval $inlibc
17187
17188 : see if setlinebuf exists
17189 set setlinebuf d_setlinebuf
17190 eval $inlibc
17191
17192 : see if setlocale exists
17193 set setlocale d_setlocale
17194 eval $inlibc
17195
17196 : see if locale.h is available
17197 set locale.h i_locale
17198 eval $inhdr
17199
17200 : see if setlocale_r exists
17201 set setlocale_r d_setlocale_r
17202 eval $inlibc
17203 case "$d_setlocale_r" in
17204 "$define")
17205         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17206         case "$d_setlocale_r_proto:$usethreads" in
17207         ":define")      d_setlocale_r_proto=define
17208                 set d_setlocale_r_proto setlocale_r $hdrs
17209                 eval $hasproto ;;
17210         *)      ;;
17211         esac
17212         case "$d_setlocale_r_proto" in
17213         define)
17214         case "$setlocale_r_proto" in
17215         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17216         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17217         esac
17218         case "$setlocale_r_proto" in
17219         ''|0)   d_setlocale_r=undef
17220                 setlocale_r_proto=0
17221                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17222         * )     case "$setlocale_r_proto" in
17223                 REENTRANT_PROTO*) ;;
17224                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17225                 esac
17226                 echo "Prototype: $try" ;;
17227         esac
17228         ;;
17229         *)      case "$usethreads" in
17230                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17231                 esac
17232                 d_setlocale_r=undef
17233                 setlocale_r_proto=0
17234                 ;;
17235         esac
17236         ;;
17237 *)      setlocale_r_proto=0
17238         ;;
17239 esac
17240
17241 : see if setnetent exists
17242 set setnetent d_setnent
17243 eval $inlibc
17244
17245 : see if setnetent_r exists
17246 set setnetent_r d_setnetent_r
17247 eval $inlibc
17248 case "$d_setnetent_r" in
17249 "$define")
17250         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17251         case "$d_setnetent_r_proto:$usethreads" in
17252         ":define")      d_setnetent_r_proto=define
17253                 set d_setnetent_r_proto setnetent_r $hdrs
17254                 eval $hasproto ;;
17255         *)      ;;
17256         esac
17257         case "$d_setnetent_r_proto" in
17258         define)
17259         case "$setnetent_r_proto" in
17260         ''|0) try='int setnetent_r(int, struct netent_data*);'
17261         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17262         esac
17263         case "$setnetent_r_proto" in
17264         ''|0) try='void setnetent_r(int, struct netent_data*);'
17265         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17266         esac
17267         case "$setnetent_r_proto" in
17268         ''|0)   d_setnetent_r=undef
17269                 setnetent_r_proto=0
17270                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17271         * )     case "$setnetent_r_proto" in
17272                 REENTRANT_PROTO*) ;;
17273                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17274                 esac
17275                 echo "Prototype: $try" ;;
17276         esac
17277         ;;
17278         *)      case "$usethreads" in
17279                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17280                 esac
17281                 d_setnetent_r=undef
17282                 setnetent_r_proto=0
17283                 ;;
17284         esac
17285         ;;
17286 *)      setnetent_r_proto=0
17287         ;;
17288 esac
17289
17290 : see if setprotoent exists
17291 set setprotoent d_setpent
17292 eval $inlibc
17293
17294 : see if setpgid exists
17295 set setpgid d_setpgid
17296 eval $inlibc
17297
17298 : see if setpgrp2 exists
17299 set setpgrp2 d_setpgrp2
17300 eval $inlibc
17301
17302 : see if setpriority exists
17303 set setpriority d_setprior
17304 eval $inlibc
17305
17306 : see if setproctitle exists
17307 set setproctitle d_setproctitle
17308 eval $inlibc
17309
17310 : see if setprotoent_r exists
17311 set setprotoent_r d_setprotoent_r
17312 eval $inlibc
17313 case "$d_setprotoent_r" in
17314 "$define")
17315         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17316         case "$d_setprotoent_r_proto:$usethreads" in
17317         ":define")      d_setprotoent_r_proto=define
17318                 set d_setprotoent_r_proto setprotoent_r $hdrs
17319                 eval $hasproto ;;
17320         *)      ;;
17321         esac
17322         case "$d_setprotoent_r_proto" in
17323         define)
17324         case "$setprotoent_r_proto" in
17325         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17326         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17327         esac
17328         case "$setprotoent_r_proto" in
17329         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17330         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17331         esac
17332         case "$setprotoent_r_proto" in
17333         ''|0)   d_setprotoent_r=undef
17334                 setprotoent_r_proto=0
17335                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17336         * )     case "$setprotoent_r_proto" in
17337                 REENTRANT_PROTO*) ;;
17338                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17339                 esac
17340                 echo "Prototype: $try" ;;
17341         esac
17342         ;;
17343         *)      case "$usethreads" in
17344                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17345                 esac
17346                 d_setprotoent_r=undef
17347                 setprotoent_r_proto=0
17348                 ;;
17349         esac
17350         ;;
17351 *)      setprotoent_r_proto=0
17352         ;;
17353 esac
17354
17355 : see if setpwent exists
17356 set setpwent d_setpwent
17357 eval $inlibc
17358
17359 : see if setpwent_r exists
17360 set setpwent_r d_setpwent_r
17361 eval $inlibc
17362 case "$d_setpwent_r" in
17363 "$define")
17364         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17365         case "$d_setpwent_r_proto:$usethreads" in
17366         ":define")      d_setpwent_r_proto=define
17367                 set d_setpwent_r_proto setpwent_r $hdrs
17368                 eval $hasproto ;;
17369         *)      ;;
17370         esac
17371         case "$d_setpwent_r_proto" in
17372         define)
17373         case "$setpwent_r_proto" in
17374         ''|0) try='int setpwent_r(FILE**);'
17375         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17376         esac
17377         case "$setpwent_r_proto" in
17378         ''|0) try='void setpwent_r(FILE**);'
17379         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17380         esac
17381         case "$setpwent_r_proto" in
17382         ''|0)   d_setpwent_r=undef
17383                 setpwent_r_proto=0
17384                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17385         * )     case "$setpwent_r_proto" in
17386                 REENTRANT_PROTO*) ;;
17387                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17388                 esac
17389                 echo "Prototype: $try" ;;
17390         esac
17391         ;;
17392         *)      case "$usethreads" in
17393                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17394                 esac
17395                 d_setpwent_r=undef
17396                 setpwent_r_proto=0
17397                 ;;
17398         esac
17399         ;;
17400 *)      setpwent_r_proto=0
17401         ;;
17402 esac
17403
17404 : see if setregid exists
17405 set setregid d_setregid
17406 eval $inlibc
17407 set setresgid d_setresgid
17408 eval $inlibc
17409
17410 : see if setreuid exists
17411 set setreuid d_setreuid
17412 eval $inlibc
17413 set setresuid d_setresuid
17414 eval $inlibc
17415
17416 : see if setrgid exists
17417 set setrgid d_setrgid
17418 eval $inlibc
17419
17420 : see if setruid exists
17421 set setruid d_setruid
17422 eval $inlibc
17423
17424 : see if setservent exists
17425 set setservent d_setsent
17426 eval $inlibc
17427
17428 : see if setservent_r exists
17429 set setservent_r d_setservent_r
17430 eval $inlibc
17431 case "$d_setservent_r" in
17432 "$define")
17433         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17434         case "$d_setservent_r_proto:$usethreads" in
17435         ":define")      d_setservent_r_proto=define
17436                 set d_setservent_r_proto setservent_r $hdrs
17437                 eval $hasproto ;;
17438         *)      ;;
17439         esac
17440         case "$d_setservent_r_proto" in
17441         define)
17442         case "$setservent_r_proto" in
17443         ''|0) try='int setservent_r(int, struct servent_data*);'
17444         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17445         esac
17446         case "$setservent_r_proto" in
17447         ''|0) try='void setservent_r(int, struct servent_data*);'
17448         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17449         esac
17450         case "$setservent_r_proto" in
17451         ''|0)   d_setservent_r=undef
17452                 setservent_r_proto=0
17453                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17454         * )     case "$setservent_r_proto" in
17455                 REENTRANT_PROTO*) ;;
17456                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17457                 esac
17458                 echo "Prototype: $try" ;;
17459         esac
17460         ;;
17461         *)      case "$usethreads" in
17462                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17463                 esac
17464                 d_setservent_r=undef
17465                 setservent_r_proto=0
17466                 ;;
17467         esac
17468         ;;
17469 *)      setservent_r_proto=0
17470         ;;
17471 esac
17472
17473 : see if setsid exists
17474 set setsid d_setsid
17475 eval $inlibc
17476
17477 : see if setvbuf exists
17478 set setvbuf d_setvbuf
17479 eval $inlibc
17480
17481 : see if sfio.h is available
17482 set sfio.h i_sfio
17483 eval $inhdr
17484
17485 : see if sfio library is available
17486 case "$i_sfio" in
17487 $define)
17488         val=''
17489         set sfreserve val
17490         eval $inlibc
17491         ;;
17492 *)
17493         val="$undef"
17494         ;;
17495 esac
17496 : Ok, but do we want to use it.
17497 case "$val" in
17498 $define)
17499         case "$usesfio" in
17500         true|$define|[yY]*) dflt='y';;
17501         *) dflt='n';;
17502         esac
17503         echo "$package can use the sfio library, but it is experimental."
17504         rp="You seem to have sfio available, do you want to try using it?"
17505         . ./myread
17506         case "$ans" in
17507         y|Y)    echo "Ok, turning on sfio then."
17508                 val="$define"
17509                 ;;
17510         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17511                 val="$undef"
17512                 ;;
17513         esac
17514         ;;
17515 *)      case "$usesfio" in
17516         true|$define|[yY]*)
17517                 echo "Sorry, cannot find sfio on this machine." >&4
17518                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17519                 val="$undef"
17520                 ;;
17521         esac
17522         ;;
17523 esac
17524 set d_sfio
17525 eval $setvar
17526 case "$d_sfio" in
17527 $define) usesfio='true';;
17528 *) usesfio='false';;
17529 esac
17530 case "$d_sfio" in
17531 $define) ;;
17532 *)      : Remove sfio from list of libraries to use
17533         case "$libs" in
17534         *-lsfio*)
17535                 echo "Removing unneeded -lsfio from library list" >&4
17536                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17537                 shift
17538                 libs="$*"
17539                 echo "libs = $libs" >&4
17540                 ;;
17541         esac
17542 ;;
17543 esac
17544
17545
17546 : see if shmctl exists
17547 set shmctl d_shmctl
17548 eval $inlibc
17549
17550 : see if shmget exists
17551 set shmget d_shmget
17552 eval $inlibc
17553
17554 : see if shmat exists
17555 set shmat d_shmat
17556 eval $inlibc
17557 : see what shmat returns
17558 case "$d_shmat" in
17559 "$define")
17560         $cat >shmat.c <<'END'
17561 #include <sys/shm.h>
17562 void *shmat();
17563 END
17564         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17565                 shmattype='void *'
17566         else
17567                 shmattype='char *'
17568         fi
17569         echo "and it returns ($shmattype)." >&4
17570         : see if a prototype for shmat is available
17571         xxx=`./findhdr sys/shm.h`
17572         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17573         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17574                 val="$define"
17575         else
17576                 val="$undef"
17577         fi
17578         $rm -f shmat.[co]
17579         ;;
17580 *)
17581         val="$undef"
17582         ;;
17583 esac
17584 set d_shmatprototype
17585 eval $setvar
17586
17587 : see if shmdt exists
17588 set shmdt d_shmdt
17589 eval $inlibc
17590
17591 : see how much of the 'shm*(2)' library is present.
17592 h_shm=true
17593 echo " "
17594 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17595 *"$undef"*) h_shm=false;;
17596 esac
17597 case "$osname" in
17598 freebsd)
17599     case "`ipcs 2>&1`" in
17600     "SVID shared memory"*"not configured"*)
17601         echo "Your $osname does not have the shm*(2) configured." >&4
17602         h_shm=false
17603         val="$undef"
17604         set shmctl d_shmctl
17605         evat $setvar
17606         set shmget d_shmget
17607         evat $setvar
17608         set shmat d_shmat
17609         evat $setvar
17610         set shmdt d_shmdt
17611         evat $setvar
17612         ;;
17613     esac
17614     ;;
17615 esac
17616 : we could also check for sys/ipc.h ...
17617 if $h_shm && $test `./findhdr sys/shm.h`; then
17618         echo "You have the full shm*(2) library." >&4
17619         val="$define"
17620 else
17621         echo "You don't have the full shm*(2) library." >&4
17622         val="$undef"
17623 fi
17624 set d_shm
17625 eval $setvar
17626
17627 : see if we have sigaction
17628 echo " "
17629 if set sigaction val -f d_sigaction; eval $csym; $val; then
17630         echo 'sigaction() found.' >&4
17631         $cat > try.c <<EOP
17632 #include <stdio.h>
17633 #include <sys/types.h>
17634 #include <signal.h>
17635 #$i_stdlib I_STDLIB
17636 #ifdef I_STDLIB
17637 #include <stdlib.h>
17638 #endif
17639 int main()
17640 {
17641     struct sigaction act, oact;
17642     act.sa_flags = 0;
17643     oact.sa_handler = 0;
17644     /* so that act and oact are used */
17645     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17646 }
17647 EOP
17648         set try
17649         if eval $compile_ok; then
17650                 val="$define"
17651         else
17652                 echo "But you don't seem to have a usable struct sigaction." >&4
17653                 val="$undef"
17654         fi
17655 else
17656         echo 'sigaction NOT found.' >&4
17657         val="$undef"
17658 fi
17659 set d_sigaction; eval $setvar
17660 $rm_try
17661
17662 : see if this is a sunmath.h system
17663 set sunmath.h i_sunmath
17664 eval $inhdr
17665
17666 : see if signbit exists
17667 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17668 $cat >try.c <<EOCP
17669 #$i_math I_MATH
17670 #$i_sunmath I_SUNMATH
17671 #ifdef I_MATH
17672 #  include <math.h>
17673 #endif
17674 #ifdef I_SUNMATH  /* Solaris special math library */
17675 #  include <sunmath.h>
17676 #endif
17677 #define NV $nvtype
17678 int main(int argc, char **argv)
17679 {
17680     NV x = 0.0;
17681     NV y = -0.0;
17682     if ((signbit(x) == 0) && (signbit(y) != 0))
17683         return 0;
17684     else
17685         return 1;
17686 }
17687 EOCP
17688 val="$undef"
17689 set try
17690 if eval $compile; then
17691     if $run ./try; then
17692         $echo "Yes." >&4
17693         val="$define"
17694     else
17695         $echo "Signbit seems to be available, but doesn't work as I expected."
17696         $echo "I won't use it." >&4
17697         val="$undef"
17698     fi
17699 else
17700     $echo "Nope." >&4
17701     dflt="$undef"
17702 fi
17703 set d_signbit
17704 eval $setvar
17705 $rm_try
17706
17707 : see if sigprocmask exists
17708 set sigprocmask d_sigprocmask
17709 eval $inlibc
17710
17711 : see if sigsetjmp exists
17712 echo " "
17713 case "$d_sigsetjmp" in
17714 '')
17715         $cat >try.c <<EOP
17716 #include <setjmp.h>
17717 #$i_stdlib I_STDLIB
17718 #ifdef I_STDLIB
17719 #include <stdlib.h>
17720 #endif
17721 sigjmp_buf env;
17722 int set = 1;
17723 int main()
17724 {
17725         if (sigsetjmp(env,1))
17726                 exit(set);
17727         set = 0;
17728         siglongjmp(env, 1);
17729         exit(1);
17730 }
17731 EOP
17732         set try
17733         if eval $compile; then
17734                 if $run ./try >/dev/null 2>&1; then
17735                         echo "POSIX sigsetjmp found." >&4
17736                         val="$define"
17737                 else
17738                         $cat >&4 <<EOM
17739 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17740 I'll ignore them.
17741 EOM
17742                         val="$undef"
17743                 fi
17744         else
17745                 echo "sigsetjmp not found." >&4
17746                 val="$undef"
17747         fi
17748         ;;
17749 *) val="$d_sigsetjmp"
17750         case "$d_sigsetjmp" in
17751         $define) echo "POSIX sigsetjmp found." >&4;;
17752         $undef) echo "sigsetjmp not found." >&4;;
17753         esac
17754         ;;
17755 esac
17756 set d_sigsetjmp
17757 eval $setvar
17758 $rm_try
17759
17760 : see if snprintf exists
17761 set snprintf d_snprintf
17762 eval $inlibc
17763
17764 : see if vsnprintf exists
17765 set vsnprintf d_vsnprintf
17766 eval $inlibc
17767
17768 case "$d_snprintf-$d_vsnprintf" in
17769 "$define-$define")
17770     $cat <<EOM
17771 Checking whether your snprintf() and vsnprintf() work okay...
17772 EOM
17773     $cat >try.c <<'EOCP'
17774 /* v?snprintf testing logic courtesy of Russ Allbery.
17775  * According to C99:
17776  * - if the buffer is too short it still must be \0-terminated
17777  * - if the buffer is too short the potentially required length
17778  *   must be returned and not -1
17779  * - if the buffer is NULL the potentially required length
17780  *   must be returned and not -1 or core dump
17781  */
17782 #include <stdio.h>
17783 #include <stdarg.h>
17784
17785 char buf[2];
17786
17787 int test (char *format, ...)
17788 {
17789     va_list args;
17790     int count;
17791
17792     va_start (args, format);
17793     count = vsnprintf (buf, sizeof buf, format, args);
17794     va_end (args);
17795     return count;
17796 }
17797
17798 int main ()
17799 {
17800     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17801              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17802 }
17803 EOCP
17804     set try
17805     if eval $compile; then
17806         `$run ./try`
17807         case "$?" in
17808         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17809         *) cat <<EOM >&4
17810 Your snprintf() and snprintf() don't seem to be working okay.
17811 EOM
17812            d_snprintf="$undef"
17813            d_vsnprintf="$undef"
17814            ;;
17815         esac
17816     else
17817         echo "(I can't seem to compile the test program--assuming they don't)"
17818         d_snprintf="$undef"
17819         d_vsnprintf="$undef"
17820     fi
17821     $rm_try
17822     ;;
17823 esac
17824
17825 : see if sockatmark exists
17826 set sockatmark d_sockatmark
17827 eval $inlibc
17828
17829 : see if prototype for sockatmark is available
17830 echo " "
17831 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17832 eval $hasproto
17833
17834 : see if socks5_init exists
17835 set socks5_init d_socks5_init
17836 eval $inlibc
17837
17838 : see if sprintf returns the length of the string in the buffer as per ANSI
17839 $echo "Checking whether sprintf returns the length of the string..." >&4
17840 $cat <<EOP >try.c
17841 #include <stdio.h>
17842 #$i_stdlib I_STDLIB
17843 #ifdef I_STDLIB
17844 #include <stdlib.h>
17845 #endif
17846 #$i_string I_STRING
17847 #ifdef I_STRING
17848 #  include <string.h>
17849 #else
17850 #  include <strings.h>
17851 #endif
17852 #$i_math I_MATH
17853 #ifdef I_MATH
17854 #include <math.h>
17855 #endif
17856
17857 char buffer[256];
17858
17859 int check (size_t expect, int test) {
17860   size_t got = strlen(buffer);
17861   if (expect == got)
17862     return 0;
17863
17864   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17865        test, buffer);
17866   exit (test);
17867 }
17868
17869 int main(int argc, char **argv) {
17870   int test = 0;
17871
17872   check(sprintf(buffer, ""), ++test);
17873   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17874   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17875
17876   return 0;
17877 }
17878 EOP
17879 set try
17880
17881 if eval $compile; then
17882     xxx="`$run ./try`"
17883     case "$?" in
17884         0) cat >&4 <<EOM
17885 sprintf returns the length of the string (as ANSI says it should)
17886 EOM
17887         d_sprintf_returns_strlen="$define"
17888         ;;
17889         *) cat >&4 <<EOM
17890 sprintf does not return the length of the string (how old is this system?)
17891 EOM
17892         d_sprintf_returns_strlen="$undef"
17893         ;;
17894     esac
17895 else
17896     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17897     d_sprintf_returns_strlen="$undef"
17898 fi
17899 $rm_try
17900
17901 : see if srand48_r exists
17902 set srand48_r d_srand48_r
17903 eval $inlibc
17904 case "$d_srand48_r" in
17905 "$define")
17906         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17907         case "$d_srand48_r_proto:$usethreads" in
17908         ":define")      d_srand48_r_proto=define
17909                 set d_srand48_r_proto srand48_r $hdrs
17910                 eval $hasproto ;;
17911         *)      ;;
17912         esac
17913         case "$d_srand48_r_proto" in
17914         define)
17915         case "$srand48_r_proto" in
17916         ''|0) try='int srand48_r(long, struct drand48_data*);'
17917         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17918         esac
17919         case "$srand48_r_proto" in
17920         ''|0)   d_srand48_r=undef
17921                 srand48_r_proto=0
17922                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17923         * )     case "$srand48_r_proto" in
17924                 REENTRANT_PROTO*) ;;
17925                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17926                 esac
17927                 echo "Prototype: $try" ;;
17928         esac
17929         ;;
17930         *)      case "$usethreads" in
17931                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17932                 esac
17933                 d_srand48_r=undef
17934                 srand48_r_proto=0
17935                 ;;
17936         esac
17937         ;;
17938 *)      srand48_r_proto=0
17939         ;;
17940 esac
17941
17942 : see if srandom_r exists
17943 set srandom_r d_srandom_r
17944 eval $inlibc
17945 case "$d_srandom_r" in
17946 "$define")
17947         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17948         case "$d_srandom_r_proto:$usethreads" in
17949         ":define")      d_srandom_r_proto=define
17950                 set d_srandom_r_proto srandom_r $hdrs
17951                 eval $hasproto ;;
17952         *)      ;;
17953         esac
17954         case "$d_srandom_r_proto" in
17955         define)
17956         case "$srandom_r_proto" in
17957         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17958         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17959         esac
17960         case "$srandom_r_proto" in
17961         ''|0)   d_srandom_r=undef
17962                 srandom_r_proto=0
17963                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17964         * )     case "$srandom_r_proto" in
17965                 REENTRANT_PROTO*) ;;
17966                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17967                 esac
17968                 echo "Prototype: $try" ;;
17969         esac
17970         ;;
17971         *)      case "$usethreads" in
17972                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17973                 esac
17974                 d_srandom_r=undef
17975                 srandom_r_proto=0
17976                 ;;
17977         esac
17978         ;;
17979 *)      srandom_r_proto=0
17980         ;;
17981 esac
17982
17983 : see if prototype for setresgid is available
17984 echo " "
17985 set d_sresgproto setresgid $i_unistd unistd.h
17986 eval $hasproto
17987
17988 : see if prototype for setresuid is available
17989 echo " "
17990 set d_sresuproto setresuid $i_unistd unistd.h
17991 eval $hasproto
17992
17993 : see if sys/stat.h is available
17994 set sys/stat.h i_sysstat
17995 eval $inhdr
17996
17997 : see if stat knows about block sizes
17998 echo " "
17999 echo "Checking to see if your struct stat has st_blocks field..." >&4
18000 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18001 eval $hasfield
18002
18003 : see if this is a sys/vfs.h system
18004 set sys/vfs.h i_sysvfs
18005 eval $inhdr
18006
18007 : see if this is a sys/statfs.h system
18008 set sys/statfs.h i_sysstatfs
18009 eval $inhdr
18010
18011 : Check for statfs_s
18012 echo " "
18013 echo "Checking to see if your system supports struct statfs..." >&4
18014 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
18015 eval $hasstruct
18016 case "$d_statfs_s" in
18017 "$define")      echo "Yes, it does."   ;;
18018 *)              echo "No, it doesn't." ;;
18019 esac
18020
18021
18022 : see if struct statfs knows about f_flags
18023 case "$d_statfs_s" in
18024 define)
18025         echo " "
18026         echo "Checking to see if your struct statfs has f_flags field..." >&4
18027         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
18028         eval $hasfield
18029         ;;
18030 *)      val="$undef"
18031         set d_statfs_f_flags
18032         eval $setvar
18033         ;;
18034 esac
18035 case "$d_statfs_f_flags" in
18036 "$define")      echo "Yes, it does."   ;;
18037 *)              echo "No, it doesn't." ;;
18038 esac
18039
18040 : see what flavor, if any, of static inline is supported
18041 echo " "
18042 echo "Checking to see if your system supports static inline..."
18043 $cat > try.c <<'EOCP'
18044 #include <stdlib.h>
18045 extern int f_via_a(int x);
18046 extern int f_via_b(int x);
18047 int main(int argc, char **argv)
18048 {
18049     int y;
18050
18051     y = f_via_a(0);
18052 #ifdef USE_B
18053     y = f_via_b(0);
18054 #endif
18055     if (y == 42) {
18056         return EXIT_SUCCESS;
18057     }
18058     else {
18059         return EXIT_FAILURE;
18060     }
18061 }
18062 EOCP
18063 $cat > a.c <<'EOCP'
18064 static INLINE int f(int x) {
18065     int y;
18066     y = x + 42;
18067     return y;
18068 }
18069
18070 int f_via_a(int x)
18071 {
18072     return f(x);
18073 }
18074 EOCP
18075 $cat > b.c <<'EOCP'
18076 extern int f(int x);
18077
18078 int f_via_b(int x)
18079 {
18080     return f(x);
18081 }
18082 EOCP
18083
18084 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18085 case "$perl_static_inline" in
18086 '')     # Check the various possibilities, and break out on success.
18087         # For gcc, prefer __inline__, which will still permit
18088         # cflags.SH to add in -ansi.
18089         case "$gccversion" in
18090                 '') xxx="inline __inline__ __inline _inline";;
18091                 *)  xxx="__inline__ inline __inline _inline";;
18092         esac
18093         for inline in $xxx; do
18094                 set try -DINLINE=$inline a.c
18095                 if eval $compile && $run ./try; then
18096                         # Now make sure there is no external linkage of static
18097                         # functions
18098                         set try -DINLINE=$inline -DUSE_B a.c b.c
18099                         if eval $compile && $run ./try; then
18100                                 $echo "Your compiler supports static $inline, " >&4
18101                                 $echo "but it also creates an external definition," >&4
18102                                 $echo "so I won't use it." >&4
18103                                 val=$undef
18104                         else
18105                                 $echo "Your compiler supports static $inline." >&4
18106                                 val=$define
18107                                 perl_static_inline="static $inline";
18108                                 break;
18109                         fi
18110                 else
18111                         $echo "Your compiler does NOT support static $inline." >&4
18112                         val="$undef"
18113                 fi
18114         done
18115         ;;
18116 *inline*) # Some variant of inline exists.
18117         echo "Keeping your $hint value of $perl_static_inline."
18118         val=$define
18119         ;;
18120 static)  # No inline capabilities
18121         echo "Keeping your $hint value of $perl_static_inline."
18122         val=$undef
18123         ;;
18124 *)  # Unrecognized previous value -- blindly trust the supplied
18125         # value and hope it makes sense.  Use old value for
18126         # d_static_inline, if there is one.
18127         echo "Keeping your $hint value of $perl_static_inline."
18128         case "$d_static_inline" in
18129                 '') val=$define ;;
18130                 *)  val=$d_static_inline ;;
18131         esac
18132         ;;
18133 esac
18134 # Fallback to plain 'static' if nothing worked.
18135 case "$perl_static_inline" in
18136 '')
18137         perl_static_inline="static"
18138         val=$undef
18139         ;;
18140 esac
18141 set d_static_inline
18142 eval $setvar
18143 $rm -f a.[co] b.[co]
18144 $rm_try
18145
18146 : Check stream access
18147 $cat >&4 <<EOM
18148 Checking how to access stdio streams by file descriptor number...
18149 EOM
18150 case "$stdio_stream_array" in
18151 '')     $cat >try.c <<EOCP
18152 #include <stdio.h>
18153 int main() {
18154   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18155     printf("yes\n");
18156 }
18157 EOCP
18158         for s in _iob __iob __sF
18159         do
18160                 set try -DSTDIO_STREAM_ARRAY=$s
18161                 if eval $compile; then
18162                         case "`$run ./try`" in
18163                         yes)    stdio_stream_array=$s; break ;;
18164                         esac
18165                 fi
18166         done
18167         $rm_try
18168 esac
18169 case "$stdio_stream_array" in
18170 '')     $cat >&4 <<EOM
18171 I can't figure out how to access stdio streams by file descriptor number.
18172 EOM
18173         d_stdio_stream_array="$undef"
18174         ;;
18175 *)      $cat >&4 <<EOM
18176 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18177 EOM
18178         d_stdio_stream_array="$define"
18179         ;;
18180 esac
18181
18182 : see if strcoll exists
18183 set strcoll d_strcoll
18184 eval $inlibc
18185
18186 : check for structure copying
18187 echo " "
18188 echo "Checking to see if your C compiler can copy structs..." >&4
18189 $cat >try.c <<'EOCP'
18190 int main()
18191 {
18192         struct blurfl {
18193                 int dyick;
18194         } foo, bar;
18195
18196         foo = bar;
18197 }
18198 EOCP
18199 if $cc -c try.c >/dev/null 2>&1 ; then
18200         val="$define"
18201         echo "Yup, it can."
18202 else
18203         val="$undef"
18204         echo "Nope, it can't."
18205 fi
18206 set d_strctcpy
18207 eval $setvar
18208 $rm_try
18209
18210 : see if strerror and/or sys_errlist[] exist
18211 echo " "
18212 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18213     if set strerror val -f d_strerror; eval $csym; $val; then
18214                 echo 'strerror() found.' >&4
18215                 d_strerror="$define"
18216                 d_strerrm='strerror(e)'
18217                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18218                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18219                         d_syserrlst="$define"
18220                 else
18221                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18222                         d_syserrlst="$undef"
18223                 fi
18224     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18225                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18226                 echo 'strerror() found in string header.' >&4
18227                 d_strerror="$define"
18228                 d_strerrm='strerror(e)'
18229                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18230                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18231                                 d_syserrlst="$define"
18232                 else
18233                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18234                         d_syserrlst="$undef"
18235                 fi
18236     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18237                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18238                 d_strerror="$undef"
18239                 d_syserrlst="$define"
18240                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18241     else
18242                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18243                 d_strerror="$undef"
18244                 d_syserrlst="$undef"
18245                 d_strerrm='"unknown"'
18246     fi
18247 fi
18248
18249 : see if strerror_r exists
18250 set strerror_r d_strerror_r
18251 eval $inlibc
18252 case "$d_strerror_r" in
18253 "$define")
18254         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18255         case "$d_strerror_r_proto:$usethreads" in
18256         ":define")      d_strerror_r_proto=define
18257                 set d_strerror_r_proto strerror_r $hdrs
18258                 eval $hasproto ;;
18259         *)      ;;
18260         esac
18261         case "$d_strerror_r_proto" in
18262         define)
18263         case "$strerror_r_proto" in
18264         ''|0) try='int strerror_r(int, char*, size_t);'
18265         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18266         esac
18267         case "$strerror_r_proto" in
18268         ''|0) try='int strerror_r(int, char*, int);'
18269         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18270         esac
18271         case "$strerror_r_proto" in
18272         ''|0) try='char* strerror_r(int, char*, size_t);'
18273         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18274         esac
18275         case "$strerror_r_proto" in
18276         ''|0)   d_strerror_r=undef
18277                 strerror_r_proto=0
18278                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18279         * )     case "$strerror_r_proto" in
18280                 REENTRANT_PROTO*) ;;
18281                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18282                 esac
18283                 echo "Prototype: $try" ;;
18284         esac
18285         ;;
18286         *)      case "$usethreads" in
18287                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18288                 esac
18289                 d_strerror_r=undef
18290                 strerror_r_proto=0
18291                 ;;
18292         esac
18293         ;;
18294 *)      strerror_r_proto=0
18295         ;;
18296 esac
18297
18298 : see if strftime exists
18299 set strftime d_strftime
18300 eval $inlibc
18301
18302 : see if strlcat exists
18303 set strlcat d_strlcat
18304 eval $inlibc
18305
18306 : see if strlcpy exists
18307 set strlcpy d_strlcpy
18308 eval $inlibc
18309
18310 : see if strtod exists
18311 set strtod d_strtod
18312 eval $inlibc
18313
18314 : see if strtol exists
18315 set strtol d_strtol
18316 eval $inlibc
18317
18318 : see if strtold exists
18319 set strtold d_strtold
18320 eval $inlibc
18321
18322 : see if strtoll exists
18323 set strtoll d_strtoll
18324 eval $inlibc
18325
18326 case "$d_longlong-$d_strtoll" in
18327 "$define-$define")
18328         $cat <<EOM
18329 Checking whether your strtoll() works okay...
18330 EOM
18331         $cat >try.c <<'EOCP'
18332 #include <errno.h>
18333 #ifdef __hpux
18334 #define strtoll __strtoll
18335 #endif
18336 #ifdef __EMX__
18337 #define strtoll _strtoll
18338 #endif
18339 #include <stdio.h>
18340 extern long long int strtoll(char *s, char **, int);
18341 static int bad = 0;
18342 int check(char *s, long long ell, int een) {
18343         long long gll;
18344         errno = 0;
18345         gll = strtoll(s, 0, 10);
18346         if (!((gll == ell) && (errno == een)))
18347                 bad++;
18348 }
18349 int main() {
18350         check(" 1",                                      1LL, 0);
18351         check(" 0",                                      0LL, 0);
18352         check("-1",                                     -1LL, 0);
18353         check("-9223372036854775808", -9223372036854775808LL, 0);
18354         check("-9223372036854775808", -9223372036854775808LL, 0);
18355         check(" 9223372036854775807",  9223372036854775807LL, 0);
18356         check("-9223372036854775808", -9223372036854775808LL, 0);
18357         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18358         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18359         if (!bad)
18360                 printf("ok\n");
18361 }
18362 EOCP
18363         set try
18364         if eval $compile; then
18365                 yyy=`$run ./try`
18366                 case "$yyy" in
18367                 ok) echo "Your strtoll() seems to be working okay." ;;
18368                 *) cat <<EOM >&4
18369 Your strtoll() doesn't seem to be working okay.
18370 EOM
18371                    d_strtoll="$undef"
18372                    ;;
18373                 esac
18374         else
18375                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18376                 d_strtoll="$undef"
18377         fi
18378         ;;
18379 esac
18380
18381 : see if strtoq exists
18382 set strtoq d_strtoq
18383 eval $inlibc
18384
18385 : see if strtoul exists
18386 set strtoul d_strtoul
18387 eval $inlibc
18388
18389 case "$d_strtoul" in
18390 "$define")
18391         $cat <<EOM
18392 Checking whether your strtoul() works okay...
18393 EOM
18394         $cat >try.c <<'EOCP'
18395 #include <errno.h>
18396 #include <stdio.h>
18397 extern unsigned long int strtoul(char *s, char **, int);
18398 static int bad = 0;
18399 void check(char *s, unsigned long eul, int een) {
18400         unsigned long gul;
18401         errno = 0;
18402         gul = strtoul(s, 0, 10);
18403         if (!((gul == eul) && (errno == een)))
18404                 bad++;
18405 }
18406 int main() {
18407         check(" 1", 1L, 0);
18408         check(" 0", 0L, 0);
18409 EOCP
18410         case "$longsize" in
18411         8)
18412             $cat >>try.c <<'EOCP'
18413         check("18446744073709551615", 18446744073709551615UL, 0);
18414         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18415 #if 0 /* strtoul() for /^-/ strings is undefined. */
18416         check("-1", 18446744073709551615UL, 0);
18417         check("-18446744073709551614", 2, 0);
18418         check("-18446744073709551615", 1, 0);
18419         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18420         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18421 #endif
18422 EOCP
18423                 ;;
18424         4)
18425                     $cat >>try.c <<'EOCP'
18426         check("4294967295", 4294967295UL, 0);
18427         check("4294967296", 4294967295UL, ERANGE);
18428 #if 0 /* strtoul() for /^-/ strings is undefined. */
18429         check("-1", 4294967295UL, 0);
18430         check("-4294967294", 2, 0);
18431         check("-4294967295", 1, 0);
18432         check("-4294967296", 4294967295UL, ERANGE);
18433         check("-4294967297", 4294967295UL, ERANGE);
18434 #endif
18435 EOCP
18436                 ;;
18437         *)
18438 : Should we write these tests to be more portable by sprintf-ing
18439 : ~0 and then manipulating that char string as input for strtol?
18440                 ;;
18441         esac
18442         $cat >>try.c <<'EOCP'
18443         if (!bad)
18444                 printf("ok\n");
18445         return 0;
18446 }
18447 EOCP
18448         set try
18449         if eval $compile; then
18450                 case "`$run ./try`" in
18451                 ok) echo "Your strtoul() seems to be working okay." ;;
18452                 *) cat <<EOM >&4
18453 Your strtoul() doesn't seem to be working okay.
18454 EOM
18455                    d_strtoul="$undef"
18456                    ;;
18457                 esac
18458         else
18459                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18460                 d_strtoul="$undef"
18461         fi
18462         ;;
18463 esac
18464
18465 : see if strtoull exists
18466 set strtoull d_strtoull
18467 eval $inlibc
18468
18469 case "$d_longlong-$d_strtoull" in
18470 "$define-$define")
18471         $cat <<EOM
18472 Checking whether your strtoull() works okay...
18473 EOM
18474         $cat >try.c <<'EOCP'
18475 #include <errno.h>
18476 #ifdef __hpux
18477 #define strtoull __strtoull
18478 #endif
18479 #include <stdio.h>
18480 extern unsigned long long int strtoull(char *s, char **, int);
18481 static int bad = 0;
18482 int check(char *s, long long eull, int een) {
18483         long long gull;
18484         errno = 0;
18485         gull = strtoull(s, 0, 10);
18486         if (!((gull == eull) && (errno == een)))
18487                 bad++;
18488 }
18489 int main() {
18490         check(" 1",                                        1LL, 0);
18491         check(" 0",                                        0LL, 0);
18492         check("18446744073709551615",  18446744073709551615ULL, 0);
18493         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18494 #if 0 /* strtoull() for /^-/ strings is undefined. */
18495         check("-1",                    18446744073709551615ULL, 0);
18496         check("-18446744073709551614",                     2LL, 0);
18497         check("-18446744073709551615",                     1LL, 0);
18498         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18499         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18500 #endif
18501         if (!bad)
18502                 printf("ok\n");
18503 }
18504 EOCP
18505         set try
18506         if eval $compile; then
18507                 case "`$run ./try`" in
18508                 ok) echo "Your strtoull() seems to be working okay." ;;
18509                 *) cat <<EOM >&4
18510 Your strtoull() doesn't seem to be working okay.
18511 EOM
18512                    d_strtoull="$undef"
18513                    ;;
18514                 esac
18515         else
18516                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18517                 d_strtoull="$undef"
18518         fi
18519         ;;
18520 esac
18521
18522 : see if strtouq exists
18523 set strtouq d_strtouq
18524 eval $inlibc
18525
18526 case "$d_strtouq" in
18527 "$define")
18528         $cat <<EOM
18529 Checking whether your strtouq() works okay...
18530 EOM
18531         $cat >try.c <<'EOCP'
18532 #include <errno.h>
18533 #include <stdio.h>
18534 extern unsigned long long int strtouq(char *s, char **, int);
18535 static int bad = 0;
18536 void check(char *s, unsigned long long eull, int een) {
18537         unsigned long long gull;
18538         errno = 0;
18539         gull = strtouq(s, 0, 10);
18540         if (!((gull == eull) && (errno == een)))
18541                 bad++;
18542 }
18543 int main() {
18544         check(" 1",                                        1LL, 0);
18545         check(" 0",                                        0LL, 0);
18546         check("18446744073709551615",  18446744073709551615ULL, 0);
18547         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18548 #if 0 /* strtouq() for /^-/ strings is undefined. */
18549         check("-1",                    18446744073709551615ULL, 0);
18550         check("-18446744073709551614",                     2LL, 0);
18551         check("-18446744073709551615",                     1LL, 0);
18552         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18553         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18554 #endif
18555         if (!bad)
18556                 printf("ok\n");
18557         return 0;
18558 }
18559 EOCP
18560         set try
18561         if eval $compile; then
18562                 case "`$run ./try`" in
18563                 ok) echo "Your strtouq() seems to be working okay." ;;
18564                 *) cat <<EOM >&4
18565 Your strtouq() doesn't seem to be working okay.
18566 EOM
18567                    d_strtouq="$undef"
18568                    ;;
18569                 esac
18570         else
18571                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18572                 d_strtouq="$undef"
18573         fi
18574         ;;
18575 esac
18576
18577 : see if strxfrm exists
18578 set strxfrm d_strxfrm
18579 eval $inlibc
18580
18581 : see if symlink exists
18582 set symlink d_symlink
18583 eval $inlibc
18584
18585 : see if syscall exists
18586 set syscall d_syscall
18587 eval $inlibc
18588
18589 : see if prototype for syscall is available
18590 echo " "
18591 set d_syscallproto syscall $i_unistd unistd.h
18592 eval $hasproto
18593
18594 : see if sysconf exists
18595 set sysconf d_sysconf
18596 eval $inlibc
18597
18598 : see if system exists
18599 set system d_system
18600 eval $inlibc
18601
18602 : see if tcgetpgrp exists
18603 set tcgetpgrp d_tcgetpgrp
18604 eval $inlibc
18605
18606 : see if tcsetpgrp exists
18607 set tcsetpgrp d_tcsetpgrp
18608 eval $inlibc
18609
18610 : see if prototype for telldir is available
18611 echo " "
18612 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18613 eval $hasproto
18614
18615 : see if time exists
18616 echo " "
18617 if test "X$d_time" = X -o X"$timetype" = X; then
18618     if set time val -f d_time; eval $csym; $val; then
18619                 echo 'time() found.' >&4
18620                 val="$define"
18621                 rp="What is the type returned by time() on this system?"
18622                 set time_t timetype long stdio.h sys/types.h
18623                 eval $typedef_ask
18624     else
18625                 echo 'time() not found, hope that will do.' >&4
18626                 val="$undef"
18627                 timetype='int';
18628     fi
18629     set d_time
18630     eval $setvar
18631 fi
18632
18633 : see if timegm exists
18634 set timegm d_timegm
18635 eval $inlibc
18636
18637 : see if this is a sys/times.h system
18638 set sys/times.h i_systimes
18639 eval $inhdr
18640
18641 : see if times exists
18642 echo " "
18643 if set times val -f d_times; eval $csym; $val; then
18644         echo 'times() found.' >&4
18645         d_times="$define"
18646         inc=''
18647         case "$i_systimes" in
18648         "$define") inc='sys/times.h';;
18649         esac
18650         rp="What is the type returned by times() on this system?"
18651         set clock_t clocktype long stdio.h sys/types.h $inc
18652         eval $typedef_ask
18653 else
18654         echo 'times() NOT found, hope that will do.' >&4
18655         d_times="$undef"
18656         clocktype='int'
18657 fi
18658
18659 : see if tmpnam_r exists
18660 set tmpnam_r d_tmpnam_r
18661 eval $inlibc
18662 case "$d_tmpnam_r" in
18663 "$define")
18664         hdrs="$i_systypes sys/types.h define stdio.h "
18665         case "$d_tmpnam_r_proto:$usethreads" in
18666         ":define")      d_tmpnam_r_proto=define
18667                 set d_tmpnam_r_proto tmpnam_r $hdrs
18668                 eval $hasproto ;;
18669         *)      ;;
18670         esac
18671         case "$d_tmpnam_r_proto" in
18672         define)
18673         case "$tmpnam_r_proto" in
18674         ''|0) try='char* tmpnam_r(char*);'
18675         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18676         esac
18677         case "$tmpnam_r_proto" in
18678         ''|0)   d_tmpnam_r=undef
18679                 tmpnam_r_proto=0
18680                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18681         * )     case "$tmpnam_r_proto" in
18682                 REENTRANT_PROTO*) ;;
18683                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18684                 esac
18685                 echo "Prototype: $try" ;;
18686         esac
18687         ;;
18688         *)      case "$usethreads" in
18689                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18690                 esac
18691                 d_tmpnam_r=undef
18692                 tmpnam_r_proto=0
18693                 ;;
18694         esac
18695         ;;
18696 *)      tmpnam_r_proto=0
18697         ;;
18698 esac
18699
18700 : see if truncate exists
18701 set truncate d_truncate
18702 eval $inlibc
18703
18704 : see if ttyname_r exists
18705 set ttyname_r d_ttyname_r
18706 eval $inlibc
18707 case "$d_ttyname_r" in
18708 "$define")
18709         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18710         case "$d_ttyname_r_proto:$usethreads" in
18711         ":define")      d_ttyname_r_proto=define
18712                 set d_ttyname_r_proto ttyname_r $hdrs
18713                 eval $hasproto ;;
18714         *)      ;;
18715         esac
18716         case "$d_ttyname_r_proto" in
18717         define)
18718         case "$ttyname_r_proto" in
18719         ''|0) try='int ttyname_r(int, char*, size_t);'
18720         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18721         esac
18722         case "$ttyname_r_proto" in
18723         ''|0) try='int ttyname_r(int, char*, int);'
18724         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18725         esac
18726         case "$ttyname_r_proto" in
18727         ''|0) try='char* ttyname_r(int, char*, int);'
18728         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18729         esac
18730         case "$ttyname_r_proto" in
18731         ''|0)   d_ttyname_r=undef
18732                 ttyname_r_proto=0
18733                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18734         * )     case "$ttyname_r_proto" in
18735                 REENTRANT_PROTO*) ;;
18736                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18737                 esac
18738                 echo "Prototype: $try" ;;
18739         esac
18740         ;;
18741         *)      case "$usethreads" in
18742                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18743                 esac
18744                 d_ttyname_r=undef
18745                 ttyname_r_proto=0
18746                 ;;
18747         esac
18748         ;;
18749 *)      ttyname_r_proto=0
18750         ;;
18751 esac
18752
18753 : see if tzname[] exists
18754 echo " "
18755 if set tzname val -a d_tzname; eval $csym; $val; then
18756         val="$define"
18757         echo 'tzname[] found.' >&4
18758 else
18759         val="$undef"
18760         echo 'tzname[] NOT found.' >&4
18761 fi
18762 set d_tzname
18763 eval $setvar
18764
18765 : Check if is a multiplatform env
18766 case "$osname" in
18767 next|darwin) multiarch="$define" ;;
18768 esac
18769 case "$multiarch" in
18770 ''|[nN]*) multiarch="$undef" ;;
18771 esac
18772
18773 : check for ordering of bytes in a UV
18774 echo " "
18775 case "$usecrosscompile$multiarch" in
18776 *$define*)
18777         $cat <<EOM
18778 You seem to be either cross-compiling or doing a multiarchitecture build,
18779 skipping the byteorder check.
18780
18781 EOM
18782         byteorder='ffff'
18783         ;;
18784 *)
18785         case "$byteorder" in
18786         '')
18787                 $cat <<'EOM'
18788 In the following, larger digits indicate more significance.  A big-endian
18789 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18790 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18791 machines may have weird orders like 3412.  A Cray will report 87654321,
18792 an Alpha will report 12345678. If the test program works the default is
18793 probably right.
18794 I'm now running the test program...
18795 EOM
18796                 $cat >try.c <<EOCP
18797 #include <stdio.h>
18798 #$i_stdlib I_STDLIB
18799 #ifdef I_STDLIB
18800 #include <stdlib.h>
18801 #endif
18802 #include <sys/types.h>
18803 typedef $uvtype UV;
18804 int main()
18805 {
18806         int i;
18807         union {
18808                 UV l;
18809                 char c[$uvsize];
18810         } u;
18811
18812         if ($uvsize > 4)
18813                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18814         else
18815                 u.l = (UV)0x04030201;
18816         for (i = 0; i < $uvsize; i++)
18817                 printf("%c", u.c[i]+'0');
18818         printf("\n");
18819         exit(0);
18820 }
18821 EOCP
18822                 xxx_prompt=y
18823                 set try
18824                 if eval $compile && $run ./try > /dev/null; then
18825                         dflt=`$run ./try`
18826                         case "$dflt" in
18827                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18828                                 echo "(The test program ran ok.)"
18829                                 echo "byteorder=$dflt"
18830                                 xxx_prompt=n
18831                         ;;
18832                         ????|????????) echo "(The test program ran ok.)" ;;
18833                         *) echo "(The test program didn't run right for some reason.)" ;;
18834                         esac
18835                 else
18836                         dflt='4321'
18837                         cat <<'EOM'
18838 (I can't seem to compile the test program.  Guessing big-endian...)
18839 EOM
18840                 fi
18841                 case "$xxx_prompt" in
18842                 y)
18843                         rp="What is the order of bytes in $uvtype?"
18844                         . ./myread
18845                         byteorder="$ans"
18846                         ;;
18847                 *)      byteorder=$dflt
18848                         ;;
18849                 esac
18850                 ;;
18851         esac
18852         $rm_try
18853         ;;
18854 esac
18855
18856 : Checking 32bit alignedness
18857 $cat <<EOM
18858
18859 Checking to see whether you can access character data unalignedly...
18860 EOM
18861 case "$d_u32align" in
18862 '')   $cat >try.c <<EOCP
18863 #include <stdio.h>
18864 #$i_stdlib I_STDLIB
18865 #ifdef I_STDLIB
18866 #include <stdlib.h>
18867 #endif
18868 #define U32 $u32type
18869 #define BYTEORDER 0x$byteorder
18870 #define U8 $u8type
18871 #include <signal.h>
18872 #ifdef SIGBUS
18873 $signal_t bletch(int s) { exit(4); }
18874 #endif
18875 int main() {
18876 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18877     volatile U8 buf[8];
18878     volatile U32 *up;
18879     int i;
18880
18881     if (sizeof(U32) != 4) {
18882         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18883         exit(1);
18884     }
18885
18886     fflush(stdout);
18887
18888 #ifdef SIGBUS
18889     signal(SIGBUS, bletch);
18890 #endif
18891
18892     buf[0] = 0;
18893     buf[1] = 0;
18894     buf[2] = 0;
18895     buf[3] = 1;
18896     buf[4] = 0;
18897     buf[5] = 0;
18898     buf[6] = 0;
18899     buf[7] = 1;
18900
18901     for (i = 0; i < 4; i++) {
18902         up = (U32*)(buf + i);
18903         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18904                (*up == 1 << (8*(3-i)))  /* little-endian */
18905               )
18906            )
18907         {
18908             printf("read failed (%x)\n", *up);
18909             exit(2);
18910         }
18911     }
18912
18913     /* write test */
18914     for (i = 0; i < 4; i++) {
18915         up = (U32*)(buf + i);
18916         *up = 0xBeef;
18917         if (*up != 0xBeef) {
18918             printf("write failed (%x)\n", *up);
18919             exit(3);
18920         }
18921     }
18922
18923     exit(0);
18924 #else
18925     printf("1\n");
18926     exit(1);
18927 #endif
18928     return 0;
18929 }
18930 EOCP
18931 set try
18932 if eval $compile_ok; then
18933         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18934         $run ./try 2>&1 >/dev/null
18935         case "$?" in
18936         0)      cat >&4 <<EOM
18937 You can access character data pretty unalignedly.
18938 EOM
18939                 d_u32align="$undef"
18940                 ;;
18941         *)      cat >&4 <<EOM
18942 It seems that you must access character data in an aligned manner.
18943 EOM
18944                 d_u32align="$define"
18945                 ;;
18946         esac
18947 else
18948         rp='Can you access character data at unaligned addresses?'
18949         dflt='n'
18950         . ./myread
18951         case "$ans" in
18952         [yY]*)  d_u32align="$undef"  ;;
18953         *)      d_u32align="$define" ;;
18954         esac
18955 fi
18956 $rm_try
18957 ;;
18958 esac
18959
18960 : see if ualarm exists
18961 set ualarm d_ualarm
18962 eval $inlibc
18963
18964 : see if umask exists
18965 set umask d_umask
18966 eval $inlibc
18967
18968 : see if unordered exists
18969 set unordered d_unordered
18970 eval $inlibc
18971
18972 : see if unsetenv exists
18973 set unsetenv d_unsetenv
18974 eval $inlibc
18975
18976 : see if usleep exists
18977 set usleep d_usleep
18978 eval $inlibc
18979
18980 : see if prototype for usleep is available
18981 echo " "
18982 set d_usleepproto usleep $i_unistd unistd.h
18983 eval $hasproto
18984
18985 : see if ustat exists
18986 set ustat d_ustat
18987 eval $inlibc
18988
18989 : see if closedir exists
18990 set closedir d_closedir
18991 eval $inlibc
18992
18993 case "$d_closedir" in
18994 "$define")
18995         echo " "
18996         echo "Checking whether closedir() returns a status..." >&4
18997         cat > try.c <<EOM
18998 #$i_dirent I_DIRENT             /**/
18999 #$i_sysdir I_SYS_DIR            /**/
19000 #$i_sysndir I_SYS_NDIR          /**/
19001 #$i_systypes I_SYS_TYPES        /**/
19002
19003 #if defined(I_SYS_TYPES)
19004 #include <sys/types.h>
19005 #endif
19006 #if defined(I_DIRENT)
19007 #include <dirent.h>
19008 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19009 #include <sys/dir.h>
19010 #endif
19011 #else
19012 #ifdef I_SYS_NDIR
19013 #include <sys/ndir.h>
19014 #else
19015 #ifdef I_SYS_DIR
19016 #ifdef hp9000s500
19017 #include <ndir.h>       /* may be wrong in the future */
19018 #else
19019 #include <sys/dir.h>
19020 #endif
19021 #endif
19022 #endif
19023 #endif
19024 int main() { return closedir(opendir(".")); }
19025 EOM
19026         set try
19027         if eval $compile_ok; then
19028                 if $run ./try > /dev/null 2>&1 ; then
19029                         echo "Yes, it does."
19030                         val="$undef"
19031                 else
19032                         echo "No, it doesn't."
19033                         val="$define"
19034                 fi
19035         else
19036                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19037                 val="$define"
19038         fi
19039         ;;
19040 *)
19041         val="$undef";
19042         ;;
19043 esac
19044 set d_void_closedir
19045 eval $setvar
19046 $rm_try
19047
19048 : see if there is a wait4
19049 set wait4 d_wait4
19050 eval $inlibc
19051
19052 : see if waitpid exists
19053 set waitpid d_waitpid
19054 eval $inlibc
19055
19056 : see if wcstombs exists
19057 set wcstombs d_wcstombs
19058 eval $inlibc
19059
19060 : see if wctomb exists
19061 set wctomb d_wctomb
19062 eval $inlibc
19063
19064 : see if writev exists
19065 set writev d_writev
19066 eval $inlibc
19067
19068 : preserve RCS keywords in files with variable substitution, grrr
19069 Date='$Date'
19070 Id='$Id'
19071 Log='$Log'
19072 RCSfile='$RCSfile'
19073 Revision='$Revision'
19074
19075 : check for alignment requirements
19076 echo " "
19077 case "$usecrosscompile" in
19078 *$define*)
19079         $cat <<EOM
19080 You seem to be cross-compiling.  Skipping the memory alignment check.
19081
19082 EOM
19083         case "$alignbytes" in
19084         '') alignbytes=8 ;;
19085         esac
19086         ;;
19087 *)
19088         case "$alignbytes" in
19089         '') echo "Checking alignment constraints..." >&4
19090                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19091                         $cat >try.c <<'EOCP'
19092 typedef long double NV;
19093 EOCP
19094                 else
19095                         $cat >try.c <<'EOCP'
19096 typedef double NV;
19097 EOCP
19098                 fi
19099                 $cat >>try.c <<'EOCP'
19100 #include <stdio.h>
19101 struct foobar {
19102         char foo;
19103         NV bar;
19104 } try_algn;
19105 int main()
19106 {
19107     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19108     return(0);
19109 }
19110 EOCP
19111                 set try
19112                 if eval $compile_ok; then
19113                         dflt=`$run ./try`
19114                 else
19115                         dflt='8'
19116                         echo "(I can't seem to compile the test program...)"
19117                 fi
19118                 case "$multiarch" in
19119                 *$define*)
19120                         : The usual safe value is 8, but Darwin with -Duselongdouble
19121                         : needs 16.  Hence, we will take 8 as a minimum, but allow
19122                         : Configure to pick a larger value if needed.
19123                         if $test "$dflt" -lt 8; then
19124                             dflt='8'
19125                                 echo "Setting alignment to 8 for multiarch support.">&4
19126                         fi
19127                         ;;
19128                 esac
19129                 ;;
19130         *) dflt="$alignbytes"
19131                 ;;
19132         esac
19133         rp="Doubles must be aligned on a how-many-byte boundary?"
19134         . ./myread
19135         alignbytes="$ans"
19136         $rm_try
19137         ;;
19138 esac
19139
19140
19141 : set the base revision
19142 baserev=5.0
19143
19144 : Determine if this is an EBCDIC system
19145 echo " "
19146 echo "Determining whether or not we are on an EBCDIC system..." >&4
19147 $cat >try.c <<'EOM'
19148 int main()
19149 {
19150   if ('M'==0xd4) return 0;
19151   return 1;
19152 }
19153 EOM
19154
19155 case "$BOOTSTRAP_CHARSET" in
19156     Y|y|define) bootstrap_charset=$define       ;;
19157     *)          bootstrap_charset=$undef        ;;
19158 esac
19159
19160 val=$undef
19161 set try
19162 if eval $compile_ok; then
19163         if $run ./try; then
19164                 echo "You seem to speak EBCDIC." >&4
19165                 val="$define"
19166         else
19167                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19168         fi
19169 else
19170         echo "I'm unable to compile the test program." >&4
19171         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19172 fi
19173 $rm_try
19174 set ebcdic
19175 eval $setvar
19176
19177 : length of character in bytes. Is always 1, otherwise it is not C
19178 : This used to be a test using sizeof
19179 charsize=1
19180
19181 : Check for the number of bits in a character
19182 case "$charbits" in
19183 '')     echo "Checking how long a character is (in bits)..." >&4
19184         $cat >try.c <<EOCP
19185 #include <stdio.h>
19186 int main ()
19187 {
19188     int n;
19189     unsigned char c;
19190     for (c = 1, n = 0; c; c <<= 1, n++) ;
19191     printf ("%d\n", n);
19192     return (0);
19193     }
19194 EOCP
19195         set try
19196         if eval $compile_ok; then
19197                 dflt=`$run ./try`
19198         else
19199                 dflt='8'
19200                 echo "(I can't seem to compile the test program.  Guessing...)"
19201         fi
19202         ;;
19203 *)
19204         dflt="$charbits"
19205         ;;
19206 esac
19207 rp="What is the length of a character (in bits)?"
19208 . ./myread
19209 charbits="$ans"
19210 $rm_try
19211 case "$charbits" in
19212 8)      ;;
19213 *)      cat >&4 << EOM
19214 Your system has an unsigned character size of $charbits bits, which
19215 is rather unusual (normally it is 8 bits).  Perl likely will not work
19216 correctly on your system, with subtle bugs in various places.
19217 EOM
19218         rp='Do you really want to continue?'
19219         dflt='n'
19220         . ./myread
19221         case "$ans" in
19222                 [yY])   echo >&4 "Okay, continuing."    ;;
19223                 *)      exit 1                          ;;
19224         esac
19225 esac
19226
19227 : how do we concatenate cpp tokens here?
19228 echo " "
19229 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19230 $cat >cpp_stuff.c <<'EOCP'
19231 #define RCAT(a,b)a/**/b
19232 #define ACAT(a,b)a ## b
19233 RCAT(Rei,ser)
19234 ACAT(Cir,cus)
19235 EOCP
19236 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19237 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19238         echo "Oh!  Smells like ANSI's been here." >&4
19239         echo "We can catify or stringify, separately or together!"
19240         cpp_stuff=42
19241 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19242         echo "Ah, yes!  The good old days!" >&4
19243         echo "However, in the good old days we don't know how to stringify and"
19244         echo "catify at the same time."
19245         cpp_stuff=1
19246 else
19247         $cat >&4 <<EOM
19248 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19249 You're going to have to edit the values of CAT[2-5] in config.h...
19250 EOM
19251         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19252 fi
19253 $rm -f cpp_stuff.*
19254
19255 : see if this is a db.h system
19256 set db.h i_db
19257 eval $inhdr
19258
19259 case "$i_db" in
19260 $define)
19261         : Check db version.
19262         echo " "
19263         echo "Checking Berkeley DB version ..." >&4
19264         $cat >try.c <<EOCP
19265 #$d_const HASCONST
19266 #ifndef HASCONST
19267 #define const
19268 #endif
19269 #include <sys/types.h>
19270 #include <stdio.h>
19271 #$i_stdlib I_STDLIB
19272 #ifdef I_STDLIB
19273 #include <stdlib.h>
19274 #endif
19275 #include <db.h>
19276 int main(int argc, char *argv[])
19277 {
19278 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19279     int Major, Minor, Patch ;
19280     unsigned long Version ;
19281     (void)db_version(&Major, &Minor, &Patch) ;
19282     if (argc == 2) {
19283         printf("%d %d %d %d %d %d\n",
19284                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19285                Major, Minor, Patch);
19286         exit(0);
19287     }
19288     printf("You have Berkeley DB Version 2 or greater.\n");
19289
19290     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19291                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19292     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19293                 Major, Minor, Patch) ;
19294
19295     /* check that db.h & libdb are compatible */
19296     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19297         printf("db.h and libdb are incompatible.\n") ;
19298         exit(3);
19299     }
19300
19301     printf("db.h and libdb are compatible.\n") ;
19302
19303     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19304                 + DB_VERSION_PATCH ;
19305
19306     /* needs to be >= 2.3.4 */
19307     if (Version < 2003004) {
19308     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19309         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19310         exit(2);
19311     }
19312
19313     exit(0);
19314 #else
19315 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19316     if (argc == 2) {
19317         printf("1 0 0\n");
19318         exit(0);
19319     }
19320     printf("You have Berkeley DB Version 1.\n");
19321     exit(0);    /* DB version < 2: the coast is clear. */
19322 #else
19323     exit(1);    /* <db.h> not Berkeley DB? */
19324 #endif
19325 #endif
19326 }
19327 EOCP
19328         set try
19329         if eval $compile_ok && $run ./try; then
19330                 echo 'Looks OK.' >&4
19331                 set `$run ./try 1`
19332                 db_version_major=$1
19333                 db_version_minor=$2
19334                 db_version_patch=$3
19335         else
19336                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19337                 i_db=$undef
19338                 case " $libs " in
19339                 *"-ldb "*)
19340                         : Remove db from list of libraries to use
19341                         echo "Removing unusable -ldb from library list" >&4
19342                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19343                         shift
19344                         libs="$*"
19345                         echo "libs = $libs" >&4
19346                         ;;
19347                 esac
19348         fi
19349         $rm_try
19350         ;;
19351 esac
19352
19353 case "$i_db" in
19354 define)
19355         : Check the return type needed for hash
19356         echo " "
19357         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19358         $cat >try.c <<EOCP
19359 #$d_const HASCONST
19360 #ifndef HASCONST
19361 #define const
19362 #endif
19363 #include <sys/types.h>
19364 #include <db.h>
19365
19366 #ifndef DB_VERSION_MAJOR
19367 u_int32_t hash_cb (ptr, size)
19368 const void *ptr;
19369 size_t size;
19370 {
19371 }
19372 HASHINFO info;
19373 int main()
19374 {
19375         info.hash = hash_cb;
19376 }
19377 #endif
19378 EOCP
19379         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19380                 if $contains warning try.out >>/dev/null 2>&1 ; then
19381                         db_hashtype='int'
19382                 else
19383                         db_hashtype='u_int32_t'
19384                 fi
19385         else
19386                 : XXX Maybe we should just give up here.
19387                 db_hashtype=u_int32_t
19388                 $cat try.out >&4
19389                 echo "Help:  I can't seem to compile the db test program." >&4
19390                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19391         fi
19392         $rm_try
19393         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19394         ;;
19395 *)      db_hashtype=u_int32_t
19396         ;;
19397 esac
19398 case "$i_db" in
19399 define)
19400         : Check the return type needed for prefix
19401         echo " "
19402         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19403         cat >try.c <<EOCP
19404 #$d_const HASCONST
19405 #ifndef HASCONST
19406 #define const
19407 #endif
19408 #include <sys/types.h>
19409 #include <db.h>
19410
19411 #ifndef DB_VERSION_MAJOR
19412 size_t prefix_cb (key1, key2)
19413 const DBT *key1;
19414 const DBT *key2;
19415 {
19416 }
19417 BTREEINFO info;
19418 int main()
19419 {
19420         info.prefix = prefix_cb;
19421 }
19422 #endif
19423 EOCP
19424         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19425                 if $contains warning try.out >>/dev/null 2>&1 ; then
19426                         db_prefixtype='int'
19427                 else
19428                         db_prefixtype='size_t'
19429                 fi
19430         else
19431                 db_prefixtype='size_t'
19432                 : XXX Maybe we should just give up here.
19433                 $cat try.out >&4
19434                 echo "Help:  I can't seem to compile the db test program." >&4
19435                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19436         fi
19437         $rm_try
19438         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19439         ;;
19440 *)      db_prefixtype='size_t'
19441         ;;
19442 esac
19443
19444 : How can we generate normalized random numbers ?
19445 echo " "
19446 echo "Looking for a random number function..." >&4
19447 case "$randfunc" in
19448 '')
19449         if set drand48 val -f; eval $csym; $val; then
19450                 dflt="drand48"
19451                 echo "Good, found drand48()." >&4
19452         elif set random val -f; eval $csym; $val; then
19453                 dflt="random"
19454                 echo "OK, found random()." >&4
19455         else
19456                 dflt="rand"
19457                 echo "Yuck, looks like I have to use rand()." >&4
19458         fi
19459         echo " "
19460         ;;
19461 *)
19462         dflt="$randfunc"
19463         ;;
19464 esac
19465 cont=true
19466
19467 case "$ccflags" in
19468 *-Dmy_rand=*|*-Dmy_srand=*)
19469         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19470         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19471         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19472         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19473         ;;
19474 esac
19475
19476 while $test "$cont"; do
19477         rp="Use which function to generate random numbers?"
19478         . ./myread
19479         if $test "$ans" = "$dflt"; then
19480                 : null
19481         else
19482                 randbits=''
19483         fi
19484         randfunc="$ans"
19485         if set $ans val -f; eval $csym; $val; then
19486                 cont=''
19487         else
19488                 dflt=y
19489                 rp="I cannot find function $ans. Use that name anyway?"
19490                 . ./myread
19491                 dflt=rand
19492                 case "$ans" in
19493                         [yY]*) cont='';;
19494                 esac
19495         fi
19496         case "$cont" in
19497         '')
19498                 case "$randfunc" in
19499                 drand48)
19500                         drand01="drand48()"
19501                         seedfunc="srand48"
19502                         randbits=48
19503                         randseedtype=long
19504                         ;;
19505                 rand|random)
19506                         case "$randbits" in
19507                         '')
19508 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19509                                 $cat >try.c <<EOCP
19510 #$i_unistd I_UNISTD
19511 #$i_stdlib I_STDLIB
19512 #include <stdio.h>
19513 #ifdef I_UNISTD
19514 #  include <unistd.h>
19515 #endif
19516 #ifdef I_STDLIB
19517 #  include <stdlib.h>
19518 #endif
19519 int main()
19520 {
19521         int i;
19522         unsigned long tmp;
19523         unsigned long max = 0L;
19524
19525         for (i = 1000; i; i--) {
19526                 tmp = (unsigned long) $randfunc();
19527                 if (tmp > max) max = tmp;
19528         }
19529         for (i = 0; max; i++)
19530                 max /= 2;
19531         printf("%d\n",i);
19532 }
19533 EOCP
19534                                 set try
19535                                 if eval $compile_ok; then
19536                                         dflt=`try`
19537                                 else
19538                                         dflt='?'
19539                                         echo "(I can't seem to compile the test program...)"
19540                                 fi
19541                                 ;;
19542                         *)
19543                                 dflt="$randbits"
19544                                 ;;
19545                         esac
19546                         rp="How many bits does your $randfunc() function produce?"
19547                         . ./myread
19548                         randbits="$ans"
19549                         $rm_try
19550                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19551                         seedfunc="s$randfunc"
19552                         randseedtype=unsigned
19553                         ;;
19554                 *)
19555                         dflt="31"
19556                         rp="How many bits does your $randfunc() function produce?"
19557                         . ./myread
19558                         randbits="$ans"
19559                         seedfunc="s$randfunc"
19560                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19561                         if set $seedfunc val -f; eval $csym; $val; then
19562                                 echo "(Using $seedfunc() to seed random generator)"
19563                         else
19564                                 echo "(Warning: no $seedfunc() to seed random generator)"
19565                                 seedfunc=rand
19566                         fi
19567                         randseedtype=unsigned
19568                         ;;
19569                 esac
19570                 ;;
19571         esac
19572 done
19573
19574 : Check how to flush
19575 echo " "
19576 $cat >&4 <<EOM
19577 Checking how to flush all pending stdio output...
19578 EOM
19579 # I only know how to find the first 32 possibly open files on SunOS.
19580 # See also hints/sunos_4_1.sh and util.c  --AD
19581 case "$osname" in
19582 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19583 esac
19584 $cat >>try.c <<EOCP
19585 #include <stdio.h>
19586 #$i_stdlib I_STDLIB
19587 #ifdef I_STDLIB
19588 #include <stdlib.h>
19589 #endif
19590 #$i_unistd I_UNISTD
19591 #ifdef I_UNISTD
19592 # include <unistd.h>
19593 #endif
19594 #$d_sysconf HAS_SYSCONF
19595 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19596 #ifdef HAS_STDIO_STREAM_ARRAY
19597 # define STDIO_STREAM_ARRAY $stdio_stream_array
19598 #endif
19599 int main() {
19600   FILE* p;
19601   unlink("try.out");
19602   p = fopen("try.out", "w");
19603 #ifdef TRY_FPUTC
19604   fputc('x', p);
19605 #else
19606 # ifdef TRY_FPRINTF
19607   fprintf(p, "x");
19608 # endif
19609 #endif
19610 #ifdef TRY_FFLUSH_NULL
19611   fflush(NULL);
19612 #endif
19613 #ifdef TRY_FFLUSH_ALL
19614   {
19615     long open_max = -1;
19616 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19617     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19618 # else
19619 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19620     open_max = sysconf(_SC_OPEN_MAX);
19621 #  else
19622 #   ifdef FOPEN_MAX
19623     open_max = FOPEN_MAX;
19624 #   else
19625 #    ifdef OPEN_MAX
19626     open_max = OPEN_MAX;
19627 #    else
19628 #     ifdef _NFILE
19629     open_max = _NFILE;
19630 #     endif
19631 #    endif
19632 #   endif
19633 #  endif
19634 # endif
19635 # ifdef HAS_STDIO_STREAM_ARRAY
19636     if (open_max > 0) {
19637       long i;
19638       for (i = 0; i < open_max; i++)
19639             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19640                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19641                 STDIO_STREAM_ARRAY[i]._flag)
19642                 fflush(&STDIO_STREAM_ARRAY[i]);
19643     }
19644   }
19645 # endif
19646 #endif
19647   _exit(42);
19648 }
19649 EOCP
19650 : first we have to find out how _not_ to flush
19651 $to try.c
19652 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19653     output=''
19654     set try -DTRY_FPUTC
19655     if eval $compile; then
19656             $run ./try 2>/dev/null
19657             code="$?"
19658             $from try.out
19659             if $test ! -s try.out -a "X$code" = X42; then
19660                 output=-DTRY_FPUTC
19661             fi
19662     fi
19663     case "$output" in
19664     '')
19665             set try -DTRY_FPRINTF
19666             if eval $compile; then
19667                     $run ./try 2>/dev/null
19668                     code="$?"
19669                     $from try.out
19670                     if $test ! -s try.out -a "X$code" = X42; then
19671                         output=-DTRY_FPRINTF
19672                     fi
19673             fi
19674         ;;
19675     esac
19676 fi
19677 : check for fflush NULL behavior
19678 case "$fflushNULL" in
19679 '')     set try -DTRY_FFLUSH_NULL $output
19680         if eval $compile; then
19681                 $run ./try 2>/dev/null
19682                 code="$?"
19683                 $from try.out
19684                 if $test -s try.out -a "X$code" = X42; then
19685                         fflushNULL="`$cat try.out`"
19686                 else
19687                         if $test "X$code" != X42; then
19688                                 $cat >&4 <<EOM
19689 (If this test failed, don't worry, we'll try another method shortly.)
19690 EOM
19691                         fi
19692                 fi
19693         fi
19694         $rm -f core try.core core.try.*
19695         case "$fflushNULL" in
19696         x)      $cat >&4 <<EOM
19697 Your fflush(NULL) works okay for output streams.
19698 Let's see if it clobbers input pipes...
19699 EOM
19700 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19701 # bug that improperly flushes the input end of pipes.  So we avoid the
19702 # autoflush on fork/system/exec support for now. :-(
19703 $cat >tryp.c <<EOCP
19704 #include <stdio.h>
19705 int
19706 main(int argc, char **argv)
19707 {
19708     char buf[1024];
19709     int i;
19710     char *bp = buf;
19711     while (1) {
19712         while ((i = getc(stdin)) != -1
19713                && (*bp++ = i) != '\n'
19714                && bp < &buf[1024])
19715         /* DO NOTHING */ ;
19716         *bp = '\0';
19717         fprintf(stdout, "%s", buf);
19718         fflush(NULL);
19719         if (i == -1)
19720             return 0;
19721         bp = buf;
19722     }
19723 }
19724 EOCP
19725                 fflushNULL="$define"
19726                 set tryp
19727                 if eval $compile; then
19728                     $rm -f tryp.out
19729                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19730                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19731                        $cat >&4 <<EOM
19732 fflush(NULL) seems to behave okay with input streams.
19733 EOM
19734                         fflushNULL="$define"
19735                     else
19736                         $cat >&4 <<EOM
19737 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19738 EOM
19739                         fflushNULL="$undef"
19740                     fi
19741                 fi
19742                 $rm -f core tryp.c tryp.core core.tryp.*
19743                 ;;
19744         '')     $cat >&4 <<EOM
19745 Your fflush(NULL) isn't working (contrary to ANSI C).
19746 EOM
19747                 fflushNULL="$undef"
19748                 ;;
19749         *)      $cat >&4 <<EOM
19750 Cannot figure out whether your fflush(NULL) works or not.
19751 I'm assuming it doesn't (contrary to ANSI C).
19752 EOM
19753                 fflushNULL="$undef"
19754                 ;;
19755         esac
19756         ;;
19757 $define|true|[yY]*)
19758         fflushNULL="$define"
19759         ;;
19760 *)
19761         fflushNULL="$undef"
19762         ;;
19763 esac
19764 : check explicit looping only if NULL did not work, and if the pipe
19765 : bug does not show up on an explicit flush too
19766 case "$fflushNULL" in
19767 "$undef")
19768         $cat >tryp.c <<EOCP
19769 #include <stdio.h>
19770 int
19771 main(int argc, char **argv)
19772 {
19773     char buf[1024];
19774     int i;
19775     char *bp = buf;
19776     while (1) {
19777         while ((i = getc(stdin)) != -1
19778                && (*bp++ = i) != '\n'
19779                && bp < &buf[1024])
19780         /* DO NOTHING */ ;
19781         *bp = '\0';
19782         fprintf(stdout, "%s", buf);
19783         fflush(stdin);
19784         if (i == -1)
19785             return 0;
19786         bp = buf;
19787     }
19788 }
19789 EOCP
19790         set tryp
19791         if eval $compile; then
19792             $rm -f tryp.out
19793             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19794             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19795                $cat >&4 <<EOM
19796 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19797 EOM
19798                 : now check for fflushall behaviour
19799                 case "$fflushall" in
19800                 '')     set try -DTRY_FFLUSH_ALL $output
19801                         if eval $compile; then
19802                                 $cat >&4 <<EOM
19803 (Now testing the other method--but note that this also may fail.)
19804 EOM
19805                                 $run ./try 2>/dev/null
19806                                 code=$?
19807                                 $from try.out
19808                                 if $test -s try.out -a "X$code" = X42; then
19809                                         fflushall="`$cat try.out`"
19810                                 fi
19811                         fi
19812                         $rm_try
19813                         case "$fflushall" in
19814                         x)      $cat >&4 <<EOM
19815 Whew. Flushing explicitly all the stdio streams works.
19816 EOM
19817                                 fflushall="$define"
19818                                 ;;
19819                         '')     $cat >&4 <<EOM
19820 Sigh. Flushing explicitly all the stdio streams doesn't work.
19821 EOM
19822                                 fflushall="$undef"
19823                                 ;;
19824                         *)      $cat >&4 <<EOM
19825 Cannot figure out whether flushing stdio streams explicitly works or not.
19826 I'm assuming it doesn't.
19827 EOM
19828                                 fflushall="$undef"
19829                                 ;;
19830                         esac
19831                         ;;
19832                 "$define"|true|[yY]*)
19833                         fflushall="$define"
19834                         ;;
19835                 *)
19836                         fflushall="$undef"
19837                         ;;
19838                 esac
19839             else
19840                 $cat >&4 <<EOM
19841 All is futile.  Even fflush(stdin) clobbers input pipes!
19842 EOM
19843                 fflushall="$undef"
19844             fi
19845         else
19846             fflushall="$undef"
19847         fi
19848         $rm -f core tryp.c tryp.core core.tryp.*
19849         ;;
19850 *)      fflushall="$undef"
19851         ;;
19852 esac
19853
19854 case "$fflushNULL$fflushall" in
19855 undefundef)
19856         $cat <<EOM
19857 OK, I give up.  I cannot figure out how to flush pending stdio output.
19858 We won't be flushing handles at all before fork/exec/popen.
19859 EOM
19860         ;;
19861 esac
19862 $rm_try tryp
19863
19864 : Store the full pathname to the ar program for use in the C program
19865 : Respect a hint or command line value for full_ar.
19866 case "$full_ar" in
19867 '') full_ar=$ar ;;
19868 esac
19869
19870 : Store the full pathname to the sed program for use in the C program
19871 full_sed=$sed
19872
19873 : see what type gids are declared as in the kernel
19874 echo " "
19875 echo "Looking for the type for group ids returned by getgid()."
19876 set gid_t gidtype xxx stdio.h sys/types.h
19877 eval $typedef
19878 case "$gidtype" in
19879 xxx)
19880         xxx=`./findhdr sys/user.h`
19881         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19882         case $1 in
19883         unsigned) dflt="$1 $2" ;;
19884         *) dflt="$1" ;;
19885         esac
19886         ;;
19887 *) dflt="$gidtype";;
19888 esac
19889 case "$gidtype" in
19890 gid_t) echo "gid_t found." ;;
19891 *)      rp="What is the type for group ids returned by getgid()?"
19892         . ./myread
19893         gidtype="$ans"
19894         ;;
19895 esac
19896
19897 : Check the size of GID
19898 echo " "
19899 case "$gidtype" in
19900 *_t) zzz="$gidtype"     ;;
19901 *)   zzz="gid"          ;;
19902 esac
19903 echo "Checking the size of $zzz..." >&4
19904 cat > try.c <<EOCP
19905 #include <sys/types.h>
19906 #include <stdio.h>
19907 #$i_stdlib I_STDLIB
19908 #ifdef I_STDLIB
19909 #include <stdlib.h>
19910 #endif
19911 int main() {
19912     printf("%d\n", (int)sizeof($gidtype));
19913     exit(0);
19914 }
19915 EOCP
19916 set try
19917 if eval $compile_ok; then
19918         yyy=`$run ./try`
19919         case "$yyy" in
19920         '')     gidsize=4
19921                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19922                 ;;
19923         *)      gidsize=$yyy
19924                 echo "Your $zzz is $gidsize bytes long."
19925                 ;;
19926         esac
19927 else
19928         gidsize=4
19929         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19930 fi
19931
19932
19933 : Check if GID is signed
19934 echo " "
19935 case "$gidtype" in
19936 *_t) zzz="$gidtype"     ;;
19937 *)   zzz="gid"          ;;
19938 esac
19939 echo "Checking the sign of $zzz..." >&4
19940 cat > try.c <<EOCP
19941 #include <sys/types.h>
19942 #include <stdio.h>
19943 int main() {
19944         $gidtype foo = -1;
19945         if (foo < 0)
19946                 printf("-1\n");
19947         else
19948                 printf("1\n");
19949 }
19950 EOCP
19951 set try
19952 if eval $compile; then
19953         yyy=`$run ./try`
19954         case "$yyy" in
19955         '')     gidsign=1
19956                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19957                 ;;
19958         *)      gidsign=$yyy
19959                 case "$gidsign" in
19960                  1) echo "Your $zzz is unsigned." ;;
19961                 -1) echo "Your $zzz is signed."   ;;
19962                 esac
19963                 ;;
19964         esac
19965 else
19966         gidsign=1
19967         echo "(I can't compile the test program--guessing unsigned.)" >&4
19968 fi
19969
19970
19971 : Check 64bit sizes
19972 echo " "
19973
19974 if $test X"$quadtype" != X; then
19975
19976 echo "Checking how to print 64-bit integers..." >&4
19977
19978 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19979         $cat >try.c <<'EOCP'
19980 #include <sys/types.h>
19981 #include <stdio.h>
19982 int main() {
19983   int q = 12345678901;
19984   printf("%ld\n", q);
19985 }
19986 EOCP
19987         set try
19988         if eval $compile; then
19989                 yyy=`$run ./try`
19990                 case "$yyy" in
19991                 12345678901)
19992                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19993                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19994                         echo "We will use %d."
19995                         ;;
19996                 esac
19997         fi
19998 fi
19999
20000 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20001         $cat >try.c <<'EOCP'
20002 #include <sys/types.h>
20003 #include <stdio.h>
20004 int main() {
20005   long q = 12345678901;
20006   printf("%ld\n", q);
20007 }
20008 EOCP
20009         set try
20010         if eval $compile; then
20011                 yyy=`$run ./try`
20012                 case "$yyy" in
20013                 12345678901)
20014                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20015                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20016                         echo "We will use %ld."
20017                         ;;
20018                 esac
20019         fi
20020 fi
20021
20022 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20023         $cat >try.c <<'EOCP'
20024 #include <sys/types.h>
20025 #include <inttypes.h>
20026 #include <stdio.h>
20027 int main() {
20028   int64_t q = 12345678901;
20029   printf("%" PRId64 "\n", q);
20030 }
20031 EOCP
20032         set try
20033         if eval $compile; then
20034                 yyy=`$run ./try`
20035                 case "$yyy" in
20036                 12345678901)
20037                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20038                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20039                         echo "We will use the C9X style."
20040                         ;;
20041                 esac
20042         fi
20043 fi
20044
20045 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20046         $cat >try.c <<EOCP
20047 #include <sys/types.h>
20048 #include <stdio.h>
20049 int main() {
20050   $quadtype q = 12345678901;
20051   printf("%Ld\n", q);
20052 }
20053 EOCP
20054         set try
20055         if eval $compile; then
20056                 yyy=`$run ./try`
20057                 case "$yyy" in
20058                 12345678901)
20059                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20060                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20061                         echo "We will use %Ld."
20062                         ;;
20063                 esac
20064         fi
20065 fi
20066
20067 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20068         $cat >try.c <<'EOCP'
20069 #include <sys/types.h>
20070 #include <stdio.h>
20071 int main() {
20072   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20073   printf("%lld\n", q);
20074 }
20075 EOCP
20076         set try
20077         if eval $compile; then
20078                 yyy=`$run ./try`
20079                 case "$yyy" in
20080                 12345678901)
20081                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20082                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20083                         echo "We will use the %lld style."
20084                         ;;
20085                 esac
20086         fi
20087 fi
20088
20089 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20090         $cat >try.c <<EOCP
20091 #include <sys/types.h>
20092 #include <stdio.h>
20093 int main() {
20094   $quadtype q = 12345678901;
20095   printf("%qd\n", q);
20096 }
20097 EOCP
20098         set try
20099         if eval $compile; then
20100                 yyy=`$run ./try`
20101                 case "$yyy" in
20102                 12345678901)
20103                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20104                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20105                         echo "We will use %qd."
20106                         ;;
20107                 esac
20108         fi
20109 fi
20110
20111 if $test X"$sPRId64" = X; then
20112         echo "Cannot figure out how to print 64-bit integers." >&4
20113 fi
20114 $rm_try
20115
20116 fi
20117
20118 case "$sPRId64" in
20119 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20120         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20121         ;;
20122 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20123         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20124         ;;
20125 esac
20126
20127 : Check format strings for internal types
20128 echo " "
20129 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20130
20131 if $test X"$ivsize" = X8; then
20132         ivdformat="$sPRId64"
20133         uvuformat="$sPRIu64"
20134         uvoformat="$sPRIo64"
20135         uvxformat="$sPRIx64"
20136         uvXUformat="$sPRIXU64"
20137 else
20138         if $test X"$ivsize" = X"$longsize"; then
20139                 ivdformat='"ld"'
20140                 uvuformat='"lu"'
20141                 uvoformat='"lo"'
20142                 uvxformat='"lx"'
20143                 uvXUformat='"lX"'
20144         else
20145                 if $test X"$ivsize" = X"$intsize"; then
20146                         ivdformat='"d"'
20147                         uvuformat='"u"'
20148                         uvoformat='"o"'
20149                         uvxformat='"x"'
20150                         uvXUformat='"X"'
20151                 else
20152                         : far out
20153                         if $test X"$ivsize" = X"$shortsize"; then
20154                                 ivdformat='"hd"'
20155                                 uvuformat='"hu"'
20156                                 uvoformat='"ho"'
20157                                 uvxformat='"hx"'
20158                                 uvXUformat='"hX"'
20159                         fi
20160                 fi
20161         fi
20162 fi
20163
20164 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20165         nveformat="$sPRIeldbl"
20166         nvfformat="$sPRIfldbl"
20167         nvgformat="$sPRIgldbl"
20168         nvEUformat="$sPRIEUldbl"
20169         nvFUformat="$sPRIFUldbl"
20170         nvGUformat="$sPRIGUldbl"
20171 else
20172         nveformat='"e"'
20173         nvfformat='"f"'
20174         nvgformat='"g"'
20175         nvEUformat='"E"'
20176         nvFUformat='"F"'
20177         nvGUformat='"G"'
20178 fi
20179
20180 case "$ivdformat" in
20181 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20182     exit 1
20183     ;;
20184 esac
20185
20186 : Check format string for GID
20187
20188 echo " "
20189 $echo "Checking the format string to be used for gids..." >&4
20190
20191 case "$gidsign" in
20192 -1)     if $test X"$gidsize" = X"$ivsize"; then
20193                 gidformat="$ivdformat"
20194         else
20195                 if $test X"$gidsize" = X"$longsize"; then
20196                         gidformat='"ld"'
20197                 else
20198                         if $test X"$gidsize" = X"$intsize"; then
20199                                 gidformat='"d"'
20200                         else
20201                                 if $test X"$gidsize" = X"$shortsize"; then
20202                                         gidformat='"hd"'
20203                                 fi
20204                         fi
20205                 fi
20206         fi
20207         ;;
20208 *)      if $test X"$gidsize" = X"$uvsize"; then
20209                 gidformat="$uvuformat"
20210         else
20211                 if $test X"$gidsize" = X"$longsize"; then
20212                         gidformat='"lu"'
20213                 else
20214                         if $test X"$gidsize" = X"$intsize"; then
20215                                 gidformat='"u"'
20216                         else
20217                                 if $test X"$gidsize" = X"$shortsize"; then
20218                                         gidformat='"hu"'
20219                                 fi
20220                         fi
20221                 fi
20222         fi
20223         ;;
20224 esac
20225
20226 : see if getgroups exists
20227 set getgroups d_getgrps
20228 eval $inlibc
20229
20230 : see if setgroups exists
20231 set setgroups d_setgrps
20232 eval $inlibc
20233
20234 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20235 echo " "
20236 case "$d_getgrps$d_setgrps" in
20237 *define*)
20238         case "$groupstype" in
20239         '') dflt="$gidtype" ;;
20240         *)  dflt="$groupstype" ;;
20241         esac
20242         $cat <<EOM
20243 What type of pointer is the second argument to getgroups() and setgroups()?
20244 Usually this is the same as group ids, $gidtype, but not always.
20245
20246 EOM
20247         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20248         . ./myread
20249         groupstype="$ans"
20250         ;;
20251 *)  groupstype="$gidtype";;
20252 esac
20253
20254 : MAD = Misc Attribute Definition
20255
20256 if $test $patchlevel -lt 9; then
20257 : MAD is not available in 5.8.x or earlier.
20258     ans=n;
20259 else
20260     case "$mad" in
20261     $define|true|[yY]*) dflt='y' ;;
20262     *)                  dflt='n' ;;
20263     esac
20264     cat <<EOM
20265
20266 Would you like to build with Misc Attribute Decoration? This is development
20267 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20268 overhead on the interpreter.
20269
20270 If this doesn't make any sense to you, just accept the default '$dflt'.
20271 EOM
20272     rp='Build Perl with MAD?'
20273     . ./myread
20274 fi
20275 case "$ans" in
20276 y|Y)    val="$define"
20277         madlyh='madly.h madly.act madly.tab'
20278         madlysrc='madly.c'
20279         madlyobj="madly$_o" ;;
20280 *)      val="$undef"
20281         madlyh=''
20282         madlysrc=''
20283         madlyobj='' ;;
20284 esac
20285 set mad
20286 eval $setvar
20287
20288 : check whether make sets MAKE
20289 echo " "
20290 echo "Checking if your $make program sets \$(MAKE)..." >&4
20291 case "$make_set_make" in
20292 '')
20293         $sed 's/^X //' > testmake.mak << 'EOF'
20294 Xall:
20295 X       @echo 'maketemp="$(MAKE)"'
20296 EOF
20297         case "`$make -f testmake.mak 2>/dev/null`" in
20298         *maketemp=*) make_set_make='#' ;;
20299         *)      make_set_make="MAKE=$make" ;;
20300         esac
20301         $rm -f testmake.mak
20302         ;;
20303 esac
20304 case "$make_set_make" in
20305 '#') echo "Yup, it does.";;
20306 *) echo "Nope, it doesn't.";;
20307 esac
20308
20309 : see what type is used for mode_t
20310 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20311 set mode_t modetype int stdio.h sys/types.h
20312 eval $typedef_ask
20313
20314 : see if we need va_copy
20315 echo " "
20316 case "$i_stdarg" in
20317 "$define")
20318         $cat >try.c <<EOCP
20319 #include <stdarg.h>
20320 #include <stdio.h>
20321 #$i_stdlib I_STDLIB
20322 #ifdef I_STDLIB
20323 #include <stdlib.h>
20324 #endif
20325 #include <signal.h>
20326
20327 int
20328 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20329 {
20330   return vfprintf(f, fmt, *valp);
20331 }
20332
20333 int
20334 myvfprintf(FILE *f, const  char *fmt, va_list val)
20335 {
20336   return ivfprintf(f, fmt, &val);
20337 }
20338
20339 int
20340 myprintf(char *fmt, ...)
20341 {
20342   va_list val;
20343   va_start(val, fmt);
20344   return myvfprintf(stdout, fmt, val);
20345 }
20346
20347 int
20348 main(int ac, char **av)
20349 {
20350   signal(SIGSEGV, exit);
20351
20352   myprintf("%s%cs all right, then\n", "that", '\'');
20353   exit(0);
20354 }
20355 EOCP
20356         set try
20357         if eval $compile && $run ./try 2>&1 >/dev/null; then
20358                 case "`$run ./try`" in
20359                 "that's all right, then")
20360                         okay=yes
20361                         ;;
20362                 esac
20363         fi
20364         case "$okay" in
20365         yes)    echo "It seems that you don't need va_copy()." >&4
20366                 need_va_copy="$undef"
20367                 ;;
20368         *)      echo "It seems that va_copy() or similar will be needed." >&4
20369                 need_va_copy="$define"
20370                 ;;
20371         esac
20372         $rm_try
20373         ;;
20374 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20375         need_va_copy="$undef"
20376         ;;
20377 esac
20378
20379 : see what type is used for size_t
20380 rp="What is the type used for the length parameter for string functions?"
20381 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20382 eval $typedef_ask
20383
20384 : check for type of arguments to gethostbyaddr. 
20385 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20386         case "$d_gethbyaddr" in
20387         $define)
20388                 $cat <<EOM
20389
20390 Checking to see what type of arguments are accepted by gethostbyaddr().
20391 EOM
20392                 hdrs="$define sys/types.h
20393                         $d_socket sys/socket.h 
20394                         $i_niin netinet/in.h 
20395                         $i_netdb netdb.h
20396                         $i_unistd unistd.h"
20397                 : The first arg can 'char *' or 'void *'
20398                 : The second arg is some of integral type
20399                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20400                         for yyy in size_t long int; do
20401                                 case "$netdb_host_type" in
20402                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20403                                         if ./protochk "$try" $hdrs; then
20404                                                 echo "Your system accepts $xxx for the first arg."
20405                                                 echo "...and $yyy for the second arg."
20406                                                 netdb_host_type="$xxx"
20407                                                 netdb_hlen_type="$yyy"
20408                                         fi
20409                                         ;;
20410                                 esac
20411                         done
20412                 done
20413                 : In case none of those worked, prompt the user.
20414                 case "$netdb_host_type" in
20415                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20416                         dflt='char *'
20417                         . ./myread
20418                         netdb_host_type=$ans
20419                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20420                         dflt="$sizetype"
20421                         . ./myread
20422                         netdb_hlen_type=$ans
20423                         ;;
20424                 esac
20425                 ;;
20426         *)      : no gethostbyaddr, so pick harmless defaults
20427                 netdb_host_type='char *'
20428                 netdb_hlen_type="$sizetype"
20429                 ;;
20430         esac
20431         # Remove the "const" if needed. -- but then we'll have a 
20432         # prototype clash!
20433         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20434 fi
20435
20436 : check for type of argument to gethostbyname. 
20437 if test "X$netdb_name_type" = X ; then
20438         case "$d_gethbyname" in
20439         $define)
20440                 $cat <<EOM
20441
20442 Checking to see what type of argument is accepted by gethostbyname().
20443 EOM
20444                 hdrs="$define sys/types.h
20445                         $d_socket sys/socket.h 
20446                         $i_niin netinet/in.h 
20447                         $i_netdb netdb.h
20448                         $i_unistd unistd.h"
20449                 for xxx in "const char *" "char *"; do
20450                         case "$netdb_name_type" in
20451                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20452                                 if ./protochk "$try" $hdrs; then
20453                                         echo "Your system accepts $xxx."
20454                                         netdb_name_type="$xxx"
20455                                 fi
20456                                 ;;
20457                         esac
20458                 done
20459                 : In case none of those worked, prompt the user.
20460                 case "$netdb_name_type" in
20461                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20462                         dflt='char *'
20463                         . ./myread
20464                         netdb_name_type=$ans
20465                         ;;
20466                 esac
20467                 ;;
20468         *)      : no gethostbyname, so pick harmless default
20469                 netdb_name_type='char *'
20470                 ;;
20471         esac
20472 fi
20473
20474 : check for type of 1st argument to getnetbyaddr. 
20475 if test "X$netdb_net_type" = X ; then
20476         case "$d_getnbyaddr" in
20477         $define)
20478                 $cat <<EOM
20479
20480 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20481 EOM
20482                 hdrs="$define sys/types.h
20483                         $d_socket sys/socket.h 
20484                         $i_niin netinet/in.h 
20485                         $i_netdb netdb.h
20486                         $i_unistd unistd.h"
20487                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20488                         case "$netdb_net_type" in
20489                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20490                                 if ./protochk "$try" $hdrs; then
20491                                         echo "Your system accepts $xxx."
20492                                         netdb_net_type="$xxx"
20493                                 fi
20494                                 ;;
20495                         esac
20496                 done
20497                 : In case none of those worked, prompt the user.
20498                 case "$netdb_net_type" in
20499                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20500                         dflt='long'
20501                         . ./myread
20502                         netdb_net_type=$ans
20503                         ;;
20504                 esac
20505                 ;;
20506         *)      : no getnetbyaddr, so pick harmless default
20507                 netdb_net_type='long'
20508                 ;;
20509         esac
20510 fi
20511 : locate the preferred pager for this system
20512 fn=f/
20513 case "$pager" in
20514 '')
20515         dflt=''
20516         case "$pg" in
20517         /*) dflt=$pg;;
20518         [a-zA-Z]:/*) dflt=$pg;;
20519         esac
20520         case "$more" in
20521         /*) dflt=$more;;
20522         [a-zA-Z]:/*) dflt=$more;;
20523         esac
20524         case "$less" in
20525         /*) dflt=$less;;
20526         [a-zA-Z]:/*) dflt=$less;;
20527         esac
20528         case "$dflt" in
20529         '') dflt=/usr/ucb/more;;
20530         esac
20531         ;;
20532 *)      dflt="$pager"
20533         ;;
20534 esac
20535 fn="f/($dflt)"
20536 echo " "
20537 rp='What pager is used on your system?'
20538 . ./getfile
20539 pager="$ans"
20540
20541 : see what type pids are declared as in the kernel
20542 rp="What is the type of process ids on this system?"
20543 set pid_t pidtype int stdio.h sys/types.h
20544 eval $typedef_ask
20545
20546 : see if ar generates random libraries by itself
20547 echo " "
20548 echo "Checking how to generate random libraries on your machine..." >&4
20549 echo 'int bar1() { return bar2(); }' > bar1.c
20550 echo 'int bar2() { return 2; }' > bar2.c
20551 $cat > foo.c <<EOP
20552 #$i_stdlib I_STDLIB
20553 #ifdef I_STDLIB
20554 #include <stdlib.h>
20555 #endif
20556 int main() { printf("%d\n", bar1()); exit(0); }
20557 EOP
20558 $cc $ccflags -c bar1.c >/dev/null 2>&1
20559 $cc $ccflags -c bar2.c >/dev/null 2>&1
20560 $cc $ccflags -c foo.c >/dev/null 2>&1
20561 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20562 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20563         $run ./foobar >/dev/null 2>&1; then
20564         echo "$ar appears to generate random libraries itself."
20565         orderlib=false
20566         if [ "X$ranlib" = "X" ]; then
20567             ranlib=":"
20568         fi
20569 elif $ar s bar$_a >/dev/null 2>&1 &&
20570         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20571         $run ./foobar >/dev/null 2>&1; then
20572                 echo "a table of contents needs to be added with '$ar s'."
20573                 orderlib=false
20574                 ranlib="$ar s"
20575 elif $ar ts bar$_a >/dev/null 2>&1 &&
20576         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20577         $run ./foobar >/dev/null 2>&1; then
20578                 echo "a table of contents needs to be added with '$ar ts'."
20579                 orderlib=false
20580                 ranlib="$ar ts"
20581 else
20582         case "$ranlib" in
20583         :) ranlib='';;
20584         '')
20585                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20586                 $test -f $ranlib || ranlib=''
20587                 ;;
20588         esac
20589         if $test -n "$ranlib"; then
20590                 echo "your system has '$ranlib'; we'll use that."
20591                 orderlib=false
20592         else
20593                 echo "your system doesn't seem to support random libraries"
20594                 echo "so we'll use lorder and tsort to order the libraries."
20595                 orderlib=true
20596                 ranlib=":"
20597         fi
20598 fi
20599 $rm -f foo* bar*
20600
20601 : see if this is a values.h system
20602 set values.h i_values
20603 eval $inhdr
20604
20605 : Check the max offset that gmtime and localtime accept
20606 echo "Checking max offsets that gmtime () accepts"
20607
20608 case $i_values in
20609     define) yyy="#include <values.h>" ;;
20610     *)      yyy="" ;;
20611     esac
20612
20613 case "$sGMTIME_min/$sGMTIME_max" in
20614     0/0|/)
20615         $cat >try.c <<EOCP
20616 #include <sys/types.h>
20617 #include <stdio.h>
20618 #include <time.h>
20619 $yyy
20620
20621 int i;
20622 struct tm *tmp;
20623 time_t pt;
20624
20625 void gm_check (time_t t, int min_year, int max_year)
20626 {
20627     tmp = gmtime (&t);
20628     if ( tmp == NULL ||
20629         /* Check tm_year overflow */
20630          tmp->tm_year < min_year || tmp->tm_year > max_year)
20631         tmp = NULL;
20632     else
20633         pt = t;
20634     } /* gm_check */
20635
20636 int check_max ()
20637 {
20638     tmp = NULL;
20639     pt  = 0;
20640 #ifdef MAXLONG
20641     gm_check (MAXLONG, 69, 0x7fffffff);
20642 #endif
20643     if (tmp == NULL || tmp->tm_year < 0) {
20644         for (i = 63; i >= 0; i--) {
20645             time_t x = pt | ((time_t)1 << i);
20646             if (x < 0 || x < pt) continue;
20647             gm_check (x, 69, 0x7fffffff);
20648             }
20649         }
20650     printf ("sGMTIME_max=%ld\n", pt);
20651     return (0);
20652     } /* check_max */
20653
20654 int check_min ()
20655 {
20656     tmp = NULL;
20657     pt  = 0;
20658 #ifdef MINLONG
20659     gm_check (MINLONG, -1900, 70);
20660 #endif
20661     if (tmp == NULL) {
20662         for (i = 36; i >= 0; i--) {
20663             time_t x = pt - ((time_t)1 << i);
20664             if (x > 0) continue;
20665             gm_check (x, -1900, 70);
20666             }
20667         }
20668     printf ("sGMTIME_min=%ld\n", pt);
20669     return (0);
20670     } /* check_min */
20671
20672 int main (int argc, char *argv[])
20673 {
20674     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20675     check_max ();
20676     check_min ();
20677     return (0);
20678     } /* main */
20679 EOCP
20680         set try
20681         if eval $compile; then
20682             eval `$run ./try`
20683         else
20684             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20685             fi
20686         $rm_try
20687         ;;
20688     esac
20689
20690 echo "Checking max offsets that localtime () accepts"
20691
20692 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20693     0/0|/)
20694         $cat >try.c <<EOCP
20695 #include <sys/types.h>
20696 #include <stdio.h>
20697 #include <time.h>
20698 $yyy
20699
20700 int i;
20701 struct tm *tmp;
20702 time_t pt;
20703
20704 void local_check (time_t t, int min_year, int max_year)
20705 {
20706     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20707         tmp = NULL;
20708     else
20709         tmp = localtime (&t);
20710     if ( tmp == NULL ||
20711         /* Check tm_year overflow */
20712          tmp->tm_year < min_year || tmp->tm_year > max_year)
20713         tmp = NULL;
20714     else
20715         pt = t;
20716     } /* local_check */
20717
20718 int check_max ()
20719 {
20720     tmp = NULL;
20721     pt  = 0;
20722 #ifdef MAXLONG
20723     local_check (MAXLONG, 69, 0x7fffffff);
20724 #endif
20725     if (tmp == NULL || tmp->tm_year < 0) {
20726         for (i = 63; i >= 0; i--) {
20727             time_t x = pt | ((time_t)1 << i);
20728             if (x < 0 || x < pt) continue;
20729             local_check (x, 69, 0x7fffffff);
20730             }
20731         }
20732     printf ("sLOCALTIME_max=%ld\n", pt);
20733     return (0);
20734    } /* check_max */
20735
20736 int check_min ()
20737 {
20738     tmp = NULL;
20739     pt  = 0;
20740 #ifdef MINLONG
20741     local_check (MINLONG, -1900, 70);
20742 #endif
20743     if (tmp == NULL) {
20744         for (i = 36; i >= 0; i--) {
20745             time_t x = pt - ((time_t)1 << i);
20746             if (x > 0) continue;
20747             local_check (x, -1900, 70);
20748             }
20749         }
20750     printf ("sLOCALTIME_min=%ld\n", pt);
20751     return (0);
20752     } /* check_min */
20753
20754 int main (int argc, char *argv[])
20755 {
20756     check_max ();
20757     check_min ();
20758     return (0);
20759     } /* main */
20760 EOCP
20761         set try
20762         if eval $compile; then
20763             eval `$run ./try`
20764         else
20765             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20766             fi
20767         $rm_try
20768         ;;
20769     esac
20770
20771 : check for type of arguments to select.
20772 case "$selecttype" in
20773 '') case "$d_select" in
20774         $define)
20775                 echo " "
20776                 $cat <<EOM
20777 Checking to see what type of arguments are accepted by select().
20778 EOM
20779                 hdrs="$define sys/types.h
20780                         $i_systime sys/time.h
20781                         $i_sysselct sys/select.h
20782                         $d_socket sys/socket.h"
20783                 : The first arg can be int, unsigned, or size_t
20784                 : The last arg may or may not be 'const'
20785                 val=''
20786                 : void pointer has been seen but using that
20787                 : breaks the selectminbits test
20788                 for xxx in 'fd_set *' 'int *'; do
20789                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20790                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20791                                         case "$val" in
20792                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20793                                                 if ./protochk "$try" $hdrs; then
20794                                                         echo "Your system accepts $xxx."
20795                                                         val="$xxx"
20796                                                 fi
20797                                                 ;;
20798                                         esac
20799                                 done
20800                         done
20801                 done
20802                 case "$val" in
20803                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20804                         case "$d_fd_set" in
20805                                 $define) dflt="fd_set *" ;;
20806                                 *)              dflt="int *" ;;
20807                         esac
20808                         . ./myread
20809                         val=$ans
20810                         ;;
20811                 esac
20812                 selecttype="$val"
20813                 ;;
20814         *)      : no select, so pick a harmless default
20815                 selecttype='int *'
20816                 ;;
20817         esac
20818         ;;
20819 esac
20820
20821 : check for the select 'width'
20822 case "$selectminbits" in
20823 '') safebits=`expr $ptrsize \* 8`
20824     case "$d_select" in
20825         $define)
20826                 $cat <<EOM
20827
20828 Checking to see on how many bits at a time your select() operates...
20829 EOM
20830                 $cat >try.c <<EOCP
20831 #include <sys/types.h>
20832 #$i_time I_TIME
20833 #$i_systime I_SYS_TIME
20834 #$i_systimek I_SYS_TIME_KERNEL
20835 #ifdef I_TIME
20836 #   include <time.h>
20837 #endif
20838 #ifdef I_SYS_TIME
20839 #   ifdef I_SYS_TIME_KERNEL
20840 #       define KERNEL
20841 #   endif
20842 #   include <sys/time.h>
20843 #   ifdef I_SYS_TIME_KERNEL
20844 #       undef KERNEL
20845 #   endif
20846 #endif
20847 #$i_sysselct I_SYS_SELECT
20848 #ifdef I_SYS_SELECT
20849 #include <sys/select.h>
20850 #endif
20851 #$d_socket HAS_SOCKET
20852 #ifdef HAS_SOCKET
20853 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20854 #endif
20855 #include <stdio.h>
20856 #$i_stdlib I_STDLIB
20857 #ifdef I_STDLIB
20858 #include <stdlib.h>
20859 #endif
20860 $selecttype b;
20861 #define S sizeof(*(b))
20862 #define MINBITS 64
20863 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20864 #define NBITS  (NBYTES * 8)
20865 int main() {
20866     char *s = (char *)malloc(NBYTES);
20867     struct timeval t;
20868     int i;
20869     FILE* fp;
20870     int fd;
20871
20872     if (!s)
20873         exit(1);
20874     fclose(stdin);
20875     fp = fopen("try.c", "r");
20876     if (fp == 0)
20877       exit(2);
20878     fd = fileno(fp);
20879     if (fd < 0)
20880       exit(3);
20881     b = ($selecttype)s;
20882     for (i = 0; i < NBITS; i++)
20883         FD_SET(i, b);
20884     t.tv_sec  = 0;
20885     t.tv_usec = 0;
20886     select(fd + 1, b, 0, 0, &t);
20887     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20888     free(s);
20889     printf("%d\n", i + 1);
20890     return 0;
20891 }
20892 EOCP
20893                 set try
20894                 if eval $compile_ok; then
20895                         selectminbits=`$run ./try`
20896                         case "$selectminbits" in
20897                         '')     cat >&4 <<EOM
20898 Cannot figure out on how many bits at a time your select() operates.
20899 I'll play safe and guess it is $safebits bits.
20900 EOM
20901                                 selectminbits=$safebits
20902                                 bits="$safebits bits"
20903                                 ;;
20904                         1)      bits="1 bit" ;;
20905                         *)      bits="$selectminbits bits" ;;
20906                         esac
20907                         echo "Your select() operates on $bits at a time." >&4
20908                 else
20909                         rp='What is the minimum number of bits your select() operates on?'
20910                         case "$byteorder" in
20911                         12345678)       dflt=64 ;;
20912                         1234)           dflt=32 ;;
20913                         *)              dflt=1  ;;
20914                         esac
20915                         . ./myread
20916                         val=$ans
20917                         selectminbits="$val"
20918                 fi
20919                 $rm_try
20920                 ;;
20921         *)      : no select, so pick a harmless default
20922                 selectminbits=$safebits
20923                 ;;
20924         esac
20925         ;;
20926 esac
20927
20928 : Trace out the files included by signal.h, then look for SIGxxx names.
20929 if [ "X$fieldn" = X ]; then
20930         : Just make some guesses.  We check them later.
20931         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20932 else
20933         xxx=`echo '#include <signal.h>' |
20934         $cppstdin $cppminus $cppflags 2>/dev/null |
20935         $grep '^[       ]*#.*include' |
20936         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20937                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20938 fi
20939 xxxfiles=''
20940 for xx in $xxx /dev/null ; do
20941         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20942 done
20943 case "$xxxfiles" in
20944 '')     xxxfiles=`./findhdr signal.h` ;;
20945 esac
20946 xxx=`awk '
20947 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20948         print substr($2, 4, 20)
20949 }
20950 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20951         print substr($3, 4, 20)
20952 }' $xxxfiles`
20953 : Append some common names just in case the awk scan failed.
20954 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20955 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20956 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20957 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20958 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20959
20960 : generate a few handy files for later
20961 $cat > signal.c <<EOCP
20962 #include <sys/types.h>
20963 #include <signal.h>
20964 #$i_stdlib I_STDLIB
20965 #ifdef I_STDLIB
20966 #include <stdlib.h>
20967 #endif
20968 #include <stdio.h>
20969 int main() {
20970
20971 /* Strange style to avoid deeply-nested #if/#else/#endif */
20972 #ifndef NSIG
20973 #  ifdef _NSIG
20974 #    define NSIG (_NSIG)
20975 #  endif
20976 #endif
20977
20978 #ifndef NSIG
20979 #  ifdef SIGMAX
20980 #    define NSIG (SIGMAX+1)
20981 #  endif
20982 #endif
20983
20984 #ifndef NSIG
20985 #  ifdef SIG_MAX
20986 #    define NSIG (SIG_MAX+1)
20987 #  endif
20988 #endif
20989
20990 #ifndef NSIG
20991 #  ifdef _SIG_MAX
20992 #    define NSIG (_SIG_MAX+1)
20993 #  endif
20994 #endif
20995
20996 #ifndef NSIG
20997 #  ifdef MAXSIG
20998 #    define NSIG (MAXSIG+1)
20999 #  endif
21000 #endif
21001
21002 #ifndef NSIG
21003 #  ifdef MAX_SIG
21004 #    define NSIG (MAX_SIG+1)
21005 #  endif
21006 #endif
21007
21008 #ifndef NSIG
21009 #  ifdef SIGARRAYSIZE
21010 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21011 #  endif
21012 #endif
21013
21014 #ifndef NSIG
21015 #  ifdef _sys_nsig
21016 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21017 #  endif
21018 #endif
21019
21020 /* Default to some arbitrary number that's big enough to get most
21021    of the common signals.
21022 */
21023 #ifndef NSIG
21024 #    define NSIG 50
21025 #endif
21026
21027 printf("NSIG %d\n", NSIG);
21028
21029 #ifndef JUST_NSIG
21030
21031 EOCP
21032
21033 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21034 {
21035         printf "#ifdef SIG"; printf $1; printf "\n"
21036         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21037         printf $1; printf ");\n"
21038         printf "#endif\n"
21039 }
21040 END {
21041         printf "#endif /* JUST_NSIG */\n";
21042         printf "exit(0);\n}\n";
21043 }
21044 ' >>signal.c
21045 $cat >signal.awk <<'EOP'
21046 BEGIN { ndups = 0 }
21047 $1 ~ /^NSIG$/ { nsig = $2 }
21048 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21049     if ($2 > maxsig) { maxsig = $2 }
21050     if (sig_name[$2]) {
21051         dup_name[ndups] = $1
21052         dup_num[ndups] = $2
21053         ndups++
21054     }
21055     else {
21056         sig_name[$2] = $1
21057         sig_num[$2] = $2
21058     }
21059 }
21060 END {
21061     if (nsig == 0) {
21062         nsig = maxsig + 1
21063     }
21064     printf("NSIG %d\n", nsig);
21065     for (n = 1; n < nsig; n++) {
21066         if (sig_name[n]) {
21067             printf("%s %d\n", sig_name[n], sig_num[n])
21068         }
21069         else {
21070             printf("NUM%d %d\n", n, n)
21071         }
21072     }
21073     for (n = 0; n < ndups; n++) {
21074         printf("%s %d\n", dup_name[n], dup_num[n])
21075     }
21076 }
21077 EOP
21078 $cat >signal_cmd <<EOS
21079 $startsh
21080 if $test -s signal.lst; then
21081     echo "Using your existing signal.lst file"
21082         exit 0
21083 fi
21084 xxx="$xxx"
21085 EOS
21086 $cat >>signal_cmd <<'EOS'
21087
21088 set signal
21089 if eval $compile_ok; then
21090         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21091                 $uniq | $awk -f signal.awk >signal.lst
21092 else
21093         echo "(I can't seem be able to compile the whole test program)" >&4
21094         echo "(I'll try it in little pieces.)" >&4
21095         set signal -DJUST_NSIG
21096         if eval $compile_ok; then
21097                 $run ./signal$_exe > signal.nsg
21098                 $cat signal.nsg
21099         else
21100                 echo "I can't seem to figure out how many signals you have." >&4
21101                 echo "Guessing 50." >&4
21102                 echo 'NSIG 50' > signal.nsg
21103         fi
21104         : Now look at all the signal names, one at a time.
21105         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21106                 $cat > signal.c <<EOCP
21107 #include <sys/types.h>
21108 #include <signal.h>
21109 #include <stdio.h>
21110 int main() {
21111 printf("$xx %d\n", SIG${xx});
21112 return 0;
21113 }
21114 EOCP
21115                 set signal
21116                 if eval $compile; then
21117                         echo "SIG${xx} found."
21118                         $run ./signal$_exe  >> signal.ls1
21119                 else
21120                         echo "SIG${xx} NOT found."
21121                 fi
21122         done
21123         if $test -s signal.ls1; then
21124                 $cat signal.nsg signal.ls1 |
21125                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21126         fi
21127
21128 fi
21129 if $test -s signal.lst; then
21130         :
21131 else
21132         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21133         echo 'kill -l' >signal
21134         set X `csh -f <signal`
21135         $rm -f signal
21136         shift
21137         case $# in
21138         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21139         esac
21140         echo $@ | $tr ' ' $trnl | \
21141             $awk '{ printf "%s %d\n", $1, ++s; }
21142                   END { printf "NSIG %d\n", ++s }' >signal.lst
21143 fi
21144 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21145 EOS
21146 chmod a+x signal_cmd
21147 $eunicefix signal_cmd
21148
21149 : generate list of signal names
21150 echo " "
21151 case "$sig_name_init" in
21152 '') doinit=yes ;;
21153 *)  case "$sig_num_init" in
21154     ''|*,*) doinit=yes ;;
21155     esac ;;
21156 esac
21157 case "$doinit" in
21158 yes)
21159         echo "Generating a list of signal names and numbers..." >&4
21160         . ./signal_cmd
21161         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21162         sig_name=`$awk 'BEGIN { printf "ZERO " }
21163                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21164         sig_num=`$awk  'BEGIN { printf "0 " }
21165                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21166         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21167                              !/^NSIG/   { printf "\"%s\", ", $1 }
21168                              END        { printf "0\n" }' signal.lst`
21169         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21170                              !/^NSIG/   { printf "%d, ", $2}
21171                              END        { printf "0\n"}' signal.lst`
21172         ;;
21173 esac
21174 echo "The following $sig_count signals are available:"
21175 echo " "
21176 echo $sig_name | $awk \
21177 'BEGIN { linelen = 0 }
21178 {
21179         for (i = 1; i <= NF; i++) {
21180                 name = "SIG" $i " "
21181                 linelen = linelen + length(name)
21182                 if (linelen > 70) {
21183                         printf "\n"
21184                         linelen = length(name)
21185                 }
21186                 printf "%s", name
21187         }
21188         printf "\n"
21189 }'
21190 sig_size=`echo $sig_name | awk '{print NF}'`
21191 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21192
21193 : Check size of size
21194 echo " "
21195 case "$sizetype" in
21196 *_t) zzz="$sizetype"    ;;
21197 *)   zzz="filesize"     ;;
21198 esac
21199 echo "Checking the size of $zzz..." >&4
21200 cat > try.c <<EOCP
21201 #include <sys/types.h>
21202 #include <stdio.h>
21203 #$i_stdlib I_STDLIB
21204 #ifdef I_STDLIB
21205 #include <stdlib.h>
21206 #endif
21207 int main() {
21208     printf("%d\n", (int)sizeof($sizetype));
21209     exit(0);
21210 }
21211 EOCP
21212 set try
21213 if eval $compile_ok; then
21214         yyy=`$run ./try`
21215         case "$yyy" in
21216         '')     sizesize=4
21217                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21218                 ;;
21219         *)      sizesize=$yyy
21220                 echo "Your $zzz size is $sizesize bytes."
21221                 ;;
21222         esac
21223 else
21224         sizesize=4
21225         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21226 fi
21227
21228
21229 : check for socklen_t
21230 echo " "
21231 echo "Checking to see if you have socklen_t..." >&4
21232 $cat >try.c <<EOCP
21233 #include <sys/types.h>
21234 #$d_socket HAS_SOCKET
21235 #ifdef HAS_SOCKET
21236 #include <sys/socket.h>
21237 #endif
21238 int main() { socklen_t x = 16; }
21239 EOCP
21240 set try
21241 if eval $compile; then
21242         val="$define"
21243         echo "You have socklen_t."
21244 else
21245         val="$undef"
21246         echo "You do not have socklen_t."
21247         case "$sizetype" in
21248         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21249         esac
21250 fi
21251 $rm_try
21252 set d_socklen_t
21253 eval $setvar
21254
21255 : see if this is a socks.h system
21256 set socks.h i_socks
21257 eval $inhdr
21258
21259 : check for type of the size argument to socket calls
21260 case "$d_socket" in
21261 "$define")
21262         $cat <<EOM
21263
21264 Checking to see what type is the last argument of accept().
21265 EOM
21266         yyy=''
21267         case "$d_socklen_t" in
21268         "$define") yyy="$yyy socklen_t"
21269         esac
21270         yyy="$yyy $sizetype int long unsigned"
21271         for xxx in $yyy; do
21272                 case "$socksizetype" in
21273                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21274                         case "$usesocks" in
21275                         "$define")
21276                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21277                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21278                                         socksizetype="$xxx"
21279                                 fi
21280                                 ;;
21281                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21282                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21283                                         socksizetype="$xxx"
21284                                 fi
21285                                 ;;
21286                         esac
21287                         ;;
21288                 esac
21289         done
21290 : In case none of those worked, prompt the user.
21291         case "$socksizetype" in
21292         '')     rp='What is the type for socket address structure sizes?'
21293                 dflt='int'
21294                 . ./myread
21295                 socksizetype=$ans
21296                 ;;
21297         esac
21298         ;;
21299 *)      : no sockets, so pick relatively harmless default
21300         socksizetype='int'
21301         ;;
21302 esac
21303
21304 : see what type is used for signed size_t
21305 set ssize_t ssizetype int stdio.h sys/types.h
21306 eval $typedef
21307 dflt="$ssizetype"
21308 $cat > try.c <<EOM
21309 #include <stdio.h>
21310 #$i_stdlib I_STDLIB
21311 #ifdef I_STDLIB
21312 #include <stdlib.h>
21313 #endif
21314 #include <sys/types.h>
21315 #define Size_t $sizetype
21316 #define SSize_t $dflt
21317 int main()
21318 {
21319         if (sizeof(Size_t) == sizeof(SSize_t))
21320                 printf("$dflt\n");
21321         else if (sizeof(Size_t) == sizeof(int))
21322                 printf("int\n");
21323         else
21324                 printf("long\n");
21325         exit(0);
21326 }
21327 EOM
21328 echo " "
21329 set try
21330 if eval $compile_ok && $run ./try > /dev/null; then
21331         ssizetype=`$run ./try`
21332         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21333 else
21334         $cat >&4 <<EOM
21335 Help! I can't compile and run the ssize_t test program: please enlighten me!
21336 (This is probably a misconfiguration in your system or libraries, and
21337 you really ought to fix it.  Still, I'll try anyway.)
21338
21339 I need a type that is the same size as $sizetype, but is guaranteed to
21340 be signed.  Common values are ssize_t, int and long.
21341
21342 EOM
21343         rp="What signed type is the same size as $sizetype?"
21344         . ./myread
21345         ssizetype="$ans"
21346 fi
21347 $rm_try
21348
21349 : Check the size of st_ino
21350 $echo " "
21351 $echo "Checking the size of st_ino..." >&4
21352 $cat > try.c <<EOCP
21353 #include <sys/stat.h>
21354 #include <stdio.h>
21355 #$i_stdlib I_STDLIB
21356 #ifdef I_STDLIB
21357 #include <stdlib.h>
21358 #endif
21359 int main() {
21360     struct stat st;
21361     printf("%d\n", (int)sizeof(st.st_ino));
21362     exit(0);
21363 }
21364 EOCP
21365 set try
21366 if eval $compile_ok; then
21367         val=`$run ./try`
21368         case "$val" in
21369         '')     st_ino_size=4
21370                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21371                 ;;
21372         *)      st_ino_size=$val
21373                 $echo "Your st_ino is $st_ino_size bytes long."
21374                 ;;
21375         esac
21376 else
21377         st_ino_size=4
21378         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21379 fi
21380 $rm_try
21381
21382 : Check if st_ino is signed
21383 $echo " "
21384 $echo "Checking the sign of st_ino..." >&4
21385 $cat > try.c <<EOCP
21386 #include <sys/stat.h>
21387 #include <stdio.h>
21388 int main() {
21389         struct stat foo;
21390         foo.st_ino = -1;
21391         if (foo.st_ino < 0)
21392                 printf("-1\n");
21393         else
21394                 printf("1\n");
21395 }
21396 EOCP
21397 set try
21398 if eval $compile; then
21399         val=`$run ./try`
21400         case "$val" in
21401         '')     st_ino_sign=1
21402                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21403                 ;;
21404         *)      st_ino_sign=$val
21405                 case "$st_ino_sign" in
21406                  1) $echo "Your st_ino is unsigned." ;;
21407                 -1) $echo "Your st_ino is signed."   ;;
21408                 esac
21409                 ;;
21410         esac
21411 else
21412         st_ino_sign=1
21413         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21414 fi
21415 $rm_try
21416
21417 : see what type of char stdio uses.
21418 echo " "
21419 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21420 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21421         echo "Your stdio uses unsigned chars." >&4
21422         stdchar="unsigned char"
21423 else
21424         echo "Your stdio uses signed chars." >&4
21425         stdchar="char"
21426 fi
21427 $rm -f stdioh
21428
21429 : see what type uids are declared as in the kernel
21430 echo " "
21431 echo "Looking for the type for user ids returned by getuid()."
21432 set uid_t uidtype xxx stdio.h sys/types.h
21433 eval $typedef
21434 case "$uidtype" in
21435 xxx)
21436         xxx=`./findhdr sys/user.h`
21437         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21438         case $1 in
21439         unsigned) dflt="$1 $2" ;;
21440         *) dflt="$1" ;;
21441         esac
21442         ;;
21443 *) dflt="$uidtype";;
21444 esac
21445 case "$uidtype" in
21446 uid_t)  echo "uid_t found." ;;
21447 *)      rp="What is the type for user ids returned by getuid()?"
21448         . ./myread
21449         uidtype="$ans"
21450         ;;
21451 esac
21452
21453 : Check size of UID
21454 echo " "
21455 case "$uidtype" in
21456 *_t) zzz="$uidtype"     ;;
21457 *)   zzz="uid"          ;;
21458 esac
21459 echo "Checking the size of $zzz..." >&4
21460 cat > try.c <<EOCP
21461 #include <sys/types.h>
21462 #include <stdio.h>
21463 #$i_stdlib I_STDLIB
21464 #ifdef I_STDLIB
21465 #include <stdlib.h>
21466 #endif
21467 int main() {
21468     printf("%d\n", (int)sizeof($uidtype));
21469     exit(0);
21470 }
21471 EOCP
21472 set try
21473 if eval $compile_ok; then
21474         yyy=`$run ./try`
21475         case "$yyy" in
21476         '')     uidsize=4
21477                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21478                 ;;
21479         *)      uidsize=$yyy
21480                 echo "Your $zzz is $uidsize bytes long."
21481                 ;;
21482         esac
21483 else
21484         uidsize=4
21485         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21486 fi
21487
21488 : Check if UID is signed
21489 echo " "
21490 case "$uidtype" in
21491 *_t) zzz="$uidtype"     ;;
21492 *)   zzz="uid"          ;;
21493 esac
21494 echo "Checking the sign of $zzz..." >&4
21495 cat > try.c <<EOCP
21496 #include <sys/types.h>
21497 #include <stdio.h>
21498 int main() {
21499         $uidtype foo = -1;
21500         if (foo < 0)
21501                 printf("-1\n");
21502         else
21503                 printf("1\n");
21504 }
21505 EOCP
21506 set try
21507 if eval $compile; then
21508         yyy=`$run ./try`
21509         case "$yyy" in
21510         '')     uidsign=1
21511                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21512                 ;;
21513         *)      uidsign=$yyy
21514                 case "$uidsign" in
21515                  1) echo "Your $zzz is unsigned." ;;
21516                 -1) echo "Your $zzz is signed."   ;;
21517                 esac
21518                 ;;
21519         esac
21520 else
21521         uidsign=1
21522         echo "(I can't compile the test program--guessing unsigned.)" >&4
21523 fi
21524
21525
21526 : Check format string for UID
21527 echo " "
21528 $echo "Checking the format string to be used for uids..." >&4
21529
21530 case "$uidsign" in
21531 -1)     if $test X"$uidsize" = X"$ivsize"; then
21532                 uidformat="$ivdformat"
21533         else
21534                 if $test X"$uidsize" = X"$longsize"; then
21535                         uidformat='"ld"'
21536                 else
21537                         if $test X"$uidsize" = X"$intsize"; then
21538                                 uidformat='"d"'
21539                         else
21540                                 if $test X"$uidsize" = X"$shortsize"; then
21541                                         uidformat='"hd"'
21542                                 fi
21543                         fi
21544                 fi
21545         fi
21546         ;;
21547 *)      if $test X"$uidsize" = X"$uvsize"; then
21548                 uidformat="$uvuformat"
21549         else
21550                 if $test X"$uidsize" = X"$longsize"; then
21551                         uidformat='"lu"'
21552                 else
21553                         if $test X"$uidsize" = X"$intsize"; then
21554                                 uidformat='"u"'
21555                         else
21556                                 if $test X"$uidsize" = X"$shortsize"; then
21557                                         uidformat='"hu"'
21558                                 fi
21559                         fi
21560                 fi
21561         fi
21562         ;;
21563 esac
21564
21565 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21566 echo " "
21567 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21568 $cat >try.c <<'EOM'
21569 /* Intentionally a long probe as I'd like to sanity check that the exact
21570    approach is going to work, as thinking it will work, but only having it
21571    part working at runtime is worse than not having it.  */
21572
21573 #include <sys/types.h>
21574 #include <sys/sysctl.h>
21575 #include <sys/param.h>
21576 #include <stdio.h>
21577 #include <string.h>
21578 #include <stdlib.h>
21579 #include <unistd.h>
21580
21581 int
21582 main(int argc, char **argv) {
21583     char *buffer;
21584     char *argv_leaf = strrchr(argv[0], '/');
21585     char *buffer_leaf;
21586     size_t size = 0;
21587     int mib[4];
21588
21589     mib[0] = CTL_KERN;
21590     mib[1] = KERN_PROC;
21591     mib[2] = KERN_PROC_PATHNAME;
21592     mib[3] = -1;
21593
21594     if (!argv_leaf) {
21595         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21596         return 1;
21597     }
21598
21599     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21600         perror("sysctl");
21601         return 2;
21602     }
21603
21604     if (size < strlen(argv_leaf) + 1) {
21605         fprintf(stderr, "size %lu is too short for a path\n",
21606                 (unsigned long) size);
21607         return 3;
21608     }
21609
21610     if (size > MAXPATHLEN * MAXPATHLEN) {
21611         fprintf(stderr, "size %lu is too long for a path\n",
21612                 (unsigned long) size);
21613         return 4;
21614     }
21615
21616     buffer = malloc(size);
21617     if (!buffer) {
21618         perror("malloc");
21619         return 5;
21620     }
21621
21622     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21623         perror("sysctl");
21624         return 6;
21625     }
21626
21627     if (strlen(buffer) + 1 != size) {
21628         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21629                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21630         return 7;
21631     }
21632
21633
21634     if (*buffer != '/') {
21635         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21636         return 8;
21637     }
21638
21639     if (strstr(buffer, "/./")) {
21640         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21641         return 9;
21642     }
21643
21644     if (strstr(buffer, "/../")) {
21645         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21646         return 10;
21647     }
21648
21649     buffer_leaf = strrchr(buffer, '/');
21650     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21651         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21652         return 11;
21653     }
21654
21655     free(buffer);
21656
21657     return 0;
21658 }
21659 EOM
21660
21661 val=$undef
21662 set try
21663 if eval $compile; then
21664         if $run ./try; then
21665                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21666                 val="$define"
21667         else
21668                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21669                 val="$undef"
21670         fi
21671 else
21672         echo "I'm unable to compile the test program." >&4
21673         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21674         val="$undef"
21675 fi
21676 $rm_try
21677 set usekernprocpathname
21678 eval $setvar
21679
21680 : Determine if we can use _NSGetExecutablePath to find executing program
21681 echo " "
21682 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21683 $cat >try.c <<'EOM'
21684 /* Intentionally a long probe as I'd like to sanity check that the exact
21685    approach is going to work, as thinking it will work, but only having it
21686    part working at runtime is worse than not having it.  */
21687 #include <mach-o/dyld.h>
21688 #include <stdio.h>
21689 #include <stdlib.h>
21690 #include <sys/param.h>
21691 #include <string.h>
21692
21693 int
21694 main(int argc, char **argv) {
21695     char buf[1];
21696     uint32_t size = sizeof(buf);
21697     int result;
21698     char *buffer;
21699     char *tidied;
21700     char *argv_leaf = strrchr(argv[0], '/');
21701     char *tidied_leaf;
21702
21703     if (!argv_leaf) {
21704         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21705         return 1;
21706     }
21707
21708     _NSGetExecutablePath(buf, &size);
21709     if (size > MAXPATHLEN * MAXPATHLEN) {
21710         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21711                 (unsigned int) size);
21712         return 2;
21713     }
21714
21715     buffer = malloc(size);
21716     if (!buffer) {
21717         perror("malloc");
21718         return 3;
21719     }
21720
21721     result = _NSGetExecutablePath(buffer, &size);
21722     if (result != 0) {
21723         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21724                 result, (unsigned int) size);
21725         return 4;
21726     }
21727
21728     tidied = realpath(buffer, NULL);
21729     if (!tidied) {
21730         perror("realpath");
21731         return 5;
21732     }
21733
21734     free(buffer);
21735
21736     if (*tidied != '/') {
21737         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21738         return 6;
21739     }
21740
21741     if (strstr(tidied, "/./")) {
21742         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21743         return 7;
21744     }
21745
21746     if (strstr(tidied, "/../")) {
21747         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21748         return 8;
21749     }
21750
21751     tidied_leaf = strrchr(tidied, '/');
21752     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21753         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21754         return 9;
21755     }
21756
21757     free(tidied);
21758
21759     return 0;
21760 }
21761 EOM
21762
21763 val=$undef
21764 set try
21765 if eval $compile; then
21766         if $run ./try; then
21767                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21768                 val="$define"
21769         else
21770                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21771         fi
21772 else
21773         echo "I'm unable to compile the test program." >&4
21774         echo "I'll assume no _NSGetExecutablePath here." >&4
21775 fi
21776 $rm_try
21777 set usensgetexecutablepath
21778 eval $setvar
21779
21780 : Check if site customization support was requested
21781 case "$usesitecustomize" in
21782     $define|true|[Yy]*)
21783         usesitecustomize="$define"
21784         ;;
21785     *)
21786         usesitecustomize="$undef"
21787         ;;
21788     esac
21789
21790 : see if prototypes support variable argument declarations
21791 echo " "
21792 case "$prototype$i_stdarg" in
21793 $define$define)
21794         echo "It appears we'll be able to prototype varargs functions." >&4
21795         val="$define"
21796         ;;
21797 *)
21798         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21799         val="$undef"
21800         ;;
21801 esac
21802 set vaproto
21803 eval $setvar
21804
21805 : determine compiler compiler
21806 case "$yacc" in
21807 '')
21808         dflt=yacc;;
21809 *)
21810         dflt="$yacc";;
21811 esac
21812 echo " "
21813 comp='yacc'
21814 if $test -f "$byacc$_exe"; then
21815         dflt="$byacc"
21816         comp="byacc or $comp"
21817 fi
21818 if $test -f "$bison$_exe"; then
21819         comp="$comp or bison -y"
21820 fi
21821 rp="Which compiler compiler ($comp) shall I use?"
21822 . ./myread
21823 yacc="$ans"
21824 case "$yacc" in
21825 *bis*)
21826         case "$yacc" in
21827         *-y*) ;;
21828         *)
21829                 yacc="$yacc -y"
21830                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21831                 ;;
21832         esac
21833         ;;
21834 esac
21835
21836 : see if this is a assert.h system
21837 set assert.h i_assert
21838 eval $inhdr
21839
21840 : see if this is a fp.h system
21841 set fp.h i_fp
21842 eval $inhdr
21843
21844 : see if this is a fp_class.h system
21845 set fp_class.h i_fp_class
21846 eval $inhdr
21847
21848 : see if gdbm.h is available
21849 set gdbm.h t_gdbm
21850 eval $inhdr
21851 case "$t_gdbm" in
21852 $define)
21853         : see if gdbm_open exists
21854         set gdbm_open d_gdbm_open
21855         eval $inlibc
21856         case "$d_gdbm_open" in
21857         $undef)
21858                 t_gdbm="$undef"
21859                 echo "We won't be including <gdbm.h>"
21860                 ;;
21861         esac
21862         ;;
21863 esac
21864 val="$t_gdbm"
21865 set i_gdbm
21866 eval $setvar
21867
21868 : see if this is a ieeefp.h system
21869 case "$i_ieeefp" in
21870 '' ) set ieeefp.h i_ieeefp
21871      eval $inhdr
21872      ;;
21873 esac
21874
21875 : see if this is a libutil.h system
21876 set libutil.h i_libutil
21877 eval $inhdr
21878
21879 : see if mach cthreads are available
21880 if test "X$usethreads" = "X$define"; then
21881         set mach/cthreads.h i_machcthr
21882         eval $inhdr
21883 else
21884         i_machcthr="$undef"
21885 fi
21886
21887 : see if this is a mntent.h system
21888 set mntent.h i_mntent
21889 eval $inhdr
21890
21891 : see if net/errno.h is available
21892 val=''
21893 set net/errno.h val
21894 eval $inhdr
21895
21896 : Unfortunately, it causes problems on some systems.  Arrgh.
21897 case "$val" in
21898 $define)
21899         cat > try.c <<'EOM'
21900 #include <stdio.h>
21901 #include <errno.h>
21902 #include <net/errno.h>
21903 int func()
21904 {
21905         return ENOTSOCK;
21906 }
21907 EOM
21908         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21909                 echo "We'll be including <net/errno.h>." >&4
21910         else
21911                 echo "We won't be including <net/errno.h>." >&4
21912                 val="$undef"
21913         fi
21914         $rm_try
21915         ;;
21916 esac
21917 set i_neterrno
21918 eval $setvar
21919
21920 : see if netinet/tcp.h is available
21921 set netinet/tcp.h i_netinettcp
21922 eval $inhdr
21923
21924 : see if this is a poll.h system
21925 set poll.h i_poll
21926 eval $inhdr
21927
21928 : see if this is a prot.h system
21929 set prot.h i_prot
21930 eval $inhdr
21931
21932 : Preprocessor symbols
21933 echo " "
21934 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21935 $cat <<'EOSH' > Cppsym.know
21936 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21937 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21938 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21939 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21940 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21941 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21942 bull c cadmus clipper CMU COFF COMPILER_VERSION
21943 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21944 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21945 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21946 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21947 GLIBC GLIBC_MINOR
21948 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21949 H3050R H3050RX hbullx20 hcx host_mips
21950 hp200 hp300 hp700 HP700 hp800 hp9000
21951 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21952 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21953 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21954 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21955 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21956 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21957 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21958 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21959 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21960 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21961 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21962 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21963 MATH_HAS_NO_SIDE_EFFECTS
21964 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21965 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21966 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21967 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21968 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21969 NetBSD news1500 news1700 news1800 news1900 news3700
21970 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21971 ns32016 ns32332 ns32k nsc32000
21972 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21973 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21974 pc532 pdp11 PGC PIC plexus PORTAR posix
21975 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21976 POSIX_C_SOURCE POSIX_SOURCE POWER
21977 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21978 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21979 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21980 sony sony_news sonyrisc sparc sparclite spectrum
21981 stardent stdc STDC_EXT stratos sun sun3 sun386
21982 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21983 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21984 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21985 sysV68 sysV88 Tek4132 Tek4300 titan
21986 TM3200 TM5400 TM5600
21987 tower tower32 tower32_200 tower32_600 tower32_700
21988 tower32_800 tower32_850 tss
21989 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21990 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21991 unix UNIX95 UNIX99 unixpc unos
21992 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21993 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21994 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21995 USGr4 USGr4_2
21996 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21997 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21998 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21999 z8000
22000 EOSH
22001 # Maybe put other stuff here too.
22002 cat <<EOSH >>Cppsym.know
22003 $osname
22004 EOSH
22005 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22006 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22007 $cat Cppsym.know > Cppsym.c
22008 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22009 $rm -f Cppsym.a Cppsym.b Cppsym.c
22010 cat <<EOSH > Cppsym
22011 $startsh
22012 if $test \$# -gt 0; then
22013     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22014     if $test -s Cppsym.got; then
22015         $rm -f Cppsym.got
22016         exit 0
22017     fi
22018     $rm -f Cppsym.got
22019     exit 1
22020 else
22021     $tr " " "$trnl" | ./Cppsym.try
22022     exit 0
22023 fi
22024 EOSH
22025 chmod +x Cppsym
22026 $eunicefix Cppsym
22027 cat <<EOSH > Cppsym.try
22028 $startsh
22029 cat <<'EOCP' > try.c
22030 #include <stdio.h>
22031 #if cpp_stuff == 1
22032 #define STRINGIFY(a)    "a"
22033 #endif
22034 #if cpp_stuff == 42
22035 #define StGiFy(a)  #a
22036 #define STRINGIFY(a)    StGiFy(a)
22037 #endif
22038 #if $cpp_stuff != 1 && $cpp_stuff != 42
22039 #   include "Bletch: How does this C preprocessor stringify macros?"
22040 #endif
22041 int main() {
22042 EOCP
22043 $awk \\
22044 EOSH
22045 cat <<'EOSH' >> Cppsym.try
22046 'length($1) > 0 {
22047     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22048     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22049     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22050     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22051 }'       >> try.c
22052 echo 'return 0;}' >> try.c
22053 EOSH
22054 cat <<EOSH >> Cppsym.try
22055 ccflags="$ccflags"
22056 case "$osname-$gccversion" in
22057 irix-) ccflags="\$ccflags -woff 1178" ;;
22058 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22059 esac
22060 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22061 EOSH
22062 chmod +x Cppsym.try
22063 $eunicefix Cppsym.try
22064 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22065 : Add in any Linux cpp "predefined macros":
22066 case "$osname::$gccversion" in
22067   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22068     tHdrH=_tmpHdr
22069     rm -f $tHdrH'.h' $tHdrH
22070     touch $tHdrH'.h'
22071     # Filter out macro arguments, such as Linux's __INT8_C(c)
22072     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22073        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22074        if [ -s $tHdrH'_cppsym.real' ]; then
22075           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22076        fi
22077     fi
22078     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22079   ;;
22080 esac
22081 : now check the C compiler for additional symbols
22082 postprocess_cc_v=''
22083 case "$osname" in
22084 aix) postprocess_cc_v="|$tr , ' '" ;;
22085 esac
22086 $cat >ccsym <<EOS
22087 $startsh
22088 $cat >tmp.c <<EOF
22089 extern int foo;
22090 EOF
22091 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22092 do
22093         case "\$i" in
22094         -D*) echo "\$i" | $sed 's/^-D//';;
22095         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22096         esac
22097 done
22098 $rm_try
22099 EOS
22100 postprocess_cc_v=''
22101 chmod +x ccsym
22102 $eunicefix ccsym
22103 ./ccsym > ccsym1.raw
22104 if $test -s ccsym1.raw; then
22105        $sort ccsym1.raw | $uniq >ccsym.raw
22106 else
22107        mv ccsym1.raw ccsym.raw
22108 fi
22109
22110 $awk '/\=/ { print $0; next }
22111         { print $0"=1" }' ccsym.raw >ccsym.list
22112 $comm -13 Cppsym.true ccsym.list >ccsym.own
22113 $comm -12 Cppsym.true ccsym.list >ccsym.com
22114 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22115 also=''
22116 if $test -z ccsym.raw; then
22117         echo "Your C compiler doesn't seem to define any symbols!" >&4
22118         echo " "
22119         echo "However, your C preprocessor defines the following symbols:"
22120         $cat Cppsym.true
22121         ccsymbols=''
22122         cppsymbols=`$cat Cppsym.true`
22123         cppsymbols=`echo $cppsymbols`
22124         cppccsymbols="$cppsymbols"
22125 else
22126         if $test -s ccsym.com; then
22127                 echo "Your C compiler and pre-processor define these symbols:"
22128                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22129                 also='also '
22130                 symbols='ones'
22131                 cppccsymbols=`$cat ccsym.com`
22132                 cppccsymbols=`echo $cppccsymbols`
22133                 $test "$silent" || sleep 1
22134         fi
22135         if $test -s ccsym.cpp; then
22136                 $test "$also" && echo " "
22137                 echo "Your C pre-processor ${also}defines the following symbols:"
22138                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22139                 also='further '
22140                 cppsymbols=`$cat ccsym.cpp`
22141                 cppsymbols=`echo $cppsymbols`
22142                 $test "$silent" || sleep 1
22143         fi
22144         if $test -s ccsym.own; then
22145                 $test "$also" && echo " "
22146                 echo "Your C compiler ${also}defines the following cpp symbols:"
22147                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22148                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22149                 ccsymbols=`$cat ccsym.own`
22150                 ccsymbols=`echo $ccsymbols`
22151                 $test "$silent" || sleep 1
22152         fi
22153 fi
22154
22155 : see if this is a termio system
22156 val="$undef"
22157 val2="$undef"
22158 val3="$undef"
22159 if $test `./findhdr termios.h`; then
22160         set tcsetattr i_termios
22161         eval $inlibc
22162         val3="$i_termios"
22163 fi
22164 echo " "
22165 case "$val3" in
22166 "$define") echo "You have POSIX termios.h... good!" >&4;;
22167 *) if ./Cppsym pyr; then
22168                 case "`/bin/universe`" in
22169                 ucb) if $test `./findhdr sgtty.h`; then
22170                                 val2="$define"
22171                                 echo "<sgtty.h> found." >&4
22172                         else
22173                                 echo "System is pyramid with BSD universe."
22174                                 ./warn "<sgtty.h> not found--you could have problems."
22175                         fi;;
22176                 *) if $test `./findhdr termio.h`; then
22177                                 val="$define"
22178                                 echo "<termio.h> found." >&4
22179                         else
22180                                 echo "System is pyramid with USG universe."
22181                                 ./warn "<termio.h> not found--you could have problems."
22182                         fi;;
22183                 esac
22184         elif ./usg; then
22185                 if $test `./findhdr termio.h`; then
22186                         echo "<termio.h> found." >&4
22187                         val="$define"
22188                 elif $test `./findhdr sgtty.h`; then
22189                         echo "<sgtty.h> found." >&4
22190                         val2="$define"
22191                 else
22192                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22193                 fi
22194         else
22195                 if $test `./findhdr sgtty.h`; then
22196                         echo "<sgtty.h> found." >&4
22197                         val2="$define"
22198                 elif $test `./findhdr termio.h`; then
22199                         echo "<termio.h> found." >&4
22200                         val="$define"
22201                 else
22202                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22203                 fi
22204         fi;;
22205 esac
22206 set i_termio; eval $setvar
22207 val=$val2; set i_sgtty; eval $setvar
22208 val=$val3; set i_termios; eval $setvar
22209
22210 : see if stdbool is available
22211 : we want a real compile instead of Inhdr because some Solaris systems
22212 : have stdbool.h, but it can only be used if the compiler indicates it
22213 : is sufficiently c99-compliant.
22214 echo " "
22215 $cat >try.c <<EOCP
22216 #include <stdio.h>
22217 #include <stdbool.h>
22218 int func(bool x)
22219 {
22220     return x ? 1 : 0;
22221 }
22222 int main(int argc, char **argv)
22223 {
22224     return func(0);
22225 }
22226 EOCP
22227 set try
22228 if eval $compile; then
22229         echo "<stdbool.h> found." >&4
22230         val="$define"
22231 else
22232         echo "<stdbool.h> NOT found." >&4
22233         val="$undef"
22234 fi
22235 $rm_try
22236 set i_stdbool
22237 eval $setvar
22238
22239 : see if stddef is available
22240 set stddef.h i_stddef
22241 eval $inhdr
22242
22243 : see if sys/access.h is available
22244 set sys/access.h i_sysaccess
22245 eval $inhdr
22246
22247 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22248 set sys/filio.h i_sysfilio
22249 eval $inhdr
22250 echo " "
22251 if $test `./findhdr sys/ioctl.h`; then
22252         val="$define"
22253         echo '<sys/ioctl.h> found.' >&4
22254 else
22255         val="$undef"
22256         if $test $i_sysfilio = "$define"; then
22257             echo '<sys/ioctl.h> NOT found.' >&4
22258         else
22259                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22260                 $test $i_termio = "$define" && xxx="termio.h"
22261                 $test $i_termios = "$define" && xxx="termios.h"
22262 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22263         fi
22264 fi
22265 set i_sysioctl
22266 eval $setvar
22267
22268 : see if socket ioctl defs are in sys/sockio.h
22269 echo " "
22270 xxx=`./findhdr sys/sockio.h`
22271 if $test "$xxx"; then
22272         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22273                 val="$define"
22274                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22275         else
22276                 val="$undef"
22277                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22278         fi
22279 else
22280         val="$undef"
22281         $cat <<EOM
22282 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22283 EOM
22284 fi
22285 set i_syssockio
22286 eval $setvar
22287
22288 : see if this is a syslog.h system
22289 set syslog.h i_syslog
22290 eval $inhdr
22291
22292 : see if this is a sys/mode.h system
22293 set sys/mode.h i_sysmode
22294 eval $inhdr
22295
22296 : see if there is a sys/poll.h file
22297 set sys/poll.h i_syspoll
22298 eval $inhdr
22299
22300 : see if sys/resource.h has to be included
22301 set sys/resource.h i_sysresrc
22302 eval $inhdr
22303
22304 : see if sys/security.h is available
22305 set sys/security.h i_syssecrt
22306 eval $inhdr
22307
22308 : see if this is a sys/statvfs.h system
22309 set sys/statvfs.h i_sysstatvfs
22310 eval $inhdr
22311
22312 : see if this is a sys/un.h system
22313 set sys/un.h i_sysun
22314 eval $inhdr
22315
22316 : see if this is a sys/utsname.h system
22317 set sys/utsname.h i_sysutsname
22318 eval $inhdr
22319
22320 : see if this is a syswait system
22321 set sys/wait.h i_syswait
22322 eval $inhdr
22323
22324 : see if this is a ustat.h system
22325 set ustat.h i_ustat
22326 eval $inhdr
22327
22328 : see if this is an utime system
22329 set utime.h i_utime
22330 eval $inhdr
22331
22332 : see if this is a vfork system
22333 case "$d_vfork" in
22334 "$define")
22335         set vfork.h i_vfork
22336         eval $inhdr
22337         ;;
22338 *)
22339         i_vfork="$undef"
22340         ;;
22341 esac
22342
22343 : Check extensions
22344 echo " "
22345 echo "Looking for extensions..." >&4
22346 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22347 : contain old or inaccurate or duplicate values.
22348 nonxs_extensions=''
22349 xs_extensions=''
22350 : We do not use find because it might not be available.
22351 : We do not just use MANIFEST because the user may have dropped
22352 : some additional extensions into the source tree and expect them
22353 : to be built.
22354
22355 : Function to recursively find available extensions, ignoring DynaLoader
22356 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22357 : In 5.10.1 and later, extensions are stored in directories
22358 : like File-Glob instead of the older File/Glob/.
22359 find_extensions='
22360     for xxx in *; do
22361         case "$xxx" in
22362             DynaLoader|dynaload) ;;
22363             *)
22364             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22365             echo " $xs_extensions $nonxs_extensions" > $$.tmp;
22366             if $contains " $this_ext " $$.tmp; then
22367                 echo >&4;
22368                 echo "Duplicate directories detected for extension $xxx" >&4;
22369                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22370                 case "$knowitall" in
22371                 "") dflt=y;;
22372                 *) dflt=n;;
22373                 esac;
22374                 . ../UU/myread;
22375                 case "$ans" in
22376                 n*|N*) ;;
22377                 *) echo >&4;
22378                     echo "Ok.  Stopping Configure." >&4;
22379                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22380                     exit 1;;
22381                 esac;
22382                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22383             fi;
22384             $ls -1 $xxx > $$.tmp;
22385             if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22386                 xs_extensions="$xs_extensions $this_ext";
22387             elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22388                 xs_extensions="$xs_extensions $this_ext";
22389             elif $test -d $xxx; then
22390                 nonxs_extensions="$nonxs_extensions $this_ext";
22391             fi;
22392             $rm -f $$.tmp;
22393             ;;
22394         esac;
22395     done'
22396 tdir=`pwd`
22397 cd "$rsrc/cpan"
22398 set X
22399 shift
22400 eval $find_extensions
22401 cd "$rsrc/dist"
22402 set X
22403 shift
22404 eval $find_extensions
22405 cd "$rsrc/ext"
22406 set X
22407 shift
22408 eval $find_extensions
22409 set X $xs_extensions
22410 shift
22411 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22412 set X $nonxs_extensions
22413 shift
22414 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22415 cd "$tdir"
22416 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22417
22418 : Now see which are supported on this system.
22419 avail_ext=''
22420 for xxx in $xs_extensions ; do
22421         case "$xxx" in
22422         DB_File|db_file)
22423                 case "$i_db" in
22424                 $define) avail_ext="$avail_ext $xxx" ;;
22425                 esac
22426                 ;;
22427         GDBM_File|gdbm_fil)
22428                 case "$i_gdbm" in
22429                 $define) avail_ext="$avail_ext $xxx" ;;
22430                 esac
22431                 ;;
22432         I18N/Langinfo|i18n_lan)
22433                 case "$i_langinfo$d_nl_langinfo" in
22434                 $define$define) avail_ext="$avail_ext $xxx" ;;
22435                 esac
22436                 ;;
22437         IPC/SysV|ipc/sysv)
22438                 : XXX Do we need a useipcsysv variable here
22439                 case "${d_msg}${d_sem}${d_shm}" in
22440                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22441                 esac
22442                 ;;
22443         NDBM_File|ndbm_fil)
22444                 case "$d_ndbm" in
22445                 $define)
22446                     case "$osname-$use64bitint" in
22447                     hpux-define)
22448                         case "$libs" in
22449                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22450                         esac
22451                         ;;
22452                     *) avail_ext="$avail_ext $xxx" ;;
22453                     esac
22454                     ;;
22455                 esac
22456                 ;;
22457         ODBM_File|odbm_fil)
22458                 case "${i_dbm}${i_rpcsvcdbm}" in
22459                 *"${define}"*)
22460                     case "$d_cplusplus" in
22461                     define) ;; # delete as a function name will not work
22462                     *)  case "$osname-$use64bitint" in
22463                         hpux-define)
22464                             case "$libs" in
22465                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22466                             esac
22467                             ;;
22468                         *) avail_ext="$avail_ext $xxx" ;;
22469                         esac
22470                         ;;
22471                     esac
22472                     ;;
22473                 esac
22474                 ;;
22475         Opcode|opcode)
22476                 case "$useopcode" in
22477                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22478                 esac
22479                 ;;
22480         POSIX|posix)
22481                 case "$useposix" in
22482                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22483                 esac
22484                 ;;
22485         Socket|socket)
22486                 case "$d_socket" in
22487                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22488                 esac
22489                 ;;
22490         Sys/Syslog|sys/syslog)
22491                 : XXX syslog requires socket
22492                 case "$d_socket" in
22493                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22494                 esac
22495                 ;;
22496         Thread|thread)
22497                 case "$usethreads" in
22498                 true|$define|y)
22499                         case "$use5005threads" in
22500                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22501                         esac
22502                 esac
22503                 ;;
22504         threads|threads/shared)
22505                 # threads and threads::shared are special cases.
22506                 # To stop people from asking "Perl 5.8.0 was supposed
22507                 # to have this new fancy threads implementation but my
22508                 # perl doesn't have it" and from people trying to
22509                 # (re)install the threads module using CPAN.pm and
22510                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22511                 # the threads.pm and threads/shared.pm will always be
22512                 # there, croaking informatively ("you need to rebuild
22513                 # all of Perl with threads, sorry") when threads haven't
22514                 # been compiled in.
22515                 # --jhi
22516                 avail_ext="$avail_ext $xxx"
22517                 ;;
22518         VMS*)
22519                 ;;
22520         Win32*)
22521                 case "$osname" in
22522                 cygwin) avail_ext="$avail_ext $xxx" ;;
22523                 esac
22524                 ;;
22525         XS/APItest|xs/apitest)
22526                 # This is just for testing.  Skip it unless we have dynamic loading.
22527
22528                 case "$usedl" in
22529                 $define) avail_ext="$avail_ext $xxx" ;;
22530                 esac
22531                 ;;
22532         XS/Typemap|xs/typemap)
22533                 # This is just for testing.  Skip it unless we have dynamic loading.
22534                 case "$usedl" in
22535                 $define) avail_ext="$avail_ext $xxx" ;;
22536                 esac
22537                 ;;
22538         *)      avail_ext="$avail_ext $xxx"
22539                 ;;
22540         esac
22541 done
22542
22543 set X $avail_ext
22544 shift
22545 avail_ext="$*"
22546
22547 case "$onlyextensions" in
22548 '') ;;
22549 *)  keepextensions=''
22550     echo "You have requested that only certain extensions be included..." >&4
22551     for i in $onlyextensions; do
22552         case " $avail_ext " in
22553         *" $i "*)
22554             echo "Keeping extension $i."
22555             keepextensions="$keepextensions $i"
22556             ;;
22557         *) echo "Ignoring extension $i." ;;
22558         esac
22559     done
22560     avail_ext="$keepextensions"
22561     ;;
22562 esac
22563
22564 case "$noextensions" in
22565 '') ;;
22566 *)  keepextensions=''
22567     echo "You have requested that certain extensions be ignored..." >&4
22568     for i in $avail_ext; do
22569         case " $noextensions " in
22570         *" $i "*) echo "Ignoring extension $i." ;;
22571         *) echo "Keeping extension $i.";
22572            keepextensions="$keepextensions $i"
22573            ;;
22574         esac
22575     done
22576     avail_ext="$keepextensions"
22577     ;;
22578 esac
22579
22580 : Now see which nonxs extensions are supported on this system.
22581 : For now assume all are.
22582 nonxs_ext=''
22583 for xxx in $nonxs_extensions ; do
22584         case "$xxx" in
22585         VMS*)
22586                 ;;
22587         *)      nonxs_ext="$nonxs_ext $xxx"
22588                 ;;
22589         esac
22590 done
22591
22592 set X $nonxs_ext
22593 shift
22594 nonxs_ext="$*"
22595
22596 case $usedl in
22597 $define)
22598         $cat <<EOM
22599 A number of extensions are supplied with $package.  You may choose to
22600 compile these extensions for dynamic loading (the default), compile
22601 them into the $package executable (static loading), or not include
22602 them at all.  Answer "none" to include no extensions.
22603 Note that DynaLoader is always built and need not be mentioned here.
22604
22605 EOM
22606         case "$dynamic_ext" in
22607         '')
22608                 : Exclude those listed in static_ext
22609                 dflt=''
22610                 for xxx in $avail_ext; do
22611                         case " $static_ext " in
22612                         *" $xxx "*) ;;
22613                         *) dflt="$dflt $xxx" ;;
22614                         esac
22615                 done
22616                 set X $dflt
22617                 shift
22618                 dflt="$*"
22619                 ;;
22620         *)      dflt="$dynamic_ext"
22621                 # Perhaps we are reusing an old out-of-date config.sh.
22622                 case "$hint" in
22623                 previous)
22624                         if test X"$dynamic_ext" != X"$avail_ext"; then
22625                                 $cat <<EOM
22626 NOTICE:  Your previous config.sh list may be incorrect.
22627 The extensions now available to you are
22628         ${avail_ext}
22629 but the default list from your previous config.sh is
22630         ${dynamic_ext}
22631
22632 EOM
22633                         fi
22634                         ;;
22635                 esac
22636                 ;;
22637         esac
22638         case "$dflt" in
22639         '')     dflt=none;;
22640         esac
22641         rp="What extensions do you wish to load dynamically?"
22642         . ./myread
22643         case "$ans" in
22644         none) dynamic_ext=' ' ;;
22645         *) dynamic_ext="$ans" ;;
22646         esac
22647
22648         case "$static_ext" in
22649         '')
22650                 : Exclude those already listed in dynamic linking
22651                 dflt=''
22652                 for xxx in $avail_ext; do
22653                         case " $dynamic_ext " in
22654                         *" $xxx "*) ;;
22655                         *) dflt="$dflt $xxx" ;;
22656                         esac
22657                 done
22658                 set X $dflt
22659                 shift
22660                 dflt="$*"
22661                 ;;
22662         *)  dflt="$static_ext"
22663                 ;;
22664         esac
22665
22666         case "$dflt" in
22667         '')     dflt=none;;
22668         esac
22669         rp="What extensions do you wish to load statically?"
22670         . ./myread
22671         case "$ans" in
22672         none) static_ext=' ' ;;
22673         *) static_ext="$ans" ;;
22674         esac
22675         ;;
22676 *)
22677         $cat <<EOM
22678 A number of extensions are supplied with $package.  Answer "none"
22679 to include no extensions.
22680 Note that DynaLoader is always built and need not be mentioned here.
22681
22682 EOM
22683         case "$static_ext" in
22684         '') dflt="$avail_ext" ;;
22685         *)      dflt="$static_ext"
22686                 # Perhaps we are reusing an old out-of-date config.sh.
22687                 case "$hint" in
22688                 previous)
22689                         if test X"$static_ext" != X"$avail_ext"; then
22690                                 $cat <<EOM
22691 NOTICE:  Your previous config.sh list may be incorrect.
22692 The extensions now available to you are
22693         ${avail_ext}
22694 but the default list from your previous config.sh is
22695         ${static_ext}
22696
22697 EOM
22698                         fi
22699                         ;;
22700                 esac
22701                 ;;
22702         esac
22703         : Exclude those that are not xs extensions
22704         case "$dflt" in
22705         '')     dflt=none;;
22706         esac
22707         rp="What extensions do you wish to include?"
22708         . ./myread
22709         case "$ans" in
22710         none) static_ext=' ' ;;
22711         *) static_ext="$ans" ;;
22712         esac
22713         ;;
22714 esac
22715 #
22716 # Encode is a special case.  If we are building Encode as a static
22717 # extension, we need to explicitly list its subextensions as well.
22718 # For other nested extensions, this is handled automatically by
22719 # the appropriate Makefile.PL.
22720 case " $static_ext " in
22721         *" Encode "*) # Add the subextensions of Encode
22722         cd "$rsrc/cpan"
22723         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22724                 static_ext="$static_ext Encode/$xxx"
22725                 known_extensions="$known_extensions Encode/$xxx"
22726         done
22727         cd "$tdir"
22728         ;;
22729 esac
22730
22731 set X $dynamic_ext $static_ext $nonxs_ext
22732 shift
22733 extensions="$*"
22734
22735 # Sanity check:  We require an extension suitable for use with
22736 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22737 # should show up as failures in the test suite, but it's helpful to
22738 # catch them now.) The 'extensions' list is normally sorted
22739 # alphabetically, so we need to accept either
22740 #    DB_File ... Fcntl ... IO  ....
22741 # or something like
22742 #    Fcntl ... NDBM_File ... IO  ....
22743 case " $extensions"  in
22744 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22745 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22746 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22747 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22748    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22749    ;;
22750 esac
22751
22752 : Remove libraries needed only for extensions
22753 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22754 : The exception is SunOS 4.x, which needs them.
22755 case "${osname}X${osvers}" in
22756 sunos*X4*)
22757     perllibs="$libs"
22758     ;;
22759 *) case "$usedl" in
22760     $define|true|[yY]*)
22761             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22762             shift
22763             perllibs="$*"
22764             ;;
22765     *)  perllibs="$libs"
22766             ;;
22767     esac
22768     ;;
22769 esac
22770
22771 : Remove build directory name from cppstdin so it can be used from
22772 : either the present location or the final installed location.
22773 echo " "
22774 : Get out of the UU directory to get correct path name.
22775 cd ..
22776 case "$cppstdin" in
22777 `pwd`/cppstdin)
22778         echo "Stripping down cppstdin path name"
22779         cppstdin=cppstdin
22780         ;;
22781 esac
22782 cd UU
22783
22784 : end of configuration questions
22785 echo " "
22786 echo "End of configuration questions."
22787 echo " "
22788
22789 : back to where it started
22790 if test -d ../UU; then
22791         cd ..
22792 fi
22793
22794 : configuration may be unconditionally patched via a 'config.arch' file
22795 if $test -f config.arch; then
22796         echo "I see a config.arch file, loading it." >&4
22797         . ./config.arch
22798 fi
22799
22800 : configuration may be patched via a 'config.over' file
22801 if $test -f config.over; then
22802         echo " "
22803         dflt=y
22804         rp='I see a config.over file.  Do you wish to load it?'
22805         . UU/myread
22806         case "$ans" in
22807         n*) echo "OK, I'll ignore it.";;
22808         *)      . ./config.over
22809                 echo "Configuration override changes have been loaded."
22810                 ;;
22811         esac
22812 fi
22813
22814 : in case they want portability, strip down executable paths
22815 case "$d_portable" in
22816 "$define")
22817         echo " "
22818         echo "Stripping down executable paths..." >&4
22819         for file in $loclist $trylist; do
22820                 eval temp=\$$file
22821                 eval $file=`basename $temp`
22822         done
22823         ;;
22824 esac
22825
22826 : create config.sh file
22827 echo " "
22828 echo "Creating config.sh..." >&4
22829 $spitshell <<EOT >config.sh
22830 $startsh
22831 #
22832 # This file was produced by running the Configure script. It holds all the
22833 # definitions figured out by Configure. Should you modify one of these values,
22834 # do not forget to propagate your changes by running "Configure -der". You may
22835 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22836 #
22837
22838 # Package name      : $package
22839 # Source directory  : $src
22840 # Configuration time: $cf_time
22841 # Configured by     : $cf_by
22842 # Target system     : $myuname
22843
22844 EOT
22845 : Add in command line options if available
22846 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22847
22848 $spitshell <<EOT >>config.sh
22849
22850 Author='$Author'
22851 Date='$Date'
22852 Header='$Header'
22853 Id='$Id'
22854 Locker='$Locker'
22855 Log='$Log'
22856 RCSfile='$RCSfile'
22857 Revision='$Revision'
22858 Source='$Source'
22859 State='$State'
22860 _a='$_a'
22861 _exe='$_exe'
22862 _o='$_o'
22863 afs='$afs'
22864 afsroot='$afsroot'
22865 alignbytes='$alignbytes'
22866 ansi2knr='$ansi2knr'
22867 aphostname='$aphostname'
22868 api_revision='$api_revision'
22869 api_subversion='$api_subversion'
22870 api_version='$api_version'
22871 api_versionstring='$api_versionstring'
22872 ar='$ar'
22873 archlib='$archlib'
22874 archlibexp='$archlibexp'
22875 archname64='$archname64'
22876 archname='$archname'
22877 archobjs='$archobjs'
22878 asctime_r_proto='$asctime_r_proto'
22879 awk='$awk'
22880 baserev='$baserev'
22881 bash='$bash'
22882 bin='$bin'
22883 bin_ELF='$bin_ELF'
22884 binexp='$binexp'
22885 bison='$bison'
22886 bootstrap_charset='$bootstrap_charset'
22887 byacc='$byacc'
22888 byteorder='$byteorder'
22889 c='$c'
22890 castflags='$castflags'
22891 cat='$cat'
22892 cc='$cc'
22893 cccdlflags='$cccdlflags'
22894 ccdlflags='$ccdlflags'
22895 ccflags='$ccflags'
22896 ccflags_uselargefiles='$ccflags_uselargefiles'
22897 ccname='$ccname'
22898 ccsymbols='$ccsymbols'
22899 ccversion='$ccversion'
22900 cf_by='$cf_by'
22901 cf_email='$cf_email'
22902 cf_time='$cf_time'
22903 charbits='$charbits'
22904 charsize='$charsize'
22905 chgrp='$chgrp'
22906 chmod='$chmod'
22907 chown='$chown'
22908 clocktype='$clocktype'
22909 comm='$comm'
22910 compress='$compress'
22911 contains='$contains'
22912 cp='$cp'
22913 cpio='$cpio'
22914 cpp='$cpp'
22915 cpp_stuff='$cpp_stuff'
22916 cppccsymbols='$cppccsymbols'
22917 cppflags='$cppflags'
22918 cpplast='$cpplast'
22919 cppminus='$cppminus'
22920 cpprun='$cpprun'
22921 cppstdin='$cppstdin'
22922 cppsymbols='$cppsymbols'
22923 crypt_r_proto='$crypt_r_proto'
22924 cryptlib='$cryptlib'
22925 csh='$csh'
22926 ctermid_r_proto='$ctermid_r_proto'
22927 ctime_r_proto='$ctime_r_proto'
22928 d_Gconvert='$d_Gconvert'
22929 d_PRIEUldbl='$d_PRIEUldbl'
22930 d_PRIFUldbl='$d_PRIFUldbl'
22931 d_PRIGUldbl='$d_PRIGUldbl'
22932 d_PRIXU64='$d_PRIXU64'
22933 d_PRId64='$d_PRId64'
22934 d_PRIeldbl='$d_PRIeldbl'
22935 d_PRIfldbl='$d_PRIfldbl'
22936 d_PRIgldbl='$d_PRIgldbl'
22937 d_PRIi64='$d_PRIi64'
22938 d_PRIo64='$d_PRIo64'
22939 d_PRIu64='$d_PRIu64'
22940 d_PRIx64='$d_PRIx64'
22941 d_SCNfldbl='$d_SCNfldbl'
22942 d__fwalk='$d__fwalk'
22943 d_access='$d_access'
22944 d_accessx='$d_accessx'
22945 d_aintl='$d_aintl'
22946 d_alarm='$d_alarm'
22947 d_archlib='$d_archlib'
22948 d_asctime64='$d_asctime64'
22949 d_asctime_r='$d_asctime_r'
22950 d_atolf='$d_atolf'
22951 d_atoll='$d_atoll'
22952 d_attribute_deprecated='$d_attribute_deprecated'
22953 d_attribute_format='$d_attribute_format'
22954 d_attribute_malloc='$d_attribute_malloc'
22955 d_attribute_nonnull='$d_attribute_nonnull'
22956 d_attribute_noreturn='$d_attribute_noreturn'
22957 d_attribute_pure='$d_attribute_pure'
22958 d_attribute_unused='$d_attribute_unused'
22959 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22960 d_bcmp='$d_bcmp'
22961 d_bcopy='$d_bcopy'
22962 d_bsd='$d_bsd'
22963 d_bsdgetpgrp='$d_bsdgetpgrp'
22964 d_bsdsetpgrp='$d_bsdsetpgrp'
22965 d_builtin_choose_expr='$d_builtin_choose_expr'
22966 d_builtin_expect='$d_builtin_expect'
22967 d_bzero='$d_bzero'
22968 d_c99_variadic_macros='$d_c99_variadic_macros'
22969 d_casti32='$d_casti32'
22970 d_castneg='$d_castneg'
22971 d_charvspr='$d_charvspr'
22972 d_chown='$d_chown'
22973 d_chroot='$d_chroot'
22974 d_chsize='$d_chsize'
22975 d_class='$d_class'
22976 d_clearenv='$d_clearenv'
22977 d_closedir='$d_closedir'
22978 d_cmsghdr_s='$d_cmsghdr_s'
22979 d_const='$d_const'
22980 d_copysignl='$d_copysignl'
22981 d_cplusplus='$d_cplusplus'
22982 d_crypt='$d_crypt'
22983 d_crypt_r='$d_crypt_r'
22984 d_csh='$d_csh'
22985 d_ctermid='$d_ctermid'
22986 d_ctermid_r='$d_ctermid_r'
22987 d_ctime64='$d_ctime64'
22988 d_ctime_r='$d_ctime_r'
22989 d_cuserid='$d_cuserid'
22990 d_dbl_dig='$d_dbl_dig'
22991 d_dbminitproto='$d_dbminitproto'
22992 d_difftime64='$d_difftime64'
22993 d_difftime='$d_difftime'
22994 d_dir_dd_fd='$d_dir_dd_fd'
22995 d_dirfd='$d_dirfd'
22996 d_dirnamlen='$d_dirnamlen'
22997 d_dlerror='$d_dlerror'
22998 d_dlopen='$d_dlopen'
22999 d_dlsymun='$d_dlsymun'
23000 d_dosuid='$d_dosuid'
23001 d_drand48_r='$d_drand48_r'
23002 d_drand48proto='$d_drand48proto'
23003 d_dup2='$d_dup2'
23004 d_eaccess='$d_eaccess'
23005 d_endgrent='$d_endgrent'
23006 d_endgrent_r='$d_endgrent_r'
23007 d_endhent='$d_endhent'
23008 d_endhostent_r='$d_endhostent_r'
23009 d_endnent='$d_endnent'
23010 d_endnetent_r='$d_endnetent_r'
23011 d_endpent='$d_endpent'
23012 d_endprotoent_r='$d_endprotoent_r'
23013 d_endpwent='$d_endpwent'
23014 d_endpwent_r='$d_endpwent_r'
23015 d_endsent='$d_endsent'
23016 d_endservent_r='$d_endservent_r'
23017 d_eofnblk='$d_eofnblk'
23018 d_eunice='$d_eunice'
23019 d_faststdio='$d_faststdio'
23020 d_fchdir='$d_fchdir'
23021 d_fchmod='$d_fchmod'
23022 d_fchown='$d_fchown'
23023 d_fcntl='$d_fcntl'
23024 d_fcntl_can_lock='$d_fcntl_can_lock'
23025 d_fd_macros='$d_fd_macros'
23026 d_fd_set='$d_fd_set'
23027 d_fds_bits='$d_fds_bits'
23028 d_fgetpos='$d_fgetpos'
23029 d_finite='$d_finite'
23030 d_finitel='$d_finitel'
23031 d_flexfnam='$d_flexfnam'
23032 d_flock='$d_flock'
23033 d_flockproto='$d_flockproto'
23034 d_fork='$d_fork'
23035 d_fp_class='$d_fp_class'
23036 d_fpathconf='$d_fpathconf'
23037 d_fpclass='$d_fpclass'
23038 d_fpclassify='$d_fpclassify'
23039 d_fpclassl='$d_fpclassl'
23040 d_fpos64_t='$d_fpos64_t'
23041 d_frexpl='$d_frexpl'
23042 d_fs_data_s='$d_fs_data_s'
23043 d_fseeko='$d_fseeko'
23044 d_fsetpos='$d_fsetpos'
23045 d_fstatfs='$d_fstatfs'
23046 d_fstatvfs='$d_fstatvfs'
23047 d_fsync='$d_fsync'
23048 d_ftello='$d_ftello'
23049 d_ftime='$d_ftime'
23050 d_futimes='$d_futimes'
23051 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23052 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23053 d_getaddrinfo='$d_getaddrinfo'
23054 d_getcwd='$d_getcwd'
23055 d_getespwnam='$d_getespwnam'
23056 d_getfsstat='$d_getfsstat'
23057 d_getgrent='$d_getgrent'
23058 d_getgrent_r='$d_getgrent_r'
23059 d_getgrgid_r='$d_getgrgid_r'
23060 d_getgrnam_r='$d_getgrnam_r'
23061 d_getgrps='$d_getgrps'
23062 d_gethbyaddr='$d_gethbyaddr'
23063 d_gethbyname='$d_gethbyname'
23064 d_gethent='$d_gethent'
23065 d_gethname='$d_gethname'
23066 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23067 d_gethostbyname_r='$d_gethostbyname_r'
23068 d_gethostent_r='$d_gethostent_r'
23069 d_gethostprotos='$d_gethostprotos'
23070 d_getitimer='$d_getitimer'
23071 d_getlogin='$d_getlogin'
23072 d_getlogin_r='$d_getlogin_r'
23073 d_getmnt='$d_getmnt'
23074 d_getmntent='$d_getmntent'
23075 d_getnameinfo='$d_getnameinfo'
23076 d_getnbyaddr='$d_getnbyaddr'
23077 d_getnbyname='$d_getnbyname'
23078 d_getnent='$d_getnent'
23079 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23080 d_getnetbyname_r='$d_getnetbyname_r'
23081 d_getnetent_r='$d_getnetent_r'
23082 d_getnetprotos='$d_getnetprotos'
23083 d_getpagsz='$d_getpagsz'
23084 d_getpbyname='$d_getpbyname'
23085 d_getpbynumber='$d_getpbynumber'
23086 d_getpent='$d_getpent'
23087 d_getpgid='$d_getpgid'
23088 d_getpgrp2='$d_getpgrp2'
23089 d_getpgrp='$d_getpgrp'
23090 d_getppid='$d_getppid'
23091 d_getprior='$d_getprior'
23092 d_getprotobyname_r='$d_getprotobyname_r'
23093 d_getprotobynumber_r='$d_getprotobynumber_r'
23094 d_getprotoent_r='$d_getprotoent_r'
23095 d_getprotoprotos='$d_getprotoprotos'
23096 d_getprpwnam='$d_getprpwnam'
23097 d_getpwent='$d_getpwent'
23098 d_getpwent_r='$d_getpwent_r'
23099 d_getpwnam_r='$d_getpwnam_r'
23100 d_getpwuid_r='$d_getpwuid_r'
23101 d_getsbyname='$d_getsbyname'
23102 d_getsbyport='$d_getsbyport'
23103 d_getsent='$d_getsent'
23104 d_getservbyname_r='$d_getservbyname_r'
23105 d_getservbyport_r='$d_getservbyport_r'
23106 d_getservent_r='$d_getservent_r'
23107 d_getservprotos='$d_getservprotos'
23108 d_getspnam='$d_getspnam'
23109 d_getspnam_r='$d_getspnam_r'
23110 d_gettimeod='$d_gettimeod'
23111 d_gmtime64='$d_gmtime64'
23112 d_gmtime_r='$d_gmtime_r'
23113 d_gnulibc='$d_gnulibc'
23114 d_grpasswd='$d_grpasswd'
23115 d_hasmntopt='$d_hasmntopt'
23116 d_htonl='$d_htonl'
23117 d_ilogbl='$d_ilogbl'
23118 d_inc_version_list='$d_inc_version_list'
23119 d_index='$d_index'
23120 d_inetaton='$d_inetaton'
23121 d_inetntop='$d_inetntop'
23122 d_inetpton='$d_inetpton'
23123 d_int64_t='$d_int64_t'
23124 d_ip_mreq='$d_ip_mreq'
23125 d_ip_mreq_source='$d_ip_mreq_source'
23126 d_ipv6_mreq='$d_ipv6_mreq'
23127 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23128 d_isascii='$d_isascii'
23129 d_isblank='$d_isblank'
23130 d_isfinite='$d_isfinite'
23131 d_isinf='$d_isinf'
23132 d_isnan='$d_isnan'
23133 d_isnanl='$d_isnanl'
23134 d_killpg='$d_killpg'
23135 d_lchown='$d_lchown'
23136 d_ldbl_dig='$d_ldbl_dig'
23137 d_libm_lib_version='$d_libm_lib_version'
23138 d_link='$d_link'
23139 d_localtime64='$d_localtime64'
23140 d_localtime_r='$d_localtime_r'
23141 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23142 d_locconv='$d_locconv'
23143 d_lockf='$d_lockf'
23144 d_longdbl='$d_longdbl'
23145 d_longlong='$d_longlong'
23146 d_lseekproto='$d_lseekproto'
23147 d_lstat='$d_lstat'
23148 d_madvise='$d_madvise'
23149 d_malloc_good_size='$d_malloc_good_size'
23150 d_malloc_size='$d_malloc_size'
23151 d_mblen='$d_mblen'
23152 d_mbstowcs='$d_mbstowcs'
23153 d_mbtowc='$d_mbtowc'
23154 d_memchr='$d_memchr'
23155 d_memcmp='$d_memcmp'
23156 d_memcpy='$d_memcpy'
23157 d_memmove='$d_memmove'
23158 d_memset='$d_memset'
23159 d_mkdir='$d_mkdir'
23160 d_mkdtemp='$d_mkdtemp'
23161 d_mkfifo='$d_mkfifo'
23162 d_mkstemp='$d_mkstemp'
23163 d_mkstemps='$d_mkstemps'
23164 d_mktime64='$d_mktime64'
23165 d_mktime='$d_mktime'
23166 d_mmap='$d_mmap'
23167 d_modfl='$d_modfl'
23168 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23169 d_modflproto='$d_modflproto'
23170 d_mprotect='$d_mprotect'
23171 d_msg='$d_msg'
23172 d_msg_ctrunc='$d_msg_ctrunc'
23173 d_msg_dontroute='$d_msg_dontroute'
23174 d_msg_oob='$d_msg_oob'
23175 d_msg_peek='$d_msg_peek'
23176 d_msg_proxy='$d_msg_proxy'
23177 d_msgctl='$d_msgctl'
23178 d_msgget='$d_msgget'
23179 d_msghdr_s='$d_msghdr_s'
23180 d_msgrcv='$d_msgrcv'
23181 d_msgsnd='$d_msgsnd'
23182 d_msync='$d_msync'
23183 d_munmap='$d_munmap'
23184 d_mymalloc='$d_mymalloc'
23185 d_ndbm='$d_ndbm'
23186 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23187 d_nice='$d_nice'
23188 d_nl_langinfo='$d_nl_langinfo'
23189 d_nv_preserves_uv='$d_nv_preserves_uv'
23190 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23191 d_off64_t='$d_off64_t'
23192 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23193 d_oldpthreads='$d_oldpthreads'
23194 d_oldsock='$d_oldsock'
23195 d_open3='$d_open3'
23196 d_pathconf='$d_pathconf'
23197 d_pause='$d_pause'
23198 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23199 d_phostname='$d_phostname'
23200 d_pipe='$d_pipe'
23201 d_poll='$d_poll'
23202 d_portable='$d_portable'
23203 d_prctl='$d_prctl'
23204 d_prctl_set_name='$d_prctl_set_name'
23205 d_printf_format_null='$d_printf_format_null'
23206 d_procselfexe='$d_procselfexe'
23207 d_pseudofork='$d_pseudofork'
23208 d_pthread_atfork='$d_pthread_atfork'
23209 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23210 d_pthread_yield='$d_pthread_yield'
23211 d_pwage='$d_pwage'
23212 d_pwchange='$d_pwchange'
23213 d_pwclass='$d_pwclass'
23214 d_pwcomment='$d_pwcomment'
23215 d_pwexpire='$d_pwexpire'
23216 d_pwgecos='$d_pwgecos'
23217 d_pwpasswd='$d_pwpasswd'
23218 d_pwquota='$d_pwquota'
23219 d_qgcvt='$d_qgcvt'
23220 d_quad='$d_quad'
23221 d_random_r='$d_random_r'
23222 d_readdir64_r='$d_readdir64_r'
23223 d_readdir='$d_readdir'
23224 d_readdir_r='$d_readdir_r'
23225 d_readlink='$d_readlink'
23226 d_readv='$d_readv'
23227 d_recvmsg='$d_recvmsg'
23228 d_rename='$d_rename'
23229 d_rewinddir='$d_rewinddir'
23230 d_rmdir='$d_rmdir'
23231 d_safebcpy='$d_safebcpy'
23232 d_safemcpy='$d_safemcpy'
23233 d_sanemcmp='$d_sanemcmp'
23234 d_sbrkproto='$d_sbrkproto'
23235 d_scalbnl='$d_scalbnl'
23236 d_sched_yield='$d_sched_yield'
23237 d_scm_rights='$d_scm_rights'
23238 d_seekdir='$d_seekdir'
23239 d_select='$d_select'
23240 d_sem='$d_sem'
23241 d_semctl='$d_semctl'
23242 d_semctl_semid_ds='$d_semctl_semid_ds'
23243 d_semctl_semun='$d_semctl_semun'
23244 d_semget='$d_semget'
23245 d_semop='$d_semop'
23246 d_sendmsg='$d_sendmsg'
23247 d_setegid='$d_setegid'
23248 d_seteuid='$d_seteuid'
23249 d_setgrent='$d_setgrent'
23250 d_setgrent_r='$d_setgrent_r'
23251 d_setgrps='$d_setgrps'
23252 d_sethent='$d_sethent'
23253 d_sethostent_r='$d_sethostent_r'
23254 d_setitimer='$d_setitimer'
23255 d_setlinebuf='$d_setlinebuf'
23256 d_setlocale='$d_setlocale'
23257 d_setlocale_r='$d_setlocale_r'
23258 d_setnent='$d_setnent'
23259 d_setnetent_r='$d_setnetent_r'
23260 d_setpent='$d_setpent'
23261 d_setpgid='$d_setpgid'
23262 d_setpgrp2='$d_setpgrp2'
23263 d_setpgrp='$d_setpgrp'
23264 d_setprior='$d_setprior'
23265 d_setproctitle='$d_setproctitle'
23266 d_setprotoent_r='$d_setprotoent_r'
23267 d_setpwent='$d_setpwent'
23268 d_setpwent_r='$d_setpwent_r'
23269 d_setregid='$d_setregid'
23270 d_setresgid='$d_setresgid'
23271 d_setresuid='$d_setresuid'
23272 d_setreuid='$d_setreuid'
23273 d_setrgid='$d_setrgid'
23274 d_setruid='$d_setruid'
23275 d_setsent='$d_setsent'
23276 d_setservent_r='$d_setservent_r'
23277 d_setsid='$d_setsid'
23278 d_setvbuf='$d_setvbuf'
23279 d_sfio='$d_sfio'
23280 d_shm='$d_shm'
23281 d_shmat='$d_shmat'
23282 d_shmatprototype='$d_shmatprototype'
23283 d_shmctl='$d_shmctl'
23284 d_shmdt='$d_shmdt'
23285 d_shmget='$d_shmget'
23286 d_sigaction='$d_sigaction'
23287 d_signbit='$d_signbit'
23288 d_sigprocmask='$d_sigprocmask'
23289 d_sigsetjmp='$d_sigsetjmp'
23290 d_sin6_scope_id='$d_sin6_scope_id'
23291 d_sitearch='$d_sitearch'
23292 d_snprintf='$d_snprintf'
23293 d_sockaddr_in6='$d_sockaddr_in6'
23294 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23295 d_sockatmark='$d_sockatmark'
23296 d_sockatmarkproto='$d_sockatmarkproto'
23297 d_socket='$d_socket'
23298 d_socklen_t='$d_socklen_t'
23299 d_sockpair='$d_sockpair'
23300 d_socks5_init='$d_socks5_init'
23301 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23302 d_sqrtl='$d_sqrtl'
23303 d_srand48_r='$d_srand48_r'
23304 d_srandom_r='$d_srandom_r'
23305 d_sresgproto='$d_sresgproto'
23306 d_sresuproto='$d_sresuproto'
23307 d_statblks='$d_statblks'
23308 d_statfs_f_flags='$d_statfs_f_flags'
23309 d_statfs_s='$d_statfs_s'
23310 d_static_inline='$d_static_inline'
23311 d_statvfs='$d_statvfs'
23312 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23313 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23314 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23315 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23316 d_stdio_stream_array='$d_stdio_stream_array'
23317 d_stdiobase='$d_stdiobase'
23318 d_stdstdio='$d_stdstdio'
23319 d_strchr='$d_strchr'
23320 d_strcoll='$d_strcoll'
23321 d_strctcpy='$d_strctcpy'
23322 d_strerrm='$d_strerrm'
23323 d_strerror='$d_strerror'
23324 d_strerror_r='$d_strerror_r'
23325 d_strftime='$d_strftime'
23326 d_strlcat='$d_strlcat'
23327 d_strlcpy='$d_strlcpy'
23328 d_strtod='$d_strtod'
23329 d_strtol='$d_strtol'
23330 d_strtold='$d_strtold'
23331 d_strtoll='$d_strtoll'
23332 d_strtoq='$d_strtoq'
23333 d_strtoul='$d_strtoul'
23334 d_strtoull='$d_strtoull'
23335 d_strtouq='$d_strtouq'
23336 d_strxfrm='$d_strxfrm'
23337 d_suidsafe='$d_suidsafe'
23338 d_symlink='$d_symlink'
23339 d_syscall='$d_syscall'
23340 d_syscallproto='$d_syscallproto'
23341 d_sysconf='$d_sysconf'
23342 d_sysernlst='$d_sysernlst'
23343 d_syserrlst='$d_syserrlst'
23344 d_system='$d_system'
23345 d_tcgetpgrp='$d_tcgetpgrp'
23346 d_tcsetpgrp='$d_tcsetpgrp'
23347 d_telldir='$d_telldir'
23348 d_telldirproto='$d_telldirproto'
23349 d_time='$d_time'
23350 d_timegm='$d_timegm'
23351 d_times='$d_times'
23352 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23353 d_tm_tm_zone='$d_tm_tm_zone'
23354 d_tmpnam_r='$d_tmpnam_r'
23355 d_truncate='$d_truncate'
23356 d_ttyname_r='$d_ttyname_r'
23357 d_tzname='$d_tzname'
23358 d_u32align='$d_u32align'
23359 d_ualarm='$d_ualarm'
23360 d_umask='$d_umask'
23361 d_uname='$d_uname'
23362 d_union_semun='$d_union_semun'
23363 d_unordered='$d_unordered'
23364 d_unsetenv='$d_unsetenv'
23365 d_usleep='$d_usleep'
23366 d_usleepproto='$d_usleepproto'
23367 d_ustat='$d_ustat'
23368 d_vendorarch='$d_vendorarch'
23369 d_vendorbin='$d_vendorbin'
23370 d_vendorlib='$d_vendorlib'
23371 d_vendorscript='$d_vendorscript'
23372 d_vfork='$d_vfork'
23373 d_void_closedir='$d_void_closedir'
23374 d_voidsig='$d_voidsig'
23375 d_voidtty='$d_voidtty'
23376 d_volatile='$d_volatile'
23377 d_vprintf='$d_vprintf'
23378 d_vsnprintf='$d_vsnprintf'
23379 d_wait4='$d_wait4'
23380 d_waitpid='$d_waitpid'
23381 d_wcstombs='$d_wcstombs'
23382 d_wctomb='$d_wctomb'
23383 d_writev='$d_writev'
23384 d_xenix='$d_xenix'
23385 date='$date'
23386 db_hashtype='$db_hashtype'
23387 db_prefixtype='$db_prefixtype'
23388 db_version_major='$db_version_major'
23389 db_version_minor='$db_version_minor'
23390 db_version_patch='$db_version_patch'
23391 defvoidused='$defvoidused'
23392 direntrytype='$direntrytype'
23393 dlext='$dlext'
23394 dlsrc='$dlsrc'
23395 doublesize='$doublesize'
23396 drand01='$drand01'
23397 drand48_r_proto='$drand48_r_proto'
23398 dtrace='$dtrace'
23399 dynamic_ext='$dynamic_ext'
23400 eagain='$eagain'
23401 ebcdic='$ebcdic'
23402 echo='$echo'
23403 egrep='$egrep'
23404 emacs='$emacs'
23405 endgrent_r_proto='$endgrent_r_proto'
23406 endhostent_r_proto='$endhostent_r_proto'
23407 endnetent_r_proto='$endnetent_r_proto'
23408 endprotoent_r_proto='$endprotoent_r_proto'
23409 endpwent_r_proto='$endpwent_r_proto'
23410 endservent_r_proto='$endservent_r_proto'
23411 eunicefix='$eunicefix'
23412 exe_ext='$exe_ext'
23413 expr='$expr'
23414 extensions='$extensions'
23415 extern_C='$extern_C'
23416 extras='$extras'
23417 fflushNULL='$fflushNULL'
23418 fflushall='$fflushall'
23419 find='$find'
23420 firstmakefile='$firstmakefile'
23421 flex='$flex'
23422 fpossize='$fpossize'
23423 fpostype='$fpostype'
23424 freetype='$freetype'
23425 from='$from'
23426 full_ar='$full_ar'
23427 full_csh='$full_csh'
23428 full_sed='$full_sed'
23429 gccansipedantic='$gccansipedantic'
23430 gccosandvers='$gccosandvers'
23431 gccversion='$gccversion'
23432 getgrent_r_proto='$getgrent_r_proto'
23433 getgrgid_r_proto='$getgrgid_r_proto'
23434 getgrnam_r_proto='$getgrnam_r_proto'
23435 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23436 gethostbyname_r_proto='$gethostbyname_r_proto'
23437 gethostent_r_proto='$gethostent_r_proto'
23438 getlogin_r_proto='$getlogin_r_proto'
23439 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23440 getnetbyname_r_proto='$getnetbyname_r_proto'
23441 getnetent_r_proto='$getnetent_r_proto'
23442 getprotobyname_r_proto='$getprotobyname_r_proto'
23443 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23444 getprotoent_r_proto='$getprotoent_r_proto'
23445 getpwent_r_proto='$getpwent_r_proto'
23446 getpwnam_r_proto='$getpwnam_r_proto'
23447 getpwuid_r_proto='$getpwuid_r_proto'
23448 getservbyname_r_proto='$getservbyname_r_proto'
23449 getservbyport_r_proto='$getservbyport_r_proto'
23450 getservent_r_proto='$getservent_r_proto'
23451 getspnam_r_proto='$getspnam_r_proto'
23452 gidformat='$gidformat'
23453 gidsign='$gidsign'
23454 gidsize='$gidsize'
23455 gidtype='$gidtype'
23456 glibpth='$glibpth'
23457 gmake='$gmake'
23458 gmtime_r_proto='$gmtime_r_proto'
23459 gnulibc_version='$gnulibc_version'
23460 grep='$grep'
23461 groupcat='$groupcat'
23462 groupstype='$groupstype'
23463 gzip='$gzip'
23464 h_fcntl='$h_fcntl'
23465 h_sysfile='$h_sysfile'
23466 hint='$hint'
23467 hostcat='$hostcat'
23468 html1dir='$html1dir'
23469 html1direxp='$html1direxp'
23470 html3dir='$html3dir'
23471 html3direxp='$html3direxp'
23472 i16size='$i16size'
23473 i16type='$i16type'
23474 i32size='$i32size'
23475 i32type='$i32type'
23476 i64size='$i64size'
23477 i64type='$i64type'
23478 i8size='$i8size'
23479 i8type='$i8type'
23480 i_arpainet='$i_arpainet'
23481 i_assert='$i_assert'
23482 i_bsdioctl='$i_bsdioctl'
23483 i_crypt='$i_crypt'
23484 i_db='$i_db'
23485 i_dbm='$i_dbm'
23486 i_dirent='$i_dirent'
23487 i_dld='$i_dld'
23488 i_dlfcn='$i_dlfcn'
23489 i_fcntl='$i_fcntl'
23490 i_float='$i_float'
23491 i_fp='$i_fp'
23492 i_fp_class='$i_fp_class'
23493 i_gdbm='$i_gdbm'
23494 i_gdbm_ndbm='$i_gdbm_ndbm'
23495 i_gdbmndbm='$i_gdbmndbm'
23496 i_grp='$i_grp'
23497 i_ieeefp='$i_ieeefp'
23498 i_inttypes='$i_inttypes'
23499 i_langinfo='$i_langinfo'
23500 i_libutil='$i_libutil'
23501 i_limits='$i_limits'
23502 i_locale='$i_locale'
23503 i_machcthr='$i_machcthr'
23504 i_malloc='$i_malloc'
23505 i_mallocmalloc='$i_mallocmalloc'
23506 i_math='$i_math'
23507 i_memory='$i_memory'
23508 i_mntent='$i_mntent'
23509 i_ndbm='$i_ndbm'
23510 i_netdb='$i_netdb'
23511 i_neterrno='$i_neterrno'
23512 i_netinettcp='$i_netinettcp'
23513 i_niin='$i_niin'
23514 i_poll='$i_poll'
23515 i_prot='$i_prot'
23516 i_pthread='$i_pthread'
23517 i_pwd='$i_pwd'
23518 i_rpcsvcdbm='$i_rpcsvcdbm'
23519 i_sfio='$i_sfio'
23520 i_sgtty='$i_sgtty'
23521 i_shadow='$i_shadow'
23522 i_socks='$i_socks'
23523 i_stdarg='$i_stdarg'
23524 i_stdbool='$i_stdbool'
23525 i_stddef='$i_stddef'
23526 i_stdlib='$i_stdlib'
23527 i_string='$i_string'
23528 i_sunmath='$i_sunmath'
23529 i_sysaccess='$i_sysaccess'
23530 i_sysdir='$i_sysdir'
23531 i_sysfile='$i_sysfile'
23532 i_sysfilio='$i_sysfilio'
23533 i_sysin='$i_sysin'
23534 i_sysioctl='$i_sysioctl'
23535 i_syslog='$i_syslog'
23536 i_sysmman='$i_sysmman'
23537 i_sysmode='$i_sysmode'
23538 i_sysmount='$i_sysmount'
23539 i_sysndir='$i_sysndir'
23540 i_sysparam='$i_sysparam'
23541 i_syspoll='$i_syspoll'
23542 i_sysresrc='$i_sysresrc'
23543 i_syssecrt='$i_syssecrt'
23544 i_sysselct='$i_sysselct'
23545 i_syssockio='$i_syssockio'
23546 i_sysstat='$i_sysstat'
23547 i_sysstatfs='$i_sysstatfs'
23548 i_sysstatvfs='$i_sysstatvfs'
23549 i_systime='$i_systime'
23550 i_systimek='$i_systimek'
23551 i_systimes='$i_systimes'
23552 i_systypes='$i_systypes'
23553 i_sysuio='$i_sysuio'
23554 i_sysun='$i_sysun'
23555 i_sysutsname='$i_sysutsname'
23556 i_sysvfs='$i_sysvfs'
23557 i_syswait='$i_syswait'
23558 i_termio='$i_termio'
23559 i_termios='$i_termios'
23560 i_time='$i_time'
23561 i_unistd='$i_unistd'
23562 i_ustat='$i_ustat'
23563 i_utime='$i_utime'
23564 i_values='$i_values'
23565 i_varargs='$i_varargs'
23566 i_varhdr='$i_varhdr'
23567 i_vfork='$i_vfork'
23568 ignore_versioned_solibs='$ignore_versioned_solibs'
23569 inc_version_list='$inc_version_list'
23570 inc_version_list_init='$inc_version_list_init'
23571 incpath='$incpath'
23572 inews='$inews'
23573 initialinstalllocation='$initialinstalllocation'
23574 installarchlib='$installarchlib'
23575 installbin='$installbin'
23576 installhtml1dir='$installhtml1dir'
23577 installhtml3dir='$installhtml3dir'
23578 installman1dir='$installman1dir'
23579 installman3dir='$installman3dir'
23580 installprefix='$installprefix'
23581 installprefixexp='$installprefixexp'
23582 installprivlib='$installprivlib'
23583 installscript='$installscript'
23584 installsitearch='$installsitearch'
23585 installsitebin='$installsitebin'
23586 installsitehtml1dir='$installsitehtml1dir'
23587 installsitehtml3dir='$installsitehtml3dir'
23588 installsitelib='$installsitelib'
23589 installsiteman1dir='$installsiteman1dir'
23590 installsiteman3dir='$installsiteman3dir'
23591 installsitescript='$installsitescript'
23592 installstyle='$installstyle'
23593 installusrbinperl='$installusrbinperl'
23594 installvendorarch='$installvendorarch'
23595 installvendorbin='$installvendorbin'
23596 installvendorhtml1dir='$installvendorhtml1dir'
23597 installvendorhtml3dir='$installvendorhtml3dir'
23598 installvendorlib='$installvendorlib'
23599 installvendorman1dir='$installvendorman1dir'
23600 installvendorman3dir='$installvendorman3dir'
23601 installvendorscript='$installvendorscript'
23602 intsize='$intsize'
23603 issymlink='$issymlink'
23604 ivdformat='$ivdformat'
23605 ivsize='$ivsize'
23606 ivtype='$ivtype'
23607 known_extensions='$known_extensions'
23608 ksh='$ksh'
23609 ld='$ld'
23610 ld_can_script='$ld_can_script'
23611 lddlflags='$lddlflags'
23612 ldflags='$ldflags'
23613 ldflags_uselargefiles='$ldflags_uselargefiles'
23614 ldlibpthname='$ldlibpthname'
23615 less='$less'
23616 lib_ext='$lib_ext'
23617 libc='$libc'
23618 libperl='$libperl'
23619 libpth='$libpth'
23620 libs='$libs'
23621 libsdirs='$libsdirs'
23622 libsfiles='$libsfiles'
23623 libsfound='$libsfound'
23624 libspath='$libspath'
23625 libswanted='$libswanted'
23626 libswanted_uselargefiles='$libswanted_uselargefiles'
23627 line='$line'
23628 lint='$lint'
23629 lkflags='$lkflags'
23630 ln='$ln'
23631 lns='$lns'
23632 localtime_r_proto='$localtime_r_proto'
23633 locincpth='$locincpth'
23634 loclibpth='$loclibpth'
23635 longdblsize='$longdblsize'
23636 longlongsize='$longlongsize'
23637 longsize='$longsize'
23638 lp='$lp'
23639 lpr='$lpr'
23640 ls='$ls'
23641 lseeksize='$lseeksize'
23642 lseektype='$lseektype'
23643 mad='$mad'
23644 madlyh='$madlyh'
23645 madlyobj='$madlyobj'
23646 madlysrc='$madlysrc'
23647 mail='$mail'
23648 mailx='$mailx'
23649 make='$make'
23650 make_set_make='$make_set_make'
23651 mallocobj='$mallocobj'
23652 mallocsrc='$mallocsrc'
23653 malloctype='$malloctype'
23654 man1dir='$man1dir'
23655 man1direxp='$man1direxp'
23656 man1ext='$man1ext'
23657 man3dir='$man3dir'
23658 man3direxp='$man3direxp'
23659 man3ext='$man3ext'
23660 mips_type='$mips_type'
23661 mistrustnm='$mistrustnm'
23662 mkdir='$mkdir'
23663 mmaptype='$mmaptype'
23664 modetype='$modetype'
23665 more='$more'
23666 multiarch='$multiarch'
23667 mv='$mv'
23668 myarchname='$myarchname'
23669 mydomain='$mydomain'
23670 myhostname='$myhostname'
23671 myuname='$myuname'
23672 n='$n'
23673 need_va_copy='$need_va_copy'
23674 netdb_hlen_type='$netdb_hlen_type'
23675 netdb_host_type='$netdb_host_type'
23676 netdb_name_type='$netdb_name_type'
23677 netdb_net_type='$netdb_net_type'
23678 nm='$nm'
23679 nm_opt='$nm_opt'
23680 nm_so_opt='$nm_so_opt'
23681 nonxs_ext='$nonxs_ext'
23682 nroff='$nroff'
23683 nvEUformat='$nvEUformat'
23684 nvFUformat='$nvFUformat'
23685 nvGUformat='$nvGUformat'
23686 nv_overflows_integers_at='$nv_overflows_integers_at'
23687 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23688 nveformat='$nveformat'
23689 nvfformat='$nvfformat'
23690 nvgformat='$nvgformat'
23691 nvsize='$nvsize'
23692 nvtype='$nvtype'
23693 o_nonblock='$o_nonblock'
23694 obj_ext='$obj_ext'
23695 old_pthread_create_joinable='$old_pthread_create_joinable'
23696 optimize='$optimize'
23697 orderlib='$orderlib'
23698 osname='$osname'
23699 osvers='$osvers'
23700 otherlibdirs='$otherlibdirs'
23701 package='$package'
23702 pager='$pager'
23703 passcat='$passcat'
23704 patchlevel='$patchlevel'
23705 path_sep='$path_sep'
23706 perl5='$perl5'
23707 perl='$perl'
23708 perl_patchlevel='$perl_patchlevel'
23709 perl_static_inline='$perl_static_inline'
23710 perladmin='$perladmin'
23711 perllibs='$perllibs'
23712 perlpath='$perlpath'
23713 pg='$pg'
23714 phostname='$phostname'
23715 pidtype='$pidtype'
23716 plibpth='$plibpth'
23717 pmake='$pmake'
23718 pr='$pr'
23719 prefix='$prefix'
23720 prefixexp='$prefixexp'
23721 privlib='$privlib'
23722 privlibexp='$privlibexp'
23723 procselfexe='$procselfexe'
23724 prototype='$prototype'
23725 ptrsize='$ptrsize'
23726 quadkind='$quadkind'
23727 quadtype='$quadtype'
23728 randbits='$randbits'
23729 randfunc='$randfunc'
23730 random_r_proto='$random_r_proto'
23731 randseedtype='$randseedtype'
23732 ranlib='$ranlib'
23733 rd_nodata='$rd_nodata'
23734 readdir64_r_proto='$readdir64_r_proto'
23735 readdir_r_proto='$readdir_r_proto'
23736 revision='$revision'
23737 rm='$rm'
23738 rm_try='$rm_try'
23739 rmail='$rmail'
23740 run='$run'
23741 runnm='$runnm'
23742 sGMTIME_max='$sGMTIME_max'
23743 sGMTIME_min='$sGMTIME_min'
23744 sLOCALTIME_max='$sLOCALTIME_max'
23745 sLOCALTIME_min='$sLOCALTIME_min'
23746 sPRIEUldbl='$sPRIEUldbl'
23747 sPRIFUldbl='$sPRIFUldbl'
23748 sPRIGUldbl='$sPRIGUldbl'
23749 sPRIXU64='$sPRIXU64'
23750 sPRId64='$sPRId64'
23751 sPRIeldbl='$sPRIeldbl'
23752 sPRIfldbl='$sPRIfldbl'
23753 sPRIgldbl='$sPRIgldbl'
23754 sPRIi64='$sPRIi64'
23755 sPRIo64='$sPRIo64'
23756 sPRIu64='$sPRIu64'
23757 sPRIx64='$sPRIx64'
23758 sSCNfldbl='$sSCNfldbl'
23759 sched_yield='$sched_yield'
23760 scriptdir='$scriptdir'
23761 scriptdirexp='$scriptdirexp'
23762 sed='$sed'
23763 seedfunc='$seedfunc'
23764 selectminbits='$selectminbits'
23765 selecttype='$selecttype'
23766 sendmail='$sendmail'
23767 setgrent_r_proto='$setgrent_r_proto'
23768 sethostent_r_proto='$sethostent_r_proto'
23769 setlocale_r_proto='$setlocale_r_proto'
23770 setnetent_r_proto='$setnetent_r_proto'
23771 setprotoent_r_proto='$setprotoent_r_proto'
23772 setpwent_r_proto='$setpwent_r_proto'
23773 setservent_r_proto='$setservent_r_proto'
23774 sh='$sh'
23775 shar='$shar'
23776 sharpbang='$sharpbang'
23777 shmattype='$shmattype'
23778 shortsize='$shortsize'
23779 shrpenv='$shrpenv'
23780 shsharp='$shsharp'
23781 sig_count='$sig_count'
23782 sig_name='$sig_name'
23783 sig_name_init='$sig_name_init'
23784 sig_num='$sig_num'
23785 sig_num_init='$sig_num_init'
23786 sig_size='$sig_size'
23787 signal_t='$signal_t'
23788 sitearch='$sitearch'
23789 sitearchexp='$sitearchexp'
23790 sitebin='$sitebin'
23791 sitebinexp='$sitebinexp'
23792 sitehtml1dir='$sitehtml1dir'
23793 sitehtml1direxp='$sitehtml1direxp'
23794 sitehtml3dir='$sitehtml3dir'
23795 sitehtml3direxp='$sitehtml3direxp'
23796 sitelib='$sitelib'
23797 sitelib_stem='$sitelib_stem'
23798 sitelibexp='$sitelibexp'
23799 siteman1dir='$siteman1dir'
23800 siteman1direxp='$siteman1direxp'
23801 siteman3dir='$siteman3dir'
23802 siteman3direxp='$siteman3direxp'
23803 siteprefix='$siteprefix'
23804 siteprefixexp='$siteprefixexp'
23805 sitescript='$sitescript'
23806 sitescriptexp='$sitescriptexp'
23807 sizesize='$sizesize'
23808 sizetype='$sizetype'
23809 sleep='$sleep'
23810 smail='$smail'
23811 so='$so'
23812 sockethdr='$sockethdr'
23813 socketlib='$socketlib'
23814 socksizetype='$socksizetype'
23815 sort='$sort'
23816 spackage='$spackage'
23817 spitshell='$spitshell'
23818 srand48_r_proto='$srand48_r_proto'
23819 srandom_r_proto='$srandom_r_proto'
23820 src='$src'
23821 ssizetype='$ssizetype'
23822 st_ino_sign='$st_ino_sign'
23823 st_ino_size='$st_ino_size'
23824 startperl='$startperl'
23825 startsh='$startsh'
23826 static_ext='$static_ext'
23827 stdchar='$stdchar'
23828 stdio_base='$stdio_base'
23829 stdio_bufsiz='$stdio_bufsiz'
23830 stdio_cnt='$stdio_cnt'
23831 stdio_filbuf='$stdio_filbuf'
23832 stdio_ptr='$stdio_ptr'
23833 stdio_stream_array='$stdio_stream_array'
23834 strerror_r_proto='$strerror_r_proto'
23835 strings='$strings'
23836 submit='$submit'
23837 subversion='$subversion'
23838 sysman='$sysman'
23839 tail='$tail'
23840 tar='$tar'
23841 targetarch='$targetarch'
23842 tbl='$tbl'
23843 tee='$tee'
23844 test='$test'
23845 timeincl='$timeincl'
23846 timetype='$timetype'
23847 tmpnam_r_proto='$tmpnam_r_proto'
23848 to='$to'
23849 touch='$touch'
23850 tr='$tr'
23851 trnl='$trnl'
23852 troff='$troff'
23853 ttyname_r_proto='$ttyname_r_proto'
23854 u16size='$u16size'
23855 u16type='$u16type'
23856 u32size='$u32size'
23857 u32type='$u32type'
23858 u64size='$u64size'
23859 u64type='$u64type'
23860 u8size='$u8size'
23861 u8type='$u8type'
23862 uidformat='$uidformat'
23863 uidsign='$uidsign'
23864 uidsize='$uidsize'
23865 uidtype='$uidtype'
23866 uname='$uname'
23867 uniq='$uniq'
23868 uquadtype='$uquadtype'
23869 use5005threads='$use5005threads'
23870 use64bitall='$use64bitall'
23871 use64bitint='$use64bitint'
23872 usecrosscompile='$usecrosscompile'
23873 usedevel='$usedevel'
23874 usedl='$usedl'
23875 usedtrace='$usedtrace'
23876 usefaststdio='$usefaststdio'
23877 useithreads='$useithreads'
23878 usekernprocpathname='$usekernprocpathname'
23879 uselargefiles='$uselargefiles'
23880 uselongdouble='$uselongdouble'
23881 usemallocwrap='$usemallocwrap'
23882 usemorebits='$usemorebits'
23883 usemultiplicity='$usemultiplicity'
23884 usemymalloc='$usemymalloc'
23885 usenm='$usenm'
23886 usensgetexecutablepath='$usensgetexecutablepath'
23887 useopcode='$useopcode'
23888 useperlio='$useperlio'
23889 useposix='$useposix'
23890 usereentrant='$usereentrant'
23891 userelocatableinc='$userelocatableinc'
23892 usesfio='$usesfio'
23893 useshrplib='$useshrplib'
23894 usesitecustomize='$usesitecustomize'
23895 usesocks='$usesocks'
23896 usethreads='$usethreads'
23897 usevendorprefix='$usevendorprefix'
23898 useversionedarchname='$useversionedarchname'
23899 usevfork='$usevfork'
23900 usrinc='$usrinc'
23901 uuname='$uuname'
23902 uvXUformat='$uvXUformat'
23903 uvoformat='$uvoformat'
23904 uvsize='$uvsize'
23905 uvtype='$uvtype'
23906 uvuformat='$uvuformat'
23907 uvxformat='$uvxformat'
23908 vaproto='$vaproto'
23909 vendorarch='$vendorarch'
23910 vendorarchexp='$vendorarchexp'
23911 vendorbin='$vendorbin'
23912 vendorbinexp='$vendorbinexp'
23913 vendorhtml1dir='$vendorhtml1dir'
23914 vendorhtml1direxp='$vendorhtml1direxp'
23915 vendorhtml3dir='$vendorhtml3dir'
23916 vendorhtml3direxp='$vendorhtml3direxp'
23917 vendorlib='$vendorlib'
23918 vendorlib_stem='$vendorlib_stem'
23919 vendorlibexp='$vendorlibexp'
23920 vendorman1dir='$vendorman1dir'
23921 vendorman1direxp='$vendorman1direxp'
23922 vendorman3dir='$vendorman3dir'
23923 vendorman3direxp='$vendorman3direxp'
23924 vendorprefix='$vendorprefix'
23925 vendorprefixexp='$vendorprefixexp'
23926 vendorscript='$vendorscript'
23927 vendorscriptexp='$vendorscriptexp'
23928 version='$version'
23929 version_patchlevel_string='$version_patchlevel_string'
23930 versiononly='$versiononly'
23931 vi='$vi'
23932 voidflags='$voidflags'
23933 xlibpth='$xlibpth'
23934 yacc='$yacc'
23935 yaccflags='$yaccflags'
23936 zcat='$zcat'
23937 zip='$zip'
23938 EOT
23939
23940 : add special variables
23941 $test -f $src/patchlevel.h && \
23942 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23943 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23944 echo "PERL_CONFIG_SH=true" >>config.sh
23945
23946 : propagate old symbols
23947 if $test -f UU/config.sh; then
23948         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23949         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23950                 config.sh config.sh UU/oldconfig.sh |\
23951                 $sort | $uniq -u >UU/oldsyms
23952         set X `$cat UU/oldsyms`
23953         shift
23954         case $# in
23955         0) ;;
23956         *)
23957                 $cat <<EOM
23958 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23959 EOM
23960                 echo ": Variables propagated from previous config.sh file." >>config.sh
23961                 for sym in `$cat UU/oldsyms`; do
23962                         echo "    Propagating $hint variable "'$'"$sym..."
23963                         eval 'tmp="$'"${sym}"'"'
23964                         echo "$tmp" | \
23965                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23966                 done
23967                 ;;
23968         esac
23969 fi
23970
23971 : Finish up by extracting the .SH files
23972 case "$alldone" in
23973 exit)
23974         $rm -rf UU
23975         echo "Extraction done."
23976         exit 0
23977         ;;
23978 cont)
23979         ;;
23980 '')
23981         dflt=''
23982         nostick=true
23983         $cat <<EOM
23984
23985 If you'd like to make any changes to the config.sh file before I begin
23986 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23987
23988 EOM
23989         rp="Press return or use a shell escape to edit config.sh:"
23990         . UU/myread
23991         nostick=''
23992         case "$ans" in
23993         '') ;;
23994         *) : in case they cannot read
23995                 sh 1>&4 -c "$ans";;
23996         esac
23997         ;;
23998 esac
23999
24000 : if this fails, just run all the .SH files by hand
24001 . ./config.sh
24002
24003 echo " "
24004 exec 1>&4
24005 pwd=`pwd`
24006 . ./UU/extract
24007 cd "$pwd"
24008
24009 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24010         dflt=y
24011         case "$silent" in
24012         true) ;;
24013         *)
24014                 $cat <<EOM
24015
24016 Now you need to generate make dependencies by running "$make depend".
24017 You might prefer to run it in background: "$make depend > makedepend.out &"
24018 It can take a while, so you might not want to run it right now.
24019
24020 EOM
24021                 ;;
24022         esac
24023         rp="Run $make depend now?"
24024         . UU/myread
24025         case "$ans" in
24026         y*)
24027                 $make depend && echo "Now you must run '$make'."
24028                 ;;
24029         *)
24030                 echo "You must run '$make depend' then '$make'."
24031                 ;;
24032         esac
24033 elif test -f [Mm]akefile; then
24034         echo " "
24035         echo "Now you must run a $make."
24036 else
24037         echo "Configure done."
24038 fi
24039
24040 if $test -f Policy.sh; then
24041     $cat <<EOM
24042
24043 If you compile $package on a different machine or from a different object
24044 directory, copy the Policy.sh file from this object directory to the
24045 new one before you run Configure -- this will help you with most of
24046 the policy defaults.
24047
24048 EOM
24049 fi
24050 if $test -f config.msg; then
24051     echo "Hmm.  I also noted the following information while running:"
24052     echo " "
24053     $cat config.msg >&4
24054     $rm -f config.msg
24055 fi
24056 $rm -f kit*isdone ark*isdone
24057 $rm -rf UU
24058
24059 : End of Configure
24060