This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
nitpicks
[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 Sun Mar 16 09:41:42 CET 2014 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin|*msys) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 hostgenerate=''
210 hostosname=''
211 hostperl=''
212 run=''
213 targetarch=''
214 targetdir=''
215 targetenv=''
216 targethost=''
217 targetmkdir=''
218 targetport=''
219 to=''
220 usecrosscompile=''
221 extern_C=''
222 mistrustnm=''
223 usedevel=''
224 perllibs=''
225 dynamic_ext=''
226 extensions=''
227 known_extensions=''
228 nonxs_ext=''
229 static_ext=''
230 useopcode=''
231 useposix=''
232 extras=''
233 d_bsd=''
234 d_eunice=''
235 d_xenix=''
236 eunicefix=''
237 ar=''
238 awk=''
239 bash=''
240 bison=''
241 byacc=''
242 cat=''
243 chgrp=''
244 chmod=''
245 chown=''
246 comm=''
247 compress=''
248 cp=''
249 cpio=''
250 cpp=''
251 csh=''
252 date=''
253 echo=''
254 egrep=''
255 emacs=''
256 expr=''
257 find=''
258 flex=''
259 gmake=''
260 grep=''
261 gzip=''
262 inews=''
263 ksh=''
264 less=''
265 line=''
266 lint=''
267 ln=''
268 lp=''
269 lpr=''
270 ls=''
271 mail=''
272 mailx=''
273 make=''
274 mkdir=''
275 more=''
276 mv=''
277 nm=''
278 nroff=''
279 perl=''
280 pg=''
281 pmake=''
282 pr=''
283 rm=''
284 rmail=''
285 sed=''
286 sendmail=''
287 shar=''
288 sleep=''
289 smail=''
290 sort=''
291 submit=''
292 tail=''
293 tar=''
294 tbl=''
295 tee=''
296 test=''
297 touch=''
298 tr=''
299 troff=''
300 uname=''
301 uniq=''
302 uuname=''
303 vi=''
304 zcat=''
305 zip=''
306 full_ar=''
307 full_sed=''
308 libswanted=''
309 hint=''
310 myuname=''
311 osname=''
312 osvers=''
313 Author=''
314 Date=''
315 Header=''
316 Id=''
317 Locker=''
318 Log=''
319 RCSfile=''
320 Revision=''
321 Source=''
322 State=''
323 sysroot=''
324 _a=''
325 _exe=''
326 _o=''
327 archobjs=''
328 exe_ext=''
329 firstmakefile=''
330 lib_ext=''
331 obj_ext=''
332 path_sep=''
333 rm_try=''
334 afs=''
335 afsroot=''
336 alignbytes=''
337 ansi2knr=''
338 archlib=''
339 archlibexp=''
340 d_archlib=''
341 installarchlib=''
342 archname=''
343 myarchname=''
344 useversionedarchname=''
345 d_atolf=''
346 d_atoll=''
347 baserev=''
348 bin=''
349 binexp=''
350 initialinstalllocation=''
351 installbin=''
352 userelocatableinc=''
353 byteorder=''
354 cc=''
355 ccflags=''
356 cppflags=''
357 ldflags=''
358 lkflags=''
359 locincpth=''
360 optimize=''
361 cf_email=''
362 cf_by=''
363 cf_time=''
364 charbits=''
365 charsize=''
366 contains=''
367 cpp_stuff=''
368 cpplast=''
369 cppminus=''
370 cpprun=''
371 cppstdin=''
372 d__fwalk=''
373 d_access=''
374 d_accessx=''
375 d_aintl=''
376 d_alarm=''
377 asctime_r_proto=''
378 d_asctime_r=''
379 d_attribute_deprecated=''
380 d_attribute_format=''
381 d_attribute_malloc=''
382 d_attribute_nonnull=''
383 d_attribute_noreturn=''
384 d_attribute_pure=''
385 d_attribute_unused=''
386 d_attribute_warn_unused_result=''
387 d_printf_format_null=''
388 d_bcmp=''
389 d_bcopy=''
390 d_builtin_choose_expr=''
391 d_builtin_expect=''
392 d_bzero=''
393 d_c99_variadic_macros=''
394 d_casti32=''
395 castflags=''
396 d_castneg=''
397 d_chown=''
398 d_chroot=''
399 d_chsize=''
400 d_class=''
401 d_clearenv=''
402 d_closedir=''
403 d_void_closedir=''
404 d_cmsghdr_s=''
405 d_const=''
406 d_copysignl=''
407 d_cplusplus=''
408 cryptlib=''
409 d_crypt=''
410 crypt_r_proto=''
411 d_crypt_r=''
412 d_csh=''
413 full_csh=''
414 d_ctermid=''
415 ctermid_r_proto=''
416 d_ctermid_r=''
417 ctime_r_proto=''
418 d_ctime_r=''
419 d_cuserid=''
420 d_dbl_dig=''
421 d_dbminitproto=''
422 d_difftime=''
423 d_dir_dd_fd=''
424 d_dirfd=''
425 d_dlerror=''
426 d_dlopen=''
427 d_dlsymun=''
428 d_dosuid=''
429 d_suidsafe=''
430 d_drand48_r=''
431 drand48_r_proto=''
432 d_drand48proto=''
433 d_dup2=''
434 d_eaccess=''
435 d_endgrent=''
436 d_endgrent_r=''
437 endgrent_r_proto=''
438 d_endhent=''
439 d_endhostent_r=''
440 endhostent_r_proto=''
441 d_endnent=''
442 d_endnetent_r=''
443 endnetent_r_proto=''
444 d_endpent=''
445 d_endprotoent_r=''
446 endprotoent_r_proto=''
447 d_endpwent=''
448 d_endpwent_r=''
449 endpwent_r_proto=''
450 d_endsent=''
451 d_endservent_r=''
452 endservent_r_proto=''
453 d_faststdio=''
454 d_fchdir=''
455 d_fchmod=''
456 d_fchown=''
457 d_fcntl=''
458 d_fcntl_can_lock=''
459 d_fd_macros=''
460 d_fd_set=''
461 d_fds_bits=''
462 d_fgetpos=''
463 d_finite=''
464 d_finitel=''
465 d_flexfnam=''
466 d_flock=''
467 d_flockproto=''
468 d_fork=''
469 d_fp_class=''
470 d_fpclass=''
471 d_fpclassify=''
472 d_fpclassl=''
473 d_fpos64_t=''
474 d_frexpl=''
475 d_fs_data_s=''
476 d_fseeko=''
477 d_fsetpos=''
478 d_fstatfs=''
479 d_fsync=''
480 d_ftello=''
481 d_ftime=''
482 d_gettimeod=''
483 d_futimes=''
484 d_Gconvert=''
485 d_getaddrinfo=''
486 d_getcwd=''
487 d_getespwnam=''
488 d_getfsstat=''
489 d_getgrent=''
490 d_getgrent_r=''
491 getgrent_r_proto=''
492 d_getgrgid_r=''
493 getgrgid_r_proto=''
494 d_getgrnam_r=''
495 getgrnam_r_proto=''
496 d_getgrps=''
497 d_gethbyaddr=''
498 d_gethbyname=''
499 d_gethent=''
500 aphostname=''
501 d_gethname=''
502 d_phostname=''
503 d_uname=''
504 d_gethostbyaddr_r=''
505 gethostbyaddr_r_proto=''
506 d_gethostbyname_r=''
507 gethostbyname_r_proto=''
508 d_gethostent_r=''
509 gethostent_r_proto=''
510 d_gethostprotos=''
511 d_getitimer=''
512 d_getlogin=''
513 d_getlogin_r=''
514 getlogin_r_proto=''
515 d_getmnt=''
516 d_getmntent=''
517 d_getnameinfo=''
518 d_getnbyaddr=''
519 d_getnbyname=''
520 d_getnent=''
521 d_getnetbyaddr_r=''
522 getnetbyaddr_r_proto=''
523 d_getnetbyname_r=''
524 getnetbyname_r_proto=''
525 d_getnetent_r=''
526 getnetent_r_proto=''
527 d_getnetprotos=''
528 d_getpagsz=''
529 d_getpent=''
530 d_getpgid=''
531 d_getpgrp2=''
532 d_bsdgetpgrp=''
533 d_getpgrp=''
534 d_getppid=''
535 d_getprior=''
536 d_getpbyname=''
537 d_getpbynumber=''
538 d_getprotobyname_r=''
539 getprotobyname_r_proto=''
540 d_getprotobynumber_r=''
541 getprotobynumber_r_proto=''
542 d_getprotoent_r=''
543 getprotoent_r_proto=''
544 d_getprotoprotos=''
545 d_getprpwnam=''
546 d_getpwent=''
547 d_getpwent_r=''
548 getpwent_r_proto=''
549 d_getpwnam_r=''
550 getpwnam_r_proto=''
551 d_getpwuid_r=''
552 getpwuid_r_proto=''
553 d_getsent=''
554 d_getservbyname_r=''
555 getservbyname_r_proto=''
556 d_getservbyport_r=''
557 getservbyport_r_proto=''
558 d_getservent_r=''
559 getservent_r_proto=''
560 d_getservprotos=''
561 d_getspnam=''
562 d_getspnam_r=''
563 getspnam_r_proto=''
564 d_getsbyname=''
565 d_getsbyport=''
566 d_gmtime_r=''
567 gmtime_r_proto=''
568 d_gnulibc=''
569 gnulibc_version=''
570 d_hasmntopt=''
571 d_htonl=''
572 d_ilogbl=''
573 d_inetaton=''
574 d_inetntop=''
575 d_inetpton=''
576 d_int64_t=''
577 d_isascii=''
578 d_isblank=''
579 d_isfinite=''
580 d_isinf=''
581 d_isnan=''
582 d_isnanl=''
583 d_killpg=''
584 d_lchown=''
585 d_ldbl_dig=''
586 d_libm_lib_version=''
587 d_link=''
588 d_localtime_r=''
589 d_localtime_r_needs_tzset=''
590 localtime_r_proto=''
591 d_locconv=''
592 d_lockf=''
593 d_longdbl=''
594 longdblsize=''
595 d_longlong=''
596 longlongsize=''
597 d_lseekproto=''
598 d_lstat=''
599 d_madvise=''
600 d_malloc_good_size=''
601 d_malloc_size=''
602 d_mblen=''
603 d_mbstowcs=''
604 d_mbtowc=''
605 d_memchr=''
606 d_memcmp=''
607 d_memcpy=''
608 d_memmove=''
609 d_memset=''
610 d_mkdir=''
611 d_mkdtemp=''
612 d_mkfifo=''
613 d_mkstemp=''
614 d_mkstemps=''
615 d_mktime=''
616 d_mmap=''
617 mmaptype=''
618 d_modfl=''
619 d_modfl_pow32_bug=''
620 d_modflproto=''
621 d_mprotect=''
622 d_msg=''
623 d_msgctl=''
624 d_msgget=''
625 d_msghdr_s=''
626 d_msgrcv=''
627 d_msgsnd=''
628 d_msync=''
629 d_munmap=''
630 d_nice=''
631 d_nl_langinfo=''
632 d_off64_t=''
633 d_open3=''
634 d_fpathconf=''
635 d_pathconf=''
636 d_pause=''
637 d_pipe=''
638 d_poll=''
639 d_portable=''
640 d_prctl=''
641 d_prctl_set_name=''
642 d_procselfexe=''
643 procselfexe=''
644 d_old_pthread_create_joinable=''
645 old_pthread_create_joinable=''
646 d_pthread_atfork=''
647 d_pthread_attr_setscope=''
648 d_pthread_yield=''
649 d_sched_yield=''
650 sched_yield=''
651 d_qgcvt=''
652 d_random_r=''
653 random_r_proto=''
654 d_readdir64_r=''
655 readdir64_r_proto=''
656 d_readdir=''
657 d_rewinddir=''
658 d_seekdir=''
659 d_telldir=''
660 d_readdir_r=''
661 readdir_r_proto=''
662 d_readlink=''
663 d_readv=''
664 d_recvmsg=''
665 d_rename=''
666 d_rmdir=''
667 d_safebcpy=''
668 d_safemcpy=''
669 d_sanemcmp=''
670 d_sbrkproto=''
671 d_scalbnl=''
672 d_select=''
673 d_sem=''
674 d_semctl=''
675 d_semget=''
676 d_semop=''
677 d_sendmsg=''
678 d_setegid=''
679 d_seteuid=''
680 d_setgrent=''
681 d_setgrent_r=''
682 setgrent_r_proto=''
683 d_setgrps=''
684 d_sethent=''
685 d_sethostent_r=''
686 sethostent_r_proto=''
687 d_setitimer=''
688 d_setlinebuf=''
689 d_setlocale=''
690 d_setlocale_r=''
691 setlocale_r_proto=''
692 d_setnent=''
693 d_setnetent_r=''
694 setnetent_r_proto=''
695 d_setpent=''
696 d_setpgid=''
697 d_setpgrp2=''
698 d_bsdsetpgrp=''
699 d_setpgrp=''
700 d_setprior=''
701 d_setproctitle=''
702 d_setprotoent_r=''
703 setprotoent_r_proto=''
704 d_setpwent=''
705 d_setpwent_r=''
706 setpwent_r_proto=''
707 d_setregid=''
708 d_setresgid=''
709 d_setresuid=''
710 d_setreuid=''
711 d_setrgid=''
712 d_setruid=''
713 d_setsent=''
714 d_setservent_r=''
715 setservent_r_proto=''
716 d_setsid=''
717 d_setvbuf=''
718 d_shm=''
719 d_shmat=''
720 d_shmatprototype=''
721 shmattype=''
722 d_shmctl=''
723 d_shmdt=''
724 d_shmget=''
725 d_sigaction=''
726 d_signbit=''
727 d_sigprocmask=''
728 d_sigsetjmp=''
729 usesitecustomize=''
730 d_snprintf=''
731 d_vsnprintf=''
732 d_sockatmark=''
733 d_sockatmarkproto=''
734 d_ip_mreq=''
735 d_ip_mreq_source=''
736 d_ipv6_mreq=''
737 d_ipv6_mreq_source=''
738 d_msg_ctrunc=''
739 d_msg_dontroute=''
740 d_msg_oob=''
741 d_msg_peek=''
742 d_msg_proxy=''
743 d_oldsock=''
744 d_scm_rights=''
745 d_sin6_scope_id=''
746 d_sockaddr_in6=''
747 d_sockaddr_sa_len=''
748 d_socket=''
749 d_sockpair=''
750 sockethdr=''
751 socketlib=''
752 d_socklen_t=''
753 d_socks5_init=''
754 d_sprintf_returns_strlen=''
755 d_sqrtl=''
756 d_srand48_r=''
757 srand48_r_proto=''
758 d_srandom_r=''
759 srandom_r_proto=''
760 d_sresgproto=''
761 d_sresuproto=''
762 d_statblks=''
763 d_statfs_f_flags=''
764 d_statfs_s=''
765 d_static_inline=''
766 perl_static_inline=''
767 d_fstatvfs=''
768 d_statvfs=''
769 d_stdio_cnt_lval=''
770 d_stdio_ptr_lval=''
771 d_stdio_ptr_lval_nochange_cnt=''
772 d_stdio_ptr_lval_sets_cnt=''
773 d_stdiobase=''
774 d_stdstdio=''
775 stdio_base=''
776 stdio_bufsiz=''
777 stdio_cnt=''
778 stdio_filbuf=''
779 stdio_ptr=''
780 d_index=''
781 d_strchr=''
782 d_strcoll=''
783 d_strctcpy=''
784 d_strerrm=''
785 d_strerror=''
786 d_sysernlst=''
787 d_syserrlst=''
788 d_strerror_r=''
789 strerror_r_proto=''
790 d_strftime=''
791 d_strlcat=''
792 d_strlcpy=''
793 d_strtod=''
794 d_strtol=''
795 d_strtold=''
796 d_strtoll=''
797 d_strtoq=''
798 d_strtoul=''
799 d_strtoull=''
800 d_strtouq=''
801 d_strxfrm=''
802 d_symlink=''
803 d_syscall=''
804 d_syscallproto=''
805 d_sysconf=''
806 d_system=''
807 d_tcgetpgrp=''
808 d_tcsetpgrp=''
809 d_telldirproto=''
810 d_time=''
811 timetype=''
812 d_asctime64=''
813 d_ctime64=''
814 d_difftime64=''
815 d_gmtime64=''
816 d_localtime64=''
817 d_mktime64=''
818 d_timegm=''
819 clocktype=''
820 d_times=''
821 d_tmpnam_r=''
822 tmpnam_r_proto=''
823 d_truncate=''
824 d_ttyname_r=''
825 ttyname_r_proto=''
826 d_tzname=''
827 d_u32align=''
828 d_ualarm=''
829 d_umask=''
830 d_semctl_semid_ds=''
831 d_semctl_semun=''
832 d_union_semun=''
833 d_unordered=''
834 d_unsetenv=''
835 d_usleep=''
836 d_usleepproto=''
837 d_ustat=''
838 d_pseudofork=''
839 d_vfork=''
840 usevfork=''
841 d_voidsig=''
842 signal_t=''
843 d_volatile=''
844 d_charvspr=''
845 d_vprintf=''
846 d_wait4=''
847 d_waitpid=''
848 d_wcstombs=''
849 d_wctomb=''
850 d_writev=''
851 dlext=''
852 bin_ELF=''
853 cccdlflags=''
854 ccdlflags=''
855 dlsrc=''
856 ld=''
857 ld_can_script=''
858 lddlflags=''
859 usedl=''
860 doublesize=''
861 bootstrap_charset=''
862 ebcdic=''
863 fflushNULL=''
864 fflushall=''
865 fpossize=''
866 fpostype=''
867 gccansipedantic=''
868 gccosandvers=''
869 gccversion=''
870 gidformat=''
871 gidsign=''
872 gidsize=''
873 gidtype=''
874 groupstype=''
875 h_fcntl=''
876 h_sysfile=''
877 html1dir=''
878 html1direxp=''
879 installhtml1dir=''
880 html3dir=''
881 html3direxp=''
882 installhtml3dir=''
883 i_arpainet=''
884 i_assert=''
885 i_crypt=''
886 db_hashtype=''
887 db_prefixtype=''
888 db_version_major=''
889 db_version_minor=''
890 db_version_patch=''
891 i_db=''
892 i_dbm=''
893 i_rpcsvcdbm=''
894 d_dirnamlen=''
895 direntrytype=''
896 i_dirent=''
897 i_dlfcn=''
898 i_fcntl=''
899 i_float=''
900 i_fp=''
901 i_fp_class=''
902 i_gdbm=''
903 d_grpasswd=''
904 i_grp=''
905 i_ieeefp=''
906 i_inttypes=''
907 i_langinfo=''
908 i_libutil=''
909 i_limits=''
910 i_locale=''
911 i_machcthr=''
912 i_malloc=''
913 i_mallocmalloc=''
914 i_math=''
915 i_memory=''
916 i_mntent=''
917 d_gdbm_ndbm_h_uses_prototypes=''
918 d_gdbmndbm_h_uses_prototypes=''
919 d_ndbm=''
920 d_ndbm_h_uses_prototypes=''
921 i_gdbm_ndbm=''
922 i_gdbmndbm=''
923 i_ndbm=''
924 i_netdb=''
925 i_neterrno=''
926 i_netinettcp=''
927 i_niin=''
928 i_sysin=''
929 i_poll=''
930 i_prot=''
931 i_pthread=''
932 d_pwage=''
933 d_pwchange=''
934 d_pwclass=''
935 d_pwcomment=''
936 d_pwexpire=''
937 d_pwgecos=''
938 d_pwpasswd=''
939 d_pwquota=''
940 i_pwd=''
941 i_shadow=''
942 i_socks=''
943 i_stdbool=''
944 i_stddef=''
945 i_stdlib=''
946 i_string=''
947 strings=''
948 i_sunmath=''
949 i_sysaccess=''
950 i_sysdir=''
951 i_sysfile=''
952 d_voidtty=''
953 i_bsdioctl=''
954 i_sysfilio=''
955 i_sysioctl=''
956 i_syssockio=''
957 i_syslog=''
958 i_sysmman=''
959 i_sysmode=''
960 i_sysmount=''
961 i_sysndir=''
962 i_sysparam=''
963 i_syspoll=''
964 i_sysresrc=''
965 i_syssecrt=''
966 i_sysselct=''
967 i_sysstat=''
968 i_sysstatfs=''
969 i_sysstatvfs=''
970 i_systimes=''
971 i_systypes=''
972 i_sysuio=''
973 i_sysun=''
974 i_sysutsname=''
975 i_sysvfs=''
976 i_syswait=''
977 i_sgtty=''
978 i_termio=''
979 i_termios=''
980 d_tm_tm_gmtoff=''
981 d_tm_tm_zone=''
982 i_systime=''
983 i_systimek=''
984 i_time=''
985 timeincl=''
986 i_unistd=''
987 i_ustat=''
988 i_utime=''
989 i_values=''
990 i_stdarg=''
991 i_varargs=''
992 i_varhdr=''
993 i_vfork=''
994 d_inc_version_list=''
995 inc_version_list=''
996 inc_version_list_init=''
997 installprefix=''
998 installprefixexp=''
999 installstyle=''
1000 installusrbinperl=''
1001 intsize=''
1002 longsize=''
1003 shortsize=''
1004 issymlink=''
1005 libc=''
1006 ldlibpthname=''
1007 libperl=''
1008 shrpenv=''
1009 useshrplib=''
1010 glibpth=''
1011 incpth=''
1012 libpth=''
1013 loclibpth=''
1014 plibpth=''
1015 xlibpth=''
1016 ignore_versioned_solibs=''
1017 libs=''
1018 libsdirs=''
1019 libsfiles=''
1020 libsfound=''
1021 libspath=''
1022 lns=''
1023 d_PRIEUldbl=''
1024 d_PRIFUldbl=''
1025 d_PRIGUldbl=''
1026 d_PRIeldbl=''
1027 d_PRIfldbl=''
1028 d_PRIgldbl=''
1029 d_SCNfldbl=''
1030 sPRIEUldbl=''
1031 sPRIFUldbl=''
1032 sPRIGUldbl=''
1033 sPRIeldbl=''
1034 sPRIfldbl=''
1035 sPRIgldbl=''
1036 sSCNfldbl=''
1037 lseeksize=''
1038 lseektype=''
1039 mad=''
1040 madlyh=''
1041 madlyobj=''
1042 madlysrc=''
1043 make_set_make=''
1044 d_mymalloc=''
1045 freetype=''
1046 mallocobj=''
1047 mallocsrc=''
1048 malloctype=''
1049 usemallocwrap=''
1050 usemymalloc=''
1051 installman1dir=''
1052 man1dir=''
1053 man1direxp=''
1054 man1ext=''
1055 installman3dir=''
1056 man3dir=''
1057 man3direxp=''
1058 man3ext=''
1059 modetype=''
1060 multiarch=''
1061 mydomain=''
1062 myhostname=''
1063 phostname=''
1064 c=''
1065 n=''
1066 d_eofnblk=''
1067 eagain=''
1068 o_nonblock=''
1069 rd_nodata=''
1070 need_va_copy=''
1071 netdb_hlen_type=''
1072 netdb_host_type=''
1073 netdb_name_type=''
1074 netdb_net_type=''
1075 groupcat=''
1076 hostcat=''
1077 passcat=''
1078 orderlib=''
1079 ranlib=''
1080 d_perl_otherlibdirs=''
1081 otherlibdirs=''
1082 package=''
1083 spackage=''
1084 pager=''
1085 api_revision=''
1086 api_subversion=''
1087 api_version=''
1088 api_versionstring=''
1089 patchlevel=''
1090 perl_patchlevel=''
1091 revision=''
1092 subversion=''
1093 version=''
1094 version_patchlevel_string=''
1095 perl5=''
1096 perladmin=''
1097 perlpath=''
1098 d_nv_preserves_uv=''
1099 d_nv_zero_is_allbits_zero=''
1100 i16size=''
1101 i16type=''
1102 i32size=''
1103 i32type=''
1104 i64size=''
1105 i64type=''
1106 i8size=''
1107 i8type=''
1108 ivsize=''
1109 ivtype=''
1110 nv_overflows_integers_at=''
1111 nv_preserves_uv_bits=''
1112 nvsize=''
1113 nvtype=''
1114 u16size=''
1115 u16type=''
1116 u32size=''
1117 u32type=''
1118 u64size=''
1119 u64type=''
1120 u8size=''
1121 u8type=''
1122 uvsize=''
1123 uvtype=''
1124 ivdformat=''
1125 nvEUformat=''
1126 nvFUformat=''
1127 nvGUformat=''
1128 nveformat=''
1129 nvfformat=''
1130 nvgformat=''
1131 uvXUformat=''
1132 uvoformat=''
1133 uvuformat=''
1134 uvxformat=''
1135 pidtype=''
1136 prefix=''
1137 prefixexp=''
1138 installprivlib=''
1139 privlib=''
1140 privlibexp=''
1141 prototype=''
1142 ptrsize=''
1143 d_PRIXU64=''
1144 d_PRId64=''
1145 d_PRIi64=''
1146 d_PRIo64=''
1147 d_PRIu64=''
1148 d_PRIx64=''
1149 sPRIXU64=''
1150 sPRId64=''
1151 sPRIi64=''
1152 sPRIo64=''
1153 sPRIu64=''
1154 sPRIx64=''
1155 d_quad=''
1156 quadkind=''
1157 quadtype=''
1158 uquadtype=''
1159 drand01=''
1160 randbits=''
1161 randfunc=''
1162 randseedtype=''
1163 seedfunc=''
1164 installscript=''
1165 scriptdir=''
1166 scriptdirexp=''
1167 selectminbits=''
1168 selecttype=''
1169 sh=''
1170 targetsh=''
1171 sig_count=''
1172 sig_name=''
1173 sig_name_init=''
1174 sig_num=''
1175 sig_num_init=''
1176 sig_size=''
1177 d_sitearch=''
1178 installsitearch=''
1179 sitearch=''
1180 sitearchexp=''
1181 installsitebin=''
1182 sitebin=''
1183 sitebinexp=''
1184 installsitehtml1dir=''
1185 sitehtml1dir=''
1186 sitehtml1direxp=''
1187 installsitehtml3dir=''
1188 sitehtml3dir=''
1189 sitehtml3direxp=''
1190 installsitelib=''
1191 sitelib=''
1192 sitelib_stem=''
1193 sitelibexp=''
1194 installsiteman1dir=''
1195 siteman1dir=''
1196 siteman1direxp=''
1197 installsiteman3dir=''
1198 siteman3dir=''
1199 siteman3direxp=''
1200 siteprefix=''
1201 siteprefixexp=''
1202 installsitescript=''
1203 sitescript=''
1204 sitescriptexp=''
1205 sizesize=''
1206 sizetype=''
1207 d_libname_unique=''
1208 so=''
1209 socksizetype=''
1210 sharpbang=''
1211 shsharp=''
1212 spitshell=''
1213 src=''
1214 ssizetype=''
1215 st_ino_sign=''
1216 st_ino_size=''
1217 startperl=''
1218 startsh=''
1219 stdchar=''
1220 d_stdio_stream_array=''
1221 stdio_stream_array=''
1222 sysman=''
1223 sGMTIME_max=''
1224 sGMTIME_min=''
1225 sLOCALTIME_max=''
1226 sLOCALTIME_min=''
1227 trnl=''
1228 uidformat=''
1229 uidsign=''
1230 uidsize=''
1231 uidtype=''
1232 archname64=''
1233 use64bitall=''
1234 use64bitint=''
1235 dtrace=''
1236 usedtrace=''
1237 usefaststdio=''
1238 usekernprocpathname=''
1239 ccflags_uselargefiles=''
1240 ldflags_uselargefiles=''
1241 libswanted_uselargefiles=''
1242 uselargefiles=''
1243 uselongdouble=''
1244 usemorebits=''
1245 usemultiplicity=''
1246 nm_opt=''
1247 nm_so_opt=''
1248 runnm=''
1249 usenm=''
1250 usensgetexecutablepath=''
1251 useperlio=''
1252 usesocks=''
1253 d_oldpthreads=''
1254 use5005threads=''
1255 useithreads=''
1256 usereentrant=''
1257 usethreads=''
1258 incpath=''
1259 mips_type=''
1260 usrinc=''
1261 vaproto=''
1262 d_vendorarch=''
1263 installvendorarch=''
1264 vendorarch=''
1265 vendorarchexp=''
1266 d_vendorbin=''
1267 installvendorbin=''
1268 vendorbin=''
1269 vendorbinexp=''
1270 installvendorhtml1dir=''
1271 vendorhtml1dir=''
1272 vendorhtml1direxp=''
1273 installvendorhtml3dir=''
1274 vendorhtml3dir=''
1275 vendorhtml3direxp=''
1276 d_vendorlib=''
1277 installvendorlib=''
1278 vendorlib=''
1279 vendorlib_stem=''
1280 vendorlibexp=''
1281 installvendorman1dir=''
1282 vendorman1dir=''
1283 vendorman1direxp=''
1284 installvendorman3dir=''
1285 vendorman3dir=''
1286 vendorman3direxp=''
1287 usevendorprefix=''
1288 vendorprefix=''
1289 vendorprefixexp=''
1290 d_vendorscript=''
1291 installvendorscript=''
1292 vendorscript=''
1293 vendorscriptexp=''
1294 versiononly=''
1295 yacc=''
1296 yaccflags=''
1297 CONFIG=''
1298
1299 : Detect odd OSs
1300 define='define'
1301 undef='undef'
1302 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1303 rmlist=''
1304
1305 : We must find out about Eunice early
1306 eunicefix=':'
1307 if test -f /etc/unixtovms; then
1308         eunicefix=/etc/unixtovms
1309 fi
1310 if test -f /etc/unixtovms.exe; then
1311         eunicefix=/etc/unixtovms.exe
1312 fi
1313
1314 : Set executable suffix now -- needed before hints available
1315 if test -f "/libs/version.library"; then
1316 : Amiga OS
1317     _exe=""
1318 elif test -f "/system/gnu_library/bin/ar.pm"; then
1319 : Stratus VOS
1320     _exe=".pm"
1321 elif test -n "$DJGPP"; then
1322 : DOS DJGPP
1323     _exe=".exe"
1324 elif test -f /kern/cookiejar; then
1325 : MiNT
1326     _exe=""
1327 elif test -d c:/. -o -n "$is_os2" ; then
1328 : OS/2 or cygwin
1329     _exe=".exe"
1330 fi
1331
1332 groupstype=''
1333 i_whoami=''
1334 : Trailing extension.  Override this in a hint file, if needed.
1335 : Extra object files, if any, needed on this platform.
1336 archobjs=''
1337 archname=''
1338 : Possible local include directories to search.
1339 : Set locincpth to "" in a hint file to defeat local include searches.
1340 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1341 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1342 :
1343 : no include file wanted by default
1344 inclwanted=''
1345
1346 : Enable -DEBUGGING and -DDEBUGGING from the command line
1347 EBUGGING=''
1348 DEBUGGING=''
1349
1350 libnames=''
1351 : change the next line if compiling for Xenix/286 on Xenix/386
1352 xlibpth='/usr/lib/386 /lib/386'
1353 : Possible local library directories to search.
1354 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1355 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1356
1357 : general looking path for locating libraries
1358 glibpth="/lib /usr/lib $xlibpth"
1359 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1360 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1361 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1362 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1363
1364 : Private path used by Configure to find libraries.  Its value
1365 : is prepended to libpth. This variable takes care of special
1366 : machines, like the mips.  Usually, it should be empty.
1367 plibpth=''
1368
1369 : default library list
1370 libswanted=''
1371 : some systems want to use only the non-versioned libso:s
1372 ignore_versioned_solibs=''
1373 : set usethreads on the Configure command line to enable threads.
1374 usereentrant='undef'
1375 ccname=''
1376 ccversion=''
1377 perllibs=''
1378 : set useposix=false in your hint file to disable the POSIX extension.
1379 useposix=true
1380 : set useopcode=false in your hint file to disable the Opcode extension.
1381 useopcode=true
1382 archname64=''
1383 ccflags_uselargefiles=''
1384 ldflags_uselargefiles=''
1385 libswanted_uselargefiles=''
1386 : set usemultiplicity on the Configure command line to enable multiplicity.
1387 : set usesocks on the Configure command line to enable socks.
1388 : List of libraries we want.
1389 : If anyone needs extra -lxxx, put those in a hint file.
1390 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1391 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1392 : We probably want to search /usr/shlib before most other libraries.
1393 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1394 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1395 glibpth="/usr/shlib $glibpth"
1396 : Do not use vfork unless overridden by a hint file.
1397 usevfork=false
1398
1399 : Find the basic shell for Bourne shell scripts
1400 case "$sh" in
1401 '')
1402         case "$SYSTYPE" in
1403         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1404         *) xxx='/bin/sh';;
1405         esac
1406         if test -f "$xxx"; then
1407                 sh="$xxx"
1408         else
1409                 : Build up a list and do a single loop so we can 'break' out.
1410                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1411                 for xxx in sh bash ksh pdksh ash; do
1412                         for p in $pth; do
1413                                 try="$try ${p}/${xxx}"
1414                         done
1415                 done
1416                 for xxx in $try; do
1417                         if test -f "$xxx"; then
1418                                 sh="$xxx";
1419                                 break
1420                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1421                                 sh="$xxx";
1422                                 break
1423                         elif test -f "$xxx.exe"; then
1424                                 sh="$xxx";
1425                                 break
1426                         fi
1427                 done
1428         fi
1429         ;;
1430 esac
1431
1432 case "$sh" in
1433 '')     cat >&2 <<EOM
1434 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1435
1436 Usually it's in /bin/sh.  How did you even get this far?
1437 Please contact me (Perl Maintainers) at perlbug@perl.org and
1438 we'll try to straighten this all out.
1439 EOM
1440         exit 1
1441         ;;
1442 esac
1443
1444 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1445 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1446 targetsh=$sh
1447
1448 : see if sh knows # comments
1449 if `$sh -c '#' >/dev/null 2>&1`; then
1450         shsharp=true
1451         spitshell=cat
1452         xcat=/bin/cat
1453         test -f $xcat$_exe || xcat=/usr/bin/cat
1454         if test ! -f $xcat$_exe; then
1455                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1456                         if test -f $p/cat$_exe; then
1457                                 xcat=$p/cat
1458                                 break
1459                         fi
1460                 done
1461                 if test ! -f $xcat$_exe; then
1462                         echo "Can't find cat anywhere!"
1463                         exit 1
1464                 fi
1465         fi
1466         echo "#!$xcat" >sharp
1467         $eunicefix sharp
1468         chmod +x sharp
1469         ./sharp > today 2>/dev/null
1470         if test -s today; then
1471                 sharpbang='#!'
1472         else
1473                 echo "#! $xcat" > sharp
1474                 $eunicefix sharp
1475                 chmod +x sharp
1476                 ./sharp > today 2>/dev/null
1477                 if test -s today; then
1478                         sharpbang='#! '
1479                 else
1480                         sharpbang=': use '
1481                 fi
1482         fi
1483 else
1484         echo " "
1485         echo "Your $sh doesn't grok # comments--I will strip them later on."
1486         shsharp=false
1487         cd ..
1488         echo "exec grep -v '^[  ]*#'" >spitshell
1489         chmod +x spitshell
1490         $eunicefix spitshell
1491         spitshell=`pwd`/spitshell
1492         cd UU
1493         echo "I presume that if # doesn't work, #! won't work either!"
1494         sharpbang=': use '
1495 fi
1496 rm -f sharp today
1497
1498 : figure out how to guarantee sh startup
1499 case "$startsh" in
1500 '') startsh=${sharpbang}${sh} ;;
1501 *)
1502 esac
1503 cat >sharp <<EOSS
1504 $startsh
1505 set abc
1506 test "$?abc" != 1
1507 EOSS
1508
1509 chmod +x sharp
1510 $eunicefix sharp
1511 if ./sharp; then
1512         : echo "Yup, it does."
1513 else
1514         echo "Hmm... '$startsh' does not guarantee sh startup..."
1515         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1516 fi
1517 rm -f sharp
1518
1519 : Save command line options in file UU/cmdline.opt for later use in
1520 : generating config.sh.
1521 cat > cmdline.opt <<EOSH
1522 : Configure command line arguments.
1523 config_arg0='$0'
1524 config_args='$*'
1525 config_argc=$#
1526 EOSH
1527 argn=1
1528 args_exp=''
1529 args_sep=''
1530 for arg in "$@"; do
1531         cat >>cmdline.opt <<EOSH
1532 config_arg$argn='$arg'
1533 EOSH
1534         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1535 $arg
1536 EOC
1537         arg_exp=`cat cmdl.opt`
1538         args_exp="$args_exp$args_sep'$arg_exp'"
1539         argn=`expr $argn + 1`
1540         args_sep=' '
1541 done
1542 rm -f cmdl.opt
1543
1544 : produce awk script to parse command line options
1545 cat >options.awk <<'EOF'
1546 BEGIN {
1547         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1548
1549         len = length(optstr);
1550         for (i = 1; i <= len; i++) {
1551                 c = substr(optstr, i, 1);
1552                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1553                 if (a == ":") {
1554                         arg[c] = 1;
1555                         i++;
1556                 }
1557                 opt[c] = 1;
1558         }
1559 }
1560 {
1561         expect = 0;
1562         str = $0;
1563         if (substr(str, 1, 1) != "-") {
1564                 printf("'%s'\n", str);
1565                 next;
1566         }
1567         len = length($0);
1568         for (i = 2; i <= len; i++) {
1569                 c = substr(str, i, 1);
1570                 if (!opt[c]) {
1571                         printf("-%s\n", substr(str, i));
1572                         next;
1573                 }
1574                 printf("-%s\n", c);
1575                 if (arg[c]) {
1576                         if (i < len)
1577                                 printf("'%s'\n", substr(str, i + 1));
1578                         else
1579                                 expect = 1;
1580                         next;
1581                 }
1582         }
1583 }
1584 END {
1585         if (expect)
1586                 print "?";
1587 }
1588 EOF
1589
1590 : process the command line options
1591 set X `for arg in "$@"; do echo "X$arg"; done |
1592         sed -e s/X// | awk -f options.awk`
1593 eval "set $*"
1594 shift
1595 rm -f options.awk
1596
1597 : set up default values
1598 fastread=''
1599 reuseval=false
1600 config_sh=''
1601 alldone=''
1602 error=''
1603 silent=''
1604 extractsh=''
1605 override=''
1606 knowitall=''
1607 rm -f optdef.sh posthint.sh
1608 cat >optdef.sh <<EOS
1609 $startsh
1610 EOS
1611
1612
1613 : option parsing
1614 while test $# -gt 0; do
1615         case "$1" in
1616         -d) shift; fastread=yes;;
1617         -e) shift; alldone=cont;;
1618         -f)
1619                 shift
1620                 cd ..
1621                 if test -r "$1"; then
1622                         config_sh="$1"
1623                 else
1624                         echo "$me: cannot read config file $1." >&2
1625                         error=true
1626                 fi
1627                 cd UU
1628                 shift;;
1629         --help|\
1630         -h) shift; error=true;;
1631         -r) shift; reuseval=true;;
1632         -s) shift; silent=true; realsilent=true;;
1633         -E) shift; alldone=exit;;
1634         -K) shift; knowitall=true;;
1635         -O) shift; override=true;;
1636         -S) shift; silent=true; extractsh=true;;
1637         -D)
1638                 shift
1639                 case "$1" in
1640                 *=)
1641                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1642                         echo "$me: ignoring -D $1" >&2
1643                         ;;
1644                 *=*) echo "$1" | \
1645                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1646                 *) echo "$1='define'" >> optdef.sh;;
1647                 esac
1648                 shift
1649                 ;;
1650         -U)
1651                 shift
1652                 case "$1" in
1653                 *=) echo "$1" >> optdef.sh;;
1654                 *=*)
1655                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1656                         echo "$me: ignoring -U $1" >&2
1657                         ;;
1658                 *) echo "$1='undef'" >> optdef.sh;;
1659                 esac
1660                 shift
1661                 ;;
1662         -A)
1663             shift
1664             xxx=''
1665             yyy="$1"
1666             zzz=''
1667             uuu=undef
1668             case "$yyy" in
1669             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1670                  case "$zzz" in
1671                  *:*) zzz='' ;;
1672                  *)   xxx=append
1673                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1674                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1675                  esac
1676                  ;;
1677             esac
1678             case "$xxx" in
1679             '')  case "$yyy" in
1680                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1681                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1682                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1683                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1684                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1685                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1686                  esac
1687                  ;;
1688             esac
1689             case "$xxx" in
1690             append)
1691                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1692             clear)
1693                 echo "$yyy=''"                  >> posthint.sh ;;
1694             define)
1695                 case "$zzz" in
1696                 '') zzz=define ;;
1697                 esac
1698                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1699             eval)
1700                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1701             prepend)
1702                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1703             undef)
1704                 case "$zzz" in
1705                 '') zzz="$uuu" ;;
1706                 esac
1707                 echo "$yyy=$zzz"                >> posthint.sh ;;
1708             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1709             esac
1710             shift
1711             ;;
1712         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1713             exit 0;;
1714         --) break;;
1715         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1716         *) break;;
1717         esac
1718 done
1719
1720 case "$error" in
1721 true)
1722         cat >&2 <<EOM
1723 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1724                  [-U symbol] [-U symbol=] [-A command:symbol...]
1725   -d : use defaults for all answers.
1726   -e : go on without questioning past the production of config.sh.
1727   -f : specify an alternate default configuration file.
1728   -h : print this help message and exit (with an error status).
1729   -r : reuse C symbols value if possible (skips costly nm extraction).
1730   -s : silent mode, only echoes questions and essential information.
1731   -D : define symbol to have some value:
1732          -D symbol         symbol gets the value 'define'
1733          -D symbol=value   symbol gets the value 'value'
1734        common used examples (see INSTALL for more info):
1735          -Duse64bitint            use 64bit integers
1736          -Duse64bitall            use 64bit integers and pointers
1737          -Dusethreads             use thread support
1738          -Dinc_version_list=none  do not include older perl trees in @INC
1739          -DEBUGGING=none          DEBUGGING options
1740          -Dcc=gcc                 choose your compiler
1741          -Dprefix=/opt/perl5      choose your destination
1742   -E : stop at the end of questions, after having produced config.sh.
1743   -K : do not use unless you know what you are doing.
1744   -O : let -D and -U override definitions from loaded configuration file.
1745   -S : perform variable substitutions on all .SH files (can mix with -f)
1746   -U : undefine symbol:
1747          -U symbol    symbol gets the value 'undef'
1748          -U symbol=   symbol gets completely empty
1749        e.g.:  -Uversiononly
1750   -A : manipulate symbol after the platform specific hints have been applied:
1751          -A append:symbol=value   append value to symbol
1752          -A symbol=value          like append:, but with a separating space
1753          -A define:symbol=value   define symbol to have value
1754          -A clear:symbol          define symbol to be ''
1755          -A define:symbol         define symbol to be 'define'
1756          -A eval:symbol=value     define symbol to be eval of value
1757          -A prepend:symbol=value  prepend value to symbol
1758          -A undef:symbol          define symbol to be 'undef'
1759          -A undef:symbol=         define symbol to be ''
1760        e.g.:  -A prepend:libswanted='cl pthread '
1761               -A ccflags=-DSOME_MACRO
1762   -V : print version number and exit (with a zero status).
1763 EOM
1764         exit 1
1765         ;;
1766 esac
1767
1768 : Sanity checks
1769 case "$fastread$alldone" in
1770 yescont|yesexit) ;;
1771 *)
1772         case "$extractsh" in
1773         true) ;;
1774         *)
1775                 if test ! -t 0; then
1776                         echo "Say 'sh Configure', not 'sh <Configure'"
1777                         exit 1
1778                 fi
1779                 ;;
1780         esac
1781         ;;
1782 esac
1783
1784 exec 4>&1
1785 case "$silent" in
1786 true) exec 1>/dev/null;;
1787 esac
1788
1789 : run the defines and the undefines, if any, but leave the file out there...
1790 touch optdef.sh
1791 . ./optdef.sh
1792 : create the posthint manipulation script and leave the file out there...
1793 touch posthint.sh
1794
1795 : set package name
1796 package='perl5'
1797 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1798 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1799 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1800 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1801 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1802 esac
1803
1804 : Some greps do not return status, grrr.
1805 echo "grimblepritz" >grimble
1806 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1807         contains=contains
1808 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1809         contains=grep
1810 else
1811         contains=contains
1812 fi
1813 rm -f grimble
1814 : the following should work in any shell
1815 case "$contains" in
1816 contains*)
1817         echo " "
1818         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1819         cat >contains <<'EOSS'
1820 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1821 EOSS
1822 chmod +x contains
1823 esac
1824
1825 : Find the path to the source tree
1826 case "$src" in
1827 '') case "$0" in
1828     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1829          case "$src" in
1830          /*)    ;;
1831          .)     ;;
1832          *)     src=`cd ../$src && pwd` ;;
1833          esac
1834          ;;
1835     *)   src='.';;
1836     esac;;
1837 esac
1838 case "$src" in
1839 '')     src=/
1840         rsrc=/
1841         ;;
1842 /*)     rsrc="$src";;
1843 *)      rsrc="../$src";;
1844 esac
1845 if test -f $rsrc/Configure && \
1846         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1847 then
1848    : found it, so we are ok.
1849 else
1850         rsrc=''
1851         for src in . .. ../.. ../../.. ../../../..; do
1852                 if test -f ../$src/Configure && \
1853                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1854                 then
1855                         rsrc=../$src
1856                         break
1857                 fi
1858         done
1859 fi
1860 case "$rsrc" in
1861 '')
1862         cat <<EOM >&4
1863
1864 Sorry, I can't seem to locate the source dir for $package.  Please start
1865 Configure with an explicit path -- i.e. /some/path/Configure.
1866
1867 EOM
1868         exit 1
1869         ;;
1870 ../.)   rsrc='..';;
1871 *)
1872         echo " "
1873         echo "Sources for $package found in \"$src\"." >&4
1874         ;;
1875 esac
1876
1877 : script used to extract .SH files with variable substitutions
1878 cat >extract <<'EOS'
1879 PERL_CONFIG_SH=true
1880 echo "Doing variable substitutions on .SH files..."
1881 if test -f MANIFEST; then
1882         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1883 else
1884         echo "(Looking for .SH files under the source directory.)"
1885         set x `(cd "$src"; find . -name "*.SH" -print)`
1886 fi
1887 shift
1888 case $# in
1889 0) set x `(cd "$src"; echo *.SH)`; shift;;
1890 esac
1891 if test ! -f "$src/$1"; then
1892         shift
1893 fi
1894 mkdir_p='
1895 name=$1;
1896 create="";
1897 while test $name; do
1898         if test ! -d "$name"; then
1899                 create="$name $create";
1900                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1901                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1902         else
1903                 name="";
1904         fi;
1905 done;
1906 for file in $create; do
1907         mkdir $file;
1908 done
1909 '
1910 for file in $*; do
1911         case "$src" in
1912         ".")
1913                 case "$file" in
1914                 */*)
1915                         dir=`expr X$file : 'X\(.*\)/'`
1916                         file=`expr X$file : 'X.*/\(.*\)'`
1917                         (cd "$dir" && . ./$file)
1918                         ;;
1919                 *)
1920                         . ./$file
1921                         ;;
1922                 esac
1923                 ;;
1924         *)
1925                 case "$file" in
1926                 */*)
1927                         dir=`expr X$file : 'X\(.*\)/'`
1928                         file=`expr X$file : 'X.*/\(.*\)'`
1929                         (set x $dir; shift; eval $mkdir_p)
1930                         sh <"$src/$dir/$file"
1931                         ;;
1932                 *)
1933                         sh <"$src/$file"
1934                         ;;
1935                 esac
1936                 ;;
1937         esac
1938 done
1939 if test -f "$src/config_h.SH"; then
1940         if test ! -f config.h; then
1941         : oops, they left it out of MANIFEST, probably, so do it anyway.
1942         . "$src/config_h.SH"
1943         fi
1944 fi
1945 EOS
1946
1947 : extract files and exit if asked to do so
1948 case "$extractsh" in
1949 true)
1950         case "$realsilent" in
1951         true) ;;
1952         *) exec 1>&4;;
1953         esac
1954         case "$config_sh" in
1955         '') config_sh='config.sh';;
1956         esac
1957         echo " "
1958         echo "Fetching answers from $config_sh..."
1959         cd ..
1960         . $config_sh
1961         test "$override" && . ./optdef.sh
1962         echo " "
1963         . UU/extract
1964         rm -rf UU
1965         echo "Extraction done."
1966         exit 0
1967         ;;
1968 esac
1969
1970 : Eunice requires " " instead of "", can you believe it
1971 echo " "
1972 : Here we go...
1973 echo "Beginning of configuration questions for $package."
1974
1975 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1976
1977 : first determine how to suppress newline on echo command
1978 echo " "
1979 echo "Checking echo to see how to suppress newlines..."
1980 (echo "hi there\c" ; echo " ") >.echotmp
1981 if $contains c .echotmp >/dev/null 2>&1 ; then
1982         echo "...using -n."
1983         n='-n'
1984         c=''
1985 else
1986         cat <<'EOM'
1987 ...using \c
1988 EOM
1989         n=''
1990         c='\c'
1991 fi
1992 echo $n "The star should be here-->$c"
1993 echo '*'
1994 rm -f .echotmp
1995
1996 : Now test for existence of everything in MANIFEST
1997 echo " "
1998 if test -f "$rsrc/MANIFEST"; then
1999         echo "First let's make sure your kit is complete.  Checking..." >&4
2000         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2001                 (split -l 50 2>/dev/null || split -50)
2002         rm -f missing
2003         tmppwd=`pwd`
2004         for filelist in x??; do
2005                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2006                         >/dev/null 2>>"$tmppwd/missing")
2007         done
2008         if test -s missing; then
2009                 cat missing >&4
2010                 cat >&4 <<'EOM'
2011
2012 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2013
2014 You have the option of continuing the configuration process, despite the
2015 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2016 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2017 and contact the author (perlbug@perl.org).
2018
2019 EOM
2020                 echo $n "Continue? [n] $c" >&4
2021                 read ans
2022                 case "$ans" in
2023                 y*)
2024                         echo "Continuing..." >&4
2025                         rm -f missing
2026                         ;;
2027                 *)
2028                         echo "ABORTING..." >&4
2029                         kill $$
2030                         ;;
2031                 esac
2032         else
2033                 echo "Looks good..."
2034         fi
2035 else
2036         echo "There is no MANIFEST file.  I hope your kit is complete !"
2037 fi
2038 rm -f missing x??
2039
2040 : Find the appropriate value for a newline for tr
2041 echo " "
2042 if test -n "$DJGPP"; then
2043        trnl='\012'
2044 fi
2045 if test X"$trnl" = X; then
2046         case "`echo foo|tr '\n' x 2>/dev/null`" in
2047         foox) trnl='\n' ;;
2048         esac
2049 fi
2050 if test X"$trnl" = X; then
2051         case "`echo foo|tr '\012' x 2>/dev/null`" in
2052         foox) trnl='\012' ;;
2053         esac
2054 fi
2055 if test X"$trnl" = X; then
2056        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2057        fooxy) trnl='\n\r' ;;
2058        esac
2059 fi
2060 if test X"$trnl" = X; then
2061         cat <<EOM >&2
2062
2063 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2064
2065 EOM
2066         exit 1
2067 fi
2068
2069 : compute the number of columns on the terminal for proper question formatting
2070 case "$COLUMNS" in
2071 '') COLUMNS='80';;
2072 esac
2073
2074 : set up the echo used in my read
2075 myecho="case \"\$xxxm\" in
2076 '') echo $n \"\$rp $c\" >&4;;
2077 *) case \"\$rp\" in
2078         '') echo $n \"[\$xxxm] $c\";;
2079         *)
2080                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2081                         echo \"\$rp\" >&4
2082                         echo $n \"[\$xxxm] $c\" >&4
2083                 else
2084                         echo $n \"\$rp [\$xxxm] $c\" >&4
2085                 fi
2086                 ;;
2087         esac;;
2088 esac"
2089
2090 : now set up to do reads with possible shell escape and default assignment
2091 cat <<EOSC >myread
2092 $startsh
2093 xxxm=\$dflt
2094 $myecho
2095 ans='!'
2096 case "\$fastread" in
2097 yes) case "\$dflt" in
2098         '') ;;
2099         *) ans='';
2100                 case "\$silent-\$rp" in
2101                 true-) ;;
2102                 *) echo " " >&4;;
2103                 esac;;
2104         esac;;
2105 *) case "\$silent" in
2106         true) case "\$rp" in
2107                 '') ans='';;
2108                 esac;;
2109         esac;;
2110 esac
2111 while expr "X\$ans" : "X!" >/dev/null; do
2112         read answ
2113         set x \$xxxm
2114         shift
2115         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2116         case  "\$answ" in
2117         "!")
2118                 sh 1>&4
2119                 echo " "
2120                 $myecho
2121                 ;;
2122         !*)
2123                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2124                 shift
2125                 sh 1>&4 -c "\$*"
2126                 echo " "
2127                 $myecho
2128                 ;;
2129         "\$ans")
2130                 case "\$ans" in
2131                 \\&*)
2132                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2133                         shift
2134                         case "\$1" in
2135                         -d)
2136                                 fastread=yes
2137                                 echo "(OK, I'll run with -d after this question.)" >&4
2138                                 ;;
2139                         -*)
2140                                 echo "*** Sorry, \$1 not supported yet." >&4
2141                                 ;;
2142                         esac
2143                         $myecho
2144                         ans=!
2145                         ;;
2146                 esac;;
2147         *)
2148                 case "\$aok" in
2149                 y)
2150                         echo "*** Substitution done -- please confirm."
2151                         xxxm="\$ans"
2152                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2153                         xxxm="\$ans"
2154                         ans=!
2155                         ;;
2156                 *)
2157                         echo "*** Error -- try again."
2158                         ans=!
2159                         ;;
2160                 esac
2161                 $myecho
2162                 ;;
2163         esac
2164         case "\$ans\$xxxm\$nostick" in
2165         '')
2166                 ans=!
2167                 $myecho
2168                 ;;
2169         esac
2170 done
2171 case "\$ans" in
2172 '') ans="\$xxxm";;
2173 esac
2174 EOSC
2175
2176 : create .config dir to save info across Configure sessions
2177 test -d ../.config || mkdir ../.config
2178 cat >../.config/README <<EOF
2179 This directory created by Configure to save information that should
2180 persist across sessions for $package.
2181
2182 You may safely delete it if you wish.
2183 EOF
2184
2185 : See if we are using a devel version and want that
2186 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2187 case "$usedevel" in
2188 $define|true|[yY]*)
2189     usedevel="$define" ;;
2190 *) case "$xversion" in
2191    *[13579])
2192         cat >&4 <<EOH
2193 *** WHOA THERE!!! ***
2194
2195     This is an UNSTABLE DEVELOPMENT release.
2196     The version of this $package distribution is $xversion, that is, odd,
2197     (as opposed to even) and that signifies a development release.
2198     If you want a maintenance release, you want an even-numbered version.
2199
2200     Do ***NOT*** install this into production use.
2201     Data corruption and crashes are possible.
2202
2203     It is most seriously suggested that you do not continue any further
2204     unless you want to help in developing and debugging Perl.
2205
2206     If you *still* want to build perl, you can answer 'y' now,
2207     or pass -Dusedevel to Configure.
2208
2209 EOH
2210         rp='Do you really want to continue?'
2211         dflt='n'
2212         . ./myread
2213         case "$ans" in
2214         [yY]) echo >&4 "Okay, continuing."
2215               usedevel="$define" ;;
2216         *) echo >&4 "Okay, bye."
2217            exit 1
2218            ;;
2219         esac
2220         ;;
2221     esac
2222     usedevel="$undef"
2223     ;;
2224 esac
2225 case "$usedevel" in
2226 $define|true|[yY]*)
2227         case "$versiononly" in
2228         '') versiononly="$define" ;;
2229         esac
2230         case "$installusrbinperl" in
2231         '') installusrbinperl="$undef" ;;
2232         esac
2233         ;;
2234 esac
2235
2236 : general instructions
2237 needman=true
2238 firsttime=true
2239 user=`(logname) 2>/dev/null`
2240 case "$user" in
2241 '') user=`whoami 2>&1`;;
2242 esac
2243 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2244         firsttime=false
2245         echo " "
2246         rp='Would you like to see the instructions?'
2247         dflt=n
2248         . ./myread
2249         case "$ans" in
2250         [yY]*) ;;
2251         *) needman=false;;
2252         esac
2253 fi
2254 if $needman; then
2255         cat <<EOH
2256
2257 This installation shell script will examine your system and ask you questions
2258 to determine how the perl5 package should be installed. If you get
2259 stuck on a question, you may use a ! shell escape to start a subshell or
2260 execute a command.  Many of the questions will have default answers in square
2261 brackets; typing carriage return will give you the default.
2262
2263 On some of the questions which ask for file or directory names you are allowed
2264 to use the ~name construct to specify the login directory belonging to "name",
2265 even if you don't have a shell which knows about that.  Questions where this is
2266 allowed will be marked "(~name ok)".
2267
2268 EOH
2269         rp=''
2270         dflt='Type carriage return to continue'
2271         . ./myread
2272         cat <<'EOH'
2273
2274 The prompter used in this script allows you to use shell variables and
2275 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2276 in the default answer, as if the default line was a set of arguments given to a
2277 script shell.  This means you may also use $* to repeat the whole default line,
2278 so you do not have to re-type everything to add something to the default.
2279
2280 Every time there is a substitution, you will have to confirm.  If there is an
2281 error (e.g. an unmatched backtick), the default answer will remain unchanged
2282 and you will be prompted again.
2283
2284 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2285 the questions and use the computed defaults (or the previous answers if there
2286 was already a config.sh file). Type 'Configure -h' for a list of options.
2287 You may also start interactively and then answer '& -d' at any prompt to turn
2288 on the non-interactive behaviour for the remainder of the execution.
2289
2290 EOH
2291         . ./myread
2292         cat <<EOH
2293
2294 Much effort has been expended to ensure that this shell script will run on any
2295 Unix system.  If despite that it blows up on yours, your best bet is to edit
2296 Configure and run it again.  If you can't run Configure for some reason,
2297 you'll have to generate a config.sh file by hand.  Whatever problems you
2298 have, let me (perlbug@perl.org) know how I blew it.
2299
2300 This installation script affects things in two ways:
2301
2302 1) it may do direct variable substitutions on some of the files included
2303    in this kit.
2304 2) it builds a config.h file for inclusion in C programs.  You may edit
2305    any of these files as the need arises after running this script.
2306
2307 If you make a mistake on a question, there is no easy way to back up to it
2308 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2309 files.  Configure will offer to let you do this before it runs the SH files.
2310
2311 EOH
2312         dflt='Type carriage return to continue'
2313         . ./myread
2314         case "$firsttime" in
2315         true) echo $user >>../.config/instruct;;
2316         esac
2317 fi
2318
2319 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2320 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2321 if test "X$sysroot" = X; then
2322     sysroot=""
2323 else
2324     case "$cc" in
2325         *gcc*|*g++*)
2326             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2327             # _sysroot is used in places where we need --sysroot=foo
2328             # but using the rest of the flags could cause issues.
2329             _sysroot="--sysroot=$sysroot";
2330             case "$ccflags" in
2331                 *sysroot*) ;;
2332                 'undef'|*)
2333                 ccflags="$ccflags $_sysroot"
2334             esac
2335             case "$ldflags" in
2336                 *sysroot*) ;;
2337                 'undef'|*)
2338                 ldflags="$ldflags $_sysroot"
2339             esac
2340             case "$cppflags" in
2341                 *sysroot*) ;;
2342                 'undef'|*)
2343                 cppflags="$cppflags $_sysroot"
2344             esac
2345             # lddlflags updated below in lddlflags section;
2346             # same with cccdlflags
2347             ;;
2348     esac
2349
2350     # Adjust some defaults to also use $sysroot
2351     for var in xlibpth loclibpth locincpth glibpth; do
2352         eval xxx=\$$var
2353         eval $var=''
2354         for path in $xxx; do
2355             eval $var=\"\$$var $sysroot$path\"
2356         done
2357     done
2358
2359 fi
2360
2361 : find out where common programs are
2362 echo " "
2363 echo "Locating common programs..." >&4
2364 cat <<EOSC >loc
2365 $startsh
2366 case \$# in
2367 0) exit 1;;
2368 esac
2369 thing=\$1
2370 shift
2371 dflt=\$1
2372 shift
2373 for dir in \$*; do
2374         case "\$thing" in
2375         .)
2376         if test -d \$dir/\$thing; then
2377                 echo \$dir
2378                 exit 0
2379         fi
2380         ;;
2381         *)
2382         for thisthing in \$dir/\$thing; do
2383                 : just loop through to pick last item
2384         done
2385         if test -f \$thisthing; then
2386                 echo \$thisthing
2387                 exit 0
2388         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2389                 echo \$thisthing
2390                 exit 0
2391         elif test -f \$dir/\$thing.exe; then
2392                 if test -n "$DJGPP"; then
2393                         echo \$dir/\$thing.exe
2394                 elif test "$eunicefix" != ":"; then
2395                         : on Eunice apparently
2396                         echo \$dir/\$thing
2397                 fi
2398                 exit 0
2399         fi
2400         ;;
2401         esac
2402 done
2403 echo \$dflt
2404 exit 1
2405 EOSC
2406 chmod +x loc
2407 $eunicefix loc
2408 loclist="
2409 awk
2410 cat
2411 chmod
2412 comm
2413 cp
2414 echo
2415 expr
2416 grep
2417 ls
2418 mkdir
2419 rm
2420 sed
2421 sort
2422 touch
2423 tr
2424 uniq
2425 "
2426 trylist="
2427 ar
2428 bison
2429 byacc
2430 cpp
2431 csh
2432 date
2433 egrep
2434 gmake
2435 gzip
2436 less
2437 ln
2438 make
2439 more
2440 nm
2441 nroff
2442 perl
2443 pg
2444 test
2445 uname
2446 zip
2447 "
2448 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2449 pth="$pth $sysroot/lib $sysroot/usr/lib"
2450 for file in $loclist; do
2451         eval xxx=\$$file
2452         case "$xxx" in
2453         /*|?:[\\/]*)
2454                 if test -f "$xxx"; then
2455                         : ok
2456                 else
2457                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2458                         xxx=`./loc $file $file $pth`
2459                 fi
2460                 ;;
2461         '') xxx=`./loc $file $file $pth`;;
2462         *) xxx=`./loc $xxx $xxx $pth`;;
2463         esac
2464         eval $file=$xxx$_exe
2465         eval _$file=$xxx
2466         case "$xxx" in
2467         /*)
2468                 echo $file is in $xxx.
2469                 ;;
2470         ?:[\\/]*)
2471                 echo $file is in $xxx.
2472                 ;;
2473         *)
2474                 echo "I don't know where '$file' is, and my life depends on it." >&4
2475                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2476                 exit 1
2477                 ;;
2478         esac
2479 done
2480 echo " "
2481 echo "Don't worry if any of the following aren't found..."
2482 say=offhand
2483 for file in $trylist; do
2484         eval xxx=\$$file
2485         case "$xxx" in
2486         /*|?:[\\/]*)
2487                 if test -f "$xxx"; then
2488                         : ok
2489                 else
2490                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2491                         xxx=`./loc $file $file $pth`
2492                 fi
2493                 ;;
2494         '') xxx=`./loc $file $file $pth`;;
2495         *) xxx=`./loc $xxx $xxx $pth`;;
2496         esac
2497         eval $file=$xxx$_exe
2498         eval _$file=$xxx
2499         case "$xxx" in
2500         /*)
2501                 echo $file is in $xxx.
2502                 ;;
2503         ?:[\\/]*)
2504                 echo $file is in $xxx.
2505                 ;;
2506         *)
2507                 echo "I don't see $file out there, $say."
2508                 say=either
2509                 ;;
2510         esac
2511 done
2512 case "$egrep" in
2513 egrep)
2514         echo "Substituting grep for egrep."
2515         egrep=$grep
2516         _egrep=$grep
2517         ;;
2518 esac
2519 case "$less" in
2520 '')     ;;
2521 *)      if $less -R </dev/null >/dev/null; then
2522                echo "Substituting less -R for less."
2523                less="$less -R"
2524                _less=$less
2525         fi
2526         ;;
2527 esac
2528 case "$ln" in
2529 ln)
2530         echo "Substituting cp for ln."
2531         ln=$cp
2532         _ln=$cp
2533         ;;
2534 esac
2535 case "$make" in
2536 make)
2537         case "$gmake" in
2538         gmake)
2539         echo "I can't find make or gmake, and my life depends on it." >&4
2540         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2541         exit 1
2542         ;;
2543         esac
2544         ;;
2545 esac
2546 case "$gmake" in
2547 gmake)  ;;
2548 *)      # We can't have osname yet.
2549         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2550                 # Assume that gmake, if found, is definitely GNU make
2551                 # and prefer it over the system make.
2552                 echo "Substituting gmake for make."
2553                 make=$gmake
2554                 _make=$gmake
2555         fi
2556         ;;
2557 esac
2558 case "$test" in
2559 test)
2560         echo "Hopefully test is built into your sh."
2561         ;;
2562 *)
2563         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2564                 echo "Using the test built into your sh."
2565                 test=test
2566                 _test=test
2567         fi
2568         ;;
2569 esac
2570 case "$echo" in
2571 echo)
2572         echo "Hopefully echo is built into your sh."
2573         ;;
2574 '') ;;
2575 *)
2576         echo " "
2577 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2578         $echo $n "hi there$c" >foo1
2579         echo $n "hi there$c" >foo2
2580         if cmp foo1 foo2 >/dev/null 2>&1; then
2581                 echo "They are compatible.  In fact, they may be identical."
2582         else
2583                 case "$n" in
2584                 '-n') n='' c='\c';;
2585                 *) n='-n' c='';;
2586                 esac
2587                 cat <<FOO
2588 They are not compatible!  You are probably running ksh on a non-USG system.
2589 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2590 have echo built in and we may have to run some Bourne shell scripts.  That
2591 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2592
2593 FOO
2594                 $echo $n "The star should be here-->$c"
2595                 $echo "*"
2596         fi
2597         $rm -f foo1 foo2
2598         ;;
2599 esac
2600
2601 # This question was auctioned at YAPC::Europe-2007 in Vienna
2602 # I never promised you could answer it. I only auctioned the question.
2603 cat <<FOO
2604 The following message is sponsored by
2605
2606   Dresden.pm<--The stars should be here.
2607
2608 Dear Perl user, system administrator or package
2609 maintainer, the Perl community sends greetings to
2610 you. Do you (emblematical) greet back [Y/n]? n
2611
2612 FOO
2613
2614 : Check what type of C compiler we use
2615 cat <<EOS >trygcc
2616 $startsh
2617 EOS
2618 cat <<'EOSC' >>trygcc
2619 case "$cc" in
2620 '') ;;
2621 *)  $rm -f try try.*
2622     $cat >try.c <<EOM
2623 int main(int argc, char *argv[]) {
2624   return 0;
2625 }
2626 EOM
2627     if $cc -o try $ccflags $ldflags try.c; then
2628        :
2629     else
2630         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2631         despair=yes
2632         trygcc=yes
2633         case "$cc" in
2634         *gcc*) trygcc=no ;;
2635         esac
2636         # Skip this test because it gives a false match on output like:
2637         #    ./trygcc: line 23: cc: command not found
2638         # case "`$cc -v -c try.c 2>&1`" in
2639         # *gcc*) trygcc=no ;;
2640         # esac
2641         if $test X"$trygcc" = Xyes; then
2642             if gcc -o try -c try.c; then
2643                 echo " "
2644                 echo "You seem to have a working gcc, though." >&4
2645                 # Switching compilers may undo the work of hints files.
2646                 # The most common problem is -D_REENTRANT for threads.
2647                 # This heuristic catches that case, but gets false positives
2648                 # if -Dusethreads was not actually specified.  Better to
2649                 # bail out here with a useful message than fail 
2650                 # mysteriously later. Should we perhaps just try to
2651                 # re-invoke Configure -Dcc=gcc config_args ?
2652                 if $test -f usethreads.cbu; then
2653                         $cat >&4 <<EOM 
2654
2655 *** However, any setting of the C compiler flags (e.g. for thread support)
2656 *** will be lost.  It may be necessary for you to restart Configure and
2657 *** add -Dcc=gcc to your Configure command line.
2658
2659 EOM
2660                         rp="Would you like to go ahead and try gcc anyway?"
2661                         dflt=n
2662                 else
2663                         rp="Would you like to use it?"
2664                         dflt=y
2665                 fi
2666                 if $test -f myread; then
2667                     . ./myread
2668                 else
2669                     if $test -f UU/myread; then
2670                         . ./UU/myread
2671                     else
2672                         echo "Cannot find myread, sorry.  Aborting." >&2
2673                         exit 1
2674                     fi
2675                 fi  
2676                 case "$ans" in
2677                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2678                 esac
2679             fi
2680         fi
2681     fi
2682     $rm -f try try.*
2683     ;;
2684 esac
2685 EOSC
2686
2687 cat <<EOS >checkcc
2688 $startsh
2689 EOS
2690 cat <<'EOSC' >>checkcc
2691 case "$cc" in        
2692 '') ;;
2693 *)  $rm -f try try.*              
2694     $cat >try.c <<EOM
2695 int main(int argc, char *argv[]) {
2696   return 0;
2697 }
2698 EOM
2699     if $cc -o try $ccflags $ldflags try.c; then
2700        :
2701     else
2702         if $test X"$despair" = Xyes; then
2703            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2704         fi
2705         $cat >&4 <<EOM         
2706 You need to find a working C compiler.
2707 Either (purchase and) install the C compiler supplied by your OS vendor,
2708 or for a free C compiler try http://gcc.gnu.org/
2709 I cannot continue any further, aborting.
2710 EOM
2711         exit 1
2712     fi
2713     $rm -f try try.*
2714     ;;
2715 esac
2716 EOSC
2717
2718 : determine whether symbolic links are supported
2719 echo " "
2720 $touch blurfl
2721 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2722         echo "Symbolic links are supported." >&4
2723         lns="$ln -s"
2724 else
2725         echo "Symbolic links are NOT supported." >&4
2726         lns="$ln"
2727 fi
2728 $rm -f blurfl sym
2729
2730 : determine whether symbolic links are supported
2731 echo " "
2732 case "$lns" in
2733 *"ln"*" -s")
2734         echo "Checking how to test for symbolic links..." >&4
2735         $lns blurfl sym
2736         if $test "X$issymlink" = X; then
2737                 case "$newsh" in
2738                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2739                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2740                 esac
2741                 if test $? = 0; then
2742                         issymlink="test -h"
2743                 else
2744                         echo "Your builtin 'test -h' may be broken." >&4
2745                         case "$test" in
2746                         /*)     ;;
2747                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2748                                 for p in $pth
2749                                 do
2750                                         if test -f "$p/$test"; then
2751                                                 test="$p/$test"
2752                                                 break
2753                                         fi
2754                                 done
2755                                 ;;
2756                         esac
2757                         case "$test" in
2758                         /*)
2759                                 echo "Trying external '$test -h'." >&4
2760                                 issymlink="$test -h"
2761                                 if $test ! -h sym >/dev/null 2>&1; then
2762                                         echo "External '$test -h' is broken, too." >&4
2763                                         issymlink=''
2764                                 fi
2765                                 ;;
2766                         *)      issymlink='' ;;
2767                         esac
2768                 fi
2769         fi
2770         if $test "X$issymlink" = X; then
2771                 if $test -L sym 2>/dev/null; then
2772                         issymlink="$test -L"
2773                         echo "The builtin '$test -L' worked." >&4
2774                 fi
2775         fi
2776         if $test "X$issymlink" != X; then
2777                 echo "You can test for symbolic links with '$issymlink'." >&4
2778         else
2779                 echo "I do not know how you can test for symbolic links." >&4
2780         fi
2781         $rm -f blurfl sym
2782         ;;
2783 *)      echo "No symbolic links, so not testing for their testing..." >&4
2784         ;;
2785 esac
2786 echo " "
2787
2788 : Make symlinks util
2789 case "$mksymlinks" in
2790 $define|true|[yY]*)
2791         case "$src" in
2792         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2793                 exit 1
2794                 ;;
2795         *)      case "$lns:$issymlink" in
2796                 *"ln"*" -s:"*"test -"?)
2797                         echo "Creating the symbolic links..." >&4
2798                         echo "(First creating the subdirectories...)" >&4
2799                         cd ..
2800                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2801                                 read directory
2802                                 test -z "$directory" && break
2803                                 mkdir -p $directory
2804                         done
2805                         # Sanity check 1.
2806                         if test ! -d t/base; then
2807                                 echo "Failed to create the subdirectories.  Aborting." >&4
2808                                 exit 1
2809                         fi
2810                         echo "(Then creating the symlinks...)" >&4
2811                         awk '{print $1}' $src/MANIFEST | while true; do
2812                                 read filename
2813                                 test -z "$filename" && break
2814                                 if test -f $filename; then
2815                                         if $issymlink $filename; then
2816                                                 rm -f $filename
2817                                         fi
2818                                 fi
2819                                 if test -f $filename; then
2820                                         echo "$filename already exists, not symlinking."
2821                                 else
2822                                         ln -s $src/$filename $filename
2823                                 fi
2824                         done
2825                         # Sanity check 2.
2826                         if test ! -f t/base/lex.t; then
2827                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2828                                 exit 1
2829                         fi
2830                         cd UU
2831                         ;;
2832                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2833                         ;;
2834                 esac
2835                 ;;
2836         esac
2837         ;;
2838 esac
2839
2840 : Check for Cross-Compilation
2841 if $test "X$targethost" = "X"; then
2842     targethost=""
2843 fi
2844 if $test "X$targetenv" = "X"; then
2845     targetenv=""
2846 fi
2847 case "$usecrosscompile" in
2848 $define|true|[yY]*)
2849         $echo "Cross-compiling..."
2850         croak=''
2851         case "$cc" in
2852         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2853             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2854             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2855             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2856             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2857             # leave out ld, choosing it is more complex
2858             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2859             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2860             # We are in a weird spot. Just before us, some values
2861             # were 'saved', to be restored after the hints are
2862             # run.  This means that the changes we made to ar,
2863             # nm and ranlib will get reverted.
2864             # To avoid that, we hijack the saving mechanism and
2865             # have it save our new values.
2866             for file in ar nm ranlib; do
2867                 eval xxx=\$$file
2868                 eval $file=$xxx$_exe
2869                 eval _$file=$xxx
2870             done
2871         ;;
2872         esac
2873         case "$targetarch" in
2874         '') echo "Targetarch not defined." >&4; croak=y ;;
2875         *)  echo "Using targetarch $targetarch." >&4 ;;
2876         esac
2877         case "$targethost" in
2878         '') echo "Targethost not defined." >&4; croak=y ;;
2879         *)  echo "Using targethost $targethost." >&4
2880         esac
2881         locincpth=' '
2882         loclibpth=' '
2883         case "$croak" in
2884         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2885         esac
2886     : compile a host miniperl and generate_uudmap, unless we got passed them
2887     if $test "X$hostperl" = X; then
2888       echo "Building host miniperl and generate_uudmap binaries" >&4
2889       before_host=`pwd`
2890       cd ..
2891       cd $src
2892       src=`pwd`
2893       rm -rf $src/host
2894       mkdir $src/host
2895       cd $src/host
2896       $src/Configure -des -Dusedevel -Dmksymlinks
2897       $make miniperl
2898       case "$hostgenerate" in
2899       '') $make generate_uudmap
2900           hostgenerate=$src/host/generate_uudmap
2901           ;;
2902        "$undef") hostgenerate=''
2903           ;;
2904       esac
2905       hostperl=$src/host/miniperl
2906       cd $before_host
2907     fi
2908     hostosname=`$hostperl -le 'print $^O'`
2909     ;;
2910 *)
2911     usecrosscompile="$undef"
2912     ;;
2913 esac
2914
2915 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2916 case "$targethost" in
2917     '') echo "Checking for cross-compile" >&4
2918     case "$usecrosscompile$multiarch" in
2919        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2920          if [ -f Makefile ]; then
2921            echo " "
2922            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2923          else
2924            echo "Configure done."
2925          fi
2926        exit 0
2927        ;;
2928      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2929         run=''
2930         to=:
2931         from=:
2932         ;;
2933     esac
2934     ;;
2935     *) echo "Using targethost $targethost." >&4
2936         case "$src" in
2937         /*) run=$src/Cross/run
2938             targetmkdir=$src/Cross/mkdir
2939             to=$src/Cross/to
2940             from=$src/Cross/from
2941             ;;
2942         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2943             run=$pwd/Cross/run
2944             targetmkdir=$pwd/Cross/mkdir
2945             to=$pwd/Cross/to
2946             from=$pwd/Cross/from
2947             ;;
2948         esac
2949         case "$targetrun" in
2950         '') targetrun=ssh ;;
2951         esac
2952         case "$targetto" in
2953         '') targetto=scp ;;
2954         esac
2955         case "$targetfrom" in
2956         '') targetfrom=scp ;;
2957         esac
2958         run=$run-$targetrun
2959         to=$to-$targetto
2960         from=$from-$targetfrom
2961         case "$targetdir" in
2962         '')  targetdir=/tmp
2963              echo "Guessing targetdir $targetdir." >&4
2964              ;;
2965         esac
2966         case "$targetuser" in
2967         '')  targetuser=root
2968              echo "Guessing targetuser $targetuser." >&4
2969              ;;
2970         esac
2971         case "$targetport" in
2972         '')  targetport=22
2973              echo "Guessing targetport $targetport." >&4
2974              ;;
2975         esac
2976         case "$targetfrom" in
2977         scp)    q=-q ;;
2978         *)      q='' ;;
2979         esac
2980         case "$targetrun" in
2981         ssh|rsh)
2982             cat >$run <<EOF
2983 #!/bin/sh
2984 env=''
2985 case "\$1" in
2986 -cwd)
2987   shift
2988   cwd=\$1
2989   shift
2990   ;;
2991 esac
2992 case "\$1" in
2993 -env)
2994   shift
2995   env=\$1
2996   shift
2997   ;;
2998 esac
2999 case "\$cwd" in
3000 '') cwd=$targetdir ;;
3001 esac
3002 exe=\$1
3003 shift
3004 $to \$exe
3005 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3006 EOF
3007             ;;
3008         adb)
3009             $touch $run
3010             ;;
3011         *)  echo "Unknown targetrun '$targetrun'" >&4
3012             exit 1
3013             ;;
3014         esac
3015         case "$targetmkdir" in
3016         */Cross/mkdir)
3017             cat >$targetmkdir <<EOF
3018 #!/bin/sh
3019 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3020 EOF
3021             $chmod a+rx $targetmkdir
3022             ;;
3023         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3024             exit 1
3025             ;;
3026         esac
3027         case "$targetto" in
3028         scp|rcp)
3029             cat >$to <<EOF
3030 #!/bin/sh
3031 for f in \$@
3032 do
3033   case "\$f" in
3034   /*)
3035     $targetmkdir \`dirname \$f\`
3036     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3037     ;;
3038   *)
3039     $targetmkdir $targetdir/\`dirname \$f\`
3040     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3041     ;;
3042   esac
3043 done
3044 exit 0
3045 EOF
3046             ;;
3047         cp) cat >$to <<EOF
3048 #!/bin/sh
3049 for f in \$@
3050 do
3051   case "\$f" in
3052   /*)
3053     $mkdir -p $targetdir/\`dirname \$f\`
3054     $cp \$f $targetdir/\$f || exit 1
3055     ;;
3056   *)
3057     $targetmkdir $targetdir/\`dirname \$f\`
3058     $cp \$f $targetdir/\$f || exit 1
3059     ;;
3060   esac
3061 done
3062 exit 0
3063 EOF
3064             ;;
3065         *)  echo "Unknown targetto '$targetto'" >&4
3066             exit 1
3067             ;;
3068         esac
3069         case "$targetfrom" in
3070         scp|rcp)
3071           cat >$from <<EOF
3072 #!/bin/sh
3073 for f in \$@
3074 do
3075   $rm -f \$f
3076   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3077 done
3078 exit 0
3079 EOF
3080             ;;
3081         cp) cat >$from <<EOF
3082 #!/bin/sh
3083 for f in \$@
3084 do
3085   $rm -f \$f
3086   cp $targetdir/\$f . || exit 1
3087 done
3088 exit 0
3089 EOF
3090             ;;
3091         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3092             exit 1
3093             ;;
3094         esac
3095         if $test ! -f $run; then
3096             echo "Target 'run' script '$run' not found." >&4
3097         else
3098             $chmod a+rx $run
3099         fi
3100         if $test ! -f $to; then
3101             echo "Target 'to' script '$to' not found." >&4
3102         else
3103             $chmod a+rx $to
3104         fi
3105         if $test ! -f $from; then
3106             echo "Target 'from' script '$from' not found." >&4
3107         else
3108             $chmod a+rx $from
3109         fi
3110         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3111             exit 1
3112         fi
3113         cat >&4 <<EOF
3114 Using '$run' for remote execution,
3115 and '$from' and '$to'
3116 for remote file transfer.
3117 EOF
3118         ;;
3119 *)      run=''
3120         to=:
3121         from=:
3122         usecrosscompile="$undef"
3123         targetarch=''
3124         ;;
3125 esac
3126
3127 : see whether [:lower:] and [:upper:] are supported character classes
3128 echo " "
3129 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3130 ABYZ)
3131         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3132         up='[:upper:]'
3133         low='[:lower:]'
3134         ;;
3135 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3136         # (0xd9 and 0xe2), therefore that is a nice testing point.
3137         if test "X$up" = X -o "X$low" = X; then
3138             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3139             rs) up='[A-Z]'
3140                 low='[a-z]'
3141                 ;;
3142             esac
3143         fi
3144         if test "X$up" = X -o "X$low" = X; then
3145             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3146             rs) up='A-Z'
3147                 low='a-z'
3148                 ;;
3149             esac
3150         fi
3151         if test "X$up" = X -o "X$low" = X; then
3152             case "`echo RS | od -x 2>/dev/null`" in
3153             *D9E2*|*d9e2*)
3154                 echo "Hey, this might be EBCDIC." >&4
3155                 if test "X$up" = X -o "X$low" = X; then
3156                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3157                     rs) up='[A-IJ-RS-Z]'
3158                         low='[a-ij-rs-z]'
3159                         ;;
3160                     esac
3161                 fi
3162                 if test "X$up" = X -o "X$low" = X; then
3163                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3164                     rs) up='A-IJ-RS-Z'
3165                         low='a-ij-rs-z'
3166                         ;;
3167                     esac
3168                 fi
3169                 ;;
3170             esac
3171         fi
3172 esac
3173 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3174 rs)
3175     echo "Using $up and $low to convert case." >&4
3176     ;;
3177 *)
3178     echo "I don't know how to translate letters from upper to lower case." >&4
3179     echo "Your tr is not acting any way I know of." >&4
3180     exit 1
3181     ;;
3182 esac
3183 : set up the translation script tr, must be called with ./tr of course
3184 cat >tr <<EOSC
3185 $startsh
3186 case "\$1\$2" in
3187 '[A-Z][a-z]') exec $tr '$up' '$low';;
3188 '[a-z][A-Z]') exec $tr '$low' '$up';;
3189 esac
3190 exec $tr "\$@"
3191 EOSC
3192 chmod +x tr
3193 $eunicefix tr
3194
3195 : Try to determine whether config.sh was made on this system
3196 case "$config_sh" in
3197 '')
3198 myuname=`$uname -a 2>/dev/null`
3199 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3200 # Downcase everything to avoid ambiguity.
3201 # Remove slashes and single quotes so we can use parts of this in
3202 # directory and file names.
3203 # Remove newlines so myuname is sane to use elsewhere.
3204 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3205 # because the A-Z/a-z are not consecutive.
3206 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3207         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3208 newmyuname="$myuname"
3209 dflt=n
3210 case "$knowitall" in
3211 '')
3212         if test -f ../config.sh; then
3213                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3214                         eval "`grep myuname= ../config.sh`"
3215                 fi
3216                 if test "X$myuname" = "X$newmyuname"; then
3217                         dflt=y
3218                 fi
3219         fi
3220         ;;
3221 *) dflt=y;;
3222 esac
3223
3224 : Get old answers from old config file if Configure was run on the
3225 : same system, otherwise use the hints.
3226 hint=default
3227 cd ..
3228 if test -f config.sh; then
3229         echo " "
3230         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3231         . UU/myread
3232         case "$ans" in
3233         n*|N*) echo "OK, I'll ignore it."
3234                 mv config.sh config.sh.old
3235                 myuname="$newmyuname"
3236                 ;;
3237         *)  echo "Fetching default answers from your old config.sh file..." >&4
3238                 tmp_n="$n"
3239                 tmp_c="$c"
3240                 tmp_sh="$sh"
3241                 . ./config.sh
3242                 cp config.sh UU
3243                 n="$tmp_n"
3244                 c="$tmp_c"
3245                 : Older versions did not always set $sh.  Catch re-use of such
3246                 : an old config.sh.
3247                 case "$sh" in
3248                 '') sh="$tmp_sh" ;;
3249                 esac
3250                 hint=previous
3251                 ;;
3252         esac
3253 fi
3254 . ./UU/checkcc
3255 if test ! -f config.sh; then
3256         $cat <<EOM
3257
3258 First time through, eh?  I have some defaults handy for some systems
3259 that need some extra help getting the Configure answers right:
3260
3261 EOM
3262         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3263         dflt=''
3264         : Half the following guesses are probably wrong... If you have better
3265         : tests or hints, please send them to perlbug@perl.org
3266         : The metaconfig authors would also appreciate a copy...
3267         $test -f /irix && osname=irix
3268         $test -f /xenix && osname=sco_xenix
3269         $test -f /dynix && osname=dynix
3270         $test -f /dnix && osname=dnix
3271         $test -f /lynx.os && osname=lynxos
3272         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3273         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3274         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3275         $test -f /bin/mips && /bin/mips && osname=mips
3276         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3277                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3278         $test -d /usr/apollo/bin && osname=apollo
3279         $test -f /etc/saf/_sactab && osname=svr4
3280         $test -d /usr/include/minix && osname=minix
3281         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3282         if $test -d /MachTen -o -d /MachTen_Folder; then
3283                 osname=machten
3284                 if $test -x /sbin/version; then
3285                         osvers=`/sbin/version | $awk '{print $2}' |
3286                         $sed -e 's/[A-Za-z]$//'`
3287                 elif $test -x /usr/etc/version; then
3288                         osvers=`/usr/etc/version | $awk '{print $2}' |
3289                         $sed -e 's/[A-Za-z]$//'`
3290                 else
3291                         osvers="$2.$3"
3292                 fi
3293         fi
3294
3295         $test -f /sys/posix.dll &&
3296                 $test -f /usr/bin/what &&
3297                 set X `/usr/bin/what /sys/posix.dll` &&
3298                 $test "$3" = UWIN &&
3299                 osname=uwin &&
3300                 osvers="$5"
3301
3302         if $test -f $uname; then
3303                 set X $myuname
3304                 shift
3305
3306                 case "$5" in
3307                 fps*) osname=fps ;;
3308                 mips*)
3309                         case "$4" in
3310                         umips) osname=umips ;;
3311                         *) osname=mips ;;
3312                         esac;;
3313                 [23]100) osname=mips ;;
3314                 next*) osname=next ;;
3315                 i386*)
3316                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3317                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3318                                 osname='sco'
3319                                 osvers=$tmp
3320                         elif $test -f /etc/kconfig; then
3321                                 osname=isc
3322                                 if test "$lns" = "$ln -s"; then
3323                                         osvers=4
3324                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3325                                         osvers=3
3326                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3327                                         osvers=2
3328                                 fi
3329                         fi
3330                         tmp=''
3331                         ;;
3332                 pc*)
3333                         if test -n "$DJGPP"; then
3334                                 osname=dos
3335                                 osvers=djgpp
3336                         fi
3337                         ;;
3338                 esac
3339
3340                 case "$1" in
3341                 aix) osname=aix
3342                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3343                         case "$tmp" in
3344                         # oslevel can fail with:
3345                         # oslevel: Unable to acquire lock.
3346                         *not\ found) osvers="$4"."$3" ;;
3347                         '<3240'|'<>3240') osvers=3.2.0 ;;
3348                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3349                         '=3250'|'>3250') osvers=3.2.5 ;;
3350                         *) osvers=$tmp;;
3351                         esac
3352                         ;;
3353                 bitrig) osname=bitrig
3354                         osvers="$3"
3355                         ;;
3356                 bsd386) osname=bsd386
3357                         osvers=`$uname -r`
3358                         ;;
3359                 cygwin*) osname=cygwin
3360                         osvers="$3"
3361                         ;;
3362                 *dc.osx) osname=dcosx
3363                         osvers="$3"
3364                         ;;
3365                 dnix) osname=dnix
3366                         osvers="$3"
3367                         ;;
3368                 domainos) osname=apollo
3369                         osvers="$3"
3370                         ;;
3371                 dgux)   osname=dgux
3372                         osvers="$3"
3373                         ;;
3374                 dragonfly) osname=dragonfly
3375                         osvers="$3"
3376                         ;;
3377                 dynixptx*) osname=dynixptx
3378                         osvers=`echo "$4"|sed 's/^v//'`
3379                         ;;
3380                 freebsd) osname=freebsd
3381                         osvers="$3" ;;
3382                 genix)  osname=genix ;;
3383                 gnu)    osname=gnu
3384                         osvers="$3" ;;
3385                 hp*)    osname=hpux
3386                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3387                         ;;
3388                 irix*)  osname=irix
3389                         case "$3" in
3390                         4*) osvers=4 ;;
3391                         5*) osvers=5 ;;
3392                         *)      osvers="$3" ;;
3393                         esac
3394                         ;;
3395                 linux)  osname=linux
3396                         case "$3" in
3397                         *)      osvers="$3" ;;
3398                         esac
3399                         $test -f /system/lib/libandroid.so && osname=linux-android
3400                         ;;
3401                 MiNT)   osname=mint
3402                         ;;
3403                 netbsd*) osname=netbsd
3404                         osvers="$3"
3405                         ;;
3406                 news-os) osvers="$3"
3407                         case "$3" in
3408                         4*) osname=newsos4 ;;
3409                         *) osname=newsos ;;
3410                         esac
3411                         ;;
3412                 next*) osname=next ;;
3413                 nonstop-ux) osname=nonstopux ;;
3414                 openbsd) osname=openbsd
3415                         osvers="$3"
3416                         ;;
3417                 os2)    osname=os2
3418                         osvers="$4"
3419                         ;;
3420                 POSIX-BC | posix-bc ) osname=posix-bc
3421                         osvers="$3"
3422                         ;;
3423                 powerux | power_ux | powermax_os | powermaxos | \
3424                 powerunix | power_unix) osname=powerux
3425                         osvers="$3"
3426                         ;;
3427                 qnx) osname=qnx
3428                         osvers="$4"
3429                         ;;
3430                 solaris) osname=solaris
3431                         case "$3" in
3432                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3433                         *)      osvers="$3" ;;
3434                         esac
3435                         ;;
3436                 sunos) osname=sunos
3437                         case "$3" in
3438                         5*) osname=solaris
3439                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3440                         *)      osvers="$3" ;;
3441                         esac
3442                         ;;
3443                 titanos) osname=titanos
3444                         case "$3" in
3445                         1*) osvers=1 ;;
3446                         2*) osvers=2 ;;
3447                         3*) osvers=3 ;;
3448                         4*) osvers=4 ;;
3449                         *)      osvers="$3" ;;
3450                         esac
3451                         ;;
3452                 ultrix) osname=ultrix
3453                         osvers="$3"
3454                         ;;
3455                 osf1|mls+)      case "$5" in
3456                                 alpha)
3457                                         osname=dec_osf
3458                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3459                                         case "$osvers" in
3460                                         [1-9].[0-9]*) ;;
3461                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3462                                         esac
3463                                         ;;
3464                         hp*)    osname=hp_osf1  ;;
3465                         mips)   osname=mips_osf1 ;;
3466                         esac
3467                         ;;
3468                 # UnixWare 7.1.2 is known as Open UNIX 8
3469                 openunix|unixware) osname=svr5
3470                         osvers="$4"
3471                         ;;
3472                 uts)    osname=uts
3473                         osvers="$3"
3474                         ;;
3475                 vos) osvers="$3"
3476                         ;;
3477                 $2) case "$osname" in
3478                         *isc*) ;;
3479                         *freebsd*) ;;
3480                         svr*)
3481                                 : svr4.x or possibly later
3482                                 case "svr$3" in
3483                                 ${osname}*)
3484                                         osname=svr$3
3485                                         osvers=$4
3486                                         ;;
3487                                 esac
3488                                 case "$osname" in
3489                                 svr4.0)
3490                                         : Check for ESIX
3491                                         if test -f /stand/boot ; then
3492                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3493                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3494                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3495                                                         if test -n "$isesix"; then
3496                                                                 osname=esix4
3497                                                         fi
3498                                                 fi
3499                                         fi
3500                                         ;;
3501                                 esac
3502                                 ;;
3503                         *)      if test -f /etc/systemid; then
3504                                         osname=sco
3505                                         set `echo $3 | $sed 's/\./ /g'` $4
3506                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3507                                                 osvers=$1.$2.$3
3508                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3509                                                 osvers=$1.$2
3510                                         elif $test -f $src/hints/sco_$1.sh; then
3511                                                 osvers=$1
3512                                         fi
3513                                 else
3514                                         case "$osname" in
3515                                         '') : Still unknown.  Probably a generic Sys V.
3516                                                 osname="sysv"
3517                                                 osvers="$3"
3518                                                 ;;
3519                                         esac
3520                                 fi
3521                                 ;;
3522                         esac
3523                         ;;
3524                 *)      case "$osname" in
3525                         '') : Still unknown.  Probably a generic BSD.
3526                                 osname="$1"
3527                                 osvers="$3"
3528                                 ;;
3529                         esac
3530                         ;;
3531                 esac
3532         else
3533                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3534                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3535                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3536                                 osname=news_os
3537                         fi
3538                         $rm -f UU/kernel.what
3539                 elif test -d c:/. -o -n "$is_os2" ; then
3540                         set X $myuname
3541                         osname=os2
3542                         osvers="$5"
3543                 fi
3544         fi
3545
3546         case "$targetarch" in
3547         '') ;;
3548         *)  hostarch=$osname
3549             case "$targetarch" in
3550                 nto*|*-nto-*)
3551                     # Will load qnx.sh, which should change osname to nto
3552                     osname=qnx
3553                     osvers=''
3554                     ;;
3555                 *linux-android*)
3556                     # Catch arm-linux-androideabi, mipsel-linux-android,
3557                     # and i686-linux-android
3558                     osname=linux-android
3559                     osvers=''
3560                     ;;
3561                 *linux*)
3562                     # Something like arm-linux-gnueabihf is really just
3563                     # plain linux.
3564                     osname=linux
3565                     osvers=''
3566                     ;;
3567                 *solaris*|*sunos*)
3568                     osname=solaris
3569                     # XXX perhaps we should just assume
3570                     # osvers to be 2, or maybe take the value
3571                     # from targetarch. Using $run before the
3572                     # hints are run is somewhat icky.
3573                     set X `$run $uname -a 2>/dev/null`
3574                     shift
3575                     case "$3" in
3576                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3577                         *)  osvers="$3" ;;
3578                     esac
3579                     ;;
3580                 *)
3581                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3582                     osvers=''
3583                 ;;
3584             esac
3585             ;;
3586         esac
3587
3588         : Now look for a hint file osname_osvers, unless one has been
3589         : specified already.
3590         case "$hintfile" in
3591         ''|' ')
3592                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3593                 : Also try without trailing minor version numbers.
3594                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3595                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3596                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3597                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3598                 case "$file" in
3599                 '') dflt=none ;;
3600                 *)  case "$osvers" in
3601                         '') dflt=$file
3602                                 ;;
3603                         *)  if $test -f $src/hints/$file.sh ; then
3604                                         dflt=$file
3605                                 elif $test -f $src/hints/$xfile.sh ; then
3606                                         dflt=$xfile
3607                                 elif $test -f $src/hints/$xxfile.sh ; then
3608                                         dflt=$xxfile
3609                                 elif $test -f $src/hints/$xxxfile.sh ; then
3610                                         dflt=$xxxfile
3611                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3612                                         dflt=$xxxxfile
3613                                 elif $test -f "$src/hints/${osname}.sh" ; then
3614                                         dflt="${osname}"
3615                                 else
3616                                         dflt=none
3617                                 fi
3618                                 ;;
3619                         esac
3620                         ;;
3621                 esac
3622                 if $test -f Policy.sh ; then
3623                         case "$dflt" in
3624                         *Policy*) ;;
3625                         none) dflt="Policy" ;;
3626                         *) dflt="Policy $dflt" ;;
3627                         esac
3628                 fi
3629                 ;;
3630         *)
3631                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3632                 ;;
3633         esac
3634
3635         if $test -f Policy.sh ; then
3636                 $cat <<EOM
3637
3638 There's also a Policy hint file available, which should make the
3639 site-specific (policy) questions easier to answer.
3640 EOM
3641
3642         fi
3643
3644         $cat <<EOM
3645
3646 You may give one or more space-separated answers, or "none" if appropriate.
3647 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3648 previous run of Configure, you may specify it as well as or instead of
3649 OS-specific hints.  If hints are provided for your OS, you should use them:
3650 although Perl can probably be built without hints on many platforms, using
3651 hints often improve performance and may enable features that Configure can't
3652 set up on its own. If there are no hints that match your OS, specify "none";
3653 DO NOT give a wrong version or a wrong OS.
3654
3655 EOM
3656
3657         rp="Which of these apply, if any?"
3658         . UU/myread
3659         tans=$ans
3660         for file in $tans; do
3661                 if $test X$file = XPolicy -a -f Policy.sh; then
3662                         . Policy.sh
3663                         $cat Policy.sh >> UU/config.sh
3664                 elif $test -f $src/hints/$file.sh; then
3665                         . $src/hints/$file.sh
3666                         $cat $src/hints/$file.sh >> UU/config.sh
3667                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3668                         : nothing
3669                 else
3670                         : Give one chance to correct a possible typo.
3671                         echo "$file.sh does not exist"
3672                         dflt=$file
3673                         rp="hint to use instead?"
3674                         . UU/myread
3675                         for file in $ans; do
3676                                 if $test -f "$src/hints/$file.sh"; then
3677                                         . $src/hints/$file.sh
3678                                         $cat $src/hints/$file.sh >> UU/config.sh
3679                                 elif $test X$ans = X -o X$ans = Xnone ; then
3680                                         : nothing
3681                                 else
3682                                         echo "$file.sh does not exist -- ignored."
3683                                 fi
3684                         done
3685                 fi
3686         done
3687
3688         hint=recommended
3689         : Remember our hint file for later.
3690         if $test -f "$src/hints/$file.sh" ; then
3691                 hintfile="$file"
3692         else
3693                 hintfile=''
3694         fi
3695 fi
3696 cd UU
3697 ;;
3698 *)
3699         echo " "
3700         echo "Fetching default answers from $config_sh..." >&4
3701         tmp_n="$n"
3702         tmp_c="$c"
3703         cd ..
3704         cp $config_sh config.sh 2>/dev/null
3705         chmod +w config.sh
3706         . ./config.sh
3707         cd UU
3708         cp ../config.sh .
3709         n="$tmp_n"
3710         c="$tmp_c"
3711         hint=previous
3712         ;;
3713 esac
3714 test "$override" && . ./optdef.sh
3715
3716 : Restore computed paths
3717 for file in $loclist $trylist; do
3718         eval $file="\$_$file"
3719 done
3720
3721 cat << EOM
3722
3723 Configure uses the operating system name and version to set some defaults.
3724 The default value is probably right if the name rings a bell. Otherwise,
3725 since spelling matters for me, either accept the default or answer "none"
3726 to leave it blank.
3727
3728 EOM
3729 case "$osname" in
3730         ''|' ')
3731                 case "$hintfile" in
3732                 ''|' '|none) dflt=none ;;
3733                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3734                 esac
3735                 ;;
3736         *) dflt="$osname" ;;
3737 esac
3738 rp="Operating system name?"
3739 . ./myread
3740 case "$ans" in
3741 none)  osname='' ;;
3742 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3743 esac
3744 echo " "
3745 case "$osvers" in
3746         ''|' ')
3747                 case "$hintfile" in
3748                 ''|' '|none) dflt=none ;;
3749                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3750                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3751                         case "$dflt" in
3752                         ''|' ') dflt=none ;;
3753                         esac
3754                         ;;
3755                 esac
3756                 ;;
3757         *) dflt="$osvers" ;;
3758 esac
3759 rp="Operating system version?"
3760 . ./myread
3761 case "$ans" in
3762 none)  osvers='' ;;
3763 *) osvers="$ans" ;;
3764 esac
3765
3766
3767 . ./posthint.sh
3768
3769 : who configured the system
3770 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3771 case "$cf_by" in
3772 "")
3773         cf_by=`(logname) 2>/dev/null`
3774         case "$cf_by" in
3775         "")
3776                 cf_by=`(whoami) 2>/dev/null`
3777                 case "$cf_by" in
3778                 "") cf_by=unknown ;;
3779                 esac ;;
3780         esac ;;
3781 esac
3782
3783 : decide how portable to be.  Allow command line overrides.
3784 case "$d_portable" in
3785 "$undef") ;;
3786 *)      d_portable="$define" ;;
3787 esac
3788
3789 : set up shell script to do ~ expansion
3790 cat >filexp <<EOSS
3791 $startsh
3792 : expand filename
3793 case "\$1" in
3794  \~/*|\~)
3795         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3796         ;;
3797  \~*)
3798         if $test -f /bin/csh; then
3799                 /bin/csh -f -c "glob \$1"
3800                 failed=\$?
3801                 echo ""
3802                 exit \$failed
3803         else
3804                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3805                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3806                 if $test ! -d "\$dir"; then
3807                         me=\`basename \$0\`
3808                         echo "\$me: can't locate home directory for: \$name" >&2
3809                         exit 1
3810                 fi
3811                 case "\$1" in
3812                 */*)
3813                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3814                         ;;
3815                 *)
3816                         echo \$dir
3817                         ;;
3818                 esac
3819         fi
3820         ;;
3821 *)
3822         echo \$1
3823         ;;
3824 esac
3825 EOSS
3826 chmod +x filexp
3827 $eunicefix filexp
3828
3829 : now set up to get a file name
3830 cat <<EOS >getfile
3831 $startsh
3832 EOS
3833 cat <<'EOSC' >>getfile
3834 tilde=''
3835 fullpath=''
3836 already=''
3837 skip=''
3838 none_ok=''
3839 exp_file=''
3840 nopath_ok=''
3841 orig_rp="$rp"
3842 orig_dflt="$dflt"
3843 case "$gfpth" in
3844 '') gfpth='.' ;;
3845 esac
3846
3847 case "$fn" in
3848 *\(*)
3849         : getfile will accept an answer from the comma-separated list
3850         : enclosed in parentheses even if it does not meet other criteria.
3851         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3852         fn=`echo $fn | sed 's/(.*)//'`
3853         ;;
3854 esac
3855
3856 case "$fn" in
3857 *:*)
3858         loc_file=`expr $fn : '.*:\(.*\)'`
3859         fn=`expr $fn : '\(.*\):.*'`
3860         ;;
3861 esac
3862
3863 case "$fn" in
3864 *~*) tilde=true;;
3865 esac
3866 case "$fn" in
3867 */*) fullpath=true;;
3868 esac
3869 case "$fn" in
3870 *+*) skip=true;;
3871 esac
3872 case "$fn" in
3873 *n*) none_ok=true;;
3874 esac
3875 case "$fn" in
3876 *e*) exp_file=true;;
3877 esac
3878 case "$fn" in
3879 *p*) nopath_ok=true;;
3880 esac
3881
3882 case "$fn" in
3883 *f*) type='File';;
3884 *d*) type='Directory';;
3885 *l*) type='Locate';;
3886 esac
3887
3888 what="$type"
3889 case "$what" in
3890 Locate) what='File';;
3891 esac
3892
3893 case "$exp_file" in
3894 '')
3895         case "$d_portable" in
3896         "$define") ;;
3897         *) exp_file=true;;
3898         esac
3899         ;;
3900 esac
3901
3902 cd ..
3903 while test "$type"; do
3904         redo=''
3905         rp="$orig_rp"
3906         dflt="$orig_dflt"
3907         case "$tilde" in
3908         true) rp="$rp (~name ok)";;
3909         esac
3910         . UU/myread
3911         if test -f UU/getfile.ok && \
3912                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3913         then
3914                 value="$ans"
3915                 ansexp="$ans"
3916                 break
3917         fi
3918         case "$ans" in
3919         none)
3920                 value=''
3921                 ansexp=''
3922                 case "$none_ok" in
3923                 true) type='';;
3924                 esac
3925                 ;;
3926         *)
3927                 case "$tilde" in
3928                 '') value="$ans"
3929                         ansexp="$ans";;
3930                 *)
3931                         value=`UU/filexp $ans`
3932                         case $? in
3933                         0)
3934                                 if test "$ans" != "$value"; then
3935                                         echo "(That expands to $value on this system.)"
3936                                 fi
3937                                 ;;
3938                         *) value="$ans";;
3939                         esac
3940                         ansexp="$value"
3941                         case "$exp_file" in
3942                         '') value="$ans";;
3943                         esac
3944                         ;;
3945                 esac
3946                 case "$fullpath" in
3947                 true)
3948                         case "$ansexp" in
3949                         /*) value="$ansexp" ;;
3950                         [a-zA-Z]:/*) value="$ansexp" ;;
3951                         *)
3952                                 redo=true
3953                                 case "$already" in
3954                                 true)
3955                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3956                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3957                                         ;;
3958                                 *)
3959                                 echo "Please give a full path name, starting with slash." >&4
3960                                         case "$tilde" in
3961                                         true)
3962                                 echo "Note that using ~name is ok provided it expands well." >&4
3963                                                 already=true
3964                                                 ;;
3965                                         esac
3966                                 esac
3967                                 ;;
3968                         esac
3969                         ;;
3970                 esac
3971                 case "$redo" in
3972                 '')
3973                         case "$type" in
3974                         File)
3975                                 for fp in $gfpth; do
3976                                         if test "X$fp" = X.; then
3977                                             pf="$ansexp"
3978                                         else    
3979                                             pf="$fp/$ansexp"
3980                                         fi
3981                                         if test -f "$pf"; then
3982                                                 type=''
3983                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3984                                         then
3985                                                 echo "($value is not a plain file, but that's ok.)"
3986                                                 type=''
3987                                         fi
3988                                         if test X"$type" = X; then
3989                                             value="$pf"
3990                                             break
3991                                         fi
3992                                 done
3993                                 ;;
3994                         Directory)
3995                                 for fp in $gfpth; do
3996                                         if test "X$fp" = X.; then
3997                                             dir="$ans"
3998                                             direxp="$ansexp"
3999                                         else    
4000                                             dir="$fp/$ansexp"
4001                                             direxp="$fp/$ansexp"
4002                                         fi
4003                                         if test -d "$direxp"; then
4004                                                 type=''
4005                                                 value="$dir"
4006                                                 break
4007                                         fi
4008                                 done
4009                                 ;;
4010                         Locate)
4011                                 if test -d "$ansexp"; then
4012                                         echo "(Looking for $loc_file in directory $value.)"
4013                                         value="$value/$loc_file"
4014                                         ansexp="$ansexp/$loc_file"
4015                                 fi
4016                                 if test -f "$ansexp"; then
4017                                         type=''
4018                                 fi
4019                                 case "$nopath_ok" in
4020                                 true)   case "$value" in
4021                                         */*) ;;
4022                                         *)      echo "Assuming $value will be in people's path."
4023                                                 type=''
4024                                                 ;;
4025                                         esac
4026                                         ;;
4027                                 esac
4028                                 ;;
4029                         esac
4030
4031                         case "$skip" in
4032                         true) type='';
4033                         esac
4034
4035                         case "$type" in
4036                         '') ;;
4037                         *)
4038                                 if test "$fastread" = yes; then
4039                                         dflt=y
4040                                 else
4041                                         dflt=n
4042                                 fi
4043                                 rp="$what $value doesn't exist.  Use that name anyway?"
4044                                 . UU/myread
4045                                 dflt=''
4046                                 case "$ans" in
4047                                 y*) type='';;
4048                                 *) echo " ";;
4049                                 esac
4050                                 ;;
4051                         esac
4052                         ;;
4053                 esac
4054                 ;;
4055         esac
4056 done
4057 cd UU
4058 ans="$value"
4059 rp="$orig_rp"
4060 dflt="$orig_dflt"
4061 rm -f getfile.ok
4062 test "X$gfpthkeep" != Xy && gfpth=""
4063 EOSC
4064
4065 : determine root of directory hierarchy where package will be installed.
4066 case "$prefix" in
4067 '')
4068         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4069         ;;
4070 *?/)
4071         dflt=`echo "$prefix" | sed 's/.$//'`
4072         ;;
4073 *)
4074         dflt="$prefix"
4075         ;;
4076 esac
4077 $cat <<EOM
4078
4079 By default, $package will be installed in $dflt/bin, manual pages
4080 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4081 installation directories. Typically this is something like /usr/local.
4082 If you wish to have binaries under /usr/bin but other parts of the
4083 installation under /usr/local, that's ok: you will be prompted
4084 separately for each of the installation directories, the prefix being
4085 only used to set the defaults.
4086
4087 EOM
4088 fn=d~
4089 rp='Installation prefix to use?'
4090 . ./getfile
4091 oldprefix=''
4092 case "$prefix" in
4093 '') ;;
4094 *)
4095         case "$ans" in
4096         "$prefix") ;;
4097         *) oldprefix="$prefix";;
4098         esac
4099         ;;
4100 esac
4101 prefix="$ans"
4102 prefixexp="$ansexp"
4103
4104 : allow them to override the AFS root
4105 case "$afsroot" in
4106 '')     afsroot=/afs ;;
4107 *)      afsroot=$afsroot ;;
4108 esac
4109
4110 : is AFS running?
4111 echo " "
4112 case "$afs" in
4113 $define|true)   afs=true ;;
4114 $undef|false)   afs=false ;;
4115 *)      if $test -d $afsroot; then
4116                 afs=true
4117         else
4118                 afs=false
4119         fi
4120         ;;
4121 esac
4122 if $afs; then
4123         echo "AFS may be running... I'll be extra cautious then..." >&4
4124 else
4125         echo "AFS does not seem to be running..." >&4
4126 fi
4127
4128 : determine installation prefix for where package is to be installed.
4129 if $afs; then
4130 $cat <<EOM
4131
4132 Since you are running AFS, I need to distinguish the directory in which
4133 files will reside from the directory in which they are installed (and from
4134 which they are presumably copied to the former directory by occult means).
4135
4136 EOM
4137         case "$installprefix" in
4138         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4139         *) dflt="$installprefix";;
4140         esac
4141 else
4142 $cat <<EOM
4143
4144 In some special cases, particularly when building $package for distribution,
4145 it is convenient to distinguish the directory in which files should be
4146 installed from the directory ($prefix) in which they will
4147 eventually reside.  For most users, these two directories are the same.
4148
4149 EOM
4150         case "$installprefix" in
4151         '') dflt=$prefix ;;
4152         *) dflt=$installprefix;;
4153         esac
4154 fi
4155 fn=d~
4156 rp='What installation prefix should I use for installing files?'
4157 . ./getfile
4158 installprefix="$ans"
4159 installprefixexp="$ansexp"
4160
4161 : Perform the prefixexp/installprefixexp correction if necessary
4162 cat <<EOS >installprefix
4163 $startsh
4164 EOS
4165 cat <<'EOSC' >>installprefix
4166 : Change installation prefix, if necessary.
4167 if $test X"$prefix" != X"$installprefix"; then
4168     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4169 else
4170     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4171 fi
4172 EOSC
4173 chmod +x installprefix
4174 $eunicefix installprefix
4175
4176 : Set variables such as privlib and privlibexp from the output of ./getfile
4177 : performing the prefixexp/installprefixexp correction if necessary.
4178 cat <<EOS >setprefixvar
4179 $startsh
4180 EOS
4181 cat <<'EOSC' >>setprefixvar
4182 eval "${prefixvar}=\"\$ans\""
4183 eval "${prefixvar}exp=\"\$ansexp\""
4184 . ./installprefix
4185 EOSC
4186 chmod +x setprefixvar
4187 $eunicefix setprefixvar
4188
4189 : set up the script used to warn in case of inconsistency
4190 cat <<EOS >whoa
4191 $startsh
4192 EOS
4193 cat <<'EOSC' >>whoa
4194 dflt=y
4195 case "$hint" in
4196     recommended)
4197         case "$hintfile" in
4198         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4199                 ;;
4200         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4201                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4202                 ;;
4203         esac
4204         ;;
4205     *)  echo " "
4206         echo "*** WHOA THERE!!! ***" >&4
4207         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4208         ;;
4209 esac
4210 rp="    Keep the $hint value?"
4211 . ./myread
4212 case "$ans" in
4213 y) td=$was; tu=$was;;
4214 esac
4215 EOSC
4216
4217 : function used to set '$1' to '$val'
4218 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4219 case "$val$was" in
4220 $define$undef) . ./whoa; eval "$var=\$td";;
4221 $undef$define) . ./whoa; eval "$var=\$tu";;
4222 *) eval "$var=$val";;
4223 esac'
4224
4225 : get the patchlevel
4226 echo " "
4227 echo "Getting the current patchlevel..." >&4
4228 if $test -r $rsrc/patchlevel.h;then
4229         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4230         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4231         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4232         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4233         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4234         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4235         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4236 else
4237         revision=0
4238         patchlevel=0
4239         subversion=0
4240         api_revision=0
4241         api_version=0
4242         api_subversion=0
4243         perl_patchlevel=0
4244         $echo "(You do not have patchlevel.h.  Eek.)"
4245 fi
4246 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4247 version_patchlevel_string="version $patchlevel subversion $subversion"
4248 case "$perl_patchlevel" in
4249 0|'') ;;
4250 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4251     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4252     ;;
4253 esac
4254
4255 $echo "(You have $package $version_patchlevel_string.)"
4256
4257 case "$osname" in
4258 dos|vms)
4259         : XXX Should be a Configure test for double-dots in filenames.
4260         version=`echo $revision $patchlevel $subversion | \
4261                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4262         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4263                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4264         ;;
4265 *)
4266         version=`echo $revision $patchlevel $subversion | \
4267                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4268         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4269                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4270         ;;
4271 esac
4272 : Special case the 5.005_xx maintenance series, which used 5.005
4273 : without any subversion label as a subdirectory in $sitelib
4274 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4275         api_versionstring='5.005'
4276 fi
4277
4278 : Do we want threads support and if so, what type
4279 case "$usethreads" in
4280 $define|true|[yY]*)     dflt='y';;
4281 *)     # Catch case where user specified ithreads or 5005threads but
4282        # forgot -Dusethreads (A.D. 4/2002)
4283        case "$useithreads$use5005threads" in
4284        *$define*)       dflt='y';;
4285        *)               dflt='n';;
4286        esac
4287        ;;
4288 esac
4289 cat <<EOM
4290
4291 Perl can be built to offer a form of threading support on some systems
4292 To do so, Configure can be run with -Dusethreads.
4293
4294 Note that Perl built with threading support runs slightly slower
4295 and uses slightly more memory than plain Perl.
4296
4297 If this doesn't make any sense to you, just accept the default '$dflt'.
4298 EOM
4299 rp='Build a threading Perl?'
4300 . ./myread
4301 case "$ans" in
4302 y|Y)    val="$define" ;;
4303 *)      val="$undef" ;;
4304 esac
4305 set usethreads
4306 eval $setvar
4307
4308 if $test $patchlevel -lt 9; then
4309     case "$usethreads" in
4310     $define)
4311         : Default to ithreads unless overridden on command line or with
4312         : old config.sh
4313         dflt='y'
4314         case "$use5005threads" in
4315                 $define|true|[yY]*)
4316                         echo "5.005 threads are no longer supported"
4317                         exit 1
4318                 ;;
4319         esac
4320         case "$useithreads" in
4321                 $undef|false|[nN]*) dflt='n';;
4322         esac
4323         rp='Use the newer interpreter-based ithreads?'
4324         . ./myread
4325         case "$ans" in
4326         y|Y)    val="$define" ;;
4327         *)      val="$undef" ;;
4328         esac
4329         set useithreads
4330         eval $setvar
4331         : Now set use5005threads to the opposite value.
4332         case "$useithreads" in
4333         $define) val="$undef" ;;
4334         *) val="$define" ;;
4335         esac
4336         set use5005threads
4337         eval $setvar
4338         ;;
4339     *)
4340         useithreads="$undef"
4341         use5005threads="$undef"
4342         ;;
4343     esac
4344
4345     case "$useithreads$use5005threads" in
4346     "$define$define")
4347         $cat >&4 <<EOM
4348
4349 You cannot have both the ithreads and the 5.005 threads enabled
4350 at the same time.  Disabling the 5.005 threads since they are
4351 much less stable than the ithreads.
4352
4353 EOM
4354         use5005threads="$undef"
4355         ;;
4356     esac
4357
4358 else
4359 : perl-5.9.x and later
4360
4361     if test X"$usethreads" = "X$define"; then
4362         case "$use5005threads" in
4363             $define|true|[yY]*)
4364                 $cat >&4 <<EOM
4365
4366 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4367
4368 EOM
4369             ;;
4370         esac
4371     fi
4372
4373     use5005threads="$undef"
4374     useithreads="$usethreads"
4375 fi
4376
4377 case "$d_oldpthreads" in
4378 '')     : Configure tests would be welcome here.  For now, assume undef.
4379         val="$undef" ;;
4380 *)      val="$d_oldpthreads" ;;
4381 esac
4382 set d_oldpthreads
4383 eval $setvar
4384
4385
4386 : Look for a hint-file generated 'call-back-unit'.  If the
4387 : user has specified that a threading perl is to be built,
4388 : we may need to set or change some other defaults.
4389 if $test -f usethreads.cbu; then
4390     echo "Your platform has some specific hints regarding threaded builds, using them..."
4391     . ./usethreads.cbu
4392 else
4393     case "$usethreads" in
4394         "$define"|true|[yY]*)
4395                 $cat <<EOM
4396 (Your platform does not have any specific hints for threaded builds.
4397  Assuming POSIX threads, then.)
4398 EOM
4399         ;;
4400     esac
4401 fi
4402
4403 : Check if multiplicity is required
4404 cat <<EOM
4405
4406 Perl can be built so that multiple Perl interpreters can coexist
4407 within the same Perl executable.
4408 EOM
4409
4410 case "$useithreads" in
4411 $define)
4412         cat <<EOM
4413 This multiple interpreter support is required for interpreter-based threads.
4414 EOM
4415         val="$define"
4416         ;;
4417 *)      case "$usemultiplicity" in
4418         $define|true|[yY]*)     dflt='y';;
4419         *) dflt='n';;
4420         esac
4421         echo " "
4422         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4423         rp='Build Perl for multiplicity?'
4424         . ./myread
4425         case "$ans" in
4426         y|Y)    val="$define" ;;
4427         *)      val="$undef" ;;
4428         esac
4429         ;;
4430 esac
4431 set usemultiplicity
4432 eval $setvar
4433
4434 : Check if morebits is requested
4435 case "$usemorebits" in
4436 "$define"|true|[yY]*)
4437         use64bitint="$define"
4438         uselongdouble="$define"
4439         usemorebits="$define"
4440         ;;
4441 *)      usemorebits="$undef"
4442         ;;
4443 esac
4444
4445 : Determine the C compiler to be used
4446 echo " "
4447 case "$cc" in
4448 '') dflt=cc;;
4449 *) dflt="$cc";;
4450 esac
4451 rp="Use which C compiler?"
4452 . ./myread
4453 cc="$ans"
4454
4455 : See whether they have no cc but they do have gcc
4456 . ./trygcc
4457 if $test -f cc.cbu; then
4458     . ./cc.cbu
4459 fi
4460 . ./checkcc
4461
4462 : make some quick guesses about what we are up against
4463 echo " "
4464 $echo $n "Hmm...  $c"
4465 echo exit 1 >bsd
4466 echo exit 1 >usg
4467 echo exit 1 >v7
4468 echo exit 1 >osf1
4469 echo exit 1 >eunice
4470 echo exit 1 >xenix
4471 echo exit 1 >venix
4472 echo exit 1 >os2
4473 d_bsd="$undef"
4474 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4475 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4476 then
4477         echo "Looks kind of like an OSF/1 system, but we'll see..."
4478         echo exit 0 >osf1
4479 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4480         xxx=`./loc addbib blurfl $pth`
4481         if $test -f $xxx; then
4482         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4483                 echo exit 0 >bsd
4484                 echo exit 0 >usg
4485         else
4486                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4487                         echo "Looks kind of like an extended USG system, but we'll see..."
4488                 else
4489                         echo "Looks kind of like a USG system, but we'll see..."
4490                 fi
4491                 echo exit 0 >usg
4492         fi
4493 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4494         echo "Looks kind of like a BSD system, but we'll see..."
4495         d_bsd="$define"
4496         echo exit 0 >bsd
4497 else
4498         echo "Looks kind of like a Version 7 system, but we'll see..."
4499         echo exit 0 >v7
4500 fi
4501 case "$eunicefix" in
4502 *unixtovms*)
4503         $cat <<'EOI'
4504 There is, however, a strange, musty smell in the air that reminds me of
4505 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4506 EOI
4507         echo exit 0 >eunice
4508         d_eunice="$define"
4509 : it so happens the Eunice I know will not run shell scripts in Unix format
4510         ;;
4511 *)
4512         echo " "
4513         echo "Congratulations.  You aren't running Eunice."
4514         d_eunice="$undef"
4515         ;;
4516 esac
4517 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4518 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4519 : semicolon as a patch separator
4520 case "$p_" in
4521 :) ;;
4522 *)
4523         $cat <<'EOI'
4524 I have the feeling something is not exactly right, however...don't tell me...
4525 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4526 (Or you may be running DOS with DJGPP.)
4527 EOI
4528         echo exit 0 >os2
4529         ;;
4530 esac
4531 if test -f /xenix; then
4532         echo "Actually, this looks more like a XENIX system..."
4533         echo exit 0 >xenix
4534         d_xenix="$define"
4535 else
4536         echo " "
4537         echo "It's not Xenix..."
4538         d_xenix="$undef"
4539 fi
4540 chmod +x xenix
4541 $eunicefix xenix
4542 if test -f /venix; then
4543         echo "Actually, this looks more like a VENIX system..."
4544         echo exit 0 >venix
4545 else
4546         echo " "
4547         if ./xenix; then
4548                 : null
4549         else
4550                 echo "Nor is it Venix..."
4551         fi
4552 fi
4553 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4554 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4555 $rm -f foo
4556
4557 : Check if we are using GNU gcc and what its version is
4558 echo " "
4559 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4560 $cat >try.c <<EOM
4561 #include <stdio.h>
4562 int main() {
4563 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4564 #ifdef __VERSION__
4565         printf("%s\n", __VERSION__);
4566 #else
4567         printf("%s\n", "1");
4568 #endif
4569 #endif
4570         return(0);
4571 }
4572 EOM
4573 if $cc -o try $ccflags $ldflags try.c; then
4574         gccversion=`$run ./try`
4575         case "$gccversion" in
4576         '') echo "You are not using GNU cc." ;;
4577         *)  echo "You are using GNU cc $gccversion."
4578             ccname=gcc
4579             ;;
4580         esac
4581 else
4582         echo " "
4583         echo "*** WHOA THERE!!! ***" >&4
4584         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4585         case "$knowitall" in
4586         '')
4587         echo "    You'd better start hunting for one and let me know about it." >&4
4588                 exit 1
4589                 ;;
4590         esac
4591 fi
4592 $rm -f try try.*
4593 case "$gccversion" in
4594 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4595 esac
4596 case "$gccversion" in
4597 '') gccosandvers='' ;;
4598 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4599    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4600    gccshortvers=''
4601    case "$gccosandvers" in
4602    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4603    $osname$osvers) ;; # looking good
4604    $osname*) cat <<EOM >&4
4605
4606 *** WHOA THERE!!! ***
4607
4608     Your gcc has not been compiled for the exact release of
4609     your operating system ($gccosandvers versus $osname$osvers).
4610
4611     In general it is a good idea to keep gcc synchronized with
4612     the operating system because otherwise serious problems
4613     may ensue when trying to compile software, like Perl.
4614
4615     I'm trying to be optimistic here, though, and will continue.
4616     If later during the configuration and build icky compilation
4617     problems appear (headerfile conflicts being the most common
4618     manifestation), I suggest reinstalling the gcc to match
4619     your operating system release.
4620
4621 EOM
4622       ;;
4623    *) gccosandvers='' ;; # failed to parse, better be silent
4624    esac
4625    ;;
4626 esac
4627 case "$ccname" in
4628 '') ccname="$cc" ;;
4629 esac
4630
4631 # gcc 3.* complain about adding -Idirectories that they already know about,
4632 # so we will take those off from locincpth.
4633 case "$gccversion" in
4634 3*)
4635     echo "main(){}">try.c
4636     for incdir in $locincpth; do
4637        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4638              grep '^c[cp]p*[01]: warning: changing search order '`
4639        if test "X$warn" != X; then
4640            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4641        fi
4642     done
4643     $rm -f try try.*
4644 esac
4645
4646 : What should the include directory be ?
4647 : Use sysroot if set, so findhdr looks in the right place.
4648 echo " "
4649 $echo $n "Hmm...  $c"
4650 dflt="$sysroot/usr/include"
4651 incpath=''
4652 mips_type=''
4653 if $test -f /bin/mips && /bin/mips; then
4654         echo "Looks like a MIPS system..."
4655         $cat >usr.c <<'EOCP'
4656 #ifdef SYSTYPE_BSD43
4657 /bsd43
4658 #endif
4659 EOCP
4660         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4661                 dflt='/bsd43/usr/include'
4662                 incpath='/bsd43'
4663                 mips_type='BSD 4.3'
4664         else
4665                 mips_type='System V'
4666         fi
4667         $rm -f usr.c usr.out
4668         echo "and you're compiling with the $mips_type compiler and libraries."
4669         xxx_prompt=y
4670         echo "exit 0" >mips
4671 else
4672         echo "Doesn't look like a MIPS system."
4673         xxx_prompt=n
4674         echo "exit 1" >mips
4675 fi
4676 chmod +x mips
4677 $eunicefix mips
4678 case "$usrinc" in
4679 '') ;;
4680 *) dflt="$usrinc";;
4681 esac
4682 case "$xxx_prompt" in
4683 y)      fn=d/
4684         echo " "
4685         rp='Where are the include files you want to use?'
4686         . ./getfile
4687         usrinc="$ans"
4688         ;;
4689 *)      usrinc="$dflt"
4690         ;;
4691 esac
4692
4693 : see how we invoke the C preprocessor
4694 echo " "
4695 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4696 cat <<'EOT' >testcpp.c
4697 #define ABC abc
4698 #define XYZ xyz
4699 ABC.XYZ
4700 EOT
4701 cd ..
4702 if test ! -f cppstdin; then
4703         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4704                 # AIX cc -E doesn't show the absolute headerfile
4705                 # locations but we'll cheat by using the -M flag.
4706                 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
4707         else
4708                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4709         fi
4710 else
4711         echo "Keeping your $hint cppstdin wrapper."
4712 fi
4713 chmod 755 cppstdin
4714 wrapper=`pwd`/cppstdin
4715 ok='false'
4716 cd UU
4717
4718 if $test "X$cppstdin" != "X" && \
4719         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4720         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4721 then
4722         echo "You used to use $cppstdin $cppminus so we'll use that again."
4723         case "$cpprun" in
4724         '') echo "But let's see if we can live without a wrapper..." ;;
4725         *)
4726                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4727                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4728                 then
4729                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4730                         ok='true'
4731                 else
4732                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4733                 fi
4734                 ;;
4735         esac
4736 else
4737         case "$cppstdin" in
4738         '') ;;
4739         *)
4740                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4741                 ;;
4742         esac
4743 fi
4744
4745 if $ok; then
4746         : nothing
4747 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4748         $cc -E <testcpp.c >testcpp.out 2>&1; \
4749         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4750         echo "Yup, it does."
4751         x_cpp="$cc $cppflags -E"
4752         x_minus='';
4753 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4754         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4755         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4756         echo "Yup, it does."
4757         x_cpp="$cc $cppflags -E"
4758         x_minus='-';
4759 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4760         $cc -P <testcpp.c >testcpp.out 2>&1; \
4761         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4762         echo "Yipee, that works!"
4763         x_cpp="$cc $cppflags -P"
4764         x_minus='';
4765 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4766         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4767         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4768         echo "At long last!"
4769         x_cpp="$cc $cppflags -P"
4770         x_minus='-';
4771 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4772         $cpp <testcpp.c >testcpp.out 2>&1; \
4773         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4774         echo "It works!"
4775         x_cpp="$cpp $cppflags"
4776         x_minus='';
4777 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4778         $cpp - <testcpp.c >testcpp.out 2>&1; \
4779         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4780         echo "Hooray, it works!  I was beginning to wonder."
4781         x_cpp="$cpp $cppflags"
4782         x_minus='-';
4783 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4784         $wrapper <testcpp.c >testcpp.out 2>&1; \
4785         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4786         x_cpp="$wrapper"
4787         x_minus=''
4788         echo "Eureka!"
4789 else
4790         dflt=''
4791         rp="No dice.  I can't find a C preprocessor.  Name one:"
4792         . ./myread
4793         x_cpp="$ans"
4794         x_minus=''
4795         $x_cpp <testcpp.c >testcpp.out 2>&1
4796         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4797                 echo "OK, that will do." >&4
4798         else
4799 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4800                 exit 1
4801         fi
4802 fi
4803
4804 case "$ok" in
4805 false)
4806         cppstdin="$x_cpp"
4807         cppminus="$x_minus"
4808         cpprun="$x_cpp"
4809         cpplast="$x_minus"
4810         set X $x_cpp
4811         shift
4812         case "$1" in
4813         "$cpp")
4814                 echo "Perhaps can we force $cc -E using a wrapper..."
4815                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4816                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4817                 then
4818                         echo "Yup, we can."
4819                         cppstdin="$wrapper"
4820                         cppminus='';
4821                 else
4822                         echo "Nope, we'll have to live without it..."
4823                 fi
4824                 ;;
4825         esac
4826         case "$cpprun" in
4827         "$wrapper")
4828                 cpprun=''
4829                 cpplast=''
4830                 ;;
4831         esac
4832         ;;
4833 esac
4834
4835 case "$cppstdin" in
4836 "$wrapper"|'cppstdin') ;;
4837 *) $rm -f $wrapper;;
4838 esac
4839 $rm -f testcpp.c testcpp.out
4840
4841 : Adjust cppfilter for path component separator
4842 case "$osname" in
4843 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4844 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4845 *)   cppfilter='' ;;
4846 esac
4847
4848 : Use gcc to determine libpth and incpth
4849 # If using gcc or clang, we can get better values for libpth, incpth
4850 # and usrinc directly from the compiler.
4851 # Note that ccname for clang is also gcc.
4852 case "$ccname" in
4853     gcc)
4854         $echo 'extern int foo;' > try.c
4855         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4856         shift
4857         if $test $# -gt 0; then
4858             incpth="$incpth $*"
4859             incpth="`$echo $incpth|$sed 's/^ //'`"
4860             for i in $*; do
4861                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4862                 if $test -d $j; then
4863                     libpth="$libpth $j"
4864                 fi
4865             done
4866             libpth="`$echo $libpth|$sed 's/^ //'`"
4867             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4868                 if $test -d $xxx; then
4869                     case " $libpth " in
4870                     *" $xxx "*) ;;
4871                     *) libpth="$libpth $xxx";;
4872                     esac
4873                 fi
4874             done
4875         fi
4876         $rm -f try.c
4877         case "$usrinc" in
4878         '') for i in $incpth; do
4879                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4880                     usrinc="$i"
4881                     break
4882                 fi
4883             done
4884             ;;
4885         esac
4886
4887         case "$usecrosscompile" in
4888         $define|true|[yY]*)
4889             case "$incpth" in
4890                 '') echo "Incpth not defined." >&4; croak=y ;;
4891                 *)  echo "Using incpth '$incpth'." >&4 ;;
4892             esac
4893             case "$libpth" in
4894                 '') echo "Libpth not defined." >&4; croak=y ;;
4895                 *)  echo "Using libpth '$libpth'." >&4 ;;
4896             esac
4897             case "$usrinc" in
4898                 '') echo "Usrinc not defined." >&4; croak=y ;;
4899                 *)  echo "Using usrinc $usrinc." >&4 ;;
4900             esac
4901             case "$croak" in
4902                 y)
4903                 if test "X$sysroot" = X; then
4904                     echo "Cannot continue, aborting." >&4; exit 1
4905                 else
4906                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4907                 fi
4908                 ;;
4909             esac
4910             ;;
4911         esac
4912     ;;
4913 esac
4914
4915 : Default value for incpth is just usrinc
4916 case "$incpth" in
4917 '') incpth="$usrinc";;
4918 esac
4919
4920 : Set private lib path
4921 case "$plibpth" in
4922 '') if ./mips; then
4923         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4924     fi;;
4925 esac
4926 case "$libpth" in
4927 ' ') dlist='';;
4928 '') dlist="$loclibpth $plibpth $glibpth";;
4929 *) dlist="$libpth";;
4930 esac
4931
4932 : Now check and see which directories actually exist, avoiding duplicates
4933 for xxx in $dlist
4934 do
4935     if $test -d $xxx; then
4936                 case " $libpth " in
4937                 *" $xxx "*) ;;
4938                 *) libpth="$libpth $xxx";;
4939                 esac
4940     fi
4941 done
4942 $cat <<'EOM'
4943
4944 Some systems have incompatible or broken versions of libraries.  Among
4945 the directories listed in the question below, please remove any you
4946 know not to be holding relevant libraries, and add any that are needed.
4947 Say "none" for none.
4948
4949 EOM
4950
4951 if test "X$sysroot" != X; then
4952     $cat <<EOM
4953 You have set sysroot to $sysroot, please supply the directories excluding sysroot
4954
4955 EOM
4956 fi
4957
4958 case "$libpth" in
4959 '') dflt='none';;
4960 *)
4961         set X $libpth
4962         shift
4963         dflt=${1+"$@"}
4964         ;;
4965 esac
4966 rp="Directories to use for library searches?"
4967 . ./myread
4968 case "$ans" in
4969 none) libpth=' ';;
4970 *) libpth="$ans";;
4971 esac
4972
4973 : compute shared library extension
4974 case "$so" in
4975 '')
4976         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4977                 dflt='sl'
4978         else
4979                 dflt='so'
4980         fi
4981         ;;
4982 *) dflt="$so";;
4983 esac
4984 $cat <<EOM
4985
4986 On some systems, shared libraries may be available.  Answer 'none' if
4987 you want to suppress searching of shared libraries for the remainder
4988 of this configuration.
4989
4990 EOM
4991 rp='What is the file extension used for shared libraries?'
4992 . ./myread
4993 so="$ans"
4994
4995 : Does target system insist that shared library basenames are unique
4996 $cat << EOM
4997
4998 Some dynamic loaders assume that the *basename* of shared library filenames
4999 are globally unique.  We'll default this to undef as we assume your system
5000 is not this weird. Set to defined if you're on one of them.
5001
5002 EOM
5003
5004 dflt='n'
5005 rp='Make shared library basenames unique?'
5006 . ./myread
5007 case "$ans" in
5008 y|Y) val="$define" ;;
5009 *)   val="$undef"  ;;
5010 esac
5011 set d_libname_unique
5012 eval $setvar
5013
5014 : Define several unixisms.
5015 : Hints files or command line option can be used to override them.
5016 : The convoluted testing is in case hints files set either the old
5017 : or the new name.
5018 case "$_exe" in
5019 '')     case "$exe_ext" in
5020         '')     ;;
5021         *)      _exe="$exe_ext" ;;
5022         esac
5023         ;;
5024 esac
5025 case "$_a" in
5026 '')     case "$lib_ext" in
5027     '') _a='.a';;
5028         *)      _a="$lib_ext" ;;
5029         esac
5030         ;;
5031 esac
5032 case "$_o" in
5033 '') case "$obj_ext" in
5034         '')     _o='.o';;
5035         *)      _o="$obj_ext";;
5036         esac
5037         ;;
5038 esac
5039 case "$p_" in
5040 '') case "$path_sep" in
5041         '')     p_=':';;
5042         *)      p_="$path_sep";;
5043         esac
5044         ;;
5045 esac
5046 exe_ext=$_exe
5047 lib_ext=$_a
5048 obj_ext=$_o
5049 path_sep=$p_
5050
5051 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5052
5053 : Which makefile gets called first.  This is used by make depend.
5054 case "$firstmakefile" in
5055 '') firstmakefile='makefile';;
5056 esac
5057
5058 : Check is we will use socks
5059 case "$usesocks" in
5060 $define|true|[yY]*)     dflt='y';;
5061 *) dflt='n';;
5062 esac
5063 cat <<EOM
5064
5065 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5066 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5067 to use the PerlIO abstraction layer, this will be implicitly selected.
5068
5069 If this doesn't make any sense to you, just accept the default '$dflt'.
5070 EOM
5071 rp='Build Perl for SOCKS?'
5072 . ./myread
5073 case "$ans" in
5074 y|Y)    val="$define" ;;
5075 *)      val="$undef" ;;
5076 esac
5077 set usesocks
5078 eval $setvar
5079
5080 : Check for uselongdouble support
5081 case "$ccflags" in
5082 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5083 esac
5084
5085 case "$uselongdouble" in
5086 $define|true|[yY]*)     dflt='y';;
5087 *) dflt='n';;
5088 esac
5089 cat <<EOM
5090
5091 Perl can be built to take advantage of long doubles which
5092 (if available) may give more accuracy and range for floating point numbers.
5093
5094 If this doesn't make any sense to you, just accept the default '$dflt'.
5095 EOM
5096 rp='Try to use long doubles if available?'
5097 . ./myread
5098 case "$ans" in
5099 y|Y)    val="$define"   ;;
5100 *)      val="$undef"    ;;
5101 esac
5102 set uselongdouble
5103 eval $setvar
5104
5105 case "$uselongdouble" in
5106 true|[yY]*) uselongdouble="$define" ;;
5107 esac
5108
5109 : Look for a hint-file generated 'call-back-unit'.  If the
5110 : user has specified that long doubles should be used,
5111 : we may need to set or change some other defaults.
5112 if $test -f uselongdouble.cbu; then
5113     echo "Your platform has some specific hints regarding long doubles, using them..."
5114     . ./uselongdouble.cbu
5115 else
5116     case "$uselongdouble" in
5117         $define)
5118                 $cat <<EOM
5119 (Your platform does not have any specific hints for long doubles.)
5120 EOM
5121         ;;
5122     esac
5123 fi
5124
5125 : Looking for optional libraries
5126 echo " "
5127 echo "Checking for optional libraries..." >&4
5128 case "$libs" in
5129 ' '|'') dflt='';;
5130 *) dflt="$libs";;
5131 esac
5132 case "$libswanted" in
5133 '') libswanted='c_s';;
5134 esac
5135 case "$usesocks" in
5136 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5137 esac
5138 libsfound=''
5139 libsfiles=''
5140 libsdirs=''
5141 libspath=''
5142 for thisdir in $libpth $xlibpth; do
5143   test -d $thisdir && libspath="$libspath $thisdir"
5144 done
5145 for thislib in $libswanted; do
5146         for thisdir in $libspath; do
5147             xxx=''
5148             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5149                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5150                 $test -f "$xxx" && eval $libscheck
5151                 $test -f "$xxx" && libstyle=shared
5152             fi
5153             if test ! -f "$xxx"; then
5154                 xxx=$thisdir/lib$thislib.$so
5155                 $test -f "$xxx" && eval $libscheck
5156                 $test -f "$xxx" && libstyle=shared
5157             fi
5158             if test ! -f "$xxx"; then
5159                 xxx=$thisdir/lib$thislib$_a
5160                 $test -f "$xxx" && eval $libscheck
5161                 $test -f "$xxx" && libstyle=static
5162             fi
5163             if test ! -f "$xxx"; then
5164                 xxx=$thisdir/$thislib$_a
5165                 $test -f "$xxx" && eval $libscheck
5166                 $test -f "$xxx" && libstyle=static
5167             fi
5168             if test ! -f "$xxx"; then
5169                 xxx=$thisdir/lib${thislib}_s$_a
5170                 $test -f "$xxx" && eval $libscheck
5171                 $test -f "$xxx" && libstyle=static
5172                 $test -f "$xxx" && thislib=${thislib}_s
5173             fi
5174             if test ! -f "$xxx"; then
5175                 xxx=$thisdir/Slib$thislib$_a
5176                 $test -f "$xxx" && eval $libscheck
5177                 $test -f "$xxx" && libstyle=static
5178             fi
5179             if $test -f "$xxx"; then
5180                 case "$libstyle" in
5181                 shared) echo "Found -l$thislib (shared)." ;;
5182                 static) echo "Found -l$thislib." ;;
5183                 *)      echo "Found -l$thislib ($libstyle)." ;;
5184                 esac
5185                 case " $dflt " in
5186                 *"-l$thislib "*);;
5187                 *) dflt="$dflt -l$thislib"
5188                    libsfound="$libsfound $xxx"
5189                    yyy=`basename $xxx`
5190                    libsfiles="$libsfiles $yyy"
5191                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5192                    case " $libsdirs " in
5193                    *" $yyy "*) ;;
5194                    *) libsdirs="$libsdirs $yyy" ;;
5195                    esac
5196                    ;;
5197                 esac
5198                 break
5199             fi
5200         done
5201         if $test ! -f "$xxx"; then
5202             echo "No -l$thislib."
5203         fi
5204 done
5205 set X $dflt
5206 shift
5207 dflt="$*"
5208 case "$libs" in
5209 '') dflt="$dflt";;
5210 *) dflt="$libs";;
5211 esac
5212 case "$dflt" in
5213 ' '|'') dflt='none';;
5214 esac
5215
5216 $cat <<EOM
5217
5218 In order to compile $package on your machine, a number of libraries
5219 are usually needed.  Include any other special libraries here as well.
5220 Say "none" for none.  The default list is almost always right.
5221 EOM
5222
5223 echo " "
5224 rp="What libraries to use?"
5225 . ./myread
5226 case "$ans" in
5227 none) libs=' ';;
5228 *) libs="$ans";;
5229 esac
5230
5231 : determine optimization, if desired, or use for debug flag also
5232 case "$optimize" in
5233 ' '|$undef) dflt='none';;
5234 '') dflt='-O';;
5235 *) dflt="$optimize";;
5236 esac
5237 $cat <<EOH
5238
5239 By default, $package compiles with the -O flag to use the optimizer.
5240 Alternately, you might want to use the symbolic debugger, which uses
5241 the -g flag (on traditional Unix systems).  Either flag can be
5242 specified here.  To use neither flag, specify the word "none".
5243
5244 EOH
5245 rp="What optimizer/debugger flag should be used?"
5246 . ./myread
5247 optimize="$ans"
5248 case "$optimize" in
5249 'none') optimize=" ";;
5250 esac
5251
5252 : Check what DEBUGGING is required from the command line
5253 : -DEBUGGING      or -DDEBUGGING or
5254 : -DEBUGGING=both                       = -g + -DDEBUGGING
5255 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5256 : -DEBUGGING=none or -UDEBUGGING        =
5257 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5258 case "$EBUGGING" in
5259 '')     ;;
5260 *)      DEBUGGING=$EBUGGING ;;
5261 esac
5262
5263 case "$DEBUGGING" in
5264 -g|both|$define)
5265     case "$optimize" in
5266         *-g*) ;;
5267         *)    optimize="$optimize -g" ;;
5268     esac ;;
5269 none|$undef)
5270     case "$optimize" in
5271         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5272                 shift
5273                 optimize="$*"
5274                 ;;
5275     esac ;;
5276 esac
5277
5278 dflt=''
5279 case "$DEBUGGING" in
5280 both|$define) dflt='-DDEBUGGING'
5281 esac
5282
5283 : argument order is deliberate, as the flag will start with - which set could
5284 : think is an option
5285 checkccflag='check=$1; flag=$2; callback=$3;
5286 echo " ";
5287 echo "Checking if your compiler accepts $flag" 2>&1;
5288 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5289 echo "int main(void) { return 0; }" > gcctest.c;
5290 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5291     echo "Yes, it does." 2>&1;
5292     if $test -s gcctest.out ; then
5293         echo "But your platform does not like it:";
5294         cat gcctest.out;
5295     else
5296         case "$ccflags" in
5297         *$check*)
5298             echo "Leaving current flags $ccflags alone." 2>&1
5299             ;;
5300         *) dflt="$dflt $flag";
5301             eval $callback
5302             ;;
5303         esac
5304     fi
5305 else
5306     echo "Nope, it does not, but that is ok." 2>&1;
5307 fi
5308 '
5309
5310 : We will not override a previous value, but we might want to
5311 : augment a hint file
5312 case "$hint" in
5313 default|recommended)
5314         case "$gccversion" in
5315         1*) dflt="$dflt -fpcc-struct-return" ;;
5316         esac
5317         case "$optimize:$DEBUGGING" in
5318         *-g*:old) dflt="$dflt -DDEBUGGING";;
5319         esac
5320         case "$gccversion" in
5321         2*) if $test -d /etc/conf/kconfig.d &&
5322                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5323                 then
5324                         # Interactive Systems (ISC) POSIX mode.
5325                         dflt="$dflt -posix"
5326                 fi
5327                 ;;
5328         esac
5329         case "$gccversion" in
5330         1*) ;;
5331         2.[0-8]*) ;;
5332         ?*)     set strict-aliasing -fno-strict-aliasing
5333                 eval $checkccflag
5334                 ;;
5335         esac
5336         # For gcc, adding -pipe speeds up compilations for some, but apparently
5337         # some assemblers can't read from stdin.  (It also slows down compilations
5338         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5339         case "$gccversion" in
5340         ?*)     set pipe -pipe
5341                 eval $checkccflag
5342                 ;;
5343         esac
5344
5345         # on x86_64 (at least) we require an extra library (libssp) in the
5346         # link command line. This library is not named, so I infer that it is
5347         # an implementation detail that may change. Hence the safest approach
5348         # is to add the flag to the flags passed to the compiler at link time,
5349         # as that way the compiler can do the right implementation dependant
5350         # thing. (NWC)
5351         case "$gccversion" in
5352         ?*)     set stack-protector -fstack-protector
5353                 eval $checkccflag
5354                 ;;
5355         esac
5356         ;;
5357 esac
5358
5359 case "$mips_type" in
5360 *BSD*|'') inclwanted="$locincpth $usrinc";;
5361 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5362 esac
5363 for thisincl in $inclwanted; do
5364         if $test -d $thisincl; then
5365                 if $test x$thisincl != x$usrinc; then
5366                         case "$dflt" in
5367                         *" -I$thisincl "*);;
5368                         *) dflt="$dflt -I$thisincl ";;
5369                         esac
5370                 fi
5371         fi
5372 done
5373
5374 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5375         xxx=true;
5376 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5377         xxx=true;
5378 else
5379         xxx=false;
5380 fi;
5381 if $xxx; then
5382         case "$dflt" in
5383         *$2*);;
5384         *) dflt="$dflt -D$2";;
5385         esac;
5386 fi'
5387
5388 set signal.h LANGUAGE_C; eval $inctest
5389
5390 case "$usesocks" in
5391 $define)
5392         ccflags="$ccflags -DSOCKS"
5393         ;;
5394 esac
5395
5396 case "$hint" in
5397 default|recommended) dflt="$ccflags $dflt" ;;
5398 *) dflt="$ccflags";;
5399 esac
5400
5401 case "$dflt" in
5402 ''|' ') dflt=none;;
5403 esac
5404
5405 $cat <<EOH
5406
5407 Your C compiler may want other flags.  For this question you should include
5408 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5409 but you should NOT include libraries or ld flags like -lwhatever.  If you
5410 want $package to honor its debug switch, you should include -DDEBUGGING here.
5411 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5412
5413 To use no flags, specify the word "none".
5414
5415 EOH
5416 set X $dflt
5417 shift
5418 dflt=${1+"$@"}
5419 rp="Any additional cc flags?"
5420 . ./myread
5421 case "$ans" in
5422 none) ccflags='';;
5423 *) ccflags="$ans";;
5424 esac
5425
5426 : the following weeds options from ccflags that are of no interest to cpp
5427 case "$cppflags" in
5428 '') cppflags="$ccflags" ;;
5429 *)  cppflags="$cppflags $ccflags" ;;
5430 esac
5431 case "$gccversion" in
5432 1*) cppflags="$cppflags -D__GNUC__"
5433 esac
5434 case "$mips_type" in
5435 '');;
5436 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5437 esac
5438 case "$cppflags" in
5439 '');;
5440 *)
5441         echo " "
5442         echo "Let me guess what the preprocessor flags are..." >&4
5443         set X $cppflags
5444         shift
5445         cppflags=''
5446         $cat >cpp.c <<'EOM'
5447 #define BLURFL foo
5448
5449 BLURFL xx LFRULB
5450 EOM
5451         previous=''
5452         for flag in $*
5453         do
5454                 case "$flag" in
5455                 -*) ftry="$flag";;
5456                 *) ftry="$previous $flag";;
5457                 esac
5458                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5459                         >cpp1.out 2>/dev/null && \
5460                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5461                         >cpp2.out 2>/dev/null && \
5462                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5463                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5464                 then
5465                         cppflags="$cppflags $ftry"
5466                         previous=''
5467                 else
5468                         previous="$flag"
5469                 fi
5470         done
5471         set X $cppflags
5472         shift
5473         cppflags=${1+"$@"}
5474         case "$cppflags" in
5475         *-*)  echo "They appear to be: $cppflags";;
5476         esac
5477         $rm -f cpp.c cpp?.out
5478         ;;
5479 esac
5480
5481 : flags used in final linking phase
5482 case "$ldflags" in
5483 '') if ./venix; then
5484                 dflt='-i -z'
5485         else
5486                 dflt=''
5487         fi
5488         case "$ccflags" in
5489         *-posix*) dflt="$dflt -posix" ;;
5490         esac
5491         ;;
5492 *) dflt="$ldflags";;
5493 esac
5494 # See note above about -fstack-protector
5495 case "$ccflags" in
5496 *-fstack-protector*)
5497         case "$dflt" in
5498         *-fstack-protector*) ;; # Don't add it again
5499         *) dflt="$dflt -fstack-protector" ;;
5500         esac
5501         ;;
5502 esac
5503
5504 : Try to guess additional flags to pick up local libraries.
5505 for thislibdir in $libpth; do
5506         case " $loclibpth " in
5507         *" $thislibdir "*)
5508                 case "$dflt " in
5509                 *"-L$thislibdir "*) ;;
5510                 *)  dflt="$dflt -L$thislibdir" ;;
5511                 esac
5512                 ;;
5513         esac
5514 done
5515
5516 case "$dflt" in
5517 '') dflt='none' ;;
5518 esac
5519
5520 $cat <<EOH
5521
5522 Your C linker may need flags.  For this question you should
5523 include -L/whatever and any other flags used by the C linker, but you
5524 should NOT include libraries like -lwhatever.
5525
5526 Make sure you include the appropriate -L/path flags if your C linker
5527 does not normally search all of the directories you specified above,
5528 namely
5529         $libpth
5530 To use no flags, specify the word "none".
5531
5532 EOH
5533
5534 rp="Any additional ld flags (NOT including libraries)?"
5535 . ./myread
5536 case "$ans" in
5537 none) ldflags='';;
5538 *) ldflags="$ans";;
5539 esac
5540 rmlist="$rmlist pdp11"
5541
5542 : coherency check
5543 echo " "
5544 echo "Checking your choice of C compiler and flags for coherency..." >&4
5545 $cat > try.c <<'EOF'
5546 #include <stdio.h>
5547 int main() { printf("Ok\n"); return(0); }
5548 EOF
5549 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5550 shift
5551 $cat >try.msg <<'EOM'
5552 I've tried to compile and run the following simple program:
5553
5554 EOM
5555 $cat try.c >> try.msg
5556
5557 $cat >> try.msg <<EOM
5558
5559 I used the command:
5560
5561         $*
5562         $run ./try
5563
5564 and I got the following output:
5565
5566 EOM
5567 dflt=y
5568 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5569         if $sh -c "$run ./try " >>try.msg 2>&1; then
5570                 xxx=`$run ./try`
5571                 case "$xxx" in
5572                 "Ok") dflt=n ;;
5573                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5574                 esac
5575         else
5576                 echo "The program compiled OK, but exited with status $?." >>try.msg
5577                 rp="You have a problem.  Shall I abort Configure"
5578                 dflt=y
5579         fi
5580 else
5581         echo "I can't compile the test program." >>try.msg
5582         rp="You have a BIG problem.  Shall I abort Configure"
5583         dflt=y
5584 fi
5585 case "$dflt" in
5586 y)
5587         $cat try.msg >&4
5588         case "$knowitall" in
5589         '')
5590                 echo "(The supplied flags or libraries might be incorrect.)"
5591                 ;;
5592         *) dflt=n;;
5593         esac
5594         echo " "
5595         . ./myread
5596         case "$ans" in
5597         n*|N*) ;;
5598         *)      echo "Ok.  Stopping Configure." >&4
5599                 exit 1
5600                 ;;
5601         esac
5602         ;;
5603 n) echo "OK, that should do.";;
5604 esac
5605 $rm_try gcctest gcctest.out
5606
5607 : define a shorthand compile call
5608 compile='
5609 mc_file=$1;
5610 shift;
5611 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5612 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5613 exit 1;
5614 fi;
5615 esac;
5616 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5617 : define a shorthand compile call for compilations that should be ok.
5618 compile_ok='
5619 mc_file=$1;
5620 shift;
5621 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5622
5623 : determine filename position in cpp output
5624 echo " "
5625 echo "Computing filename position in cpp output for #include directives..." >&4
5626 case "$osname" in
5627 vos) testaccess=-e ;;
5628 *)   testaccess=-r ;;
5629 esac
5630 echo '#include <stdio.h>' > foo.c
5631 $cat >fieldn <<EOF
5632 $startsh
5633 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5634 $grep '^[       ]*#.*stdio\.h' | \
5635 while read cline; do
5636         pos=1
5637         set \$cline
5638         while $test \$# -gt 0; do
5639                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5640                         echo "\$pos"
5641                         exit 0
5642                 fi
5643                 shift
5644                 pos=\`expr \$pos + 1\`
5645         done
5646 done
5647 EOF
5648 chmod +x fieldn
5649 fieldn=`./fieldn`
5650 $rm -f foo.c fieldn
5651 case $fieldn in
5652 '') pos='???';;
5653 1) pos=first;;
5654 2) pos=second;;
5655 3) pos=third;;
5656 *) pos="${fieldn}th";;
5657 esac
5658 echo "Your cpp writes the filename in the $pos field of the line."
5659
5660 : locate header file
5661 $cat >findhdr <<EOF
5662 $startsh
5663 wanted=\$1
5664 name=''
5665 for usrincdir in $incpth
5666 do
5667         if test -f \$usrincdir/\$wanted; then
5668                 echo "\$usrincdir/\$wanted"
5669                 exit 0
5670         fi
5671 done
5672 awkprg='{ print \$$fieldn }'
5673 echo "#include <\$wanted>" > foo\$\$.c
5674 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5675 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5676 while read cline; do
5677         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5678         case "\$name" in
5679         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5680         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5681         *) exit 2;;
5682         esac;
5683 done;
5684 #
5685 # status = 0: grep returned 0 lines, case statement not executed
5686 # status = 1: headerfile found
5687 # status = 2: while loop executed, no headerfile found
5688 #
5689 status=\$?
5690 $rm -f foo\$\$.c;
5691 if test \$status -eq 1; then
5692         exit 0;
5693 fi
5694 exit 1
5695 EOF
5696 chmod +x findhdr
5697
5698 : define an alternate in-header-list? function
5699 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5700 cont=true; xxf="echo \"<\$1> found.\" >&4";
5701 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5702 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5703 esac;
5704 case $# in 4) instead=instead;; *) instead="at last";; esac;
5705 while $test "$cont"; do
5706         xxx=`./findhdr $1`
5707         var=$2; eval "was=\$$2";
5708         if $test "$xxx" && $test -r "$xxx";
5709         then eval $xxf;
5710         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5711                 cont="";
5712         else eval $xxnf;
5713         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5714         set $yyy; shift; shift; yyy=$@;
5715         case $# in 0) cont="";;
5716         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5717                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5718         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5719                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5720         esac;
5721 done;
5722 while $test "$yyy";
5723 do set $yyy; var=$2; eval "was=\$$2";
5724         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5725         set $yyy; shift; shift; yyy=$@;
5726 done'
5727
5728 : see if stdlib is available
5729 set stdlib.h i_stdlib
5730 eval $inhdr
5731
5732 : check for lengths of integral types
5733 echo " "
5734 case "$intsize" in
5735 '')
5736         echo "Checking to see how big your integers are..." >&4
5737         $cat >try.c <<EOCP
5738 #include <stdio.h>
5739 #$i_stdlib I_STDLIB
5740 #ifdef I_STDLIB
5741 #include <stdlib.h>
5742 #endif
5743 int main()
5744 {
5745         printf("intsize=%d;\n", (int)sizeof(int));
5746         printf("longsize=%d;\n", (int)sizeof(long));
5747         printf("shortsize=%d;\n", (int)sizeof(short));
5748         exit(0);
5749 }
5750 EOCP
5751         set try
5752         if eval $compile_ok && $run ./try > /dev/null; then
5753                 eval `$run ./try`
5754                 echo "Your integers are $intsize bytes long."
5755                 echo "Your long integers are $longsize bytes long."
5756                 echo "Your short integers are $shortsize bytes long."
5757         else
5758                 $cat >&4 <<EOM
5759 !
5760 Help! I can't compile and run the intsize test program: please enlighten me!
5761 (This is probably a misconfiguration in your system or libraries, and
5762 you really ought to fix it.  Still, I'll try anyway.)
5763 !
5764 EOM
5765                 dflt=4
5766                 rp="What is the size of an integer (in bytes)?"
5767                 . ./myread
5768                 intsize="$ans"
5769                 dflt=$intsize
5770                 rp="What is the size of a long integer (in bytes)?"
5771                 . ./myread
5772                 longsize="$ans"
5773                 dflt=2
5774                 rp="What is the size of a short integer (in bytes)?"
5775                 . ./myread
5776                 shortsize="$ans"
5777         fi
5778         ;;
5779 esac
5780 $rm_try
5781
5782 : check for long long
5783 echo " "
5784 echo "Checking to see if you have long long..." >&4
5785 echo 'int main() { long long x = 7; return 0; }' > try.c
5786 set try
5787 if eval $compile; then
5788         val="$define"
5789         echo "You have long long."
5790 else
5791         val="$undef"
5792         echo "You do not have long long."
5793 fi
5794 $rm_try
5795 set d_longlong
5796 eval $setvar
5797
5798 : check for length of long long
5799 case "${d_longlong}${longlongsize}" in
5800 $define)
5801         echo " "
5802         echo "Checking to see how big your long longs are..." >&4
5803         $cat >try.c <<'EOCP'
5804 #include <stdio.h>
5805 int main()
5806 {
5807     printf("%d\n", (int)sizeof(long long));
5808     return(0);
5809 }
5810 EOCP
5811         set try
5812         if eval $compile_ok; then
5813                 longlongsize=`$run ./try`
5814                 echo "Your long longs are $longlongsize bytes long."
5815         else
5816                 dflt='8'
5817                 echo " "
5818                 echo "(I can't seem to compile the test program.  Guessing...)"
5819                 rp="What is the size of a long long (in bytes)?"
5820                 . ./myread
5821                 longlongsize="$ans"
5822         fi
5823         if $test "X$longsize" = "X$longlongsize"; then
5824                 echo "(That isn't any different from an ordinary long.)"
5825         fi
5826         ;;
5827 esac
5828 $rm_try
5829
5830 : see if inttypes.h is available
5831 : we want a real compile instead of Inhdr because some systems
5832 : have an inttypes.h which includes non-existent headers
5833 echo " "
5834 $cat >try.c <<EOCP
5835 #include <inttypes.h>
5836 int main() {
5837         static int32_t foo32 = 0x12345678;
5838 }
5839 EOCP
5840 set try
5841 if eval $compile; then
5842         echo "<inttypes.h> found." >&4
5843         val="$define"
5844 else
5845         echo "<inttypes.h> NOT found." >&4
5846         val="$undef"
5847 fi
5848 $rm_try
5849 set i_inttypes
5850 eval $setvar
5851
5852 : check for int64_t
5853 echo " "
5854 echo "Checking to see if you have int64_t..." >&4
5855 $cat >try.c <<EOCP
5856 #include <sys/types.h>
5857 #$i_inttypes I_INTTYPES
5858 #ifdef I_INTTYPES
5859 #include <inttypes.h>
5860 #endif
5861 int main() { int64_t x = 7; }
5862 EOCP
5863 set try
5864 if eval $compile; then
5865         val="$define"
5866         echo "You have int64_t."
5867 else
5868         val="$undef"
5869         echo "You do not have int64_t."
5870 fi
5871 $rm_try
5872 set d_int64_t
5873 eval $setvar
5874
5875 : Check if 64bit ints have a quad type
5876 echo " "
5877 echo "Checking which 64-bit integer type we could use..." >&4
5878
5879 case "$intsize" in
5880 8) val=int
5881    set quadtype
5882    eval $setvar
5883    val='"unsigned int"'
5884    set uquadtype
5885    eval $setvar
5886    quadkind=1
5887    ;;
5888 *) case "$longsize" in
5889    8) val=long
5890       set quadtype
5891       eval $setvar
5892       val='"unsigned long"'
5893       set uquadtype
5894       eval $setvar
5895       quadkind=2
5896       ;;
5897    *) case "$d_longlong:$longlongsize" in
5898       define:8)
5899         val='"long long"'
5900         set quadtype
5901         eval $setvar
5902         val='"unsigned long long"'
5903         set uquadtype
5904         eval $setvar
5905         quadkind=3
5906         ;;
5907       *) case "$d_int64_t" in
5908          define)
5909            val=int64_t
5910            set quadtype
5911            eval $setvar
5912            val=uint64_t
5913            set uquadtype
5914            eval $setvar
5915            quadkind=4
5916            ;;
5917          esac
5918          ;;
5919       esac
5920       ;;
5921    esac
5922    ;;
5923 esac
5924
5925 case "$quadtype" in
5926 '')     echo "Alas, no 64-bit integer types in sight." >&4
5927         d_quad="$undef"
5928         ;;
5929 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5930         d_quad="$define"
5931         ;;
5932 esac
5933
5934 : Do we want 64bit support
5935 case "$uselonglong" in
5936 "$define"|true|[yY]*)
5937         cat <<EOM >&4
5938
5939 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5940 EOM
5941         use64bitint="$define"
5942         ;;
5943 esac
5944 case "$use64bits" in
5945 "$define"|true|[yY]*)
5946         cat <<EOM >&4
5947
5948 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5949 EOM
5950         use64bitint="$define"
5951         ;;
5952 esac
5953 case "$use64bitints" in
5954 "$define"|true|[yY]*)
5955         cat <<EOM >&4
5956
5957 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5958 EOM
5959         use64bitint="$define"
5960         ;;
5961 esac
5962 case "$use64bitsint" in
5963 "$define"|true|[yY]*)
5964         cat <<EOM >&4
5965
5966 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5967 EOM
5968         use64bitint="$define"
5969         ;;
5970 esac
5971 case "$uselonglongs" in
5972 "$define"|true|[yY]*)
5973         cat <<EOM >&4
5974
5975 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5976 EOM
5977         use64bitint="$define"
5978         ;;
5979 esac
5980 case "$use64bitsall" in
5981 "$define"|true|[yY]*)
5982         cat <<EOM >&4
5983
5984 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5985 EOM
5986         use64bitall="$define"
5987         ;;
5988 esac
5989
5990 case "$ccflags" in
5991 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5992 esac
5993 case "$use64bitall" in
5994 "$define"|true|[yY]*) use64bitint="$define" ;;
5995 esac
5996
5997 case "$longsize" in
5998 8) cat <<EOM
5999
6000 You have natively 64-bit long integers.
6001 EOM
6002    val="$define"
6003    ;;
6004 *) case "$use64bitint" in
6005    "$define"|true|[yY]*) dflt='y';;
6006    *) dflt='n';;
6007    esac
6008    case "$d_quad" in
6009    "$define") ;;
6010    *) dflt='n' ;;
6011    esac
6012    cat <<EOM
6013
6014 Perl can be built to take advantage of 64-bit integer types
6015 on some systems.  To do so, Configure can be run with -Duse64bitint.
6016 Choosing this option will most probably introduce binary incompatibilities.
6017
6018 If this doesn't make any sense to you, just accept the default '$dflt'.
6019 (The default has been chosen based on your configuration.)
6020 EOM
6021    rp='Try to use 64-bit integers, if available?'
6022    . ./myread
6023    case "$ans" in
6024    [yY]*) val="$define" ;;
6025    *)     val="$undef"  ;;
6026    esac
6027    ;;
6028 esac
6029 set use64bitint
6030 eval $setvar
6031
6032 case "$use64bitall" in
6033 "$define"|true|[yY]*) dflt='y' ;;
6034 *) case "$longsize" in
6035    8) dflt='y' ;;
6036    *) dflt='n' ;;
6037    esac
6038    ;;
6039 esac
6040 cat <<EOM
6041
6042 You may also choose to try maximal 64-bitness.  It means using as much
6043 64-bitness as possible on the platform.  This in turn means even more
6044 binary incompatibilities.  On the other hand, your platform may not
6045 have any more 64-bitness available than what you already have chosen.
6046
6047 If this doesn't make any sense to you, just accept the default '$dflt'.
6048 (The default has been chosen based on your configuration.)
6049 EOM
6050 rp='Try to use maximal 64-bit support, if available?'
6051 . ./myread
6052 case "$ans" in
6053 [yY]*) val="$define" ;;
6054 *)     val="$undef"  ;;
6055 esac
6056 set use64bitall
6057 eval $setvar
6058 case "$use64bitall" in
6059 "$define")
6060         case "$use64bitint" in
6061         "$undef")
6062                 cat <<EOM
6063
6064 Since you have chosen a maximally 64-bit build, I'm also turning on
6065 the use of 64-bit integers.
6066 EOM
6067                 use64bitint="$define" ;;
6068         esac
6069         ;;
6070 esac
6071
6072 : Look for a hint-file generated 'call-back-unit'.  If the
6073 : user has specified that a 64-bit perl is to be built,
6074 : we may need to set or change some other defaults.
6075 if $test -f use64bitint.cbu; then
6076         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6077         . ./use64bitint.cbu
6078 fi
6079 case "$use64bitint" in
6080 "$define"|true|[yY]*)
6081         : This test was common to all the OpenBSD forks, and seems harmless for
6082         : other platforms:
6083         echo " "
6084         echo "Checking if your C library has broken 64-bit functions..." >&4
6085         cat >try.c <<EOCP
6086 #include <stdio.h>
6087 typedef $uquadtype myULL;
6088 int main (void)
6089 {
6090     struct {
6091         double d;
6092         myULL  u;
6093     } *p, test[] = {
6094         {4294967303.15, 4294967303ULL},
6095         {4294967294.2,  4294967294ULL},
6096         {4294967295.7,  4294967295ULL},
6097         {0.0, 0ULL}
6098     };
6099     for (p = test; p->u; p++) {
6100         myULL x = (myULL)p->d;
6101         if (x != p->u) {
6102             printf("buggy\n");
6103             return 0;
6104         }
6105     }
6106     printf("ok\n");
6107     return 0;
6108 }
6109 EOCP
6110         set try
6111         if eval $compile_ok; then
6112             libcquad=`$run ./try`
6113             echo "Your C library's 64-bit functions are $libcquad."
6114         else
6115             echo "(I can't seem to compile the test program.)"
6116             echo "Assuming that your C library's 64-bit functions are ok."
6117             libcquad="ok"
6118         fi
6119         $rm_try
6120
6121         case "$libcquad" in
6122             buggy*)
6123                 cat >&4 <<EOM
6124
6125 *** You have a C library with broken 64-bit functions.
6126 *** 64-bit support does not work reliably in this configuration.
6127 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6128 *** Cannot continue, aborting.
6129
6130 EOM
6131                 exit 1
6132                 ;;
6133         esac
6134         case "$longsize" in
6135         4) case "$archname64" in
6136            '') archname64=64int ;;
6137            esac
6138            ;;
6139         esac
6140         ;;
6141 esac
6142
6143 : Look for a hint-file generated 'call-back-unit'.  If the
6144 : user has specified that a maximally 64-bit perl is to be built,
6145 : we may need to set or change some other defaults.
6146 if $test -f use64bitall.cbu; then
6147         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6148         . ./use64bitall.cbu
6149 fi
6150 case "$use64bitall" in
6151 "$define"|true|[yY]*)
6152         case "$longsize" in
6153         4) case "$archname64" in
6154            ''|64int) archname64=64all ;;
6155            esac
6156            ;;
6157         esac
6158         ;;
6159 esac
6160
6161 case "$d_quad:$use64bitint" in
6162 $undef:$define)
6163         cat >&4 <<EOF
6164
6165 *** You have chosen to use 64-bit integers,
6166 *** but none can be found.
6167 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6168 *** Cannot continue, aborting.
6169
6170 EOF
6171         exit 1
6172         ;;
6173 esac
6174
6175 : check for length of double
6176 echo " "
6177 case "$doublesize" in
6178 '')
6179         echo "Checking to see how big your double precision numbers are..." >&4
6180         $cat >try.c <<EOCP
6181 #include <stdio.h>
6182 #$i_stdlib I_STDLIB
6183 #ifdef I_STDLIB
6184 #include <stdlib.h>
6185 #endif
6186 int main()
6187 {
6188     printf("%d\n", (int)sizeof(double));
6189     exit(0);
6190 }
6191 EOCP
6192         set try
6193         if eval $compile_ok; then
6194                 doublesize=`$run ./try`
6195                 echo "Your double is $doublesize bytes long."
6196         else
6197                 dflt='8'
6198                 echo "(I can't seem to compile the test program.  Guessing...)"
6199                 rp="What is the size of a double precision number (in bytes)?"
6200                 . ./myread
6201                 doublesize="$ans"
6202         fi
6203         ;;
6204 esac
6205 $rm_try
6206
6207 : check for long doubles
6208 echo " "
6209 echo "Checking to see if you have long double..." >&4
6210 echo 'int main() { long double x = 7.0; }' > try.c
6211 set try
6212 if eval $compile; then
6213         val="$define"
6214         echo "You have long double."
6215 else
6216         val="$undef"
6217         echo "You do not have long double."
6218 fi
6219 $rm_try
6220 set d_longdbl
6221 eval $setvar
6222
6223 : check for length of long double
6224 case "${d_longdbl}${longdblsize}" in
6225 $define)
6226         echo " "
6227         echo "Checking to see how big your long doubles are..." >&4
6228         $cat >try.c <<'EOCP'
6229 #include <stdio.h>
6230 int main()
6231 {
6232         printf("%d\n", sizeof(long double));
6233 }
6234 EOCP
6235         set try
6236         set try
6237         if eval $compile; then
6238                 longdblsize=`$run ./try`
6239                 echo "Your long doubles are $longdblsize bytes long."
6240         else
6241                 dflt='8'
6242                 echo " "
6243                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6244                 rp="What is the size of a long double (in bytes)?"
6245                 . ./myread
6246                 longdblsize="$ans"
6247         fi
6248         if $test "X$doublesize" = "X$longdblsize"; then
6249                 echo "That isn't any different from an ordinary double."
6250                 echo "I'll keep your setting anyway, but you may see some"
6251                 echo "harmless compilation warnings."
6252         fi
6253         ;;
6254 esac
6255 $rm_try
6256
6257 : determine the architecture name
6258 echo " "
6259 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6260         tarch=`arch`"-$osname"
6261 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6262         if uname -m > tmparch 2>&1 ; then
6263                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6264                         -e 's/$/'"-$osname/" tmparch`
6265         else
6266                 tarch="$osname"
6267         fi
6268         $rm -f tmparch
6269 else
6270         tarch="$osname"
6271 fi
6272 case "$myarchname" in
6273 ''|"$tarch") ;;
6274 *)
6275         echo "(Your architecture name used to be $myarchname.)"
6276         archname=''
6277         ;;
6278 esac
6279 case "$targetarch" in
6280 '') ;;
6281 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6282 esac
6283 myarchname="$tarch"
6284 case "$archname" in
6285 '') dflt="$tarch";;
6286 *) dflt="$archname";;
6287 esac
6288 rp='What is your architecture name'
6289 . ./myread
6290 archname="$ans"
6291
6292 : optionally add API version to the architecture for versioned archlibs
6293 case "$useversionedarchname" in
6294 $define|true|[yY]*) dflt='y';;
6295 *)                  dflt='n';;
6296 esac
6297 rp='Add the Perl API version to your archname?'
6298 . ./myread
6299 case "$ans" in
6300 y|Y)    useversionedarchname="$define" ;;
6301 *)      useversionedarchname="$undef" ;;
6302 esac
6303 case "$useversionedarchname" in
6304 $define)
6305         case "$archname" in
6306         *-$api_versionstring)
6307                 echo "...and architecture name already has -$api_versionstring" >&4
6308                 ;;
6309         *)
6310                 archname="$archname-$api_versionstring"
6311                 echo "...setting architecture name to $archname." >&4
6312                 ;;
6313         esac
6314         ;;
6315 esac
6316
6317 case "$usethreads" in
6318 $define)
6319         echo "Threads selected." >&4
6320         case "$archname" in
6321         *-thread*) echo "...and architecture name already has -thread." >&4
6322                 ;;
6323         *)      archname="$archname-thread"
6324                 echo "...setting architecture name to $archname." >&4
6325                 ;;
6326         esac
6327         ;;
6328 esac
6329 case "$usemultiplicity" in
6330 $define)
6331         echo "Multiplicity selected." >&4
6332         case "$archname" in
6333         *-multi*) echo "...and architecture name already has -multi." >&4
6334                 ;;
6335         *)      archname="$archname-multi"
6336                 echo "...setting architecture name to $archname." >&4
6337                 ;;
6338         esac
6339         ;;
6340 esac
6341 case "$use64bitint$use64bitall" in
6342 *"$define"*)
6343         case "$archname64" in
6344         '')
6345                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6346                 ;;
6347         *)
6348                 case "$use64bitint" in
6349                 "$define") echo "64 bit integers selected." >&4 ;;
6350                 esac
6351                 case "$use64bitall" in
6352                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6353                 esac
6354                 case "$archname" in
6355                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6356                         ;;
6357                 *)      archname="$archname-$archname64"
6358                         echo "...setting architecture name to $archname." >&4
6359                         ;;
6360                 esac
6361                 ;;
6362         esac
6363 esac
6364 case "$uselongdouble" in
6365 $define)
6366         echo "Long doubles selected." >&4
6367         case "$longdblsize" in
6368         $doublesize)
6369                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6370                 ;;
6371         *)
6372                 case "$archname" in
6373                 *-ld*) echo "...and architecture name already has -ld." >&4
6374                         ;;
6375                 *)      archname="$archname-ld"
6376                         echo "...setting architecture name to $archname." >&4
6377                         ;;
6378                 esac
6379                 ;;
6380         esac
6381         ;;
6382 esac
6383 if $test -f archname.cbu; then
6384         echo "Your platform has some specific hints for architecture name, using them..."
6385         . ./archname.cbu
6386 fi
6387
6388 : set the prefixit variable, to compute a suitable default value
6389 prefixit='case "$3" in
6390 ""|none)
6391         case "$oldprefix" in
6392         "") eval "$1=\"\$$2\"";;
6393         *)
6394                 case "$3" in
6395                 "") eval "$1=";;
6396                 none)
6397                         eval "tp=\"\$$2\"";
6398                         case "$tp" in
6399                         ""|" ") eval "$1=\"\$$2\"";;
6400                         *) eval "$1=";;
6401                         esac;;
6402                 esac;;
6403         esac;;
6404 *)
6405         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6406         case "$tp" in
6407         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6408         /*-$oldprefix/*|\~*-$oldprefix/*)
6409                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6410         *) eval "$1=\"\$$2\"";;
6411         esac;;
6412 esac'
6413
6414 : determine installation style
6415 : For now, try to deduce it from prefix unless it is already set.
6416 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6417 case "$installstyle" in
6418 '')     case "$prefix" in
6419                 *perl*) dflt='lib';;
6420                 *) dflt='lib/perl5' ;;
6421         esac
6422         ;;
6423 *)      dflt="$installstyle" ;;
6424 esac
6425 : Probably not worth prompting for this since we prompt for all
6426 : the directories individually, and the prompt would be too long and
6427 : confusing anyway.
6428 installstyle=$dflt
6429
6430 : determine where public executables go
6431 echo " "
6432 set dflt bin bin
6433 eval $prefixit
6434 fn=d~
6435 rp='Pathname where the public executables will reside?'
6436 . ./getfile
6437 if $test "X$ansexp" != "X$binexp"; then
6438         installbin=''
6439 fi
6440 prefixvar=bin
6441 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6442 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6443 :     this via initialinstalllocation
6444 . ./setprefixvar
6445
6446 case "$userelocatableinc" in
6447 $define|true|[yY]*)     dflt='y' ;;
6448 *)                      dflt='n' ;;
6449 esac
6450 cat <<EOM
6451
6452 Would you like to build Perl so that the installation is relocatable, so that
6453 library paths in @INC are determined relative to the path of the perl binary?
6454 This is not advised for system Perl installs, or if you need to run setid
6455 scripts or scripts under taint mode.
6456
6457 If this doesn't make any sense to you, just accept the default '$dflt'.
6458 EOM
6459 rp='Use relocatable @INC?'
6460 . ./myread
6461 case "$ans" in
6462 y|Y)    val="$define" ;;
6463 *)      val="$undef"  ;;
6464 esac
6465 set userelocatableinc
6466 eval $setvar
6467
6468 initialinstalllocation="$binexp"
6469 : Default prefix is now "up one level from where the binaries are"
6470 case "$userelocatableinc" in
6471 $define|true|[yY]*)
6472     bin=".../"
6473     binexp=".../"
6474     prefix=".../.."
6475     prefixexp=".../.."
6476     installprefixexp=".../.."
6477     ;;
6478 esac
6479
6480 : determine where private library files go
6481 : Usual default is /usr/local/lib/perl5/$version.
6482 : Also allow things like /opt/perl/lib/$version, since
6483 : /opt/perl/lib/perl5... would be redundant.
6484 : The default "style" setting is made in installstyle.U
6485 case "$installstyle" in
6486 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6487 *)       set dflt privlib lib/$version ;;
6488 esac
6489 eval $prefixit
6490 $cat <<EOM
6491
6492 There are some auxiliary files for $package that need to be put into a
6493 private library directory that is accessible by everyone.
6494
6495 EOM
6496 fn=$binexp
6497 fn=d~+
6498 rp='Pathname where the private library files will reside?'
6499 . ./getfile
6500 prefixvar=privlib
6501 . ./setprefixvar
6502
6503 : set the prefixup variable, to restore leading tilda escape
6504 prefixup='case "$prefixexp" in
6505 "$prefix") ;;
6506 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6507 esac'
6508
6509 : determine where public architecture dependent libraries go
6510 set archlib archlib
6511 eval $prefixit
6512 : privlib default is /usr/local/lib/$package/$version
6513 : archlib default is /usr/local/lib/$package/$version/$archname
6514 : privlib may have an optional trailing /share.
6515 tdflt=`echo $privlib | $sed 's,/share$,,'`
6516 tdflt=$tdflt/$archname
6517 case "$archlib" in
6518 '')     dflt=$tdflt
6519         ;;
6520 *)      dflt="$archlib"
6521     ;;
6522 esac
6523 $cat <<EOM
6524
6525 $spackage contains architecture-dependent library files.  If you are
6526 sharing libraries in a heterogeneous environment, you might store
6527 these files in a separate location.  Otherwise, you can just include
6528 them with the rest of the public library files.
6529
6530 EOM
6531 fn=$binexp
6532 fn=d+~
6533 rp='Where do you want to put the public architecture-dependent libraries?'
6534 . ./getfile
6535 prefixvar=archlib
6536 . ./setprefixvar
6537 if $test X"$archlib" = X"$privlib"; then
6538         d_archlib="$undef"
6539 else
6540         d_archlib="$define"
6541 fi
6542
6543 : see if setuid scripts can be secure
6544 $cat <<EOM
6545
6546 Some kernels have a bug that prevents setuid #! scripts from being
6547 secure.  Some sites have disabled setuid #! scripts because of this.
6548
6549 First let's decide if your kernel supports secure setuid #! scripts.
6550 (If setuid #! scripts would be secure but have been disabled anyway,
6551 don't say that they are secure if asked.)
6552
6553 EOM
6554
6555 val="$undef"
6556 if $test -d /dev/fd; then
6557         echo "#!$ls" >reflect
6558         chmod +x,u+s reflect
6559         ./reflect >flect 2>&1
6560         if $contains "/dev/fd" flect >/dev/null; then
6561                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6562                 val="$define"
6563         else
6564                 $cat <<EOM
6565 If you are not sure if they are secure, I can check but I'll need a
6566 username and password different from the one you are using right now.
6567 If you don't have such a username or don't want me to test, simply
6568 enter 'none'.
6569
6570 EOM
6571                 rp='Other username to test security of setuid scripts with?'
6572                 dflt='none'
6573                 . ./myread
6574                 case "$ans" in
6575                 n|none)
6576                         case "$d_suidsafe" in
6577                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6578                                 dflt=n;;
6579                         "$undef")
6580                                 echo "Well, the $hint value is *not* secure." >&4
6581                                 dflt=n;;
6582                         *)      echo "Well, the $hint value *is* secure." >&4
6583                                 dflt=y;;
6584                         esac
6585                         ;;
6586                 *)
6587                         $rm -f reflect flect
6588                         echo "#!$ls" >reflect
6589                         chmod +x,u+s reflect
6590                         echo >flect
6591                         chmod a+w flect
6592                         echo '"su" will (probably) prompt you for '"$ans's password."
6593                         su $ans -c './reflect >flect'
6594                         if $contains "/dev/fd" flect >/dev/null; then
6595                                 echo "Okay, it looks like setuid scripts are secure." >&4
6596                                 dflt=y
6597                         else
6598                                 echo "I don't think setuid scripts are secure." >&4
6599                                 dflt=n
6600                         fi
6601                         ;;
6602                 esac
6603                 rp='Does your kernel have *secure* setuid scripts?'
6604                 . ./myread
6605                 case "$ans" in
6606                 [yY]*)  val="$define";;
6607                 *)      val="$undef";;
6608                 esac
6609         fi
6610 else
6611         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6612         echo "(That's for file descriptors, not floppy disks.)"
6613         val="$undef"
6614 fi
6615 set d_suidsafe
6616 eval $setvar
6617
6618 $rm -f reflect flect
6619
6620 : now see if they want to do setuid emulation
6621 if $test $patchlevel -lt 11; then
6622 echo " "
6623 val="$undef"
6624 case "$d_suidsafe" in
6625 "$define")
6626         val="$undef"
6627         echo "No need to emulate SUID scripts since they are secure here." >&4
6628         ;;
6629 *)
6630         $cat <<EOM
6631 Some systems have disabled setuid scripts, especially systems where
6632 setuid scripts cannot be secure.  On systems where setuid scripts have
6633 been disabled, the setuid/setgid bits on scripts are currently
6634 useless.  It is possible for $package to detect those bits and emulate
6635 setuid/setgid in a secure fashion.  This emulation will only work if
6636 setuid scripts have been disabled in your kernel.
6637
6638 EOM
6639         case "$d_dosuid" in
6640         "$define") dflt=y ;;
6641         *) dflt=n ;;
6642         esac
6643         rp="Do you want to do setuid/setgid emulation?"
6644         . ./myread
6645         case "$ans" in
6646         [yY]*)  val="$define";;
6647         *)      val="$undef";;
6648         esac
6649         ;;
6650 esac
6651 set d_dosuid
6652 eval $setvar
6653 else
6654     case "$d_dosuid" in
6655         "$define")
6656         cat >&4 <<EOH
6657
6658 SUID emulation has been removed for 5.12
6659 Please re-run Configure without -Dd_dosuid
6660
6661 EOH
6662         exit 1;
6663         ;;
6664     esac
6665     d_dosuid=undef
6666 fi
6667
6668 : Find perl5.005 or later.
6669 echo "Looking for a previously installed perl5.005 or later... "
6670 case "$perl5" in
6671 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6672                 : Check if this perl is recent and can load a simple module
6673                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6674                         perl5=$tdir/perl
6675                         break;
6676                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6677                         perl5=$tdir/perl5
6678                         break;
6679                 fi
6680         done
6681         ;;
6682 *)      perl5="$perl5"
6683         ;;
6684 esac
6685 case "$perl5" in
6686 '')     echo "None found.  That's ok.";;
6687 *)      echo "Using $perl5." ;;
6688 esac
6689
6690 : Set the siteprefix variables
6691 $cat <<EOM
6692
6693 After $package is installed, you may wish to install various
6694 add-on modules and utilities.  Typically, these add-ons will
6695 be installed under $prefix with the rest
6696 of this package.  However, you may wish to install such add-ons
6697 elsewhere under a different prefix.
6698
6699 If you do not wish to put everything under a single prefix, that's
6700 ok.  You will be prompted for the individual locations; this siteprefix
6701 is only used to suggest the defaults.
6702
6703 The default should be fine for most people.
6704
6705 EOM
6706 fn=d~+
6707 rp='Installation prefix to use for add-on modules and utilities?'
6708 : XXX Here might be another good place for an installstyle setting.
6709 case "$siteprefix" in
6710 '') dflt=$prefix ;;
6711 *)  dflt=$siteprefix ;;
6712 esac
6713 . ./getfile
6714 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6715 oldsiteprefix=''
6716 case "$siteprefix" in
6717 '') ;;
6718 *)      case "$ans" in
6719         "$prefix") ;;
6720         *) oldsiteprefix="$prefix";;
6721         esac
6722         ;;
6723 esac
6724 siteprefix="$ans"
6725 siteprefixexp="$ansexp"
6726
6727 : determine where site specific libraries go.
6728 : Usual default is /usr/local/lib/perl5/site_perl/$version
6729 : The default "style" setting is made in installstyle.U
6730 : XXX No longer works with Prefixit stuff.
6731 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6732 case "$sitelib" in
6733 '') case "$installstyle" in
6734         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6735         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6736         esac
6737         ;;
6738 *)      dflt="$sitelib"
6739         ;;
6740 esac
6741 $cat <<EOM
6742
6743 The installation process will create a directory for
6744 site-specific extensions and modules.  Most users find it convenient
6745 to place all site-specific files in this directory rather than in the
6746 main distribution directory.
6747
6748 EOM
6749 fn=d~+
6750 rp='Pathname for the site-specific library files?'
6751 . ./getfile
6752 prefixvar=sitelib
6753 . ./setprefixvar
6754 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6755
6756 : Determine list of previous versions to include in @INC
6757 $cat > getverlist <<EOPL
6758 #!$perl5 -w
6759 use File::Basename;
6760 \$api_versionstring = "$api_versionstring";
6761 \$version = "$version";
6762 \$stem = "$sitelib_stem";
6763 \$archname = "$archname";
6764 EOPL
6765         $cat >> getverlist <<'EOPL'
6766 # The list found is store twice for each entry: the original name, and
6767 # the binary broken down version as pack "sss", so sorting is easy and
6768 # unambiguous. This will work for all versions that have a maximum of
6769 # three digit groups, separate by '.'s or '_'s. Names are extended with
6770 # ".0.0" to ensure at least three elements for the pack.
6771 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6772
6773 # Can't have leading @ because metaconfig interprets it as a command!
6774 ;@inc_version_list=();
6775 # XXX Redo to do opendir/readdir?
6776 if (-d $stem) {
6777     chdir($stem);
6778     ;@candidates = map {
6779         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6780     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6781 }
6782 else {
6783     ;@candidates = ();
6784 }
6785
6786 ($pversion, $aversion, $vsn5005) = map {
6787     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6788 foreach $d (@candidates) {
6789     if ($d->[1] lt $pversion) {
6790         if ($d->[1] ge $aversion) {
6791             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6792         }
6793         elsif ($d->[1] ge $vsn5005) {
6794             unshift(@inc_version_list, grep { -d } $d->[0]);
6795         }
6796     }
6797     else {
6798         # Skip newer version.  I.e. don't look in
6799         # 5.7.0 if we're installing 5.6.1.
6800     }
6801 }
6802
6803 if (@inc_version_list) {
6804     print join(' ', @inc_version_list);
6805 }
6806 else {
6807     # Blank space to preserve value for next Configure run.
6808     print " ";
6809 }
6810 EOPL
6811 chmod +x getverlist
6812 case "$inc_version_list" in
6813 '')     if test -x "$perl5$exe_ext"; then
6814                 dflt=`$perl5 getverlist`
6815         else
6816                 dflt='none'
6817         fi
6818         ;;
6819 $undef) dflt='none' ;;
6820 *)  eval dflt=\"$inc_version_list\" ;;
6821 esac
6822 case "$dflt" in
6823 ''|' ') dflt=none ;;
6824 esac
6825 case "$dflt" in
6826 5.005) dflt=none ;;
6827 esac
6828 $cat <<EOM
6829
6830 In order to ease the process of upgrading, this version of perl
6831 can be configured to use modules built and installed with earlier
6832 versions of perl that were installed under $prefix.  Specify here
6833 the list of earlier versions that this version of perl should check.
6834 If Configure detected no earlier versions of perl installed under
6835 $prefix, then the list will be empty.  Answer 'none' to tell perl
6836 to not search earlier versions.
6837
6838 The default should almost always be sensible, so if you're not sure,
6839 just accept the default.
6840 EOM
6841
6842 rp='List of earlier versions to include in @INC?'
6843 . ./myread
6844 case "$ans" in
6845 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6846 *) inc_version_list="$ans" ;;
6847 esac
6848 case "$inc_version_list" in
6849 ''|' ')
6850         inc_version_list_init='0'
6851         d_inc_version_list="$undef"
6852         ;;
6853 *)      inc_version_list_init=`echo $inc_version_list |
6854                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6855         d_inc_version_list="$define"
6856         ;;
6857 esac
6858 $rm -f getverlist
6859
6860 : see if malloc/malloc.h has to be included
6861 set malloc/malloc.h i_mallocmalloc
6862 eval $inhdr
6863
6864 : see if this is a malloc.h system
6865 : we want a real compile instead of Inhdr because some systems have a
6866 : malloc.h that just gives a compile error saying to use stdlib.h instead
6867 echo " "
6868 $cat >try.c <<EOCP
6869 #include <stdlib.h>
6870 #include <malloc.h>
6871 #$i_mallocmalloc I_MALLOCMALLOC
6872 #ifdef I_MALLOCMALLOC
6873 # include <malloc/malloc.h>
6874 #endif
6875
6876 int main () { return 0; }
6877 EOCP
6878 set try
6879 if eval $compile; then
6880     echo "<malloc.h> found." >&4
6881     val="$define"
6882 else
6883     echo "<malloc.h> NOT found." >&4
6884     val="$undef"
6885 fi
6886 $rm_try
6887 set i_malloc
6888 eval $setvar
6889
6890 : check for length of pointer
6891 echo " "
6892 case "$ptrsize" in
6893 '')
6894         echo "Checking to see how big your pointers are..." >&4
6895         $cat >>try.c <<EOCP
6896 #include <stdio.h>
6897 #$i_stdlib I_STDLIB
6898 #ifdef I_STDLIB
6899 #include <stdlib.h>
6900 #endif
6901 int main()
6902 {
6903     printf("%d\n", (int)sizeof(void *));
6904     exit(0);
6905 }
6906 EOCP
6907         set try
6908         if eval $compile_ok; then
6909                 ptrsize=`$run ./try`
6910                 echo "Your pointers are $ptrsize bytes long."
6911         else
6912                 dflt='4'
6913                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6914                 rp="What is the size of a pointer (in bytes)?"
6915                 . ./myread
6916                 ptrsize="$ans"
6917         fi
6918         ;;
6919 esac
6920 $rm_try
6921 case "$use64bitall" in
6922 "$define"|true|[yY]*)
6923         case "$ptrsize" in
6924         4)      cat <<EOM >&4
6925
6926 *** You have chosen a maximally 64-bit build,
6927 *** but your pointers are only 4 bytes wide.
6928 *** Please rerun Configure without -Duse64bitall.
6929 EOM
6930                 case "$d_quad" in
6931                 define)
6932                         cat <<EOM >&4
6933 *** Since you have quads, you could possibly try with -Duse64bitint.
6934 EOM
6935                         ;;
6936                 esac
6937                 cat <<EOM >&4
6938 *** Cannot continue, aborting.
6939
6940 EOM
6941
6942                 exit 1
6943                 ;;
6944         esac
6945         ;;
6946 esac
6947
6948
6949 : determine whether to use malloc wrapping
6950 echo " "
6951 case "$usemallocwrap" in
6952 [yY]*|true|$define)     dflt='y' ;;
6953 [nN]*|false|$undef)     dflt='n' ;;
6954 *)      case "$usedevel" in
6955         [yY]*|true|$define)     dflt='y' ;;
6956         *) dflt='n' ;;
6957         esac
6958         ;;
6959 esac
6960 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6961 . ./myread
6962 usemallocwrap="$ans"
6963 case "$ans" in
6964 y*|true)
6965         usemallocwrap="$define" ;;
6966 *)
6967         usemallocwrap="$undef" ;;
6968 esac
6969
6970 : determine which malloc to compile in
6971 echo " "
6972 case "$usemymalloc" in
6973 [yY]*|true|$define)     dflt='y' ;;
6974 [nN]*|false|$undef)     dflt='n' ;;
6975 *)      case "$ptrsize" in
6976         4) dflt='y' ;;
6977         *) dflt='n' ;;
6978         esac
6979         if test "$useithreads" = "$define"; then dflt='n'; fi
6980         ;;
6981 esac
6982 rp="Do you wish to attempt to use the malloc that comes with $package?"
6983 . ./myread
6984 usemymalloc="$ans"
6985 case "$ans" in
6986 y*|true)
6987         usemymalloc='y'
6988         mallocsrc='malloc.c'
6989         mallocobj="malloc$_o"
6990         d_mymalloc="$define"
6991         case "$libs" in
6992         *-lmalloc*)
6993                 : Remove malloc from list of libraries to use
6994                 echo "Removing unneeded -lmalloc from library list" >&4
6995                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6996                 shift
6997                 libs="$*"
6998                 echo "libs = $libs" >&4
6999                 ;;
7000         esac
7001         ;;
7002 *)
7003         usemymalloc='n'
7004         mallocsrc=''
7005         mallocobj=''
7006         d_mymalloc="$undef"
7007         ;;
7008 esac
7009
7010 : compute the return types of malloc and free
7011 echo " "
7012 $cat >malloc.c <<END
7013 #$i_malloc I_MALLOC
7014 #$i_stdlib I_STDLIB
7015 #include <stdio.h>
7016 #include <sys/types.h>
7017 #ifdef I_MALLOC
7018 #include <malloc.h>
7019 #endif
7020 #ifdef I_STDLIB
7021 #include <stdlib.h>
7022 #endif
7023 #ifdef TRY_MALLOC
7024 void *malloc();
7025 #endif
7026 #ifdef TRY_FREE
7027 void free();
7028 #endif
7029 END
7030 case "$malloctype" in
7031 '')
7032         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7033                 malloctype='void *'
7034         else
7035                 malloctype='char *'
7036         fi
7037         ;;
7038 esac
7039 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7040
7041 case "$freetype" in
7042 '')
7043         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7044                 freetype='void'
7045         else
7046                 freetype='int'
7047         fi
7048         ;;
7049 esac
7050 echo "Your system uses $freetype free(), it would seem." >&4
7051 $rm -f malloc.[co]
7052 : determine where site specific architecture-dependent libraries go.
7053 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7054 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7055 : sitelib may have an optional trailing /share.
7056 case "$sitearch" in
7057 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7058         dflt="$dflt/$archname"
7059         ;;
7060 *)      dflt="$sitearch"
7061         ;;
7062 esac
7063 set sitearch sitearch none
7064 eval $prefixit
7065 $cat <<EOM
7066
7067 The installation process will also create a directory for
7068 architecture-dependent site-specific extensions and modules.
7069
7070 EOM
7071 fn=d~+
7072 rp='Pathname for the site-specific architecture-dependent library files?'
7073 . ./getfile
7074 prefixvar=sitearch
7075 . ./setprefixvar
7076 if $test X"$sitearch" = X"$sitelib"; then
7077         d_sitearch="$undef"
7078 else
7079         d_sitearch="$define"
7080 fi
7081
7082 : Set the vendorprefix variables
7083 $cat <<EOM
7084
7085 The installation process will also create a directory for
7086 vendor-supplied add-ons.  Vendors who supply perl with their system
7087 may find it convenient to place all vendor-supplied files in this
7088 directory rather than in the main distribution directory.  This will
7089 ease upgrades between binary-compatible maintenance versions of perl.
7090
7091 Of course you may also use these directories in whatever way you see
7092 fit.  For example, you might use them to access modules shared over a
7093 company-wide network.
7094
7095 The default answer should be fine for most people.
7096 This causes further questions about vendor add-ons to be skipped
7097 and no vendor-specific directories will be configured for perl.
7098
7099 EOM
7100 rp='Do you want to configure vendor-specific add-on directories?'
7101 case "$usevendorprefix" in
7102 define|true|[yY]*) dflt=y ;;
7103 *)      : User may have set vendorprefix directly on Configure command line.
7104         case "$vendorprefix" in
7105         ''|' ') dflt=n ;;
7106         *)      dflt=y ;;
7107         esac
7108         ;;
7109 esac
7110 . ./myread
7111 case "$ans" in
7112 [yY]*)  fn=d~+
7113         rp='Installation prefix to use for vendor-supplied add-ons?'
7114         case "$vendorprefix" in
7115         '') dflt="$prefix" ;;
7116         *)  dflt=$vendorprefix ;;
7117         esac
7118         . ./getfile
7119         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7120         oldvendorprefix=''
7121         case "$vendorprefix" in
7122         '') ;;
7123         *)      case "$ans" in
7124                 "$prefix") ;;
7125                 *) oldvendorprefix="$prefix";;
7126                 esac
7127                 ;;
7128         esac
7129         usevendorprefix="$define"
7130         vendorprefix="$ans"
7131         vendorprefixexp="$ansexp"
7132         ;;
7133 *)      usevendorprefix="$undef"
7134         vendorprefix=''
7135         vendorprefixexp=''
7136         ;;
7137 esac
7138
7139 : Set the vendorlib variables
7140 case "$vendorprefix" in
7141 '')     d_vendorlib="$undef"
7142         vendorlib=''
7143         vendorlibexp=''
7144         ;;
7145 *)      d_vendorlib="$define"
7146         : determine where vendor-supplied modules go.
7147         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7148         case "$vendorlib" in
7149         '')
7150                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7151                 case "$installstyle" in
7152                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7153                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7154                 esac
7155                 ;;
7156         *)      dflt="$vendorlib"
7157                 ;;
7158         esac
7159         fn=d~+
7160         rp='Pathname for the vendor-supplied library files?'
7161         . ./getfile
7162         vendorlib="$ans"
7163         vendorlibexp="$ansexp"
7164         ;;
7165 esac
7166 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7167 prefixvar=vendorlib
7168 . ./installprefix
7169
7170 : Set the vendorarch variables
7171 case "$vendorprefix" in
7172 '')     d_vendorarch="$undef"
7173         vendorarch=''
7174         vendorarchexp=''
7175         ;;
7176 *)      d_vendorarch="$define"
7177         : determine where vendor-supplied architecture-dependent libraries go.
7178         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7179         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7180         : vendorlib may have an optional trailing /share.
7181         case "$vendorarch" in
7182         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7183                 dflt="$dflt/$archname"
7184                 ;;
7185         *)      dflt="$vendorarch" ;;
7186         esac
7187         fn=d~+
7188         rp='Pathname for vendor-supplied architecture-dependent files?'
7189         . ./getfile
7190         vendorarch="$ans"
7191         vendorarchexp="$ansexp"
7192         ;;
7193 esac
7194 prefixvar=vendorarch
7195 . ./installprefix
7196 if $test X"$vendorarch" = X"$vendorlib"; then
7197         d_vendorarch="$undef"
7198 else
7199         d_vendorarch="$define"
7200 fi
7201
7202 : Final catch-all directories to search
7203 $cat <<EOM
7204
7205 Lastly, you can have perl look in other directories for extensions and
7206 modules in addition to those already specified.
7207 These directories will be searched after
7208         $sitearch
7209         $sitelib
7210 EOM
7211 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7212 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7213 echo ' '
7214 case "$otherlibdirs" in
7215 ''|' ') dflt='none' ;;
7216 *)      dflt="$otherlibdirs" ;;
7217 esac
7218 $cat <<EOM
7219 Enter a colon-separated set of extra paths to include in perl's @INC
7220 search path, or enter 'none' for no extra paths.
7221
7222 EOM
7223
7224 rp='Colon-separated list of additional directories for perl to search?'
7225 . ./myread
7226 case "$ans" in
7227 ' '|''|none)    otherlibdirs=' ' ;;
7228 *)      otherlibdirs="$ans" ;;
7229 esac
7230 case "$otherlibdirs" in
7231 ' ') val=$undef ;;
7232 *)      val=$define ;;
7233 esac
7234 set d_perl_otherlibdirs
7235 eval $setvar
7236
7237 : Cruising for prototypes
7238 echo " "
7239 echo "Checking out function prototypes..." >&4
7240 $cat >prototype.c <<EOCP
7241 #$i_stdlib I_STDLIB
7242 #ifdef I_STDLIB
7243 #include <stdlib.h>
7244 #endif
7245 int main(int argc, char *argv[]) {
7246         exit(0);}
7247 EOCP
7248 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7249         echo "Your C compiler appears to support function prototypes."
7250         val="$define"
7251 else
7252         echo "Your C compiler doesn't seem to understand function prototypes."
7253         val="$undef"
7254 fi
7255 set prototype
7256 eval $setvar
7257 $rm -f prototype*
7258
7259 : Check if ansi2knr is required
7260 case "$prototype" in
7261 "$define") ;;
7262 *)      ansi2knr='ansi2knr'
7263         echo " "
7264         cat <<EOM >&4
7265
7266 $me:  FATAL ERROR:
7267 This version of $package can only be compiled by a compiler that 
7268 understands function prototypes.  Unfortunately, your C compiler 
7269         $cc $ccflags
7270 doesn't seem to understand them.  Sorry about that.
7271
7272 If GNU cc is available for your system, perhaps you could try that instead.  
7273
7274 Eventually, we hope to support building Perl with pre-ANSI compilers.
7275 If you would like to help in that effort, please contact <perlbug@perl.org>.
7276
7277 Aborting Configure now.
7278 EOM
7279         exit 2
7280         ;;
7281 esac
7282
7283 : DTrace support
7284 dflt_dtrace='/usr/sbin/dtrace'
7285 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7286
7287 cat <<EOM
7288
7289 Perl can be built to support DTrace on platforms that support it.
7290 DTrace is a diagnosis and performance analysis tool from Sun.
7291
7292 If this doesn't make any sense to you, just accept the default '$dflt'.
7293 EOM
7294
7295 while $test 1 ; do
7296         case "$usedtrace" in
7297         $define|true|[yY]*)
7298                 dflt='y'
7299                 ;;
7300         ?*)
7301                 dflt='y'
7302                 dflt_dtrace=$usedtrace
7303                 ;;
7304         *)
7305                 dflt='n'
7306                 ;;
7307         esac
7308
7309         rp='Support DTrace if available?'
7310         . ./myread
7311         case "$ans" in
7312         y|Y)    val="$define" ;;
7313         *)      val="$undef" ;;
7314         esac
7315         set usedtrace
7316         eval $setvar
7317
7318         test "X$usedtrace" != "X$define" && break
7319
7320         echo " "
7321         rp='Where is the dtrace executable?'
7322         dflt=$dflt_dtrace
7323         . ./getfile
7324         val="$ans"
7325         set dtrace
7326         eval $setvar
7327
7328         if $test -f $dtrace
7329         then
7330                 if $dtrace -h -s ../perldtrace.d \
7331                         -o perldtrace.tmp >/dev/null 2>&1 \
7332                         && rm -f perldtrace.tmp
7333                 then
7334                         echo " "
7335                         echo "Good: your $dtrace knows about the -h flag."
7336                 else
7337                         cat >&2 <<EOM
7338
7339 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7340 ***
7341 *** Your installed dtrace doesn't support the -h switch to compile a D
7342 *** program into a C header. Can't continue.
7343
7344 EOM
7345                         exit 1
7346                 fi
7347                 break;
7348         fi
7349
7350         case "$fastread" in
7351         yes)
7352                 cat >&2 <<EOM
7353
7354 *** $me:  Fatal Error:  $dtrace not found.
7355 *** Can't continue.
7356
7357 EOM
7358                 exit 1
7359                 ;;
7360         *)
7361                 echo "*** $dtrace was not found."
7362                 echo " "
7363                 ;;
7364         esac
7365 done
7366
7367 : See if we want extra modules installed
7368 echo " "
7369 case "$extras" in
7370 '') dflt='n';;
7371 *) dflt='y';;
7372 esac
7373 cat <<EOM
7374 Perl can be built with extra modules or bundles of modules which
7375 will be fetched from the CPAN and installed alongside Perl.
7376
7377 Notice that you will need access to the CPAN; either via the Internet,
7378 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7379 be asked later to configure the CPAN.pm module which will in turn do
7380 the installation of the rest of the extra modules or bundles.)
7381
7382 Notice also that if the modules require any external software such as
7383 libraries and headers (the libz library and the zlib.h header for the
7384 Compress::Zlib module, for example) you MUST have any such software
7385 already installed, this configuration process will NOT install such
7386 things for you.
7387
7388 If this doesn't make any sense to you, just accept the default '$dflt'.
7389 EOM
7390 rp='Install any extra modules (y or n)?'
7391 . ./myread
7392 case "$ans" in
7393 y|Y)
7394         cat <<EOM
7395
7396 Please list any extra modules or bundles to be installed from CPAN,
7397 with spaces between the names.  The names can be in any format the
7398 'install' command of CPAN.pm will understand.  (Answer 'none',
7399 without the quotes, to install no extra modules or bundles.)
7400 EOM
7401         rp='Extras?'
7402         dflt="$extras"
7403         . ./myread
7404         extras="$ans"
7405 esac
7406 case "$extras" in
7407 ''|'none')
7408         val=''
7409         $rm -f ../extras.lst
7410         ;;
7411 *)      echo "(Saving the list of extras for later...)"
7412         echo "$extras" > ../extras.lst
7413         val="'$extras'"
7414         ;;
7415 esac
7416 set extras
7417 eval $setvar
7418 echo " "
7419
7420 : determine where html pages for programs go
7421 set html1dir html1dir none
7422 eval $prefixit
7423 $cat <<EOM
7424
7425 If you wish to install html files for programs in $spackage, indicate
7426 the appropriate directory here.  To skip installing html files,
7427 answer "none".
7428 EOM
7429 case "$html1dir" in
7430 ''|none|$undef|' ') dflt=none ;;
7431 *) dflt=$html1dir ;;
7432 esac
7433 fn=dn+~
7434 rp="Directory for the main $spackage html pages?"
7435 . ./getfile
7436 prefixvar=html1dir
7437 . ./setprefixvar
7438 : Use ' ' for none so value is preserved next time through Configure
7439 $test X"$html1dir" = "X" && html1dir=' '
7440
7441 : determine where html pages for libraries and modules go
7442 set html3dir html3dir none
7443 eval $prefixit
7444 $cat <<EOM
7445
7446 If you wish to install html files for modules associated with $spackage,
7447 indicate the appropriate directory here.  To skip installing html files,
7448 answer "none".
7449 EOM
7450 : There is no obvious default.  If they have specified html1dir, then
7451 : try to key off that, possibly changing .../html1 into .../html3.
7452 case "$html3dir" in
7453 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7454 *) dflt=$html3dir ;;
7455 esac
7456 fn=dn+~
7457 rp="Directory for the $spackage module html pages?"
7458 . ./getfile
7459 prefixvar=html3dir
7460 . ./setprefixvar
7461 : Use ' ' for none so value is preserved next time through Configure
7462 $test X"$html3dir" = "X" && html3dir=' '
7463
7464 : determine whether to install perl also as /usr/bin/perl
7465
7466 echo " "
7467 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7468         $cat <<EOM
7469 Many scripts expect perl to be installed as /usr/bin/perl.
7470
7471 If you want to, I can install the perl you are about to compile
7472 as /usr/bin/perl (in addition to $bin/perl).
7473 EOM
7474         if test -f /usr/bin/perl; then
7475             $cat <<EOM
7476
7477 However, please note that because you already have a /usr/bin/perl,
7478 overwriting that with a new Perl would very probably cause problems.
7479 Therefore I'm assuming you don't want to do that (unless you insist).
7480
7481 EOM
7482             case "$installusrbinperl" in
7483             "$define"|[yY]*)    dflt='y';;
7484             *)                  dflt='n';;
7485             esac
7486         else
7487             $cat <<EOM
7488
7489 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7490
7491 EOM
7492             case "$installusrbinperl" in
7493             "$undef"|[nN]*)     dflt='n';;
7494             *)                  dflt='y';;
7495             esac
7496         fi
7497         rp="Do you want to install perl as /usr/bin/perl?"
7498         . ./myread
7499         case "$ans" in
7500         [yY]*)  val="$define";;
7501         *)      val="$undef" ;;
7502         esac
7503 else
7504         val="$undef"
7505 fi
7506 set installusrbinperl
7507 eval $setvar
7508
7509 : Check if we are using the GNU C library
7510 echo " "
7511 echo "Checking for GNU C Library..." >&4
7512 cat >try.c <<'EOCP'
7513 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7514    alone are insufficient to distinguish different versions, such as
7515    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7516    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7517 */
7518 #include <stdio.h>
7519 int main(void)
7520 {
7521 #ifdef __GLIBC__
7522 #   ifdef __GLIBC_MINOR__
7523 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7524 #           include <gnu/libc-version.h>
7525             printf("%s\n",  gnu_get_libc_version());
7526 #       else
7527             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7528 #       endif
7529 #   else
7530         printf("%d\n",  __GLIBC__);
7531 #   endif
7532     return 0;
7533 #else
7534     return 1;
7535 #endif
7536 }
7537 EOCP
7538 set try
7539 if eval $compile_ok && $run ./try > glibc.ver; then
7540         val="$define"
7541         gnulibc_version=`$cat glibc.ver`
7542         echo "You are using the GNU C Library version $gnulibc_version"
7543 else
7544         val="$undef"
7545         gnulibc_version=''
7546         echo "You are not using the GNU C Library"
7547 fi
7548 $rm_try glibc.ver
7549 set d_gnulibc
7550 eval $setvar
7551
7552 : see if nm is to be used to determine whether a symbol is defined or not
7553 case "$usenm" in
7554 '')
7555         dflt=''
7556         case "$d_gnulibc" in
7557         "$define")
7558                 echo " "
7559                 echo "nm probably won't work on the GNU C Library." >&4
7560                 dflt=n
7561                 ;;
7562         esac
7563         case "$dflt" in
7564         '')
7565                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7566                         echo " "
7567                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7568                         echo "'nm' won't be sufficient on this system." >&4
7569                         dflt=n
7570                 fi
7571                 ;;
7572         esac
7573         case "$dflt" in
7574         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7575                 if $test $dflt -gt 20; then
7576                         dflt=y
7577                 else
7578                         dflt=n
7579                 fi
7580                 ;;
7581         esac
7582         ;;
7583 *)
7584         case "$usenm" in
7585         true|$define) dflt=y;;
7586         *) dflt=n;;
7587         esac
7588         ;;
7589 esac
7590 $cat <<EOM
7591
7592 I can use $nm to extract the symbols from your C libraries. This
7593 is a time consuming task which may generate huge output on the disk (up
7594 to 3 megabytes) but that should make the symbols extraction faster. The
7595 alternative is to skip the 'nm' extraction part and to compile a small
7596 test program instead to determine whether each symbol is present. If
7597 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7598 this may be the best solution.
7599
7600 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7601
7602 EOM
7603 rp="Shall I use $nm to extract C symbols from the libraries?"
7604 . ./myread
7605 case "$ans" in
7606 [Nn]*) usenm=false;;
7607 *) usenm=true;;
7608 esac
7609
7610 runnm=$usenm
7611 case "$reuseval" in
7612 true) runnm=false;;
7613 esac
7614
7615 : nm options which may be necessary
7616 case "$nm_opt" in
7617 '') if $test -f /mach_boot; then
7618                 nm_opt=''       # Mach
7619         elif $test -d /usr/ccs/lib; then
7620                 nm_opt='-p'     # Solaris (and SunOS?)
7621         elif $test -f /dgux; then
7622                 nm_opt='-p'     # DG-UX
7623         elif $test -f /lib64/rld; then
7624                 nm_opt='-p'     # 64-bit Irix
7625         else
7626                 nm_opt=''
7627         fi;;
7628 esac
7629
7630 : nm options which may be necessary for shared libraries but illegal
7631 : for archive libraries.  Thank you, Linux.
7632 case "$nm_so_opt" in
7633 '')     case "$myuname" in
7634         *linux*|gnu*)
7635                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7636                         nm_so_opt='--dynamic'
7637                 fi
7638                 ;;
7639         esac
7640         ;;
7641 esac
7642
7643 : Figure out where the libc is located
7644 case "$runnm" in
7645 true)
7646 : get list of predefined functions in a handy place
7647 echo " "
7648 case "$libc" in
7649 '') libc=unknown
7650         case "$libs" in
7651         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7652         esac
7653         ;;
7654 esac
7655 case "$libs" in
7656 '') ;;
7657 *)  for thislib in $libs; do
7658         case "$thislib" in
7659         -lc|-lc_s)
7660                 : Handle C library specially below.
7661                 ;;
7662         -l*)
7663                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7664                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7665                         :
7666                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7667                         :
7668                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7669                         :
7670                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7671                         :
7672                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7673                         :
7674                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7675                         :
7676                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7677                         :
7678                 else
7679                         try=''
7680                 fi
7681                 libnames="$libnames $try"
7682                 ;;
7683         *) libnames="$libnames $thislib" ;;
7684         esac
7685         done
7686         ;;
7687 esac
7688 xxx=normal
7689 case "$libc" in
7690 unknown)
7691         set /lib/libc.$so
7692         for xxx in $libpth; do
7693                 $test -r $1 || set $xxx/libc.$so
7694                 : The messy sed command sorts on library version numbers.
7695                 $test -r $1 || \
7696                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7697                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7698                                 h
7699                                 s/[0-9][0-9]*/0000&/g
7700                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7701                                 G
7702                                 s/\n/ /' | \
7703                          $sort | $sed -e 's/^.* //'`
7704                 eval set \$$#
7705         done
7706         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
7707         $test -r $1 || set $sysroot/lib/libsys_s$_a
7708         ;;
7709 *)
7710         set blurfl
7711         ;;
7712 esac
7713 if $test -r "$1"; then
7714         echo "Your (shared) C library seems to be in $1."
7715         libc="$1"
7716 elif $test -r /lib/libc && $test -r /lib/clib; then
7717         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7718         xxx=apollo
7719         libc='/lib/clib /lib/libc'
7720         if $test -r /lib/syslib; then
7721                 echo "(Your math library is in /lib/syslib.)"
7722                 libc="$libc /lib/syslib"
7723         fi
7724 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7725         echo "Your C library seems to be in $libc, as you said before."
7726 elif $test -r $incpath/usr/lib/libc$_a; then
7727         libc=$incpath/usr/lib/libc$_a;
7728         echo "Your C library seems to be in $libc.  That's fine."
7729 elif $test -r /lib/libc$_a; then
7730         libc=/lib/libc$_a;
7731         echo "Your C library seems to be in $libc.  You're normal."
7732 else
7733         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7734                 :
7735         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7736                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7737         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7738                 :
7739         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7740                 :
7741         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7742                 :
7743         else
7744                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7745         fi
7746         if $test -r "$tans"; then
7747                 echo "Your C library seems to be in $tans, of all places."
7748                 libc=$tans
7749         else
7750                 libc='blurfl'
7751         fi
7752 fi
7753 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7754         dflt="$libc"
7755         cat <<EOM
7756
7757 If the guess above is wrong (which it might be if you're using a strange
7758 compiler, or your machine supports multiple models), you can override it here.
7759
7760 EOM
7761 else
7762         dflt=''
7763         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7764         cat >&4 <<EOM
7765 I can't seem to find your C library.  I've looked in the following places:
7766
7767 EOM
7768         $sed 's/^/      /' libpath
7769         cat <<EOM
7770
7771 None of these seems to contain your C library. I need to get its name...
7772
7773 EOM
7774 fi
7775 fn=f
7776 rp='Where is your C library?'
7777 . ./getfile
7778 libc="$ans"
7779
7780 echo " "
7781 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7782 set X `cat libnames`
7783 shift
7784 xxx=files
7785 case $# in 1) xxx=file; esac
7786 echo "Extracting names from the following $xxx for later perusal:" >&4
7787 echo " "
7788 $sed 's/^/      /' libnames >&4
7789 echo " "
7790 $echo $n "This may take a while...$c" >&4
7791
7792 for file in $*; do
7793         case $file in
7794         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7795         *) $nm $nm_opt $file 2>/dev/null;;
7796         esac
7797 done >libc.tmp
7798
7799 $echo $n ".$c"
7800 $grep fprintf libc.tmp > libc.ptf
7801 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7802 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7803 xxx='[ADTSIWi]'
7804 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7805         eval $xscan;\
7806         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7807                 eval $xrun
7808 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7809         eval $xscan;\
7810         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7811                 eval $xrun
7812 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7813         eval $xscan;\
7814         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7815                 eval $xrun
7816 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7817         eval $xscan;\
7818         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7819                 eval $xrun
7820 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7821         eval $xscan;\
7822         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7823                 eval $xrun
7824 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7825         eval $xscan;\
7826         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7827                 eval $xrun
7828 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7829                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7830         eval $xscan;\
7831         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7832                 eval $xrun
7833 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7834         eval $xscan;\
7835         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7836                 eval $xrun
7837 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7838         eval $xscan;\
7839         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7840                 eval $xrun
7841 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7842         eval $xscan;\
7843         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7844                 eval $xrun
7845 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7846         eval $xscan;\
7847         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7848                 eval $xrun
7849 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7850         eval $xscan;\
7851         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7852                 eval $xrun
7853 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7854         eval $xscan;\
7855         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7856                 eval $xrun
7857 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7858         eval $xscan;\
7859         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7860                 eval $xrun
7861 else
7862         $nm -p $* 2>/dev/null >libc.tmp
7863         $grep fprintf libc.tmp > libc.ptf
7864         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7865                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7866         then
7867                 nm_opt='-p'
7868                 eval $xrun
7869         else
7870                 echo " "
7871                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7872                 com=''
7873                 if $ar t $libc > libc.tmp && \
7874                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7875                 then
7876                         for thisname in $libnames $libc; do
7877                                 $ar t $thisname >>libc.tmp
7878                         done
7879                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7880                         echo "Ok." >&4
7881                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7882                         for thisname in $libnames $libc; do
7883                                 $ar tv $thisname >>libc.tmp
7884                                 emximp -o tmp.imp $thisname \
7885                                     2>/dev/null && \
7886                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7887                                     < tmp.imp >>libc.tmp
7888                                 $rm -f tmp.imp
7889                         done
7890                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7891                         echo "Ok." >&4
7892                 else
7893                         echo "$ar didn't seem to work right." >&4
7894                         echo "Maybe this is a Cray...trying bld instead..." >&4
7895                         if  bld t $libc | \
7896                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7897                                 $test -s libc.list
7898                         then
7899                                 for thisname in $libnames; do
7900                                         bld t $libnames | \
7901                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7902                                         $ar t $thisname >>libc.tmp
7903                                 done
7904                                 echo "Ok." >&4
7905                         else
7906                                 echo "That didn't work either.  Giving up." >&4
7907                                 exit 1
7908                         fi
7909                 fi
7910         fi
7911 fi
7912 nm_extract="$com"
7913 case "$PASE" in
7914 define)
7915     echo " "
7916     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7917     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7918     ;;
7919 *)  if $test -f /lib/syscalls.exp; then
7920         echo " "
7921         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7922         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7923                 /lib/syscalls.exp >>libc.list
7924     fi
7925     ;;
7926 esac
7927 ;;
7928 esac
7929 $rm -f libnames libpath
7930
7931 : Check if we are using C++
7932 echo " "
7933 echo "Checking for C++..." >&4
7934 $cat >try.c <<'EOCP'
7935 #include <stdio.h>
7936 int main(void)
7937 {
7938 #ifdef __cplusplus
7939     return 0;
7940 #else
7941     return 1;
7942 #endif
7943 }
7944 EOCP
7945 set try
7946 if eval $compile_ok && $run ./try; then
7947         val="$define"
7948         echo "You are using a C++ compiler."
7949 else
7950         val="$undef"
7951         echo "You are not using a C++ compiler."
7952 fi
7953 $rm_try cplusplus$$
7954 set d_cplusplus
7955 eval $setvar
7956
7957 : is a C symbol defined?
7958 csym='tlook=$1;
7959 case "$3" in
7960 -v) tf=libc.tmp; tdc="";;
7961 -a) tf=libc.tmp; tdc="[]";;
7962 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7963 esac;
7964 case "$d_cplusplus" in
7965     $define)    extern_C="extern \"C\"" ;;
7966     *)          extern_C="extern"       ;;
7967 esac;
7968 tx=yes;
7969 case "$reuseval-$4" in
7970 true-) ;;
7971 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7972 esac;
7973 case "$tx" in
7974 yes)
7975         tval=false;
7976         if $test "$runnm" = true; then
7977                 if $contains $tlook $tf >/dev/null 2>&1; then
7978                         tval=true;
7979                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7980                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
7981                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7982                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7983                         $rm_try;
7984                 fi;
7985         else
7986                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p() && p() != (void *)main) return(0); else return(1); }"> try.c;
7987                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7988                 $rm_try;
7989         fi;
7990         ;;
7991 *)
7992         case "$tval" in
7993         $define) tval=true;;
7994         *) tval=false;;
7995         esac;
7996         ;;
7997 esac;
7998 eval "$2=$tval"'
7999
8000 : define an is-in-libc? function
8001 inlibc='echo " "; td=$define; tu=$undef;
8002 sym=$1; var=$2; eval "was=\$$2";
8003 tx=yes;
8004 case "$reuseval$was" in
8005 true) ;;
8006 true*) tx=no;;
8007 esac;
8008 case "$tx" in
8009 yes)
8010         set $sym tres -f;
8011         eval $csym;
8012         case "$tres" in
8013         true)
8014                 echo "$sym() found." >&4;
8015                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
8016         *)
8017                 echo "$sym() NOT found." >&4;
8018                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
8019         esac;;
8020 *)
8021         case "$was" in
8022         $define) echo "$sym() found." >&4;;
8023         *) echo "$sym() NOT found." >&4;;
8024         esac;;
8025 esac'
8026
8027 : see if dlopen exists
8028 xxx_runnm="$runnm"
8029 xxx_ccflags="$ccflags"
8030 runnm=false
8031 : with g++ one needs -shared to get is-in-libc to work for dlopen
8032 case "$gccversion" in
8033 '')     ;;
8034 *)      case "$d_cplusplus" in
8035         "$define") ccflags="$ccflags -shared" ;;
8036         esac
8037         ;;
8038 esac
8039 set dlopen d_dlopen
8040 eval $inlibc
8041 runnm="$xxx_runnm"
8042 ccflags="$xxx_ccflags"
8043
8044 : see if this is a unistd.h system
8045 set unistd.h i_unistd
8046 eval $inhdr
8047
8048 : determine which dynamic loading, if any, to compile in
8049 echo " "
8050 dldir="ext/DynaLoader"
8051 case "$usedl" in
8052     $define|y|true)
8053         dflt='y'
8054         usedl="$define"
8055         ;;
8056     $undef|n|false)
8057         dflt='n'
8058         usedl="$undef"
8059         ;;
8060     *)
8061         dflt='n'
8062         case "$d_dlopen" in
8063             $define) dflt='y' ;;
8064         esac
8065         : Does a dl_xxx.xs file exist for this operating system
8066         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8067         ;;
8068 esac
8069 rp="Do you wish to use dynamic loading?"
8070 . ./myread
8071 usedl="$ans"
8072 bin_ELF="$undef"
8073 case "$ans" in
8074     y*) usedl="$define"
8075         case "$dlsrc" in
8076             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8077                     dflt="$dldir/dl_${osname}.xs"
8078                 elif $test "$d_dlopen" = "$define" ; then
8079                     dflt="$dldir/dl_dlopen.xs"
8080                 else
8081                     dflt=''
8082                 fi
8083                 ;;
8084             *)  dflt="$dldir/$dlsrc"
8085                 ;;
8086         esac
8087         echo "The following dynamic loading files are available:"
8088         : Can not go over to $dldir because getfile has path hard-coded in.
8089         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8090         rp="Source file to use for dynamic loading"
8091         fn="fne"
8092         gfpth="$src"
8093         . ./getfile
8094         usedl="$define"
8095         : emulate basename
8096         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8097
8098         $cat << EOM
8099
8100 Some systems may require passing special flags to $cc -c to
8101 compile modules that will be used to create a shared library.
8102 To use no flags, say "none".
8103
8104 EOM
8105         case "$cccdlflags" in
8106             '') case "$gccversion" in
8107                 '') case "$osname" in
8108                         hpux)   dflt='+z' ;;
8109                         next)   dflt='none' ;;
8110                         irix*)  dflt='-KPIC' ;;
8111                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8112                         sunos)  dflt='-pic' ;;
8113                         *)      dflt='none' ;;
8114                     esac
8115                     ;;
8116                 *)  case "$osname" in
8117                         darwin) dflt='none' ;;
8118                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8119                         *)      dflt='-fpic' ;;
8120                     esac ;;
8121                 esac ;;
8122             ' ') dflt='none' ;;
8123             *)   dflt="$cccdlflags" ;;
8124         esac
8125
8126         case "$dflt" in
8127             none) dflt='' ;;
8128         esac
8129
8130         # If -Dsysroot was specified, now's the time to add it
8131         # to cccdlflags
8132         if test "X$sysroot" != X; then
8133             case "$gccversion" in
8134                 '') ;;
8135                 *)  case "$dflt" in
8136                         *sysroot*) ;;
8137                         'undef'|*)
8138                             dflt="$dflt --sysroot=$sysroot" ;;
8139                     esac
8140                     ;;
8141             esac
8142         fi
8143
8144         case "$dflt" in
8145             '') dflt='none';;
8146         esac
8147
8148         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8149         . ./myread
8150         case "$ans" in
8151             none) cccdlflags=' ' ;;
8152             *)    cccdlflags="$ans" ;;
8153         esac
8154
8155         cat << EOM
8156
8157 Some systems use ld to create libraries that can be dynamically loaded,
8158 while other systems (such as those using ELF) use $cc.
8159
8160 EOM
8161
8162 : Determine if this is ELF
8163         $cat >try.c <<EOM
8164 /* Test for whether ELF binaries are produced */
8165 #include <fcntl.h>
8166 #$i_stdlib I_STDLIB
8167 #ifdef I_STDLIB
8168 #include <stdlib.h>
8169 #endif
8170 #$i_unistd I_UNISTD
8171 #ifdef I_UNISTD
8172 #include <unistd.h>
8173 #endif
8174 int main() {
8175     char b[4];
8176     int i = open("a.out",O_RDONLY);
8177     if(i == -1)
8178         exit(1); /* fail */
8179     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8180         exit(0); /* succeed (yes, it is ELF) */
8181     exit(1); /* fail */
8182 }
8183 EOM
8184         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8185             bin_ELF="$define"
8186         fi
8187         $rm_try
8188
8189         case "$ld" in
8190             '') if $test $bin_ELF = "$define"; then
8191                     cat <<EOM
8192 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8193 EOM
8194                     dflt="$cc"
8195                 else
8196                     echo "I'll use ld to build dynamic libraries."
8197                     dflt='ld'
8198                 fi
8199                 ;;
8200             *)  dflt="$ld"
8201                 ;;
8202         esac
8203
8204         rp="What command should be used to create dynamic libraries?"
8205         . ./myread
8206         ld="$ans"
8207
8208         cat << EOM
8209
8210 Some systems may require passing special flags to $ld to create a
8211 library that can be dynamically loaded.  If your ld flags include
8212 -L/other/path options to locate libraries outside your loader's normal
8213 search path, you may need to specify those -L options here as well.  To
8214 use no flags, say "none".
8215
8216 EOM
8217         case "$lddlflags" in
8218             '') case "$osname" in
8219                     haiku) dflt='-shared' ;;
8220                     hpux) dflt='-b';
8221                           case "$gccversion" in
8222                               '') dflt="$dflt +vnocompatwarnings" ;;
8223                           esac
8224                           ;;
8225                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8226                     next)  dflt='none' ;;
8227                     solaris) # See [perl #66604].
8228                             # On Solaris 11, gcc -m64 on amd64
8229                             # appears not to understand -G.  gcc versions at
8230                             # least as old as 3.4.3 support -shared, so just
8231                             # use that with Solaris 11 and later, but keep
8232                             # the old behavior for older Solaris versions.
8233                             case "$gccversion" in
8234                                 '') dflt='-G' ;;
8235                                 *)  case "$osvers" in
8236                                         2.?|2.10) dflt='-G' ;;
8237                                         *) dflt='-shared' ;;
8238                                     esac
8239                                     ;;
8240                             esac
8241                             ;;
8242                     sunos) dflt='-assert nodefinitions' ;;
8243                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8244                     *)     dflt='none' ;;
8245                 esac
8246                 ;;
8247             *) dflt="$lddlflags" ;;
8248         esac
8249
8250         : Only do this for gcc, since, for example, qcc has no concept
8251         : of --sysroot.
8252         if $test "X$sysroot" != X; then
8253             case "$gccversion" in
8254                 '') ;;
8255                 *)  dflt="$dflt --sysroot $sysroot" ;;
8256             esac
8257         fi
8258
8259         : Try to guess additional flags to pick up local libraries.
8260         : Be careful not to append to a plain 'none'
8261         case "$dflt" in
8262             none) dflt='' ;;
8263         esac
8264         for thisflag in $ldflags; do
8265             case "$thisflag" in
8266                 -L*|-R*|-Wl,-R*)
8267                     case " $dflt " in
8268                         *" $thisflag "*) ;;
8269                         *) dflt="$dflt $thisflag" ;;
8270                     esac
8271                     ;;
8272             esac
8273         done
8274
8275         case "$dflt" in
8276             ''|' ') dflt='none' ;;
8277         esac
8278
8279         case "$ldflags" in
8280             *-fstack-protector*)
8281                 case "$dflt" in
8282                     *-fstack-protector*) ;; # Don't add it again
8283                     *) dflt="$dflt -fstack-protector" ;;
8284                 esac
8285                 ;;
8286         esac
8287
8288         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8289         . ./myread
8290         case "$ans" in
8291             none) lddlflags=' ' ;;
8292             *) lddlflags="$ans" ;;
8293         esac
8294
8295         cat <<EOM
8296
8297 Some systems may require passing special flags to $cc to indicate that
8298 the resulting executable will use dynamic linking.  To use no flags,
8299 say "none".
8300
8301 EOM
8302         case "$ccdlflags" in
8303             '') case "$osname" in
8304                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8305                     next|sunos)      dflt='none'   ;;
8306                     *)               dflt='none'   ;;
8307                 esac ;;
8308             ' ') dflt='none' ;;
8309             *)   dflt="$ccdlflags" ;;
8310         esac
8311         rp="Any special flags to pass to $cc to use dynamic linking?"
8312         . ./myread
8313         case "$ans" in
8314             none) ccdlflags=' ' ;;
8315             *)    ccdlflags="$ans" ;;
8316         esac
8317         ;;
8318
8319     *)  usedl="$undef"
8320         ld='ld'
8321         dlsrc='dl_none.xs'
8322         lddlflags=''
8323         ccdlflags=''
8324         ;;
8325 esac
8326
8327 ld_can_script="$undef"
8328 case "$bin_ELF$usedl" in
8329     $define$define)
8330         # Abuse try.h and a.out names for neat cleanup
8331         $cat >try.c <<EOM
8332 void foo() {}
8333 void bar() {}
8334 EOM
8335         $cat >try.h <<EOM
8336 LIBTEST_42 {
8337  global:
8338   foo;
8339  local: *;
8340  };
8341 EOM
8342         if $cc $cccdlflags $ccdlflags $ccflags \
8343                $ldflags $lddlflags -o a.out try.c \
8344                -Wl,--version-script=try.h >/dev/null 2>&1 \
8345            &&  $test -s a.out ; then
8346             echo "ld supports scripting" >&4
8347             ld_can_script="$define"
8348         else
8349             echo "ld does not support scripting" >&4
8350         fi
8351         $rm_try
8352         ;;
8353 esac
8354
8355 : Do we want a shared libperl?
8356 also=''
8357 case "$usedl" in
8358 $undef)
8359         # No dynamic loading being used, so don't bother even to prompt.
8360         useshrplib='false'
8361         ;;
8362 *)      case "$useshrplib" in
8363         '')     case "$osname" in
8364                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8365                         dflt=y
8366                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8367                         ;;
8368                 next*)
8369                         case "$osvers" in
8370                         4*)     dflt=y
8371                                 also='Building a shared libperl is needed for MAB support.'
8372                                 ;;
8373                         *)      dflt=n
8374                                 ;;
8375                         esac
8376                         ;;
8377                 *)      dflt=n
8378                         ;;
8379                 esac
8380                 ;;
8381         $define|true|[Yy]*)
8382                 dflt=y
8383                 ;;
8384         *)      dflt=n
8385                 ;;
8386         esac
8387         $cat << EOM
8388
8389 The perl executable is normally obtained by linking perlmain.c with
8390 libperl${_a}, any static extensions (usually just DynaLoader), and
8391 any other libraries needed on this system (such as -lm, etc.).  Since
8392 your system supports dynamic loading, it is probably possible to build
8393 a shared libperl.$so.  If you will have more than one executable linked
8394 to libperl.$so, this will significantly reduce the size of each
8395 executable, but it may have a noticeable effect on performance.  The
8396 default is probably sensible for your system.
8397 $also
8398
8399 EOM
8400         rp="Build a shared libperl.$so (y/n)"
8401         . ./myread
8402         case "$ans" in
8403         true|$define|[Yy]*)
8404                 useshrplib='true'  ;;
8405         *)      useshrplib='false' ;;
8406         esac
8407         ;;
8408 esac
8409
8410 case "$useshrplib" in
8411 true)
8412         case "$userelocatableinc" in
8413         true|define)
8414                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8415                 echo "See INSTALL for an explanation why that won't work." >&4
8416                 exit 4
8417                 ;;
8418         esac
8419         case "$libperl" in
8420         '')
8421                 # Figure out a good name for libperl.so.  Since it gets stored in
8422                 # a version-specific architecture-dependent library, the version
8423                 # number isn't really that important, except for making cc/ld happy.
8424                 #
8425                 # A name such as libperl.so.10.1
8426                 majmin="libperl.$so.$patchlevel.$subversion"
8427                 # A name such as libperl.so.100
8428                 majonly=`echo $patchlevel $subversion |
8429                         $awk '{printf "%d%02d", $1, $2}'`
8430                 majonly=libperl.$so.$majonly
8431                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8432                 # rely on figuring it out from the naming of libc.
8433                 case "${osname}${osvers}" in
8434                 next4*)
8435                         dflt=libperl.5.$so
8436                         # XXX How handle the --version stuff for MAB?
8437                         ;;
8438                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8439                         dflt=libperl.$so
8440                         ;;
8441                 cygwin*) # ld links now against the dll directly
8442                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8443                         majonly=`echo $patchlevel $subversion |
8444                                 $awk '{printf "%03d%03d", $1, $2}'`
8445                         majonly=cygperl5.$majonly.$so
8446                         dflt=$majmin
8447                         ;;
8448                 *)      # Try to guess based on whether libc has major.minor.
8449                         case "$libc" in
8450                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8451                         *libc.$so.[0-9]*) dflt=$majonly ;;
8452                         *)      dflt=libperl.$so ;;
8453                         esac
8454                         ;;
8455                 esac
8456                 ;;
8457         *)      dflt=$libperl
8458                 ;;
8459         esac
8460         cat << EOM
8461
8462 I need to select a good name for the shared libperl.  If your system uses
8463 library names with major and minor numbers, then you might want something
8464 like $majmin.  Alternatively, if your system uses a single version
8465 number for shared libraries, then you might want to use $majonly.
8466 Or, your system might be quite happy with a simple libperl.$so.
8467
8468 Since the shared libperl will get installed into a version-specific
8469 architecture-dependent directory, the version number of the shared perl
8470 library probably isn't important, so the default should be o.k.
8471
8472 EOM
8473         rp='What name do you want to give to the shared libperl?'
8474         . ./myread
8475         libperl=$ans
8476         echo "Ok, I'll use $libperl"
8477         ;;
8478 *)
8479         libperl="libperl${_a}"
8480         ;;
8481 esac
8482
8483 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8484 case "$shrpdir" in
8485 '') ;;
8486 *)      $cat >&4 <<EOM
8487 WARNING:  Use of the shrpdir variable for the installation location of
8488 the shared $libperl is not supported.  It was never documented and
8489 will not work in this version.  Let me (perlbug@perl.org)
8490 know of any problems this may cause.
8491
8492 EOM
8493         case "$shrpdir" in
8494         "$archlibexp/CORE")
8495                 $cat >&4 <<EOM
8496 But your current setting of $shrpdir is
8497 the default anyway, so it's harmless.
8498 EOM
8499                 ;;
8500         *)
8501                 $cat >&4 <<EOM
8502 Further, your current attempted setting of $shrpdir
8503 conflicts with the value of $archlibexp/CORE
8504 that installperl will use.
8505 EOM
8506                 ;;
8507         esac
8508         ;;
8509 esac
8510
8511 # How will the perl executable find the installed shared $libperl?
8512 # Add $xxx to ccdlflags.
8513 # If we can't figure out a command-line option, use $shrpenv to
8514 # set env LD_RUN_PATH.  The main perl makefile uses this.
8515 shrpdir=$archlibexp/CORE
8516 xxx=''
8517 tmp_shrpenv=''
8518 if "$useshrplib"; then
8519     case "$osname" in
8520         aix)
8521                 # We'll set it in Makefile.SH...
8522                 ;;
8523         solaris)
8524                 xxx="-R $shrpdir"
8525                 ;;
8526         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8527                 xxx="-Wl,-R$shrpdir"
8528                 ;;
8529         bsdos|linux|irix*|dec_osf|gnu*)
8530                 xxx="-Wl,-rpath,$shrpdir"
8531                 ;;
8532         next)
8533                 # next doesn't like the default...
8534                 ;;
8535         haiku)
8536                 # Haiku doesn't like the default, either.
8537                 ;;
8538         hpux*)
8539                 # hpux doesn't like the default, either.
8540                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8541                 ;;
8542         cygwin)
8543                 # cygwin needs only ldlibpth
8544                 ;;
8545         *)
8546                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8547                 ;;
8548         esac
8549         case "$xxx" in
8550         '') ;;
8551         *)
8552                 # Only add $xxx if it isn't already in ccdlflags.
8553                 case " $ccdlflags " in
8554                 *" $xxx "*)     ;;
8555                 *)      ccdlflags="$ccdlflags $xxx"
8556                         cat <<EOM >&4
8557
8558 Adding $xxx to the flags
8559 passed to $ld so that the perl executable will find the
8560 installed shared $libperl.
8561
8562 EOM
8563                         ;;
8564                 esac
8565                 ;;
8566         esac
8567 fi
8568 # Fix ccdlflags in AIX for building external extensions.
8569 # (For building Perl itself bare -bE:perl.exp is needed,
8570 #  Makefile.SH takes care of this.)
8571 case "$osname" in
8572 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8573 esac
8574 # Respect a hint or command-line value.
8575 case "$shrpenv" in
8576 '') shrpenv="$tmp_shrpenv" ;;
8577 esac
8578 case "$ldlibpthname" in
8579 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8580 none)   ldlibpthname='' ;;
8581 esac
8582
8583 : determine where manual pages are on this system
8584 echo " "
8585 case "$sysman" in
8586 '')
8587         syspath='/usr/share/man/man1 /usr/man/man1'
8588         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8589         syspath="$syspath /usr/man/u_man/man1"
8590         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8591         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8592         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8593         sysman=`./loc . /usr/man/man1 $syspath`
8594         ;;
8595 esac
8596 if $test -d "$sysman"; then
8597         echo "System manual is in $sysman." >&4
8598 else
8599         echo "Could not find manual pages in source form." >&4
8600 fi
8601
8602 : determine where manual pages go
8603 set man1dir man1dir none
8604 eval $prefixit
8605 $cat <<EOM
8606
8607 $spackage has manual pages available in source form.
8608 EOM
8609 case "$nroff" in
8610 nroff)
8611         echo "However, you don't have nroff, so they're probably useless to you."
8612         case "$man1dir" in
8613         '') man1dir="none";;
8614         esac;;
8615 esac
8616 echo "If you don't want the manual sources installed, answer 'none'."
8617 case "$man1dir" in
8618 ' ') dflt=none
8619         ;;
8620 '')
8621         lookpath="$prefixexp/share/man/man1"
8622         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8623         lookpath="$lookpath $prefixexp/man/p_man/man1"
8624         lookpath="$lookpath $prefixexp/man/u_man/man1"
8625         lookpath="$lookpath $prefixexp/man/man.1"
8626         case "$sysman" in
8627         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8628         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8629         esac
8630         set dflt
8631         eval $prefixup
8632         ;;
8633 *)  dflt="$man1dir"
8634         ;;
8635 esac
8636 echo " "
8637 fn=dn+~
8638 rp="Where do the main $spackage manual pages (source) go?"
8639 . ./getfile
8640 if $test "X$man1direxp" != "X$ansexp"; then
8641         installman1dir=''
8642 fi
8643 prefixvar=man1dir
8644 . ./setprefixvar
8645
8646 case "$man1dir" in
8647 '')     man1dir=' '
8648         installman1dir='';;
8649 esac
8650
8651 : What suffix to use on installed man pages
8652
8653 case "$man1dir" in
8654 ' ')
8655         man1ext='0'
8656         ;;
8657 *)
8658         rp="What suffix should be used for the main $spackage man pages?"
8659         case "$man1ext" in
8660         '')     case "$man1dir" in
8661                 *1)  dflt=1 ;;
8662                 *1p) dflt=1p ;;
8663                 *1pm) dflt=1pm ;;
8664                 *l) dflt=l;;
8665                 *n) dflt=n;;
8666                 *o) dflt=o;;
8667                 *p) dflt=p;;
8668                 *C) dflt=C;;
8669                 *L) dflt=L;;
8670                 *L1) dflt=L1;;
8671                 *) dflt=1;;
8672                 esac
8673                 ;;
8674         *)      dflt="$man1ext";;
8675         esac
8676         . ./myread
8677         man1ext="$ans"
8678         ;;
8679 esac
8680
8681 : see if we can have long filenames
8682 echo " "
8683 first=123456789abcdef
8684 $rm -f $first
8685 if (echo hi >$first) 2>/dev/null; then
8686         if $test -f 123456789abcde; then
8687                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8688                 val="$undef"
8689         else
8690                 echo 'You can have filenames longer than 14 characters.'>&4
8691                 val="$define"
8692         fi
8693 else
8694         $cat <<'EOM'
8695 You can't have filenames longer than 14 chars.
8696 You can't even think about them!
8697 EOM
8698         val="$undef"
8699 fi
8700 set d_flexfnam
8701 eval $setvar
8702 $rm -rf 123456789abcde*
8703
8704 : determine where library module manual pages go
8705 set man3dir man3dir none
8706 eval $prefixit
8707 $cat <<EOM
8708
8709 $spackage has manual pages for many of the library modules.
8710 EOM
8711
8712 case "$nroff" in
8713 nroff)
8714         $cat <<'EOM'
8715 However, you don't have nroff, so they're probably useless to you.
8716 EOM
8717         case "$man3dir" in
8718         '') man3dir="none";;
8719         esac;;
8720 esac
8721
8722 case "$d_flexfnam" in
8723 undef)
8724         $cat <<'EOM'
8725 However, your system can't handle the long file names like File::Basename.3.
8726 EOM
8727         case "$man3dir" in
8728         '') man3dir="none";;
8729         esac;;
8730 esac
8731
8732 echo "If you don't want the manual sources installed, answer 'none'."
8733 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8734 case "$man3dir" in
8735 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8736         if $test -d "$privlib/man/man3"; then
8737                 cat <<EOM >&4
8738
8739 WARNING:  Previous versions of perl installed man3 pages into
8740 $privlib/man/man3.  This version will suggest a
8741 new default of $dflt.
8742 EOM
8743                 tdflt=$dflt
8744                 dflt='n'
8745                 rp='Do you wish to preserve the old behavior?(y/n)'
8746                 . ./myread
8747                 case "$ans" in
8748                 y*) dflt="$privlib/man/man3" ;;
8749                 *)  dflt=$tdflt ;;
8750                 esac
8751     fi
8752         ;;
8753 *)      dflt="$man3dir" ;;
8754 esac
8755 case "$dflt" in
8756 ' ') dflt=none ;;
8757 esac
8758 echo " "
8759 fn=dn+~
8760 rp="Where do the $package library man pages (source) go?"
8761 . ./getfile
8762 prefixvar=man3dir
8763 . ./setprefixvar
8764
8765 case "$man3dir" in
8766 '')     man3dir=' '
8767         installman3dir='';;
8768 esac
8769
8770 : What suffix to use on installed man pages
8771 case "$man3dir" in
8772 ' ')
8773         man3ext='0'
8774         ;;
8775 *)
8776         rp="What suffix should be used for the $package library man pages?"
8777         case "$man3ext" in
8778         '')     case "$man3dir" in
8779                 *3)  dflt=3 ;;
8780                 *3p) dflt=3p ;;
8781                 *3pm) dflt=3pm ;;
8782                 *l) dflt=l;;
8783                 *n) dflt=n;;
8784                 *o) dflt=o;;
8785                 *p) dflt=p;;
8786                 *C) dflt=C;;
8787                 *L) dflt=L;;
8788                 *L3) dflt=L3;;
8789                 *) dflt=3;;
8790                 esac
8791                 ;;
8792         *)      dflt="$man3ext";;
8793         esac
8794         . ./myread
8795         man3ext="$ans"
8796         ;;
8797 esac
8798
8799 : see if we have to deal with yellow pages, now NIS.
8800 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8801         if $test -f /usr/etc/nibindd; then
8802                 echo " "
8803                 echo "I'm fairly confident you're on a NeXT."
8804                 echo " "
8805                 rp='Do you get the hosts file via NetInfo?'
8806                 dflt=y
8807                 case "$hostcat" in
8808                 nidump*) ;;
8809                 '') ;;
8810                 *) dflt=n;;
8811                 esac
8812                 . ./myread
8813                 case "$ans" in
8814                 y*) hostcat='nidump hosts .';;
8815                 *)      case "$hostcat" in
8816                         nidump*) hostcat='';;
8817                         esac
8818                         ;;
8819                 esac
8820         fi
8821         case "$hostcat" in
8822         nidump*) ;;
8823         *)
8824                 case "$hostcat" in
8825                 *ypcat*) dflt=y;;
8826                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8827                                 dflt=y
8828                         else
8829                                 dflt=n
8830                         fi;;
8831                 *) dflt=n;;
8832                 esac
8833                 echo " "
8834                 rp='Are you getting the hosts file via yellow pages?'
8835                 . ./myread
8836                 case "$ans" in
8837                 y*) hostcat='ypcat hosts';;
8838                 *) hostcat='cat /etc/hosts';;
8839                 esac
8840                 ;;
8841         esac
8842 fi
8843 case "$hostcat" in
8844 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8845 esac
8846 case "$groupcat" in
8847 '') test -f /etc/group && groupcat='cat /etc/group';;
8848 esac
8849 case "$passcat" in
8850 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8851 esac
8852
8853 : now get the host name
8854 echo " "
8855 echo "Figuring out host name..." >&4
8856 case "$myhostname" in
8857 '') cont=true
8858         echo 'Maybe "hostname" will work...'
8859         if tans=`sh -c hostname 2>&1` ; then
8860                 myhostname=$tans
8861                 phostname=hostname
8862                 cont=''
8863         fi
8864         ;;
8865 *) cont='';;
8866 esac
8867 if $test "$cont"; then
8868         if ./xenix; then
8869                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8870                 if tans=`cat /etc/systemid 2>&1` ; then
8871                         myhostname=$tans
8872                         phostname='cat /etc/systemid'
8873                         echo "Whadyaknow.  Xenix always was a bit strange..."
8874                         cont=''
8875                 fi
8876         elif $test -r /etc/systemid; then
8877                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8878         fi
8879 fi
8880 if $test "$cont"; then
8881         echo 'No, maybe "uuname -l" will work...'
8882         if tans=`sh -c 'uuname -l' 2>&1` ; then
8883                 myhostname=$tans
8884                 phostname='uuname -l'
8885         else
8886                 echo 'Strange.  Maybe "uname -n" will work...'
8887                 if tans=`sh -c 'uname -n' 2>&1` ; then
8888                         myhostname=$tans
8889                         phostname='uname -n'
8890                 else
8891                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8892                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8893                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8894                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8895                         else
8896                                 case "$myhostname" in
8897                                 '') echo "Does this machine have an identity crisis or something?"
8898                                         phostname='';;
8899                                 *)
8900                                         echo "Well, you said $myhostname before..."
8901                                         phostname='echo $myhostname';;
8902                                 esac
8903                         fi
8904                 fi
8905         fi
8906 fi
8907 case "$myhostname" in
8908 '') myhostname=noname ;;
8909 esac
8910 : you do not want to know about this
8911 set $myhostname
8912 myhostname=$1
8913
8914 : verify guess
8915 if $test "$myhostname" ; then
8916         dflt=y
8917         rp='Your host name appears to be "'$myhostname'".'" Right?"
8918         . ./myread
8919         case "$ans" in
8920         y*) ;;
8921         *) myhostname='';;
8922         esac
8923 fi
8924
8925 : bad guess or no guess
8926 while $test "X$myhostname" = X ; do
8927         dflt=''
8928         rp="Please type the (one word) name of your host:"
8929         . ./myread
8930         myhostname="$ans"
8931 done
8932
8933 : translate upper to lower if necessary
8934 case "$myhostname" in
8935 *[A-Z]*)
8936         echo "(Normalizing case in your host name)"
8937         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8938         ;;
8939 esac
8940
8941 case "$myhostname" in
8942 *.*)
8943         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8944         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8945         echo "(Trimming domain name from host name--host name is now $myhostname)"
8946         ;;
8947 *) case "$mydomain" in
8948         '')
8949                 {
8950                         test "X$hostcat" = "Xypcat hosts" &&
8951                         ypmatch "$myhostname" hosts 2>/dev/null |\
8952                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8953                         $test -s hosts
8954                 } || {
8955                         test "X$hostcat" != "X" &&
8956                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8957                                         /[       ]$myhostname[  . ]/p" > hosts
8958                 }
8959                 tmp_re="[       . ]"
8960                 if $test -f hosts; then
8961                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8962                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8963                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8964                                 hosts | $sort | $uniq | \
8965                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8966                         case `$echo X$dflt` in
8967                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8968                                 dflt=.
8969                                 ;;
8970                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8971                                 ;;
8972                         esac
8973                 else
8974                         echo "(I cannot locate a hosts database anywhere)"
8975                         dflt=.
8976                 fi
8977                 case "$dflt" in
8978                 .)
8979                         tans=`./loc resolv.conf X /etc /usr/etc`
8980                         if $test -f "$tans"; then
8981                                 echo "(Attempting domain name extraction from $tans)"
8982                                 dflt=.`$sed -n -e 's/   / /g' \
8983                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8984                                   -e 1q 2>/dev/null`
8985                                 case "$dflt" in
8986                                 .) dflt=.`$sed -n -e 's/        / /g' \
8987                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8988                                      -e 1q 2>/dev/null`
8989                                         ;;
8990                                 esac
8991                         fi
8992                         ;;
8993                 esac
8994                 case "$dflt" in
8995                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8996                         dflt=.`sh -c domainname 2>/dev/null`
8997                         case "$dflt" in
8998                         '') dflt='.';;
8999                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9000                         esac
9001                         ;;
9002                 esac
9003                 case "$dflt$osname" in
9004                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9005                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9006                         ;;
9007                 esac
9008                 case "$dflt" in
9009                 .) echo "(Lost all hope -- silly guess then)"
9010                         dflt='.nonet'
9011                         ;;
9012                 esac
9013                 $rm -f hosts
9014                 ;;
9015         *) dflt="$mydomain";;
9016         esac;;
9017 esac
9018 echo " "
9019 rp="What is your domain name?"
9020 . ./myread
9021 tans="$ans"
9022 case "$ans" in
9023 '') ;;
9024 .*) ;;
9025 *) tans=".$tans";;
9026 esac
9027 mydomain="$tans"
9028
9029 : translate upper to lower if necessary
9030 case "$mydomain" in
9031 *[A-Z]*)
9032         echo "(Normalizing case in your domain name)"
9033         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9034         ;;
9035 esac
9036
9037 : a little sanity check here
9038 case "$phostname" in
9039 '') ;;
9040 *)
9041         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9042         $myhostname$mydomain|$myhostname) ;;
9043         *)
9044                 case "$phostname" in
9045                 sed*)
9046                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9047                         ;;
9048                 *)
9049                         echo "(That doesn't agree with your $phostname command, by the way.)"
9050                         ;;
9051                 esac
9052         ;;
9053         esac
9054         ;;
9055 esac
9056
9057 : determine the e-mail address of the user who is running us
9058 $cat <<EOM
9059
9060 I need to get your e-mail address in Internet format if possible, i.e.
9061 something like user@host.domain. Please answer accurately since I have
9062 no easy means to double check it. The default value provided below
9063 is most probably close to reality but may not be valid from outside
9064 your organization...
9065
9066 EOM
9067 cont=x
9068 while test "$cont"; do
9069         case "$MAILDOMAIN" in
9070         '')
9071                 if $test -s /etc/mailname; then
9072                         maildomain=`$cat /etc/mailname`
9073                 else
9074                         maildomain="$myhostname$mydomain"
9075                 fi
9076                 ;;
9077         *)  maildomain="$MAILDOMAIN";;
9078         esac
9079         case "$cf_email" in
9080         '') dflt="$cf_by@$maildomain";;
9081         *)  dflt="$cf_email";;
9082         esac
9083         rp='What is your e-mail address?'
9084         . ./myread
9085         cf_email="$ans"
9086         case "$cf_email" in
9087         *@*.*) cont='' ;;
9088         *)
9089                 rp='Address does not look like an Internet one.  Use it anyway?'
9090                 case "$fastread" in
9091                 yes) dflt=y ;;
9092                 *) dflt=n ;;
9093                 esac
9094                 . ./myread
9095                 case "$ans" in
9096                 y*) cont='' ;;
9097                 *) echo " " ;;
9098                 esac
9099                 ;;
9100         esac
9101 done
9102
9103 : Ask e-mail of administrator
9104 $cat <<EOM
9105
9106 If you or somebody else will be maintaining perl at your site, please
9107 fill in the correct e-mail address here so that they may be contacted
9108 if necessary. Currently, the "perlbug" program included with perl
9109 will send mail to this address in addition to perlbug@perl.org. You may
9110 enter "none" for no administrator.
9111
9112 EOM
9113 case "$perladmin" in
9114 '') dflt="$cf_email";;
9115 *) dflt="$perladmin";;
9116 esac
9117 rp='Perl administrator e-mail address'
9118 . ./myread
9119 perladmin="$ans"
9120
9121 : determine whether to only install version-specific parts.
9122 echo " "
9123 $cat <<EOM
9124 Do you want to install only the version-specific parts of the perl
9125 distribution?  Usually you do *not* want to do this.
9126 EOM
9127 case "$versiononly" in
9128 "$define"|[Yy]*|true) dflt='y' ;;
9129 *) dflt='n';
9130 esac
9131 rp="Do you want to install only the version-specific parts of perl?"
9132 . ./myread
9133 case "$ans" in
9134 [yY]*)  val="$define";;
9135 *)      val="$undef" ;;
9136 esac
9137 set versiononly
9138 eval $setvar
9139
9140 case "$versiononly" in
9141 "$define") inc_version_list=''
9142            inc_version_list_init=0
9143            ;;
9144 esac
9145
9146 : figure out how to guarantee perl startup
9147 : XXX Note that this currently takes advantage of the bug that binexp ignores
9148 :     the Configure -Dinstallprefix setting, which in turn means that under
9149 :     relocatable @INC, initialinstalllocation is what binexp started as.
9150 case "$startperl" in
9151 '')
9152         case "$sharpbang" in
9153         *!)
9154                 $cat <<EOH
9155
9156 I can use the #! construct to start perl on your system. This will
9157 make startup of perl scripts faster, but may cause problems if you
9158 want to share those scripts and perl is not in a standard place
9159 ($initialinstalllocation/perl) on all your platforms. The alternative
9160 is to force a shell by starting the script with a single ':' character.
9161
9162 EOH
9163                 case "$versiononly" in
9164                 "$define")      dflt="$initialinstalllocation/perl$version";;
9165                 *)              dflt="$initialinstalllocation/perl";;
9166                 esac
9167                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9168                 . ./myread
9169                 case "$ans" in
9170                 none)   startperl=": # use perl";;
9171                 *)      startperl="#!$ans"
9172                         if $test 30 -lt `echo "$ans" | wc -c`; then
9173                                 $cat >&4 <<EOM
9174
9175 WARNING:  Some systems limit the #! command to 32 characters.
9176 If you experience difficulty running Perl scripts with #!, try
9177 installing Perl in a directory with a shorter pathname.
9178
9179 EOM
9180                         fi ;;
9181                 esac
9182                 ;;
9183         *) startperl=": # use perl"
9184                 ;;
9185         esac
9186         ;;
9187 esac
9188 echo "I'll use $startperl to start perl scripts."
9189
9190 : figure best path for perl in scripts
9191 case "$perlpath" in
9192 '')
9193         case "$versiononly" in
9194         "$define")      perlpath="$initialinstalllocation/perl$version";;
9195         *)              perlpath="$initialinstalllocation/perl";;
9196         esac
9197         case "$startperl" in
9198         *!*) ;;
9199         *)
9200                 $cat <<EOH
9201
9202 I will use the "eval 'exec'" idiom to start Perl on your system.
9203 I can use the full path of your Perl binary for this purpose, but
9204 doing so may cause problems if you want to share those scripts and
9205 Perl is not always in a standard place ($initialinstalllocation/perl).
9206
9207 EOH
9208                 dflt="$initialinstalllocation/perl"
9209                 rp="What path shall I use in \"eval 'exec'\"?"
9210                 . ./myread
9211                 perlpath="$ans"
9212                 ;;
9213         esac
9214         ;;
9215 esac
9216 case "$startperl" in
9217 *!*)    ;;
9218 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9219 esac
9220
9221 : determine where public executable scripts go
9222 set scriptdir scriptdir
9223 eval $prefixit
9224 case "$scriptdir" in
9225 '')
9226         dflt="$bin"
9227         : guess some guesses
9228         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9229         $test -d /usr/share/bin     && dflt=/usr/share/bin
9230         $test -d /usr/local/script  && dflt=/usr/local/script
9231         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9232         $test -d $prefixexp/script  && dflt=$prefixexp/script
9233         set dflt
9234         eval $prefixup
9235         ;;
9236 *)  dflt="$scriptdir"
9237         ;;
9238 esac
9239 $cat <<EOM
9240
9241 Some installations have a separate directory just for executable scripts so
9242 that they can mount it across multiple architectures but keep the scripts in
9243 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9244 Or you might just lump your scripts in with all your other executables.
9245
9246 EOM
9247 fn=d~
9248 rp='Where do you keep publicly executable scripts?'
9249 . ./getfile
9250 if $test "X$ansexp" != "X$scriptdirexp"; then
9251         installscript=''
9252 fi
9253 installscriptdir=''
9254 prefixvar=scriptdir
9255 . ./setprefixvar
9256 : A little fix up for an irregularly named variable.
9257 installscript="$installscriptdir"
9258
9259 : determine where add-on public executables go
9260 case "$sitebin" in
9261 '')     dflt=$siteprefix/bin ;;
9262 *)      dflt=$sitebin ;;
9263 esac
9264 fn=d~
9265 rp='Pathname where the add-on public executables should be installed?'
9266 . ./getfile
9267 prefixvar=sitebin
9268 . ./setprefixvar
9269
9270 : determine where add-on html pages go
9271 : There is no standard location, so try to copy the previously-selected
9272 : directory structure for the core html pages.
9273 case "$sitehtml1dir" in
9274 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9275 *)     dflt=$sitehtml1dir ;;
9276 esac
9277 case "$dflt" in
9278 ''|' ') dflt=none ;;
9279 esac
9280 fn=dn+~
9281 rp='Pathname where the site-specific html pages should be installed?'
9282 . ./getfile
9283 prefixvar=sitehtml1dir
9284 . ./setprefixvar
9285
9286 : determine where add-on library html pages go
9287 : There is no standard location, so try to copy the previously-selected
9288 : directory structure for the core html pages.
9289 case "$sitehtml3dir" in
9290 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9291 *)     dflt=$sitehtml3dir ;;
9292 esac
9293 case "$dflt" in
9294 ''|' ') dflt=none ;;
9295 esac
9296 fn=dn+~
9297 rp='Pathname where the site-specific library html pages should be installed?'
9298 . ./getfile
9299 prefixvar=sitehtml3dir
9300 . ./setprefixvar
9301
9302 : determine where add-on manual pages go
9303 case "$siteman1dir" in
9304 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9305 *)      dflt=$siteman1dir ;;
9306 esac
9307 case "$dflt" in
9308 ''|' ') dflt=none ;;
9309 esac
9310 fn=dn+~
9311 rp='Pathname where the site-specific manual pages should be installed?'
9312 . ./getfile
9313 prefixvar=siteman1dir
9314 . ./setprefixvar
9315
9316 : determine where add-on library man pages go
9317 case "$siteman3dir" in
9318 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9319 *)      dflt=$siteman3dir ;;
9320 esac
9321 case "$dflt" in
9322 ''|' ') dflt=none ;;
9323 esac
9324 fn=dn+~
9325 rp='Pathname where the site-specific library manual pages should be installed?'
9326 . ./getfile
9327 prefixvar=siteman3dir
9328 . ./setprefixvar
9329
9330 : determine where add-on public executable scripts go
9331 case "$sitescript" in
9332 '')     dflt=$siteprefix/script
9333         $test -d $dflt || dflt=$sitebin ;;
9334 *)  dflt="$sitescript" ;;
9335 esac
9336 fn=d~+
9337 rp='Pathname where add-on public executable scripts should be installed?'
9338 . ./getfile
9339 prefixvar=sitescript
9340 . ./setprefixvar
9341
9342 : Check if faststdio is requested and available
9343 case "$usefaststdio" in
9344 $define|true|[yY]*|'')
9345         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9346         case "$xversion" in
9347         [68])   dflt='y' ;;
9348         *)      dflt='n' ;;
9349         esac
9350         ;;
9351 *) dflt='n';;
9352 esac
9353 cat <<EOM
9354
9355 Perl can be built to use 'fast stdio', which means using the stdio
9356 library but also directly manipulating the stdio buffers to enable
9357 faster I/O.  Using stdio is better for backward compatibility (especially
9358 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9359 interface has been preferred instead of stdio.
9360
9361 If this doesn't make any sense to you, just accept the default '$dflt'.
9362 EOM
9363 rp='Use the "fast stdio" if available?'
9364 . ./myread
9365 case "$ans" in
9366 y|Y)    val="$define" ;;
9367 *)      val="$undef" ;;
9368 esac
9369 set usefaststdio
9370 eval $setvar
9371
9372
9373 : define an is-a-typedef? function
9374 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9375 case "$inclist" in
9376 "") inclist="sys/types.h";;
9377 esac;
9378 eval "varval=\$$var";
9379 case "$varval" in
9380 "")
9381         $rm -f temp.c;
9382         for inc in $inclist; do
9383                 echo "#include <$inc>" >>temp.c;
9384         done;
9385         echo "#ifdef $type" >> temp.c;
9386         echo "printf(\"We have $type\");" >> temp.c;
9387         echo "#endif" >> temp.c;
9388         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9389         if $contains $type temp.E >/dev/null 2>&1; then
9390                 eval "$var=\$type";
9391         else
9392                 eval "$var=\$def";
9393         fi;
9394         $rm -f temp.?;;
9395 *) eval "$var=\$varval";;
9396 esac'
9397
9398 : define an is-a-typedef? function that prompts if the type is not available.
9399 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9400 case "$inclist" in
9401 "") inclist="sys/types.h";;
9402 esac;
9403 eval "varval=\$$var";
9404 case "$varval" in
9405 "")
9406         $rm -f temp.c;
9407         for inc in $inclist; do
9408                 echo "#include <$inc>" >>temp.c;
9409         done;
9410         echo "#ifdef $type" >> temp.c;
9411         echo "printf(\"We have $type\");" >> temp.c;
9412         echo "#endif" >> temp.c;
9413         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9414         echo " " ;
9415         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9416         if $contains $type temp.E >/dev/null 2>&1; then
9417                 echo "$type found." >&4;
9418                 eval "$var=\$type";
9419         else
9420                 echo "$type NOT found." >&4;
9421                 dflt="$def";
9422                 . ./myread ;
9423                 eval "$var=\$ans";
9424         fi;
9425         $rm -f temp.?;;
9426 *) eval "$var=\$varval";;
9427 esac'
9428
9429 : see what type lseek is declared as in the kernel
9430 rp="What is the type used for lseek's offset on this system?"
9431 set off_t lseektype long stdio.h sys/types.h
9432 eval $typedef_ask
9433
9434 echo " "
9435 echo "Checking to see how big your file offsets are..." >&4
9436 $cat >try.c <<EOCP
9437 #include <sys/types.h>
9438 #include <stdio.h>
9439 int main()
9440 {
9441     printf("%d\n", (int)sizeof($lseektype));
9442     return(0);
9443 }
9444 EOCP
9445 set try
9446 if eval $compile_ok; then
9447         lseeksize=`$run ./try`
9448         echo "Your file offsets are $lseeksize bytes long."
9449 else
9450         dflt=$longsize
9451         echo " "
9452         echo "(I can't seem to compile the test program.  Guessing...)"
9453         rp="What is the size of your file offsets (in bytes)?"
9454         . ./myread
9455         lseeksize="$ans"
9456 fi
9457 $rm_try
9458
9459 : see what type file positions are declared as in the library
9460 rp="What is the type for file position used by fsetpos()?"
9461 set fpos_t fpostype long stdio.h sys/types.h
9462 eval $typedef_ask
9463
9464 : Check size for Fpos_t
9465 echo " "
9466 case "$fpostype" in
9467 *_t) zzz="$fpostype"    ;;
9468 *)   zzz="fpos_t"       ;;
9469 esac
9470 echo "Checking the size of $zzz..." >&4
9471 cat > try.c <<EOCP
9472 #include <sys/types.h>
9473 #include <stdio.h>
9474 #$i_stdlib I_STDLIB
9475 #ifdef I_STDLIB
9476 #include <stdlib.h>
9477 #endif
9478 int main() {
9479     printf("%d\n", (int)sizeof($fpostype));
9480     exit(0);
9481 }
9482 EOCP
9483 set try
9484 if eval $compile_ok; then
9485         yyy=`$run ./try`
9486         case "$yyy" in
9487         '')     fpossize=4
9488                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9489                 ;;
9490         *)      fpossize=$yyy
9491                 echo "Your $zzz is $fpossize bytes long."
9492                 ;;
9493         esac
9494 else
9495         dflt="$longsize"
9496         echo " " >&4
9497         echo "(I can't compile the test program.  Guessing...)" >&4
9498         rp="What is the size of your file positions (in bytes)?"
9499         . ./myread
9500         fpossize="$ans"
9501 fi
9502
9503 : Check for large file support
9504 # Backward compatibility (uselfs is deprecated).
9505 case "$uselfs" in
9506 "$define"|true|[yY]*)
9507         cat <<EOM >&4
9508
9509 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9510 EOM
9511         uselargefiles="$define"
9512         ;;
9513 esac
9514
9515 case "$lseeksize:$fpossize" in
9516 8:8) cat <<EOM
9517
9518 You can have files larger than 2 gigabytes.
9519 EOM
9520    val="$define" ;;
9521 *)    case "$uselargefiles" in
9522    "$undef"|false|[nN]*) dflt='n' ;;
9523    *)   dflt='y' ;;
9524    esac
9525    cat <<EOM
9526
9527 Perl can be built to understand large files (files larger than 2 gigabytes)
9528 on some systems.  To do so, Configure can be run with -Duselargefiles.
9529
9530 If this doesn't make any sense to you, just accept the default '$dflt'.
9531 EOM
9532    rp='Try to understand large files, if available?'
9533    . ./myread
9534    case "$ans" in
9535    y|Y)         val="$define" ;;
9536    *)           val="$undef"  ;;
9537    esac
9538    ;;
9539 esac
9540 set uselargefiles
9541 eval $setvar
9542 : Look for a hint-file generated 'call-back-unit'.  If the
9543 : user has specified that a large files perl is to be built,
9544 : we may need to set or change some other defaults.
9545 if $test -f uselargefiles.cbu; then
9546         echo "Your platform has some specific hints regarding large file builds, using them..."
9547         . ./uselargefiles.cbu
9548 fi
9549 case "$uselargefiles" in
9550 "$define")
9551         if $test -f uselargefiles.cbu; then
9552                 echo " "
9553                 echo "Rechecking to see how big your file offsets are..." >&4
9554                 $cat >try.c <<EOCP
9555 #include <sys/types.h>
9556 #include <stdio.h>
9557 int main()
9558 {
9559     printf("%d\n", (int)sizeof($lseektype));
9560     return(0);
9561 }
9562 EOCP
9563                 set try
9564                 if eval $compile_ok; then
9565                         lseeksize=`$run ./try`
9566                         $echo "Your file offsets are now $lseeksize bytes long."
9567                 else
9568                         dflt="$lseeksize"
9569                         echo " "
9570                         echo "(I can't seem to compile the test program.  Guessing...)"
9571                         rp="What is the size of your file offsets (in bytes)?"
9572                         . ./myread
9573                         lseeksize="$ans"
9574                 fi
9575                 case "$fpostype" in
9576                 *_t) zzz="$fpostype"    ;;
9577                 *)   zzz="fpos_t"       ;;
9578                 esac
9579                 $echo $n "Rechecking the size of $zzz...$c" >&4
9580                 $cat > try.c <<EOCP
9581 #include <sys/types.h>
9582 #include <stdio.h>
9583 #$i_stdlib I_STDLIB
9584 #ifdef I_STDLIB
9585 #include <stdlib.h>
9586 #endif
9587 int main() {
9588     printf("%d\n", (int)sizeof($fpostype));
9589     return(0);
9590 }
9591 EOCP
9592                 set try
9593                 if eval $compile_ok; then
9594                         yyy=`$run ./try`
9595                         dflt="$lseeksize"
9596                         case "$yyy" in
9597                         '')     echo " "
9598                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9599                                 ;;
9600                         *)      fpossize=$yyy
9601                                 echo " $fpossize bytes." >&4
9602                                 ;;
9603                         esac
9604                 else
9605                         dflt="$fpossize"
9606                         echo " "
9607                         echo "(I can't compile the test program.  Guessing...)" >&4
9608                         rp="What is the size of your file positions (in bytes)?"
9609                         . ./myread
9610                         fpossize="$ans"
9611                 fi
9612                 $rm_try
9613         fi
9614         ;;
9615 esac
9616
9617 : Check if we want perlio
9618 useperlio="$define"
9619
9620 : Set the vendorbin variables
9621 case "$vendorprefix" in
9622 '')     d_vendorbin="$undef"
9623         vendorbin=''
9624         vendorbinexp=''
9625         ;;
9626 *)      d_vendorbin="$define"
9627         : determine where vendor-supplied executables go.
9628         case "$vendorbin" in
9629         '') dflt=$vendorprefix/bin ;;
9630         *)      dflt="$vendorbin" ;;
9631         esac
9632         fn=d~+
9633         rp='Pathname for the vendor-supplied executables directory?'
9634         . ./getfile
9635         vendorbin="$ans"
9636         vendorbinexp="$ansexp"
9637         ;;
9638 esac
9639 prefixvar=vendorbin
9640 . ./installprefix
9641
9642 : Set the vendorhtml1dir variables
9643 case "$vendorprefix" in
9644 '')     vendorhtml1dir=''
9645         vendorhtml1direxp=''
9646         ;;
9647 *)      : determine where vendor-supplied html pages go.
9648         : There is no standard location, so try to copy the previously-selected
9649         : directory structure for the core html pages.
9650         : XXX Better default suggestions would be welcome.
9651         case "$vendorhtml1dir" in
9652         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9653         *)      dflt=$vendorhtml1dir ;;
9654         esac
9655         case "$dflt" in
9656         ''|' ') dflt=none ;;
9657         esac
9658         fn=dn+~
9659         rp='Pathname for the vendor-supplied html pages?'
9660         . ./getfile
9661         vendorhtml1dir="$ans"
9662         vendorhtml1direxp="$ansexp"
9663         ;;
9664 esac
9665 : Use ' ' for none so value is preserved next time through Configure
9666 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9667 prefixvar=vendorhtml1dir
9668 . ./installprefix
9669
9670 : Set the vendorhtml3dir variables
9671 case "$vendorprefix" in
9672 '')     vendorhtml3dir=''
9673         vendorhtml3direxp=''
9674         ;;
9675 *)      : determine where vendor-supplied module html pages go.
9676         : There is no standard location, so try to copy the previously-selected
9677         : directory structure for the core html pages.
9678         : XXX Better default suggestions would be welcome.
9679         case "$vendorhtml3dir" in
9680         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9681         *)      dflt=$vendorhtml3dir ;;
9682         esac
9683         case "$dflt" in
9684         ''|' ') dflt=none ;;
9685         esac
9686         fn=dn+~
9687         rp='Pathname for the vendor-supplied html pages?'
9688         . ./getfile
9689         vendorhtml3dir="$ans"
9690         vendorhtml3direxp="$ansexp"
9691         ;;
9692 esac
9693 : Use ' ' for none so value is preserved next time through Configure
9694 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9695 prefixvar=vendorhtml3dir
9696 . ./installprefix
9697
9698 : Set the vendorman1dir variables
9699 case "$vendorprefix" in
9700 '')     vendorman1dir=''
9701         vendorman1direxp=''
9702         ;;
9703 *)      : determine where vendor-supplied manual pages go.
9704         case "$vendorman1dir" in
9705         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9706         *)      dflt=$vendorman1dir ;;
9707         esac
9708         case "$dflt" in
9709         ''|' ') dflt=none ;;
9710         esac
9711         fn=nd~+
9712         rp='Pathname for the vendor-supplied manual section 1 pages?'
9713         . ./getfile
9714         vendorman1dir="$ans"
9715         vendorman1direxp="$ansexp"
9716         ;;
9717 esac
9718 : Use ' ' for none so value is preserved next time through Configure
9719 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9720 prefixvar=vendorman1dir
9721 . ./installprefix
9722
9723 : Set the vendorman3dir variables
9724 case "$vendorprefix" in
9725 '')     vendorman3dir=''
9726         vendorman3direxp=''
9727         ;;
9728 *)      : determine where vendor-supplied module manual pages go.
9729         case "$vendorman3dir" in
9730         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9731         *)      dflt=$vendorman3dir ;;
9732         esac
9733         case "$dflt" in
9734         ''|' ') dflt=none ;;
9735         esac
9736         fn=nd~+
9737         rp='Pathname for the vendor-supplied manual section 3 pages?'
9738         . ./getfile
9739         vendorman3dir="$ans"
9740         vendorman3direxp="$ansexp"
9741         ;;
9742 esac
9743 : Use ' ' for none so value is preserved next time through Configure
9744 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9745 prefixvar=vendorman3dir
9746 . ./installprefix
9747
9748 : Set the vendorscript variables
9749 case "$vendorprefix" in
9750 '')     d_vendorscript="$undef"
9751         vendorscript=''
9752         vendorscriptexp=''
9753         ;;
9754 *)      d_vendorscript="$define"
9755         : determine where vendor-supplied scripts go.
9756         case "$vendorscript" in
9757         '')     dflt=$vendorprefix/script
9758                 $test -d $dflt || dflt=$vendorbin ;;
9759         *)  dflt="$vendorscript" ;;
9760         esac
9761         $cat <<EOM
9762
9763 The installation process will create a directory for
9764 vendor-supplied scripts.
9765
9766 EOM
9767         fn=d~+
9768         rp='Pathname for the vendor-supplied scripts directory?'
9769         . ./getfile
9770         vendorscript="$ans"
9771         vendorscriptexp="$ansexp"
9772         ;;
9773 esac
9774 prefixvar=vendorscript
9775 . ./installprefix
9776
9777 : script used to emit important warnings
9778 cat >warn <<EOS
9779 $startsh
9780 if test \$# -gt 0; then
9781         echo "\$@" >msg
9782 else
9783         cat >msg
9784 fi
9785 echo "*** WARNING:" >&4
9786 sed -e 's/^/*** /' <msg >&4
9787 echo "*** " >&4
9788 cat msg >>config.msg
9789 echo " " >>config.msg
9790 rm -f msg
9791 EOS
9792 chmod +x warn
9793 $eunicefix warn
9794
9795 : see which of string.h or strings.h is needed
9796 echo " "
9797 strings=`./findhdr string.h`
9798 if $test "$strings" && $test -r "$strings"; then
9799         echo "Using <string.h> instead of <strings.h>." >&4
9800         val="$define"
9801 else
9802         val="$undef"
9803         strings=`./findhdr strings.h`
9804         if $test "$strings" && $test -r "$strings"; then
9805                 echo "Using <strings.h> instead of <string.h>." >&4
9806         else
9807                 ./warn "No string header found -- You'll surely have problems."
9808         fi
9809 fi
9810 set i_string
9811 eval $setvar
9812 case "$i_string" in
9813 "$undef") strings=`./findhdr strings.h`;;
9814 *)        strings=`./findhdr string.h`;;
9815 esac
9816
9817 : see if qgcvt exists
9818 set qgcvt d_qgcvt
9819 eval $inlibc
9820
9821 : Check print/scan long double stuff
9822 echo " "
9823
9824 if $test X"$d_longdbl" = X"$define"; then
9825
9826 echo "Checking how to print long doubles..." >&4
9827
9828 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9829         $cat >try.c <<'EOCP'
9830 #include <sys/types.h>
9831 #include <stdio.h>
9832 int main() {
9833   double d = 123.456;
9834   printf("%.3f\n", d);
9835 }
9836 EOCP
9837         set try
9838         if eval $compile; then
9839                 yyy=`$run ./try`
9840                 case "$yyy" in
9841                 123.456)
9842                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9843                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9844                         echo "We will use %f."
9845                         ;;
9846                 esac
9847         fi
9848 fi
9849
9850 if $test X"$sPRIfldbl" = X; then
9851         $cat >try.c <<'EOCP'
9852 #include <sys/types.h>
9853 #include <stdio.h>
9854 int main() {
9855   long double d = 123.456;
9856   printf("%.3Lf\n", d);
9857 }
9858 EOCP
9859         set try
9860         if eval $compile; then
9861                 yyy=`$run ./try`
9862                 case "$yyy" in
9863                 123.456)
9864                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9865                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9866                         echo "We will use %Lf."
9867                         ;;
9868                 esac
9869         fi
9870 fi
9871
9872 if $test X"$sPRIfldbl" = X; then
9873         $cat >try.c <<'EOCP'
9874 #include <sys/types.h>
9875 #include <stdio.h>
9876 int main() {
9877   long double d = 123.456;
9878   printf("%.3llf\n", d);
9879 }
9880 EOCP
9881         set try
9882         if eval $compile; then
9883                 yyy=`$run ./try`
9884                 case "$yyy" in
9885                 123.456)
9886                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9887                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9888                         echo "We will use %llf."
9889                         ;;
9890                 esac
9891         fi
9892 fi
9893
9894 if $test X"$sPRIfldbl" = X; then
9895         $cat >try.c <<'EOCP'
9896 #include <sys/types.h>
9897 #include <stdio.h>
9898 int main() {
9899   long double d = 123.456;
9900   printf("%.3lf\n", d);
9901 }
9902 EOCP
9903         set try
9904         if eval $compile; then
9905                 yyy=`$run ./try`
9906                 case "$yyy" in
9907                 123.456)
9908                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9909                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9910                         echo "We will use %lf."
9911                         ;;
9912                 esac
9913         fi
9914 fi
9915
9916 if $test X"$sPRIfldbl" = X; then
9917         echo "Cannot figure out how to print long doubles." >&4
9918 else
9919         sSCNfldbl=$sPRIfldbl    # expect consistency
9920 fi
9921
9922 $rm_try
9923
9924 fi # d_longdbl
9925
9926 case "$sPRIfldbl" in
9927 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9928         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9929         d_SCNfldbl="$undef";
9930         ;;
9931 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9932         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9933         d_SCNfldbl="$define";
9934         ;;
9935 esac
9936
9937 : Check how to convert floats to strings.
9938
9939 if test "X$d_Gconvert" = X; then
9940
9941 echo " "
9942 echo "Checking for an efficient way to convert floats to strings."
9943 echo " " > try.c
9944 case "$uselongdouble" in
9945 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9946 esac
9947 case "$d_longdbl" in
9948 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9949 esac
9950 case "$d_PRIgldbl" in
9951 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9952 esac
9953 $cat >>try.c <<EOP
9954 #ifdef TRY_gconvert
9955 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9956 char *myname = "gconvert";
9957 #endif
9958 #ifdef TRY_gcvt
9959 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9960 char *myname = "gcvt";
9961 #endif
9962 #ifdef TRY_qgcvt
9963 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9964 char *myname = "qgcvt";
9965 #define DOUBLETYPE long double
9966 #endif
9967 #ifdef TRY_sprintf
9968 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9969 #ifdef HAS_PRIgldbl
9970 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9971 #else
9972 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9973 #endif
9974 #else
9975 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9976 #endif
9977 char *myname = "sprintf";
9978 #endif
9979
9980 #ifndef DOUBLETYPE
9981 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9982 #define DOUBLETYPE long double
9983 #else
9984 #define DOUBLETYPE double
9985 #endif
9986 #endif
9987
9988 #include <stdio.h>
9989
9990 #$i_stdlib I_STDLIB
9991 #ifdef I_STDLIB
9992 #include <stdlib.h>
9993 #endif
9994 #$i_string I_STRING
9995 #ifdef I_STRING
9996 #  include <string.h>
9997 #else
9998 #  include <strings.h>
9999 #endif
10000
10001 int checkit(char *expect, char *got)
10002 {
10003     if (strcmp(expect, got)) {
10004                 printf("%s oddity:  Expected %s, got %s\n",
10005                         myname, expect, got);
10006                 exit(1);
10007         }
10008 }
10009
10010 int main()
10011 {
10012         char buf[64];
10013         buf[63] = '\0';
10014
10015         /* This must be 1st test on (which?) platform */
10016         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10017         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10018         checkit("0.1", buf);
10019
10020         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10021         checkit("0.01", buf);
10022
10023         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10024         checkit("0.001", buf);
10025
10026         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10027         checkit("0.0001", buf);
10028
10029         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10030         if (strlen(buf) > 5)
10031             checkit("9e-005", buf); /* for Microsoft ?? */
10032         else
10033             checkit("9e-05", buf);
10034
10035         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10036         checkit("1", buf);
10037
10038         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10039         checkit("1.1", buf);
10040
10041         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10042         checkit("1.01", buf);
10043
10044         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10045         checkit("1.001", buf);
10046
10047         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10048         checkit("1.0001", buf);
10049
10050         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10051         checkit("1.00001", buf);
10052
10053         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10054         checkit("1.000001", buf);
10055
10056         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10057         checkit("0", buf);
10058
10059         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10060         checkit("-1", buf);
10061
10062         /* Some Linux gcvt's give 1.e+5 here. */
10063         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10064         checkit("100000", buf);
10065
10066         /* Some Linux gcvt's give -1.e+5 here. */
10067         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10068         checkit("-100000", buf);
10069
10070         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10071         checkit("123.456", buf);
10072
10073         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10074         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10075         /* 34 should be enough to scare even long double
10076          * places into using the e notation. */
10077         if (strlen(buf) > 5)
10078             checkit("1e+034", buf); /* for Microsoft */
10079         else
10080             checkit("1e+34", buf);
10081
10082         /* For Perl, if you add additional tests here, also add them to
10083          * t/base/num.t for benefit of platforms not using Configure or
10084          * overriding d_Gconvert */
10085
10086         exit(0);
10087 }
10088 EOP
10089 : first add preferred functions to our list
10090 xxx_list=""
10091 for xxx_convert in $gconvert_preference; do
10092     case $xxx_convert in
10093     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10094     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10095     esac
10096 done
10097 : then add any others
10098 for xxx_convert in gconvert gcvt sprintf; do
10099     case "$xxx_list" in
10100     *$xxx_convert*) ;;
10101     *) xxx_list="$xxx_list $xxx_convert" ;;
10102     esac
10103 done
10104
10105 case "$d_longdbl$uselongdouble" in
10106 "$define$define")
10107     : again, add preferred functions to our list first
10108     xxx_ld_list=""
10109     for xxx_convert in $gconvert_ld_preference; do
10110         case $xxx_convert in
10111         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10112         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10113         esac
10114     done
10115     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10116     for xxx_convert in qgcvt sprintf $xxx_list; do
10117         case "$xxx_ld_list" in
10118         $xxx_convert*|*" $xxx_convert"*) ;;
10119         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10120         esac
10121     done
10122     : if sprintf cannot do long doubles, move it to the end
10123     if test "$d_PRIgldbl" != "$define"; then
10124         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10125     fi
10126     : if no qgcvt, remove it
10127     if test "$d_qgcvt" != "$define"; then
10128         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10129     fi
10130     : use the ld_list
10131     xxx_list="$xxx_ld_list"
10132     ;;
10133 esac
10134
10135 for xxx_convert in $xxx_list; do
10136         echo "Trying $xxx_convert..."
10137         $rm -f try try$_o core
10138         set try -DTRY_$xxx_convert
10139         if eval $compile; then
10140                 echo "$xxx_convert() found." >&4
10141                 if $run ./try; then
10142                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10143                         break;
10144                 else
10145                         echo "...But $xxx_convert didn't work as I expected."
10146                         xxx_convert=''
10147                 fi
10148         else
10149                 echo "$xxx_convert NOT found." >&4
10150         fi
10151 done
10152
10153 if test X$xxx_convert = X; then
10154     echo "*** WHOA THERE!!! ***" >&4
10155     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10156     xxx_convert=sprintf
10157 fi
10158
10159 case "$xxx_convert" in
10160 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10161 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10162 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10163 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10164    "$define$define$define")
10165       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10166    "$define$define$undef")
10167       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10168    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10169    esac
10170    ;;
10171 esac
10172
10173 fi
10174 $rm_try
10175
10176 : see if _fwalk exists
10177 set fwalk d__fwalk
10178 eval $inlibc
10179
10180 : Initialize h_fcntl
10181 h_fcntl=false
10182
10183 : Initialize h_sysfile
10184 h_sysfile=false
10185
10186 : access call always available on UNIX
10187 set access d_access
10188 eval $inlibc
10189
10190 : locate the flags for 'access()'
10191 case "$d_access" in
10192 "$define")
10193         echo " "
10194         $cat >access.c <<EOCP
10195 #include <sys/types.h>
10196 #ifdef I_FCNTL
10197 #include <fcntl.h>
10198 #endif
10199 #ifdef I_SYS_FILE
10200 #include <sys/file.h>
10201 #endif
10202 #ifdef I_UNISTD
10203 #include <unistd.h>
10204 #endif
10205 #$i_stdlib I_STDLIB
10206 #ifdef I_STDLIB
10207 #include <stdlib.h>
10208 #endif
10209 int main() {
10210         exit(R_OK);
10211 }
10212 EOCP
10213         : check sys/file.h first, no particular reason here
10214         if $test `./findhdr sys/file.h` && \
10215                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10216                 h_sysfile=true;
10217                 echo "<sys/file.h> defines the *_OK access constants." >&4
10218         elif $test `./findhdr fcntl.h` && \
10219                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10220                 h_fcntl=true;
10221                 echo "<fcntl.h> defines the *_OK access constants." >&4
10222         elif $test `./findhdr unistd.h` && \
10223                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10224                 echo "<unistd.h> defines the *_OK access constants." >&4
10225         else
10226                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10227         fi
10228         ;;
10229 esac
10230 $rm -f access*
10231
10232 : see if accessx exists
10233 set accessx d_accessx
10234 eval $inlibc
10235
10236 : see if aintl exists
10237 set aintl d_aintl
10238 eval $inlibc
10239
10240 : see if alarm exists
10241 set alarm d_alarm
10242 eval $inlibc
10243
10244 : see if 64bit time functions exists
10245
10246 set ctime64 d_ctime64
10247 eval $inlibc
10248
10249 set localtime64 d_localtime64
10250 eval $inlibc
10251
10252 set gmtime64 d_gmtime64
10253 eval $inlibc
10254
10255 set mktime64 d_mktime64
10256 eval $inlibc
10257
10258 set difftime64 d_difftime64
10259 eval $inlibc
10260
10261 set asctime64 d_asctime64
10262 eval $inlibc
10263
10264 : see if POSIX threads are available
10265 set pthread.h i_pthread
10266 eval $inhdr
10267
10268 : define a function to check prototypes
10269 $cat > protochk <<EOSH
10270 $startsh
10271 cc="$cc"
10272 optimize="$optimize"
10273 ccflags="$ccflags"
10274 prototype="$prototype"
10275 define="$define"
10276 rm_try="$rm_try"
10277 usethreads=$usethreads
10278 i_pthread=$i_pthread
10279 pthread_h_first=$pthread_h_first
10280 EOSH
10281
10282 $cat >> protochk <<'EOSH'
10283
10284 $rm_try
10285 foo="$1"
10286 shift
10287 while test $# -ge 2; do
10288         case "$1" in
10289                 $define) echo "#include <$2>" >> try.c ;;
10290                 literal) echo "$2" >> try.c ;;
10291         esac
10292     # Extra magic for the benefit of systems that need pthread.h
10293     # to be included early to correctly detect threadsafe functions.
10294     # Such functions must guarantee themselves, though, that the usethreads
10295     # and i_pthread have been defined, before calling protochk.
10296     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10297         echo "#include <pthread.h>" >> try.c
10298         pthread_h_done=yes
10299     fi
10300     shift 2
10301 done
10302 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10303 cat >> try.c <<'EOCP'
10304 #ifdef CAN_PROTOTYPE
10305 #define _(args) args
10306 #else
10307 #define _(args) ()
10308 #endif
10309 EOCP
10310 echo "$foo" >> try.c
10311 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10312 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10313 status=$?
10314 $rm_try
10315 exit $status
10316 EOSH
10317 chmod +x protochk
10318 $eunicefix protochk
10319
10320 : Define hasproto macro for Configure internal use
10321 hasproto='varname=$1; func=$2; shift; shift;
10322 while $test $# -ge 2; do
10323         case "$1" in
10324         $define) echo "#include <$2>";;
10325         esac ;
10326     shift 2;
10327 done > try.c;
10328 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10329 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10330         echo "$func() prototype found.";
10331         val="$define";
10332 else
10333         echo "$func() prototype NOT found.";
10334         val="$undef";
10335 fi;
10336 set $varname;
10337 eval $setvar;
10338 $rm_try tryout.c'
10339
10340 : see if sys/types.h has to be included
10341 set sys/types.h i_systypes
10342 eval $inhdr
10343
10344 : see if sys/select.h has to be included
10345 set sys/select.h i_sysselct
10346 eval $inhdr
10347
10348 : Define hasfield macro for Configure internal use
10349 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10350 while $test $# -ge 2; do
10351         case "$1" in
10352         $define) echo "#include <$2>";;
10353         esac ;
10354     shift 2;
10355 done > try.c;
10356 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10357 set try;
10358 if eval $compile; then
10359         val="$define";
10360 else
10361         val="$undef";
10362 fi;
10363 set $varname;
10364 eval $setvar;
10365 $rm_try'
10366
10367 : see if we should include time.h, sys/time.h, or both
10368 echo " "
10369 if test "X$timeincl" = X; then
10370         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10371         $echo $n "I'm now running the test program...$c"
10372         $cat >try.c <<EOCP
10373 #include <sys/types.h>
10374 #ifdef I_TIME
10375 #include <time.h>
10376 #endif
10377 #ifdef I_SYSTIME
10378 #ifdef SYSTIMEKERNEL
10379 #define KERNEL
10380 #endif
10381 #include <sys/time.h>
10382 #endif
10383 #ifdef I_SYSSELECT
10384 #include <sys/select.h>
10385 #endif
10386 #$i_stdlib I_STDLIB
10387 #ifdef I_STDLIB
10388 #include <stdlib.h>
10389 #endif
10390 int main()
10391 {
10392         struct tm foo;
10393 #ifdef S_TIMEVAL
10394         struct timeval bar;
10395 #endif
10396 #ifdef S_TIMEZONE
10397         struct timezone tzp;
10398 #endif
10399         if (foo.tm_sec == foo.tm_sec)
10400                 exit(0);
10401 #ifdef S_TIMEVAL
10402         if (bar.tv_sec == bar.tv_sec)
10403                 exit(0);
10404 #endif
10405         exit(1);
10406 }
10407 EOCP
10408         flags=''
10409         for s_timezone in '-DS_TIMEZONE' ''; do
10410         sysselect=''
10411         for s_timeval in '-DS_TIMEVAL' ''; do
10412         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10413         for i_time in '' '-DI_TIME'; do
10414         for i_systime in '-DI_SYSTIME' ''; do
10415                 case "$flags" in
10416                 '') $echo $n ".$c"
10417                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10418                         if eval $compile; then
10419                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10420                                 shift
10421                                 flags="$*"
10422                                 echo " "
10423                                 $echo $n "Succeeded with $flags$c"
10424                         fi
10425                         ;;
10426                 esac
10427         done
10428         done
10429         done
10430         done
10431         done
10432         timeincl=''
10433         echo " "
10434         case "$flags" in
10435         *SYSTIMEKERNEL*) i_systimek="$define"
10436                 timeincl=`./findhdr sys/time.h`
10437                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10438         *) i_systimek="$undef";;
10439         esac
10440         case "$flags" in
10441         *I_TIME*) i_time="$define"
10442                 timeincl=`./findhdr time.h`" $timeincl"
10443                 echo "We'll include <time.h>." >&4;;
10444         *) i_time="$undef";;
10445         esac
10446         case "$flags" in
10447         *I_SYSTIME*) i_systime="$define"
10448                 timeincl=`./findhdr sys/time.h`" $timeincl"
10449                 echo "We'll include <sys/time.h>." >&4;;
10450         *) i_systime="$undef";;
10451         esac
10452         $rm_try
10453 fi
10454 : see if struct tm knows about tm_zone
10455 case "$i_systime$i_time" in
10456 *$define*)
10457         echo " "
10458         echo "Checking to see if your struct tm has tm_zone field..." >&4
10459         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10460         eval $hasfield
10461         ;;
10462 *)      val="$undef"
10463         set d_tm_tm_zone
10464         eval $setvar
10465         ;;
10466 esac
10467 case "$d_tm_tm_zone" in
10468 "$define")      echo "Yes, it does."   ;;
10469 *)              echo "No, it doesn't." ;;
10470 esac
10471 : see if struct tm knows about tm_gmtoff
10472 case "$i_systime$i_time" in
10473 *$define*)
10474         echo " "
10475         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10476         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10477         eval $hasfield
10478         ;;
10479 *)      val="$undef"
10480         set d_tm_tm_gmtoff
10481         eval $setvar
10482         ;;
10483 esac
10484 case "$d_tm_tm_gmtoff" in
10485 "$define")      echo "Yes, it does."   ;;
10486 *)              echo "No, it doesn't." ;;
10487 esac
10488
10489 : see if asctime_r exists
10490 set asctime_r d_asctime_r
10491 eval $inlibc
10492 case "$d_asctime_r" in
10493 "$define")
10494         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10495         case "$d_asctime_r_proto:$usethreads" in
10496         ":define")      d_asctime_r_proto=define
10497                 set d_asctime_r_proto asctime_r $hdrs
10498                 eval $hasproto ;;
10499         *)      ;;
10500         esac
10501         case "$d_asctime_r_proto" in
10502         define)
10503         case "$asctime_r_proto" in
10504         ''|0) try='char* asctime_r(const struct tm*, char*);'
10505         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10506         esac
10507         case "$asctime_r_proto" in
10508         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10509         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10510         esac
10511         case "$asctime_r_proto" in
10512         ''|0) try='int asctime_r(const struct tm*, char*);'
10513         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10514         esac
10515         case "$asctime_r_proto" in
10516         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10517         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10518         esac
10519         case "$asctime_r_proto" in
10520         ''|0)   d_asctime_r=undef
10521                 asctime_r_proto=0
10522                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10523         * )     case "$asctime_r_proto" in
10524                 REENTRANT_PROTO*) ;;
10525                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10526                 esac
10527                 echo "Prototype: $try" ;;
10528         esac
10529         ;;
10530         *)      case "$usethreads" in
10531                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10532                 esac
10533                 d_asctime_r=undef
10534                 asctime_r_proto=0
10535                 ;;
10536         esac
10537         ;;
10538 *)      asctime_r_proto=0
10539         ;;
10540 esac
10541
10542 : see if atolf exists
10543 set atolf d_atolf
10544 eval $inlibc
10545
10546 : see if atoll exists
10547 set atoll d_atoll
10548 eval $inlibc
10549
10550 : Look for GCC-style attribute format
10551 case "$d_attribute_format" in
10552 '')
10553 echo " "
10554 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10555 $cat >attrib.c <<'EOCP'
10556 #include <stdio.h>
10557 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10558 EOCP
10559 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10560         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10561                 echo "Your C compiler doesn't support __attribute__((format))."
10562                 val="$undef"
10563         else
10564                 echo "Your C compiler supports __attribute__((format))."
10565                 val="$define"
10566         fi
10567 else
10568         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10569         val="$undef"
10570 fi
10571 ;;
10572 *) val="$d_attribute_format" ;;
10573 esac
10574 set d_attribute_format
10575 eval $setvar
10576 $rm -f attrib*
10577
10578 : Look for GCC-style attribute format with null format allowed
10579 case "$d_printf_format_null" in
10580 '') case "$d_attribute_format" in
10581     $define)
10582         echo " "
10583         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10584 $cat >attrib.c <<EOCP
10585 #include <stdio.h>
10586 #$i_stdlib I_STDLIB
10587 #ifdef I_STDLIB
10588 #include <stdlib.h>
10589 #endif
10590 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10591 int null_printf (char* pat,...) { return (int)pat; }
10592 int main () { exit(null_printf(NULL)); }
10593 EOCP
10594         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10595             : run the executable in case it produces a run-time warning
10596             if $run ./attrib >>attrib.out 2>&1; then
10597                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10598                     echo "Your C compiler doesn't allow __printf__ format to be null."
10599                     val="$undef"
10600                 else
10601                     echo "Your C compiler allows __printf__ format to be null."
10602                     val="$define"
10603                 fi
10604             else
10605             echo "Your C compiler executable failed with __printf__ format null."
10606             val="$undef"
10607         fi
10608     else
10609         echo "Your C compiler fails with __printf__ format null."
10610         val="$undef"
10611     fi
10612     ;;
10613     *)  val="$undef" ;;
10614     esac
10615 ;;
10616 *)  val="$d_printf_format_null" ;;
10617 esac
10618 set d_printf_format_null
10619 eval $setvar
10620 $rm -f attrib*
10621
10622 : Look for GCC-style attribute malloc
10623 case "$d_attribute_malloc" in
10624 '')
10625 echo " "
10626 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10627 $cat >attrib.c <<'EOCP'
10628 #include <stdio.h>
10629 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10630 EOCP
10631 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10632         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10633                 echo "Your C compiler doesn't support __attribute__((malloc))."
10634                 val="$undef"
10635         else
10636                 echo "Your C compiler supports __attribute__((malloc))."
10637                 val="$define"
10638         fi
10639 else
10640         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10641         val="$undef"
10642 fi
10643 ;;
10644 *) val="$d_attribute_malloc" ;;
10645 esac
10646 set d_attribute_malloc
10647 eval $setvar
10648 $rm -f attrib*
10649
10650 : Look for GCC-style attribute nonnull
10651 case "$d_attribute_nonnull" in
10652 '')
10653 echo " "
10654 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10655 $cat >attrib.c <<'EOCP'
10656 #include <stdio.h>
10657 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10658 EOCP
10659 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10660         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10661                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10662                 val="$undef"
10663         else
10664                 echo "Your C compiler supports __attribute__((nonnull))."
10665                 val="$define"
10666         fi
10667 else
10668         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10669         val="$undef"
10670 fi
10671 ;;
10672 *) val="$d_attribute_nonnull" ;;
10673 esac
10674 set d_attribute_nonnull
10675 eval $setvar
10676 $rm -f attrib*
10677
10678 : Look for GCC-style attribute noreturn
10679 case "$d_attribute_noreturn" in
10680 '')
10681 echo " "
10682 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10683 $cat >attrib.c <<'EOCP'
10684 #include <stdio.h>
10685 void fall_over_dead( void ) __attribute__((noreturn));
10686 EOCP
10687 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10688         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10689                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10690                 val="$undef"
10691         else
10692                 echo "Your C compiler supports __attribute__((noreturn))."
10693                 val="$define"
10694         fi
10695 else
10696         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10697         val="$undef"
10698 fi
10699 ;;
10700 *) val="$d_attribute_noreturn" ;;
10701 esac
10702 set d_attribute_noreturn
10703 eval $setvar
10704 $rm -f attrib*
10705
10706 : Look for GCC-style attribute pure
10707 case "$d_attribute_pure" in
10708 '')
10709 echo " "
10710 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10711 $cat >attrib.c <<'EOCP'
10712 #include <stdio.h>
10713 int square( int n ) __attribute__((pure));
10714 EOCP
10715 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10716         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10717                 echo "Your C compiler doesn't support __attribute__((pure))."
10718                 val="$undef"
10719         else
10720                 echo "Your C compiler supports __attribute__((pure))."
10721                 val="$define"
10722         fi
10723 else
10724         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10725         val="$undef"
10726 fi
10727 ;;
10728 *) val="$d_attribute_pure" ;;
10729 esac
10730 set d_attribute_pure
10731 eval $setvar
10732 $rm -f attrib*
10733
10734 : Look for GCC-style attribute unused
10735 case "$d_attribute_unused" in
10736 '')
10737 echo " "
10738 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10739 $cat >attrib.c <<'EOCP'
10740 #include <stdio.h>
10741 int do_something( int dummy __attribute__((unused)), int n );
10742 EOCP
10743 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10744         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10745                 echo "Your C compiler doesn't support __attribute__((unused))."
10746                 val="$undef"
10747         else
10748                 echo "Your C compiler supports __attribute__((unused))."
10749                 val="$define"
10750         fi
10751 else
10752         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10753         val="$undef"
10754 fi
10755 ;;
10756 *) val="$d_attribute_unused" ;;
10757 esac
10758 set d_attribute_unused
10759 eval $setvar
10760 $rm -f attrib*
10761
10762 : Look for GCC-style attribute deprecated
10763 case "$d_attribute_deprecated" in
10764 '')
10765 echo " "
10766 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10767 $cat >attrib.c <<'EOCP'
10768 #include <stdio.h>
10769 int I_am_deprecated(void) __attribute__((deprecated));
10770 EOCP
10771 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10772         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10773                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10774                 val="$undef"
10775         else
10776                 echo "Your C compiler supports __attribute__((deprecated))."
10777                 val="$define"
10778         fi
10779 else
10780         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10781         val="$undef"
10782 fi
10783 ;;
10784 *) val="$d_attribute_deprecated" ;;
10785 esac
10786 set d_attribute_deprecated
10787 eval $setvar
10788 $rm -f attrib*
10789
10790 : Look for GCC-style attribute warn_unused_result
10791 case "$d_attribute_warn_unused_result" in
10792 '')
10793 echo " "
10794 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10795 $cat >attrib.c <<'EOCP'
10796 #include <stdio.h>
10797 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10798 EOCP
10799 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10800         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10801                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10802                 val="$undef"
10803         else
10804                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10805                 val="$define"
10806         fi
10807 else
10808         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10809         val="$undef"
10810 fi
10811 ;;
10812 *) val="$d_attribute_warn_unused_result" ;;
10813 esac
10814 set d_attribute_warn_unused_result
10815 eval $setvar
10816 $rm -f attrib*
10817
10818 : see if bcmp exists
10819 set bcmp d_bcmp
10820 eval $inlibc
10821
10822 : see if bcopy exists
10823 set bcopy d_bcopy
10824 eval $inlibc
10825
10826 : see if getpgrp exists
10827 set getpgrp d_getpgrp
10828 eval $inlibc
10829
10830 case "$d_getpgrp" in
10831 "$define")
10832         echo " "
10833         echo "Checking to see which flavor of getpgrp is in use..."
10834         $cat >try.c <<EOP
10835 #$i_unistd I_UNISTD
10836 #include <sys/types.h>
10837 #ifdef I_UNISTD
10838 #  include <unistd.h>
10839 #endif
10840 #$i_stdlib I_STDLIB
10841 #ifdef I_STDLIB
10842 #include <stdlib.h>
10843 #endif
10844 int main()
10845 {
10846         if (getuid() == 0) {
10847                 printf("(I see you are running Configure as super-user...)\n");
10848                 setuid(1);
10849         }
10850 #ifdef TRY_BSD_PGRP
10851         if (getpgrp(1) == 0)
10852                 exit(0);
10853 #else
10854         if (getpgrp() > 0)
10855                 exit(0);
10856 #endif
10857         exit(1);
10858 }
10859 EOP
10860         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10861                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10862                 val="$define"
10863         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10864                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10865                 val="$undef"
10866         else
10867                 echo "I can't seem to compile and run the test program."
10868                 if ./usg; then
10869                         xxx="a USG one, i.e. you use getpgrp()."
10870                 else
10871                         # SVR4 systems can appear rather BSD-ish.
10872                         case "$i_unistd" in
10873                         $undef)
10874                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10875                                 val="$define"
10876                                 ;;
10877                         $define)
10878                                 xxx="probably a USG one, i.e. you use getpgrp()."
10879                                 val="$undef"
10880                                 ;;
10881                         esac
10882                 fi
10883                 echo "Assuming your getpgrp is $xxx" >&4
10884         fi
10885         ;;
10886 *) val="$undef";;
10887 esac
10888 set d_bsdgetpgrp
10889 eval $setvar
10890 $rm_try
10891
10892 : see if setpgrp exists
10893 set setpgrp d_setpgrp
10894 eval $inlibc
10895
10896 case "$d_setpgrp" in
10897 "$define")
10898         echo " "
10899         echo "Checking to see which flavor of setpgrp is in use..."
10900         $cat >try.c <<EOP
10901 #$i_unistd I_UNISTD
10902 #include <sys/types.h>
10903 #ifdef I_UNISTD
10904 #  include <unistd.h>
10905 #endif
10906 #$i_stdlib I_STDLIB
10907 #ifdef I_STDLIB
10908 #include <stdlib.h>
10909 #endif
10910 int main()
10911 {
10912         if (getuid() == 0) {
10913                 printf("(I see you are running Configure as super-user...)\n");
10914                 setuid(1);
10915         }
10916 #ifdef TRY_BSD_PGRP
10917         if (-1 == setpgrp(1, 1))
10918                 exit(0);
10919 #else
10920         if (setpgrp() != -1)
10921                 exit(0);
10922 #endif
10923         exit(1);
10924 }
10925 EOP
10926         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10927                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10928                 val="$define"
10929         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10930                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10931                 val="$undef"
10932         else
10933                 echo "(I can't seem to compile and run the test program.)"
10934                 if ./usg; then
10935                         xxx="a USG one, i.e. you use setpgrp()."
10936                 else
10937                         # SVR4 systems can appear rather BSD-ish.
10938                         case "$i_unistd" in
10939                         $undef)
10940                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10941                                 val="$define"
10942                                 ;;
10943                         $define)
10944                                 xxx="probably a USG one, i.e. you use setpgrp()."
10945                                 val="$undef"
10946                                 ;;
10947                         esac
10948                 fi
10949                 echo "Assuming your setpgrp is $xxx" >&4
10950         fi
10951         ;;
10952 *) val="$undef";;
10953 esac
10954 set d_bsdsetpgrp
10955 eval $setvar
10956 $rm_try
10957
10958 : Look for GCC-style __builtin_choose_expr
10959 case "$d_builtin_choose_expr" in
10960 '')
10961     echo " "
10962     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10963     $cat >try.c <<'EOCP'
10964 #include <assert.h>
10965 #include <stdlib.h>
10966 #include <stdio.h>
10967
10968 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10969
10970 int main(void) {
10971     assert( SYRINX(1) == 2112 );
10972     assert( SYRINX(1) != 5150 );
10973     assert( SYRINX(0) == 5150 );
10974     assert( SYRINX(0) != 2112 );
10975     puts( "All good!" );
10976     exit(0);
10977 }
10978
10979 EOCP
10980     set try
10981     if eval $compile && $run ./try; then
10982         echo "Your C compiler supports __builtin_choose_expr."
10983         val="$define"
10984     else
10985         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10986         val="$undef"
10987     fi
10988 ;;
10989 *) val="$d_builtin_choose_expr" ;;
10990 esac
10991
10992 set d_builtin_choose_expr
10993 eval $setvar
10994 $rm_try
10995
10996 : Look for GCC-style __builtin_expect
10997 case "$d_builtin_expect" in
10998 '')
10999     echo " "
11000     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11001     $cat >try.c <<'EOCP'
11002 int main(void) {
11003     int n = 50;
11004     if ( __builtin_expect(n, 0) ) n = 1;
11005     /* Remember shell exit code truth is 0, C truth is non-zero */
11006     return !(n == 1);
11007 }
11008 EOCP
11009     set try
11010     if eval $compile && $run ./try; then
11011         echo "Your C compiler supports __builtin_expect."
11012         val="$define"
11013     else
11014         echo "Your C compiler doesn't seem to understand __builtin_expect."
11015         val="$undef"
11016     fi
11017     ;;
11018 *) val="$d_builtin_expect" ;;
11019 esac
11020
11021 set d_builtin_expect
11022 eval $setvar
11023 $rm_try
11024
11025 : see if bzero exists
11026 set bzero d_bzero
11027 eval $inlibc
11028
11029 : see if stdarg is available
11030 echo " "
11031 if $test `./findhdr stdarg.h`; then
11032         echo "<stdarg.h> found." >&4
11033         valstd="$define"
11034 else
11035         echo "<stdarg.h> NOT found." >&4
11036         valstd="$undef"
11037 fi
11038
11039 : see if varargs is available
11040 echo " "
11041 if $test `./findhdr varargs.h`; then
11042         echo "<varargs.h> found." >&4
11043 else
11044         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11045 fi
11046
11047 : set up the varargs testing programs
11048 $cat > varargs.c <<EOP
11049 #ifdef I_STDARG
11050 #include <stdarg.h>
11051 #endif
11052 #ifdef I_VARARGS
11053 #include <varargs.h>
11054 #endif
11055
11056 #ifdef I_STDARG
11057 int f(char *p, ...)
11058 #else
11059 int f(va_alist)
11060 va_dcl
11061 #endif
11062 {
11063         va_list ap;
11064 #ifndef I_STDARG
11065         char *p;
11066 #endif
11067 #ifdef I_STDARG
11068         va_start(ap,p);
11069 #else
11070         va_start(ap);
11071         p = va_arg(ap, char *);
11072 #endif
11073         va_end(ap);
11074         return 0;
11075 }
11076 EOP
11077 $cat > varargs <<EOP
11078 $startsh
11079 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11080         echo "true"
11081 else
11082         echo "false"
11083 fi
11084 $rm -f varargs$_o
11085 EOP
11086 chmod +x varargs
11087
11088 : now check which varargs header should be included
11089 echo " "
11090 i_varhdr=''
11091 val=''
11092 case "$valstd" in
11093 "$define")
11094         if `./varargs I_STDARG`; then
11095                 val='stdarg.h'
11096         elif `./varargs I_VARARGS`; then
11097                 val='varargs.h'
11098         fi
11099         ;;
11100 *)
11101         if `./varargs I_VARARGS`; then
11102                 val='varargs.h'
11103         fi
11104         ;;
11105 esac
11106 case "$val" in
11107 '')
11108         echo " "
11109         echo "*** WHOA THERE!!! ***" >&4
11110         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11111         case "$knowitall" in
11112         '')
11113         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11114                 exit 1
11115                 ;;
11116         esac
11117 echo "I could not find the definition for va_dcl... You have problems..." >&4
11118         val="$undef"; set i_stdarg; eval $setvar
11119         val="$undef"; set i_varargs; eval $setvar
11120         ;;
11121 *)
11122         set i_varhdr
11123         eval $setvar
11124         case "$i_varhdr" in
11125         stdarg.h)
11126                 val="$define"; set i_stdarg; eval $setvar
11127                 val="$undef"; set i_varargs; eval $setvar
11128                 ;;
11129         varargs.h)
11130                 val="$undef"; set i_stdarg; eval $setvar
11131                 val="$define"; set i_varargs; eval $setvar
11132                 ;;
11133         esac
11134         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11135 esac
11136 $rm -f varargs*
11137
11138 : see if the Compiler supports C99 variadic macros
11139 case "$i_stdarg$i_stdlib" in
11140     "$define$define")
11141     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11142     $cat >try.c <<EOCP
11143 #include <stdio.h>
11144 #include <stdarg.h>
11145
11146 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11147
11148 int main() {
11149   char buf[20];
11150   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11151   puts(buf);
11152   return 0;
11153 }
11154 EOCP
11155     set try
11156     if eval $compile && $run ./try 2>&1 >/dev/null; then
11157         case "`$run ./try`" in
11158             "123 456 789")
11159             echo "You have C99 variadic macros." >&4
11160             d_c99_variadic_macros="$define"
11161             ;;
11162             *)
11163             echo "You don't have functional C99 variadic macros." >&4
11164             d_c99_variadic_macros="$undef"
11165             ;;
11166         esac
11167     else
11168         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11169         d_c99_variadic_macros="$undef"
11170     fi
11171     $rm_try
11172     ;;
11173     *)
11174     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11175     d_c99_variadic_macros="$undef"
11176     ;;
11177 esac
11178
11179 : see if signal is declared as pointer to function returning int or void
11180 echo " "
11181 xxx=`./findhdr signal.h`
11182 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11183 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11184         echo "You have int (*signal())() instead of void." >&4
11185         val="$undef"
11186 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11187         echo "You have void (*signal())()." >&4
11188         val="$define"
11189 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11190         echo "You have int (*signal())() instead of void." >&4
11191         val="$undef"
11192 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11193         echo "You have void (*signal())()." >&4
11194         val="$define"
11195 else
11196         case "$d_voidsig" in
11197         '')
11198         echo "I can't determine whether signal handler returns void or int..." >&4
11199                 dflt=void
11200                 rp="What type does your signal handler return?"
11201                 . ./myread
11202                 case "$ans" in
11203                 v*) val="$define";;
11204                 *) val="$undef";;
11205                 esac;;
11206         "$define")
11207                 echo "As you already told me, signal handler returns void." >&4
11208                 val="$define"
11209                 ;;
11210         *)      echo "As you already told me, signal handler returns int." >&4
11211                 val="$undef"
11212                 ;;
11213         esac
11214 fi
11215 set d_voidsig
11216 eval $setvar
11217 case "$d_voidsig" in
11218 "$define") signal_t="void";;
11219 *) signal_t="int";;
11220 esac
11221 $rm -f $$.tmp
11222
11223 : check for ability to cast large floats to 32-bit ints.
11224 echo " "
11225 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11226 if $test "$intsize" -ge 4; then
11227         xxx=int
11228 else
11229         xxx=long
11230 fi
11231 $cat >try.c <<EOCP
11232 #include <stdio.h>
11233 #$i_stdlib I_STDLIB
11234 #ifdef I_STDLIB
11235 #include <stdlib.h>
11236 #endif
11237 #include <sys/types.h>
11238 #include <signal.h>
11239 $signal_t blech(int s) { exit(3); }
11240 int main()
11241 {
11242         $xxx i32;
11243         double f, g;
11244         int result = 0;
11245         char str[16];
11246         signal(SIGFPE, blech);
11247
11248         /* Don't let compiler optimize the test away.  Store the number
11249            in a writable string for gcc to pass to sscanf under HP-UX.
11250         */
11251         sprintf(str, "2147483647");
11252         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11253         g = 10 * f;
11254         i32  = ($xxx) g;
11255
11256         /* x86 processors will probably give 0x8000 0000, which is a
11257            sign change.  We don't want that.  We want to mimic SPARC
11258            behavior here, which is to preserve the sign and give
11259            back 0x7fff ffff.
11260         */
11261         if (i32 != ($xxx) f)
11262                 result |= 1;
11263         exit(result);
11264 }
11265 EOCP
11266 set try
11267 if eval $compile_ok; then
11268         $run ./try
11269         yyy=$?
11270 else
11271         echo "(I can't seem to compile the test program--assuming it can't)"
11272         yyy=1
11273 fi
11274 case "$yyy" in
11275 0)      val="$define"
11276         echo "Yup, it can."
11277         ;;
11278 *)      val="$undef"
11279         echo "Nope, it can't."
11280         ;;
11281 esac
11282 set d_casti32
11283 eval $setvar
11284 $rm_try
11285
11286 : check for ability to cast negative floats to unsigned
11287 echo " "
11288 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11289 $cat >try.c <<EOCP
11290 #include <stdio.h>
11291 #$i_stdlib I_STDLIB
11292 #ifdef I_STDLIB
11293 #include <stdlib.h>
11294 #endif
11295 #include <sys/types.h>
11296 #include <signal.h>
11297 $signal_t blech(int s) { exit(7); }
11298 $signal_t blech_in_list(int s) { exit(4); }
11299 unsigned long dummy_long(unsigned long p) { return p; }
11300 unsigned int dummy_int(unsigned int p) { return p; }
11301 unsigned short dummy_short(unsigned short p) { return p; }
11302 int main()
11303 {
11304         double f;
11305         unsigned long along;
11306         unsigned int aint;
11307         unsigned short ashort;
11308         int result = 0;
11309         char str[16];
11310
11311         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11312            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11313            optimized the whole file away
11314         */
11315         /* Store the number in a writable string for gcc to pass to
11316            sscanf under HP-UX.
11317         */
11318         sprintf(str, "-123");
11319         sscanf(str, "%lf", &f);  /* f = -123.; */
11320
11321         signal(SIGFPE, blech);
11322         along = (unsigned long)f;
11323         aint = (unsigned int)f;
11324         ashort = (unsigned short)f;
11325         if (along != (unsigned long)-123)
11326                 result |= 1;
11327         if (aint != (unsigned int)-123)
11328                 result |= 1;
11329         if (ashort != (unsigned short)-123)
11330                 result |= 1;
11331         sprintf(str, "1073741824.");
11332         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11333         f = f + f;
11334         along = 0;
11335         along = (unsigned long)f;
11336         if (along != 0x80000000)
11337                 result |= 2;
11338         f -= 1.;
11339         along = 0;
11340         along = (unsigned long)f;
11341         if (along != 0x7fffffff)
11342                 result |= 1;
11343         f += 2.;
11344         along = 0;
11345         along = (unsigned long)f;
11346         if (along != 0x80000001)
11347                 result |= 2;
11348         if (result)
11349                 exit(result);
11350         signal(SIGFPE, blech_in_list);
11351         sprintf(str, "123.");
11352         sscanf(str, "%lf", &f);  /* f = 123.; */
11353         along = dummy_long((unsigned long)f);
11354         aint = dummy_int((unsigned int)f);
11355         ashort = dummy_short((unsigned short)f);
11356         if (along != (unsigned long)123)
11357                 result |= 4;
11358         if (aint != (unsigned int)123)
11359                 result |= 4;
11360         if (ashort != (unsigned short)123)
11361                 result |= 4;
11362         exit(result);
11363
11364 }
11365 EOCP
11366 set try
11367 if eval $compile_ok; then
11368         $run ./try
11369         castflags=$?
11370 else
11371         echo "(I can't seem to compile the test program--assuming it can't)"
11372         castflags=7
11373 fi
11374 case "$castflags" in
11375 0)      val="$define"
11376         echo "Yup, it can."
11377         ;;
11378 *)      val="$undef"
11379         echo "Nope, it can't."
11380         ;;
11381 esac
11382 set d_castneg
11383 eval $setvar
11384 $rm_try
11385
11386 : see if vprintf exists
11387 echo " "
11388 if set vprintf val -f d_vprintf; eval $csym; $val; then
11389         echo 'vprintf() found.' >&4
11390         val="$define"
11391         $cat >try.c <<EOF
11392 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11393 #$i_varargs I_VARARGS
11394
11395 #$i_stdlib I_STDLIB
11396 #$i_unistd I_UNISTD
11397
11398 #ifdef I_STDARG
11399 #  include <stdarg.h>
11400 #else /* I_VARARGS */
11401 #  include <varargs.h>
11402 #endif
11403
11404 #ifdef I_UNISTD
11405 #  include <unistd.h>
11406 #endif
11407
11408 #ifdef I_STDLIB
11409 #  include <stdlib.h>
11410 #endif
11411
11412 #include <stdio.h> /* vsprintf prototype */
11413
11414 #ifdef I_STDARG
11415 void xxx(int n, ...)
11416 {
11417     va_list args;
11418     char buf[10];
11419     va_start(args, n);
11420     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11421 }
11422 int main() { xxx(1, "foo"); }
11423
11424 #else /* I_VARARGS */
11425
11426 xxx(va_alist)
11427 va_dcl
11428 {
11429     va_list args;
11430     char buf[10];
11431     va_start(args);
11432     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11433 }
11434 int main() { xxx("foo"); }
11435
11436 #endif
11437
11438 EOF
11439         set try
11440         if eval $compile_ok; then
11441                 if $run ./try; then
11442                         echo "Your vsprintf() returns (int)." >&4
11443                         val2="$undef"
11444                 else
11445                         echo "Your vsprintf() returns (char*)." >&4
11446                         val2="$define"
11447                 fi
11448         else
11449                 echo 'I am unable to compile the vsprintf() test program.' >&4
11450                 # We shouldn't get here.  If we do, assume the standard signature,
11451                 # not the old BSD one.
11452                 echo 'Guessing that vsprintf() returns (int).' >&4
11453                 val2="$undef"
11454         fi
11455 else
11456         echo 'vprintf() NOT found.' >&4
11457         val="$undef"
11458         val2="$undef"
11459 fi
11460 $rm_try
11461 set d_vprintf
11462 eval $setvar
11463 val=$val2
11464 set d_charvspr
11465 eval $setvar
11466
11467 : see if chown exists
11468 set chown d_chown
11469 eval $inlibc
11470
11471 : see if chroot exists
11472 set chroot d_chroot
11473 eval $inlibc
11474
11475 : see if chsize exists
11476 set chsize d_chsize
11477 eval $inlibc
11478
11479 : see if class exists
11480 set class d_class
11481 eval $inlibc
11482
11483 : see if clearenv exists
11484 set clearenv d_clearenv
11485 eval $inlibc
11486
11487 : Define hasstruct macro for Configure internal use
11488 hasstruct='varname=$1; struct=$2; shift; shift;
11489 while $test $# -ge 2; do
11490         case "$1" in
11491         $define) echo "#include <$2>";;
11492         esac ;
11493     shift 2;
11494 done > try.c;
11495 echo "int main () { struct $struct foo; }" >> try.c;
11496 set try;
11497 if eval $compile; then
11498         val="$define";
11499 else
11500         val="$undef";
11501 fi;
11502 set $varname;
11503 eval $setvar;
11504 $rm_try'
11505
11506 : see whether socket exists
11507 socketlib=''
11508 sockethdr=''
11509 echo " "
11510 $echo $n "Hmm... $c" >&4
11511 if set socket val -f d_socket; eval $csym; $val; then
11512     echo "Looks like you have Berkeley networking support." >&4
11513     d_socket="$define"
11514     if set setsockopt val -f; eval $csym; $val; then
11515         d_oldsock="$undef"
11516     else
11517         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11518         d_oldsock="$define"
11519     fi
11520 else
11521     if $contains socklib libc.list >/dev/null 2>&1; then
11522         echo "Looks like you have Berkeley networking support." >&4
11523         d_socket="$define"
11524         : we will have to assume that it supports the 4.2 BSD interface
11525         d_oldsock="$undef"
11526     else
11527         echo "You don't have Berkeley networking in libc$_a..." >&4
11528         if test "X$d_socket" = "X$define"; then
11529             echo "...but you seem to believe that you have sockets." >&4
11530         else
11531             for net in net socket
11532             do
11533                 if test -f $sysroot/usr/lib/lib$net$_a; then
11534                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11535                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11536                     if $contains socket libc.list >/dev/null 2>&1; then
11537                         d_socket="$define"
11538                         socketlib="-l$net"
11539                         case "$net" in
11540                         net)
11541                             echo "...but the Wollongong group seems to have hacked it in." >&4
11542                             sockethdr="-I$sysroot/usr/netinclude"
11543                             ;;
11544                         esac
11545                         echo "Found Berkeley sockets interface in lib$net." >&4
11546                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11547                             d_oldsock="$undef"
11548                         else
11549                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11550                             d_oldsock="$define"
11551                         fi
11552                         break
11553                     fi
11554                 fi
11555             done
11556             if test "X$d_socket" != "X$define"; then
11557                echo "or anywhere else I see." >&4
11558                d_socket="$undef"
11559                d_oldsock="$undef"
11560             fi
11561         fi
11562     fi
11563 fi
11564
11565 : see if socketpair exists
11566 set socketpair d_sockpair
11567 eval $inlibc
11568
11569
11570 echo " "
11571 echo "Checking the availability sa_len in the sock struct ..." >&4
11572 $cat >try.c <<EOF
11573 #include <sys/types.h>
11574 #include <sys/socket.h>
11575 int main() {
11576 struct sockaddr sa;
11577 return (sa.sa_len);
11578 }
11579 EOF
11580 val="$undef"
11581 set try; if eval $compile; then
11582     val="$define"
11583 fi
11584 set d_sockaddr_sa_len; eval $setvar
11585 $rm_try
11586
11587 echo " "
11588 echo "Checking the availability struct sockaddr_in6 ..." >&4
11589 $cat >try.c <<EOF
11590 #include <sys/types.h>
11591 #include <sys/socket.h>
11592 #include <netinet/in.h>
11593 int main() {
11594 struct sockaddr_in6 sin6;
11595 return (sin6.sin6_family);
11596 }
11597 EOF
11598 val="$undef"
11599 set try; if eval $compile; then
11600     val="$define"
11601 fi
11602 set d_sockaddr_in6; eval $setvar
11603 $rm_try
11604
11605 echo " "
11606 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11607 $cat >try.c <<EOF
11608 #include <sys/types.h>
11609 #include <sys/socket.h>
11610 #include <netinet/in.h>
11611 int main() {
11612 struct sockaddr_in6 sin6;
11613 return (sin6.sin6_scope_id);
11614 }
11615 EOF
11616 val="$undef"
11617 set try; if eval $compile; then
11618     val="$define"
11619 fi
11620 set d_sin6_scope_id; eval $setvar
11621 $rm_try
11622
11623 echo " "
11624 echo "Checking the availability struct ip_mreq ..." >&4
11625 $cat >try.c <<EOF
11626 #include <sys/types.h>
11627 #include <sys/socket.h>
11628 #include <netinet/in.h>
11629 int main() {
11630 struct ip_mreq mreq;
11631 return (mreq.imr_multiaddr.s_addr);
11632 }
11633 EOF
11634 val="$undef"
11635 set try; if eval $compile; then
11636        val="$define"
11637 fi
11638 set d_ip_mreq; eval $setvar
11639 $rm_try
11640
11641 echo " "
11642 echo "Checking the availability struct ip_mreq_source ..." >&4
11643 $cat >try.c <<EOF
11644 #include <sys/types.h>
11645 #include <sys/socket.h>
11646 #include <netinet/in.h>
11647 int main() {
11648 struct ip_mreq_source mreq;
11649 return (mreq.imr_multiaddr.s_addr);
11650 }
11651 EOF
11652 val="$undef"
11653 set try; if eval $compile; then
11654        val="$define"
11655 fi
11656 set d_ip_mreq_source; eval $setvar
11657 $rm_try
11658
11659 echo " "
11660 echo "Checking the availability struct ipv6_mreq ..." >&4
11661 $cat >try.c <<EOF
11662 #include <sys/types.h>
11663 #include <sys/socket.h>
11664 #include <netinet/in.h>
11665 int main() {
11666 struct ipv6_mreq mreq;
11667 return (mreq.ipv6mr_interface);
11668 }
11669 EOF
11670 val="$undef"
11671 set try; if eval $compile; then
11672     val="$define"
11673 fi
11674 set d_ipv6_mreq; eval $setvar
11675 $rm_try
11676
11677 echo " "
11678 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11679 $cat >try.c <<EOF
11680 #include <sys/types.h>
11681 #include <sys/socket.h>
11682 #include <netinet/in.h>
11683 int main() {
11684 struct ipv6_mreq_source mreq;
11685 return (mreq.imr_multiaddr.s_addr);
11686 }
11687 EOF
11688 val="$undef"
11689 set try; if eval $compile; then
11690        val="$define"
11691 fi
11692 set d_ipv6_mreq_source; eval $setvar
11693 $rm_try
11694
11695 echo " "
11696 echo "Checking the availability of certain socket constants..." >&4
11697 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11698     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11699     $cat >try.c <<EOF
11700 #include <sys/types.h>
11701 #include <sys/socket.h>
11702 int main() {
11703     int i = $ENUM;
11704 }
11705 EOF
11706     val="$undef"
11707     set try; if eval $compile; then
11708         val="$define"
11709     fi
11710     set d_${enum}; eval $setvar
11711     $rm_try
11712 done
11713
11714 : see if this is a sys/uio.h system
11715 set sys/uio.h i_sysuio
11716 eval $inhdr
11717
11718 : Check for cmsghdr support
11719 echo " "
11720 echo "Checking to see if your system supports struct cmsghdr..." >&4
11721 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11722 eval $hasstruct
11723 case "$d_cmsghdr_s" in
11724 "$define")      echo "Yes, it does."   ;;
11725 *)              echo "No, it doesn't." ;;
11726 esac
11727
11728
11729 : check for const keyword
11730 echo " "
11731 echo 'Checking to see if your C compiler knows about "const"...' >&4
11732 $cat >const.c <<'EOCP'
11733 typedef struct spug { int drokk; } spug;
11734 int main()
11735 {
11736         const char *foo;
11737         const spug y = { 0 };
11738 }
11739 EOCP
11740 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11741         val="$define"
11742         echo "Yup, it does."
11743 else
11744         val="$undef"
11745         echo "Nope, it doesn't."
11746 fi
11747 set d_const
11748 eval $setvar
11749
11750 : see if copysignl exists
11751 set copysignl d_copysignl
11752 eval $inlibc
11753
11754 : see if crypt exists
11755 echo " "
11756 set crypt d_crypt
11757 eval $inlibc
11758 case "$d_crypt" in
11759 $define) cryptlib='' ;;
11760 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11761                 echo 'crypt() found.' >&4
11762                 val="$define"
11763                 cryptlib=''
11764         else
11765                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11766                 if $test -z "$cryptlib"; then
11767                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11768                 else
11769                         cryptlib=-lcrypt
11770                 fi
11771                 if $test -z "$cryptlib"; then
11772                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11773                 else
11774                         cryptlib=-lcrypt
11775                 fi
11776                 if $test -z "$cryptlib"; then
11777                         cryptlib=`./loc libcrypt$_a "" $libpth`
11778                 else
11779                         cryptlib=-lcrypt
11780                 fi
11781                 if $test -z "$cryptlib"; then
11782                         echo 'crypt() NOT found.' >&4
11783                         val="$undef"
11784                 else
11785                         val="$define"
11786                 fi
11787         fi
11788         set d_crypt
11789         eval $setvar
11790         ;;
11791 esac
11792
11793 : see if this is a crypt.h system
11794 set crypt.h i_crypt
11795 eval $inhdr
11796
11797 : see if crypt_r exists
11798 set crypt_r d_crypt_r
11799 eval $inlibc
11800 case "$d_crypt_r" in
11801 "$define")
11802         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11803         case "$d_crypt_r_proto:$usethreads" in
11804         ":define")      d_crypt_r_proto=define
11805                 set d_crypt_r_proto crypt_r $hdrs
11806                 eval $hasproto ;;
11807         *)      ;;
11808         esac
11809         case "$d_crypt_r_proto" in
11810         define)
11811         case "$crypt_r_proto" in
11812         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11813         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11814         esac
11815         case "$crypt_r_proto" in
11816         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11817         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11818         esac
11819         case "$crypt_r_proto" in
11820         ''|0)   d_crypt_r=undef
11821                 crypt_r_proto=0
11822                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11823         * )     case "$crypt_r_proto" in
11824                 REENTRANT_PROTO*) ;;
11825                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11826                 esac
11827                 echo "Prototype: $try" ;;
11828         esac
11829         ;;
11830         *)      case "$usethreads" in
11831                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11832                 esac
11833                 d_crypt_r=undef
11834                 crypt_r_proto=0
11835                 ;;
11836         esac
11837         ;;
11838 *)      crypt_r_proto=0
11839         ;;
11840 esac
11841
11842 : get csh whereabouts
11843 case "$csh" in
11844 'csh') val="$undef" ;;
11845 *) val="$define" ;;
11846 esac
11847 set d_csh
11848 eval $setvar
11849 : Respect a hint or command line value for full_csh.
11850 case "$full_csh" in
11851 '') full_csh=$csh ;;
11852 esac
11853
11854 : see if ctermid exists
11855 set ctermid d_ctermid
11856 eval $inlibc
11857
11858 : see if ctermid_r exists
11859 set ctermid_r d_ctermid_r
11860 eval $inlibc
11861 case "$d_ctermid_r" in
11862 "$define")
11863         hdrs="$i_systypes sys/types.h define stdio.h "
11864         case "$d_ctermid_r_proto:$usethreads" in
11865         ":define")      d_ctermid_r_proto=define
11866                 set d_ctermid_r_proto ctermid_r $hdrs
11867                 eval $hasproto ;;
11868         *)      ;;
11869         esac
11870         case "$d_ctermid_r_proto" in
11871         define)
11872         case "$ctermid_r_proto" in
11873         ''|0) try='char* ctermid_r(char*);'
11874         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11875         esac
11876         case "$ctermid_r_proto" in
11877         ''|0)   d_ctermid_r=undef
11878                 ctermid_r_proto=0
11879                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11880         * )     case "$ctermid_r_proto" in
11881                 REENTRANT_PROTO*) ;;
11882                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11883                 esac
11884                 echo "Prototype: $try" ;;
11885         esac
11886         ;;
11887         *)      case "$usethreads" in
11888                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11889                 esac
11890                 d_ctermid_r=undef
11891                 ctermid_r_proto=0
11892                 ;;
11893         esac
11894         ;;
11895 *)      ctermid_r_proto=0
11896         ;;
11897 esac
11898
11899 : see if ctime_r exists
11900 set ctime_r d_ctime_r
11901 eval $inlibc
11902 case "$d_ctime_r" in
11903 "$define")
11904         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11905         case "$d_ctime_r_proto:$usethreads" in
11906         ":define")      d_ctime_r_proto=define
11907                 set d_ctime_r_proto ctime_r $hdrs
11908                 eval $hasproto ;;
11909         *)      ;;
11910         esac
11911         case "$d_ctime_r_proto" in
11912         define)
11913         case "$ctime_r_proto" in
11914         ''|0) try='char* ctime_r(const time_t*, char*);'
11915         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11916         esac
11917         case "$ctime_r_proto" in
11918         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11919         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11920         esac
11921         case "$ctime_r_proto" in
11922         ''|0) try='int ctime_r(const time_t*, char*);'
11923         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11924         esac
11925         case "$ctime_r_proto" in
11926         ''|0) try='int ctime_r(const time_t*, char*, int);'
11927         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11928         esac
11929         case "$ctime_r_proto" in
11930         ''|0)   d_ctime_r=undef
11931                 ctime_r_proto=0
11932                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11933         * )     case "$ctime_r_proto" in
11934                 REENTRANT_PROTO*) ;;
11935                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11936                 esac
11937                 echo "Prototype: $try" ;;
11938         esac
11939         ;;
11940         *)      case "$usethreads" in
11941                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11942                 esac
11943                 d_ctime_r=undef
11944                 ctime_r_proto=0
11945                 ;;
11946         esac
11947         ;;
11948 *)      ctime_r_proto=0
11949         ;;
11950 esac
11951
11952 : see if cuserid exists
11953 set cuserid d_cuserid
11954 eval $inlibc
11955
11956 : see if this is a limits.h system
11957 set limits.h i_limits
11958 eval $inhdr
11959
11960 : see if this is a float.h system
11961 set float.h i_float
11962 eval $inhdr
11963
11964 : See if number of significant digits in a double precision number is known
11965 echo " "
11966 $cat >dbl_dig.c <<EOM
11967 #$i_limits I_LIMITS
11968 #$i_float I_FLOAT
11969 #ifdef I_LIMITS
11970 #include <limits.h>
11971 #endif
11972 #ifdef I_FLOAT
11973 #include <float.h>
11974 #endif
11975 #ifdef DBL_DIG
11976 printf("Contains DBL_DIG");
11977 #endif
11978 EOM
11979 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11980 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11981         echo "DBL_DIG found." >&4
11982         val="$define"
11983 else
11984         echo "DBL_DIG NOT found." >&4
11985         val="$undef"
11986 fi
11987 $rm -f dbl_dig.?
11988 set d_dbl_dig
11989 eval $setvar
11990
11991 : see if dbm.h is available
11992 : see if dbmclose exists
11993 set dbmclose d_dbmclose
11994 eval $inlibc
11995
11996 case "$d_dbmclose" in
11997 $define)
11998         set dbm.h i_dbm
11999         eval $inhdr
12000         case "$i_dbm" in
12001         $define)
12002                 val="$undef"
12003                 set i_rpcsvcdbm
12004                 eval $setvar
12005                 ;;
12006         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12007                 eval $inhdr
12008                 ;;
12009         esac
12010         ;;
12011 *)      echo "We won't be including <dbm.h>"
12012         val="$undef"
12013         set i_dbm
12014         eval $setvar
12015         val="$undef"
12016         set i_rpcsvcdbm
12017         eval $setvar
12018         ;;
12019 esac
12020
12021 : see if prototype for dbminit is available
12022 echo " "
12023 set d_dbminitproto dbminit $i_dbm dbm.h
12024 eval $hasproto
12025
12026 : see if difftime exists
12027 set difftime d_difftime
12028 eval $inlibc
12029
12030 : see if this is a dirent system
12031 echo " "
12032 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12033         val="$define"
12034         echo "<dirent.h> found." >&4
12035 else
12036         val="$undef"
12037         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12038                 echo "<sys/dir.h> found." >&4
12039                 echo " "
12040         else
12041                 xinc=`./findhdr sys/ndir.h`
12042         fi
12043         echo "<dirent.h> NOT found." >&4
12044 fi
12045 set i_dirent
12046 eval $setvar
12047
12048 : Look for type of directory structure.
12049 echo " "
12050 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12051
12052 case "$direntrytype" in
12053 ''|' ')
12054         case "$i_dirent" in
12055         $define) guess1='struct dirent' ;;
12056         *) guess1='struct direct'  ;;
12057         esac
12058         ;;
12059 *)      guess1="$direntrytype"
12060         ;;
12061 esac
12062
12063 case "$guess1" in
12064 'struct dirent') guess2='struct direct' ;;
12065 *) guess2='struct dirent' ;;
12066 esac
12067
12068 if $contains "$guess1" try.c >/dev/null 2>&1; then
12069         direntrytype="$guess1"
12070         echo "Your directory entries are $direntrytype." >&4
12071 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12072         direntrytype="$guess2"
12073         echo "Your directory entries seem to be $direntrytype." >&4
12074 else
12075         echo "I don't recognize your system's directory entries." >&4
12076         rp="What type is used for directory entries on this system?"
12077         dflt="$guess1"
12078         . ./myread
12079         direntrytype="$ans"
12080 fi
12081 $rm_try
12082
12083 : see if the directory entry stores field length
12084 echo " "
12085 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12086 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12087         echo "Good, your directory entry keeps length information in d_namlen." >&4
12088         val="$define"
12089 else
12090         echo "Your directory entry does not know about the d_namlen field." >&4
12091         val="$undef"
12092 fi
12093 set d_dirnamlen
12094 eval $setvar
12095 $rm_try
12096
12097 : Look for DIR.dd_fd
12098 case "$i_dirent" in
12099 "$define")
12100     echo "Checking to see if DIR has a dd_fd member variable" >&4
12101     $cat >try.c <<EOCP
12102 #$i_stdlib I_STDLIB
12103 #ifdef I_STDLIB
12104 #include <stdlib.h>
12105 #endif
12106 #include <dirent.h>
12107
12108 int main() {
12109     DIR dir;
12110     dir.dd_fd = 1;
12111     return 0;
12112 }
12113 EOCP
12114     val=$undef
12115     set try
12116     if eval $compile; then
12117         echo "Yes, it does."
12118         val="$define"
12119     else
12120         echo "No, it does not."
12121         val="$undef"
12122     fi
12123     ;;
12124 *)
12125     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12126     val="$undef"
12127     ;;
12128 esac
12129 set d_dir_dd_fd
12130 eval $setvar
12131 $rm_try
12132
12133 : see if this is an sysdir system
12134 set sys/dir.h i_sysdir
12135 eval $inhdr
12136
12137 : see if this is an sysndir system
12138 set sys/ndir.h i_sysndir
12139 eval $inhdr
12140
12141 : Look for dirfd
12142 echo " "
12143 $cat >dirfd.c <<EOM
12144 #include <stdio.h>
12145 #$i_stdlib I_STDLIB
12146 #ifdef I_STDLIB
12147 #include <stdlib.h>
12148 #endif
12149 #$i_dirent I_DIRENT             /**/
12150 #$i_sysdir I_SYS_DIR            /**/
12151 #$i_sysndir I_SYS_NDIR          /**/
12152 #$i_systypes I_SYS_TYPES        /**/
12153 #if defined(I_SYS_TYPES)
12154 #include <sys/types.h>
12155 #endif
12156 #if defined(I_DIRENT)
12157 #include <dirent.h>
12158 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12159 #include <sys/dir.h>
12160 #endif
12161 #else
12162 #ifdef I_SYS_NDIR
12163 #include <sys/ndir.h>
12164 #else
12165 #ifdef I_SYS_DIR
12166 #ifdef hp9000s500
12167 #include <ndir.h>       /* may be wrong in the future */
12168 #else
12169 #include <sys/dir.h>
12170 #endif
12171 #endif
12172 #endif
12173 #endif
12174 int main() {
12175         DIR *dirp = opendir(".");
12176         if (dirfd(dirp) >= 0)
12177                 exit(0);
12178         else
12179                 exit(1);
12180 }
12181 EOM
12182 val=$undef
12183 set dirfd
12184 if eval $compile; then
12185         val="$define"
12186 fi
12187 case "$val" in
12188 $define)        echo "dirfd() found." >&4       ;;
12189 *)              echo "dirfd() NOT found." >&4   ;;
12190 esac
12191 set d_dirfd
12192 eval $setvar
12193 $rm -f dirfd*
12194
12195 : see if dlerror exists
12196 xxx_runnm="$runnm"
12197 runnm=false
12198 set dlerror d_dlerror
12199 eval $inlibc
12200 runnm="$xxx_runnm"
12201
12202 : see if dlfcn is available
12203 set dlfcn.h i_dlfcn
12204 eval $inhdr
12205
12206 : Check what extension to use for shared libs
12207 case "$usedl" in
12208 $define|y|true)
12209         $cat << EOM
12210
12211 On a few systems, the dynamically loaded modules that perl generates and uses
12212 will need a different extension than shared libs. The default will probably
12213 be appropriate.
12214
12215 EOM
12216         case "$dlext" in
12217         '')     dflt="$so" ;;
12218         *)      dflt="$dlext" ;;
12219         esac
12220         rp='What is the extension of dynamically loaded modules'
12221         . ./myread
12222         dlext="$ans"
12223         ;;
12224 *)
12225         dlext="none"
12226         ;;
12227 esac
12228
12229 : Check if dlsym need a leading underscore
12230 echo " "
12231 val="$undef"
12232
12233 case "$dlsrc" in
12234 dl_dlopen.xs)
12235         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12236         $cat >dyna.c <<'EOM'
12237 fred () { }
12238 EOM
12239
12240 $cat >fred.c<<EOM
12241
12242 #include <stdio.h>
12243 #$i_stdlib I_STDLIB
12244 #ifdef I_STDLIB
12245 #include <stdlib.h>
12246 #endif
12247 #$i_dlfcn I_DLFCN
12248 #ifdef I_DLFCN
12249 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12250 #else
12251 #include <sys/types.h>
12252 #include <nlist.h>
12253 #include <link.h>
12254 #endif
12255
12256 extern int fred() ;
12257
12258 int main()
12259 {
12260     void * handle ;
12261     void * symbol ;
12262 #ifndef RTLD_LAZY
12263     int mode = 1 ;
12264 #else
12265     int mode = RTLD_LAZY ;
12266 #endif
12267     handle = dlopen("./dyna.$dlext", mode) ;
12268     if (handle == NULL) {
12269         printf ("1\n") ;
12270         fflush (stdout) ;
12271         exit(0);
12272     }
12273     symbol = dlsym(handle, "fred") ;
12274     if (symbol == NULL) {
12275         /* try putting a leading underscore */
12276         symbol = dlsym(handle, "_fred") ;
12277         if (symbol == NULL) {
12278             printf ("2\n") ;
12279             fflush (stdout) ;
12280             exit(0);
12281         }
12282         printf ("3\n") ;
12283     }
12284     else
12285         printf ("4\n") ;
12286     fflush (stdout) ;
12287     exit(0);
12288 }
12289 EOM
12290         : Call the object file tmp-dyna.o in case dlext=o.
12291         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12292                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12293                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12294                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12295                 xxx=`$run ./fred`
12296                 case $xxx in
12297                 1)      echo "Test program failed using dlopen." >&4
12298                         echo "Perhaps you should not use dynamic loading." >&4;;
12299                 2)      echo "Test program failed using dlsym." >&4
12300                         echo "Perhaps you should not use dynamic loading." >&4;;
12301                 3)      echo "dlsym needs a leading underscore" >&4
12302                         val="$define" ;;
12303                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12304                 esac
12305         else
12306                 echo "I can't compile and run the test program." >&4
12307                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12308         fi
12309         ;;
12310 esac
12311
12312 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12313
12314 set d_dlsymun
12315 eval $setvar
12316
12317 : see if drand48_r exists
12318 set drand48_r d_drand48_r
12319 eval $inlibc
12320 case "$d_drand48_r" in
12321 "$define")
12322         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12323         case "$d_drand48_r_proto:$usethreads" in
12324         ":define")      d_drand48_r_proto=define
12325                 set d_drand48_r_proto drand48_r $hdrs
12326                 eval $hasproto ;;
12327         *)      ;;
12328         esac
12329         case "$d_drand48_r_proto" in
12330         define)
12331         case "$drand48_r_proto" in
12332         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12333         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12334         esac
12335         case "$drand48_r_proto" in
12336         ''|0)   d_drand48_r=undef
12337                 drand48_r_proto=0
12338                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12339         * )     case "$drand48_r_proto" in
12340                 REENTRANT_PROTO*) ;;
12341                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12342                 esac
12343                 echo "Prototype: $try" ;;
12344         esac
12345         ;;
12346         *)      case "$usethreads" in
12347                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12348                 esac
12349                 d_drand48_r=undef
12350                 drand48_r_proto=0
12351                 ;;
12352         esac
12353         ;;
12354 *)      drand48_r_proto=0
12355         ;;
12356 esac
12357
12358 : see if prototype for drand48 is available
12359 echo " "
12360 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12361 eval $hasproto
12362
12363 : see if dup2 exists
12364 set dup2 d_dup2
12365 eval $inlibc
12366
12367 : see if eaccess exists
12368 set eaccess d_eaccess
12369 eval $inlibc
12370
12371 : see if endgrent exists
12372 set endgrent d_endgrent
12373 eval $inlibc
12374
12375 : see if this is an grp system
12376 set grp.h i_grp
12377 eval $inhdr
12378
12379 case "$i_grp" in
12380 $define)
12381         xxx=`./findhdr grp.h`
12382         $cppstdin $cppflags $cppminus < $xxx >$$.h
12383
12384         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12385                 val="$define"
12386         else
12387                 val="$undef"
12388         fi
12389         set d_grpasswd
12390         eval $setvar
12391
12392         $rm -f $$.h
12393         ;;
12394 *)
12395         val="$undef";
12396         set d_grpasswd; eval $setvar
12397         ;;
12398 esac
12399
12400 : see if endgrent_r exists
12401 set endgrent_r d_endgrent_r
12402 eval $inlibc
12403 case "$d_endgrent_r" in
12404 "$define")
12405         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12406         case "$d_endgrent_r_proto:$usethreads" in
12407         ":define")      d_endgrent_r_proto=define
12408                 set d_endgrent_r_proto endgrent_r $hdrs
12409                 eval $hasproto ;;
12410         *)      ;;
12411         esac
12412         case "$d_endgrent_r_proto" in
12413         define)
12414         case "$endgrent_r_proto" in
12415         ''|0) try='int endgrent_r(FILE**);'
12416         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12417         esac
12418         case "$endgrent_r_proto" in
12419         ''|0) try='void endgrent_r(FILE**);'
12420         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12421         esac
12422         case "$endgrent_r_proto" in
12423         ''|0)   d_endgrent_r=undef
12424                 endgrent_r_proto=0
12425                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12426         * )     case "$endgrent_r_proto" in
12427                 REENTRANT_PROTO*) ;;
12428                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12429                 esac
12430                 echo "Prototype: $try" ;;
12431         esac
12432         ;;
12433         *)      case "$usethreads" in
12434                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12435                 esac
12436                 d_endgrent_r=undef
12437                 endgrent_r_proto=0
12438                 ;;
12439         esac
12440         ;;
12441 *)      endgrent_r_proto=0
12442         ;;
12443 esac
12444
12445 : see if endhostent exists
12446 set endhostent d_endhent
12447 eval $inlibc
12448
12449 : see if this is a netdb.h system
12450 set netdb.h i_netdb
12451 eval $inhdr
12452
12453 : see if endhostent_r exists
12454 set endhostent_r d_endhostent_r
12455 eval $inlibc
12456 case "$d_endhostent_r" in
12457 "$define")
12458         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12459         case "$d_endhostent_r_proto:$usethreads" in
12460         ":define")      d_endhostent_r_proto=define
12461                 set d_endhostent_r_proto endhostent_r $hdrs
12462                 eval $hasproto ;;
12463         *)      ;;
12464         esac
12465         case "$d_endhostent_r_proto" in
12466         define)
12467         case "$endhostent_r_proto" in
12468         ''|0) try='int endhostent_r(struct hostent_data*);'
12469         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12470         esac
12471         case "$endhostent_r_proto" in
12472         ''|0) try='void endhostent_r(struct hostent_data*);'
12473         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12474         esac
12475         case "$endhostent_r_proto" in
12476         ''|0)   d_endhostent_r=undef
12477                 endhostent_r_proto=0
12478                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12479         * )     case "$endhostent_r_proto" in
12480                 REENTRANT_PROTO*) ;;
12481                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12482                 esac
12483                 echo "Prototype: $try" ;;
12484         esac
12485         ;;
12486         *)      case "$usethreads" in
12487                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12488                 esac
12489                 d_endhostent_r=undef
12490                 endhostent_r_proto=0
12491                 ;;
12492         esac
12493         ;;
12494 *)      endhostent_r_proto=0
12495         ;;
12496 esac
12497
12498 : see if endnetent exists
12499 set endnetent d_endnent
12500 eval $inlibc
12501
12502 : see if endnetent_r exists
12503 set endnetent_r d_endnetent_r
12504 eval $inlibc
12505 case "$d_endnetent_r" in
12506 "$define")
12507         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12508         case "$d_endnetent_r_proto:$usethreads" in
12509         ":define")      d_endnetent_r_proto=define
12510                 set d_endnetent_r_proto endnetent_r $hdrs
12511                 eval $hasproto ;;
12512         *)      ;;
12513         esac
12514         case "$d_endnetent_r_proto" in
12515         define)
12516         case "$endnetent_r_proto" in
12517         ''|0) try='int endnetent_r(struct netent_data*);'
12518         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12519         esac
12520         case "$endnetent_r_proto" in
12521         ''|0) try='void endnetent_r(struct netent_data*);'
12522         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12523         esac
12524         case "$endnetent_r_proto" in
12525         ''|0)   d_endnetent_r=undef
12526                 endnetent_r_proto=0
12527                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12528         * )     case "$endnetent_r_proto" in
12529                 REENTRANT_PROTO*) ;;
12530                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12531                 esac
12532                 echo "Prototype: $try" ;;
12533         esac
12534         ;;
12535         *)      case "$usethreads" in
12536                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12537                 esac
12538                 d_endnetent_r=undef
12539                 endnetent_r_proto=0
12540                 ;;
12541         esac
12542         ;;
12543 *)      endnetent_r_proto=0
12544         ;;
12545 esac
12546
12547 : see if endprotoent exists
12548 set endprotoent d_endpent
12549 eval $inlibc
12550
12551 : see if endprotoent_r exists
12552 set endprotoent_r d_endprotoent_r
12553 eval $inlibc
12554 case "$d_endprotoent_r" in
12555 "$define")
12556         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12557         case "$d_endprotoent_r_proto:$usethreads" in
12558         ":define")      d_endprotoent_r_proto=define
12559                 set d_endprotoent_r_proto endprotoent_r $hdrs
12560                 eval $hasproto ;;
12561         *)      ;;
12562         esac
12563         case "$d_endprotoent_r_proto" in
12564         define)
12565         case "$endprotoent_r_proto" in
12566         ''|0) try='int endprotoent_r(struct protoent_data*);'
12567         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12568         esac
12569         case "$endprotoent_r_proto" in
12570         ''|0) try='void endprotoent_r(struct protoent_data*);'
12571         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12572         esac
12573         case "$endprotoent_r_proto" in
12574         ''|0)   d_endprotoent_r=undef
12575                 endprotoent_r_proto=0
12576                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12577         * )     case "$endprotoent_r_proto" in
12578                 REENTRANT_PROTO*) ;;
12579                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12580                 esac
12581                 echo "Prototype: $try" ;;
12582         esac
12583         ;;
12584         *)      case "$usethreads" in
12585                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12586                 esac
12587                 d_endprotoent_r=undef
12588                 endprotoent_r_proto=0
12589                 ;;
12590         esac
12591         ;;
12592 *)      endprotoent_r_proto=0
12593         ;;
12594 esac
12595
12596 : see if endpwent exists
12597 set endpwent d_endpwent
12598 eval $inlibc
12599
12600 : see if this is a pwd.h system
12601 set pwd.h i_pwd
12602 eval $inhdr
12603
12604 case "$i_pwd" in
12605 $define)
12606         xxx=`./findhdr pwd.h`
12607         $cppstdin $cppflags $cppminus < $xxx >$$.h
12608
12609         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12610                 val="$define"
12611         else
12612                 val="$undef"
12613         fi
12614         set d_pwquota
12615         eval $setvar
12616
12617         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12618                 val="$define"
12619         else
12620                 val="$undef"
12621         fi
12622         set d_pwage
12623         eval $setvar
12624
12625         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12626                 val="$define"
12627         else
12628                 val="$undef"
12629         fi
12630         set d_pwchange
12631         eval $setvar
12632
12633         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12634                 val="$define"
12635         else
12636                 val="$undef"
12637         fi
12638         set d_pwclass
12639         eval $setvar
12640
12641         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12642                 val="$define"
12643         else
12644                 val="$undef"
12645         fi
12646         set d_pwexpire
12647         eval $setvar
12648
12649         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12650                 val="$define"
12651         else
12652                 val="$undef"
12653         fi
12654         set d_pwcomment
12655         eval $setvar
12656
12657         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12658                 val="$define"
12659         else
12660                 val="$undef"
12661         fi
12662         set d_pwgecos
12663         eval $setvar
12664
12665         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12666                 val="$define"
12667         else
12668                 val="$undef"
12669         fi
12670         set d_pwpasswd
12671         eval $setvar
12672
12673         $rm -f $$.h
12674         ;;
12675 *)
12676         val="$undef";
12677         set d_pwquota; eval $setvar
12678         set d_pwage; eval $setvar
12679         set d_pwchange; eval $setvar
12680         set d_pwclass; eval $setvar
12681         set d_pwexpire; eval $setvar
12682         set d_pwcomment; eval $setvar
12683         set d_pwgecos; eval $setvar
12684         set d_pwpasswd; eval $setvar
12685         ;;
12686 esac
12687
12688 : see if endpwent_r exists
12689 set endpwent_r d_endpwent_r
12690 eval $inlibc
12691 case "$d_endpwent_r" in
12692 "$define")
12693         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12694         case "$d_endpwent_r_proto:$usethreads" in
12695         ":define")      d_endpwent_r_proto=define
12696                 set d_endpwent_r_proto endpwent_r $hdrs
12697                 eval $hasproto ;;
12698         *)      ;;
12699         esac
12700         case "$d_endpwent_r_proto" in
12701         define)
12702         case "$endpwent_r_proto" in
12703         ''|0) try='int endpwent_r(FILE**);'
12704         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12705         esac
12706         case "$endpwent_r_proto" in
12707         ''|0) try='void endpwent_r(FILE**);'
12708         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12709         esac
12710         case "$endpwent_r_proto" in
12711         ''|0)   d_endpwent_r=undef
12712                 endpwent_r_proto=0
12713                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12714         * )     case "$endpwent_r_proto" in
12715                 REENTRANT_PROTO*) ;;
12716                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12717                 esac
12718                 echo "Prototype: $try" ;;
12719         esac
12720         ;;
12721         *)      case "$usethreads" in
12722                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12723                 esac
12724                 d_endpwent_r=undef
12725                 endpwent_r_proto=0
12726                 ;;
12727         esac
12728         ;;
12729 *)      endpwent_r_proto=0
12730         ;;
12731 esac
12732
12733 : see if endservent exists
12734 set endservent d_endsent
12735 eval $inlibc
12736
12737 : see if endservent_r exists
12738 set endservent_r d_endservent_r
12739 eval $inlibc
12740 case "$d_endservent_r" in
12741 "$define")
12742         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12743         case "$d_endservent_r_proto:$usethreads" in
12744         ":define")      d_endservent_r_proto=define
12745                 set d_endservent_r_proto endservent_r $hdrs
12746                 eval $hasproto ;;
12747         *)      ;;
12748         esac
12749         case "$d_endservent_r_proto" in
12750         define)
12751         case "$endservent_r_proto" in
12752         ''|0) try='int endservent_r(struct servent_data*);'
12753         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12754         esac
12755         case "$endservent_r_proto" in
12756         ''|0) try='void endservent_r(struct servent_data*);'
12757         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12758         esac
12759         case "$endservent_r_proto" in
12760         ''|0)   d_endservent_r=undef
12761                 endservent_r_proto=0
12762                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12763         * )     case "$endservent_r_proto" in
12764                 REENTRANT_PROTO*) ;;
12765                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12766                 esac
12767                 echo "Prototype: $try" ;;
12768         esac
12769         ;;
12770         *)      case "$usethreads" in
12771                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12772                 esac
12773                 d_endservent_r=undef
12774                 endservent_r_proto=0
12775                 ;;
12776         esac
12777         ;;
12778 *)      endservent_r_proto=0
12779         ;;
12780 esac
12781
12782 : Locate the flags for 'open()'
12783 echo " "
12784 $cat >try.c <<EOCP
12785 #include <sys/types.h>
12786 #ifdef I_FCNTL
12787 #include <fcntl.h>
12788 #endif
12789 #ifdef I_SYS_FILE
12790 #include <sys/file.h>
12791 #endif
12792 #$i_stdlib I_STDLIB
12793 #ifdef I_STDLIB
12794 #include <stdlib.h>
12795 #endif
12796 int main() {
12797         if(O_RDONLY);
12798 #ifdef O_TRUNC
12799         exit(0);
12800 #else
12801         exit(1);
12802 #endif
12803 }
12804 EOCP
12805 : check sys/file.h first to get FREAD on Sun
12806 if $test `./findhdr sys/file.h` && \
12807                 set try -DI_SYS_FILE && eval $compile; then
12808         h_sysfile=true;
12809         echo "<sys/file.h> defines the O_* constants..." >&4
12810         if $run ./try; then
12811                 echo "and you have the 3 argument form of open()." >&4
12812                 val="$define"
12813         else
12814                 echo "but not the 3 argument form of open().  Oh, well." >&4
12815                 val="$undef"
12816         fi
12817 elif $test `./findhdr fcntl.h` && \
12818                 set try -DI_FCNTL && eval $compile; then
12819         h_fcntl=true;
12820         echo "<fcntl.h> defines the O_* constants..." >&4
12821         if $run ./try; then
12822                 echo "and you have the 3 argument form of open()." >&4
12823                 val="$define"
12824         else
12825                 echo "but not the 3 argument form of open().  Oh, well." >&4
12826                 val="$undef"
12827         fi
12828 else
12829         val="$undef"
12830         echo "I can't find the O_* constant definitions!  You got problems." >&4
12831 fi
12832 set d_open3
12833 eval $setvar
12834 $rm_try
12835
12836 : see if this is a sys/file.h system
12837 val=''
12838 set sys/file.h val
12839 eval $inhdr
12840
12841 : do we need to include sys/file.h ?
12842 case "$val" in
12843 "$define")
12844         echo " "
12845         if $h_sysfile; then
12846                 val="$define"
12847                 echo "We'll be including <sys/file.h>." >&4
12848         else
12849                 val="$undef"
12850                 echo "We won't be including <sys/file.h>." >&4
12851         fi
12852         ;;
12853 *)
12854         h_sysfile=false
12855         ;;
12856 esac
12857 set i_sysfile
12858 eval $setvar
12859
12860 : see if fcntl.h is there
12861 val=''
12862 set fcntl.h val
12863 eval $inhdr
12864
12865 : see if we can include fcntl.h
12866 case "$val" in
12867 "$define")
12868         echo " "
12869         if $h_fcntl; then
12870                 val="$define"
12871                 echo "We'll be including <fcntl.h>." >&4
12872         else
12873                 val="$undef"
12874                 if $h_sysfile; then
12875         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12876                 else
12877                         echo "We won't be including <fcntl.h>." >&4
12878                 fi
12879         fi
12880         ;;
12881 *)
12882         h_fcntl=false
12883         val="$undef"
12884         ;;
12885 esac
12886 set i_fcntl
12887 eval $setvar
12888
12889 : see if fork exists
12890 set fork d_fork
12891 eval $inlibc
12892
12893 : see if pipe exists
12894 set pipe d_pipe
12895 eval $inlibc
12896
12897 : check for non-blocking I/O stuff
12898 case "$h_sysfile" in
12899 true) echo "#include <sys/file.h>" > head.c;;
12900 *)
12901        case "$h_fcntl" in
12902        true) echo "#include <fcntl.h>" > head.c;;
12903        *) echo "#include <sys/fcntl.h>" > head.c;;
12904        esac
12905        ;;
12906 esac
12907 echo " "
12908 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12909 case "$o_nonblock" in
12910 '')
12911         $cat head.c > try.c
12912         $cat >>try.c <<EOCP
12913 #include <stdio.h>
12914 #$i_stdlib I_STDLIB
12915 #ifdef I_STDLIB
12916 #include <stdlib.h>
12917 #endif
12918 #$i_fcntl I_FCNTL
12919 #ifdef I_FCNTL
12920 #include <fcntl.h>
12921 #endif
12922 int main() {
12923 #ifdef O_NONBLOCK
12924         printf("O_NONBLOCK\n");
12925         exit(0);
12926 #endif
12927 #ifdef O_NDELAY
12928         printf("O_NDELAY\n");
12929         exit(0);
12930 #endif
12931 #ifdef FNDELAY
12932         printf("FNDELAY\n");
12933         exit(0);
12934 #endif
12935         exit(0);
12936 }
12937 EOCP
12938         set try
12939         if eval $compile_ok; then
12940                 o_nonblock=`$run ./try`
12941                 case "$o_nonblock" in
12942                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12943                 *) echo "Seems like we can use $o_nonblock.";;
12944                 esac
12945         else
12946                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12947         fi
12948         ;;
12949 *) echo "Using $hint value $o_nonblock.";;
12950 esac
12951 $rm_try
12952
12953 echo " "
12954 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12955 case "$eagain" in
12956 '')
12957         case "$d_fork:$d_pipe" in
12958         define:define)
12959         $cat head.c > try.c
12960         $cat >>try.c <<EOCP
12961 #include <errno.h>
12962 #include <sys/types.h>
12963 #include <signal.h>
12964 #include <stdio.h>
12965 #$i_stdlib I_STDLIB
12966 #ifdef I_STDLIB
12967 #include <stdlib.h>
12968 #endif
12969 #$i_fcntl I_FCNTL
12970 #ifdef I_FCNTL
12971 #include <fcntl.h>
12972 #endif
12973 #define MY_O_NONBLOCK $o_nonblock
12974 #ifndef errno  /* XXX need better Configure test */
12975 extern int errno;
12976 #endif
12977 #$i_unistd I_UNISTD
12978 #ifdef I_UNISTD
12979 #include <unistd.h>
12980 #endif
12981 #$i_string I_STRING
12982 #ifdef I_STRING
12983 #include <string.h>
12984 #else
12985 #include <strings.h>
12986 #endif
12987 $signal_t blech(int x) { exit(3); }
12988 EOCP
12989         $cat >> try.c <<'EOCP'
12990 int main()
12991 {
12992         int pd[2];
12993         int pu[2];
12994         char buf[1];
12995         char string[100];
12996
12997         pipe(pd);       /* Down: child -> parent */
12998         pipe(pu);       /* Up: parent -> child */
12999         if (0 != fork()) {
13000                 int ret;
13001                 close(pd[1]);   /* Parent reads from pd[0] */
13002                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13003 #ifdef F_SETFL
13004                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13005                         exit(1);
13006 #else
13007                 exit(4);
13008 #endif
13009                 signal(SIGALRM, blech);
13010                 alarm(5);
13011                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13012                         exit(2);
13013                 sprintf(string, "%d\n", ret);
13014                 write(2, string, strlen(string));
13015                 alarm(0);
13016 #ifdef EAGAIN
13017                 if (errno == EAGAIN) {
13018                         printf("EAGAIN\n");
13019                         goto ok;
13020                 }
13021 #endif
13022 #ifdef EWOULDBLOCK
13023                 if (errno == EWOULDBLOCK)
13024                         printf("EWOULDBLOCK\n");
13025 #endif
13026         ok:
13027                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
13028                 sleep(2);                               /* Give it time to close our pipe */
13029                 alarm(5);
13030                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13031                 alarm(0);
13032                 sprintf(string, "%d\n", ret);
13033                 write(4, string, strlen(string));
13034                 exit(0);
13035         }
13036
13037         close(pd[0]);                   /* We write to pd[1] */
13038         close(pu[1]);                   /* We read from pu[0] */
13039         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
13040         close(pd[1]);                   /* Pipe pd is now fully closed! */
13041         exit(0);                                /* Bye bye, thank you for playing! */
13042 }
13043 EOCP
13044         set try
13045         if eval $compile_ok; then
13046                 echo "$startsh" >mtry
13047                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13048                 chmod +x mtry
13049                 $run ./mtry >/dev/null 2>&1
13050                 case $? in
13051                 0) eagain=`$cat try.out`;;
13052                 1) echo "Could not perform non-blocking setting!";;
13053                 2) echo "I did a successful read() for something that was not there!";;
13054                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13055                 4) echo "Could not find F_SETFL!";;
13056                 *) echo "Something terribly wrong happened during testing.";;
13057                 esac
13058                 rd_nodata=`$cat try.ret`
13059                 echo "A read() system call with no data present returns $rd_nodata."
13060                 case "$rd_nodata" in
13061                 0|-1) ;;
13062                 *)
13063                         echo "(That's peculiar, fixing that to be -1.)"
13064                         rd_nodata=-1
13065                         ;;
13066                 esac
13067                 case "$eagain" in
13068                 '')
13069                         echo "Forcing errno EAGAIN on read() with no data available."
13070                         eagain=EAGAIN
13071                         ;;
13072                 *)
13073                         echo "Your read() sets errno to $eagain when no data is available."
13074                         ;;
13075                 esac
13076                 status=`$cat try.err`
13077                 case "$status" in
13078                 0) echo "And it correctly returns 0 to signal EOF.";;
13079                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13080                 *) echo "However, your read() returns '$status' on EOF??";;
13081                 esac
13082                 val="$define"
13083                 if test "$status" = "$rd_nodata"; then
13084                         echo "WARNING: you can't distinguish between EOF and no data!"
13085                         val="$undef"
13086                 fi
13087         else
13088                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13089                 eagain=EAGAIN
13090         fi
13091         ;;
13092         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13093                 eagain=EAGAIN
13094                 val="$define"
13095                 ;;
13096         esac
13097         set d_eofnblk
13098         eval $setvar
13099         ;;
13100 *)
13101         echo "Using $hint value $eagain."
13102         echo "Your read() returns $rd_nodata when no data is present."
13103         case "$d_eofnblk" in
13104         "$define") echo "And you can see EOF because read() returns 0.";;
13105         "$undef") echo "But you can't see EOF status from read() returned value.";;
13106         *)
13107                 echo "(Assuming you can't see EOF status from read anyway.)"
13108                 d_eofnblk=$undef
13109                 ;;
13110         esac
13111         ;;
13112 esac
13113 $rm_try head.c mtry
13114
13115 : see if _ptr and _cnt from stdio act std
13116 echo " "
13117
13118 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13119         echo "(Looks like you have stdio.h from BSD.)"
13120         case "$stdio_ptr" in
13121         '') stdio_ptr='((fp)->_p)'
13122                 ptr_lval=$define
13123                 ;;
13124         *)      ptr_lval=$d_stdio_ptr_lval;;
13125         esac
13126         case "$stdio_cnt" in
13127         '') stdio_cnt='((fp)->_r)'
13128                 cnt_lval=$define
13129                 ;;
13130         *)      cnt_lval=$d_stdio_cnt_lval;;
13131         esac
13132         case "$stdio_base" in
13133         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13134         esac
13135         case "$stdio_bufsiz" in
13136         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13137         esac
13138 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13139         echo "(Looks like you have stdio.h from Linux.)"
13140         case "$stdio_ptr" in
13141         '') stdio_ptr='((fp)->_IO_read_ptr)'
13142                 ptr_lval=$define
13143                 ;;
13144         *)      ptr_lval=$d_stdio_ptr_lval;;
13145         esac
13146         case "$stdio_cnt" in
13147         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13148                 cnt_lval=$undef
13149                 ;;
13150         *)      cnt_lval=$d_stdio_cnt_lval;;
13151         esac
13152         case "$stdio_base" in
13153         '') stdio_base='((fp)->_IO_read_base)';;
13154         esac
13155         case "$stdio_bufsiz" in
13156         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13157         esac
13158 else
13159         case "$stdio_ptr" in
13160         '') stdio_ptr='((fp)->_ptr)'
13161                 ptr_lval=$define
13162                 ;;
13163         *)      ptr_lval=$d_stdio_ptr_lval;;
13164         esac
13165         case "$stdio_cnt" in
13166         '') stdio_cnt='((fp)->_cnt)'
13167                 cnt_lval=$define
13168                 ;;
13169         *)      cnt_lval=$d_stdio_cnt_lval;;
13170         esac
13171         case "$stdio_base" in
13172         '') stdio_base='((fp)->_base)';;
13173         esac
13174         case "$stdio_bufsiz" in
13175         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13176         esac
13177 fi
13178
13179 : test whether _ptr and _cnt really work
13180 echo "Checking how std your stdio is..." >&4
13181 $cat >try.c <<EOP
13182 #include <stdio.h>
13183 #$i_stdlib I_STDLIB
13184 #ifdef I_STDLIB
13185 #include <stdlib.h>
13186 #endif
13187 #define FILE_ptr(fp)    $stdio_ptr
13188 #define FILE_cnt(fp)    $stdio_cnt
13189 int main() {
13190         FILE *fp = fopen("try.c", "r");
13191         char c = getc(fp);
13192         if (
13193                 18 <= FILE_cnt(fp) &&
13194                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13195         )
13196                 exit(0);
13197         exit(1);
13198 }
13199 EOP
13200 val="$undef"
13201 set try
13202 if eval $compile && $to try.c; then
13203         if $run ./try; then
13204                 echo "Your stdio acts pretty std."
13205                 val="$define"
13206         else
13207                 echo "Your stdio isn't very std."
13208         fi
13209 else
13210         echo "Your stdio doesn't appear very std."
13211 fi
13212 $rm_try
13213
13214 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13215 # direct buffer manipulation no longer works.  The Configure tests
13216 # should be changed to correctly detect this, but until then,
13217 # the following check should at least let perl compile and run.
13218 # (This quick fix should be updated before 5.8.1.)
13219 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13220 # A. Dougherty, June 3, 2002.
13221 case "$d_gnulibc" in
13222 $define)
13223         case "$gnulibc_version" in
13224         2.[01]*)  ;;
13225         2.2) ;;
13226         2.2.[0-9]) ;;
13227         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13228                 val="$undef"
13229                 ;;
13230         esac
13231         ;;
13232 esac
13233 set d_stdstdio
13234 eval $setvar
13235
13236 : Can _ptr be used as an lvalue?
13237 case "$d_stdstdio$ptr_lval" in
13238 $define$define) val=$define ;;
13239 *) val=$undef ;;
13240 esac
13241 set d_stdio_ptr_lval
13242 eval $setvar
13243
13244 : Can _cnt be used as an lvalue?
13245 case "$d_stdstdio$cnt_lval" in
13246 $define$define) val=$define ;;
13247 *) val=$undef ;;
13248 esac
13249 set d_stdio_cnt_lval
13250 eval $setvar
13251
13252
13253 : test whether setting _ptr sets _cnt as a side effect
13254 d_stdio_ptr_lval_sets_cnt="$undef"
13255 d_stdio_ptr_lval_nochange_cnt="$undef"
13256 case "$d_stdio_ptr_lval$d_stdstdio" in
13257 $define$define)
13258         echo "Checking to see what happens if we set the stdio ptr..." >&4
13259 $cat >try.c <<EOP
13260 #include <stdio.h>
13261 /* Can we scream? */
13262 /* Eat dust sed :-) */
13263 /* In the buffer space, no one can hear you scream. */
13264 #$i_stdlib I_STDLIB
13265 #ifdef I_STDLIB
13266 #include <stdlib.h>
13267 #endif
13268 #define FILE_ptr(fp)    $stdio_ptr
13269 #define FILE_cnt(fp)    $stdio_cnt
13270 #include <sys/types.h>
13271 int main() {
13272         FILE *fp = fopen("try.c", "r");
13273         int c;
13274         char *ptr;
13275         size_t cnt;
13276         if (!fp) {
13277             puts("Fail even to read");
13278             exit(1);
13279         }
13280         c = getc(fp); /* Read away the first # */
13281         if (c == EOF) {
13282             puts("Fail even to read");
13283             exit(1);
13284         }
13285         if (!(
13286                 18 <= FILE_cnt(fp) &&
13287                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13288         )) {
13289                 puts("Fail even to read");
13290                 exit (1);
13291         }
13292         ptr = (char*) FILE_ptr(fp);
13293         cnt = (size_t)FILE_cnt(fp);
13294
13295         FILE_ptr(fp) += 42;
13296
13297         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13298                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13299                 exit (1);
13300         }
13301         if (FILE_cnt(fp) <= 20) {
13302                 printf ("Fail (<20 chars to test)");
13303                 exit (1);
13304         }
13305         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13306                 puts("Fail compare");
13307                 exit (1);
13308         }
13309         if (cnt == FILE_cnt(fp)) {
13310                 puts("Pass_unchanged");
13311                 exit (0);
13312         }
13313         if (FILE_cnt(fp) == (cnt - 42)) {
13314                 puts("Pass_changed");
13315                 exit (0);
13316         }
13317         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13318         return 1;
13319
13320 }
13321 EOP
13322         set try
13323         if eval $compile && $to try.c; then
13324                 case `$run ./try` in
13325                 Pass_changed)
13326                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13327                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13328                 Pass_unchanged)
13329                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13330                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13331                 Fail*)
13332                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13333                 *)
13334                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13335         esac
13336         else
13337                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13338         fi
13339         $rm_try
13340         ;;
13341 esac
13342
13343 : see if _base is also standard
13344 val="$undef"
13345 case "$d_stdstdio" in
13346 $define)
13347         $cat >try.c <<EOP
13348 #include <stdio.h>
13349 #$i_stdlib I_STDLIB
13350 #ifdef I_STDLIB
13351 #include <stdlib.h>
13352 #endif
13353 #define FILE_base(fp)   $stdio_base
13354 #define FILE_bufsiz(fp) $stdio_bufsiz
13355 int main() {
13356         FILE *fp = fopen("try.c", "r");
13357         char c = getc(fp);
13358         if (
13359                 19 <= FILE_bufsiz(fp) &&
13360                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13361         )
13362                 exit(0);
13363         exit(1);
13364 }
13365 EOP
13366         set try
13367         if eval $compile && $to try.c; then
13368                 if $run ./try; then
13369                         echo "And its _base field acts std."
13370                         val="$define"
13371                 else
13372                         echo "But its _base field isn't std."
13373                 fi
13374         else
13375                 echo "However, it seems to be lacking the _base field."
13376         fi
13377         $rm_try
13378         ;;
13379 esac
13380 set d_stdiobase
13381 eval $setvar
13382
13383 : see if fast_stdio exists
13384 val="$undef"
13385 case "$d_stdstdio:$d_stdio_ptr_lval" in
13386 "$define:$define")
13387         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13388         *$define*)
13389                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13390                 val="$define"
13391                 ;;
13392         esac
13393         ;;
13394 esac
13395 set d_faststdio
13396 eval $setvar
13397
13398
13399
13400 : see if fchdir exists
13401 set fchdir d_fchdir
13402 eval $inlibc
13403
13404 : see if fchmod exists
13405 set fchmod d_fchmod
13406 eval $inlibc
13407
13408 : see if fchown exists
13409 set fchown d_fchown
13410 eval $inlibc
13411
13412 : see if this is an fcntl system
13413 set fcntl d_fcntl
13414 eval $inlibc
13415
13416 : See if fcntl-based locking works.
13417 echo " "
13418 $cat >try.c <<EOCP
13419 #$i_stdlib I_STDLIB
13420 #ifdef I_STDLIB
13421 #include <stdlib.h>
13422 #endif
13423 #include <unistd.h>
13424 #include <fcntl.h>
13425 #include <signal.h>
13426 $signal_t blech(int x) { exit(3); }
13427 int main() {
13428 #if defined(F_SETLK) && defined(F_SETLKW)
13429      struct flock flock;
13430      int retval, fd;
13431      fd = open("try.c", O_RDONLY);
13432      flock.l_type = F_RDLCK;
13433      flock.l_whence = SEEK_SET;
13434      flock.l_start = flock.l_len = 0;
13435      signal(SIGALRM, blech);
13436      alarm(10);
13437      retval = fcntl(fd, F_SETLK, &flock);
13438      close(fd);
13439      (retval < 0 ? exit(2) : exit(0));
13440 #else
13441      exit(2);
13442 #endif
13443 }
13444 EOCP
13445 echo "Checking if fcntl-based file locking works... "
13446 case "$d_fcntl" in
13447 "$define")
13448         set try
13449         if eval $compile_ok; then
13450                 if $run ./try; then
13451                         echo "Yes, it seems to work."
13452                         val="$define"
13453                 else
13454                         echo "Nope, it didn't work."
13455                         val="$undef"
13456                         case "$?" in
13457                         3) $cat >&4 <<EOM
13458 ***
13459 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13460 *** This is (almost) impossible.
13461 *** If your NFS lock daemons are not feeling well, something like
13462 *** this may happen, please investigate.  Cannot continue, aborting.
13463 ***
13464 EOM
13465                                 exit 1
13466                                 ;;
13467                         esac
13468                 fi
13469         else
13470                 echo "I'm unable to compile the test program, so I'll assume not."
13471                 val="$undef"
13472         fi
13473         ;;
13474 *) val="$undef";
13475         echo "Nope, since you don't even have fcntl()."
13476         ;;
13477 esac
13478 set d_fcntl_can_lock
13479 eval $setvar
13480 $rm_try
13481
13482 : check for fd_set items
13483 $cat <<EOM
13484
13485 Checking to see how well your C compiler handles fd_set and friends ...
13486 EOM
13487 $cat >try.c <<EOCP
13488 #$i_stdlib I_STDLIB
13489 #ifdef I_STDLIB
13490 #include <stdlib.h>
13491 #endif
13492 #$i_systime I_SYS_TIME
13493 #$i_sysselct I_SYS_SELECT
13494 #$d_socket HAS_SOCKET
13495 #include <sys/types.h>
13496 #ifdef HAS_SOCKET
13497 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13498 #endif
13499 #ifdef I_SYS_TIME
13500 #include <sys/time.h>
13501 #endif
13502 #ifdef I_SYS_SELECT
13503 #include <sys/select.h>
13504 #endif
13505 int main() {
13506         fd_set fds;
13507
13508 #ifdef TRYBITS
13509         if(fds.fds_bits);
13510 #endif
13511
13512 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13513         exit(0);
13514 #else
13515         exit(1);
13516 #endif
13517 }
13518 EOCP
13519 set try -DTRYBITS
13520 if eval $compile; then
13521         d_fds_bits="$define"
13522         d_fd_set="$define"
13523         echo "Well, your system knows about the normal fd_set typedef..." >&4
13524         if $run ./try; then
13525                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13526                 d_fd_macros="$define"
13527         else
13528                 $cat >&4 <<'EOM'
13529 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13530 EOM
13531                 d_fd_macros="$undef"
13532         fi
13533 else
13534         $cat <<'EOM'
13535 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13536 EOM
13537         set try
13538         if eval $compile; then
13539                 d_fds_bits="$undef"
13540                 d_fd_set="$define"
13541                 echo "Well, your system has some sort of fd_set available..." >&4
13542                 if $run ./try; then
13543                         echo "and you have the normal fd_set macros." >&4
13544                         d_fd_macros="$define"
13545                 else
13546                         $cat <<'EOM'
13547 but not the normal fd_set macros!  Gross!  More work for me...
13548 EOM
13549                         d_fd_macros="$undef"
13550                 fi
13551         else
13552         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13553                 d_fd_set="$undef"
13554                 d_fds_bits="$undef"
13555                 d_fd_macros="$undef"
13556         fi
13557 fi
13558 $rm_try
13559
13560 : see if fgetpos exists
13561 set fgetpos d_fgetpos
13562 eval $inlibc
13563
13564 : see if finite exists
13565 set finite d_finite
13566 eval $inlibc
13567
13568 : see if finitel exists
13569 set finitel d_finitel
13570 eval $inlibc
13571
13572 : see if flock exists
13573 set flock d_flock
13574 eval $inlibc
13575
13576 : see if prototype for flock is available
13577 echo " "
13578 set d_flockproto flock $i_sysfile sys/file.h
13579 eval $hasproto
13580
13581 : see if fp_class exists
13582 set fp_class d_fp_class
13583 eval $inlibc
13584
13585 : see if pathconf exists
13586 set pathconf d_pathconf
13587 eval $inlibc
13588
13589 : see if fpathconf exists
13590 set fpathconf d_fpathconf
13591 eval $inlibc
13592
13593 : see if fpclass exists
13594 set fpclass d_fpclass
13595 eval $inlibc
13596
13597 : see if fpclassify exists
13598 set fpclassify d_fpclassify
13599 eval $inlibc
13600
13601 : see if fpclassl exists
13602 set fpclassl d_fpclassl
13603 eval $inlibc
13604
13605 : check for fpos64_t
13606 echo " "
13607 echo "Checking to see if you have fpos64_t..." >&4
13608 $cat >try.c <<EOCP
13609 #include <stdio.h>
13610 int main() { fpos64_t x = 7; }
13611 EOCP
13612 set try
13613 if eval $compile; then
13614         val="$define"
13615         echo "You have fpos64_t."
13616 else
13617         val="$undef"
13618         echo "You do not have fpos64_t."
13619         case "$fpossize" in
13620         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13621         esac
13622 fi
13623 $rm_try
13624 set d_fpos64_t
13625 eval $setvar
13626
13627 : see if frexpl exists
13628 set frexpl d_frexpl
13629 eval $inlibc
13630
13631 : see if this is a sys/param system
13632 set sys/param.h i_sysparam
13633 eval $inhdr
13634
13635 : see if this is a sys/mount.h system
13636 set sys/mount.h i_sysmount
13637 eval $inhdr
13638
13639 : Check for fs_data_s
13640 echo " "
13641 echo "Checking to see if your system supports struct fs_data..." >&4
13642 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13643 eval $hasstruct
13644 case "$d_fs_data_s" in
13645 "$define")      echo "Yes, it does."   ;;
13646 *)              echo "No, it doesn't." ;;
13647 esac
13648
13649 : see if fseeko exists
13650 set fseeko d_fseeko
13651 eval $inlibc
13652 case "$longsize" in
13653 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13654 esac
13655
13656 : see if fsetpos exists
13657 set fsetpos d_fsetpos
13658 eval $inlibc
13659
13660 : see if fstatfs exists
13661 set fstatfs d_fstatfs
13662 eval $inlibc
13663
13664 : see if statvfs exists
13665 set statvfs d_statvfs
13666 eval $inlibc
13667
13668 : see if fstatvfs exists
13669 set fstatvfs d_fstatvfs
13670 eval $inlibc
13671
13672
13673 : see if fsync exists
13674 set fsync d_fsync
13675 eval $inlibc
13676
13677 : see if ftello exists
13678 set ftello d_ftello
13679 eval $inlibc
13680 case "$longsize" in
13681 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13682 esac
13683
13684 : check for a working futimes
13685 d_futimes="$undef"
13686 echo " "
13687 echo "Checking if you have a working futimes()" >&4
13688 $cat >try.c <<EOCP
13689 #include <stdio.h>
13690 #include <sys/time.h>
13691 #include <errno.h>
13692 #include <fcntl.h>
13693
13694 int main ()
13695 {
13696     int fd, rv;
13697     fd = open ("try.c", O_RDWR);
13698     if (-1 == fd) exit (1);
13699     rv = futimes (fd, NULL);
13700     exit (rv == -1 ? errno : 0);
13701 }
13702 EOCP
13703 set try
13704 if eval $compile; then
13705     `$run ./try`
13706     rc=$?
13707     case "$rc" in
13708         0)  echo "Yes, you have" >&4
13709             d_futimes="$define"
13710             ;;
13711         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13712             ;;
13713     esac
13714 else
13715     echo "No, it does not (probably harmless)" >&4
13716 fi
13717 $rm_try
13718
13719 : see if ndbm.h is available
13720 set ndbm.h i_ndbm
13721 eval $inhdr
13722 : Compatibility location for RedHat 7.1
13723 set gdbm/ndbm.h i_gdbmndbm
13724 eval $inhdr
13725 : Compatibility location for Debian 4.0
13726 set gdbm-ndbm.h i_gdbm_ndbm
13727 eval $inhdr
13728
13729 val="$undef"
13730 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13731         : see if dbm_open exists
13732         set dbm_open d_dbm_open
13733         eval $inlibc
13734         case "$d_dbm_open" in
13735         $undef)
13736                 i_ndbm="$undef"
13737                 i_gdbmndbm="$undef"
13738                 i_gdbm_ndbm="$undef"
13739                 echo "We won't be including <ndbm.h>"
13740                 val="$undef"
13741                 ;;
13742         *) val="$define"
13743            ;;
13744         esac
13745 fi
13746 set d_ndbm
13747 eval $setvar
13748
13749 ndbm_hdr_protochk='name=$1; hdr=$2;
13750 eval "ihdr=\$""i_$name";
13751 val="$undef";
13752 if $test "$ihdr" = "$define"; then
13753         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13754         case "$d_cplusplus" in
13755         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13756         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13757         esac;
13758         case "$val" in
13759         $define) $echo "Your <$hdr> seems to have prototypes";;
13760         *) $echo "Your <$hdr> does not seem to have prototypes";;
13761         esac;
13762 fi;
13763 set "d_${name}_h_uses_prototypes";
13764 eval $setvar'
13765
13766 set ndbm ndbm.h
13767 eval $ndbm_hdr_protochk
13768 set gdbmndbm gdbm/ndbm.h
13769 eval $ndbm_hdr_protochk
13770 set gdbm_ndbm gdbm-ndbm.h
13771 eval $ndbm_hdr_protochk
13772
13773 : see if getaddrinfo exists
13774 set getaddrinfo d_getaddrinfo
13775 eval $inlibc
13776
13777 : see if getcwd exists
13778 set getcwd d_getcwd
13779 eval $inlibc
13780
13781 : see if getespwnam exists
13782 set getespwnam d_getespwnam
13783 eval $inlibc
13784
13785 : see if getfsstat exists
13786 set getfsstat d_getfsstat
13787 eval $inlibc
13788
13789 : see if getgrent exists
13790 set getgrent d_getgrent
13791 eval $inlibc
13792
13793 : see if getgrent_r exists
13794 set getgrent_r d_getgrent_r
13795 eval $inlibc
13796 case "$d_getgrent_r" in
13797 "$define")
13798         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13799         case "$d_getgrent_r_proto:$usethreads" in
13800         ":define")      d_getgrent_r_proto=define
13801                 set d_getgrent_r_proto getgrent_r $hdrs
13802                 eval $hasproto ;;
13803         *)      ;;
13804         esac
13805         case "$d_getgrent_r_proto" in
13806         define)
13807         case "$getgrent_r_proto" in
13808         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13809         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13810         esac
13811         case "$getgrent_r_proto" in
13812         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13813         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13814         esac
13815         case "$getgrent_r_proto" in
13816         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13817         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13818         esac
13819         case "$getgrent_r_proto" in
13820         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13821         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13822         esac
13823         case "$getgrent_r_proto" in
13824         ''|0) try='int getgrent_r(struct group*, char*, int);'
13825         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13826         esac
13827         case "$getgrent_r_proto" in
13828         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13829         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13830         esac
13831         case "$getgrent_r_proto" in
13832         ''|0)   d_getgrent_r=undef
13833                 getgrent_r_proto=0
13834                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13835         * )     case "$getgrent_r_proto" in
13836                 REENTRANT_PROTO*) ;;
13837                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13838                 esac
13839                 echo "Prototype: $try" ;;
13840         esac
13841         ;;
13842         *)      case "$usethreads" in
13843                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13844                 esac
13845                 d_getgrent_r=undef
13846                 getgrent_r_proto=0
13847                 ;;
13848         esac
13849         ;;
13850 *)      getgrent_r_proto=0
13851         ;;
13852 esac
13853
13854 : see if getgrgid_r exists
13855 set getgrgid_r d_getgrgid_r
13856 eval $inlibc
13857 case "$d_getgrgid_r" in
13858 "$define")
13859         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13860         case "$d_getgrgid_r_proto:$usethreads" in
13861         ":define")      d_getgrgid_r_proto=define
13862                 set d_getgrgid_r_proto getgrgid_r $hdrs
13863                 eval $hasproto ;;
13864         *)      ;;
13865         esac
13866         case "$d_getgrgid_r_proto" in
13867         define)
13868         case "$getgrgid_r_proto" in
13869         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13870         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13871         esac
13872         case "$getgrgid_r_proto" in
13873         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13874         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13875         esac
13876         case "$getgrgid_r_proto" in
13877         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13878         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13879         esac
13880         case "$getgrgid_r_proto" in
13881         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13882         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13883         esac
13884         case "$getgrgid_r_proto" in
13885         ''|0)   d_getgrgid_r=undef
13886                 getgrgid_r_proto=0
13887                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13888         * )     case "$getgrgid_r_proto" in
13889                 REENTRANT_PROTO*) ;;
13890                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13891                 esac
13892                 echo "Prototype: $try" ;;
13893         esac
13894         ;;
13895         *)      case "$usethreads" in
13896                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13897                 esac
13898                 d_getgrgid_r=undef
13899                 getgrgid_r_proto=0
13900                 ;;
13901         esac
13902         ;;
13903 *)      getgrgid_r_proto=0
13904         ;;
13905 esac
13906
13907 : see if getgrnam_r exists
13908 set getgrnam_r d_getgrnam_r
13909 eval $inlibc
13910 case "$d_getgrnam_r" in
13911 "$define")
13912         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13913         case "$d_getgrnam_r_proto:$usethreads" in
13914         ":define")      d_getgrnam_r_proto=define
13915                 set d_getgrnam_r_proto getgrnam_r $hdrs
13916                 eval $hasproto ;;
13917         *)      ;;
13918         esac
13919         case "$d_getgrnam_r_proto" in
13920         define)
13921         case "$getgrnam_r_proto" in
13922         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13923         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13924         esac
13925         case "$getgrnam_r_proto" in
13926         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13927         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13928         esac
13929         case "$getgrnam_r_proto" in
13930         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13931         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13932         esac
13933         case "$getgrnam_r_proto" in
13934         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13935         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13936         esac
13937         case "$getgrnam_r_proto" in
13938         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13939         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13940         esac
13941         case "$getgrnam_r_proto" in
13942         ''|0)   d_getgrnam_r=undef
13943                 getgrnam_r_proto=0
13944                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13945         * )     case "$getgrnam_r_proto" in
13946                 REENTRANT_PROTO*) ;;
13947                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13948                 esac
13949                 echo "Prototype: $try" ;;
13950         esac
13951         ;;
13952         *)      case "$usethreads" in
13953                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13954                 esac
13955                 d_getgrnam_r=undef
13956                 getgrnam_r_proto=0
13957                 ;;
13958         esac
13959         ;;
13960 *)      getgrnam_r_proto=0
13961         ;;
13962 esac
13963
13964 : see if gethostbyaddr exists
13965 set gethostbyaddr d_gethbyaddr
13966 eval $inlibc
13967
13968 : see if gethostbyname exists
13969 set gethostbyname d_gethbyname
13970 eval $inlibc
13971
13972 : see if gethostent exists
13973 set gethostent d_gethent
13974 eval $inlibc
13975
13976 : see how we will look up host name
13977 echo " "
13978 call=''
13979 if set gethostname val -f d_gethname; eval $csym; $val; then
13980         echo 'gethostname() found.' >&4
13981         d_gethname="$define"
13982         call=gethostname
13983 fi
13984 if set uname val -f d_uname; eval $csym; $val; then
13985         if ./xenix; then
13986                 $cat <<'EOM'
13987 uname() was found, but you're running xenix, and older versions of xenix
13988 have a broken uname(). If you don't really know whether your xenix is old
13989 enough to have a broken system call, use the default answer.
13990
13991 EOM
13992                 dflt=y
13993                 case "$d_uname" in
13994                 "$define") dflt=n;;
13995                 esac
13996                 rp='Is your uname() broken?'
13997                 . ./myread
13998                 case "$ans" in
13999                 n*) d_uname="$define"; call=uname;;
14000                 esac
14001         else
14002                 echo 'uname() found.' >&4
14003                 d_uname="$define"
14004                 case "$call" in
14005                 '') call=uname ;;
14006                 esac
14007         fi
14008 fi
14009 case "$d_gethname" in
14010 '') d_gethname="$undef";;
14011 esac
14012 case "$d_uname" in
14013 '') d_uname="$undef";;
14014 esac
14015 case "$d_uname$d_gethname" in
14016 *define*)
14017         dflt=n
14018         cat <<EOM
14019
14020 Every now and then someone has a $call() that lies about the hostname
14021 but can't be fixed for political or economic reasons.  If you wish, I can
14022 pretend $call() isn't there and maybe compute hostname at run-time
14023 thanks to the '$phostname' command.
14024
14025 EOM
14026         rp="Shall I ignore $call() from now on?"
14027         . ./myread
14028         case "$ans" in
14029         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14030         esac;;
14031 esac
14032 case "$phostname" in
14033 '') aphostname='';;
14034 *) case "$aphostname" in
14035         /*) ;;
14036         *) set X $phostname
14037                 shift
14038                 file=$1
14039                 shift
14040                 file=`./loc $file $file $pth`
14041                 aphostname=`echo $file $*`
14042                 ;;
14043         esac
14044         ;;
14045 esac
14046 case "$d_uname$d_gethname" in
14047 *define*) ;;
14048 *)
14049         case "$phostname" in
14050         '')
14051                 echo "There will be no way for $package to get your hostname." >&4;;
14052         *)
14053         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14054                 ;;
14055         esac;;
14056 esac
14057 case "$d_phostname" in
14058 '') d_phostname="$undef";;
14059 esac
14060
14061 : see if gethostbyaddr_r exists
14062 set gethostbyaddr_r d_gethostbyaddr_r
14063 eval $inlibc
14064 case "$d_gethostbyaddr_r" in
14065 "$define")
14066         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14067         case "$d_gethostbyaddr_r_proto:$usethreads" in
14068         ":define")      d_gethostbyaddr_r_proto=define
14069                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14070                 eval $hasproto ;;
14071         *)      ;;
14072         esac
14073         case "$d_gethostbyaddr_r_proto" in
14074         define)
14075         case "$gethostbyaddr_r_proto" in
14076         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14077         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14078         esac
14079         case "$gethostbyaddr_r_proto" in
14080         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14081         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14082         esac
14083         case "$gethostbyaddr_r_proto" in
14084         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14085         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14086         esac
14087         case "$gethostbyaddr_r_proto" in
14088         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14089         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14090         esac
14091         case "$gethostbyaddr_r_proto" in
14092         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14093         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14094         esac
14095         case "$gethostbyaddr_r_proto" in
14096         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14097         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14098         esac
14099         case "$gethostbyaddr_r_proto" in
14100         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14101         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14102         esac
14103         case "$gethostbyaddr_r_proto" in
14104         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14105         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14106         esac
14107         case "$gethostbyaddr_r_proto" in
14108         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14109         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14110         esac
14111         case "$gethostbyaddr_r_proto" in
14112         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14113         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14114         esac
14115         case "$gethostbyaddr_r_proto" in
14116         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14117         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14118         esac
14119         case "$gethostbyaddr_r_proto" in
14120         ''|0)   d_gethostbyaddr_r=undef
14121                 gethostbyaddr_r_proto=0
14122                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14123         * )     case "$gethostbyaddr_r_proto" in
14124                 REENTRANT_PROTO*) ;;
14125                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14126                 esac
14127                 echo "Prototype: $try" ;;
14128         esac
14129         ;;
14130         *)      case "$usethreads" in
14131                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14132                 esac
14133                 d_gethostbyaddr_r=undef
14134                 gethostbyaddr_r_proto=0
14135                 ;;
14136         esac
14137         ;;
14138 *)      gethostbyaddr_r_proto=0
14139         ;;
14140 esac
14141
14142 : see if gethostbyname_r exists
14143 set gethostbyname_r d_gethostbyname_r
14144 eval $inlibc
14145 case "$d_gethostbyname_r" in
14146 "$define")
14147         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14148         case "$d_gethostbyname_r_proto:$usethreads" in
14149         ":define")      d_gethostbyname_r_proto=define
14150                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14151                 eval $hasproto ;;
14152         *)      ;;
14153         esac
14154         case "$d_gethostbyname_r_proto" in
14155         define)
14156         case "$gethostbyname_r_proto" in
14157         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14158         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14159         esac
14160         case "$gethostbyname_r_proto" in
14161         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14162         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14163         esac
14164         case "$gethostbyname_r_proto" in
14165         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14166         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14167         esac
14168         case "$gethostbyname_r_proto" in
14169         ''|0)   d_gethostbyname_r=undef
14170                 gethostbyname_r_proto=0
14171                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14172         * )     case "$gethostbyname_r_proto" in
14173                 REENTRANT_PROTO*) ;;
14174                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14175                 esac
14176                 echo "Prototype: $try" ;;
14177         esac
14178         ;;
14179         *)      case "$usethreads" in
14180                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14181                 esac
14182                 d_gethostbyname_r=undef
14183                 gethostbyname_r_proto=0
14184                 ;;
14185         esac
14186         ;;
14187 *)      gethostbyname_r_proto=0
14188         ;;
14189 esac
14190
14191 : see if gethostent_r exists
14192 set gethostent_r d_gethostent_r
14193 eval $inlibc
14194 case "$d_gethostent_r" in
14195 "$define")
14196         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14197         case "$d_gethostent_r_proto:$usethreads" in
14198         ":define")      d_gethostent_r_proto=define
14199                 set d_gethostent_r_proto gethostent_r $hdrs
14200                 eval $hasproto ;;
14201         *)      ;;
14202         esac
14203         case "$d_gethostent_r_proto" in
14204         define)
14205         case "$gethostent_r_proto" in
14206         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14207         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14208         esac
14209         case "$gethostent_r_proto" in
14210         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14211         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14212         esac
14213         case "$gethostent_r_proto" in
14214         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14215         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14216         esac
14217         case "$gethostent_r_proto" in
14218         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14219         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14220         esac
14221         case "$gethostent_r_proto" in
14222         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14223         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14224         esac
14225         case "$gethostent_r_proto" in
14226         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14227         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14228         esac
14229         case "$gethostent_r_proto" in
14230         ''|0)   d_gethostent_r=undef
14231                 gethostent_r_proto=0
14232                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14233         * )     case "$gethostent_r_proto" in
14234                 REENTRANT_PROTO*) ;;
14235                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14236                 esac
14237                 echo "Prototype: $try" ;;
14238         esac
14239         ;;
14240         *)      case "$usethreads" in
14241                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14242                 esac
14243                 d_gethostent_r=undef
14244                 gethostent_r_proto=0
14245                 ;;
14246         esac
14247         ;;
14248 *)      gethostent_r_proto=0
14249         ;;
14250 esac
14251
14252 : see if prototypes for various gethostxxx netdb.h functions are available
14253 echo " "
14254 set d_gethostprotos gethostent $i_netdb netdb.h
14255 eval $hasproto
14256
14257 : see if getitimer exists
14258 set getitimer d_getitimer
14259 eval $inlibc
14260
14261 : see if getlogin exists
14262 set getlogin d_getlogin
14263 eval $inlibc
14264
14265 : see if getlogin_r exists
14266 set getlogin_r d_getlogin_r
14267 eval $inlibc
14268 case "$d_getlogin_r" in
14269 "$define")
14270         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14271         case "$d_getlogin_r_proto:$usethreads" in
14272         ":define")      d_getlogin_r_proto=define
14273                 set d_getlogin_r_proto getlogin_r $hdrs
14274                 eval $hasproto ;;
14275         *)      ;;
14276         esac
14277         case "$d_getlogin_r_proto" in
14278         define)
14279         case "$getlogin_r_proto" in
14280         ''|0) try='int getlogin_r(char*, size_t);'
14281         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14282         esac
14283         case "$getlogin_r_proto" in
14284         ''|0) try='int getlogin_r(char*, int);'
14285         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14286         esac
14287         case "$getlogin_r_proto" in
14288         ''|0) try='char* getlogin_r(char*, size_t);'
14289         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14290         esac
14291         case "$getlogin_r_proto" in
14292         ''|0) try='char* getlogin_r(char*, int);'
14293         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14294         esac
14295         case "$getlogin_r_proto" in
14296         ''|0)   d_getlogin_r=undef
14297                 getlogin_r_proto=0
14298                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14299         * )     case "$getlogin_r_proto" in
14300                 REENTRANT_PROTO*) ;;
14301                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14302                 esac
14303                 echo "Prototype: $try" ;;
14304         esac
14305         ;;
14306         *)      case "$usethreads" in
14307                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14308                 esac
14309                 d_getlogin_r=undef
14310                 getlogin_r_proto=0
14311                 ;;
14312         esac
14313         ;;
14314 *)      getlogin_r_proto=0
14315         ;;
14316 esac
14317
14318 : see if getmnt exists
14319 set getmnt d_getmnt
14320 eval $inlibc
14321
14322 : see if getmntent exists
14323 set getmntent d_getmntent
14324 eval $inlibc
14325
14326 : see if getnameinfo exists
14327 set getnameinfo d_getnameinfo
14328 eval $inlibc
14329
14330 : see if getnetbyaddr exists
14331 set getnetbyaddr d_getnbyaddr
14332 eval $inlibc
14333
14334 : see if getnetbyname exists
14335 set getnetbyname d_getnbyname
14336 eval $inlibc
14337
14338 : see if getnetent exists
14339 set getnetent d_getnent
14340 eval $inlibc
14341
14342 : see if getnetbyaddr_r exists
14343 set getnetbyaddr_r d_getnetbyaddr_r
14344 eval $inlibc
14345 case "$d_getnetbyaddr_r" in
14346 "$define")
14347         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14348         case "$d_getnetbyaddr_r_proto:$usethreads" in
14349         ":define")      d_getnetbyaddr_r_proto=define
14350                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14351                 eval $hasproto ;;
14352         *)      ;;
14353         esac
14354         case "$d_getnetbyaddr_r_proto" in
14355         define)
14356         case "$getnetbyaddr_r_proto" in
14357         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14358         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14359         esac
14360         case "$getnetbyaddr_r_proto" in
14361         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14362         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14363         esac
14364         case "$getnetbyaddr_r_proto" in
14365         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14366         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14367         esac
14368         case "$getnetbyaddr_r_proto" in
14369         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14370         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14371         esac
14372         case "$getnetbyaddr_r_proto" in
14373         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14374         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14375         esac
14376         case "$getnetbyaddr_r_proto" in
14377         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14378         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14379         esac
14380         case "$getnetbyaddr_r_proto" in
14381         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14382         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14383         esac
14384         case "$getnetbyaddr_r_proto" in
14385         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14386         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14387         esac
14388         case "$getnetbyaddr_r_proto" in
14389         ''|0)   d_getnetbyaddr_r=undef
14390                 getnetbyaddr_r_proto=0
14391                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14392         * )     case "$getnetbyaddr_r_proto" in
14393                 REENTRANT_PROTO*) ;;
14394                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14395                 esac
14396                 echo "Prototype: $try" ;;
14397         esac
14398         ;;
14399         *)      case "$usethreads" in
14400                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14401                 esac
14402                 d_getnetbyaddr_r=undef
14403                 getnetbyaddr_r_proto=0
14404                 ;;
14405         esac
14406         ;;
14407 *)      getnetbyaddr_r_proto=0
14408         ;;
14409 esac
14410
14411 : see if getnetbyname_r exists
14412 set getnetbyname_r d_getnetbyname_r
14413 eval $inlibc
14414 case "$d_getnetbyname_r" in
14415 "$define")
14416         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14417         case "$d_getnetbyname_r_proto:$usethreads" in
14418         ":define")      d_getnetbyname_r_proto=define
14419                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14420                 eval $hasproto ;;
14421         *)      ;;
14422         esac
14423         case "$d_getnetbyname_r_proto" in
14424         define)
14425         case "$getnetbyname_r_proto" in
14426         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14427         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14428         esac
14429         case "$getnetbyname_r_proto" in
14430         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14431         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14432         esac
14433         case "$getnetbyname_r_proto" in
14434         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14435         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14436         esac
14437         case "$getnetbyname_r_proto" in
14438         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14439         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14440         esac
14441         case "$getnetbyname_r_proto" in
14442         ''|0)   d_getnetbyname_r=undef
14443                 getnetbyname_r_proto=0
14444                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14445         * )     case "$getnetbyname_r_proto" in
14446                 REENTRANT_PROTO*) ;;
14447                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14448                 esac
14449                 echo "Prototype: $try" ;;
14450         esac
14451         ;;
14452         *)      case "$usethreads" in
14453                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14454                 esac
14455                 d_getnetbyname_r=undef
14456                 getnetbyname_r_proto=0
14457                 ;;
14458         esac
14459         ;;
14460 *)      getnetbyname_r_proto=0
14461         ;;
14462 esac
14463
14464 : see if getnetent_r exists
14465 set getnetent_r d_getnetent_r
14466 eval $inlibc
14467 case "$d_getnetent_r" in
14468 "$define")
14469         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14470         case "$d_getnetent_r_proto:$usethreads" in
14471         ":define")      d_getnetent_r_proto=define
14472                 set d_getnetent_r_proto getnetent_r $hdrs
14473                 eval $hasproto ;;
14474         *)      ;;
14475         esac
14476         case "$d_getnetent_r_proto" in
14477         define)
14478         case "$getnetent_r_proto" in
14479         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14480         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14481         esac
14482         case "$getnetent_r_proto" in
14483         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14484         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14485         esac
14486         case "$getnetent_r_proto" in
14487         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14488         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14489         esac
14490         case "$getnetent_r_proto" in
14491         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14492         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14493         esac
14494         case "$getnetent_r_proto" in
14495         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14496         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14497         esac
14498         case "$getnetent_r_proto" in
14499         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14500         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14501         esac
14502         case "$getnetent_r_proto" in
14503         ''|0)   d_getnetent_r=undef
14504                 getnetent_r_proto=0
14505                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14506         * )     case "$getnetent_r_proto" in
14507                 REENTRANT_PROTO*) ;;
14508                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14509                 esac
14510                 echo "Prototype: $try" ;;
14511         esac
14512         ;;
14513         *)      case "$usethreads" in
14514                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14515                 esac
14516                 d_getnetent_r=undef
14517                 getnetent_r_proto=0
14518                 ;;
14519         esac
14520         ;;
14521 *)      getnetent_r_proto=0
14522         ;;
14523 esac
14524
14525 : see if prototypes for various getnetxxx netdb.h functions are available
14526 echo " "
14527 set d_getnetprotos getnetent $i_netdb netdb.h
14528 eval $hasproto
14529
14530 : see if getpagesize exists
14531 set getpagesize d_getpagsz
14532 eval $inlibc
14533
14534 : Optional checks for getprotobyname and getprotobynumber
14535
14536 : see if getprotobyname exists
14537 set getprotobyname d_getpbyname
14538 eval $inlibc
14539
14540 : see if getprotobynumber exists
14541 set getprotobynumber d_getpbynumber
14542 eval $inlibc
14543
14544 : see if getprotoent exists
14545 set getprotoent d_getpent
14546 eval $inlibc
14547
14548 : see if getpgid exists
14549 set getpgid d_getpgid
14550 eval $inlibc
14551
14552 : see if getpgrp2 exists
14553 set getpgrp2 d_getpgrp2
14554 eval $inlibc
14555
14556 : see if getppid exists
14557 set getppid d_getppid
14558 eval $inlibc
14559
14560 : see if getpriority exists
14561 set getpriority d_getprior
14562 eval $inlibc
14563
14564 : see if getprotobyname_r exists
14565 set getprotobyname_r d_getprotobyname_r
14566 eval $inlibc
14567 case "$d_getprotobyname_r" in
14568 "$define")
14569         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14570         case "$d_getprotobyname_r_proto:$usethreads" in
14571         ":define")      d_getprotobyname_r_proto=define
14572                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14573                 eval $hasproto ;;
14574         *)      ;;
14575         esac
14576         case "$d_getprotobyname_r_proto" in
14577         define)
14578         case "$getprotobyname_r_proto" in
14579         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14580         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14581         esac
14582         case "$getprotobyname_r_proto" in
14583         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14584         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14585         esac
14586         case "$getprotobyname_r_proto" in
14587         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14588         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14589         esac
14590         case "$getprotobyname_r_proto" in
14591         ''|0)   d_getprotobyname_r=undef
14592                 getprotobyname_r_proto=0
14593                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14594         * )     case "$getprotobyname_r_proto" in
14595                 REENTRANT_PROTO*) ;;
14596                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14597                 esac
14598                 echo "Prototype: $try" ;;
14599         esac
14600         ;;
14601         *)      case "$usethreads" in
14602                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14603                 esac
14604                 d_getprotobyname_r=undef
14605                 getprotobyname_r_proto=0
14606                 ;;
14607         esac
14608         ;;
14609 *)      getprotobyname_r_proto=0
14610         ;;
14611 esac
14612
14613 : see if getprotobynumber_r exists
14614 set getprotobynumber_r d_getprotobynumber_r
14615 eval $inlibc
14616 case "$d_getprotobynumber_r" in
14617 "$define")
14618         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14619         case "$d_getprotobynumber_r_proto:$usethreads" in
14620         ":define")      d_getprotobynumber_r_proto=define
14621                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14622                 eval $hasproto ;;
14623         *)      ;;
14624         esac
14625         case "$d_getprotobynumber_r_proto" in
14626         define)
14627         case "$getprotobynumber_r_proto" in
14628         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14629         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14630         esac
14631         case "$getprotobynumber_r_proto" in
14632         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14633         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14634         esac
14635         case "$getprotobynumber_r_proto" in
14636         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14637         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14638         esac
14639         case "$getprotobynumber_r_proto" in
14640         ''|0)   d_getprotobynumber_r=undef
14641                 getprotobynumber_r_proto=0
14642                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14643         * )     case "$getprotobynumber_r_proto" in
14644                 REENTRANT_PROTO*) ;;
14645                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14646                 esac
14647                 echo "Prototype: $try" ;;
14648         esac
14649         ;;
14650         *)      case "$usethreads" in
14651                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14652                 esac
14653                 d_getprotobynumber_r=undef
14654                 getprotobynumber_r_proto=0
14655                 ;;
14656         esac
14657         ;;
14658 *)      getprotobynumber_r_proto=0
14659         ;;
14660 esac
14661
14662 : see if getprotoent_r exists
14663 set getprotoent_r d_getprotoent_r
14664 eval $inlibc
14665 case "$d_getprotoent_r" in
14666 "$define")
14667         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14668         case "$d_getprotoent_r_proto:$usethreads" in
14669         ":define")      d_getprotoent_r_proto=define
14670                 set d_getprotoent_r_proto getprotoent_r $hdrs
14671                 eval $hasproto ;;
14672         *)      ;;
14673         esac
14674         case "$d_getprotoent_r_proto" in
14675         define)
14676         case "$getprotoent_r_proto" in
14677         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14678         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14679         esac
14680         case "$getprotoent_r_proto" in
14681         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14682         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14683         esac
14684         case "$getprotoent_r_proto" in
14685         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14686         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14687         esac
14688         case "$getprotoent_r_proto" in
14689         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14690         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14691         esac
14692         case "$getprotoent_r_proto" in
14693         ''|0)   d_getprotoent_r=undef
14694                 getprotoent_r_proto=0
14695                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14696         * )     case "$getprotoent_r_proto" in
14697                 REENTRANT_PROTO*) ;;
14698                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14699                 esac
14700                 echo "Prototype: $try" ;;
14701         esac
14702         ;;
14703         *)      case "$usethreads" in
14704                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14705                 esac
14706                 d_getprotoent_r=undef
14707                 getprotoent_r_proto=0
14708                 ;;
14709         esac
14710         ;;
14711 *)      getprotoent_r_proto=0
14712         ;;
14713 esac
14714
14715 : see if prototypes for various getprotoxxx netdb.h functions are available
14716 echo " "
14717 set d_getprotoprotos getprotoent $i_netdb netdb.h
14718 eval $hasproto
14719
14720 : see if getprpwnam exists
14721 set getprpwnam d_getprpwnam
14722 eval $inlibc
14723
14724 : see if getpwent exists
14725 set getpwent d_getpwent
14726 eval $inlibc
14727
14728 : see if getpwent_r exists
14729 set getpwent_r d_getpwent_r
14730 eval $inlibc
14731 case "$d_getpwent_r" in
14732 "$define")
14733         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14734         case "$d_getpwent_r_proto:$usethreads" in
14735         ":define")      d_getpwent_r_proto=define
14736                 set d_getpwent_r_proto getpwent_r $hdrs
14737                 eval $hasproto ;;
14738         *)      ;;
14739         esac
14740         case "$d_getpwent_r_proto" in
14741         define)
14742         case "$getpwent_r_proto" in
14743         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14744         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14745         esac
14746         case "$getpwent_r_proto" in
14747         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14748         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14749         esac
14750         case "$getpwent_r_proto" in
14751         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14752         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14753         esac
14754         case "$getpwent_r_proto" in
14755         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14756         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14757         esac
14758         case "$getpwent_r_proto" in
14759         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14760         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14761         esac
14762         case "$getpwent_r_proto" in
14763         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14764         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14765         esac
14766         case "$getpwent_r_proto" in
14767         ''|0)   d_getpwent_r=undef
14768                 getpwent_r_proto=0
14769                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14770         * )     case "$getpwent_r_proto" in
14771                 REENTRANT_PROTO*) ;;
14772                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14773                 esac
14774                 echo "Prototype: $try" ;;
14775         esac
14776         ;;
14777         *)      case "$usethreads" in
14778                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14779                 esac
14780                 d_getpwent_r=undef
14781                 getpwent_r_proto=0
14782                 ;;
14783         esac
14784         ;;
14785 *)      getpwent_r_proto=0
14786         ;;
14787 esac
14788
14789 : see if getpwnam_r exists
14790 set getpwnam_r d_getpwnam_r
14791 eval $inlibc
14792 case "$d_getpwnam_r" in
14793 "$define")
14794         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14795         case "$d_getpwnam_r_proto:$usethreads" in
14796         ":define")      d_getpwnam_r_proto=define
14797                 set d_getpwnam_r_proto getpwnam_r $hdrs
14798                 eval $hasproto ;;
14799         *)      ;;
14800         esac
14801         case "$d_getpwnam_r_proto" in
14802         define)
14803         case "$getpwnam_r_proto" in
14804         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14805         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14806         esac
14807         case "$getpwnam_r_proto" in
14808         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14809         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14810         esac
14811         case "$getpwnam_r_proto" in
14812         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14813         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14814         esac
14815         case "$getpwnam_r_proto" in
14816         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14817         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14818         esac
14819         case "$getpwnam_r_proto" in
14820         ''|0)   d_getpwnam_r=undef
14821                 getpwnam_r_proto=0
14822                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14823         * )     case "$getpwnam_r_proto" in
14824                 REENTRANT_PROTO*) ;;
14825                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14826                 esac
14827                 echo "Prototype: $try" ;;
14828         esac
14829         ;;
14830         *)      case "$usethreads" in
14831                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14832                 esac
14833                 d_getpwnam_r=undef
14834                 getpwnam_r_proto=0
14835                 ;;
14836         esac
14837         ;;
14838 *)      getpwnam_r_proto=0
14839         ;;
14840 esac
14841
14842 : see if getpwuid_r exists
14843 set getpwuid_r d_getpwuid_r
14844 eval $inlibc
14845 case "$d_getpwuid_r" in
14846 "$define")
14847         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14848         case "$d_getpwuid_r_proto:$usethreads" in
14849         ":define")      d_getpwuid_r_proto=define
14850                 set d_getpwuid_r_proto getpwuid_r $hdrs
14851                 eval $hasproto ;;
14852         *)      ;;
14853         esac
14854         case "$d_getpwuid_r_proto" in
14855         define)
14856         case "$getpwuid_r_proto" in
14857         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14858         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14859         esac
14860         case "$getpwuid_r_proto" in
14861         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14862         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14863         esac
14864         case "$getpwuid_r_proto" in
14865         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14866         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14867         esac
14868         case "$getpwuid_r_proto" in
14869         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14870         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14871         esac
14872         case "$getpwuid_r_proto" in
14873         ''|0)   d_getpwuid_r=undef
14874                 getpwuid_r_proto=0
14875                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14876         * )     case "$getpwuid_r_proto" in
14877                 REENTRANT_PROTO*) ;;
14878                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14879                 esac
14880                 echo "Prototype: $try" ;;
14881         esac
14882         ;;
14883         *)      case "$usethreads" in
14884                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14885                 esac
14886                 d_getpwuid_r=undef
14887                 getpwuid_r_proto=0
14888                 ;;
14889         esac
14890         ;;
14891 *)      getpwuid_r_proto=0
14892         ;;
14893 esac
14894
14895 : Optional checks for getsbyname and getsbyport
14896
14897 : see if getservbyname exists
14898 set getservbyname d_getsbyname
14899 eval $inlibc
14900
14901 : see if getservbyport exists
14902 set getservbyport d_getsbyport
14903 eval $inlibc
14904
14905 : see if getservent exists
14906 set getservent d_getsent
14907 eval $inlibc
14908
14909 : see if getservbyname_r exists
14910 set getservbyname_r d_getservbyname_r
14911 eval $inlibc
14912 case "$d_getservbyname_r" in
14913 "$define")
14914         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14915         case "$d_getservbyname_r_proto:$usethreads" in
14916         ":define")      d_getservbyname_r_proto=define
14917                 set d_getservbyname_r_proto getservbyname_r $hdrs
14918                 eval $hasproto ;;
14919         *)      ;;
14920         esac
14921         case "$d_getservbyname_r_proto" in
14922         define)
14923         case "$getservbyname_r_proto" in
14924         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14925         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14926         esac
14927         case "$getservbyname_r_proto" in
14928         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14929         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14930         esac
14931         case "$getservbyname_r_proto" in
14932         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14933         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14934         esac
14935         case "$getservbyname_r_proto" in
14936         ''|0)   d_getservbyname_r=undef
14937                 getservbyname_r_proto=0
14938                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14939         * )     case "$getservbyname_r_proto" in
14940                 REENTRANT_PROTO*) ;;
14941                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14942                 esac
14943                 echo "Prototype: $try" ;;
14944         esac
14945         ;;
14946         *)      case "$usethreads" in
14947                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14948                 esac
14949                 d_getservbyname_r=undef
14950                 getservbyname_r_proto=0
14951                 ;;
14952         esac
14953         ;;
14954 *)      getservbyname_r_proto=0
14955         ;;
14956 esac
14957
14958 : see if getservbyport_r exists
14959 set getservbyport_r d_getservbyport_r
14960 eval $inlibc
14961 case "$d_getservbyport_r" in
14962 "$define")
14963         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14964         case "$d_getservbyport_r_proto:$usethreads" in
14965         ":define")      d_getservbyport_r_proto=define
14966                 set d_getservbyport_r_proto getservbyport_r $hdrs
14967                 eval $hasproto ;;
14968         *)      ;;
14969         esac
14970         case "$d_getservbyport_r_proto" in
14971         define)
14972         case "$getservbyport_r_proto" in
14973         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14974         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14975         esac
14976         case "$getservbyport_r_proto" in
14977         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14978         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14979         esac
14980         case "$getservbyport_r_proto" in
14981         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14982         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14983         esac
14984         case "$getservbyport_r_proto" in
14985         ''|0)   d_getservbyport_r=undef
14986                 getservbyport_r_proto=0
14987                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14988         * )     case "$getservbyport_r_proto" in
14989                 REENTRANT_PROTO*) ;;
14990                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14991                 esac
14992                 echo "Prototype: $try" ;;
14993         esac
14994         ;;
14995         *)      case "$usethreads" in
14996                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14997                 esac
14998                 d_getservbyport_r=undef
14999                 getservbyport_r_proto=0
15000                 ;;
15001         esac
15002         ;;
15003 *)      getservbyport_r_proto=0
15004         ;;
15005 esac
15006
15007 : see if getservent_r exists
15008 set getservent_r d_getservent_r
15009 eval $inlibc
15010 case "$d_getservent_r" in
15011 "$define")
15012         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15013         case "$d_getservent_r_proto:$usethreads" in
15014         ":define")      d_getservent_r_proto=define
15015                 set d_getservent_r_proto getservent_r $hdrs
15016                 eval $hasproto ;;
15017         *)      ;;
15018         esac
15019         case "$d_getservent_r_proto" in
15020         define)
15021         case "$getservent_r_proto" in
15022         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15023         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15024         esac
15025         case "$getservent_r_proto" in
15026         ''|0) try='int getservent_r(struct servent*, char*, int);'
15027         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15028         esac
15029         case "$getservent_r_proto" in
15030         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15031         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15032         esac
15033         case "$getservent_r_proto" in
15034         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15035         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15036         esac
15037         case "$getservent_r_proto" in
15038         ''|0)   d_getservent_r=undef
15039                 getservent_r_proto=0
15040                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15041         * )     case "$getservent_r_proto" in
15042                 REENTRANT_PROTO*) ;;
15043                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15044                 esac
15045                 echo "Prototype: $try" ;;
15046         esac
15047         ;;
15048         *)      case "$usethreads" in
15049                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15050                 esac
15051                 d_getservent_r=undef
15052                 getservent_r_proto=0
15053                 ;;
15054         esac
15055         ;;
15056 *)      getservent_r_proto=0
15057         ;;
15058 esac
15059
15060 : see if prototypes for various getservxxx netdb.h functions are available
15061 echo " "
15062 set d_getservprotos getservent $i_netdb netdb.h
15063 eval $hasproto
15064
15065 : see if getspnam exists
15066 set getspnam d_getspnam
15067 eval $inlibc
15068
15069 : see if this is a shadow.h system
15070 set shadow.h i_shadow
15071 eval $inhdr
15072
15073 : see if getspnam_r exists
15074 set getspnam_r d_getspnam_r
15075 eval $inlibc
15076 case "$d_getspnam_r" in
15077 "$define")
15078         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15079         case "$d_getspnam_r_proto:$usethreads" in
15080         ":define")      d_getspnam_r_proto=define
15081                 set d_getspnam_r_proto getspnam_r $hdrs
15082                 eval $hasproto ;;
15083         *)      ;;
15084         esac
15085         case "$d_getspnam_r_proto" in
15086         define)
15087         case "$getspnam_r_proto" in
15088         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15089         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15090         esac
15091         case "$getspnam_r_proto" in
15092         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15093         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15094         esac
15095         case "$getspnam_r_proto" in
15096         ''|0)   d_getspnam_r=undef
15097                 getspnam_r_proto=0
15098                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15099         * )     case "$getspnam_r_proto" in
15100                 REENTRANT_PROTO*) ;;
15101                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15102                 esac
15103                 echo "Prototype: $try" ;;
15104         esac
15105         ;;
15106         *)      case "$usethreads" in
15107                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15108                 esac
15109                 d_getspnam_r=undef
15110                 getspnam_r_proto=0
15111                 ;;
15112         esac
15113         ;;
15114 *)      getspnam_r_proto=0
15115         ;;
15116 esac
15117
15118 : see if gettimeofday or ftime exists
15119 set gettimeofday d_gettimeod
15120 eval $inlibc
15121 case "$d_gettimeod" in
15122 "$undef")
15123         set ftime d_ftime 
15124         eval $inlibc
15125         ;;
15126 *)
15127         val="$undef"; set d_ftime; eval $setvar
15128         ;;
15129 esac
15130 case "$d_gettimeod$d_ftime" in
15131 "$undef$undef")
15132         echo " "
15133         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15134         ;;
15135 esac
15136
15137 : see if gmtime_r exists
15138 set gmtime_r d_gmtime_r
15139 eval $inlibc
15140 case "$d_gmtime_r" in
15141 "$define")
15142         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15143         case "$d_gmtime_r_proto:$usethreads" in
15144         ":define")      d_gmtime_r_proto=define
15145                 set d_gmtime_r_proto gmtime_r $hdrs
15146                 eval $hasproto ;;
15147         *)      ;;
15148         esac
15149         case "$d_gmtime_r_proto" in
15150         define)
15151         case "$gmtime_r_proto" in
15152         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15153         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15154         esac
15155         case "$gmtime_r_proto" in
15156         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15157         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15158         esac
15159         case "$gmtime_r_proto" in
15160         ''|0)   d_gmtime_r=undef
15161                 gmtime_r_proto=0
15162                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15163         * )     case "$gmtime_r_proto" in
15164                 REENTRANT_PROTO*) ;;
15165                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15166                 esac
15167                 echo "Prototype: $try" ;;
15168         esac
15169         ;;
15170         *)      case "$usethreads" in
15171                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15172                 esac
15173                 d_gmtime_r=undef
15174                 gmtime_r_proto=0
15175                 ;;
15176         esac
15177         ;;
15178 *)      gmtime_r_proto=0
15179         ;;
15180 esac
15181
15182 : see if hasmntopt exists
15183 set hasmntopt d_hasmntopt
15184 eval $inlibc
15185
15186 : see if this is a netinet/in.h or sys/in.h system
15187 set netinet/in.h i_niin sys/in.h i_sysin
15188 eval $inhdr
15189
15190 : see if arpa/inet.h has to be included
15191 set arpa/inet.h i_arpainet
15192 eval $inhdr
15193
15194 : see if htonl --and friends-- exists
15195 val=''
15196 set htonl val
15197 eval $inlibc
15198
15199 : Maybe they are macros.
15200 case "$val" in
15201 $undef)
15202         $cat >htonl.c <<EOM
15203 #include <stdio.h>
15204 #include <sys/types.h>
15205 #$i_niin I_NETINET_IN
15206 #$i_sysin I_SYS_IN
15207 #$i_arpainet I_ARPA_INET
15208 #ifdef I_NETINET_IN
15209 #include <netinet/in.h>
15210 #endif
15211 #ifdef I_SYS_IN
15212 #include <sys/in.h>
15213 #endif
15214 #ifdef I_ARPA_INET
15215 #include <arpa/inet.h>
15216 #endif
15217 #ifdef htonl
15218 printf("Defined as a macro.");
15219 #endif
15220 EOM
15221         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15222         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15223                 val="$define"
15224                 echo "But it seems to be defined as a macro." >&4
15225         fi
15226         $rm -f htonl.?
15227         ;;
15228 esac
15229 set d_htonl
15230 eval $setvar
15231
15232 : see if ilogbl exists
15233 set ilogbl d_ilogbl
15234 eval $inlibc
15235
15236 : index or strchr
15237 echo " "
15238 if set index val -f; eval $csym; $val; then
15239         if set strchr val -f d_strchr; eval $csym; $val; then
15240                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15241                         val="$define"
15242                         vali="$undef"
15243                         echo "strchr() found." >&4
15244                 else
15245                         val="$undef"
15246                         vali="$define"
15247                         echo "index() found." >&4
15248                 fi
15249         else
15250                 val="$undef"
15251                 vali="$define"
15252                 echo "index() found." >&4
15253         fi
15254 else
15255         if set strchr val -f d_strchr; eval $csym; $val; then
15256                 val="$define"
15257                 vali="$undef"
15258                 echo "strchr() found." >&4
15259         else
15260                 echo "No index() or strchr() found!" >&4
15261                 val="$undef"
15262                 vali="$undef"
15263         fi
15264 fi
15265 set d_strchr; eval $setvar
15266 val="$vali"
15267 set d_index; eval $setvar
15268
15269 : check whether inet_aton exists
15270 set inet_aton d_inetaton
15271 eval $inlibc
15272
15273 : see if inet_ntop exists
15274 set inet_ntop d_inetntop
15275 eval $inlibc
15276
15277 : see if inet_pton exists
15278 set inet_pton d_inetpton
15279 eval $inlibc
15280
15281 : Look for isascii
15282 echo " "
15283 $cat >isascii.c <<EOCP
15284 #include <stdio.h>
15285 #include <ctype.h>
15286 #$i_stdlib I_STDLIB
15287 #ifdef I_STDLIB
15288 #include <stdlib.h>
15289 #endif
15290 int main() {
15291         int c = 'A';
15292         if (isascii(c))
15293                 exit(0);
15294         else
15295                 exit(1);
15296 }
15297 EOCP
15298 set isascii
15299 if eval $compile; then
15300         echo "isascii() found." >&4
15301         val="$define"
15302 else
15303         echo "isascii() NOT found." >&4
15304         val="$undef"
15305 fi
15306 set d_isascii
15307 eval $setvar
15308 $rm -f isascii*
15309
15310 : Look for isblank
15311 echo " "
15312 $cat >isblank.c <<'EOCP'
15313 #include <stdio.h>
15314 #include <ctype.h>
15315 int main() {
15316         int c = ' ';
15317         if (isblank(c))
15318                 return 0 ;
15319         else
15320                 return 1 ;
15321 }
15322 EOCP
15323 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15324         echo "isblank() found." >&4
15325         val="$define"
15326 else
15327         echo "isblank() NOT found." >&4
15328         val="$undef"
15329 fi
15330 set d_isblank
15331 eval $setvar
15332 $rm -f isblank*
15333
15334 : see if isfinite exists
15335 set isfinite d_isfinite
15336 eval $inlibc
15337
15338 : see if isinf exists
15339 set isinf d_isinf
15340 eval $inlibc
15341
15342 : see if isnan exists
15343 set isnan d_isnan
15344 eval $inlibc
15345
15346 : see if isnanl exists
15347 set isnanl d_isnanl
15348 eval $inlibc
15349
15350 : see if killpg exists
15351 set killpg d_killpg
15352 eval $inlibc
15353
15354 : see if lchown exists
15355 echo " "
15356 $cat > try.c <<'EOCP'
15357 /* System header to define __stub macros and hopefully few prototypes,
15358     which can conflict with char lchown(); below.  */
15359 #include <assert.h>
15360 /* Override any gcc2 internal prototype to avoid an error.  */
15361 /* We use char because int might match the return type of a gcc2
15362    builtin and then its argument prototype would still apply.  */
15363 char lchown();
15364 int main() {
15365     /*  The GNU C library defines this for functions which it implements
15366         to always fail with ENOSYS.  Some functions are actually named
15367         something starting with __ and the normal name is an alias.  */
15368 #if defined (__stub_lchown) || defined (__stub___lchown)
15369 choke me
15370 #else
15371 lchown();
15372 #endif
15373 ; return 0; }
15374 EOCP
15375 set try
15376 if eval $compile; then
15377     $echo "lchown() found." >&4
15378     val="$define"
15379 else
15380     $echo "lchown() NOT found." >&4
15381     val="$undef"
15382 fi
15383 set d_lchown
15384 eval $setvar
15385
15386 : See if number of significant digits in a double precision number is known
15387 echo " "
15388 $cat >ldbl_dig.c <<EOM
15389 #$i_limits I_LIMITS
15390 #$i_float I_FLOAT
15391 #ifdef I_LIMITS
15392 #include <limits.h>
15393 #endif
15394 #ifdef I_FLOAT
15395 #include <float.h>
15396 #endif
15397 #ifdef LDBL_DIG
15398 printf("Contains LDBL_DIG");
15399 #endif
15400 EOM
15401 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15402 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15403         echo "LDBL_DIG found." >&4
15404         val="$define"
15405 else
15406         echo "LDBL_DIG NOT found." >&4
15407         val="$undef"
15408 fi
15409 $rm -f ldbl_dig.?
15410 set d_ldbl_dig
15411 eval $setvar
15412
15413 : see if this is a math.h system
15414 set math.h i_math
15415 eval $inhdr
15416
15417 : check to see if math.h defines _LIB_VERSION
15418 d_libm_lib_version="$undef"
15419 case $i_math in
15420     $define)
15421         echo " "
15422         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15423         $cat >try.c <<EOCP
15424 #include <unistd.h>
15425 #include <math.h>
15426 int main (int argc, char *argv[])
15427 {
15428     printf ("%d\n", _LIB_VERSION);
15429     return (0);
15430     } /* main */
15431 EOCP
15432         set try
15433         if eval $compile; then
15434             foo=`$run ./try`
15435             echo "Yes, it does ($foo)" >&4
15436             d_libm_lib_version="$define"
15437         else
15438             echo "No, it does not (probably harmless)" >&4
15439             fi
15440         $rm_try
15441         ;;
15442
15443     esac
15444
15445 : see if link exists
15446 set link d_link
15447 eval $inlibc
15448
15449 : see if localtime_r exists
15450 set localtime_r d_localtime_r
15451 eval $inlibc
15452 case "$d_localtime_r" in
15453 "$define")
15454         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15455         case "$d_localtime_r_proto:$usethreads" in
15456         ":define")      d_localtime_r_proto=define
15457                 set d_localtime_r_proto localtime_r $hdrs
15458                 eval $hasproto ;;
15459         *)      ;;
15460         esac
15461         case "$d_localtime_r_proto" in
15462         define)
15463         case "$localtime_r_proto" in
15464         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15465         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15466         esac
15467         case "$localtime_r_proto" in
15468         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15469         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15470         esac
15471         case "$localtime_r_proto" in
15472         ''|0)   d_localtime_r=undef
15473                 localtime_r_proto=0
15474                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15475         * )     case "$localtime_r_proto" in
15476                 REENTRANT_PROTO*) ;;
15477                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15478                 esac
15479                 echo "Prototype: $try" ;;
15480         esac
15481         ;;
15482         *)      case "$usethreads" in
15483                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15484                 esac
15485                 d_localtime_r=undef
15486                 localtime_r_proto=0
15487                 ;;
15488         esac
15489         ;;
15490 *)      localtime_r_proto=0
15491         ;;
15492 esac
15493
15494 : see if localtime_r calls tzset
15495 case "$localtime_r_proto" in
15496 REENTRANT_PROTO*)
15497         $cat >try.c <<EOCP
15498 /*  Does our libc's localtime_r call tzset ?
15499  *  return 0 if so, 1 otherwise.
15500  */
15501 #$i_systypes    I_SYS_TYPES
15502 #$i_unistd      I_UNISTD
15503 #$i_time        I_TIME
15504 #$i_stdlib      I_STDLIB
15505 #$i_string      I_STRING
15506 #$i_malloc      I_MALLOC
15507 #ifdef I_SYS_TYPES
15508 #  include <sys/types.h>
15509 #endif
15510 #ifdef I_UNISTD
15511 #  include <unistd.h>
15512 #endif
15513 #ifdef I_TIME
15514 #  include <time.h>
15515 #endif
15516 #ifdef I_STDLIB
15517 #include <stdlib.h>
15518 #endif
15519 #ifdef I_STRING
15520 #  include <string.h>
15521 #else
15522 #  include <strings.h>
15523 #endif
15524 #ifdef I_MALLOC
15525 #  include <malloc.h>
15526 #endif
15527 int main()
15528 {
15529     time_t t = time(0L);
15530     char w_tz[]="TZ" "=GMT+5",
15531          e_tz[]="TZ" "=GMT-5",
15532         *tz_e = (char*)malloc(16),
15533         *tz_w = (char*)malloc(16);
15534     struct tm tm_e, tm_w;
15535     memset(&tm_e,'\0',sizeof(struct tm));
15536     memset(&tm_w,'\0',sizeof(struct tm));
15537     strcpy(tz_e,e_tz);
15538     strcpy(tz_w,w_tz);
15539
15540     putenv(tz_e);
15541     localtime_r(&t, &tm_e);
15542
15543     putenv(tz_w);
15544     localtime_r(&t, &tm_w);
15545
15546     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15547         return 1;
15548     return 0;
15549 }
15550 EOCP
15551         set try
15552         if eval $compile; then
15553             if $run ./try; then
15554                 d_localtime_r_needs_tzset=undef;
15555             else
15556                 d_localtime_r_needs_tzset=define;
15557             fi;
15558         else
15559             d_localtime_r_needs_tzset=undef;
15560         fi;
15561      ;;
15562   *)
15563      d_localtime_r_needs_tzset=undef;
15564      ;;
15565 esac
15566 $rm_try
15567
15568 : see if localeconv exists
15569 set localeconv d_locconv
15570 eval $inlibc
15571
15572 : see if lockf exists
15573 set lockf d_lockf
15574 eval $inlibc
15575
15576 : see if prototype for lseek is available
15577 echo " "
15578 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15579 eval $hasproto
15580
15581 : see if lstat exists
15582 set lstat d_lstat
15583 eval $inlibc
15584
15585 : see if madvise exists
15586 set madvise d_madvise
15587 eval $inlibc
15588
15589 : see if malloc_size exists
15590 set malloc_size d_malloc_size
15591 eval $inlibc
15592
15593 : see if malloc_size_good exists
15594 set malloc_good_size d_malloc_good_size
15595 eval $inlibc
15596
15597 : see if mblen exists
15598 set mblen d_mblen
15599 eval $inlibc
15600
15601 : see if mbstowcs exists
15602 set mbstowcs d_mbstowcs
15603 eval $inlibc
15604
15605 : see if mbtowc exists
15606 set mbtowc d_mbtowc
15607 eval $inlibc
15608
15609 : see if memchr exists
15610 set memchr d_memchr
15611 eval $inlibc
15612
15613 : see if memcmp exists
15614 set memcmp d_memcmp
15615 eval $inlibc
15616
15617 : see if memcpy exists
15618 set memcpy d_memcpy
15619 eval $inlibc
15620
15621 : see if memmove exists
15622 set memmove d_memmove
15623 eval $inlibc
15624
15625 : see if memset exists
15626 set memset d_memset
15627 eval $inlibc
15628
15629 : see if mkdir exists
15630 set mkdir d_mkdir
15631 eval $inlibc
15632
15633 : see if mkdtemp exists
15634 set mkdtemp d_mkdtemp
15635 eval $inlibc
15636
15637 : see if mkfifo exists
15638 set mkfifo d_mkfifo
15639 eval $inlibc
15640
15641 : see if mkstemp exists
15642 set mkstemp d_mkstemp
15643 eval $inlibc
15644
15645 : see if mkstemps exists
15646 set mkstemps d_mkstemps
15647 eval $inlibc
15648
15649 : see if mktime exists
15650 set mktime d_mktime
15651 eval $inlibc
15652
15653 : see if this is a sys/mman.h system
15654 set sys/mman.h i_sysmman
15655 eval $inhdr
15656
15657 : see if mmap exists
15658 set mmap d_mmap
15659 eval $inlibc
15660 : see what shmat returns
15661 : default to something harmless
15662 mmaptype='void *'
15663 case "$i_sysmman$d_mmap" in
15664 "$define$define")
15665         $cat >mmap.c <<'END'
15666 #include <sys/mman.h>
15667 void *mmap();
15668 END
15669         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15670                 mmaptype='void *'
15671         else
15672                 mmaptype='caddr_t'
15673         fi
15674         echo "and it returns ($mmaptype)." >&4
15675         ;;
15676 esac
15677
15678
15679
15680 : see if sqrtl exists
15681 set sqrtl d_sqrtl
15682 eval $inlibc
15683
15684 : see if scalbnl exists
15685 set scalbnl d_scalbnl
15686 eval $inlibc
15687
15688 : see if modfl exists
15689 set modfl d_modfl
15690 eval $inlibc
15691
15692 : see if prototype for modfl is available
15693 echo " "
15694 set d_modflproto modfl $i_math math.h
15695 eval $hasproto
15696
15697 d_modfl_pow32_bug="$undef"
15698
15699 case "$d_longdbl$d_modfl" in
15700 $define$define)
15701         $cat <<EOM
15702 Checking to see whether your modfl() is okay for large values...
15703 EOM
15704 $cat >try.c <<EOCP
15705 #include <math.h>
15706 #include <stdio.h>
15707 EOCP
15708 if $test "X$d_modflproto" != "X$define"; then
15709         $cat >>try.c <<EOCP
15710 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15711 long double modfl (long double, long double *);
15712 EOCP
15713 fi
15714 $cat >>try.c <<EOCP
15715 int main() {
15716     long double nv = 4294967303.15;
15717     long double v, w;
15718     v = modfl(nv, &w);
15719 #ifdef __GLIBC__
15720     printf("glibc");
15721 #endif
15722     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15723     return 0;
15724 }
15725 EOCP
15726         case "$osname:$gccversion" in
15727         aix:)   saveccflags="$ccflags"
15728                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15729         esac
15730         set try
15731         if eval $compile; then
15732                 foo=`$run ./try`
15733                 case "$foo" in
15734                 *" 4294967303.150000 1.150000 4294967302.000000")
15735                         echo >&4 "Your modfl() is broken for large values."
15736                         d_modfl_pow32_bug="$define"
15737                         case "$foo" in
15738                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15739                         ;;
15740                         esac
15741                         ;;
15742                 *" 4294967303.150000 0.150000 4294967303.000000")
15743                         echo >&4 "Your modfl() seems okay for large values."
15744                         ;;
15745                 *)      echo >&4 "I don't understand your modfl() at all."
15746                         d_modfl="$undef"
15747                         ;;
15748                 esac
15749                 $rm_try
15750         else
15751                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15752                 d_modfl="$undef"
15753         fi
15754         case "$osname:$gccversion" in
15755         aix:)   ccflags="$saveccflags" ;; # restore
15756         esac
15757         ;;
15758 esac
15759
15760 if $test "$uselongdouble" = "$define"; then
15761     message=""
15762     if $test "$d_sqrtl" != "$define"; then
15763         message="$message sqrtl"
15764     fi
15765     if $test "$d_modfl" != "$define"; then
15766         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15767             echo "You have both aintl and copysignl, so I can emulate modfl."
15768         else
15769             message="$message modfl"
15770         fi
15771     fi
15772     if $test "$d_frexpl" != "$define"; then
15773         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15774             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15775         else
15776             message="$message frexpl"
15777         fi
15778     fi
15779
15780     if $test "$message" != ""; then
15781         $cat <<EOM >&4
15782
15783 *** You requested the use of long doubles but you do not seem to have
15784 *** the following mathematical functions needed for long double support:
15785 ***    $message
15786 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15787 *** Cannot continue, aborting.
15788
15789 EOM
15790
15791         exit 1
15792     fi
15793 fi
15794
15795 : see if mprotect exists
15796 set mprotect d_mprotect
15797 eval $inlibc
15798
15799 : see if msgctl exists
15800 set msgctl d_msgctl
15801 eval $inlibc
15802
15803 : see if msgget exists
15804 set msgget d_msgget
15805 eval $inlibc
15806
15807 : see if msgsnd exists
15808 set msgsnd d_msgsnd
15809 eval $inlibc
15810
15811 : see if msgrcv exists
15812 set msgrcv d_msgrcv
15813 eval $inlibc
15814
15815 : see how much of the 'msg*(2)' library is present.
15816 h_msg=true
15817 echo " "
15818 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15819 *"$undef"*) h_msg=false;;
15820 esac
15821 case "$osname" in
15822 freebsd)
15823     case "`ipcs 2>&1`" in
15824     "SVID messages"*"not configured"*)
15825         echo "Your $osname does not have the msg*(2) configured." >&4
15826         h_msg=false
15827         val="$undef"
15828         set msgctl d_msgctl
15829         eval $setvar
15830         set msgget d_msgget
15831         eval $setvar
15832         set msgsnd d_msgsnd
15833         eval $setvar
15834         set msgrcv d_msgrcv
15835         eval $setvar
15836         ;;
15837     esac
15838     ;;
15839 esac
15840 : we could also check for sys/ipc.h ...
15841 if $h_msg && $test `./findhdr sys/msg.h`; then
15842         echo "You have the full msg*(2) library." >&4
15843         val="$define"
15844 else
15845         echo "You don't have the full msg*(2) library." >&4
15846         val="$undef"
15847 fi
15848 set d_msg
15849 eval $setvar
15850
15851 : Check for msghdr_s
15852 echo " "
15853 echo "Checking to see if your system supports struct msghdr..." >&4
15854 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15855 eval $hasstruct
15856 case "$d_msghdr_s" in
15857 "$define")      echo "Yes, it does."   ;;
15858 *)              echo "No, it doesn't." ;;
15859 esac
15860
15861
15862 : see if msync exists
15863 set msync d_msync
15864 eval $inlibc
15865
15866 : see if munmap exists
15867 set munmap d_munmap
15868 eval $inlibc
15869
15870 : see if nice exists
15871 set nice d_nice
15872 eval $inlibc
15873
15874 : see if this is a langinfo.h system
15875 set langinfo.h i_langinfo
15876 eval $inhdr
15877
15878 : see if nl_langinfo exists
15879 set nl_langinfo d_nl_langinfo
15880 eval $inlibc
15881
15882 : check for volatile keyword
15883 echo " "
15884 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15885 $cat >try.c <<'EOCP'
15886 int main()
15887 {
15888         typedef struct _goo_struct goo_struct;
15889         goo_struct * volatile goo = ((goo_struct *)0);
15890         struct _goo_struct {
15891                 long long_int;
15892                 int reg_int;
15893                 char char_var;
15894         };
15895         typedef unsigned short foo_t;
15896         char *volatile foo;
15897         volatile int bar;
15898         volatile foo_t blech;
15899         foo = foo;
15900 }
15901 EOCP
15902 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15903         val="$define"
15904         echo "Yup, it does."
15905 else
15906         val="$undef"
15907         echo "Nope, it doesn't."
15908 fi
15909 set d_volatile
15910 eval $setvar
15911 $rm_try
15912
15913 : Check basic sizes
15914 echo " "
15915 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15916
15917 case "$use64bitint:$d_quad:$quadtype" in
15918 define:define:?*)
15919         ivtype="$quadtype"
15920         uvtype="$uquadtype"
15921         ivsize=8
15922         uvsize=8
15923         ;;
15924 *)      ivtype="long"
15925         uvtype="unsigned long"
15926         ivsize=$longsize
15927         uvsize=$longsize
15928         ;;
15929 esac
15930
15931 case "$uselongdouble:$d_longdbl" in
15932 define:define)
15933         nvtype="long double"
15934         nvsize=$longdblsize
15935         ;;
15936 *)      nvtype=double
15937         nvsize=$doublesize
15938         ;;
15939 esac
15940
15941 $echo "(IV will be "$ivtype", $ivsize bytes)"
15942 $echo "(UV will be "$uvtype", $uvsize bytes)"
15943 $echo "(NV will be "$nvtype", $nvsize bytes)"
15944
15945 $cat >try.c <<EOCP
15946 #$i_inttypes I_INTTYPES
15947 #ifdef I_INTTYPES
15948 #include <inttypes.h>
15949 #endif
15950 #include <stdio.h>
15951 int main() {
15952 #ifdef INT8
15953    int8_t i =  INT8_MAX;
15954   uint8_t u = UINT8_MAX;
15955   printf("int8_t\n");
15956 #endif
15957 #ifdef INT16
15958    int16_t i =  INT16_MAX;
15959   uint16_t u = UINT16_MAX;
15960   printf("int16_t\n");
15961 #endif
15962 #ifdef INT32
15963    int32_t i =  INT32_MAX;
15964   uint32_t u = UINT32_MAX;
15965   printf("int32_t\n");
15966 #endif
15967 }
15968 EOCP
15969
15970 i8type="signed char"
15971 u8type="unsigned char"
15972 i8size=1
15973 u8size=1
15974
15975 case "$i16type" in
15976 '')     case "$shortsize" in
15977         2)      i16type=short
15978                 u16type="unsigned short"
15979                 i16size=$shortsize
15980                 u16size=$shortsize
15981                 ;;
15982         esac
15983         ;;
15984 esac
15985 case "$i16type" in
15986 '')     set try -DINT16
15987         if eval $compile; then
15988                 case "`$run ./try`" in
15989                 int16_t)
15990                         i16type=int16_t
15991                         u16type=uint16_t
15992                         i16size=2
15993                         u16size=2
15994                         ;;
15995                 esac
15996         fi
15997         ;;
15998 esac
15999 case "$i16type" in
16000 '')     if $test $shortsize -ge 2; then
16001                 i16type=short
16002                 u16type="unsigned short"
16003                 i16size=$shortsize
16004                 u16size=$shortsize
16005         fi
16006         ;;
16007 esac
16008
16009 case "$i32type" in
16010 '')     case "$longsize" in
16011         4)      i32type=long
16012                 u32type="unsigned long"
16013                 i32size=$longsize
16014                 u32size=$longsize
16015                 ;;
16016         *)      case "$intsize" in
16017                 4)      i32type=int
16018                         u32type="unsigned int"
16019                         i32size=$intsize
16020                         u32size=$intsize
16021                         ;;
16022                 esac
16023                 ;;
16024         esac
16025         ;;
16026 esac
16027 case "$i32type" in
16028 '')     set try -DINT32
16029         if eval $compile; then
16030                 case "`$run ./try`" in
16031                 int32_t)
16032                         i32type=int32_t
16033                         u32type=uint32_t
16034                         i32size=4
16035                         u32size=4
16036                         ;;
16037                 esac
16038         fi
16039         ;;
16040 esac
16041 case "$i32type" in
16042 '')     if $test $intsize -ge 4; then
16043                 i32type=int
16044                 u32type="unsigned int"
16045                 i32size=$intsize
16046                 u32size=$intsize
16047         fi
16048         ;;
16049 esac
16050
16051 case "$i64type" in
16052 '')     case "$d_quad:$quadtype" in
16053         define:?*)
16054                 i64type="$quadtype"
16055                 u64type="$uquadtype"
16056                 i64size=8
16057                 u64size=8
16058                 ;;
16059         esac
16060         ;;
16061 esac
16062
16063 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16064 : volatile so that the compiler has to store it out to memory.
16065 if test X"$d_volatile" = X"$define"; then
16066         volatile=volatile
16067 fi
16068 $cat <<EOP >try.c
16069 #include <stdio.h>
16070 #$i_stdlib I_STDLIB
16071 #ifdef I_STDLIB
16072 #include <stdlib.h>
16073 #endif
16074 #include <sys/types.h>
16075 #include <signal.h>
16076 #ifdef SIGFPE
16077 $volatile int bletched = 0;
16078 $signal_t blech(int s) { bletched = 1; }
16079 #endif
16080 int main() {
16081     $uvtype u = 0;
16082     $nvtype d;
16083     int     n = 8 * $uvsize;
16084     int     i;
16085 #ifdef SIGFPE
16086     signal(SIGFPE, blech);
16087 #endif
16088
16089     for (i = 0; i < n; i++) {
16090       u = u << 1 | ($uvtype)1;
16091       d = ($nvtype)u;
16092       if (($uvtype)d != u)
16093         break;
16094       if (d <= 0)
16095         break;
16096       d = ($nvtype)(u - 1);
16097       if (($uvtype)d != (u - 1))
16098         break;
16099 #ifdef SIGFPE
16100       if (bletched)
16101         break;
16102 #endif
16103     }
16104     printf("%d\n", ((i == n) ? -n : i));
16105     exit(0);
16106 }
16107 EOP
16108 set try
16109
16110 d_nv_preserves_uv="$undef"
16111 if eval $compile; then
16112         nv_preserves_uv_bits="`$run ./try`"
16113 fi
16114 case "$nv_preserves_uv_bits" in
16115 \-[1-9]*)
16116         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16117         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16118         d_nv_preserves_uv="$define"
16119         ;;
16120 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16121         d_nv_preserves_uv="$undef" ;;
16122 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16123         nv_preserves_uv_bits="0" ;;
16124 esac
16125 $rm_try
16126
16127 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16128 : volatile so that the compiler has to store it out to memory.
16129 if test X"$d_volatile" = X"$define"; then
16130         volatile=volatile
16131 fi
16132 $cat <<EOP >try.c
16133 #include <stdio.h>
16134
16135 typedef $nvtype NV;
16136
16137 int
16138 main() {
16139   NV value = 2;
16140   int count = 1;
16141
16142   while(count < 256) {
16143     $volatile NV up = value + 1.0;
16144     $volatile NV negated = -value;
16145     $volatile NV down = negated - 1.0;
16146     $volatile NV got_up = up - value;
16147     int up_good = got_up == 1.0;
16148     int got_down = down - negated;
16149     int down_good = got_down == -1.0;
16150
16151     if (down_good != up_good) {
16152       fprintf(stderr,
16153               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16154               up_good, (double) got_up, down_good, (double) got_down,
16155               count, (double) value);
16156       return 1;
16157     }
16158     if (!up_good) {
16159       while (1) {
16160         if (count > 8) {
16161           count -= 8;
16162           fputs("256.0", stdout);
16163         } else {
16164           count--;
16165           fputs("2.0", stdout);
16166         }
16167         if (!count) {
16168           puts("");
16169           return 0;
16170         }
16171         fputs("*", stdout);
16172       }
16173     }
16174     value *= 2;
16175     ++count;
16176   }
16177   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16178           count, (double) value);
16179   return 1;
16180 }
16181 EOP
16182 set try
16183
16184 nv_overflows_integers_at='0'
16185 if eval $compile; then
16186     xxx="`$run ./try`"
16187     case "$?" in
16188         0)
16189             case "$xxx" in
16190                 2*)  cat >&4 <<EOM
16191 The largest integer your NVs can preserve is equal to $xxx
16192 EOM
16193                     nv_overflows_integers_at="$xxx"
16194                     ;;
16195                 *)  cat >&4 <<EOM
16196 Cannot determine the largest integer value your NVs can hold, unexpected output
16197 '$xxx'
16198 EOM
16199                     ;;
16200             esac
16201             ;;
16202         *)  cat >&4 <<EOM
16203 Cannot determine the largest integer value your NVs can hold
16204 EOM
16205             ;;
16206     esac
16207 fi
16208 $rm_try
16209
16210 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16211 : volatile so that the compiler has to store it out to memory.
16212 if test X"$d_volatile" = X"$define"; then
16213         volatile=volatile
16214 fi
16215 $cat <<EOP >try.c
16216 #include <stdio.h>
16217 #$i_stdlib I_STDLIB
16218 #ifdef I_STDLIB
16219 #include <stdlib.h>
16220 #endif
16221 #$i_string I_STRING
16222 #ifdef I_STRING
16223 #  include <string.h>
16224 #else
16225 #  include <strings.h>
16226 #endif
16227 #include <sys/types.h>
16228 #include <signal.h>
16229 #ifdef SIGFPE
16230 $volatile int bletched = 0;
16231 $signal_t blech(int s) { bletched = 1; }
16232 #endif
16233
16234 int checkit($nvtype d, char *where) {
16235     unsigned char *p = (char *)&d;
16236     unsigned char *end = p + sizeof(d);
16237     int fail = 0;
16238
16239     while (p < end)
16240         fail += *p++;
16241
16242     if (!fail)
16243         return 0;
16244
16245     p = (char *)&d;
16246     printf("No - %s: 0x", where);
16247     while (p < end)
16248         printf ("%02X", *p++);
16249     printf("\n");
16250     return 1;
16251 }
16252
16253 int main(int argc, char **argv) {
16254     $nvtype d = 0.0;
16255     int fail = 0;
16256     fail += checkit(d, "0.0");
16257
16258     /* The compiler shouldn't be assuming that bletched is 0  */
16259     d = bletched;
16260
16261     fail += checkit(d, "bleched");
16262
16263 #ifdef SIGFPE
16264     signal(SIGFPE, blech);
16265 #endif
16266
16267     /* Paranoia - the compiler should have no way of knowing that ANSI says
16268        that argv[argc] will always be NULL.  Actually, if it did assume this it
16269        would be buggy, as this is C and main() can be called from elsewhere in
16270        the program.  */
16271     d = argv[argc] ? 1 : 0;
16272
16273     if (d) {
16274         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16275     }
16276
16277     fail += checkit(d, "ternary");
16278
16279     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16280
16281     if (d != 0.0) {
16282         printf("No - memset doesn't give 0.0\n");
16283         /* This might just blow up:  */
16284         printf("(gives %g)\n", d);
16285         return 1;
16286     }
16287
16288 #ifdef SIGFPE
16289     if (bletched) {
16290         printf("No - something bleched\n");
16291         return 1;
16292     }
16293 #endif
16294     if (fail) {
16295       printf("No - %d fail(s)\n", fail);
16296       return 1;
16297     }
16298     printf("Yes\n");
16299     return 0;
16300 }
16301 EOP
16302 set try
16303
16304 d_nv_zero_is_allbits_zero="$undef"
16305 if eval $compile; then
16306     xxx="`$run ./try`"
16307     case "$?" in
16308         0)
16309             case "$xxx" in
16310                 Yes)  cat >&4 <<EOM
16311 0.0 is represented as all bits zero in memory
16312 EOM
16313                     d_nv_zero_is_allbits_zero="$define"
16314                     ;;
16315                 *)  cat >&4 <<EOM
16316 0.0 is not represented as all bits zero in memory
16317 EOM
16318                     d_nv_zero_is_allbits_zero="$undef"
16319                     ;;
16320             esac
16321             ;;
16322         *)  cat >&4 <<EOM
16323 0.0 is not represented as all bits zero in memory
16324 EOM
16325             d_nv_zero_is_allbits_zero="$undef"
16326             ;;
16327     esac
16328 fi
16329 $rm_try
16330
16331 : check for off64_t
16332 echo " "
16333 echo "Checking to see if you have off64_t..." >&4
16334 $cat >try.c <<EOCP
16335 #include <sys/types.h>
16336 #include <unistd.h>
16337 int main() { off64_t x = 7; }
16338 EOCP
16339 set try
16340 if eval $compile; then
16341         val="$define"
16342         echo "You have off64_t."
16343 else
16344         val="$undef"
16345         echo "You do not have off64_t."
16346         case "$lseeksize" in
16347         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16348         esac
16349 fi
16350 $rm_try
16351 set d_off64_t
16352 eval $setvar
16353
16354 : how to create joinable pthreads
16355 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16356         echo " "
16357         echo "Checking what constant to use for creating joinable pthreads..." >&4
16358         $cat >try.c <<'EOCP'
16359 #include <pthread.h>
16360 int main() {
16361     int detachstate = JOINABLE;
16362 }
16363 EOCP
16364         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16365         if eval $compile; then
16366                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16367                 val="$undef" # Yes, undef.
16368                 set d_old_pthread_create_joinable
16369                 eval $setvar
16370                 val=""
16371                 set old_pthread_create_joinable
16372                 eval $setvar
16373         else
16374                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16375                 if eval $compile; then
16376                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16377                         val="$define"
16378                         set d_old_pthread_create_joinable
16379                         eval $setvar
16380                         val=PTHREAD_CREATE_UNDETACHED
16381                         set old_pthread_create_joinable
16382                         eval $setvar
16383                 else
16384                         set try -DJOINABLE=__UNDETACHED
16385                         if eval $compile; then
16386                                 echo "You seem to use __UNDETACHED." >&4
16387                                 val="$define"
16388                                 set d_old_pthread_create_joinable
16389                                 eval $setvar
16390                                 val=__UNDETACHED
16391                                 set old_pthread_create_joinable
16392                                 eval $setvar
16393                         else
16394                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16395                                 val="$define"
16396                                 set d_old_pthread_create_joinable
16397                                 eval $setvar
16398                                 val=0
16399                                 set old_pthread_create_joinable
16400                                 eval $setvar
16401                         fi
16402                 fi
16403         fi
16404         $rm_try
16405 else
16406     d_old_pthread_create_joinable="$undef"
16407     old_pthread_create_joinable=""
16408 fi
16409
16410 : see if pause exists
16411 set pause d_pause
16412 eval $inlibc
16413
16414 : see if poll exists
16415 set poll d_poll
16416 eval $inlibc
16417
16418 : see if prctl exists
16419 set prctl d_prctl
16420 eval $inlibc
16421
16422 : see if prctl supports PR_SET_NAME
16423 d_prctl_set_name=$undef
16424 case $d_prctl in
16425     $define)
16426         $cat >try.c <<EOM
16427 #include <sys/prctl.h>
16428
16429 int main (int argc, char *argv[])
16430 {
16431     return (prctl (PR_SET_NAME, "Test"));
16432     } /* main */
16433 EOM
16434         set try
16435         if eval $compile_ok && $run ./try; then
16436             echo "Your prctl (PR_SET_NAME, ...) works"
16437             d_prctl_set_name=$define
16438             fi
16439         $rm_try
16440         ;;
16441     esac
16442
16443 : see if readlink exists
16444 set readlink d_readlink
16445 eval $inlibc
16446
16447 : Check if exe is symlink to abs path of executing program
16448 echo " "
16449 procselfexe=''
16450 val="$undef"
16451 case "$d_readlink" in
16452     "$define")
16453         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16454         : more tidy to avoid an extra level of symlink
16455         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16456         while test $# -gt 0; do
16457             type=$1; try=$2
16458             shift; shift
16459             if $issymlink $try; then
16460                 $ls -l $try > reflect
16461                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16462                     echo "You have $type-like $try."
16463                     procselfexe='"'$try'"'
16464                     val="$define"
16465                     : This will break out of the loop
16466                     set X; shift
16467                 fi
16468             fi
16469         done
16470         ;;
16471 esac
16472 $rm -f reflect
16473 set d_procselfexe
16474 eval $setvar
16475
16476 : backward compatibility for d_hvfork
16477 if test X$d_hvfork != X; then
16478         d_vfork="$d_hvfork"
16479         d_hvfork=''
16480 fi
16481 : see if there is a vfork
16482 val=''
16483 set vfork val
16484 eval $inlibc
16485
16486 d_pseudofork=$undef
16487
16488 : Ok, but do we want to use it. vfork is reportedly unreliable in
16489 : perl on Solaris 2.x, and probably elsewhere.
16490 case "$val" in
16491 $define)
16492         echo " "
16493         case "$usevfork" in
16494         false) dflt='n';;
16495         *) dflt='y';;
16496         esac
16497         cat <<'EOM'
16498
16499 Perl can only use a vfork() that doesn't suffer from strict
16500 restrictions on calling functions or modifying global data in
16501 the child.  For example, glibc-2.1 contains such a vfork()
16502 that is unsuitable.  If your system provides a proper fork()
16503 call, chances are that you do NOT want perl to use vfork().
16504
16505 EOM
16506         rp="Do you still want to use vfork()?"
16507         . ./myread
16508         case "$ans" in
16509         y|Y) ;;
16510         *)
16511                 echo "Ok, we won't use vfork()."
16512                 val="$undef"
16513                 ;;
16514         esac
16515         ;;
16516 esac
16517 set d_vfork
16518 eval $setvar
16519 case "$d_vfork" in
16520 $define) usevfork='true';;
16521 *) usevfork='false';;
16522 esac
16523
16524 : see whether the pthread_atfork exists
16525 $cat >try.c <<EOP
16526 #include <pthread.h>
16527 #include <stdio.h>
16528 int main() {
16529 #ifdef  PTHREAD_ATFORK
16530         pthread_atfork(NULL,NULL,NULL);
16531 #endif
16532 }
16533 EOP
16534
16535 : see if pthread_atfork exists
16536 set try -DPTHREAD_ATFORK
16537 if eval $compile; then
16538     val="$define"
16539 else
16540     val="$undef"
16541 fi
16542 case "$usethreads" in
16543 $define)
16544         case "$val" in
16545         $define) echo 'pthread_atfork found.' >&4        ;;
16546         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16547         esac
16548 esac
16549 set d_pthread_atfork
16550 eval $setvar
16551
16552 : see if pthread_attr_setscope exists
16553 set pthread_attr_setscope d_pthread_attr_setscope
16554 eval $inlibc
16555
16556 : see whether the various POSIXish _yields exist
16557 $cat >try.c <<EOP
16558 #include <pthread.h>
16559 #include <stdio.h>
16560 int main() {
16561 #ifdef SCHED_YIELD
16562         sched_yield();
16563 #else
16564 #ifdef PTHREAD_YIELD
16565         pthread_yield();
16566 #else
16567 #ifdef PTHREAD_YIELD_NULL
16568         pthread_yield(NULL);
16569 #endif
16570 #endif
16571 #endif
16572 }
16573 EOP
16574 : see if sched_yield exists
16575 set try -DSCHED_YIELD
16576 if eval $compile; then
16577     val="$define"
16578     sched_yield='sched_yield()'
16579 else
16580     val="$undef"
16581 fi
16582 case "$usethreads" in
16583 $define)
16584         case "$val" in
16585         $define) echo 'sched_yield() found.' >&4        ;;
16586         *)       echo 'sched_yield() NOT found.' >&4    ;;
16587         esac
16588 esac
16589 set d_sched_yield
16590 eval $setvar
16591
16592 : see if pthread_yield exists
16593 set try -DPTHREAD_YIELD
16594 if eval $compile; then
16595     val="$define"
16596     case "$sched_yield" in
16597     '') sched_yield='pthread_yield()' ;;
16598     esac
16599 else
16600     set try -DPTHREAD_YIELD_NULL
16601     if eval $compile; then
16602         val="$define"
16603         case "$sched_yield" in
16604         '') sched_yield='pthread_yield(NULL)' ;;
16605         esac
16606     else
16607         val="$undef"
16608     fi
16609 fi
16610 case "$usethreads" in
16611 $define)
16612         case "$val" in
16613         $define) echo 'pthread_yield() found.' >&4      ;;
16614         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16615         esac
16616         ;;
16617 esac
16618 set d_pthread_yield
16619 eval $setvar
16620 case "$sched_yield" in
16621 '') sched_yield=undef ;;
16622 esac
16623 $rm_try
16624
16625 : see if random_r exists
16626 set random_r d_random_r
16627 eval $inlibc
16628 case "$d_random_r" in
16629 "$define")
16630         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16631         case "$d_random_r_proto:$usethreads" in
16632         ":define")      d_random_r_proto=define
16633                 set d_random_r_proto random_r $hdrs
16634                 eval $hasproto ;;
16635         *)      ;;
16636         esac
16637         case "$d_random_r_proto" in
16638         define)
16639         case "$random_r_proto" in
16640         ''|0) try='int random_r(int*, struct random_data*);'
16641         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16642         esac
16643         case "$random_r_proto" in
16644         ''|0) try='int random_r(long*, struct random_data*);'
16645         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16646         esac
16647         case "$random_r_proto" in
16648         ''|0) try='int random_r(struct random_data*, int32_t*);'
16649         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16650         esac
16651         case "$random_r_proto" in
16652         ''|0)   d_random_r=undef
16653                 random_r_proto=0
16654                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16655         * )     case "$random_r_proto" in
16656                 REENTRANT_PROTO*) ;;
16657                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16658                 esac
16659                 echo "Prototype: $try" ;;
16660         esac
16661         ;;
16662         *)      case "$usethreads" in
16663                 define) echo "random_r has no prototype, not using it." >&4 ;;
16664                 esac
16665                 d_random_r=undef
16666                 random_r_proto=0
16667                 ;;
16668         esac
16669         ;;
16670 *)      random_r_proto=0
16671         ;;
16672 esac
16673
16674 : see if readdir and friends exist
16675 set readdir d_readdir
16676 eval $inlibc
16677 set seekdir d_seekdir
16678 eval $inlibc
16679 set telldir d_telldir
16680 eval $inlibc
16681 set rewinddir d_rewinddir
16682 eval $inlibc
16683
16684 : see if readdir64_r exists
16685 set readdir64_r d_readdir64_r
16686 eval $inlibc
16687 case "$d_readdir64_r" in
16688 "$define")
16689         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16690         case "$d_readdir64_r_proto:$usethreads" in
16691         ":define")      d_readdir64_r_proto=define
16692                 set d_readdir64_r_proto readdir64_r $hdrs
16693                 eval $hasproto ;;
16694         *)      ;;
16695         esac
16696         case "$d_readdir64_r_proto" in
16697         define)
16698         case "$readdir64_r_proto" in
16699         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16700         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16701         esac
16702         case "$readdir64_r_proto" in
16703         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16704         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16705         esac
16706         case "$readdir64_r_proto" in
16707         ''|0)   d_readdir64_r=undef
16708                 readdir64_r_proto=0
16709                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16710         * )     case "$readdir64_r_proto" in
16711                 REENTRANT_PROTO*) ;;
16712                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16713                 esac
16714                 echo "Prototype: $try" ;;
16715         esac
16716         ;;
16717         *)      case "$usethreads" in
16718                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16719                 esac
16720                 d_readdir64_r=undef
16721                 readdir64_r_proto=0
16722                 ;;
16723         esac
16724         ;;
16725 *)      readdir64_r_proto=0
16726         ;;
16727 esac
16728
16729 : see if readdir_r exists
16730 set readdir_r d_readdir_r
16731 eval $inlibc
16732 case "$d_readdir_r" in
16733 "$define")
16734         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16735         case "$d_readdir_r_proto:$usethreads" in
16736         ":define")      d_readdir_r_proto=define
16737                 set d_readdir_r_proto readdir_r $hdrs
16738                 eval $hasproto ;;
16739         *)      ;;
16740         esac
16741         case "$d_readdir_r_proto" in
16742         define)
16743         case "$readdir_r_proto" in
16744         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16745         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16746         esac
16747         case "$readdir_r_proto" in
16748         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16749         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16750         esac
16751         case "$readdir_r_proto" in
16752         ''|0)   d_readdir_r=undef
16753                 readdir_r_proto=0
16754                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16755         * )     case "$readdir_r_proto" in
16756                 REENTRANT_PROTO*) ;;
16757                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16758                 esac
16759                 echo "Prototype: $try" ;;
16760         esac
16761         ;;
16762         *)      case "$usethreads" in
16763                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16764                 esac
16765                 d_readdir_r=undef
16766                 readdir_r_proto=0
16767                 ;;
16768         esac
16769         ;;
16770 *)      readdir_r_proto=0
16771         ;;
16772 esac
16773
16774 : see if readv exists
16775 set readv d_readv
16776 eval $inlibc
16777
16778 : see if recvmsg exists
16779 set recvmsg d_recvmsg
16780 eval $inlibc
16781
16782 : see if rename exists
16783 set rename d_rename
16784 eval $inlibc
16785
16786 : see if rmdir exists
16787 set rmdir d_rmdir
16788 eval $inlibc
16789
16790 : see if memory.h is available.
16791 val=''
16792 set memory.h val
16793 eval $inhdr
16794
16795 : See if it conflicts with string.h
16796 case "$val" in
16797 $define)
16798         case "$strings" in
16799         '') ;;
16800         *)
16801                 $cppstdin $cppflags $cppminus < $strings > mem.h
16802                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16803                         echo " "
16804                         echo "We won't be including <memory.h>."
16805                         val="$undef"
16806                 fi
16807                 $rm -f mem.h
16808                 ;;
16809         esac
16810 esac
16811 set i_memory
16812 eval $setvar
16813
16814 : can bcopy handle overlapping blocks?
16815 echo " "
16816 val="$undef"
16817 case "$d_memmove" in
16818 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16819 *)      case "$d_bcopy" in
16820         "$define")
16821                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16822                 $cat >try.c <<EOCP
16823 #$i_memory I_MEMORY
16824 #$i_stdlib I_STDLIB
16825 #$i_string I_STRING
16826 #$i_unistd I_UNISTD
16827 EOCP
16828         $cat >>try.c <<'EOCP'
16829 #include <stdio.h>
16830 #ifdef I_MEMORY
16831 #  include <memory.h>
16832 #endif
16833 #ifdef I_STDLIB
16834 #  include <stdlib.h>
16835 #endif
16836 #ifdef I_STRING
16837 #  include <string.h>
16838 #else
16839 #  include <strings.h>
16840 #endif
16841 #ifdef I_UNISTD
16842 #  include <unistd.h>  /* Needed for NetBSD */
16843 #endif
16844 int main()
16845 {
16846 char buf[128], abc[128];
16847 char *b;
16848 int len;
16849 int off;
16850 int align;
16851
16852 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16853    try to store the string in read-only memory. */
16854 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16855
16856 for (align = 7; align >= 0; align--) {
16857         for (len = 36; len; len--) {
16858                 b = buf+align;
16859                 bcopy(abc, b, len);
16860                 for (off = 1; off <= len; off++) {
16861                         bcopy(b, b+off, len);
16862                         bcopy(b+off, b, len);
16863                         if (bcmp(b, abc, len))
16864                                 exit(1);
16865                 }
16866         }
16867 }
16868 exit(0);
16869 }
16870 EOCP
16871                 set try
16872                 if eval $compile_ok; then
16873                         if $run ./try 2>/dev/null; then
16874                                 echo "Yes, it can."
16875                                 val="$define"
16876                         else
16877                                 echo "It can't, sorry."
16878                         fi
16879                 else
16880                         echo "(I can't compile the test program, so we'll assume not...)"
16881                 fi
16882                 ;;
16883         esac
16884         $rm_try
16885         ;;
16886 esac
16887 set d_safebcpy
16888 eval $setvar
16889
16890 : can memcpy handle overlapping blocks?
16891 echo " "
16892 val="$undef"
16893 case "$d_memmove" in
16894 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16895 *)      case "$d_memcpy" in
16896         "$define")
16897                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16898                 $cat >try.c <<EOCP
16899 #$i_memory I_MEMORY
16900 #$i_stdlib I_STDLIB
16901 #$i_string I_STRING
16902 #$i_unistd I_UNISTD
16903 EOCP
16904         $cat >>try.c <<'EOCP'
16905 #include <stdio.h>
16906 #ifdef I_MEMORY
16907 #  include <memory.h>
16908 #endif
16909 #ifdef I_STDLIB
16910 #  include <stdlib.h>
16911 #endif
16912 #ifdef I_STRING
16913 #  include <string.h>
16914 #else
16915 #  include <strings.h>
16916 #endif
16917 #ifdef I_UNISTD
16918 #  include <unistd.h>  /* Needed for NetBSD */
16919 #endif
16920 int main()
16921 {
16922 char buf[128], abc[128];
16923 char *b;
16924 int len;
16925 int off;
16926 int align;
16927
16928 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16929    try to store the string in read-only memory. */
16930 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16931
16932 for (align = 7; align >= 0; align--) {
16933         for (len = 36; len; len--) {
16934                 b = buf+align;
16935                 memcpy(b, abc, len);
16936                 for (off = 1; off <= len; off++) {
16937                         memcpy(b+off, b, len);
16938                         memcpy(b, b+off, len);
16939                         if (memcmp(b, abc, len))
16940                                 exit(1);
16941                 }
16942         }
16943 }
16944 exit(0);
16945 }
16946 EOCP
16947                 set try
16948                 if eval $compile_ok; then
16949                         if $run ./try 2>/dev/null; then
16950                                 echo "Yes, it can."
16951                                 val="$define"
16952                         else
16953                                 echo "It can't, sorry."
16954                         fi
16955                 else
16956                         echo "(I can't compile the test program, so we'll assume not...)"
16957                 fi
16958                 ;;
16959         esac
16960         $rm_try
16961         ;;
16962 esac
16963 set d_safemcpy
16964 eval $setvar
16965
16966 : can memcmp be trusted to compare relative magnitude?
16967 val="$undef"
16968 case "$d_memcmp" in
16969 "$define")
16970         echo " "
16971         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16972         $cat >try.c <<EOCP
16973 #$i_memory I_MEMORY
16974 #$i_stdlib I_STDLIB
16975 #$i_string I_STRING
16976 #$i_unistd I_UNISTD
16977 EOCP
16978         $cat >>try.c <<'EOCP'
16979 #include <stdio.h>
16980 #ifdef I_MEMORY
16981 #  include <memory.h>
16982 #endif
16983 #ifdef I_STDLIB
16984 #  include <stdlib.h>
16985 #endif
16986 #ifdef I_STRING
16987 #  include <string.h>
16988 #else
16989 #  include <strings.h>
16990 #endif
16991 #ifdef I_UNISTD
16992 #  include <unistd.h>  /* Needed for NetBSD */
16993 #endif
16994 int main()
16995 {
16996 char a = -1;
16997 char b = 0;
16998 if ((a < b) && memcmp(&a, &b, 1) < 0)
16999         exit(1);
17000 exit(0);
17001 }
17002 EOCP
17003         set try
17004         if eval $compile_ok; then
17005                 if $run ./try 2>/dev/null; then
17006                         echo "Yes, it can."
17007                         val="$define"
17008                 else
17009                         echo "No, it can't (it uses signed chars)."
17010                 fi
17011         else
17012                 echo "(I can't compile the test program, so we'll assume not...)"
17013         fi
17014         ;;
17015 esac
17016 $rm_try
17017 set d_sanemcmp
17018 eval $setvar
17019
17020 : see if prototype for sbrk is available
17021 echo " "
17022 set d_sbrkproto sbrk $i_unistd unistd.h
17023 eval $hasproto
17024
17025 : see if select exists
17026 set select d_select
17027 eval $inlibc
17028
17029 : see if semctl exists
17030 set semctl d_semctl
17031 eval $inlibc
17032
17033 : see if semget exists
17034 set semget d_semget
17035 eval $inlibc
17036
17037 : see if semop exists
17038 set semop d_semop
17039 eval $inlibc
17040
17041 : see how much of the 'sem*(2)' library is present.
17042 h_sem=true
17043 echo " "
17044 case "$d_semctl$d_semget$d_semop" in
17045 *"$undef"*) h_sem=false;;
17046 esac
17047 case "$osname" in
17048 freebsd)
17049     case "`ipcs 2>&1`" in
17050     "SVID messages"*"not configured"*)
17051         echo "Your $osname does not have the sem*(2) configured." >&4
17052         h_sem=false
17053         val="$undef"
17054         set semctl d_semctl
17055         eval $setvar
17056         set semget d_semget
17057         eval $setvar
17058         set semop d_semop
17059         eval $setvar
17060         ;;
17061     esac
17062     ;;
17063 esac
17064 : we could also check for sys/ipc.h ...
17065 if $h_sem && $test `./findhdr sys/sem.h`; then
17066         echo "You have the full sem*(2) library." >&4
17067         val="$define"
17068 else
17069         echo "You don't have the full sem*(2) library." >&4
17070         val="$undef"
17071 fi
17072 set d_sem
17073 eval $setvar
17074
17075 : see whether sys/sem.h defines union semun
17076 echo " "
17077 $cat > try.c <<'END'
17078 #include <sys/types.h>
17079 #include <sys/ipc.h>
17080 #include <sys/sem.h>
17081 int main () { union semun semun; semun.buf = 0; }
17082 END
17083 set try
17084 if eval $compile; then
17085     echo "You have union semun in <sys/sem.h>." >&4
17086     val="$define"
17087 else
17088     echo "You do not have union semun in <sys/sem.h>." >&4
17089     val="$undef"
17090 fi
17091 $rm_try
17092 set d_union_semun
17093 eval $setvar
17094
17095 : see how to do semctl IPC_STAT
17096 case "$d_sem" in
17097 $define)
17098     echo " "
17099     $cat > tryh.h <<END
17100 #ifndef S_IRUSR
17101 #   ifdef S_IREAD
17102 #       define S_IRUSR S_IREAD
17103 #       define S_IWUSR S_IWRITE
17104 #       define S_IXUSR S_IEXEC
17105 #   else
17106 #       define S_IRUSR 0400
17107 #       define S_IWUSR 0200
17108 #       define S_IXUSR 0100
17109 #   endif
17110 #   define S_IRGRP (S_IRUSR>>3)
17111 #   define S_IWGRP (S_IWUSR>>3)
17112 #   define S_IXGRP (S_IXUSR>>3)
17113 #   define S_IROTH (S_IRUSR>>6)
17114 #   define S_IWOTH (S_IWUSR>>6)
17115 #   define S_IXOTH (S_IXUSR>>6)
17116 #endif
17117 #ifndef S_IRWXU
17118 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17119 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17120 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17121 #endif
17122 END
17123     : see whether semctl IPC_STAT can use union semun
17124     case "$d_semctl_semun" in
17125     '')
17126       val="$undef"
17127       $cat > try.c <<END
17128 #include <sys/types.h>
17129 #include <sys/ipc.h>
17130 #include <sys/sem.h>
17131 #include <sys/stat.h>
17132 #include <stdio.h>
17133 #include <errno.h>
17134 #include "tryh.h"
17135 #ifndef errno
17136 extern int errno;
17137 #endif
17138 #$d_union_semun HAS_UNION_SEMUN
17139 int main() {
17140     union semun
17141 #ifndef HAS_UNION_SEMUN
17142     {
17143         int val;
17144         struct semid_ds *buf;
17145         unsigned short *array;
17146     }
17147 #endif
17148     arg;
17149     int sem, st;
17150
17151 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17152     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17153     if (sem > -1) {
17154         struct semid_ds argbuf;
17155         arg.buf = &argbuf;
17156 #       ifdef IPC_STAT
17157         st = semctl(sem, 0, IPC_STAT, arg);
17158         if (st == 0)
17159             printf("semun\n");
17160         else
17161 #       endif /* IPC_STAT */
17162             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17163 #       ifdef IPC_RMID
17164         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17165 #       endif /* IPC_RMID */
17166             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17167     } else
17168 #endif /* IPC_PRIVATE && ... */
17169         printf("semget failed: errno = %d\n", errno);
17170   return 0;
17171 }
17172 END
17173       set try
17174       if eval $compile; then
17175           xxx=`$run ./try`
17176           case "$xxx" in
17177           semun) val="$define" ;;
17178           esac
17179       fi
17180       $rm_try
17181       set d_semctl_semun
17182       eval $setvar
17183       ;;
17184     esac
17185     case "$d_semctl_semun" in
17186     $define)
17187         echo "You can use union semun for semctl IPC_STAT." >&4
17188         also='also'
17189         ;;
17190     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17191         also=''
17192         ;;
17193     esac
17194
17195     : see whether semctl IPC_STAT can use struct semid_ds pointer
17196     case "$d_semctl_semid_ds" in
17197     '')
17198       val="$undef"
17199       $cat > try.c <<'END'
17200 #include <sys/types.h>
17201 #include <sys/ipc.h>
17202 #include <sys/sem.h>
17203 #include <sys/stat.h>
17204 #include "tryh.h"
17205 #include <stdio.h>
17206 #include <errno.h>
17207 #ifndef errno
17208 extern int errno;
17209 #endif
17210 int main() {
17211     struct semid_ds arg;
17212     int sem, st;
17213
17214 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17215     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17216     if (sem > -1) {
17217 #       ifdef IPC_STAT
17218         st = semctl(sem, 0, IPC_STAT, &arg);
17219         if (st == 0)
17220             printf("semid_ds\n");
17221         else
17222 #       endif /* IPC_STAT */
17223             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17224 #       ifdef IPC_RMID
17225         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17226 #       endif /* IPC_RMID */
17227             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17228     } else
17229 #endif /* IPC_PRIVATE && ... */
17230         printf("semget failed: errno = %d\n", errno);
17231
17232     return 0;
17233 }
17234 END
17235       set try
17236       if eval $compile; then
17237           xxx=`$run ./try`
17238           case "$xxx" in
17239           semid_ds) val="$define" ;;
17240           esac
17241       fi
17242       $rm_try
17243       set d_semctl_semid_ds
17244       eval $setvar
17245       ;;
17246     esac
17247     case "$d_semctl_semid_ds" in
17248     $define)
17249         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17250         ;;
17251     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17252         ;;
17253     esac
17254     ;;
17255 *)  val="$undef"
17256
17257     # We do not have the full sem*(2) library, so assume we can not
17258     # use either.
17259
17260     set d_semctl_semun
17261     eval $setvar
17262
17263     set d_semctl_semid_ds
17264     eval $setvar
17265     ;;
17266 esac
17267 $rm_try tryh.h
17268
17269 : see if sendmsg exists
17270 set sendmsg d_sendmsg
17271 eval $inlibc
17272
17273 : see if setegid exists
17274 set setegid d_setegid
17275 eval $inlibc
17276
17277 : see if seteuid exists
17278 set seteuid d_seteuid
17279 eval $inlibc
17280
17281 : see if setgrent exists
17282 set setgrent d_setgrent
17283 eval $inlibc
17284
17285 : see if setgrent_r exists
17286 set setgrent_r d_setgrent_r
17287 eval $inlibc
17288 case "$d_setgrent_r" in
17289 "$define")
17290         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17291         case "$d_setgrent_r_proto:$usethreads" in
17292         ":define")      d_setgrent_r_proto=define
17293                 set d_setgrent_r_proto setgrent_r $hdrs
17294                 eval $hasproto ;;
17295         *)      ;;
17296         esac
17297         case "$d_setgrent_r_proto" in
17298         define)
17299         case "$setgrent_r_proto" in
17300         ''|0) try='int setgrent_r(FILE**);'
17301         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17302         esac
17303         case "$setgrent_r_proto" in
17304         ''|0) try='void setgrent_r(FILE**);'
17305         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17306         esac
17307         case "$setgrent_r_proto" in
17308         ''|0)   d_setgrent_r=undef
17309                 setgrent_r_proto=0
17310                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17311         * )     case "$setgrent_r_proto" in
17312                 REENTRANT_PROTO*) ;;
17313                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17314                 esac
17315                 echo "Prototype: $try" ;;
17316         esac
17317         ;;
17318         *)      case "$usethreads" in
17319                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17320                 esac
17321                 d_setgrent_r=undef
17322                 setgrent_r_proto=0
17323                 ;;
17324         esac
17325         ;;
17326 *)      setgrent_r_proto=0
17327         ;;
17328 esac
17329
17330 : see if sethostent exists
17331 set sethostent d_sethent
17332 eval $inlibc
17333
17334 : see if sethostent_r exists
17335 set sethostent_r d_sethostent_r
17336 eval $inlibc
17337 case "$d_sethostent_r" in
17338 "$define")
17339         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17340         case "$d_sethostent_r_proto:$usethreads" in
17341         ":define")      d_sethostent_r_proto=define
17342                 set d_sethostent_r_proto sethostent_r $hdrs
17343                 eval $hasproto ;;
17344         *)      ;;
17345         esac
17346         case "$d_sethostent_r_proto" in
17347         define)
17348         case "$sethostent_r_proto" in
17349         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17350         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17351         esac
17352         case "$sethostent_r_proto" in
17353         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17354         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17355         esac
17356         case "$sethostent_r_proto" in
17357         ''|0)   d_sethostent_r=undef
17358                 sethostent_r_proto=0
17359                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17360         * )     case "$sethostent_r_proto" in
17361                 REENTRANT_PROTO*) ;;
17362                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17363                 esac
17364                 echo "Prototype: $try" ;;
17365         esac
17366         ;;
17367         *)      case "$usethreads" in
17368                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17369                 esac
17370                 d_sethostent_r=undef
17371                 sethostent_r_proto=0
17372                 ;;
17373         esac
17374         ;;
17375 *)      sethostent_r_proto=0
17376         ;;
17377 esac
17378
17379 : see if setitimer exists
17380 set setitimer d_setitimer
17381 eval $inlibc
17382
17383 : see if setlinebuf exists
17384 set setlinebuf d_setlinebuf
17385 eval $inlibc
17386
17387 : see if setlocale exists
17388 set setlocale d_setlocale
17389 eval $inlibc
17390
17391 : see if locale.h is available
17392 set locale.h i_locale
17393 eval $inhdr
17394
17395 : see if setlocale_r exists
17396 set setlocale_r d_setlocale_r
17397 eval $inlibc
17398 case "$d_setlocale_r" in
17399 "$define")
17400         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17401         case "$d_setlocale_r_proto:$usethreads" in
17402         ":define")      d_setlocale_r_proto=define
17403                 set d_setlocale_r_proto setlocale_r $hdrs
17404                 eval $hasproto ;;
17405         *)      ;;
17406         esac
17407         case "$d_setlocale_r_proto" in
17408         define)
17409         case "$setlocale_r_proto" in
17410         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17411         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17412         esac
17413         case "$setlocale_r_proto" in
17414         ''|0)   d_setlocale_r=undef
17415                 setlocale_r_proto=0
17416                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17417         * )     case "$setlocale_r_proto" in
17418                 REENTRANT_PROTO*) ;;
17419                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17420                 esac
17421                 echo "Prototype: $try" ;;
17422         esac
17423         ;;
17424         *)      case "$usethreads" in
17425                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17426                 esac
17427                 d_setlocale_r=undef
17428                 setlocale_r_proto=0
17429                 ;;
17430         esac
17431         ;;
17432 *)      setlocale_r_proto=0
17433         ;;
17434 esac
17435
17436 : see if setnetent exists
17437 set setnetent d_setnent
17438 eval $inlibc
17439
17440 : see if setnetent_r exists
17441 set setnetent_r d_setnetent_r
17442 eval $inlibc
17443 case "$d_setnetent_r" in
17444 "$define")
17445         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17446         case "$d_setnetent_r_proto:$usethreads" in
17447         ":define")      d_setnetent_r_proto=define
17448                 set d_setnetent_r_proto setnetent_r $hdrs
17449                 eval $hasproto ;;
17450         *)      ;;
17451         esac
17452         case "$d_setnetent_r_proto" in
17453         define)
17454         case "$setnetent_r_proto" in
17455         ''|0) try='int setnetent_r(int, struct netent_data*);'
17456         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17457         esac
17458         case "$setnetent_r_proto" in
17459         ''|0) try='void setnetent_r(int, struct netent_data*);'
17460         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17461         esac
17462         case "$setnetent_r_proto" in
17463         ''|0)   d_setnetent_r=undef
17464                 setnetent_r_proto=0
17465                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17466         * )     case "$setnetent_r_proto" in
17467                 REENTRANT_PROTO*) ;;
17468                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17469                 esac
17470                 echo "Prototype: $try" ;;
17471         esac
17472         ;;
17473         *)      case "$usethreads" in
17474                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17475                 esac
17476                 d_setnetent_r=undef
17477                 setnetent_r_proto=0
17478                 ;;
17479         esac
17480         ;;
17481 *)      setnetent_r_proto=0
17482         ;;
17483 esac
17484
17485 : see if setprotoent exists
17486 set setprotoent d_setpent
17487 eval $inlibc
17488
17489 : see if setpgid exists
17490 set setpgid d_setpgid
17491 eval $inlibc
17492
17493 : see if setpgrp2 exists
17494 set setpgrp2 d_setpgrp2
17495 eval $inlibc
17496
17497 : see if setpriority exists
17498 set setpriority d_setprior
17499 eval $inlibc
17500
17501 : see if setproctitle exists
17502 set setproctitle d_setproctitle
17503 eval $inlibc
17504
17505 : see if setprotoent_r exists
17506 set setprotoent_r d_setprotoent_r
17507 eval $inlibc
17508 case "$d_setprotoent_r" in
17509 "$define")
17510         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17511         case "$d_setprotoent_r_proto:$usethreads" in
17512         ":define")      d_setprotoent_r_proto=define
17513                 set d_setprotoent_r_proto setprotoent_r $hdrs
17514                 eval $hasproto ;;
17515         *)      ;;
17516         esac
17517         case "$d_setprotoent_r_proto" in
17518         define)
17519         case "$setprotoent_r_proto" in
17520         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17521         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17522         esac
17523         case "$setprotoent_r_proto" in
17524         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17525         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17526         esac
17527         case "$setprotoent_r_proto" in
17528         ''|0)   d_setprotoent_r=undef
17529                 setprotoent_r_proto=0
17530                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17531         * )     case "$setprotoent_r_proto" in
17532                 REENTRANT_PROTO*) ;;
17533                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17534                 esac
17535                 echo "Prototype: $try" ;;
17536         esac
17537         ;;
17538         *)      case "$usethreads" in
17539                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17540                 esac
17541                 d_setprotoent_r=undef
17542                 setprotoent_r_proto=0
17543                 ;;
17544         esac
17545         ;;
17546 *)      setprotoent_r_proto=0
17547         ;;
17548 esac
17549
17550 : see if setpwent exists
17551 set setpwent d_setpwent
17552 eval $inlibc
17553
17554 : see if setpwent_r exists
17555 set setpwent_r d_setpwent_r
17556 eval $inlibc
17557 case "$d_setpwent_r" in
17558 "$define")
17559         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17560         case "$d_setpwent_r_proto:$usethreads" in
17561         ":define")      d_setpwent_r_proto=define
17562                 set d_setpwent_r_proto setpwent_r $hdrs
17563                 eval $hasproto ;;
17564         *)      ;;
17565         esac
17566         case "$d_setpwent_r_proto" in
17567         define)
17568         case "$setpwent_r_proto" in
17569         ''|0) try='int setpwent_r(FILE**);'
17570         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17571         esac
17572         case "$setpwent_r_proto" in
17573         ''|0) try='void setpwent_r(FILE**);'
17574         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17575         esac
17576         case "$setpwent_r_proto" in
17577         ''|0)   d_setpwent_r=undef
17578                 setpwent_r_proto=0
17579                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17580         * )     case "$setpwent_r_proto" in
17581                 REENTRANT_PROTO*) ;;
17582                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17583                 esac
17584                 echo "Prototype: $try" ;;
17585         esac
17586         ;;
17587         *)      case "$usethreads" in
17588                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17589                 esac
17590                 d_setpwent_r=undef
17591                 setpwent_r_proto=0
17592                 ;;
17593         esac
17594         ;;
17595 *)      setpwent_r_proto=0
17596         ;;
17597 esac
17598
17599 : see if setregid exists
17600 set setregid d_setregid
17601 eval $inlibc
17602 set setresgid d_setresgid
17603 eval $inlibc
17604
17605 : see if setreuid exists
17606 set setreuid d_setreuid
17607 eval $inlibc
17608 set setresuid d_setresuid
17609 eval $inlibc
17610
17611 : see if setrgid exists
17612 set setrgid d_setrgid
17613 eval $inlibc
17614
17615 : see if setruid exists
17616 set setruid d_setruid
17617 eval $inlibc
17618
17619 : see if setservent exists
17620 set setservent d_setsent
17621 eval $inlibc
17622
17623 : see if setservent_r exists
17624 set setservent_r d_setservent_r
17625 eval $inlibc
17626 case "$d_setservent_r" in
17627 "$define")
17628         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17629         case "$d_setservent_r_proto:$usethreads" in
17630         ":define")      d_setservent_r_proto=define
17631                 set d_setservent_r_proto setservent_r $hdrs
17632                 eval $hasproto ;;
17633         *)      ;;
17634         esac
17635         case "$d_setservent_r_proto" in
17636         define)
17637         case "$setservent_r_proto" in
17638         ''|0) try='int setservent_r(int, struct servent_data*);'
17639         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17640         esac
17641         case "$setservent_r_proto" in
17642         ''|0) try='void setservent_r(int, struct servent_data*);'
17643         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17644         esac
17645         case "$setservent_r_proto" in
17646         ''|0)   d_setservent_r=undef
17647                 setservent_r_proto=0
17648                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17649         * )     case "$setservent_r_proto" in
17650                 REENTRANT_PROTO*) ;;
17651                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17652                 esac
17653                 echo "Prototype: $try" ;;
17654         esac
17655         ;;
17656         *)      case "$usethreads" in
17657                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17658                 esac
17659                 d_setservent_r=undef
17660                 setservent_r_proto=0
17661                 ;;
17662         esac
17663         ;;
17664 *)      setservent_r_proto=0
17665         ;;
17666 esac
17667
17668 : see if setsid exists
17669 set setsid d_setsid
17670 eval $inlibc
17671
17672 : see if setvbuf exists
17673 set setvbuf d_setvbuf
17674 eval $inlibc
17675
17676 : see if shmctl exists
17677 set shmctl d_shmctl
17678 eval $inlibc
17679
17680 : see if shmget exists
17681 set shmget d_shmget
17682 eval $inlibc
17683
17684 : see if shmat exists
17685 set shmat d_shmat
17686 eval $inlibc
17687 : see what shmat returns
17688 case "$d_shmat" in
17689 "$define")
17690         $cat >shmat.c <<'END'
17691 #include <sys/shm.h>
17692 void *shmat();
17693 END
17694         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17695                 shmattype='void *'
17696         else
17697                 shmattype='char *'
17698         fi
17699         echo "and it returns ($shmattype)." >&4
17700         : see if a prototype for shmat is available
17701         xxx=`./findhdr sys/shm.h`
17702         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17703         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17704                 val="$define"
17705         else
17706                 val="$undef"
17707         fi
17708         $rm -f shmat.[co]
17709         ;;
17710 *)
17711         val="$undef"
17712         ;;
17713 esac
17714 set d_shmatprototype
17715 eval $setvar
17716
17717 : see if shmdt exists
17718 set shmdt d_shmdt
17719 eval $inlibc
17720
17721 : see how much of the 'shm*(2)' library is present.
17722 h_shm=true
17723 echo " "
17724 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17725 *"$undef"*) h_shm=false;;
17726 esac
17727 case "$osname" in
17728 freebsd)
17729     case "`ipcs 2>&1`" in
17730     "SVID shared memory"*"not configured"*)
17731         echo "Your $osname does not have the shm*(2) configured." >&4
17732         h_shm=false
17733         val="$undef"
17734         set shmctl d_shmctl
17735         evat $setvar
17736         set shmget d_shmget
17737         evat $setvar
17738         set shmat d_shmat
17739         evat $setvar
17740         set shmdt d_shmdt
17741         evat $setvar
17742         ;;
17743     esac
17744     ;;
17745 esac
17746 : we could also check for sys/ipc.h ...
17747 if $h_shm && $test `./findhdr sys/shm.h`; then
17748         echo "You have the full shm*(2) library." >&4
17749         val="$define"
17750 else
17751         echo "You don't have the full shm*(2) library." >&4
17752         val="$undef"
17753 fi
17754 set d_shm
17755 eval $setvar
17756
17757 : see if we have sigaction
17758 echo " "
17759 if set sigaction val -f d_sigaction; eval $csym; $val; then
17760         echo 'sigaction() found.' >&4
17761         $cat > try.c <<EOP
17762 #include <stdio.h>
17763 #include <sys/types.h>
17764 #include <signal.h>
17765 #$i_stdlib I_STDLIB
17766 #ifdef I_STDLIB
17767 #include <stdlib.h>
17768 #endif
17769 int main()
17770 {
17771     struct sigaction act, oact;
17772     act.sa_flags = 0;
17773     oact.sa_handler = 0;
17774     /* so that act and oact are used */
17775     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17776 }
17777 EOP
17778         set try
17779         if eval $compile_ok; then
17780                 val="$define"
17781         else
17782                 echo "But you don't seem to have a usable struct sigaction." >&4
17783                 val="$undef"
17784         fi
17785 else
17786         echo 'sigaction NOT found.' >&4
17787         val="$undef"
17788 fi
17789 set d_sigaction; eval $setvar
17790 $rm_try
17791
17792 : see if this is a sunmath.h system
17793 set sunmath.h i_sunmath
17794 eval $inhdr
17795
17796 : see if signbit exists
17797 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17798 $cat >try.c <<EOCP
17799 #$i_math I_MATH
17800 #$i_sunmath I_SUNMATH
17801 #ifdef I_MATH
17802 #  include <math.h>
17803 #endif
17804 #ifdef I_SUNMATH  /* Solaris special math library */
17805 #  include <sunmath.h>
17806 #endif
17807 #define NV $nvtype
17808 int main(int argc, char **argv)
17809 {
17810     NV x = 0.0;
17811     NV y = -0.0;
17812     if ((signbit(x) == 0) && (signbit(y) != 0))
17813         return 0;
17814     else
17815         return 1;
17816 }
17817 EOCP
17818 val="$undef"
17819 set try
17820 if eval $compile; then
17821     if $run ./try; then
17822         $echo "Yes." >&4
17823         val="$define"
17824     else
17825         $echo "Signbit seems to be available, but doesn't work as I expected."
17826         $echo "I won't use it." >&4
17827         val="$undef"
17828     fi
17829 else
17830     $echo "Nope." >&4
17831     dflt="$undef"
17832 fi
17833 set d_signbit
17834 eval $setvar
17835 $rm_try
17836
17837 : see if sigprocmask exists
17838 set sigprocmask d_sigprocmask
17839 eval $inlibc
17840
17841 : see if sigsetjmp exists
17842 echo " "
17843 case "$d_sigsetjmp" in
17844 '')
17845         $cat >try.c <<EOP
17846 #include <setjmp.h>
17847 #$i_stdlib I_STDLIB
17848 #ifdef I_STDLIB
17849 #include <stdlib.h>
17850 #endif
17851 sigjmp_buf env;
17852 int set = 1;
17853 int main()
17854 {
17855         if (sigsetjmp(env,1))
17856                 exit(set);
17857         set = 0;
17858         siglongjmp(env, 1);
17859         exit(1);
17860 }
17861 EOP
17862         set try
17863         if eval $compile; then
17864                 if $run ./try >/dev/null 2>&1; then
17865                         echo "POSIX sigsetjmp found." >&4
17866                         val="$define"
17867                 else
17868                         $cat >&4 <<EOM
17869 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17870 I'll ignore them.
17871 EOM
17872                         val="$undef"
17873                 fi
17874         else
17875                 echo "sigsetjmp not found." >&4
17876                 val="$undef"
17877         fi
17878         ;;
17879 *) val="$d_sigsetjmp"
17880         case "$d_sigsetjmp" in
17881         $define) echo "POSIX sigsetjmp found." >&4;;
17882         $undef) echo "sigsetjmp not found." >&4;;
17883         esac
17884         ;;
17885 esac
17886 set d_sigsetjmp
17887 eval $setvar
17888 $rm_try
17889
17890 : see if snprintf exists
17891 set snprintf d_snprintf
17892 eval $inlibc
17893
17894 : see if vsnprintf exists
17895 set vsnprintf d_vsnprintf
17896 eval $inlibc
17897
17898 case "$d_snprintf-$d_vsnprintf" in
17899 "$define-$define")
17900     $cat <<EOM
17901 Checking whether your snprintf() and vsnprintf() work okay...
17902 EOM
17903     $cat >try.c <<'EOCP'
17904 /* v?snprintf testing logic courtesy of Russ Allbery.
17905  * According to C99:
17906  * - if the buffer is too short it still must be \0-terminated
17907  * - if the buffer is too short the potentially required length
17908  *   must be returned and not -1
17909  * - if the buffer is NULL the potentially required length
17910  *   must be returned and not -1 or core dump
17911  */
17912 #include <stdio.h>
17913 #include <stdarg.h>
17914
17915 char buf[2];
17916
17917 int test (char *format, ...)
17918 {
17919     va_list args;
17920     int count;
17921
17922     va_start (args, format);
17923     count = vsnprintf (buf, sizeof buf, format, args);
17924     va_end (args);
17925     return count;
17926 }
17927
17928 int main ()
17929 {
17930     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17931              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17932 }
17933 EOCP
17934     set try
17935     if eval $compile; then
17936         `$run ./try`
17937         case "$?" in
17938         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17939         *) cat <<EOM >&4
17940 Your snprintf() and snprintf() don't seem to be working okay.
17941 EOM
17942            d_snprintf="$undef"
17943            d_vsnprintf="$undef"
17944            ;;
17945         esac
17946     else
17947         echo "(I can't seem to compile the test program--assuming they don't)"
17948         d_snprintf="$undef"
17949         d_vsnprintf="$undef"
17950     fi
17951     $rm_try
17952     ;;
17953 esac
17954
17955 : see if sockatmark exists
17956 set sockatmark d_sockatmark
17957 eval $inlibc
17958
17959 : see if prototype for sockatmark is available
17960 echo " "
17961 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17962 eval $hasproto
17963
17964 : see if socks5_init exists
17965 set socks5_init d_socks5_init
17966 eval $inlibc
17967
17968 : see if sprintf returns the length of the string in the buffer as per ANSI
17969 $echo "Checking whether sprintf returns the length of the string..." >&4
17970 $cat <<EOP >try.c
17971 #include <stdio.h>
17972 #$i_stdlib I_STDLIB
17973 #ifdef I_STDLIB
17974 #include <stdlib.h>
17975 #endif
17976 #$i_string I_STRING
17977 #ifdef I_STRING
17978 #  include <string.h>
17979 #else
17980 #  include <strings.h>
17981 #endif
17982 #$i_math I_MATH
17983 #ifdef I_MATH
17984 #include <math.h>
17985 #endif
17986
17987 char buffer[256];
17988
17989 int check (size_t expect, int test) {
17990   size_t got = strlen(buffer);
17991   if (expect == got)
17992     return 0;
17993
17994   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17995        test, buffer);
17996   exit (test);
17997 }
17998
17999 int main(int argc, char **argv) {
18000   int test = 0;
18001
18002   check(sprintf(buffer, ""), ++test);
18003   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18004   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18005
18006   return 0;
18007 }
18008 EOP
18009 set try
18010
18011 if eval $compile; then
18012     xxx="`$run ./try`"
18013     case "$?" in
18014         0) cat >&4 <<EOM
18015 sprintf returns the length of the string (as ANSI says it should)
18016 EOM
18017         d_sprintf_returns_strlen="$define"
18018         ;;
18019         *) cat >&4 <<EOM
18020 sprintf does not return the length of the string (how old is this system?)
18021 EOM
18022         d_sprintf_returns_strlen="$undef"
18023         ;;
18024     esac
18025 else
18026     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18027     d_sprintf_returns_strlen="$undef"
18028 fi
18029 $rm_try
18030
18031 : see if srand48_r exists
18032 set srand48_r d_srand48_r
18033 eval $inlibc
18034 case "$d_srand48_r" in
18035 "$define")
18036         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18037         case "$d_srand48_r_proto:$usethreads" in
18038         ":define")      d_srand48_r_proto=define
18039                 set d_srand48_r_proto srand48_r $hdrs
18040                 eval $hasproto ;;
18041         *)      ;;
18042         esac
18043         case "$d_srand48_r_proto" in
18044         define)
18045         case "$srand48_r_proto" in
18046         ''|0) try='int srand48_r(long, struct drand48_data*);'
18047         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18048         esac
18049         case "$srand48_r_proto" in
18050         ''|0)   d_srand48_r=undef
18051                 srand48_r_proto=0
18052                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18053         * )     case "$srand48_r_proto" in
18054                 REENTRANT_PROTO*) ;;
18055                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18056                 esac
18057                 echo "Prototype: $try" ;;
18058         esac
18059         ;;
18060         *)      case "$usethreads" in
18061                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18062                 esac
18063                 d_srand48_r=undef
18064                 srand48_r_proto=0
18065                 ;;
18066         esac
18067         ;;
18068 *)      srand48_r_proto=0
18069         ;;
18070 esac
18071
18072 : see if srandom_r exists
18073 set srandom_r d_srandom_r
18074 eval $inlibc
18075 case "$d_srandom_r" in
18076 "$define")
18077         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18078         case "$d_srandom_r_proto:$usethreads" in
18079         ":define")      d_srandom_r_proto=define
18080                 set d_srandom_r_proto srandom_r $hdrs
18081                 eval $hasproto ;;
18082         *)      ;;
18083         esac
18084         case "$d_srandom_r_proto" in
18085         define)
18086         case "$srandom_r_proto" in
18087         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18088         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18089         esac
18090         case "$srandom_r_proto" in
18091         ''|0)   d_srandom_r=undef
18092                 srandom_r_proto=0
18093                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18094         * )     case "$srandom_r_proto" in
18095                 REENTRANT_PROTO*) ;;
18096                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18097                 esac
18098                 echo "Prototype: $try" ;;
18099         esac
18100         ;;
18101         *)      case "$usethreads" in
18102                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18103                 esac
18104                 d_srandom_r=undef
18105                 srandom_r_proto=0
18106                 ;;
18107         esac
18108         ;;
18109 *)      srandom_r_proto=0
18110         ;;
18111 esac
18112
18113 : see if prototype for setresgid is available
18114 echo " "
18115 set d_sresgproto setresgid $i_unistd unistd.h
18116 eval $hasproto
18117
18118 : see if prototype for setresuid is available
18119 echo " "
18120 set d_sresuproto setresuid $i_unistd unistd.h
18121 eval $hasproto
18122
18123 : see if sys/stat.h is available
18124 set sys/stat.h i_sysstat
18125 eval $inhdr
18126
18127 : see if stat knows about block sizes
18128 echo " "
18129 echo "Checking to see if your struct stat has st_blocks field..." >&4
18130 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18131 eval $hasfield
18132
18133 : see if this is a sys/vfs.h system
18134 set sys/vfs.h i_sysvfs
18135 eval $inhdr
18136
18137 : see if this is a sys/statfs.h system
18138 set sys/statfs.h i_sysstatfs
18139 eval $inhdr
18140
18141 : Check for statfs_s
18142 echo " "
18143 echo "Checking to see if your system supports struct statfs..." >&4
18144 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
18145 eval $hasstruct
18146 case "$d_statfs_s" in
18147 "$define")      echo "Yes, it does."   ;;
18148 *)              echo "No, it doesn't." ;;
18149 esac
18150
18151
18152 : see if struct statfs knows about f_flags
18153 case "$d_statfs_s" in
18154 define)
18155         echo " "
18156         echo "Checking to see if your struct statfs has f_flags field..." >&4
18157         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
18158         eval $hasfield
18159         ;;
18160 *)      val="$undef"
18161         set d_statfs_f_flags
18162         eval $setvar
18163         ;;
18164 esac
18165 case "$d_statfs_f_flags" in
18166 "$define")      echo "Yes, it does."   ;;
18167 *)              echo "No, it doesn't." ;;
18168 esac
18169
18170 : see what flavor, if any, of static inline is supported
18171 echo " "
18172 echo "Checking to see if your system supports static inline..."
18173 $cat > try.c <<'EOCP'
18174 #include <stdlib.h>
18175 extern int f_via_a(int x);
18176 extern int f_via_b(int x);
18177 int main(int argc, char **argv)
18178 {
18179     int y;
18180
18181     y = f_via_a(0);
18182 #ifdef USE_B
18183     y = f_via_b(0);
18184 #endif
18185     if (y == 42) {
18186         return EXIT_SUCCESS;
18187     }
18188     else {
18189         return EXIT_FAILURE;
18190     }
18191 }
18192 EOCP
18193 $cat > a.c <<'EOCP'
18194 static INLINE int f(int x) {
18195     int y;
18196     y = x + 42;
18197     return y;
18198 }
18199
18200 int f_via_a(int x)
18201 {
18202     return f(x);
18203 }
18204 EOCP
18205 $cat > b.c <<'EOCP'
18206 extern int f(int x);
18207
18208 int f_via_b(int x)
18209 {
18210     return f(x);
18211 }
18212 EOCP
18213
18214 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18215 case "$perl_static_inline" in
18216 '')     # Check the various possibilities, and break out on success.
18217         # For gcc, prefer __inline__, which will still permit
18218         # cflags.SH to add in -ansi.
18219         case "$gccversion" in
18220                 '') xxx="inline __inline__ __inline _inline";;
18221                 *)  xxx="__inline__ inline __inline _inline";;
18222         esac
18223         for inline in $xxx; do
18224                 set try -DINLINE=$inline a.c
18225                 if eval $compile && $run ./try; then
18226                         # Now make sure there is no external linkage of static
18227                         # functions
18228                         set try -DINLINE=$inline -DUSE_B a.c b.c
18229                         if eval $compile && $run ./try; then
18230                                 $echo "Your compiler supports static $inline, " >&4
18231                                 $echo "but it also creates an external definition," >&4
18232                                 $echo "so I won't use it." >&4
18233                                 val=$undef
18234                         else
18235                                 $echo "Your compiler supports static $inline." >&4
18236                                 val=$define
18237                                 perl_static_inline="static $inline";
18238                                 break;
18239                         fi
18240                 else
18241                         $echo "Your compiler does NOT support static $inline." >&4
18242                         val="$undef"
18243                 fi
18244         done
18245         ;;
18246 *inline*) # Some variant of inline exists.
18247         echo "Keeping your $hint value of $perl_static_inline."
18248         val=$define
18249         ;;
18250 static)  # No inline capabilities
18251         echo "Keeping your $hint value of $perl_static_inline."
18252         val=$undef
18253         ;;
18254 *)  # Unrecognized previous value -- blindly trust the supplied
18255         # value and hope it makes sense.  Use old value for
18256         # d_static_inline, if there is one.
18257         echo "Keeping your $hint value of $perl_static_inline."
18258         case "$d_static_inline" in
18259                 '') val=$define ;;
18260                 *)  val=$d_static_inline ;;
18261         esac
18262         ;;
18263 esac
18264 # Fallback to plain 'static' if nothing worked.
18265 case "$perl_static_inline" in
18266 '')
18267         perl_static_inline="static"
18268         val=$undef
18269         ;;
18270 esac
18271 set d_static_inline
18272 eval $setvar
18273 $rm -f a.[co] b.[co]
18274 $rm_try
18275
18276 : Check stream access
18277 $cat >&4 <<EOM
18278 Checking how to access stdio streams by file descriptor number...
18279 EOM
18280 case "$stdio_stream_array" in
18281 '')     $cat >try.c <<EOCP
18282 #include <stdio.h>
18283 int main() {
18284   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18285     printf("yes\n");
18286 }
18287 EOCP
18288         for s in _iob __iob __sF
18289         do
18290                 set try -DSTDIO_STREAM_ARRAY=$s
18291                 if eval $compile; then
18292                         case "`$run ./try`" in
18293                         yes)    stdio_stream_array=$s; break ;;
18294                         esac
18295                 fi
18296         done
18297         $rm_try
18298 esac
18299 case "$stdio_stream_array" in
18300 '')     $cat >&4 <<EOM
18301 I can't figure out how to access stdio streams by file descriptor number.
18302 EOM
18303         d_stdio_stream_array="$undef"
18304         ;;
18305 *)      $cat >&4 <<EOM
18306 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18307 EOM
18308         d_stdio_stream_array="$define"
18309         ;;
18310 esac
18311
18312 : see if strcoll exists
18313 set strcoll d_strcoll
18314 eval $inlibc
18315
18316 : check for structure copying
18317 echo " "
18318 echo "Checking to see if your C compiler can copy structs..." >&4
18319 $cat >try.c <<'EOCP'
18320 int main()
18321 {
18322         struct blurfl {
18323                 int dyick;
18324         } foo, bar;
18325
18326         foo = bar;
18327 }
18328 EOCP
18329 if $cc -c try.c >/dev/null 2>&1 ; then
18330         val="$define"
18331         echo "Yup, it can."
18332 else
18333         val="$undef"
18334         echo "Nope, it can't."
18335 fi
18336 set d_strctcpy
18337 eval $setvar
18338 $rm_try
18339
18340 : see if strerror and/or sys_errlist[] exist
18341 echo " "
18342 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18343     if set strerror val -f d_strerror; eval $csym; $val; then
18344                 echo 'strerror() found.' >&4
18345                 d_strerror="$define"
18346                 d_strerrm='strerror(e)'
18347                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18348                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18349                         d_syserrlst="$define"
18350                 else
18351                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18352                         d_syserrlst="$undef"
18353                 fi
18354     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18355                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18356                 echo 'strerror() found in string header.' >&4
18357                 d_strerror="$define"
18358                 d_strerrm='strerror(e)'
18359                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18360                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18361                                 d_syserrlst="$define"
18362                 else
18363                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18364                         d_syserrlst="$undef"
18365                 fi
18366     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18367                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18368                 d_strerror="$undef"
18369                 d_syserrlst="$define"
18370                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18371     else
18372                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18373                 d_strerror="$undef"
18374                 d_syserrlst="$undef"
18375                 d_strerrm='"unknown"'
18376     fi
18377 fi
18378
18379 : see if strerror_r exists
18380 set strerror_r d_strerror_r
18381 eval $inlibc
18382 case "$d_strerror_r" in
18383 "$define")
18384         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18385         case "$d_strerror_r_proto:$usethreads" in
18386         ":define")      d_strerror_r_proto=define
18387                 set d_strerror_r_proto strerror_r $hdrs
18388                 eval $hasproto ;;
18389         *)      ;;
18390         esac
18391         case "$d_strerror_r_proto" in
18392         define)
18393         case "$strerror_r_proto" in
18394         ''|0) try='int strerror_r(int, char*, size_t);'
18395         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18396         esac
18397         case "$strerror_r_proto" in
18398         ''|0) try='int strerror_r(int, char*, int);'
18399         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18400         esac
18401         case "$strerror_r_proto" in
18402         ''|0) try='char* strerror_r(int, char*, size_t);'
18403         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18404         esac
18405         case "$strerror_r_proto" in
18406         ''|0)   d_strerror_r=undef
18407                 strerror_r_proto=0
18408                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18409         * )     case "$strerror_r_proto" in
18410                 REENTRANT_PROTO*) ;;
18411                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18412                 esac
18413                 echo "Prototype: $try" ;;
18414         esac
18415         ;;
18416         *)      case "$usethreads" in
18417                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18418                 esac
18419                 d_strerror_r=undef
18420                 strerror_r_proto=0
18421                 ;;
18422         esac
18423         ;;
18424 *)      strerror_r_proto=0
18425         ;;
18426 esac
18427
18428 : see if strftime exists
18429 set strftime d_strftime
18430 eval $inlibc
18431
18432 : see if strlcat exists
18433 set strlcat d_strlcat
18434 eval $inlibc
18435
18436 : see if strlcpy exists
18437 set strlcpy d_strlcpy
18438 eval $inlibc
18439
18440 : see if strtod exists
18441 set strtod d_strtod
18442 eval $inlibc
18443
18444 : see if strtol exists
18445 set strtol d_strtol
18446 eval $inlibc
18447
18448 : see if strtold exists
18449 set strtold d_strtold
18450 eval $inlibc
18451
18452 : see if strtoll exists
18453 set strtoll d_strtoll
18454 eval $inlibc
18455
18456 case "$d_longlong-$d_strtoll" in
18457 "$define-$define")
18458         $cat <<EOM
18459 Checking whether your strtoll() works okay...
18460 EOM
18461         $cat >try.c <<'EOCP'
18462 #include <errno.h>
18463 #ifdef __hpux
18464 #define strtoll __strtoll
18465 #endif
18466 #ifdef __EMX__
18467 #define strtoll _strtoll
18468 #endif
18469 #include <stdio.h>
18470 extern long long int strtoll(char *s, char **, int);
18471 static int bad = 0;
18472 int check(char *s, long long ell, int een) {
18473         long long gll;
18474         errno = 0;
18475         gll = strtoll(s, 0, 10);
18476         if (!((gll == ell) && (errno == een)))
18477                 bad++;
18478 }
18479 int main() {
18480         check(" 1",                                      1LL, 0);
18481         check(" 0",                                      0LL, 0);
18482         check("-1",                                     -1LL, 0);
18483         check("-9223372036854775808", -9223372036854775808LL, 0);
18484         check("-9223372036854775808", -9223372036854775808LL, 0);
18485         check(" 9223372036854775807",  9223372036854775807LL, 0);
18486         check("-9223372036854775808", -9223372036854775808LL, 0);
18487         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18488         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18489         if (!bad)
18490                 printf("ok\n");
18491 }
18492 EOCP
18493         set try
18494         if eval $compile; then
18495                 yyy=`$run ./try`
18496                 case "$yyy" in
18497                 ok) echo "Your strtoll() seems to be working okay." ;;
18498                 *) cat <<EOM >&4
18499 Your strtoll() doesn't seem to be working okay.
18500 EOM
18501                    d_strtoll="$undef"
18502                    ;;
18503                 esac
18504         else
18505                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18506                 d_strtoll="$undef"
18507         fi
18508         ;;
18509 esac
18510
18511 : see if strtoq exists
18512 set strtoq d_strtoq
18513 eval $inlibc
18514
18515 : see if strtoul exists
18516 set strtoul d_strtoul
18517 eval $inlibc
18518
18519 case "$d_strtoul" in
18520 "$define")
18521         $cat <<EOM
18522 Checking whether your strtoul() works okay...
18523 EOM
18524         $cat >try.c <<'EOCP'
18525 #include <errno.h>
18526 #include <stdio.h>
18527 extern unsigned long int strtoul(char *s, char **, int);
18528 static int bad = 0;
18529 void check(char *s, unsigned long eul, int een) {
18530         unsigned long gul;
18531         errno = 0;
18532         gul = strtoul(s, 0, 10);
18533         if (!((gul == eul) && (errno == een)))
18534                 bad++;
18535 }
18536 int main() {
18537         check(" 1", 1L, 0);
18538         check(" 0", 0L, 0);
18539 EOCP
18540         case "$longsize" in
18541         8)
18542             $cat >>try.c <<'EOCP'
18543         check("18446744073709551615", 18446744073709551615UL, 0);
18544         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18545 #if 0 /* strtoul() for /^-/ strings is undefined. */
18546         check("-1", 18446744073709551615UL, 0);
18547         check("-18446744073709551614", 2, 0);
18548         check("-18446744073709551615", 1, 0);
18549         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18550         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18551 #endif
18552 EOCP
18553                 ;;
18554         4)
18555                     $cat >>try.c <<'EOCP'
18556         check("4294967295", 4294967295UL, 0);
18557         check("4294967296", 4294967295UL, ERANGE);
18558 #if 0 /* strtoul() for /^-/ strings is undefined. */
18559         check("-1", 4294967295UL, 0);
18560         check("-4294967294", 2, 0);
18561         check("-4294967295", 1, 0);
18562         check("-4294967296", 4294967295UL, ERANGE);
18563         check("-4294967297", 4294967295UL, ERANGE);
18564 #endif
18565 EOCP
18566                 ;;
18567         *)
18568 : Should we write these tests to be more portable by sprintf-ing
18569 : ~0 and then manipulating that char string as input for strtol?
18570                 ;;
18571         esac
18572         $cat >>try.c <<'EOCP'
18573         if (!bad)
18574                 printf("ok\n");
18575         return 0;
18576 }
18577 EOCP
18578         set try
18579         if eval $compile; then
18580                 case "`$run ./try`" in
18581                 ok) echo "Your strtoul() seems to be working okay." ;;
18582                 *) cat <<EOM >&4
18583 Your strtoul() doesn't seem to be working okay.
18584 EOM
18585                    d_strtoul="$undef"
18586                    ;;
18587                 esac
18588         else
18589                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18590                 d_strtoul="$undef"
18591         fi
18592         ;;
18593 esac
18594
18595 : see if strtoull exists
18596 set strtoull d_strtoull
18597 eval $inlibc
18598
18599 case "$d_longlong-$d_strtoull" in
18600 "$define-$define")
18601         $cat <<EOM
18602 Checking whether your strtoull() works okay...
18603 EOM
18604         $cat >try.c <<'EOCP'
18605 #include <errno.h>
18606 #ifdef __hpux
18607 #define strtoull __strtoull
18608 #endif
18609 #include <stdio.h>
18610 extern unsigned long long int strtoull(char *s, char **, int);
18611 static int bad = 0;
18612 int check(char *s, long long eull, int een) {
18613         long long gull;
18614         errno = 0;
18615         gull = strtoull(s, 0, 10);
18616         if (!((gull == eull) && (errno == een)))
18617                 bad++;
18618 }
18619 int main() {
18620         check(" 1",                                        1LL, 0);
18621         check(" 0",                                        0LL, 0);
18622         check("18446744073709551615",  18446744073709551615ULL, 0);
18623         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18624 #if 0 /* strtoull() for /^-/ strings is undefined. */
18625         check("-1",                    18446744073709551615ULL, 0);
18626         check("-18446744073709551614",                     2LL, 0);
18627         check("-18446744073709551615",                     1LL, 0);
18628         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18629         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18630 #endif
18631         if (!bad)
18632                 printf("ok\n");
18633 }
18634 EOCP
18635         set try
18636         if eval $compile; then
18637                 case "`$run ./try`" in
18638                 ok) echo "Your strtoull() seems to be working okay." ;;
18639                 *) cat <<EOM >&4
18640 Your strtoull() doesn't seem to be working okay.
18641 EOM
18642                    d_strtoull="$undef"
18643                    ;;
18644                 esac
18645         else
18646                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18647                 d_strtoull="$undef"
18648         fi
18649         ;;
18650 esac
18651
18652 : see if strtouq exists
18653 set strtouq d_strtouq
18654 eval $inlibc
18655
18656 case "$d_strtouq" in
18657 "$define")
18658         $cat <<EOM
18659 Checking whether your strtouq() works okay...
18660 EOM
18661         $cat >try.c <<'EOCP'
18662 #include <errno.h>
18663 #include <stdio.h>
18664 extern unsigned long long int strtouq(char *s, char **, int);
18665 static int bad = 0;
18666 void check(char *s, unsigned long long eull, int een) {
18667         unsigned long long gull;
18668         errno = 0;
18669         gull = strtouq(s, 0, 10);
18670         if (!((gull == eull) && (errno == een)))
18671                 bad++;
18672 }
18673 int main() {
18674         check(" 1",                                        1LL, 0);
18675         check(" 0",                                        0LL, 0);
18676         check("18446744073709551615",  18446744073709551615ULL, 0);
18677         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18678 #if 0 /* strtouq() for /^-/ strings is undefined. */
18679         check("-1",                    18446744073709551615ULL, 0);
18680         check("-18446744073709551614",                     2LL, 0);
18681         check("-18446744073709551615",                     1LL, 0);
18682         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18683         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18684 #endif
18685         if (!bad)
18686                 printf("ok\n");
18687         return 0;
18688 }
18689 EOCP
18690         set try
18691         if eval $compile; then
18692                 case "`$run ./try`" in
18693                 ok) echo "Your strtouq() seems to be working okay." ;;
18694                 *) cat <<EOM >&4
18695 Your strtouq() doesn't seem to be working okay.
18696 EOM
18697                    d_strtouq="$undef"
18698                    ;;
18699                 esac
18700         else
18701                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18702                 d_strtouq="$undef"
18703         fi
18704         ;;
18705 esac
18706
18707 : see if strxfrm exists
18708 set strxfrm d_strxfrm
18709 eval $inlibc
18710
18711 : see if symlink exists
18712 set symlink d_symlink
18713 eval $inlibc
18714
18715 : see if syscall exists
18716 set syscall d_syscall
18717 eval $inlibc
18718
18719 : see if prototype for syscall is available
18720 echo " "
18721 set d_syscallproto syscall $i_unistd unistd.h
18722 eval $hasproto
18723
18724 : see if sysconf exists
18725 set sysconf d_sysconf
18726 eval $inlibc
18727
18728 : see if system exists
18729 set system d_system
18730 eval $inlibc
18731
18732 : see if tcgetpgrp exists
18733 set tcgetpgrp d_tcgetpgrp
18734 eval $inlibc
18735
18736 : see if tcsetpgrp exists
18737 set tcsetpgrp d_tcsetpgrp
18738 eval $inlibc
18739
18740 : see if prototype for telldir is available
18741 echo " "
18742 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18743 eval $hasproto
18744
18745 : see if time exists
18746 echo " "
18747 if test "X$d_time" = X -o X"$timetype" = X; then
18748     if set time val -f d_time; eval $csym; $val; then
18749                 echo 'time() found.' >&4
18750                 val="$define"
18751                 rp="What is the type returned by time() on this system?"
18752                 set time_t timetype long stdio.h sys/types.h
18753                 eval $typedef_ask
18754     else
18755                 echo 'time() not found, hope that will do.' >&4
18756                 val="$undef"
18757                 timetype='int';
18758     fi
18759     set d_time
18760     eval $setvar
18761 fi
18762
18763 : see if timegm exists
18764 set timegm d_timegm
18765 eval $inlibc
18766
18767 : see if this is a sys/times.h system
18768 set sys/times.h i_systimes
18769 eval $inhdr
18770
18771 : see if times exists
18772 echo " "
18773 if set times val -f d_times; eval $csym; $val; then
18774         echo 'times() found.' >&4
18775         d_times="$define"
18776         inc=''
18777         case "$i_systimes" in
18778         "$define") inc='sys/times.h';;
18779         esac
18780         rp="What is the type returned by times() on this system?"
18781         set clock_t clocktype long stdio.h sys/types.h $inc
18782         eval $typedef_ask
18783 else
18784         echo 'times() NOT found, hope that will do.' >&4
18785         d_times="$undef"
18786         clocktype='int'
18787 fi
18788
18789 : see if tmpnam_r exists
18790 set tmpnam_r d_tmpnam_r
18791 eval $inlibc
18792 case "$d_tmpnam_r" in
18793 "$define")
18794         hdrs="$i_systypes sys/types.h define stdio.h "
18795         case "$d_tmpnam_r_proto:$usethreads" in
18796         ":define")      d_tmpnam_r_proto=define
18797                 set d_tmpnam_r_proto tmpnam_r $hdrs
18798                 eval $hasproto ;;
18799         *)      ;;
18800         esac
18801         case "$d_tmpnam_r_proto" in
18802         define)
18803         case "$tmpnam_r_proto" in
18804         ''|0) try='char* tmpnam_r(char*);'
18805         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18806         esac
18807         case "$tmpnam_r_proto" in
18808         ''|0)   d_tmpnam_r=undef
18809                 tmpnam_r_proto=0
18810                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18811         * )     case "$tmpnam_r_proto" in
18812                 REENTRANT_PROTO*) ;;
18813                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18814                 esac
18815                 echo "Prototype: $try" ;;
18816         esac
18817         ;;
18818         *)      case "$usethreads" in
18819                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18820                 esac
18821                 d_tmpnam_r=undef
18822                 tmpnam_r_proto=0
18823                 ;;
18824         esac
18825         ;;
18826 *)      tmpnam_r_proto=0
18827         ;;
18828 esac
18829
18830 : see if truncate exists
18831 set truncate d_truncate
18832 eval $inlibc
18833
18834 : see if ttyname_r exists
18835 set ttyname_r d_ttyname_r
18836 eval $inlibc
18837 case "$d_ttyname_r" in
18838 "$define")
18839         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18840         case "$d_ttyname_r_proto:$usethreads" in
18841         ":define")      d_ttyname_r_proto=define
18842                 set d_ttyname_r_proto ttyname_r $hdrs
18843                 eval $hasproto ;;
18844         *)      ;;
18845         esac
18846         case "$d_ttyname_r_proto" in
18847         define)
18848         case "$ttyname_r_proto" in
18849         ''|0) try='int ttyname_r(int, char*, size_t);'
18850         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18851         esac
18852         case "$ttyname_r_proto" in
18853         ''|0) try='int ttyname_r(int, char*, int);'
18854         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18855         esac
18856         case "$ttyname_r_proto" in
18857         ''|0) try='char* ttyname_r(int, char*, int);'
18858         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18859         esac
18860         case "$ttyname_r_proto" in
18861         ''|0)   d_ttyname_r=undef
18862                 ttyname_r_proto=0
18863                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18864         * )     case "$ttyname_r_proto" in
18865                 REENTRANT_PROTO*) ;;
18866                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18867                 esac
18868                 echo "Prototype: $try" ;;
18869         esac
18870         ;;
18871         *)      case "$usethreads" in
18872                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18873                 esac
18874                 d_ttyname_r=undef
18875                 ttyname_r_proto=0
18876                 ;;
18877         esac
18878         ;;
18879 *)      ttyname_r_proto=0
18880         ;;
18881 esac
18882
18883 : see if tzname[] exists
18884 echo " "
18885 if set tzname val -a d_tzname; eval $csym; $val; then
18886         val="$define"
18887         echo 'tzname[] found.' >&4
18888 else
18889         val="$undef"
18890         echo 'tzname[] NOT found.' >&4
18891 fi
18892 set d_tzname
18893 eval $setvar
18894
18895 : Check if is a multiplatform env
18896 case "$osname" in
18897 next|darwin) multiarch="$define" ;;
18898 esac
18899 case "$multiarch" in
18900 ''|[nN]*) multiarch="$undef" ;;
18901 esac
18902
18903 : check for ordering of bytes in a UV
18904 echo " "
18905 case "$multiarch" in
18906 *$define*)
18907         $cat <<EOM
18908 You seem to be doing a multiarchitecture build,
18909 skipping the byteorder check.
18910
18911 EOM
18912         byteorder='ffff'
18913         ;;
18914 *)
18915         case "$byteorder" in
18916         '')
18917                 $cat <<'EOM'
18918 In the following, larger digits indicate more significance.  A big-endian
18919 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18920 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18921 machines may have weird orders like 3412.  A Cray will report 87654321,
18922 an Alpha will report 12345678. If the test program works the default is
18923 probably right.
18924 I'm now running the test program...
18925 EOM
18926                 $cat >try.c <<EOCP
18927 #include <stdio.h>
18928 #$i_stdlib I_STDLIB
18929 #ifdef I_STDLIB
18930 #include <stdlib.h>
18931 #endif
18932 #include <sys/types.h>
18933 typedef $uvtype UV;
18934 int main()
18935 {
18936         int i;
18937         union {
18938                 UV l;
18939                 char c[$uvsize];
18940         } u;
18941
18942         if ($uvsize > 4)
18943                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18944         else
18945                 u.l = (UV)0x04030201;
18946         for (i = 0; i < $uvsize; i++)
18947                 printf("%c", u.c[i]+'0');
18948         printf("\n");
18949         exit(0);
18950 }
18951 EOCP
18952                 xxx_prompt=y
18953                 set try
18954                 if eval $compile && $run ./try > /dev/null; then
18955                         dflt=`$run ./try`
18956                         case "$dflt" in
18957                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18958                                 echo "(The test program ran ok.)"
18959                                 echo "byteorder=$dflt"
18960                                 xxx_prompt=n
18961                         ;;
18962                         ????|????????) echo "(The test program ran ok.)" ;;
18963                         *) echo "(The test program didn't run right for some reason.)" ;;
18964                         esac
18965                 else
18966                         dflt='4321'
18967                         cat <<'EOM'
18968 (I can't seem to compile the test program.  Guessing big-endian...)
18969 EOM
18970                 fi
18971                 case "$xxx_prompt" in
18972                 y)
18973                         rp="What is the order of bytes in $uvtype?"
18974                         . ./myread
18975                         byteorder="$ans"
18976                         ;;
18977                 *)      byteorder=$dflt
18978                         ;;
18979                 esac
18980                 ;;
18981         esac
18982         $rm_try
18983         ;;
18984 esac
18985
18986 : Checking 32bit alignedness
18987 $cat <<EOM
18988
18989 Checking to see whether you can access character data unalignedly...
18990 EOM
18991 case "$d_u32align" in
18992 '')   $cat >try.c <<EOCP
18993 #include <stdio.h>
18994 #$i_stdlib I_STDLIB
18995 #ifdef I_STDLIB
18996 #include <stdlib.h>
18997 #endif
18998 #define U32 $u32type
18999 #define BYTEORDER 0x$byteorder
19000 #define U8 $u8type
19001 #include <signal.h>
19002 #ifdef SIGBUS
19003 $signal_t bletch(int s) { exit(4); }
19004 #endif
19005 int main() {
19006 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19007     volatile U8 buf[8];
19008     volatile U32 *up;
19009     int i;
19010
19011     if (sizeof(U32) != 4) {
19012         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19013         exit(1);
19014     }
19015
19016     fflush(stdout);
19017
19018 #ifdef SIGBUS
19019     signal(SIGBUS, bletch);
19020 #endif
19021
19022     buf[0] = 0;
19023     buf[1] = 0;
19024     buf[2] = 0;
19025     buf[3] = 1;
19026     buf[4] = 0;
19027     buf[5] = 0;
19028     buf[6] = 0;
19029     buf[7] = 1;
19030
19031     for (i = 0; i < 4; i++) {
19032         up = (U32*)(buf + i);
19033         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19034                (*up == 1 << (8*(3-i)))  /* little-endian */
19035               )
19036            )
19037         {
19038             printf("read failed (%x)\n", *up);
19039             exit(2);
19040         }
19041     }
19042
19043     /* write test */
19044     for (i = 0; i < 4; i++) {
19045         up = (U32*)(buf + i);
19046         *up = 0xBeef;
19047         if (*up != 0xBeef) {
19048             printf("write failed (%x)\n", *up);
19049             exit(3);
19050         }
19051     }
19052
19053     exit(0);
19054 #else
19055     printf("1\n");
19056     exit(1);
19057 #endif
19058     return 0;
19059 }
19060 EOCP
19061 set try
19062 if eval $compile_ok; then
19063         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19064         $run ./try 2>&1 >/dev/null
19065         case "$?" in
19066         0)      cat >&4 <<EOM
19067 You can access character data pretty unalignedly.
19068 EOM
19069                 d_u32align="$undef"
19070                 ;;
19071         *)      cat >&4 <<EOM
19072 It seems that you must access character data in an aligned manner.
19073 EOM
19074                 d_u32align="$define"
19075                 ;;
19076         esac
19077 else
19078         rp='Can you access character data at unaligned addresses?'
19079         dflt='n'
19080         . ./myread
19081         case "$ans" in
19082         [yY]*)  d_u32align="$undef"  ;;
19083         *)      d_u32align="$define" ;;
19084         esac
19085 fi
19086 $rm_try
19087 ;;
19088 esac
19089
19090 : see if ualarm exists
19091 set ualarm d_ualarm
19092 eval $inlibc
19093
19094 : see if umask exists
19095 set umask d_umask
19096 eval $inlibc
19097
19098 : see if unordered exists
19099 set unordered d_unordered
19100 eval $inlibc
19101
19102 : see if unsetenv exists
19103 set unsetenv d_unsetenv
19104 eval $inlibc
19105
19106 : see if usleep exists
19107 set usleep d_usleep
19108 eval $inlibc
19109
19110 : see if prototype for usleep is available
19111 echo " "
19112 set d_usleepproto usleep $i_unistd unistd.h
19113 eval $hasproto
19114
19115 : see if ustat exists
19116 set ustat d_ustat
19117 eval $inlibc
19118
19119 : see if closedir exists
19120 set closedir d_closedir
19121 eval $inlibc
19122
19123 case "$d_closedir" in
19124 "$define")
19125         echo " "
19126         echo "Checking whether closedir() returns a status..." >&4
19127         cat > try.c <<EOM
19128 #$i_dirent I_DIRENT             /**/
19129 #$i_sysdir I_SYS_DIR            /**/
19130 #$i_sysndir I_SYS_NDIR          /**/
19131 #$i_systypes I_SYS_TYPES        /**/
19132
19133 #if defined(I_SYS_TYPES)
19134 #include <sys/types.h>
19135 #endif
19136 #if defined(I_DIRENT)
19137 #include <dirent.h>
19138 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19139 #include <sys/dir.h>
19140 #endif
19141 #else
19142 #ifdef I_SYS_NDIR
19143 #include <sys/ndir.h>
19144 #else
19145 #ifdef I_SYS_DIR
19146 #ifdef hp9000s500
19147 #include <ndir.h>       /* may be wrong in the future */
19148 #else
19149 #include <sys/dir.h>
19150 #endif
19151 #endif
19152 #endif
19153 #endif
19154 int main() { return closedir(opendir(".")); }
19155 EOM
19156         set try
19157         if eval $compile_ok; then
19158                 if $run ./try > /dev/null 2>&1 ; then
19159                         echo "Yes, it does."
19160                         val="$undef"
19161                 else
19162                         echo "No, it doesn't."
19163                         val="$define"
19164                 fi
19165         else
19166                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19167                 val="$define"
19168         fi
19169         ;;
19170 *)
19171         val="$undef";
19172         ;;
19173 esac
19174 set d_void_closedir
19175 eval $setvar
19176 $rm_try
19177
19178 : see if there is a wait4
19179 set wait4 d_wait4
19180 eval $inlibc
19181
19182 : see if waitpid exists
19183 set waitpid d_waitpid
19184 eval $inlibc
19185
19186 : see if wcstombs exists
19187 set wcstombs d_wcstombs
19188 eval $inlibc
19189
19190 : see if wctomb exists
19191 set wctomb d_wctomb
19192 eval $inlibc
19193
19194 : see if writev exists
19195 set writev d_writev
19196 eval $inlibc
19197
19198 : preserve RCS keywords in files with variable substitution, grrr
19199 Date='$Date'
19200 Id='$Id'
19201 Log='$Log'
19202 RCSfile='$RCSfile'
19203 Revision='$Revision'
19204
19205 : check for alignment requirements
19206 echo " "
19207 case "$alignbytes" in
19208     '') echo "Checking alignment constraints..." >&4
19209         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19210             $cat >try.c <<'EOCP'
19211 typedef long double NV;
19212 EOCP
19213         else
19214             $cat >try.c <<'EOCP'
19215 typedef double NV;
19216 EOCP
19217         fi
19218         $cat >>try.c <<'EOCP'
19219 #include <stdio.h>
19220 struct foobar {
19221     char foo;
19222     NV bar;
19223 } try_algn;
19224 int main()
19225 {
19226     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19227     return(0);
19228 }
19229 EOCP
19230         set try
19231         if eval $compile_ok; then
19232             dflt=`$run ./try`
19233         else
19234             dflt='8'
19235             echo "(I can't seem to compile the test program...)"
19236         fi
19237         case "$multiarch" in
19238             *$define*)
19239                 : The usual safe value is 8, but Darwin with -Duselongdouble
19240                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19241                 : Configure to pick a larger value if needed.
19242                 if $test "$dflt" -lt 8; then
19243                     dflt='8'
19244                     echo "Setting alignment to 8 for multiarch support.">&4
19245                 fi
19246                 ;;
19247         esac
19248         ;;
19249     *) dflt="$alignbytes"
19250         ;;
19251 esac
19252 rp="Doubles must be aligned on a how-many-byte boundary?"
19253 . ./myread
19254 alignbytes="$ans"
19255 $rm_try
19256
19257 : set the base revision
19258 baserev=5.0
19259
19260 : Determine if this is an EBCDIC system
19261 echo " "
19262 echo "Determining whether or not we are on an EBCDIC system..." >&4
19263 $cat >try.c <<'EOM'
19264 int main()
19265 {
19266   if ('M'==0xd4) return 0;
19267   return 1;
19268 }
19269 EOM
19270
19271 case "$BOOTSTRAP_CHARSET" in
19272     Y|y|define) bootstrap_charset=$define       ;;
19273     *)          bootstrap_charset=$undef        ;;
19274 esac
19275
19276 val=$undef
19277 set try
19278 if eval $compile_ok; then
19279         if $run ./try; then
19280                 echo "You seem to speak EBCDIC." >&4
19281                 val="$define"
19282         else
19283                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19284         fi
19285 else
19286         echo "I'm unable to compile the test program." >&4
19287         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19288 fi
19289 $rm_try
19290 set ebcdic
19291 eval $setvar
19292
19293 : length of character in bytes. Is always 1, otherwise it is not C
19294 : This used to be a test using sizeof
19295 charsize=1
19296
19297 : Check for the number of bits in a character
19298 case "$charbits" in
19299 '')     echo "Checking how long a character is (in bits)..." >&4
19300         $cat >try.c <<EOCP
19301 #include <stdio.h>
19302 int main ()
19303 {
19304     int n;
19305     unsigned char c;
19306     for (c = 1, n = 0; c; c <<= 1, n++) ;
19307     printf ("%d\n", n);
19308     return (0);
19309     }
19310 EOCP
19311         set try
19312         if eval $compile_ok; then
19313                 dflt=`$run ./try`
19314         else
19315                 dflt='8'
19316                 echo "(I can't seem to compile the test program.  Guessing...)"
19317         fi
19318         ;;
19319 *)
19320         dflt="$charbits"
19321         ;;
19322 esac
19323 rp="What is the length of a character (in bits)?"
19324 . ./myread
19325 charbits="$ans"
19326 $rm_try
19327 case "$charbits" in
19328 8)      ;;
19329 *)      cat >&4 << EOM
19330 Your system has an unsigned character size of $charbits bits, which
19331 is rather unusual (normally it is 8 bits).  Perl likely will not work
19332 correctly on your system, with subtle bugs in various places.
19333 EOM
19334         rp='Do you really want to continue?'
19335         dflt='n'
19336         . ./myread
19337         case "$ans" in
19338                 [yY])   echo >&4 "Okay, continuing."    ;;
19339                 *)      exit 1                          ;;
19340         esac
19341 esac
19342
19343 : how do we concatenate cpp tokens here?
19344 echo " "
19345 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19346 $cat >cpp_stuff.c <<'EOCP'
19347 #define RCAT(a,b)a/**/b
19348 #define ACAT(a,b)a ## b
19349 RCAT(Rei,ser)
19350 ACAT(Cir,cus)
19351 EOCP
19352 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19353 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19354         echo "Oh!  Smells like ANSI's been here." >&4
19355         echo "We can catify or stringify, separately or together!"
19356         cpp_stuff=42
19357 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19358         echo "Ah, yes!  The good old days!" >&4
19359         echo "However, in the good old days we don't know how to stringify and"
19360         echo "catify at the same time."
19361         cpp_stuff=1
19362 else
19363         $cat >&4 <<EOM
19364 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19365 You're going to have to edit the values of CAT[2-5] in config.h...
19366 EOM
19367         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19368 fi
19369 $rm -f cpp_stuff.*
19370
19371 : see if this is a db.h system
19372 set db.h i_db
19373 eval $inhdr
19374
19375 case "$i_db" in
19376 $define)
19377         : Check db version.
19378         echo " "
19379         echo "Checking Berkeley DB version ..." >&4
19380         $cat >try.c <<EOCP
19381 #$d_const HASCONST
19382 #ifndef HASCONST
19383 #define const
19384 #endif
19385 #include <sys/types.h>
19386 #include <stdio.h>
19387 #$i_stdlib I_STDLIB
19388 #ifdef I_STDLIB
19389 #include <stdlib.h>
19390 #endif
19391 #include <db.h>
19392 int main(int argc, char *argv[])
19393 {
19394 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19395     int Major, Minor, Patch ;
19396     unsigned long Version ;
19397     (void)db_version(&Major, &Minor, &Patch) ;
19398     if (argc == 2) {
19399         printf("%d %d %d %d %d %d\n",
19400                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19401                Major, Minor, Patch);
19402         exit(0);
19403     }
19404     printf("You have Berkeley DB Version 2 or greater.\n");
19405
19406     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19407                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19408     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19409                 Major, Minor, Patch) ;
19410
19411     /* check that db.h & libdb are compatible */
19412     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19413         printf("db.h and libdb are incompatible.\n") ;
19414         exit(3);
19415     }
19416
19417     printf("db.h and libdb are compatible.\n") ;
19418
19419     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19420                 + DB_VERSION_PATCH ;
19421
19422     /* needs to be >= 2.3.4 */
19423     if (Version < 2003004) {
19424     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19425         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19426         exit(2);
19427     }
19428
19429     exit(0);
19430 #else
19431 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19432     if (argc == 2) {
19433         printf("1 0 0\n");
19434         exit(0);
19435     }
19436     printf("You have Berkeley DB Version 1.\n");
19437     exit(0);    /* DB version < 2: the coast is clear. */
19438 #else
19439     exit(1);    /* <db.h> not Berkeley DB? */
19440 #endif
19441 #endif
19442 }
19443 EOCP
19444         set try
19445         if eval $compile_ok && $run ./try; then
19446                 echo 'Looks OK.' >&4
19447                 set `$run ./try 1`
19448                 db_version_major=$1
19449                 db_version_minor=$2
19450                 db_version_patch=$3
19451         else
19452                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19453                 i_db=$undef
19454                 case " $libs " in
19455                 *"-ldb "*)
19456                         : Remove db from list of libraries to use
19457                         echo "Removing unusable -ldb from library list" >&4
19458                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19459                         shift
19460                         libs="$*"
19461                         echo "libs = $libs" >&4
19462                         ;;
19463                 esac
19464         fi
19465         $rm_try
19466         ;;
19467 esac
19468
19469 case "$i_db" in
19470 define)
19471         : Check the return type needed for hash
19472         echo " "
19473         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19474         $cat >try.c <<EOCP
19475 #$d_const HASCONST
19476 #ifndef HASCONST
19477 #define const
19478 #endif
19479 #include <sys/types.h>
19480 #include <db.h>
19481
19482 #ifndef DB_VERSION_MAJOR
19483 u_int32_t hash_cb (ptr, size)
19484 const void *ptr;
19485 size_t size;
19486 {
19487 }
19488 HASHINFO info;
19489 int main()
19490 {
19491         info.hash = hash_cb;
19492 }
19493 #endif
19494 EOCP
19495         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19496                 if $contains warning try.out >>/dev/null 2>&1 ; then
19497                         db_hashtype='int'
19498                 else
19499                         db_hashtype='u_int32_t'
19500                 fi
19501         else
19502                 : XXX Maybe we should just give up here.
19503                 db_hashtype=u_int32_t
19504                 $cat try.out >&4
19505                 echo "Help:  I can't seem to compile the db test program." >&4
19506                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19507         fi
19508         $rm_try
19509         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19510         ;;
19511 *)      db_hashtype=u_int32_t
19512         ;;
19513 esac
19514 case "$i_db" in
19515 define)
19516         : Check the return type needed for prefix
19517         echo " "
19518         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19519         cat >try.c <<EOCP
19520 #$d_const HASCONST
19521 #ifndef HASCONST
19522 #define const
19523 #endif
19524 #include <sys/types.h>
19525 #include <db.h>
19526
19527 #ifndef DB_VERSION_MAJOR
19528 size_t prefix_cb (key1, key2)
19529 const DBT *key1;
19530 const DBT *key2;
19531 {
19532 }
19533 BTREEINFO info;
19534 int main()
19535 {
19536         info.prefix = prefix_cb;
19537 }
19538 #endif
19539 EOCP
19540         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19541                 if $contains warning try.out >>/dev/null 2>&1 ; then
19542                         db_prefixtype='int'
19543                 else
19544                         db_prefixtype='size_t'
19545                 fi
19546         else
19547                 db_prefixtype='size_t'
19548                 : XXX Maybe we should just give up here.
19549                 $cat try.out >&4
19550                 echo "Help:  I can't seem to compile the db test program." >&4
19551                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19552         fi
19553         $rm_try
19554         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19555         ;;
19556 *)      db_prefixtype='size_t'
19557         ;;
19558 esac
19559
19560 : How can we generate normalized random numbers ?
19561 echo " "
19562 echo "Using our internal random number implementation..." >&4
19563
19564 case "$ccflags" in
19565 *-Dmy_rand=*|*-Dmy_srand=*)
19566         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19567         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19568         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19569         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19570         ;;
19571 esac
19572
19573 randfunc=Perl_drand48
19574 drand01="Perl_drand48()"
19575 seedfunc="Perl_drand48_init"
19576 randbits=48
19577 randseedtype=U32
19578
19579 : Check how to flush
19580 echo " "
19581 $cat >&4 <<EOM
19582 Checking how to flush all pending stdio output...
19583 EOM
19584 # I only know how to find the first 32 possibly open files on SunOS.
19585 # See also hints/sunos_4_1.sh and util.c  --AD
19586 case "$osname" in
19587 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19588 esac
19589 $cat >>try.c <<EOCP
19590 #include <stdio.h>
19591 #$i_stdlib I_STDLIB
19592 #ifdef I_STDLIB
19593 #include <stdlib.h>
19594 #endif
19595 #$i_unistd I_UNISTD
19596 #ifdef I_UNISTD
19597 # include <unistd.h>
19598 #endif
19599 #$d_sysconf HAS_SYSCONF
19600 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19601 #ifdef HAS_STDIO_STREAM_ARRAY
19602 # define STDIO_STREAM_ARRAY $stdio_stream_array
19603 #endif
19604 int main() {
19605   FILE* p;
19606   unlink("try.out");
19607   p = fopen("try.out", "w");
19608 #ifdef TRY_FPUTC
19609   fputc('x', p);
19610 #else
19611 # ifdef TRY_FPRINTF
19612   fprintf(p, "x");
19613 # endif
19614 #endif
19615 #ifdef TRY_FFLUSH_NULL
19616   fflush(NULL);
19617 #endif
19618 #ifdef TRY_FFLUSH_ALL
19619   {
19620     long open_max = -1;
19621 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19622     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19623 # else
19624 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19625     open_max = sysconf(_SC_OPEN_MAX);
19626 #  else
19627 #   ifdef FOPEN_MAX
19628     open_max = FOPEN_MAX;
19629 #   else
19630 #    ifdef OPEN_MAX
19631     open_max = OPEN_MAX;
19632 #    else
19633 #     ifdef _NFILE
19634     open_max = _NFILE;
19635 #     endif
19636 #    endif
19637 #   endif
19638 #  endif
19639 # endif
19640 # ifdef HAS_STDIO_STREAM_ARRAY
19641     if (open_max > 0) {
19642       long i;
19643       for (i = 0; i < open_max; i++)
19644             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19645                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19646                 STDIO_STREAM_ARRAY[i]._flag)
19647                 fflush(&STDIO_STREAM_ARRAY[i]);
19648     }
19649   }
19650 # endif
19651 #endif
19652   _exit(42);
19653 }
19654 EOCP
19655 : first we have to find out how _not_ to flush
19656 $to try.c
19657 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19658     output=''
19659     set try -DTRY_FPUTC
19660     if eval $compile; then
19661             $run ./try 2>/dev/null
19662             code="$?"
19663             $from try.out
19664             if $test ! -s try.out -a "X$code" = X42; then
19665                 output=-DTRY_FPUTC
19666             fi
19667     fi
19668     case "$output" in
19669     '')
19670             set try -DTRY_FPRINTF
19671             if eval $compile; then
19672                     $run ./try 2>/dev/null
19673                     code="$?"
19674                     $from try.out
19675                     if $test ! -s try.out -a "X$code" = X42; then
19676                         output=-DTRY_FPRINTF
19677                     fi
19678             fi
19679         ;;
19680     esac
19681 fi
19682 : check for fflush NULL behavior
19683 case "$fflushNULL" in
19684 '')     set try -DTRY_FFLUSH_NULL $output
19685         if eval $compile; then
19686                 $run ./try 2>/dev/null
19687                 code="$?"
19688                 $from try.out
19689                 if $test -s try.out -a "X$code" = X42; then
19690                         fflushNULL="`$cat try.out`"
19691                 else
19692                         if $test "X$code" != X42; then
19693                                 $cat >&4 <<EOM
19694 (If this test failed, don't worry, we'll try another method shortly.)
19695 EOM
19696                         fi
19697                 fi
19698         fi
19699         $rm -f core try.core core.try.*
19700         case "$fflushNULL" in
19701         x)      $cat >&4 <<EOM
19702 Your fflush(NULL) works okay for output streams.
19703 Let's see if it clobbers input pipes...
19704 EOM
19705 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19706 # bug that improperly flushes the input end of pipes.  So we avoid the
19707 # autoflush on fork/system/exec support for now. :-(
19708 $cat >tryp.c <<EOCP
19709 #include <stdio.h>
19710 int
19711 main(int argc, char **argv)
19712 {
19713     char buf[1024];
19714     int i;
19715     char *bp = buf;
19716     while (1) {
19717         while ((i = getc(stdin)) != -1
19718                && (*bp++ = i) != '\n'
19719                && bp < &buf[1024])
19720         /* DO NOTHING */ ;
19721         *bp = '\0';
19722         fprintf(stdout, "%s", buf);
19723         fflush(NULL);
19724         if (i == -1)
19725             return 0;
19726         bp = buf;
19727     }
19728 }
19729 EOCP
19730                 fflushNULL="$define"
19731                 set tryp
19732                 if eval $compile; then
19733                     $rm -f tryp.out
19734                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
19735                     if $test "X$targethost" != X; then
19736                         $to tryp.c
19737                         $to tryp
19738                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19739                     else
19740                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19741                     fi
19742                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19743                        $cat >&4 <<EOM
19744 fflush(NULL) seems to behave okay with input streams.
19745 EOM
19746                         fflushNULL="$define"
19747                     else
19748                         $cat >&4 <<EOM
19749 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19750 EOM
19751                         fflushNULL="$undef"
19752                     fi
19753                 fi
19754                 $rm -f core tryp.c tryp.core core.tryp.*
19755                 ;;
19756         '')     $cat >&4 <<EOM
19757 Your fflush(NULL) isn't working (contrary to ANSI C).
19758 EOM
19759                 fflushNULL="$undef"
19760                 ;;
19761         *)      $cat >&4 <<EOM
19762 Cannot figure out whether your fflush(NULL) works or not.
19763 I'm assuming it doesn't (contrary to ANSI C).
19764 EOM
19765                 fflushNULL="$undef"
19766                 ;;
19767         esac
19768         ;;
19769 $define|true|[yY]*)
19770         fflushNULL="$define"
19771         ;;
19772 *)
19773         fflushNULL="$undef"
19774         ;;
19775 esac
19776 : check explicit looping only if NULL did not work, and if the pipe
19777 : bug does not show up on an explicit flush too
19778 case "$fflushNULL" in
19779 "$undef")
19780         $cat >tryp.c <<EOCP
19781 #include <stdio.h>
19782 int
19783 main(int argc, char **argv)
19784 {
19785     char buf[1024];
19786     int i;
19787     char *bp = buf;
19788     while (1) {
19789         while ((i = getc(stdin)) != -1
19790                && (*bp++ = i) != '\n'
19791                && bp < &buf[1024])
19792         /* DO NOTHING */ ;
19793         *bp = '\0';
19794         fprintf(stdout, "%s", buf);
19795         fflush(stdin);
19796         if (i == -1)
19797             return 0;
19798         bp = buf;
19799     }
19800 }
19801 EOCP
19802         set tryp
19803         if eval $compile; then
19804             $rm -f tryp.out
19805             if $test "X$targethost" != X; then
19806                 $to tryp.c
19807                 $to tryp
19808                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19809             else
19810                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19811             fi
19812             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19813                $cat >&4 <<EOM
19814 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19815 EOM
19816                 : now check for fflushall behaviour
19817                 case "$fflushall" in
19818                 '')     set try -DTRY_FFLUSH_ALL $output
19819                         if eval $compile; then
19820                                 $cat >&4 <<EOM
19821 (Now testing the other method--but note that this also may fail.)
19822 EOM
19823                                 $run ./try 2>/dev/null
19824                                 code=$?
19825                                 $from try.out
19826                                 if $test -s try.out -a "X$code" = X42; then
19827                                         fflushall="`$cat try.out`"
19828                                 fi
19829                         fi
19830                         $rm_try
19831                         case "$fflushall" in
19832                         x)      $cat >&4 <<EOM
19833 Whew. Flushing explicitly all the stdio streams works.
19834 EOM
19835                                 fflushall="$define"
19836                                 ;;
19837                         '')     $cat >&4 <<EOM
19838 Sigh. Flushing explicitly all the stdio streams doesn't work.
19839 EOM
19840                                 fflushall="$undef"
19841                                 ;;
19842                         *)      $cat >&4 <<EOM
19843 Cannot figure out whether flushing stdio streams explicitly works or not.
19844 I'm assuming it doesn't.
19845 EOM
19846                                 fflushall="$undef"
19847                                 ;;
19848                         esac
19849                         ;;
19850                 "$define"|true|[yY]*)
19851                         fflushall="$define"
19852                         ;;
19853                 *)
19854                         fflushall="$undef"
19855                         ;;
19856                 esac
19857             else
19858                 $cat >&4 <<EOM
19859 All is futile.  Even fflush(stdin) clobbers input pipes!
19860 EOM
19861                 fflushall="$undef"
19862             fi
19863         else
19864             fflushall="$undef"
19865         fi
19866         $rm -f core tryp.c tryp.core core.tryp.*
19867         ;;
19868 *)      fflushall="$undef"
19869         ;;
19870 esac
19871
19872 case "$fflushNULL$fflushall" in
19873 undefundef)
19874         $cat <<EOM
19875 OK, I give up.  I cannot figure out how to flush pending stdio output.
19876 We won't be flushing handles at all before fork/exec/popen.
19877 EOM
19878         ;;
19879 esac
19880 $rm_try tryp
19881
19882 : Store the full pathname to the ar program for use in the C program
19883 : Respect a hint or command line value for full_ar.
19884 case "$full_ar" in
19885 '') full_ar=$ar ;;
19886 esac
19887
19888 : Store the full pathname to the sed program for use in the C program
19889 full_sed=$sed
19890
19891 : see what type gids are declared as in the kernel
19892 echo " "
19893 echo "Looking for the type for group ids returned by getgid()."
19894 set gid_t gidtype xxx stdio.h sys/types.h
19895 eval $typedef
19896 case "$gidtype" in
19897 xxx)
19898         xxx=`./findhdr sys/user.h`
19899         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19900         case $1 in
19901         unsigned) dflt="$1 $2" ;;
19902         *) dflt="$1" ;;
19903         esac
19904         ;;
19905 *) dflt="$gidtype";;
19906 esac
19907 case "$gidtype" in
19908 gid_t) echo "gid_t found." ;;
19909 *)      rp="What is the type for group ids returned by getgid()?"
19910         . ./myread
19911         gidtype="$ans"
19912         ;;
19913 esac
19914
19915 : Check the size of GID
19916 echo " "
19917 case "$gidtype" in
19918 *_t) zzz="$gidtype"     ;;
19919 *)   zzz="gid"          ;;
19920 esac
19921 echo "Checking the size of $zzz..." >&4
19922 cat > try.c <<EOCP
19923 #include <sys/types.h>
19924 #include <stdio.h>
19925 #$i_stdlib I_STDLIB
19926 #ifdef I_STDLIB
19927 #include <stdlib.h>
19928 #endif
19929 int main() {
19930     printf("%d\n", (int)sizeof($gidtype));
19931     exit(0);
19932 }
19933 EOCP
19934 set try
19935 if eval $compile_ok; then
19936         yyy=`$run ./try`
19937         case "$yyy" in
19938         '')     gidsize=4
19939                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19940                 ;;
19941         *)      gidsize=$yyy
19942                 echo "Your $zzz is $gidsize bytes long."
19943                 ;;
19944         esac
19945 else
19946         gidsize=4
19947         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19948 fi
19949
19950
19951 : Check if GID is signed
19952 echo " "
19953 case "$gidtype" in
19954 *_t) zzz="$gidtype"     ;;
19955 *)   zzz="gid"          ;;
19956 esac
19957 echo "Checking the sign of $zzz..." >&4
19958 cat > try.c <<EOCP
19959 #include <sys/types.h>
19960 #include <stdio.h>
19961 int main() {
19962         $gidtype foo = -1;
19963         if (foo < 0)
19964                 printf("-1\n");
19965         else
19966                 printf("1\n");
19967 }
19968 EOCP
19969 set try
19970 if eval $compile; then
19971         yyy=`$run ./try`
19972         case "$yyy" in
19973         '')     gidsign=1
19974                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19975                 ;;
19976         *)      gidsign=$yyy
19977                 case "$gidsign" in
19978                  1) echo "Your $zzz is unsigned." ;;
19979                 -1) echo "Your $zzz is signed."   ;;
19980                 esac
19981                 ;;
19982         esac
19983 else
19984         gidsign=1
19985         echo "(I can't compile the test program--guessing unsigned.)" >&4
19986 fi
19987
19988
19989 : Check 64bit sizes
19990 echo " "
19991
19992 if $test X"$quadtype" != X; then
19993
19994 echo "Checking how to print 64-bit integers..." >&4
19995
19996 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19997         $cat >try.c <<'EOCP'
19998 #include <sys/types.h>
19999 #include <stdio.h>
20000 int main() {
20001   int q = 12345678901;
20002   printf("%ld\n", q);
20003 }
20004 EOCP
20005         set try
20006         if eval $compile; then
20007                 yyy=`$run ./try`
20008                 case "$yyy" in
20009                 12345678901)
20010                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20011                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20012                         echo "We will use %d."
20013                         ;;
20014                 esac
20015         fi
20016 fi
20017
20018 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20019         $cat >try.c <<'EOCP'
20020 #include <sys/types.h>
20021 #include <stdio.h>
20022 int main() {
20023   long q = 12345678901;
20024   printf("%ld\n", q);
20025 }
20026 EOCP
20027         set try
20028         if eval $compile; then
20029                 yyy=`$run ./try`
20030                 case "$yyy" in
20031                 12345678901)
20032                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20033                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20034                         echo "We will use %ld."
20035                         ;;
20036                 esac
20037         fi
20038 fi
20039
20040 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20041         $cat >try.c <<'EOCP'
20042 #include <sys/types.h>
20043 #include <inttypes.h>
20044 #include <stdio.h>
20045 int main() {
20046   int64_t q = 12345678901;
20047   printf("%" PRId64 "\n", q);
20048 }
20049 EOCP
20050         set try
20051         if eval $compile; then
20052                 yyy=`$run ./try`
20053                 case "$yyy" in
20054                 12345678901)
20055                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20056                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20057                         echo "We will use the C9X style."
20058                         ;;
20059                 esac
20060         fi
20061 fi
20062
20063 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20064         $cat >try.c <<EOCP
20065 #include <sys/types.h>
20066 #include <stdio.h>
20067 int main() {
20068   $quadtype q = 12345678901;
20069   printf("%Ld\n", q);
20070 }
20071 EOCP
20072         set try
20073         if eval $compile; then
20074                 yyy=`$run ./try`
20075                 case "$yyy" in
20076                 12345678901)
20077                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20078                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20079                         echo "We will use %Ld."
20080                         ;;
20081                 esac
20082         fi
20083 fi
20084
20085 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20086         $cat >try.c <<'EOCP'
20087 #include <sys/types.h>
20088 #include <stdio.h>
20089 int main() {
20090   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20091   printf("%lld\n", q);
20092 }
20093 EOCP
20094         set try
20095         if eval $compile; then
20096                 yyy=`$run ./try`
20097                 case "$yyy" in
20098                 12345678901)
20099                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20100                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20101                         echo "We will use the %lld style."
20102                         ;;
20103                 esac
20104         fi
20105 fi
20106
20107 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20108         $cat >try.c <<EOCP
20109 #include <sys/types.h>
20110 #include <stdio.h>
20111 int main() {
20112   $quadtype q = 12345678901;
20113   printf("%qd\n", q);
20114 }
20115 EOCP
20116         set try
20117         if eval $compile; then
20118                 yyy=`$run ./try`
20119                 case "$yyy" in
20120                 12345678901)
20121                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20122                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20123                         echo "We will use %qd."
20124                         ;;
20125                 esac
20126         fi
20127 fi
20128
20129 if $test X"$sPRId64" = X; then
20130         echo "Cannot figure out how to print 64-bit integers." >&4
20131 fi
20132 $rm_try
20133
20134 fi
20135
20136 case "$sPRId64" in
20137 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20138         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20139         ;;
20140 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20141         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20142         ;;
20143 esac
20144
20145 : Check format strings for internal types
20146 echo " "
20147 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20148
20149 if $test X"$ivsize" = X8; then
20150         ivdformat="$sPRId64"
20151         uvuformat="$sPRIu64"
20152         uvoformat="$sPRIo64"
20153         uvxformat="$sPRIx64"
20154         uvXUformat="$sPRIXU64"
20155 else
20156         if $test X"$ivsize" = X"$longsize"; then
20157                 ivdformat='"ld"'
20158                 uvuformat='"lu"'
20159                 uvoformat='"lo"'
20160                 uvxformat='"lx"'
20161                 uvXUformat='"lX"'
20162         else
20163                 if $test X"$ivsize" = X"$intsize"; then
20164                         ivdformat='"d"'
20165                         uvuformat='"u"'
20166                         uvoformat='"o"'
20167                         uvxformat='"x"'
20168                         uvXUformat='"X"'
20169                 else
20170                         : far out
20171                         if $test X"$ivsize" = X"$shortsize"; then
20172                                 ivdformat='"hd"'
20173                                 uvuformat='"hu"'
20174                                 uvoformat='"ho"'
20175                                 uvxformat='"hx"'
20176                                 uvXUformat='"hX"'
20177                         fi
20178                 fi
20179         fi
20180 fi
20181
20182 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20183         nveformat="$sPRIeldbl"
20184         nvfformat="$sPRIfldbl"
20185         nvgformat="$sPRIgldbl"
20186         nvEUformat="$sPRIEUldbl"
20187         nvFUformat="$sPRIFUldbl"
20188         nvGUformat="$sPRIGUldbl"
20189 else
20190         nveformat='"e"'
20191         nvfformat='"f"'
20192         nvgformat='"g"'
20193         nvEUformat='"E"'
20194         nvFUformat='"F"'
20195         nvGUformat='"G"'
20196 fi
20197
20198 case "$ivdformat" in
20199 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20200     exit 1
20201     ;;
20202 esac
20203
20204 : Check format string for GID
20205
20206 echo " "
20207 $echo "Checking the format string to be used for gids..." >&4
20208
20209 case "$gidsign" in
20210 -1)     if $test X"$gidsize" = X"$ivsize"; then
20211                 gidformat="$ivdformat"
20212         else
20213                 if $test X"$gidsize" = X"$longsize"; then
20214                         gidformat='"ld"'
20215                 else
20216                         if $test X"$gidsize" = X"$intsize"; then
20217                                 gidformat='"d"'
20218                         else
20219                                 if $test X"$gidsize" = X"$shortsize"; then
20220                                         gidformat='"hd"'
20221                                 fi
20222                         fi
20223                 fi
20224         fi
20225         ;;
20226 *)      if $test X"$gidsize" = X"$uvsize"; then
20227                 gidformat="$uvuformat"
20228         else
20229                 if $test X"$gidsize" = X"$longsize"; then
20230                         gidformat='"lu"'
20231                 else
20232                         if $test X"$gidsize" = X"$intsize"; then
20233                                 gidformat='"u"'
20234                         else
20235                                 if $test X"$gidsize" = X"$shortsize"; then
20236                                         gidformat='"hu"'
20237                                 fi
20238                         fi
20239                 fi
20240         fi
20241         ;;
20242 esac
20243
20244 : see if getgroups exists
20245 set getgroups d_getgrps
20246 eval $inlibc
20247
20248 : see if setgroups exists
20249 set setgroups d_setgrps
20250 eval $inlibc
20251
20252 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20253 echo " "
20254 case "$d_getgrps$d_setgrps" in
20255 *define*)
20256         case "$groupstype" in
20257         '') dflt="$gidtype" ;;
20258         *)  dflt="$groupstype" ;;
20259         esac
20260         $cat <<EOM
20261 What type of pointer is the second argument to getgroups() and setgroups()?
20262 Usually this is the same as group ids, $gidtype, but not always.
20263
20264 EOM
20265         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20266         . ./myread
20267         groupstype="$ans"
20268         ;;
20269 *)  groupstype="$gidtype";;
20270 esac
20271
20272 : MAD = Misc Attribute Definition
20273
20274 if $test $patchlevel -lt 9; then
20275 : MAD is not available in 5.8.x or earlier.
20276     ans=n;
20277 else
20278     case "$mad" in
20279     $define|true|[yY]*) dflt='y' ;;
20280     *)                  dflt='n' ;;
20281     esac
20282     cat <<EOM
20283
20284 Would you like to build with Misc Attribute Decoration? This is development
20285 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20286 overhead on the interpreter.
20287
20288 If this doesn't make any sense to you, just accept the default '$dflt'.
20289 EOM
20290     rp='Build Perl with MAD?'
20291     . ./myread
20292 fi
20293 case "$ans" in
20294 y|Y)    val="$define"
20295         madlyh='madly.h madly.act madly.tab'
20296         madlysrc='madly.c'
20297         madlyobj="madly$_o" ;;
20298 *)      val="$undef"
20299         madlyh=''
20300         madlysrc=''
20301         madlyobj='' ;;
20302 esac
20303 set mad
20304 eval $setvar
20305
20306 : check whether make sets MAKE
20307 echo " "
20308 echo "Checking if your $make program sets \$(MAKE)..." >&4
20309 case "$make_set_make" in
20310 '')
20311         $sed 's/^X //' > testmake.mak << 'EOF'
20312 Xall:
20313 X       @echo 'maketemp="$(MAKE)"'
20314 EOF
20315         case "`$make -f testmake.mak 2>/dev/null`" in
20316         *maketemp=*) make_set_make='#' ;;
20317         *)      make_set_make="MAKE=$make" ;;
20318         esac
20319         $rm -f testmake.mak
20320         ;;
20321 esac
20322 case "$make_set_make" in
20323 '#') echo "Yup, it does.";;
20324 *) echo "Nope, it doesn't.";;
20325 esac
20326
20327 : see what type is used for mode_t
20328 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20329 set mode_t modetype int stdio.h sys/types.h
20330 eval $typedef_ask
20331
20332 : see if we need va_copy
20333 echo " "
20334 case "$i_stdarg" in
20335 "$define")
20336         $cat >try.c <<EOCP
20337 #include <stdarg.h>
20338 #include <stdio.h>
20339 #$i_stdlib I_STDLIB
20340 #ifdef I_STDLIB
20341 #include <stdlib.h>
20342 #endif
20343 #include <signal.h>
20344
20345 int
20346 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20347 {
20348   return vfprintf(f, fmt, *valp);
20349 }
20350
20351 int
20352 myvfprintf(FILE *f, const  char *fmt, va_list val)
20353 {
20354   return ivfprintf(f, fmt, &val);
20355 }
20356
20357 int
20358 myprintf(char *fmt, ...)
20359 {
20360   va_list val;
20361   va_start(val, fmt);
20362   return myvfprintf(stdout, fmt, val);
20363 }
20364
20365 int
20366 main(int ac, char **av)
20367 {
20368   signal(SIGSEGV, exit);
20369
20370   myprintf("%s%cs all right, then\n", "that", '\'');
20371   exit(0);
20372 }
20373 EOCP
20374         set try
20375         if eval $compile && $run ./try 2>&1 >/dev/null; then
20376                 case "`$run ./try`" in
20377                 "that's all right, then")
20378                         okay=yes
20379                         ;;
20380                 esac
20381         fi
20382         case "$okay" in
20383         yes)    echo "It seems that you don't need va_copy()." >&4
20384                 need_va_copy="$undef"
20385                 ;;
20386         *)      echo "It seems that va_copy() or similar will be needed." >&4
20387                 need_va_copy="$define"
20388                 ;;
20389         esac
20390         $rm_try
20391         ;;
20392 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20393         need_va_copy="$undef"
20394         ;;
20395 esac
20396
20397 : see what type is used for size_t
20398 rp="What is the type used for the length parameter for string functions?"
20399 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20400 eval $typedef_ask
20401
20402 : check for type of arguments to gethostbyaddr. 
20403 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20404         case "$d_gethbyaddr" in
20405         $define)
20406                 $cat <<EOM
20407
20408 Checking to see what type of arguments are accepted by gethostbyaddr().
20409 EOM
20410                 hdrs="$define sys/types.h
20411                         $d_socket sys/socket.h 
20412                         $i_niin netinet/in.h 
20413                         $i_netdb netdb.h
20414                         $i_unistd unistd.h"
20415                 : The first arg can 'char *' or 'void *'
20416                 : The second arg is some of integral type
20417                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20418                         for yyy in size_t long int; do
20419                                 case "$netdb_host_type" in
20420                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20421                                         if ./protochk "$try" $hdrs; then
20422                                                 echo "Your system accepts $xxx for the first arg."
20423                                                 echo "...and $yyy for the second arg."
20424                                                 netdb_host_type="$xxx"
20425                                                 netdb_hlen_type="$yyy"
20426                                         fi
20427                                         ;;
20428                                 esac
20429                         done
20430                 done
20431                 : In case none of those worked, prompt the user.
20432                 case "$netdb_host_type" in
20433                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20434                         dflt='char *'
20435                         . ./myread
20436                         netdb_host_type=$ans
20437                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20438                         dflt="$sizetype"
20439                         . ./myread
20440                         netdb_hlen_type=$ans
20441                         ;;
20442                 esac
20443                 ;;
20444         *)      : no gethostbyaddr, so pick harmless defaults
20445                 netdb_host_type='char *'
20446                 netdb_hlen_type="$sizetype"
20447                 ;;
20448         esac
20449         # Remove the "const" if needed. -- but then we'll have a 
20450         # prototype clash!
20451         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20452 fi
20453
20454 : check for type of argument to gethostbyname. 
20455 if test "X$netdb_name_type" = X ; then
20456         case "$d_gethbyname" in
20457         $define)
20458                 $cat <<EOM
20459
20460 Checking to see what type of argument is accepted by gethostbyname().
20461 EOM
20462                 hdrs="$define sys/types.h
20463                         $d_socket sys/socket.h 
20464                         $i_niin netinet/in.h 
20465                         $i_netdb netdb.h
20466                         $i_unistd unistd.h"
20467                 for xxx in "const char *" "char *"; do
20468                         case "$netdb_name_type" in
20469                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20470                                 if ./protochk "$try" $hdrs; then
20471                                         echo "Your system accepts $xxx."
20472                                         netdb_name_type="$xxx"
20473                                 fi
20474                                 ;;
20475                         esac
20476                 done
20477                 : In case none of those worked, prompt the user.
20478                 case "$netdb_name_type" in
20479                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20480                         dflt='char *'
20481                         . ./myread
20482                         netdb_name_type=$ans
20483                         ;;
20484                 esac
20485                 ;;
20486         *)      : no gethostbyname, so pick harmless default
20487                 netdb_name_type='char *'
20488                 ;;
20489         esac
20490 fi
20491
20492 : check for type of 1st argument to getnetbyaddr. 
20493 if test "X$netdb_net_type" = X ; then
20494         case "$d_getnbyaddr" in
20495         $define)
20496                 $cat <<EOM
20497
20498 Checking to see what type of 1st argument is accepted by getnetbyaddr().
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 in_addr_t "unsigned long" long "unsigned int" int; do
20506                         case "$netdb_net_type" in
20507                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20508                                 if ./protochk "$try" $hdrs; then
20509                                         echo "Your system accepts $xxx."
20510                                         netdb_net_type="$xxx"
20511                                 fi
20512                                 ;;
20513                         esac
20514                 done
20515                 : In case none of those worked, prompt the user.
20516                 case "$netdb_net_type" in
20517                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20518                         dflt='long'
20519                         . ./myread
20520                         netdb_net_type=$ans
20521                         ;;
20522                 esac
20523                 ;;
20524         *)      : no getnetbyaddr, so pick harmless default
20525                 netdb_net_type='long'
20526                 ;;
20527         esac
20528 fi
20529 : locate the preferred pager for this system
20530 fn=f/
20531 case "$pager" in
20532 '')
20533         dflt=''
20534         case "$pg" in
20535         /*) dflt=$pg;;
20536         [a-zA-Z]:/*) dflt=$pg;;
20537         esac
20538         case "$more" in
20539         /*) dflt=$more;;
20540         [a-zA-Z]:/*) dflt=$more;;
20541         esac
20542         case "$less" in
20543         /*) dflt=$less;;
20544         [a-zA-Z]:/*) dflt=$less;;
20545         esac
20546         case "$dflt" in
20547         '') dflt=/usr/ucb/more;;
20548         esac
20549         ;;
20550 *)      dflt="$pager"
20551         ;;
20552 esac
20553 fn="f/($dflt)"
20554 echo " "
20555 rp='What pager is used on your system?'
20556 . ./getfile
20557 pager="$ans"
20558
20559 : see what type pids are declared as in the kernel
20560 rp="What is the type of process ids on this system?"
20561 set pid_t pidtype int stdio.h sys/types.h
20562 eval $typedef_ask
20563
20564 : see if ar generates random libraries by itself
20565 echo " "
20566 echo "Checking how to generate random libraries on your machine..." >&4
20567 echo 'int bar1() { return bar2(); }' > bar1.c
20568 echo 'int bar2() { return 2; }' > bar2.c
20569 $cat > foo.c <<EOP
20570 #$i_stdlib I_STDLIB
20571 #ifdef I_STDLIB
20572 #include <stdlib.h>
20573 #endif
20574 int main() { printf("%d\n", bar1()); exit(0); }
20575 EOP
20576 $cc $ccflags -c bar1.c >/dev/null 2>&1
20577 $cc $ccflags -c bar2.c >/dev/null 2>&1
20578 $cc $ccflags -c foo.c >/dev/null 2>&1
20579 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20580 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20581         $run ./foobar >/dev/null 2>&1; then
20582         echo "$ar appears to generate random libraries itself."
20583         orderlib=false
20584         if [ "X$ranlib" = "X" ]; then
20585             ranlib=":"
20586         fi
20587 elif $ar s bar$_a >/dev/null 2>&1 &&
20588         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20589         $run ./foobar >/dev/null 2>&1; then
20590                 echo "a table of contents needs to be added with '$ar s'."
20591                 orderlib=false
20592                 ranlib="$ar s"
20593 elif $ar ts bar$_a >/dev/null 2>&1 &&
20594         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20595         $run ./foobar >/dev/null 2>&1; then
20596                 echo "a table of contents needs to be added with '$ar ts'."
20597                 orderlib=false
20598                 ranlib="$ar ts"
20599 else
20600         case "$ranlib" in
20601         :) ranlib='';;
20602         '')
20603                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20604                 $test -f $ranlib || ranlib=''
20605                 ;;
20606         esac
20607         if $test -n "$ranlib"; then
20608                 echo "your system has '$ranlib'; we'll use that."
20609                 orderlib=false
20610         else
20611                 echo "your system doesn't seem to support random libraries"
20612                 echo "so we'll use lorder and tsort to order the libraries."
20613                 orderlib=true
20614                 ranlib=":"
20615         fi
20616 fi
20617 $rm -f foo* bar*
20618
20619 : see if this is a values.h system
20620 set values.h i_values
20621 eval $inhdr
20622
20623 : Check the max offset that gmtime and localtime accept
20624 echo "Checking max offsets that gmtime () accepts"
20625
20626 case $i_values in
20627     define) yyy="#include <values.h>" ;;
20628     *)      yyy="" ;;
20629     esac
20630
20631 case "$sGMTIME_min/$sGMTIME_max" in
20632     0/0|/)
20633         $cat >try.c <<EOCP
20634 #include <sys/types.h>
20635 #include <stdio.h>
20636 #include <time.h>
20637 $yyy
20638
20639 int i;
20640 struct tm *tmp;
20641 time_t pt;
20642
20643 void gm_check (time_t t, int min_year, int max_year)
20644 {
20645     tmp = gmtime (&t);
20646     if ( tmp == NULL ||
20647         /* Check tm_year overflow */
20648          tmp->tm_year < min_year || tmp->tm_year > max_year)
20649         tmp = NULL;
20650     else
20651         pt = t;
20652     } /* gm_check */
20653
20654 int check_max ()
20655 {
20656     tmp = NULL;
20657     pt  = 0;
20658 #ifdef MAXLONG
20659     gm_check (MAXLONG, 69, 0x7fffffff);
20660 #endif
20661     if (tmp == NULL || tmp->tm_year < 0) {
20662         for (i = 63; i >= 0; i--) {
20663             time_t x = pt | ((time_t)1 << i);
20664             if (x < 0 || x < pt) continue;
20665             gm_check (x, 69, 0x7fffffff);
20666             }
20667         }
20668     printf ("sGMTIME_max=%ld\n", pt);
20669     return (0);
20670     } /* check_max */
20671
20672 int check_min ()
20673 {
20674     tmp = NULL;
20675     pt  = 0;
20676 #ifdef MINLONG
20677     gm_check (MINLONG, -1900, 70);
20678 #endif
20679     if (tmp == NULL) {
20680         for (i = 36; i >= 0; i--) {
20681             time_t x = pt - ((time_t)1 << i);
20682             if (x > 0) continue;
20683             gm_check (x, -1900, 70);
20684             }
20685         }
20686     printf ("sGMTIME_min=%ld\n", pt);
20687     return (0);
20688     } /* check_min */
20689
20690 int main (int argc, char *argv[])
20691 {
20692     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20693     check_max ();
20694     check_min ();
20695     return (0);
20696     } /* main */
20697 EOCP
20698         set try
20699         if eval $compile; then
20700             eval `$run ./try`
20701         else
20702             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20703             fi
20704         $rm_try
20705         ;;
20706     esac
20707
20708 echo "Checking max offsets that localtime () accepts"
20709
20710 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20711     0/0|/)
20712         $cat >try.c <<EOCP
20713 #include <sys/types.h>
20714 #include <stdio.h>
20715 #include <time.h>
20716 $yyy
20717
20718 int i;
20719 struct tm *tmp;
20720 time_t pt;
20721
20722 void local_check (time_t t, int min_year, int max_year)
20723 {
20724     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20725         tmp = NULL;
20726     else
20727         tmp = localtime (&t);
20728     if ( tmp == NULL ||
20729         /* Check tm_year overflow */
20730          tmp->tm_year < min_year || tmp->tm_year > max_year)
20731         tmp = NULL;
20732     else
20733         pt = t;
20734     } /* local_check */
20735
20736 int check_max ()
20737 {
20738     tmp = NULL;
20739     pt  = 0;
20740 #ifdef MAXLONG
20741     local_check (MAXLONG, 69, 0x7fffffff);
20742 #endif
20743     if (tmp == NULL || tmp->tm_year < 0) {
20744         for (i = 63; i >= 0; i--) {
20745             time_t x = pt | ((time_t)1 << i);
20746             if (x < 0 || x < pt) continue;
20747             local_check (x, 69, 0x7fffffff);
20748             }
20749         }
20750     printf ("sLOCALTIME_max=%ld\n", pt);
20751     return (0);
20752    } /* check_max */
20753
20754 int check_min ()
20755 {
20756     tmp = NULL;
20757     pt  = 0;
20758 #ifdef MINLONG
20759     local_check (MINLONG, -1900, 70);
20760 #endif
20761     if (tmp == NULL) {
20762         for (i = 36; i >= 0; i--) {
20763             time_t x = pt - ((time_t)1 << i);
20764             if (x > 0) continue;
20765             local_check (x, -1900, 70);
20766             }
20767         }
20768     printf ("sLOCALTIME_min=%ld\n", pt);
20769     return (0);
20770     } /* check_min */
20771
20772 int main (int argc, char *argv[])
20773 {
20774     check_max ();
20775     check_min ();
20776     return (0);
20777     } /* main */
20778 EOCP
20779         set try
20780         if eval $compile; then
20781             eval `$run ./try`
20782         else
20783             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20784             fi
20785         $rm_try
20786         ;;
20787     esac
20788
20789 : check for type of arguments to select.
20790 case "$selecttype" in
20791 '') case "$d_select" in
20792         $define)
20793                 echo " "
20794                 $cat <<EOM
20795 Checking to see what type of arguments are accepted by select().
20796 EOM
20797                 hdrs="$define sys/types.h
20798                         $i_systime sys/time.h
20799                         $i_sysselct sys/select.h
20800                         $d_socket sys/socket.h"
20801                 : The first arg can be int, unsigned, or size_t
20802                 : The last arg may or may not be 'const'
20803                 val=''
20804                 : void pointer has been seen but using that
20805                 : breaks the selectminbits test
20806                 for xxx in 'fd_set *' 'int *'; do
20807                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20808                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20809                                         case "$val" in
20810                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20811                                                 if ./protochk "$try" $hdrs; then
20812                                                         echo "Your system accepts $xxx."
20813                                                         val="$xxx"
20814                                                 fi
20815                                                 ;;
20816                                         esac
20817                                 done
20818                         done
20819                 done
20820                 case "$val" in
20821                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20822                         case "$d_fd_set" in
20823                                 $define) dflt="fd_set *" ;;
20824                                 *)              dflt="int *" ;;
20825                         esac
20826                         . ./myread
20827                         val=$ans
20828                         ;;
20829                 esac
20830                 selecttype="$val"
20831                 ;;
20832         *)      : no select, so pick a harmless default
20833                 selecttype='int *'
20834                 ;;
20835         esac
20836         ;;
20837 esac
20838
20839 : check for the select 'width'
20840 case "$selectminbits" in
20841 '') safebits=`expr $ptrsize \* 8`
20842     case "$d_select" in
20843         $define)
20844                 $cat <<EOM
20845
20846 Checking to see on how many bits at a time your select() operates...
20847 EOM
20848                 $cat >try.c <<EOCP
20849 #include <sys/types.h>
20850 #$i_time I_TIME
20851 #$i_systime I_SYS_TIME
20852 #$i_systimek I_SYS_TIME_KERNEL
20853 #ifdef I_TIME
20854 #   include <time.h>
20855 #endif
20856 #ifdef I_SYS_TIME
20857 #   ifdef I_SYS_TIME_KERNEL
20858 #       define KERNEL
20859 #   endif
20860 #   include <sys/time.h>
20861 #   ifdef I_SYS_TIME_KERNEL
20862 #       undef KERNEL
20863 #   endif
20864 #endif
20865 #$i_sysselct I_SYS_SELECT
20866 #ifdef I_SYS_SELECT
20867 #include <sys/select.h>
20868 #endif
20869 #$d_socket HAS_SOCKET
20870 #ifdef HAS_SOCKET
20871 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20872 #endif
20873 #include <stdio.h>
20874 #$i_stdlib I_STDLIB
20875 #ifdef I_STDLIB
20876 #include <stdlib.h>
20877 #endif
20878 $selecttype b;
20879 #define S sizeof(*(b))
20880 #define MINBITS 64
20881 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20882 #define NBITS  (NBYTES * 8)
20883 int main() {
20884     char *s = (char *)malloc(NBYTES);
20885     struct timeval t;
20886     int i;
20887     FILE* fp;
20888     int fd;
20889
20890     if (!s)
20891         exit(1);
20892     fclose(stdin);
20893     fp = fopen("try.c", "r");
20894     if (fp == 0)
20895       exit(2);
20896     fd = fileno(fp);
20897     if (fd < 0)
20898       exit(3);
20899     b = ($selecttype)s;
20900     for (i = 0; i < NBITS; i++)
20901         FD_SET(i, b);
20902     t.tv_sec  = 0;
20903     t.tv_usec = 0;
20904     select(fd + 1, b, 0, 0, &t);
20905     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20906     free(s);
20907     printf("%d\n", i + 1);
20908     return 0;
20909 }
20910 EOCP
20911                 set try
20912                 if eval $compile_ok; then
20913                         selectminbits=`$run ./try`
20914                         case "$selectminbits" in
20915                         '')     cat >&4 <<EOM
20916 Cannot figure out on how many bits at a time your select() operates.
20917 I'll play safe and guess it is $safebits bits.
20918 EOM
20919                                 selectminbits=$safebits
20920                                 bits="$safebits bits"
20921                                 ;;
20922                         1)      bits="1 bit" ;;
20923                         *)      bits="$selectminbits bits" ;;
20924                         esac
20925                         echo "Your select() operates on $bits at a time." >&4
20926                 else
20927                         rp='What is the minimum number of bits your select() operates on?'
20928                         case "$byteorder" in
20929                         12345678)       dflt=64 ;;
20930                         1234)           dflt=32 ;;
20931                         *)              dflt=1  ;;
20932                         esac
20933                         . ./myread
20934                         val=$ans
20935                         selectminbits="$val"
20936                 fi
20937                 $rm_try
20938                 ;;
20939         *)      : no select, so pick a harmless default
20940                 selectminbits=$safebits
20941                 ;;
20942         esac
20943         ;;
20944 esac
20945
20946 : Trace out the files included by signal.h, then look for SIGxxx names.
20947 if [ "X$fieldn" = X ]; then
20948         : Just make some guesses.  We check them later.
20949         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
20950 else
20951         xxx=`echo '#include <signal.h>' |
20952         $cppstdin $cppminus $cppflags 2>/dev/null |
20953         $grep '^[       ]*#.*include' |
20954         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20955                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20956 fi
20957 xxxfiles=''
20958 for xx in $xxx /dev/null ; do
20959         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20960 done
20961 case "$xxxfiles" in
20962 '')     xxxfiles=`./findhdr signal.h` ;;
20963 esac
20964 xxx=`awk '
20965 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20966         print substr($2, 4, 20)
20967 }
20968 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20969         print substr($3, 4, 20)
20970 }' $xxxfiles`
20971 : Append some common names just in case the awk scan failed.
20972 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20973 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20974 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20975 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20976 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20977
20978 : generate a few handy files for later
20979 $cat > signal.c <<EOCP
20980 #include <sys/types.h>
20981 #include <signal.h>
20982 #$i_stdlib I_STDLIB
20983 #ifdef I_STDLIB
20984 #include <stdlib.h>
20985 #endif
20986 #include <stdio.h>
20987 int main() {
20988
20989 /* Strange style to avoid deeply-nested #if/#else/#endif */
20990 #ifndef NSIG
20991 #  ifdef _NSIG
20992 #    define NSIG (_NSIG)
20993 #  endif
20994 #endif
20995
20996 #ifndef NSIG
20997 #  ifdef SIGMAX
20998 #    define NSIG (SIGMAX+1)
20999 #  endif
21000 #endif
21001
21002 #ifndef NSIG
21003 #  ifdef SIG_MAX
21004 #    define NSIG (SIG_MAX+1)
21005 #  endif
21006 #endif
21007
21008 #ifndef NSIG
21009 #  ifdef _SIG_MAX
21010 #    define NSIG (_SIG_MAX+1)
21011 #  endif
21012 #endif
21013
21014 #ifndef NSIG
21015 #  ifdef MAXSIG
21016 #    define NSIG (MAXSIG+1)
21017 #  endif
21018 #endif
21019
21020 #ifndef NSIG
21021 #  ifdef MAX_SIG
21022 #    define NSIG (MAX_SIG+1)
21023 #  endif
21024 #endif
21025
21026 #ifndef NSIG
21027 #  ifdef SIGARRAYSIZE
21028 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21029 #  endif
21030 #endif
21031
21032 #ifndef NSIG
21033 #  ifdef _sys_nsig
21034 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21035 #  endif
21036 #endif
21037
21038 /* Default to some arbitrary number that's big enough to get most
21039    of the common signals.
21040 */
21041 #ifndef NSIG
21042 #    define NSIG 50
21043 #endif
21044
21045 printf("NSIG %d\n", NSIG);
21046
21047 #ifndef JUST_NSIG
21048
21049 EOCP
21050
21051 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21052 {
21053         printf "#ifdef SIG"; printf $1; printf "\n"
21054         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21055         printf $1; printf ");\n"
21056         printf "#endif\n"
21057 }
21058 END {
21059         printf "#endif /* JUST_NSIG */\n";
21060         printf "exit(0);\n}\n";
21061 }
21062 ' >>signal.c
21063 $cat >signal.awk <<'EOP'
21064 BEGIN { ndups = 0 }
21065 $1 ~ /^NSIG$/ { nsig = $2 }
21066 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21067     if ($2 > maxsig) { maxsig = $2 }
21068     if (sig_name[$2]) {
21069         dup_name[ndups] = $1
21070         dup_num[ndups] = $2
21071         ndups++
21072     }
21073     else {
21074         sig_name[$2] = $1
21075         sig_num[$2] = $2
21076     }
21077 }
21078 END {
21079     if (nsig == 0) {
21080         nsig = maxsig + 1
21081     }
21082     printf("NSIG %d\n", nsig);
21083     for (n = 1; n < nsig; n++) {
21084         if (sig_name[n]) {
21085             printf("%s %d\n", sig_name[n], sig_num[n])
21086         }
21087         else {
21088             printf("NUM%d %d\n", n, n)
21089         }
21090     }
21091     for (n = 0; n < ndups; n++) {
21092         printf("%s %d\n", dup_name[n], dup_num[n])
21093     }
21094 }
21095 EOP
21096 $cat >signal_cmd <<EOS
21097 $startsh
21098 if $test -s signal.lst; then
21099     echo "Using your existing signal.lst file"
21100         exit 0
21101 fi
21102 xxx="$xxx"
21103 EOS
21104 $cat >>signal_cmd <<'EOS'
21105
21106 set signal
21107 if eval $compile_ok; then
21108         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21109                 $uniq | $awk -f signal.awk >signal.lst
21110 else
21111         echo "(I can't seem be able to compile the whole test program)" >&4
21112         echo "(I'll try it in little pieces.)" >&4
21113         set signal -DJUST_NSIG
21114         if eval $compile_ok; then
21115                 $run ./signal$_exe > signal.nsg
21116                 $cat signal.nsg
21117         else
21118                 echo "I can't seem to figure out how many signals you have." >&4
21119                 echo "Guessing 50." >&4
21120                 echo 'NSIG 50' > signal.nsg
21121         fi
21122         : Now look at all the signal names, one at a time.
21123         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21124                 $cat > signal.c <<EOCP
21125 #include <sys/types.h>
21126 #include <signal.h>
21127 #include <stdio.h>
21128 int main() {
21129 printf("$xx %d\n", SIG${xx});
21130 return 0;
21131 }
21132 EOCP
21133                 set signal
21134                 if eval $compile; then
21135                         echo "SIG${xx} found."
21136                         $run ./signal$_exe  >> signal.ls1
21137                 else
21138                         echo "SIG${xx} NOT found."
21139                 fi
21140         done
21141         if $test -s signal.ls1; then
21142                 $cat signal.nsg signal.ls1 |
21143                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21144         fi
21145
21146 fi
21147 if $test -s signal.lst; then
21148         :
21149 else
21150         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21151         echo 'kill -l' >signal
21152         set X `csh -f <signal`
21153         $rm -f signal
21154         shift
21155         case $# in
21156         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21157         esac
21158         echo $@ | $tr ' ' $trnl | \
21159             $awk '{ printf "%s %d\n", $1, ++s; }
21160                   END { printf "NSIG %d\n", ++s }' >signal.lst
21161 fi
21162 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21163 EOS
21164 chmod a+x signal_cmd
21165 $eunicefix signal_cmd
21166
21167 : generate list of signal names
21168 echo " "
21169 case "$sig_name_init" in
21170 '') doinit=yes ;;
21171 *)  case "$sig_num_init" in
21172     ''|*,*) doinit=yes ;;
21173     esac ;;
21174 esac
21175 case "$doinit" in
21176 yes)
21177         echo "Generating a list of signal names and numbers..." >&4
21178         . ./signal_cmd
21179         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21180         sig_name=`$awk 'BEGIN { printf "ZERO " }
21181                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21182         sig_num=`$awk  'BEGIN { printf "0 " }
21183                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21184         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21185                              !/^NSIG/   { printf "\"%s\", ", $1 }
21186                              END        { printf "0\n" }' signal.lst`
21187         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21188                              !/^NSIG/   { printf "%d, ", $2}
21189                              END        { printf "0\n"}' signal.lst`
21190         ;;
21191 esac
21192 echo "The following $sig_count signals are available:"
21193 echo " "
21194 echo $sig_name | $awk \
21195 'BEGIN { linelen = 0 }
21196 {
21197         for (i = 1; i <= NF; i++) {
21198                 name = "SIG" $i " "
21199                 linelen = linelen + length(name)
21200                 if (linelen > 70) {
21201                         printf "\n"
21202                         linelen = length(name)
21203                 }
21204                 printf "%s", name
21205         }
21206         printf "\n"
21207 }'
21208 sig_size=`echo $sig_name | awk '{print NF}'`
21209 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21210
21211 : Check size of size
21212 echo " "
21213 case "$sizetype" in
21214 *_t) zzz="$sizetype"    ;;
21215 *)   zzz="filesize"     ;;
21216 esac
21217 echo "Checking the size of $zzz..." >&4
21218 cat > try.c <<EOCP
21219 #include <sys/types.h>
21220 #include <stdio.h>
21221 #$i_stdlib I_STDLIB
21222 #ifdef I_STDLIB
21223 #include <stdlib.h>
21224 #endif
21225 int main() {
21226     printf("%d\n", (int)sizeof($sizetype));
21227     exit(0);
21228 }
21229 EOCP
21230 set try
21231 if eval $compile_ok; then
21232         yyy=`$run ./try`
21233         case "$yyy" in
21234         '')     sizesize=4
21235                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21236                 ;;
21237         *)      sizesize=$yyy
21238                 echo "Your $zzz size is $sizesize bytes."
21239                 ;;
21240         esac
21241 else
21242         sizesize=4
21243         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21244 fi
21245
21246
21247 : check for socklen_t
21248 echo " "
21249 echo "Checking to see if you have socklen_t..." >&4
21250 $cat >try.c <<EOCP
21251 #include <sys/types.h>
21252 #$d_socket HAS_SOCKET
21253 #ifdef HAS_SOCKET
21254 #include <sys/socket.h>
21255 #endif
21256 int main() { socklen_t x = 16; }
21257 EOCP
21258 set try
21259 if eval $compile; then
21260         val="$define"
21261         echo "You have socklen_t."
21262 else
21263         val="$undef"
21264         echo "You do not have socklen_t."
21265         case "$sizetype" in
21266         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21267         esac
21268 fi
21269 $rm_try
21270 set d_socklen_t
21271 eval $setvar
21272
21273 : see if this is a socks.h system
21274 set socks.h i_socks
21275 eval $inhdr
21276
21277 : check for type of the size argument to socket calls
21278 case "$d_socket" in
21279 "$define")
21280         $cat <<EOM
21281
21282 Checking to see what type is the last argument of accept().
21283 EOM
21284         yyy=''
21285         case "$d_socklen_t" in
21286         "$define") yyy="$yyy socklen_t"
21287         esac
21288         yyy="$yyy $sizetype int long unsigned"
21289         for xxx in $yyy; do
21290                 case "$socksizetype" in
21291                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21292                         case "$usesocks" in
21293                         "$define")
21294                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21295                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21296                                         socksizetype="$xxx"
21297                                 fi
21298                                 ;;
21299                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21300                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21301                                         socksizetype="$xxx"
21302                                 fi
21303                                 ;;
21304                         esac
21305                         ;;
21306                 esac
21307         done
21308 : In case none of those worked, prompt the user.
21309         case "$socksizetype" in
21310         '')     rp='What is the type for socket address structure sizes?'
21311                 dflt='int'
21312                 . ./myread
21313                 socksizetype=$ans
21314                 ;;
21315         esac
21316         ;;
21317 *)      : no sockets, so pick relatively harmless default
21318         socksizetype='int'
21319         ;;
21320 esac
21321
21322 : see what type is used for signed size_t
21323 set ssize_t ssizetype int stdio.h sys/types.h
21324 eval $typedef
21325 dflt="$ssizetype"
21326 $cat > try.c <<EOM
21327 #include <stdio.h>
21328 #$i_stdlib I_STDLIB
21329 #ifdef I_STDLIB
21330 #include <stdlib.h>
21331 #endif
21332 #include <sys/types.h>
21333 #define Size_t $sizetype
21334 #define SSize_t $dflt
21335 int main()
21336 {
21337         if (sizeof(Size_t) == sizeof(SSize_t))
21338                 printf("$dflt\n");
21339         else if (sizeof(Size_t) == sizeof(int))
21340                 printf("int\n");
21341         else
21342                 printf("long\n");
21343         exit(0);
21344 }
21345 EOM
21346 echo " "
21347 set try
21348 if eval $compile_ok && $run ./try > /dev/null; then
21349         ssizetype=`$run ./try`
21350         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21351 else
21352         $cat >&4 <<EOM
21353 Help! I can't compile and run the ssize_t test program: please enlighten me!
21354 (This is probably a misconfiguration in your system or libraries, and
21355 you really ought to fix it.  Still, I'll try anyway.)
21356
21357 I need a type that is the same size as $sizetype, but is guaranteed to
21358 be signed.  Common values are ssize_t, int and long.
21359
21360 EOM
21361         rp="What signed type is the same size as $sizetype?"
21362         . ./myread
21363         ssizetype="$ans"
21364 fi
21365 $rm_try
21366
21367 : Check the size of st_ino
21368 $echo " "
21369 $echo "Checking the size of st_ino..." >&4
21370 $cat > try.c <<EOCP
21371 #include <sys/stat.h>
21372 #include <stdio.h>
21373 #$i_stdlib I_STDLIB
21374 #ifdef I_STDLIB
21375 #include <stdlib.h>
21376 #endif
21377 int main() {
21378     struct stat st;
21379     printf("%d\n", (int)sizeof(st.st_ino));
21380     exit(0);
21381 }
21382 EOCP
21383 set try
21384 if eval $compile_ok; then
21385         val=`$run ./try`
21386         case "$val" in
21387         '')     st_ino_size=4
21388                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21389                 ;;
21390         *)      st_ino_size=$val
21391                 $echo "Your st_ino is $st_ino_size bytes long."
21392                 ;;
21393         esac
21394 else
21395         st_ino_size=4
21396         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21397 fi
21398 $rm_try
21399
21400 : Check if st_ino is signed
21401 $echo " "
21402 $echo "Checking the sign of st_ino..." >&4
21403 $cat > try.c <<EOCP
21404 #include <sys/stat.h>
21405 #include <stdio.h>
21406 int main() {
21407         struct stat foo;
21408         foo.st_ino = -1;
21409         if (foo.st_ino < 0)
21410                 printf("-1\n");
21411         else
21412                 printf("1\n");
21413 }
21414 EOCP
21415 set try
21416 if eval $compile; then
21417         val=`$run ./try`
21418         case "$val" in
21419         '')     st_ino_sign=1
21420                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21421                 ;;
21422         *)      st_ino_sign=$val
21423                 case "$st_ino_sign" in
21424                  1) $echo "Your st_ino is unsigned." ;;
21425                 -1) $echo "Your st_ino is signed."   ;;
21426                 esac
21427                 ;;
21428         esac
21429 else
21430         st_ino_sign=1
21431         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21432 fi
21433 $rm_try
21434
21435 : see what type of char stdio uses.
21436 echo " "
21437 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21438 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21439         echo "Your stdio uses unsigned chars." >&4
21440         stdchar="unsigned char"
21441 else
21442         echo "Your stdio uses signed chars." >&4
21443         stdchar="char"
21444 fi
21445 $rm -f stdioh
21446
21447 : see what type uids are declared as in the kernel
21448 echo " "
21449 echo "Looking for the type for user ids returned by getuid()."
21450 set uid_t uidtype xxx stdio.h sys/types.h
21451 eval $typedef
21452 case "$uidtype" in
21453 xxx)
21454         xxx=`./findhdr sys/user.h`
21455         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21456         case $1 in
21457         unsigned) dflt="$1 $2" ;;
21458         *) dflt="$1" ;;
21459         esac
21460         ;;
21461 *) dflt="$uidtype";;
21462 esac
21463 case "$uidtype" in
21464 uid_t)  echo "uid_t found." ;;
21465 *)      rp="What is the type for user ids returned by getuid()?"
21466         . ./myread
21467         uidtype="$ans"
21468         ;;
21469 esac
21470
21471 : Check size of UID
21472 echo " "
21473 case "$uidtype" in
21474 *_t) zzz="$uidtype"     ;;
21475 *)   zzz="uid"          ;;
21476 esac
21477 echo "Checking the size of $zzz..." >&4
21478 cat > try.c <<EOCP
21479 #include <sys/types.h>
21480 #include <stdio.h>
21481 #$i_stdlib I_STDLIB
21482 #ifdef I_STDLIB
21483 #include <stdlib.h>
21484 #endif
21485 int main() {
21486     printf("%d\n", (int)sizeof($uidtype));
21487     exit(0);
21488 }
21489 EOCP
21490 set try
21491 if eval $compile_ok; then
21492         yyy=`$run ./try`
21493         case "$yyy" in
21494         '')     uidsize=4
21495                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21496                 ;;
21497         *)      uidsize=$yyy
21498                 echo "Your $zzz is $uidsize bytes long."
21499                 ;;
21500         esac
21501 else
21502         uidsize=4
21503         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21504 fi
21505
21506 : Check if UID is signed
21507 echo " "
21508 case "$uidtype" in
21509 *_t) zzz="$uidtype"     ;;
21510 *)   zzz="uid"          ;;
21511 esac
21512 echo "Checking the sign of $zzz..." >&4
21513 cat > try.c <<EOCP
21514 #include <sys/types.h>
21515 #include <stdio.h>
21516 int main() {
21517         $uidtype foo = -1;
21518         if (foo < 0)
21519                 printf("-1\n");
21520         else
21521                 printf("1\n");
21522 }
21523 EOCP
21524 set try
21525 if eval $compile; then
21526         yyy=`$run ./try`
21527         case "$yyy" in
21528         '')     uidsign=1
21529                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21530                 ;;
21531         *)      uidsign=$yyy
21532                 case "$uidsign" in
21533                  1) echo "Your $zzz is unsigned." ;;
21534                 -1) echo "Your $zzz is signed."   ;;
21535                 esac
21536                 ;;
21537         esac
21538 else
21539         uidsign=1
21540         echo "(I can't compile the test program--guessing unsigned.)" >&4
21541 fi
21542
21543
21544 : Check format string for UID
21545 echo " "
21546 $echo "Checking the format string to be used for uids..." >&4
21547
21548 case "$uidsign" in
21549 -1)     if $test X"$uidsize" = X"$ivsize"; then
21550                 uidformat="$ivdformat"
21551         else
21552                 if $test X"$uidsize" = X"$longsize"; then
21553                         uidformat='"ld"'
21554                 else
21555                         if $test X"$uidsize" = X"$intsize"; then
21556                                 uidformat='"d"'
21557                         else
21558                                 if $test X"$uidsize" = X"$shortsize"; then
21559                                         uidformat='"hd"'
21560                                 fi
21561                         fi
21562                 fi
21563         fi
21564         ;;
21565 *)      if $test X"$uidsize" = X"$uvsize"; then
21566                 uidformat="$uvuformat"
21567         else
21568                 if $test X"$uidsize" = X"$longsize"; then
21569                         uidformat='"lu"'
21570                 else
21571                         if $test X"$uidsize" = X"$intsize"; then
21572                                 uidformat='"u"'
21573                         else
21574                                 if $test X"$uidsize" = X"$shortsize"; then
21575                                         uidformat='"hu"'
21576                                 fi
21577                         fi
21578                 fi
21579         fi
21580         ;;
21581 esac
21582
21583 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21584 echo " "
21585 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21586 $cat >try.c <<'EOM'
21587 /* Intentionally a long probe as I'd like to sanity check that the exact
21588    approach is going to work, as thinking it will work, but only having it
21589    part working at runtime is worse than not having it.  */
21590
21591 #include <sys/types.h>
21592 #include <sys/sysctl.h>
21593 #include <sys/param.h>
21594 #include <stdio.h>
21595 #include <string.h>
21596 #include <stdlib.h>
21597 #include <unistd.h>
21598
21599 int
21600 main(int argc, char **argv) {
21601     char *buffer;
21602     char *argv_leaf = strrchr(argv[0], '/');
21603     char *buffer_leaf;
21604     size_t size = 0;
21605     int mib[4];
21606
21607     mib[0] = CTL_KERN;
21608     mib[1] = KERN_PROC;
21609     mib[2] = KERN_PROC_PATHNAME;
21610     mib[3] = -1;
21611
21612     if (!argv_leaf) {
21613         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21614         return 1;
21615     }
21616
21617     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21618         perror("sysctl");
21619         return 2;
21620     }
21621
21622     if (size < strlen(argv_leaf) + 1) {
21623         fprintf(stderr, "size %lu is too short for a path\n",
21624                 (unsigned long) size);
21625         return 3;
21626     }
21627
21628     if (size > MAXPATHLEN * MAXPATHLEN) {
21629         fprintf(stderr, "size %lu is too long for a path\n",
21630                 (unsigned long) size);
21631         return 4;
21632     }
21633
21634     buffer = malloc(size);
21635     if (!buffer) {
21636         perror("malloc");
21637         return 5;
21638     }
21639
21640     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21641         perror("sysctl");
21642         return 6;
21643     }
21644
21645     if (strlen(buffer) + 1 != size) {
21646         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21647                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21648         return 7;
21649     }
21650
21651
21652     if (*buffer != '/') {
21653         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21654         return 8;
21655     }
21656
21657     if (strstr(buffer, "/./")) {
21658         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21659         return 9;
21660     }
21661
21662     if (strstr(buffer, "/../")) {
21663         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21664         return 10;
21665     }
21666
21667     buffer_leaf = strrchr(buffer, '/');
21668     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21669         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21670         return 11;
21671     }
21672
21673     free(buffer);
21674
21675     return 0;
21676 }
21677 EOM
21678
21679 val=$undef
21680 set try
21681 if eval $compile; then
21682         if $run ./try; then
21683                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21684                 val="$define"
21685         else
21686                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21687                 val="$undef"
21688         fi
21689 else
21690         echo "I'm unable to compile the test program." >&4
21691         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21692         val="$undef"
21693 fi
21694 $rm_try
21695 set usekernprocpathname
21696 eval $setvar
21697
21698 : Determine if we can use _NSGetExecutablePath to find executing program
21699 echo " "
21700 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21701 $cat >try.c <<'EOM'
21702 /* Intentionally a long probe as I'd like to sanity check that the exact
21703    approach is going to work, as thinking it will work, but only having it
21704    part working at runtime is worse than not having it.  */
21705 #include <mach-o/dyld.h>
21706 #include <stdio.h>
21707 #include <stdlib.h>
21708 #include <sys/param.h>
21709 #include <string.h>
21710
21711 int
21712 main(int argc, char **argv) {
21713     char buf[1];
21714     uint32_t size = sizeof(buf);
21715     int result;
21716     char *buffer;
21717     char *tidied;
21718     char *argv_leaf = strrchr(argv[0], '/');
21719     char *tidied_leaf;
21720
21721     if (!argv_leaf) {
21722         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21723         return 1;
21724     }
21725
21726     _NSGetExecutablePath(buf, &size);
21727     if (size > MAXPATHLEN * MAXPATHLEN) {
21728         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21729                 (unsigned int) size);
21730         return 2;
21731     }
21732
21733     buffer = malloc(size);
21734     if (!buffer) {
21735         perror("malloc");
21736         return 3;
21737     }
21738
21739     result = _NSGetExecutablePath(buffer, &size);
21740     if (result != 0) {
21741         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21742                 result, (unsigned int) size);
21743         return 4;
21744     }
21745
21746     tidied = realpath(buffer, NULL);
21747     if (!tidied) {
21748         perror("realpath");
21749         return 5;
21750     }
21751
21752     free(buffer);
21753
21754     if (*tidied != '/') {
21755         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21756         return 6;
21757     }
21758
21759     if (strstr(tidied, "/./")) {
21760         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21761         return 7;
21762     }
21763
21764     if (strstr(tidied, "/../")) {
21765         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21766         return 8;
21767     }
21768
21769     tidied_leaf = strrchr(tidied, '/');
21770     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21771         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21772         return 9;
21773     }
21774
21775     free(tidied);
21776
21777     return 0;
21778 }
21779 EOM
21780
21781 val=$undef
21782 set try
21783 if eval $compile; then
21784         if $run ./try; then
21785                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21786                 val="$define"
21787         else
21788                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21789         fi
21790 else
21791         echo "I'm unable to compile the test program." >&4
21792         echo "I'll assume no _NSGetExecutablePath here." >&4
21793 fi
21794 $rm_try
21795 set usensgetexecutablepath
21796 eval $setvar
21797
21798 : Check if site customization support was requested
21799 case "$usesitecustomize" in
21800     $define|true|[Yy]*)
21801         usesitecustomize="$define"
21802         ;;
21803     *)
21804         usesitecustomize="$undef"
21805         ;;
21806     esac
21807
21808 : see if prototypes support variable argument declarations
21809 echo " "
21810 case "$prototype$i_stdarg" in
21811 $define$define)
21812         echo "It appears we'll be able to prototype varargs functions." >&4
21813         val="$define"
21814         ;;
21815 *)
21816         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21817         val="$undef"
21818         ;;
21819 esac
21820 set vaproto
21821 eval $setvar
21822
21823 : determine compiler compiler
21824 case "$yacc" in
21825 '')
21826         dflt=yacc;;
21827 *)
21828         dflt="$yacc";;
21829 esac
21830 echo " "
21831 comp='yacc'
21832 if $test -f "$byacc$_exe"; then
21833         dflt="$byacc"
21834         comp="byacc or $comp"
21835 fi
21836 if $test -f "$bison$_exe"; then
21837         comp="$comp or bison -y"
21838 fi
21839 rp="Which compiler compiler ($comp) shall I use?"
21840 . ./myread
21841 yacc="$ans"
21842 case "$yacc" in
21843 *bis*)
21844         case "$yacc" in
21845         *-y*) ;;
21846         *)
21847                 yacc="$yacc -y"
21848                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21849                 ;;
21850         esac
21851         ;;
21852 esac
21853
21854 : see if this is a assert.h system
21855 set assert.h i_assert
21856 eval $inhdr
21857
21858 : see if this is a fp.h system
21859 set fp.h i_fp
21860 eval $inhdr
21861
21862 : see if this is a fp_class.h system
21863 set fp_class.h i_fp_class
21864 eval $inhdr
21865
21866 : see if gdbm.h is available
21867 set gdbm.h t_gdbm
21868 eval $inhdr
21869 case "$t_gdbm" in
21870 $define)
21871         : see if gdbm_open exists
21872         set gdbm_open d_gdbm_open
21873         eval $inlibc
21874         case "$d_gdbm_open" in
21875         $undef)
21876                 t_gdbm="$undef"
21877                 echo "We won't be including <gdbm.h>"
21878                 ;;
21879         esac
21880         ;;
21881 esac
21882 val="$t_gdbm"
21883 set i_gdbm
21884 eval $setvar
21885
21886 : see if this is a ieeefp.h system
21887 case "$i_ieeefp" in
21888 '' ) set ieeefp.h i_ieeefp
21889      eval $inhdr
21890      ;;
21891 esac
21892
21893 : see if this is a libutil.h system
21894 set libutil.h i_libutil
21895 eval $inhdr
21896
21897 : see if mach cthreads are available
21898 if test "X$usethreads" = "X$define"; then
21899         set mach/cthreads.h i_machcthr
21900         eval $inhdr
21901 else
21902         i_machcthr="$undef"
21903 fi
21904
21905 : see if this is a mntent.h system
21906 set mntent.h i_mntent
21907 eval $inhdr
21908
21909 : see if net/errno.h is available
21910 val=''
21911 set net/errno.h val
21912 eval $inhdr
21913
21914 : Unfortunately, it causes problems on some systems.  Arrgh.
21915 case "$val" in
21916 $define)
21917         cat > try.c <<'EOM'
21918 #include <stdio.h>
21919 #include <errno.h>
21920 #include <net/errno.h>
21921 int func()
21922 {
21923         return ENOTSOCK;
21924 }
21925 EOM
21926         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21927                 echo "We'll be including <net/errno.h>." >&4
21928         else
21929                 echo "We won't be including <net/errno.h>." >&4
21930                 val="$undef"
21931         fi
21932         $rm_try
21933         ;;
21934 esac
21935 set i_neterrno
21936 eval $setvar
21937
21938 : see if netinet/tcp.h is available
21939 set netinet/tcp.h i_netinettcp
21940 eval $inhdr
21941
21942 : see if this is a poll.h system
21943 set poll.h i_poll
21944 eval $inhdr
21945
21946 : see if this is a prot.h system
21947 set prot.h i_prot
21948 eval $inhdr
21949
21950 : Preprocessor symbols
21951 echo " "
21952 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21953 $cat <<'EOSH' > Cppsym.know
21954 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21955 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21956 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21957 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21958 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21959 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21960 bull c cadmus clipper CMU COFF COMPILER_VERSION
21961 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21962 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21963 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21964 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21965 GLIBC GLIBC_MINOR
21966 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21967 H3050R H3050RX hbullx20 hcx host_mips
21968 hp200 hp300 hp700 HP700 hp800 hp9000
21969 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21970 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21971 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21972 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21973 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21974 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21975 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21976 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21977 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21978 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21979 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21980 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21981 MATH_HAS_NO_SIDE_EFFECTS
21982 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21983 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21984 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21985 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21986 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21987 NetBSD news1500 news1700 news1800 news1900 news3700
21988 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21989 ns32016 ns32332 ns32k nsc32000
21990 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21991 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21992 pc532 pdp11 PGC PIC plexus PORTAR posix
21993 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21994 POSIX_C_SOURCE POSIX_SOURCE POWER
21995 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21996 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21997 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21998 sony sony_news sonyrisc sparc sparclite spectrum
21999 stardent stdc STDC_EXT stratos sun sun3 sun386
22000 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
22001 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
22002 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
22003 sysV68 sysV88 Tek4132 Tek4300 titan
22004 TM3200 TM5400 TM5600
22005 tower tower32 tower32_200 tower32_600 tower32_700
22006 tower32_800 tower32_850 tss
22007 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
22008 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
22009 unix UNIX95 UNIX99 unixpc unos
22010 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
22011 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
22012 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
22013 USGr4 USGr4_2
22014 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
22015 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
22016 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22017 z8000
22018 EOSH
22019 # Maybe put other stuff here too.
22020 cat <<EOSH >>Cppsym.know
22021 $osname
22022 EOSH
22023 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22024 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22025 $cat Cppsym.know > Cppsym.c
22026 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22027 $rm -f Cppsym.a Cppsym.b Cppsym.c
22028 cat <<EOSH > Cppsym
22029 $startsh
22030 if $test \$# -gt 0; then
22031     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22032     if $test -s Cppsym.got; then
22033         $rm -f Cppsym.got
22034         exit 0
22035     fi
22036     $rm -f Cppsym.got
22037     exit 1
22038 else
22039     $tr " " "$trnl" | ./Cppsym.try
22040     exit 0
22041 fi
22042 EOSH
22043 chmod +x Cppsym
22044 $eunicefix Cppsym
22045 cat <<EOSH > Cppsym.try
22046 $startsh
22047 cat <<'EOCP' > try.c
22048 #include <stdio.h>
22049 #if cpp_stuff == 1
22050 #define STRINGIFY(a)    "a"
22051 #endif
22052 #if cpp_stuff == 42
22053 #define StGiFy(a)  #a
22054 #define STRINGIFY(a)    StGiFy(a)
22055 #endif
22056 #if $cpp_stuff != 1 && $cpp_stuff != 42
22057 #   include "Bletch: How does this C preprocessor stringify macros?"
22058 #endif
22059 int main() {
22060 EOCP
22061 $awk \\
22062 EOSH
22063 cat <<'EOSH' >> Cppsym.try
22064 'length($1) > 0 {
22065     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22066     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22067     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22068     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22069 }'       >> try.c
22070 echo 'return 0;}' >> try.c
22071 EOSH
22072 cat <<EOSH >> Cppsym.try
22073 ccflags="$ccflags"
22074 case "$osname-$gccversion" in
22075 irix-) ccflags="\$ccflags -woff 1178" ;;
22076 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22077 esac
22078 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22079 EOSH
22080 chmod +x Cppsym.try
22081 $eunicefix Cppsym.try
22082 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22083 : Add in any Linux cpp "predefined macros":
22084 case "$osname::$gccversion" in
22085   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22086     tHdrH=_tmpHdr
22087     rm -f $tHdrH'.h' $tHdrH
22088     touch $tHdrH'.h'
22089     # Filter out macro arguments, such as Linux's __INT8_C(c)
22090     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22091        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22092        if [ -s $tHdrH'_cppsym.real' ]; then
22093           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22094        fi
22095     fi
22096     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22097   ;;
22098 esac
22099 : now check the C compiler for additional symbols
22100 postprocess_cc_v=''
22101 case "$osname" in
22102 aix) postprocess_cc_v="|$tr , ' '" ;;
22103 esac
22104 $cat >ccsym <<EOS
22105 $startsh
22106 $cat >tmp.c <<EOF
22107 extern int foo;
22108 EOF
22109 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22110 do
22111         case "\$i" in
22112         -D*) echo "\$i" | $sed 's/^-D//';;
22113         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22114         esac
22115 done
22116 $rm_try
22117 EOS
22118 postprocess_cc_v=''
22119 chmod +x ccsym
22120 $eunicefix ccsym
22121 ./ccsym > ccsym1.raw
22122 if $test -s ccsym1.raw; then
22123        $sort ccsym1.raw | $uniq >ccsym.raw
22124 else
22125        mv ccsym1.raw ccsym.raw
22126 fi
22127
22128 $awk '/\=/ { print $0; next }
22129         { print $0"=1" }' ccsym.raw >ccsym.list
22130 $comm -13 Cppsym.true ccsym.list >ccsym.own
22131 $comm -12 Cppsym.true ccsym.list >ccsym.com
22132 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22133 also=''
22134 if $test -z ccsym.raw; then
22135         echo "Your C compiler doesn't seem to define any symbols!" >&4
22136         echo " "
22137         echo "However, your C preprocessor defines the following symbols:"
22138         $cat Cppsym.true
22139         ccsymbols=''
22140         cppsymbols=`$cat Cppsym.true`
22141         cppsymbols=`echo $cppsymbols`
22142         cppccsymbols="$cppsymbols"
22143 else
22144         if $test -s ccsym.com; then
22145                 echo "Your C compiler and pre-processor define these symbols:"
22146                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22147                 also='also '
22148                 symbols='ones'
22149                 cppccsymbols=`$cat ccsym.com`
22150                 cppccsymbols=`echo $cppccsymbols`
22151                 $test "$silent" || sleep 1
22152         fi
22153         if $test -s ccsym.cpp; then
22154                 $test "$also" && echo " "
22155                 echo "Your C pre-processor ${also}defines the following symbols:"
22156                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22157                 also='further '
22158                 cppsymbols=`$cat ccsym.cpp`
22159                 cppsymbols=`echo $cppsymbols`
22160                 $test "$silent" || sleep 1
22161         fi
22162         if $test -s ccsym.own; then
22163                 $test "$also" && echo " "
22164                 echo "Your C compiler ${also}defines the following cpp symbols:"
22165                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22166                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22167                 ccsymbols=`$cat ccsym.own`
22168                 ccsymbols=`echo $ccsymbols`
22169                 $test "$silent" || sleep 1
22170         fi
22171 fi
22172
22173 : see if this is a termio system
22174 val="$undef"
22175 val2="$undef"
22176 val3="$undef"
22177 if $test `./findhdr termios.h`; then
22178     set tcsetattr i_termios
22179     eval $inlibc
22180     val3="$i_termios"
22181 fi
22182 echo " "
22183 case "$val3" in
22184     "$define") echo "You have POSIX termios.h... good!" >&4;;
22185     *)  if ./Cppsym pyr; then
22186             case "`$run /bin/universe`" in
22187                 ucb) if $test `./findhdr sgtty.h`; then
22188                         val2="$define"
22189                         echo "<sgtty.h> found." >&4
22190                     else
22191                         echo "System is pyramid with BSD universe."
22192                         ./warn "<sgtty.h> not found--you could have problems."
22193                     fi;;
22194                 *)  if $test `./findhdr termio.h`; then
22195                         val="$define"
22196                         echo "<termio.h> found." >&4
22197                     else
22198                         echo "System is pyramid with USG universe."
22199                         ./warn "<termio.h> not found--you could have problems."
22200                     fi;;
22201             esac
22202         elif ./usg; then
22203             if $test `./findhdr termio.h`; then
22204                 echo "<termio.h> found." >&4
22205                 val="$define"
22206             elif $test `./findhdr sgtty.h`; then
22207                 echo "<sgtty.h> found." >&4
22208                 val2="$define"
22209             else
22210                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22211             fi
22212         else
22213             if $test `./findhdr sgtty.h`; then
22214                 echo "<sgtty.h> found." >&4
22215                 val2="$define"
22216             elif $test `./findhdr termio.h`; then
22217                 echo "<termio.h> found." >&4
22218                 val="$define"
22219             else
22220                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22221             fi
22222         fi;;
22223 esac
22224 set i_termio; eval $setvar
22225 val=$val2; set i_sgtty; eval $setvar
22226 val=$val3; set i_termios; eval $setvar
22227
22228 : see if stdbool is available
22229 : we want a real compile instead of Inhdr because some Solaris systems
22230 : have stdbool.h, but it can only be used if the compiler indicates it
22231 : is sufficiently c99-compliant.
22232 echo " "
22233 $cat >try.c <<EOCP
22234 #include <stdio.h>
22235 #include <stdbool.h>
22236 int func(bool x)
22237 {
22238     return x ? 1 : 0;
22239 }
22240 int main(int argc, char **argv)
22241 {
22242     return func(0);
22243 }
22244 EOCP
22245 set try
22246 if eval $compile; then
22247         echo "<stdbool.h> found." >&4
22248         val="$define"
22249 else
22250         echo "<stdbool.h> NOT found." >&4
22251         val="$undef"
22252 fi
22253 $rm_try
22254 set i_stdbool
22255 eval $setvar
22256
22257 : see if stddef is available
22258 set stddef.h i_stddef
22259 eval $inhdr
22260
22261 : see if sys/access.h is available
22262 set sys/access.h i_sysaccess
22263 eval $inhdr
22264
22265 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22266 set sys/filio.h i_sysfilio
22267 eval $inhdr
22268 echo " "
22269 if $test `./findhdr sys/ioctl.h`; then
22270         val="$define"
22271         echo '<sys/ioctl.h> found.' >&4
22272 else
22273         val="$undef"
22274         if $test $i_sysfilio = "$define"; then
22275             echo '<sys/ioctl.h> NOT found.' >&4
22276         else
22277                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22278                 $test $i_termio = "$define" && xxx="termio.h"
22279                 $test $i_termios = "$define" && xxx="termios.h"
22280 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22281         fi
22282 fi
22283 set i_sysioctl
22284 eval $setvar
22285
22286 : see if socket ioctl defs are in sys/sockio.h
22287 echo " "
22288 xxx=`./findhdr sys/sockio.h`
22289 if $test "$xxx"; then
22290         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22291                 val="$define"
22292                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22293         else
22294                 val="$undef"
22295                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22296         fi
22297 else
22298         val="$undef"
22299         $cat <<EOM
22300 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22301 EOM
22302 fi
22303 set i_syssockio
22304 eval $setvar
22305
22306 : see if this is a syslog.h system
22307 set syslog.h i_syslog
22308 eval $inhdr
22309
22310 : see if this is a sys/mode.h system
22311 set sys/mode.h i_sysmode
22312 eval $inhdr
22313
22314 : see if there is a sys/poll.h file
22315 set sys/poll.h i_syspoll
22316 eval $inhdr
22317
22318 : see if sys/resource.h has to be included
22319 set sys/resource.h i_sysresrc
22320 eval $inhdr
22321
22322 : see if sys/security.h is available
22323 set sys/security.h i_syssecrt
22324 eval $inhdr
22325
22326 : see if this is a sys/statvfs.h system
22327 set sys/statvfs.h i_sysstatvfs
22328 eval $inhdr
22329
22330 : see if this is a sys/un.h system
22331 set sys/un.h i_sysun
22332 eval $inhdr
22333
22334 : see if this is a sys/utsname.h system
22335 set sys/utsname.h i_sysutsname
22336 eval $inhdr
22337
22338 : see if this is a syswait system
22339 set sys/wait.h i_syswait
22340 eval $inhdr
22341
22342 : see if this is a ustat.h system
22343 set ustat.h i_ustat
22344 eval $inhdr
22345
22346 : see if this is an utime system
22347 set utime.h i_utime
22348 eval $inhdr
22349
22350 : see if this is a vfork system
22351 case "$d_vfork" in
22352 "$define")
22353         set vfork.h i_vfork
22354         eval $inhdr
22355         ;;
22356 *)
22357         i_vfork="$undef"
22358         ;;
22359 esac
22360
22361 : Check extensions
22362 echo " "
22363 echo "Looking for extensions..." >&4
22364 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22365 : contain old or inaccurate or duplicate values.
22366 nonxs_extensions=''
22367 xs_extensions=''
22368 : We do not use find because it might not be available.
22369 : We do not just use MANIFEST because the user may have dropped
22370 : some additional extensions into the source tree and expect them
22371 : to be built.
22372
22373 : Function to recursively find available extensions, ignoring DynaLoader
22374 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22375 : In 5.10.1 and later, extensions are stored in directories
22376 : like File-Glob instead of the older File/Glob/.
22377 find_extensions='
22378     for xxx in *; do
22379         case "$xxx" in
22380             DynaLoader|dynaload) ;;
22381             *)
22382             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22383             case "$this_ext" in
22384                 Scalar/List/Utils) this_ext="List/Util" ;;
22385                 PathTools)         this_ext="Cwd"       ;;
22386             esac;
22387             echo " $xs_extensions $nonxs_extensions" > $$.tmp;
22388             if $contains " $this_ext " $$.tmp; then
22389                 echo >&4;
22390                 echo "Duplicate directories detected for extension $xxx" >&4;
22391                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22392                 case "$knowitall" in
22393                 "") dflt=y;;
22394                 *) dflt=n;;
22395                 esac;
22396                 . ../UU/myread;
22397                 case "$ans" in
22398                 n*|N*) ;;
22399                 *) echo >&4;
22400                     echo "Ok.  Stopping Configure." >&4;
22401                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22402                     exit 1;;
22403                 esac;
22404                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22405             fi;
22406             $ls -1 $xxx > $$.tmp;
22407             if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22408                 xs_extensions="$xs_extensions $this_ext";
22409             elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22410                 xs_extensions="$xs_extensions $this_ext";
22411             elif $test -d $xxx; then
22412                 nonxs_extensions="$nonxs_extensions $this_ext";
22413             fi;
22414             $rm -f $$.tmp;
22415             ;;
22416         esac;
22417     done'
22418 tdir=`pwd`
22419 cd "$rsrc/cpan"
22420 set X
22421 shift
22422 eval $find_extensions
22423 cd "$rsrc/dist"
22424 set X
22425 shift
22426 eval $find_extensions
22427 cd "$rsrc/ext"
22428 set X
22429 shift
22430 eval $find_extensions
22431 set X $xs_extensions
22432 shift
22433 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22434 set X $nonxs_extensions
22435 shift
22436 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22437 cd "$tdir"
22438 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22439
22440 : Now see which are supported on this system.
22441 avail_ext=''
22442 for xxx in $xs_extensions ; do
22443         case "$xxx" in
22444         DB_File|db_file)
22445                 case "$i_db" in
22446                 $define) avail_ext="$avail_ext $xxx" ;;
22447                 esac
22448                 ;;
22449         GDBM_File|gdbm_fil)
22450                 case "$i_gdbm" in
22451                 $define) avail_ext="$avail_ext $xxx" ;;
22452                 esac
22453                 ;;
22454         I18N/Langinfo|i18n_lan)
22455                 case "$i_langinfo$d_nl_langinfo" in
22456                 $define$define) avail_ext="$avail_ext $xxx" ;;
22457                 esac
22458                 ;;
22459         IPC/SysV|ipc/sysv)
22460                 : XXX Do we need a useipcsysv variable here
22461                 case "${d_msg}${d_sem}${d_shm}" in
22462                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22463                 esac
22464                 ;;
22465         NDBM_File|ndbm_fil)
22466                 case "$d_ndbm" in
22467                 $define)
22468                     case "$osname-$use64bitint" in
22469                     hpux-define)
22470                         case "$libs" in
22471                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22472                         esac
22473                         ;;
22474                     *) avail_ext="$avail_ext $xxx" ;;
22475                     esac
22476                     ;;
22477                 esac
22478                 ;;
22479         ODBM_File|odbm_fil)
22480                 case "${i_dbm}${i_rpcsvcdbm}" in
22481                 *"${define}"*)
22482                     case "$d_cplusplus" in
22483                     define) ;; # delete as a function name will not work
22484                     *)  case "$osname-$use64bitint" in
22485                         hpux-define)
22486                             case "$libs" in
22487                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22488                             esac
22489                             ;;
22490                         *) avail_ext="$avail_ext $xxx" ;;
22491                         esac
22492                         ;;
22493                     esac
22494                     ;;
22495                 esac
22496                 ;;
22497         Opcode|opcode)
22498                 case "$useopcode" in
22499                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22500                 esac
22501                 ;;
22502         POSIX|posix)
22503                 case "$useposix" in
22504                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22505                 esac
22506                 ;;
22507         Socket|socket)
22508                 case "$d_socket" in
22509                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22510                 esac
22511                 ;;
22512         Sys/Syslog|sys/syslog)
22513                 : XXX syslog requires socket
22514                 case "$d_socket" in
22515                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22516                 esac
22517                 ;;
22518         Thread|thread)
22519                 case "$usethreads" in
22520                 true|$define|y)
22521                         case "$use5005threads" in
22522                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22523                         esac
22524                 esac
22525                 ;;
22526         threads|threads/shared)
22527                 # threads and threads::shared are special cases.
22528                 # To stop people from asking "Perl 5.8.0 was supposed
22529                 # to have this new fancy threads implementation but my
22530                 # perl doesn't have it" and from people trying to
22531                 # (re)install the threads module using CPAN.pm and
22532                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22533                 # the threads.pm and threads/shared.pm will always be
22534                 # there, croaking informatively ("you need to rebuild
22535                 # all of Perl with threads, sorry") when threads haven't
22536                 # been compiled in.
22537                 # --jhi
22538                 avail_ext="$avail_ext $xxx"
22539                 ;;
22540         VMS*)
22541                 ;;
22542         Win32*)
22543                 case "$osname" in
22544                 cygwin) avail_ext="$avail_ext $xxx" ;;
22545                 esac
22546                 ;;
22547         XS/APItest|xs/apitest)
22548                 # This is just for testing.  Skip it unless we have dynamic loading.
22549
22550                 case "$usedl" in
22551                 $define) avail_ext="$avail_ext $xxx" ;;
22552                 esac
22553                 ;;
22554         XS/Typemap|xs/typemap)
22555                 # This is just for testing.  Skip it unless we have dynamic loading.
22556                 case "$usedl" in
22557                 $define) avail_ext="$avail_ext $xxx" ;;
22558                 esac
22559                 ;;
22560         *)      avail_ext="$avail_ext $xxx"
22561                 ;;
22562         esac
22563 done
22564
22565 set X $avail_ext
22566 shift
22567 avail_ext="$*"
22568
22569 case "$onlyextensions" in
22570 '') ;;
22571 *)  keepextensions=''
22572     echo "You have requested that only certain extensions be included..." >&4
22573     for i in $onlyextensions; do
22574         case " $avail_ext " in
22575         *" $i "*)
22576             echo "Keeping extension $i."
22577             keepextensions="$keepextensions $i"
22578             ;;
22579         *) echo "Ignoring extension $i." ;;
22580         esac
22581     done
22582     avail_ext="$keepextensions"
22583     ;;
22584 esac
22585
22586 case "$noextensions" in
22587 '') ;;
22588 *)  keepextensions=''
22589     echo "You have requested that certain extensions be ignored..." >&4
22590     for i in $avail_ext; do
22591         case " $noextensions " in
22592         *" $i "*) echo "Ignoring extension $i." ;;
22593         *) echo "Keeping extension $i.";
22594            keepextensions="$keepextensions $i"
22595            ;;
22596         esac
22597     done
22598     avail_ext="$keepextensions"
22599     ;;
22600 esac
22601
22602 : Now see which nonxs extensions are supported on this system.
22603 : For now assume all are.
22604 nonxs_ext=''
22605 for xxx in $nonxs_extensions ; do
22606         case "$xxx" in
22607         VMS*)
22608                 ;;
22609         *)      nonxs_ext="$nonxs_ext $xxx"
22610                 ;;
22611         esac
22612 done
22613
22614 set X $nonxs_ext
22615 shift
22616 nonxs_ext="$*"
22617
22618 case $usedl in
22619 $define)
22620         $cat <<EOM
22621 A number of extensions are supplied with $package.  You may choose to
22622 compile these extensions for dynamic loading (the default), compile
22623 them into the $package executable (static loading), or not include
22624 them at all.  Answer "none" to include no extensions.
22625 Note that DynaLoader is always built and need not be mentioned here.
22626
22627 EOM
22628         case "$dynamic_ext" in
22629         '')
22630                 : Exclude those listed in static_ext
22631                 dflt=''
22632                 for xxx in $avail_ext; do
22633                         case " $static_ext " in
22634                         *" $xxx "*) ;;
22635                         *) dflt="$dflt $xxx" ;;
22636                         esac
22637                 done
22638                 set X $dflt
22639                 shift
22640                 dflt="$*"
22641                 ;;
22642         *)      dflt="$dynamic_ext"
22643                 # Perhaps we are reusing an old out-of-date config.sh.
22644                 case "$hint" in
22645                 previous)
22646                         if test X"$dynamic_ext" != X"$avail_ext"; then
22647                                 $cat <<EOM
22648 NOTICE:  Your previous config.sh list may be incorrect.
22649 The extensions now available to you are
22650         ${avail_ext}
22651 but the default list from your previous config.sh is
22652         ${dynamic_ext}
22653
22654 EOM
22655                         fi
22656                         ;;
22657                 esac
22658                 ;;
22659         esac
22660         case "$dflt" in
22661         '')     dflt=none;;
22662         esac
22663         rp="What extensions do you wish to load dynamically?"
22664         . ./myread
22665         case "$ans" in
22666         none) dynamic_ext=' ' ;;
22667         *) dynamic_ext="$ans" ;;
22668         esac
22669
22670         case "$static_ext" in
22671         '')
22672                 : Exclude those already listed in dynamic linking
22673                 dflt=''
22674                 for xxx in $avail_ext; do
22675                         case " $dynamic_ext " in
22676                         *" $xxx "*) ;;
22677                         *) dflt="$dflt $xxx" ;;
22678                         esac
22679                 done
22680                 set X $dflt
22681                 shift
22682                 dflt="$*"
22683                 ;;
22684         *)  dflt="$static_ext"
22685                 ;;
22686         esac
22687
22688         case "$dflt" in
22689         '')     dflt=none;;
22690         esac
22691         rp="What extensions do you wish to load statically?"
22692         . ./myread
22693         case "$ans" in
22694         none) static_ext=' ' ;;
22695         *) static_ext="$ans" ;;
22696         esac
22697         ;;
22698 *)
22699         $cat <<EOM
22700 A number of extensions are supplied with $package.  Answer "none"
22701 to include no extensions.
22702 Note that DynaLoader is always built and need not be mentioned here.
22703
22704 EOM
22705         case "$static_ext" in
22706         '') dflt="$avail_ext" ;;
22707         *)      dflt="$static_ext"
22708                 # Perhaps we are reusing an old out-of-date config.sh.
22709                 case "$hint" in
22710                 previous)
22711                         if test X"$static_ext" != X"$avail_ext"; then
22712                                 $cat <<EOM
22713 NOTICE:  Your previous config.sh list may be incorrect.
22714 The extensions now available to you are
22715         ${avail_ext}
22716 but the default list from your previous config.sh is
22717         ${static_ext}
22718
22719 EOM
22720                         fi
22721                         ;;
22722                 esac
22723                 ;;
22724         esac
22725         : Exclude those that are not xs extensions
22726         case "$dflt" in
22727         '')     dflt=none;;
22728         esac
22729         rp="What extensions do you wish to include?"
22730         . ./myread
22731         case "$ans" in
22732         none) static_ext=' ' ;;
22733         *) static_ext="$ans" ;;
22734         esac
22735         ;;
22736 esac
22737 #
22738 # Encode is a special case.  If we are building Encode as a static
22739 # extension, we need to explicitly list its subextensions as well.
22740 # For other nested extensions, this is handled automatically by
22741 # the appropriate Makefile.PL.
22742 case " $static_ext " in
22743         *" Encode "*) # Add the subextensions of Encode
22744         cd "$rsrc/cpan"
22745         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22746                 static_ext="$static_ext Encode/$xxx"
22747                 known_extensions="$known_extensions Encode/$xxx"
22748         done
22749         cd "$tdir"
22750         ;;
22751 esac
22752
22753 set X $dynamic_ext $static_ext $nonxs_ext
22754 shift
22755 extensions="$*"
22756
22757 # Sanity check:  We require an extension suitable for use with
22758 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22759 # should show up as failures in the test suite, but it's helpful to
22760 # catch them now.) The 'extensions' list is normally sorted
22761 # alphabetically, so we need to accept either
22762 #    DB_File ... Fcntl ... IO  ....
22763 # or something like
22764 #    Fcntl ... NDBM_File ... IO  ....
22765 case " $extensions"  in
22766 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22767 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22768 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22769 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22770    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22771    ;;
22772 esac
22773
22774 : Remove libraries needed only for extensions
22775 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22776 : The exception is SunOS 4.x, which needs them.
22777 case "${osname}X${osvers}" in
22778 sunos*X4*)
22779     perllibs="$libs"
22780     ;;
22781 *) case "$usedl" in
22782     $define|true|[yY]*)
22783             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22784             shift
22785             perllibs="$*"
22786             ;;
22787     *)  perllibs="$libs"
22788             ;;
22789     esac
22790     ;;
22791 esac
22792
22793 : Remove build directory name from cppstdin so it can be used from
22794 : either the present location or the final installed location.
22795 echo " "
22796 : Get out of the UU directory to get correct path name.
22797 cd ..
22798 case "$cppstdin" in
22799 `pwd`/cppstdin)
22800         echo "Stripping down cppstdin path name"
22801         cppstdin=cppstdin
22802         ;;
22803 esac
22804 cd UU
22805
22806 : end of configuration questions
22807 echo " "
22808 echo "End of configuration questions."
22809 echo " "
22810
22811 : back to where it started
22812 if test -d ../UU; then
22813         cd ..
22814 fi
22815
22816 : configuration may be unconditionally patched via a 'config.arch' file
22817 if $test -f config.arch; then
22818         echo "I see a config.arch file, loading it." >&4
22819         . ./config.arch
22820 fi
22821
22822 : configuration may be patched via a 'config.over' file
22823 if $test -f config.over; then
22824         echo " "
22825         dflt=y
22826         rp='I see a config.over file.  Do you wish to load it?'
22827         . UU/myread
22828         case "$ans" in
22829         n*) echo "OK, I'll ignore it.";;
22830         *)      . ./config.over
22831                 echo "Configuration override changes have been loaded."
22832                 ;;
22833         esac
22834 fi
22835
22836 : in case they want portability, strip down executable paths
22837 case "$d_portable" in
22838 "$define")
22839         echo " "
22840         echo "Stripping down executable paths..." >&4
22841         for file in $loclist $trylist; do
22842                 eval temp=\$$file
22843                 eval $file=`basename $temp`
22844         done
22845         ;;
22846 esac
22847
22848 : create config.sh file
22849 echo " "
22850 echo "Creating config.sh..." >&4
22851 $spitshell <<EOT >config.sh
22852 $startsh
22853 #
22854 # This file was produced by running the Configure script. It holds all the
22855 # definitions figured out by Configure. Should you modify one of these values,
22856 # do not forget to propagate your changes by running "Configure -der". You may
22857 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22858 #
22859
22860 # Package name      : $package
22861 # Source directory  : $src
22862 # Configuration time: $cf_time
22863 # Configured by     : $cf_by
22864 # Target system     : $myuname
22865
22866 EOT
22867 : Add in command line options if available
22868 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22869
22870 $spitshell <<EOT >>config.sh
22871
22872 Author='$Author'
22873 Date='$Date'
22874 Header='$Header'
22875 Id='$Id'
22876 Locker='$Locker'
22877 Log='$Log'
22878 RCSfile='$RCSfile'
22879 Revision='$Revision'
22880 Source='$Source'
22881 State='$State'
22882 _a='$_a'
22883 _exe='$_exe'
22884 _o='$_o'
22885 afs='$afs'
22886 afsroot='$afsroot'
22887 alignbytes='$alignbytes'
22888 ansi2knr='$ansi2knr'
22889 aphostname='$aphostname'
22890 api_revision='$api_revision'
22891 api_subversion='$api_subversion'
22892 api_version='$api_version'
22893 api_versionstring='$api_versionstring'
22894 ar='$ar'
22895 archlib='$archlib'
22896 archlibexp='$archlibexp'
22897 archname64='$archname64'
22898 archname='$archname'
22899 archobjs='$archobjs'
22900 asctime_r_proto='$asctime_r_proto'
22901 awk='$awk'
22902 baserev='$baserev'
22903 bash='$bash'
22904 bin='$bin'
22905 bin_ELF='$bin_ELF'
22906 binexp='$binexp'
22907 bison='$bison'
22908 bootstrap_charset='$bootstrap_charset'
22909 byacc='$byacc'
22910 byteorder='$byteorder'
22911 c='$c'
22912 castflags='$castflags'
22913 cat='$cat'
22914 cc='$cc'
22915 cccdlflags='$cccdlflags'
22916 ccdlflags='$ccdlflags'
22917 ccflags='$ccflags'
22918 ccflags_uselargefiles='$ccflags_uselargefiles'
22919 ccname='$ccname'
22920 ccsymbols='$ccsymbols'
22921 ccversion='$ccversion'
22922 cf_by='$cf_by'
22923 cf_email='$cf_email'
22924 cf_time='$cf_time'
22925 charbits='$charbits'
22926 charsize='$charsize'
22927 chgrp='$chgrp'
22928 chmod='$chmod'
22929 chown='$chown'
22930 clocktype='$clocktype'
22931 comm='$comm'
22932 compress='$compress'
22933 contains='$contains'
22934 cp='$cp'
22935 cpio='$cpio'
22936 cpp='$cpp'
22937 cpp_stuff='$cpp_stuff'
22938 cppccsymbols='$cppccsymbols'
22939 cppflags='$cppflags'
22940 cpplast='$cpplast'
22941 cppminus='$cppminus'
22942 cpprun='$cpprun'
22943 cppstdin='$cppstdin'
22944 cppsymbols='$cppsymbols'
22945 crypt_r_proto='$crypt_r_proto'
22946 cryptlib='$cryptlib'
22947 csh='$csh'
22948 ctermid_r_proto='$ctermid_r_proto'
22949 ctime_r_proto='$ctime_r_proto'
22950 d_Gconvert='$d_Gconvert'
22951 d_PRIEUldbl='$d_PRIEUldbl'
22952 d_PRIFUldbl='$d_PRIFUldbl'
22953 d_PRIGUldbl='$d_PRIGUldbl'
22954 d_PRIXU64='$d_PRIXU64'
22955 d_PRId64='$d_PRId64'
22956 d_PRIeldbl='$d_PRIeldbl'
22957 d_PRIfldbl='$d_PRIfldbl'
22958 d_PRIgldbl='$d_PRIgldbl'
22959 d_PRIi64='$d_PRIi64'
22960 d_PRIo64='$d_PRIo64'
22961 d_PRIu64='$d_PRIu64'
22962 d_PRIx64='$d_PRIx64'
22963 d_SCNfldbl='$d_SCNfldbl'
22964 d__fwalk='$d__fwalk'
22965 d_access='$d_access'
22966 d_accessx='$d_accessx'
22967 d_aintl='$d_aintl'
22968 d_alarm='$d_alarm'
22969 d_archlib='$d_archlib'
22970 d_asctime64='$d_asctime64'
22971 d_asctime_r='$d_asctime_r'
22972 d_atolf='$d_atolf'
22973 d_atoll='$d_atoll'
22974 d_attribute_deprecated='$d_attribute_deprecated'
22975 d_attribute_format='$d_attribute_format'
22976 d_attribute_malloc='$d_attribute_malloc'
22977 d_attribute_nonnull='$d_attribute_nonnull'
22978 d_attribute_noreturn='$d_attribute_noreturn'
22979 d_attribute_pure='$d_attribute_pure'
22980 d_attribute_unused='$d_attribute_unused'
22981 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22982 d_bcmp='$d_bcmp'
22983 d_bcopy='$d_bcopy'
22984 d_bsd='$d_bsd'
22985 d_bsdgetpgrp='$d_bsdgetpgrp'
22986 d_bsdsetpgrp='$d_bsdsetpgrp'
22987 d_builtin_choose_expr='$d_builtin_choose_expr'
22988 d_builtin_expect='$d_builtin_expect'
22989 d_bzero='$d_bzero'
22990 d_c99_variadic_macros='$d_c99_variadic_macros'
22991 d_casti32='$d_casti32'
22992 d_castneg='$d_castneg'
22993 d_charvspr='$d_charvspr'
22994 d_chown='$d_chown'
22995 d_chroot='$d_chroot'
22996 d_chsize='$d_chsize'
22997 d_class='$d_class'
22998 d_clearenv='$d_clearenv'
22999 d_closedir='$d_closedir'
23000 d_cmsghdr_s='$d_cmsghdr_s'
23001 d_const='$d_const'
23002 d_copysignl='$d_copysignl'
23003 d_cplusplus='$d_cplusplus'
23004 d_crypt='$d_crypt'
23005 d_crypt_r='$d_crypt_r'
23006 d_csh='$d_csh'
23007 d_ctermid='$d_ctermid'
23008 d_ctermid_r='$d_ctermid_r'
23009 d_ctime64='$d_ctime64'
23010 d_ctime_r='$d_ctime_r'
23011 d_cuserid='$d_cuserid'
23012 d_dbl_dig='$d_dbl_dig'
23013 d_dbminitproto='$d_dbminitproto'
23014 d_difftime64='$d_difftime64'
23015 d_difftime='$d_difftime'
23016 d_dir_dd_fd='$d_dir_dd_fd'
23017 d_dirfd='$d_dirfd'
23018 d_dirnamlen='$d_dirnamlen'
23019 d_dlerror='$d_dlerror'
23020 d_dlopen='$d_dlopen'
23021 d_dlsymun='$d_dlsymun'
23022 d_dosuid='$d_dosuid'
23023 d_drand48_r='$d_drand48_r'
23024 d_drand48proto='$d_drand48proto'
23025 d_dup2='$d_dup2'
23026 d_eaccess='$d_eaccess'
23027 d_endgrent='$d_endgrent'
23028 d_endgrent_r='$d_endgrent_r'
23029 d_endhent='$d_endhent'
23030 d_endhostent_r='$d_endhostent_r'
23031 d_endnent='$d_endnent'
23032 d_endnetent_r='$d_endnetent_r'
23033 d_endpent='$d_endpent'
23034 d_endprotoent_r='$d_endprotoent_r'
23035 d_endpwent='$d_endpwent'
23036 d_endpwent_r='$d_endpwent_r'
23037 d_endsent='$d_endsent'
23038 d_endservent_r='$d_endservent_r'
23039 d_eofnblk='$d_eofnblk'
23040 d_eunice='$d_eunice'
23041 d_faststdio='$d_faststdio'
23042 d_fchdir='$d_fchdir'
23043 d_fchmod='$d_fchmod'
23044 d_fchown='$d_fchown'
23045 d_fcntl='$d_fcntl'
23046 d_fcntl_can_lock='$d_fcntl_can_lock'
23047 d_fd_macros='$d_fd_macros'
23048 d_fd_set='$d_fd_set'
23049 d_fds_bits='$d_fds_bits'
23050 d_fgetpos='$d_fgetpos'
23051 d_finite='$d_finite'
23052 d_finitel='$d_finitel'
23053 d_flexfnam='$d_flexfnam'
23054 d_flock='$d_flock'
23055 d_flockproto='$d_flockproto'
23056 d_fork='$d_fork'
23057 d_fp_class='$d_fp_class'
23058 d_fpathconf='$d_fpathconf'
23059 d_fpclass='$d_fpclass'
23060 d_fpclassify='$d_fpclassify'
23061 d_fpclassl='$d_fpclassl'
23062 d_fpos64_t='$d_fpos64_t'
23063 d_frexpl='$d_frexpl'
23064 d_fs_data_s='$d_fs_data_s'
23065 d_fseeko='$d_fseeko'
23066 d_fsetpos='$d_fsetpos'
23067 d_fstatfs='$d_fstatfs'
23068 d_fstatvfs='$d_fstatvfs'
23069 d_fsync='$d_fsync'
23070 d_ftello='$d_ftello'
23071 d_ftime='$d_ftime'
23072 d_futimes='$d_futimes'
23073 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23074 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23075 d_getaddrinfo='$d_getaddrinfo'
23076 d_getcwd='$d_getcwd'
23077 d_getespwnam='$d_getespwnam'
23078 d_getfsstat='$d_getfsstat'
23079 d_getgrent='$d_getgrent'
23080 d_getgrent_r='$d_getgrent_r'
23081 d_getgrgid_r='$d_getgrgid_r'
23082 d_getgrnam_r='$d_getgrnam_r'
23083 d_getgrps='$d_getgrps'
23084 d_gethbyaddr='$d_gethbyaddr'
23085 d_gethbyname='$d_gethbyname'
23086 d_gethent='$d_gethent'
23087 d_gethname='$d_gethname'
23088 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23089 d_gethostbyname_r='$d_gethostbyname_r'
23090 d_gethostent_r='$d_gethostent_r'
23091 d_gethostprotos='$d_gethostprotos'
23092 d_getitimer='$d_getitimer'
23093 d_getlogin='$d_getlogin'
23094 d_getlogin_r='$d_getlogin_r'
23095 d_getmnt='$d_getmnt'
23096 d_getmntent='$d_getmntent'
23097 d_getnameinfo='$d_getnameinfo'
23098 d_getnbyaddr='$d_getnbyaddr'
23099 d_getnbyname='$d_getnbyname'
23100 d_getnent='$d_getnent'
23101 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23102 d_getnetbyname_r='$d_getnetbyname_r'
23103 d_getnetent_r='$d_getnetent_r'
23104 d_getnetprotos='$d_getnetprotos'
23105 d_getpagsz='$d_getpagsz'
23106 d_getpbyname='$d_getpbyname'
23107 d_getpbynumber='$d_getpbynumber'
23108 d_getpent='$d_getpent'
23109 d_getpgid='$d_getpgid'
23110 d_getpgrp2='$d_getpgrp2'
23111 d_getpgrp='$d_getpgrp'
23112 d_getppid='$d_getppid'
23113 d_getprior='$d_getprior'
23114 d_getprotobyname_r='$d_getprotobyname_r'
23115 d_getprotobynumber_r='$d_getprotobynumber_r'
23116 d_getprotoent_r='$d_getprotoent_r'
23117 d_getprotoprotos='$d_getprotoprotos'
23118 d_getprpwnam='$d_getprpwnam'
23119 d_getpwent='$d_getpwent'
23120 d_getpwent_r='$d_getpwent_r'
23121 d_getpwnam_r='$d_getpwnam_r'
23122 d_getpwuid_r='$d_getpwuid_r'
23123 d_getsbyname='$d_getsbyname'
23124 d_getsbyport='$d_getsbyport'
23125 d_getsent='$d_getsent'
23126 d_getservbyname_r='$d_getservbyname_r'
23127 d_getservbyport_r='$d_getservbyport_r'
23128 d_getservent_r='$d_getservent_r'
23129 d_getservprotos='$d_getservprotos'
23130 d_getspnam='$d_getspnam'
23131 d_getspnam_r='$d_getspnam_r'
23132 d_gettimeod='$d_gettimeod'
23133 d_gmtime64='$d_gmtime64'
23134 d_gmtime_r='$d_gmtime_r'
23135 d_gnulibc='$d_gnulibc'
23136 d_grpasswd='$d_grpasswd'
23137 d_hasmntopt='$d_hasmntopt'
23138 d_htonl='$d_htonl'
23139 d_ilogbl='$d_ilogbl'
23140 d_inc_version_list='$d_inc_version_list'
23141 d_index='$d_index'
23142 d_inetaton='$d_inetaton'
23143 d_inetntop='$d_inetntop'
23144 d_inetpton='$d_inetpton'
23145 d_int64_t='$d_int64_t'
23146 d_ip_mreq='$d_ip_mreq'
23147 d_ip_mreq_source='$d_ip_mreq_source'
23148 d_ipv6_mreq='$d_ipv6_mreq'
23149 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23150 d_isascii='$d_isascii'
23151 d_isblank='$d_isblank'
23152 d_isfinite='$d_isfinite'
23153 d_isinf='$d_isinf'
23154 d_isnan='$d_isnan'
23155 d_isnanl='$d_isnanl'
23156 d_killpg='$d_killpg'
23157 d_lchown='$d_lchown'
23158 d_ldbl_dig='$d_ldbl_dig'
23159 d_libm_lib_version='$d_libm_lib_version'
23160 d_libname_unique='$d_libname_unique'
23161 d_link='$d_link'
23162 d_localtime64='$d_localtime64'
23163 d_localtime_r='$d_localtime_r'
23164 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23165 d_locconv='$d_locconv'
23166 d_lockf='$d_lockf'
23167 d_longdbl='$d_longdbl'
23168 d_longlong='$d_longlong'
23169 d_lseekproto='$d_lseekproto'
23170 d_lstat='$d_lstat'
23171 d_madvise='$d_madvise'
23172 d_malloc_good_size='$d_malloc_good_size'
23173 d_malloc_size='$d_malloc_size'
23174 d_mblen='$d_mblen'
23175 d_mbstowcs='$d_mbstowcs'
23176 d_mbtowc='$d_mbtowc'
23177 d_memchr='$d_memchr'
23178 d_memcmp='$d_memcmp'
23179 d_memcpy='$d_memcpy'
23180 d_memmove='$d_memmove'
23181 d_memset='$d_memset'
23182 d_mkdir='$d_mkdir'
23183 d_mkdtemp='$d_mkdtemp'
23184 d_mkfifo='$d_mkfifo'
23185 d_mkstemp='$d_mkstemp'
23186 d_mkstemps='$d_mkstemps'
23187 d_mktime64='$d_mktime64'
23188 d_mktime='$d_mktime'
23189 d_mmap='$d_mmap'
23190 d_modfl='$d_modfl'
23191 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23192 d_modflproto='$d_modflproto'
23193 d_mprotect='$d_mprotect'
23194 d_msg='$d_msg'
23195 d_msg_ctrunc='$d_msg_ctrunc'
23196 d_msg_dontroute='$d_msg_dontroute'
23197 d_msg_oob='$d_msg_oob'
23198 d_msg_peek='$d_msg_peek'
23199 d_msg_proxy='$d_msg_proxy'
23200 d_msgctl='$d_msgctl'
23201 d_msgget='$d_msgget'
23202 d_msghdr_s='$d_msghdr_s'
23203 d_msgrcv='$d_msgrcv'
23204 d_msgsnd='$d_msgsnd'
23205 d_msync='$d_msync'
23206 d_munmap='$d_munmap'
23207 d_mymalloc='$d_mymalloc'
23208 d_ndbm='$d_ndbm'
23209 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23210 d_nice='$d_nice'
23211 d_nl_langinfo='$d_nl_langinfo'
23212 d_nv_preserves_uv='$d_nv_preserves_uv'
23213 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23214 d_off64_t='$d_off64_t'
23215 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23216 d_oldpthreads='$d_oldpthreads'
23217 d_oldsock='$d_oldsock'
23218 d_open3='$d_open3'
23219 d_pathconf='$d_pathconf'
23220 d_pause='$d_pause'
23221 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23222 d_phostname='$d_phostname'
23223 d_pipe='$d_pipe'
23224 d_poll='$d_poll'
23225 d_portable='$d_portable'
23226 d_prctl='$d_prctl'
23227 d_prctl_set_name='$d_prctl_set_name'
23228 d_printf_format_null='$d_printf_format_null'
23229 d_procselfexe='$d_procselfexe'
23230 d_pseudofork='$d_pseudofork'
23231 d_pthread_atfork='$d_pthread_atfork'
23232 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23233 d_pthread_yield='$d_pthread_yield'
23234 d_pwage='$d_pwage'
23235 d_pwchange='$d_pwchange'
23236 d_pwclass='$d_pwclass'
23237 d_pwcomment='$d_pwcomment'
23238 d_pwexpire='$d_pwexpire'
23239 d_pwgecos='$d_pwgecos'
23240 d_pwpasswd='$d_pwpasswd'
23241 d_pwquota='$d_pwquota'
23242 d_qgcvt='$d_qgcvt'
23243 d_quad='$d_quad'
23244 d_random_r='$d_random_r'
23245 d_readdir64_r='$d_readdir64_r'
23246 d_readdir='$d_readdir'
23247 d_readdir_r='$d_readdir_r'
23248 d_readlink='$d_readlink'
23249 d_readv='$d_readv'
23250 d_recvmsg='$d_recvmsg'
23251 d_rename='$d_rename'
23252 d_rewinddir='$d_rewinddir'
23253 d_rmdir='$d_rmdir'
23254 d_safebcpy='$d_safebcpy'
23255 d_safemcpy='$d_safemcpy'
23256 d_sanemcmp='$d_sanemcmp'
23257 d_sbrkproto='$d_sbrkproto'
23258 d_scalbnl='$d_scalbnl'
23259 d_sched_yield='$d_sched_yield'
23260 d_scm_rights='$d_scm_rights'
23261 d_seekdir='$d_seekdir'
23262 d_select='$d_select'
23263 d_sem='$d_sem'
23264 d_semctl='$d_semctl'
23265 d_semctl_semid_ds='$d_semctl_semid_ds'
23266 d_semctl_semun='$d_semctl_semun'
23267 d_semget='$d_semget'
23268 d_semop='$d_semop'
23269 d_sendmsg='$d_sendmsg'
23270 d_setegid='$d_setegid'
23271 d_seteuid='$d_seteuid'
23272 d_setgrent='$d_setgrent'
23273 d_setgrent_r='$d_setgrent_r'
23274 d_setgrps='$d_setgrps'
23275 d_sethent='$d_sethent'
23276 d_sethostent_r='$d_sethostent_r'
23277 d_setitimer='$d_setitimer'
23278 d_setlinebuf='$d_setlinebuf'
23279 d_setlocale='$d_setlocale'
23280 d_setlocale_r='$d_setlocale_r'
23281 d_setnent='$d_setnent'
23282 d_setnetent_r='$d_setnetent_r'
23283 d_setpent='$d_setpent'
23284 d_setpgid='$d_setpgid'
23285 d_setpgrp2='$d_setpgrp2'
23286 d_setpgrp='$d_setpgrp'
23287 d_setprior='$d_setprior'
23288 d_setproctitle='$d_setproctitle'
23289 d_setprotoent_r='$d_setprotoent_r'
23290 d_setpwent='$d_setpwent'
23291 d_setpwent_r='$d_setpwent_r'
23292 d_setregid='$d_setregid'
23293 d_setresgid='$d_setresgid'
23294 d_setresuid='$d_setresuid'
23295 d_setreuid='$d_setreuid'
23296 d_setrgid='$d_setrgid'
23297 d_setruid='$d_setruid'
23298 d_setsent='$d_setsent'
23299 d_setservent_r='$d_setservent_r'
23300 d_setsid='$d_setsid'
23301 d_setvbuf='$d_setvbuf'
23302 d_shm='$d_shm'
23303 d_shmat='$d_shmat'
23304 d_shmatprototype='$d_shmatprototype'
23305 d_shmctl='$d_shmctl'
23306 d_shmdt='$d_shmdt'
23307 d_shmget='$d_shmget'
23308 d_sigaction='$d_sigaction'
23309 d_signbit='$d_signbit'
23310 d_sigprocmask='$d_sigprocmask'
23311 d_sigsetjmp='$d_sigsetjmp'
23312 d_sin6_scope_id='$d_sin6_scope_id'
23313 d_sitearch='$d_sitearch'
23314 d_snprintf='$d_snprintf'
23315 d_sockaddr_in6='$d_sockaddr_in6'
23316 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23317 d_sockatmark='$d_sockatmark'
23318 d_sockatmarkproto='$d_sockatmarkproto'
23319 d_socket='$d_socket'
23320 d_socklen_t='$d_socklen_t'
23321 d_sockpair='$d_sockpair'
23322 d_socks5_init='$d_socks5_init'
23323 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23324 d_sqrtl='$d_sqrtl'
23325 d_srand48_r='$d_srand48_r'
23326 d_srandom_r='$d_srandom_r'
23327 d_sresgproto='$d_sresgproto'
23328 d_sresuproto='$d_sresuproto'
23329 d_statblks='$d_statblks'
23330 d_statfs_f_flags='$d_statfs_f_flags'
23331 d_statfs_s='$d_statfs_s'
23332 d_static_inline='$d_static_inline'
23333 d_statvfs='$d_statvfs'
23334 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23335 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23336 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23337 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23338 d_stdio_stream_array='$d_stdio_stream_array'
23339 d_stdiobase='$d_stdiobase'
23340 d_stdstdio='$d_stdstdio'
23341 d_strchr='$d_strchr'
23342 d_strcoll='$d_strcoll'
23343 d_strctcpy='$d_strctcpy'
23344 d_strerrm='$d_strerrm'
23345 d_strerror='$d_strerror'
23346 d_strerror_r='$d_strerror_r'
23347 d_strftime='$d_strftime'
23348 d_strlcat='$d_strlcat'
23349 d_strlcpy='$d_strlcpy'
23350 d_strtod='$d_strtod'
23351 d_strtol='$d_strtol'
23352 d_strtold='$d_strtold'
23353 d_strtoll='$d_strtoll'
23354 d_strtoq='$d_strtoq'
23355 d_strtoul='$d_strtoul'
23356 d_strtoull='$d_strtoull'
23357 d_strtouq='$d_strtouq'
23358 d_strxfrm='$d_strxfrm'
23359 d_suidsafe='$d_suidsafe'
23360 d_symlink='$d_symlink'
23361 d_syscall='$d_syscall'
23362 d_syscallproto='$d_syscallproto'
23363 d_sysconf='$d_sysconf'
23364 d_sysernlst='$d_sysernlst'
23365 d_syserrlst='$d_syserrlst'
23366 d_system='$d_system'
23367 d_tcgetpgrp='$d_tcgetpgrp'
23368 d_tcsetpgrp='$d_tcsetpgrp'
23369 d_telldir='$d_telldir'
23370 d_telldirproto='$d_telldirproto'
23371 d_time='$d_time'
23372 d_timegm='$d_timegm'
23373 d_times='$d_times'
23374 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23375 d_tm_tm_zone='$d_tm_tm_zone'
23376 d_tmpnam_r='$d_tmpnam_r'
23377 d_truncate='$d_truncate'
23378 d_ttyname_r='$d_ttyname_r'
23379 d_tzname='$d_tzname'
23380 d_u32align='$d_u32align'
23381 d_ualarm='$d_ualarm'
23382 d_umask='$d_umask'
23383 d_uname='$d_uname'
23384 d_union_semun='$d_union_semun'
23385 d_unordered='$d_unordered'
23386 d_unsetenv='$d_unsetenv'
23387 d_usleep='$d_usleep'
23388 d_usleepproto='$d_usleepproto'
23389 d_ustat='$d_ustat'
23390 d_vendorarch='$d_vendorarch'
23391 d_vendorbin='$d_vendorbin'
23392 d_vendorlib='$d_vendorlib'
23393 d_vendorscript='$d_vendorscript'
23394 d_vfork='$d_vfork'
23395 d_void_closedir='$d_void_closedir'
23396 d_voidsig='$d_voidsig'
23397 d_voidtty='$d_voidtty'
23398 d_volatile='$d_volatile'
23399 d_vprintf='$d_vprintf'
23400 d_vsnprintf='$d_vsnprintf'
23401 d_wait4='$d_wait4'
23402 d_waitpid='$d_waitpid'
23403 d_wcstombs='$d_wcstombs'
23404 d_wctomb='$d_wctomb'
23405 d_writev='$d_writev'
23406 d_xenix='$d_xenix'
23407 date='$date'
23408 db_hashtype='$db_hashtype'
23409 db_prefixtype='$db_prefixtype'
23410 db_version_major='$db_version_major'
23411 db_version_minor='$db_version_minor'
23412 db_version_patch='$db_version_patch'
23413 direntrytype='$direntrytype'
23414 dlext='$dlext'
23415 dlsrc='$dlsrc'
23416 doublesize='$doublesize'
23417 drand01='$drand01'
23418 drand48_r_proto='$drand48_r_proto'
23419 dtrace='$dtrace'
23420 dynamic_ext='$dynamic_ext'
23421 eagain='$eagain'
23422 ebcdic='$ebcdic'
23423 echo='$echo'
23424 egrep='$egrep'
23425 emacs='$emacs'
23426 endgrent_r_proto='$endgrent_r_proto'
23427 endhostent_r_proto='$endhostent_r_proto'
23428 endnetent_r_proto='$endnetent_r_proto'
23429 endprotoent_r_proto='$endprotoent_r_proto'
23430 endpwent_r_proto='$endpwent_r_proto'
23431 endservent_r_proto='$endservent_r_proto'
23432 eunicefix='$eunicefix'
23433 exe_ext='$exe_ext'
23434 expr='$expr'
23435 extensions='$extensions'
23436 extern_C='$extern_C'
23437 extras='$extras'
23438 fflushNULL='$fflushNULL'
23439 fflushall='$fflushall'
23440 find='$find'
23441 firstmakefile='$firstmakefile'
23442 flex='$flex'
23443 fpossize='$fpossize'
23444 fpostype='$fpostype'
23445 freetype='$freetype'
23446 from='$from'
23447 full_ar='$full_ar'
23448 full_csh='$full_csh'
23449 full_sed='$full_sed'
23450 gccansipedantic='$gccansipedantic'
23451 gccosandvers='$gccosandvers'
23452 gccversion='$gccversion'
23453 getgrent_r_proto='$getgrent_r_proto'
23454 getgrgid_r_proto='$getgrgid_r_proto'
23455 getgrnam_r_proto='$getgrnam_r_proto'
23456 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23457 gethostbyname_r_proto='$gethostbyname_r_proto'
23458 gethostent_r_proto='$gethostent_r_proto'
23459 getlogin_r_proto='$getlogin_r_proto'
23460 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23461 getnetbyname_r_proto='$getnetbyname_r_proto'
23462 getnetent_r_proto='$getnetent_r_proto'
23463 getprotobyname_r_proto='$getprotobyname_r_proto'
23464 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23465 getprotoent_r_proto='$getprotoent_r_proto'
23466 getpwent_r_proto='$getpwent_r_proto'
23467 getpwnam_r_proto='$getpwnam_r_proto'
23468 getpwuid_r_proto='$getpwuid_r_proto'
23469 getservbyname_r_proto='$getservbyname_r_proto'
23470 getservbyport_r_proto='$getservbyport_r_proto'
23471 getservent_r_proto='$getservent_r_proto'
23472 getspnam_r_proto='$getspnam_r_proto'
23473 gidformat='$gidformat'
23474 gidsign='$gidsign'
23475 gidsize='$gidsize'
23476 gidtype='$gidtype'
23477 glibpth='$glibpth'
23478 gmake='$gmake'
23479 gmtime_r_proto='$gmtime_r_proto'
23480 gnulibc_version='$gnulibc_version'
23481 grep='$grep'
23482 groupcat='$groupcat'
23483 groupstype='$groupstype'
23484 gzip='$gzip'
23485 h_fcntl='$h_fcntl'
23486 h_sysfile='$h_sysfile'
23487 hint='$hint'
23488 hostcat='$hostcat'
23489 hostgenerate='$hostgenerate'
23490 hostosname='$hostosname'
23491 hostperl='$hostperl'
23492 html1dir='$html1dir'
23493 html1direxp='$html1direxp'
23494 html3dir='$html3dir'
23495 html3direxp='$html3direxp'
23496 i16size='$i16size'
23497 i16type='$i16type'
23498 i32size='$i32size'
23499 i32type='$i32type'
23500 i64size='$i64size'
23501 i64type='$i64type'
23502 i8size='$i8size'
23503 i8type='$i8type'
23504 i_arpainet='$i_arpainet'
23505 i_assert='$i_assert'
23506 i_bsdioctl='$i_bsdioctl'
23507 i_crypt='$i_crypt'
23508 i_db='$i_db'
23509 i_dbm='$i_dbm'
23510 i_dirent='$i_dirent'
23511 i_dlfcn='$i_dlfcn'
23512 i_fcntl='$i_fcntl'
23513 i_float='$i_float'
23514 i_fp='$i_fp'
23515 i_fp_class='$i_fp_class'
23516 i_gdbm='$i_gdbm'
23517 i_gdbm_ndbm='$i_gdbm_ndbm'
23518 i_gdbmndbm='$i_gdbmndbm'
23519 i_grp='$i_grp'
23520 i_ieeefp='$i_ieeefp'
23521 i_inttypes='$i_inttypes'
23522 i_langinfo='$i_langinfo'
23523 i_libutil='$i_libutil'
23524 i_limits='$i_limits'
23525 i_locale='$i_locale'
23526 i_machcthr='$i_machcthr'
23527 i_malloc='$i_malloc'
23528 i_mallocmalloc='$i_mallocmalloc'
23529 i_math='$i_math'
23530 i_memory='$i_memory'
23531 i_mntent='$i_mntent'
23532 i_ndbm='$i_ndbm'
23533 i_netdb='$i_netdb'
23534 i_neterrno='$i_neterrno'
23535 i_netinettcp='$i_netinettcp'
23536 i_niin='$i_niin'
23537 i_poll='$i_poll'
23538 i_prot='$i_prot'
23539 i_pthread='$i_pthread'
23540 i_pwd='$i_pwd'
23541 i_rpcsvcdbm='$i_rpcsvcdbm'
23542 i_sgtty='$i_sgtty'
23543 i_shadow='$i_shadow'
23544 i_socks='$i_socks'
23545 i_stdarg='$i_stdarg'
23546 i_stdbool='$i_stdbool'
23547 i_stddef='$i_stddef'
23548 i_stdlib='$i_stdlib'
23549 i_string='$i_string'
23550 i_sunmath='$i_sunmath'
23551 i_sysaccess='$i_sysaccess'
23552 i_sysdir='$i_sysdir'
23553 i_sysfile='$i_sysfile'
23554 i_sysfilio='$i_sysfilio'
23555 i_sysin='$i_sysin'
23556 i_sysioctl='$i_sysioctl'
23557 i_syslog='$i_syslog'
23558 i_sysmman='$i_sysmman'
23559 i_sysmode='$i_sysmode'
23560 i_sysmount='$i_sysmount'
23561 i_sysndir='$i_sysndir'
23562 i_sysparam='$i_sysparam'
23563 i_syspoll='$i_syspoll'
23564 i_sysresrc='$i_sysresrc'
23565 i_syssecrt='$i_syssecrt'
23566 i_sysselct='$i_sysselct'
23567 i_syssockio='$i_syssockio'
23568 i_sysstat='$i_sysstat'
23569 i_sysstatfs='$i_sysstatfs'
23570 i_sysstatvfs='$i_sysstatvfs'
23571 i_systime='$i_systime'
23572 i_systimek='$i_systimek'
23573 i_systimes='$i_systimes'
23574 i_systypes='$i_systypes'
23575 i_sysuio='$i_sysuio'
23576 i_sysun='$i_sysun'
23577 i_sysutsname='$i_sysutsname'
23578 i_sysvfs='$i_sysvfs'
23579 i_syswait='$i_syswait'
23580 i_termio='$i_termio'
23581 i_termios='$i_termios'
23582 i_time='$i_time'
23583 i_unistd='$i_unistd'
23584 i_ustat='$i_ustat'
23585 i_utime='$i_utime'
23586 i_values='$i_values'
23587 i_varargs='$i_varargs'
23588 i_varhdr='$i_varhdr'
23589 i_vfork='$i_vfork'
23590 ignore_versioned_solibs='$ignore_versioned_solibs'
23591 inc_version_list='$inc_version_list'
23592 inc_version_list_init='$inc_version_list_init'
23593 incpath='$incpath'
23594 incpth='$incpth'
23595 inews='$inews'
23596 initialinstalllocation='$initialinstalllocation'
23597 installarchlib='$installarchlib'
23598 installbin='$installbin'
23599 installhtml1dir='$installhtml1dir'
23600 installhtml3dir='$installhtml3dir'
23601 installman1dir='$installman1dir'
23602 installman3dir='$installman3dir'
23603 installprefix='$installprefix'
23604 installprefixexp='$installprefixexp'
23605 installprivlib='$installprivlib'
23606 installscript='$installscript'
23607 installsitearch='$installsitearch'
23608 installsitebin='$installsitebin'
23609 installsitehtml1dir='$installsitehtml1dir'
23610 installsitehtml3dir='$installsitehtml3dir'
23611 installsitelib='$installsitelib'
23612 installsiteman1dir='$installsiteman1dir'
23613 installsiteman3dir='$installsiteman3dir'
23614 installsitescript='$installsitescript'
23615 installstyle='$installstyle'
23616 installusrbinperl='$installusrbinperl'
23617 installvendorarch='$installvendorarch'
23618 installvendorbin='$installvendorbin'
23619 installvendorhtml1dir='$installvendorhtml1dir'
23620 installvendorhtml3dir='$installvendorhtml3dir'
23621 installvendorlib='$installvendorlib'
23622 installvendorman1dir='$installvendorman1dir'
23623 installvendorman3dir='$installvendorman3dir'
23624 installvendorscript='$installvendorscript'
23625 intsize='$intsize'
23626 issymlink='$issymlink'
23627 ivdformat='$ivdformat'
23628 ivsize='$ivsize'
23629 ivtype='$ivtype'
23630 known_extensions='$known_extensions'
23631 ksh='$ksh'
23632 ld='$ld'
23633 ld_can_script='$ld_can_script'
23634 lddlflags='$lddlflags'
23635 ldflags='$ldflags'
23636 ldflags_uselargefiles='$ldflags_uselargefiles'
23637 ldlibpthname='$ldlibpthname'
23638 less='$less'
23639 lib_ext='$lib_ext'
23640 libc='$libc'
23641 libperl='$libperl'
23642 libpth='$libpth'
23643 libs='$libs'
23644 libsdirs='$libsdirs'
23645 libsfiles='$libsfiles'
23646 libsfound='$libsfound'
23647 libspath='$libspath'
23648 libswanted='$libswanted'
23649 libswanted_uselargefiles='$libswanted_uselargefiles'
23650 line='$line'
23651 lint='$lint'
23652 lkflags='$lkflags'
23653 ln='$ln'
23654 lns='$lns'
23655 localtime_r_proto='$localtime_r_proto'
23656 locincpth='$locincpth'
23657 loclibpth='$loclibpth'
23658 longdblsize='$longdblsize'
23659 longlongsize='$longlongsize'
23660 longsize='$longsize'
23661 lp='$lp'
23662 lpr='$lpr'
23663 ls='$ls'
23664 lseeksize='$lseeksize'
23665 lseektype='$lseektype'
23666 mad='$mad'
23667 madlyh='$madlyh'
23668 madlyobj='$madlyobj'
23669 madlysrc='$madlysrc'
23670 mail='$mail'
23671 mailx='$mailx'
23672 make='$make'
23673 make_set_make='$make_set_make'
23674 mallocobj='$mallocobj'
23675 mallocsrc='$mallocsrc'
23676 malloctype='$malloctype'
23677 man1dir='$man1dir'
23678 man1direxp='$man1direxp'
23679 man1ext='$man1ext'
23680 man3dir='$man3dir'
23681 man3direxp='$man3direxp'
23682 man3ext='$man3ext'
23683 mips_type='$mips_type'
23684 mistrustnm='$mistrustnm'
23685 mkdir='$mkdir'
23686 mmaptype='$mmaptype'
23687 modetype='$modetype'
23688 more='$more'
23689 multiarch='$multiarch'
23690 mv='$mv'
23691 myarchname='$myarchname'
23692 mydomain='$mydomain'
23693 myhostname='$myhostname'
23694 myuname='$myuname'
23695 n='$n'
23696 need_va_copy='$need_va_copy'
23697 netdb_hlen_type='$netdb_hlen_type'
23698 netdb_host_type='$netdb_host_type'
23699 netdb_name_type='$netdb_name_type'
23700 netdb_net_type='$netdb_net_type'
23701 nm='$nm'
23702 nm_opt='$nm_opt'
23703 nm_so_opt='$nm_so_opt'
23704 nonxs_ext='$nonxs_ext'
23705 nroff='$nroff'
23706 nvEUformat='$nvEUformat'
23707 nvFUformat='$nvFUformat'
23708 nvGUformat='$nvGUformat'
23709 nv_overflows_integers_at='$nv_overflows_integers_at'
23710 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23711 nveformat='$nveformat'
23712 nvfformat='$nvfformat'
23713 nvgformat='$nvgformat'
23714 nvsize='$nvsize'
23715 nvtype='$nvtype'
23716 o_nonblock='$o_nonblock'
23717 obj_ext='$obj_ext'
23718 old_pthread_create_joinable='$old_pthread_create_joinable'
23719 optimize='$optimize'
23720 orderlib='$orderlib'
23721 osname='$osname'
23722 osvers='$osvers'
23723 otherlibdirs='$otherlibdirs'
23724 package='$package'
23725 pager='$pager'
23726 passcat='$passcat'
23727 patchlevel='$patchlevel'
23728 path_sep='$path_sep'
23729 perl5='$perl5'
23730 perl='$perl'
23731 perl_patchlevel='$perl_patchlevel'
23732 perl_static_inline='$perl_static_inline'
23733 perladmin='$perladmin'
23734 perllibs='$perllibs'
23735 perlpath='$perlpath'
23736 pg='$pg'
23737 phostname='$phostname'
23738 pidtype='$pidtype'
23739 plibpth='$plibpth'
23740 pmake='$pmake'
23741 pr='$pr'
23742 prefix='$prefix'
23743 prefixexp='$prefixexp'
23744 privlib='$privlib'
23745 privlibexp='$privlibexp'
23746 procselfexe='$procselfexe'
23747 prototype='$prototype'
23748 ptrsize='$ptrsize'
23749 quadkind='$quadkind'
23750 quadtype='$quadtype'
23751 randbits='$randbits'
23752 randfunc='$randfunc'
23753 random_r_proto='$random_r_proto'
23754 randseedtype='$randseedtype'
23755 ranlib='$ranlib'
23756 rd_nodata='$rd_nodata'
23757 readdir64_r_proto='$readdir64_r_proto'
23758 readdir_r_proto='$readdir_r_proto'
23759 revision='$revision'
23760 rm='$rm'
23761 rm_try='$rm_try'
23762 rmail='$rmail'
23763 run='$run'
23764 runnm='$runnm'
23765 sGMTIME_max='$sGMTIME_max'
23766 sGMTIME_min='$sGMTIME_min'
23767 sLOCALTIME_max='$sLOCALTIME_max'
23768 sLOCALTIME_min='$sLOCALTIME_min'
23769 sPRIEUldbl='$sPRIEUldbl'
23770 sPRIFUldbl='$sPRIFUldbl'
23771 sPRIGUldbl='$sPRIGUldbl'
23772 sPRIXU64='$sPRIXU64'
23773 sPRId64='$sPRId64'
23774 sPRIeldbl='$sPRIeldbl'
23775 sPRIfldbl='$sPRIfldbl'
23776 sPRIgldbl='$sPRIgldbl'
23777 sPRIi64='$sPRIi64'
23778 sPRIo64='$sPRIo64'
23779 sPRIu64='$sPRIu64'
23780 sPRIx64='$sPRIx64'
23781 sSCNfldbl='$sSCNfldbl'
23782 sched_yield='$sched_yield'
23783 scriptdir='$scriptdir'
23784 scriptdirexp='$scriptdirexp'
23785 sed='$sed'
23786 seedfunc='$seedfunc'
23787 selectminbits='$selectminbits'
23788 selecttype='$selecttype'
23789 sendmail='$sendmail'
23790 setgrent_r_proto='$setgrent_r_proto'
23791 sethostent_r_proto='$sethostent_r_proto'
23792 setlocale_r_proto='$setlocale_r_proto'
23793 setnetent_r_proto='$setnetent_r_proto'
23794 setprotoent_r_proto='$setprotoent_r_proto'
23795 setpwent_r_proto='$setpwent_r_proto'
23796 setservent_r_proto='$setservent_r_proto'
23797 sh='$sh'
23798 shar='$shar'
23799 sharpbang='$sharpbang'
23800 shmattype='$shmattype'
23801 shortsize='$shortsize'
23802 shrpenv='$shrpenv'
23803 shsharp='$shsharp'
23804 sig_count='$sig_count'
23805 sig_name='$sig_name'
23806 sig_name_init='$sig_name_init'
23807 sig_num='$sig_num'
23808 sig_num_init='$sig_num_init'
23809 sig_size='$sig_size'
23810 signal_t='$signal_t'
23811 sitearch='$sitearch'
23812 sitearchexp='$sitearchexp'
23813 sitebin='$sitebin'
23814 sitebinexp='$sitebinexp'
23815 sitehtml1dir='$sitehtml1dir'
23816 sitehtml1direxp='$sitehtml1direxp'
23817 sitehtml3dir='$sitehtml3dir'
23818 sitehtml3direxp='$sitehtml3direxp'
23819 sitelib='$sitelib'
23820 sitelib_stem='$sitelib_stem'
23821 sitelibexp='$sitelibexp'
23822 siteman1dir='$siteman1dir'
23823 siteman1direxp='$siteman1direxp'
23824 siteman3dir='$siteman3dir'
23825 siteman3direxp='$siteman3direxp'
23826 siteprefix='$siteprefix'
23827 siteprefixexp='$siteprefixexp'
23828 sitescript='$sitescript'
23829 sitescriptexp='$sitescriptexp'
23830 sizesize='$sizesize'
23831 sizetype='$sizetype'
23832 sleep='$sleep'
23833 smail='$smail'
23834 so='$so'
23835 sockethdr='$sockethdr'
23836 socketlib='$socketlib'
23837 socksizetype='$socksizetype'
23838 sort='$sort'
23839 spackage='$spackage'
23840 spitshell='$spitshell'
23841 srand48_r_proto='$srand48_r_proto'
23842 srandom_r_proto='$srandom_r_proto'
23843 src='$src'
23844 ssizetype='$ssizetype'
23845 st_ino_sign='$st_ino_sign'
23846 st_ino_size='$st_ino_size'
23847 startperl='$startperl'
23848 startsh='$startsh'
23849 static_ext='$static_ext'
23850 stdchar='$stdchar'
23851 stdio_base='$stdio_base'
23852 stdio_bufsiz='$stdio_bufsiz'
23853 stdio_cnt='$stdio_cnt'
23854 stdio_filbuf='$stdio_filbuf'
23855 stdio_ptr='$stdio_ptr'
23856 stdio_stream_array='$stdio_stream_array'
23857 strerror_r_proto='$strerror_r_proto'
23858 strings='$strings'
23859 submit='$submit'
23860 subversion='$subversion'
23861 sysman='$sysman'
23862 sysroot='$sysroot'
23863 tail='$tail'
23864 tar='$tar'
23865 targetarch='$targetarch'
23866 targetdir='$targetdir'
23867 targetenv='$targetenv'
23868 targethost='$targethost'
23869 targetmkdir='$targetmkdir'
23870 targetport='$targetport'
23871 targetsh='$targetsh'
23872 tbl='$tbl'
23873 tee='$tee'
23874 test='$test'
23875 timeincl='$timeincl'
23876 timetype='$timetype'
23877 tmpnam_r_proto='$tmpnam_r_proto'
23878 to='$to'
23879 touch='$touch'
23880 tr='$tr'
23881 trnl='$trnl'
23882 troff='$troff'
23883 ttyname_r_proto='$ttyname_r_proto'
23884 u16size='$u16size'
23885 u16type='$u16type'
23886 u32size='$u32size'
23887 u32type='$u32type'
23888 u64size='$u64size'
23889 u64type='$u64type'
23890 u8size='$u8size'
23891 u8type='$u8type'
23892 uidformat='$uidformat'
23893 uidsign='$uidsign'
23894 uidsize='$uidsize'
23895 uidtype='$uidtype'
23896 uname='$uname'
23897 uniq='$uniq'
23898 uquadtype='$uquadtype'
23899 use5005threads='$use5005threads'
23900 use64bitall='$use64bitall'
23901 use64bitint='$use64bitint'
23902 usecrosscompile='$usecrosscompile'
23903 usedevel='$usedevel'
23904 usedl='$usedl'
23905 usedtrace='$usedtrace'
23906 usefaststdio='$usefaststdio'
23907 useithreads='$useithreads'
23908 usekernprocpathname='$usekernprocpathname'
23909 uselargefiles='$uselargefiles'
23910 uselongdouble='$uselongdouble'
23911 usemallocwrap='$usemallocwrap'
23912 usemorebits='$usemorebits'
23913 usemultiplicity='$usemultiplicity'
23914 usemymalloc='$usemymalloc'
23915 usenm='$usenm'
23916 usensgetexecutablepath='$usensgetexecutablepath'
23917 useopcode='$useopcode'
23918 useperlio='$useperlio'
23919 useposix='$useposix'
23920 usereentrant='$usereentrant'
23921 userelocatableinc='$userelocatableinc'
23922 useshrplib='$useshrplib'
23923 usesitecustomize='$usesitecustomize'
23924 usesocks='$usesocks'
23925 usethreads='$usethreads'
23926 usevendorprefix='$usevendorprefix'
23927 useversionedarchname='$useversionedarchname'
23928 usevfork='$usevfork'
23929 usrinc='$usrinc'
23930 uuname='$uuname'
23931 uvXUformat='$uvXUformat'
23932 uvoformat='$uvoformat'
23933 uvsize='$uvsize'
23934 uvtype='$uvtype'
23935 uvuformat='$uvuformat'
23936 uvxformat='$uvxformat'
23937 vaproto='$vaproto'
23938 vendorarch='$vendorarch'
23939 vendorarchexp='$vendorarchexp'
23940 vendorbin='$vendorbin'
23941 vendorbinexp='$vendorbinexp'
23942 vendorhtml1dir='$vendorhtml1dir'
23943 vendorhtml1direxp='$vendorhtml1direxp'
23944 vendorhtml3dir='$vendorhtml3dir'
23945 vendorhtml3direxp='$vendorhtml3direxp'
23946 vendorlib='$vendorlib'
23947 vendorlib_stem='$vendorlib_stem'
23948 vendorlibexp='$vendorlibexp'
23949 vendorman1dir='$vendorman1dir'
23950 vendorman1direxp='$vendorman1direxp'
23951 vendorman3dir='$vendorman3dir'
23952 vendorman3direxp='$vendorman3direxp'
23953 vendorprefix='$vendorprefix'
23954 vendorprefixexp='$vendorprefixexp'
23955 vendorscript='$vendorscript'
23956 vendorscriptexp='$vendorscriptexp'
23957 version='$version'
23958 version_patchlevel_string='$version_patchlevel_string'
23959 versiononly='$versiononly'
23960 vi='$vi'
23961 xlibpth='$xlibpth'
23962 yacc='$yacc'
23963 yaccflags='$yaccflags'
23964 zcat='$zcat'
23965 zip='$zip'
23966 EOT
23967
23968 : add special variables
23969 $test -f $src/patchlevel.h && \
23970 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23971 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23972 echo "PERL_CONFIG_SH=true" >>config.sh
23973
23974 : propagate old symbols
23975 if $test -f UU/config.sh; then
23976         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23977         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23978                 config.sh config.sh UU/oldconfig.sh |\
23979                 $sort | $uniq -u >UU/oldsyms
23980         set X `$cat UU/oldsyms`
23981         shift
23982         case $# in
23983         0) ;;
23984         *)
23985                 $cat <<EOM
23986 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23987 EOM
23988                 echo ": Variables propagated from previous config.sh file." >>config.sh
23989                 for sym in `$cat UU/oldsyms`; do
23990                         echo "    Propagating $hint variable "'$'"$sym..."
23991                         eval 'tmp="$'"${sym}"'"'
23992                         echo "$tmp" | \
23993                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23994                 done
23995                 ;;
23996         esac
23997 fi
23998
23999 : Finish up by extracting the .SH files
24000 case "$alldone" in
24001 exit)
24002         $rm -rf UU
24003         echo "Extraction done."
24004         exit 0
24005         ;;
24006 cont)
24007         ;;
24008 '')
24009         dflt=''
24010         nostick=true
24011         $cat <<EOM
24012
24013 If you'd like to make any changes to the config.sh file before I begin
24014 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24015
24016 EOM
24017         rp="Press return or use a shell escape to edit config.sh:"
24018         . UU/myread
24019         nostick=''
24020         case "$ans" in
24021         '') ;;
24022         *) : in case they cannot read
24023                 sh 1>&4 -c "$ans";;
24024         esac
24025         ;;
24026 esac
24027
24028 : if this fails, just run all the .SH files by hand
24029 . ./config.sh
24030
24031 echo " "
24032 exec 1>&4
24033 pwd=`pwd`
24034 . ./UU/extract
24035 cd "$pwd"
24036
24037 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24038         dflt=y
24039         case "$silent" in
24040         true) ;;
24041         *)
24042                 $cat <<EOM
24043
24044 Now you need to generate make dependencies by running "$make depend".
24045 You might prefer to run it in background: "$make depend > makedepend.out &"
24046 It can take a while, so you might not want to run it right now.
24047
24048 EOM
24049                 ;;
24050         esac
24051         rp="Run $make depend now?"
24052         . UU/myread
24053         case "$ans" in
24054         y*)
24055                 $make depend && echo "Now you must run '$make'."
24056                 ;;
24057         *)
24058                 echo "You must run '$make depend' then '$make'."
24059                 ;;
24060         esac
24061 elif test -f [Mm]akefile; then
24062         echo " "
24063         echo "Now you must run a $make."
24064 else
24065         echo "Configure done."
24066 fi
24067
24068 if $test -f Policy.sh; then
24069     $cat <<EOM
24070
24071 If you compile $package on a different machine or from a different object
24072 directory, copy the Policy.sh file from this object directory to the
24073 new one before you run Configure -- this will help you with most of
24074 the policy defaults.
24075
24076 EOM
24077 fi
24078 if $test -f config.msg; then
24079     echo "Hmm.  I also noted the following information while running:"
24080     echo " "
24081     $cat config.msg >&4
24082     $rm -f config.msg
24083 fi
24084 $rm -f kit*isdone ark*isdone
24085 $rm -rf UU
24086
24087 : End of Configure
24088