This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make casing tables native
[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 Thu Aug 29 09:37:19 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                 bitrig) osname=bitrig
3259                         osvers="$3"
3260                         ;;
3261                 bsd386) osname=bsd386
3262                         osvers=`$uname -r`
3263                         ;;
3264                 cygwin*) osname=cygwin
3265                         osvers="$3"
3266                         ;;
3267                 *dc.osx) osname=dcosx
3268                         osvers="$3"
3269                         ;;
3270                 dnix) osname=dnix
3271                         osvers="$3"
3272                         ;;
3273                 domainos) osname=apollo
3274                         osvers="$3"
3275                         ;;
3276                 dgux)   osname=dgux
3277                         osvers="$3"
3278                         ;;
3279                 dragonfly) osname=dragonfly
3280                         osvers="$3"
3281                         ;;
3282                 dynixptx*) osname=dynixptx
3283                         osvers=`echo "$4"|sed 's/^v//'`
3284                         ;;
3285                 freebsd) osname=freebsd
3286                         osvers="$3" ;;
3287                 genix)  osname=genix ;;
3288                 gnu)    osname=gnu
3289                         osvers="$3" ;;
3290                 hp*)    osname=hpux
3291                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3292                         ;;
3293                 irix*)  osname=irix
3294                         case "$3" in
3295                         4*) osvers=4 ;;
3296                         5*) osvers=5 ;;
3297                         *)      osvers="$3" ;;
3298                         esac
3299                         ;;
3300                 linux)  osname=linux
3301                         case "$3" in
3302                         *)      osvers="$3" ;;
3303                         esac
3304                         ;;
3305                 MiNT)   osname=mint
3306                         ;;
3307                 netbsd*) osname=netbsd
3308                         osvers="$3"
3309                         ;;
3310                 news-os) osvers="$3"
3311                         case "$3" in
3312                         4*) osname=newsos4 ;;
3313                         *) osname=newsos ;;
3314                         esac
3315                         ;;
3316                 next*) osname=next ;;
3317                 nonstop-ux) osname=nonstopux ;;
3318                 openbsd) osname=openbsd
3319                         osvers="$3"
3320                         ;;
3321                 os2)    osname=os2
3322                         osvers="$4"
3323                         ;;
3324                 POSIX-BC | posix-bc ) osname=posix-bc
3325                         osvers="$3"
3326                         ;;
3327                 powerux | power_ux | powermax_os | powermaxos | \
3328                 powerunix | power_unix) osname=powerux
3329                         osvers="$3"
3330                         ;;
3331                 qnx) osname=qnx
3332                         osvers="$4"
3333                         ;;
3334                 solaris) osname=solaris
3335                         case "$3" in
3336                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3337                         *)      osvers="$3" ;;
3338                         esac
3339                         ;;
3340                 sunos) osname=sunos
3341                         case "$3" in
3342                         5*) osname=solaris
3343                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3344                         *)      osvers="$3" ;;
3345                         esac
3346                         ;;
3347                 titanos) osname=titanos
3348                         case "$3" in
3349                         1*) osvers=1 ;;
3350                         2*) osvers=2 ;;
3351                         3*) osvers=3 ;;
3352                         4*) osvers=4 ;;
3353                         *)      osvers="$3" ;;
3354                         esac
3355                         ;;
3356                 ultrix) osname=ultrix
3357                         osvers="$3"
3358                         ;;
3359                 osf1|mls+)      case "$5" in
3360                                 alpha)
3361                                         osname=dec_osf
3362                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3363                                         case "$osvers" in
3364                                         [1-9].[0-9]*) ;;
3365                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3366                                         esac
3367                                         ;;
3368                         hp*)    osname=hp_osf1  ;;
3369                         mips)   osname=mips_osf1 ;;
3370                         esac
3371                         ;;
3372                 # UnixWare 7.1.2 is known as Open UNIX 8
3373                 openunix|unixware) osname=svr5
3374                         osvers="$4"
3375                         ;;
3376                 uts)    osname=uts
3377                         osvers="$3"
3378                         ;;
3379                 vos) osvers="$3"
3380                         ;;
3381                 $2) case "$osname" in
3382                         *isc*) ;;
3383                         *freebsd*) ;;
3384                         svr*)
3385                                 : svr4.x or possibly later
3386                                 case "svr$3" in
3387                                 ${osname}*)
3388                                         osname=svr$3
3389                                         osvers=$4
3390                                         ;;
3391                                 esac
3392                                 case "$osname" in
3393                                 svr4.0)
3394                                         : Check for ESIX
3395                                         if test -f /stand/boot ; then
3396                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3397                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3398                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3399                                                         if test -n "$isesix"; then
3400                                                                 osname=esix4
3401                                                         fi
3402                                                 fi
3403                                         fi
3404                                         ;;
3405                                 esac
3406                                 ;;
3407                         *)      if test -f /etc/systemid; then
3408                                         osname=sco
3409                                         set `echo $3 | $sed 's/\./ /g'` $4
3410                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3411                                                 osvers=$1.$2.$3
3412                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3413                                                 osvers=$1.$2
3414                                         elif $test -f $src/hints/sco_$1.sh; then
3415                                                 osvers=$1
3416                                         fi
3417                                 else
3418                                         case "$osname" in
3419                                         '') : Still unknown.  Probably a generic Sys V.
3420                                                 osname="sysv"
3421                                                 osvers="$3"
3422                                                 ;;
3423                                         esac
3424                                 fi
3425                                 ;;
3426                         esac
3427                         ;;
3428                 *)      case "$osname" in
3429                         '') : Still unknown.  Probably a generic BSD.
3430                                 osname="$1"
3431                                 osvers="$3"
3432                                 ;;
3433                         esac
3434                         ;;
3435                 esac
3436         else
3437                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3438                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3439                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3440                                 osname=news_os
3441                         fi
3442                         $rm -f UU/kernel.what
3443                 elif test -d c:/. -o -n "$is_os2" ; then
3444                         set X $myuname
3445                         osname=os2
3446                         osvers="$5"
3447                 fi
3448         fi
3449
3450         case "$targetarch" in
3451         '') ;;
3452         *)  hostarch=$osname
3453             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3454             osvers=''
3455             ;;
3456         esac
3457
3458         : Now look for a hint file osname_osvers, unless one has been
3459         : specified already.
3460         case "$hintfile" in
3461         ''|' ')
3462                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3463                 : Also try without trailing minor version numbers.
3464                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3465                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3466                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3467                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3468                 case "$file" in
3469                 '') dflt=none ;;
3470                 *)  case "$osvers" in
3471                         '') dflt=$file
3472                                 ;;
3473                         *)  if $test -f $src/hints/$file.sh ; then
3474                                         dflt=$file
3475                                 elif $test -f $src/hints/$xfile.sh ; then
3476                                         dflt=$xfile
3477                                 elif $test -f $src/hints/$xxfile.sh ; then
3478                                         dflt=$xxfile
3479                                 elif $test -f $src/hints/$xxxfile.sh ; then
3480                                         dflt=$xxxfile
3481                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3482                                         dflt=$xxxxfile
3483                                 elif $test -f "$src/hints/${osname}.sh" ; then
3484                                         dflt="${osname}"
3485                                 else
3486                                         dflt=none
3487                                 fi
3488                                 ;;
3489                         esac
3490                         ;;
3491                 esac
3492                 if $test -f Policy.sh ; then
3493                         case "$dflt" in
3494                         *Policy*) ;;
3495                         none) dflt="Policy" ;;
3496                         *) dflt="Policy $dflt" ;;
3497                         esac
3498                 fi
3499                 ;;
3500         *)
3501                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3502                 ;;
3503         esac
3504
3505         if $test -f Policy.sh ; then
3506                 $cat <<EOM
3507
3508 There's also a Policy hint file available, which should make the
3509 site-specific (policy) questions easier to answer.
3510 EOM
3511
3512         fi
3513
3514         $cat <<EOM
3515
3516 You may give one or more space-separated answers, or "none" if appropriate.
3517 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3518 previous run of Configure, you may specify it as well as or instead of
3519 OS-specific hints.  If hints are provided for your OS, you should use them:
3520 although Perl can probably be built without hints on many platforms, using
3521 hints often improve performance and may enable features that Configure can't
3522 set up on its own. If there are no hints that match your OS, specify "none";
3523 DO NOT give a wrong version or a wrong OS.
3524
3525 EOM
3526
3527         rp="Which of these apply, if any?"
3528         . UU/myread
3529         tans=$ans
3530         for file in $tans; do
3531                 if $test X$file = XPolicy -a -f Policy.sh; then
3532                         . Policy.sh
3533                         $cat Policy.sh >> UU/config.sh
3534                 elif $test -f $src/hints/$file.sh; then
3535                         . $src/hints/$file.sh
3536                         $cat $src/hints/$file.sh >> UU/config.sh
3537                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3538                         : nothing
3539                 else
3540                         : Give one chance to correct a possible typo.
3541                         echo "$file.sh does not exist"
3542                         dflt=$file
3543                         rp="hint to use instead?"
3544                         . UU/myread
3545                         for file in $ans; do
3546                                 if $test -f "$src/hints/$file.sh"; then
3547                                         . $src/hints/$file.sh
3548                                         $cat $src/hints/$file.sh >> UU/config.sh
3549                                 elif $test X$ans = X -o X$ans = Xnone ; then
3550                                         : nothing
3551                                 else
3552                                         echo "$file.sh does not exist -- ignored."
3553                                 fi
3554                         done
3555                 fi
3556         done
3557
3558         hint=recommended
3559         : Remember our hint file for later.
3560         if $test -f "$src/hints/$file.sh" ; then
3561                 hintfile="$file"
3562         else
3563                 hintfile=''
3564         fi
3565 fi
3566 cd UU
3567 ;;
3568 *)
3569         echo " "
3570         echo "Fetching default answers from $config_sh..." >&4
3571         tmp_n="$n"
3572         tmp_c="$c"
3573         cd ..
3574         cp $config_sh config.sh 2>/dev/null
3575         chmod +w config.sh
3576         . ./config.sh
3577         cd UU
3578         cp ../config.sh .
3579         n="$tmp_n"
3580         c="$tmp_c"
3581         hint=previous
3582         ;;
3583 esac
3584 test "$override" && . ./optdef.sh
3585
3586 : Restore computed paths
3587 for file in $loclist $trylist; do
3588         eval $file="\$_$file"
3589 done
3590
3591 cat << EOM
3592
3593 Configure uses the operating system name and version to set some defaults.
3594 The default value is probably right if the name rings a bell. Otherwise,
3595 since spelling matters for me, either accept the default or answer "none"
3596 to leave it blank.
3597
3598 EOM
3599 case "$osname" in
3600         ''|' ')
3601                 case "$hintfile" in
3602                 ''|' '|none) dflt=none ;;
3603                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3604                 esac
3605                 ;;
3606         *) dflt="$osname" ;;
3607 esac
3608 rp="Operating system name?"
3609 . ./myread
3610 case "$ans" in
3611 none)  osname='' ;;
3612 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3613 esac
3614 echo " "
3615 case "$osvers" in
3616         ''|' ')
3617                 case "$hintfile" in
3618                 ''|' '|none) dflt=none ;;
3619                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3620                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3621                         case "$dflt" in
3622                         ''|' ') dflt=none ;;
3623                         esac
3624                         ;;
3625                 esac
3626                 ;;
3627         *) dflt="$osvers" ;;
3628 esac
3629 rp="Operating system version?"
3630 . ./myread
3631 case "$ans" in
3632 none)  osvers='' ;;
3633 *) osvers="$ans" ;;
3634 esac
3635
3636
3637 . ./posthint.sh
3638
3639 : who configured the system
3640 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3641 case "$cf_by" in
3642 "")
3643         cf_by=`(logname) 2>/dev/null`
3644         case "$cf_by" in
3645         "")
3646                 cf_by=`(whoami) 2>/dev/null`
3647                 case "$cf_by" in
3648                 "") cf_by=unknown ;;
3649                 esac ;;
3650         esac ;;
3651 esac
3652
3653 : decide how portable to be.  Allow command line overrides.
3654 case "$d_portable" in
3655 "$undef") ;;
3656 *)      d_portable="$define" ;;
3657 esac
3658
3659 : set up shell script to do ~ expansion
3660 cat >filexp <<EOSS
3661 $startsh
3662 : expand filename
3663 case "\$1" in
3664  \~/*|\~)
3665         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3666         ;;
3667  \~*)
3668         if $test -f /bin/csh; then
3669                 /bin/csh -f -c "glob \$1"
3670                 failed=\$?
3671                 echo ""
3672                 exit \$failed
3673         else
3674                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3675                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3676                 if $test ! -d "\$dir"; then
3677                         me=\`basename \$0\`
3678                         echo "\$me: can't locate home directory for: \$name" >&2
3679                         exit 1
3680                 fi
3681                 case "\$1" in
3682                 */*)
3683                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3684                         ;;
3685                 *)
3686                         echo \$dir
3687                         ;;
3688                 esac
3689         fi
3690         ;;
3691 *)
3692         echo \$1
3693         ;;
3694 esac
3695 EOSS
3696 chmod +x filexp
3697 $eunicefix filexp
3698
3699 : now set up to get a file name
3700 cat <<EOS >getfile
3701 $startsh
3702 EOS
3703 cat <<'EOSC' >>getfile
3704 tilde=''
3705 fullpath=''
3706 already=''
3707 skip=''
3708 none_ok=''
3709 exp_file=''
3710 nopath_ok=''
3711 orig_rp="$rp"
3712 orig_dflt="$dflt"
3713 case "$gfpth" in
3714 '') gfpth='.' ;;
3715 esac
3716
3717 case "$fn" in
3718 *\(*)
3719         : getfile will accept an answer from the comma-separated list
3720         : enclosed in parentheses even if it does not meet other criteria.
3721         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3722         fn=`echo $fn | sed 's/(.*)//'`
3723         ;;
3724 esac
3725
3726 case "$fn" in
3727 *:*)
3728         loc_file=`expr $fn : '.*:\(.*\)'`
3729         fn=`expr $fn : '\(.*\):.*'`
3730         ;;
3731 esac
3732
3733 case "$fn" in
3734 *~*) tilde=true;;
3735 esac
3736 case "$fn" in
3737 */*) fullpath=true;;
3738 esac
3739 case "$fn" in
3740 *+*) skip=true;;
3741 esac
3742 case "$fn" in
3743 *n*) none_ok=true;;
3744 esac
3745 case "$fn" in
3746 *e*) exp_file=true;;
3747 esac
3748 case "$fn" in
3749 *p*) nopath_ok=true;;
3750 esac
3751
3752 case "$fn" in
3753 *f*) type='File';;
3754 *d*) type='Directory';;
3755 *l*) type='Locate';;
3756 esac
3757
3758 what="$type"
3759 case "$what" in
3760 Locate) what='File';;
3761 esac
3762
3763 case "$exp_file" in
3764 '')
3765         case "$d_portable" in
3766         "$define") ;;
3767         *) exp_file=true;;
3768         esac
3769         ;;
3770 esac
3771
3772 cd ..
3773 while test "$type"; do
3774         redo=''
3775         rp="$orig_rp"
3776         dflt="$orig_dflt"
3777         case "$tilde" in
3778         true) rp="$rp (~name ok)";;
3779         esac
3780         . UU/myread
3781         if test -f UU/getfile.ok && \
3782                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3783         then
3784                 value="$ans"
3785                 ansexp="$ans"
3786                 break
3787         fi
3788         case "$ans" in
3789         none)
3790                 value=''
3791                 ansexp=''
3792                 case "$none_ok" in
3793                 true) type='';;
3794                 esac
3795                 ;;
3796         *)
3797                 case "$tilde" in
3798                 '') value="$ans"
3799                         ansexp="$ans";;
3800                 *)
3801                         value=`UU/filexp $ans`
3802                         case $? in
3803                         0)
3804                                 if test "$ans" != "$value"; then
3805                                         echo "(That expands to $value on this system.)"
3806                                 fi
3807                                 ;;
3808                         *) value="$ans";;
3809                         esac
3810                         ansexp="$value"
3811                         case "$exp_file" in
3812                         '') value="$ans";;
3813                         esac
3814                         ;;
3815                 esac
3816                 case "$fullpath" in
3817                 true)
3818                         case "$ansexp" in
3819                         /*) value="$ansexp" ;;
3820                         [a-zA-Z]:/*) value="$ansexp" ;;
3821                         *)
3822                                 redo=true
3823                                 case "$already" in
3824                                 true)
3825                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3826                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3827                                         ;;
3828                                 *)
3829                                 echo "Please give a full path name, starting with slash." >&4
3830                                         case "$tilde" in
3831                                         true)
3832                                 echo "Note that using ~name is ok provided it expands well." >&4
3833                                                 already=true
3834                                                 ;;
3835                                         esac
3836                                 esac
3837                                 ;;
3838                         esac
3839                         ;;
3840                 esac
3841                 case "$redo" in
3842                 '')
3843                         case "$type" in
3844                         File)
3845                                 for fp in $gfpth; do
3846                                         if test "X$fp" = X.; then
3847                                             pf="$ansexp"
3848                                         else    
3849                                             pf="$fp/$ansexp"
3850                                         fi
3851                                         if test -f "$pf"; then
3852                                                 type=''
3853                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3854                                         then
3855                                                 echo "($value is not a plain file, but that's ok.)"
3856                                                 type=''
3857                                         fi
3858                                         if test X"$type" = X; then
3859                                             value="$pf"
3860                                             break
3861                                         fi
3862                                 done
3863                                 ;;
3864                         Directory)
3865                                 for fp in $gfpth; do
3866                                         if test "X$fp" = X.; then
3867                                             dir="$ans"
3868                                             direxp="$ansexp"
3869                                         else    
3870                                             dir="$fp/$ansexp"
3871                                             direxp="$fp/$ansexp"
3872                                         fi
3873                                         if test -d "$direxp"; then
3874                                                 type=''
3875                                                 value="$dir"
3876                                                 break
3877                                         fi
3878                                 done
3879                                 ;;
3880                         Locate)
3881                                 if test -d "$ansexp"; then
3882                                         echo "(Looking for $loc_file in directory $value.)"
3883                                         value="$value/$loc_file"
3884                                         ansexp="$ansexp/$loc_file"
3885                                 fi
3886                                 if test -f "$ansexp"; then
3887                                         type=''
3888                                 fi
3889                                 case "$nopath_ok" in
3890                                 true)   case "$value" in
3891                                         */*) ;;
3892                                         *)      echo "Assuming $value will be in people's path."
3893                                                 type=''
3894                                                 ;;
3895                                         esac
3896                                         ;;
3897                                 esac
3898                                 ;;
3899                         esac
3900
3901                         case "$skip" in
3902                         true) type='';
3903                         esac
3904
3905                         case "$type" in
3906                         '') ;;
3907                         *)
3908                                 if test "$fastread" = yes; then
3909                                         dflt=y
3910                                 else
3911                                         dflt=n
3912                                 fi
3913                                 rp="$what $value doesn't exist.  Use that name anyway?"
3914                                 . UU/myread
3915                                 dflt=''
3916                                 case "$ans" in
3917                                 y*) type='';;
3918                                 *) echo " ";;
3919                                 esac
3920                                 ;;
3921                         esac
3922                         ;;
3923                 esac
3924                 ;;
3925         esac
3926 done
3927 cd UU
3928 ans="$value"
3929 rp="$orig_rp"
3930 dflt="$orig_dflt"
3931 rm -f getfile.ok
3932 test "X$gfpthkeep" != Xy && gfpth=""
3933 EOSC
3934
3935 : determine root of directory hierarchy where package will be installed.
3936 case "$prefix" in
3937 '')
3938         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3939         ;;
3940 *?/)
3941         dflt=`echo "$prefix" | sed 's/.$//'`
3942         ;;
3943 *)
3944         dflt="$prefix"
3945         ;;
3946 esac
3947 $cat <<EOM
3948
3949 By default, $package will be installed in $dflt/bin, manual pages
3950 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3951 installation directories. Typically this is something like /usr/local.
3952 If you wish to have binaries under /usr/bin but other parts of the
3953 installation under /usr/local, that's ok: you will be prompted
3954 separately for each of the installation directories, the prefix being
3955 only used to set the defaults.
3956
3957 EOM
3958 fn=d~
3959 rp='Installation prefix to use?'
3960 . ./getfile
3961 oldprefix=''
3962 case "$prefix" in
3963 '') ;;
3964 *)
3965         case "$ans" in
3966         "$prefix") ;;
3967         *) oldprefix="$prefix";;
3968         esac
3969         ;;
3970 esac
3971 prefix="$ans"
3972 prefixexp="$ansexp"
3973
3974 : allow them to override the AFS root
3975 case "$afsroot" in
3976 '')     afsroot=/afs ;;
3977 *)      afsroot=$afsroot ;;
3978 esac
3979
3980 : is AFS running?
3981 echo " "
3982 case "$afs" in
3983 $define|true)   afs=true ;;
3984 $undef|false)   afs=false ;;
3985 *)      if $test -d $afsroot; then
3986                 afs=true
3987         else
3988                 afs=false
3989         fi
3990         ;;
3991 esac
3992 if $afs; then
3993         echo "AFS may be running... I'll be extra cautious then..." >&4
3994 else
3995         echo "AFS does not seem to be running..." >&4
3996 fi
3997
3998 : determine installation prefix for where package is to be installed.
3999 if $afs; then
4000 $cat <<EOM
4001
4002 Since you are running AFS, I need to distinguish the directory in which
4003 files will reside from the directory in which they are installed (and from
4004 which they are presumably copied to the former directory by occult means).
4005
4006 EOM
4007         case "$installprefix" in
4008         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4009         *) dflt="$installprefix";;
4010         esac
4011 else
4012 $cat <<EOM
4013
4014 In some special cases, particularly when building $package for distribution,
4015 it is convenient to distinguish the directory in which files should be
4016 installed from the directory ($prefix) in which they will
4017 eventually reside.  For most users, these two directories are the same.
4018
4019 EOM
4020         case "$installprefix" in
4021         '') dflt=$prefix ;;
4022         *) dflt=$installprefix;;
4023         esac
4024 fi
4025 fn=d~
4026 rp='What installation prefix should I use for installing files?'
4027 . ./getfile
4028 installprefix="$ans"
4029 installprefixexp="$ansexp"
4030
4031 : Perform the prefixexp/installprefixexp correction if necessary
4032 cat <<EOS >installprefix
4033 $startsh
4034 EOS
4035 cat <<'EOSC' >>installprefix
4036 : Change installation prefix, if necessary.
4037 if $test X"$prefix" != X"$installprefix"; then
4038     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4039 else
4040     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4041 fi
4042 EOSC
4043 chmod +x installprefix
4044 $eunicefix installprefix
4045
4046 : Set variables such as privlib and privlibexp from the output of ./getfile
4047 : performing the prefixexp/installprefixexp correction if necessary.
4048 cat <<EOS >setprefixvar
4049 $startsh
4050 EOS
4051 cat <<'EOSC' >>setprefixvar
4052 eval "${prefixvar}=\"\$ans\""
4053 eval "${prefixvar}exp=\"\$ansexp\""
4054 . ./installprefix
4055 EOSC
4056 chmod +x setprefixvar
4057 $eunicefix setprefixvar
4058
4059 : set up the script used to warn in case of inconsistency
4060 cat <<EOS >whoa
4061 $startsh
4062 EOS
4063 cat <<'EOSC' >>whoa
4064 dflt=y
4065 case "$hint" in
4066     recommended)
4067         case "$hintfile" in
4068         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4069                 ;;
4070         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4071                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4072                 ;;
4073         esac
4074         ;;
4075     *)  echo " "
4076         echo "*** WHOA THERE!!! ***" >&4
4077         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4078         ;;
4079 esac
4080 rp="    Keep the $hint value?"
4081 . ./myread
4082 case "$ans" in
4083 y) td=$was; tu=$was;;
4084 esac
4085 EOSC
4086
4087 : function used to set '$1' to '$val'
4088 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4089 case "$val$was" in
4090 $define$undef) . ./whoa; eval "$var=\$td";;
4091 $undef$define) . ./whoa; eval "$var=\$tu";;
4092 *) eval "$var=$val";;
4093 esac'
4094
4095 : get the patchlevel
4096 echo " "
4097 echo "Getting the current patchlevel..." >&4
4098 if $test -r $rsrc/patchlevel.h;then
4099         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4100         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4101         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4102         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4103         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4104         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4105         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4106 else
4107         revision=0
4108         patchlevel=0
4109         subversion=0
4110         api_revision=0
4111         api_version=0
4112         api_subversion=0
4113         perl_patchlevel=0
4114         $echo "(You do not have patchlevel.h.  Eek.)"
4115 fi
4116 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4117 version_patchlevel_string="version $patchlevel subversion $subversion"
4118 case "$perl_patchlevel" in
4119 0|'') ;;
4120 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4121     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4122     ;;
4123 esac
4124
4125 $echo "(You have $package $version_patchlevel_string.)"
4126
4127 case "$osname" in
4128 dos|vms)
4129         : XXX Should be a Configure test for double-dots in filenames.
4130         version=`echo $revision $patchlevel $subversion | \
4131                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4132         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4133                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4134         ;;
4135 *)
4136         version=`echo $revision $patchlevel $subversion | \
4137                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4138         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4139                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4140         ;;
4141 esac
4142 : Special case the 5.005_xx maintenance series, which used 5.005
4143 : without any subversion label as a subdirectory in $sitelib
4144 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4145         api_versionstring='5.005'
4146 fi
4147
4148 : Do we want threads support and if so, what type
4149 case "$usethreads" in
4150 $define|true|[yY]*)     dflt='y';;
4151 *)     # Catch case where user specified ithreads or 5005threads but
4152        # forgot -Dusethreads (A.D. 4/2002)
4153        case "$useithreads$use5005threads" in
4154        *$define*)       dflt='y';;
4155        *)               dflt='n';;
4156        esac
4157        ;;
4158 esac
4159 cat <<EOM
4160
4161 Perl can be built to offer a form of threading support on some systems
4162 To do so, Configure can be run with -Dusethreads.
4163
4164 Note that Perl built with threading support runs slightly slower
4165 and uses slightly more memory than plain Perl.
4166
4167 If this doesn't make any sense to you, just accept the default '$dflt'.
4168 EOM
4169 rp='Build a threading Perl?'
4170 . ./myread
4171 case "$ans" in
4172 y|Y)    val="$define" ;;
4173 *)      val="$undef" ;;
4174 esac
4175 set usethreads
4176 eval $setvar
4177
4178 if $test $patchlevel -lt 9; then
4179     case "$usethreads" in
4180     $define)
4181         : Default to ithreads unless overridden on command line or with
4182         : old config.sh
4183         dflt='y'
4184         case "$use5005threads" in
4185                 $define|true|[yY]*)
4186                         echo "5.005 threads are no longer supported"
4187                         exit 1
4188                 ;;
4189         esac
4190         case "$useithreads" in
4191                 $undef|false|[nN]*) dflt='n';;
4192         esac
4193         rp='Use the newer interpreter-based ithreads?'
4194         . ./myread
4195         case "$ans" in
4196         y|Y)    val="$define" ;;
4197         *)      val="$undef" ;;
4198         esac
4199         set useithreads
4200         eval $setvar
4201         : Now set use5005threads to the opposite value.
4202         case "$useithreads" in
4203         $define) val="$undef" ;;
4204         *) val="$define" ;;
4205         esac
4206         set use5005threads
4207         eval $setvar
4208         ;;
4209     *)
4210         useithreads="$undef"
4211         use5005threads="$undef"
4212         ;;
4213     esac
4214
4215     case "$useithreads$use5005threads" in
4216     "$define$define")
4217         $cat >&4 <<EOM
4218
4219 You cannot have both the ithreads and the 5.005 threads enabled
4220 at the same time.  Disabling the 5.005 threads since they are
4221 much less stable than the ithreads.
4222
4223 EOM
4224         use5005threads="$undef"
4225         ;;
4226     esac
4227
4228 else
4229 : perl-5.9.x and later
4230
4231     if test X"$usethreads" = "X$define"; then
4232         case "$use5005threads" in
4233             $define|true|[yY]*)
4234                 $cat >&4 <<EOM
4235
4236 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4237
4238 EOM
4239             ;;
4240         esac
4241     fi
4242
4243     use5005threads="$undef"
4244     useithreads="$usethreads"
4245 fi
4246
4247 case "$d_oldpthreads" in
4248 '')     : Configure tests would be welcome here.  For now, assume undef.
4249         val="$undef" ;;
4250 *)      val="$d_oldpthreads" ;;
4251 esac
4252 set d_oldpthreads
4253 eval $setvar
4254
4255
4256 : Look for a hint-file generated 'call-back-unit'.  If the
4257 : user has specified that a threading perl is to be built,
4258 : we may need to set or change some other defaults.
4259 if $test -f usethreads.cbu; then
4260     echo "Your platform has some specific hints regarding threaded builds, using them..."
4261     . ./usethreads.cbu
4262 else
4263     case "$usethreads" in
4264         "$define"|true|[yY]*)
4265                 $cat <<EOM
4266 (Your platform does not have any specific hints for threaded builds.
4267  Assuming POSIX threads, then.)
4268 EOM
4269         ;;
4270     esac
4271 fi
4272
4273 : Check if multiplicity is required
4274 cat <<EOM
4275
4276 Perl can be built so that multiple Perl interpreters can coexist
4277 within the same Perl executable.
4278 EOM
4279
4280 case "$useithreads" in
4281 $define)
4282         cat <<EOM
4283 This multiple interpreter support is required for interpreter-based threads.
4284 EOM
4285         val="$define"
4286         ;;
4287 *)      case "$usemultiplicity" in
4288         $define|true|[yY]*)     dflt='y';;
4289         *) dflt='n';;
4290         esac
4291         echo " "
4292         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4293         rp='Build Perl for multiplicity?'
4294         . ./myread
4295         case "$ans" in
4296         y|Y)    val="$define" ;;
4297         *)      val="$undef" ;;
4298         esac
4299         ;;
4300 esac
4301 set usemultiplicity
4302 eval $setvar
4303
4304 : Check if morebits is requested
4305 case "$usemorebits" in
4306 "$define"|true|[yY]*)
4307         use64bitint="$define"
4308         uselongdouble="$define"
4309         usemorebits="$define"
4310         ;;
4311 *)      usemorebits="$undef"
4312         ;;
4313 esac
4314
4315 : Determine the C compiler to be used
4316 echo " "
4317 case "$cc" in
4318 '') dflt=cc;;
4319 *) dflt="$cc";;
4320 esac
4321 rp="Use which C compiler?"
4322 . ./myread
4323 cc="$ans"
4324
4325 : See whether they have no cc but they do have gcc
4326 . ./trygcc
4327 if $test -f cc.cbu; then
4328     . ./cc.cbu
4329 fi
4330 . ./checkcc
4331
4332 : make some quick guesses about what we are up against
4333 echo " "
4334 $echo $n "Hmm...  $c"
4335 echo exit 1 >bsd
4336 echo exit 1 >usg
4337 echo exit 1 >v7
4338 echo exit 1 >osf1
4339 echo exit 1 >eunice
4340 echo exit 1 >xenix
4341 echo exit 1 >venix
4342 echo exit 1 >os2
4343 d_bsd="$undef"
4344 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4345 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4346 then
4347         echo "Looks kind of like an OSF/1 system, but we'll see..."
4348         echo exit 0 >osf1
4349 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4350         xxx=`./loc addbib blurfl $pth`
4351         if $test -f $xxx; then
4352         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4353                 echo exit 0 >bsd
4354                 echo exit 0 >usg
4355         else
4356                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4357                         echo "Looks kind of like an extended USG system, but we'll see..."
4358                 else
4359                         echo "Looks kind of like a USG system, but we'll see..."
4360                 fi
4361                 echo exit 0 >usg
4362         fi
4363 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4364         echo "Looks kind of like a BSD system, but we'll see..."
4365         d_bsd="$define"
4366         echo exit 0 >bsd
4367 else
4368         echo "Looks kind of like a Version 7 system, but we'll see..."
4369         echo exit 0 >v7
4370 fi
4371 case "$eunicefix" in
4372 *unixtovms*)
4373         $cat <<'EOI'
4374 There is, however, a strange, musty smell in the air that reminds me of
4375 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4376 EOI
4377         echo exit 0 >eunice
4378         d_eunice="$define"
4379 : it so happens the Eunice I know will not run shell scripts in Unix format
4380         ;;
4381 *)
4382         echo " "
4383         echo "Congratulations.  You aren't running Eunice."
4384         d_eunice="$undef"
4385         ;;
4386 esac
4387 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4388 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4389 : semicolon as a patch separator
4390 case "$p_" in
4391 :) ;;
4392 *)
4393         $cat <<'EOI'
4394 I have the feeling something is not exactly right, however...don't tell me...
4395 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4396 (Or you may be running DOS with DJGPP.)
4397 EOI
4398         echo exit 0 >os2
4399         ;;
4400 esac
4401 if test -f /xenix; then
4402         echo "Actually, this looks more like a XENIX system..."
4403         echo exit 0 >xenix
4404         d_xenix="$define"
4405 else
4406         echo " "
4407         echo "It's not Xenix..."
4408         d_xenix="$undef"
4409 fi
4410 chmod +x xenix
4411 $eunicefix xenix
4412 if test -f /venix; then
4413         echo "Actually, this looks more like a VENIX system..."
4414         echo exit 0 >venix
4415 else
4416         echo " "
4417         if ./xenix; then
4418                 : null
4419         else
4420                 echo "Nor is it Venix..."
4421         fi
4422 fi
4423 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4424 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4425 $rm -f foo
4426
4427 : Check if we are using GNU gcc and what its version is
4428 echo " "
4429 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4430 $cat >try.c <<EOM
4431 #include <stdio.h>
4432 int main() {
4433 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4434 #ifdef __VERSION__
4435         printf("%s\n", __VERSION__);
4436 #else
4437         printf("%s\n", "1");
4438 #endif
4439 #endif
4440         return(0);
4441 }
4442 EOM
4443 if $cc -o try $ccflags $ldflags try.c; then
4444         gccversion=`$run ./try`
4445         case "$gccversion" in
4446         '') echo "You are not using GNU cc." ;;
4447         *)  echo "You are using GNU cc $gccversion."
4448             ccname=gcc
4449             ;;
4450         esac
4451 else
4452         echo " "
4453         echo "*** WHOA THERE!!! ***" >&4
4454         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4455         case "$knowitall" in
4456         '')
4457         echo "    You'd better start hunting for one and let me know about it." >&4
4458                 exit 1
4459                 ;;
4460         esac
4461 fi
4462 $rm -f try try.*
4463 case "$gccversion" in
4464 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4465 esac
4466 case "$gccversion" in
4467 '') gccosandvers='' ;;
4468 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4469    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4470    gccshortvers=''
4471    case "$gccosandvers" in
4472    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4473    $osname$osvers) ;; # looking good
4474    $osname*) cat <<EOM >&4
4475
4476 *** WHOA THERE!!! ***
4477
4478     Your gcc has not been compiled for the exact release of
4479     your operating system ($gccosandvers versus $osname$osvers).
4480
4481     In general it is a good idea to keep gcc synchronized with
4482     the operating system because otherwise serious problems
4483     may ensue when trying to compile software, like Perl.
4484
4485     I'm trying to be optimistic here, though, and will continue.
4486     If later during the configuration and build icky compilation
4487     problems appear (headerfile conflicts being the most common
4488     manifestation), I suggest reinstalling the gcc to match
4489     your operating system release.
4490
4491 EOM
4492       ;;
4493    *) gccosandvers='' ;; # failed to parse, better be silent
4494    esac
4495    ;;
4496 esac
4497 case "$ccname" in
4498 '') ccname="$cc" ;;
4499 esac
4500
4501 # gcc 3.* complain about adding -Idirectories that they already know about,
4502 # so we will take those off from locincpth.
4503 case "$gccversion" in
4504 3*)
4505     echo "main(){}">try.c
4506     for incdir in $locincpth; do
4507        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4508              grep '^c[cp]p*[01]: warning: changing search order '`
4509        if test "X$warn" != X; then
4510            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4511        fi
4512     done
4513     $rm -f try try.*
4514 esac
4515
4516 : What should the include directory be ?
4517 echo " "
4518 $echo $n "Hmm...  $c"
4519 dflt='/usr/include'
4520 incpath=''
4521 mips_type=''
4522 if $test -f /bin/mips && /bin/mips; then
4523         echo "Looks like a MIPS system..."
4524         $cat >usr.c <<'EOCP'
4525 #ifdef SYSTYPE_BSD43
4526 /bsd43
4527 #endif
4528 EOCP
4529         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4530                 dflt='/bsd43/usr/include'
4531                 incpath='/bsd43'
4532                 mips_type='BSD 4.3'
4533         else
4534                 mips_type='System V'
4535         fi
4536         $rm -f usr.c usr.out
4537         echo "and you're compiling with the $mips_type compiler and libraries."
4538         xxx_prompt=y
4539         echo "exit 0" >mips
4540 else
4541         echo "Doesn't look like a MIPS system."
4542         xxx_prompt=n
4543         echo "exit 1" >mips
4544 fi
4545 chmod +x mips
4546 $eunicefix mips
4547 case "$usrinc" in
4548 '') ;;
4549 *) dflt="$usrinc";;
4550 esac
4551 case "$xxx_prompt" in
4552 y)      fn=d/
4553         echo " "
4554         rp='Where are the include files you want to use?'
4555         . ./getfile
4556         usrinc="$ans"
4557         ;;
4558 *)      usrinc="$dflt"
4559         ;;
4560 esac
4561
4562 : see how we invoke the C preprocessor
4563 echo " "
4564 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4565 cat <<'EOT' >testcpp.c
4566 #define ABC abc
4567 #define XYZ xyz
4568 ABC.XYZ
4569 EOT
4570 cd ..
4571 if test ! -f cppstdin; then
4572         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4573                 # AIX cc -E doesn't show the absolute headerfile
4574                 # locations but we'll cheat by using the -M flag.
4575                 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
4576         else
4577                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4578         fi
4579 else
4580         echo "Keeping your $hint cppstdin wrapper."
4581 fi
4582 chmod 755 cppstdin
4583 wrapper=`pwd`/cppstdin
4584 ok='false'
4585 cd UU
4586
4587 if $test "X$cppstdin" != "X" && \
4588         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4589         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4590 then
4591         echo "You used to use $cppstdin $cppminus so we'll use that again."
4592         case "$cpprun" in
4593         '') echo "But let's see if we can live without a wrapper..." ;;
4594         *)
4595                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4596                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4597                 then
4598                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4599                         ok='true'
4600                 else
4601                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4602                 fi
4603                 ;;
4604         esac
4605 else
4606         case "$cppstdin" in
4607         '') ;;
4608         *)
4609                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4610                 ;;
4611         esac
4612 fi
4613
4614 if $ok; then
4615         : nothing
4616 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4617         $cc -E <testcpp.c >testcpp.out 2>&1; \
4618         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4619         echo "Yup, it does."
4620         x_cpp="$cc -E"
4621         x_minus='';
4622 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4623         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4624         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4625         echo "Yup, it does."
4626         x_cpp="$cc -E"
4627         x_minus='-';
4628 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4629         $cc -P <testcpp.c >testcpp.out 2>&1; \
4630         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4631         echo "Yipee, that works!"
4632         x_cpp="$cc -P"
4633         x_minus='';
4634 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4635         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4636         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4637         echo "At long last!"
4638         x_cpp="$cc -P"
4639         x_minus='-';
4640 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4641         $cpp <testcpp.c >testcpp.out 2>&1; \
4642         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4643         echo "It works!"
4644         x_cpp="$cpp"
4645         x_minus='';
4646 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4647         $cpp - <testcpp.c >testcpp.out 2>&1; \
4648         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4649         echo "Hooray, it works!  I was beginning to wonder."
4650         x_cpp="$cpp"
4651         x_minus='-';
4652 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4653         $wrapper <testcpp.c >testcpp.out 2>&1; \
4654         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4655         x_cpp="$wrapper"
4656         x_minus=''
4657         echo "Eureka!"
4658 else
4659         dflt=''
4660         rp="No dice.  I can't find a C preprocessor.  Name one:"
4661         . ./myread
4662         x_cpp="$ans"
4663         x_minus=''
4664         $x_cpp <testcpp.c >testcpp.out 2>&1
4665         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4666                 echo "OK, that will do." >&4
4667         else
4668 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4669                 exit 1
4670         fi
4671 fi
4672
4673 case "$ok" in
4674 false)
4675         cppstdin="$x_cpp"
4676         cppminus="$x_minus"
4677         cpprun="$x_cpp"
4678         cpplast="$x_minus"
4679         set X $x_cpp
4680         shift
4681         case "$1" in
4682         "$cpp")
4683                 echo "Perhaps can we force $cc -E using a wrapper..."
4684                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4685                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4686                 then
4687                         echo "Yup, we can."
4688                         cppstdin="$wrapper"
4689                         cppminus='';
4690                 else
4691                         echo "Nope, we'll have to live without it..."
4692                 fi
4693                 ;;
4694         esac
4695         case "$cpprun" in
4696         "$wrapper")
4697                 cpprun=''
4698                 cpplast=''
4699                 ;;
4700         esac
4701         ;;
4702 esac
4703
4704 case "$cppstdin" in
4705 "$wrapper"|'cppstdin') ;;
4706 *) $rm -f $wrapper;;
4707 esac
4708 $rm -f testcpp.c testcpp.out
4709
4710 : Set private lib path
4711 case "$plibpth" in
4712 '') if ./mips; then
4713                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4714         fi;;
4715 esac
4716 case "$libpth" in
4717 ' ') dlist='';;
4718 '') dlist="$loclibpth $plibpth $glibpth";;
4719 *) dlist="$libpth";;
4720 esac
4721
4722 : Now check and see which directories actually exist, avoiding duplicates
4723 libpth=''
4724 for xxx in $dlist
4725 do
4726     if $test -d $xxx; then
4727                 case " $libpth " in
4728                 *" $xxx "*) ;;
4729                 *) libpth="$libpth $xxx";;
4730                 esac
4731     fi
4732 done
4733 $cat <<'EOM'
4734
4735 Some systems have incompatible or broken versions of libraries.  Among
4736 the directories listed in the question below, please remove any you
4737 know not to be holding relevant libraries, and add any that are needed.
4738 Say "none" for none.
4739
4740 EOM
4741 case "$libpth" in
4742 '') dflt='none';;
4743 *)
4744         set X $libpth
4745         shift
4746         dflt=${1+"$@"}
4747         ;;
4748 esac
4749 rp="Directories to use for library searches?"
4750 . ./myread
4751 case "$ans" in
4752 none) libpth=' ';;
4753 *) libpth="$ans";;
4754 esac
4755
4756 : compute shared library extension
4757 case "$so" in
4758 '')
4759         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4760                 dflt='sl'
4761         else
4762                 dflt='so'
4763         fi
4764         ;;
4765 *) dflt="$so";;
4766 esac
4767 $cat <<EOM
4768
4769 On some systems, shared libraries may be available.  Answer 'none' if
4770 you want to suppress searching of shared libraries for the remainder
4771 of this configuration.
4772
4773 EOM
4774 rp='What is the file extension used for shared libraries?'
4775 . ./myread
4776 so="$ans"
4777
4778 : Define several unixisms.
4779 : Hints files or command line option can be used to override them.
4780 : The convoluted testing is in case hints files set either the old
4781 : or the new name.
4782 case "$_exe" in
4783 '')     case "$exe_ext" in
4784         '')     ;;
4785         *)      _exe="$exe_ext" ;;
4786         esac
4787         ;;
4788 esac
4789 case "$_a" in
4790 '')     case "$lib_ext" in
4791     '') _a='.a';;
4792         *)      _a="$lib_ext" ;;
4793         esac
4794         ;;
4795 esac
4796 case "$_o" in
4797 '') case "$obj_ext" in
4798         '')     _o='.o';;
4799         *)      _o="$obj_ext";;
4800         esac
4801         ;;
4802 esac
4803 case "$p_" in
4804 '') case "$path_sep" in
4805         '')     p_=':';;
4806         *)      p_="$path_sep";;
4807         esac
4808         ;;
4809 esac
4810 exe_ext=$_exe
4811 lib_ext=$_a
4812 obj_ext=$_o
4813 path_sep=$p_
4814
4815 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4816
4817 : Which makefile gets called first.  This is used by make depend.
4818 case "$firstmakefile" in
4819 '') firstmakefile='makefile';;
4820 esac
4821
4822 : Check is we will use socks
4823 case "$usesocks" in
4824 $define|true|[yY]*)     dflt='y';;
4825 *) dflt='n';;
4826 esac
4827 cat <<EOM
4828
4829 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4830 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4831 to use the PerlIO abstraction layer, this will be implicitly selected.
4832
4833 If this doesn't make any sense to you, just accept the default '$dflt'.
4834 EOM
4835 rp='Build Perl for SOCKS?'
4836 . ./myread
4837 case "$ans" in
4838 y|Y)    val="$define" ;;
4839 *)      val="$undef" ;;
4840 esac
4841 set usesocks
4842 eval $setvar
4843
4844 : Check for uselongdouble support
4845 case "$ccflags" in
4846 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4847 esac
4848
4849 case "$uselongdouble" in
4850 $define|true|[yY]*)     dflt='y';;
4851 *) dflt='n';;
4852 esac
4853 cat <<EOM
4854
4855 Perl can be built to take advantage of long doubles which
4856 (if available) may give more accuracy and range for floating point numbers.
4857
4858 If this doesn't make any sense to you, just accept the default '$dflt'.
4859 EOM
4860 rp='Try to use long doubles if available?'
4861 . ./myread
4862 case "$ans" in
4863 y|Y)    val="$define"   ;;
4864 *)      val="$undef"    ;;
4865 esac
4866 set uselongdouble
4867 eval $setvar
4868
4869 case "$uselongdouble" in
4870 true|[yY]*) uselongdouble="$define" ;;
4871 esac
4872
4873 : Look for a hint-file generated 'call-back-unit'.  If the
4874 : user has specified that long doubles should be used,
4875 : we may need to set or change some other defaults.
4876 if $test -f uselongdouble.cbu; then
4877     echo "Your platform has some specific hints regarding long doubles, using them..."
4878     . ./uselongdouble.cbu
4879 else
4880     case "$uselongdouble" in
4881         $define)
4882                 $cat <<EOM
4883 (Your platform does not have any specific hints for long doubles.)
4884 EOM
4885         ;;
4886     esac
4887 fi
4888
4889 : Looking for optional libraries
4890 echo " "
4891 echo "Checking for optional libraries..." >&4
4892 case "$libs" in
4893 ' '|'') dflt='';;
4894 *) dflt="$libs";;
4895 esac
4896 case "$libswanted" in
4897 '') libswanted='c_s';;
4898 esac
4899 case "$usesocks" in
4900 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4901 esac
4902 libsfound=''
4903 libsfiles=''
4904 libsdirs=''
4905 libspath=''
4906 for thisdir in $libpth $xlibpth; do
4907   test -d $thisdir && libspath="$libspath $thisdir"
4908 done
4909 for thislib in $libswanted; do
4910         for thisdir in $libspath; do
4911             xxx=''
4912             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4913                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4914                 $test -f "$xxx" && eval $libscheck
4915                 $test -f "$xxx" && libstyle=shared
4916             fi
4917             if test ! -f "$xxx"; then
4918                 xxx=$thisdir/lib$thislib.$so
4919                 $test -f "$xxx" && eval $libscheck
4920                 $test -f "$xxx" && libstyle=shared
4921             fi
4922             if test ! -f "$xxx"; then
4923                 xxx=$thisdir/lib$thislib$_a
4924                 $test -f "$xxx" && eval $libscheck
4925                 $test -f "$xxx" && libstyle=static
4926             fi
4927             if test ! -f "$xxx"; then
4928                 xxx=$thisdir/$thislib$_a
4929                 $test -f "$xxx" && eval $libscheck
4930                 $test -f "$xxx" && libstyle=static
4931             fi
4932             if test ! -f "$xxx"; then
4933                 xxx=$thisdir/lib${thislib}_s$_a
4934                 $test -f "$xxx" && eval $libscheck
4935                 $test -f "$xxx" && libstyle=static
4936                 $test -f "$xxx" && thislib=${thislib}_s
4937             fi
4938             if test ! -f "$xxx"; then
4939                 xxx=$thisdir/Slib$thislib$_a
4940                 $test -f "$xxx" && eval $libscheck
4941                 $test -f "$xxx" && libstyle=static
4942             fi
4943             if $test -f "$xxx"; then
4944                 case "$libstyle" in
4945                 shared) echo "Found -l$thislib (shared)." ;;
4946                 static) echo "Found -l$thislib." ;;
4947                 *)      echo "Found -l$thislib ($libstyle)." ;;
4948                 esac
4949                 case " $dflt " in
4950                 *"-l$thislib "*);;
4951                 *) dflt="$dflt -l$thislib"
4952                    libsfound="$libsfound $xxx"
4953                    yyy=`basename $xxx`
4954                    libsfiles="$libsfiles $yyy"
4955                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4956                    case " $libsdirs " in
4957                    *" $yyy "*) ;;
4958                    *) libsdirs="$libsdirs $yyy" ;;
4959                    esac
4960                    ;;
4961                 esac
4962                 break
4963             fi
4964         done
4965         if $test ! -f "$xxx"; then
4966             echo "No -l$thislib."
4967         fi
4968 done
4969 set X $dflt
4970 shift
4971 dflt="$*"
4972 case "$libs" in
4973 '') dflt="$dflt";;
4974 *) dflt="$libs";;
4975 esac
4976 case "$dflt" in
4977 ' '|'') dflt='none';;
4978 esac
4979
4980 $cat <<EOM
4981
4982 In order to compile $package on your machine, a number of libraries
4983 are usually needed.  Include any other special libraries here as well.
4984 Say "none" for none.  The default list is almost always right.
4985 EOM
4986
4987 echo " "
4988 rp="What libraries to use?"
4989 . ./myread
4990 case "$ans" in
4991 none) libs=' ';;
4992 *) libs="$ans";;
4993 esac
4994
4995 : determine optimization, if desired, or use for debug flag also
4996 case "$optimize" in
4997 ' '|$undef) dflt='none';;
4998 '') dflt='-O';;
4999 *) dflt="$optimize";;
5000 esac
5001 $cat <<EOH
5002
5003 By default, $package compiles with the -O flag to use the optimizer.
5004 Alternately, you might want to use the symbolic debugger, which uses
5005 the -g flag (on traditional Unix systems).  Either flag can be
5006 specified here.  To use neither flag, specify the word "none".
5007
5008 EOH
5009 rp="What optimizer/debugger flag should be used?"
5010 . ./myread
5011 optimize="$ans"
5012 case "$optimize" in
5013 'none') optimize=" ";;
5014 esac
5015
5016 : Check what DEBUGGING is required from the command line
5017 : -DEBUGGING      or -DDEBUGGING or
5018 : -DEBUGGING=both                       = -g + -DDEBUGGING
5019 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5020 : -DEBUGGING=none or -UDEBUGGING        =
5021 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5022 case "$EBUGGING" in
5023 '')     ;;
5024 *)      DEBUGGING=$EBUGGING ;;
5025 esac
5026
5027 case "$DEBUGGING" in
5028 -g|both|$define)
5029     case "$optimize" in
5030         *-g*) ;;
5031         *)    optimize="$optimize -g" ;;
5032     esac ;;
5033 none|$undef)
5034     case "$optimize" in
5035         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5036                 shift
5037                 optimize="$*"
5038                 ;;
5039     esac ;;
5040 esac
5041
5042 dflt=''
5043 case "$DEBUGGING" in
5044 both|$define) dflt='-DDEBUGGING'
5045 esac
5046
5047 : argument order is deliberate, as the flag will start with - which set could
5048 : think is an option
5049 checkccflag='check=$1; flag=$2; callback=$3;
5050 echo " ";
5051 echo "Checking if your compiler accepts $flag" 2>&1;
5052 echo "int main(void) { return 0; }" > gcctest.c;
5053 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5054     echo "Yes, it does." 2>&1;
5055     if $test -s gcctest.out ; then
5056         echo "But your platform does not like it:";
5057         cat gcctest.out;
5058     else
5059         case "$ccflags" in
5060         *$check*)
5061             echo "Leaving current flags $ccflags alone." 2>&1
5062             ;;
5063         *) dflt="$dflt $flag";
5064             eval $callback
5065             ;;
5066         esac
5067     fi
5068 else
5069     echo "Nope, it does not, but that is ok." 2>&1;
5070 fi
5071 '
5072
5073 : We will not override a previous value, but we might want to
5074 : augment a hint file
5075 case "$hint" in
5076 default|recommended)
5077         case "$gccversion" in
5078         1*) dflt="$dflt -fpcc-struct-return" ;;
5079         esac
5080         case "$optimize:$DEBUGGING" in
5081         *-g*:old) dflt="$dflt -DDEBUGGING";;
5082         esac
5083         case "$gccversion" in
5084         2*) if $test -d /etc/conf/kconfig.d &&
5085                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5086                 then
5087                         # Interactive Systems (ISC) POSIX mode.
5088                         dflt="$dflt -posix"
5089                 fi
5090                 ;;
5091         esac
5092         case "$gccversion" in
5093         1*) ;;
5094         2.[0-8]*) ;;
5095         ?*)     set strict-aliasing -fno-strict-aliasing
5096                 eval $checkccflag
5097                 ;;
5098         esac
5099         # For gcc, adding -pipe speeds up compilations for some, but apparently
5100         # some assemblers can't read from stdin.  (It also slows down compilations
5101         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5102         case "$gccversion" in
5103         ?*)     set pipe -pipe
5104                 eval $checkccflag
5105                 ;;
5106         esac
5107
5108         # on x86_64 (at least) we require an extra library (libssp) in the
5109         # link command line. This library is not named, so I infer that it is
5110         # an implementation detail that may change. Hence the safest approach
5111         # is to add the flag to the flags passed to the compiler at link time,
5112         # as that way the compiler can do the right implementation dependant
5113         # thing. (NWC)
5114         case "$gccversion" in
5115         ?*)     set stack-protector -fstack-protector
5116                 eval $checkccflag
5117                 ;;
5118         esac
5119         ;;
5120 esac
5121
5122 case "$mips_type" in
5123 *BSD*|'') inclwanted="$locincpth $usrinc";;
5124 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5125 esac
5126 for thisincl in $inclwanted; do
5127         if $test -d $thisincl; then
5128                 if $test x$thisincl != x$usrinc; then
5129                         case "$dflt" in
5130                         *" -I$thisincl "*);;
5131                         *) dflt="$dflt -I$thisincl ";;
5132                         esac
5133                 fi
5134         fi
5135 done
5136
5137 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5138         xxx=true;
5139 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5140         xxx=true;
5141 else
5142         xxx=false;
5143 fi;
5144 if $xxx; then
5145         case "$dflt" in
5146         *$2*);;
5147         *) dflt="$dflt -D$2";;
5148         esac;
5149 fi'
5150
5151 set signal.h LANGUAGE_C; eval $inctest
5152
5153 case "$usesocks" in
5154 $define)
5155         ccflags="$ccflags -DSOCKS"
5156         ;;
5157 esac
5158
5159 case "$hint" in
5160 default|recommended) dflt="$ccflags $dflt" ;;
5161 *) dflt="$ccflags";;
5162 esac
5163
5164 case "$dflt" in
5165 ''|' ') dflt=none;;
5166 esac
5167
5168 $cat <<EOH
5169
5170 Your C compiler may want other flags.  For this question you should include
5171 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5172 but you should NOT include libraries or ld flags like -lwhatever.  If you
5173 want $package to honor its debug switch, you should include -DDEBUGGING here.
5174 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5175
5176 To use no flags, specify the word "none".
5177
5178 EOH
5179 set X $dflt
5180 shift
5181 dflt=${1+"$@"}
5182 rp="Any additional cc flags?"
5183 . ./myread
5184 case "$ans" in
5185 none) ccflags='';;
5186 *) ccflags="$ans";;
5187 esac
5188
5189 : the following weeds options from ccflags that are of no interest to cpp
5190 case "$cppflags" in
5191 '') cppflags="$ccflags" ;;
5192 *)  cppflags="$cppflags $ccflags" ;;
5193 esac
5194 case "$gccversion" in
5195 1*) cppflags="$cppflags -D__GNUC__"
5196 esac
5197 case "$mips_type" in
5198 '');;
5199 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5200 esac
5201 case "$cppflags" in
5202 '');;
5203 *)
5204         echo " "
5205         echo "Let me guess what the preprocessor flags are..." >&4
5206         set X $cppflags
5207         shift
5208         cppflags=''
5209         $cat >cpp.c <<'EOM'
5210 #define BLURFL foo
5211
5212 BLURFL xx LFRULB
5213 EOM
5214         previous=''
5215         for flag in $*
5216         do
5217                 case "$flag" in
5218                 -*) ftry="$flag";;
5219                 *) ftry="$previous $flag";;
5220                 esac
5221                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5222                         >cpp1.out 2>/dev/null && \
5223                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5224                         >cpp2.out 2>/dev/null && \
5225                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5226                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5227                 then
5228                         cppflags="$cppflags $ftry"
5229                         previous=''
5230                 else
5231                         previous="$flag"
5232                 fi
5233         done
5234         set X $cppflags
5235         shift
5236         cppflags=${1+"$@"}
5237         case "$cppflags" in
5238         *-*)  echo "They appear to be: $cppflags";;
5239         esac
5240         $rm -f cpp.c cpp?.out
5241         ;;
5242 esac
5243
5244 : flags used in final linking phase
5245 case "$ldflags" in
5246 '') if ./venix; then
5247                 dflt='-i -z'
5248         else
5249                 dflt=''
5250         fi
5251         case "$ccflags" in
5252         *-posix*) dflt="$dflt -posix" ;;
5253         esac
5254         ;;
5255 *) dflt="$ldflags";;
5256 esac
5257 # See note above about -fstack-protector
5258 case "$ccflags" in
5259 *-fstack-protector*)
5260         case "$dflt" in
5261         *-fstack-protector*) ;; # Don't add it again
5262         *) dflt="$dflt -fstack-protector" ;;
5263         esac
5264         ;;
5265 esac
5266
5267 : Try to guess additional flags to pick up local libraries.
5268 for thislibdir in $libpth; do
5269         case " $loclibpth " in
5270         *" $thislibdir "*)
5271                 case "$dflt " in
5272                 *"-L$thislibdir "*) ;;
5273                 *)  dflt="$dflt -L$thislibdir" ;;
5274                 esac
5275                 ;;
5276         esac
5277 done
5278
5279 case "$dflt" in
5280 '') dflt='none' ;;
5281 esac
5282
5283 $cat <<EOH
5284
5285 Your C linker may need flags.  For this question you should
5286 include -L/whatever and any other flags used by the C linker, but you
5287 should NOT include libraries like -lwhatever.
5288
5289 Make sure you include the appropriate -L/path flags if your C linker
5290 does not normally search all of the directories you specified above,
5291 namely
5292         $libpth
5293 To use no flags, specify the word "none".
5294
5295 EOH
5296
5297 rp="Any additional ld flags (NOT including libraries)?"
5298 . ./myread
5299 case "$ans" in
5300 none) ldflags='';;
5301 *) ldflags="$ans";;
5302 esac
5303 rmlist="$rmlist pdp11"
5304
5305 : coherency check
5306 echo " "
5307 echo "Checking your choice of C compiler and flags for coherency..." >&4
5308 $cat > try.c <<'EOF'
5309 #include <stdio.h>
5310 int main() { printf("Ok\n"); return(0); }
5311 EOF
5312 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5313 shift
5314 $cat >try.msg <<'EOM'
5315 I've tried to compile and run the following simple program:
5316
5317 EOM
5318 $cat try.c >> try.msg
5319
5320 $cat >> try.msg <<EOM
5321
5322 I used the command:
5323
5324         $*
5325         $run ./try
5326
5327 and I got the following output:
5328
5329 EOM
5330 dflt=y
5331 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5332         if $sh -c "$run ./try " >>try.msg 2>&1; then
5333                 xxx=`$run ./try`
5334                 case "$xxx" in
5335                 "Ok") dflt=n ;;
5336                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5337                         case " $libs " in
5338                         *" -lsfio "*)
5339                                 cat >> try.msg <<'EOQS'
5340 If $libs contains -lsfio, and sfio is mis-configured, then it
5341 sometimes (apparently) runs and exits with a 0 status, but with no
5342 output!  It may have to do with sfio's use of _exit vs. exit.
5343
5344 EOQS
5345                                 rp="You have a big problem.  Shall I abort Configure"
5346                                 dflt=y
5347                                 ;;
5348                         esac
5349                         ;;
5350                 esac
5351         else
5352                 echo "The program compiled OK, but exited with status $?." >>try.msg
5353                 rp="You have a problem.  Shall I abort Configure"
5354                 dflt=y
5355         fi
5356 else
5357         echo "I can't compile the test program." >>try.msg
5358         rp="You have a BIG problem.  Shall I abort Configure"
5359         dflt=y
5360 fi
5361 case "$dflt" in
5362 y)
5363         $cat try.msg >&4
5364         case "$knowitall" in
5365         '')
5366                 echo "(The supplied flags or libraries might be incorrect.)"
5367                 ;;
5368         *) dflt=n;;
5369         esac
5370         echo " "
5371         . ./myread
5372         case "$ans" in
5373         n*|N*) ;;
5374         *)      echo "Ok.  Stopping Configure." >&4
5375                 exit 1
5376                 ;;
5377         esac
5378         ;;
5379 n) echo "OK, that should do.";;
5380 esac
5381 $rm_try gcctest gcctest.out
5382
5383 : define a shorthand compile call
5384 compile='
5385 mc_file=$1;
5386 shift;
5387 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5388 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5389 exit 1;
5390 fi;
5391 esac;
5392 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5393 : define a shorthand compile call for compilations that should be ok.
5394 compile_ok='
5395 mc_file=$1;
5396 shift;
5397 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5398
5399 : determine filename position in cpp output
5400 echo " "
5401 echo "Computing filename position in cpp output for #include directives..." >&4
5402 case "$osname" in
5403 vos) testaccess=-e ;;
5404 *)   testaccess=-r ;;
5405 esac
5406 echo '#include <stdio.h>' > foo.c
5407 $cat >fieldn <<EOF
5408 $startsh
5409 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5410 $grep '^[       ]*#.*stdio\.h' | \
5411 while read cline; do
5412         pos=1
5413         set \$cline
5414         while $test \$# -gt 0; do
5415                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5416                         echo "\$pos"
5417                         exit 0
5418                 fi
5419                 shift
5420                 pos=\`expr \$pos + 1\`
5421         done
5422 done
5423 EOF
5424 chmod +x fieldn
5425 fieldn=`./fieldn`
5426 $rm -f foo.c fieldn
5427 case $fieldn in
5428 '') pos='???';;
5429 1) pos=first;;
5430 2) pos=second;;
5431 3) pos=third;;
5432 *) pos="${fieldn}th";;
5433 esac
5434 echo "Your cpp writes the filename in the $pos field of the line."
5435
5436 case "$osname" in
5437 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5438 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5439 *)   cppfilter='' ;;
5440 esac
5441 : locate header file
5442 $cat >findhdr <<EOF
5443 $startsh
5444 wanted=\$1
5445 name=''
5446 for usrincdir in $usrinc
5447 do
5448         if test -f \$usrincdir/\$wanted; then
5449                 echo "\$usrincdir/\$wanted"
5450                 exit 0
5451         fi
5452 done
5453 awkprg='{ print \$$fieldn }'
5454 echo "#include <\$wanted>" > foo\$\$.c
5455 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5456 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5457 while read cline; do
5458         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5459         case "\$name" in
5460         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5461         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5462         *) exit 2;;
5463         esac;
5464 done;
5465 #
5466 # status = 0: grep returned 0 lines, case statement not executed
5467 # status = 1: headerfile found
5468 # status = 2: while loop executed, no headerfile found
5469 #
5470 status=\$?
5471 $rm -f foo\$\$.c;
5472 if test \$status -eq 1; then
5473         exit 0;
5474 fi
5475 exit 1
5476 EOF
5477 chmod +x findhdr
5478
5479 : define an alternate in-header-list? function
5480 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5481 cont=true; xxf="echo \"<\$1> found.\" >&4";
5482 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5483 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5484 esac;
5485 case $# in 4) instead=instead;; *) instead="at last";; esac;
5486 while $test "$cont"; do
5487         xxx=`./findhdr $1`
5488         var=$2; eval "was=\$$2";
5489         if $test "$xxx" && $test -r "$xxx";
5490         then eval $xxf;
5491         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5492                 cont="";
5493         else eval $xxnf;
5494         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5495         set $yyy; shift; shift; yyy=$@;
5496         case $# in 0) cont="";;
5497         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5498                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5499         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5500                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5501         esac;
5502 done;
5503 while $test "$yyy";
5504 do set $yyy; var=$2; eval "was=\$$2";
5505         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5506         set $yyy; shift; shift; yyy=$@;
5507 done'
5508
5509 : see if stdlib is available
5510 set stdlib.h i_stdlib
5511 eval $inhdr
5512
5513 : check for lengths of integral types
5514 echo " "
5515 case "$intsize" in
5516 '')
5517         echo "Checking to see how big your integers are..." >&4
5518         $cat >try.c <<EOCP
5519 #include <stdio.h>
5520 #$i_stdlib I_STDLIB
5521 #ifdef I_STDLIB
5522 #include <stdlib.h>
5523 #endif
5524 int main()
5525 {
5526         printf("intsize=%d;\n", (int)sizeof(int));
5527         printf("longsize=%d;\n", (int)sizeof(long));
5528         printf("shortsize=%d;\n", (int)sizeof(short));
5529         exit(0);
5530 }
5531 EOCP
5532         set try
5533         if eval $compile_ok && $run ./try > /dev/null; then
5534                 eval `$run ./try`
5535                 echo "Your integers are $intsize bytes long."
5536                 echo "Your long integers are $longsize bytes long."
5537                 echo "Your short integers are $shortsize bytes long."
5538         else
5539                 $cat >&4 <<EOM
5540 !
5541 Help! I can't compile and run the intsize test program: please enlighten me!
5542 (This is probably a misconfiguration in your system or libraries, and
5543 you really ought to fix it.  Still, I'll try anyway.)
5544 !
5545 EOM
5546                 dflt=4
5547                 rp="What is the size of an integer (in bytes)?"
5548                 . ./myread
5549                 intsize="$ans"
5550                 dflt=$intsize
5551                 rp="What is the size of a long integer (in bytes)?"
5552                 . ./myread
5553                 longsize="$ans"
5554                 dflt=2
5555                 rp="What is the size of a short integer (in bytes)?"
5556                 . ./myread
5557                 shortsize="$ans"
5558         fi
5559         ;;
5560 esac
5561 $rm_try
5562
5563 : check for long long
5564 echo " "
5565 echo "Checking to see if you have long long..." >&4
5566 echo 'int main() { long long x = 7; return 0; }' > try.c
5567 set try
5568 if eval $compile; then
5569         val="$define"
5570         echo "You have long long."
5571 else
5572         val="$undef"
5573         echo "You do not have long long."
5574 fi
5575 $rm_try
5576 set d_longlong
5577 eval $setvar
5578
5579 : check for length of long long
5580 case "${d_longlong}${longlongsize}" in
5581 $define)
5582         echo " "
5583         echo "Checking to see how big your long longs are..." >&4
5584         $cat >try.c <<'EOCP'
5585 #include <stdio.h>
5586 int main()
5587 {
5588     printf("%d\n", (int)sizeof(long long));
5589     return(0);
5590 }
5591 EOCP
5592         set try
5593         if eval $compile_ok; then
5594                 longlongsize=`$run ./try`
5595                 echo "Your long longs are $longlongsize bytes long."
5596         else
5597                 dflt='8'
5598                 echo " "
5599                 echo "(I can't seem to compile the test program.  Guessing...)"
5600                 rp="What is the size of a long long (in bytes)?"
5601                 . ./myread
5602                 longlongsize="$ans"
5603         fi
5604         if $test "X$longsize" = "X$longlongsize"; then
5605                 echo "(That isn't any different from an ordinary long.)"
5606         fi
5607         ;;
5608 esac
5609 $rm_try
5610
5611 : see if inttypes.h is available
5612 : we want a real compile instead of Inhdr because some systems
5613 : have an inttypes.h which includes non-existent headers
5614 echo " "
5615 $cat >try.c <<EOCP
5616 #include <inttypes.h>
5617 int main() {
5618         static int32_t foo32 = 0x12345678;
5619 }
5620 EOCP
5621 set try
5622 if eval $compile; then
5623         echo "<inttypes.h> found." >&4
5624         val="$define"
5625 else
5626         echo "<inttypes.h> NOT found." >&4
5627         val="$undef"
5628 fi
5629 $rm_try
5630 set i_inttypes
5631 eval $setvar
5632
5633 : check for int64_t
5634 echo " "
5635 echo "Checking to see if you have int64_t..." >&4
5636 $cat >try.c <<EOCP
5637 #include <sys/types.h>
5638 #$i_inttypes I_INTTYPES
5639 #ifdef I_INTTYPES
5640 #include <inttypes.h>
5641 #endif
5642 int main() { int64_t x = 7; }
5643 EOCP
5644 set try
5645 if eval $compile; then
5646         val="$define"
5647         echo "You have int64_t."
5648 else
5649         val="$undef"
5650         echo "You do not have int64_t."
5651 fi
5652 $rm_try
5653 set d_int64_t
5654 eval $setvar
5655
5656 : Check if 64bit ints have a quad type
5657 echo " "
5658 echo "Checking which 64-bit integer type we could use..." >&4
5659
5660 case "$intsize" in
5661 8) val=int
5662    set quadtype
5663    eval $setvar
5664    val='"unsigned int"'
5665    set uquadtype
5666    eval $setvar
5667    quadkind=1
5668    ;;
5669 *) case "$longsize" in
5670    8) val=long
5671       set quadtype
5672       eval $setvar
5673       val='"unsigned long"'
5674       set uquadtype
5675       eval $setvar
5676       quadkind=2
5677       ;;
5678    *) case "$d_longlong:$longlongsize" in
5679       define:8)
5680         val='"long long"'
5681         set quadtype
5682         eval $setvar
5683         val='"unsigned long long"'
5684         set uquadtype
5685         eval $setvar
5686         quadkind=3
5687         ;;
5688       *) case "$d_int64_t" in
5689          define)
5690            val=int64_t
5691            set quadtype
5692            eval $setvar
5693            val=uint64_t
5694            set uquadtype
5695            eval $setvar
5696            quadkind=4
5697            ;;
5698          esac
5699          ;;
5700       esac
5701       ;;
5702    esac
5703    ;;
5704 esac
5705
5706 case "$quadtype" in
5707 '')     echo "Alas, no 64-bit integer types in sight." >&4
5708         d_quad="$undef"
5709         ;;
5710 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5711         d_quad="$define"
5712         ;;
5713 esac
5714
5715 : Do we want 64bit support
5716 case "$uselonglong" in
5717 "$define"|true|[yY]*)
5718         cat <<EOM >&4
5719
5720 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5721 EOM
5722         use64bitint="$define"
5723         ;;
5724 esac
5725 case "$use64bits" in
5726 "$define"|true|[yY]*)
5727         cat <<EOM >&4
5728
5729 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5730 EOM
5731         use64bitint="$define"
5732         ;;
5733 esac
5734 case "$use64bitints" in
5735 "$define"|true|[yY]*)
5736         cat <<EOM >&4
5737
5738 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5739 EOM
5740         use64bitint="$define"
5741         ;;
5742 esac
5743 case "$use64bitsint" in
5744 "$define"|true|[yY]*)
5745         cat <<EOM >&4
5746
5747 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5748 EOM
5749         use64bitint="$define"
5750         ;;
5751 esac
5752 case "$uselonglongs" in
5753 "$define"|true|[yY]*)
5754         cat <<EOM >&4
5755
5756 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5757 EOM
5758         use64bitint="$define"
5759         ;;
5760 esac
5761 case "$use64bitsall" in
5762 "$define"|true|[yY]*)
5763         cat <<EOM >&4
5764
5765 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5766 EOM
5767         use64bitall="$define"
5768         ;;
5769 esac
5770
5771 case "$ccflags" in
5772 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5773 esac
5774 case "$use64bitall" in
5775 "$define"|true|[yY]*) use64bitint="$define" ;;
5776 esac
5777
5778 case "$longsize" in
5779 8) cat <<EOM
5780
5781 You have natively 64-bit long integers.
5782 EOM
5783    val="$define"
5784    ;;
5785 *) case "$use64bitint" in
5786    "$define"|true|[yY]*) dflt='y';;
5787    *) dflt='n';;
5788    esac
5789    case "$d_quad" in
5790    "$define") ;;
5791    *) dflt='n' ;;
5792    esac
5793    cat <<EOM
5794
5795 Perl can be built to take advantage of 64-bit integer types
5796 on some systems.  To do so, Configure can be run with -Duse64bitint.
5797 Choosing this option will most probably introduce binary incompatibilities.
5798
5799 If this doesn't make any sense to you, just accept the default '$dflt'.
5800 (The default has been chosen based on your configuration.)
5801 EOM
5802    rp='Try to use 64-bit integers, if available?'
5803    . ./myread
5804    case "$ans" in
5805    [yY]*) val="$define" ;;
5806    *)     val="$undef"  ;;
5807    esac
5808    ;;
5809 esac
5810 set use64bitint
5811 eval $setvar
5812
5813 case "$use64bitall" in
5814 "$define"|true|[yY]*) dflt='y' ;;
5815 *) case "$longsize" in
5816    8) dflt='y' ;;
5817    *) dflt='n' ;;
5818    esac
5819    ;;
5820 esac
5821 cat <<EOM
5822
5823 You may also choose to try maximal 64-bitness.  It means using as much
5824 64-bitness as possible on the platform.  This in turn means even more
5825 binary incompatibilities.  On the other hand, your platform may not
5826 have any more 64-bitness available than what you already have chosen.
5827
5828 If this doesn't make any sense to you, just accept the default '$dflt'.
5829 (The default has been chosen based on your configuration.)
5830 EOM
5831 rp='Try to use maximal 64-bit support, if available?'
5832 . ./myread
5833 case "$ans" in
5834 [yY]*) val="$define" ;;
5835 *)     val="$undef"  ;;
5836 esac
5837 set use64bitall
5838 eval $setvar
5839 case "$use64bitall" in
5840 "$define")
5841         case "$use64bitint" in
5842         "$undef")
5843                 cat <<EOM
5844
5845 Since you have chosen a maximally 64-bit build, I'm also turning on
5846 the use of 64-bit integers.
5847 EOM
5848                 use64bitint="$define" ;;
5849         esac
5850         ;;
5851 esac
5852
5853 : Look for a hint-file generated 'call-back-unit'.  If the
5854 : user has specified that a 64-bit perl is to be built,
5855 : we may need to set or change some other defaults.
5856 if $test -f use64bitint.cbu; then
5857         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5858         . ./use64bitint.cbu
5859 fi
5860 case "$use64bitint" in
5861 "$define"|true|[yY]*)
5862         : This test was common to all the OpenBSD forks, and seems harmless for
5863         : other platforms:
5864         echo " "
5865         echo "Checking if your C library has broken 64-bit functions..." >&4
5866         cat >try.c <<EOCP
5867 #include <stdio.h>
5868 typedef $uquadtype myULL;
5869 int main (void)
5870 {
5871     struct {
5872         double d;
5873         myULL  u;
5874     } *p, test[] = {
5875         {4294967303.15, 4294967303ULL},
5876         {4294967294.2,  4294967294ULL},
5877         {4294967295.7,  4294967295ULL},
5878         {0.0, 0ULL}
5879     };
5880     for (p = test; p->u; p++) {
5881         myULL x = (myULL)p->d;
5882         if (x != p->u) {
5883             printf("buggy\n");
5884             return 0;
5885         }
5886     }
5887     printf("ok\n");
5888     return 0;
5889 }
5890 EOCP
5891         set try
5892         if eval $compile_ok; then
5893             libcquad=`./try`
5894             echo "Your C library's 64-bit functions are $libcquad."
5895         else
5896             echo "(I can't seem to compile the test program.)"
5897             echo "Assuming that your C library's 64-bit functions are ok."
5898             libcquad="ok"
5899         fi
5900         $rm_try
5901
5902         case "$libcquad" in
5903             buggy*)
5904                 cat >&4 <<EOM
5905
5906 *** You have a C library with broken 64-bit functions.
5907 *** 64-bit support does not work reliably in this configuration.
5908 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5909 *** Cannot continue, aborting.
5910
5911 EOM
5912                 exit 1
5913                 ;;
5914         esac
5915         case "$longsize" in
5916         4) case "$archname64" in
5917            '') archname64=64int ;;
5918            esac
5919            ;;
5920         esac
5921         ;;
5922 esac
5923
5924 : Look for a hint-file generated 'call-back-unit'.  If the
5925 : user has specified that a maximally 64-bit perl is to be built,
5926 : we may need to set or change some other defaults.
5927 if $test -f use64bitall.cbu; then
5928         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5929         . ./use64bitall.cbu
5930 fi
5931 case "$use64bitall" in
5932 "$define"|true|[yY]*)
5933         case "$longsize" in
5934         4) case "$archname64" in
5935            ''|64int) archname64=64all ;;
5936            esac
5937            ;;
5938         esac
5939         ;;
5940 esac
5941
5942 case "$d_quad:$use64bitint" in
5943 $undef:$define)
5944         cat >&4 <<EOF
5945
5946 *** You have chosen to use 64-bit integers,
5947 *** but none can be found.
5948 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5949 *** Cannot continue, aborting.
5950
5951 EOF
5952         exit 1
5953         ;;
5954 esac
5955
5956 : check for length of double
5957 echo " "
5958 case "$doublesize" in
5959 '')
5960         echo "Checking to see how big your double precision numbers are..." >&4
5961         $cat >try.c <<EOCP
5962 #include <stdio.h>
5963 #$i_stdlib I_STDLIB
5964 #ifdef I_STDLIB
5965 #include <stdlib.h>
5966 #endif
5967 int main()
5968 {
5969     printf("%d\n", (int)sizeof(double));
5970     exit(0);
5971 }
5972 EOCP
5973         set try
5974         if eval $compile_ok; then
5975                 doublesize=`$run ./try`
5976                 echo "Your double is $doublesize bytes long."
5977         else
5978                 dflt='8'
5979                 echo "(I can't seem to compile the test program.  Guessing...)"
5980                 rp="What is the size of a double precision number (in bytes)?"
5981                 . ./myread
5982                 doublesize="$ans"
5983         fi
5984         ;;
5985 esac
5986 $rm_try
5987
5988 : check for long doubles
5989 echo " "
5990 echo "Checking to see if you have long double..." >&4
5991 echo 'int main() { long double x = 7.0; }' > try.c
5992 set try
5993 if eval $compile; then
5994         val="$define"
5995         echo "You have long double."
5996 else
5997         val="$undef"
5998         echo "You do not have long double."
5999 fi
6000 $rm_try
6001 set d_longdbl
6002 eval $setvar
6003
6004 : check for length of long double
6005 case "${d_longdbl}${longdblsize}" in
6006 $define)
6007         echo " "
6008         echo "Checking to see how big your long doubles are..." >&4
6009         $cat >try.c <<'EOCP'
6010 #include <stdio.h>
6011 int main()
6012 {
6013         printf("%d\n", sizeof(long double));
6014 }
6015 EOCP
6016         set try
6017         set try
6018         if eval $compile; then
6019                 longdblsize=`$run ./try`
6020                 echo "Your long doubles are $longdblsize bytes long."
6021         else
6022                 dflt='8'
6023                 echo " "
6024                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6025                 rp="What is the size of a long double (in bytes)?"
6026                 . ./myread
6027                 longdblsize="$ans"
6028         fi
6029         if $test "X$doublesize" = "X$longdblsize"; then
6030                 echo "That isn't any different from an ordinary double."
6031                 echo "I'll keep your setting anyway, but you may see some"
6032                 echo "harmless compilation warnings."
6033         fi
6034         ;;
6035 esac
6036 $rm_try
6037
6038 : determine the architecture name
6039 echo " "
6040 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6041         tarch=`arch`"-$osname"
6042 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6043         if uname -m > tmparch 2>&1 ; then
6044                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6045                         -e 's/$/'"-$osname/" tmparch`
6046         else
6047                 tarch="$osname"
6048         fi
6049         $rm -f tmparch
6050 else
6051         tarch="$osname"
6052 fi
6053 case "$myarchname" in
6054 ''|"$tarch") ;;
6055 *)
6056         echo "(Your architecture name used to be $myarchname.)"
6057         archname=''
6058         ;;
6059 esac
6060 case "$targetarch" in
6061 '') ;;
6062 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6063 esac
6064 myarchname="$tarch"
6065 case "$archname" in
6066 '') dflt="$tarch";;
6067 *) dflt="$archname";;
6068 esac
6069 rp='What is your architecture name'
6070 . ./myread
6071 archname="$ans"
6072
6073 : optionally add API version to the architecture for versioned archlibs
6074 case "$useversionedarchname" in
6075 $define|true|[yY]*) dflt='y';;
6076 *)                  dflt='n';;
6077 esac
6078 rp='Add the Perl API version to your archname?'
6079 . ./myread
6080 case "$ans" in
6081 y|Y)    useversionedarchname="$define" ;;
6082 *)      useversionedarchname="$undef" ;;
6083 esac
6084 case "$useversionedarchname" in
6085 $define)
6086         case "$archname" in
6087         *-$api_versionstring)
6088                 echo "...and architecture name already has -$api_versionstring" >&4
6089                 ;;
6090         *)
6091                 archname="$archname-$api_versionstring"
6092                 echo "...setting architecture name to $archname." >&4
6093                 ;;
6094         esac
6095         ;;
6096 esac
6097
6098 case "$usethreads" in
6099 $define)
6100         echo "Threads selected." >&4
6101         case "$archname" in
6102         *-thread*) echo "...and architecture name already has -thread." >&4
6103                 ;;
6104         *)      archname="$archname-thread"
6105                 echo "...setting architecture name to $archname." >&4
6106                 ;;
6107         esac
6108         ;;
6109 esac
6110 case "$usemultiplicity" in
6111 $define)
6112         echo "Multiplicity selected." >&4
6113         case "$archname" in
6114         *-multi*) echo "...and architecture name already has -multi." >&4
6115                 ;;
6116         *)      archname="$archname-multi"
6117                 echo "...setting architecture name to $archname." >&4
6118                 ;;
6119         esac
6120         ;;
6121 esac
6122 case "$use64bitint$use64bitall" in
6123 *"$define"*)
6124         case "$archname64" in
6125         '')
6126                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6127                 ;;
6128         *)
6129                 case "$use64bitint" in
6130                 "$define") echo "64 bit integers selected." >&4 ;;
6131                 esac
6132                 case "$use64bitall" in
6133                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6134                 esac
6135                 case "$archname" in
6136                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6137                         ;;
6138                 *)      archname="$archname-$archname64"
6139                         echo "...setting architecture name to $archname." >&4
6140                         ;;
6141                 esac
6142                 ;;
6143         esac
6144 esac
6145 case "$uselongdouble" in
6146 $define)
6147         echo "Long doubles selected." >&4
6148         case "$longdblsize" in
6149         $doublesize)
6150                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6151                 ;;
6152         *)
6153                 case "$archname" in
6154                 *-ld*) echo "...and architecture name already has -ld." >&4
6155                         ;;
6156                 *)      archname="$archname-ld"
6157                         echo "...setting architecture name to $archname." >&4
6158                         ;;
6159                 esac
6160                 ;;
6161         esac
6162         ;;
6163 esac
6164 if $test -f archname.cbu; then
6165         echo "Your platform has some specific hints for architecture name, using them..."
6166         . ./archname.cbu
6167 fi
6168
6169 : set the prefixit variable, to compute a suitable default value
6170 prefixit='case "$3" in
6171 ""|none)
6172         case "$oldprefix" in
6173         "") eval "$1=\"\$$2\"";;
6174         *)
6175                 case "$3" in
6176                 "") eval "$1=";;
6177                 none)
6178                         eval "tp=\"\$$2\"";
6179                         case "$tp" in
6180                         ""|" ") eval "$1=\"\$$2\"";;
6181                         *) eval "$1=";;
6182                         esac;;
6183                 esac;;
6184         esac;;
6185 *)
6186         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6187         case "$tp" in
6188         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6189         /*-$oldprefix/*|\~*-$oldprefix/*)
6190                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6191         *) eval "$1=\"\$$2\"";;
6192         esac;;
6193 esac'
6194
6195 : determine installation style
6196 : For now, try to deduce it from prefix unless it is already set.
6197 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6198 case "$installstyle" in
6199 '')     case "$prefix" in
6200                 *perl*) dflt='lib';;
6201                 *) dflt='lib/perl5' ;;
6202         esac
6203         ;;
6204 *)      dflt="$installstyle" ;;
6205 esac
6206 : Probably not worth prompting for this since we prompt for all
6207 : the directories individually, and the prompt would be too long and
6208 : confusing anyway.
6209 installstyle=$dflt
6210
6211 : determine where public executables go
6212 echo " "
6213 set dflt bin bin
6214 eval $prefixit
6215 fn=d~
6216 rp='Pathname where the public executables will reside?'
6217 . ./getfile
6218 if $test "X$ansexp" != "X$binexp"; then
6219         installbin=''
6220 fi
6221 prefixvar=bin
6222 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6223 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6224 :     this via initialinstalllocation
6225 . ./setprefixvar
6226
6227 case "$userelocatableinc" in
6228 $define|true|[yY]*)     dflt='y' ;;
6229 *)                      dflt='n' ;;
6230 esac
6231 cat <<EOM
6232
6233 Would you like to build Perl so that the installation is relocatable, so that
6234 library paths in @INC are determined relative to the path of the perl binary?
6235 This is not advised for system Perl installs, or if you need to run setid
6236 scripts or scripts under taint mode.
6237
6238 If this doesn't make any sense to you, just accept the default '$dflt'.
6239 EOM
6240 rp='Use relocatable @INC?'
6241 . ./myread
6242 case "$ans" in
6243 y|Y)    val="$define" ;;
6244 *)      val="$undef"  ;;
6245 esac
6246 set userelocatableinc
6247 eval $setvar
6248
6249 initialinstalllocation="$binexp"
6250 : Default prefix is now "up one level from where the binaries are"
6251 case "$userelocatableinc" in
6252 $define|true|[yY]*)
6253     bin=".../"
6254     binexp=".../"
6255     prefix=".../.."
6256     prefixexp=".../.."
6257     installprefixexp=".../.."
6258     ;;
6259 esac
6260
6261 : determine where private library files go
6262 : Usual default is /usr/local/lib/perl5/$version.
6263 : Also allow things like /opt/perl/lib/$version, since
6264 : /opt/perl/lib/perl5... would be redundant.
6265 : The default "style" setting is made in installstyle.U
6266 case "$installstyle" in
6267 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6268 *)       set dflt privlib lib/$version ;;
6269 esac
6270 eval $prefixit
6271 $cat <<EOM
6272
6273 There are some auxiliary files for $package that need to be put into a
6274 private library directory that is accessible by everyone.
6275
6276 EOM
6277 fn=$binexp
6278 fn=d~+
6279 rp='Pathname where the private library files will reside?'
6280 . ./getfile
6281 prefixvar=privlib
6282 . ./setprefixvar
6283
6284 : set the prefixup variable, to restore leading tilda escape
6285 prefixup='case "$prefixexp" in
6286 "$prefix") ;;
6287 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6288 esac'
6289
6290 : determine where public architecture dependent libraries go
6291 set archlib archlib
6292 eval $prefixit
6293 : privlib default is /usr/local/lib/$package/$version
6294 : archlib default is /usr/local/lib/$package/$version/$archname
6295 : privlib may have an optional trailing /share.
6296 tdflt=`echo $privlib | $sed 's,/share$,,'`
6297 tdflt=$tdflt/$archname
6298 case "$archlib" in
6299 '')     dflt=$tdflt
6300         ;;
6301 *)      dflt="$archlib"
6302     ;;
6303 esac
6304 $cat <<EOM
6305
6306 $spackage contains architecture-dependent library files.  If you are
6307 sharing libraries in a heterogeneous environment, you might store
6308 these files in a separate location.  Otherwise, you can just include
6309 them with the rest of the public library files.
6310
6311 EOM
6312 fn=$binexp
6313 fn=d+~
6314 rp='Where do you want to put the public architecture-dependent libraries?'
6315 . ./getfile
6316 prefixvar=archlib
6317 . ./setprefixvar
6318 if $test X"$archlib" = X"$privlib"; then
6319         d_archlib="$undef"
6320 else
6321         d_archlib="$define"
6322 fi
6323
6324 : see if setuid scripts can be secure
6325 $cat <<EOM
6326
6327 Some kernels have a bug that prevents setuid #! scripts from being
6328 secure.  Some sites have disabled setuid #! scripts because of this.
6329
6330 First let's decide if your kernel supports secure setuid #! scripts.
6331 (If setuid #! scripts would be secure but have been disabled anyway,
6332 don't say that they are secure if asked.)
6333
6334 EOM
6335
6336 val="$undef"
6337 if $test -d /dev/fd; then
6338         echo "#!$ls" >reflect
6339         chmod +x,u+s reflect
6340         ./reflect >flect 2>&1
6341         if $contains "/dev/fd" flect >/dev/null; then
6342                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6343                 val="$define"
6344         else
6345                 $cat <<EOM
6346 If you are not sure if they are secure, I can check but I'll need a
6347 username and password different from the one you are using right now.
6348 If you don't have such a username or don't want me to test, simply
6349 enter 'none'.
6350
6351 EOM
6352                 rp='Other username to test security of setuid scripts with?'
6353                 dflt='none'
6354                 . ./myread
6355                 case "$ans" in
6356                 n|none)
6357                         case "$d_suidsafe" in
6358                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6359                                 dflt=n;;
6360                         "$undef")
6361                                 echo "Well, the $hint value is *not* secure." >&4
6362                                 dflt=n;;
6363                         *)      echo "Well, the $hint value *is* secure." >&4
6364                                 dflt=y;;
6365                         esac
6366                         ;;
6367                 *)
6368                         $rm -f reflect flect
6369                         echo "#!$ls" >reflect
6370                         chmod +x,u+s reflect
6371                         echo >flect
6372                         chmod a+w flect
6373                         echo '"su" will (probably) prompt you for '"$ans's password."
6374                         su $ans -c './reflect >flect'
6375                         if $contains "/dev/fd" flect >/dev/null; then
6376                                 echo "Okay, it looks like setuid scripts are secure." >&4
6377                                 dflt=y
6378                         else
6379                                 echo "I don't think setuid scripts are secure." >&4
6380                                 dflt=n
6381                         fi
6382                         ;;
6383                 esac
6384                 rp='Does your kernel have *secure* setuid scripts?'
6385                 . ./myread
6386                 case "$ans" in
6387                 [yY]*)  val="$define";;
6388                 *)      val="$undef";;
6389                 esac
6390         fi
6391 else
6392         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6393         echo "(That's for file descriptors, not floppy disks.)"
6394         val="$undef"
6395 fi
6396 set d_suidsafe
6397 eval $setvar
6398
6399 $rm -f reflect flect
6400
6401 : now see if they want to do setuid emulation
6402 if $test $patchlevel -lt 11; then
6403 echo " "
6404 val="$undef"
6405 case "$d_suidsafe" in
6406 "$define")
6407         val="$undef"
6408         echo "No need to emulate SUID scripts since they are secure here." >&4
6409         ;;
6410 *)
6411         $cat <<EOM
6412 Some systems have disabled setuid scripts, especially systems where
6413 setuid scripts cannot be secure.  On systems where setuid scripts have
6414 been disabled, the setuid/setgid bits on scripts are currently
6415 useless.  It is possible for $package to detect those bits and emulate
6416 setuid/setgid in a secure fashion.  This emulation will only work if
6417 setuid scripts have been disabled in your kernel.
6418
6419 EOM
6420         case "$d_dosuid" in
6421         "$define") dflt=y ;;
6422         *) dflt=n ;;
6423         esac
6424         rp="Do you want to do setuid/setgid emulation?"
6425         . ./myread
6426         case "$ans" in
6427         [yY]*)  val="$define";;
6428         *)      val="$undef";;
6429         esac
6430         ;;
6431 esac
6432 set d_dosuid
6433 eval $setvar
6434 else
6435     case "$d_dosuid" in
6436         "$define")
6437         cat >&4 <<EOH
6438
6439 SUID emulation has been removed for 5.12
6440 Please re-run Configure without -Dd_dosuid
6441
6442 EOH
6443         exit 1;
6444         ;;
6445     esac
6446     d_dosuid=undef
6447 fi
6448
6449 : Find perl5.005 or later.
6450 echo "Looking for a previously installed perl5.005 or later... "
6451 case "$perl5" in
6452 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6453                 : Check if this perl is recent and can load a simple module
6454                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6455                         perl5=$tdir/perl
6456                         break;
6457                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6458                         perl5=$tdir/perl5
6459                         break;
6460                 fi
6461         done
6462         ;;
6463 *)      perl5="$perl5"
6464         ;;
6465 esac
6466 case "$perl5" in
6467 '')     echo "None found.  That's ok.";;
6468 *)      echo "Using $perl5." ;;
6469 esac
6470
6471 : Set the siteprefix variables
6472 $cat <<EOM
6473
6474 After $package is installed, you may wish to install various
6475 add-on modules and utilities.  Typically, these add-ons will
6476 be installed under $prefix with the rest
6477 of this package.  However, you may wish to install such add-ons
6478 elsewhere under a different prefix.
6479
6480 If you do not wish to put everything under a single prefix, that's
6481 ok.  You will be prompted for the individual locations; this siteprefix
6482 is only used to suggest the defaults.
6483
6484 The default should be fine for most people.
6485
6486 EOM
6487 fn=d~+
6488 rp='Installation prefix to use for add-on modules and utilities?'
6489 : XXX Here might be another good place for an installstyle setting.
6490 case "$siteprefix" in
6491 '') dflt=$prefix ;;
6492 *)  dflt=$siteprefix ;;
6493 esac
6494 . ./getfile
6495 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6496 oldsiteprefix=''
6497 case "$siteprefix" in
6498 '') ;;
6499 *)      case "$ans" in
6500         "$prefix") ;;
6501         *) oldsiteprefix="$prefix";;
6502         esac
6503         ;;
6504 esac
6505 siteprefix="$ans"
6506 siteprefixexp="$ansexp"
6507
6508 : determine where site specific libraries go.
6509 : Usual default is /usr/local/lib/perl5/site_perl/$version
6510 : The default "style" setting is made in installstyle.U
6511 : XXX No longer works with Prefixit stuff.
6512 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6513 case "$sitelib" in
6514 '') case "$installstyle" in
6515         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6516         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6517         esac
6518         ;;
6519 *)      dflt="$sitelib"
6520         ;;
6521 esac
6522 $cat <<EOM
6523
6524 The installation process will create a directory for
6525 site-specific extensions and modules.  Most users find it convenient
6526 to place all site-specific files in this directory rather than in the
6527 main distribution directory.
6528
6529 EOM
6530 fn=d~+
6531 rp='Pathname for the site-specific library files?'
6532 . ./getfile
6533 prefixvar=sitelib
6534 . ./setprefixvar
6535 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6536
6537 : Determine list of previous versions to include in @INC
6538 $cat > getverlist <<EOPL
6539 #!$perl5 -w
6540 use File::Basename;
6541 \$api_versionstring = "$api_versionstring";
6542 \$version = "$version";
6543 \$stem = "$sitelib_stem";
6544 \$archname = "$archname";
6545 EOPL
6546         $cat >> getverlist <<'EOPL'
6547 # The list found is store twice for each entry: the original name, and
6548 # the binary broken down version as pack "sss", so sorting is easy and
6549 # unambiguous. This will work for all versions that have a maximum of
6550 # three digit groups, separate by '.'s or '_'s. Names are extended with
6551 # ".0.0" to ensure at least three elements for the pack.
6552 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6553
6554 # Can't have leading @ because metaconfig interprets it as a command!
6555 ;@inc_version_list=();
6556 # XXX Redo to do opendir/readdir?
6557 if (-d $stem) {
6558     chdir($stem);
6559     ;@candidates = map {
6560         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6561     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6562 }
6563 else {
6564     ;@candidates = ();
6565 }
6566
6567 ($pversion, $aversion, $vsn5005) = map {
6568     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6569 foreach $d (@candidates) {
6570     if ($d->[1] lt $pversion) {
6571         if ($d->[1] ge $aversion) {
6572             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6573         }
6574         elsif ($d->[1] ge $vsn5005) {
6575             unshift(@inc_version_list, grep { -d } $d->[0]);
6576         }
6577     }
6578     else {
6579         # Skip newer version.  I.e. don't look in
6580         # 5.7.0 if we're installing 5.6.1.
6581     }
6582 }
6583
6584 if (@inc_version_list) {
6585     print join(' ', @inc_version_list);
6586 }
6587 else {
6588     # Blank space to preserve value for next Configure run.
6589     print " ";
6590 }
6591 EOPL
6592 chmod +x getverlist
6593 case "$inc_version_list" in
6594 '')     if test -x "$perl5$exe_ext"; then
6595                 dflt=`$perl5 getverlist`
6596         else
6597                 dflt='none'
6598         fi
6599         ;;
6600 $undef) dflt='none' ;;
6601 *)  eval dflt=\"$inc_version_list\" ;;
6602 esac
6603 case "$dflt" in
6604 ''|' ') dflt=none ;;
6605 esac
6606 case "$dflt" in
6607 5.005) dflt=none ;;
6608 esac
6609 $cat <<EOM
6610
6611 In order to ease the process of upgrading, this version of perl
6612 can be configured to use modules built and installed with earlier
6613 versions of perl that were installed under $prefix.  Specify here
6614 the list of earlier versions that this version of perl should check.
6615 If Configure detected no earlier versions of perl installed under
6616 $prefix, then the list will be empty.  Answer 'none' to tell perl
6617 to not search earlier versions.
6618
6619 The default should almost always be sensible, so if you're not sure,
6620 just accept the default.
6621 EOM
6622
6623 rp='List of earlier versions to include in @INC?'
6624 . ./myread
6625 case "$ans" in
6626 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6627 *) inc_version_list="$ans" ;;
6628 esac
6629 case "$inc_version_list" in
6630 ''|' ')
6631         inc_version_list_init='0'
6632         d_inc_version_list="$undef"
6633         ;;
6634 *)      inc_version_list_init=`echo $inc_version_list |
6635                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6636         d_inc_version_list="$define"
6637         ;;
6638 esac
6639 $rm -f getverlist
6640
6641 : see if malloc/malloc.h has to be included
6642 set malloc/malloc.h i_mallocmalloc
6643 eval $inhdr
6644
6645 : see if this is a malloc.h system
6646 : we want a real compile instead of Inhdr because some systems have a
6647 : malloc.h that just gives a compile error saying to use stdlib.h instead
6648 echo " "
6649 $cat >try.c <<EOCP
6650 #include <stdlib.h>
6651 #include <malloc.h>
6652 #$i_mallocmalloc I_MALLOCMALLOC
6653 #ifdef I_MALLOCMALLOC
6654 # include <malloc/malloc.h>
6655 #endif
6656
6657 int main () { return 0; }
6658 EOCP
6659 set try
6660 if eval $compile; then
6661     echo "<malloc.h> found." >&4
6662     val="$define"
6663 else
6664     echo "<malloc.h> NOT found." >&4
6665     val="$undef"
6666 fi
6667 $rm_try
6668 set i_malloc
6669 eval $setvar
6670
6671 : check for void type
6672 echo " "
6673 echo "Checking to see how well your C compiler groks the void type..." >&4
6674 case "$voidflags" in
6675 '')
6676         $cat >try.c <<EOCP
6677 #$i_stdlib I_STDLIB
6678 #ifdef I_STDLIB
6679 #include <stdlib.h>
6680 #endif
6681 #if TRY & 1
6682 void sub() {
6683 #else
6684 sub() {
6685 #endif
6686         extern void moo();      /* function returning void */
6687         void (*goo)();          /* ptr to func returning void */
6688 #if TRY & 8
6689         void *hue;              /* generic ptr */
6690 #endif
6691 #if TRY & 2
6692         void (*foo[10])();
6693 #endif
6694
6695 #if TRY & 4
6696         if(goo == moo) {
6697                 exit(0);
6698         }
6699 #endif
6700         exit(0);
6701 }
6702 int main() { sub(); }
6703 EOCP
6704         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6705                 voidflags=$defvoidused
6706         echo "Good.  It appears to support void to the level $package wants.">&4
6707                 if $contains warning .out >/dev/null 2>&1; then
6708                         echo "However, you might get some warnings that look like this:"
6709                         $cat .out
6710                 fi
6711         else
6712 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6713                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6714                         echo "It supports 1..."
6715                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6716                                 echo "It also supports 2..."
6717                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6718                                         voidflags=7
6719                                         echo "And it supports 4 but not 8 definitely."
6720                                 else
6721                                         echo "It doesn't support 4..."
6722                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6723                                                 voidflags=11
6724                                                 echo "But it supports 8."
6725                                         else
6726                                                 voidflags=3
6727                                                 echo "Neither does it support 8."
6728                                         fi
6729                                 fi
6730                         else
6731                                 echo "It does not support 2..."
6732                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6733                                         voidflags=13
6734                                         echo "But it supports 4 and 8."
6735                                 else
6736                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6737                                                 voidflags=5
6738                                                 echo "And it supports 4 but has not heard about 8."
6739                                         else
6740                                                 echo "However it supports 8 but not 4."
6741                                         fi
6742                                 fi
6743                         fi
6744                 else
6745                         echo "There is no support at all for void."
6746                         voidflags=0
6747                 fi
6748         fi
6749 esac
6750 case "$voidflags" in
6751 "$defvoidused") ;;
6752 *)      $cat >&4 <<'EOM'
6753   Support flag bits are:
6754     1: basic void declarations.
6755     2: arrays of pointers to functions returning void.
6756     4: operations between pointers to and addresses of void functions.
6757     8: generic void pointers.
6758 EOM
6759         dflt="$voidflags";
6760         rp="Your void support flags add up to what?"
6761         . ./myread
6762         voidflags="$ans"
6763         ;;
6764 esac
6765 $rm_try
6766
6767 : check for length of pointer
6768 echo " "
6769 case "$ptrsize" in
6770 '')
6771         echo "Checking to see how big your pointers are..." >&4
6772         if test "$voidflags" -gt 7; then
6773                 echo '#define VOID_PTR char *' > try.c
6774         else
6775                 echo '#define VOID_PTR void *' > try.c
6776         fi
6777         $cat >>try.c <<EOCP
6778 #include <stdio.h>
6779 #$i_stdlib I_STDLIB
6780 #ifdef I_STDLIB
6781 #include <stdlib.h>
6782 #endif
6783 int main()
6784 {
6785     printf("%d\n", (int)sizeof(VOID_PTR));
6786     exit(0);
6787 }
6788 EOCP
6789         set try
6790         if eval $compile_ok; then
6791                 ptrsize=`$run ./try`
6792                 echo "Your pointers are $ptrsize bytes long."
6793         else
6794                 dflt='4'
6795                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6796                 rp="What is the size of a pointer (in bytes)?"
6797                 . ./myread
6798                 ptrsize="$ans"
6799         fi
6800         ;;
6801 esac
6802 $rm_try
6803 case "$use64bitall" in
6804 "$define"|true|[yY]*)
6805         case "$ptrsize" in
6806         4)      cat <<EOM >&4
6807
6808 *** You have chosen a maximally 64-bit build,
6809 *** but your pointers are only 4 bytes wide.
6810 *** Please rerun Configure without -Duse64bitall.
6811 EOM
6812                 case "$d_quad" in
6813                 define)
6814                         cat <<EOM >&4
6815 *** Since you have quads, you could possibly try with -Duse64bitint.
6816 EOM
6817                         ;;
6818                 esac
6819                 cat <<EOM >&4
6820 *** Cannot continue, aborting.
6821
6822 EOM
6823
6824                 exit 1
6825                 ;;
6826         esac
6827         ;;
6828 esac
6829
6830
6831 : determine whether to use malloc wrapping
6832 echo " "
6833 case "$usemallocwrap" in
6834 [yY]*|true|$define)     dflt='y' ;;
6835 [nN]*|false|$undef)     dflt='n' ;;
6836 *)      case "$usedevel" in
6837         [yY]*|true|$define)     dflt='y' ;;
6838         *) dflt='n' ;;
6839         esac
6840         ;;
6841 esac
6842 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6843 . ./myread
6844 usemallocwrap="$ans"
6845 case "$ans" in
6846 y*|true)
6847         usemallocwrap="$define" ;;
6848 *)
6849         usemallocwrap="$undef" ;;
6850 esac
6851
6852 : determine which malloc to compile in
6853 echo " "
6854 case "$usemymalloc" in
6855 [yY]*|true|$define)     dflt='y' ;;
6856 [nN]*|false|$undef)     dflt='n' ;;
6857 *)      case "$ptrsize" in
6858         4) dflt='y' ;;
6859         *) dflt='n' ;;
6860         esac
6861         if test "$useithreads" = "$define"; then dflt='n'; fi
6862         ;;
6863 esac
6864 rp="Do you wish to attempt to use the malloc that comes with $package?"
6865 . ./myread
6866 usemymalloc="$ans"
6867 case "$ans" in
6868 y*|true)
6869         usemymalloc='y'
6870         mallocsrc='malloc.c'
6871         mallocobj="malloc$_o"
6872         d_mymalloc="$define"
6873         case "$libs" in
6874         *-lmalloc*)
6875                 : Remove malloc from list of libraries to use
6876                 echo "Removing unneeded -lmalloc from library list" >&4
6877                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6878                 shift
6879                 libs="$*"
6880                 echo "libs = $libs" >&4
6881                 ;;
6882         esac
6883         ;;
6884 *)
6885         usemymalloc='n'
6886         mallocsrc=''
6887         mallocobj=''
6888         d_mymalloc="$undef"
6889         ;;
6890 esac
6891
6892 : compute the return types of malloc and free
6893 echo " "
6894 $cat >malloc.c <<END
6895 #$i_malloc I_MALLOC
6896 #$i_stdlib I_STDLIB
6897 #include <stdio.h>
6898 #include <sys/types.h>
6899 #ifdef I_MALLOC
6900 #include <malloc.h>
6901 #endif
6902 #ifdef I_STDLIB
6903 #include <stdlib.h>
6904 #endif
6905 #ifdef TRY_MALLOC
6906 void *malloc();
6907 #endif
6908 #ifdef TRY_FREE
6909 void free();
6910 #endif
6911 END
6912 case "$malloctype" in
6913 '')
6914         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6915                 malloctype='void *'
6916         else
6917                 malloctype='char *'
6918         fi
6919         ;;
6920 esac
6921 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6922
6923 case "$freetype" in
6924 '')
6925         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6926                 freetype='void'
6927         else
6928                 freetype='int'
6929         fi
6930         ;;
6931 esac
6932 echo "Your system uses $freetype free(), it would seem." >&4
6933 $rm -f malloc.[co]
6934 : determine where site specific architecture-dependent libraries go.
6935 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6936 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6937 : sitelib may have an optional trailing /share.
6938 case "$sitearch" in
6939 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6940         dflt="$dflt/$archname"
6941         ;;
6942 *)      dflt="$sitearch"
6943         ;;
6944 esac
6945 set sitearch sitearch none
6946 eval $prefixit
6947 $cat <<EOM
6948
6949 The installation process will also create a directory for
6950 architecture-dependent site-specific extensions and modules.
6951
6952 EOM
6953 fn=d~+
6954 rp='Pathname for the site-specific architecture-dependent library files?'
6955 . ./getfile
6956 prefixvar=sitearch
6957 . ./setprefixvar
6958 if $test X"$sitearch" = X"$sitelib"; then
6959         d_sitearch="$undef"
6960 else
6961         d_sitearch="$define"
6962 fi
6963
6964 : Set the vendorprefix variables
6965 $cat <<EOM
6966
6967 The installation process will also create a directory for
6968 vendor-supplied add-ons.  Vendors who supply perl with their system
6969 may find it convenient to place all vendor-supplied files in this
6970 directory rather than in the main distribution directory.  This will
6971 ease upgrades between binary-compatible maintenance versions of perl.
6972
6973 Of course you may also use these directories in whatever way you see
6974 fit.  For example, you might use them to access modules shared over a
6975 company-wide network.
6976
6977 The default answer should be fine for most people.
6978 This causes further questions about vendor add-ons to be skipped
6979 and no vendor-specific directories will be configured for perl.
6980
6981 EOM
6982 rp='Do you want to configure vendor-specific add-on directories?'
6983 case "$usevendorprefix" in
6984 define|true|[yY]*) dflt=y ;;
6985 *)      : User may have set vendorprefix directly on Configure command line.
6986         case "$vendorprefix" in
6987         ''|' ') dflt=n ;;
6988         *)      dflt=y ;;
6989         esac
6990         ;;
6991 esac
6992 . ./myread
6993 case "$ans" in
6994 [yY]*)  fn=d~+
6995         rp='Installation prefix to use for vendor-supplied add-ons?'
6996         case "$vendorprefix" in
6997         '') dflt="$prefix" ;;
6998         *)  dflt=$vendorprefix ;;
6999         esac
7000         . ./getfile
7001         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7002         oldvendorprefix=''
7003         case "$vendorprefix" in
7004         '') ;;
7005         *)      case "$ans" in
7006                 "$prefix") ;;
7007                 *) oldvendorprefix="$prefix";;
7008                 esac
7009                 ;;
7010         esac
7011         usevendorprefix="$define"
7012         vendorprefix="$ans"
7013         vendorprefixexp="$ansexp"
7014         ;;
7015 *)      usevendorprefix="$undef"
7016         vendorprefix=''
7017         vendorprefixexp=''
7018         ;;
7019 esac
7020
7021 : Set the vendorlib variables
7022 case "$vendorprefix" in
7023 '')     d_vendorlib="$undef"
7024         vendorlib=''
7025         vendorlibexp=''
7026         ;;
7027 *)      d_vendorlib="$define"
7028         : determine where vendor-supplied modules go.
7029         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7030         case "$vendorlib" in
7031         '')
7032                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7033                 case "$installstyle" in
7034                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7035                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7036                 esac
7037                 ;;
7038         *)      dflt="$vendorlib"
7039                 ;;
7040         esac
7041         fn=d~+
7042         rp='Pathname for the vendor-supplied library files?'
7043         . ./getfile
7044         vendorlib="$ans"
7045         vendorlibexp="$ansexp"
7046         ;;
7047 esac
7048 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7049 prefixvar=vendorlib
7050 . ./installprefix
7051
7052 : Set the vendorarch variables
7053 case "$vendorprefix" in
7054 '')     d_vendorarch="$undef"
7055         vendorarch=''
7056         vendorarchexp=''
7057         ;;
7058 *)      d_vendorarch="$define"
7059         : determine where vendor-supplied architecture-dependent libraries go.
7060         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7061         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7062         : vendorlib may have an optional trailing /share.
7063         case "$vendorarch" in
7064         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7065                 dflt="$dflt/$archname"
7066                 ;;
7067         *)      dflt="$vendorarch" ;;
7068         esac
7069         fn=d~+
7070         rp='Pathname for vendor-supplied architecture-dependent files?'
7071         . ./getfile
7072         vendorarch="$ans"
7073         vendorarchexp="$ansexp"
7074         ;;
7075 esac
7076 prefixvar=vendorarch
7077 . ./installprefix
7078 if $test X"$vendorarch" = X"$vendorlib"; then
7079         d_vendorarch="$undef"
7080 else
7081         d_vendorarch="$define"
7082 fi
7083
7084 : Final catch-all directories to search
7085 $cat <<EOM
7086
7087 Lastly, you can have perl look in other directories for extensions and
7088 modules in addition to those already specified.
7089 These directories will be searched after
7090         $sitearch
7091         $sitelib
7092 EOM
7093 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7094 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7095 echo ' '
7096 case "$otherlibdirs" in
7097 ''|' ') dflt='none' ;;
7098 *)      dflt="$otherlibdirs" ;;
7099 esac
7100 $cat <<EOM
7101 Enter a colon-separated set of extra paths to include in perl's @INC
7102 search path, or enter 'none' for no extra paths.
7103
7104 EOM
7105
7106 rp='Colon-separated list of additional directories for perl to search?'
7107 . ./myread
7108 case "$ans" in
7109 ' '|''|none)    otherlibdirs=' ' ;;
7110 *)      otherlibdirs="$ans" ;;
7111 esac
7112 case "$otherlibdirs" in
7113 ' ') val=$undef ;;
7114 *)      val=$define ;;
7115 esac
7116 set d_perl_otherlibdirs
7117 eval $setvar
7118
7119 : Cruising for prototypes
7120 echo " "
7121 echo "Checking out function prototypes..." >&4
7122 $cat >prototype.c <<EOCP
7123 #$i_stdlib I_STDLIB
7124 #ifdef I_STDLIB
7125 #include <stdlib.h>
7126 #endif
7127 int main(int argc, char *argv[]) {
7128         exit(0);}
7129 EOCP
7130 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7131         echo "Your C compiler appears to support function prototypes."
7132         val="$define"
7133 else
7134         echo "Your C compiler doesn't seem to understand function prototypes."
7135         val="$undef"
7136 fi
7137 set prototype
7138 eval $setvar
7139 $rm -f prototype*
7140
7141 : Check if ansi2knr is required
7142 case "$prototype" in
7143 "$define") ;;
7144 *)      ansi2knr='ansi2knr'
7145         echo " "
7146         cat <<EOM >&4
7147
7148 $me:  FATAL ERROR:
7149 This version of $package can only be compiled by a compiler that 
7150 understands function prototypes.  Unfortunately, your C compiler 
7151         $cc $ccflags
7152 doesn't seem to understand them.  Sorry about that.
7153
7154 If GNU cc is available for your system, perhaps you could try that instead.  
7155
7156 Eventually, we hope to support building Perl with pre-ANSI compilers.
7157 If you would like to help in that effort, please contact <perlbug@perl.org>.
7158
7159 Aborting Configure now.
7160 EOM
7161         exit 2
7162         ;;
7163 esac
7164
7165 : DTrace support
7166 dflt_dtrace='/usr/sbin/dtrace'
7167 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7168
7169 cat <<EOM
7170
7171 Perl can be built to support DTrace on platforms that support it.
7172 DTrace is a diagnosis and performance analysis tool from Sun.
7173
7174 If this doesn't make any sense to you, just accept the default '$dflt'.
7175 EOM
7176
7177 while $test 1 ; do
7178         case "$usedtrace" in
7179         $define|true|[yY]*)
7180                 dflt='y'
7181                 ;;
7182         ?*)
7183                 dflt='y'
7184                 dflt_dtrace=$usedtrace
7185                 ;;
7186         *)
7187                 dflt='n'
7188                 ;;
7189         esac
7190
7191         rp='Support DTrace if available?'
7192         . ./myread
7193         case "$ans" in
7194         y|Y)    val="$define" ;;
7195         *)      val="$undef" ;;
7196         esac
7197         set usedtrace
7198         eval $setvar
7199
7200         test "X$usedtrace" != "X$define" && break
7201
7202         echo " "
7203         rp='Where is the dtrace executable?'
7204         dflt=$dflt_dtrace
7205         . ./getfile
7206         val="$ans"
7207         set dtrace
7208         eval $setvar
7209
7210         if $test -f $dtrace
7211         then
7212                 if $dtrace -h -s ../perldtrace.d \
7213                         -o perldtrace.tmp >/dev/null 2>&1 \
7214                         && rm -f perldtrace.tmp
7215                 then
7216                         echo " "
7217                         echo "Good: your $dtrace knows about the -h flag."
7218                 else
7219                         cat >&2 <<EOM
7220
7221 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7222 ***
7223 *** Your installed dtrace doesn't support the -h switch to compile a D
7224 *** program into a C header. Can't continue.
7225
7226 EOM
7227                         exit 1
7228                 fi
7229                 break;
7230         fi
7231
7232         case "$fastread" in
7233         yes)
7234                 cat >&2 <<EOM
7235
7236 *** $me:  Fatal Error:  $dtrace not found.
7237 *** Can't continue.
7238
7239 EOM
7240                 exit 1
7241                 ;;
7242         *)
7243                 echo "*** $dtrace was not found."
7244                 echo " "
7245                 ;;
7246         esac
7247 done
7248
7249 : See if we want extra modules installed
7250 echo " "
7251 case "$extras" in
7252 '') dflt='n';;
7253 *) dflt='y';;
7254 esac
7255 cat <<EOM
7256 Perl can be built with extra modules or bundles of modules which
7257 will be fetched from the CPAN and installed alongside Perl.
7258
7259 Notice that you will need access to the CPAN; either via the Internet,
7260 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7261 be asked later to configure the CPAN.pm module which will in turn do
7262 the installation of the rest of the extra modules or bundles.)
7263
7264 Notice also that if the modules require any external software such as
7265 libraries and headers (the libz library and the zlib.h header for the
7266 Compress::Zlib module, for example) you MUST have any such software
7267 already installed, this configuration process will NOT install such
7268 things for you.
7269
7270 If this doesn't make any sense to you, just accept the default '$dflt'.
7271 EOM
7272 rp='Install any extra modules (y or n)?'
7273 . ./myread
7274 case "$ans" in
7275 y|Y)
7276         cat <<EOM
7277
7278 Please list any extra modules or bundles to be installed from CPAN,
7279 with spaces between the names.  The names can be in any format the
7280 'install' command of CPAN.pm will understand.  (Answer 'none',
7281 without the quotes, to install no extra modules or bundles.)
7282 EOM
7283         rp='Extras?'
7284         dflt="$extras"
7285         . ./myread
7286         extras="$ans"
7287 esac
7288 case "$extras" in
7289 ''|'none')
7290         val=''
7291         $rm -f ../extras.lst
7292         ;;
7293 *)      echo "(Saving the list of extras for later...)"
7294         echo "$extras" > ../extras.lst
7295         val="'$extras'"
7296         ;;
7297 esac
7298 set extras
7299 eval $setvar
7300 echo " "
7301
7302 : determine where html pages for programs go
7303 set html1dir html1dir none
7304 eval $prefixit
7305 $cat <<EOM
7306
7307 If you wish to install html files for programs in $spackage, indicate
7308 the appropriate directory here.  To skip installing html files,
7309 answer "none".
7310 EOM
7311 case "$html1dir" in
7312 ''|none|$undef|' ') dflt=none ;;
7313 *) dflt=$html1dir ;;
7314 esac
7315 fn=dn+~
7316 rp="Directory for the main $spackage html pages?"
7317 . ./getfile
7318 prefixvar=html1dir
7319 . ./setprefixvar
7320 : Use ' ' for none so value is preserved next time through Configure
7321 $test X"$html1dir" = "X" && html1dir=' '
7322
7323 : determine where html pages for libraries and modules go
7324 set html3dir html3dir none
7325 eval $prefixit
7326 $cat <<EOM
7327
7328 If you wish to install html files for modules associated with $spackage,
7329 indicate the appropriate directory here.  To skip installing html files,
7330 answer "none".
7331 EOM
7332 : There is no obvious default.  If they have specified html1dir, then
7333 : try to key off that, possibly changing .../html1 into .../html3.
7334 case "$html3dir" in
7335 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7336 *) dflt=$html3dir ;;
7337 esac
7338 fn=dn+~
7339 rp="Directory for the $spackage module html pages?"
7340 . ./getfile
7341 prefixvar=html3dir
7342 . ./setprefixvar
7343 : Use ' ' for none so value is preserved next time through Configure
7344 $test X"$html3dir" = "X" && html3dir=' '
7345
7346 : determine whether to install perl also as /usr/bin/perl
7347
7348 echo " "
7349 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7350         $cat <<EOM
7351 Many scripts expect perl to be installed as /usr/bin/perl.
7352
7353 If you want to, I can install the perl you are about to compile
7354 as /usr/bin/perl (in addition to $bin/perl).
7355 EOM
7356         if test -f /usr/bin/perl; then
7357             $cat <<EOM
7358
7359 However, please note that because you already have a /usr/bin/perl,
7360 overwriting that with a new Perl would very probably cause problems.
7361 Therefore I'm assuming you don't want to do that (unless you insist).
7362
7363 EOM
7364             case "$installusrbinperl" in
7365             "$define"|[yY]*)    dflt='y';;
7366             *)                  dflt='n';;
7367             esac
7368         else
7369             $cat <<EOM
7370
7371 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7372
7373 EOM
7374             case "$installusrbinperl" in
7375             "$undef"|[nN]*)     dflt='n';;
7376             *)                  dflt='y';;
7377             esac
7378         fi
7379         rp="Do you want to install perl as /usr/bin/perl?"
7380         . ./myread
7381         case "$ans" in
7382         [yY]*)  val="$define";;
7383         *)      val="$undef" ;;
7384         esac
7385 else
7386         val="$undef"
7387 fi
7388 set installusrbinperl
7389 eval $setvar
7390
7391 : Check if we are using the GNU C library
7392 echo " "
7393 echo "Checking for GNU C Library..." >&4
7394 cat >try.c <<'EOCP'
7395 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7396    alone are insufficient to distinguish different versions, such as
7397    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7398    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7399 */
7400 #include <stdio.h>
7401 int main(void)
7402 {
7403 #ifdef __GLIBC__
7404 #   ifdef __GLIBC_MINOR__
7405 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7406 #           include <gnu/libc-version.h>
7407             printf("%s\n",  gnu_get_libc_version());
7408 #       else
7409             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7410 #       endif
7411 #   else
7412         printf("%d\n",  __GLIBC__);
7413 #   endif
7414     return 0;
7415 #else
7416     return 1;
7417 #endif
7418 }
7419 EOCP
7420 set try
7421 if eval $compile_ok && $run ./try > glibc.ver; then
7422         val="$define"
7423         gnulibc_version=`$cat glibc.ver`
7424         echo "You are using the GNU C Library version $gnulibc_version"
7425 else
7426         val="$undef"
7427         gnulibc_version=''
7428         echo "You are not using the GNU C Library"
7429 fi
7430 $rm_try glibc.ver
7431 set d_gnulibc
7432 eval $setvar
7433
7434 : see if nm is to be used to determine whether a symbol is defined or not
7435 case "$usenm" in
7436 '')
7437         dflt=''
7438         case "$d_gnulibc" in
7439         "$define")
7440                 echo " "
7441                 echo "nm probably won't work on the GNU C Library." >&4
7442                 dflt=n
7443                 ;;
7444         esac
7445         case "$dflt" in
7446         '')
7447                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7448                         echo " "
7449                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7450                         echo "'nm' won't be sufficient on this system." >&4
7451                         dflt=n
7452                 fi
7453                 ;;
7454         esac
7455         case "$dflt" in
7456         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7457                 if $test $dflt -gt 20; then
7458                         dflt=y
7459                 else
7460                         dflt=n
7461                 fi
7462                 ;;
7463         esac
7464         ;;
7465 *)
7466         case "$usenm" in
7467         true|$define) dflt=y;;
7468         *) dflt=n;;
7469         esac
7470         ;;
7471 esac
7472 $cat <<EOM
7473
7474 I can use $nm to extract the symbols from your C libraries. This
7475 is a time consuming task which may generate huge output on the disk (up
7476 to 3 megabytes) but that should make the symbols extraction faster. The
7477 alternative is to skip the 'nm' extraction part and to compile a small
7478 test program instead to determine whether each symbol is present. If
7479 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7480 this may be the best solution.
7481
7482 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7483
7484 EOM
7485 rp="Shall I use $nm to extract C symbols from the libraries?"
7486 . ./myread
7487 case "$ans" in
7488 [Nn]*) usenm=false;;
7489 *) usenm=true;;
7490 esac
7491
7492 runnm=$usenm
7493 case "$reuseval" in
7494 true) runnm=false;;
7495 esac
7496
7497 : nm options which may be necessary
7498 case "$nm_opt" in
7499 '') if $test -f /mach_boot; then
7500                 nm_opt=''       # Mach
7501         elif $test -d /usr/ccs/lib; then
7502                 nm_opt='-p'     # Solaris (and SunOS?)
7503         elif $test -f /dgux; then
7504                 nm_opt='-p'     # DG-UX
7505         elif $test -f /lib64/rld; then
7506                 nm_opt='-p'     # 64-bit Irix
7507         else
7508                 nm_opt=''
7509         fi;;
7510 esac
7511
7512 : nm options which may be necessary for shared libraries but illegal
7513 : for archive libraries.  Thank you, Linux.
7514 case "$nm_so_opt" in
7515 '')     case "$myuname" in
7516         *linux*|gnu*)
7517                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7518                         nm_so_opt='--dynamic'
7519                 fi
7520                 ;;
7521         esac
7522         ;;
7523 esac
7524
7525 : Figure out where the libc is located
7526 case "$runnm" in
7527 true)
7528 : get list of predefined functions in a handy place
7529 echo " "
7530 case "$libc" in
7531 '') libc=unknown
7532         case "$libs" in
7533         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7534         esac
7535         ;;
7536 esac
7537 case "$libs" in
7538 '') ;;
7539 *)  for thislib in $libs; do
7540         case "$thislib" in
7541         -lc|-lc_s)
7542                 : Handle C library specially below.
7543                 ;;
7544         -l*)
7545                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7546                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7547                         :
7548                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7549                         :
7550                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7551                         :
7552                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7553                         :
7554                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7555                         :
7556                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7557                         :
7558                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7559                         :
7560                 else
7561                         try=''
7562                 fi
7563                 libnames="$libnames $try"
7564                 ;;
7565         *) libnames="$libnames $thislib" ;;
7566         esac
7567         done
7568         ;;
7569 esac
7570 xxx=normal
7571 case "$libc" in
7572 unknown)
7573         set /lib/libc.$so
7574         for xxx in $libpth; do
7575                 $test -r $1 || set $xxx/libc.$so
7576                 : The messy sed command sorts on library version numbers.
7577                 $test -r $1 || \
7578                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7579                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7580                                 h
7581                                 s/[0-9][0-9]*/0000&/g
7582                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7583                                 G
7584                                 s/\n/ /' | \
7585                          $sort | $sed -e 's/^.* //'`
7586                 eval set \$$#
7587         done
7588         $test -r $1 || set /usr/ccs/lib/libc.$so
7589         $test -r $1 || set /lib/libsys_s$_a
7590         ;;
7591 *)
7592         set blurfl
7593         ;;
7594 esac
7595 if $test -r "$1"; then
7596         echo "Your (shared) C library seems to be in $1."
7597         libc="$1"
7598 elif $test -r /lib/libc && $test -r /lib/clib; then
7599         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7600         xxx=apollo
7601         libc='/lib/clib /lib/libc'
7602         if $test -r /lib/syslib; then
7603                 echo "(Your math library is in /lib/syslib.)"
7604                 libc="$libc /lib/syslib"
7605         fi
7606 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7607         echo "Your C library seems to be in $libc, as you said before."
7608 elif $test -r $incpath/usr/lib/libc$_a; then
7609         libc=$incpath/usr/lib/libc$_a;
7610         echo "Your C library seems to be in $libc.  That's fine."
7611 elif $test -r /lib/libc$_a; then
7612         libc=/lib/libc$_a;
7613         echo "Your C library seems to be in $libc.  You're normal."
7614 else
7615         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7616                 :
7617         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7618                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7619         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7620                 :
7621         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7622                 :
7623         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7624                 :
7625         else
7626                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7627         fi
7628         if $test -r "$tans"; then
7629                 echo "Your C library seems to be in $tans, of all places."
7630                 libc=$tans
7631         else
7632                 libc='blurfl'
7633         fi
7634 fi
7635 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7636         dflt="$libc"
7637         cat <<EOM
7638
7639 If the guess above is wrong (which it might be if you're using a strange
7640 compiler, or your machine supports multiple models), you can override it here.
7641
7642 EOM
7643 else
7644         dflt=''
7645         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7646         cat >&4 <<EOM
7647 I can't seem to find your C library.  I've looked in the following places:
7648
7649 EOM
7650         $sed 's/^/      /' libpath
7651         cat <<EOM
7652
7653 None of these seems to contain your C library. I need to get its name...
7654
7655 EOM
7656 fi
7657 fn=f
7658 rp='Where is your C library?'
7659 . ./getfile
7660 libc="$ans"
7661
7662 echo " "
7663 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7664 set X `cat libnames`
7665 shift
7666 xxx=files
7667 case $# in 1) xxx=file; esac
7668 echo "Extracting names from the following $xxx for later perusal:" >&4
7669 echo " "
7670 $sed 's/^/      /' libnames >&4
7671 echo " "
7672 $echo $n "This may take a while...$c" >&4
7673
7674 for file in $*; do
7675         case $file in
7676         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7677         *) $nm $nm_opt $file 2>/dev/null;;
7678         esac
7679 done >libc.tmp
7680
7681 $echo $n ".$c"
7682 $grep fprintf libc.tmp > libc.ptf
7683 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7684 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7685 xxx='[ADTSIWi]'
7686 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7687         eval $xscan;\
7688         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7689                 eval $xrun
7690 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7691         eval $xscan;\
7692         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7693                 eval $xrun
7694 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7695         eval $xscan;\
7696         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7697                 eval $xrun
7698 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7699         eval $xscan;\
7700         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7701                 eval $xrun
7702 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7703         eval $xscan;\
7704         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7705                 eval $xrun
7706 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7707         eval $xscan;\
7708         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7709                 eval $xrun
7710 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7711                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7712         eval $xscan;\
7713         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7714                 eval $xrun
7715 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7716         eval $xscan;\
7717         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7718                 eval $xrun
7719 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7720         eval $xscan;\
7721         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7722                 eval $xrun
7723 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7724         eval $xscan;\
7725         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7726                 eval $xrun
7727 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7728         eval $xscan;\
7729         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7730                 eval $xrun
7731 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7732         eval $xscan;\
7733         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7734                 eval $xrun
7735 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7736         eval $xscan;\
7737         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7738                 eval $xrun
7739 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7740         eval $xscan;\
7741         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7742                 eval $xrun
7743 else
7744         $nm -p $* 2>/dev/null >libc.tmp
7745         $grep fprintf libc.tmp > libc.ptf
7746         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7747                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7748         then
7749                 nm_opt='-p'
7750                 eval $xrun
7751         else
7752                 echo " "
7753                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7754                 com=''
7755                 if $ar t $libc > libc.tmp && \
7756                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7757                 then
7758                         for thisname in $libnames $libc; do
7759                                 $ar t $thisname >>libc.tmp
7760                         done
7761                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7762                         echo "Ok." >&4
7763                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7764                         for thisname in $libnames $libc; do
7765                                 $ar tv $thisname >>libc.tmp
7766                                 emximp -o tmp.imp $thisname \
7767                                     2>/dev/null && \
7768                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7769                                     < tmp.imp >>libc.tmp
7770                                 $rm -f tmp.imp
7771                         done
7772                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7773                         echo "Ok." >&4
7774                 else
7775                         echo "$ar didn't seem to work right." >&4
7776                         echo "Maybe this is a Cray...trying bld instead..." >&4
7777                         if  bld t $libc | \
7778                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7779                                 $test -s libc.list
7780                         then
7781                                 for thisname in $libnames; do
7782                                         bld t $libnames | \
7783                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7784                                         $ar t $thisname >>libc.tmp
7785                                 done
7786                                 echo "Ok." >&4
7787                         else
7788                                 echo "That didn't work either.  Giving up." >&4
7789                                 exit 1
7790                         fi
7791                 fi
7792         fi
7793 fi
7794 nm_extract="$com"
7795 case "$PASE" in
7796 define)
7797     echo " "
7798     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7799     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7800     ;;
7801 *)  if $test -f /lib/syscalls.exp; then
7802         echo " "
7803         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7804         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7805                 /lib/syscalls.exp >>libc.list
7806     fi
7807     ;;
7808 esac
7809 ;;
7810 esac
7811 $rm -f libnames libpath
7812
7813 : see if dld is available
7814 set dld.h i_dld
7815 eval $inhdr
7816
7817 : Check if we are using C++
7818 echo " "
7819 echo "Checking for C++..." >&4
7820 $cat >try.c <<'EOCP'
7821 #include <stdio.h>
7822 int main(void)
7823 {
7824 #ifdef __cplusplus
7825     return 0;
7826 #else
7827     return 1;
7828 #endif
7829 }
7830 EOCP
7831 set try
7832 if eval $compile_ok && $run ./try; then
7833         val="$define"
7834         echo "You are using a C++ compiler."
7835 else
7836         val="$undef"
7837         echo "You are not using a C++ compiler."
7838 fi
7839 $rm_try cplusplus$$
7840 set d_cplusplus
7841 eval $setvar
7842
7843 : is a C symbol defined?
7844 csym='tlook=$1;
7845 case "$3" in
7846 -v) tf=libc.tmp; tdc="";;
7847 -a) tf=libc.tmp; tdc="[]";;
7848 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7849 esac;
7850 case "$d_cplusplus" in
7851     $define)    extern_C="extern \"C\"" ;;
7852     *)          extern_C="extern"       ;;
7853 esac;
7854 tx=yes;
7855 case "$reuseval-$4" in
7856 true-) ;;
7857 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7858 esac;
7859 case "$tx" in
7860 yes)
7861         tval=false;
7862         if $test "$runnm" = true; then
7863                 if $contains $tlook $tf >/dev/null 2>&1; then
7864                         tval=true;
7865                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7866                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7867                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7868                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7869                         $rm_try;
7870                 fi;
7871         else
7872                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7873                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7874                 $rm_try;
7875         fi;
7876         ;;
7877 *)
7878         case "$tval" in
7879         $define) tval=true;;
7880         *) tval=false;;
7881         esac;
7882         ;;
7883 esac;
7884 eval "$2=$tval"'
7885
7886 : define an is-in-libc? function
7887 inlibc='echo " "; td=$define; tu=$undef;
7888 sym=$1; var=$2; eval "was=\$$2";
7889 tx=yes;
7890 case "$reuseval$was" in
7891 true) ;;
7892 true*) tx=no;;
7893 esac;
7894 case "$tx" in
7895 yes)
7896         set $sym tres -f;
7897         eval $csym;
7898         case "$tres" in
7899         true)
7900                 echo "$sym() found." >&4;
7901                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7902         *)
7903                 echo "$sym() NOT found." >&4;
7904                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7905         esac;;
7906 *)
7907         case "$was" in
7908         $define) echo "$sym() found." >&4;;
7909         *) echo "$sym() NOT found." >&4;;
7910         esac;;
7911 esac'
7912
7913 : see if dlopen exists
7914 xxx_runnm="$runnm"
7915 xxx_ccflags="$ccflags"
7916 runnm=false
7917 : with g++ one needs -shared to get is-in-libc to work for dlopen
7918 case "$gccversion" in
7919 '')     ;;
7920 *)      case "$d_cplusplus" in
7921         "$define") ccflags="$ccflags -shared" ;;
7922         esac
7923         ;;
7924 esac
7925 set dlopen d_dlopen
7926 eval $inlibc
7927 runnm="$xxx_runnm"
7928 ccflags="$xxx_ccflags"
7929
7930 : see if this is a unistd.h system
7931 set unistd.h i_unistd
7932 eval $inhdr
7933
7934 : determine which dynamic loading, if any, to compile in
7935 echo " "
7936 dldir="ext/DynaLoader"
7937 case "$usedl" in
7938 $define|y|true)
7939         dflt='y'
7940         usedl="$define"
7941         ;;
7942 $undef|n|false)
7943         dflt='n'
7944         usedl="$undef"
7945         ;;
7946 *)
7947         dflt='n'
7948         case "$d_dlopen" in
7949             $define) dflt='y' ;;
7950         esac
7951         case "$i_dld" in
7952             $define) dflt='y' ;;
7953         esac
7954         : Does a dl_xxx.xs file exist for this operating system
7955         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7956         ;;
7957 esac
7958 rp="Do you wish to use dynamic loading?"
7959 . ./myread
7960 usedl="$ans"
7961 bin_ELF="$undef"
7962 case "$ans" in
7963 y*) usedl="$define"
7964         case "$dlsrc" in
7965         '')
7966                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7967                         dflt="$dldir/dl_${osname}.xs"
7968                 elif $test "$d_dlopen" = "$define" ; then
7969                         dflt="$dldir/dl_dlopen.xs"
7970                 elif $test "$i_dld" = "$define" ; then
7971                         dflt="$dldir/dl_dld.xs"
7972                 else
7973                         dflt=''
7974                 fi
7975                 ;;
7976         *)      dflt="$dldir/$dlsrc"
7977                 ;;
7978         esac
7979     echo "The following dynamic loading files are available:"
7980         : Can not go over to $dldir because getfile has path hard-coded in.
7981         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7982         rp="Source file to use for dynamic loading"
7983         fn="fne"
7984         gfpth="$src"
7985         . ./getfile
7986         usedl="$define"
7987         : emulate basename
7988         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7989
7990         $cat << EOM
7991
7992 Some systems may require passing special flags to $cc -c to
7993 compile modules that will be used to create a shared library.
7994 To use no flags, say "none".
7995
7996 EOM
7997     case "$cccdlflags" in
7998     '') case "$gccversion" in
7999                 '') case "$osname" in
8000                         hpux)   dflt='+z' ;;
8001                         next)   dflt='none' ;;
8002                         irix*)  dflt='-KPIC' ;;
8003                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8004                         sunos)  dflt='-pic' ;;
8005                         *)      dflt='none' ;;
8006                     esac
8007                         ;;
8008                 *)  case "$osname" in
8009                         darwin) dflt='none' ;;
8010                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8011                         *)      dflt='-fpic' ;;
8012                     esac ;;
8013             esac ;;
8014         ' ') dflt='none' ;;
8015     *)  dflt="$cccdlflags" ;;
8016     esac
8017     rp="Any special flags to pass to $cc -c to compile shared library modules?"
8018     . ./myread
8019     case "$ans" in
8020     none) cccdlflags=' ' ;;
8021     *) cccdlflags="$ans" ;;
8022     esac
8023
8024     cat << EOM
8025
8026 Some systems use ld to create libraries that can be dynamically loaded,
8027 while other systems (such as those using ELF) use $cc.
8028
8029 EOM
8030
8031 : Determine if this is ELF
8032         $cat >try.c <<EOM
8033 /* Test for whether ELF binaries are produced */
8034 #include <fcntl.h>
8035 #$i_stdlib I_STDLIB
8036 #ifdef I_STDLIB
8037 #include <stdlib.h>
8038 #endif
8039 #$i_unistd I_UNISTD
8040 #ifdef I_UNISTD
8041 #include <unistd.h>
8042 #endif
8043 int main() {
8044         char b[4];
8045         int i = open("a.out",O_RDONLY);
8046         if(i == -1)
8047                 exit(1); /* fail */
8048         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8049                 exit(0); /* succeed (yes, it is ELF) */
8050         else
8051                 exit(1); /* fail */
8052 }
8053 EOM
8054         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8055                 bin_ELF="$define"
8056         fi
8057         $rm_try
8058
8059         case "$ld" in
8060         '')     if $test $bin_ELF = "$define"; then
8061                         cat <<EOM
8062 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8063 EOM
8064                         dflt="$cc"
8065                 else
8066                         echo "I'll use ld to build dynamic libraries."
8067                         dflt='ld'
8068                 fi
8069                 ;;
8070         *)      dflt="$ld"
8071                 ;;
8072         esac
8073
8074     rp="What command should be used to create dynamic libraries?"
8075     . ./myread
8076         ld="$ans"
8077
8078     cat << EOM
8079
8080 Some systems may require passing special flags to $ld to create a
8081 library that can be dynamically loaded.  If your ld flags include
8082 -L/other/path options to locate libraries outside your loader's normal
8083 search path, you may need to specify those -L options here as well.  To
8084 use no flags, say "none".
8085
8086 EOM
8087     case "$lddlflags" in
8088     '') case "$osname" in
8089                         haiku) dflt='-shared' ;;
8090                         hpux) dflt='-b';
8091                               case "$gccversion" in
8092                               '') dflt="$dflt +vnocompatwarnings" ;;
8093                               esac
8094                               ;;
8095                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8096                         next)  dflt='none' ;;
8097                         solaris) # See [perl #66604].
8098                                 # On Solaris 11, gcc -m64 on amd64 
8099                                 # appears not to understand -G.  gcc versions at
8100                                 # least as old as 3.4.3 support -shared, so just
8101                                 # use that with Solaris 11 and later, but keep
8102                                 # the old behavior for older Solaris versions.
8103                                 case "$gccversion" in
8104                                         '') dflt='-G' ;;
8105                                         *)      case "$osvers" in
8106                                                         2.?|2.10) dflt='-G' ;;
8107                                                         *) dflt='-shared' ;;
8108                                                 esac
8109                                                 ;;
8110                                 esac
8111                                 ;;
8112                         sunos) dflt='-assert nodefinitions' ;;
8113                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8114                 *)     dflt='none' ;;
8115                         esac
8116                         ;;
8117     *) dflt="$lddlflags" ;;
8118     esac
8119
8120         : Try to guess additional flags to pick up local libraries.
8121         : Be careful not to append to a plain 'none'
8122         case "$dflt" in
8123         none) dflt='' ;;
8124         esac
8125         for thisflag in $ldflags; do
8126                 case "$thisflag" in
8127                 -L*|-R*|-Wl,-R*)
8128                         case " $dflt " in
8129                         *" $thisflag "*) ;;
8130                         *) dflt="$dflt $thisflag" ;;
8131                         esac
8132                         ;;
8133                 esac
8134         done
8135
8136         case "$dflt" in
8137         ''|' ') dflt='none' ;;
8138         esac
8139
8140         case "$ldflags" in
8141         *-fstack-protector*)
8142             case "$dflt" in
8143                         *-fstack-protector*) ;; # Don't add it again
8144                         *) dflt="$dflt -fstack-protector" ;; 
8145                 esac
8146                 ;;
8147         esac
8148
8149
8150     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8151     . ./myread
8152     case "$ans" in
8153     none) lddlflags=' ' ;;
8154     *) lddlflags="$ans" ;;
8155     esac
8156
8157         cat <<EOM
8158
8159 Some systems may require passing special flags to $cc to indicate that
8160 the resulting executable will use dynamic linking.  To use no flags,
8161 say "none".
8162
8163 EOM
8164     case "$ccdlflags" in
8165     '') case "$osname" in
8166             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8167             next|sunos) dflt='none' ;;
8168             *)          dflt='none' ;;
8169             esac ;;
8170     ' ')  dflt='none' ;;
8171     *)  dflt="$ccdlflags" ;;
8172     esac
8173     rp="Any special flags to pass to $cc to use dynamic linking?"
8174     . ./myread
8175     case "$ans" in
8176     none) ccdlflags=' ' ;;
8177     *) ccdlflags="$ans" ;;
8178     esac
8179     ;;
8180 *)  usedl="$undef"
8181         ld='ld'
8182     dlsrc='dl_none.xs'
8183     lddlflags=''
8184     ccdlflags=''
8185     ;;
8186 esac
8187
8188 ld_can_script="$undef"
8189 case "$bin_ELF$usedl" in
8190 $define$define)
8191     # Abuse try.h and a.out names for neat cleanup
8192     $cat >try.c <<EOM
8193 void foo() {}
8194 void bar() {}
8195 EOM
8196     $cat >try.h <<EOM
8197 LIBTEST_42 {
8198  global:
8199   foo;
8200  local: *;
8201  };
8202 EOM
8203     if $cc $cccdlflags $ccdlflags $ccflags \
8204            $ldflags $lddlflags -o a.out try.c \
8205            -Wl,--version-script=try.h >/dev/null 2>&1 \
8206        &&  $test -s a.out ; then
8207         echo "ld supports scripting" >&4
8208         ld_can_script="$define"
8209     else
8210         echo "ld does not support scripting" >&4
8211     fi
8212     $rm_try
8213     ;;
8214 esac
8215
8216 : Do we want a shared libperl?
8217 also=''
8218 case "$usedl" in
8219 $undef)
8220         # No dynamic loading being used, so don't bother even to prompt.
8221         useshrplib='false'
8222         ;;
8223 *)      case "$useshrplib" in
8224         '')     case "$osname" in
8225                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8226                         dflt=y
8227                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8228                         ;;
8229                 next*)
8230                         case "$osvers" in
8231                         4*)     dflt=y
8232                                 also='Building a shared libperl is needed for MAB support.'
8233                                 ;;
8234                         *)      dflt=n
8235                                 ;;
8236                         esac
8237                         ;;
8238                 *)      dflt=n
8239                         ;;
8240                 esac
8241                 ;;
8242         $define|true|[Yy]*)
8243                 dflt=y
8244                 ;;
8245         *)      dflt=n
8246                 ;;
8247         esac
8248         $cat << EOM
8249
8250 The perl executable is normally obtained by linking perlmain.c with
8251 libperl${_a}, any static extensions (usually just DynaLoader), and
8252 any other libraries needed on this system (such as -lm, etc.).  Since
8253 your system supports dynamic loading, it is probably possible to build
8254 a shared libperl.$so.  If you will have more than one executable linked
8255 to libperl.$so, this will significantly reduce the size of each
8256 executable, but it may have a noticeable effect on performance.  The
8257 default is probably sensible for your system.
8258 $also
8259
8260 EOM
8261         rp="Build a shared libperl.$so (y/n)"
8262         . ./myread
8263         case "$ans" in
8264         true|$define|[Yy]*)
8265                 useshrplib='true'  ;;
8266         *)      useshrplib='false' ;;
8267         esac
8268         ;;
8269 esac
8270
8271 case "$useshrplib" in
8272 true)
8273         case "$userelocatableinc" in
8274         true|define)
8275                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8276                 echo "See INSTALL for an explanation why that won't work." >&4
8277                 exit 4
8278                 ;;
8279         esac
8280         case "$libperl" in
8281         '')
8282                 # Figure out a good name for libperl.so.  Since it gets stored in
8283                 # a version-specific architecture-dependent library, the version
8284                 # number isn't really that important, except for making cc/ld happy.
8285                 #
8286                 # A name such as libperl.so.10.1
8287                 majmin="libperl.$so.$patchlevel.$subversion"
8288                 # A name such as libperl.so.100
8289                 majonly=`echo $patchlevel $subversion |
8290                         $awk '{printf "%d%02d", $1, $2}'`
8291                 majonly=libperl.$so.$majonly
8292                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8293                 # rely on figuring it out from the naming of libc.
8294                 case "${osname}${osvers}" in
8295                 next4*)
8296                         dflt=libperl.5.$so
8297                         # XXX How handle the --version stuff for MAB?
8298                         ;;
8299                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8300                         dflt=libperl.$so
8301                         ;;
8302                 cygwin*) # ld links now against the dll directly
8303                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8304                         majonly=`echo $patchlevel $subversion |
8305                                 $awk '{printf "%03d%03d", $1, $2}'`
8306                         majonly=cygperl5.$majonly.$so
8307                         dflt=$majmin
8308                         ;;
8309                 *)      # Try to guess based on whether libc has major.minor.
8310                         case "$libc" in
8311                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8312                         *libc.$so.[0-9]*) dflt=$majonly ;;
8313                         *)      dflt=libperl.$so ;;
8314                         esac
8315                         ;;
8316                 esac
8317                 ;;
8318         *)      dflt=$libperl
8319                 ;;
8320         esac
8321         cat << EOM
8322
8323 I need to select a good name for the shared libperl.  If your system uses
8324 library names with major and minor numbers, then you might want something
8325 like $majmin.  Alternatively, if your system uses a single version
8326 number for shared libraries, then you might want to use $majonly.
8327 Or, your system might be quite happy with a simple libperl.$so.
8328
8329 Since the shared libperl will get installed into a version-specific
8330 architecture-dependent directory, the version number of the shared perl
8331 library probably isn't important, so the default should be o.k.
8332
8333 EOM
8334         rp='What name do you want to give to the shared libperl?'
8335         . ./myread
8336         libperl=$ans
8337         echo "Ok, I'll use $libperl"
8338         ;;
8339 *)
8340         libperl="libperl${_a}"
8341         ;;
8342 esac
8343
8344 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8345 case "$shrpdir" in
8346 '') ;;
8347 *)      $cat >&4 <<EOM
8348 WARNING:  Use of the shrpdir variable for the installation location of
8349 the shared $libperl is not supported.  It was never documented and
8350 will not work in this version.  Let me (perlbug@perl.org)
8351 know of any problems this may cause.
8352
8353 EOM
8354         case "$shrpdir" in
8355         "$archlibexp/CORE")
8356                 $cat >&4 <<EOM
8357 But your current setting of $shrpdir is
8358 the default anyway, so it's harmless.
8359 EOM
8360                 ;;
8361         *)
8362                 $cat >&4 <<EOM
8363 Further, your current attempted setting of $shrpdir
8364 conflicts with the value of $archlibexp/CORE
8365 that installperl will use.
8366 EOM
8367                 ;;
8368         esac
8369         ;;
8370 esac
8371
8372 # How will the perl executable find the installed shared $libperl?
8373 # Add $xxx to ccdlflags.
8374 # If we can't figure out a command-line option, use $shrpenv to
8375 # set env LD_RUN_PATH.  The main perl makefile uses this.
8376 shrpdir=$archlibexp/CORE
8377 xxx=''
8378 tmp_shrpenv=''
8379 if "$useshrplib"; then
8380     case "$osname" in
8381         aix)
8382                 # We'll set it in Makefile.SH...
8383                 ;;
8384         solaris)
8385                 xxx="-R $shrpdir"
8386                 ;;
8387         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8388                 xxx="-Wl,-R$shrpdir"
8389                 ;;
8390         bsdos|linux|irix*|dec_osf|gnu*)
8391                 xxx="-Wl,-rpath,$shrpdir"
8392                 ;;
8393         next)
8394                 # next doesn't like the default...
8395                 ;;
8396         haiku)
8397                 # Haiku doesn't like the default, either.
8398                 ;;
8399         hpux*)
8400                 # hpux doesn't like the default, either.
8401                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8402                 ;;
8403         cygwin)
8404                 # cygwin needs only ldlibpth
8405                 ;;
8406         *)
8407                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8408                 ;;
8409         esac
8410         case "$xxx" in
8411         '') ;;
8412         *)
8413                 # Only add $xxx if it isn't already in ccdlflags.
8414                 case " $ccdlflags " in
8415                 *" $xxx "*)     ;;
8416                 *)      ccdlflags="$ccdlflags $xxx"
8417                         cat <<EOM >&4
8418
8419 Adding $xxx to the flags
8420 passed to $ld so that the perl executable will find the
8421 installed shared $libperl.
8422
8423 EOM
8424                         ;;
8425                 esac
8426                 ;;
8427         esac
8428 fi
8429 # Fix ccdlflags in AIX for building external extensions.
8430 # (For building Perl itself bare -bE:perl.exp is needed,
8431 #  Makefile.SH takes care of this.)
8432 case "$osname" in
8433 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8434 esac
8435 # Respect a hint or command-line value.
8436 case "$shrpenv" in
8437 '') shrpenv="$tmp_shrpenv" ;;
8438 esac
8439 case "$ldlibpthname" in
8440 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8441 none)   ldlibpthname='' ;;
8442 esac
8443
8444 : determine where manual pages are on this system
8445 echo " "
8446 case "$sysman" in
8447 '')
8448         syspath='/usr/share/man/man1 /usr/man/man1'
8449         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8450         syspath="$syspath /usr/man/u_man/man1"
8451         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8452         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8453         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8454         sysman=`./loc . /usr/man/man1 $syspath`
8455         ;;
8456 esac
8457 if $test -d "$sysman"; then
8458         echo "System manual is in $sysman." >&4
8459 else
8460         echo "Could not find manual pages in source form." >&4
8461 fi
8462
8463 : determine where manual pages go
8464 set man1dir man1dir none
8465 eval $prefixit
8466 $cat <<EOM
8467
8468 $spackage has manual pages available in source form.
8469 EOM
8470 case "$nroff" in
8471 nroff)
8472         echo "However, you don't have nroff, so they're probably useless to you."
8473         case "$man1dir" in
8474         '') man1dir="none";;
8475         esac;;
8476 esac
8477 echo "If you don't want the manual sources installed, answer 'none'."
8478 case "$man1dir" in
8479 ' ') dflt=none
8480         ;;
8481 '')
8482         lookpath="$prefixexp/share/man/man1"
8483         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8484         lookpath="$lookpath $prefixexp/man/p_man/man1"
8485         lookpath="$lookpath $prefixexp/man/u_man/man1"
8486         lookpath="$lookpath $prefixexp/man/man.1"
8487         case "$sysman" in
8488         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8489         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8490         esac
8491         set dflt
8492         eval $prefixup
8493         ;;
8494 *)  dflt="$man1dir"
8495         ;;
8496 esac
8497 echo " "
8498 fn=dn+~
8499 rp="Where do the main $spackage manual pages (source) go?"
8500 . ./getfile
8501 if $test "X$man1direxp" != "X$ansexp"; then
8502         installman1dir=''
8503 fi
8504 prefixvar=man1dir
8505 . ./setprefixvar
8506
8507 case "$man1dir" in
8508 '')     man1dir=' '
8509         installman1dir='';;
8510 esac
8511
8512 : What suffix to use on installed man pages
8513
8514 case "$man1dir" in
8515 ' ')
8516         man1ext='0'
8517         ;;
8518 *)
8519         rp="What suffix should be used for the main $spackage man pages?"
8520         case "$man1ext" in
8521         '')     case "$man1dir" in
8522                 *1)  dflt=1 ;;
8523                 *1p) dflt=1p ;;
8524                 *1pm) dflt=1pm ;;
8525                 *l) dflt=l;;
8526                 *n) dflt=n;;
8527                 *o) dflt=o;;
8528                 *p) dflt=p;;
8529                 *C) dflt=C;;
8530                 *L) dflt=L;;
8531                 *L1) dflt=L1;;
8532                 *) dflt=1;;
8533                 esac
8534                 ;;
8535         *)      dflt="$man1ext";;
8536         esac
8537         . ./myread
8538         man1ext="$ans"
8539         ;;
8540 esac
8541
8542 : see if we can have long filenames
8543 echo " "
8544 first=123456789abcdef
8545 $rm -f $first
8546 if (echo hi >$first) 2>/dev/null; then
8547         if $test -f 123456789abcde; then
8548                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8549                 val="$undef"
8550         else
8551                 echo 'You can have filenames longer than 14 characters.'>&4
8552                 val="$define"
8553         fi
8554 else
8555         $cat <<'EOM'
8556 You can't have filenames longer than 14 chars.
8557 You can't even think about them!
8558 EOM
8559         val="$undef"
8560 fi
8561 set d_flexfnam
8562 eval $setvar
8563 $rm -rf 123456789abcde*
8564
8565 : determine where library module manual pages go
8566 set man3dir man3dir none
8567 eval $prefixit
8568 $cat <<EOM
8569
8570 $spackage has manual pages for many of the library modules.
8571 EOM
8572
8573 case "$nroff" in
8574 nroff)
8575         $cat <<'EOM'
8576 However, you don't have nroff, so they're probably useless to you.
8577 EOM
8578         case "$man3dir" in
8579         '') man3dir="none";;
8580         esac;;
8581 esac
8582
8583 case "$d_flexfnam" in
8584 undef)
8585         $cat <<'EOM'
8586 However, your system can't handle the long file names like File::Basename.3.
8587 EOM
8588         case "$man3dir" in
8589         '') man3dir="none";;
8590         esac;;
8591 esac
8592
8593 echo "If you don't want the manual sources installed, answer 'none'."
8594 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8595 case "$man3dir" in
8596 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8597         if $test -d "$privlib/man/man3"; then
8598                 cat <<EOM >&4
8599
8600 WARNING:  Previous versions of perl installed man3 pages into
8601 $privlib/man/man3.  This version will suggest a
8602 new default of $dflt.
8603 EOM
8604                 tdflt=$dflt
8605                 dflt='n'
8606                 rp='Do you wish to preserve the old behavior?(y/n)'
8607                 . ./myread
8608                 case "$ans" in
8609                 y*) dflt="$privlib/man/man3" ;;
8610                 *)  dflt=$tdflt ;;
8611                 esac
8612     fi
8613         ;;
8614 *)      dflt="$man3dir" ;;
8615 esac
8616 case "$dflt" in
8617 ' ') dflt=none ;;
8618 esac
8619 echo " "
8620 fn=dn+~
8621 rp="Where do the $package library man pages (source) go?"
8622 . ./getfile
8623 prefixvar=man3dir
8624 . ./setprefixvar
8625
8626 case "$man3dir" in
8627 '')     man3dir=' '
8628         installman3dir='';;
8629 esac
8630
8631 : What suffix to use on installed man pages
8632 case "$man3dir" in
8633 ' ')
8634         man3ext='0'
8635         ;;
8636 *)
8637         rp="What suffix should be used for the $package library man pages?"
8638         case "$man3ext" in
8639         '')     case "$man3dir" in
8640                 *3)  dflt=3 ;;
8641                 *3p) dflt=3p ;;
8642                 *3pm) dflt=3pm ;;
8643                 *l) dflt=l;;
8644                 *n) dflt=n;;
8645                 *o) dflt=o;;
8646                 *p) dflt=p;;
8647                 *C) dflt=C;;
8648                 *L) dflt=L;;
8649                 *L3) dflt=L3;;
8650                 *) dflt=3;;
8651                 esac
8652                 ;;
8653         *)      dflt="$man3ext";;
8654         esac
8655         . ./myread
8656         man3ext="$ans"
8657         ;;
8658 esac
8659
8660 : see if we have to deal with yellow pages, now NIS.
8661 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8662         if $test -f /usr/etc/nibindd; then
8663                 echo " "
8664                 echo "I'm fairly confident you're on a NeXT."
8665                 echo " "
8666                 rp='Do you get the hosts file via NetInfo?'
8667                 dflt=y
8668                 case "$hostcat" in
8669                 nidump*) ;;
8670                 '') ;;
8671                 *) dflt=n;;
8672                 esac
8673                 . ./myread
8674                 case "$ans" in
8675                 y*) hostcat='nidump hosts .';;
8676                 *)      case "$hostcat" in
8677                         nidump*) hostcat='';;
8678                         esac
8679                         ;;
8680                 esac
8681         fi
8682         case "$hostcat" in
8683         nidump*) ;;
8684         *)
8685                 case "$hostcat" in
8686                 *ypcat*) dflt=y;;
8687                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8688                                 dflt=y
8689                         else
8690                                 dflt=n
8691                         fi;;
8692                 *) dflt=n;;
8693                 esac
8694                 echo " "
8695                 rp='Are you getting the hosts file via yellow pages?'
8696                 . ./myread
8697                 case "$ans" in
8698                 y*) hostcat='ypcat hosts';;
8699                 *) hostcat='cat /etc/hosts';;
8700                 esac
8701                 ;;
8702         esac
8703 fi
8704 case "$hostcat" in
8705 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8706 esac
8707 case "$groupcat" in
8708 '') test -f /etc/group && groupcat='cat /etc/group';;
8709 esac
8710 case "$passcat" in
8711 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8712 esac
8713
8714 : now get the host name
8715 echo " "
8716 echo "Figuring out host name..." >&4
8717 case "$myhostname" in
8718 '') cont=true
8719         echo 'Maybe "hostname" will work...'
8720         if tans=`sh -c hostname 2>&1` ; then
8721                 myhostname=$tans
8722                 phostname=hostname
8723                 cont=''
8724         fi
8725         ;;
8726 *) cont='';;
8727 esac
8728 if $test "$cont"; then
8729         if ./xenix; then
8730                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8731                 if tans=`cat /etc/systemid 2>&1` ; then
8732                         myhostname=$tans
8733                         phostname='cat /etc/systemid'
8734                         echo "Whadyaknow.  Xenix always was a bit strange..."
8735                         cont=''
8736                 fi
8737         elif $test -r /etc/systemid; then
8738                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8739         fi
8740 fi
8741 if $test "$cont"; then
8742         echo 'No, maybe "uuname -l" will work...'
8743         if tans=`sh -c 'uuname -l' 2>&1` ; then
8744                 myhostname=$tans
8745                 phostname='uuname -l'
8746         else
8747                 echo 'Strange.  Maybe "uname -n" will work...'
8748                 if tans=`sh -c 'uname -n' 2>&1` ; then
8749                         myhostname=$tans
8750                         phostname='uname -n'
8751                 else
8752                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8753                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8754                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8755                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8756                         else
8757                                 case "$myhostname" in
8758                                 '') echo "Does this machine have an identity crisis or something?"
8759                                         phostname='';;
8760                                 *)
8761                                         echo "Well, you said $myhostname before..."
8762                                         phostname='echo $myhostname';;
8763                                 esac
8764                         fi
8765                 fi
8766         fi
8767 fi
8768 case "$myhostname" in
8769 '') myhostname=noname ;;
8770 esac
8771 : you do not want to know about this
8772 set $myhostname
8773 myhostname=$1
8774
8775 : verify guess
8776 if $test "$myhostname" ; then
8777         dflt=y
8778         rp='Your host name appears to be "'$myhostname'".'" Right?"
8779         . ./myread
8780         case "$ans" in
8781         y*) ;;
8782         *) myhostname='';;
8783         esac
8784 fi
8785
8786 : bad guess or no guess
8787 while $test "X$myhostname" = X ; do
8788         dflt=''
8789         rp="Please type the (one word) name of your host:"
8790         . ./myread
8791         myhostname="$ans"
8792 done
8793
8794 : translate upper to lower if necessary
8795 case "$myhostname" in
8796 *[A-Z]*)
8797         echo "(Normalizing case in your host name)"
8798         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8799         ;;
8800 esac
8801
8802 case "$myhostname" in
8803 *.*)
8804         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8805         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8806         echo "(Trimming domain name from host name--host name is now $myhostname)"
8807         ;;
8808 *) case "$mydomain" in
8809         '')
8810                 {
8811                         test "X$hostcat" = "Xypcat hosts" &&
8812                         ypmatch "$myhostname" hosts 2>/dev/null |\
8813                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8814                         $test -s hosts
8815                 } || {
8816                         test "X$hostcat" != "X" &&
8817                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8818                                         /[       ]$myhostname[  . ]/p" > hosts
8819                 }
8820                 tmp_re="[       . ]"
8821                 if $test -f hosts; then
8822                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8823                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8824                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8825                                 hosts | $sort | $uniq | \
8826                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8827                         case `$echo X$dflt` in
8828                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8829                                 dflt=.
8830                                 ;;
8831                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8832                                 ;;
8833                         esac
8834                 else
8835                         echo "(I cannot locate a hosts database anywhere)"
8836                         dflt=.
8837                 fi
8838                 case "$dflt" in
8839                 .)
8840                         tans=`./loc resolv.conf X /etc /usr/etc`
8841                         if $test -f "$tans"; then
8842                                 echo "(Attempting domain name extraction from $tans)"
8843                                 dflt=.`$sed -n -e 's/   / /g' \
8844                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8845                                   -e 1q 2>/dev/null`
8846                                 case "$dflt" in
8847                                 .) dflt=.`$sed -n -e 's/        / /g' \
8848                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8849                                      -e 1q 2>/dev/null`
8850                                         ;;
8851                                 esac
8852                         fi
8853                         ;;
8854                 esac
8855                 case "$dflt" in
8856                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8857                         dflt=.`sh -c domainname 2>/dev/null`
8858                         case "$dflt" in
8859                         '') dflt='.';;
8860                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8861                         esac
8862                         ;;
8863                 esac
8864                 case "$dflt$osname" in
8865                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8866                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8867                         ;;
8868                 esac
8869                 case "$dflt" in
8870                 .) echo "(Lost all hope -- silly guess then)"
8871                         dflt='.nonet'
8872                         ;;
8873                 esac
8874                 $rm -f hosts
8875                 ;;
8876         *) dflt="$mydomain";;
8877         esac;;
8878 esac
8879 echo " "
8880 rp="What is your domain name?"
8881 . ./myread
8882 tans="$ans"
8883 case "$ans" in
8884 '') ;;
8885 .*) ;;
8886 *) tans=".$tans";;
8887 esac
8888 mydomain="$tans"
8889
8890 : translate upper to lower if necessary
8891 case "$mydomain" in
8892 *[A-Z]*)
8893         echo "(Normalizing case in your domain name)"
8894         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8895         ;;
8896 esac
8897
8898 : a little sanity check here
8899 case "$phostname" in
8900 '') ;;
8901 *)
8902         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8903         $myhostname$mydomain|$myhostname) ;;
8904         *)
8905                 case "$phostname" in
8906                 sed*)
8907                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8908                         ;;
8909                 *)
8910                         echo "(That doesn't agree with your $phostname command, by the way.)"
8911                         ;;
8912                 esac
8913         ;;
8914         esac
8915         ;;
8916 esac
8917
8918 : determine the e-mail address of the user who is running us
8919 $cat <<EOM
8920
8921 I need to get your e-mail address in Internet format if possible, i.e.
8922 something like user@host.domain. Please answer accurately since I have
8923 no easy means to double check it. The default value provided below
8924 is most probably close to reality but may not be valid from outside
8925 your organization...
8926
8927 EOM
8928 cont=x
8929 while test "$cont"; do
8930         case "$MAILDOMAIN" in
8931         '')
8932                 if $test -s /etc/mailname; then
8933                         maildomain=`$cat /etc/mailname`
8934                 else
8935                         maildomain="$myhostname$mydomain"
8936                 fi
8937                 ;;
8938         *)  maildomain="$MAILDOMAIN";;
8939         esac
8940         case "$cf_email" in
8941         '') dflt="$cf_by@$maildomain";;
8942         *)  dflt="$cf_email";;
8943         esac
8944         rp='What is your e-mail address?'
8945         . ./myread
8946         cf_email="$ans"
8947         case "$cf_email" in
8948         *@*.*) cont='' ;;
8949         *)
8950                 rp='Address does not look like an Internet one.  Use it anyway?'
8951                 case "$fastread" in
8952                 yes) dflt=y ;;
8953                 *) dflt=n ;;
8954                 esac
8955                 . ./myread
8956                 case "$ans" in
8957                 y*) cont='' ;;
8958                 *) echo " " ;;
8959                 esac
8960                 ;;
8961         esac
8962 done
8963
8964 : Ask e-mail of administrator
8965 $cat <<EOM
8966
8967 If you or somebody else will be maintaining perl at your site, please
8968 fill in the correct e-mail address here so that they may be contacted
8969 if necessary. Currently, the "perlbug" program included with perl
8970 will send mail to this address in addition to perlbug@perl.org. You may
8971 enter "none" for no administrator.
8972
8973 EOM
8974 case "$perladmin" in
8975 '') dflt="$cf_email";;
8976 *) dflt="$perladmin";;
8977 esac
8978 rp='Perl administrator e-mail address'
8979 . ./myread
8980 perladmin="$ans"
8981
8982 : determine whether to only install version-specific parts.
8983 echo " "
8984 $cat <<EOM
8985 Do you want to install only the version-specific parts of the perl
8986 distribution?  Usually you do *not* want to do this.
8987 EOM
8988 case "$versiononly" in
8989 "$define"|[Yy]*|true) dflt='y' ;;
8990 *) dflt='n';
8991 esac
8992 rp="Do you want to install only the version-specific parts of perl?"
8993 . ./myread
8994 case "$ans" in
8995 [yY]*)  val="$define";;
8996 *)      val="$undef" ;;
8997 esac
8998 set versiononly
8999 eval $setvar
9000
9001 case "$versiononly" in
9002 "$define") inc_version_list=''
9003            inc_version_list_init=0
9004            ;;
9005 esac
9006
9007 : figure out how to guarantee perl startup
9008 : XXX Note that this currently takes advantage of the bug that binexp ignores
9009 :     the Configure -Dinstallprefix setting, which in turn means that under
9010 :     relocatable @INC, initialinstalllocation is what binexp started as.
9011 case "$startperl" in
9012 '')
9013         case "$sharpbang" in
9014         *!)
9015                 $cat <<EOH
9016
9017 I can use the #! construct to start perl on your system. This will
9018 make startup of perl scripts faster, but may cause problems if you
9019 want to share those scripts and perl is not in a standard place
9020 ($initialinstalllocation/perl) on all your platforms. The alternative
9021 is to force a shell by starting the script with a single ':' character.
9022
9023 EOH
9024                 case "$versiononly" in
9025                 "$define")      dflt="$initialinstalllocation/perl$version";;
9026                 *)              dflt="$initialinstalllocation/perl";;
9027                 esac
9028                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9029                 . ./myread
9030                 case "$ans" in
9031                 none)   startperl=": # use perl";;
9032                 *)      startperl="#!$ans"
9033                         if $test 30 -lt `echo "$ans" | wc -c`; then
9034                                 $cat >&4 <<EOM
9035
9036 WARNING:  Some systems limit the #! command to 32 characters.
9037 If you experience difficulty running Perl scripts with #!, try
9038 installing Perl in a directory with a shorter pathname.
9039
9040 EOM
9041                         fi ;;
9042                 esac
9043                 ;;
9044         *) startperl=": # use perl"
9045                 ;;
9046         esac
9047         ;;
9048 esac
9049 echo "I'll use $startperl to start perl scripts."
9050
9051 : figure best path for perl in scripts
9052 case "$perlpath" in
9053 '')
9054         case "$versiononly" in
9055         "$define")      perlpath="$initialinstalllocation/perl$version";;
9056         *)              perlpath="$initialinstalllocation/perl";;
9057         esac
9058         case "$startperl" in
9059         *!*) ;;
9060         *)
9061                 $cat <<EOH
9062
9063 I will use the "eval 'exec'" idiom to start Perl on your system.
9064 I can use the full path of your Perl binary for this purpose, but
9065 doing so may cause problems if you want to share those scripts and
9066 Perl is not always in a standard place ($initialinstalllocation/perl).
9067
9068 EOH
9069                 dflt="$initialinstalllocation/perl"
9070                 rp="What path shall I use in \"eval 'exec'\"?"
9071                 . ./myread
9072                 perlpath="$ans"
9073                 ;;
9074         esac
9075         ;;
9076 esac
9077 case "$startperl" in
9078 *!*)    ;;
9079 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9080 esac
9081
9082 : determine where public executable scripts go
9083 set scriptdir scriptdir
9084 eval $prefixit
9085 case "$scriptdir" in
9086 '')
9087         dflt="$bin"
9088         : guess some guesses
9089         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9090         $test -d /usr/share/bin     && dflt=/usr/share/bin
9091         $test -d /usr/local/script  && dflt=/usr/local/script
9092         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9093         $test -d $prefixexp/script  && dflt=$prefixexp/script
9094         set dflt
9095         eval $prefixup
9096         ;;
9097 *)  dflt="$scriptdir"
9098         ;;
9099 esac
9100 $cat <<EOM
9101
9102 Some installations have a separate directory just for executable scripts so
9103 that they can mount it across multiple architectures but keep the scripts in
9104 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9105 Or you might just lump your scripts in with all your other executables.
9106
9107 EOM
9108 fn=d~
9109 rp='Where do you keep publicly executable scripts?'
9110 . ./getfile
9111 if $test "X$ansexp" != "X$scriptdirexp"; then
9112         installscript=''
9113 fi
9114 installscriptdir=''
9115 prefixvar=scriptdir
9116 . ./setprefixvar
9117 : A little fix up for an irregularly named variable.
9118 installscript="$installscriptdir"
9119
9120 : determine where add-on public executables go
9121 case "$sitebin" in
9122 '')     dflt=$siteprefix/bin ;;
9123 *)      dflt=$sitebin ;;
9124 esac
9125 fn=d~
9126 rp='Pathname where the add-on public executables should be installed?'
9127 . ./getfile
9128 prefixvar=sitebin
9129 . ./setprefixvar
9130
9131 : determine where add-on html pages go
9132 : There is no standard location, so try to copy the previously-selected
9133 : directory structure for the core html pages.
9134 case "$sitehtml1dir" in
9135 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9136 *)     dflt=$sitehtml1dir ;;
9137 esac
9138 case "$dflt" in
9139 ''|' ') dflt=none ;;
9140 esac
9141 fn=dn+~
9142 rp='Pathname where the site-specific html pages should be installed?'
9143 . ./getfile
9144 prefixvar=sitehtml1dir
9145 . ./setprefixvar
9146
9147 : determine where add-on library html pages go
9148 : There is no standard location, so try to copy the previously-selected
9149 : directory structure for the core html pages.
9150 case "$sitehtml3dir" in
9151 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9152 *)     dflt=$sitehtml3dir ;;
9153 esac
9154 case "$dflt" in
9155 ''|' ') dflt=none ;;
9156 esac
9157 fn=dn+~
9158 rp='Pathname where the site-specific library html pages should be installed?'
9159 . ./getfile
9160 prefixvar=sitehtml3dir
9161 . ./setprefixvar
9162
9163 : determine where add-on manual pages go
9164 case "$siteman1dir" in
9165 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9166 *)      dflt=$siteman1dir ;;
9167 esac
9168 case "$dflt" in
9169 ''|' ') dflt=none ;;
9170 esac
9171 fn=dn+~
9172 rp='Pathname where the site-specific manual pages should be installed?'
9173 . ./getfile
9174 prefixvar=siteman1dir
9175 . ./setprefixvar
9176
9177 : determine where add-on library man pages go
9178 case "$siteman3dir" in
9179 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9180 *)      dflt=$siteman3dir ;;
9181 esac
9182 case "$dflt" in
9183 ''|' ') dflt=none ;;
9184 esac
9185 fn=dn+~
9186 rp='Pathname where the site-specific library manual pages should be installed?'
9187 . ./getfile
9188 prefixvar=siteman3dir
9189 . ./setprefixvar
9190
9191 : determine where add-on public executable scripts go
9192 case "$sitescript" in
9193 '')     dflt=$siteprefix/script
9194         $test -d $dflt || dflt=$sitebin ;;
9195 *)  dflt="$sitescript" ;;
9196 esac
9197 fn=d~+
9198 rp='Pathname where add-on public executable scripts should be installed?'
9199 . ./getfile
9200 prefixvar=sitescript
9201 . ./setprefixvar
9202
9203 : Check if faststdio is requested and available
9204 case "$usefaststdio" in
9205 $define|true|[yY]*|'')
9206         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9207         case "$xversion" in
9208         [68])   dflt='y' ;;
9209         *)      dflt='n' ;;
9210         esac
9211         ;;
9212 *) dflt='n';;
9213 esac
9214 cat <<EOM
9215
9216 Perl can be built to use 'fast stdio', which means using the stdio
9217 library but also directly manipulating the stdio buffers to enable
9218 faster I/O.  Using stdio is better for backward compatibility (especially
9219 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9220 interface has been preferred instead of stdio.
9221
9222 If this doesn't make any sense to you, just accept the default '$dflt'.
9223 EOM
9224 rp='Use the "fast stdio" if available?'
9225 . ./myread
9226 case "$ans" in
9227 y|Y)    val="$define" ;;
9228 *)      val="$undef" ;;
9229 esac
9230 set usefaststdio
9231 eval $setvar
9232
9233
9234 : define an is-a-typedef? function
9235 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9236 case "$inclist" in
9237 "") inclist="sys/types.h";;
9238 esac;
9239 eval "varval=\$$var";
9240 case "$varval" in
9241 "")
9242         $rm -f temp.c;
9243         for inc in $inclist; do
9244                 echo "#include <$inc>" >>temp.c;
9245         done;
9246         echo "#ifdef $type" >> temp.c;
9247         echo "printf(\"We have $type\");" >> temp.c;
9248         echo "#endif" >> temp.c;
9249         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9250         if $contains $type temp.E >/dev/null 2>&1; then
9251                 eval "$var=\$type";
9252         else
9253                 eval "$var=\$def";
9254         fi;
9255         $rm -f temp.?;;
9256 *) eval "$var=\$varval";;
9257 esac'
9258
9259 : define an is-a-typedef? function that prompts if the type is not available.
9260 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9261 case "$inclist" in
9262 "") inclist="sys/types.h";;
9263 esac;
9264 eval "varval=\$$var";
9265 case "$varval" in
9266 "")
9267         $rm -f temp.c;
9268         for inc in $inclist; do
9269                 echo "#include <$inc>" >>temp.c;
9270         done;
9271         echo "#ifdef $type" >> temp.c;
9272         echo "printf(\"We have $type\");" >> temp.c;
9273         echo "#endif" >> temp.c;
9274         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9275         echo " " ;
9276         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9277         if $contains $type temp.E >/dev/null 2>&1; then
9278                 echo "$type found." >&4;
9279                 eval "$var=\$type";
9280         else
9281                 echo "$type NOT found." >&4;
9282                 dflt="$def";
9283                 . ./myread ;
9284                 eval "$var=\$ans";
9285         fi;
9286         $rm -f temp.?;;
9287 *) eval "$var=\$varval";;
9288 esac'
9289
9290 : see what type lseek is declared as in the kernel
9291 rp="What is the type used for lseek's offset on this system?"
9292 set off_t lseektype long stdio.h sys/types.h
9293 eval $typedef_ask
9294
9295 echo " "
9296 echo "Checking to see how big your file offsets are..." >&4
9297 $cat >try.c <<EOCP
9298 #include <sys/types.h>
9299 #include <stdio.h>
9300 int main()
9301 {
9302     printf("%d\n", (int)sizeof($lseektype));
9303     return(0);
9304 }
9305 EOCP
9306 set try
9307 if eval $compile_ok; then
9308         lseeksize=`$run ./try`
9309         echo "Your file offsets are $lseeksize bytes long."
9310 else
9311         dflt=$longsize
9312         echo " "
9313         echo "(I can't seem to compile the test program.  Guessing...)"
9314         rp="What is the size of your file offsets (in bytes)?"
9315         . ./myread
9316         lseeksize="$ans"
9317 fi
9318 $rm_try
9319
9320 : see what type file positions are declared as in the library
9321 rp="What is the type for file position used by fsetpos()?"
9322 set fpos_t fpostype long stdio.h sys/types.h
9323 eval $typedef_ask
9324
9325 : Check size for Fpos_t
9326 echo " "
9327 case "$fpostype" in
9328 *_t) zzz="$fpostype"    ;;
9329 *)   zzz="fpos_t"       ;;
9330 esac
9331 echo "Checking the size of $zzz..." >&4
9332 cat > try.c <<EOCP
9333 #include <sys/types.h>
9334 #include <stdio.h>
9335 #$i_stdlib I_STDLIB
9336 #ifdef I_STDLIB
9337 #include <stdlib.h>
9338 #endif
9339 int main() {
9340     printf("%d\n", (int)sizeof($fpostype));
9341     exit(0);
9342 }
9343 EOCP
9344 set try
9345 if eval $compile_ok; then
9346         yyy=`$run ./try`
9347         case "$yyy" in
9348         '')     fpossize=4
9349                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9350                 ;;
9351         *)      fpossize=$yyy
9352                 echo "Your $zzz is $fpossize bytes long."
9353                 ;;
9354         esac
9355 else
9356         dflt="$longsize"
9357         echo " " >&4
9358         echo "(I can't compile the test program.  Guessing...)" >&4
9359         rp="What is the size of your file positions (in bytes)?"
9360         . ./myread
9361         fpossize="$ans"
9362 fi
9363
9364 : Check for large file support
9365 # Backward compatibility (uselfs is deprecated).
9366 case "$uselfs" in
9367 "$define"|true|[yY]*)
9368         cat <<EOM >&4
9369
9370 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9371 EOM
9372         uselargefiles="$define"
9373         ;;
9374 esac
9375
9376 case "$lseeksize:$fpossize" in
9377 8:8) cat <<EOM
9378
9379 You can have files larger than 2 gigabytes.
9380 EOM
9381    val="$define" ;;
9382 *)    case "$uselargefiles" in
9383    "$undef"|false|[nN]*) dflt='n' ;;
9384    *)   dflt='y' ;;
9385    esac
9386    cat <<EOM
9387
9388 Perl can be built to understand large files (files larger than 2 gigabytes)
9389 on some systems.  To do so, Configure can be run with -Duselargefiles.
9390
9391 If this doesn't make any sense to you, just accept the default '$dflt'.
9392 EOM
9393    rp='Try to understand large files, if available?'
9394    . ./myread
9395    case "$ans" in
9396    y|Y)         val="$define" ;;
9397    *)           val="$undef"  ;;
9398    esac
9399    ;;
9400 esac
9401 set uselargefiles
9402 eval $setvar
9403 : Look for a hint-file generated 'call-back-unit'.  If the
9404 : user has specified that a large files perl is to be built,
9405 : we may need to set or change some other defaults.
9406 if $test -f uselargefiles.cbu; then
9407         echo "Your platform has some specific hints regarding large file builds, using them..."
9408         . ./uselargefiles.cbu
9409 fi
9410 case "$uselargefiles" in
9411 "$define")
9412         if $test -f uselargefiles.cbu; then
9413                 echo " "
9414                 echo "Rechecking to see how big your file offsets are..." >&4
9415                 $cat >try.c <<EOCP
9416 #include <sys/types.h>
9417 #include <stdio.h>
9418 int main()
9419 {
9420     printf("%d\n", (int)sizeof($lseektype));
9421     return(0);
9422 }
9423 EOCP
9424                 set try
9425                 if eval $compile_ok; then
9426                         lseeksize=`$run ./try`
9427                         $echo "Your file offsets are now $lseeksize bytes long."
9428                 else
9429                         dflt="$lseeksize"
9430                         echo " "
9431                         echo "(I can't seem to compile the test program.  Guessing...)"
9432                         rp="What is the size of your file offsets (in bytes)?"
9433                         . ./myread
9434                         lseeksize="$ans"
9435                 fi
9436                 case "$fpostype" in
9437                 *_t) zzz="$fpostype"    ;;
9438                 *)   zzz="fpos_t"       ;;
9439                 esac
9440                 $echo $n "Rechecking the size of $zzz...$c" >&4
9441                 $cat > try.c <<EOCP
9442 #include <sys/types.h>
9443 #include <stdio.h>
9444 #$i_stdlib I_STDLIB
9445 #ifdef I_STDLIB
9446 #include <stdlib.h>
9447 #endif
9448 int main() {
9449     printf("%d\n", (int)sizeof($fpostype));
9450     return(0);
9451 }
9452 EOCP
9453                 set try
9454                 if eval $compile_ok; then
9455                         yyy=`$run ./try`
9456                         dflt="$lseeksize"
9457                         case "$yyy" in
9458                         '')     echo " "
9459                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9460                                 ;;
9461                         *)      fpossize=$yyy
9462                                 echo " $fpossize bytes." >&4
9463                                 ;;
9464                         esac
9465                 else
9466                         dflt="$fpossize"
9467                         echo " "
9468                         echo "(I can't compile the test program.  Guessing...)" >&4
9469                         rp="What is the size of your file positions (in bytes)?"
9470                         . ./myread
9471                         fpossize="$ans"
9472                 fi
9473                 $rm_try
9474         fi
9475         ;;
9476 esac
9477
9478 : Check if we want perlio
9479 useperlio="$define"
9480
9481 : Set the vendorbin variables
9482 case "$vendorprefix" in
9483 '')     d_vendorbin="$undef"
9484         vendorbin=''
9485         vendorbinexp=''
9486         ;;
9487 *)      d_vendorbin="$define"
9488         : determine where vendor-supplied executables go.
9489         case "$vendorbin" in
9490         '') dflt=$vendorprefix/bin ;;
9491         *)      dflt="$vendorbin" ;;
9492         esac
9493         fn=d~+
9494         rp='Pathname for the vendor-supplied executables directory?'
9495         . ./getfile
9496         vendorbin="$ans"
9497         vendorbinexp="$ansexp"
9498         ;;
9499 esac
9500 prefixvar=vendorbin
9501 . ./installprefix
9502
9503 : Set the vendorhtml1dir variables
9504 case "$vendorprefix" in
9505 '')     vendorhtml1dir=''
9506         vendorhtml1direxp=''
9507         ;;
9508 *)      : determine where vendor-supplied html pages go.
9509         : There is no standard location, so try to copy the previously-selected
9510         : directory structure for the core html pages.
9511         : XXX Better default suggestions would be welcome.
9512         case "$vendorhtml1dir" in
9513         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9514         *)      dflt=$vendorhtml1dir ;;
9515         esac
9516         case "$dflt" in
9517         ''|' ') dflt=none ;;
9518         esac
9519         fn=dn+~
9520         rp='Pathname for the vendor-supplied html pages?'
9521         . ./getfile
9522         vendorhtml1dir="$ans"
9523         vendorhtml1direxp="$ansexp"
9524         ;;
9525 esac
9526 : Use ' ' for none so value is preserved next time through Configure
9527 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9528 prefixvar=vendorhtml1dir
9529 . ./installprefix
9530
9531 : Set the vendorhtml3dir variables
9532 case "$vendorprefix" in
9533 '')     vendorhtml3dir=''
9534         vendorhtml3direxp=''
9535         ;;
9536 *)      : determine where vendor-supplied module html pages go.
9537         : There is no standard location, so try to copy the previously-selected
9538         : directory structure for the core html pages.
9539         : XXX Better default suggestions would be welcome.
9540         case "$vendorhtml3dir" in
9541         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9542         *)      dflt=$vendorhtml3dir ;;
9543         esac
9544         case "$dflt" in
9545         ''|' ') dflt=none ;;
9546         esac
9547         fn=dn+~
9548         rp='Pathname for the vendor-supplied html pages?'
9549         . ./getfile
9550         vendorhtml3dir="$ans"
9551         vendorhtml3direxp="$ansexp"
9552         ;;
9553 esac
9554 : Use ' ' for none so value is preserved next time through Configure
9555 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9556 prefixvar=vendorhtml3dir
9557 . ./installprefix
9558
9559 : Set the vendorman1dir variables
9560 case "$vendorprefix" in
9561 '')     vendorman1dir=''
9562         vendorman1direxp=''
9563         ;;
9564 *)      : determine where vendor-supplied manual pages go.
9565         case "$vendorman1dir" in
9566         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9567         *)      dflt=$vendorman1dir ;;
9568         esac
9569         case "$dflt" in
9570         ''|' ') dflt=none ;;
9571         esac
9572         fn=nd~+
9573         rp='Pathname for the vendor-supplied manual section 1 pages?'
9574         . ./getfile
9575         vendorman1dir="$ans"
9576         vendorman1direxp="$ansexp"
9577         ;;
9578 esac
9579 : Use ' ' for none so value is preserved next time through Configure
9580 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9581 prefixvar=vendorman1dir
9582 . ./installprefix
9583
9584 : Set the vendorman3dir variables
9585 case "$vendorprefix" in
9586 '')     vendorman3dir=''
9587         vendorman3direxp=''
9588         ;;
9589 *)      : determine where vendor-supplied module manual pages go.
9590         case "$vendorman3dir" in
9591         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9592         *)      dflt=$vendorman3dir ;;
9593         esac
9594         case "$dflt" in
9595         ''|' ') dflt=none ;;
9596         esac
9597         fn=nd~+
9598         rp='Pathname for the vendor-supplied manual section 3 pages?'
9599         . ./getfile
9600         vendorman3dir="$ans"
9601         vendorman3direxp="$ansexp"
9602         ;;
9603 esac
9604 : Use ' ' for none so value is preserved next time through Configure
9605 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9606 prefixvar=vendorman3dir
9607 . ./installprefix
9608
9609 : Set the vendorscript variables
9610 case "$vendorprefix" in
9611 '')     d_vendorscript="$undef"
9612         vendorscript=''
9613         vendorscriptexp=''
9614         ;;
9615 *)      d_vendorscript="$define"
9616         : determine where vendor-supplied scripts go.
9617         case "$vendorscript" in
9618         '')     dflt=$vendorprefix/script
9619                 $test -d $dflt || dflt=$vendorbin ;;
9620         *)  dflt="$vendorscript" ;;
9621         esac
9622         $cat <<EOM
9623
9624 The installation process will create a directory for
9625 vendor-supplied scripts.
9626
9627 EOM
9628         fn=d~+
9629         rp='Pathname for the vendor-supplied scripts directory?'
9630         . ./getfile
9631         vendorscript="$ans"
9632         vendorscriptexp="$ansexp"
9633         ;;
9634 esac
9635 prefixvar=vendorscript
9636 . ./installprefix
9637
9638 : script used to emit important warnings
9639 cat >warn <<EOS
9640 $startsh
9641 if test \$# -gt 0; then
9642         echo "\$@" >msg
9643 else
9644         cat >msg
9645 fi
9646 echo "*** WARNING:" >&4
9647 sed -e 's/^/*** /' <msg >&4
9648 echo "*** " >&4
9649 cat msg >>config.msg
9650 echo " " >>config.msg
9651 rm -f msg
9652 EOS
9653 chmod +x warn
9654 $eunicefix warn
9655
9656 : see which of string.h or strings.h is needed
9657 echo " "
9658 strings=`./findhdr string.h`
9659 if $test "$strings" && $test -r "$strings"; then
9660         echo "Using <string.h> instead of <strings.h>." >&4
9661         val="$define"
9662 else
9663         val="$undef"
9664         strings=`./findhdr strings.h`
9665         if $test "$strings" && $test -r "$strings"; then
9666                 echo "Using <strings.h> instead of <string.h>." >&4
9667         else
9668                 ./warn "No string header found -- You'll surely have problems."
9669         fi
9670 fi
9671 set i_string
9672 eval $setvar
9673 case "$i_string" in
9674 "$undef") strings=`./findhdr strings.h`;;
9675 *)        strings=`./findhdr string.h`;;
9676 esac
9677
9678 : see if qgcvt exists
9679 set qgcvt d_qgcvt
9680 eval $inlibc
9681
9682 : Check print/scan long double stuff
9683 echo " "
9684
9685 if $test X"$d_longdbl" = X"$define"; then
9686
9687 echo "Checking how to print long doubles..." >&4
9688
9689 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9690         $cat >try.c <<'EOCP'
9691 #include <sys/types.h>
9692 #include <stdio.h>
9693 int main() {
9694   double d = 123.456;
9695   printf("%.3f\n", d);
9696 }
9697 EOCP
9698         set try
9699         if eval $compile; then
9700                 yyy=`$run ./try`
9701                 case "$yyy" in
9702                 123.456)
9703                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9704                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9705                         echo "We will use %f."
9706                         ;;
9707                 esac
9708         fi
9709 fi
9710
9711 if $test X"$sPRIfldbl" = X; then
9712         $cat >try.c <<'EOCP'
9713 #include <sys/types.h>
9714 #include <stdio.h>
9715 int main() {
9716   long double d = 123.456;
9717   printf("%.3Lf\n", d);
9718 }
9719 EOCP
9720         set try
9721         if eval $compile; then
9722                 yyy=`$run ./try`
9723                 case "$yyy" in
9724                 123.456)
9725                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9726                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9727                         echo "We will use %Lf."
9728                         ;;
9729                 esac
9730         fi
9731 fi
9732
9733 if $test X"$sPRIfldbl" = X; then
9734         $cat >try.c <<'EOCP'
9735 #include <sys/types.h>
9736 #include <stdio.h>
9737 int main() {
9738   long double d = 123.456;
9739   printf("%.3llf\n", d);
9740 }
9741 EOCP
9742         set try
9743         if eval $compile; then
9744                 yyy=`$run ./try`
9745                 case "$yyy" in
9746                 123.456)
9747                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9748                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9749                         echo "We will use %llf."
9750                         ;;
9751                 esac
9752         fi
9753 fi
9754
9755 if $test X"$sPRIfldbl" = X; then
9756         $cat >try.c <<'EOCP'
9757 #include <sys/types.h>
9758 #include <stdio.h>
9759 int main() {
9760   long double d = 123.456;
9761   printf("%.3lf\n", d);
9762 }
9763 EOCP
9764         set try
9765         if eval $compile; then
9766                 yyy=`$run ./try`
9767                 case "$yyy" in
9768                 123.456)
9769                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9770                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9771                         echo "We will use %lf."
9772                         ;;
9773                 esac
9774         fi
9775 fi
9776
9777 if $test X"$sPRIfldbl" = X; then
9778         echo "Cannot figure out how to print long doubles." >&4
9779 else
9780         sSCNfldbl=$sPRIfldbl    # expect consistency
9781 fi
9782
9783 $rm_try
9784
9785 fi # d_longdbl
9786
9787 case "$sPRIfldbl" in
9788 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9789         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9790         d_SCNfldbl="$undef";
9791         ;;
9792 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9793         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9794         d_SCNfldbl="$define";
9795         ;;
9796 esac
9797
9798 : Check how to convert floats to strings.
9799
9800 if test "X$d_Gconvert" = X; then
9801
9802 echo " "
9803 echo "Checking for an efficient way to convert floats to strings."
9804 echo " " > try.c
9805 case "$uselongdouble" in
9806 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9807 esac
9808 case "$d_longdbl" in
9809 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9810 esac
9811 case "$d_PRIgldbl" in
9812 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9813 esac
9814 $cat >>try.c <<EOP
9815 #ifdef TRY_gconvert
9816 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9817 char *myname = "gconvert";
9818 #endif
9819 #ifdef TRY_gcvt
9820 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9821 char *myname = "gcvt";
9822 #endif
9823 #ifdef TRY_qgcvt
9824 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9825 char *myname = "qgcvt";
9826 #define DOUBLETYPE long double
9827 #endif
9828 #ifdef TRY_sprintf
9829 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9830 #ifdef HAS_PRIgldbl
9831 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9832 #else
9833 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9834 #endif
9835 #else
9836 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9837 #endif
9838 char *myname = "sprintf";
9839 #endif
9840
9841 #ifndef DOUBLETYPE
9842 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9843 #define DOUBLETYPE long double
9844 #else
9845 #define DOUBLETYPE double
9846 #endif
9847 #endif
9848
9849 #include <stdio.h>
9850
9851 #$i_stdlib I_STDLIB
9852 #ifdef I_STDLIB
9853 #include <stdlib.h>
9854 #endif
9855 #$i_string I_STRING
9856 #ifdef I_STRING
9857 #  include <string.h>
9858 #else
9859 #  include <strings.h>
9860 #endif
9861
9862 int checkit(char *expect, char *got)
9863 {
9864     if (strcmp(expect, got)) {
9865                 printf("%s oddity:  Expected %s, got %s\n",
9866                         myname, expect, got);
9867                 exit(1);
9868         }
9869 }
9870
9871 int main()
9872 {
9873         char buf[64];
9874         buf[63] = '\0';
9875
9876         /* This must be 1st test on (which?) platform */
9877         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9878         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9879         checkit("0.1", buf);
9880
9881         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9882         checkit("0.01", buf);
9883
9884         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9885         checkit("0.001", buf);
9886
9887         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9888         checkit("0.0001", buf);
9889
9890         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9891         if (strlen(buf) > 5)
9892             checkit("9e-005", buf); /* for Microsoft ?? */
9893         else
9894             checkit("9e-05", buf);
9895
9896         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9897         checkit("1", buf);
9898
9899         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9900         checkit("1.1", buf);
9901
9902         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9903         checkit("1.01", buf);
9904
9905         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9906         checkit("1.001", buf);
9907
9908         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9909         checkit("1.0001", buf);
9910
9911         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9912         checkit("1.00001", buf);
9913
9914         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9915         checkit("1.000001", buf);
9916
9917         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9918         checkit("0", buf);
9919
9920         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9921         checkit("-1", buf);
9922
9923         /* Some Linux gcvt's give 1.e+5 here. */
9924         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9925         checkit("100000", buf);
9926
9927         /* Some Linux gcvt's give -1.e+5 here. */
9928         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9929         checkit("-100000", buf);
9930
9931         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9932         checkit("123.456", buf);
9933
9934         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9935         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9936         /* 34 should be enough to scare even long double
9937          * places into using the e notation. */
9938         if (strlen(buf) > 5)
9939             checkit("1e+034", buf); /* for Microsoft */
9940         else
9941             checkit("1e+34", buf);
9942
9943         /* For Perl, if you add additional tests here, also add them to
9944          * t/base/num.t for benefit of platforms not using Configure or
9945          * overriding d_Gconvert */
9946
9947         exit(0);
9948 }
9949 EOP
9950 : first add preferred functions to our list
9951 xxx_list=""
9952 for xxx_convert in $gconvert_preference; do
9953     case $xxx_convert in
9954     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9955     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9956     esac
9957 done
9958 : then add any others
9959 for xxx_convert in gconvert gcvt sprintf; do
9960     case "$xxx_list" in
9961     *$xxx_convert*) ;;
9962     *) xxx_list="$xxx_list $xxx_convert" ;;
9963     esac
9964 done
9965
9966 case "$d_longdbl$uselongdouble" in
9967 "$define$define")
9968     : again, add preferred functions to our list first
9969     xxx_ld_list=""
9970     for xxx_convert in $gconvert_ld_preference; do
9971         case $xxx_convert in
9972         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9973         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9974         esac
9975     done
9976     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9977     for xxx_convert in qgcvt sprintf $xxx_list; do
9978         case "$xxx_ld_list" in
9979         $xxx_convert*|*" $xxx_convert"*) ;;
9980         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9981         esac
9982     done
9983     : if sprintf cannot do long doubles, move it to the end
9984     if test "$d_PRIgldbl" != "$define"; then
9985         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9986     fi
9987     : if no qgcvt, remove it
9988     if test "$d_qgcvt" != "$define"; then
9989         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9990     fi
9991     : use the ld_list
9992     xxx_list="$xxx_ld_list"
9993     ;;
9994 esac
9995
9996 for xxx_convert in $xxx_list; do
9997         echo "Trying $xxx_convert..."
9998         $rm -f try try$_o core
9999         set try -DTRY_$xxx_convert
10000         if eval $compile; then
10001                 echo "$xxx_convert() found." >&4
10002                 if $run ./try; then
10003                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10004                         break;
10005                 else
10006                         echo "...But $xxx_convert didn't work as I expected."
10007                         xxx_convert=''
10008                 fi
10009         else
10010                 echo "$xxx_convert NOT found." >&4
10011         fi
10012 done
10013
10014 if test X$xxx_convert = X; then
10015     echo "*** WHOA THERE!!! ***" >&4
10016     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10017     xxx_convert=sprintf
10018 fi
10019
10020 case "$xxx_convert" in
10021 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10022 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10023 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10024 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10025    "$define$define$define")
10026       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10027    "$define$define$undef")
10028       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10029    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10030    esac
10031    ;;
10032 esac
10033
10034 fi
10035 $rm_try
10036
10037 : see if _fwalk exists
10038 set fwalk d__fwalk
10039 eval $inlibc
10040
10041 : Initialize h_fcntl
10042 h_fcntl=false
10043
10044 : Initialize h_sysfile
10045 h_sysfile=false
10046
10047 : access call always available on UNIX
10048 set access d_access
10049 eval $inlibc
10050
10051 : locate the flags for 'access()'
10052 case "$d_access" in
10053 "$define")
10054         echo " "
10055         $cat >access.c <<EOCP
10056 #include <sys/types.h>
10057 #ifdef I_FCNTL
10058 #include <fcntl.h>
10059 #endif
10060 #ifdef I_SYS_FILE
10061 #include <sys/file.h>
10062 #endif
10063 #ifdef I_UNISTD
10064 #include <unistd.h>
10065 #endif
10066 #$i_stdlib I_STDLIB
10067 #ifdef I_STDLIB
10068 #include <stdlib.h>
10069 #endif
10070 int main() {
10071         exit(R_OK);
10072 }
10073 EOCP
10074         : check sys/file.h first, no particular reason here
10075         if $test `./findhdr sys/file.h` && \
10076                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10077                 h_sysfile=true;
10078                 echo "<sys/file.h> defines the *_OK access constants." >&4
10079         elif $test `./findhdr fcntl.h` && \
10080                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10081                 h_fcntl=true;
10082                 echo "<fcntl.h> defines the *_OK access constants." >&4
10083         elif $test `./findhdr unistd.h` && \
10084                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10085                 echo "<unistd.h> defines the *_OK access constants." >&4
10086         else
10087                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10088         fi
10089         ;;
10090 esac
10091 $rm -f access*
10092
10093 : see if accessx exists
10094 set accessx d_accessx
10095 eval $inlibc
10096
10097 : see if aintl exists
10098 set aintl d_aintl
10099 eval $inlibc
10100
10101 : see if alarm exists
10102 set alarm d_alarm
10103 eval $inlibc
10104
10105 : see if 64bit time functions exists
10106
10107 set ctime64 d_ctime64
10108 eval $inlibc
10109
10110 set localtime64 d_localtime64
10111 eval $inlibc
10112
10113 set gmtime64 d_gmtime64
10114 eval $inlibc
10115
10116 set mktime64 d_mktime64
10117 eval $inlibc
10118
10119 set difftime64 d_difftime64
10120 eval $inlibc
10121
10122 set asctime64 d_asctime64
10123 eval $inlibc
10124
10125 : see if POSIX threads are available
10126 set pthread.h i_pthread
10127 eval $inhdr
10128
10129 : define a function to check prototypes
10130 $cat > protochk <<EOSH
10131 $startsh
10132 cc="$cc"
10133 optimize="$optimize"
10134 ccflags="$ccflags"
10135 prototype="$prototype"
10136 define="$define"
10137 rm_try="$rm_try"
10138 usethreads=$usethreads
10139 i_pthread=$i_pthread
10140 pthread_h_first=$pthread_h_first
10141 EOSH
10142
10143 $cat >> protochk <<'EOSH'
10144
10145 $rm_try
10146 foo="$1"
10147 shift
10148 while test $# -ge 2; do
10149         case "$1" in
10150                 $define) echo "#include <$2>" >> try.c ;;
10151                 literal) echo "$2" >> try.c ;;
10152         esac
10153     # Extra magic for the benefit of systems that need pthread.h
10154     # to be included early to correctly detect threadsafe functions.
10155     # Such functions must guarantee themselves, though, that the usethreads
10156     # and i_pthread have been defined, before calling protochk.
10157     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10158         echo "#include <pthread.h>" >> try.c
10159         pthread_h_done=yes
10160     fi
10161     shift 2
10162 done
10163 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10164 cat >> try.c <<'EOCP'
10165 #ifdef CAN_PROTOTYPE
10166 #define _(args) args
10167 #else
10168 #define _(args) ()
10169 #endif
10170 EOCP
10171 echo "$foo" >> try.c
10172 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10173 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10174 status=$?
10175 $rm_try
10176 exit $status
10177 EOSH
10178 chmod +x protochk
10179 $eunicefix protochk
10180
10181 : Define hasproto macro for Configure internal use
10182 hasproto='varname=$1; func=$2; shift; shift;
10183 while $test $# -ge 2; do
10184         case "$1" in
10185         $define) echo "#include <$2>";;
10186         esac ;
10187     shift 2;
10188 done > try.c;
10189 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10190 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10191         echo "$func() prototype found.";
10192         val="$define";
10193 else
10194         echo "$func() prototype NOT found.";
10195         val="$undef";
10196 fi;
10197 set $varname;
10198 eval $setvar;
10199 $rm_try tryout.c'
10200
10201 : see if sys/types.h has to be included
10202 set sys/types.h i_systypes
10203 eval $inhdr
10204
10205 : see if sys/select.h has to be included
10206 set sys/select.h i_sysselct
10207 eval $inhdr
10208
10209 : Define hasfield macro for Configure internal use
10210 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10211 while $test $# -ge 2; do
10212         case "$1" in
10213         $define) echo "#include <$2>";;
10214         esac ;
10215     shift 2;
10216 done > try.c;
10217 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10218 set try;
10219 if eval $compile; then
10220         val="$define";
10221 else
10222         val="$undef";
10223 fi;
10224 set $varname;
10225 eval $setvar;
10226 $rm_try'
10227
10228 : see if we should include time.h, sys/time.h, or both
10229 echo " "
10230 if test "X$timeincl" = X; then
10231         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10232         $echo $n "I'm now running the test program...$c"
10233         $cat >try.c <<EOCP
10234 #include <sys/types.h>
10235 #ifdef I_TIME
10236 #include <time.h>
10237 #endif
10238 #ifdef I_SYSTIME
10239 #ifdef SYSTIMEKERNEL
10240 #define KERNEL
10241 #endif
10242 #include <sys/time.h>
10243 #endif
10244 #ifdef I_SYSSELECT
10245 #include <sys/select.h>
10246 #endif
10247 #$i_stdlib I_STDLIB
10248 #ifdef I_STDLIB
10249 #include <stdlib.h>
10250 #endif
10251 int main()
10252 {
10253         struct tm foo;
10254 #ifdef S_TIMEVAL
10255         struct timeval bar;
10256 #endif
10257 #ifdef S_TIMEZONE
10258         struct timezone tzp;
10259 #endif
10260         if (foo.tm_sec == foo.tm_sec)
10261                 exit(0);
10262 #ifdef S_TIMEVAL
10263         if (bar.tv_sec == bar.tv_sec)
10264                 exit(0);
10265 #endif
10266         exit(1);
10267 }
10268 EOCP
10269         flags=''
10270         for s_timezone in '-DS_TIMEZONE' ''; do
10271         sysselect=''
10272         for s_timeval in '-DS_TIMEVAL' ''; do
10273         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10274         for i_time in '' '-DI_TIME'; do
10275         for i_systime in '-DI_SYSTIME' ''; do
10276                 case "$flags" in
10277                 '') $echo $n ".$c"
10278                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10279                         if eval $compile; then
10280                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10281                                 shift
10282                                 flags="$*"
10283                                 echo " "
10284                                 $echo $n "Succeeded with $flags$c"
10285                         fi
10286                         ;;
10287                 esac
10288         done
10289         done
10290         done
10291         done
10292         done
10293         timeincl=''
10294         echo " "
10295         case "$flags" in
10296         *SYSTIMEKERNEL*) i_systimek="$define"
10297                 timeincl=`./findhdr sys/time.h`
10298                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10299         *) i_systimek="$undef";;
10300         esac
10301         case "$flags" in
10302         *I_TIME*) i_time="$define"
10303                 timeincl=`./findhdr time.h`" $timeincl"
10304                 echo "We'll include <time.h>." >&4;;
10305         *) i_time="$undef";;
10306         esac
10307         case "$flags" in
10308         *I_SYSTIME*) i_systime="$define"
10309                 timeincl=`./findhdr sys/time.h`" $timeincl"
10310                 echo "We'll include <sys/time.h>." >&4;;
10311         *) i_systime="$undef";;
10312         esac
10313         $rm_try
10314 fi
10315 : see if struct tm knows about tm_zone
10316 case "$i_systime$i_time" in
10317 *$define*)
10318         echo " "
10319         echo "Checking to see if your struct tm has tm_zone field..." >&4
10320         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10321         eval $hasfield
10322         ;;
10323 *)      val="$undef"
10324         set d_tm_tm_zone
10325         eval $setvar
10326         ;;
10327 esac
10328 case "$d_tm_tm_zone" in
10329 "$define")      echo "Yes, it does."   ;;
10330 *)              echo "No, it doesn't." ;;
10331 esac
10332 : see if struct tm knows about tm_gmtoff
10333 case "$i_systime$i_time" in
10334 *$define*)
10335         echo " "
10336         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10337         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10338         eval $hasfield
10339         ;;
10340 *)      val="$undef"
10341         set d_tm_tm_gmtoff
10342         eval $setvar
10343         ;;
10344 esac
10345 case "$d_tm_tm_gmtoff" in
10346 "$define")      echo "Yes, it does."   ;;
10347 *)              echo "No, it doesn't." ;;
10348 esac
10349
10350 : see if asctime_r exists
10351 set asctime_r d_asctime_r
10352 eval $inlibc
10353 case "$d_asctime_r" in
10354 "$define")
10355         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10356         case "$d_asctime_r_proto:$usethreads" in
10357         ":define")      d_asctime_r_proto=define
10358                 set d_asctime_r_proto asctime_r $hdrs
10359                 eval $hasproto ;;
10360         *)      ;;
10361         esac
10362         case "$d_asctime_r_proto" in
10363         define)
10364         case "$asctime_r_proto" in
10365         ''|0) try='char* asctime_r(const struct tm*, char*);'
10366         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10367         esac
10368         case "$asctime_r_proto" in
10369         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10370         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10371         esac
10372         case "$asctime_r_proto" in
10373         ''|0) try='int asctime_r(const struct tm*, char*);'
10374         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10375         esac
10376         case "$asctime_r_proto" in
10377         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10378         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10379         esac
10380         case "$asctime_r_proto" in
10381         ''|0)   d_asctime_r=undef
10382                 asctime_r_proto=0
10383                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10384         * )     case "$asctime_r_proto" in
10385                 REENTRANT_PROTO*) ;;
10386                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10387                 esac
10388                 echo "Prototype: $try" ;;
10389         esac
10390         ;;
10391         *)      case "$usethreads" in
10392                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10393                 esac
10394                 d_asctime_r=undef
10395                 asctime_r_proto=0
10396                 ;;
10397         esac
10398         ;;
10399 *)      asctime_r_proto=0
10400         ;;
10401 esac
10402
10403 : see if atolf exists
10404 set atolf d_atolf
10405 eval $inlibc
10406
10407 : see if atoll exists
10408 set atoll d_atoll
10409 eval $inlibc
10410
10411 : Look for GCC-style attribute format
10412 case "$d_attribute_format" in
10413 '')
10414 echo " "
10415 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10416 $cat >attrib.c <<'EOCP'
10417 #include <stdio.h>
10418 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10419 EOCP
10420 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10421         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10422                 echo "Your C compiler doesn't support __attribute__((format))."
10423                 val="$undef"
10424         else
10425                 echo "Your C compiler supports __attribute__((format))."
10426                 val="$define"
10427         fi
10428 else
10429         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10430         val="$undef"
10431 fi
10432 ;;
10433 *) val="$d_attribute_format" ;;
10434 esac
10435 set d_attribute_format
10436 eval $setvar
10437 $rm -f attrib*
10438
10439 : Look for GCC-style attribute format with null format allowed
10440 case "$d_printf_format_null" in
10441 '') case "$d_attribute_format" in
10442     $define)
10443         echo " "
10444         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10445 $cat >attrib.c <<EOCP
10446 #include <stdio.h>
10447 #$i_stdlib I_STDLIB
10448 #ifdef I_STDLIB
10449 #include <stdlib.h>
10450 #endif
10451 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10452 int null_printf (char* pat,...) { return (int)pat; }
10453 int main () { exit(null_printf(NULL)); }
10454 EOCP
10455         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10456             : run the executable in case it produces a run-time warning
10457             if $run ./attrib >>attrib.out 2>&1; then
10458                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10459                     echo "Your C compiler doesn't allow __printf__ format to be null."
10460                     val="$undef"
10461                 else
10462                     echo "Your C compiler allows __printf__ format to be null."
10463                     val="$define"
10464                 fi
10465             else
10466             echo "Your C compiler executable failed with __printf__ format null."
10467             val="$undef"
10468         fi
10469     else
10470         echo "Your C compiler fails with __printf__ format null."
10471         val="$undef"
10472     fi
10473     ;;
10474     *)  val="$undef" ;;
10475     esac
10476 ;;
10477 *)  val="$d_printf_format_null" ;;
10478 esac
10479 set d_printf_format_null
10480 eval $setvar
10481 $rm -f attrib*
10482
10483 : Look for GCC-style attribute malloc
10484 case "$d_attribute_malloc" in
10485 '')
10486 echo " "
10487 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10488 $cat >attrib.c <<'EOCP'
10489 #include <stdio.h>
10490 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
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__((malloc))."
10495                 val="$undef"
10496         else
10497                 echo "Your C compiler supports __attribute__((malloc))."
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_malloc" ;;
10506 esac
10507 set d_attribute_malloc
10508 eval $setvar
10509 $rm -f attrib*
10510
10511 : Look for GCC-style attribute nonnull
10512 case "$d_attribute_nonnull" in
10513 '')
10514 echo " "
10515 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10516 $cat >attrib.c <<'EOCP'
10517 #include <stdio.h>
10518 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
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__((nonnull))."
10523                 val="$undef"
10524         else
10525                 echo "Your C compiler supports __attribute__((nonnull))."
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_nonnull" ;;
10534 esac
10535 set d_attribute_nonnull
10536 eval $setvar
10537 $rm -f attrib*
10538
10539 : Look for GCC-style attribute noreturn
10540 case "$d_attribute_noreturn" in
10541 '')
10542 echo " "
10543 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10544 $cat >attrib.c <<'EOCP'
10545 #include <stdio.h>
10546 void fall_over_dead( void ) __attribute__((noreturn));
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__((noreturn))."
10551                 val="$undef"
10552         else
10553                 echo "Your C compiler supports __attribute__((noreturn))."
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_noreturn" ;;
10562 esac
10563 set d_attribute_noreturn
10564 eval $setvar
10565 $rm -f attrib*
10566
10567 : Look for GCC-style attribute pure
10568 case "$d_attribute_pure" in
10569 '')
10570 echo " "
10571 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10572 $cat >attrib.c <<'EOCP'
10573 #include <stdio.h>
10574 int square( int n ) __attribute__((pure));
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__((pure))."
10579                 val="$undef"
10580         else
10581                 echo "Your C compiler supports __attribute__((pure))."
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_pure" ;;
10590 esac
10591 set d_attribute_pure
10592 eval $setvar
10593 $rm -f attrib*
10594
10595 : Look for GCC-style attribute unused
10596 case "$d_attribute_unused" in
10597 '')
10598 echo " "
10599 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10600 $cat >attrib.c <<'EOCP'
10601 #include <stdio.h>
10602 int do_something( int dummy __attribute__((unused)), int n );
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__((unused))."
10607                 val="$undef"
10608         else
10609                 echo "Your C compiler supports __attribute__((unused))."
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_unused" ;;
10618 esac
10619 set d_attribute_unused
10620 eval $setvar
10621 $rm -f attrib*
10622
10623 : Look for GCC-style attribute deprecated
10624 case "$d_attribute_deprecated" in
10625 '')
10626 echo " "
10627 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10628 $cat >attrib.c <<'EOCP'
10629 #include <stdio.h>
10630 int I_am_deprecated(void) __attribute__((deprecated));
10631 EOCP
10632 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10633         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10634                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10635                 val="$undef"
10636         else
10637                 echo "Your C compiler supports __attribute__((deprecated))."
10638                 val="$define"
10639         fi
10640 else
10641         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10642         val="$undef"
10643 fi
10644 ;;
10645 *) val="$d_attribute_deprecated" ;;
10646 esac
10647 set d_attribute_deprecated
10648 eval $setvar
10649 $rm -f attrib*
10650
10651 : Look for GCC-style attribute warn_unused_result
10652 case "$d_attribute_warn_unused_result" in
10653 '')
10654 echo " "
10655 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10656 $cat >attrib.c <<'EOCP'
10657 #include <stdio.h>
10658 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10659 EOCP
10660 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10661         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10662                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10663                 val="$undef"
10664         else
10665                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10666                 val="$define"
10667         fi
10668 else
10669         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10670         val="$undef"
10671 fi
10672 ;;
10673 *) val="$d_attribute_warn_unused_result" ;;
10674 esac
10675 set d_attribute_warn_unused_result
10676 eval $setvar
10677 $rm -f attrib*
10678
10679 : see if bcmp exists
10680 set bcmp d_bcmp
10681 eval $inlibc
10682
10683 : see if bcopy exists
10684 set bcopy d_bcopy
10685 eval $inlibc
10686
10687 : see if getpgrp exists
10688 set getpgrp d_getpgrp
10689 eval $inlibc
10690
10691 case "$d_getpgrp" in
10692 "$define")
10693         echo " "
10694         echo "Checking to see which flavor of getpgrp is in use..."
10695         $cat >try.c <<EOP
10696 #$i_unistd I_UNISTD
10697 #include <sys/types.h>
10698 #ifdef I_UNISTD
10699 #  include <unistd.h>
10700 #endif
10701 #$i_stdlib I_STDLIB
10702 #ifdef I_STDLIB
10703 #include <stdlib.h>
10704 #endif
10705 int main()
10706 {
10707         if (getuid() == 0) {
10708                 printf("(I see you are running Configure as super-user...)\n");
10709                 setuid(1);
10710         }
10711 #ifdef TRY_BSD_PGRP
10712         if (getpgrp(1) == 0)
10713                 exit(0);
10714 #else
10715         if (getpgrp() > 0)
10716                 exit(0);
10717 #endif
10718         exit(1);
10719 }
10720 EOP
10721         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10722                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10723                 val="$define"
10724         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10725                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10726                 val="$undef"
10727         else
10728                 echo "I can't seem to compile and run the test program."
10729                 if ./usg; then
10730                         xxx="a USG one, i.e. you use getpgrp()."
10731                 else
10732                         # SVR4 systems can appear rather BSD-ish.
10733                         case "$i_unistd" in
10734                         $undef)
10735                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10736                                 val="$define"
10737                                 ;;
10738                         $define)
10739                                 xxx="probably a USG one, i.e. you use getpgrp()."
10740                                 val="$undef"
10741                                 ;;
10742                         esac
10743                 fi
10744                 echo "Assuming your getpgrp is $xxx" >&4
10745         fi
10746         ;;
10747 *) val="$undef";;
10748 esac
10749 set d_bsdgetpgrp
10750 eval $setvar
10751 $rm_try
10752
10753 : see if setpgrp exists
10754 set setpgrp d_setpgrp
10755 eval $inlibc
10756
10757 case "$d_setpgrp" in
10758 "$define")
10759         echo " "
10760         echo "Checking to see which flavor of setpgrp is in use..."
10761         $cat >try.c <<EOP
10762 #$i_unistd I_UNISTD
10763 #include <sys/types.h>
10764 #ifdef I_UNISTD
10765 #  include <unistd.h>
10766 #endif
10767 #$i_stdlib I_STDLIB
10768 #ifdef I_STDLIB
10769 #include <stdlib.h>
10770 #endif
10771 int main()
10772 {
10773         if (getuid() == 0) {
10774                 printf("(I see you are running Configure as super-user...)\n");
10775                 setuid(1);
10776         }
10777 #ifdef TRY_BSD_PGRP
10778         if (-1 == setpgrp(1, 1))
10779                 exit(0);
10780 #else
10781         if (setpgrp() != -1)
10782                 exit(0);
10783 #endif
10784         exit(1);
10785 }
10786 EOP
10787         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10788                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10789                 val="$define"
10790         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10791                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10792                 val="$undef"
10793         else
10794                 echo "(I can't seem to compile and run the test program.)"
10795                 if ./usg; then
10796                         xxx="a USG one, i.e. you use setpgrp()."
10797                 else
10798                         # SVR4 systems can appear rather BSD-ish.
10799                         case "$i_unistd" in
10800                         $undef)
10801                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10802                                 val="$define"
10803                                 ;;
10804                         $define)
10805                                 xxx="probably a USG one, i.e. you use setpgrp()."
10806                                 val="$undef"
10807                                 ;;
10808                         esac
10809                 fi
10810                 echo "Assuming your setpgrp is $xxx" >&4
10811         fi
10812         ;;
10813 *) val="$undef";;
10814 esac
10815 set d_bsdsetpgrp
10816 eval $setvar
10817 $rm_try
10818
10819 : Look for GCC-style __builtin_choose_expr
10820 case "$d_builtin_choose_expr" in
10821 '')
10822     echo " "
10823     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10824     $cat >try.c <<'EOCP'
10825 #include <assert.h>
10826 #include <stdlib.h>
10827 #include <stdio.h>
10828
10829 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10830
10831 int main(void) {
10832     assert( SYRINX(1) == 2112 );
10833     assert( SYRINX(1) != 5150 );
10834     assert( SYRINX(0) == 5150 );
10835     assert( SYRINX(0) != 2112 );
10836     puts( "All good!" );
10837     exit(0);
10838 }
10839
10840 EOCP
10841     set try
10842     if eval $compile && $run ./try; then
10843         echo "Your C compiler supports __builtin_choose_expr."
10844         val="$define"
10845     else
10846         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10847         val="$undef"
10848     fi
10849 ;;
10850 *) val="$d_builtin_choose_expr" ;;
10851 esac
10852
10853 set d_builtin_choose_expr
10854 eval $setvar
10855 $rm_try
10856
10857 : Look for GCC-style __builtin_expect
10858 case "$d_builtin_expect" in
10859 '')
10860     echo " "
10861     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10862     $cat >try.c <<'EOCP'
10863 int main(void) {
10864     int n = 50;
10865     if ( __builtin_expect(n, 0) ) n = 1;
10866     /* Remember shell exit code truth is 0, C truth is non-zero */
10867     return !(n == 1);
10868 }
10869 EOCP
10870     set try
10871     if eval $compile && $run ./try; then
10872         echo "Your C compiler supports __builtin_expect."
10873         val="$define"
10874     else
10875         echo "Your C compiler doesn't seem to understand __builtin_expect."
10876         val="$undef"
10877     fi
10878     ;;
10879 *) val="$d_builtin_expect" ;;
10880 esac
10881
10882 set d_builtin_expect
10883 eval $setvar
10884 $rm_try
10885
10886 : see if bzero exists
10887 set bzero d_bzero
10888 eval $inlibc
10889
10890 : see if stdarg is available
10891 echo " "
10892 if $test `./findhdr stdarg.h`; then
10893         echo "<stdarg.h> found." >&4
10894         valstd="$define"
10895 else
10896         echo "<stdarg.h> NOT found." >&4
10897         valstd="$undef"
10898 fi
10899
10900 : see if varargs is available
10901 echo " "
10902 if $test `./findhdr varargs.h`; then
10903         echo "<varargs.h> found." >&4
10904 else
10905         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10906 fi
10907
10908 : set up the varargs testing programs
10909 $cat > varargs.c <<EOP
10910 #ifdef I_STDARG
10911 #include <stdarg.h>
10912 #endif
10913 #ifdef I_VARARGS
10914 #include <varargs.h>
10915 #endif
10916
10917 #ifdef I_STDARG
10918 int f(char *p, ...)
10919 #else
10920 int f(va_alist)
10921 va_dcl
10922 #endif
10923 {
10924         va_list ap;
10925 #ifndef I_STDARG
10926         char *p;
10927 #endif
10928 #ifdef I_STDARG
10929         va_start(ap,p);
10930 #else
10931         va_start(ap);
10932         p = va_arg(ap, char *);
10933 #endif
10934         va_end(ap);
10935         return 0;
10936 }
10937 EOP
10938 $cat > varargs <<EOP
10939 $startsh
10940 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10941         echo "true"
10942 else
10943         echo "false"
10944 fi
10945 $rm -f varargs$_o
10946 EOP
10947 chmod +x varargs
10948
10949 : now check which varargs header should be included
10950 echo " "
10951 i_varhdr=''
10952 val=''
10953 case "$valstd" in
10954 "$define")
10955         if `./varargs I_STDARG`; then
10956                 val='stdarg.h'
10957         elif `./varargs I_VARARGS`; then
10958                 val='varargs.h'
10959         fi
10960         ;;
10961 *)
10962         if `./varargs I_VARARGS`; then
10963                 val='varargs.h'
10964         fi
10965         ;;
10966 esac
10967 case "$val" in
10968 '')
10969         echo " "
10970         echo "*** WHOA THERE!!! ***" >&4
10971         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
10972         case "$knowitall" in
10973         '')
10974         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
10975                 exit 1
10976                 ;;
10977         esac
10978 echo "I could not find the definition for va_dcl... You have problems..." >&4
10979         val="$undef"; set i_stdarg; eval $setvar
10980         val="$undef"; set i_varargs; eval $setvar
10981         ;;
10982 *)
10983         set i_varhdr
10984         eval $setvar
10985         case "$i_varhdr" in
10986         stdarg.h)
10987                 val="$define"; set i_stdarg; eval $setvar
10988                 val="$undef"; set i_varargs; eval $setvar
10989                 ;;
10990         varargs.h)
10991                 val="$undef"; set i_stdarg; eval $setvar
10992                 val="$define"; set i_varargs; eval $setvar
10993                 ;;
10994         esac
10995         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10996 esac
10997 $rm -f varargs*
10998
10999 : see if the Compiler supports C99 variadic macros
11000 case "$i_stdarg$i_stdlib" in
11001     "$define$define")
11002     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11003     $cat >try.c <<EOCP
11004 #include <stdio.h>
11005 #include <stdarg.h>
11006
11007 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11008
11009 int main() {
11010   char buf[20];
11011   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11012   puts(buf);
11013   return 0;
11014 }
11015 EOCP
11016     set try
11017     if eval $compile && $run ./try 2>&1 >/dev/null; then
11018         case "`$run ./try`" in
11019             "123 456 789")
11020             echo "You have C99 variadic macros." >&4
11021             d_c99_variadic_macros="$define"
11022             ;;
11023             *)
11024             echo "You don't have functional C99 variadic macros." >&4
11025             d_c99_variadic_macros="$undef"
11026             ;;
11027         esac
11028     else
11029         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11030         d_c99_variadic_macros="$undef"
11031     fi
11032     $rm_try
11033     ;;
11034     *)
11035     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11036     d_c99_variadic_macros="$undef"
11037     ;;
11038 esac
11039
11040 : see if signal is declared as pointer to function returning int or void
11041 echo " "
11042 xxx=`./findhdr signal.h`
11043 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11044 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11045         echo "You have int (*signal())() instead of void." >&4
11046         val="$undef"
11047 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11048         echo "You have void (*signal())()." >&4
11049         val="$define"
11050 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11051         echo "You have int (*signal())() instead of void." >&4
11052         val="$undef"
11053 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11054         echo "You have void (*signal())()." >&4
11055         val="$define"
11056 else
11057         case "$d_voidsig" in
11058         '')
11059         echo "I can't determine whether signal handler returns void or int..." >&4
11060                 dflt=void
11061                 rp="What type does your signal handler return?"
11062                 . ./myread
11063                 case "$ans" in
11064                 v*) val="$define";;
11065                 *) val="$undef";;
11066                 esac;;
11067         "$define")
11068                 echo "As you already told me, signal handler returns void." >&4
11069                 val="$define"
11070                 ;;
11071         *)      echo "As you already told me, signal handler returns int." >&4
11072                 val="$undef"
11073                 ;;
11074         esac
11075 fi
11076 set d_voidsig
11077 eval $setvar
11078 case "$d_voidsig" in
11079 "$define") signal_t="void";;
11080 *) signal_t="int";;
11081 esac
11082 $rm -f $$.tmp
11083
11084 : check for ability to cast large floats to 32-bit ints.
11085 echo " "
11086 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11087 if $test "$intsize" -ge 4; then
11088         xxx=int
11089 else
11090         xxx=long
11091 fi
11092 $cat >try.c <<EOCP
11093 #include <stdio.h>
11094 #$i_stdlib I_STDLIB
11095 #ifdef I_STDLIB
11096 #include <stdlib.h>
11097 #endif
11098 #include <sys/types.h>
11099 #include <signal.h>
11100 $signal_t blech(int s) { exit(3); }
11101 int main()
11102 {
11103         $xxx i32;
11104         double f, g;
11105         int result = 0;
11106         char str[16];
11107         signal(SIGFPE, blech);
11108
11109         /* Don't let compiler optimize the test away.  Store the number
11110            in a writable string for gcc to pass to sscanf under HP-UX.
11111         */
11112         sprintf(str, "2147483647");
11113         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11114         g = 10 * f;
11115         i32  = ($xxx) g;
11116
11117         /* x86 processors will probably give 0x8000 0000, which is a
11118            sign change.  We don't want that.  We want to mimic SPARC
11119            behavior here, which is to preserve the sign and give
11120            back 0x7fff ffff.
11121         */
11122         if (i32 != ($xxx) f)
11123                 result |= 1;
11124         exit(result);
11125 }
11126 EOCP
11127 set try
11128 if eval $compile_ok; then
11129         $run ./try
11130         yyy=$?
11131 else
11132         echo "(I can't seem to compile the test program--assuming it can't)"
11133         yyy=1
11134 fi
11135 case "$yyy" in
11136 0)      val="$define"
11137         echo "Yup, it can."
11138         ;;
11139 *)      val="$undef"
11140         echo "Nope, it can't."
11141         ;;
11142 esac
11143 set d_casti32
11144 eval $setvar
11145 $rm_try
11146
11147 : check for ability to cast negative floats to unsigned
11148 echo " "
11149 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11150 $cat >try.c <<EOCP
11151 #include <stdio.h>
11152 #$i_stdlib I_STDLIB
11153 #ifdef I_STDLIB
11154 #include <stdlib.h>
11155 #endif
11156 #include <sys/types.h>
11157 #include <signal.h>
11158 $signal_t blech(int s) { exit(7); }
11159 $signal_t blech_in_list(int s) { exit(4); }
11160 unsigned long dummy_long(unsigned long p) { return p; }
11161 unsigned int dummy_int(unsigned int p) { return p; }
11162 unsigned short dummy_short(unsigned short p) { return p; }
11163 int main()
11164 {
11165         double f;
11166         unsigned long along;
11167         unsigned int aint;
11168         unsigned short ashort;
11169         int result = 0;
11170         char str[16];
11171
11172         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11173            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11174            optimized the whole file away
11175         */
11176         /* Store the number in a writable string for gcc to pass to
11177            sscanf under HP-UX.
11178         */
11179         sprintf(str, "-123");
11180         sscanf(str, "%lf", &f);  /* f = -123.; */
11181
11182         signal(SIGFPE, blech);
11183         along = (unsigned long)f;
11184         aint = (unsigned int)f;
11185         ashort = (unsigned short)f;
11186         if (along != (unsigned long)-123)
11187                 result |= 1;
11188         if (aint != (unsigned int)-123)
11189                 result |= 1;
11190         if (ashort != (unsigned short)-123)
11191                 result |= 1;
11192         sprintf(str, "1073741824.");
11193         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11194         f = f + f;
11195         along = 0;
11196         along = (unsigned long)f;
11197         if (along != 0x80000000)
11198                 result |= 2;
11199         f -= 1.;
11200         along = 0;
11201         along = (unsigned long)f;
11202         if (along != 0x7fffffff)
11203                 result |= 1;
11204         f += 2.;
11205         along = 0;
11206         along = (unsigned long)f;
11207         if (along != 0x80000001)
11208                 result |= 2;
11209         if (result)
11210                 exit(result);
11211         signal(SIGFPE, blech_in_list);
11212         sprintf(str, "123.");
11213         sscanf(str, "%lf", &f);  /* f = 123.; */
11214         along = dummy_long((unsigned long)f);
11215         aint = dummy_int((unsigned int)f);
11216         ashort = dummy_short((unsigned short)f);
11217         if (along != (unsigned long)123)
11218                 result |= 4;
11219         if (aint != (unsigned int)123)
11220                 result |= 4;
11221         if (ashort != (unsigned short)123)
11222                 result |= 4;
11223         exit(result);
11224
11225 }
11226 EOCP
11227 set try
11228 if eval $compile_ok; then
11229         $run ./try
11230         castflags=$?
11231 else
11232         echo "(I can't seem to compile the test program--assuming it can't)"
11233         castflags=7
11234 fi
11235 case "$castflags" in
11236 0)      val="$define"
11237         echo "Yup, it can."
11238         ;;
11239 *)      val="$undef"
11240         echo "Nope, it can't."
11241         ;;
11242 esac
11243 set d_castneg
11244 eval $setvar
11245 $rm_try
11246
11247 : see if vprintf exists
11248 echo " "
11249 if set vprintf val -f d_vprintf; eval $csym; $val; then
11250         echo 'vprintf() found.' >&4
11251         val="$define"
11252         $cat >try.c <<EOF
11253 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11254 #$i_varargs I_VARARGS
11255
11256 #$i_stdlib I_STDLIB
11257 #$i_unistd I_UNISTD
11258
11259 #ifdef I_STDARG
11260 #  include <stdarg.h>
11261 #else /* I_VARARGS */
11262 #  include <varargs.h>
11263 #endif
11264
11265 #ifdef I_UNISTD
11266 #  include <unistd.h>
11267 #endif
11268
11269 #ifdef I_STDLIB
11270 #  include <stdlib.h>
11271 #endif
11272
11273 #include <stdio.h> /* vsprintf prototype */
11274
11275 #ifdef I_STDARG
11276 void xxx(int n, ...)
11277 {
11278     va_list args;
11279     char buf[10];
11280     va_start(args, n);
11281     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11282 }
11283 int main() { xxx(1, "foo"); }
11284
11285 #else /* I_VARARGS */
11286
11287 xxx(va_alist)
11288 va_dcl
11289 {
11290     va_list args;
11291     char buf[10];
11292     va_start(args);
11293     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11294 }
11295 int main() { xxx("foo"); }
11296
11297 #endif
11298
11299 EOF
11300         set try
11301         if eval $compile_ok; then
11302                 if $run ./try; then
11303                         echo "Your vsprintf() returns (int)." >&4
11304                         val2="$undef"
11305                 else
11306                         echo "Your vsprintf() returns (char*)." >&4
11307                         val2="$define"
11308                 fi
11309         else
11310                 echo 'I am unable to compile the vsprintf() test program.' >&4
11311                 # We shouldn't get here.  If we do, assume the standard signature,
11312                 # not the old BSD one.
11313                 echo 'Guessing that vsprintf() returns (int).' >&4
11314                 val2="$undef"
11315         fi
11316 else
11317         echo 'vprintf() NOT found.' >&4
11318         val="$undef"
11319         val2="$undef"
11320 fi
11321 $rm_try
11322 set d_vprintf
11323 eval $setvar
11324 val=$val2
11325 set d_charvspr
11326 eval $setvar
11327
11328 : see if chown exists
11329 set chown d_chown
11330 eval $inlibc
11331
11332 : see if chroot exists
11333 set chroot d_chroot
11334 eval $inlibc
11335
11336 : see if chsize exists
11337 set chsize d_chsize
11338 eval $inlibc
11339
11340 : see if class exists
11341 set class d_class
11342 eval $inlibc
11343
11344 : see if clearenv exists
11345 set clearenv d_clearenv
11346 eval $inlibc
11347
11348 : Define hasstruct macro for Configure internal use
11349 hasstruct='varname=$1; struct=$2; shift; shift;
11350 while $test $# -ge 2; do
11351         case "$1" in
11352         $define) echo "#include <$2>";;
11353         esac ;
11354     shift 2;
11355 done > try.c;
11356 echo "int main () { struct $struct foo; }" >> try.c;
11357 set try;
11358 if eval $compile; then
11359         val="$define";
11360 else
11361         val="$undef";
11362 fi;
11363 set $varname;
11364 eval $setvar;
11365 $rm_try'
11366
11367 : see whether socket exists
11368 socketlib=''
11369 sockethdr=''
11370 echo " "
11371 $echo $n "Hmm... $c" >&4
11372 if set socket val -f d_socket; eval $csym; $val; then
11373         echo "Looks like you have Berkeley networking support." >&4
11374         d_socket="$define"
11375         if set setsockopt val -f; eval $csym; $val; then
11376                 d_oldsock="$undef"
11377         else
11378                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11379                 d_oldsock="$define"
11380         fi
11381 else
11382         if $contains socklib libc.list >/dev/null 2>&1; then
11383                 echo "Looks like you have Berkeley networking support." >&4
11384                 d_socket="$define"
11385                 : we will have to assume that it supports the 4.2 BSD interface
11386                 d_oldsock="$undef"
11387         else
11388                 echo "You don't have Berkeley networking in libc$_a..." >&4
11389                 if test "X$d_socket" = "X$define"; then
11390                    echo "...but you seem to believe that you have sockets." >&4
11391                 else
11392                         for net in net socket
11393                         do
11394                                 if test -f /usr/lib/lib$net$_a; then
11395                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11396                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11397                                         if $contains socket libc.list >/dev/null 2>&1; then
11398                                                 d_socket="$define"
11399                                                 socketlib="-l$net"
11400                                                 case "$net" in
11401                                                 net)
11402                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11403                                                         sockethdr="-I/usr/netinclude"
11404                                                         ;;
11405                                                 esac
11406                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11407                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11408                                                         d_oldsock="$undef"
11409                                                 else
11410                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11411                                                         d_oldsock="$define"
11412                                                 fi
11413                                                 break
11414                                         fi
11415                                 fi
11416                         done
11417                         if test "X$d_socket" != "X$define"; then
11418                            echo "or anywhere else I see." >&4
11419                            d_socket="$undef"
11420                            d_oldsock="$undef"
11421                         fi
11422                 fi
11423         fi
11424 fi
11425
11426 : see if socketpair exists
11427 set socketpair d_sockpair
11428 eval $inlibc
11429
11430
11431 echo " "
11432 echo "Checking the availability sa_len in the sock struct ..." >&4
11433 $cat >try.c <<EOF
11434 #include <sys/types.h>
11435 #include <sys/socket.h>
11436 int main() {
11437 struct sockaddr sa;
11438 return (sa.sa_len);
11439 }
11440 EOF
11441 val="$undef"
11442 set try; if eval $compile; then
11443         val="$define"
11444 fi
11445 set d_sockaddr_sa_len; eval $setvar
11446 $rm_try
11447
11448 echo " "
11449 echo "Checking the availability struct sockaddr_in6 ..." >&4
11450 $cat >try.c <<EOF
11451 #include <sys/types.h>
11452 #include <sys/socket.h>
11453 #include <netinet/in.h>
11454 int main() {
11455 struct sockaddr_in6 sin6;
11456 return (sin6.sin6_family);
11457 }
11458 EOF
11459 val="$undef"
11460 set try; if eval $compile; then
11461         val="$define"
11462 fi
11463 set d_sockaddr_in6; eval $setvar
11464 $rm_try
11465
11466 echo " "
11467 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11468 $cat >try.c <<EOF
11469 #include <sys/types.h>
11470 #include <sys/socket.h>
11471 #include <netinet/in.h>
11472 int main() {
11473 struct sockaddr_in6 sin6;
11474 return (sin6.sin6_scope_id);
11475 }
11476 EOF
11477 val="$undef"
11478 set try; if eval $compile; then
11479         val="$define"
11480 fi
11481 set d_sin6_scope_id; eval $setvar
11482 $rm_try
11483
11484 echo " "
11485 echo "Checking the availability struct ip_mreq ..." >&4
11486 $cat >try.c <<EOF
11487 #include <sys/types.h>
11488 #include <sys/socket.h>
11489 #include <netinet/in.h>
11490 int main() {
11491 struct ip_mreq mreq;
11492 return (mreq.imr_multiaddr.s_addr);
11493 }
11494 EOF
11495 val="$undef"
11496 set try; if eval $compile; then
11497        val="$define"
11498 fi
11499 set d_ip_mreq; eval $setvar
11500 $rm_try
11501
11502 echo " "
11503 echo "Checking the availability struct ip_mreq_source ..." >&4
11504 $cat >try.c <<EOF
11505 #include <sys/types.h>
11506 #include <sys/socket.h>
11507 #include <netinet/in.h>
11508 int main() {
11509 struct ip_mreq_source mreq;
11510 return (mreq.imr_multiaddr.s_addr);
11511 }
11512 EOF
11513 val="$undef"
11514 set try; if eval $compile; then
11515        val="$define"
11516 fi
11517 set d_ip_mreq_source; eval $setvar
11518 $rm_try
11519
11520 echo " "
11521 echo "Checking the availability struct ipv6_mreq ..." >&4
11522 $cat >try.c <<EOF
11523 #include <sys/types.h>
11524 #include <sys/socket.h>
11525 #include <netinet/in.h>
11526 int main() {
11527 struct ipv6_mreq mreq;
11528 return (mreq.ipv6mr_interface);
11529 }
11530 EOF
11531 val="$undef"
11532 set try; if eval $compile; then
11533         val="$define"
11534 fi
11535 set d_ipv6_mreq; eval $setvar
11536 $rm_try
11537
11538 echo " "
11539 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11540 $cat >try.c <<EOF
11541 #include <sys/types.h>
11542 #include <sys/socket.h>
11543 #include <netinet/in.h>
11544 int main() {
11545 struct ipv6_mreq_source mreq;
11546 return (mreq.imr_multiaddr.s_addr);
11547 }
11548 EOF
11549 val="$undef"
11550 set try; if eval $compile; then
11551        val="$define"
11552 fi
11553 set d_ipv6_mreq_source; eval $setvar
11554 $rm_try
11555
11556 echo " "
11557 echo "Checking the availability of certain socket constants..." >&4
11558 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11559         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11560         $cat >try.c <<EOF
11561 #include <sys/types.h>
11562 #include <sys/socket.h>
11563 int main() {
11564     int i = $ENUM;
11565 }
11566 EOF
11567         val="$undef"
11568         set try; if eval $compile; then
11569                 val="$define"
11570         fi
11571         set d_${enum}; eval $setvar
11572         $rm_try
11573 done
11574
11575 : see if this is a sys/uio.h system
11576 set sys/uio.h i_sysuio
11577 eval $inhdr
11578
11579 : Check for cmsghdr support
11580 echo " "
11581 echo "Checking to see if your system supports struct cmsghdr..." >&4
11582 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11583 eval $hasstruct
11584 case "$d_cmsghdr_s" in
11585 "$define")      echo "Yes, it does."   ;;
11586 *)              echo "No, it doesn't." ;;
11587 esac
11588
11589
11590 : check for const keyword
11591 echo " "
11592 echo 'Checking to see if your C compiler knows about "const"...' >&4
11593 $cat >const.c <<'EOCP'
11594 typedef struct spug { int drokk; } spug;
11595 int main()
11596 {
11597         const char *foo;
11598         const spug y = { 0 };
11599 }
11600 EOCP
11601 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11602         val="$define"
11603         echo "Yup, it does."
11604 else
11605         val="$undef"
11606         echo "Nope, it doesn't."
11607 fi
11608 set d_const
11609 eval $setvar
11610
11611 : see if copysignl exists
11612 set copysignl d_copysignl
11613 eval $inlibc
11614
11615 : see if crypt exists
11616 echo " "
11617 set crypt d_crypt
11618 eval $inlibc
11619 case "$d_crypt" in
11620 $define) cryptlib='' ;;
11621 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11622                 echo 'crypt() found.' >&4
11623                 val="$define"
11624                 cryptlib=''
11625         else
11626                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11627                 if $test -z "$cryptlib"; then
11628                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11629                 else
11630                         cryptlib=-lcrypt
11631                 fi
11632                 if $test -z "$cryptlib"; then
11633                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11634                 else
11635                         cryptlib=-lcrypt
11636                 fi
11637                 if $test -z "$cryptlib"; then
11638                         cryptlib=`./loc libcrypt$_a "" $libpth`
11639                 else
11640                         cryptlib=-lcrypt
11641                 fi
11642                 if $test -z "$cryptlib"; then
11643                         echo 'crypt() NOT found.' >&4
11644                         val="$undef"
11645                 else
11646                         val="$define"
11647                 fi
11648         fi
11649         set d_crypt
11650         eval $setvar
11651         ;;
11652 esac
11653
11654 : see if this is a crypt.h system
11655 set crypt.h i_crypt
11656 eval $inhdr
11657
11658 : see if crypt_r exists
11659 set crypt_r d_crypt_r
11660 eval $inlibc
11661 case "$d_crypt_r" in
11662 "$define")
11663         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11664         case "$d_crypt_r_proto:$usethreads" in
11665         ":define")      d_crypt_r_proto=define
11666                 set d_crypt_r_proto crypt_r $hdrs
11667                 eval $hasproto ;;
11668         *)      ;;
11669         esac
11670         case "$d_crypt_r_proto" in
11671         define)
11672         case "$crypt_r_proto" in
11673         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11674         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11675         esac
11676         case "$crypt_r_proto" in
11677         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11678         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11679         esac
11680         case "$crypt_r_proto" in
11681         ''|0)   d_crypt_r=undef
11682                 crypt_r_proto=0
11683                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11684         * )     case "$crypt_r_proto" in
11685                 REENTRANT_PROTO*) ;;
11686                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11687                 esac
11688                 echo "Prototype: $try" ;;
11689         esac
11690         ;;
11691         *)      case "$usethreads" in
11692                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11693                 esac
11694                 d_crypt_r=undef
11695                 crypt_r_proto=0
11696                 ;;
11697         esac
11698         ;;
11699 *)      crypt_r_proto=0
11700         ;;
11701 esac
11702
11703 : get csh whereabouts
11704 case "$csh" in
11705 'csh') val="$undef" ;;
11706 *) val="$define" ;;
11707 esac
11708 set d_csh
11709 eval $setvar
11710 : Respect a hint or command line value for full_csh.
11711 case "$full_csh" in
11712 '') full_csh=$csh ;;
11713 esac
11714
11715 : see if ctermid exists
11716 set ctermid d_ctermid
11717 eval $inlibc
11718
11719 : see if ctermid_r exists
11720 set ctermid_r d_ctermid_r
11721 eval $inlibc
11722 case "$d_ctermid_r" in
11723 "$define")
11724         hdrs="$i_systypes sys/types.h define stdio.h "
11725         case "$d_ctermid_r_proto:$usethreads" in
11726         ":define")      d_ctermid_r_proto=define
11727                 set d_ctermid_r_proto ctermid_r $hdrs
11728                 eval $hasproto ;;
11729         *)      ;;
11730         esac
11731         case "$d_ctermid_r_proto" in
11732         define)
11733         case "$ctermid_r_proto" in
11734         ''|0) try='char* ctermid_r(char*);'
11735         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11736         esac
11737         case "$ctermid_r_proto" in
11738         ''|0)   d_ctermid_r=undef
11739                 ctermid_r_proto=0
11740                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11741         * )     case "$ctermid_r_proto" in
11742                 REENTRANT_PROTO*) ;;
11743                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11744                 esac
11745                 echo "Prototype: $try" ;;
11746         esac
11747         ;;
11748         *)      case "$usethreads" in
11749                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11750                 esac
11751                 d_ctermid_r=undef
11752                 ctermid_r_proto=0
11753                 ;;
11754         esac
11755         ;;
11756 *)      ctermid_r_proto=0
11757         ;;
11758 esac
11759
11760 : see if ctime_r exists
11761 set ctime_r d_ctime_r
11762 eval $inlibc
11763 case "$d_ctime_r" in
11764 "$define")
11765         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11766         case "$d_ctime_r_proto:$usethreads" in
11767         ":define")      d_ctime_r_proto=define
11768                 set d_ctime_r_proto ctime_r $hdrs
11769                 eval $hasproto ;;
11770         *)      ;;
11771         esac
11772         case "$d_ctime_r_proto" in
11773         define)
11774         case "$ctime_r_proto" in
11775         ''|0) try='char* ctime_r(const time_t*, char*);'
11776         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11777         esac
11778         case "$ctime_r_proto" in
11779         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11780         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11781         esac
11782         case "$ctime_r_proto" in
11783         ''|0) try='int ctime_r(const time_t*, char*);'
11784         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11785         esac
11786         case "$ctime_r_proto" in
11787         ''|0) try='int ctime_r(const time_t*, char*, int);'
11788         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11789         esac
11790         case "$ctime_r_proto" in
11791         ''|0)   d_ctime_r=undef
11792                 ctime_r_proto=0
11793                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11794         * )     case "$ctime_r_proto" in
11795                 REENTRANT_PROTO*) ;;
11796                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11797                 esac
11798                 echo "Prototype: $try" ;;
11799         esac
11800         ;;
11801         *)      case "$usethreads" in
11802                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11803                 esac
11804                 d_ctime_r=undef
11805                 ctime_r_proto=0
11806                 ;;
11807         esac
11808         ;;
11809 *)      ctime_r_proto=0
11810         ;;
11811 esac
11812
11813 : see if cuserid exists
11814 set cuserid d_cuserid
11815 eval $inlibc
11816
11817 : see if this is a limits.h system
11818 set limits.h i_limits
11819 eval $inhdr
11820
11821 : see if this is a float.h system
11822 set float.h i_float
11823 eval $inhdr
11824
11825 : See if number of significant digits in a double precision number is known
11826 echo " "
11827 $cat >dbl_dig.c <<EOM
11828 #$i_limits I_LIMITS
11829 #$i_float I_FLOAT
11830 #ifdef I_LIMITS
11831 #include <limits.h>
11832 #endif
11833 #ifdef I_FLOAT
11834 #include <float.h>
11835 #endif
11836 #ifdef DBL_DIG
11837 printf("Contains DBL_DIG");
11838 #endif
11839 EOM
11840 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11841 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11842         echo "DBL_DIG found." >&4
11843         val="$define"
11844 else
11845         echo "DBL_DIG NOT found." >&4
11846         val="$undef"
11847 fi
11848 $rm -f dbl_dig.?
11849 set d_dbl_dig
11850 eval $setvar
11851
11852 : see if dbm.h is available
11853 : see if dbmclose exists
11854 set dbmclose d_dbmclose
11855 eval $inlibc
11856
11857 case "$d_dbmclose" in
11858 $define)
11859         set dbm.h i_dbm
11860         eval $inhdr
11861         case "$i_dbm" in
11862         $define)
11863                 val="$undef"
11864                 set i_rpcsvcdbm
11865                 eval $setvar
11866                 ;;
11867         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11868                 eval $inhdr
11869                 ;;
11870         esac
11871         ;;
11872 *)      echo "We won't be including <dbm.h>"
11873         val="$undef"
11874         set i_dbm
11875         eval $setvar
11876         val="$undef"
11877         set i_rpcsvcdbm
11878         eval $setvar
11879         ;;
11880 esac
11881
11882 : see if prototype for dbminit is available
11883 echo " "
11884 set d_dbminitproto dbminit $i_dbm dbm.h
11885 eval $hasproto
11886
11887 : see if difftime exists
11888 set difftime d_difftime
11889 eval $inlibc
11890
11891 : see if this is a dirent system
11892 echo " "
11893 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11894         val="$define"
11895         echo "<dirent.h> found." >&4
11896 else
11897         val="$undef"
11898         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11899                 echo "<sys/dir.h> found." >&4
11900                 echo " "
11901         else
11902                 xinc=`./findhdr sys/ndir.h`
11903         fi
11904         echo "<dirent.h> NOT found." >&4
11905 fi
11906 set i_dirent
11907 eval $setvar
11908
11909 : Look for type of directory structure.
11910 echo " "
11911 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11912
11913 case "$direntrytype" in
11914 ''|' ')
11915         case "$i_dirent" in
11916         $define) guess1='struct dirent' ;;
11917         *) guess1='struct direct'  ;;
11918         esac
11919         ;;
11920 *)      guess1="$direntrytype"
11921         ;;
11922 esac
11923
11924 case "$guess1" in
11925 'struct dirent') guess2='struct direct' ;;
11926 *) guess2='struct dirent' ;;
11927 esac
11928
11929 if $contains "$guess1" try.c >/dev/null 2>&1; then
11930         direntrytype="$guess1"
11931         echo "Your directory entries are $direntrytype." >&4
11932 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11933         direntrytype="$guess2"
11934         echo "Your directory entries seem to be $direntrytype." >&4
11935 else
11936         echo "I don't recognize your system's directory entries." >&4
11937         rp="What type is used for directory entries on this system?"
11938         dflt="$guess1"
11939         . ./myread
11940         direntrytype="$ans"
11941 fi
11942 $rm_try
11943
11944 : see if the directory entry stores field length
11945 echo " "
11946 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11947 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11948         echo "Good, your directory entry keeps length information in d_namlen." >&4
11949         val="$define"
11950 else
11951         echo "Your directory entry does not know about the d_namlen field." >&4
11952         val="$undef"
11953 fi
11954 set d_dirnamlen
11955 eval $setvar
11956 $rm_try
11957
11958 : Look for DIR.dd_fd
11959 case "$i_dirent" in
11960 "$define")
11961     echo "Checking to see if DIR has a dd_fd member variable" >&4
11962     $cat >try.c <<EOCP
11963 #$i_stdlib I_STDLIB
11964 #ifdef I_STDLIB
11965 #include <stdlib.h>
11966 #endif
11967 #include <dirent.h>
11968
11969 int main() {
11970     DIR dir;
11971     dir.dd_fd = 1;
11972     return 0;
11973 }
11974 EOCP
11975     val=$undef
11976     set try
11977     if eval $compile; then
11978         echo "Yes, it does."
11979         val="$define"
11980     else
11981         echo "No, it does not."
11982         val="$undef"
11983     fi
11984     ;;
11985 *)
11986     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11987     val="$undef"
11988     ;;
11989 esac
11990 set d_dir_dd_fd
11991 eval $setvar
11992 $rm_try
11993
11994 : see if this is an sysdir system
11995 set sys/dir.h i_sysdir
11996 eval $inhdr
11997
11998 : see if this is an sysndir system
11999 set sys/ndir.h i_sysndir
12000 eval $inhdr
12001
12002 : Look for dirfd
12003 echo " "
12004 $cat >dirfd.c <<EOM
12005 #include <stdio.h>
12006 #$i_stdlib I_STDLIB
12007 #ifdef I_STDLIB
12008 #include <stdlib.h>
12009 #endif
12010 #$i_dirent I_DIRENT             /**/
12011 #$i_sysdir I_SYS_DIR            /**/
12012 #$i_sysndir I_SYS_NDIR          /**/
12013 #$i_systypes I_SYS_TYPES        /**/
12014 #if defined(I_SYS_TYPES)
12015 #include <sys/types.h>
12016 #endif
12017 #if defined(I_DIRENT)
12018 #include <dirent.h>
12019 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12020 #include <sys/dir.h>
12021 #endif
12022 #else
12023 #ifdef I_SYS_NDIR
12024 #include <sys/ndir.h>
12025 #else
12026 #ifdef I_SYS_DIR
12027 #ifdef hp9000s500
12028 #include <ndir.h>       /* may be wrong in the future */
12029 #else
12030 #include <sys/dir.h>
12031 #endif
12032 #endif
12033 #endif
12034 #endif
12035 int main() {
12036         DIR *dirp = opendir(".");
12037         if (dirfd(dirp) >= 0)
12038                 exit(0);
12039         else
12040                 exit(1);
12041 }
12042 EOM
12043 val=$undef
12044 set dirfd
12045 if eval $compile; then
12046         val="$define"
12047 fi
12048 case "$val" in
12049 $define)        echo "dirfd() found." >&4       ;;
12050 *)              echo "dirfd() NOT found." >&4   ;;
12051 esac
12052 set d_dirfd
12053 eval $setvar
12054 $rm -f dirfd*
12055
12056 : see if dlerror exists
12057 xxx_runnm="$runnm"
12058 runnm=false
12059 set dlerror d_dlerror
12060 eval $inlibc
12061 runnm="$xxx_runnm"
12062
12063 : see if dlfcn is available
12064 set dlfcn.h i_dlfcn
12065 eval $inhdr
12066
12067 : Check what extension to use for shared libs
12068 case "$usedl" in
12069 $define|y|true)
12070         $cat << EOM
12071
12072 On a few systems, the dynamically loaded modules that perl generates and uses
12073 will need a different extension than shared libs. The default will probably
12074 be appropriate.
12075
12076 EOM
12077         case "$dlext" in
12078         '')     dflt="$so" ;;
12079         *)      dflt="$dlext" ;;
12080         esac
12081         rp='What is the extension of dynamically loaded modules'
12082         . ./myread
12083         dlext="$ans"
12084         ;;
12085 *)
12086         dlext="none"
12087         ;;
12088 esac
12089
12090 : Check if dlsym need a leading underscore
12091 echo " "
12092 val="$undef"
12093
12094 case "$dlsrc" in
12095 dl_dlopen.xs)
12096         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12097         $cat >dyna.c <<'EOM'
12098 fred () { }
12099 EOM
12100
12101 $cat >fred.c<<EOM
12102
12103 #include <stdio.h>
12104 #$i_stdlib I_STDLIB
12105 #ifdef I_STDLIB
12106 #include <stdlib.h>
12107 #endif
12108 #$i_dlfcn I_DLFCN
12109 #ifdef I_DLFCN
12110 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12111 #else
12112 #include <sys/types.h>
12113 #include <nlist.h>
12114 #include <link.h>
12115 #endif
12116
12117 extern int fred() ;
12118
12119 int main()
12120 {
12121     void * handle ;
12122     void * symbol ;
12123 #ifndef RTLD_LAZY
12124     int mode = 1 ;
12125 #else
12126     int mode = RTLD_LAZY ;
12127 #endif
12128     handle = dlopen("./dyna.$dlext", mode) ;
12129     if (handle == NULL) {
12130         printf ("1\n") ;
12131         fflush (stdout) ;
12132         exit(0);
12133     }
12134     symbol = dlsym(handle, "fred") ;
12135     if (symbol == NULL) {
12136         /* try putting a leading underscore */
12137         symbol = dlsym(handle, "_fred") ;
12138         if (symbol == NULL) {
12139             printf ("2\n") ;
12140             fflush (stdout) ;
12141             exit(0);
12142         }
12143         printf ("3\n") ;
12144     }
12145     else
12146         printf ("4\n") ;
12147     fflush (stdout) ;
12148     exit(0);
12149 }
12150 EOM
12151         : Call the object file tmp-dyna.o in case dlext=o.
12152         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12153                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12154                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12155                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12156                 xxx=`$run ./fred`
12157                 case $xxx in
12158                 1)      echo "Test program failed using dlopen." >&4
12159                         echo "Perhaps you should not use dynamic loading." >&4;;
12160                 2)      echo "Test program failed using dlsym." >&4
12161                         echo "Perhaps you should not use dynamic loading." >&4;;
12162                 3)      echo "dlsym needs a leading underscore" >&4
12163                         val="$define" ;;
12164                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12165                 esac
12166         else
12167                 echo "I can't compile and run the test program." >&4
12168                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12169         fi
12170         ;;
12171 esac
12172
12173 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12174
12175 set d_dlsymun
12176 eval $setvar
12177
12178 : see if drand48_r exists
12179 set drand48_r d_drand48_r
12180 eval $inlibc
12181 case "$d_drand48_r" in
12182 "$define")
12183         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12184         case "$d_drand48_r_proto:$usethreads" in
12185         ":define")      d_drand48_r_proto=define
12186                 set d_drand48_r_proto drand48_r $hdrs
12187                 eval $hasproto ;;
12188         *)      ;;
12189         esac
12190         case "$d_drand48_r_proto" in
12191         define)
12192         case "$drand48_r_proto" in
12193         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12194         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12195         esac
12196         case "$drand48_r_proto" in
12197         ''|0)   d_drand48_r=undef
12198                 drand48_r_proto=0
12199                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12200         * )     case "$drand48_r_proto" in
12201                 REENTRANT_PROTO*) ;;
12202                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12203                 esac
12204                 echo "Prototype: $try" ;;
12205         esac
12206         ;;
12207         *)      case "$usethreads" in
12208                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12209                 esac
12210                 d_drand48_r=undef
12211                 drand48_r_proto=0
12212                 ;;
12213         esac
12214         ;;
12215 *)      drand48_r_proto=0
12216         ;;
12217 esac
12218
12219 : see if prototype for drand48 is available
12220 echo " "
12221 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12222 eval $hasproto
12223
12224 : see if dup2 exists
12225 set dup2 d_dup2
12226 eval $inlibc
12227
12228 : see if eaccess exists
12229 set eaccess d_eaccess
12230 eval $inlibc
12231
12232 : see if endgrent exists
12233 set endgrent d_endgrent
12234 eval $inlibc
12235
12236 : see if this is an grp system
12237 set grp.h i_grp
12238 eval $inhdr
12239
12240 case "$i_grp" in
12241 $define)
12242         xxx=`./findhdr grp.h`
12243         $cppstdin $cppflags $cppminus < $xxx >$$.h
12244
12245         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12246                 val="$define"
12247         else
12248                 val="$undef"
12249         fi
12250         set d_grpasswd
12251         eval $setvar
12252
12253         $rm -f $$.h
12254         ;;
12255 *)
12256         val="$undef";
12257         set d_grpasswd; eval $setvar
12258         ;;
12259 esac
12260
12261 : see if endgrent_r exists
12262 set endgrent_r d_endgrent_r
12263 eval $inlibc
12264 case "$d_endgrent_r" in
12265 "$define")
12266         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12267         case "$d_endgrent_r_proto:$usethreads" in
12268         ":define")      d_endgrent_r_proto=define
12269                 set d_endgrent_r_proto endgrent_r $hdrs
12270                 eval $hasproto ;;
12271         *)      ;;
12272         esac
12273         case "$d_endgrent_r_proto" in
12274         define)
12275         case "$endgrent_r_proto" in
12276         ''|0) try='int endgrent_r(FILE**);'
12277         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12278         esac
12279         case "$endgrent_r_proto" in
12280         ''|0) try='void endgrent_r(FILE**);'
12281         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12282         esac
12283         case "$endgrent_r_proto" in
12284         ''|0)   d_endgrent_r=undef
12285                 endgrent_r_proto=0
12286                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12287         * )     case "$endgrent_r_proto" in
12288                 REENTRANT_PROTO*) ;;
12289                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12290                 esac
12291                 echo "Prototype: $try" ;;
12292         esac
12293         ;;
12294         *)      case "$usethreads" in
12295                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12296                 esac
12297                 d_endgrent_r=undef
12298                 endgrent_r_proto=0
12299                 ;;
12300         esac
12301         ;;
12302 *)      endgrent_r_proto=0
12303         ;;
12304 esac
12305
12306 : see if endhostent exists
12307 set endhostent d_endhent
12308 eval $inlibc
12309
12310 : see if this is a netdb.h system
12311 set netdb.h i_netdb
12312 eval $inhdr
12313
12314 : see if endhostent_r exists
12315 set endhostent_r d_endhostent_r
12316 eval $inlibc
12317 case "$d_endhostent_r" in
12318 "$define")
12319         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12320         case "$d_endhostent_r_proto:$usethreads" in
12321         ":define")      d_endhostent_r_proto=define
12322                 set d_endhostent_r_proto endhostent_r $hdrs
12323                 eval $hasproto ;;
12324         *)      ;;
12325         esac
12326         case "$d_endhostent_r_proto" in
12327         define)
12328         case "$endhostent_r_proto" in
12329         ''|0) try='int endhostent_r(struct hostent_data*);'
12330         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12331         esac
12332         case "$endhostent_r_proto" in
12333         ''|0) try='void endhostent_r(struct hostent_data*);'
12334         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12335         esac
12336         case "$endhostent_r_proto" in
12337         ''|0)   d_endhostent_r=undef
12338                 endhostent_r_proto=0
12339                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12340         * )     case "$endhostent_r_proto" in
12341                 REENTRANT_PROTO*) ;;
12342                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12343                 esac
12344                 echo "Prototype: $try" ;;
12345         esac
12346         ;;
12347         *)      case "$usethreads" in
12348                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12349                 esac
12350                 d_endhostent_r=undef
12351                 endhostent_r_proto=0
12352                 ;;
12353         esac
12354         ;;
12355 *)      endhostent_r_proto=0
12356         ;;
12357 esac
12358
12359 : see if endnetent exists
12360 set endnetent d_endnent
12361 eval $inlibc
12362
12363 : see if endnetent_r exists
12364 set endnetent_r d_endnetent_r
12365 eval $inlibc
12366 case "$d_endnetent_r" in
12367 "$define")
12368         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12369         case "$d_endnetent_r_proto:$usethreads" in
12370         ":define")      d_endnetent_r_proto=define
12371                 set d_endnetent_r_proto endnetent_r $hdrs
12372                 eval $hasproto ;;
12373         *)      ;;
12374         esac
12375         case "$d_endnetent_r_proto" in
12376         define)
12377         case "$endnetent_r_proto" in
12378         ''|0) try='int endnetent_r(struct netent_data*);'
12379         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12380         esac
12381         case "$endnetent_r_proto" in
12382         ''|0) try='void endnetent_r(struct netent_data*);'
12383         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12384         esac
12385         case "$endnetent_r_proto" in
12386         ''|0)   d_endnetent_r=undef
12387                 endnetent_r_proto=0
12388                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12389         * )     case "$endnetent_r_proto" in
12390                 REENTRANT_PROTO*) ;;
12391                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12392                 esac
12393                 echo "Prototype: $try" ;;
12394         esac
12395         ;;
12396         *)      case "$usethreads" in
12397                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12398                 esac
12399                 d_endnetent_r=undef
12400                 endnetent_r_proto=0
12401                 ;;
12402         esac
12403         ;;
12404 *)      endnetent_r_proto=0
12405         ;;
12406 esac
12407
12408 : see if endprotoent exists
12409 set endprotoent d_endpent
12410 eval $inlibc
12411
12412 : see if endprotoent_r exists
12413 set endprotoent_r d_endprotoent_r
12414 eval $inlibc
12415 case "$d_endprotoent_r" in
12416 "$define")
12417         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12418         case "$d_endprotoent_r_proto:$usethreads" in
12419         ":define")      d_endprotoent_r_proto=define
12420                 set d_endprotoent_r_proto endprotoent_r $hdrs
12421                 eval $hasproto ;;
12422         *)      ;;
12423         esac
12424         case "$d_endprotoent_r_proto" in
12425         define)
12426         case "$endprotoent_r_proto" in
12427         ''|0) try='int endprotoent_r(struct protoent_data*);'
12428         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12429         esac
12430         case "$endprotoent_r_proto" in
12431         ''|0) try='void endprotoent_r(struct protoent_data*);'
12432         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12433         esac
12434         case "$endprotoent_r_proto" in
12435         ''|0)   d_endprotoent_r=undef
12436                 endprotoent_r_proto=0
12437                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12438         * )     case "$endprotoent_r_proto" in
12439                 REENTRANT_PROTO*) ;;
12440                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12441                 esac
12442                 echo "Prototype: $try" ;;
12443         esac
12444         ;;
12445         *)      case "$usethreads" in
12446                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12447                 esac
12448                 d_endprotoent_r=undef
12449                 endprotoent_r_proto=0
12450                 ;;
12451         esac
12452         ;;
12453 *)      endprotoent_r_proto=0
12454         ;;
12455 esac
12456
12457 : see if endpwent exists
12458 set endpwent d_endpwent
12459 eval $inlibc
12460
12461 : see if this is a pwd.h system
12462 set pwd.h i_pwd
12463 eval $inhdr
12464
12465 case "$i_pwd" in
12466 $define)
12467         xxx=`./findhdr pwd.h`
12468         $cppstdin $cppflags $cppminus < $xxx >$$.h
12469
12470         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12471                 val="$define"
12472         else
12473                 val="$undef"
12474         fi
12475         set d_pwquota
12476         eval $setvar
12477
12478         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12479                 val="$define"
12480         else
12481                 val="$undef"
12482         fi
12483         set d_pwage
12484         eval $setvar
12485
12486         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12487                 val="$define"
12488         else
12489                 val="$undef"
12490         fi
12491         set d_pwchange
12492         eval $setvar
12493
12494         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12495                 val="$define"
12496         else
12497                 val="$undef"
12498         fi
12499         set d_pwclass
12500         eval $setvar
12501
12502         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12503                 val="$define"
12504         else
12505                 val="$undef"
12506         fi
12507         set d_pwexpire
12508         eval $setvar
12509
12510         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12511                 val="$define"
12512         else
12513                 val="$undef"
12514         fi
12515         set d_pwcomment
12516         eval $setvar
12517
12518         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12519                 val="$define"
12520         else
12521                 val="$undef"
12522         fi
12523         set d_pwgecos
12524         eval $setvar
12525
12526         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12527                 val="$define"
12528         else
12529                 val="$undef"
12530         fi
12531         set d_pwpasswd
12532         eval $setvar
12533
12534         $rm -f $$.h
12535         ;;
12536 *)
12537         val="$undef";
12538         set d_pwquota; eval $setvar
12539         set d_pwage; eval $setvar
12540         set d_pwchange; eval $setvar
12541         set d_pwclass; eval $setvar
12542         set d_pwexpire; eval $setvar
12543         set d_pwcomment; eval $setvar
12544         set d_pwgecos; eval $setvar
12545         set d_pwpasswd; eval $setvar
12546         ;;
12547 esac
12548
12549 : see if endpwent_r exists
12550 set endpwent_r d_endpwent_r
12551 eval $inlibc
12552 case "$d_endpwent_r" in
12553 "$define")
12554         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12555         case "$d_endpwent_r_proto:$usethreads" in
12556         ":define")      d_endpwent_r_proto=define
12557                 set d_endpwent_r_proto endpwent_r $hdrs
12558                 eval $hasproto ;;
12559         *)      ;;
12560         esac
12561         case "$d_endpwent_r_proto" in
12562         define)
12563         case "$endpwent_r_proto" in
12564         ''|0) try='int endpwent_r(FILE**);'
12565         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12566         esac
12567         case "$endpwent_r_proto" in
12568         ''|0) try='void endpwent_r(FILE**);'
12569         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12570         esac
12571         case "$endpwent_r_proto" in
12572         ''|0)   d_endpwent_r=undef
12573                 endpwent_r_proto=0
12574                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12575         * )     case "$endpwent_r_proto" in
12576                 REENTRANT_PROTO*) ;;
12577                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12578                 esac
12579                 echo "Prototype: $try" ;;
12580         esac
12581         ;;
12582         *)      case "$usethreads" in
12583                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12584                 esac
12585                 d_endpwent_r=undef
12586                 endpwent_r_proto=0
12587                 ;;
12588         esac
12589         ;;
12590 *)      endpwent_r_proto=0
12591         ;;
12592 esac
12593
12594 : see if endservent exists
12595 set endservent d_endsent
12596 eval $inlibc
12597
12598 : see if endservent_r exists
12599 set endservent_r d_endservent_r
12600 eval $inlibc
12601 case "$d_endservent_r" in
12602 "$define")
12603         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12604         case "$d_endservent_r_proto:$usethreads" in
12605         ":define")      d_endservent_r_proto=define
12606                 set d_endservent_r_proto endservent_r $hdrs
12607                 eval $hasproto ;;
12608         *)      ;;
12609         esac
12610         case "$d_endservent_r_proto" in
12611         define)
12612         case "$endservent_r_proto" in
12613         ''|0) try='int endservent_r(struct servent_data*);'
12614         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12615         esac
12616         case "$endservent_r_proto" in
12617         ''|0) try='void endservent_r(struct servent_data*);'
12618         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12619         esac
12620         case "$endservent_r_proto" in
12621         ''|0)   d_endservent_r=undef
12622                 endservent_r_proto=0
12623                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12624         * )     case "$endservent_r_proto" in
12625                 REENTRANT_PROTO*) ;;
12626                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12627                 esac
12628                 echo "Prototype: $try" ;;
12629         esac
12630         ;;
12631         *)      case "$usethreads" in
12632                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12633                 esac
12634                 d_endservent_r=undef
12635                 endservent_r_proto=0
12636                 ;;
12637         esac
12638         ;;
12639 *)      endservent_r_proto=0
12640         ;;
12641 esac
12642
12643 : Locate the flags for 'open()'
12644 echo " "
12645 $cat >try.c <<EOCP
12646 #include <sys/types.h>
12647 #ifdef I_FCNTL
12648 #include <fcntl.h>
12649 #endif
12650 #ifdef I_SYS_FILE
12651 #include <sys/file.h>
12652 #endif
12653 #$i_stdlib I_STDLIB
12654 #ifdef I_STDLIB
12655 #include <stdlib.h>
12656 #endif
12657 int main() {
12658         if(O_RDONLY);
12659 #ifdef O_TRUNC
12660         exit(0);
12661 #else
12662         exit(1);
12663 #endif
12664 }
12665 EOCP
12666 : check sys/file.h first to get FREAD on Sun
12667 if $test `./findhdr sys/file.h` && \
12668                 set try -DI_SYS_FILE && eval $compile; then
12669         h_sysfile=true;
12670         echo "<sys/file.h> defines the O_* constants..." >&4
12671         if $run ./try; then
12672                 echo "and you have the 3 argument form of open()." >&4
12673                 val="$define"
12674         else
12675                 echo "but not the 3 argument form of open().  Oh, well." >&4
12676                 val="$undef"
12677         fi
12678 elif $test `./findhdr fcntl.h` && \
12679                 set try -DI_FCNTL && eval $compile; then
12680         h_fcntl=true;
12681         echo "<fcntl.h> defines the O_* constants..." >&4
12682         if $run ./try; then
12683                 echo "and you have the 3 argument form of open()." >&4
12684                 val="$define"
12685         else
12686                 echo "but not the 3 argument form of open().  Oh, well." >&4
12687                 val="$undef"
12688         fi
12689 else
12690         val="$undef"
12691         echo "I can't find the O_* constant definitions!  You got problems." >&4
12692 fi
12693 set d_open3
12694 eval $setvar
12695 $rm_try
12696
12697 : see if this is a sys/file.h system
12698 val=''
12699 set sys/file.h val
12700 eval $inhdr
12701
12702 : do we need to include sys/file.h ?
12703 case "$val" in
12704 "$define")
12705         echo " "
12706         if $h_sysfile; then
12707                 val="$define"
12708                 echo "We'll be including <sys/file.h>." >&4
12709         else
12710                 val="$undef"
12711                 echo "We won't be including <sys/file.h>." >&4
12712         fi
12713         ;;
12714 *)
12715         h_sysfile=false
12716         ;;
12717 esac
12718 set i_sysfile
12719 eval $setvar
12720
12721 : see if fcntl.h is there
12722 val=''
12723 set fcntl.h val
12724 eval $inhdr
12725
12726 : see if we can include fcntl.h
12727 case "$val" in
12728 "$define")
12729         echo " "
12730         if $h_fcntl; then
12731                 val="$define"
12732                 echo "We'll be including <fcntl.h>." >&4
12733         else
12734                 val="$undef"
12735                 if $h_sysfile; then
12736         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12737                 else
12738                         echo "We won't be including <fcntl.h>." >&4
12739                 fi
12740         fi
12741         ;;
12742 *)
12743         h_fcntl=false
12744         val="$undef"
12745         ;;
12746 esac
12747 set i_fcntl
12748 eval $setvar
12749
12750 : see if fork exists
12751 set fork d_fork
12752 eval $inlibc
12753
12754 : see if pipe exists
12755 set pipe d_pipe
12756 eval $inlibc
12757
12758 : check for non-blocking I/O stuff
12759 case "$h_sysfile" in
12760 true) echo "#include <sys/file.h>" > head.c;;
12761 *)
12762        case "$h_fcntl" in
12763        true) echo "#include <fcntl.h>" > head.c;;
12764        *) echo "#include <sys/fcntl.h>" > head.c;;
12765        esac
12766        ;;
12767 esac
12768 echo " "
12769 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12770 case "$o_nonblock" in
12771 '')
12772         $cat head.c > try.c
12773         $cat >>try.c <<EOCP
12774 #include <stdio.h>
12775 #$i_stdlib I_STDLIB
12776 #ifdef I_STDLIB
12777 #include <stdlib.h>
12778 #endif
12779 #$i_fcntl I_FCNTL
12780 #ifdef I_FCNTL
12781 #include <fcntl.h>
12782 #endif
12783 int main() {
12784 #ifdef O_NONBLOCK
12785         printf("O_NONBLOCK\n");
12786         exit(0);
12787 #endif
12788 #ifdef O_NDELAY
12789         printf("O_NDELAY\n");
12790         exit(0);
12791 #endif
12792 #ifdef FNDELAY
12793         printf("FNDELAY\n");
12794         exit(0);
12795 #endif
12796         exit(0);
12797 }
12798 EOCP
12799         set try
12800         if eval $compile_ok; then
12801                 o_nonblock=`$run ./try`
12802                 case "$o_nonblock" in
12803                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12804                 *) echo "Seems like we can use $o_nonblock.";;
12805                 esac
12806         else
12807                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12808         fi
12809         ;;
12810 *) echo "Using $hint value $o_nonblock.";;
12811 esac
12812 $rm_try
12813
12814 echo " "
12815 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12816 case "$eagain" in
12817 '')
12818         case "$d_fork:$d_pipe" in
12819         define:define)
12820         $cat head.c > try.c
12821         $cat >>try.c <<EOCP
12822 #include <errno.h>
12823 #include <sys/types.h>
12824 #include <signal.h>
12825 #include <stdio.h>
12826 #$i_stdlib I_STDLIB
12827 #ifdef I_STDLIB
12828 #include <stdlib.h>
12829 #endif
12830 #$i_fcntl I_FCNTL
12831 #ifdef I_FCNTL
12832 #include <fcntl.h>
12833 #endif
12834 #define MY_O_NONBLOCK $o_nonblock
12835 #ifndef errno  /* XXX need better Configure test */
12836 extern int errno;
12837 #endif
12838 #$i_unistd I_UNISTD
12839 #ifdef I_UNISTD
12840 #include <unistd.h>
12841 #endif
12842 #$i_string I_STRING
12843 #ifdef I_STRING
12844 #include <string.h>
12845 #else
12846 #include <strings.h>
12847 #endif
12848 $signal_t blech(int x) { exit(3); }
12849 EOCP
12850         $cat >> try.c <<'EOCP'
12851 int main()
12852 {
12853         int pd[2];
12854         int pu[2];
12855         char buf[1];
12856         char string[100];
12857
12858         pipe(pd);       /* Down: child -> parent */
12859         pipe(pu);       /* Up: parent -> child */
12860         if (0 != fork()) {
12861                 int ret;
12862                 close(pd[1]);   /* Parent reads from pd[0] */
12863                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12864 #ifdef F_SETFL
12865                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12866                         exit(1);
12867 #else
12868                 exit(4);
12869 #endif
12870                 signal(SIGALRM, blech);
12871                 alarm(5);
12872                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12873                         exit(2);
12874                 sprintf(string, "%d\n", ret);
12875                 write(2, string, strlen(string));
12876                 alarm(0);
12877 #ifdef EAGAIN
12878                 if (errno == EAGAIN) {
12879                         printf("EAGAIN\n");
12880                         goto ok;
12881                 }
12882 #endif
12883 #ifdef EWOULDBLOCK
12884                 if (errno == EWOULDBLOCK)
12885                         printf("EWOULDBLOCK\n");
12886 #endif
12887         ok:
12888                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12889                 sleep(2);                               /* Give it time to close our pipe */
12890                 alarm(5);
12891                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12892                 alarm(0);
12893                 sprintf(string, "%d\n", ret);
12894                 write(4, string, strlen(string));
12895                 exit(0);
12896         }
12897
12898         close(pd[0]);                   /* We write to pd[1] */
12899         close(pu[1]);                   /* We read from pu[0] */
12900         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12901         close(pd[1]);                   /* Pipe pd is now fully closed! */
12902         exit(0);                                /* Bye bye, thank you for playing! */
12903 }
12904 EOCP
12905         set try
12906         if eval $compile_ok; then
12907                 echo "$startsh" >mtry
12908                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12909                 chmod +x mtry
12910                 ./mtry >/dev/null 2>&1
12911                 case $? in
12912                 0) eagain=`$cat try.out`;;
12913                 1) echo "Could not perform non-blocking setting!";;
12914                 2) echo "I did a successful read() for something that was not there!";;
12915                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12916                 4) echo "Could not find F_SETFL!";;
12917                 *) echo "Something terribly wrong happened during testing.";;
12918                 esac
12919                 rd_nodata=`$cat try.ret`
12920                 echo "A read() system call with no data present returns $rd_nodata."
12921                 case "$rd_nodata" in
12922                 0|-1) ;;
12923                 *)
12924                         echo "(That's peculiar, fixing that to be -1.)"
12925                         rd_nodata=-1
12926                         ;;
12927                 esac
12928                 case "$eagain" in
12929                 '')
12930                         echo "Forcing errno EAGAIN on read() with no data available."
12931                         eagain=EAGAIN
12932                         ;;
12933                 *)
12934                         echo "Your read() sets errno to $eagain when no data is available."
12935                         ;;
12936                 esac
12937                 status=`$cat try.err`
12938                 case "$status" in
12939                 0) echo "And it correctly returns 0 to signal EOF.";;
12940                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12941                 *) echo "However, your read() returns '$status' on EOF??";;
12942                 esac
12943                 val="$define"
12944                 if test "$status" = "$rd_nodata"; then
12945                         echo "WARNING: you can't distinguish between EOF and no data!"
12946                         val="$undef"
12947                 fi
12948         else
12949                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12950                 eagain=EAGAIN
12951         fi
12952         ;;
12953         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12954                 eagain=EAGAIN
12955                 val="$define"
12956                 ;;
12957         esac
12958         set d_eofnblk
12959         eval $setvar
12960         ;;
12961 *)
12962         echo "Using $hint value $eagain."
12963         echo "Your read() returns $rd_nodata when no data is present."
12964         case "$d_eofnblk" in
12965         "$define") echo "And you can see EOF because read() returns 0.";;
12966         "$undef") echo "But you can't see EOF status from read() returned value.";;
12967         *)
12968                 echo "(Assuming you can't see EOF status from read anyway.)"
12969                 d_eofnblk=$undef
12970                 ;;
12971         esac
12972         ;;
12973 esac
12974 $rm_try head.c mtry
12975
12976 : see if _ptr and _cnt from stdio act std
12977 echo " "
12978
12979 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12980         echo "(Looks like you have stdio.h from BSD.)"
12981         case "$stdio_ptr" in
12982         '') stdio_ptr='((fp)->_p)'
12983                 ptr_lval=$define
12984                 ;;
12985         *)      ptr_lval=$d_stdio_ptr_lval;;
12986         esac
12987         case "$stdio_cnt" in
12988         '') stdio_cnt='((fp)->_r)'
12989                 cnt_lval=$define
12990                 ;;
12991         *)      cnt_lval=$d_stdio_cnt_lval;;
12992         esac
12993         case "$stdio_base" in
12994         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12995         esac
12996         case "$stdio_bufsiz" in
12997         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12998         esac
12999 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13000         echo "(Looks like you have stdio.h from Linux.)"
13001         case "$stdio_ptr" in
13002         '') stdio_ptr='((fp)->_IO_read_ptr)'
13003                 ptr_lval=$define
13004                 ;;
13005         *)      ptr_lval=$d_stdio_ptr_lval;;
13006         esac
13007         case "$stdio_cnt" in
13008         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13009                 cnt_lval=$undef
13010                 ;;
13011         *)      cnt_lval=$d_stdio_cnt_lval;;
13012         esac
13013         case "$stdio_base" in
13014         '') stdio_base='((fp)->_IO_read_base)';;
13015         esac
13016         case "$stdio_bufsiz" in
13017         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13018         esac
13019 else
13020         case "$stdio_ptr" in
13021         '') stdio_ptr='((fp)->_ptr)'
13022                 ptr_lval=$define
13023                 ;;
13024         *)      ptr_lval=$d_stdio_ptr_lval;;
13025         esac
13026         case "$stdio_cnt" in
13027         '') stdio_cnt='((fp)->_cnt)'
13028                 cnt_lval=$define
13029                 ;;
13030         *)      cnt_lval=$d_stdio_cnt_lval;;
13031         esac
13032         case "$stdio_base" in
13033         '') stdio_base='((fp)->_base)';;
13034         esac
13035         case "$stdio_bufsiz" in
13036         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13037         esac
13038 fi
13039
13040 : test whether _ptr and _cnt really work
13041 echo "Checking how std your stdio is..." >&4
13042 $cat >try.c <<EOP
13043 #include <stdio.h>
13044 #$i_stdlib I_STDLIB
13045 #ifdef I_STDLIB
13046 #include <stdlib.h>
13047 #endif
13048 #define FILE_ptr(fp)    $stdio_ptr
13049 #define FILE_cnt(fp)    $stdio_cnt
13050 int main() {
13051         FILE *fp = fopen("try.c", "r");
13052         char c = getc(fp);
13053         if (
13054                 18 <= FILE_cnt(fp) &&
13055                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13056         )
13057                 exit(0);
13058         exit(1);
13059 }
13060 EOP
13061 val="$undef"
13062 set try
13063 if eval $compile && $to try.c; then
13064         if $run ./try; then
13065                 echo "Your stdio acts pretty std."
13066                 val="$define"
13067         else
13068                 echo "Your stdio isn't very std."
13069         fi
13070 else
13071         echo "Your stdio doesn't appear very std."
13072 fi
13073 $rm_try
13074
13075 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13076 # direct buffer manipulation no longer works.  The Configure tests
13077 # should be changed to correctly detect this, but until then,
13078 # the following check should at least let perl compile and run.
13079 # (This quick fix should be updated before 5.8.1.)
13080 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13081 # A. Dougherty, June 3, 2002.
13082 case "$d_gnulibc" in
13083 $define)
13084         case "$gnulibc_version" in
13085         2.[01]*)  ;;
13086         2.2) ;;
13087         2.2.[0-9]) ;;
13088         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13089                 val="$undef"
13090                 ;;
13091         esac
13092         ;;
13093 esac
13094 set d_stdstdio
13095 eval $setvar
13096
13097 : Can _ptr be used as an lvalue?
13098 case "$d_stdstdio$ptr_lval" in
13099 $define$define) val=$define ;;
13100 *) val=$undef ;;
13101 esac
13102 set d_stdio_ptr_lval
13103 eval $setvar
13104
13105 : Can _cnt be used as an lvalue?
13106 case "$d_stdstdio$cnt_lval" in
13107 $define$define) val=$define ;;
13108 *) val=$undef ;;
13109 esac
13110 set d_stdio_cnt_lval
13111 eval $setvar
13112
13113
13114 : test whether setting _ptr sets _cnt as a side effect
13115 d_stdio_ptr_lval_sets_cnt="$undef"
13116 d_stdio_ptr_lval_nochange_cnt="$undef"
13117 case "$d_stdio_ptr_lval$d_stdstdio" in
13118 $define$define)
13119         echo "Checking to see what happens if we set the stdio ptr..." >&4
13120 $cat >try.c <<EOP
13121 #include <stdio.h>
13122 /* Can we scream? */
13123 /* Eat dust sed :-) */
13124 /* In the buffer space, no one can hear you scream. */
13125 #$i_stdlib I_STDLIB
13126 #ifdef I_STDLIB
13127 #include <stdlib.h>
13128 #endif
13129 #define FILE_ptr(fp)    $stdio_ptr
13130 #define FILE_cnt(fp)    $stdio_cnt
13131 #include <sys/types.h>
13132 int main() {
13133         FILE *fp = fopen("try.c", "r");
13134         int c;
13135         char *ptr;
13136         size_t cnt;
13137         if (!fp) {
13138             puts("Fail even to read");
13139             exit(1);
13140         }
13141         c = getc(fp); /* Read away the first # */
13142         if (c == EOF) {
13143             puts("Fail even to read");
13144             exit(1);
13145         }
13146         if (!(
13147                 18 <= FILE_cnt(fp) &&
13148                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13149         )) {
13150                 puts("Fail even to read");
13151                 exit (1);
13152         }
13153         ptr = (char*) FILE_ptr(fp);
13154         cnt = (size_t)FILE_cnt(fp);
13155
13156         FILE_ptr(fp) += 42;
13157
13158         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13159                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13160                 exit (1);
13161         }
13162         if (FILE_cnt(fp) <= 20) {
13163                 printf ("Fail (<20 chars to test)");
13164                 exit (1);
13165         }
13166         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13167                 puts("Fail compare");
13168                 exit (1);
13169         }
13170         if (cnt == FILE_cnt(fp)) {
13171                 puts("Pass_unchanged");
13172                 exit (0);
13173         }
13174         if (FILE_cnt(fp) == (cnt - 42)) {
13175                 puts("Pass_changed");
13176                 exit (0);
13177         }
13178         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13179         return 1;
13180
13181 }
13182 EOP
13183         set try
13184         if eval $compile && $to try.c; then
13185                 case `$run ./try` in
13186                 Pass_changed)
13187                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13188                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13189                 Pass_unchanged)
13190                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13191                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13192                 Fail*)
13193                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13194                 *)
13195                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13196         esac
13197         else
13198                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13199         fi
13200         $rm_try
13201         ;;
13202 esac
13203
13204 : see if _base is also standard
13205 val="$undef"
13206 case "$d_stdstdio" in
13207 $define)
13208         $cat >try.c <<EOP
13209 #include <stdio.h>
13210 #$i_stdlib I_STDLIB
13211 #ifdef I_STDLIB
13212 #include <stdlib.h>
13213 #endif
13214 #define FILE_base(fp)   $stdio_base
13215 #define FILE_bufsiz(fp) $stdio_bufsiz
13216 int main() {
13217         FILE *fp = fopen("try.c", "r");
13218         char c = getc(fp);
13219         if (
13220                 19 <= FILE_bufsiz(fp) &&
13221                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13222         )
13223                 exit(0);
13224         exit(1);
13225 }
13226 EOP
13227         set try
13228         if eval $compile && $to try.c; then
13229                 if $run ./try; then
13230                         echo "And its _base field acts std."
13231                         val="$define"
13232                 else
13233                         echo "But its _base field isn't std."
13234                 fi
13235         else
13236                 echo "However, it seems to be lacking the _base field."
13237         fi
13238         $rm_try
13239         ;;
13240 esac
13241 set d_stdiobase
13242 eval $setvar
13243
13244 : see if fast_stdio exists
13245 val="$undef"
13246 case "$d_stdstdio:$d_stdio_ptr_lval" in
13247 "$define:$define")
13248         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13249         *$define*)
13250                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13251                 val="$define"
13252                 ;;
13253         esac
13254         ;;
13255 esac
13256 set d_faststdio
13257 eval $setvar
13258
13259
13260
13261 : see if fchdir exists
13262 set fchdir d_fchdir
13263 eval $inlibc
13264
13265 : see if fchmod exists
13266 set fchmod d_fchmod
13267 eval $inlibc
13268
13269 : see if fchown exists
13270 set fchown d_fchown
13271 eval $inlibc
13272
13273 : see if this is an fcntl system
13274 set fcntl d_fcntl
13275 eval $inlibc
13276
13277 : See if fcntl-based locking works.
13278 echo " "
13279 $cat >try.c <<EOCP
13280 #$i_stdlib I_STDLIB
13281 #ifdef I_STDLIB
13282 #include <stdlib.h>
13283 #endif
13284 #include <unistd.h>
13285 #include <fcntl.h>
13286 #include <signal.h>
13287 $signal_t blech(int x) { exit(3); }
13288 int main() {
13289 #if defined(F_SETLK) && defined(F_SETLKW)
13290      struct flock flock;
13291      int retval, fd;
13292      fd = open("try.c", O_RDONLY);
13293      flock.l_type = F_RDLCK;
13294      flock.l_whence = SEEK_SET;
13295      flock.l_start = flock.l_len = 0;
13296      signal(SIGALRM, blech);
13297      alarm(10);
13298      retval = fcntl(fd, F_SETLK, &flock);
13299      close(fd);
13300      (retval < 0 ? exit(2) : exit(0));
13301 #else
13302      exit(2);
13303 #endif
13304 }
13305 EOCP
13306 echo "Checking if fcntl-based file locking works... "
13307 case "$d_fcntl" in
13308 "$define")
13309         set try
13310         if eval $compile_ok; then
13311                 if $run ./try; then
13312                         echo "Yes, it seems to work."
13313                         val="$define"
13314                 else
13315                         echo "Nope, it didn't work."
13316                         val="$undef"
13317                         case "$?" in
13318                         3) $cat >&4 <<EOM
13319 ***
13320 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13321 *** This is (almost) impossible.
13322 *** If your NFS lock daemons are not feeling well, something like
13323 *** this may happen, please investigate.  Cannot continue, aborting.
13324 ***
13325 EOM
13326                                 exit 1
13327                                 ;;
13328                         esac
13329                 fi
13330         else
13331                 echo "I'm unable to compile the test program, so I'll assume not."
13332                 val="$undef"
13333         fi
13334         ;;
13335 *) val="$undef";
13336         echo "Nope, since you don't even have fcntl()."
13337         ;;
13338 esac
13339 set d_fcntl_can_lock
13340 eval $setvar
13341 $rm_try
13342
13343 : check for fd_set items
13344 $cat <<EOM
13345
13346 Checking to see how well your C compiler handles fd_set and friends ...
13347 EOM
13348 $cat >try.c <<EOCP
13349 #$i_stdlib I_STDLIB
13350 #ifdef I_STDLIB
13351 #include <stdlib.h>
13352 #endif
13353 #$i_systime I_SYS_TIME
13354 #$i_sysselct I_SYS_SELECT
13355 #$d_socket HAS_SOCKET
13356 #include <sys/types.h>
13357 #ifdef HAS_SOCKET
13358 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13359 #endif
13360 #ifdef I_SYS_TIME
13361 #include <sys/time.h>
13362 #endif
13363 #ifdef I_SYS_SELECT
13364 #include <sys/select.h>
13365 #endif
13366 int main() {
13367         fd_set fds;
13368
13369 #ifdef TRYBITS
13370         if(fds.fds_bits);
13371 #endif
13372
13373 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13374         exit(0);
13375 #else
13376         exit(1);
13377 #endif
13378 }
13379 EOCP
13380 set try -DTRYBITS
13381 if eval $compile; then
13382         d_fds_bits="$define"
13383         d_fd_set="$define"
13384         echo "Well, your system knows about the normal fd_set typedef..." >&4
13385         if $run ./try; then
13386                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13387                 d_fd_macros="$define"
13388         else
13389                 $cat >&4 <<'EOM'
13390 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13391 EOM
13392                 d_fd_macros="$undef"
13393         fi
13394 else
13395         $cat <<'EOM'
13396 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13397 EOM
13398         set try
13399         if eval $compile; then
13400                 d_fds_bits="$undef"
13401                 d_fd_set="$define"
13402                 echo "Well, your system has some sort of fd_set available..." >&4
13403                 if $run ./try; then
13404                         echo "and you have the normal fd_set macros." >&4
13405                         d_fd_macros="$define"
13406                 else
13407                         $cat <<'EOM'
13408 but not the normal fd_set macros!  Gross!  More work for me...
13409 EOM
13410                         d_fd_macros="$undef"
13411                 fi
13412         else
13413         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13414                 d_fd_set="$undef"
13415                 d_fds_bits="$undef"
13416                 d_fd_macros="$undef"
13417         fi
13418 fi
13419 $rm_try
13420
13421 : see if fgetpos exists
13422 set fgetpos d_fgetpos
13423 eval $inlibc
13424
13425 : see if finite exists
13426 set finite d_finite
13427 eval $inlibc
13428
13429 : see if finitel exists
13430 set finitel d_finitel
13431 eval $inlibc
13432
13433 : see if flock exists
13434 set flock d_flock
13435 eval $inlibc
13436
13437 : see if prototype for flock is available
13438 echo " "
13439 set d_flockproto flock $i_sysfile sys/file.h
13440 eval $hasproto
13441
13442 : see if fp_class exists
13443 set fp_class d_fp_class
13444 eval $inlibc
13445
13446 : see if pathconf exists
13447 set pathconf d_pathconf
13448 eval $inlibc
13449
13450 : see if fpathconf exists
13451 set fpathconf d_fpathconf
13452 eval $inlibc
13453
13454 : see if fpclass exists
13455 set fpclass d_fpclass
13456 eval $inlibc
13457
13458 : see if fpclassify exists
13459 set fpclassify d_fpclassify
13460 eval $inlibc
13461
13462 : see if fpclassl exists
13463 set fpclassl d_fpclassl
13464 eval $inlibc
13465
13466 : check for fpos64_t
13467 echo " "
13468 echo "Checking to see if you have fpos64_t..." >&4
13469 $cat >try.c <<EOCP
13470 #include <stdio.h>
13471 int main() { fpos64_t x = 7; }
13472 EOCP
13473 set try
13474 if eval $compile; then
13475         val="$define"
13476         echo "You have fpos64_t."
13477 else
13478         val="$undef"
13479         echo "You do not have fpos64_t."
13480         case "$fpossize" in
13481         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13482         esac
13483 fi
13484 $rm_try
13485 set d_fpos64_t
13486 eval $setvar
13487
13488 : see if frexpl exists
13489 set frexpl d_frexpl
13490 eval $inlibc
13491
13492 : see if this is a sys/param system
13493 set sys/param.h i_sysparam
13494 eval $inhdr
13495
13496 : see if this is a sys/mount.h system
13497 set sys/mount.h i_sysmount
13498 eval $inhdr
13499
13500 : Check for fs_data_s
13501 echo " "
13502 echo "Checking to see if your system supports struct fs_data..." >&4
13503 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13504 eval $hasstruct
13505 case "$d_fs_data_s" in
13506 "$define")      echo "Yes, it does."   ;;
13507 *)              echo "No, it doesn't." ;;
13508 esac
13509
13510 : see if fseeko exists
13511 set fseeko d_fseeko
13512 eval $inlibc
13513 case "$longsize" in
13514 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13515 esac
13516
13517 : see if fsetpos exists
13518 set fsetpos d_fsetpos
13519 eval $inlibc
13520
13521 : see if fstatfs exists
13522 set fstatfs d_fstatfs
13523 eval $inlibc
13524
13525 : see if statvfs exists
13526 set statvfs d_statvfs
13527 eval $inlibc
13528
13529 : see if fstatvfs exists
13530 set fstatvfs d_fstatvfs
13531 eval $inlibc
13532
13533
13534 : see if fsync exists
13535 set fsync d_fsync
13536 eval $inlibc
13537
13538 : see if ftello exists
13539 set ftello d_ftello
13540 eval $inlibc
13541 case "$longsize" in
13542 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13543 esac
13544
13545 : check for a working futimes
13546 d_futimes="$undef"
13547 echo " "
13548 echo "Checking if you have a working futimes()" >&4
13549 $cat >try.c <<EOCP
13550 #include <stdio.h>
13551 #include <sys/time.h>
13552 #include <errno.h>
13553 #include <fcntl.h>
13554
13555 int main ()
13556 {
13557     int fd, rv;
13558     fd = open ("try.c", O_RDWR);
13559     if (-1 == fd) exit (1);
13560     rv = futimes (fd, NULL);
13561     exit (rv == -1 ? errno : 0);
13562 }
13563 EOCP
13564 set try
13565 if eval $compile; then
13566     `$run ./try`
13567     rc=$?
13568     case "$rc" in
13569         0)  echo "Yes, you have" >&4
13570             d_futimes="$define"
13571             ;;
13572         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13573             ;;
13574     esac
13575 else
13576     echo "No, it does not (probably harmless)" >&4
13577 fi
13578 $rm_try
13579
13580 : see if ndbm.h is available
13581 set ndbm.h i_ndbm
13582 eval $inhdr
13583 : Compatibility location for RedHat 7.1
13584 set gdbm/ndbm.h i_gdbmndbm
13585 eval $inhdr
13586 : Compatibility location for Debian 4.0
13587 set gdbm-ndbm.h i_gdbm_ndbm
13588 eval $inhdr
13589
13590 val="$undef"
13591 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13592         : see if dbm_open exists
13593         set dbm_open d_dbm_open
13594         eval $inlibc
13595         case "$d_dbm_open" in
13596         $undef)
13597                 i_ndbm="$undef"
13598                 i_gdbmndbm="$undef"
13599                 i_gdbm_ndbm="$undef"
13600                 echo "We won't be including <ndbm.h>"
13601                 val="$undef"
13602                 ;;
13603         *) val="$define"
13604            ;;
13605         esac
13606 fi
13607 set d_ndbm
13608 eval $setvar
13609
13610 ndbm_hdr_protochk='name=$1; hdr=$2;
13611 eval "ihdr=\$""i_$name";
13612 val="$undef";
13613 if $test "$ihdr" = "$define"; then
13614         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13615         case "$d_cplusplus" in
13616         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13617         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13618         esac;
13619         case "$val" in
13620         $define) $echo "Your <$hdr> seems to have prototypes";;
13621         *) $echo "Your <$hdr> does not seem to have prototypes";;
13622         esac;
13623 fi;
13624 set "d_${name}_h_uses_prototypes";
13625 eval $setvar'
13626
13627 set ndbm ndbm.h
13628 eval $ndbm_hdr_protochk
13629 set gdbmndbm gdbm/ndbm.h
13630 eval $ndbm_hdr_protochk
13631 set gdbm_ndbm gdbm-ndbm.h
13632 eval $ndbm_hdr_protochk
13633
13634 : see if getaddrinfo exists
13635 set getaddrinfo d_getaddrinfo
13636 eval $inlibc
13637
13638 : see if getcwd exists
13639 set getcwd d_getcwd
13640 eval $inlibc
13641
13642 : see if getespwnam exists
13643 set getespwnam d_getespwnam
13644 eval $inlibc
13645
13646 : see if getfsstat exists
13647 set getfsstat d_getfsstat
13648 eval $inlibc
13649
13650 : see if getgrent exists
13651 set getgrent d_getgrent
13652 eval $inlibc
13653
13654 : see if getgrent_r exists
13655 set getgrent_r d_getgrent_r
13656 eval $inlibc
13657 case "$d_getgrent_r" in
13658 "$define")
13659         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13660         case "$d_getgrent_r_proto:$usethreads" in
13661         ":define")      d_getgrent_r_proto=define
13662                 set d_getgrent_r_proto getgrent_r $hdrs
13663                 eval $hasproto ;;
13664         *)      ;;
13665         esac
13666         case "$d_getgrent_r_proto" in
13667         define)
13668         case "$getgrent_r_proto" in
13669         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13670         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13671         esac
13672         case "$getgrent_r_proto" in
13673         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13674         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13675         esac
13676         case "$getgrent_r_proto" in
13677         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13678         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13679         esac
13680         case "$getgrent_r_proto" in
13681         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13682         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13683         esac
13684         case "$getgrent_r_proto" in
13685         ''|0) try='int getgrent_r(struct group*, char*, int);'
13686         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13687         esac
13688         case "$getgrent_r_proto" in
13689         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13690         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13691         esac
13692         case "$getgrent_r_proto" in
13693         ''|0)   d_getgrent_r=undef
13694                 getgrent_r_proto=0
13695                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13696         * )     case "$getgrent_r_proto" in
13697                 REENTRANT_PROTO*) ;;
13698                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13699                 esac
13700                 echo "Prototype: $try" ;;
13701         esac
13702         ;;
13703         *)      case "$usethreads" in
13704                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13705                 esac
13706                 d_getgrent_r=undef
13707                 getgrent_r_proto=0
13708                 ;;
13709         esac
13710         ;;
13711 *)      getgrent_r_proto=0
13712         ;;
13713 esac
13714
13715 : see if getgrgid_r exists
13716 set getgrgid_r d_getgrgid_r
13717 eval $inlibc
13718 case "$d_getgrgid_r" in
13719 "$define")
13720         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13721         case "$d_getgrgid_r_proto:$usethreads" in
13722         ":define")      d_getgrgid_r_proto=define
13723                 set d_getgrgid_r_proto getgrgid_r $hdrs
13724                 eval $hasproto ;;
13725         *)      ;;
13726         esac
13727         case "$d_getgrgid_r_proto" in
13728         define)
13729         case "$getgrgid_r_proto" in
13730         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13731         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13732         esac
13733         case "$getgrgid_r_proto" in
13734         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13735         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13736         esac
13737         case "$getgrgid_r_proto" in
13738         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13739         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13740         esac
13741         case "$getgrgid_r_proto" in
13742         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13743         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13744         esac
13745         case "$getgrgid_r_proto" in
13746         ''|0)   d_getgrgid_r=undef
13747                 getgrgid_r_proto=0
13748                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13749         * )     case "$getgrgid_r_proto" in
13750                 REENTRANT_PROTO*) ;;
13751                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13752                 esac
13753                 echo "Prototype: $try" ;;
13754         esac
13755         ;;
13756         *)      case "$usethreads" in
13757                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13758                 esac
13759                 d_getgrgid_r=undef
13760                 getgrgid_r_proto=0
13761                 ;;
13762         esac
13763         ;;
13764 *)      getgrgid_r_proto=0
13765         ;;
13766 esac
13767
13768 : see if getgrnam_r exists
13769 set getgrnam_r d_getgrnam_r
13770 eval $inlibc
13771 case "$d_getgrnam_r" in
13772 "$define")
13773         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13774         case "$d_getgrnam_r_proto:$usethreads" in
13775         ":define")      d_getgrnam_r_proto=define
13776                 set d_getgrnam_r_proto getgrnam_r $hdrs
13777                 eval $hasproto ;;
13778         *)      ;;
13779         esac
13780         case "$d_getgrnam_r_proto" in
13781         define)
13782         case "$getgrnam_r_proto" in
13783         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13784         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13785         esac
13786         case "$getgrnam_r_proto" in
13787         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13788         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13789         esac
13790         case "$getgrnam_r_proto" in
13791         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13792         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13793         esac
13794         case "$getgrnam_r_proto" in
13795         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13796         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13797         esac
13798         case "$getgrnam_r_proto" in
13799         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13800         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13801         esac
13802         case "$getgrnam_r_proto" in
13803         ''|0)   d_getgrnam_r=undef
13804                 getgrnam_r_proto=0
13805                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13806         * )     case "$getgrnam_r_proto" in
13807                 REENTRANT_PROTO*) ;;
13808                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13809                 esac
13810                 echo "Prototype: $try" ;;
13811         esac
13812         ;;
13813         *)      case "$usethreads" in
13814                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13815                 esac
13816                 d_getgrnam_r=undef
13817                 getgrnam_r_proto=0
13818                 ;;
13819         esac
13820         ;;
13821 *)      getgrnam_r_proto=0
13822         ;;
13823 esac
13824
13825 : see if gethostbyaddr exists
13826 set gethostbyaddr d_gethbyaddr
13827 eval $inlibc
13828
13829 : see if gethostbyname exists
13830 set gethostbyname d_gethbyname
13831 eval $inlibc
13832
13833 : see if gethostent exists
13834 set gethostent d_gethent
13835 eval $inlibc
13836
13837 : see how we will look up host name
13838 echo " "
13839 call=''
13840 if set gethostname val -f d_gethname; eval $csym; $val; then
13841         echo 'gethostname() found.' >&4
13842         d_gethname="$define"
13843         call=gethostname
13844 fi
13845 if set uname val -f d_uname; eval $csym; $val; then
13846         if ./xenix; then
13847                 $cat <<'EOM'
13848 uname() was found, but you're running xenix, and older versions of xenix
13849 have a broken uname(). If you don't really know whether your xenix is old
13850 enough to have a broken system call, use the default answer.
13851
13852 EOM
13853                 dflt=y
13854                 case "$d_uname" in
13855                 "$define") dflt=n;;
13856                 esac
13857                 rp='Is your uname() broken?'
13858                 . ./myread
13859                 case "$ans" in
13860                 n*) d_uname="$define"; call=uname;;
13861                 esac
13862         else
13863                 echo 'uname() found.' >&4
13864                 d_uname="$define"
13865                 case "$call" in
13866                 '') call=uname ;;
13867                 esac
13868         fi
13869 fi
13870 case "$d_gethname" in
13871 '') d_gethname="$undef";;
13872 esac
13873 case "$d_uname" in
13874 '') d_uname="$undef";;
13875 esac
13876 case "$d_uname$d_gethname" in
13877 *define*)
13878         dflt=n
13879         cat <<EOM
13880
13881 Every now and then someone has a $call() that lies about the hostname
13882 but can't be fixed for political or economic reasons.  If you wish, I can
13883 pretend $call() isn't there and maybe compute hostname at run-time
13884 thanks to the '$phostname' command.
13885
13886 EOM
13887         rp="Shall I ignore $call() from now on?"
13888         . ./myread
13889         case "$ans" in
13890         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13891         esac;;
13892 esac
13893 case "$phostname" in
13894 '') aphostname='';;
13895 *) case "$aphostname" in
13896         /*) ;;
13897         *) set X $phostname
13898                 shift
13899                 file=$1
13900                 shift
13901                 file=`./loc $file $file $pth`
13902                 aphostname=`echo $file $*`
13903                 ;;
13904         esac
13905         ;;
13906 esac
13907 case "$d_uname$d_gethname" in
13908 *define*) ;;
13909 *)
13910         case "$phostname" in
13911         '')
13912                 echo "There will be no way for $package to get your hostname." >&4;;
13913         *)
13914         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13915                 ;;
13916         esac;;
13917 esac
13918 case "$d_phostname" in
13919 '') d_phostname="$undef";;
13920 esac
13921
13922 : see if gethostbyaddr_r exists
13923 set gethostbyaddr_r d_gethostbyaddr_r
13924 eval $inlibc
13925 case "$d_gethostbyaddr_r" in
13926 "$define")
13927         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13928         case "$d_gethostbyaddr_r_proto:$usethreads" in
13929         ":define")      d_gethostbyaddr_r_proto=define
13930                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13931                 eval $hasproto ;;
13932         *)      ;;
13933         esac
13934         case "$d_gethostbyaddr_r_proto" in
13935         define)
13936         case "$gethostbyaddr_r_proto" in
13937         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13938         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13939         esac
13940         case "$gethostbyaddr_r_proto" in
13941         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13942         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13943         esac
13944         case "$gethostbyaddr_r_proto" in
13945         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13946         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13947         esac
13948         case "$gethostbyaddr_r_proto" in
13949         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13950         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13951         esac
13952         case "$gethostbyaddr_r_proto" in
13953         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13954         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13955         esac
13956         case "$gethostbyaddr_r_proto" in
13957         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13958         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13959         esac
13960         case "$gethostbyaddr_r_proto" in
13961         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13962         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13963         esac
13964         case "$gethostbyaddr_r_proto" in
13965         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13966         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13967         esac
13968         case "$gethostbyaddr_r_proto" in
13969         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13970         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13971         esac
13972         case "$gethostbyaddr_r_proto" in
13973         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13974         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13975         esac
13976         case "$gethostbyaddr_r_proto" in
13977         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13978         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13979         esac
13980         case "$gethostbyaddr_r_proto" in
13981         ''|0)   d_gethostbyaddr_r=undef
13982                 gethostbyaddr_r_proto=0
13983                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13984         * )     case "$gethostbyaddr_r_proto" in
13985                 REENTRANT_PROTO*) ;;
13986                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13987                 esac
13988                 echo "Prototype: $try" ;;
13989         esac
13990         ;;
13991         *)      case "$usethreads" in
13992                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13993                 esac
13994                 d_gethostbyaddr_r=undef
13995                 gethostbyaddr_r_proto=0
13996                 ;;
13997         esac
13998         ;;
13999 *)      gethostbyaddr_r_proto=0
14000         ;;
14001 esac
14002
14003 : see if gethostbyname_r exists
14004 set gethostbyname_r d_gethostbyname_r
14005 eval $inlibc
14006 case "$d_gethostbyname_r" in
14007 "$define")
14008         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14009         case "$d_gethostbyname_r_proto:$usethreads" in
14010         ":define")      d_gethostbyname_r_proto=define
14011                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14012                 eval $hasproto ;;
14013         *)      ;;
14014         esac
14015         case "$d_gethostbyname_r_proto" in
14016         define)
14017         case "$gethostbyname_r_proto" in
14018         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14019         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14020         esac
14021         case "$gethostbyname_r_proto" in
14022         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14023         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14024         esac
14025         case "$gethostbyname_r_proto" in
14026         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14027         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14028         esac
14029         case "$gethostbyname_r_proto" in
14030         ''|0)   d_gethostbyname_r=undef
14031                 gethostbyname_r_proto=0
14032                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14033         * )     case "$gethostbyname_r_proto" in
14034                 REENTRANT_PROTO*) ;;
14035                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14036                 esac
14037                 echo "Prototype: $try" ;;
14038         esac
14039         ;;
14040         *)      case "$usethreads" in
14041                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14042                 esac
14043                 d_gethostbyname_r=undef
14044                 gethostbyname_r_proto=0
14045                 ;;
14046         esac
14047         ;;
14048 *)      gethostbyname_r_proto=0
14049         ;;
14050 esac
14051
14052 : see if gethostent_r exists
14053 set gethostent_r d_gethostent_r
14054 eval $inlibc
14055 case "$d_gethostent_r" in
14056 "$define")
14057         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14058         case "$d_gethostent_r_proto:$usethreads" in
14059         ":define")      d_gethostent_r_proto=define
14060                 set d_gethostent_r_proto gethostent_r $hdrs
14061                 eval $hasproto ;;
14062         *)      ;;
14063         esac
14064         case "$d_gethostent_r_proto" in
14065         define)
14066         case "$gethostent_r_proto" in
14067         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14068         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14069         esac
14070         case "$gethostent_r_proto" in
14071         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14072         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14073         esac
14074         case "$gethostent_r_proto" in
14075         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14076         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14077         esac
14078         case "$gethostent_r_proto" in
14079         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14080         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14081         esac
14082         case "$gethostent_r_proto" in
14083         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14084         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14085         esac
14086         case "$gethostent_r_proto" in
14087         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14088         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14089         esac
14090         case "$gethostent_r_proto" in
14091         ''|0)   d_gethostent_r=undef
14092                 gethostent_r_proto=0
14093                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14094         * )     case "$gethostent_r_proto" in
14095                 REENTRANT_PROTO*) ;;
14096                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14097                 esac
14098                 echo "Prototype: $try" ;;
14099         esac
14100         ;;
14101         *)      case "$usethreads" in
14102                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14103                 esac
14104                 d_gethostent_r=undef
14105                 gethostent_r_proto=0
14106                 ;;
14107         esac
14108         ;;
14109 *)      gethostent_r_proto=0
14110         ;;
14111 esac
14112
14113 : see if prototypes for various gethostxxx netdb.h functions are available
14114 echo " "
14115 set d_gethostprotos gethostent $i_netdb netdb.h
14116 eval $hasproto
14117
14118 : see if getitimer exists
14119 set getitimer d_getitimer
14120 eval $inlibc
14121
14122 : see if getlogin exists
14123 set getlogin d_getlogin
14124 eval $inlibc
14125
14126 : see if getlogin_r exists
14127 set getlogin_r d_getlogin_r
14128 eval $inlibc
14129 case "$d_getlogin_r" in
14130 "$define")
14131         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14132         case "$d_getlogin_r_proto:$usethreads" in
14133         ":define")      d_getlogin_r_proto=define
14134                 set d_getlogin_r_proto getlogin_r $hdrs
14135                 eval $hasproto ;;
14136         *)      ;;
14137         esac
14138         case "$d_getlogin_r_proto" in
14139         define)
14140         case "$getlogin_r_proto" in
14141         ''|0) try='int getlogin_r(char*, size_t);'
14142         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14143         esac
14144         case "$getlogin_r_proto" in
14145         ''|0) try='int getlogin_r(char*, int);'
14146         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14147         esac
14148         case "$getlogin_r_proto" in
14149         ''|0) try='char* getlogin_r(char*, size_t);'
14150         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14151         esac
14152         case "$getlogin_r_proto" in
14153         ''|0) try='char* getlogin_r(char*, int);'
14154         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14155         esac
14156         case "$getlogin_r_proto" in
14157         ''|0)   d_getlogin_r=undef
14158                 getlogin_r_proto=0
14159                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14160         * )     case "$getlogin_r_proto" in
14161                 REENTRANT_PROTO*) ;;
14162                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14163                 esac
14164                 echo "Prototype: $try" ;;
14165         esac
14166         ;;
14167         *)      case "$usethreads" in
14168                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14169                 esac
14170                 d_getlogin_r=undef
14171                 getlogin_r_proto=0
14172                 ;;
14173         esac
14174         ;;
14175 *)      getlogin_r_proto=0
14176         ;;
14177 esac
14178
14179 : see if getmnt exists
14180 set getmnt d_getmnt
14181 eval $inlibc
14182
14183 : see if getmntent exists
14184 set getmntent d_getmntent
14185 eval $inlibc
14186
14187 : see if getnameinfo exists
14188 set getnameinfo d_getnameinfo
14189 eval $inlibc
14190
14191 : see if getnetbyaddr exists
14192 set getnetbyaddr d_getnbyaddr
14193 eval $inlibc
14194
14195 : see if getnetbyname exists
14196 set getnetbyname d_getnbyname
14197 eval $inlibc
14198
14199 : see if getnetent exists
14200 set getnetent d_getnent
14201 eval $inlibc
14202
14203 : see if getnetbyaddr_r exists
14204 set getnetbyaddr_r d_getnetbyaddr_r
14205 eval $inlibc
14206 case "$d_getnetbyaddr_r" in
14207 "$define")
14208         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14209         case "$d_getnetbyaddr_r_proto:$usethreads" in
14210         ":define")      d_getnetbyaddr_r_proto=define
14211                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14212                 eval $hasproto ;;
14213         *)      ;;
14214         esac
14215         case "$d_getnetbyaddr_r_proto" in
14216         define)
14217         case "$getnetbyaddr_r_proto" in
14218         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14219         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14220         esac
14221         case "$getnetbyaddr_r_proto" in
14222         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14223         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14224         esac
14225         case "$getnetbyaddr_r_proto" in
14226         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14227         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14228         esac
14229         case "$getnetbyaddr_r_proto" in
14230         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14231         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14232         esac
14233         case "$getnetbyaddr_r_proto" in
14234         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14235         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14236         esac
14237         case "$getnetbyaddr_r_proto" in
14238         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14239         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14240         esac
14241         case "$getnetbyaddr_r_proto" in
14242         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14243         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14244         esac
14245         case "$getnetbyaddr_r_proto" in
14246         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14247         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14248         esac
14249         case "$getnetbyaddr_r_proto" in
14250         ''|0)   d_getnetbyaddr_r=undef
14251                 getnetbyaddr_r_proto=0
14252                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14253         * )     case "$getnetbyaddr_r_proto" in
14254                 REENTRANT_PROTO*) ;;
14255                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14256                 esac
14257                 echo "Prototype: $try" ;;
14258         esac
14259         ;;
14260         *)      case "$usethreads" in
14261                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14262                 esac
14263                 d_getnetbyaddr_r=undef
14264                 getnetbyaddr_r_proto=0
14265                 ;;
14266         esac
14267         ;;
14268 *)      getnetbyaddr_r_proto=0
14269         ;;
14270 esac
14271
14272 : see if getnetbyname_r exists
14273 set getnetbyname_r d_getnetbyname_r
14274 eval $inlibc
14275 case "$d_getnetbyname_r" in
14276 "$define")
14277         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14278         case "$d_getnetbyname_r_proto:$usethreads" in
14279         ":define")      d_getnetbyname_r_proto=define
14280                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14281                 eval $hasproto ;;
14282         *)      ;;
14283         esac
14284         case "$d_getnetbyname_r_proto" in
14285         define)
14286         case "$getnetbyname_r_proto" in
14287         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14288         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14289         esac
14290         case "$getnetbyname_r_proto" in
14291         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14292         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14293         esac
14294         case "$getnetbyname_r_proto" in
14295         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14296         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14297         esac
14298         case "$getnetbyname_r_proto" in
14299         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14300         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14301         esac
14302         case "$getnetbyname_r_proto" in
14303         ''|0)   d_getnetbyname_r=undef
14304                 getnetbyname_r_proto=0
14305                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14306         * )     case "$getnetbyname_r_proto" in
14307                 REENTRANT_PROTO*) ;;
14308                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14309                 esac
14310                 echo "Prototype: $try" ;;
14311         esac
14312         ;;
14313         *)      case "$usethreads" in
14314                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14315                 esac
14316                 d_getnetbyname_r=undef
14317                 getnetbyname_r_proto=0
14318                 ;;
14319         esac
14320         ;;
14321 *)      getnetbyname_r_proto=0
14322         ;;
14323 esac
14324
14325 : see if getnetent_r exists
14326 set getnetent_r d_getnetent_r
14327 eval $inlibc
14328 case "$d_getnetent_r" in
14329 "$define")
14330         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14331         case "$d_getnetent_r_proto:$usethreads" in
14332         ":define")      d_getnetent_r_proto=define
14333                 set d_getnetent_r_proto getnetent_r $hdrs
14334                 eval $hasproto ;;
14335         *)      ;;
14336         esac
14337         case "$d_getnetent_r_proto" in
14338         define)
14339         case "$getnetent_r_proto" in
14340         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14341         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14342         esac
14343         case "$getnetent_r_proto" in
14344         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14345         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14346         esac
14347         case "$getnetent_r_proto" in
14348         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14349         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14350         esac
14351         case "$getnetent_r_proto" in
14352         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14353         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14354         esac
14355         case "$getnetent_r_proto" in
14356         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14357         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14358         esac
14359         case "$getnetent_r_proto" in
14360         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14361         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14362         esac
14363         case "$getnetent_r_proto" in
14364         ''|0)   d_getnetent_r=undef
14365                 getnetent_r_proto=0
14366                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14367         * )     case "$getnetent_r_proto" in
14368                 REENTRANT_PROTO*) ;;
14369                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14370                 esac
14371                 echo "Prototype: $try" ;;
14372         esac
14373         ;;
14374         *)      case "$usethreads" in
14375                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14376                 esac
14377                 d_getnetent_r=undef
14378                 getnetent_r_proto=0
14379                 ;;
14380         esac
14381         ;;
14382 *)      getnetent_r_proto=0
14383         ;;
14384 esac
14385
14386 : see if prototypes for various getnetxxx netdb.h functions are available
14387 echo " "
14388 set d_getnetprotos getnetent $i_netdb netdb.h
14389 eval $hasproto
14390
14391 : see if getpagesize exists
14392 set getpagesize d_getpagsz
14393 eval $inlibc
14394
14395 : Optional checks for getprotobyname and getprotobynumber
14396
14397 : see if getprotobyname exists
14398 set getprotobyname d_getpbyname
14399 eval $inlibc
14400
14401 : see if getprotobynumber exists
14402 set getprotobynumber d_getpbynumber
14403 eval $inlibc
14404
14405 : see if getprotoent exists
14406 set getprotoent d_getpent
14407 eval $inlibc
14408
14409 : see if getpgid exists
14410 set getpgid d_getpgid
14411 eval $inlibc
14412
14413 : see if getpgrp2 exists
14414 set getpgrp2 d_getpgrp2
14415 eval $inlibc
14416
14417 : see if getppid exists
14418 set getppid d_getppid
14419 eval $inlibc
14420
14421 : see if getpriority exists
14422 set getpriority d_getprior
14423 eval $inlibc
14424
14425 : see if getprotobyname_r exists
14426 set getprotobyname_r d_getprotobyname_r
14427 eval $inlibc
14428 case "$d_getprotobyname_r" in
14429 "$define")
14430         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14431         case "$d_getprotobyname_r_proto:$usethreads" in
14432         ":define")      d_getprotobyname_r_proto=define
14433                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14434                 eval $hasproto ;;
14435         *)      ;;
14436         esac
14437         case "$d_getprotobyname_r_proto" in
14438         define)
14439         case "$getprotobyname_r_proto" in
14440         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14441         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14442         esac
14443         case "$getprotobyname_r_proto" in
14444         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14445         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14446         esac
14447         case "$getprotobyname_r_proto" in
14448         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14449         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14450         esac
14451         case "$getprotobyname_r_proto" in
14452         ''|0)   d_getprotobyname_r=undef
14453                 getprotobyname_r_proto=0
14454                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14455         * )     case "$getprotobyname_r_proto" in
14456                 REENTRANT_PROTO*) ;;
14457                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14458                 esac
14459                 echo "Prototype: $try" ;;
14460         esac
14461         ;;
14462         *)      case "$usethreads" in
14463                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14464                 esac
14465                 d_getprotobyname_r=undef
14466                 getprotobyname_r_proto=0
14467                 ;;
14468         esac
14469         ;;
14470 *)      getprotobyname_r_proto=0
14471         ;;
14472 esac
14473
14474 : see if getprotobynumber_r exists
14475 set getprotobynumber_r d_getprotobynumber_r
14476 eval $inlibc
14477 case "$d_getprotobynumber_r" in
14478 "$define")
14479         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14480         case "$d_getprotobynumber_r_proto:$usethreads" in
14481         ":define")      d_getprotobynumber_r_proto=define
14482                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14483                 eval $hasproto ;;
14484         *)      ;;
14485         esac
14486         case "$d_getprotobynumber_r_proto" in
14487         define)
14488         case "$getprotobynumber_r_proto" in
14489         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14490         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14491         esac
14492         case "$getprotobynumber_r_proto" in
14493         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14494         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14495         esac
14496         case "$getprotobynumber_r_proto" in
14497         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14498         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14499         esac
14500         case "$getprotobynumber_r_proto" in
14501         ''|0)   d_getprotobynumber_r=undef
14502                 getprotobynumber_r_proto=0
14503                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14504         * )     case "$getprotobynumber_r_proto" in
14505                 REENTRANT_PROTO*) ;;
14506                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14507                 esac
14508                 echo "Prototype: $try" ;;
14509         esac
14510         ;;
14511         *)      case "$usethreads" in
14512                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14513                 esac
14514                 d_getprotobynumber_r=undef
14515                 getprotobynumber_r_proto=0
14516                 ;;
14517         esac
14518         ;;
14519 *)      getprotobynumber_r_proto=0
14520         ;;
14521 esac
14522
14523 : see if getprotoent_r exists
14524 set getprotoent_r d_getprotoent_r
14525 eval $inlibc
14526 case "$d_getprotoent_r" in
14527 "$define")
14528         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14529         case "$d_getprotoent_r_proto:$usethreads" in
14530         ":define")      d_getprotoent_r_proto=define
14531                 set d_getprotoent_r_proto getprotoent_r $hdrs
14532                 eval $hasproto ;;
14533         *)      ;;
14534         esac
14535         case "$d_getprotoent_r_proto" in
14536         define)
14537         case "$getprotoent_r_proto" in
14538         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14539         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14540         esac
14541         case "$getprotoent_r_proto" in
14542         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14543         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14544         esac
14545         case "$getprotoent_r_proto" in
14546         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14547         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14548         esac
14549         case "$getprotoent_r_proto" in
14550         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14551         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14552         esac
14553         case "$getprotoent_r_proto" in
14554         ''|0)   d_getprotoent_r=undef
14555                 getprotoent_r_proto=0
14556                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14557         * )     case "$getprotoent_r_proto" in
14558                 REENTRANT_PROTO*) ;;
14559                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14560                 esac
14561                 echo "Prototype: $try" ;;
14562         esac
14563         ;;
14564         *)      case "$usethreads" in
14565                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14566                 esac
14567                 d_getprotoent_r=undef
14568                 getprotoent_r_proto=0
14569                 ;;
14570         esac
14571         ;;
14572 *)      getprotoent_r_proto=0
14573         ;;
14574 esac
14575
14576 : see if prototypes for various getprotoxxx netdb.h functions are available
14577 echo " "
14578 set d_getprotoprotos getprotoent $i_netdb netdb.h
14579 eval $hasproto
14580
14581 : see if getprpwnam exists
14582 set getprpwnam d_getprpwnam
14583 eval $inlibc
14584
14585 : see if getpwent exists
14586 set getpwent d_getpwent
14587 eval $inlibc
14588
14589 : see if getpwent_r exists
14590 set getpwent_r d_getpwent_r
14591 eval $inlibc
14592 case "$d_getpwent_r" in
14593 "$define")
14594         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14595         case "$d_getpwent_r_proto:$usethreads" in
14596         ":define")      d_getpwent_r_proto=define
14597                 set d_getpwent_r_proto getpwent_r $hdrs
14598                 eval $hasproto ;;
14599         *)      ;;
14600         esac
14601         case "$d_getpwent_r_proto" in
14602         define)
14603         case "$getpwent_r_proto" in
14604         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14605         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14606         esac
14607         case "$getpwent_r_proto" in
14608         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14609         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14610         esac
14611         case "$getpwent_r_proto" in
14612         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14613         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14614         esac
14615         case "$getpwent_r_proto" in
14616         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14617         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14618         esac
14619         case "$getpwent_r_proto" in
14620         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14621         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14622         esac
14623         case "$getpwent_r_proto" in
14624         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14625         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14626         esac
14627         case "$getpwent_r_proto" in
14628         ''|0)   d_getpwent_r=undef
14629                 getpwent_r_proto=0
14630                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14631         * )     case "$getpwent_r_proto" in
14632                 REENTRANT_PROTO*) ;;
14633                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14634                 esac
14635                 echo "Prototype: $try" ;;
14636         esac
14637         ;;
14638         *)      case "$usethreads" in
14639                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14640                 esac
14641                 d_getpwent_r=undef
14642                 getpwent_r_proto=0
14643                 ;;
14644         esac
14645         ;;
14646 *)      getpwent_r_proto=0
14647         ;;
14648 esac
14649
14650 : see if getpwnam_r exists
14651 set getpwnam_r d_getpwnam_r
14652 eval $inlibc
14653 case "$d_getpwnam_r" in
14654 "$define")
14655         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14656         case "$d_getpwnam_r_proto:$usethreads" in
14657         ":define")      d_getpwnam_r_proto=define
14658                 set d_getpwnam_r_proto getpwnam_r $hdrs
14659                 eval $hasproto ;;
14660         *)      ;;
14661         esac
14662         case "$d_getpwnam_r_proto" in
14663         define)
14664         case "$getpwnam_r_proto" in
14665         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14666         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14667         esac
14668         case "$getpwnam_r_proto" in
14669         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14670         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14671         esac
14672         case "$getpwnam_r_proto" in
14673         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14674         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14675         esac
14676         case "$getpwnam_r_proto" in
14677         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14678         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14679         esac
14680         case "$getpwnam_r_proto" in
14681         ''|0)   d_getpwnam_r=undef
14682                 getpwnam_r_proto=0
14683                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14684         * )     case "$getpwnam_r_proto" in
14685                 REENTRANT_PROTO*) ;;
14686                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14687                 esac
14688                 echo "Prototype: $try" ;;
14689         esac
14690         ;;
14691         *)      case "$usethreads" in
14692                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14693                 esac
14694                 d_getpwnam_r=undef
14695                 getpwnam_r_proto=0
14696                 ;;
14697         esac
14698         ;;
14699 *)      getpwnam_r_proto=0
14700         ;;
14701 esac
14702
14703 : see if getpwuid_r exists
14704 set getpwuid_r d_getpwuid_r
14705 eval $inlibc
14706 case "$d_getpwuid_r" in
14707 "$define")
14708         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14709         case "$d_getpwuid_r_proto:$usethreads" in
14710         ":define")      d_getpwuid_r_proto=define
14711                 set d_getpwuid_r_proto getpwuid_r $hdrs
14712                 eval $hasproto ;;
14713         *)      ;;
14714         esac
14715         case "$d_getpwuid_r_proto" in
14716         define)
14717         case "$getpwuid_r_proto" in
14718         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14719         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14720         esac
14721         case "$getpwuid_r_proto" in
14722         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14723         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14724         esac
14725         case "$getpwuid_r_proto" in
14726         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14727         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14728         esac
14729         case "$getpwuid_r_proto" in
14730         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14731         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14732         esac
14733         case "$getpwuid_r_proto" in
14734         ''|0)   d_getpwuid_r=undef
14735                 getpwuid_r_proto=0
14736                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14737         * )     case "$getpwuid_r_proto" in
14738                 REENTRANT_PROTO*) ;;
14739                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14740                 esac
14741                 echo "Prototype: $try" ;;
14742         esac
14743         ;;
14744         *)      case "$usethreads" in
14745                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14746                 esac
14747                 d_getpwuid_r=undef
14748                 getpwuid_r_proto=0
14749                 ;;
14750         esac
14751         ;;
14752 *)      getpwuid_r_proto=0
14753         ;;
14754 esac
14755
14756 : Optional checks for getsbyname and getsbyport
14757
14758 : see if getservbyname exists
14759 set getservbyname d_getsbyname
14760 eval $inlibc
14761
14762 : see if getservbyport exists
14763 set getservbyport d_getsbyport
14764 eval $inlibc
14765
14766 : see if getservent exists
14767 set getservent d_getsent
14768 eval $inlibc
14769
14770 : see if getservbyname_r exists
14771 set getservbyname_r d_getservbyname_r
14772 eval $inlibc
14773 case "$d_getservbyname_r" in
14774 "$define")
14775         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14776         case "$d_getservbyname_r_proto:$usethreads" in
14777         ":define")      d_getservbyname_r_proto=define
14778                 set d_getservbyname_r_proto getservbyname_r $hdrs
14779                 eval $hasproto ;;
14780         *)      ;;
14781         esac
14782         case "$d_getservbyname_r_proto" in
14783         define)
14784         case "$getservbyname_r_proto" in
14785         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14786         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14787         esac
14788         case "$getservbyname_r_proto" in
14789         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14790         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14791         esac
14792         case "$getservbyname_r_proto" in
14793         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14794         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14795         esac
14796         case "$getservbyname_r_proto" in
14797         ''|0)   d_getservbyname_r=undef
14798                 getservbyname_r_proto=0
14799                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14800         * )     case "$getservbyname_r_proto" in
14801                 REENTRANT_PROTO*) ;;
14802                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14803                 esac
14804                 echo "Prototype: $try" ;;
14805         esac
14806         ;;
14807         *)      case "$usethreads" in
14808                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14809                 esac
14810                 d_getservbyname_r=undef
14811                 getservbyname_r_proto=0
14812                 ;;
14813         esac
14814         ;;
14815 *)      getservbyname_r_proto=0
14816         ;;
14817 esac
14818
14819 : see if getservbyport_r exists
14820 set getservbyport_r d_getservbyport_r
14821 eval $inlibc
14822 case "$d_getservbyport_r" in
14823 "$define")
14824         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14825         case "$d_getservbyport_r_proto:$usethreads" in
14826         ":define")      d_getservbyport_r_proto=define
14827                 set d_getservbyport_r_proto getservbyport_r $hdrs
14828                 eval $hasproto ;;
14829         *)      ;;
14830         esac
14831         case "$d_getservbyport_r_proto" in
14832         define)
14833         case "$getservbyport_r_proto" in
14834         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14835         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14836         esac
14837         case "$getservbyport_r_proto" in
14838         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14839         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14840         esac
14841         case "$getservbyport_r_proto" in
14842         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14843         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14844         esac
14845         case "$getservbyport_r_proto" in
14846         ''|0)   d_getservbyport_r=undef
14847                 getservbyport_r_proto=0
14848                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14849         * )     case "$getservbyport_r_proto" in
14850                 REENTRANT_PROTO*) ;;
14851                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14852                 esac
14853                 echo "Prototype: $try" ;;
14854         esac
14855         ;;
14856         *)      case "$usethreads" in
14857                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14858                 esac
14859                 d_getservbyport_r=undef
14860                 getservbyport_r_proto=0
14861                 ;;
14862         esac
14863         ;;
14864 *)      getservbyport_r_proto=0
14865         ;;
14866 esac
14867
14868 : see if getservent_r exists
14869 set getservent_r d_getservent_r
14870 eval $inlibc
14871 case "$d_getservent_r" in
14872 "$define")
14873         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14874         case "$d_getservent_r_proto:$usethreads" in
14875         ":define")      d_getservent_r_proto=define
14876                 set d_getservent_r_proto getservent_r $hdrs
14877                 eval $hasproto ;;
14878         *)      ;;
14879         esac
14880         case "$d_getservent_r_proto" in
14881         define)
14882         case "$getservent_r_proto" in
14883         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14884         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14885         esac
14886         case "$getservent_r_proto" in
14887         ''|0) try='int getservent_r(struct servent*, char*, int);'
14888         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14889         esac
14890         case "$getservent_r_proto" in
14891         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14892         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14893         esac
14894         case "$getservent_r_proto" in
14895         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14896         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14897         esac
14898         case "$getservent_r_proto" in
14899         ''|0)   d_getservent_r=undef
14900                 getservent_r_proto=0
14901                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14902         * )     case "$getservent_r_proto" in
14903                 REENTRANT_PROTO*) ;;
14904                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14905                 esac
14906                 echo "Prototype: $try" ;;
14907         esac
14908         ;;
14909         *)      case "$usethreads" in
14910                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14911                 esac
14912                 d_getservent_r=undef
14913                 getservent_r_proto=0
14914                 ;;
14915         esac
14916         ;;
14917 *)      getservent_r_proto=0
14918         ;;
14919 esac
14920
14921 : see if prototypes for various getservxxx netdb.h functions are available
14922 echo " "
14923 set d_getservprotos getservent $i_netdb netdb.h
14924 eval $hasproto
14925
14926 : see if getspnam exists
14927 set getspnam d_getspnam
14928 eval $inlibc
14929
14930 : see if this is a shadow.h system
14931 set shadow.h i_shadow
14932 eval $inhdr
14933
14934 : see if getspnam_r exists
14935 set getspnam_r d_getspnam_r
14936 eval $inlibc
14937 case "$d_getspnam_r" in
14938 "$define")
14939         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14940         case "$d_getspnam_r_proto:$usethreads" in
14941         ":define")      d_getspnam_r_proto=define
14942                 set d_getspnam_r_proto getspnam_r $hdrs
14943                 eval $hasproto ;;
14944         *)      ;;
14945         esac
14946         case "$d_getspnam_r_proto" in
14947         define)
14948         case "$getspnam_r_proto" in
14949         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14950         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14951         esac
14952         case "$getspnam_r_proto" in
14953         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14954         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14955         esac
14956         case "$getspnam_r_proto" in
14957         ''|0)   d_getspnam_r=undef
14958                 getspnam_r_proto=0
14959                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14960         * )     case "$getspnam_r_proto" in
14961                 REENTRANT_PROTO*) ;;
14962                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14963                 esac
14964                 echo "Prototype: $try" ;;
14965         esac
14966         ;;
14967         *)      case "$usethreads" in
14968                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14969                 esac
14970                 d_getspnam_r=undef
14971                 getspnam_r_proto=0
14972                 ;;
14973         esac
14974         ;;
14975 *)      getspnam_r_proto=0
14976         ;;
14977 esac
14978
14979 : see if gettimeofday or ftime exists
14980 set gettimeofday d_gettimeod
14981 eval $inlibc
14982 case "$d_gettimeod" in
14983 "$undef")
14984         set ftime d_ftime 
14985         eval $inlibc
14986         ;;
14987 *)
14988         val="$undef"; set d_ftime; eval $setvar
14989         ;;
14990 esac
14991 case "$d_gettimeod$d_ftime" in
14992 "$undef$undef")
14993         echo " "
14994         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14995         ;;
14996 esac
14997
14998 : see if gmtime_r exists
14999 set gmtime_r d_gmtime_r
15000 eval $inlibc
15001 case "$d_gmtime_r" in
15002 "$define")
15003         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15004         case "$d_gmtime_r_proto:$usethreads" in
15005         ":define")      d_gmtime_r_proto=define
15006                 set d_gmtime_r_proto gmtime_r $hdrs
15007                 eval $hasproto ;;
15008         *)      ;;
15009         esac
15010         case "$d_gmtime_r_proto" in
15011         define)
15012         case "$gmtime_r_proto" in
15013         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15014         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15015         esac
15016         case "$gmtime_r_proto" in
15017         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15018         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15019         esac
15020         case "$gmtime_r_proto" in
15021         ''|0)   d_gmtime_r=undef
15022                 gmtime_r_proto=0
15023                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15024         * )     case "$gmtime_r_proto" in
15025                 REENTRANT_PROTO*) ;;
15026                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15027                 esac
15028                 echo "Prototype: $try" ;;
15029         esac
15030         ;;
15031         *)      case "$usethreads" in
15032                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15033                 esac
15034                 d_gmtime_r=undef
15035                 gmtime_r_proto=0
15036                 ;;
15037         esac
15038         ;;
15039 *)      gmtime_r_proto=0
15040         ;;
15041 esac
15042
15043 : see if hasmntopt exists
15044 set hasmntopt d_hasmntopt
15045 eval $inlibc
15046
15047 : see if this is a netinet/in.h or sys/in.h system
15048 set netinet/in.h i_niin sys/in.h i_sysin
15049 eval $inhdr
15050
15051 : see if arpa/inet.h has to be included
15052 set arpa/inet.h i_arpainet
15053 eval $inhdr
15054
15055 : see if htonl --and friends-- exists
15056 val=''
15057 set htonl val
15058 eval $inlibc
15059
15060 : Maybe they are macros.
15061 case "$val" in
15062 $undef)
15063         $cat >htonl.c <<EOM
15064 #include <stdio.h>
15065 #include <sys/types.h>
15066 #$i_niin I_NETINET_IN
15067 #$i_sysin I_SYS_IN
15068 #$i_arpainet I_ARPA_INET
15069 #ifdef I_NETINET_IN
15070 #include <netinet/in.h>
15071 #endif
15072 #ifdef I_SYS_IN
15073 #include <sys/in.h>
15074 #endif
15075 #ifdef I_ARPA_INET
15076 #include <arpa/inet.h>
15077 #endif
15078 #ifdef htonl
15079 printf("Defined as a macro.");
15080 #endif
15081 EOM
15082         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15083         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15084                 val="$define"
15085                 echo "But it seems to be defined as a macro." >&4
15086         fi
15087         $rm -f htonl.?
15088         ;;
15089 esac
15090 set d_htonl
15091 eval $setvar
15092
15093 : see if ilogbl exists
15094 set ilogbl d_ilogbl
15095 eval $inlibc
15096
15097 : index or strchr
15098 echo " "
15099 if set index val -f; eval $csym; $val; then
15100         if set strchr val -f d_strchr; eval $csym; $val; then
15101                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15102                         val="$define"
15103                         vali="$undef"
15104                         echo "strchr() found." >&4
15105                 else
15106                         val="$undef"
15107                         vali="$define"
15108                         echo "index() found." >&4
15109                 fi
15110         else
15111                 val="$undef"
15112                 vali="$define"
15113                 echo "index() found." >&4
15114         fi
15115 else
15116         if set strchr val -f d_strchr; eval $csym; $val; then
15117                 val="$define"
15118                 vali="$undef"
15119                 echo "strchr() found." >&4
15120         else
15121                 echo "No index() or strchr() found!" >&4
15122                 val="$undef"
15123                 vali="$undef"
15124         fi
15125 fi
15126 set d_strchr; eval $setvar
15127 val="$vali"
15128 set d_index; eval $setvar
15129
15130 : check whether inet_aton exists
15131 set inet_aton d_inetaton
15132 eval $inlibc
15133
15134 : see if inet_ntop exists
15135 set inet_ntop d_inetntop
15136 eval $inlibc
15137
15138 : see if inet_pton exists
15139 set inet_pton d_inetpton
15140 eval $inlibc
15141
15142 : Look for isascii
15143 echo " "
15144 $cat >isascii.c <<EOCP
15145 #include <stdio.h>
15146 #include <ctype.h>
15147 #$i_stdlib I_STDLIB
15148 #ifdef I_STDLIB
15149 #include <stdlib.h>
15150 #endif
15151 int main() {
15152         int c = 'A';
15153         if (isascii(c))
15154                 exit(0);
15155         else
15156                 exit(1);
15157 }
15158 EOCP
15159 set isascii
15160 if eval $compile; then
15161         echo "isascii() found." >&4
15162         val="$define"
15163 else
15164         echo "isascii() NOT found." >&4
15165         val="$undef"
15166 fi
15167 set d_isascii
15168 eval $setvar
15169 $rm -f isascii*
15170
15171 : Look for isblank
15172 echo " "
15173 $cat >isblank.c <<'EOCP'
15174 #include <stdio.h>
15175 #include <ctype.h>
15176 int main() {
15177         int c = ' ';
15178         if (isblank(c))
15179                 return 0 ;
15180         else
15181                 return 1 ;
15182 }
15183 EOCP
15184 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15185         echo "isblank() found." >&4
15186         val="$define"
15187 else
15188         echo "isblank() NOT found." >&4
15189         val="$undef"
15190 fi
15191 set d_isblank
15192 eval $setvar
15193 $rm -f isblank*
15194
15195 : see if isfinite exists
15196 set isfinite d_isfinite
15197 eval $inlibc
15198
15199 : see if isinf exists
15200 set isinf d_isinf
15201 eval $inlibc
15202
15203 : see if isnan exists
15204 set isnan d_isnan
15205 eval $inlibc
15206
15207 : see if isnanl exists
15208 set isnanl d_isnanl
15209 eval $inlibc
15210
15211 : see if killpg exists
15212 set killpg d_killpg
15213 eval $inlibc
15214
15215 : see if lchown exists
15216 echo " "
15217 $cat > try.c <<'EOCP'
15218 /* System header to define __stub macros and hopefully few prototypes,
15219     which can conflict with char lchown(); below.  */
15220 #include <assert.h>
15221 /* Override any gcc2 internal prototype to avoid an error.  */
15222 /* We use char because int might match the return type of a gcc2
15223    builtin and then its argument prototype would still apply.  */
15224 char lchown();
15225 int main() {
15226     /*  The GNU C library defines this for functions which it implements
15227         to always fail with ENOSYS.  Some functions are actually named
15228         something starting with __ and the normal name is an alias.  */
15229 #if defined (__stub_lchown) || defined (__stub___lchown)
15230 choke me
15231 #else
15232 lchown();
15233 #endif
15234 ; return 0; }
15235 EOCP
15236 set try
15237 if eval $compile; then
15238     $echo "lchown() found." >&4
15239     val="$define"
15240 else
15241     $echo "lchown() NOT found." >&4
15242     val="$undef"
15243 fi
15244 set d_lchown
15245 eval $setvar
15246
15247 : See if number of significant digits in a double precision number is known
15248 echo " "
15249 $cat >ldbl_dig.c <<EOM
15250 #$i_limits I_LIMITS
15251 #$i_float I_FLOAT
15252 #ifdef I_LIMITS
15253 #include <limits.h>
15254 #endif
15255 #ifdef I_FLOAT
15256 #include <float.h>
15257 #endif
15258 #ifdef LDBL_DIG
15259 printf("Contains LDBL_DIG");
15260 #endif
15261 EOM
15262 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15263 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15264         echo "LDBL_DIG found." >&4
15265         val="$define"
15266 else
15267         echo "LDBL_DIG NOT found." >&4
15268         val="$undef"
15269 fi
15270 $rm -f ldbl_dig.?
15271 set d_ldbl_dig
15272 eval $setvar
15273
15274 : see if this is a math.h system
15275 set math.h i_math
15276 eval $inhdr
15277
15278 : check to see if math.h defines _LIB_VERSION
15279 d_libm_lib_version="$undef"
15280 case $i_math in
15281     $define)
15282         echo " "
15283         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15284         $cat >try.c <<EOCP
15285 #include <unistd.h>
15286 #include <math.h>
15287 int main (int argc, char *argv[])
15288 {
15289     printf ("%d\n", _LIB_VERSION);
15290     return (0);
15291     } /* main */
15292 EOCP
15293         set try
15294         if eval $compile; then
15295             foo=`$run ./try`
15296             echo "Yes, it does ($foo)" >&4
15297             d_libm_lib_version="$define"
15298         else
15299             echo "No, it does not (probably harmless)" >&4
15300             fi
15301         $rm_try
15302         ;;
15303
15304     esac
15305
15306 : see if link exists
15307 set link d_link
15308 eval $inlibc
15309
15310 : see if localtime_r exists
15311 set localtime_r d_localtime_r
15312 eval $inlibc
15313 case "$d_localtime_r" in
15314 "$define")
15315         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15316         case "$d_localtime_r_proto:$usethreads" in
15317         ":define")      d_localtime_r_proto=define
15318                 set d_localtime_r_proto localtime_r $hdrs
15319                 eval $hasproto ;;
15320         *)      ;;
15321         esac
15322         case "$d_localtime_r_proto" in
15323         define)
15324         case "$localtime_r_proto" in
15325         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15326         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15327         esac
15328         case "$localtime_r_proto" in
15329         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15330         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15331         esac
15332         case "$localtime_r_proto" in
15333         ''|0)   d_localtime_r=undef
15334                 localtime_r_proto=0
15335                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15336         * )     case "$localtime_r_proto" in
15337                 REENTRANT_PROTO*) ;;
15338                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15339                 esac
15340                 echo "Prototype: $try" ;;
15341         esac
15342         ;;
15343         *)      case "$usethreads" in
15344                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15345                 esac
15346                 d_localtime_r=undef
15347                 localtime_r_proto=0
15348                 ;;
15349         esac
15350         ;;
15351 *)      localtime_r_proto=0
15352         ;;
15353 esac
15354
15355 : see if localtime_r calls tzset
15356 case "$localtime_r_proto" in
15357 REENTRANT_PROTO*)
15358         $cat >try.c <<EOCP
15359 /*  Does our libc's localtime_r call tzset ?
15360  *  return 0 if so, 1 otherwise.
15361  */
15362 #$i_systypes    I_SYS_TYPES
15363 #$i_unistd      I_UNISTD
15364 #$i_time        I_TIME
15365 #$i_stdlib      I_STDLIB
15366 #$i_string      I_STRING
15367 #$i_malloc      I_MALLOC
15368 #ifdef I_SYS_TYPES
15369 #  include <sys/types.h>
15370 #endif
15371 #ifdef I_UNISTD
15372 #  include <unistd.h>
15373 #endif
15374 #ifdef I_TIME
15375 #  include <time.h>
15376 #endif
15377 #ifdef I_STDLIB
15378 #include <stdlib.h>
15379 #endif
15380 #ifdef I_STRING
15381 #  include <string.h>
15382 #else
15383 #  include <strings.h>
15384 #endif
15385 #ifdef I_MALLOC
15386 #  include <malloc.h>
15387 #endif
15388 int main()
15389 {
15390     time_t t = time(0L);
15391     char w_tz[]="TZ" "=GMT+5",
15392          e_tz[]="TZ" "=GMT-5",
15393         *tz_e = (char*)malloc(16),
15394         *tz_w = (char*)malloc(16);
15395     struct tm tm_e, tm_w;
15396     memset(&tm_e,'\0',sizeof(struct tm));
15397     memset(&tm_w,'\0',sizeof(struct tm));
15398     strcpy(tz_e,e_tz);
15399     strcpy(tz_w,w_tz);
15400
15401     putenv(tz_e);
15402     localtime_r(&t, &tm_e);
15403
15404     putenv(tz_w);
15405     localtime_r(&t, &tm_w);
15406
15407     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15408         return 1;
15409     return 0;
15410 }
15411 EOCP
15412         set try
15413         if eval $compile; then
15414             if $run ./try; then
15415                 d_localtime_r_needs_tzset=undef;
15416             else
15417                 d_localtime_r_needs_tzset=define;
15418             fi;
15419         else
15420             d_localtime_r_needs_tzset=undef;
15421         fi;
15422      ;;
15423   *)
15424      d_localtime_r_needs_tzset=undef;
15425      ;;
15426 esac
15427 $rm_try
15428
15429 : see if localeconv exists
15430 set localeconv d_locconv
15431 eval $inlibc
15432
15433 : see if lockf exists
15434 set lockf d_lockf
15435 eval $inlibc
15436
15437 : see if prototype for lseek is available
15438 echo " "
15439 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15440 eval $hasproto
15441
15442 : see if lstat exists
15443 set lstat d_lstat
15444 eval $inlibc
15445
15446 : see if madvise exists
15447 set madvise d_madvise
15448 eval $inlibc
15449
15450 : see if malloc_size exists
15451 set malloc_size d_malloc_size
15452 eval $inlibc
15453
15454 : see if malloc_size_good exists
15455 set malloc_good_size d_malloc_good_size
15456 eval $inlibc
15457
15458 : see if mblen exists
15459 set mblen d_mblen
15460 eval $inlibc
15461
15462 : see if mbstowcs exists
15463 set mbstowcs d_mbstowcs
15464 eval $inlibc
15465
15466 : see if mbtowc exists
15467 set mbtowc d_mbtowc
15468 eval $inlibc
15469
15470 : see if memchr exists
15471 set memchr d_memchr
15472 eval $inlibc
15473
15474 : see if memcmp exists
15475 set memcmp d_memcmp
15476 eval $inlibc
15477
15478 : see if memcpy exists
15479 set memcpy d_memcpy
15480 eval $inlibc
15481
15482 : see if memmove exists
15483 set memmove d_memmove
15484 eval $inlibc
15485
15486 : see if memset exists
15487 set memset d_memset
15488 eval $inlibc
15489
15490 : see if mkdir exists
15491 set mkdir d_mkdir
15492 eval $inlibc
15493
15494 : see if mkdtemp exists
15495 set mkdtemp d_mkdtemp
15496 eval $inlibc
15497
15498 : see if mkfifo exists
15499 set mkfifo d_mkfifo
15500 eval $inlibc
15501
15502 : see if mkstemp exists
15503 set mkstemp d_mkstemp
15504 eval $inlibc
15505
15506 : see if mkstemps exists
15507 set mkstemps d_mkstemps
15508 eval $inlibc
15509
15510 : see if mktime exists
15511 set mktime d_mktime
15512 eval $inlibc
15513
15514 : see if this is a sys/mman.h system
15515 set sys/mman.h i_sysmman
15516 eval $inhdr
15517
15518 : see if mmap exists
15519 set mmap d_mmap
15520 eval $inlibc
15521 : see what shmat returns
15522 : default to something harmless
15523 mmaptype='void *'
15524 case "$i_sysmman$d_mmap" in
15525 "$define$define")
15526         $cat >mmap.c <<'END'
15527 #include <sys/mman.h>
15528 void *mmap();
15529 END
15530         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15531                 mmaptype='void *'
15532         else
15533                 mmaptype='caddr_t'
15534         fi
15535         echo "and it returns ($mmaptype)." >&4
15536         ;;
15537 esac
15538
15539
15540
15541 : see if sqrtl exists
15542 set sqrtl d_sqrtl
15543 eval $inlibc
15544
15545 : see if scalbnl exists
15546 set scalbnl d_scalbnl
15547 eval $inlibc
15548
15549 : see if modfl exists
15550 set modfl d_modfl
15551 eval $inlibc
15552
15553 : see if prototype for modfl is available
15554 echo " "
15555 set d_modflproto modfl $i_math math.h
15556 eval $hasproto
15557
15558 d_modfl_pow32_bug="$undef"
15559
15560 case "$d_longdbl$d_modfl" in
15561 $define$define)
15562         $cat <<EOM
15563 Checking to see whether your modfl() is okay for large values...
15564 EOM
15565 $cat >try.c <<EOCP
15566 #include <math.h>
15567 #include <stdio.h>
15568 EOCP
15569 if $test "X$d_modflproto" != "X$define"; then
15570         $cat >>try.c <<EOCP
15571 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15572 long double modfl (long double, long double *);
15573 EOCP
15574 fi
15575 $cat >>try.c <<EOCP
15576 int main() {
15577     long double nv = 4294967303.15;
15578     long double v, w;
15579     v = modfl(nv, &w);
15580 #ifdef __GLIBC__
15581     printf("glibc");
15582 #endif
15583     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15584     return 0;
15585 }
15586 EOCP
15587         case "$osname:$gccversion" in
15588         aix:)   saveccflags="$ccflags"
15589                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15590         esac
15591         set try
15592         if eval $compile; then
15593                 foo=`$run ./try`
15594                 case "$foo" in
15595                 *" 4294967303.150000 1.150000 4294967302.000000")
15596                         echo >&4 "Your modfl() is broken for large values."
15597                         d_modfl_pow32_bug="$define"
15598                         case "$foo" in
15599                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15600                         ;;
15601                         esac
15602                         ;;
15603                 *" 4294967303.150000 0.150000 4294967303.000000")
15604                         echo >&4 "Your modfl() seems okay for large values."
15605                         ;;
15606                 *)      echo >&4 "I don't understand your modfl() at all."
15607                         d_modfl="$undef"
15608                         ;;
15609                 esac
15610                 $rm_try
15611         else
15612                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15613                 d_modfl="$undef"
15614         fi
15615         case "$osname:$gccversion" in
15616         aix:)   ccflags="$saveccflags" ;; # restore
15617         esac
15618         ;;
15619 esac
15620
15621 if $test "$uselongdouble" = "$define"; then
15622     message=""
15623     if $test "$d_sqrtl" != "$define"; then
15624         message="$message sqrtl"
15625     fi
15626     if $test "$d_modfl" != "$define"; then
15627         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15628             echo "You have both aintl and copysignl, so I can emulate modfl."
15629         else
15630             message="$message modfl"
15631         fi
15632     fi
15633     if $test "$d_frexpl" != "$define"; then
15634         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15635             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15636         else
15637             message="$message frexpl"
15638         fi
15639     fi
15640
15641     if $test "$message" != ""; then
15642         $cat <<EOM >&4
15643
15644 *** You requested the use of long doubles but you do not seem to have
15645 *** the following mathematical functions needed for long double support:
15646 ***    $message
15647 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15648 *** Cannot continue, aborting.
15649
15650 EOM
15651
15652         exit 1
15653     fi
15654 fi
15655
15656 : see if mprotect exists
15657 set mprotect d_mprotect
15658 eval $inlibc
15659
15660 : see if msgctl exists
15661 set msgctl d_msgctl
15662 eval $inlibc
15663
15664 : see if msgget exists
15665 set msgget d_msgget
15666 eval $inlibc
15667
15668 : see if msgsnd exists
15669 set msgsnd d_msgsnd
15670 eval $inlibc
15671
15672 : see if msgrcv exists
15673 set msgrcv d_msgrcv
15674 eval $inlibc
15675
15676 : see how much of the 'msg*(2)' library is present.
15677 h_msg=true
15678 echo " "
15679 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15680 *"$undef"*) h_msg=false;;
15681 esac
15682 case "$osname" in
15683 freebsd)
15684     case "`ipcs 2>&1`" in
15685     "SVID messages"*"not configured"*)
15686         echo "Your $osname does not have the msg*(2) configured." >&4
15687         h_msg=false
15688         val="$undef"
15689         set msgctl d_msgctl
15690         eval $setvar
15691         set msgget d_msgget
15692         eval $setvar
15693         set msgsnd d_msgsnd
15694         eval $setvar
15695         set msgrcv d_msgrcv
15696         eval $setvar
15697         ;;
15698     esac
15699     ;;
15700 esac
15701 : we could also check for sys/ipc.h ...
15702 if $h_msg && $test `./findhdr sys/msg.h`; then
15703         echo "You have the full msg*(2) library." >&4
15704         val="$define"
15705 else
15706         echo "You don't have the full msg*(2) library." >&4
15707         val="$undef"
15708 fi
15709 set d_msg
15710 eval $setvar
15711
15712 : Check for msghdr_s
15713 echo " "
15714 echo "Checking to see if your system supports struct msghdr..." >&4
15715 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15716 eval $hasstruct
15717 case "$d_msghdr_s" in
15718 "$define")      echo "Yes, it does."   ;;
15719 *)              echo "No, it doesn't." ;;
15720 esac
15721
15722
15723 : see if msync exists
15724 set msync d_msync
15725 eval $inlibc
15726
15727 : see if munmap exists
15728 set munmap d_munmap
15729 eval $inlibc
15730
15731 : see if nice exists
15732 set nice d_nice
15733 eval $inlibc
15734
15735 : see if this is a langinfo.h system
15736 set langinfo.h i_langinfo
15737 eval $inhdr
15738
15739 : see if nl_langinfo exists
15740 set nl_langinfo d_nl_langinfo
15741 eval $inlibc
15742
15743 : check for volatile keyword
15744 echo " "
15745 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15746 $cat >try.c <<'EOCP'
15747 int main()
15748 {
15749         typedef struct _goo_struct goo_struct;
15750         goo_struct * volatile goo = ((goo_struct *)0);
15751         struct _goo_struct {
15752                 long long_int;
15753                 int reg_int;
15754                 char char_var;
15755         };
15756         typedef unsigned short foo_t;
15757         char *volatile foo;
15758         volatile int bar;
15759         volatile foo_t blech;
15760         foo = foo;
15761 }
15762 EOCP
15763 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15764         val="$define"
15765         echo "Yup, it does."
15766 else
15767         val="$undef"
15768         echo "Nope, it doesn't."
15769 fi
15770 set d_volatile
15771 eval $setvar
15772 $rm_try
15773
15774 : Check basic sizes
15775 echo " "
15776 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15777
15778 case "$use64bitint:$d_quad:$quadtype" in
15779 define:define:?*)
15780         ivtype="$quadtype"
15781         uvtype="$uquadtype"
15782         ivsize=8
15783         uvsize=8
15784         ;;
15785 *)      ivtype="long"
15786         uvtype="unsigned long"
15787         ivsize=$longsize
15788         uvsize=$longsize
15789         ;;
15790 esac
15791
15792 case "$uselongdouble:$d_longdbl" in
15793 define:define)
15794         nvtype="long double"
15795         nvsize=$longdblsize
15796         ;;
15797 *)      nvtype=double
15798         nvsize=$doublesize
15799         ;;
15800 esac
15801
15802 $echo "(IV will be "$ivtype", $ivsize bytes)"
15803 $echo "(UV will be "$uvtype", $uvsize bytes)"
15804 $echo "(NV will be "$nvtype", $nvsize bytes)"
15805
15806 $cat >try.c <<EOCP
15807 #$i_inttypes I_INTTYPES
15808 #ifdef I_INTTYPES
15809 #include <inttypes.h>
15810 #endif
15811 #include <stdio.h>
15812 int main() {
15813 #ifdef INT8
15814    int8_t i =  INT8_MAX;
15815   uint8_t u = UINT8_MAX;
15816   printf("int8_t\n");
15817 #endif
15818 #ifdef INT16
15819    int16_t i =  INT16_MAX;
15820   uint16_t u = UINT16_MAX;
15821   printf("int16_t\n");
15822 #endif
15823 #ifdef INT32
15824    int32_t i =  INT32_MAX;
15825   uint32_t u = UINT32_MAX;
15826   printf("int32_t\n");
15827 #endif
15828 }
15829 EOCP
15830
15831 i8type="signed char"
15832 u8type="unsigned char"
15833 i8size=1
15834 u8size=1
15835
15836 case "$i16type" in
15837 '')     case "$shortsize" in
15838         2)      i16type=short
15839                 u16type="unsigned short"
15840                 i16size=$shortsize
15841                 u16size=$shortsize
15842                 ;;
15843         esac
15844         ;;
15845 esac
15846 case "$i16type" in
15847 '')     set try -DINT16
15848         if eval $compile; then
15849                 case "`$run ./try`" in
15850                 int16_t)
15851                         i16type=int16_t
15852                         u16type=uint16_t
15853                         i16size=2
15854                         u16size=2
15855                         ;;
15856                 esac
15857         fi
15858         ;;
15859 esac
15860 case "$i16type" in
15861 '')     if $test $shortsize -ge 2; then
15862                 i16type=short
15863                 u16type="unsigned short"
15864                 i16size=$shortsize
15865                 u16size=$shortsize
15866         fi
15867         ;;
15868 esac
15869
15870 case "$i32type" in
15871 '')     case "$longsize" in
15872         4)      i32type=long
15873                 u32type="unsigned long"
15874                 i32size=$longsize
15875                 u32size=$longsize
15876                 ;;
15877         *)      case "$intsize" in
15878                 4)      i32type=int
15879                         u32type="unsigned int"
15880                         i32size=$intsize
15881                         u32size=$intsize
15882                         ;;
15883                 esac
15884                 ;;
15885         esac
15886         ;;
15887 esac
15888 case "$i32type" in
15889 '')     set try -DINT32
15890         if eval $compile; then
15891                 case "`$run ./try`" in
15892                 int32_t)
15893                         i32type=int32_t
15894                         u32type=uint32_t
15895                         i32size=4
15896                         u32size=4
15897                         ;;
15898                 esac
15899         fi
15900         ;;
15901 esac
15902 case "$i32type" in
15903 '')     if $test $intsize -ge 4; then
15904                 i32type=int
15905                 u32type="unsigned int"
15906                 i32size=$intsize
15907                 u32size=$intsize
15908         fi
15909         ;;
15910 esac
15911
15912 case "$i64type" in
15913 '')     case "$d_quad:$quadtype" in
15914         define:?*)
15915                 i64type="$quadtype"
15916                 u64type="$uquadtype"
15917                 i64size=8
15918                 u64size=8
15919                 ;;
15920         esac
15921         ;;
15922 esac
15923
15924 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15925 : volatile so that the compiler has to store it out to memory.
15926 if test X"$d_volatile" = X"$define"; then
15927         volatile=volatile
15928 fi
15929 $cat <<EOP >try.c
15930 #include <stdio.h>
15931 #$i_stdlib I_STDLIB
15932 #ifdef I_STDLIB
15933 #include <stdlib.h>
15934 #endif
15935 #include <sys/types.h>
15936 #include <signal.h>
15937 #ifdef SIGFPE
15938 $volatile int bletched = 0;
15939 $signal_t blech(int s) { bletched = 1; }
15940 #endif
15941 int main() {
15942     $uvtype u = 0;
15943     $nvtype d;
15944     int     n = 8 * $uvsize;
15945     int     i;
15946 #ifdef SIGFPE
15947     signal(SIGFPE, blech);
15948 #endif
15949
15950     for (i = 0; i < n; i++) {
15951       u = u << 1 | ($uvtype)1;
15952       d = ($nvtype)u;
15953       if (($uvtype)d != u)
15954         break;
15955       if (d <= 0)
15956         break;
15957       d = ($nvtype)(u - 1);
15958       if (($uvtype)d != (u - 1))
15959         break;
15960 #ifdef SIGFPE
15961       if (bletched)
15962         break;
15963 #endif
15964     }
15965     printf("%d\n", ((i == n) ? -n : i));
15966     exit(0);
15967 }
15968 EOP
15969 set try
15970
15971 d_nv_preserves_uv="$undef"
15972 if eval $compile; then
15973         nv_preserves_uv_bits="`$run ./try`"
15974 fi
15975 case "$nv_preserves_uv_bits" in
15976 \-[1-9]*)
15977         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15978         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15979         d_nv_preserves_uv="$define"
15980         ;;
15981 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15982         d_nv_preserves_uv="$undef" ;;
15983 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15984         nv_preserves_uv_bits="0" ;;
15985 esac
15986 $rm_try
15987
15988 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15989 : volatile so that the compiler has to store it out to memory.
15990 if test X"$d_volatile" = X"$define"; then
15991         volatile=volatile
15992 fi
15993 $cat <<EOP >try.c
15994 #include <stdio.h>
15995
15996 typedef $nvtype NV;
15997
15998 int
15999 main() {
16000   NV value = 2;
16001   int count = 1;
16002
16003   while(count < 256) {
16004     $volatile NV up = value + 1.0;
16005     $volatile NV negated = -value;
16006     $volatile NV down = negated - 1.0;
16007     $volatile NV got_up = up - value;
16008     int up_good = got_up == 1.0;
16009     int got_down = down - negated;
16010     int down_good = got_down == -1.0;
16011
16012     if (down_good != up_good) {
16013       fprintf(stderr,
16014               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16015               up_good, (double) got_up, down_good, (double) got_down,
16016               count, (double) value);
16017       return 1;
16018     }
16019     if (!up_good) {
16020       while (1) {
16021         if (count > 8) {
16022           count -= 8;
16023           fputs("256.0", stdout);
16024         } else {
16025           count--;
16026           fputs("2.0", stdout);
16027         }
16028         if (!count) {
16029           puts("");
16030           return 0;
16031         }
16032         fputs("*", stdout);
16033       }
16034     }
16035     value *= 2;
16036     ++count;
16037   }
16038   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16039           count, (double) value);
16040   return 1;
16041 }
16042 EOP
16043 set try
16044
16045 nv_overflows_integers_at='0'
16046 if eval $compile; then
16047     xxx="`$run ./try`"
16048     case "$?" in
16049         0)
16050             case "$xxx" in
16051                 2*)  cat >&4 <<EOM
16052 The largest integer your NVs can preserve is equal to $xxx
16053 EOM
16054                     nv_overflows_integers_at="$xxx"
16055                     ;;
16056                 *)  cat >&4 <<EOM
16057 Cannot determine the largest integer value your NVs can hold, unexpected output
16058 '$xxx'
16059 EOM
16060                     ;;
16061             esac
16062             ;;
16063         *)  cat >&4 <<EOM
16064 Cannot determine the largest integer value your NVs can hold
16065 EOM
16066             ;;
16067     esac
16068 fi
16069 $rm_try
16070
16071 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16072 : volatile so that the compiler has to store it out to memory.
16073 if test X"$d_volatile" = X"$define"; then
16074         volatile=volatile
16075 fi
16076 $cat <<EOP >try.c
16077 #include <stdio.h>
16078 #$i_stdlib I_STDLIB
16079 #ifdef I_STDLIB
16080 #include <stdlib.h>
16081 #endif
16082 #$i_string I_STRING
16083 #ifdef I_STRING
16084 #  include <string.h>
16085 #else
16086 #  include <strings.h>
16087 #endif
16088 #include <sys/types.h>
16089 #include <signal.h>
16090 #ifdef SIGFPE
16091 $volatile int bletched = 0;
16092 $signal_t blech(int s) { bletched = 1; }
16093 #endif
16094
16095 int checkit($nvtype d, char *where) {
16096     unsigned char *p = (char *)&d;
16097     unsigned char *end = p + sizeof(d);
16098     int fail = 0;
16099
16100     while (p < end)
16101         fail += *p++;
16102
16103     if (!fail)
16104         return 0;
16105
16106     p = (char *)&d;
16107     printf("No - %s: 0x", where);
16108     while (p < end)
16109         printf ("%02X", *p++);
16110     printf("\n");
16111     return 1;
16112 }
16113
16114 int main(int argc, char **argv) {
16115     $nvtype d = 0.0;
16116     int fail = 0;
16117     fail += checkit(d, "0.0");
16118
16119     /* The compiler shouldn't be assuming that bletched is 0  */
16120     d = bletched;
16121
16122     fail += checkit(d, "bleched");
16123
16124 #ifdef SIGFPE
16125     signal(SIGFPE, blech);
16126 #endif
16127
16128     /* Paranoia - the compiler should have no way of knowing that ANSI says
16129        that argv[argc] will always be NULL.  Actually, if it did assume this it
16130        would be buggy, as this is C and main() can be called from elsewhere in
16131        the program.  */
16132     d = argv[argc] ? 1 : 0;
16133
16134     if (d) {
16135         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16136     }
16137
16138     fail += checkit(d, "ternary");
16139
16140     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16141
16142     if (d != 0.0) {
16143         printf("No - memset doesn't give 0.0\n");
16144         /* This might just blow up:  */
16145         printf("(gives %g)\n", d);
16146         return 1;
16147     }
16148
16149 #ifdef SIGFPE
16150     if (bletched) {
16151         printf("No - something bleched\n");
16152         return 1;
16153     }
16154 #endif
16155     if (fail) {
16156       printf("No - %d fail(s)\n", fail);
16157       return 1;
16158     }
16159     printf("Yes\n");
16160     return 0;
16161 }
16162 EOP
16163 set try
16164
16165 d_nv_zero_is_allbits_zero="$undef"
16166 if eval $compile; then
16167     xxx="`$run ./try`"
16168     case "$?" in
16169         0)
16170             case "$xxx" in
16171                 Yes)  cat >&4 <<EOM
16172 0.0 is represented as all bits zero in memory
16173 EOM
16174                     d_nv_zero_is_allbits_zero="$define"
16175                     ;;
16176                 *)  cat >&4 <<EOM
16177 0.0 is not represented as all bits zero in memory
16178 EOM
16179                     d_nv_zero_is_allbits_zero="$undef"
16180                     ;;
16181             esac
16182             ;;
16183         *)  cat >&4 <<EOM
16184 0.0 is not represented as all bits zero in memory
16185 EOM
16186             d_nv_zero_is_allbits_zero="$undef"
16187             ;;
16188     esac
16189 fi
16190 $rm_try
16191
16192 : check for off64_t
16193 echo " "
16194 echo "Checking to see if you have off64_t..." >&4
16195 $cat >try.c <<EOCP
16196 #include <sys/types.h>
16197 #include <unistd.h>
16198 int main() { off64_t x = 7; }
16199 EOCP
16200 set try
16201 if eval $compile; then
16202         val="$define"
16203         echo "You have off64_t."
16204 else
16205         val="$undef"
16206         echo "You do not have off64_t."
16207         case "$lseeksize" in
16208         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16209         esac
16210 fi
16211 $rm_try
16212 set d_off64_t
16213 eval $setvar
16214
16215 : how to create joinable pthreads
16216 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16217         echo " "
16218         echo "Checking what constant to use for creating joinable pthreads..." >&4
16219         $cat >try.c <<'EOCP'
16220 #include <pthread.h>
16221 int main() {
16222     int detachstate = JOINABLE;
16223 }
16224 EOCP
16225         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16226         if eval $compile; then
16227                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16228                 val="$undef" # Yes, undef.
16229                 set d_old_pthread_create_joinable
16230                 eval $setvar
16231                 val=""
16232                 set old_pthread_create_joinable
16233                 eval $setvar
16234         else
16235                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16236                 if eval $compile; then
16237                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16238                         val="$define"
16239                         set d_old_pthread_create_joinable
16240                         eval $setvar
16241                         val=PTHREAD_CREATE_UNDETACHED
16242                         set old_pthread_create_joinable
16243                         eval $setvar
16244                 else
16245                         set try -DJOINABLE=__UNDETACHED
16246                         if eval $compile; then
16247                                 echo "You seem to use __UNDETACHED." >&4
16248                                 val="$define"
16249                                 set d_old_pthread_create_joinable
16250                                 eval $setvar
16251                                 val=__UNDETACHED
16252                                 set old_pthread_create_joinable
16253                                 eval $setvar
16254                         else
16255                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16256                                 val="$define"
16257                                 set d_old_pthread_create_joinable
16258                                 eval $setvar
16259                                 val=0
16260                                 set old_pthread_create_joinable
16261                                 eval $setvar
16262                         fi
16263                 fi
16264         fi
16265         $rm_try
16266 else
16267     d_old_pthread_create_joinable="$undef"
16268     old_pthread_create_joinable=""
16269 fi
16270
16271 : see if pause exists
16272 set pause d_pause
16273 eval $inlibc
16274
16275 : see if poll exists
16276 set poll d_poll
16277 eval $inlibc
16278
16279 : see if prctl exists
16280 set prctl d_prctl
16281 eval $inlibc
16282
16283 : see if prctl supports PR_SET_NAME
16284 d_prctl_set_name=$undef
16285 case $d_prctl in
16286     $define)
16287         $cat >try.c <<EOM
16288 #include <sys/prctl.h>
16289
16290 int main (int argc, char *argv[])
16291 {
16292     return (prctl (PR_SET_NAME, "Test"));
16293     } /* main */
16294 EOM
16295         set try
16296         if eval $compile_ok && $run ./try; then
16297             echo "Your prctl (PR_SET_NAME, ...) works"
16298             d_prctl_set_name=$define
16299             fi
16300         $rm_try
16301         ;;
16302     esac
16303
16304 : see if readlink exists
16305 set readlink d_readlink
16306 eval $inlibc
16307
16308 : Check if exe is symlink to abs path of executing program
16309 echo " "
16310 procselfexe=''
16311 val="$undef"
16312 case "$d_readlink" in
16313     "$define")
16314         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16315         : more tidy to avoid an extra level of symlink
16316         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16317         while test $# -gt 0; do
16318             type=$1; try=$2
16319             shift; shift
16320             if $issymlink $try; then
16321                 $ls -l $try > reflect
16322                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16323                     echo "You have $type-like $try."
16324                     procselfexe='"'$try'"'
16325                     val="$define"
16326                     : This will break out of the loop
16327                     set X; shift
16328                 fi
16329             fi
16330         done
16331         ;;
16332 esac
16333 $rm -f reflect
16334 set d_procselfexe
16335 eval $setvar
16336
16337 : backward compatibility for d_hvfork
16338 if test X$d_hvfork != X; then
16339         d_vfork="$d_hvfork"
16340         d_hvfork=''
16341 fi
16342 : see if there is a vfork
16343 val=''
16344 set vfork val
16345 eval $inlibc
16346
16347 d_pseudofork=$undef
16348
16349 : Ok, but do we want to use it. vfork is reportedly unreliable in
16350 : perl on Solaris 2.x, and probably elsewhere.
16351 case "$val" in
16352 $define)
16353         echo " "
16354         case "$usevfork" in
16355         false) dflt='n';;
16356         *) dflt='y';;
16357         esac
16358         cat <<'EOM'
16359
16360 Perl can only use a vfork() that doesn't suffer from strict
16361 restrictions on calling functions or modifying global data in
16362 the child.  For example, glibc-2.1 contains such a vfork()
16363 that is unsuitable.  If your system provides a proper fork()
16364 call, chances are that you do NOT want perl to use vfork().
16365
16366 EOM
16367         rp="Do you still want to use vfork()?"
16368         . ./myread
16369         case "$ans" in
16370         y|Y) ;;
16371         *)
16372                 echo "Ok, we won't use vfork()."
16373                 val="$undef"
16374                 ;;
16375         esac
16376         ;;
16377 esac
16378 set d_vfork
16379 eval $setvar
16380 case "$d_vfork" in
16381 $define) usevfork='true';;
16382 *) usevfork='false';;
16383 esac
16384
16385 : see whether the pthread_atfork exists
16386 $cat >try.c <<EOP
16387 #include <pthread.h>
16388 #include <stdio.h>
16389 int main() {
16390 #ifdef  PTHREAD_ATFORK
16391         pthread_atfork(NULL,NULL,NULL);
16392 #endif
16393 }
16394 EOP
16395
16396 : see if pthread_atfork exists
16397 set try -DPTHREAD_ATFORK
16398 if eval $compile; then
16399     val="$define"
16400 else
16401     val="$undef"
16402 fi
16403 case "$usethreads" in
16404 $define)
16405         case "$val" in
16406         $define) echo 'pthread_atfork found.' >&4        ;;
16407         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16408         esac
16409 esac
16410 set d_pthread_atfork
16411 eval $setvar
16412
16413 : see if pthread_attr_setscope exists
16414 set pthread_attr_setscope d_pthread_attr_setscope
16415 eval $inlibc
16416
16417 : see whether the various POSIXish _yields exist
16418 $cat >try.c <<EOP
16419 #include <pthread.h>
16420 #include <stdio.h>
16421 int main() {
16422 #ifdef SCHED_YIELD
16423         sched_yield();
16424 #else
16425 #ifdef PTHREAD_YIELD
16426         pthread_yield();
16427 #else
16428 #ifdef PTHREAD_YIELD_NULL
16429         pthread_yield(NULL);
16430 #endif
16431 #endif
16432 #endif
16433 }
16434 EOP
16435 : see if sched_yield exists
16436 set try -DSCHED_YIELD
16437 if eval $compile; then
16438     val="$define"
16439     sched_yield='sched_yield()'
16440 else
16441     val="$undef"
16442 fi
16443 case "$usethreads" in
16444 $define)
16445         case "$val" in
16446         $define) echo 'sched_yield() found.' >&4        ;;
16447         *)       echo 'sched_yield() NOT found.' >&4    ;;
16448         esac
16449 esac
16450 set d_sched_yield
16451 eval $setvar
16452
16453 : see if pthread_yield exists
16454 set try -DPTHREAD_YIELD
16455 if eval $compile; then
16456     val="$define"
16457     case "$sched_yield" in
16458     '') sched_yield='pthread_yield()' ;;
16459     esac
16460 else
16461     set try -DPTHREAD_YIELD_NULL
16462     if eval $compile; then
16463         val="$define"
16464         case "$sched_yield" in
16465         '') sched_yield='pthread_yield(NULL)' ;;
16466         esac
16467     else
16468         val="$undef"
16469     fi
16470 fi
16471 case "$usethreads" in
16472 $define)
16473         case "$val" in
16474         $define) echo 'pthread_yield() found.' >&4      ;;
16475         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16476         esac
16477         ;;
16478 esac
16479 set d_pthread_yield
16480 eval $setvar
16481 case "$sched_yield" in
16482 '') sched_yield=undef ;;
16483 esac
16484 $rm_try
16485
16486 : see if random_r exists
16487 set random_r d_random_r
16488 eval $inlibc
16489 case "$d_random_r" in
16490 "$define")
16491         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16492         case "$d_random_r_proto:$usethreads" in
16493         ":define")      d_random_r_proto=define
16494                 set d_random_r_proto random_r $hdrs
16495                 eval $hasproto ;;
16496         *)      ;;
16497         esac
16498         case "$d_random_r_proto" in
16499         define)
16500         case "$random_r_proto" in
16501         ''|0) try='int random_r(int*, struct random_data*);'
16502         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16503         esac
16504         case "$random_r_proto" in
16505         ''|0) try='int random_r(long*, struct random_data*);'
16506         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16507         esac
16508         case "$random_r_proto" in
16509         ''|0) try='int random_r(struct random_data*, int32_t*);'
16510         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16511         esac
16512         case "$random_r_proto" in
16513         ''|0)   d_random_r=undef
16514                 random_r_proto=0
16515                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16516         * )     case "$random_r_proto" in
16517                 REENTRANT_PROTO*) ;;
16518                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16519                 esac
16520                 echo "Prototype: $try" ;;
16521         esac
16522         ;;
16523         *)      case "$usethreads" in
16524                 define) echo "random_r has no prototype, not using it." >&4 ;;
16525                 esac
16526                 d_random_r=undef
16527                 random_r_proto=0
16528                 ;;
16529         esac
16530         ;;
16531 *)      random_r_proto=0
16532         ;;
16533 esac
16534
16535 : see if readdir and friends exist
16536 set readdir d_readdir
16537 eval $inlibc
16538 set seekdir d_seekdir
16539 eval $inlibc
16540 set telldir d_telldir
16541 eval $inlibc
16542 set rewinddir d_rewinddir
16543 eval $inlibc
16544
16545 : see if readdir64_r exists
16546 set readdir64_r d_readdir64_r
16547 eval $inlibc
16548 case "$d_readdir64_r" in
16549 "$define")
16550         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16551         case "$d_readdir64_r_proto:$usethreads" in
16552         ":define")      d_readdir64_r_proto=define
16553                 set d_readdir64_r_proto readdir64_r $hdrs
16554                 eval $hasproto ;;
16555         *)      ;;
16556         esac
16557         case "$d_readdir64_r_proto" in
16558         define)
16559         case "$readdir64_r_proto" in
16560         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16561         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16562         esac
16563         case "$readdir64_r_proto" in
16564         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16565         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16566         esac
16567         case "$readdir64_r_proto" in
16568         ''|0)   d_readdir64_r=undef
16569                 readdir64_r_proto=0
16570                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16571         * )     case "$readdir64_r_proto" in
16572                 REENTRANT_PROTO*) ;;
16573                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16574                 esac
16575                 echo "Prototype: $try" ;;
16576         esac
16577         ;;
16578         *)      case "$usethreads" in
16579                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16580                 esac
16581                 d_readdir64_r=undef
16582                 readdir64_r_proto=0
16583                 ;;
16584         esac
16585         ;;
16586 *)      readdir64_r_proto=0
16587         ;;
16588 esac
16589
16590 : see if readdir_r exists
16591 set readdir_r d_readdir_r
16592 eval $inlibc
16593 case "$d_readdir_r" in
16594 "$define")
16595         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16596         case "$d_readdir_r_proto:$usethreads" in
16597         ":define")      d_readdir_r_proto=define
16598                 set d_readdir_r_proto readdir_r $hdrs
16599                 eval $hasproto ;;
16600         *)      ;;
16601         esac
16602         case "$d_readdir_r_proto" in
16603         define)
16604         case "$readdir_r_proto" in
16605         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16606         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16607         esac
16608         case "$readdir_r_proto" in
16609         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16610         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16611         esac
16612         case "$readdir_r_proto" in
16613         ''|0)   d_readdir_r=undef
16614                 readdir_r_proto=0
16615                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16616         * )     case "$readdir_r_proto" in
16617                 REENTRANT_PROTO*) ;;
16618                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16619                 esac
16620                 echo "Prototype: $try" ;;
16621         esac
16622         ;;
16623         *)      case "$usethreads" in
16624                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16625                 esac
16626                 d_readdir_r=undef
16627                 readdir_r_proto=0
16628                 ;;
16629         esac
16630         ;;
16631 *)      readdir_r_proto=0
16632         ;;
16633 esac
16634
16635 : see if readv exists
16636 set readv d_readv
16637 eval $inlibc
16638
16639 : see if recvmsg exists
16640 set recvmsg d_recvmsg
16641 eval $inlibc
16642
16643 : see if rename exists
16644 set rename d_rename
16645 eval $inlibc
16646
16647 : see if rmdir exists
16648 set rmdir d_rmdir
16649 eval $inlibc
16650
16651 : see if memory.h is available.
16652 val=''
16653 set memory.h val
16654 eval $inhdr
16655
16656 : See if it conflicts with string.h
16657 case "$val" in
16658 $define)
16659         case "$strings" in
16660         '') ;;
16661         *)
16662                 $cppstdin $cppflags $cppminus < $strings > mem.h
16663                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16664                         echo " "
16665                         echo "We won't be including <memory.h>."
16666                         val="$undef"
16667                 fi
16668                 $rm -f mem.h
16669                 ;;
16670         esac
16671 esac
16672 set i_memory
16673 eval $setvar
16674
16675 : can bcopy handle overlapping blocks?
16676 echo " "
16677 val="$undef"
16678 case "$d_memmove" in
16679 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16680 *)      case "$d_bcopy" in
16681         "$define")
16682                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16683                 $cat >try.c <<EOCP
16684 #$i_memory I_MEMORY
16685 #$i_stdlib I_STDLIB
16686 #$i_string I_STRING
16687 #$i_unistd I_UNISTD
16688 EOCP
16689         $cat >>try.c <<'EOCP'
16690 #include <stdio.h>
16691 #ifdef I_MEMORY
16692 #  include <memory.h>
16693 #endif
16694 #ifdef I_STDLIB
16695 #  include <stdlib.h>
16696 #endif
16697 #ifdef I_STRING
16698 #  include <string.h>
16699 #else
16700 #  include <strings.h>
16701 #endif
16702 #ifdef I_UNISTD
16703 #  include <unistd.h>  /* Needed for NetBSD */
16704 #endif
16705 int main()
16706 {
16707 char buf[128], abc[128];
16708 char *b;
16709 int len;
16710 int off;
16711 int align;
16712
16713 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16714    try to store the string in read-only memory. */
16715 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16716
16717 for (align = 7; align >= 0; align--) {
16718         for (len = 36; len; len--) {
16719                 b = buf+align;
16720                 bcopy(abc, b, len);
16721                 for (off = 1; off <= len; off++) {
16722                         bcopy(b, b+off, len);
16723                         bcopy(b+off, b, len);
16724                         if (bcmp(b, abc, len))
16725                                 exit(1);
16726                 }
16727         }
16728 }
16729 exit(0);
16730 }
16731 EOCP
16732                 set try
16733                 if eval $compile_ok; then
16734                         if $run ./try 2>/dev/null; then
16735                                 echo "Yes, it can."
16736                                 val="$define"
16737                         else
16738                                 echo "It can't, sorry."
16739                         fi
16740                 else
16741                         echo "(I can't compile the test program, so we'll assume not...)"
16742                 fi
16743                 ;;
16744         esac
16745         $rm_try
16746         ;;
16747 esac
16748 set d_safebcpy
16749 eval $setvar
16750
16751 : can memcpy handle overlapping blocks?
16752 echo " "
16753 val="$undef"
16754 case "$d_memmove" in
16755 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16756 *)      case "$d_memcpy" in
16757         "$define")
16758                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16759                 $cat >try.c <<EOCP
16760 #$i_memory I_MEMORY
16761 #$i_stdlib I_STDLIB
16762 #$i_string I_STRING
16763 #$i_unistd I_UNISTD
16764 EOCP
16765         $cat >>try.c <<'EOCP'
16766 #include <stdio.h>
16767 #ifdef I_MEMORY
16768 #  include <memory.h>
16769 #endif
16770 #ifdef I_STDLIB
16771 #  include <stdlib.h>
16772 #endif
16773 #ifdef I_STRING
16774 #  include <string.h>
16775 #else
16776 #  include <strings.h>
16777 #endif
16778 #ifdef I_UNISTD
16779 #  include <unistd.h>  /* Needed for NetBSD */
16780 #endif
16781 int main()
16782 {
16783 char buf[128], abc[128];
16784 char *b;
16785 int len;
16786 int off;
16787 int align;
16788
16789 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16790    try to store the string in read-only memory. */
16791 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16792
16793 for (align = 7; align >= 0; align--) {
16794         for (len = 36; len; len--) {
16795                 b = buf+align;
16796                 memcpy(b, abc, len);
16797                 for (off = 1; off <= len; off++) {
16798                         memcpy(b+off, b, len);
16799                         memcpy(b, b+off, len);
16800                         if (memcmp(b, abc, len))
16801                                 exit(1);
16802                 }
16803         }
16804 }
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 "It can't, sorry."
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         ;;
16823 esac
16824 set d_safemcpy
16825 eval $setvar
16826
16827 : can memcmp be trusted to compare relative magnitude?
16828 val="$undef"
16829 case "$d_memcmp" in
16830 "$define")
16831         echo " "
16832         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16833         $cat >try.c <<EOCP
16834 #$i_memory I_MEMORY
16835 #$i_stdlib I_STDLIB
16836 #$i_string I_STRING
16837 #$i_unistd I_UNISTD
16838 EOCP
16839         $cat >>try.c <<'EOCP'
16840 #include <stdio.h>
16841 #ifdef I_MEMORY
16842 #  include <memory.h>
16843 #endif
16844 #ifdef I_STDLIB
16845 #  include <stdlib.h>
16846 #endif
16847 #ifdef I_STRING
16848 #  include <string.h>
16849 #else
16850 #  include <strings.h>
16851 #endif
16852 #ifdef I_UNISTD
16853 #  include <unistd.h>  /* Needed for NetBSD */
16854 #endif
16855 int main()
16856 {
16857 char a = -1;
16858 char b = 0;
16859 if ((a < b) && memcmp(&a, &b, 1) < 0)
16860         exit(1);
16861 exit(0);
16862 }
16863 EOCP
16864         set try
16865         if eval $compile_ok; then
16866                 if $run ./try 2>/dev/null; then
16867                         echo "Yes, it can."
16868                         val="$define"
16869                 else
16870                         echo "No, it can't (it uses signed chars)."
16871                 fi
16872         else
16873                 echo "(I can't compile the test program, so we'll assume not...)"
16874         fi
16875         ;;
16876 esac
16877 $rm_try
16878 set d_sanemcmp
16879 eval $setvar
16880
16881 : see if prototype for sbrk is available
16882 echo " "
16883 set d_sbrkproto sbrk $i_unistd unistd.h
16884 eval $hasproto
16885
16886 : see if select exists
16887 set select d_select
16888 eval $inlibc
16889
16890 : see if semctl exists
16891 set semctl d_semctl
16892 eval $inlibc
16893
16894 : see if semget exists
16895 set semget d_semget
16896 eval $inlibc
16897
16898 : see if semop exists
16899 set semop d_semop
16900 eval $inlibc
16901
16902 : see how much of the 'sem*(2)' library is present.
16903 h_sem=true
16904 echo " "
16905 case "$d_semctl$d_semget$d_semop" in
16906 *"$undef"*) h_sem=false;;
16907 esac
16908 case "$osname" in
16909 freebsd)
16910     case "`ipcs 2>&1`" in
16911     "SVID messages"*"not configured"*)
16912         echo "Your $osname does not have the sem*(2) configured." >&4
16913         h_sem=false
16914         val="$undef"
16915         set semctl d_semctl
16916         eval $setvar
16917         set semget d_semget
16918         eval $setvar
16919         set semop d_semop
16920         eval $setvar
16921         ;;
16922     esac
16923     ;;
16924 esac
16925 : we could also check for sys/ipc.h ...
16926 if $h_sem && $test `./findhdr sys/sem.h`; then
16927         echo "You have the full sem*(2) library." >&4
16928         val="$define"
16929 else
16930         echo "You don't have the full sem*(2) library." >&4
16931         val="$undef"
16932 fi
16933 set d_sem
16934 eval $setvar
16935
16936 : see whether sys/sem.h defines union semun
16937 echo " "
16938 $cat > try.c <<'END'
16939 #include <sys/types.h>
16940 #include <sys/ipc.h>
16941 #include <sys/sem.h>
16942 int main () { union semun semun; semun.buf = 0; }
16943 END
16944 set try
16945 if eval $compile; then
16946     echo "You have union semun in <sys/sem.h>." >&4
16947     val="$define"
16948 else
16949     echo "You do not have union semun in <sys/sem.h>." >&4
16950     val="$undef"
16951 fi
16952 $rm_try
16953 set d_union_semun
16954 eval $setvar
16955
16956 : see how to do semctl IPC_STAT
16957 case "$d_sem" in
16958 $define)
16959     echo " "
16960     $cat > tryh.h <<END
16961 #ifndef S_IRUSR
16962 #   ifdef S_IREAD
16963 #       define S_IRUSR S_IREAD
16964 #       define S_IWUSR S_IWRITE
16965 #       define S_IXUSR S_IEXEC
16966 #   else
16967 #       define S_IRUSR 0400
16968 #       define S_IWUSR 0200
16969 #       define S_IXUSR 0100
16970 #   endif
16971 #   define S_IRGRP (S_IRUSR>>3)
16972 #   define S_IWGRP (S_IWUSR>>3)
16973 #   define S_IXGRP (S_IXUSR>>3)
16974 #   define S_IROTH (S_IRUSR>>6)
16975 #   define S_IWOTH (S_IWUSR>>6)
16976 #   define S_IXOTH (S_IXUSR>>6)
16977 #endif
16978 #ifndef S_IRWXU
16979 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16980 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16981 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16982 #endif
16983 END
16984     : see whether semctl IPC_STAT can use union semun
16985     case "$d_semctl_semun" in
16986     '')
16987       val="$undef"
16988       $cat > try.c <<END
16989 #include <sys/types.h>
16990 #include <sys/ipc.h>
16991 #include <sys/sem.h>
16992 #include <sys/stat.h>
16993 #include <stdio.h>
16994 #include <errno.h>
16995 #include "tryh.h"
16996 #ifndef errno
16997 extern int errno;
16998 #endif
16999 #$d_union_semun HAS_UNION_SEMUN
17000 int main() {
17001     union semun
17002 #ifndef HAS_UNION_SEMUN
17003     {
17004         int val;
17005         struct semid_ds *buf;
17006         unsigned short *array;
17007     }
17008 #endif
17009     arg;
17010     int sem, st;
17011
17012 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17013     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17014     if (sem > -1) {
17015         struct semid_ds argbuf;
17016         arg.buf = &argbuf;
17017 #       ifdef IPC_STAT
17018         st = semctl(sem, 0, IPC_STAT, arg);
17019         if (st == 0)
17020             printf("semun\n");
17021         else
17022 #       endif /* IPC_STAT */
17023             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17024 #       ifdef IPC_RMID
17025         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17026 #       endif /* IPC_RMID */
17027             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17028     } else
17029 #endif /* IPC_PRIVATE && ... */
17030         printf("semget failed: errno = %d\n", errno);
17031   return 0;
17032 }
17033 END
17034       set try
17035       if eval $compile; then
17036           xxx=`$run ./try`
17037           case "$xxx" in
17038           semun) val="$define" ;;
17039           esac
17040       fi
17041       $rm_try
17042       set d_semctl_semun
17043       eval $setvar
17044       ;;
17045     esac
17046     case "$d_semctl_semun" in
17047     $define)
17048         echo "You can use union semun for semctl IPC_STAT." >&4
17049         also='also'
17050         ;;
17051     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17052         also=''
17053         ;;
17054     esac
17055
17056     : see whether semctl IPC_STAT can use struct semid_ds pointer
17057     case "$d_semctl_semid_ds" in
17058     '')
17059       val="$undef"
17060       $cat > try.c <<'END'
17061 #include <sys/types.h>
17062 #include <sys/ipc.h>
17063 #include <sys/sem.h>
17064 #include <sys/stat.h>
17065 #include "tryh.h"
17066 #include <stdio.h>
17067 #include <errno.h>
17068 #ifndef errno
17069 extern int errno;
17070 #endif
17071 int main() {
17072     struct semid_ds arg;
17073     int sem, st;
17074
17075 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17076     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17077     if (sem > -1) {
17078 #       ifdef IPC_STAT
17079         st = semctl(sem, 0, IPC_STAT, &arg);
17080         if (st == 0)
17081             printf("semid_ds\n");
17082         else
17083 #       endif /* IPC_STAT */
17084             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17085 #       ifdef IPC_RMID
17086         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17087 #       endif /* IPC_RMID */
17088             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17089     } else
17090 #endif /* IPC_PRIVATE && ... */
17091         printf("semget failed: errno = %d\n", errno);
17092
17093     return 0;
17094 }
17095 END
17096       set try
17097       if eval $compile; then
17098           xxx=`$run ./try`
17099           case "$xxx" in
17100           semid_ds) val="$define" ;;
17101           esac
17102       fi
17103       $rm_try
17104       set d_semctl_semid_ds
17105       eval $setvar
17106       ;;
17107     esac
17108     case "$d_semctl_semid_ds" in
17109     $define)
17110         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17111         ;;
17112     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17113         ;;
17114     esac
17115     ;;
17116 *)  val="$undef"
17117
17118     # We do not have the full sem*(2) library, so assume we can not
17119     # use either.
17120
17121     set d_semctl_semun
17122     eval $setvar
17123
17124     set d_semctl_semid_ds
17125     eval $setvar
17126     ;;
17127 esac
17128 $rm_try tryh.h
17129
17130 : see if sendmsg exists
17131 set sendmsg d_sendmsg
17132 eval $inlibc
17133
17134 : see if setegid exists
17135 set setegid d_setegid
17136 eval $inlibc
17137
17138 : see if seteuid exists
17139 set seteuid d_seteuid
17140 eval $inlibc
17141
17142 : see if setgrent exists
17143 set setgrent d_setgrent
17144 eval $inlibc
17145
17146 : see if setgrent_r exists
17147 set setgrent_r d_setgrent_r
17148 eval $inlibc
17149 case "$d_setgrent_r" in
17150 "$define")
17151         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17152         case "$d_setgrent_r_proto:$usethreads" in
17153         ":define")      d_setgrent_r_proto=define
17154                 set d_setgrent_r_proto setgrent_r $hdrs
17155                 eval $hasproto ;;
17156         *)      ;;
17157         esac
17158         case "$d_setgrent_r_proto" in
17159         define)
17160         case "$setgrent_r_proto" in
17161         ''|0) try='int setgrent_r(FILE**);'
17162         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17163         esac
17164         case "$setgrent_r_proto" in
17165         ''|0) try='void setgrent_r(FILE**);'
17166         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17167         esac
17168         case "$setgrent_r_proto" in
17169         ''|0)   d_setgrent_r=undef
17170                 setgrent_r_proto=0
17171                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17172         * )     case "$setgrent_r_proto" in
17173                 REENTRANT_PROTO*) ;;
17174                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17175                 esac
17176                 echo "Prototype: $try" ;;
17177         esac
17178         ;;
17179         *)      case "$usethreads" in
17180                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17181                 esac
17182                 d_setgrent_r=undef
17183                 setgrent_r_proto=0
17184                 ;;
17185         esac
17186         ;;
17187 *)      setgrent_r_proto=0
17188         ;;
17189 esac
17190
17191 : see if sethostent exists
17192 set sethostent d_sethent
17193 eval $inlibc
17194
17195 : see if sethostent_r exists
17196 set sethostent_r d_sethostent_r
17197 eval $inlibc
17198 case "$d_sethostent_r" in
17199 "$define")
17200         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17201         case "$d_sethostent_r_proto:$usethreads" in
17202         ":define")      d_sethostent_r_proto=define
17203                 set d_sethostent_r_proto sethostent_r $hdrs
17204                 eval $hasproto ;;
17205         *)      ;;
17206         esac
17207         case "$d_sethostent_r_proto" in
17208         define)
17209         case "$sethostent_r_proto" in
17210         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17211         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17212         esac
17213         case "$sethostent_r_proto" in
17214         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17215         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17216         esac
17217         case "$sethostent_r_proto" in
17218         ''|0)   d_sethostent_r=undef
17219                 sethostent_r_proto=0
17220                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17221         * )     case "$sethostent_r_proto" in
17222                 REENTRANT_PROTO*) ;;
17223                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17224                 esac
17225                 echo "Prototype: $try" ;;
17226         esac
17227         ;;
17228         *)      case "$usethreads" in
17229                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17230                 esac
17231                 d_sethostent_r=undef
17232                 sethostent_r_proto=0
17233                 ;;
17234         esac
17235         ;;
17236 *)      sethostent_r_proto=0
17237         ;;
17238 esac
17239
17240 : see if setitimer exists
17241 set setitimer d_setitimer
17242 eval $inlibc
17243
17244 : see if setlinebuf exists
17245 set setlinebuf d_setlinebuf
17246 eval $inlibc
17247
17248 : see if setlocale exists
17249 set setlocale d_setlocale
17250 eval $inlibc
17251
17252 : see if locale.h is available
17253 set locale.h i_locale
17254 eval $inhdr
17255
17256 : see if setlocale_r exists
17257 set setlocale_r d_setlocale_r
17258 eval $inlibc
17259 case "$d_setlocale_r" in
17260 "$define")
17261         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17262         case "$d_setlocale_r_proto:$usethreads" in
17263         ":define")      d_setlocale_r_proto=define
17264                 set d_setlocale_r_proto setlocale_r $hdrs
17265                 eval $hasproto ;;
17266         *)      ;;
17267         esac
17268         case "$d_setlocale_r_proto" in
17269         define)
17270         case "$setlocale_r_proto" in
17271         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17272         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17273         esac
17274         case "$setlocale_r_proto" in
17275         ''|0)   d_setlocale_r=undef
17276                 setlocale_r_proto=0
17277                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17278         * )     case "$setlocale_r_proto" in
17279                 REENTRANT_PROTO*) ;;
17280                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17281                 esac
17282                 echo "Prototype: $try" ;;
17283         esac
17284         ;;
17285         *)      case "$usethreads" in
17286                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17287                 esac
17288                 d_setlocale_r=undef
17289                 setlocale_r_proto=0
17290                 ;;
17291         esac
17292         ;;
17293 *)      setlocale_r_proto=0
17294         ;;
17295 esac
17296
17297 : see if setnetent exists
17298 set setnetent d_setnent
17299 eval $inlibc
17300
17301 : see if setnetent_r exists
17302 set setnetent_r d_setnetent_r
17303 eval $inlibc
17304 case "$d_setnetent_r" in
17305 "$define")
17306         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17307         case "$d_setnetent_r_proto:$usethreads" in
17308         ":define")      d_setnetent_r_proto=define
17309                 set d_setnetent_r_proto setnetent_r $hdrs
17310                 eval $hasproto ;;
17311         *)      ;;
17312         esac
17313         case "$d_setnetent_r_proto" in
17314         define)
17315         case "$setnetent_r_proto" in
17316         ''|0) try='int setnetent_r(int, struct netent_data*);'
17317         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17318         esac
17319         case "$setnetent_r_proto" in
17320         ''|0) try='void setnetent_r(int, struct netent_data*);'
17321         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17322         esac
17323         case "$setnetent_r_proto" in
17324         ''|0)   d_setnetent_r=undef
17325                 setnetent_r_proto=0
17326                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17327         * )     case "$setnetent_r_proto" in
17328                 REENTRANT_PROTO*) ;;
17329                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17330                 esac
17331                 echo "Prototype: $try" ;;
17332         esac
17333         ;;
17334         *)      case "$usethreads" in
17335                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17336                 esac
17337                 d_setnetent_r=undef
17338                 setnetent_r_proto=0
17339                 ;;
17340         esac
17341         ;;
17342 *)      setnetent_r_proto=0
17343         ;;
17344 esac
17345
17346 : see if setprotoent exists
17347 set setprotoent d_setpent
17348 eval $inlibc
17349
17350 : see if setpgid exists
17351 set setpgid d_setpgid
17352 eval $inlibc
17353
17354 : see if setpgrp2 exists
17355 set setpgrp2 d_setpgrp2
17356 eval $inlibc
17357
17358 : see if setpriority exists
17359 set setpriority d_setprior
17360 eval $inlibc
17361
17362 : see if setproctitle exists
17363 set setproctitle d_setproctitle
17364 eval $inlibc
17365
17366 : see if setprotoent_r exists
17367 set setprotoent_r d_setprotoent_r
17368 eval $inlibc
17369 case "$d_setprotoent_r" in
17370 "$define")
17371         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17372         case "$d_setprotoent_r_proto:$usethreads" in
17373         ":define")      d_setprotoent_r_proto=define
17374                 set d_setprotoent_r_proto setprotoent_r $hdrs
17375                 eval $hasproto ;;
17376         *)      ;;
17377         esac
17378         case "$d_setprotoent_r_proto" in
17379         define)
17380         case "$setprotoent_r_proto" in
17381         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17382         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17383         esac
17384         case "$setprotoent_r_proto" in
17385         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17386         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17387         esac
17388         case "$setprotoent_r_proto" in
17389         ''|0)   d_setprotoent_r=undef
17390                 setprotoent_r_proto=0
17391                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17392         * )     case "$setprotoent_r_proto" in
17393                 REENTRANT_PROTO*) ;;
17394                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17395                 esac
17396                 echo "Prototype: $try" ;;
17397         esac
17398         ;;
17399         *)      case "$usethreads" in
17400                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17401                 esac
17402                 d_setprotoent_r=undef
17403                 setprotoent_r_proto=0
17404                 ;;
17405         esac
17406         ;;
17407 *)      setprotoent_r_proto=0
17408         ;;
17409 esac
17410
17411 : see if setpwent exists
17412 set setpwent d_setpwent
17413 eval $inlibc
17414
17415 : see if setpwent_r exists
17416 set setpwent_r d_setpwent_r
17417 eval $inlibc
17418 case "$d_setpwent_r" in
17419 "$define")
17420         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17421         case "$d_setpwent_r_proto:$usethreads" in
17422         ":define")      d_setpwent_r_proto=define
17423                 set d_setpwent_r_proto setpwent_r $hdrs
17424                 eval $hasproto ;;
17425         *)      ;;
17426         esac
17427         case "$d_setpwent_r_proto" in
17428         define)
17429         case "$setpwent_r_proto" in
17430         ''|0) try='int setpwent_r(FILE**);'
17431         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17432         esac
17433         case "$setpwent_r_proto" in
17434         ''|0) try='void setpwent_r(FILE**);'
17435         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17436         esac
17437         case "$setpwent_r_proto" in
17438         ''|0)   d_setpwent_r=undef
17439                 setpwent_r_proto=0
17440                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17441         * )     case "$setpwent_r_proto" in
17442                 REENTRANT_PROTO*) ;;
17443                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17444                 esac
17445                 echo "Prototype: $try" ;;
17446         esac
17447         ;;
17448         *)      case "$usethreads" in
17449                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17450                 esac
17451                 d_setpwent_r=undef
17452                 setpwent_r_proto=0
17453                 ;;
17454         esac
17455         ;;
17456 *)      setpwent_r_proto=0
17457         ;;
17458 esac
17459
17460 : see if setregid exists
17461 set setregid d_setregid
17462 eval $inlibc
17463 set setresgid d_setresgid
17464 eval $inlibc
17465
17466 : see if setreuid exists
17467 set setreuid d_setreuid
17468 eval $inlibc
17469 set setresuid d_setresuid
17470 eval $inlibc
17471
17472 : see if setrgid exists
17473 set setrgid d_setrgid
17474 eval $inlibc
17475
17476 : see if setruid exists
17477 set setruid d_setruid
17478 eval $inlibc
17479
17480 : see if setservent exists
17481 set setservent d_setsent
17482 eval $inlibc
17483
17484 : see if setservent_r exists
17485 set setservent_r d_setservent_r
17486 eval $inlibc
17487 case "$d_setservent_r" in
17488 "$define")
17489         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17490         case "$d_setservent_r_proto:$usethreads" in
17491         ":define")      d_setservent_r_proto=define
17492                 set d_setservent_r_proto setservent_r $hdrs
17493                 eval $hasproto ;;
17494         *)      ;;
17495         esac
17496         case "$d_setservent_r_proto" in
17497         define)
17498         case "$setservent_r_proto" in
17499         ''|0) try='int setservent_r(int, struct servent_data*);'
17500         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17501         esac
17502         case "$setservent_r_proto" in
17503         ''|0) try='void setservent_r(int, struct servent_data*);'
17504         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17505         esac
17506         case "$setservent_r_proto" in
17507         ''|0)   d_setservent_r=undef
17508                 setservent_r_proto=0
17509                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17510         * )     case "$setservent_r_proto" in
17511                 REENTRANT_PROTO*) ;;
17512                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17513                 esac
17514                 echo "Prototype: $try" ;;
17515         esac
17516         ;;
17517         *)      case "$usethreads" in
17518                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17519                 esac
17520                 d_setservent_r=undef
17521                 setservent_r_proto=0
17522                 ;;
17523         esac
17524         ;;
17525 *)      setservent_r_proto=0
17526         ;;
17527 esac
17528
17529 : see if setsid exists
17530 set setsid d_setsid
17531 eval $inlibc
17532
17533 : see if setvbuf exists
17534 set setvbuf d_setvbuf
17535 eval $inlibc
17536
17537 : see if sfio.h is available
17538 set sfio.h i_sfio
17539 eval $inhdr
17540
17541 : see if sfio library is available
17542 case "$i_sfio" in
17543 $define)
17544         val=''
17545         set sfreserve val
17546         eval $inlibc
17547         ;;
17548 *)
17549         val="$undef"
17550         ;;
17551 esac
17552 : Ok, but do we want to use it.
17553 case "$val" in
17554 $define)
17555         case "$usesfio" in
17556         true|$define|[yY]*) dflt='y';;
17557         *) dflt='n';;
17558         esac
17559         echo "$package can use the sfio library, but it is experimental."
17560         rp="You seem to have sfio available, do you want to try using it?"
17561         . ./myread
17562         case "$ans" in
17563         y|Y)    echo "Ok, turning on sfio then."
17564                 val="$define"
17565                 ;;
17566         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17567                 val="$undef"
17568                 ;;
17569         esac
17570         ;;
17571 *)      case "$usesfio" in
17572         true|$define|[yY]*)
17573                 echo "Sorry, cannot find sfio on this machine." >&4
17574                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17575                 val="$undef"
17576                 ;;
17577         esac
17578         ;;
17579 esac
17580 set d_sfio
17581 eval $setvar
17582 case "$d_sfio" in
17583 $define) usesfio='true';;
17584 *) usesfio='false';;
17585 esac
17586 case "$d_sfio" in
17587 $define) ;;
17588 *)      : Remove sfio from list of libraries to use
17589         case "$libs" in
17590         *-lsfio*)
17591                 echo "Removing unneeded -lsfio from library list" >&4
17592                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17593                 shift
17594                 libs="$*"
17595                 echo "libs = $libs" >&4
17596                 ;;
17597         esac
17598 ;;
17599 esac
17600
17601
17602 : see if shmctl exists
17603 set shmctl d_shmctl
17604 eval $inlibc
17605
17606 : see if shmget exists
17607 set shmget d_shmget
17608 eval $inlibc
17609
17610 : see if shmat exists
17611 set shmat d_shmat
17612 eval $inlibc
17613 : see what shmat returns
17614 case "$d_shmat" in
17615 "$define")
17616         $cat >shmat.c <<'END'
17617 #include <sys/shm.h>
17618 void *shmat();
17619 END
17620         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17621                 shmattype='void *'
17622         else
17623                 shmattype='char *'
17624         fi
17625         echo "and it returns ($shmattype)." >&4
17626         : see if a prototype for shmat is available
17627         xxx=`./findhdr sys/shm.h`
17628         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17629         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17630                 val="$define"
17631         else
17632                 val="$undef"
17633         fi
17634         $rm -f shmat.[co]
17635         ;;
17636 *)
17637         val="$undef"
17638         ;;
17639 esac
17640 set d_shmatprototype
17641 eval $setvar
17642
17643 : see if shmdt exists
17644 set shmdt d_shmdt
17645 eval $inlibc
17646
17647 : see how much of the 'shm*(2)' library is present.
17648 h_shm=true
17649 echo " "
17650 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17651 *"$undef"*) h_shm=false;;
17652 esac
17653 case "$osname" in
17654 freebsd)
17655     case "`ipcs 2>&1`" in
17656     "SVID shared memory"*"not configured"*)
17657         echo "Your $osname does not have the shm*(2) configured." >&4
17658         h_shm=false
17659         val="$undef"
17660         set shmctl d_shmctl
17661         evat $setvar
17662         set shmget d_shmget
17663         evat $setvar
17664         set shmat d_shmat
17665         evat $setvar
17666         set shmdt d_shmdt
17667         evat $setvar
17668         ;;
17669     esac
17670     ;;
17671 esac
17672 : we could also check for sys/ipc.h ...
17673 if $h_shm && $test `./findhdr sys/shm.h`; then
17674         echo "You have the full shm*(2) library." >&4
17675         val="$define"
17676 else
17677         echo "You don't have the full shm*(2) library." >&4
17678         val="$undef"
17679 fi
17680 set d_shm
17681 eval $setvar
17682
17683 : see if we have sigaction
17684 echo " "
17685 if set sigaction val -f d_sigaction; eval $csym; $val; then
17686         echo 'sigaction() found.' >&4
17687         $cat > try.c <<EOP
17688 #include <stdio.h>
17689 #include <sys/types.h>
17690 #include <signal.h>
17691 #$i_stdlib I_STDLIB
17692 #ifdef I_STDLIB
17693 #include <stdlib.h>
17694 #endif
17695 int main()
17696 {
17697     struct sigaction act, oact;
17698     act.sa_flags = 0;
17699     oact.sa_handler = 0;
17700     /* so that act and oact are used */
17701     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17702 }
17703 EOP
17704         set try
17705         if eval $compile_ok; then
17706                 val="$define"
17707         else
17708                 echo "But you don't seem to have a usable struct sigaction." >&4
17709                 val="$undef"
17710         fi
17711 else
17712         echo 'sigaction NOT found.' >&4
17713         val="$undef"
17714 fi
17715 set d_sigaction; eval $setvar
17716 $rm_try
17717
17718 : see if this is a sunmath.h system
17719 set sunmath.h i_sunmath
17720 eval $inhdr
17721
17722 : see if signbit exists
17723 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17724 $cat >try.c <<EOCP
17725 #$i_math I_MATH
17726 #$i_sunmath I_SUNMATH
17727 #ifdef I_MATH
17728 #  include <math.h>
17729 #endif
17730 #ifdef I_SUNMATH  /* Solaris special math library */
17731 #  include <sunmath.h>
17732 #endif
17733 #define NV $nvtype
17734 int main(int argc, char **argv)
17735 {
17736     NV x = 0.0;
17737     NV y = -0.0;
17738     if ((signbit(x) == 0) && (signbit(y) != 0))
17739         return 0;
17740     else
17741         return 1;
17742 }
17743 EOCP
17744 val="$undef"
17745 set try
17746 if eval $compile; then
17747     if $run ./try; then
17748         $echo "Yes." >&4
17749         val="$define"
17750     else
17751         $echo "Signbit seems to be available, but doesn't work as I expected."
17752         $echo "I won't use it." >&4
17753         val="$undef"
17754     fi
17755 else
17756     $echo "Nope." >&4
17757     dflt="$undef"
17758 fi
17759 set d_signbit
17760 eval $setvar
17761 $rm_try
17762
17763 : see if sigprocmask exists
17764 set sigprocmask d_sigprocmask
17765 eval $inlibc
17766
17767 : see if sigsetjmp exists
17768 echo " "
17769 case "$d_sigsetjmp" in
17770 '')
17771         $cat >try.c <<EOP
17772 #include <setjmp.h>
17773 #$i_stdlib I_STDLIB
17774 #ifdef I_STDLIB
17775 #include <stdlib.h>
17776 #endif
17777 sigjmp_buf env;
17778 int set = 1;
17779 int main()
17780 {
17781         if (sigsetjmp(env,1))
17782                 exit(set);
17783         set = 0;
17784         siglongjmp(env, 1);
17785         exit(1);
17786 }
17787 EOP
17788         set try
17789         if eval $compile; then
17790                 if $run ./try >/dev/null 2>&1; then
17791                         echo "POSIX sigsetjmp found." >&4
17792                         val="$define"
17793                 else
17794                         $cat >&4 <<EOM
17795 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17796 I'll ignore them.
17797 EOM
17798                         val="$undef"
17799                 fi
17800         else
17801                 echo "sigsetjmp not found." >&4
17802                 val="$undef"
17803         fi
17804         ;;
17805 *) val="$d_sigsetjmp"
17806         case "$d_sigsetjmp" in
17807         $define) echo "POSIX sigsetjmp found." >&4;;
17808         $undef) echo "sigsetjmp not found." >&4;;
17809         esac
17810         ;;
17811 esac
17812 set d_sigsetjmp
17813 eval $setvar
17814 $rm_try
17815
17816 : see if snprintf exists
17817 set snprintf d_snprintf
17818 eval $inlibc
17819
17820 : see if vsnprintf exists
17821 set vsnprintf d_vsnprintf
17822 eval $inlibc
17823
17824 case "$d_snprintf-$d_vsnprintf" in
17825 "$define-$define")
17826     $cat <<EOM
17827 Checking whether your snprintf() and vsnprintf() work okay...
17828 EOM
17829     $cat >try.c <<'EOCP'
17830 /* v?snprintf testing logic courtesy of Russ Allbery.
17831  * According to C99:
17832  * - if the buffer is too short it still must be \0-terminated
17833  * - if the buffer is too short the potentially required length
17834  *   must be returned and not -1
17835  * - if the buffer is NULL the potentially required length
17836  *   must be returned and not -1 or core dump
17837  */
17838 #include <stdio.h>
17839 #include <stdarg.h>
17840
17841 char buf[2];
17842
17843 int test (char *format, ...)
17844 {
17845     va_list args;
17846     int count;
17847
17848     va_start (args, format);
17849     count = vsnprintf (buf, sizeof buf, format, args);
17850     va_end (args);
17851     return count;
17852 }
17853
17854 int main ()
17855 {
17856     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17857              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17858 }
17859 EOCP
17860     set try
17861     if eval $compile; then
17862         `$run ./try`
17863         case "$?" in
17864         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17865         *) cat <<EOM >&4
17866 Your snprintf() and snprintf() don't seem to be working okay.
17867 EOM
17868            d_snprintf="$undef"
17869            d_vsnprintf="$undef"
17870            ;;
17871         esac
17872     else
17873         echo "(I can't seem to compile the test program--assuming they don't)"
17874         d_snprintf="$undef"
17875         d_vsnprintf="$undef"
17876     fi
17877     $rm_try
17878     ;;
17879 esac
17880
17881 : see if sockatmark exists
17882 set sockatmark d_sockatmark
17883 eval $inlibc
17884
17885 : see if prototype for sockatmark is available
17886 echo " "
17887 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17888 eval $hasproto
17889
17890 : see if socks5_init exists
17891 set socks5_init d_socks5_init
17892 eval $inlibc
17893
17894 : see if sprintf returns the length of the string in the buffer as per ANSI
17895 $echo "Checking whether sprintf returns the length of the string..." >&4
17896 $cat <<EOP >try.c
17897 #include <stdio.h>
17898 #$i_stdlib I_STDLIB
17899 #ifdef I_STDLIB
17900 #include <stdlib.h>
17901 #endif
17902 #$i_string I_STRING
17903 #ifdef I_STRING
17904 #  include <string.h>
17905 #else
17906 #  include <strings.h>
17907 #endif
17908 #$i_math I_MATH
17909 #ifdef I_MATH
17910 #include <math.h>
17911 #endif
17912
17913 char buffer[256];
17914
17915 int check (size_t expect, int test) {
17916   size_t got = strlen(buffer);
17917   if (expect == got)
17918     return 0;
17919
17920   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17921        test, buffer);
17922   exit (test);
17923 }
17924
17925 int main(int argc, char **argv) {
17926   int test = 0;
17927
17928   check(sprintf(buffer, ""), ++test);
17929   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17930   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17931
17932   return 0;
17933 }
17934 EOP
17935 set try
17936
17937 if eval $compile; then
17938     xxx="`$run ./try`"
17939     case "$?" in
17940         0) cat >&4 <<EOM
17941 sprintf returns the length of the string (as ANSI says it should)
17942 EOM
17943         d_sprintf_returns_strlen="$define"
17944         ;;
17945         *) cat >&4 <<EOM
17946 sprintf does not return the length of the string (how old is this system?)
17947 EOM
17948         d_sprintf_returns_strlen="$undef"
17949         ;;
17950     esac
17951 else
17952     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17953     d_sprintf_returns_strlen="$undef"
17954 fi
17955 $rm_try
17956
17957 : see if srand48_r exists
17958 set srand48_r d_srand48_r
17959 eval $inlibc
17960 case "$d_srand48_r" in
17961 "$define")
17962         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17963         case "$d_srand48_r_proto:$usethreads" in
17964         ":define")      d_srand48_r_proto=define
17965                 set d_srand48_r_proto srand48_r $hdrs
17966                 eval $hasproto ;;
17967         *)      ;;
17968         esac
17969         case "$d_srand48_r_proto" in
17970         define)
17971         case "$srand48_r_proto" in
17972         ''|0) try='int srand48_r(long, struct drand48_data*);'
17973         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17974         esac
17975         case "$srand48_r_proto" in
17976         ''|0)   d_srand48_r=undef
17977                 srand48_r_proto=0
17978                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17979         * )     case "$srand48_r_proto" in
17980                 REENTRANT_PROTO*) ;;
17981                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17982                 esac
17983                 echo "Prototype: $try" ;;
17984         esac
17985         ;;
17986         *)      case "$usethreads" in
17987                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17988                 esac
17989                 d_srand48_r=undef
17990                 srand48_r_proto=0
17991                 ;;
17992         esac
17993         ;;
17994 *)      srand48_r_proto=0
17995         ;;
17996 esac
17997
17998 : see if srandom_r exists
17999 set srandom_r d_srandom_r
18000 eval $inlibc
18001 case "$d_srandom_r" in
18002 "$define")
18003         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18004         case "$d_srandom_r_proto:$usethreads" in
18005         ":define")      d_srandom_r_proto=define
18006                 set d_srandom_r_proto srandom_r $hdrs
18007                 eval $hasproto ;;
18008         *)      ;;
18009         esac
18010         case "$d_srandom_r_proto" in
18011         define)
18012         case "$srandom_r_proto" in
18013         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18014         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18015         esac
18016         case "$srandom_r_proto" in
18017         ''|0)   d_srandom_r=undef
18018                 srandom_r_proto=0
18019                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18020         * )     case "$srandom_r_proto" in
18021                 REENTRANT_PROTO*) ;;
18022                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18023                 esac
18024                 echo "Prototype: $try" ;;
18025         esac
18026         ;;
18027         *)      case "$usethreads" in
18028                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18029                 esac
18030                 d_srandom_r=undef
18031                 srandom_r_proto=0
18032                 ;;
18033         esac
18034         ;;
18035 *)      srandom_r_proto=0
18036         ;;
18037 esac
18038
18039 : see if prototype for setresgid is available
18040 echo " "
18041 set d_sresgproto setresgid $i_unistd unistd.h
18042 eval $hasproto
18043
18044 : see if prototype for setresuid is available
18045 echo " "
18046 set d_sresuproto setresuid $i_unistd unistd.h
18047 eval $hasproto
18048
18049 : see if sys/stat.h is available
18050 set sys/stat.h i_sysstat
18051 eval $inhdr
18052
18053 : see if stat knows about block sizes
18054 echo " "
18055 echo "Checking to see if your struct stat has st_blocks field..." >&4
18056 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18057 eval $hasfield
18058
18059 : see if this is a sys/vfs.h system
18060 set sys/vfs.h i_sysvfs
18061 eval $inhdr
18062
18063 : see if this is a sys/statfs.h system
18064 set sys/statfs.h i_sysstatfs
18065 eval $inhdr
18066
18067 : Check for statfs_s
18068 echo " "
18069 echo "Checking to see if your system supports struct statfs..." >&4
18070 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
18071 eval $hasstruct
18072 case "$d_statfs_s" in
18073 "$define")      echo "Yes, it does."   ;;
18074 *)              echo "No, it doesn't." ;;
18075 esac
18076
18077
18078 : see if struct statfs knows about f_flags
18079 case "$d_statfs_s" in
18080 define)
18081         echo " "
18082         echo "Checking to see if your struct statfs has f_flags field..." >&4
18083         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
18084         eval $hasfield
18085         ;;
18086 *)      val="$undef"
18087         set d_statfs_f_flags
18088         eval $setvar
18089         ;;
18090 esac
18091 case "$d_statfs_f_flags" in
18092 "$define")      echo "Yes, it does."   ;;
18093 *)              echo "No, it doesn't." ;;
18094 esac
18095
18096 : see what flavor, if any, of static inline is supported
18097 echo " "
18098 echo "Checking to see if your system supports static inline..."
18099 $cat > try.c <<'EOCP'
18100 #include <stdlib.h>
18101 extern int f_via_a(int x);
18102 extern int f_via_b(int x);
18103 int main(int argc, char **argv)
18104 {
18105     int y;
18106
18107     y = f_via_a(0);
18108 #ifdef USE_B
18109     y = f_via_b(0);
18110 #endif
18111     if (y == 42) {
18112         return EXIT_SUCCESS;
18113     }
18114     else {
18115         return EXIT_FAILURE;
18116     }
18117 }
18118 EOCP
18119 $cat > a.c <<'EOCP'
18120 static INLINE int f(int x) {
18121     int y;
18122     y = x + 42;
18123     return y;
18124 }
18125
18126 int f_via_a(int x)
18127 {
18128     return f(x);
18129 }
18130 EOCP
18131 $cat > b.c <<'EOCP'
18132 extern int f(int x);
18133
18134 int f_via_b(int x)
18135 {
18136     return f(x);
18137 }
18138 EOCP
18139
18140 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18141 case "$perl_static_inline" in
18142 '')     # Check the various possibilities, and break out on success.
18143         # For gcc, prefer __inline__, which will still permit
18144         # cflags.SH to add in -ansi.
18145         case "$gccversion" in
18146                 '') xxx="inline __inline__ __inline _inline";;
18147                 *)  xxx="__inline__ inline __inline _inline";;
18148         esac
18149         for inline in $xxx; do
18150                 set try -DINLINE=$inline a.c
18151                 if eval $compile && $run ./try; then
18152                         # Now make sure there is no external linkage of static
18153                         # functions
18154                         set try -DINLINE=$inline -DUSE_B a.c b.c
18155                         if eval $compile && $run ./try; then
18156                                 $echo "Your compiler supports static $inline, " >&4
18157                                 $echo "but it also creates an external definition," >&4
18158                                 $echo "so I won't use it." >&4
18159                                 val=$undef
18160                         else
18161                                 $echo "Your compiler supports static $inline." >&4
18162                                 val=$define
18163                                 perl_static_inline="static $inline";
18164                                 break;
18165                         fi
18166                 else
18167                         $echo "Your compiler does NOT support static $inline." >&4
18168                         val="$undef"
18169                 fi
18170         done
18171         ;;
18172 *inline*) # Some variant of inline exists.
18173         echo "Keeping your $hint value of $perl_static_inline."
18174         val=$define
18175         ;;
18176 static)  # No inline capabilities
18177         echo "Keeping your $hint value of $perl_static_inline."
18178         val=$undef
18179         ;;
18180 *)  # Unrecognized previous value -- blindly trust the supplied
18181         # value and hope it makes sense.  Use old value for
18182         # d_static_inline, if there is one.
18183         echo "Keeping your $hint value of $perl_static_inline."
18184         case "$d_static_inline" in
18185                 '') val=$define ;;
18186                 *)  val=$d_static_inline ;;
18187         esac
18188         ;;
18189 esac
18190 # Fallback to plain 'static' if nothing worked.
18191 case "$perl_static_inline" in
18192 '')
18193         perl_static_inline="static"
18194         val=$undef
18195         ;;
18196 esac
18197 set d_static_inline
18198 eval $setvar
18199 $rm -f a.[co] b.[co]
18200 $rm_try
18201
18202 : Check stream access
18203 $cat >&4 <<EOM
18204 Checking how to access stdio streams by file descriptor number...
18205 EOM
18206 case "$stdio_stream_array" in
18207 '')     $cat >try.c <<EOCP
18208 #include <stdio.h>
18209 int main() {
18210   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18211     printf("yes\n");
18212 }
18213 EOCP
18214         for s in _iob __iob __sF
18215         do
18216                 set try -DSTDIO_STREAM_ARRAY=$s
18217                 if eval $compile; then
18218                         case "`$run ./try`" in
18219                         yes)    stdio_stream_array=$s; break ;;
18220                         esac
18221                 fi
18222         done
18223         $rm_try
18224 esac
18225 case "$stdio_stream_array" in
18226 '')     $cat >&4 <<EOM
18227 I can't figure out how to access stdio streams by file descriptor number.
18228 EOM
18229         d_stdio_stream_array="$undef"
18230         ;;
18231 *)      $cat >&4 <<EOM
18232 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18233 EOM
18234         d_stdio_stream_array="$define"
18235         ;;
18236 esac
18237
18238 : see if strcoll exists
18239 set strcoll d_strcoll
18240 eval $inlibc
18241
18242 : check for structure copying
18243 echo " "
18244 echo "Checking to see if your C compiler can copy structs..." >&4
18245 $cat >try.c <<'EOCP'
18246 int main()
18247 {
18248         struct blurfl {
18249                 int dyick;
18250         } foo, bar;
18251
18252         foo = bar;
18253 }
18254 EOCP
18255 if $cc -c try.c >/dev/null 2>&1 ; then
18256         val="$define"
18257         echo "Yup, it can."
18258 else
18259         val="$undef"
18260         echo "Nope, it can't."
18261 fi
18262 set d_strctcpy
18263 eval $setvar
18264 $rm_try
18265
18266 : see if strerror and/or sys_errlist[] exist
18267 echo " "
18268 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18269     if set strerror val -f d_strerror; eval $csym; $val; then
18270                 echo 'strerror() found.' >&4
18271                 d_strerror="$define"
18272                 d_strerrm='strerror(e)'
18273                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18274                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18275                         d_syserrlst="$define"
18276                 else
18277                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18278                         d_syserrlst="$undef"
18279                 fi
18280     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18281                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18282                 echo 'strerror() found in string header.' >&4
18283                 d_strerror="$define"
18284                 d_strerrm='strerror(e)'
18285                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18286                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18287                                 d_syserrlst="$define"
18288                 else
18289                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18290                         d_syserrlst="$undef"
18291                 fi
18292     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18293                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18294                 d_strerror="$undef"
18295                 d_syserrlst="$define"
18296                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18297     else
18298                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18299                 d_strerror="$undef"
18300                 d_syserrlst="$undef"
18301                 d_strerrm='"unknown"'
18302     fi
18303 fi
18304
18305 : see if strerror_r exists
18306 set strerror_r d_strerror_r
18307 eval $inlibc
18308 case "$d_strerror_r" in
18309 "$define")
18310         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18311         case "$d_strerror_r_proto:$usethreads" in
18312         ":define")      d_strerror_r_proto=define
18313                 set d_strerror_r_proto strerror_r $hdrs
18314                 eval $hasproto ;;
18315         *)      ;;
18316         esac
18317         case "$d_strerror_r_proto" in
18318         define)
18319         case "$strerror_r_proto" in
18320         ''|0) try='int strerror_r(int, char*, size_t);'
18321         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18322         esac
18323         case "$strerror_r_proto" in
18324         ''|0) try='int strerror_r(int, char*, int);'
18325         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18326         esac
18327         case "$strerror_r_proto" in
18328         ''|0) try='char* strerror_r(int, char*, size_t);'
18329         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18330         esac
18331         case "$strerror_r_proto" in
18332         ''|0)   d_strerror_r=undef
18333                 strerror_r_proto=0
18334                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18335         * )     case "$strerror_r_proto" in
18336                 REENTRANT_PROTO*) ;;
18337                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18338                 esac
18339                 echo "Prototype: $try" ;;
18340         esac
18341         ;;
18342         *)      case "$usethreads" in
18343                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18344                 esac
18345                 d_strerror_r=undef
18346                 strerror_r_proto=0
18347                 ;;
18348         esac
18349         ;;
18350 *)      strerror_r_proto=0
18351         ;;
18352 esac
18353
18354 : see if strftime exists
18355 set strftime d_strftime
18356 eval $inlibc
18357
18358 : see if strlcat exists
18359 set strlcat d_strlcat
18360 eval $inlibc
18361
18362 : see if strlcpy exists
18363 set strlcpy d_strlcpy
18364 eval $inlibc
18365
18366 : see if strtod exists
18367 set strtod d_strtod
18368 eval $inlibc
18369
18370 : see if strtol exists
18371 set strtol d_strtol
18372 eval $inlibc
18373
18374 : see if strtold exists
18375 set strtold d_strtold
18376 eval $inlibc
18377
18378 : see if strtoll exists
18379 set strtoll d_strtoll
18380 eval $inlibc
18381
18382 case "$d_longlong-$d_strtoll" in
18383 "$define-$define")
18384         $cat <<EOM
18385 Checking whether your strtoll() works okay...
18386 EOM
18387         $cat >try.c <<'EOCP'
18388 #include <errno.h>
18389 #ifdef __hpux
18390 #define strtoll __strtoll
18391 #endif
18392 #ifdef __EMX__
18393 #define strtoll _strtoll
18394 #endif
18395 #include <stdio.h>
18396 extern long long int strtoll(char *s, char **, int);
18397 static int bad = 0;
18398 int check(char *s, long long ell, int een) {
18399         long long gll;
18400         errno = 0;
18401         gll = strtoll(s, 0, 10);
18402         if (!((gll == ell) && (errno == een)))
18403                 bad++;
18404 }
18405 int main() {
18406         check(" 1",                                      1LL, 0);
18407         check(" 0",                                      0LL, 0);
18408         check("-1",                                     -1LL, 0);
18409         check("-9223372036854775808", -9223372036854775808LL, 0);
18410         check("-9223372036854775808", -9223372036854775808LL, 0);
18411         check(" 9223372036854775807",  9223372036854775807LL, 0);
18412         check("-9223372036854775808", -9223372036854775808LL, 0);
18413         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18414         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18415         if (!bad)
18416                 printf("ok\n");
18417 }
18418 EOCP
18419         set try
18420         if eval $compile; then
18421                 yyy=`$run ./try`
18422                 case "$yyy" in
18423                 ok) echo "Your strtoll() seems to be working okay." ;;
18424                 *) cat <<EOM >&4
18425 Your strtoll() doesn't seem to be working okay.
18426 EOM
18427                    d_strtoll="$undef"
18428                    ;;
18429                 esac
18430         else
18431                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18432                 d_strtoll="$undef"
18433         fi
18434         ;;
18435 esac
18436
18437 : see if strtoq exists
18438 set strtoq d_strtoq
18439 eval $inlibc
18440
18441 : see if strtoul exists
18442 set strtoul d_strtoul
18443 eval $inlibc
18444
18445 case "$d_strtoul" in
18446 "$define")
18447         $cat <<EOM
18448 Checking whether your strtoul() works okay...
18449 EOM
18450         $cat >try.c <<'EOCP'
18451 #include <errno.h>
18452 #include <stdio.h>
18453 extern unsigned long int strtoul(char *s, char **, int);
18454 static int bad = 0;
18455 void check(char *s, unsigned long eul, int een) {
18456         unsigned long gul;
18457         errno = 0;
18458         gul = strtoul(s, 0, 10);
18459         if (!((gul == eul) && (errno == een)))
18460                 bad++;
18461 }
18462 int main() {
18463         check(" 1", 1L, 0);
18464         check(" 0", 0L, 0);
18465 EOCP
18466         case "$longsize" in
18467         8)
18468             $cat >>try.c <<'EOCP'
18469         check("18446744073709551615", 18446744073709551615UL, 0);
18470         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18471 #if 0 /* strtoul() for /^-/ strings is undefined. */
18472         check("-1", 18446744073709551615UL, 0);
18473         check("-18446744073709551614", 2, 0);
18474         check("-18446744073709551615", 1, 0);
18475         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18476         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18477 #endif
18478 EOCP
18479                 ;;
18480         4)
18481                     $cat >>try.c <<'EOCP'
18482         check("4294967295", 4294967295UL, 0);
18483         check("4294967296", 4294967295UL, ERANGE);
18484 #if 0 /* strtoul() for /^-/ strings is undefined. */
18485         check("-1", 4294967295UL, 0);
18486         check("-4294967294", 2, 0);
18487         check("-4294967295", 1, 0);
18488         check("-4294967296", 4294967295UL, ERANGE);
18489         check("-4294967297", 4294967295UL, ERANGE);
18490 #endif
18491 EOCP
18492                 ;;
18493         *)
18494 : Should we write these tests to be more portable by sprintf-ing
18495 : ~0 and then manipulating that char string as input for strtol?
18496                 ;;
18497         esac
18498         $cat >>try.c <<'EOCP'
18499         if (!bad)
18500                 printf("ok\n");
18501         return 0;
18502 }
18503 EOCP
18504         set try
18505         if eval $compile; then
18506                 case "`$run ./try`" in
18507                 ok) echo "Your strtoul() seems to be working okay." ;;
18508                 *) cat <<EOM >&4
18509 Your strtoul() doesn't seem to be working okay.
18510 EOM
18511                    d_strtoul="$undef"
18512                    ;;
18513                 esac
18514         else
18515                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18516                 d_strtoul="$undef"
18517         fi
18518         ;;
18519 esac
18520
18521 : see if strtoull exists
18522 set strtoull d_strtoull
18523 eval $inlibc
18524
18525 case "$d_longlong-$d_strtoull" in
18526 "$define-$define")
18527         $cat <<EOM
18528 Checking whether your strtoull() works okay...
18529 EOM
18530         $cat >try.c <<'EOCP'
18531 #include <errno.h>
18532 #ifdef __hpux
18533 #define strtoull __strtoull
18534 #endif
18535 #include <stdio.h>
18536 extern unsigned long long int strtoull(char *s, char **, int);
18537 static int bad = 0;
18538 int check(char *s, long long eull, int een) {
18539         long long gull;
18540         errno = 0;
18541         gull = strtoull(s, 0, 10);
18542         if (!((gull == eull) && (errno == een)))
18543                 bad++;
18544 }
18545 int main() {
18546         check(" 1",                                        1LL, 0);
18547         check(" 0",                                        0LL, 0);
18548         check("18446744073709551615",  18446744073709551615ULL, 0);
18549         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18550 #if 0 /* strtoull() for /^-/ strings is undefined. */
18551         check("-1",                    18446744073709551615ULL, 0);
18552         check("-18446744073709551614",                     2LL, 0);
18553         check("-18446744073709551615",                     1LL, 0);
18554         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18555         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18556 #endif
18557         if (!bad)
18558                 printf("ok\n");
18559 }
18560 EOCP
18561         set try
18562         if eval $compile; then
18563                 case "`$run ./try`" in
18564                 ok) echo "Your strtoull() seems to be working okay." ;;
18565                 *) cat <<EOM >&4
18566 Your strtoull() doesn't seem to be working okay.
18567 EOM
18568                    d_strtoull="$undef"
18569                    ;;
18570                 esac
18571         else
18572                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18573                 d_strtoull="$undef"
18574         fi
18575         ;;
18576 esac
18577
18578 : see if strtouq exists
18579 set strtouq d_strtouq
18580 eval $inlibc
18581
18582 case "$d_strtouq" in
18583 "$define")
18584         $cat <<EOM
18585 Checking whether your strtouq() works okay...
18586 EOM
18587         $cat >try.c <<'EOCP'
18588 #include <errno.h>
18589 #include <stdio.h>
18590 extern unsigned long long int strtouq(char *s, char **, int);
18591 static int bad = 0;
18592 void check(char *s, unsigned long long eull, int een) {
18593         unsigned long long gull;
18594         errno = 0;
18595         gull = strtouq(s, 0, 10);
18596         if (!((gull == eull) && (errno == een)))
18597                 bad++;
18598 }
18599 int main() {
18600         check(" 1",                                        1LL, 0);
18601         check(" 0",                                        0LL, 0);
18602         check("18446744073709551615",  18446744073709551615ULL, 0);
18603         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18604 #if 0 /* strtouq() for /^-/ strings is undefined. */
18605         check("-1",                    18446744073709551615ULL, 0);
18606         check("-18446744073709551614",                     2LL, 0);
18607         check("-18446744073709551615",                     1LL, 0);
18608         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18609         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18610 #endif
18611         if (!bad)
18612                 printf("ok\n");
18613         return 0;
18614 }
18615 EOCP
18616         set try
18617         if eval $compile; then
18618                 case "`$run ./try`" in
18619                 ok) echo "Your strtouq() seems to be working okay." ;;
18620                 *) cat <<EOM >&4
18621 Your strtouq() doesn't seem to be working okay.
18622 EOM
18623                    d_strtouq="$undef"
18624                    ;;
18625                 esac
18626         else
18627                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18628                 d_strtouq="$undef"
18629         fi
18630         ;;
18631 esac
18632
18633 : see if strxfrm exists
18634 set strxfrm d_strxfrm
18635 eval $inlibc
18636
18637 : see if symlink exists
18638 set symlink d_symlink
18639 eval $inlibc
18640
18641 : see if syscall exists
18642 set syscall d_syscall
18643 eval $inlibc
18644
18645 : see if prototype for syscall is available
18646 echo " "
18647 set d_syscallproto syscall $i_unistd unistd.h
18648 eval $hasproto
18649
18650 : see if sysconf exists
18651 set sysconf d_sysconf
18652 eval $inlibc
18653
18654 : see if system exists
18655 set system d_system
18656 eval $inlibc
18657
18658 : see if tcgetpgrp exists
18659 set tcgetpgrp d_tcgetpgrp
18660 eval $inlibc
18661
18662 : see if tcsetpgrp exists
18663 set tcsetpgrp d_tcsetpgrp
18664 eval $inlibc
18665
18666 : see if prototype for telldir is available
18667 echo " "
18668 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18669 eval $hasproto
18670
18671 : see if time exists
18672 echo " "
18673 if test "X$d_time" = X -o X"$timetype" = X; then
18674     if set time val -f d_time; eval $csym; $val; then
18675                 echo 'time() found.' >&4
18676                 val="$define"
18677                 rp="What is the type returned by time() on this system?"
18678                 set time_t timetype long stdio.h sys/types.h
18679                 eval $typedef_ask
18680     else
18681                 echo 'time() not found, hope that will do.' >&4
18682                 val="$undef"
18683                 timetype='int';
18684     fi
18685     set d_time
18686     eval $setvar
18687 fi
18688
18689 : see if timegm exists
18690 set timegm d_timegm
18691 eval $inlibc
18692
18693 : see if this is a sys/times.h system
18694 set sys/times.h i_systimes
18695 eval $inhdr
18696
18697 : see if times exists
18698 echo " "
18699 if set times val -f d_times; eval $csym; $val; then
18700         echo 'times() found.' >&4
18701         d_times="$define"
18702         inc=''
18703         case "$i_systimes" in
18704         "$define") inc='sys/times.h';;
18705         esac
18706         rp="What is the type returned by times() on this system?"
18707         set clock_t clocktype long stdio.h sys/types.h $inc
18708         eval $typedef_ask
18709 else
18710         echo 'times() NOT found, hope that will do.' >&4
18711         d_times="$undef"
18712         clocktype='int'
18713 fi
18714
18715 : see if tmpnam_r exists
18716 set tmpnam_r d_tmpnam_r
18717 eval $inlibc
18718 case "$d_tmpnam_r" in
18719 "$define")
18720         hdrs="$i_systypes sys/types.h define stdio.h "
18721         case "$d_tmpnam_r_proto:$usethreads" in
18722         ":define")      d_tmpnam_r_proto=define
18723                 set d_tmpnam_r_proto tmpnam_r $hdrs
18724                 eval $hasproto ;;
18725         *)      ;;
18726         esac
18727         case "$d_tmpnam_r_proto" in
18728         define)
18729         case "$tmpnam_r_proto" in
18730         ''|0) try='char* tmpnam_r(char*);'
18731         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18732         esac
18733         case "$tmpnam_r_proto" in
18734         ''|0)   d_tmpnam_r=undef
18735                 tmpnam_r_proto=0
18736                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18737         * )     case "$tmpnam_r_proto" in
18738                 REENTRANT_PROTO*) ;;
18739                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18740                 esac
18741                 echo "Prototype: $try" ;;
18742         esac
18743         ;;
18744         *)      case "$usethreads" in
18745                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18746                 esac
18747                 d_tmpnam_r=undef
18748                 tmpnam_r_proto=0
18749                 ;;
18750         esac
18751         ;;
18752 *)      tmpnam_r_proto=0
18753         ;;
18754 esac
18755
18756 : see if truncate exists
18757 set truncate d_truncate
18758 eval $inlibc
18759
18760 : see if ttyname_r exists
18761 set ttyname_r d_ttyname_r
18762 eval $inlibc
18763 case "$d_ttyname_r" in
18764 "$define")
18765         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18766         case "$d_ttyname_r_proto:$usethreads" in
18767         ":define")      d_ttyname_r_proto=define
18768                 set d_ttyname_r_proto ttyname_r $hdrs
18769                 eval $hasproto ;;
18770         *)      ;;
18771         esac
18772         case "$d_ttyname_r_proto" in
18773         define)
18774         case "$ttyname_r_proto" in
18775         ''|0) try='int ttyname_r(int, char*, size_t);'
18776         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18777         esac
18778         case "$ttyname_r_proto" in
18779         ''|0) try='int ttyname_r(int, char*, int);'
18780         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18781         esac
18782         case "$ttyname_r_proto" in
18783         ''|0) try='char* ttyname_r(int, char*, int);'
18784         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18785         esac
18786         case "$ttyname_r_proto" in
18787         ''|0)   d_ttyname_r=undef
18788                 ttyname_r_proto=0
18789                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18790         * )     case "$ttyname_r_proto" in
18791                 REENTRANT_PROTO*) ;;
18792                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18793                 esac
18794                 echo "Prototype: $try" ;;
18795         esac
18796         ;;
18797         *)      case "$usethreads" in
18798                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18799                 esac
18800                 d_ttyname_r=undef
18801                 ttyname_r_proto=0
18802                 ;;
18803         esac
18804         ;;
18805 *)      ttyname_r_proto=0
18806         ;;
18807 esac
18808
18809 : see if tzname[] exists
18810 echo " "
18811 if set tzname val -a d_tzname; eval $csym; $val; then
18812         val="$define"
18813         echo 'tzname[] found.' >&4
18814 else
18815         val="$undef"
18816         echo 'tzname[] NOT found.' >&4
18817 fi
18818 set d_tzname
18819 eval $setvar
18820
18821 : Check if is a multiplatform env
18822 case "$osname" in
18823 next|darwin) multiarch="$define" ;;
18824 esac
18825 case "$multiarch" in
18826 ''|[nN]*) multiarch="$undef" ;;
18827 esac
18828
18829 : check for ordering of bytes in a UV
18830 echo " "
18831 case "$usecrosscompile$multiarch" in
18832 *$define*)
18833         $cat <<EOM
18834 You seem to be either cross-compiling or doing a multiarchitecture build,
18835 skipping the byteorder check.
18836
18837 EOM
18838         byteorder='ffff'
18839         ;;
18840 *)
18841         case "$byteorder" in
18842         '')
18843                 $cat <<'EOM'
18844 In the following, larger digits indicate more significance.  A big-endian
18845 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18846 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18847 machines may have weird orders like 3412.  A Cray will report 87654321,
18848 an Alpha will report 12345678. If the test program works the default is
18849 probably right.
18850 I'm now running the test program...
18851 EOM
18852                 $cat >try.c <<EOCP
18853 #include <stdio.h>
18854 #$i_stdlib I_STDLIB
18855 #ifdef I_STDLIB
18856 #include <stdlib.h>
18857 #endif
18858 #include <sys/types.h>
18859 typedef $uvtype UV;
18860 int main()
18861 {
18862         int i;
18863         union {
18864                 UV l;
18865                 char c[$uvsize];
18866         } u;
18867
18868         if ($uvsize > 4)
18869                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18870         else
18871                 u.l = (UV)0x04030201;
18872         for (i = 0; i < $uvsize; i++)
18873                 printf("%c", u.c[i]+'0');
18874         printf("\n");
18875         exit(0);
18876 }
18877 EOCP
18878                 xxx_prompt=y
18879                 set try
18880                 if eval $compile && $run ./try > /dev/null; then
18881                         dflt=`$run ./try`
18882                         case "$dflt" in
18883                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18884                                 echo "(The test program ran ok.)"
18885                                 echo "byteorder=$dflt"
18886                                 xxx_prompt=n
18887                         ;;
18888                         ????|????????) echo "(The test program ran ok.)" ;;
18889                         *) echo "(The test program didn't run right for some reason.)" ;;
18890                         esac
18891                 else
18892                         dflt='4321'
18893                         cat <<'EOM'
18894 (I can't seem to compile the test program.  Guessing big-endian...)
18895 EOM
18896                 fi
18897                 case "$xxx_prompt" in
18898                 y)
18899                         rp="What is the order of bytes in $uvtype?"
18900                         . ./myread
18901                         byteorder="$ans"
18902                         ;;
18903                 *)      byteorder=$dflt
18904                         ;;
18905                 esac
18906                 ;;
18907         esac
18908         $rm_try
18909         ;;
18910 esac
18911
18912 : Checking 32bit alignedness
18913 $cat <<EOM
18914
18915 Checking to see whether you can access character data unalignedly...
18916 EOM
18917 case "$d_u32align" in
18918 '')   $cat >try.c <<EOCP
18919 #include <stdio.h>
18920 #$i_stdlib I_STDLIB
18921 #ifdef I_STDLIB
18922 #include <stdlib.h>
18923 #endif
18924 #define U32 $u32type
18925 #define BYTEORDER 0x$byteorder
18926 #define U8 $u8type
18927 #include <signal.h>
18928 #ifdef SIGBUS
18929 $signal_t bletch(int s) { exit(4); }
18930 #endif
18931 int main() {
18932 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18933     volatile U8 buf[8];
18934     volatile U32 *up;
18935     int i;
18936
18937     if (sizeof(U32) != 4) {
18938         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18939         exit(1);
18940     }
18941
18942     fflush(stdout);
18943
18944 #ifdef SIGBUS
18945     signal(SIGBUS, bletch);
18946 #endif
18947
18948     buf[0] = 0;
18949     buf[1] = 0;
18950     buf[2] = 0;
18951     buf[3] = 1;
18952     buf[4] = 0;
18953     buf[5] = 0;
18954     buf[6] = 0;
18955     buf[7] = 1;
18956
18957     for (i = 0; i < 4; i++) {
18958         up = (U32*)(buf + i);
18959         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18960                (*up == 1 << (8*(3-i)))  /* little-endian */
18961               )
18962            )
18963         {
18964             printf("read failed (%x)\n", *up);
18965             exit(2);
18966         }
18967     }
18968
18969     /* write test */
18970     for (i = 0; i < 4; i++) {
18971         up = (U32*)(buf + i);
18972         *up = 0xBeef;
18973         if (*up != 0xBeef) {
18974             printf("write failed (%x)\n", *up);
18975             exit(3);
18976         }
18977     }
18978
18979     exit(0);
18980 #else
18981     printf("1\n");
18982     exit(1);
18983 #endif
18984     return 0;
18985 }
18986 EOCP
18987 set try
18988 if eval $compile_ok; then
18989         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18990         $run ./try 2>&1 >/dev/null
18991         case "$?" in
18992         0)      cat >&4 <<EOM
18993 You can access character data pretty unalignedly.
18994 EOM
18995                 d_u32align="$undef"
18996                 ;;
18997         *)      cat >&4 <<EOM
18998 It seems that you must access character data in an aligned manner.
18999 EOM
19000                 d_u32align="$define"
19001                 ;;
19002         esac
19003 else
19004         rp='Can you access character data at unaligned addresses?'
19005         dflt='n'
19006         . ./myread
19007         case "$ans" in
19008         [yY]*)  d_u32align="$undef"  ;;
19009         *)      d_u32align="$define" ;;
19010         esac
19011 fi
19012 $rm_try
19013 ;;
19014 esac
19015
19016 : see if ualarm exists
19017 set ualarm d_ualarm
19018 eval $inlibc
19019
19020 : see if umask exists
19021 set umask d_umask
19022 eval $inlibc
19023
19024 : see if unordered exists
19025 set unordered d_unordered
19026 eval $inlibc
19027
19028 : see if unsetenv exists
19029 set unsetenv d_unsetenv
19030 eval $inlibc
19031
19032 : see if usleep exists
19033 set usleep d_usleep
19034 eval $inlibc
19035
19036 : see if prototype for usleep is available
19037 echo " "
19038 set d_usleepproto usleep $i_unistd unistd.h
19039 eval $hasproto
19040
19041 : see if ustat exists
19042 set ustat d_ustat
19043 eval $inlibc
19044
19045 : see if closedir exists
19046 set closedir d_closedir
19047 eval $inlibc
19048
19049 case "$d_closedir" in
19050 "$define")
19051         echo " "
19052         echo "Checking whether closedir() returns a status..." >&4
19053         cat > try.c <<EOM
19054 #$i_dirent I_DIRENT             /**/
19055 #$i_sysdir I_SYS_DIR            /**/
19056 #$i_sysndir I_SYS_NDIR          /**/
19057 #$i_systypes I_SYS_TYPES        /**/
19058
19059 #if defined(I_SYS_TYPES)
19060 #include <sys/types.h>
19061 #endif
19062 #if defined(I_DIRENT)
19063 #include <dirent.h>
19064 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19065 #include <sys/dir.h>
19066 #endif
19067 #else
19068 #ifdef I_SYS_NDIR
19069 #include <sys/ndir.h>
19070 #else
19071 #ifdef I_SYS_DIR
19072 #ifdef hp9000s500
19073 #include <ndir.h>       /* may be wrong in the future */
19074 #else
19075 #include <sys/dir.h>
19076 #endif
19077 #endif
19078 #endif
19079 #endif
19080 int main() { return closedir(opendir(".")); }
19081 EOM
19082         set try
19083         if eval $compile_ok; then
19084                 if $run ./try > /dev/null 2>&1 ; then
19085                         echo "Yes, it does."
19086                         val="$undef"
19087                 else
19088                         echo "No, it doesn't."
19089                         val="$define"
19090                 fi
19091         else
19092                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19093                 val="$define"
19094         fi
19095         ;;
19096 *)
19097         val="$undef";
19098         ;;
19099 esac
19100 set d_void_closedir
19101 eval $setvar
19102 $rm_try
19103
19104 : see if there is a wait4
19105 set wait4 d_wait4
19106 eval $inlibc
19107
19108 : see if waitpid exists
19109 set waitpid d_waitpid
19110 eval $inlibc
19111
19112 : see if wcstombs exists
19113 set wcstombs d_wcstombs
19114 eval $inlibc
19115
19116 : see if wctomb exists
19117 set wctomb d_wctomb
19118 eval $inlibc
19119
19120 : see if writev exists
19121 set writev d_writev
19122 eval $inlibc
19123
19124 : preserve RCS keywords in files with variable substitution, grrr
19125 Date='$Date'
19126 Id='$Id'
19127 Log='$Log'
19128 RCSfile='$RCSfile'
19129 Revision='$Revision'
19130
19131 : check for alignment requirements
19132 echo " "
19133 case "$usecrosscompile" in
19134 *$define*)
19135         $cat <<EOM
19136 You seem to be cross-compiling.  Skipping the memory alignment check.
19137
19138 EOM
19139         case "$alignbytes" in
19140         '') alignbytes=8 ;;
19141         esac
19142         ;;
19143 *)
19144         case "$alignbytes" in
19145         '') echo "Checking alignment constraints..." >&4
19146                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19147                         $cat >try.c <<'EOCP'
19148 typedef long double NV;
19149 EOCP
19150                 else
19151                         $cat >try.c <<'EOCP'
19152 typedef double NV;
19153 EOCP
19154                 fi
19155                 $cat >>try.c <<'EOCP'
19156 #include <stdio.h>
19157 struct foobar {
19158         char foo;
19159         NV bar;
19160 } try_algn;
19161 int main()
19162 {
19163     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19164     return(0);
19165 }
19166 EOCP
19167                 set try
19168                 if eval $compile_ok; then
19169                         dflt=`$run ./try`
19170                 else
19171                         dflt='8'
19172                         echo "(I can't seem to compile the test program...)"
19173                 fi
19174                 case "$multiarch" in
19175                 *$define*)
19176                         : The usual safe value is 8, but Darwin with -Duselongdouble
19177                         : needs 16.  Hence, we will take 8 as a minimum, but allow
19178                         : Configure to pick a larger value if needed.
19179                         if $test "$dflt" -lt 8; then
19180                             dflt='8'
19181                                 echo "Setting alignment to 8 for multiarch support.">&4
19182                         fi
19183                         ;;
19184                 esac
19185                 ;;
19186         *) dflt="$alignbytes"
19187                 ;;
19188         esac
19189         rp="Doubles must be aligned on a how-many-byte boundary?"
19190         . ./myread
19191         alignbytes="$ans"
19192         $rm_try
19193         ;;
19194 esac
19195
19196
19197 : set the base revision
19198 baserev=5.0
19199
19200 : Determine if this is an EBCDIC system
19201 echo " "
19202 echo "Determining whether or not we are on an EBCDIC system..." >&4
19203 $cat >try.c <<'EOM'
19204 int main()
19205 {
19206   if ('M'==0xd4) return 0;
19207   return 1;
19208 }
19209 EOM
19210
19211 case "$BOOTSTRAP_CHARSET" in
19212     Y|y|define) bootstrap_charset=$define       ;;
19213     *)          bootstrap_charset=$undef        ;;
19214 esac
19215
19216 val=$undef
19217 set try
19218 if eval $compile_ok; then
19219         if $run ./try; then
19220                 echo "You seem to speak EBCDIC." >&4
19221                 val="$define"
19222         else
19223                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19224         fi
19225 else
19226         echo "I'm unable to compile the test program." >&4
19227         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19228 fi
19229 $rm_try
19230 set ebcdic
19231 eval $setvar
19232
19233 : length of character in bytes. Is always 1, otherwise it is not C
19234 : This used to be a test using sizeof
19235 charsize=1
19236
19237 : Check for the number of bits in a character
19238 case "$charbits" in
19239 '')     echo "Checking how long a character is (in bits)..." >&4
19240         $cat >try.c <<EOCP
19241 #include <stdio.h>
19242 int main ()
19243 {
19244     int n;
19245     unsigned char c;
19246     for (c = 1, n = 0; c; c <<= 1, n++) ;
19247     printf ("%d\n", n);
19248     return (0);
19249     }
19250 EOCP
19251         set try
19252         if eval $compile_ok; then
19253                 dflt=`$run ./try`
19254         else
19255                 dflt='8'
19256                 echo "(I can't seem to compile the test program.  Guessing...)"
19257         fi
19258         ;;
19259 *)
19260         dflt="$charbits"
19261         ;;
19262 esac
19263 rp="What is the length of a character (in bits)?"
19264 . ./myread
19265 charbits="$ans"
19266 $rm_try
19267 case "$charbits" in
19268 8)      ;;
19269 *)      cat >&4 << EOM
19270 Your system has an unsigned character size of $charbits bits, which
19271 is rather unusual (normally it is 8 bits).  Perl likely will not work
19272 correctly on your system, with subtle bugs in various places.
19273 EOM
19274         rp='Do you really want to continue?'
19275         dflt='n'
19276         . ./myread
19277         case "$ans" in
19278                 [yY])   echo >&4 "Okay, continuing."    ;;
19279                 *)      exit 1                          ;;
19280         esac
19281 esac
19282
19283 : how do we concatenate cpp tokens here?
19284 echo " "
19285 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19286 $cat >cpp_stuff.c <<'EOCP'
19287 #define RCAT(a,b)a/**/b
19288 #define ACAT(a,b)a ## b
19289 RCAT(Rei,ser)
19290 ACAT(Cir,cus)
19291 EOCP
19292 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19293 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19294         echo "Oh!  Smells like ANSI's been here." >&4
19295         echo "We can catify or stringify, separately or together!"
19296         cpp_stuff=42
19297 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19298         echo "Ah, yes!  The good old days!" >&4
19299         echo "However, in the good old days we don't know how to stringify and"
19300         echo "catify at the same time."
19301         cpp_stuff=1
19302 else
19303         $cat >&4 <<EOM
19304 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19305 You're going to have to edit the values of CAT[2-5] in config.h...
19306 EOM
19307         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19308 fi
19309 $rm -f cpp_stuff.*
19310
19311 : see if this is a db.h system
19312 set db.h i_db
19313 eval $inhdr
19314
19315 case "$i_db" in
19316 $define)
19317         : Check db version.
19318         echo " "
19319         echo "Checking Berkeley DB version ..." >&4
19320         $cat >try.c <<EOCP
19321 #$d_const HASCONST
19322 #ifndef HASCONST
19323 #define const
19324 #endif
19325 #include <sys/types.h>
19326 #include <stdio.h>
19327 #$i_stdlib I_STDLIB
19328 #ifdef I_STDLIB
19329 #include <stdlib.h>
19330 #endif
19331 #include <db.h>
19332 int main(int argc, char *argv[])
19333 {
19334 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19335     int Major, Minor, Patch ;
19336     unsigned long Version ;
19337     (void)db_version(&Major, &Minor, &Patch) ;
19338     if (argc == 2) {
19339         printf("%d %d %d %d %d %d\n",
19340                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19341                Major, Minor, Patch);
19342         exit(0);
19343     }
19344     printf("You have Berkeley DB Version 2 or greater.\n");
19345
19346     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19347                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19348     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19349                 Major, Minor, Patch) ;
19350
19351     /* check that db.h & libdb are compatible */
19352     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19353         printf("db.h and libdb are incompatible.\n") ;
19354         exit(3);
19355     }
19356
19357     printf("db.h and libdb are compatible.\n") ;
19358
19359     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19360                 + DB_VERSION_PATCH ;
19361
19362     /* needs to be >= 2.3.4 */
19363     if (Version < 2003004) {
19364     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19365         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19366         exit(2);
19367     }
19368
19369     exit(0);
19370 #else
19371 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19372     if (argc == 2) {
19373         printf("1 0 0\n");
19374         exit(0);
19375     }
19376     printf("You have Berkeley DB Version 1.\n");
19377     exit(0);    /* DB version < 2: the coast is clear. */
19378 #else
19379     exit(1);    /* <db.h> not Berkeley DB? */
19380 #endif
19381 #endif
19382 }
19383 EOCP
19384         set try
19385         if eval $compile_ok && $run ./try; then
19386                 echo 'Looks OK.' >&4
19387                 set `$run ./try 1`
19388                 db_version_major=$1
19389                 db_version_minor=$2
19390                 db_version_patch=$3
19391         else
19392                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19393                 i_db=$undef
19394                 case " $libs " in
19395                 *"-ldb "*)
19396                         : Remove db from list of libraries to use
19397                         echo "Removing unusable -ldb from library list" >&4
19398                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19399                         shift
19400                         libs="$*"
19401                         echo "libs = $libs" >&4
19402                         ;;
19403                 esac
19404         fi
19405         $rm_try
19406         ;;
19407 esac
19408
19409 case "$i_db" in
19410 define)
19411         : Check the return type needed for hash
19412         echo " "
19413         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19414         $cat >try.c <<EOCP
19415 #$d_const HASCONST
19416 #ifndef HASCONST
19417 #define const
19418 #endif
19419 #include <sys/types.h>
19420 #include <db.h>
19421
19422 #ifndef DB_VERSION_MAJOR
19423 u_int32_t hash_cb (ptr, size)
19424 const void *ptr;
19425 size_t size;
19426 {
19427 }
19428 HASHINFO info;
19429 int main()
19430 {
19431         info.hash = hash_cb;
19432 }
19433 #endif
19434 EOCP
19435         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19436                 if $contains warning try.out >>/dev/null 2>&1 ; then
19437                         db_hashtype='int'
19438                 else
19439                         db_hashtype='u_int32_t'
19440                 fi
19441         else
19442                 : XXX Maybe we should just give up here.
19443                 db_hashtype=u_int32_t
19444                 $cat try.out >&4
19445                 echo "Help:  I can't seem to compile the db test program." >&4
19446                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19447         fi
19448         $rm_try
19449         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19450         ;;
19451 *)      db_hashtype=u_int32_t
19452         ;;
19453 esac
19454 case "$i_db" in
19455 define)
19456         : Check the return type needed for prefix
19457         echo " "
19458         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19459         cat >try.c <<EOCP
19460 #$d_const HASCONST
19461 #ifndef HASCONST
19462 #define const
19463 #endif
19464 #include <sys/types.h>
19465 #include <db.h>
19466
19467 #ifndef DB_VERSION_MAJOR
19468 size_t prefix_cb (key1, key2)
19469 const DBT *key1;
19470 const DBT *key2;
19471 {
19472 }
19473 BTREEINFO info;
19474 int main()
19475 {
19476         info.prefix = prefix_cb;
19477 }
19478 #endif
19479 EOCP
19480         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19481                 if $contains warning try.out >>/dev/null 2>&1 ; then
19482                         db_prefixtype='int'
19483                 else
19484                         db_prefixtype='size_t'
19485                 fi
19486         else
19487                 db_prefixtype='size_t'
19488                 : XXX Maybe we should just give up here.
19489                 $cat try.out >&4
19490                 echo "Help:  I can't seem to compile the db test program." >&4
19491                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19492         fi
19493         $rm_try
19494         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19495         ;;
19496 *)      db_prefixtype='size_t'
19497         ;;
19498 esac
19499
19500 : How can we generate normalized random numbers ?
19501 echo " "
19502 echo "Looking for a random number function..." >&4
19503 case "$randfunc" in
19504 '')
19505         if set drand48 val -f; eval $csym; $val; then
19506                 dflt="drand48"
19507                 echo "Good, found drand48()." >&4
19508         elif set random val -f; eval $csym; $val; then
19509                 dflt="random"
19510                 echo "OK, found random()." >&4
19511         else
19512                 dflt="rand"
19513                 echo "Yuck, looks like I have to use rand()." >&4
19514         fi
19515         echo " "
19516         ;;
19517 *)
19518         dflt="$randfunc"
19519         ;;
19520 esac
19521 cont=true
19522
19523 case "$ccflags" in
19524 *-Dmy_rand=*|*-Dmy_srand=*)
19525         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19526         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19527         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19528         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19529         ;;
19530 esac
19531
19532 while $test "$cont"; do
19533         rp="Use which function to generate random numbers?"
19534         . ./myread
19535         if $test "$ans" = "$dflt"; then
19536                 : null
19537         else
19538                 randbits=''
19539         fi
19540         randfunc="$ans"
19541         if set $ans val -f; eval $csym; $val; then
19542                 cont=''
19543         else
19544                 dflt=y
19545                 rp="I cannot find function $ans. Use that name anyway?"
19546                 . ./myread
19547                 dflt=rand
19548                 case "$ans" in
19549                         [yY]*) cont='';;
19550                 esac
19551         fi
19552         case "$cont" in
19553         '')
19554                 case "$randfunc" in
19555                 drand48)
19556                         drand01="drand48()"
19557                         seedfunc="srand48"
19558                         randbits=48
19559                         randseedtype=long
19560                         ;;
19561                 rand|random)
19562                         case "$randbits" in
19563                         '')
19564 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19565                                 $cat >try.c <<EOCP
19566 #$i_unistd I_UNISTD
19567 #$i_stdlib I_STDLIB
19568 #include <stdio.h>
19569 #ifdef I_UNISTD
19570 #  include <unistd.h>
19571 #endif
19572 #ifdef I_STDLIB
19573 #  include <stdlib.h>
19574 #endif
19575 int main()
19576 {
19577         int i;
19578         unsigned long tmp;
19579         unsigned long max = 0L;
19580
19581         for (i = 1000; i; i--) {
19582                 tmp = (unsigned long) $randfunc();
19583                 if (tmp > max) max = tmp;
19584         }
19585         for (i = 0; max; i++)
19586                 max /= 2;
19587         printf("%d\n",i);
19588 }
19589 EOCP
19590                                 set try
19591                                 if eval $compile_ok; then
19592                                         dflt=`try`
19593                                 else
19594                                         dflt='?'
19595                                         echo "(I can't seem to compile the test program...)"
19596                                 fi
19597                                 ;;
19598                         *)
19599                                 dflt="$randbits"
19600                                 ;;
19601                         esac
19602                         rp="How many bits does your $randfunc() function produce?"
19603                         . ./myread
19604                         randbits="$ans"
19605                         $rm_try
19606                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19607                         seedfunc="s$randfunc"
19608                         randseedtype=unsigned
19609                         ;;
19610                 *)
19611                         dflt="31"
19612                         rp="How many bits does your $randfunc() function produce?"
19613                         . ./myread
19614                         randbits="$ans"
19615                         seedfunc="s$randfunc"
19616                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19617                         if set $seedfunc val -f; eval $csym; $val; then
19618                                 echo "(Using $seedfunc() to seed random generator)"
19619                         else
19620                                 echo "(Warning: no $seedfunc() to seed random generator)"
19621                                 seedfunc=rand
19622                         fi
19623                         randseedtype=unsigned
19624                         ;;
19625                 esac
19626                 ;;
19627         esac
19628 done
19629
19630 : Check how to flush
19631 echo " "
19632 $cat >&4 <<EOM
19633 Checking how to flush all pending stdio output...
19634 EOM
19635 # I only know how to find the first 32 possibly open files on SunOS.
19636 # See also hints/sunos_4_1.sh and util.c  --AD
19637 case "$osname" in
19638 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19639 esac
19640 $cat >>try.c <<EOCP
19641 #include <stdio.h>
19642 #$i_stdlib I_STDLIB
19643 #ifdef I_STDLIB
19644 #include <stdlib.h>
19645 #endif
19646 #$i_unistd I_UNISTD
19647 #ifdef I_UNISTD
19648 # include <unistd.h>
19649 #endif
19650 #$d_sysconf HAS_SYSCONF
19651 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19652 #ifdef HAS_STDIO_STREAM_ARRAY
19653 # define STDIO_STREAM_ARRAY $stdio_stream_array
19654 #endif
19655 int main() {
19656   FILE* p;
19657   unlink("try.out");
19658   p = fopen("try.out", "w");
19659 #ifdef TRY_FPUTC
19660   fputc('x', p);
19661 #else
19662 # ifdef TRY_FPRINTF
19663   fprintf(p, "x");
19664 # endif
19665 #endif
19666 #ifdef TRY_FFLUSH_NULL
19667   fflush(NULL);
19668 #endif
19669 #ifdef TRY_FFLUSH_ALL
19670   {
19671     long open_max = -1;
19672 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19673     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19674 # else
19675 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19676     open_max = sysconf(_SC_OPEN_MAX);
19677 #  else
19678 #   ifdef FOPEN_MAX
19679     open_max = FOPEN_MAX;
19680 #   else
19681 #    ifdef OPEN_MAX
19682     open_max = OPEN_MAX;
19683 #    else
19684 #     ifdef _NFILE
19685     open_max = _NFILE;
19686 #     endif
19687 #    endif
19688 #   endif
19689 #  endif
19690 # endif
19691 # ifdef HAS_STDIO_STREAM_ARRAY
19692     if (open_max > 0) {
19693       long i;
19694       for (i = 0; i < open_max; i++)
19695             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19696                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19697                 STDIO_STREAM_ARRAY[i]._flag)
19698                 fflush(&STDIO_STREAM_ARRAY[i]);
19699     }
19700   }
19701 # endif
19702 #endif
19703   _exit(42);
19704 }
19705 EOCP
19706 : first we have to find out how _not_ to flush
19707 $to try.c
19708 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19709     output=''
19710     set try -DTRY_FPUTC
19711     if eval $compile; then
19712             $run ./try 2>/dev/null
19713             code="$?"
19714             $from try.out
19715             if $test ! -s try.out -a "X$code" = X42; then
19716                 output=-DTRY_FPUTC
19717             fi
19718     fi
19719     case "$output" in
19720     '')
19721             set try -DTRY_FPRINTF
19722             if eval $compile; then
19723                     $run ./try 2>/dev/null
19724                     code="$?"
19725                     $from try.out
19726                     if $test ! -s try.out -a "X$code" = X42; then
19727                         output=-DTRY_FPRINTF
19728                     fi
19729             fi
19730         ;;
19731     esac
19732 fi
19733 : check for fflush NULL behavior
19734 case "$fflushNULL" in
19735 '')     set try -DTRY_FFLUSH_NULL $output
19736         if eval $compile; then
19737                 $run ./try 2>/dev/null
19738                 code="$?"
19739                 $from try.out
19740                 if $test -s try.out -a "X$code" = X42; then
19741                         fflushNULL="`$cat try.out`"
19742                 else
19743                         if $test "X$code" != X42; then
19744                                 $cat >&4 <<EOM
19745 (If this test failed, don't worry, we'll try another method shortly.)
19746 EOM
19747                         fi
19748                 fi
19749         fi
19750         $rm -f core try.core core.try.*
19751         case "$fflushNULL" in
19752         x)      $cat >&4 <<EOM
19753 Your fflush(NULL) works okay for output streams.
19754 Let's see if it clobbers input pipes...
19755 EOM
19756 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19757 # bug that improperly flushes the input end of pipes.  So we avoid the
19758 # autoflush on fork/system/exec support for now. :-(
19759 $cat >tryp.c <<EOCP
19760 #include <stdio.h>
19761 int
19762 main(int argc, char **argv)
19763 {
19764     char buf[1024];
19765     int i;
19766     char *bp = buf;
19767     while (1) {
19768         while ((i = getc(stdin)) != -1
19769                && (*bp++ = i) != '\n'
19770                && bp < &buf[1024])
19771         /* DO NOTHING */ ;
19772         *bp = '\0';
19773         fprintf(stdout, "%s", buf);
19774         fflush(NULL);
19775         if (i == -1)
19776             return 0;
19777         bp = buf;
19778     }
19779 }
19780 EOCP
19781                 fflushNULL="$define"
19782                 set tryp
19783                 if eval $compile; then
19784                     $rm -f tryp.out
19785                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19786                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19787                        $cat >&4 <<EOM
19788 fflush(NULL) seems to behave okay with input streams.
19789 EOM
19790                         fflushNULL="$define"
19791                     else
19792                         $cat >&4 <<EOM
19793 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19794 EOM
19795                         fflushNULL="$undef"
19796                     fi
19797                 fi
19798                 $rm -f core tryp.c tryp.core core.tryp.*
19799                 ;;
19800         '')     $cat >&4 <<EOM
19801 Your fflush(NULL) isn't working (contrary to ANSI C).
19802 EOM
19803                 fflushNULL="$undef"
19804                 ;;
19805         *)      $cat >&4 <<EOM
19806 Cannot figure out whether your fflush(NULL) works or not.
19807 I'm assuming it doesn't (contrary to ANSI C).
19808 EOM
19809                 fflushNULL="$undef"
19810                 ;;
19811         esac
19812         ;;
19813 $define|true|[yY]*)
19814         fflushNULL="$define"
19815         ;;
19816 *)
19817         fflushNULL="$undef"
19818         ;;
19819 esac
19820 : check explicit looping only if NULL did not work, and if the pipe
19821 : bug does not show up on an explicit flush too
19822 case "$fflushNULL" in
19823 "$undef")
19824         $cat >tryp.c <<EOCP
19825 #include <stdio.h>
19826 int
19827 main(int argc, char **argv)
19828 {
19829     char buf[1024];
19830     int i;
19831     char *bp = buf;
19832     while (1) {
19833         while ((i = getc(stdin)) != -1
19834                && (*bp++ = i) != '\n'
19835                && bp < &buf[1024])
19836         /* DO NOTHING */ ;
19837         *bp = '\0';
19838         fprintf(stdout, "%s", buf);
19839         fflush(stdin);
19840         if (i == -1)
19841             return 0;
19842         bp = buf;
19843     }
19844 }
19845 EOCP
19846         set tryp
19847         if eval $compile; then
19848             $rm -f tryp.out
19849             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19850             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19851                $cat >&4 <<EOM
19852 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19853 EOM
19854                 : now check for fflushall behaviour
19855                 case "$fflushall" in
19856                 '')     set try -DTRY_FFLUSH_ALL $output
19857                         if eval $compile; then
19858                                 $cat >&4 <<EOM
19859 (Now testing the other method--but note that this also may fail.)
19860 EOM
19861                                 $run ./try 2>/dev/null
19862                                 code=$?
19863                                 $from try.out
19864                                 if $test -s try.out -a "X$code" = X42; then
19865                                         fflushall="`$cat try.out`"
19866                                 fi
19867                         fi
19868                         $rm_try
19869                         case "$fflushall" in
19870                         x)      $cat >&4 <<EOM
19871 Whew. Flushing explicitly all the stdio streams works.
19872 EOM
19873                                 fflushall="$define"
19874                                 ;;
19875                         '')     $cat >&4 <<EOM
19876 Sigh. Flushing explicitly all the stdio streams doesn't work.
19877 EOM
19878                                 fflushall="$undef"
19879                                 ;;
19880                         *)      $cat >&4 <<EOM
19881 Cannot figure out whether flushing stdio streams explicitly works or not.
19882 I'm assuming it doesn't.
19883 EOM
19884                                 fflushall="$undef"
19885                                 ;;
19886                         esac
19887                         ;;
19888                 "$define"|true|[yY]*)
19889                         fflushall="$define"
19890                         ;;
19891                 *)
19892                         fflushall="$undef"
19893                         ;;
19894                 esac
19895             else
19896                 $cat >&4 <<EOM
19897 All is futile.  Even fflush(stdin) clobbers input pipes!
19898 EOM
19899                 fflushall="$undef"
19900             fi
19901         else
19902             fflushall="$undef"
19903         fi
19904         $rm -f core tryp.c tryp.core core.tryp.*
19905         ;;
19906 *)      fflushall="$undef"
19907         ;;
19908 esac
19909
19910 case "$fflushNULL$fflushall" in
19911 undefundef)
19912         $cat <<EOM
19913 OK, I give up.  I cannot figure out how to flush pending stdio output.
19914 We won't be flushing handles at all before fork/exec/popen.
19915 EOM
19916         ;;
19917 esac
19918 $rm_try tryp
19919
19920 : Store the full pathname to the ar program for use in the C program
19921 : Respect a hint or command line value for full_ar.
19922 case "$full_ar" in
19923 '') full_ar=$ar ;;
19924 esac
19925
19926 : Store the full pathname to the sed program for use in the C program
19927 full_sed=$sed
19928
19929 : see what type gids are declared as in the kernel
19930 echo " "
19931 echo "Looking for the type for group ids returned by getgid()."
19932 set gid_t gidtype xxx stdio.h sys/types.h
19933 eval $typedef
19934 case "$gidtype" in
19935 xxx)
19936         xxx=`./findhdr sys/user.h`
19937         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19938         case $1 in
19939         unsigned) dflt="$1 $2" ;;
19940         *) dflt="$1" ;;
19941         esac
19942         ;;
19943 *) dflt="$gidtype";;
19944 esac
19945 case "$gidtype" in
19946 gid_t) echo "gid_t found." ;;
19947 *)      rp="What is the type for group ids returned by getgid()?"
19948         . ./myread
19949         gidtype="$ans"
19950         ;;
19951 esac
19952
19953 : Check the size of GID
19954 echo " "
19955 case "$gidtype" in
19956 *_t) zzz="$gidtype"     ;;
19957 *)   zzz="gid"          ;;
19958 esac
19959 echo "Checking the size of $zzz..." >&4
19960 cat > try.c <<EOCP
19961 #include <sys/types.h>
19962 #include <stdio.h>
19963 #$i_stdlib I_STDLIB
19964 #ifdef I_STDLIB
19965 #include <stdlib.h>
19966 #endif
19967 int main() {
19968     printf("%d\n", (int)sizeof($gidtype));
19969     exit(0);
19970 }
19971 EOCP
19972 set try
19973 if eval $compile_ok; then
19974         yyy=`$run ./try`
19975         case "$yyy" in
19976         '')     gidsize=4
19977                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19978                 ;;
19979         *)      gidsize=$yyy
19980                 echo "Your $zzz is $gidsize bytes long."
19981                 ;;
19982         esac
19983 else
19984         gidsize=4
19985         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19986 fi
19987
19988
19989 : Check if GID is signed
19990 echo " "
19991 case "$gidtype" in
19992 *_t) zzz="$gidtype"     ;;
19993 *)   zzz="gid"          ;;
19994 esac
19995 echo "Checking the sign of $zzz..." >&4
19996 cat > try.c <<EOCP
19997 #include <sys/types.h>
19998 #include <stdio.h>
19999 int main() {
20000         $gidtype foo = -1;
20001         if (foo < 0)
20002                 printf("-1\n");
20003         else
20004                 printf("1\n");
20005 }
20006 EOCP
20007 set try
20008 if eval $compile; then
20009         yyy=`$run ./try`
20010         case "$yyy" in
20011         '')     gidsign=1
20012                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20013                 ;;
20014         *)      gidsign=$yyy
20015                 case "$gidsign" in
20016                  1) echo "Your $zzz is unsigned." ;;
20017                 -1) echo "Your $zzz is signed."   ;;
20018                 esac
20019                 ;;
20020         esac
20021 else
20022         gidsign=1
20023         echo "(I can't compile the test program--guessing unsigned.)" >&4
20024 fi
20025
20026
20027 : Check 64bit sizes
20028 echo " "
20029
20030 if $test X"$quadtype" != X; then
20031
20032 echo "Checking how to print 64-bit integers..." >&4
20033
20034 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20035         $cat >try.c <<'EOCP'
20036 #include <sys/types.h>
20037 #include <stdio.h>
20038 int main() {
20039   int q = 12345678901;
20040   printf("%ld\n", q);
20041 }
20042 EOCP
20043         set try
20044         if eval $compile; then
20045                 yyy=`$run ./try`
20046                 case "$yyy" in
20047                 12345678901)
20048                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20049                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20050                         echo "We will use %d."
20051                         ;;
20052                 esac
20053         fi
20054 fi
20055
20056 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20057         $cat >try.c <<'EOCP'
20058 #include <sys/types.h>
20059 #include <stdio.h>
20060 int main() {
20061   long q = 12345678901;
20062   printf("%ld\n", q);
20063 }
20064 EOCP
20065         set try
20066         if eval $compile; then
20067                 yyy=`$run ./try`
20068                 case "$yyy" in
20069                 12345678901)
20070                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20071                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20072                         echo "We will use %ld."
20073                         ;;
20074                 esac
20075         fi
20076 fi
20077
20078 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20079         $cat >try.c <<'EOCP'
20080 #include <sys/types.h>
20081 #include <inttypes.h>
20082 #include <stdio.h>
20083 int main() {
20084   int64_t q = 12345678901;
20085   printf("%" PRId64 "\n", q);
20086 }
20087 EOCP
20088         set try
20089         if eval $compile; then
20090                 yyy=`$run ./try`
20091                 case "$yyy" in
20092                 12345678901)
20093                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20094                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20095                         echo "We will use the C9X style."
20096                         ;;
20097                 esac
20098         fi
20099 fi
20100
20101 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20102         $cat >try.c <<EOCP
20103 #include <sys/types.h>
20104 #include <stdio.h>
20105 int main() {
20106   $quadtype q = 12345678901;
20107   printf("%Ld\n", q);
20108 }
20109 EOCP
20110         set try
20111         if eval $compile; then
20112                 yyy=`$run ./try`
20113                 case "$yyy" in
20114                 12345678901)
20115                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20116                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20117                         echo "We will use %Ld."
20118                         ;;
20119                 esac
20120         fi
20121 fi
20122
20123 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20124         $cat >try.c <<'EOCP'
20125 #include <sys/types.h>
20126 #include <stdio.h>
20127 int main() {
20128   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20129   printf("%lld\n", q);
20130 }
20131 EOCP
20132         set try
20133         if eval $compile; then
20134                 yyy=`$run ./try`
20135                 case "$yyy" in
20136                 12345678901)
20137                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20138                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20139                         echo "We will use the %lld style."
20140                         ;;
20141                 esac
20142         fi
20143 fi
20144
20145 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20146         $cat >try.c <<EOCP
20147 #include <sys/types.h>
20148 #include <stdio.h>
20149 int main() {
20150   $quadtype q = 12345678901;
20151   printf("%qd\n", q);
20152 }
20153 EOCP
20154         set try
20155         if eval $compile; then
20156                 yyy=`$run ./try`
20157                 case "$yyy" in
20158                 12345678901)
20159                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20160                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20161                         echo "We will use %qd."
20162                         ;;
20163                 esac
20164         fi
20165 fi
20166
20167 if $test X"$sPRId64" = X; then
20168         echo "Cannot figure out how to print 64-bit integers." >&4
20169 fi
20170 $rm_try
20171
20172 fi
20173
20174 case "$sPRId64" in
20175 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20176         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20177         ;;
20178 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20179         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20180         ;;
20181 esac
20182
20183 : Check format strings for internal types
20184 echo " "
20185 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20186
20187 if $test X"$ivsize" = X8; then
20188         ivdformat="$sPRId64"
20189         uvuformat="$sPRIu64"
20190         uvoformat="$sPRIo64"
20191         uvxformat="$sPRIx64"
20192         uvXUformat="$sPRIXU64"
20193 else
20194         if $test X"$ivsize" = X"$longsize"; then
20195                 ivdformat='"ld"'
20196                 uvuformat='"lu"'
20197                 uvoformat='"lo"'
20198                 uvxformat='"lx"'
20199                 uvXUformat='"lX"'
20200         else
20201                 if $test X"$ivsize" = X"$intsize"; then
20202                         ivdformat='"d"'
20203                         uvuformat='"u"'
20204                         uvoformat='"o"'
20205                         uvxformat='"x"'
20206                         uvXUformat='"X"'
20207                 else
20208                         : far out
20209                         if $test X"$ivsize" = X"$shortsize"; then
20210                                 ivdformat='"hd"'
20211                                 uvuformat='"hu"'
20212                                 uvoformat='"ho"'
20213                                 uvxformat='"hx"'
20214                                 uvXUformat='"hX"'
20215                         fi
20216                 fi
20217         fi
20218 fi
20219
20220 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20221         nveformat="$sPRIeldbl"
20222         nvfformat="$sPRIfldbl"
20223         nvgformat="$sPRIgldbl"
20224         nvEUformat="$sPRIEUldbl"
20225         nvFUformat="$sPRIFUldbl"
20226         nvGUformat="$sPRIGUldbl"
20227 else
20228         nveformat='"e"'
20229         nvfformat='"f"'
20230         nvgformat='"g"'
20231         nvEUformat='"E"'
20232         nvFUformat='"F"'
20233         nvGUformat='"G"'
20234 fi
20235
20236 case "$ivdformat" in
20237 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20238     exit 1
20239     ;;
20240 esac
20241
20242 : Check format string for GID
20243
20244 echo " "
20245 $echo "Checking the format string to be used for gids..." >&4
20246
20247 case "$gidsign" in
20248 -1)     if $test X"$gidsize" = X"$ivsize"; then
20249                 gidformat="$ivdformat"
20250         else
20251                 if $test X"$gidsize" = X"$longsize"; then
20252                         gidformat='"ld"'
20253                 else
20254                         if $test X"$gidsize" = X"$intsize"; then
20255                                 gidformat='"d"'
20256                         else
20257                                 if $test X"$gidsize" = X"$shortsize"; then
20258                                         gidformat='"hd"'
20259                                 fi
20260                         fi
20261                 fi
20262         fi
20263         ;;
20264 *)      if $test X"$gidsize" = X"$uvsize"; then
20265                 gidformat="$uvuformat"
20266         else
20267                 if $test X"$gidsize" = X"$longsize"; then
20268                         gidformat='"lu"'
20269                 else
20270                         if $test X"$gidsize" = X"$intsize"; then
20271                                 gidformat='"u"'
20272                         else
20273                                 if $test X"$gidsize" = X"$shortsize"; then
20274                                         gidformat='"hu"'
20275                                 fi
20276                         fi
20277                 fi
20278         fi
20279         ;;
20280 esac
20281
20282 : see if getgroups exists
20283 set getgroups d_getgrps
20284 eval $inlibc
20285
20286 : see if setgroups exists
20287 set setgroups d_setgrps
20288 eval $inlibc
20289
20290 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20291 echo " "
20292 case "$d_getgrps$d_setgrps" in
20293 *define*)
20294         case "$groupstype" in
20295         '') dflt="$gidtype" ;;
20296         *)  dflt="$groupstype" ;;
20297         esac
20298         $cat <<EOM
20299 What type of pointer is the second argument to getgroups() and setgroups()?
20300 Usually this is the same as group ids, $gidtype, but not always.
20301
20302 EOM
20303         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20304         . ./myread
20305         groupstype="$ans"
20306         ;;
20307 *)  groupstype="$gidtype";;
20308 esac
20309
20310 : MAD = Misc Attribute Definition
20311
20312 if $test $patchlevel -lt 9; then
20313 : MAD is not available in 5.8.x or earlier.
20314     ans=n;
20315 else
20316     case "$mad" in
20317     $define|true|[yY]*) dflt='y' ;;
20318     *)                  dflt='n' ;;
20319     esac
20320     cat <<EOM
20321
20322 Would you like to build with Misc Attribute Decoration? This is development
20323 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20324 overhead on the interpreter.
20325
20326 If this doesn't make any sense to you, just accept the default '$dflt'.
20327 EOM
20328     rp='Build Perl with MAD?'
20329     . ./myread
20330 fi
20331 case "$ans" in
20332 y|Y)    val="$define"
20333         madlyh='madly.h madly.act madly.tab'
20334         madlysrc='madly.c'
20335         madlyobj="madly$_o" ;;
20336 *)      val="$undef"
20337         madlyh=''
20338         madlysrc=''
20339         madlyobj='' ;;
20340 esac
20341 set mad
20342 eval $setvar
20343
20344 : check whether make sets MAKE
20345 echo " "
20346 echo "Checking if your $make program sets \$(MAKE)..." >&4
20347 case "$make_set_make" in
20348 '')
20349         $sed 's/^X //' > testmake.mak << 'EOF'
20350 Xall:
20351 X       @echo 'maketemp="$(MAKE)"'
20352 EOF
20353         case "`$make -f testmake.mak 2>/dev/null`" in
20354         *maketemp=*) make_set_make='#' ;;
20355         *)      make_set_make="MAKE=$make" ;;
20356         esac
20357         $rm -f testmake.mak
20358         ;;
20359 esac
20360 case "$make_set_make" in
20361 '#') echo "Yup, it does.";;
20362 *) echo "Nope, it doesn't.";;
20363 esac
20364
20365 : see what type is used for mode_t
20366 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20367 set mode_t modetype int stdio.h sys/types.h
20368 eval $typedef_ask
20369
20370 : see if we need va_copy
20371 echo " "
20372 case "$i_stdarg" in
20373 "$define")
20374         $cat >try.c <<EOCP
20375 #include <stdarg.h>
20376 #include <stdio.h>
20377 #$i_stdlib I_STDLIB
20378 #ifdef I_STDLIB
20379 #include <stdlib.h>
20380 #endif
20381 #include <signal.h>
20382
20383 int
20384 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20385 {
20386   return vfprintf(f, fmt, *valp);
20387 }
20388
20389 int
20390 myvfprintf(FILE *f, const  char *fmt, va_list val)
20391 {
20392   return ivfprintf(f, fmt, &val);
20393 }
20394
20395 int
20396 myprintf(char *fmt, ...)
20397 {
20398   va_list val;
20399   va_start(val, fmt);
20400   return myvfprintf(stdout, fmt, val);
20401 }
20402
20403 int
20404 main(int ac, char **av)
20405 {
20406   signal(SIGSEGV, exit);
20407
20408   myprintf("%s%cs all right, then\n", "that", '\'');
20409   exit(0);
20410 }
20411 EOCP
20412         set try
20413         if eval $compile && $run ./try 2>&1 >/dev/null; then
20414                 case "`$run ./try`" in
20415                 "that's all right, then")
20416                         okay=yes
20417                         ;;
20418                 esac
20419         fi
20420         case "$okay" in
20421         yes)    echo "It seems that you don't need va_copy()." >&4
20422                 need_va_copy="$undef"
20423                 ;;
20424         *)      echo "It seems that va_copy() or similar will be needed." >&4
20425                 need_va_copy="$define"
20426                 ;;
20427         esac
20428         $rm_try
20429         ;;
20430 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20431         need_va_copy="$undef"
20432         ;;
20433 esac
20434
20435 : see what type is used for size_t
20436 rp="What is the type used for the length parameter for string functions?"
20437 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20438 eval $typedef_ask
20439
20440 : check for type of arguments to gethostbyaddr. 
20441 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20442         case "$d_gethbyaddr" in
20443         $define)
20444                 $cat <<EOM
20445
20446 Checking to see what type of arguments are accepted by gethostbyaddr().
20447 EOM
20448                 hdrs="$define sys/types.h
20449                         $d_socket sys/socket.h 
20450                         $i_niin netinet/in.h 
20451                         $i_netdb netdb.h
20452                         $i_unistd unistd.h"
20453                 : The first arg can 'char *' or 'void *'
20454                 : The second arg is some of integral type
20455                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20456                         for yyy in size_t long int; do
20457                                 case "$netdb_host_type" in
20458                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20459                                         if ./protochk "$try" $hdrs; then
20460                                                 echo "Your system accepts $xxx for the first arg."
20461                                                 echo "...and $yyy for the second arg."
20462                                                 netdb_host_type="$xxx"
20463                                                 netdb_hlen_type="$yyy"
20464                                         fi
20465                                         ;;
20466                                 esac
20467                         done
20468                 done
20469                 : In case none of those worked, prompt the user.
20470                 case "$netdb_host_type" in
20471                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20472                         dflt='char *'
20473                         . ./myread
20474                         netdb_host_type=$ans
20475                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20476                         dflt="$sizetype"
20477                         . ./myread
20478                         netdb_hlen_type=$ans
20479                         ;;
20480                 esac
20481                 ;;
20482         *)      : no gethostbyaddr, so pick harmless defaults
20483                 netdb_host_type='char *'
20484                 netdb_hlen_type="$sizetype"
20485                 ;;
20486         esac
20487         # Remove the "const" if needed. -- but then we'll have a 
20488         # prototype clash!
20489         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20490 fi
20491
20492 : check for type of argument to gethostbyname. 
20493 if test "X$netdb_name_type" = X ; then
20494         case "$d_gethbyname" in
20495         $define)
20496                 $cat <<EOM
20497
20498 Checking to see what type of argument is accepted by gethostbyname().
20499 EOM
20500                 hdrs="$define sys/types.h
20501                         $d_socket sys/socket.h 
20502                         $i_niin netinet/in.h 
20503                         $i_netdb netdb.h
20504                         $i_unistd unistd.h"
20505                 for xxx in "const char *" "char *"; do
20506                         case "$netdb_name_type" in
20507                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20508                                 if ./protochk "$try" $hdrs; then
20509                                         echo "Your system accepts $xxx."
20510                                         netdb_name_type="$xxx"
20511                                 fi
20512                                 ;;
20513                         esac
20514                 done
20515                 : In case none of those worked, prompt the user.
20516                 case "$netdb_name_type" in
20517                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20518                         dflt='char *'
20519                         . ./myread
20520                         netdb_name_type=$ans
20521                         ;;
20522                 esac
20523                 ;;
20524         *)      : no gethostbyname, so pick harmless default
20525                 netdb_name_type='char *'
20526                 ;;
20527         esac
20528 fi
20529
20530 : check for type of 1st argument to getnetbyaddr. 
20531 if test "X$netdb_net_type" = X ; then
20532         case "$d_getnbyaddr" in
20533         $define)
20534                 $cat <<EOM
20535
20536 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20537 EOM
20538                 hdrs="$define sys/types.h
20539                         $d_socket sys/socket.h 
20540                         $i_niin netinet/in.h 
20541                         $i_netdb netdb.h
20542                         $i_unistd unistd.h"
20543                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20544                         case "$netdb_net_type" in
20545                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20546                                 if ./protochk "$try" $hdrs; then
20547                                         echo "Your system accepts $xxx."
20548                                         netdb_net_type="$xxx"
20549                                 fi
20550                                 ;;
20551                         esac
20552                 done
20553                 : In case none of those worked, prompt the user.
20554                 case "$netdb_net_type" in
20555                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20556                         dflt='long'
20557                         . ./myread
20558                         netdb_net_type=$ans
20559                         ;;
20560                 esac
20561                 ;;
20562         *)      : no getnetbyaddr, so pick harmless default
20563                 netdb_net_type='long'
20564                 ;;
20565         esac
20566 fi
20567 : locate the preferred pager for this system
20568 fn=f/
20569 case "$pager" in
20570 '')
20571         dflt=''
20572         case "$pg" in
20573         /*) dflt=$pg;;
20574         [a-zA-Z]:/*) dflt=$pg;;
20575         esac
20576         case "$more" in
20577         /*) dflt=$more;;
20578         [a-zA-Z]:/*) dflt=$more;;
20579         esac
20580         case "$less" in
20581         /*) dflt=$less;;
20582         [a-zA-Z]:/*) dflt=$less;;
20583         esac
20584         case "$dflt" in
20585         '') dflt=/usr/ucb/more;;
20586         esac
20587         ;;
20588 *)      dflt="$pager"
20589         ;;
20590 esac
20591 fn="f/($dflt)"
20592 echo " "
20593 rp='What pager is used on your system?'
20594 . ./getfile
20595 pager="$ans"
20596
20597 : see what type pids are declared as in the kernel
20598 rp="What is the type of process ids on this system?"
20599 set pid_t pidtype int stdio.h sys/types.h
20600 eval $typedef_ask
20601
20602 : see if ar generates random libraries by itself
20603 echo " "
20604 echo "Checking how to generate random libraries on your machine..." >&4
20605 echo 'int bar1() { return bar2(); }' > bar1.c
20606 echo 'int bar2() { return 2; }' > bar2.c
20607 $cat > foo.c <<EOP
20608 #$i_stdlib I_STDLIB
20609 #ifdef I_STDLIB
20610 #include <stdlib.h>
20611 #endif
20612 int main() { printf("%d\n", bar1()); exit(0); }
20613 EOP
20614 $cc $ccflags -c bar1.c >/dev/null 2>&1
20615 $cc $ccflags -c bar2.c >/dev/null 2>&1
20616 $cc $ccflags -c foo.c >/dev/null 2>&1
20617 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20618 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20619         $run ./foobar >/dev/null 2>&1; then
20620         echo "$ar appears to generate random libraries itself."
20621         orderlib=false
20622         if [ "X$ranlib" = "X" ]; then
20623             ranlib=":"
20624         fi
20625 elif $ar s bar$_a >/dev/null 2>&1 &&
20626         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20627         $run ./foobar >/dev/null 2>&1; then
20628                 echo "a table of contents needs to be added with '$ar s'."
20629                 orderlib=false
20630                 ranlib="$ar s"
20631 elif $ar ts bar$_a >/dev/null 2>&1 &&
20632         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20633         $run ./foobar >/dev/null 2>&1; then
20634                 echo "a table of contents needs to be added with '$ar ts'."
20635                 orderlib=false
20636                 ranlib="$ar ts"
20637 else
20638         case "$ranlib" in
20639         :) ranlib='';;
20640         '')
20641                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20642                 $test -f $ranlib || ranlib=''
20643                 ;;
20644         esac
20645         if $test -n "$ranlib"; then
20646                 echo "your system has '$ranlib'; we'll use that."
20647                 orderlib=false
20648         else
20649                 echo "your system doesn't seem to support random libraries"
20650                 echo "so we'll use lorder and tsort to order the libraries."
20651                 orderlib=true
20652                 ranlib=":"
20653         fi
20654 fi
20655 $rm -f foo* bar*
20656
20657 : see if this is a values.h system
20658 set values.h i_values
20659 eval $inhdr
20660
20661 : Check the max offset that gmtime and localtime accept
20662 echo "Checking max offsets that gmtime () accepts"
20663
20664 case $i_values in
20665     define) yyy="#include <values.h>" ;;
20666     *)      yyy="" ;;
20667     esac
20668
20669 case "$sGMTIME_min/$sGMTIME_max" in
20670     0/0|/)
20671         $cat >try.c <<EOCP
20672 #include <sys/types.h>
20673 #include <stdio.h>
20674 #include <time.h>
20675 $yyy
20676
20677 int i;
20678 struct tm *tmp;
20679 time_t pt;
20680
20681 void gm_check (time_t t, int min_year, int max_year)
20682 {
20683     tmp = gmtime (&t);
20684     if ( tmp == NULL ||
20685         /* Check tm_year overflow */
20686          tmp->tm_year < min_year || tmp->tm_year > max_year)
20687         tmp = NULL;
20688     else
20689         pt = t;
20690     } /* gm_check */
20691
20692 int check_max ()
20693 {
20694     tmp = NULL;
20695     pt  = 0;
20696 #ifdef MAXLONG
20697     gm_check (MAXLONG, 69, 0x7fffffff);
20698 #endif
20699     if (tmp == NULL || tmp->tm_year < 0) {
20700         for (i = 63; i >= 0; i--) {
20701             time_t x = pt | ((time_t)1 << i);
20702             if (x < 0 || x < pt) continue;
20703             gm_check (x, 69, 0x7fffffff);
20704             }
20705         }
20706     printf ("sGMTIME_max=%ld\n", pt);
20707     return (0);
20708     } /* check_max */
20709
20710 int check_min ()
20711 {
20712     tmp = NULL;
20713     pt  = 0;
20714 #ifdef MINLONG
20715     gm_check (MINLONG, -1900, 70);
20716 #endif
20717     if (tmp == NULL) {
20718         for (i = 36; i >= 0; i--) {
20719             time_t x = pt - ((time_t)1 << i);
20720             if (x > 0) continue;
20721             gm_check (x, -1900, 70);
20722             }
20723         }
20724     printf ("sGMTIME_min=%ld\n", pt);
20725     return (0);
20726     } /* check_min */
20727
20728 int main (int argc, char *argv[])
20729 {
20730     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20731     check_max ();
20732     check_min ();
20733     return (0);
20734     } /* main */
20735 EOCP
20736         set try
20737         if eval $compile; then
20738             eval `$run ./try`
20739         else
20740             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20741             fi
20742         $rm_try
20743         ;;
20744     esac
20745
20746 echo "Checking max offsets that localtime () accepts"
20747
20748 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20749     0/0|/)
20750         $cat >try.c <<EOCP
20751 #include <sys/types.h>
20752 #include <stdio.h>
20753 #include <time.h>
20754 $yyy
20755
20756 int i;
20757 struct tm *tmp;
20758 time_t pt;
20759
20760 void local_check (time_t t, int min_year, int max_year)
20761 {
20762     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20763         tmp = NULL;
20764     else
20765         tmp = localtime (&t);
20766     if ( tmp == NULL ||
20767         /* Check tm_year overflow */
20768          tmp->tm_year < min_year || tmp->tm_year > max_year)
20769         tmp = NULL;
20770     else
20771         pt = t;
20772     } /* local_check */
20773
20774 int check_max ()
20775 {
20776     tmp = NULL;
20777     pt  = 0;
20778 #ifdef MAXLONG
20779     local_check (MAXLONG, 69, 0x7fffffff);
20780 #endif
20781     if (tmp == NULL || tmp->tm_year < 0) {
20782         for (i = 63; i >= 0; i--) {
20783             time_t x = pt | ((time_t)1 << i);
20784             if (x < 0 || x < pt) continue;
20785             local_check (x, 69, 0x7fffffff);
20786             }
20787         }
20788     printf ("sLOCALTIME_max=%ld\n", pt);
20789     return (0);
20790    } /* check_max */
20791
20792 int check_min ()
20793 {
20794     tmp = NULL;
20795     pt  = 0;
20796 #ifdef MINLONG
20797     local_check (MINLONG, -1900, 70);
20798 #endif
20799     if (tmp == NULL) {
20800         for (i = 36; i >= 0; i--) {
20801             time_t x = pt - ((time_t)1 << i);
20802             if (x > 0) continue;
20803             local_check (x, -1900, 70);
20804             }
20805         }
20806     printf ("sLOCALTIME_min=%ld\n", pt);
20807     return (0);
20808     } /* check_min */
20809
20810 int main (int argc, char *argv[])
20811 {
20812     check_max ();
20813     check_min ();
20814     return (0);
20815     } /* main */
20816 EOCP
20817         set try
20818         if eval $compile; then
20819             eval `$run ./try`
20820         else
20821             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20822             fi
20823         $rm_try
20824         ;;
20825     esac
20826
20827 : check for type of arguments to select.
20828 case "$selecttype" in
20829 '') case "$d_select" in
20830         $define)
20831                 echo " "
20832                 $cat <<EOM
20833 Checking to see what type of arguments are accepted by select().
20834 EOM
20835                 hdrs="$define sys/types.h
20836                         $i_systime sys/time.h
20837                         $i_sysselct sys/select.h
20838                         $d_socket sys/socket.h"
20839                 : The first arg can be int, unsigned, or size_t
20840                 : The last arg may or may not be 'const'
20841                 val=''
20842                 : void pointer has been seen but using that
20843                 : breaks the selectminbits test
20844                 for xxx in 'fd_set *' 'int *'; do
20845                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20846                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20847                                         case "$val" in
20848                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20849                                                 if ./protochk "$try" $hdrs; then
20850                                                         echo "Your system accepts $xxx."
20851                                                         val="$xxx"
20852                                                 fi
20853                                                 ;;
20854                                         esac
20855                                 done
20856                         done
20857                 done
20858                 case "$val" in
20859                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20860                         case "$d_fd_set" in
20861                                 $define) dflt="fd_set *" ;;
20862                                 *)              dflt="int *" ;;
20863                         esac
20864                         . ./myread
20865                         val=$ans
20866                         ;;
20867                 esac
20868                 selecttype="$val"
20869                 ;;
20870         *)      : no select, so pick a harmless default
20871                 selecttype='int *'
20872                 ;;
20873         esac
20874         ;;
20875 esac
20876
20877 : check for the select 'width'
20878 case "$selectminbits" in
20879 '') safebits=`expr $ptrsize \* 8`
20880     case "$d_select" in
20881         $define)
20882                 $cat <<EOM
20883
20884 Checking to see on how many bits at a time your select() operates...
20885 EOM
20886                 $cat >try.c <<EOCP
20887 #include <sys/types.h>
20888 #$i_time I_TIME
20889 #$i_systime I_SYS_TIME
20890 #$i_systimek I_SYS_TIME_KERNEL
20891 #ifdef I_TIME
20892 #   include <time.h>
20893 #endif
20894 #ifdef I_SYS_TIME
20895 #   ifdef I_SYS_TIME_KERNEL
20896 #       define KERNEL
20897 #   endif
20898 #   include <sys/time.h>
20899 #   ifdef I_SYS_TIME_KERNEL
20900 #       undef KERNEL
20901 #   endif
20902 #endif
20903 #$i_sysselct I_SYS_SELECT
20904 #ifdef I_SYS_SELECT
20905 #include <sys/select.h>
20906 #endif
20907 #$d_socket HAS_SOCKET
20908 #ifdef HAS_SOCKET
20909 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20910 #endif
20911 #include <stdio.h>
20912 #$i_stdlib I_STDLIB
20913 #ifdef I_STDLIB
20914 #include <stdlib.h>
20915 #endif
20916 $selecttype b;
20917 #define S sizeof(*(b))
20918 #define MINBITS 64
20919 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20920 #define NBITS  (NBYTES * 8)
20921 int main() {
20922     char *s = (char *)malloc(NBYTES);
20923     struct timeval t;
20924     int i;
20925     FILE* fp;
20926     int fd;
20927
20928     if (!s)
20929         exit(1);
20930     fclose(stdin);
20931     fp = fopen("try.c", "r");
20932     if (fp == 0)
20933       exit(2);
20934     fd = fileno(fp);
20935     if (fd < 0)
20936       exit(3);
20937     b = ($selecttype)s;
20938     for (i = 0; i < NBITS; i++)
20939         FD_SET(i, b);
20940     t.tv_sec  = 0;
20941     t.tv_usec = 0;
20942     select(fd + 1, b, 0, 0, &t);
20943     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20944     free(s);
20945     printf("%d\n", i + 1);
20946     return 0;
20947 }
20948 EOCP
20949                 set try
20950                 if eval $compile_ok; then
20951                         selectminbits=`$run ./try`
20952                         case "$selectminbits" in
20953                         '')     cat >&4 <<EOM
20954 Cannot figure out on how many bits at a time your select() operates.
20955 I'll play safe and guess it is $safebits bits.
20956 EOM
20957                                 selectminbits=$safebits
20958                                 bits="$safebits bits"
20959                                 ;;
20960                         1)      bits="1 bit" ;;
20961                         *)      bits="$selectminbits bits" ;;
20962                         esac
20963                         echo "Your select() operates on $bits at a time." >&4
20964                 else
20965                         rp='What is the minimum number of bits your select() operates on?'
20966                         case "$byteorder" in
20967                         12345678)       dflt=64 ;;
20968                         1234)           dflt=32 ;;
20969                         *)              dflt=1  ;;
20970                         esac
20971                         . ./myread
20972                         val=$ans
20973                         selectminbits="$val"
20974                 fi
20975                 $rm_try
20976                 ;;
20977         *)      : no select, so pick a harmless default
20978                 selectminbits=$safebits
20979                 ;;
20980         esac
20981         ;;
20982 esac
20983
20984 : Trace out the files included by signal.h, then look for SIGxxx names.
20985 if [ "X$fieldn" = X ]; then
20986         : Just make some guesses.  We check them later.
20987         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20988 else
20989         xxx=`echo '#include <signal.h>' |
20990         $cppstdin $cppminus $cppflags 2>/dev/null |
20991         $grep '^[       ]*#.*include' |
20992         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20993                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20994 fi
20995 xxxfiles=''
20996 for xx in $xxx /dev/null ; do
20997         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20998 done
20999 case "$xxxfiles" in
21000 '')     xxxfiles=`./findhdr signal.h` ;;
21001 esac
21002 xxx=`awk '
21003 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21004         print substr($2, 4, 20)
21005 }
21006 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21007         print substr($3, 4, 20)
21008 }' $xxxfiles`
21009 : Append some common names just in case the awk scan failed.
21010 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21011 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21012 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21013 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21014 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21015
21016 : generate a few handy files for later
21017 $cat > signal.c <<EOCP
21018 #include <sys/types.h>
21019 #include <signal.h>
21020 #$i_stdlib I_STDLIB
21021 #ifdef I_STDLIB
21022 #include <stdlib.h>
21023 #endif
21024 #include <stdio.h>
21025 int main() {
21026
21027 /* Strange style to avoid deeply-nested #if/#else/#endif */
21028 #ifndef NSIG
21029 #  ifdef _NSIG
21030 #    define NSIG (_NSIG)
21031 #  endif
21032 #endif
21033
21034 #ifndef NSIG
21035 #  ifdef SIGMAX
21036 #    define NSIG (SIGMAX+1)
21037 #  endif
21038 #endif
21039
21040 #ifndef NSIG
21041 #  ifdef SIG_MAX
21042 #    define NSIG (SIG_MAX+1)
21043 #  endif
21044 #endif
21045
21046 #ifndef NSIG
21047 #  ifdef _SIG_MAX
21048 #    define NSIG (_SIG_MAX+1)
21049 #  endif
21050 #endif
21051
21052 #ifndef NSIG
21053 #  ifdef MAXSIG
21054 #    define NSIG (MAXSIG+1)
21055 #  endif
21056 #endif
21057
21058 #ifndef NSIG
21059 #  ifdef MAX_SIG
21060 #    define NSIG (MAX_SIG+1)
21061 #  endif
21062 #endif
21063
21064 #ifndef NSIG
21065 #  ifdef SIGARRAYSIZE
21066 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21067 #  endif
21068 #endif
21069
21070 #ifndef NSIG
21071 #  ifdef _sys_nsig
21072 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21073 #  endif
21074 #endif
21075
21076 /* Default to some arbitrary number that's big enough to get most
21077    of the common signals.
21078 */
21079 #ifndef NSIG
21080 #    define NSIG 50
21081 #endif
21082
21083 printf("NSIG %d\n", NSIG);
21084
21085 #ifndef JUST_NSIG
21086
21087 EOCP
21088
21089 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21090 {
21091         printf "#ifdef SIG"; printf $1; printf "\n"
21092         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21093         printf $1; printf ");\n"
21094         printf "#endif\n"
21095 }
21096 END {
21097         printf "#endif /* JUST_NSIG */\n";
21098         printf "exit(0);\n}\n";
21099 }
21100 ' >>signal.c
21101 $cat >signal.awk <<'EOP'
21102 BEGIN { ndups = 0 }
21103 $1 ~ /^NSIG$/ { nsig = $2 }
21104 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21105     if ($2 > maxsig) { maxsig = $2 }
21106     if (sig_name[$2]) {
21107         dup_name[ndups] = $1
21108         dup_num[ndups] = $2
21109         ndups++
21110     }
21111     else {
21112         sig_name[$2] = $1
21113         sig_num[$2] = $2
21114     }
21115 }
21116 END {
21117     if (nsig == 0) {
21118         nsig = maxsig + 1
21119     }
21120     printf("NSIG %d\n", nsig);
21121     for (n = 1; n < nsig; n++) {
21122         if (sig_name[n]) {
21123             printf("%s %d\n", sig_name[n], sig_num[n])
21124         }
21125         else {
21126             printf("NUM%d %d\n", n, n)
21127         }
21128     }
21129     for (n = 0; n < ndups; n++) {
21130         printf("%s %d\n", dup_name[n], dup_num[n])
21131     }
21132 }
21133 EOP
21134 $cat >signal_cmd <<EOS
21135 $startsh
21136 if $test -s signal.lst; then
21137     echo "Using your existing signal.lst file"
21138         exit 0
21139 fi
21140 xxx="$xxx"
21141 EOS
21142 $cat >>signal_cmd <<'EOS'
21143
21144 set signal
21145 if eval $compile_ok; then
21146         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21147                 $uniq | $awk -f signal.awk >signal.lst
21148 else
21149         echo "(I can't seem be able to compile the whole test program)" >&4
21150         echo "(I'll try it in little pieces.)" >&4
21151         set signal -DJUST_NSIG
21152         if eval $compile_ok; then
21153                 $run ./signal$_exe > signal.nsg
21154                 $cat signal.nsg
21155         else
21156                 echo "I can't seem to figure out how many signals you have." >&4
21157                 echo "Guessing 50." >&4
21158                 echo 'NSIG 50' > signal.nsg
21159         fi
21160         : Now look at all the signal names, one at a time.
21161         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21162                 $cat > signal.c <<EOCP
21163 #include <sys/types.h>
21164 #include <signal.h>
21165 #include <stdio.h>
21166 int main() {
21167 printf("$xx %d\n", SIG${xx});
21168 return 0;
21169 }
21170 EOCP
21171                 set signal
21172                 if eval $compile; then
21173                         echo "SIG${xx} found."
21174                         $run ./signal$_exe  >> signal.ls1
21175                 else
21176                         echo "SIG${xx} NOT found."
21177                 fi
21178         done
21179         if $test -s signal.ls1; then
21180                 $cat signal.nsg signal.ls1 |
21181                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21182         fi
21183
21184 fi
21185 if $test -s signal.lst; then
21186         :
21187 else
21188         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21189         echo 'kill -l' >signal
21190         set X `csh -f <signal`
21191         $rm -f signal
21192         shift
21193         case $# in
21194         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21195         esac
21196         echo $@ | $tr ' ' $trnl | \
21197             $awk '{ printf "%s %d\n", $1, ++s; }
21198                   END { printf "NSIG %d\n", ++s }' >signal.lst
21199 fi
21200 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21201 EOS
21202 chmod a+x signal_cmd
21203 $eunicefix signal_cmd
21204
21205 : generate list of signal names
21206 echo " "
21207 case "$sig_name_init" in
21208 '') doinit=yes ;;
21209 *)  case "$sig_num_init" in
21210     ''|*,*) doinit=yes ;;
21211     esac ;;
21212 esac
21213 case "$doinit" in
21214 yes)
21215         echo "Generating a list of signal names and numbers..." >&4
21216         . ./signal_cmd
21217         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21218         sig_name=`$awk 'BEGIN { printf "ZERO " }
21219                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21220         sig_num=`$awk  'BEGIN { printf "0 " }
21221                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21222         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21223                              !/^NSIG/   { printf "\"%s\", ", $1 }
21224                              END        { printf "0\n" }' signal.lst`
21225         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21226                              !/^NSIG/   { printf "%d, ", $2}
21227                              END        { printf "0\n"}' signal.lst`
21228         ;;
21229 esac
21230 echo "The following $sig_count signals are available:"
21231 echo " "
21232 echo $sig_name | $awk \
21233 'BEGIN { linelen = 0 }
21234 {
21235         for (i = 1; i <= NF; i++) {
21236                 name = "SIG" $i " "
21237                 linelen = linelen + length(name)
21238                 if (linelen > 70) {
21239                         printf "\n"
21240                         linelen = length(name)
21241                 }
21242                 printf "%s", name
21243         }
21244         printf "\n"
21245 }'
21246 sig_size=`echo $sig_name | awk '{print NF}'`
21247 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21248
21249 : Check size of size
21250 echo " "
21251 case "$sizetype" in
21252 *_t) zzz="$sizetype"    ;;
21253 *)   zzz="filesize"     ;;
21254 esac
21255 echo "Checking the size of $zzz..." >&4
21256 cat > try.c <<EOCP
21257 #include <sys/types.h>
21258 #include <stdio.h>
21259 #$i_stdlib I_STDLIB
21260 #ifdef I_STDLIB
21261 #include <stdlib.h>
21262 #endif
21263 int main() {
21264     printf("%d\n", (int)sizeof($sizetype));
21265     exit(0);
21266 }
21267 EOCP
21268 set try
21269 if eval $compile_ok; then
21270         yyy=`$run ./try`
21271         case "$yyy" in
21272         '')     sizesize=4
21273                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21274                 ;;
21275         *)      sizesize=$yyy
21276                 echo "Your $zzz size is $sizesize bytes."
21277                 ;;
21278         esac
21279 else
21280         sizesize=4
21281         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21282 fi
21283
21284
21285 : check for socklen_t
21286 echo " "
21287 echo "Checking to see if you have socklen_t..." >&4
21288 $cat >try.c <<EOCP
21289 #include <sys/types.h>
21290 #$d_socket HAS_SOCKET
21291 #ifdef HAS_SOCKET
21292 #include <sys/socket.h>
21293 #endif
21294 int main() { socklen_t x = 16; }
21295 EOCP
21296 set try
21297 if eval $compile; then
21298         val="$define"
21299         echo "You have socklen_t."
21300 else
21301         val="$undef"
21302         echo "You do not have socklen_t."
21303         case "$sizetype" in
21304         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21305         esac
21306 fi
21307 $rm_try
21308 set d_socklen_t
21309 eval $setvar
21310
21311 : see if this is a socks.h system
21312 set socks.h i_socks
21313 eval $inhdr
21314
21315 : check for type of the size argument to socket calls
21316 case "$d_socket" in
21317 "$define")
21318         $cat <<EOM
21319
21320 Checking to see what type is the last argument of accept().
21321 EOM
21322         yyy=''
21323         case "$d_socklen_t" in
21324         "$define") yyy="$yyy socklen_t"
21325         esac
21326         yyy="$yyy $sizetype int long unsigned"
21327         for xxx in $yyy; do
21328                 case "$socksizetype" in
21329                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21330                         case "$usesocks" in
21331                         "$define")
21332                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21333                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21334                                         socksizetype="$xxx"
21335                                 fi
21336                                 ;;
21337                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21338                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21339                                         socksizetype="$xxx"
21340                                 fi
21341                                 ;;
21342                         esac
21343                         ;;
21344                 esac
21345         done
21346 : In case none of those worked, prompt the user.
21347         case "$socksizetype" in
21348         '')     rp='What is the type for socket address structure sizes?'
21349                 dflt='int'
21350                 . ./myread
21351                 socksizetype=$ans
21352                 ;;
21353         esac
21354         ;;
21355 *)      : no sockets, so pick relatively harmless default
21356         socksizetype='int'
21357         ;;
21358 esac
21359
21360 : see what type is used for signed size_t
21361 set ssize_t ssizetype int stdio.h sys/types.h
21362 eval $typedef
21363 dflt="$ssizetype"
21364 $cat > try.c <<EOM
21365 #include <stdio.h>
21366 #$i_stdlib I_STDLIB
21367 #ifdef I_STDLIB
21368 #include <stdlib.h>
21369 #endif
21370 #include <sys/types.h>
21371 #define Size_t $sizetype
21372 #define SSize_t $dflt
21373 int main()
21374 {
21375         if (sizeof(Size_t) == sizeof(SSize_t))
21376                 printf("$dflt\n");
21377         else if (sizeof(Size_t) == sizeof(int))
21378                 printf("int\n");
21379         else
21380                 printf("long\n");
21381         exit(0);
21382 }
21383 EOM
21384 echo " "
21385 set try
21386 if eval $compile_ok && $run ./try > /dev/null; then
21387         ssizetype=`$run ./try`
21388         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21389 else
21390         $cat >&4 <<EOM
21391 Help! I can't compile and run the ssize_t test program: please enlighten me!
21392 (This is probably a misconfiguration in your system or libraries, and
21393 you really ought to fix it.  Still, I'll try anyway.)
21394
21395 I need a type that is the same size as $sizetype, but is guaranteed to
21396 be signed.  Common values are ssize_t, int and long.
21397
21398 EOM
21399         rp="What signed type is the same size as $sizetype?"
21400         . ./myread
21401         ssizetype="$ans"
21402 fi
21403 $rm_try
21404
21405 : Check the size of st_ino
21406 $echo " "
21407 $echo "Checking the size of st_ino..." >&4
21408 $cat > try.c <<EOCP
21409 #include <sys/stat.h>
21410 #include <stdio.h>
21411 #$i_stdlib I_STDLIB
21412 #ifdef I_STDLIB
21413 #include <stdlib.h>
21414 #endif
21415 int main() {
21416     struct stat st;
21417     printf("%d\n", (int)sizeof(st.st_ino));
21418     exit(0);
21419 }
21420 EOCP
21421 set try
21422 if eval $compile_ok; then
21423         val=`$run ./try`
21424         case "$val" in
21425         '')     st_ino_size=4
21426                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21427                 ;;
21428         *)      st_ino_size=$val
21429                 $echo "Your st_ino is $st_ino_size bytes long."
21430                 ;;
21431         esac
21432 else
21433         st_ino_size=4
21434         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21435 fi
21436 $rm_try
21437
21438 : Check if st_ino is signed
21439 $echo " "
21440 $echo "Checking the sign of st_ino..." >&4
21441 $cat > try.c <<EOCP
21442 #include <sys/stat.h>
21443 #include <stdio.h>
21444 int main() {
21445         struct stat foo;
21446         foo.st_ino = -1;
21447         if (foo.st_ino < 0)
21448                 printf("-1\n");
21449         else
21450                 printf("1\n");
21451 }
21452 EOCP
21453 set try
21454 if eval $compile; then
21455         val=`$run ./try`
21456         case "$val" in
21457         '')     st_ino_sign=1
21458                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21459                 ;;
21460         *)      st_ino_sign=$val
21461                 case "$st_ino_sign" in
21462                  1) $echo "Your st_ino is unsigned." ;;
21463                 -1) $echo "Your st_ino is signed."   ;;
21464                 esac
21465                 ;;
21466         esac
21467 else
21468         st_ino_sign=1
21469         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21470 fi
21471 $rm_try
21472
21473 : see what type of char stdio uses.
21474 echo " "
21475 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21476 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21477         echo "Your stdio uses unsigned chars." >&4
21478         stdchar="unsigned char"
21479 else
21480         echo "Your stdio uses signed chars." >&4
21481         stdchar="char"
21482 fi
21483 $rm -f stdioh
21484
21485 : see what type uids are declared as in the kernel
21486 echo " "
21487 echo "Looking for the type for user ids returned by getuid()."
21488 set uid_t uidtype xxx stdio.h sys/types.h
21489 eval $typedef
21490 case "$uidtype" in
21491 xxx)
21492         xxx=`./findhdr sys/user.h`
21493         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21494         case $1 in
21495         unsigned) dflt="$1 $2" ;;
21496         *) dflt="$1" ;;
21497         esac
21498         ;;
21499 *) dflt="$uidtype";;
21500 esac
21501 case "$uidtype" in
21502 uid_t)  echo "uid_t found." ;;
21503 *)      rp="What is the type for user ids returned by getuid()?"
21504         . ./myread
21505         uidtype="$ans"
21506         ;;
21507 esac
21508
21509 : Check size of UID
21510 echo " "
21511 case "$uidtype" in
21512 *_t) zzz="$uidtype"     ;;
21513 *)   zzz="uid"          ;;
21514 esac
21515 echo "Checking the size of $zzz..." >&4
21516 cat > try.c <<EOCP
21517 #include <sys/types.h>
21518 #include <stdio.h>
21519 #$i_stdlib I_STDLIB
21520 #ifdef I_STDLIB
21521 #include <stdlib.h>
21522 #endif
21523 int main() {
21524     printf("%d\n", (int)sizeof($uidtype));
21525     exit(0);
21526 }
21527 EOCP
21528 set try
21529 if eval $compile_ok; then
21530         yyy=`$run ./try`
21531         case "$yyy" in
21532         '')     uidsize=4
21533                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21534                 ;;
21535         *)      uidsize=$yyy
21536                 echo "Your $zzz is $uidsize bytes long."
21537                 ;;
21538         esac
21539 else
21540         uidsize=4
21541         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21542 fi
21543
21544 : Check if UID is signed
21545 echo " "
21546 case "$uidtype" in
21547 *_t) zzz="$uidtype"     ;;
21548 *)   zzz="uid"          ;;
21549 esac
21550 echo "Checking the sign of $zzz..." >&4
21551 cat > try.c <<EOCP
21552 #include <sys/types.h>
21553 #include <stdio.h>
21554 int main() {
21555         $uidtype foo = -1;
21556         if (foo < 0)
21557                 printf("-1\n");
21558         else
21559                 printf("1\n");
21560 }
21561 EOCP
21562 set try
21563 if eval $compile; then
21564         yyy=`$run ./try`
21565         case "$yyy" in
21566         '')     uidsign=1
21567                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21568                 ;;
21569         *)      uidsign=$yyy
21570                 case "$uidsign" in
21571                  1) echo "Your $zzz is unsigned." ;;
21572                 -1) echo "Your $zzz is signed."   ;;
21573                 esac
21574                 ;;
21575         esac
21576 else
21577         uidsign=1
21578         echo "(I can't compile the test program--guessing unsigned.)" >&4
21579 fi
21580
21581
21582 : Check format string for UID
21583 echo " "
21584 $echo "Checking the format string to be used for uids..." >&4
21585
21586 case "$uidsign" in
21587 -1)     if $test X"$uidsize" = X"$ivsize"; then
21588                 uidformat="$ivdformat"
21589         else
21590                 if $test X"$uidsize" = X"$longsize"; then
21591                         uidformat='"ld"'
21592                 else
21593                         if $test X"$uidsize" = X"$intsize"; then
21594                                 uidformat='"d"'
21595                         else
21596                                 if $test X"$uidsize" = X"$shortsize"; then
21597                                         uidformat='"hd"'
21598                                 fi
21599                         fi
21600                 fi
21601         fi
21602         ;;
21603 *)      if $test X"$uidsize" = X"$uvsize"; then
21604                 uidformat="$uvuformat"
21605         else
21606                 if $test X"$uidsize" = X"$longsize"; then
21607                         uidformat='"lu"'
21608                 else
21609                         if $test X"$uidsize" = X"$intsize"; then
21610                                 uidformat='"u"'
21611                         else
21612                                 if $test X"$uidsize" = X"$shortsize"; then
21613                                         uidformat='"hu"'
21614                                 fi
21615                         fi
21616                 fi
21617         fi
21618         ;;
21619 esac
21620
21621 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21622 echo " "
21623 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21624 $cat >try.c <<'EOM'
21625 /* Intentionally a long probe as I'd like to sanity check that the exact
21626    approach is going to work, as thinking it will work, but only having it
21627    part working at runtime is worse than not having it.  */
21628
21629 #include <sys/types.h>
21630 #include <sys/sysctl.h>
21631 #include <sys/param.h>
21632 #include <stdio.h>
21633 #include <string.h>
21634 #include <stdlib.h>
21635 #include <unistd.h>
21636
21637 int
21638 main(int argc, char **argv) {
21639     char *buffer;
21640     char *argv_leaf = strrchr(argv[0], '/');
21641     char *buffer_leaf;
21642     size_t size = 0;
21643     int mib[4];
21644
21645     mib[0] = CTL_KERN;
21646     mib[1] = KERN_PROC;
21647     mib[2] = KERN_PROC_PATHNAME;
21648     mib[3] = -1;
21649
21650     if (!argv_leaf) {
21651         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21652         return 1;
21653     }
21654
21655     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21656         perror("sysctl");
21657         return 2;
21658     }
21659
21660     if (size < strlen(argv_leaf) + 1) {
21661         fprintf(stderr, "size %lu is too short for a path\n",
21662                 (unsigned long) size);
21663         return 3;
21664     }
21665
21666     if (size > MAXPATHLEN * MAXPATHLEN) {
21667         fprintf(stderr, "size %lu is too long for a path\n",
21668                 (unsigned long) size);
21669         return 4;
21670     }
21671
21672     buffer = malloc(size);
21673     if (!buffer) {
21674         perror("malloc");
21675         return 5;
21676     }
21677
21678     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21679         perror("sysctl");
21680         return 6;
21681     }
21682
21683     if (strlen(buffer) + 1 != size) {
21684         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21685                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21686         return 7;
21687     }
21688
21689
21690     if (*buffer != '/') {
21691         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21692         return 8;
21693     }
21694
21695     if (strstr(buffer, "/./")) {
21696         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21697         return 9;
21698     }
21699
21700     if (strstr(buffer, "/../")) {
21701         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21702         return 10;
21703     }
21704
21705     buffer_leaf = strrchr(buffer, '/');
21706     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21707         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21708         return 11;
21709     }
21710
21711     free(buffer);
21712
21713     return 0;
21714 }
21715 EOM
21716
21717 val=$undef
21718 set try
21719 if eval $compile; then
21720         if $run ./try; then
21721                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21722                 val="$define"
21723         else
21724                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21725                 val="$undef"
21726         fi
21727 else
21728         echo "I'm unable to compile the test program." >&4
21729         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21730         val="$undef"
21731 fi
21732 $rm_try
21733 set usekernprocpathname
21734 eval $setvar
21735
21736 : Determine if we can use _NSGetExecutablePath to find executing program
21737 echo " "
21738 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21739 $cat >try.c <<'EOM'
21740 /* Intentionally a long probe as I'd like to sanity check that the exact
21741    approach is going to work, as thinking it will work, but only having it
21742    part working at runtime is worse than not having it.  */
21743 #include <mach-o/dyld.h>
21744 #include <stdio.h>
21745 #include <stdlib.h>
21746 #include <sys/param.h>
21747 #include <string.h>
21748
21749 int
21750 main(int argc, char **argv) {
21751     char buf[1];
21752     uint32_t size = sizeof(buf);
21753     int result;
21754     char *buffer;
21755     char *tidied;
21756     char *argv_leaf = strrchr(argv[0], '/');
21757     char *tidied_leaf;
21758
21759     if (!argv_leaf) {
21760         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21761         return 1;
21762     }
21763
21764     _NSGetExecutablePath(buf, &size);
21765     if (size > MAXPATHLEN * MAXPATHLEN) {
21766         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21767                 (unsigned int) size);
21768         return 2;
21769     }
21770
21771     buffer = malloc(size);
21772     if (!buffer) {
21773         perror("malloc");
21774         return 3;
21775     }
21776
21777     result = _NSGetExecutablePath(buffer, &size);
21778     if (result != 0) {
21779         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21780                 result, (unsigned int) size);
21781         return 4;
21782     }
21783
21784     tidied = realpath(buffer, NULL);
21785     if (!tidied) {
21786         perror("realpath");
21787         return 5;
21788     }
21789
21790     free(buffer);
21791
21792     if (*tidied != '/') {
21793         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21794         return 6;
21795     }
21796
21797     if (strstr(tidied, "/./")) {
21798         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21799         return 7;
21800     }
21801
21802     if (strstr(tidied, "/../")) {
21803         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21804         return 8;
21805     }
21806
21807     tidied_leaf = strrchr(tidied, '/');
21808     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21809         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21810         return 9;
21811     }
21812
21813     free(tidied);
21814
21815     return 0;
21816 }
21817 EOM
21818
21819 val=$undef
21820 set try
21821 if eval $compile; then
21822         if $run ./try; then
21823                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21824                 val="$define"
21825         else
21826                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21827         fi
21828 else
21829         echo "I'm unable to compile the test program." >&4
21830         echo "I'll assume no _NSGetExecutablePath here." >&4
21831 fi
21832 $rm_try
21833 set usensgetexecutablepath
21834 eval $setvar
21835
21836 : Check if site customization support was requested
21837 case "$usesitecustomize" in
21838     $define|true|[Yy]*)
21839         usesitecustomize="$define"
21840         ;;
21841     *)
21842         usesitecustomize="$undef"
21843         ;;
21844     esac
21845
21846 : see if prototypes support variable argument declarations
21847 echo " "
21848 case "$prototype$i_stdarg" in
21849 $define$define)
21850         echo "It appears we'll be able to prototype varargs functions." >&4
21851         val="$define"
21852         ;;
21853 *)
21854         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21855         val="$undef"
21856         ;;
21857 esac
21858 set vaproto
21859 eval $setvar
21860
21861 : determine compiler compiler
21862 case "$yacc" in
21863 '')
21864         dflt=yacc;;
21865 *)
21866         dflt="$yacc";;
21867 esac
21868 echo " "
21869 comp='yacc'
21870 if $test -f "$byacc$_exe"; then
21871         dflt="$byacc"
21872         comp="byacc or $comp"
21873 fi
21874 if $test -f "$bison$_exe"; then
21875         comp="$comp or bison -y"
21876 fi
21877 rp="Which compiler compiler ($comp) shall I use?"
21878 . ./myread
21879 yacc="$ans"
21880 case "$yacc" in
21881 *bis*)
21882         case "$yacc" in
21883         *-y*) ;;
21884         *)
21885                 yacc="$yacc -y"
21886                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21887                 ;;
21888         esac
21889         ;;
21890 esac
21891
21892 : see if this is a assert.h system
21893 set assert.h i_assert
21894 eval $inhdr
21895
21896 : see if this is a fp.h system
21897 set fp.h i_fp
21898 eval $inhdr
21899
21900 : see if this is a fp_class.h system
21901 set fp_class.h i_fp_class
21902 eval $inhdr
21903
21904 : see if gdbm.h is available
21905 set gdbm.h t_gdbm
21906 eval $inhdr
21907 case "$t_gdbm" in
21908 $define)
21909         : see if gdbm_open exists
21910         set gdbm_open d_gdbm_open
21911         eval $inlibc
21912         case "$d_gdbm_open" in
21913         $undef)
21914                 t_gdbm="$undef"
21915                 echo "We won't be including <gdbm.h>"
21916                 ;;
21917         esac
21918         ;;
21919 esac
21920 val="$t_gdbm"
21921 set i_gdbm
21922 eval $setvar
21923
21924 : see if this is a ieeefp.h system
21925 case "$i_ieeefp" in
21926 '' ) set ieeefp.h i_ieeefp
21927      eval $inhdr
21928      ;;
21929 esac
21930
21931 : see if this is a libutil.h system
21932 set libutil.h i_libutil
21933 eval $inhdr
21934
21935 : see if mach cthreads are available
21936 if test "X$usethreads" = "X$define"; then
21937         set mach/cthreads.h i_machcthr
21938         eval $inhdr
21939 else
21940         i_machcthr="$undef"
21941 fi
21942
21943 : see if this is a mntent.h system
21944 set mntent.h i_mntent
21945 eval $inhdr
21946
21947 : see if net/errno.h is available
21948 val=''
21949 set net/errno.h val
21950 eval $inhdr
21951
21952 : Unfortunately, it causes problems on some systems.  Arrgh.
21953 case "$val" in
21954 $define)
21955         cat > try.c <<'EOM'
21956 #include <stdio.h>
21957 #include <errno.h>
21958 #include <net/errno.h>
21959 int func()
21960 {
21961         return ENOTSOCK;
21962 }
21963 EOM
21964         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21965                 echo "We'll be including <net/errno.h>." >&4
21966         else
21967                 echo "We won't be including <net/errno.h>." >&4
21968                 val="$undef"
21969         fi
21970         $rm_try
21971         ;;
21972 esac
21973 set i_neterrno
21974 eval $setvar
21975
21976 : see if netinet/tcp.h is available
21977 set netinet/tcp.h i_netinettcp
21978 eval $inhdr
21979
21980 : see if this is a poll.h system
21981 set poll.h i_poll
21982 eval $inhdr
21983
21984 : see if this is a prot.h system
21985 set prot.h i_prot
21986 eval $inhdr
21987
21988 : Preprocessor symbols
21989 echo " "
21990 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21991 $cat <<'EOSH' > Cppsym.know
21992 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21993 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21994 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21995 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21996 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21997 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21998 bull c cadmus clipper CMU COFF COMPILER_VERSION
21999 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
22000 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
22001 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
22002 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
22003 GLIBC GLIBC_MINOR
22004 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
22005 H3050R H3050RX hbullx20 hcx host_mips
22006 hp200 hp300 hp700 HP700 hp800 hp9000
22007 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22008 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
22009 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
22010 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22011 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
22012 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
22013 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
22014 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
22015 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
22016 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
22017 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
22018 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
22019 MATH_HAS_NO_SIDE_EFFECTS
22020 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
22021 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
22022 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
22023 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
22024 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
22025 NetBSD news1500 news1700 news1800 news1900 news3700
22026 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
22027 ns32016 ns32332 ns32k nsc32000
22028 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22029 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
22030 pc532 pdp11 PGC PIC plexus PORTAR posix
22031 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22032 POSIX_C_SOURCE POSIX_SOURCE POWER
22033 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
22034 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
22035 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
22036 sony sony_news sonyrisc sparc sparclite spectrum
22037 stardent stdc STDC_EXT stratos sun sun3 sun386
22038 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
22039 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
22040 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
22041 sysV68 sysV88 Tek4132 Tek4300 titan
22042 TM3200 TM5400 TM5600
22043 tower tower32 tower32_200 tower32_600 tower32_700
22044 tower32_800 tower32_850 tss
22045 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
22046 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
22047 unix UNIX95 UNIX99 unixpc unos
22048 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
22049 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
22050 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
22051 USGr4 USGr4_2
22052 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
22053 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
22054 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22055 z8000
22056 EOSH
22057 # Maybe put other stuff here too.
22058 cat <<EOSH >>Cppsym.know
22059 $osname
22060 EOSH
22061 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22062 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22063 $cat Cppsym.know > Cppsym.c
22064 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22065 $rm -f Cppsym.a Cppsym.b Cppsym.c
22066 cat <<EOSH > Cppsym
22067 $startsh
22068 if $test \$# -gt 0; then
22069     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22070     if $test -s Cppsym.got; then
22071         $rm -f Cppsym.got
22072         exit 0
22073     fi
22074     $rm -f Cppsym.got
22075     exit 1
22076 else
22077     $tr " " "$trnl" | ./Cppsym.try
22078     exit 0
22079 fi
22080 EOSH
22081 chmod +x Cppsym
22082 $eunicefix Cppsym
22083 cat <<EOSH > Cppsym.try
22084 $startsh
22085 cat <<'EOCP' > try.c
22086 #include <stdio.h>
22087 #if cpp_stuff == 1
22088 #define STRINGIFY(a)    "a"
22089 #endif
22090 #if cpp_stuff == 42
22091 #define StGiFy(a)  #a
22092 #define STRINGIFY(a)    StGiFy(a)
22093 #endif
22094 #if $cpp_stuff != 1 && $cpp_stuff != 42
22095 #   include "Bletch: How does this C preprocessor stringify macros?"
22096 #endif
22097 int main() {
22098 EOCP
22099 $awk \\
22100 EOSH
22101 cat <<'EOSH' >> Cppsym.try
22102 'length($1) > 0 {
22103     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22104     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22105     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22106     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22107 }'       >> try.c
22108 echo 'return 0;}' >> try.c
22109 EOSH
22110 cat <<EOSH >> Cppsym.try
22111 ccflags="$ccflags"
22112 case "$osname-$gccversion" in
22113 irix-) ccflags="\$ccflags -woff 1178" ;;
22114 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22115 esac
22116 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22117 EOSH
22118 chmod +x Cppsym.try
22119 $eunicefix Cppsym.try
22120 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22121 : Add in any Linux cpp "predefined macros":
22122 case "$osname::$gccversion" in
22123   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22124     tHdrH=_tmpHdr
22125     rm -f $tHdrH'.h' $tHdrH
22126     touch $tHdrH'.h'
22127     # Filter out macro arguments, such as Linux's __INT8_C(c)
22128     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22129        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22130        if [ -s $tHdrH'_cppsym.real' ]; then
22131           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22132        fi
22133     fi
22134     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22135   ;;
22136 esac
22137 : now check the C compiler for additional symbols
22138 postprocess_cc_v=''
22139 case "$osname" in
22140 aix) postprocess_cc_v="|$tr , ' '" ;;
22141 esac
22142 $cat >ccsym <<EOS
22143 $startsh
22144 $cat >tmp.c <<EOF
22145 extern int foo;
22146 EOF
22147 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22148 do
22149         case "\$i" in
22150         -D*) echo "\$i" | $sed 's/^-D//';;
22151         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22152         esac
22153 done
22154 $rm_try
22155 EOS
22156 postprocess_cc_v=''
22157 chmod +x ccsym
22158 $eunicefix ccsym
22159 ./ccsym > ccsym1.raw
22160 if $test -s ccsym1.raw; then
22161        $sort ccsym1.raw | $uniq >ccsym.raw
22162 else
22163        mv ccsym1.raw ccsym.raw
22164 fi
22165
22166 $awk '/\=/ { print $0; next }
22167         { print $0"=1" }' ccsym.raw >ccsym.list
22168 $comm -13 Cppsym.true ccsym.list >ccsym.own
22169 $comm -12 Cppsym.true ccsym.list >ccsym.com
22170 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22171 also=''
22172 if $test -z ccsym.raw; then
22173         echo "Your C compiler doesn't seem to define any symbols!" >&4
22174         echo " "
22175         echo "However, your C preprocessor defines the following symbols:"
22176         $cat Cppsym.true
22177         ccsymbols=''
22178         cppsymbols=`$cat Cppsym.true`
22179         cppsymbols=`echo $cppsymbols`
22180         cppccsymbols="$cppsymbols"
22181 else
22182         if $test -s ccsym.com; then
22183                 echo "Your C compiler and pre-processor define these symbols:"
22184                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22185                 also='also '
22186                 symbols='ones'
22187                 cppccsymbols=`$cat ccsym.com`
22188                 cppccsymbols=`echo $cppccsymbols`
22189                 $test "$silent" || sleep 1
22190         fi
22191         if $test -s ccsym.cpp; then
22192                 $test "$also" && echo " "
22193                 echo "Your C pre-processor ${also}defines the following symbols:"
22194                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22195                 also='further '
22196                 cppsymbols=`$cat ccsym.cpp`
22197                 cppsymbols=`echo $cppsymbols`
22198                 $test "$silent" || sleep 1
22199         fi
22200         if $test -s ccsym.own; then
22201                 $test "$also" && echo " "
22202                 echo "Your C compiler ${also}defines the following cpp symbols:"
22203                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22204                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22205                 ccsymbols=`$cat ccsym.own`
22206                 ccsymbols=`echo $ccsymbols`
22207                 $test "$silent" || sleep 1
22208         fi
22209 fi
22210
22211 : see if this is a termio system
22212 val="$undef"
22213 val2="$undef"
22214 val3="$undef"
22215 if $test `./findhdr termios.h`; then
22216         set tcsetattr i_termios
22217         eval $inlibc
22218         val3="$i_termios"
22219 fi
22220 echo " "
22221 case "$val3" in
22222 "$define") echo "You have POSIX termios.h... good!" >&4;;
22223 *) if ./Cppsym pyr; then
22224                 case "`/bin/universe`" in
22225                 ucb) if $test `./findhdr sgtty.h`; then
22226                                 val2="$define"
22227                                 echo "<sgtty.h> found." >&4
22228                         else
22229                                 echo "System is pyramid with BSD universe."
22230                                 ./warn "<sgtty.h> not found--you could have problems."
22231                         fi;;
22232                 *) if $test `./findhdr termio.h`; then
22233                                 val="$define"
22234                                 echo "<termio.h> found." >&4
22235                         else
22236                                 echo "System is pyramid with USG universe."
22237                                 ./warn "<termio.h> not found--you could have problems."
22238                         fi;;
22239                 esac
22240         elif ./usg; then
22241                 if $test `./findhdr termio.h`; then
22242                         echo "<termio.h> found." >&4
22243                         val="$define"
22244                 elif $test `./findhdr sgtty.h`; then
22245                         echo "<sgtty.h> found." >&4
22246                         val2="$define"
22247                 else
22248                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22249                 fi
22250         else
22251                 if $test `./findhdr sgtty.h`; then
22252                         echo "<sgtty.h> found." >&4
22253                         val2="$define"
22254                 elif $test `./findhdr termio.h`; then
22255                         echo "<termio.h> found." >&4
22256                         val="$define"
22257                 else
22258                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22259                 fi
22260         fi;;
22261 esac
22262 set i_termio; eval $setvar
22263 val=$val2; set i_sgtty; eval $setvar
22264 val=$val3; set i_termios; eval $setvar
22265
22266 : see if stdbool is available
22267 : we want a real compile instead of Inhdr because some Solaris systems
22268 : have stdbool.h, but it can only be used if the compiler indicates it
22269 : is sufficiently c99-compliant.
22270 echo " "
22271 $cat >try.c <<EOCP
22272 #include <stdio.h>
22273 #include <stdbool.h>
22274 int func(bool x)
22275 {
22276     return x ? 1 : 0;
22277 }
22278 int main(int argc, char **argv)
22279 {
22280     return func(0);
22281 }
22282 EOCP
22283 set try
22284 if eval $compile; then
22285         echo "<stdbool.h> found." >&4
22286         val="$define"
22287 else
22288         echo "<stdbool.h> NOT found." >&4
22289         val="$undef"
22290 fi
22291 $rm_try
22292 set i_stdbool
22293 eval $setvar
22294
22295 : see if stddef is available
22296 set stddef.h i_stddef
22297 eval $inhdr
22298
22299 : see if sys/access.h is available
22300 set sys/access.h i_sysaccess
22301 eval $inhdr
22302
22303 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22304 set sys/filio.h i_sysfilio
22305 eval $inhdr
22306 echo " "
22307 if $test `./findhdr sys/ioctl.h`; then
22308         val="$define"
22309         echo '<sys/ioctl.h> found.' >&4
22310 else
22311         val="$undef"
22312         if $test $i_sysfilio = "$define"; then
22313             echo '<sys/ioctl.h> NOT found.' >&4
22314         else
22315                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22316                 $test $i_termio = "$define" && xxx="termio.h"
22317                 $test $i_termios = "$define" && xxx="termios.h"
22318 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22319         fi
22320 fi
22321 set i_sysioctl
22322 eval $setvar
22323
22324 : see if socket ioctl defs are in sys/sockio.h
22325 echo " "
22326 xxx=`./findhdr sys/sockio.h`
22327 if $test "$xxx"; then
22328         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22329                 val="$define"
22330                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22331         else
22332                 val="$undef"
22333                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22334         fi
22335 else
22336         val="$undef"
22337         $cat <<EOM
22338 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22339 EOM
22340 fi
22341 set i_syssockio
22342 eval $setvar
22343
22344 : see if this is a syslog.h system
22345 set syslog.h i_syslog
22346 eval $inhdr
22347
22348 : see if this is a sys/mode.h system
22349 set sys/mode.h i_sysmode
22350 eval $inhdr
22351
22352 : see if there is a sys/poll.h file
22353 set sys/poll.h i_syspoll
22354 eval $inhdr
22355
22356 : see if sys/resource.h has to be included
22357 set sys/resource.h i_sysresrc
22358 eval $inhdr
22359
22360 : see if sys/security.h is available
22361 set sys/security.h i_syssecrt
22362 eval $inhdr
22363
22364 : see if this is a sys/statvfs.h system
22365 set sys/statvfs.h i_sysstatvfs
22366 eval $inhdr
22367
22368 : see if this is a sys/un.h system
22369 set sys/un.h i_sysun
22370 eval $inhdr
22371
22372 : see if this is a sys/utsname.h system
22373 set sys/utsname.h i_sysutsname
22374 eval $inhdr
22375
22376 : see if this is a syswait system
22377 set sys/wait.h i_syswait
22378 eval $inhdr
22379
22380 : see if this is a ustat.h system
22381 set ustat.h i_ustat
22382 eval $inhdr
22383
22384 : see if this is an utime system
22385 set utime.h i_utime
22386 eval $inhdr
22387
22388 : see if this is a vfork system
22389 case "$d_vfork" in
22390 "$define")
22391         set vfork.h i_vfork
22392         eval $inhdr
22393         ;;
22394 *)
22395         i_vfork="$undef"
22396         ;;
22397 esac
22398
22399 : Check extensions
22400 echo " "
22401 echo "Looking for extensions..." >&4
22402 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22403 : contain old or inaccurate or duplicate values.
22404 nonxs_extensions=''
22405 xs_extensions=''
22406 : We do not use find because it might not be available.
22407 : We do not just use MANIFEST because the user may have dropped
22408 : some additional extensions into the source tree and expect them
22409 : to be built.
22410
22411 : Function to recursively find available extensions, ignoring DynaLoader
22412 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22413 : In 5.10.1 and later, extensions are stored in directories
22414 : like File-Glob instead of the older File/Glob/.
22415 find_extensions='
22416     for xxx in *; do
22417         case "$xxx" in
22418             DynaLoader|dynaload) ;;
22419             *)
22420             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22421             echo " $xs_extensions $nonxs_extensions" > $$.tmp;
22422             if $contains " $this_ext " $$.tmp; then
22423                 echo >&4;
22424                 echo "Duplicate directories detected for extension $xxx" >&4;
22425                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22426                 case "$knowitall" in
22427                 "") dflt=y;;
22428                 *) dflt=n;;
22429                 esac;
22430                 . ../UU/myread;
22431                 case "$ans" in
22432                 n*|N*) ;;
22433                 *) echo >&4;
22434                     echo "Ok.  Stopping Configure." >&4;
22435                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22436                     exit 1;;
22437                 esac;
22438                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22439             fi;
22440             $ls -1 $xxx > $$.tmp;
22441             if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22442                 xs_extensions="$xs_extensions $this_ext";
22443             elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22444                 xs_extensions="$xs_extensions $this_ext";
22445             elif $test -d $xxx; then
22446                 nonxs_extensions="$nonxs_extensions $this_ext";
22447             fi;
22448             $rm -f $$.tmp;
22449             ;;
22450         esac;
22451     done'
22452 tdir=`pwd`
22453 cd "$rsrc/cpan"
22454 set X
22455 shift
22456 eval $find_extensions
22457 cd "$rsrc/dist"
22458 set X
22459 shift
22460 eval $find_extensions
22461 cd "$rsrc/ext"
22462 set X
22463 shift
22464 eval $find_extensions
22465 set X $xs_extensions
22466 shift
22467 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22468 set X $nonxs_extensions
22469 shift
22470 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22471 cd "$tdir"
22472 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22473
22474 : Now see which are supported on this system.
22475 avail_ext=''
22476 for xxx in $xs_extensions ; do
22477         case "$xxx" in
22478         DB_File|db_file)
22479                 case "$i_db" in
22480                 $define) avail_ext="$avail_ext $xxx" ;;
22481                 esac
22482                 ;;
22483         GDBM_File|gdbm_fil)
22484                 case "$i_gdbm" in
22485                 $define) avail_ext="$avail_ext $xxx" ;;
22486                 esac
22487                 ;;
22488         I18N/Langinfo|i18n_lan)
22489                 case "$i_langinfo$d_nl_langinfo" in
22490                 $define$define) avail_ext="$avail_ext $xxx" ;;
22491                 esac
22492                 ;;
22493         IPC/SysV|ipc/sysv)
22494                 : XXX Do we need a useipcsysv variable here
22495                 case "${d_msg}${d_sem}${d_shm}" in
22496                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22497                 esac
22498                 ;;
22499         NDBM_File|ndbm_fil)
22500                 case "$d_ndbm" in
22501                 $define)
22502                     case "$osname-$use64bitint" in
22503                     hpux-define)
22504                         case "$libs" in
22505                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22506                         esac
22507                         ;;
22508                     *) avail_ext="$avail_ext $xxx" ;;
22509                     esac
22510                     ;;
22511                 esac
22512                 ;;
22513         ODBM_File|odbm_fil)
22514                 case "${i_dbm}${i_rpcsvcdbm}" in
22515                 *"${define}"*)
22516                     case "$d_cplusplus" in
22517                     define) ;; # delete as a function name will not work
22518                     *)  case "$osname-$use64bitint" in
22519                         hpux-define)
22520                             case "$libs" in
22521                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22522                             esac
22523                             ;;
22524                         *) avail_ext="$avail_ext $xxx" ;;
22525                         esac
22526                         ;;
22527                     esac
22528                     ;;
22529                 esac
22530                 ;;
22531         Opcode|opcode)
22532                 case "$useopcode" in
22533                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22534                 esac
22535                 ;;
22536         POSIX|posix)
22537                 case "$useposix" in
22538                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22539                 esac
22540                 ;;
22541         Socket|socket)
22542                 case "$d_socket" in
22543                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22544                 esac
22545                 ;;
22546         Sys/Syslog|sys/syslog)
22547                 : XXX syslog requires socket
22548                 case "$d_socket" in
22549                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22550                 esac
22551                 ;;
22552         Thread|thread)
22553                 case "$usethreads" in
22554                 true|$define|y)
22555                         case "$use5005threads" in
22556                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22557                         esac
22558                 esac
22559                 ;;
22560         threads|threads/shared)
22561                 # threads and threads::shared are special cases.
22562                 # To stop people from asking "Perl 5.8.0 was supposed
22563                 # to have this new fancy threads implementation but my
22564                 # perl doesn't have it" and from people trying to
22565                 # (re)install the threads module using CPAN.pm and
22566                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22567                 # the threads.pm and threads/shared.pm will always be
22568                 # there, croaking informatively ("you need to rebuild
22569                 # all of Perl with threads, sorry") when threads haven't
22570                 # been compiled in.
22571                 # --jhi
22572                 avail_ext="$avail_ext $xxx"
22573                 ;;
22574         VMS*)
22575                 ;;
22576         Win32*)
22577                 case "$osname" in
22578                 cygwin) avail_ext="$avail_ext $xxx" ;;
22579                 esac
22580                 ;;
22581         XS/APItest|xs/apitest)
22582                 # This is just for testing.  Skip it unless we have dynamic loading.
22583
22584                 case "$usedl" in
22585                 $define) avail_ext="$avail_ext $xxx" ;;
22586                 esac
22587                 ;;
22588         XS/Typemap|xs/typemap)
22589                 # This is just for testing.  Skip it unless we have dynamic loading.
22590                 case "$usedl" in
22591                 $define) avail_ext="$avail_ext $xxx" ;;
22592                 esac
22593                 ;;
22594         *)      avail_ext="$avail_ext $xxx"
22595                 ;;
22596         esac
22597 done
22598
22599 set X $avail_ext
22600 shift
22601 avail_ext="$*"
22602
22603 case "$onlyextensions" in
22604 '') ;;
22605 *)  keepextensions=''
22606     echo "You have requested that only certain extensions be included..." >&4
22607     for i in $onlyextensions; do
22608         case " $avail_ext " in
22609         *" $i "*)
22610             echo "Keeping extension $i."
22611             keepextensions="$keepextensions $i"
22612             ;;
22613         *) echo "Ignoring extension $i." ;;
22614         esac
22615     done
22616     avail_ext="$keepextensions"
22617     ;;
22618 esac
22619
22620 case "$noextensions" in
22621 '') ;;
22622 *)  keepextensions=''
22623     echo "You have requested that certain extensions be ignored..." >&4
22624     for i in $avail_ext; do
22625         case " $noextensions " in
22626         *" $i "*) echo "Ignoring extension $i." ;;
22627         *) echo "Keeping extension $i.";
22628            keepextensions="$keepextensions $i"
22629            ;;
22630         esac
22631     done
22632     avail_ext="$keepextensions"
22633     ;;
22634 esac
22635
22636 : Now see which nonxs extensions are supported on this system.
22637 : For now assume all are.
22638 nonxs_ext=''
22639 for xxx in $nonxs_extensions ; do
22640         case "$xxx" in
22641         VMS*)
22642                 ;;
22643         *)      nonxs_ext="$nonxs_ext $xxx"
22644                 ;;
22645         esac
22646 done
22647
22648 set X $nonxs_ext
22649 shift
22650 nonxs_ext="$*"
22651
22652 case $usedl in
22653 $define)
22654         $cat <<EOM
22655 A number of extensions are supplied with $package.  You may choose to
22656 compile these extensions for dynamic loading (the default), compile
22657 them into the $package executable (static loading), or not include
22658 them at all.  Answer "none" to include no extensions.
22659 Note that DynaLoader is always built and need not be mentioned here.
22660
22661 EOM
22662         case "$dynamic_ext" in
22663         '')
22664                 : Exclude those listed in static_ext
22665                 dflt=''
22666                 for xxx in $avail_ext; do
22667                         case " $static_ext " in
22668                         *" $xxx "*) ;;
22669                         *) dflt="$dflt $xxx" ;;
22670                         esac
22671                 done
22672                 set X $dflt
22673                 shift
22674                 dflt="$*"
22675                 ;;
22676         *)      dflt="$dynamic_ext"
22677                 # Perhaps we are reusing an old out-of-date config.sh.
22678                 case "$hint" in
22679                 previous)
22680                         if test X"$dynamic_ext" != X"$avail_ext"; then
22681                                 $cat <<EOM
22682 NOTICE:  Your previous config.sh list may be incorrect.
22683 The extensions now available to you are
22684         ${avail_ext}
22685 but the default list from your previous config.sh is
22686         ${dynamic_ext}
22687
22688 EOM
22689                         fi
22690                         ;;
22691                 esac
22692                 ;;
22693         esac
22694         case "$dflt" in
22695         '')     dflt=none;;
22696         esac
22697         rp="What extensions do you wish to load dynamically?"
22698         . ./myread
22699         case "$ans" in
22700         none) dynamic_ext=' ' ;;
22701         *) dynamic_ext="$ans" ;;
22702         esac
22703
22704         case "$static_ext" in
22705         '')
22706                 : Exclude those already listed in dynamic linking
22707                 dflt=''
22708                 for xxx in $avail_ext; do
22709                         case " $dynamic_ext " in
22710                         *" $xxx "*) ;;
22711                         *) dflt="$dflt $xxx" ;;
22712                         esac
22713                 done
22714                 set X $dflt
22715                 shift
22716                 dflt="$*"
22717                 ;;
22718         *)  dflt="$static_ext"
22719                 ;;
22720         esac
22721
22722         case "$dflt" in
22723         '')     dflt=none;;
22724         esac
22725         rp="What extensions do you wish to load statically?"
22726         . ./myread
22727         case "$ans" in
22728         none) static_ext=' ' ;;
22729         *) static_ext="$ans" ;;
22730         esac
22731         ;;
22732 *)
22733         $cat <<EOM
22734 A number of extensions are supplied with $package.  Answer "none"
22735 to include no extensions.
22736 Note that DynaLoader is always built and need not be mentioned here.
22737
22738 EOM
22739         case "$static_ext" in
22740         '') dflt="$avail_ext" ;;
22741         *)      dflt="$static_ext"
22742                 # Perhaps we are reusing an old out-of-date config.sh.
22743                 case "$hint" in
22744                 previous)
22745                         if test X"$static_ext" != X"$avail_ext"; then
22746                                 $cat <<EOM
22747 NOTICE:  Your previous config.sh list may be incorrect.
22748 The extensions now available to you are
22749         ${avail_ext}
22750 but the default list from your previous config.sh is
22751         ${static_ext}
22752
22753 EOM
22754                         fi
22755                         ;;
22756                 esac
22757                 ;;
22758         esac
22759         : Exclude those that are not xs extensions
22760         case "$dflt" in
22761         '')     dflt=none;;
22762         esac
22763         rp="What extensions do you wish to include?"
22764         . ./myread
22765         case "$ans" in
22766         none) static_ext=' ' ;;
22767         *) static_ext="$ans" ;;
22768         esac
22769         ;;
22770 esac
22771 #
22772 # Encode is a special case.  If we are building Encode as a static
22773 # extension, we need to explicitly list its subextensions as well.
22774 # For other nested extensions, this is handled automatically by
22775 # the appropriate Makefile.PL.
22776 case " $static_ext " in
22777         *" Encode "*) # Add the subextensions of Encode
22778         cd "$rsrc/cpan"
22779         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22780                 static_ext="$static_ext Encode/$xxx"
22781                 known_extensions="$known_extensions Encode/$xxx"
22782         done
22783         cd "$tdir"
22784         ;;
22785 esac
22786
22787 set X $dynamic_ext $static_ext $nonxs_ext
22788 shift
22789 extensions="$*"
22790
22791 # Sanity check:  We require an extension suitable for use with
22792 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22793 # should show up as failures in the test suite, but it's helpful to
22794 # catch them now.) The 'extensions' list is normally sorted
22795 # alphabetically, so we need to accept either
22796 #    DB_File ... Fcntl ... IO  ....
22797 # or something like
22798 #    Fcntl ... NDBM_File ... IO  ....
22799 case " $extensions"  in
22800 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22801 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22802 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22803 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22804    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22805    ;;
22806 esac
22807
22808 : Remove libraries needed only for extensions
22809 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22810 : The exception is SunOS 4.x, which needs them.
22811 case "${osname}X${osvers}" in
22812 sunos*X4*)
22813     perllibs="$libs"
22814     ;;
22815 *) case "$usedl" in
22816     $define|true|[yY]*)
22817             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22818             shift
22819             perllibs="$*"
22820             ;;
22821     *)  perllibs="$libs"
22822             ;;
22823     esac
22824     ;;
22825 esac
22826
22827 : Remove build directory name from cppstdin so it can be used from
22828 : either the present location or the final installed location.
22829 echo " "
22830 : Get out of the UU directory to get correct path name.
22831 cd ..
22832 case "$cppstdin" in
22833 `pwd`/cppstdin)
22834         echo "Stripping down cppstdin path name"
22835         cppstdin=cppstdin
22836         ;;
22837 esac
22838 cd UU
22839
22840 : end of configuration questions
22841 echo " "
22842 echo "End of configuration questions."
22843 echo " "
22844
22845 : back to where it started
22846 if test -d ../UU; then
22847         cd ..
22848 fi
22849
22850 : configuration may be unconditionally patched via a 'config.arch' file
22851 if $test -f config.arch; then
22852         echo "I see a config.arch file, loading it." >&4
22853         . ./config.arch
22854 fi
22855
22856 : configuration may be patched via a 'config.over' file
22857 if $test -f config.over; then
22858         echo " "
22859         dflt=y
22860         rp='I see a config.over file.  Do you wish to load it?'
22861         . UU/myread
22862         case "$ans" in
22863         n*) echo "OK, I'll ignore it.";;
22864         *)      . ./config.over
22865                 echo "Configuration override changes have been loaded."
22866                 ;;
22867         esac
22868 fi
22869
22870 : in case they want portability, strip down executable paths
22871 case "$d_portable" in
22872 "$define")
22873         echo " "
22874         echo "Stripping down executable paths..." >&4
22875         for file in $loclist $trylist; do
22876                 eval temp=\$$file
22877                 eval $file=`basename $temp`
22878         done
22879         ;;
22880 esac
22881
22882 : create config.sh file
22883 echo " "
22884 echo "Creating config.sh..." >&4
22885 $spitshell <<EOT >config.sh
22886 $startsh
22887 #
22888 # This file was produced by running the Configure script. It holds all the
22889 # definitions figured out by Configure. Should you modify one of these values,
22890 # do not forget to propagate your changes by running "Configure -der". You may
22891 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22892 #
22893
22894 # Package name      : $package
22895 # Source directory  : $src
22896 # Configuration time: $cf_time
22897 # Configured by     : $cf_by
22898 # Target system     : $myuname
22899
22900 EOT
22901 : Add in command line options if available
22902 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22903
22904 $spitshell <<EOT >>config.sh
22905
22906 Author='$Author'
22907 Date='$Date'
22908 Header='$Header'
22909 Id='$Id'
22910 Locker='$Locker'
22911 Log='$Log'
22912 RCSfile='$RCSfile'
22913 Revision='$Revision'
22914 Source='$Source'
22915 State='$State'
22916 _a='$_a'
22917 _exe='$_exe'
22918 _o='$_o'
22919 afs='$afs'
22920 afsroot='$afsroot'
22921 alignbytes='$alignbytes'
22922 ansi2knr='$ansi2knr'
22923 aphostname='$aphostname'
22924 api_revision='$api_revision'
22925 api_subversion='$api_subversion'
22926 api_version='$api_version'
22927 api_versionstring='$api_versionstring'
22928 ar='$ar'
22929 archlib='$archlib'
22930 archlibexp='$archlibexp'
22931 archname64='$archname64'
22932 archname='$archname'
22933 archobjs='$archobjs'
22934 asctime_r_proto='$asctime_r_proto'
22935 awk='$awk'
22936 baserev='$baserev'
22937 bash='$bash'
22938 bin='$bin'
22939 bin_ELF='$bin_ELF'
22940 binexp='$binexp'
22941 bison='$bison'
22942 bootstrap_charset='$bootstrap_charset'
22943 byacc='$byacc'
22944 byteorder='$byteorder'
22945 c='$c'
22946 castflags='$castflags'
22947 cat='$cat'
22948 cc='$cc'
22949 cccdlflags='$cccdlflags'
22950 ccdlflags='$ccdlflags'
22951 ccflags='$ccflags'
22952 ccflags_uselargefiles='$ccflags_uselargefiles'
22953 ccname='$ccname'
22954 ccsymbols='$ccsymbols'
22955 ccversion='$ccversion'
22956 cf_by='$cf_by'
22957 cf_email='$cf_email'
22958 cf_time='$cf_time'
22959 charbits='$charbits'
22960 charsize='$charsize'
22961 chgrp='$chgrp'
22962 chmod='$chmod'
22963 chown='$chown'
22964 clocktype='$clocktype'
22965 comm='$comm'
22966 compress='$compress'
22967 contains='$contains'
22968 cp='$cp'
22969 cpio='$cpio'
22970 cpp='$cpp'
22971 cpp_stuff='$cpp_stuff'
22972 cppccsymbols='$cppccsymbols'
22973 cppflags='$cppflags'
22974 cpplast='$cpplast'
22975 cppminus='$cppminus'
22976 cpprun='$cpprun'
22977 cppstdin='$cppstdin'
22978 cppsymbols='$cppsymbols'
22979 crypt_r_proto='$crypt_r_proto'
22980 cryptlib='$cryptlib'
22981 csh='$csh'
22982 ctermid_r_proto='$ctermid_r_proto'
22983 ctime_r_proto='$ctime_r_proto'
22984 d_Gconvert='$d_Gconvert'
22985 d_PRIEUldbl='$d_PRIEUldbl'
22986 d_PRIFUldbl='$d_PRIFUldbl'
22987 d_PRIGUldbl='$d_PRIGUldbl'
22988 d_PRIXU64='$d_PRIXU64'
22989 d_PRId64='$d_PRId64'
22990 d_PRIeldbl='$d_PRIeldbl'
22991 d_PRIfldbl='$d_PRIfldbl'
22992 d_PRIgldbl='$d_PRIgldbl'
22993 d_PRIi64='$d_PRIi64'
22994 d_PRIo64='$d_PRIo64'
22995 d_PRIu64='$d_PRIu64'
22996 d_PRIx64='$d_PRIx64'
22997 d_SCNfldbl='$d_SCNfldbl'
22998 d__fwalk='$d__fwalk'
22999 d_access='$d_access'
23000 d_accessx='$d_accessx'
23001 d_aintl='$d_aintl'
23002 d_alarm='$d_alarm'
23003 d_archlib='$d_archlib'
23004 d_asctime64='$d_asctime64'
23005 d_asctime_r='$d_asctime_r'
23006 d_atolf='$d_atolf'
23007 d_atoll='$d_atoll'
23008 d_attribute_deprecated='$d_attribute_deprecated'
23009 d_attribute_format='$d_attribute_format'
23010 d_attribute_malloc='$d_attribute_malloc'
23011 d_attribute_nonnull='$d_attribute_nonnull'
23012 d_attribute_noreturn='$d_attribute_noreturn'
23013 d_attribute_pure='$d_attribute_pure'
23014 d_attribute_unused='$d_attribute_unused'
23015 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23016 d_bcmp='$d_bcmp'
23017 d_bcopy='$d_bcopy'
23018 d_bsd='$d_bsd'
23019 d_bsdgetpgrp='$d_bsdgetpgrp'
23020 d_bsdsetpgrp='$d_bsdsetpgrp'
23021 d_builtin_choose_expr='$d_builtin_choose_expr'
23022 d_builtin_expect='$d_builtin_expect'
23023 d_bzero='$d_bzero'
23024 d_c99_variadic_macros='$d_c99_variadic_macros'
23025 d_casti32='$d_casti32'
23026 d_castneg='$d_castneg'
23027 d_charvspr='$d_charvspr'
23028 d_chown='$d_chown'
23029 d_chroot='$d_chroot'
23030 d_chsize='$d_chsize'
23031 d_class='$d_class'
23032 d_clearenv='$d_clearenv'
23033 d_closedir='$d_closedir'
23034 d_cmsghdr_s='$d_cmsghdr_s'
23035 d_const='$d_const'
23036 d_copysignl='$d_copysignl'
23037 d_cplusplus='$d_cplusplus'
23038 d_crypt='$d_crypt'
23039 d_crypt_r='$d_crypt_r'
23040 d_csh='$d_csh'
23041 d_ctermid='$d_ctermid'
23042 d_ctermid_r='$d_ctermid_r'
23043 d_ctime64='$d_ctime64'
23044 d_ctime_r='$d_ctime_r'
23045 d_cuserid='$d_cuserid'
23046 d_dbl_dig='$d_dbl_dig'
23047 d_dbminitproto='$d_dbminitproto'
23048 d_difftime64='$d_difftime64'
23049 d_difftime='$d_difftime'
23050 d_dir_dd_fd='$d_dir_dd_fd'
23051 d_dirfd='$d_dirfd'
23052 d_dirnamlen='$d_dirnamlen'
23053 d_dlerror='$d_dlerror'
23054 d_dlopen='$d_dlopen'
23055 d_dlsymun='$d_dlsymun'
23056 d_dosuid='$d_dosuid'
23057 d_drand48_r='$d_drand48_r'
23058 d_drand48proto='$d_drand48proto'
23059 d_dup2='$d_dup2'
23060 d_eaccess='$d_eaccess'
23061 d_endgrent='$d_endgrent'
23062 d_endgrent_r='$d_endgrent_r'
23063 d_endhent='$d_endhent'
23064 d_endhostent_r='$d_endhostent_r'
23065 d_endnent='$d_endnent'
23066 d_endnetent_r='$d_endnetent_r'
23067 d_endpent='$d_endpent'
23068 d_endprotoent_r='$d_endprotoent_r'
23069 d_endpwent='$d_endpwent'
23070 d_endpwent_r='$d_endpwent_r'
23071 d_endsent='$d_endsent'
23072 d_endservent_r='$d_endservent_r'
23073 d_eofnblk='$d_eofnblk'
23074 d_eunice='$d_eunice'
23075 d_faststdio='$d_faststdio'
23076 d_fchdir='$d_fchdir'
23077 d_fchmod='$d_fchmod'
23078 d_fchown='$d_fchown'
23079 d_fcntl='$d_fcntl'
23080 d_fcntl_can_lock='$d_fcntl_can_lock'
23081 d_fd_macros='$d_fd_macros'
23082 d_fd_set='$d_fd_set'
23083 d_fds_bits='$d_fds_bits'
23084 d_fgetpos='$d_fgetpos'
23085 d_finite='$d_finite'
23086 d_finitel='$d_finitel'
23087 d_flexfnam='$d_flexfnam'
23088 d_flock='$d_flock'
23089 d_flockproto='$d_flockproto'
23090 d_fork='$d_fork'
23091 d_fp_class='$d_fp_class'
23092 d_fpathconf='$d_fpathconf'
23093 d_fpclass='$d_fpclass'
23094 d_fpclassify='$d_fpclassify'
23095 d_fpclassl='$d_fpclassl'
23096 d_fpos64_t='$d_fpos64_t'
23097 d_frexpl='$d_frexpl'
23098 d_fs_data_s='$d_fs_data_s'
23099 d_fseeko='$d_fseeko'
23100 d_fsetpos='$d_fsetpos'
23101 d_fstatfs='$d_fstatfs'
23102 d_fstatvfs='$d_fstatvfs'
23103 d_fsync='$d_fsync'
23104 d_ftello='$d_ftello'
23105 d_ftime='$d_ftime'
23106 d_futimes='$d_futimes'
23107 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23108 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23109 d_getaddrinfo='$d_getaddrinfo'
23110 d_getcwd='$d_getcwd'
23111 d_getespwnam='$d_getespwnam'
23112 d_getfsstat='$d_getfsstat'
23113 d_getgrent='$d_getgrent'
23114 d_getgrent_r='$d_getgrent_r'
23115 d_getgrgid_r='$d_getgrgid_r'
23116 d_getgrnam_r='$d_getgrnam_r'
23117 d_getgrps='$d_getgrps'
23118 d_gethbyaddr='$d_gethbyaddr'
23119 d_gethbyname='$d_gethbyname'
23120 d_gethent='$d_gethent'
23121 d_gethname='$d_gethname'
23122 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23123 d_gethostbyname_r='$d_gethostbyname_r'
23124 d_gethostent_r='$d_gethostent_r'
23125 d_gethostprotos='$d_gethostprotos'
23126 d_getitimer='$d_getitimer'
23127 d_getlogin='$d_getlogin'
23128 d_getlogin_r='$d_getlogin_r'
23129 d_getmnt='$d_getmnt'
23130 d_getmntent='$d_getmntent'
23131 d_getnameinfo='$d_getnameinfo'
23132 d_getnbyaddr='$d_getnbyaddr'
23133 d_getnbyname='$d_getnbyname'
23134 d_getnent='$d_getnent'
23135 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23136 d_getnetbyname_r='$d_getnetbyname_r'
23137 d_getnetent_r='$d_getnetent_r'
23138 d_getnetprotos='$d_getnetprotos'
23139 d_getpagsz='$d_getpagsz'
23140 d_getpbyname='$d_getpbyname'
23141 d_getpbynumber='$d_getpbynumber'
23142 d_getpent='$d_getpent'
23143 d_getpgid='$d_getpgid'
23144 d_getpgrp2='$d_getpgrp2'
23145 d_getpgrp='$d_getpgrp'
23146 d_getppid='$d_getppid'
23147 d_getprior='$d_getprior'
23148 d_getprotobyname_r='$d_getprotobyname_r'
23149 d_getprotobynumber_r='$d_getprotobynumber_r'
23150 d_getprotoent_r='$d_getprotoent_r'
23151 d_getprotoprotos='$d_getprotoprotos'
23152 d_getprpwnam='$d_getprpwnam'
23153 d_getpwent='$d_getpwent'
23154 d_getpwent_r='$d_getpwent_r'
23155 d_getpwnam_r='$d_getpwnam_r'
23156 d_getpwuid_r='$d_getpwuid_r'
23157 d_getsbyname='$d_getsbyname'
23158 d_getsbyport='$d_getsbyport'
23159 d_getsent='$d_getsent'
23160 d_getservbyname_r='$d_getservbyname_r'
23161 d_getservbyport_r='$d_getservbyport_r'
23162 d_getservent_r='$d_getservent_r'
23163 d_getservprotos='$d_getservprotos'
23164 d_getspnam='$d_getspnam'
23165 d_getspnam_r='$d_getspnam_r'
23166 d_gettimeod='$d_gettimeod'
23167 d_gmtime64='$d_gmtime64'
23168 d_gmtime_r='$d_gmtime_r'
23169 d_gnulibc='$d_gnulibc'
23170 d_grpasswd='$d_grpasswd'
23171 d_hasmntopt='$d_hasmntopt'
23172 d_htonl='$d_htonl'
23173 d_ilogbl='$d_ilogbl'
23174 d_inc_version_list='$d_inc_version_list'
23175 d_index='$d_index'
23176 d_inetaton='$d_inetaton'
23177 d_inetntop='$d_inetntop'
23178 d_inetpton='$d_inetpton'
23179 d_int64_t='$d_int64_t'
23180 d_ip_mreq='$d_ip_mreq'
23181 d_ip_mreq_source='$d_ip_mreq_source'
23182 d_ipv6_mreq='$d_ipv6_mreq'
23183 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23184 d_isascii='$d_isascii'
23185 d_isblank='$d_isblank'
23186 d_isfinite='$d_isfinite'
23187 d_isinf='$d_isinf'
23188 d_isnan='$d_isnan'
23189 d_isnanl='$d_isnanl'
23190 d_killpg='$d_killpg'
23191 d_lchown='$d_lchown'
23192 d_ldbl_dig='$d_ldbl_dig'
23193 d_libm_lib_version='$d_libm_lib_version'
23194 d_link='$d_link'
23195 d_localtime64='$d_localtime64'
23196 d_localtime_r='$d_localtime_r'
23197 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23198 d_locconv='$d_locconv'
23199 d_lockf='$d_lockf'
23200 d_longdbl='$d_longdbl'
23201 d_longlong='$d_longlong'
23202 d_lseekproto='$d_lseekproto'
23203 d_lstat='$d_lstat'
23204 d_madvise='$d_madvise'
23205 d_malloc_good_size='$d_malloc_good_size'
23206 d_malloc_size='$d_malloc_size'
23207 d_mblen='$d_mblen'
23208 d_mbstowcs='$d_mbstowcs'
23209 d_mbtowc='$d_mbtowc'
23210 d_memchr='$d_memchr'
23211 d_memcmp='$d_memcmp'
23212 d_memcpy='$d_memcpy'
23213 d_memmove='$d_memmove'
23214 d_memset='$d_memset'
23215 d_mkdir='$d_mkdir'
23216 d_mkdtemp='$d_mkdtemp'
23217 d_mkfifo='$d_mkfifo'
23218 d_mkstemp='$d_mkstemp'
23219 d_mkstemps='$d_mkstemps'
23220 d_mktime64='$d_mktime64'
23221 d_mktime='$d_mktime'
23222 d_mmap='$d_mmap'
23223 d_modfl='$d_modfl'
23224 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23225 d_modflproto='$d_modflproto'
23226 d_mprotect='$d_mprotect'
23227 d_msg='$d_msg'
23228 d_msg_ctrunc='$d_msg_ctrunc'
23229 d_msg_dontroute='$d_msg_dontroute'
23230 d_msg_oob='$d_msg_oob'
23231 d_msg_peek='$d_msg_peek'
23232 d_msg_proxy='$d_msg_proxy'
23233 d_msgctl='$d_msgctl'
23234 d_msgget='$d_msgget'
23235 d_msghdr_s='$d_msghdr_s'
23236 d_msgrcv='$d_msgrcv'
23237 d_msgsnd='$d_msgsnd'
23238 d_msync='$d_msync'
23239 d_munmap='$d_munmap'
23240 d_mymalloc='$d_mymalloc'
23241 d_ndbm='$d_ndbm'
23242 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23243 d_nice='$d_nice'
23244 d_nl_langinfo='$d_nl_langinfo'
23245 d_nv_preserves_uv='$d_nv_preserves_uv'
23246 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23247 d_off64_t='$d_off64_t'
23248 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23249 d_oldpthreads='$d_oldpthreads'
23250 d_oldsock='$d_oldsock'
23251 d_open3='$d_open3'
23252 d_pathconf='$d_pathconf'
23253 d_pause='$d_pause'
23254 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23255 d_phostname='$d_phostname'
23256 d_pipe='$d_pipe'
23257 d_poll='$d_poll'
23258 d_portable='$d_portable'
23259 d_prctl='$d_prctl'
23260 d_prctl_set_name='$d_prctl_set_name'
23261 d_printf_format_null='$d_printf_format_null'
23262 d_procselfexe='$d_procselfexe'
23263 d_pseudofork='$d_pseudofork'
23264 d_pthread_atfork='$d_pthread_atfork'
23265 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23266 d_pthread_yield='$d_pthread_yield'
23267 d_pwage='$d_pwage'
23268 d_pwchange='$d_pwchange'
23269 d_pwclass='$d_pwclass'
23270 d_pwcomment='$d_pwcomment'
23271 d_pwexpire='$d_pwexpire'
23272 d_pwgecos='$d_pwgecos'
23273 d_pwpasswd='$d_pwpasswd'
23274 d_pwquota='$d_pwquota'
23275 d_qgcvt='$d_qgcvt'
23276 d_quad='$d_quad'
23277 d_random_r='$d_random_r'
23278 d_readdir64_r='$d_readdir64_r'
23279 d_readdir='$d_readdir'
23280 d_readdir_r='$d_readdir_r'
23281 d_readlink='$d_readlink'
23282 d_readv='$d_readv'
23283 d_recvmsg='$d_recvmsg'
23284 d_rename='$d_rename'
23285 d_rewinddir='$d_rewinddir'
23286 d_rmdir='$d_rmdir'
23287 d_safebcpy='$d_safebcpy'
23288 d_safemcpy='$d_safemcpy'
23289 d_sanemcmp='$d_sanemcmp'
23290 d_sbrkproto='$d_sbrkproto'
23291 d_scalbnl='$d_scalbnl'
23292 d_sched_yield='$d_sched_yield'
23293 d_scm_rights='$d_scm_rights'
23294 d_seekdir='$d_seekdir'
23295 d_select='$d_select'
23296 d_sem='$d_sem'
23297 d_semctl='$d_semctl'
23298 d_semctl_semid_ds='$d_semctl_semid_ds'
23299 d_semctl_semun='$d_semctl_semun'
23300 d_semget='$d_semget'
23301 d_semop='$d_semop'
23302 d_sendmsg='$d_sendmsg'
23303 d_setegid='$d_setegid'
23304 d_seteuid='$d_seteuid'
23305 d_setgrent='$d_setgrent'
23306 d_setgrent_r='$d_setgrent_r'
23307 d_setgrps='$d_setgrps'
23308 d_sethent='$d_sethent'
23309 d_sethostent_r='$d_sethostent_r'
23310 d_setitimer='$d_setitimer'
23311 d_setlinebuf='$d_setlinebuf'
23312 d_setlocale='$d_setlocale'
23313 d_setlocale_r='$d_setlocale_r'
23314 d_setnent='$d_setnent'
23315 d_setnetent_r='$d_setnetent_r'
23316 d_setpent='$d_setpent'
23317 d_setpgid='$d_setpgid'
23318 d_setpgrp2='$d_setpgrp2'
23319 d_setpgrp='$d_setpgrp'
23320 d_setprior='$d_setprior'
23321 d_setproctitle='$d_setproctitle'
23322 d_setprotoent_r='$d_setprotoent_r'
23323 d_setpwent='$d_setpwent'
23324 d_setpwent_r='$d_setpwent_r'
23325 d_setregid='$d_setregid'
23326 d_setresgid='$d_setresgid'
23327 d_setresuid='$d_setresuid'
23328 d_setreuid='$d_setreuid'
23329 d_setrgid='$d_setrgid'
23330 d_setruid='$d_setruid'
23331 d_setsent='$d_setsent'
23332 d_setservent_r='$d_setservent_r'
23333 d_setsid='$d_setsid'
23334 d_setvbuf='$d_setvbuf'
23335 d_sfio='$d_sfio'
23336 d_shm='$d_shm'
23337 d_shmat='$d_shmat'
23338 d_shmatprototype='$d_shmatprototype'
23339 d_shmctl='$d_shmctl'
23340 d_shmdt='$d_shmdt'
23341 d_shmget='$d_shmget'
23342 d_sigaction='$d_sigaction'
23343 d_signbit='$d_signbit'
23344 d_sigprocmask='$d_sigprocmask'
23345 d_sigsetjmp='$d_sigsetjmp'
23346 d_sin6_scope_id='$d_sin6_scope_id'
23347 d_sitearch='$d_sitearch'
23348 d_snprintf='$d_snprintf'
23349 d_sockaddr_in6='$d_sockaddr_in6'
23350 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23351 d_sockatmark='$d_sockatmark'
23352 d_sockatmarkproto='$d_sockatmarkproto'
23353 d_socket='$d_socket'
23354 d_socklen_t='$d_socklen_t'
23355 d_sockpair='$d_sockpair'
23356 d_socks5_init='$d_socks5_init'
23357 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23358 d_sqrtl='$d_sqrtl'
23359 d_srand48_r='$d_srand48_r'
23360 d_srandom_r='$d_srandom_r'
23361 d_sresgproto='$d_sresgproto'
23362 d_sresuproto='$d_sresuproto'
23363 d_statblks='$d_statblks'
23364 d_statfs_f_flags='$d_statfs_f_flags'
23365 d_statfs_s='$d_statfs_s'
23366 d_static_inline='$d_static_inline'
23367 d_statvfs='$d_statvfs'
23368 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23369 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23370 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23371 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23372 d_stdio_stream_array='$d_stdio_stream_array'
23373 d_stdiobase='$d_stdiobase'
23374 d_stdstdio='$d_stdstdio'
23375 d_strchr='$d_strchr'
23376 d_strcoll='$d_strcoll'
23377 d_strctcpy='$d_strctcpy'
23378 d_strerrm='$d_strerrm'
23379 d_strerror='$d_strerror'
23380 d_strerror_r='$d_strerror_r'
23381 d_strftime='$d_strftime'
23382 d_strlcat='$d_strlcat'
23383 d_strlcpy='$d_strlcpy'
23384 d_strtod='$d_strtod'
23385 d_strtol='$d_strtol'
23386 d_strtold='$d_strtold'
23387 d_strtoll='$d_strtoll'
23388 d_strtoq='$d_strtoq'
23389 d_strtoul='$d_strtoul'
23390 d_strtoull='$d_strtoull'
23391 d_strtouq='$d_strtouq'
23392 d_strxfrm='$d_strxfrm'
23393 d_suidsafe='$d_suidsafe'
23394 d_symlink='$d_symlink'
23395 d_syscall='$d_syscall'
23396 d_syscallproto='$d_syscallproto'
23397 d_sysconf='$d_sysconf'
23398 d_sysernlst='$d_sysernlst'
23399 d_syserrlst='$d_syserrlst'
23400 d_system='$d_system'
23401 d_tcgetpgrp='$d_tcgetpgrp'
23402 d_tcsetpgrp='$d_tcsetpgrp'
23403 d_telldir='$d_telldir'
23404 d_telldirproto='$d_telldirproto'
23405 d_time='$d_time'
23406 d_timegm='$d_timegm'
23407 d_times='$d_times'
23408 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23409 d_tm_tm_zone='$d_tm_tm_zone'
23410 d_tmpnam_r='$d_tmpnam_r'
23411 d_truncate='$d_truncate'
23412 d_ttyname_r='$d_ttyname_r'
23413 d_tzname='$d_tzname'
23414 d_u32align='$d_u32align'
23415 d_ualarm='$d_ualarm'
23416 d_umask='$d_umask'
23417 d_uname='$d_uname'
23418 d_union_semun='$d_union_semun'
23419 d_unordered='$d_unordered'
23420 d_unsetenv='$d_unsetenv'
23421 d_usleep='$d_usleep'
23422 d_usleepproto='$d_usleepproto'
23423 d_ustat='$d_ustat'
23424 d_vendorarch='$d_vendorarch'
23425 d_vendorbin='$d_vendorbin'
23426 d_vendorlib='$d_vendorlib'
23427 d_vendorscript='$d_vendorscript'
23428 d_vfork='$d_vfork'
23429 d_void_closedir='$d_void_closedir'
23430 d_voidsig='$d_voidsig'
23431 d_voidtty='$d_voidtty'
23432 d_volatile='$d_volatile'
23433 d_vprintf='$d_vprintf'
23434 d_vsnprintf='$d_vsnprintf'
23435 d_wait4='$d_wait4'
23436 d_waitpid='$d_waitpid'
23437 d_wcstombs='$d_wcstombs'
23438 d_wctomb='$d_wctomb'
23439 d_writev='$d_writev'
23440 d_xenix='$d_xenix'
23441 date='$date'
23442 db_hashtype='$db_hashtype'
23443 db_prefixtype='$db_prefixtype'
23444 db_version_major='$db_version_major'
23445 db_version_minor='$db_version_minor'
23446 db_version_patch='$db_version_patch'
23447 defvoidused='$defvoidused'
23448 direntrytype='$direntrytype'
23449 dlext='$dlext'
23450 dlsrc='$dlsrc'
23451 doublesize='$doublesize'
23452 drand01='$drand01'
23453 drand48_r_proto='$drand48_r_proto'
23454 dtrace='$dtrace'
23455 dynamic_ext='$dynamic_ext'
23456 eagain='$eagain'
23457 ebcdic='$ebcdic'
23458 echo='$echo'
23459 egrep='$egrep'
23460 emacs='$emacs'
23461 endgrent_r_proto='$endgrent_r_proto'
23462 endhostent_r_proto='$endhostent_r_proto'
23463 endnetent_r_proto='$endnetent_r_proto'
23464 endprotoent_r_proto='$endprotoent_r_proto'
23465 endpwent_r_proto='$endpwent_r_proto'
23466 endservent_r_proto='$endservent_r_proto'
23467 eunicefix='$eunicefix'
23468 exe_ext='$exe_ext'
23469 expr='$expr'
23470 extensions='$extensions'
23471 extern_C='$extern_C'
23472 extras='$extras'
23473 fflushNULL='$fflushNULL'
23474 fflushall='$fflushall'
23475 find='$find'
23476 firstmakefile='$firstmakefile'
23477 flex='$flex'
23478 fpossize='$fpossize'
23479 fpostype='$fpostype'
23480 freetype='$freetype'
23481 from='$from'
23482 full_ar='$full_ar'
23483 full_csh='$full_csh'
23484 full_sed='$full_sed'
23485 gccansipedantic='$gccansipedantic'
23486 gccosandvers='$gccosandvers'
23487 gccversion='$gccversion'
23488 getgrent_r_proto='$getgrent_r_proto'
23489 getgrgid_r_proto='$getgrgid_r_proto'
23490 getgrnam_r_proto='$getgrnam_r_proto'
23491 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23492 gethostbyname_r_proto='$gethostbyname_r_proto'
23493 gethostent_r_proto='$gethostent_r_proto'
23494 getlogin_r_proto='$getlogin_r_proto'
23495 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23496 getnetbyname_r_proto='$getnetbyname_r_proto'
23497 getnetent_r_proto='$getnetent_r_proto'
23498 getprotobyname_r_proto='$getprotobyname_r_proto'
23499 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23500 getprotoent_r_proto='$getprotoent_r_proto'
23501 getpwent_r_proto='$getpwent_r_proto'
23502 getpwnam_r_proto='$getpwnam_r_proto'
23503 getpwuid_r_proto='$getpwuid_r_proto'
23504 getservbyname_r_proto='$getservbyname_r_proto'
23505 getservbyport_r_proto='$getservbyport_r_proto'
23506 getservent_r_proto='$getservent_r_proto'
23507 getspnam_r_proto='$getspnam_r_proto'
23508 gidformat='$gidformat'
23509 gidsign='$gidsign'
23510 gidsize='$gidsize'
23511 gidtype='$gidtype'
23512 glibpth='$glibpth'
23513 gmake='$gmake'
23514 gmtime_r_proto='$gmtime_r_proto'
23515 gnulibc_version='$gnulibc_version'
23516 grep='$grep'
23517 groupcat='$groupcat'
23518 groupstype='$groupstype'
23519 gzip='$gzip'
23520 h_fcntl='$h_fcntl'
23521 h_sysfile='$h_sysfile'
23522 hint='$hint'
23523 hostcat='$hostcat'
23524 html1dir='$html1dir'
23525 html1direxp='$html1direxp'
23526 html3dir='$html3dir'
23527 html3direxp='$html3direxp'
23528 i16size='$i16size'
23529 i16type='$i16type'
23530 i32size='$i32size'
23531 i32type='$i32type'
23532 i64size='$i64size'
23533 i64type='$i64type'
23534 i8size='$i8size'
23535 i8type='$i8type'
23536 i_arpainet='$i_arpainet'
23537 i_assert='$i_assert'
23538 i_bsdioctl='$i_bsdioctl'
23539 i_crypt='$i_crypt'
23540 i_db='$i_db'
23541 i_dbm='$i_dbm'
23542 i_dirent='$i_dirent'
23543 i_dld='$i_dld'
23544 i_dlfcn='$i_dlfcn'
23545 i_fcntl='$i_fcntl'
23546 i_float='$i_float'
23547 i_fp='$i_fp'
23548 i_fp_class='$i_fp_class'
23549 i_gdbm='$i_gdbm'
23550 i_gdbm_ndbm='$i_gdbm_ndbm'
23551 i_gdbmndbm='$i_gdbmndbm'
23552 i_grp='$i_grp'
23553 i_ieeefp='$i_ieeefp'
23554 i_inttypes='$i_inttypes'
23555 i_langinfo='$i_langinfo'
23556 i_libutil='$i_libutil'
23557 i_limits='$i_limits'
23558 i_locale='$i_locale'
23559 i_machcthr='$i_machcthr'
23560 i_malloc='$i_malloc'
23561 i_mallocmalloc='$i_mallocmalloc'
23562 i_math='$i_math'
23563 i_memory='$i_memory'
23564 i_mntent='$i_mntent'
23565 i_ndbm='$i_ndbm'
23566 i_netdb='$i_netdb'
23567 i_neterrno='$i_neterrno'
23568 i_netinettcp='$i_netinettcp'
23569 i_niin='$i_niin'
23570 i_poll='$i_poll'
23571 i_prot='$i_prot'
23572 i_pthread='$i_pthread'
23573 i_pwd='$i_pwd'
23574 i_rpcsvcdbm='$i_rpcsvcdbm'
23575 i_sfio='$i_sfio'
23576 i_sgtty='$i_sgtty'
23577 i_shadow='$i_shadow'
23578 i_socks='$i_socks'
23579 i_stdarg='$i_stdarg'
23580 i_stdbool='$i_stdbool'
23581 i_stddef='$i_stddef'
23582 i_stdlib='$i_stdlib'
23583 i_string='$i_string'
23584 i_sunmath='$i_sunmath'
23585 i_sysaccess='$i_sysaccess'
23586 i_sysdir='$i_sysdir'
23587 i_sysfile='$i_sysfile'
23588 i_sysfilio='$i_sysfilio'
23589 i_sysin='$i_sysin'
23590 i_sysioctl='$i_sysioctl'
23591 i_syslog='$i_syslog'
23592 i_sysmman='$i_sysmman'
23593 i_sysmode='$i_sysmode'
23594 i_sysmount='$i_sysmount'
23595 i_sysndir='$i_sysndir'
23596 i_sysparam='$i_sysparam'
23597 i_syspoll='$i_syspoll'
23598 i_sysresrc='$i_sysresrc'
23599 i_syssecrt='$i_syssecrt'
23600 i_sysselct='$i_sysselct'
23601 i_syssockio='$i_syssockio'
23602 i_sysstat='$i_sysstat'
23603 i_sysstatfs='$i_sysstatfs'
23604 i_sysstatvfs='$i_sysstatvfs'
23605 i_systime='$i_systime'
23606 i_systimek='$i_systimek'
23607 i_systimes='$i_systimes'
23608 i_systypes='$i_systypes'
23609 i_sysuio='$i_sysuio'
23610 i_sysun='$i_sysun'
23611 i_sysutsname='$i_sysutsname'
23612 i_sysvfs='$i_sysvfs'
23613 i_syswait='$i_syswait'
23614 i_termio='$i_termio'
23615 i_termios='$i_termios'
23616 i_time='$i_time'
23617 i_unistd='$i_unistd'
23618 i_ustat='$i_ustat'
23619 i_utime='$i_utime'
23620 i_values='$i_values'
23621 i_varargs='$i_varargs'
23622 i_varhdr='$i_varhdr'
23623 i_vfork='$i_vfork'
23624 ignore_versioned_solibs='$ignore_versioned_solibs'
23625 inc_version_list='$inc_version_list'
23626 inc_version_list_init='$inc_version_list_init'
23627 incpath='$incpath'
23628 inews='$inews'
23629 initialinstalllocation='$initialinstalllocation'
23630 installarchlib='$installarchlib'
23631 installbin='$installbin'
23632 installhtml1dir='$installhtml1dir'
23633 installhtml3dir='$installhtml3dir'
23634 installman1dir='$installman1dir'
23635 installman3dir='$installman3dir'
23636 installprefix='$installprefix'
23637 installprefixexp='$installprefixexp'
23638 installprivlib='$installprivlib'
23639 installscript='$installscript'
23640 installsitearch='$installsitearch'
23641 installsitebin='$installsitebin'
23642 installsitehtml1dir='$installsitehtml1dir'
23643 installsitehtml3dir='$installsitehtml3dir'
23644 installsitelib='$installsitelib'
23645 installsiteman1dir='$installsiteman1dir'
23646 installsiteman3dir='$installsiteman3dir'
23647 installsitescript='$installsitescript'
23648 installstyle='$installstyle'
23649 installusrbinperl='$installusrbinperl'
23650 installvendorarch='$installvendorarch'
23651 installvendorbin='$installvendorbin'
23652 installvendorhtml1dir='$installvendorhtml1dir'
23653 installvendorhtml3dir='$installvendorhtml3dir'
23654 installvendorlib='$installvendorlib'
23655 installvendorman1dir='$installvendorman1dir'
23656 installvendorman3dir='$installvendorman3dir'
23657 installvendorscript='$installvendorscript'
23658 intsize='$intsize'
23659 issymlink='$issymlink'
23660 ivdformat='$ivdformat'
23661 ivsize='$ivsize'
23662 ivtype='$ivtype'
23663 known_extensions='$known_extensions'
23664 ksh='$ksh'
23665 ld='$ld'
23666 ld_can_script='$ld_can_script'
23667 lddlflags='$lddlflags'
23668 ldflags='$ldflags'
23669 ldflags_uselargefiles='$ldflags_uselargefiles'
23670 ldlibpthname='$ldlibpthname'
23671 less='$less'
23672 lib_ext='$lib_ext'
23673 libc='$libc'
23674 libperl='$libperl'
23675 libpth='$libpth'
23676 libs='$libs'
23677 libsdirs='$libsdirs'
23678 libsfiles='$libsfiles'
23679 libsfound='$libsfound'
23680 libspath='$libspath'
23681 libswanted='$libswanted'
23682 libswanted_uselargefiles='$libswanted_uselargefiles'
23683 line='$line'
23684 lint='$lint'
23685 lkflags='$lkflags'
23686 ln='$ln'
23687 lns='$lns'
23688 localtime_r_proto='$localtime_r_proto'
23689 locincpth='$locincpth'
23690 loclibpth='$loclibpth'
23691 longdblsize='$longdblsize'
23692 longlongsize='$longlongsize'
23693 longsize='$longsize'
23694 lp='$lp'
23695 lpr='$lpr'
23696 ls='$ls'
23697 lseeksize='$lseeksize'
23698 lseektype='$lseektype'
23699 mad='$mad'
23700 madlyh='$madlyh'
23701 madlyobj='$madlyobj'
23702 madlysrc='$madlysrc'
23703 mail='$mail'
23704 mailx='$mailx'
23705 make='$make'
23706 make_set_make='$make_set_make'
23707 mallocobj='$mallocobj'
23708 mallocsrc='$mallocsrc'
23709 malloctype='$malloctype'
23710 man1dir='$man1dir'
23711 man1direxp='$man1direxp'
23712 man1ext='$man1ext'
23713 man3dir='$man3dir'
23714 man3direxp='$man3direxp'
23715 man3ext='$man3ext'
23716 mips_type='$mips_type'
23717 mistrustnm='$mistrustnm'
23718 mkdir='$mkdir'
23719 mmaptype='$mmaptype'
23720 modetype='$modetype'
23721 more='$more'
23722 multiarch='$multiarch'
23723 mv='$mv'
23724 myarchname='$myarchname'
23725 mydomain='$mydomain'
23726 myhostname='$myhostname'
23727 myuname='$myuname'
23728 n='$n'
23729 need_va_copy='$need_va_copy'
23730 netdb_hlen_type='$netdb_hlen_type'
23731 netdb_host_type='$netdb_host_type'
23732 netdb_name_type='$netdb_name_type'
23733 netdb_net_type='$netdb_net_type'
23734 nm='$nm'
23735 nm_opt='$nm_opt'
23736 nm_so_opt='$nm_so_opt'
23737 nonxs_ext='$nonxs_ext'
23738 nroff='$nroff'
23739 nvEUformat='$nvEUformat'
23740 nvFUformat='$nvFUformat'
23741 nvGUformat='$nvGUformat'
23742 nv_overflows_integers_at='$nv_overflows_integers_at'
23743 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23744 nveformat='$nveformat'
23745 nvfformat='$nvfformat'
23746 nvgformat='$nvgformat'
23747 nvsize='$nvsize'
23748 nvtype='$nvtype'
23749 o_nonblock='$o_nonblock'
23750 obj_ext='$obj_ext'
23751 old_pthread_create_joinable='$old_pthread_create_joinable'
23752 optimize='$optimize'
23753 orderlib='$orderlib'
23754 osname='$osname'
23755 osvers='$osvers'
23756 otherlibdirs='$otherlibdirs'
23757 package='$package'
23758 pager='$pager'
23759 passcat='$passcat'
23760 patchlevel='$patchlevel'
23761 path_sep='$path_sep'
23762 perl5='$perl5'
23763 perl='$perl'
23764 perl_patchlevel='$perl_patchlevel'
23765 perl_static_inline='$perl_static_inline'
23766 perladmin='$perladmin'
23767 perllibs='$perllibs'
23768 perlpath='$perlpath'
23769 pg='$pg'
23770 phostname='$phostname'
23771 pidtype='$pidtype'
23772 plibpth='$plibpth'
23773 pmake='$pmake'
23774 pr='$pr'
23775 prefix='$prefix'
23776 prefixexp='$prefixexp'
23777 privlib='$privlib'
23778 privlibexp='$privlibexp'
23779 procselfexe='$procselfexe'
23780 prototype='$prototype'
23781 ptrsize='$ptrsize'
23782 quadkind='$quadkind'
23783 quadtype='$quadtype'
23784 randbits='$randbits'
23785 randfunc='$randfunc'
23786 random_r_proto='$random_r_proto'
23787 randseedtype='$randseedtype'
23788 ranlib='$ranlib'
23789 rd_nodata='$rd_nodata'
23790 readdir64_r_proto='$readdir64_r_proto'
23791 readdir_r_proto='$readdir_r_proto'
23792 revision='$revision'
23793 rm='$rm'
23794 rm_try='$rm_try'
23795 rmail='$rmail'
23796 run='$run'
23797 runnm='$runnm'
23798 sGMTIME_max='$sGMTIME_max'
23799 sGMTIME_min='$sGMTIME_min'
23800 sLOCALTIME_max='$sLOCALTIME_max'
23801 sLOCALTIME_min='$sLOCALTIME_min'
23802 sPRIEUldbl='$sPRIEUldbl'
23803 sPRIFUldbl='$sPRIFUldbl'
23804 sPRIGUldbl='$sPRIGUldbl'
23805 sPRIXU64='$sPRIXU64'
23806 sPRId64='$sPRId64'
23807 sPRIeldbl='$sPRIeldbl'
23808 sPRIfldbl='$sPRIfldbl'
23809 sPRIgldbl='$sPRIgldbl'
23810 sPRIi64='$sPRIi64'
23811 sPRIo64='$sPRIo64'
23812 sPRIu64='$sPRIu64'
23813 sPRIx64='$sPRIx64'
23814 sSCNfldbl='$sSCNfldbl'
23815 sched_yield='$sched_yield'
23816 scriptdir='$scriptdir'
23817 scriptdirexp='$scriptdirexp'
23818 sed='$sed'
23819 seedfunc='$seedfunc'
23820 selectminbits='$selectminbits'
23821 selecttype='$selecttype'
23822 sendmail='$sendmail'
23823 setgrent_r_proto='$setgrent_r_proto'
23824 sethostent_r_proto='$sethostent_r_proto'
23825 setlocale_r_proto='$setlocale_r_proto'
23826 setnetent_r_proto='$setnetent_r_proto'
23827 setprotoent_r_proto='$setprotoent_r_proto'
23828 setpwent_r_proto='$setpwent_r_proto'
23829 setservent_r_proto='$setservent_r_proto'
23830 sh='$sh'
23831 shar='$shar'
23832 sharpbang='$sharpbang'
23833 shmattype='$shmattype'
23834 shortsize='$shortsize'
23835 shrpenv='$shrpenv'
23836 shsharp='$shsharp'
23837 sig_count='$sig_count'
23838 sig_name='$sig_name'
23839 sig_name_init='$sig_name_init'
23840 sig_num='$sig_num'
23841 sig_num_init='$sig_num_init'
23842 sig_size='$sig_size'
23843 signal_t='$signal_t'
23844 sitearch='$sitearch'
23845 sitearchexp='$sitearchexp'
23846 sitebin='$sitebin'
23847 sitebinexp='$sitebinexp'
23848 sitehtml1dir='$sitehtml1dir'
23849 sitehtml1direxp='$sitehtml1direxp'
23850 sitehtml3dir='$sitehtml3dir'
23851 sitehtml3direxp='$sitehtml3direxp'
23852 sitelib='$sitelib'
23853 sitelib_stem='$sitelib_stem'
23854 sitelibexp='$sitelibexp'
23855 siteman1dir='$siteman1dir'
23856 siteman1direxp='$siteman1direxp'
23857 siteman3dir='$siteman3dir'
23858 siteman3direxp='$siteman3direxp'
23859 siteprefix='$siteprefix'
23860 siteprefixexp='$siteprefixexp'
23861 sitescript='$sitescript'
23862 sitescriptexp='$sitescriptexp'
23863 sizesize='$sizesize'
23864 sizetype='$sizetype'
23865 sleep='$sleep'
23866 smail='$smail'
23867 so='$so'
23868 sockethdr='$sockethdr'
23869 socketlib='$socketlib'
23870 socksizetype='$socksizetype'
23871 sort='$sort'
23872 spackage='$spackage'
23873 spitshell='$spitshell'
23874 srand48_r_proto='$srand48_r_proto'
23875 srandom_r_proto='$srandom_r_proto'
23876 src='$src'
23877 ssizetype='$ssizetype'
23878 st_ino_sign='$st_ino_sign'
23879 st_ino_size='$st_ino_size'
23880 startperl='$startperl'
23881 startsh='$startsh'
23882 static_ext='$static_ext'
23883 stdchar='$stdchar'
23884 stdio_base='$stdio_base'
23885 stdio_bufsiz='$stdio_bufsiz'
23886 stdio_cnt='$stdio_cnt'
23887 stdio_filbuf='$stdio_filbuf'
23888 stdio_ptr='$stdio_ptr'
23889 stdio_stream_array='$stdio_stream_array'
23890 strerror_r_proto='$strerror_r_proto'
23891 strings='$strings'
23892 submit='$submit'
23893 subversion='$subversion'
23894 sysman='$sysman'
23895 tail='$tail'
23896 tar='$tar'
23897 targetarch='$targetarch'
23898 tbl='$tbl'
23899 tee='$tee'
23900 test='$test'
23901 timeincl='$timeincl'
23902 timetype='$timetype'
23903 tmpnam_r_proto='$tmpnam_r_proto'
23904 to='$to'
23905 touch='$touch'
23906 tr='$tr'
23907 trnl='$trnl'
23908 troff='$troff'
23909 ttyname_r_proto='$ttyname_r_proto'
23910 u16size='$u16size'
23911 u16type='$u16type'
23912 u32size='$u32size'
23913 u32type='$u32type'
23914 u64size='$u64size'
23915 u64type='$u64type'
23916 u8size='$u8size'
23917 u8type='$u8type'
23918 uidformat='$uidformat'
23919 uidsign='$uidsign'
23920 uidsize='$uidsize'
23921 uidtype='$uidtype'
23922 uname='$uname'
23923 uniq='$uniq'
23924 uquadtype='$uquadtype'
23925 use5005threads='$use5005threads'
23926 use64bitall='$use64bitall'
23927 use64bitint='$use64bitint'
23928 usecrosscompile='$usecrosscompile'
23929 usedevel='$usedevel'
23930 usedl='$usedl'
23931 usedtrace='$usedtrace'
23932 usefaststdio='$usefaststdio'
23933 useithreads='$useithreads'
23934 usekernprocpathname='$usekernprocpathname'
23935 uselargefiles='$uselargefiles'
23936 uselongdouble='$uselongdouble'
23937 usemallocwrap='$usemallocwrap'
23938 usemorebits='$usemorebits'
23939 usemultiplicity='$usemultiplicity'
23940 usemymalloc='$usemymalloc'
23941 usenm='$usenm'
23942 usensgetexecutablepath='$usensgetexecutablepath'
23943 useopcode='$useopcode'
23944 useperlio='$useperlio'
23945 useposix='$useposix'
23946 usereentrant='$usereentrant'
23947 userelocatableinc='$userelocatableinc'
23948 usesfio='$usesfio'
23949 useshrplib='$useshrplib'
23950 usesitecustomize='$usesitecustomize'
23951 usesocks='$usesocks'
23952 usethreads='$usethreads'
23953 usevendorprefix='$usevendorprefix'
23954 useversionedarchname='$useversionedarchname'
23955 usevfork='$usevfork'
23956 usrinc='$usrinc'
23957 uuname='$uuname'
23958 uvXUformat='$uvXUformat'
23959 uvoformat='$uvoformat'
23960 uvsize='$uvsize'
23961 uvtype='$uvtype'
23962 uvuformat='$uvuformat'
23963 uvxformat='$uvxformat'
23964 vaproto='$vaproto'
23965 vendorarch='$vendorarch'
23966 vendorarchexp='$vendorarchexp'
23967 vendorbin='$vendorbin'
23968 vendorbinexp='$vendorbinexp'
23969 vendorhtml1dir='$vendorhtml1dir'
23970 vendorhtml1direxp='$vendorhtml1direxp'
23971 vendorhtml3dir='$vendorhtml3dir'
23972 vendorhtml3direxp='$vendorhtml3direxp'
23973 vendorlib='$vendorlib'
23974 vendorlib_stem='$vendorlib_stem'
23975 vendorlibexp='$vendorlibexp'
23976 vendorman1dir='$vendorman1dir'
23977 vendorman1direxp='$vendorman1direxp'
23978 vendorman3dir='$vendorman3dir'
23979 vendorman3direxp='$vendorman3direxp'
23980 vendorprefix='$vendorprefix'
23981 vendorprefixexp='$vendorprefixexp'
23982 vendorscript='$vendorscript'
23983 vendorscriptexp='$vendorscriptexp'
23984 version='$version'
23985 version_patchlevel_string='$version_patchlevel_string'
23986 versiononly='$versiononly'
23987 vi='$vi'
23988 voidflags='$voidflags'
23989 xlibpth='$xlibpth'
23990 yacc='$yacc'
23991 yaccflags='$yaccflags'
23992 zcat='$zcat'
23993 zip='$zip'
23994 EOT
23995
23996 : add special variables
23997 $test -f $src/patchlevel.h && \
23998 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23999 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24000 echo "PERL_CONFIG_SH=true" >>config.sh
24001
24002 : propagate old symbols
24003 if $test -f UU/config.sh; then
24004         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24005         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24006                 config.sh config.sh UU/oldconfig.sh |\
24007                 $sort | $uniq -u >UU/oldsyms
24008         set X `$cat UU/oldsyms`
24009         shift
24010         case $# in
24011         0) ;;
24012         *)
24013                 $cat <<EOM
24014 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24015 EOM
24016                 echo ": Variables propagated from previous config.sh file." >>config.sh
24017                 for sym in `$cat UU/oldsyms`; do
24018                         echo "    Propagating $hint variable "'$'"$sym..."
24019                         eval 'tmp="$'"${sym}"'"'
24020                         echo "$tmp" | \
24021                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24022                 done
24023                 ;;
24024         esac
24025 fi
24026
24027 : Finish up by extracting the .SH files
24028 case "$alldone" in
24029 exit)
24030         $rm -rf UU
24031         echo "Extraction done."
24032         exit 0
24033         ;;
24034 cont)
24035         ;;
24036 '')
24037         dflt=''
24038         nostick=true
24039         $cat <<EOM
24040
24041 If you'd like to make any changes to the config.sh file before I begin
24042 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24043
24044 EOM
24045         rp="Press return or use a shell escape to edit config.sh:"
24046         . UU/myread
24047         nostick=''
24048         case "$ans" in
24049         '') ;;
24050         *) : in case they cannot read
24051                 sh 1>&4 -c "$ans";;
24052         esac
24053         ;;
24054 esac
24055
24056 : if this fails, just run all the .SH files by hand
24057 . ./config.sh
24058
24059 echo " "
24060 exec 1>&4
24061 pwd=`pwd`
24062 . ./UU/extract
24063 cd "$pwd"
24064
24065 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24066         dflt=y
24067         case "$silent" in
24068         true) ;;
24069         *)
24070                 $cat <<EOM
24071
24072 Now you need to generate make dependencies by running "$make depend".
24073 You might prefer to run it in background: "$make depend > makedepend.out &"
24074 It can take a while, so you might not want to run it right now.
24075
24076 EOM
24077                 ;;
24078         esac
24079         rp="Run $make depend now?"
24080         . UU/myread
24081         case "$ans" in
24082         y*)
24083                 $make depend && echo "Now you must run '$make'."
24084                 ;;
24085         *)
24086                 echo "You must run '$make depend' then '$make'."
24087                 ;;
24088         esac
24089 elif test -f [Mm]akefile; then
24090         echo " "
24091         echo "Now you must run a $make."
24092 else
24093         echo "Configure done."
24094 fi
24095
24096 if $test -f Policy.sh; then
24097     $cat <<EOM
24098
24099 If you compile $package on a different machine or from a different object
24100 directory, copy the Policy.sh file from this object directory to the
24101 new one before you run Configure -- this will help you with most of
24102 the policy defaults.
24103
24104 EOM
24105 fi
24106 if $test -f config.msg; then
24107     echo "Hmm.  I also noted the following information while running:"
24108     echo " "
24109     $cat config.msg >&4
24110     $rm -f config.msg
24111 fi
24112 $rm -f kit*isdone ark*isdone
24113 $rm -rf UU
24114
24115 : End of Configure
24116