This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
extra tests for grok_number(_flags)()
[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 using [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 ) 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_backtrace=''
389 d_bcmp=''
390 d_bcopy=''
391 d_builtin_choose_expr=''
392 d_builtin_expect=''
393 d_bzero=''
394 d_c99_variadic_macros=''
395 d_casti32=''
396 castflags=''
397 d_castneg=''
398 d_chown=''
399 d_chroot=''
400 d_chsize=''
401 d_class=''
402 d_clearenv=''
403 d_closedir=''
404 d_void_closedir=''
405 d_cmsghdr_s=''
406 d_const=''
407 d_copysignl=''
408 d_cplusplus=''
409 cryptlib=''
410 d_crypt=''
411 crypt_r_proto=''
412 d_crypt_r=''
413 d_csh=''
414 full_csh=''
415 d_ctermid=''
416 ctermid_r_proto=''
417 d_ctermid_r=''
418 ctime_r_proto=''
419 d_ctime_r=''
420 d_cuserid=''
421 d_dbl_dig=''
422 d_dbminitproto=''
423 d_difftime=''
424 d_dir_dd_fd=''
425 d_dirfd=''
426 d_dladdr=''
427 d_dlerror=''
428 d_dlopen=''
429 d_dlsymun=''
430 d_dosuid=''
431 d_suidsafe=''
432 d_drand48_r=''
433 drand48_r_proto=''
434 d_drand48proto=''
435 d_dup2=''
436 d_eaccess=''
437 d_endgrent=''
438 d_endgrent_r=''
439 endgrent_r_proto=''
440 d_endhent=''
441 d_endhostent_r=''
442 endhostent_r_proto=''
443 d_endnent=''
444 d_endnetent_r=''
445 endnetent_r_proto=''
446 d_endpent=''
447 d_endprotoent_r=''
448 endprotoent_r_proto=''
449 d_endpwent=''
450 d_endpwent_r=''
451 endpwent_r_proto=''
452 d_endsent=''
453 d_endservent_r=''
454 endservent_r_proto=''
455 d_faststdio=''
456 d_fchdir=''
457 d_fchmod=''
458 d_fchown=''
459 d_fcntl=''
460 d_fcntl_can_lock=''
461 d_fd_macros=''
462 d_fd_set=''
463 d_fds_bits=''
464 d_fgetpos=''
465 d_finite=''
466 d_finitel=''
467 d_flexfnam=''
468 d_flock=''
469 d_flockproto=''
470 d_fork=''
471 d_fp_class=''
472 d_fpclass=''
473 d_fpclassify=''
474 d_fpclassl=''
475 d_fpos64_t=''
476 d_frexpl=''
477 d_fs_data_s=''
478 d_fseeko=''
479 d_fsetpos=''
480 d_fstatfs=''
481 d_fsync=''
482 d_ftello=''
483 d_ftime=''
484 d_gettimeod=''
485 d_futimes=''
486 d_Gconvert=''
487 d_getaddrinfo=''
488 d_getcwd=''
489 d_getespwnam=''
490 d_getfsstat=''
491 d_getgrent=''
492 d_getgrent_r=''
493 getgrent_r_proto=''
494 d_getgrgid_r=''
495 getgrgid_r_proto=''
496 d_getgrnam_r=''
497 getgrnam_r_proto=''
498 d_getgrps=''
499 d_gethbyaddr=''
500 d_gethbyname=''
501 d_gethent=''
502 aphostname=''
503 d_gethname=''
504 d_phostname=''
505 d_uname=''
506 d_gethostbyaddr_r=''
507 gethostbyaddr_r_proto=''
508 d_gethostbyname_r=''
509 gethostbyname_r_proto=''
510 d_gethostent_r=''
511 gethostent_r_proto=''
512 d_gethostprotos=''
513 d_getitimer=''
514 d_getlogin=''
515 d_getlogin_r=''
516 getlogin_r_proto=''
517 d_getmnt=''
518 d_getmntent=''
519 d_getnameinfo=''
520 d_getnbyaddr=''
521 d_getnbyname=''
522 d_getnent=''
523 d_getnetbyaddr_r=''
524 getnetbyaddr_r_proto=''
525 d_getnetbyname_r=''
526 getnetbyname_r_proto=''
527 d_getnetent_r=''
528 getnetent_r_proto=''
529 d_getnetprotos=''
530 d_getpagsz=''
531 d_getpent=''
532 d_getpgid=''
533 d_getpgrp2=''
534 d_bsdgetpgrp=''
535 d_getpgrp=''
536 d_getppid=''
537 d_getprior=''
538 d_getpbyname=''
539 d_getpbynumber=''
540 d_getprotobyname_r=''
541 getprotobyname_r_proto=''
542 d_getprotobynumber_r=''
543 getprotobynumber_r_proto=''
544 d_getprotoent_r=''
545 getprotoent_r_proto=''
546 d_getprotoprotos=''
547 d_getprpwnam=''
548 d_getpwent=''
549 d_getpwent_r=''
550 getpwent_r_proto=''
551 d_getpwnam_r=''
552 getpwnam_r_proto=''
553 d_getpwuid_r=''
554 getpwuid_r_proto=''
555 d_getsent=''
556 d_getservbyname_r=''
557 getservbyname_r_proto=''
558 d_getservbyport_r=''
559 getservbyport_r_proto=''
560 d_getservent_r=''
561 getservent_r_proto=''
562 d_getservprotos=''
563 d_getspnam=''
564 d_getspnam_r=''
565 getspnam_r_proto=''
566 d_getsbyname=''
567 d_getsbyport=''
568 d_gmtime_r=''
569 gmtime_r_proto=''
570 d_gnulibc=''
571 gnulibc_version=''
572 d_hasmntopt=''
573 d_htonl=''
574 d_ilogbl=''
575 d_inetaton=''
576 d_inetntop=''
577 d_inetpton=''
578 d_int64_t=''
579 d_isascii=''
580 d_isblank=''
581 d_isfinite=''
582 d_isinf=''
583 d_isnan=''
584 d_isnanl=''
585 d_killpg=''
586 d_lchown=''
587 d_ldbl_dig=''
588 d_libm_lib_version=''
589 d_link=''
590 d_localtime_r=''
591 d_localtime_r_needs_tzset=''
592 localtime_r_proto=''
593 d_locconv=''
594 d_lockf=''
595 d_longdbl=''
596 longdblsize=''
597 d_longlong=''
598 longlongsize=''
599 d_lseekproto=''
600 d_lstat=''
601 d_madvise=''
602 d_malloc_good_size=''
603 d_malloc_size=''
604 d_mblen=''
605 d_mbstowcs=''
606 d_mbtowc=''
607 d_memchr=''
608 d_memcmp=''
609 d_memcpy=''
610 d_memmove=''
611 d_memset=''
612 d_mkdir=''
613 d_mkdtemp=''
614 d_mkfifo=''
615 d_mkstemp=''
616 d_mkstemps=''
617 d_mktime=''
618 d_mmap=''
619 mmaptype=''
620 d_modfl=''
621 d_modfl_pow32_bug=''
622 d_modflproto=''
623 d_mprotect=''
624 d_msg=''
625 d_msgctl=''
626 d_msgget=''
627 d_msghdr_s=''
628 d_msgrcv=''
629 d_msgsnd=''
630 d_msync=''
631 d_munmap=''
632 d_nice=''
633 d_nl_langinfo=''
634 d_off64_t=''
635 d_open3=''
636 d_fpathconf=''
637 d_pathconf=''
638 d_pause=''
639 d_pipe=''
640 d_poll=''
641 d_portable=''
642 d_prctl=''
643 d_prctl_set_name=''
644 d_procselfexe=''
645 procselfexe=''
646 d_old_pthread_create_joinable=''
647 old_pthread_create_joinable=''
648 d_pthread_atfork=''
649 d_pthread_attr_setscope=''
650 d_pthread_yield=''
651 d_sched_yield=''
652 sched_yield=''
653 d_qgcvt=''
654 d_random_r=''
655 random_r_proto=''
656 d_readdir64_r=''
657 readdir64_r_proto=''
658 d_readdir=''
659 d_rewinddir=''
660 d_seekdir=''
661 d_telldir=''
662 d_readdir_r=''
663 readdir_r_proto=''
664 d_readlink=''
665 d_readv=''
666 d_recvmsg=''
667 d_rename=''
668 d_rmdir=''
669 d_safebcpy=''
670 d_safemcpy=''
671 d_sanemcmp=''
672 d_sbrkproto=''
673 d_scalbnl=''
674 d_select=''
675 d_sem=''
676 d_semctl=''
677 d_semget=''
678 d_semop=''
679 d_sendmsg=''
680 d_setegid=''
681 d_seteuid=''
682 d_setgrent=''
683 d_setgrent_r=''
684 setgrent_r_proto=''
685 d_setgrps=''
686 d_sethent=''
687 d_sethostent_r=''
688 sethostent_r_proto=''
689 d_setitimer=''
690 d_setlinebuf=''
691 d_setlocale=''
692 d_setlocale_r=''
693 setlocale_r_proto=''
694 d_setnent=''
695 d_setnetent_r=''
696 setnetent_r_proto=''
697 d_setpent=''
698 d_setpgid=''
699 d_setpgrp2=''
700 d_bsdsetpgrp=''
701 d_setpgrp=''
702 d_setprior=''
703 d_setproctitle=''
704 d_setprotoent_r=''
705 setprotoent_r_proto=''
706 d_setpwent=''
707 d_setpwent_r=''
708 setpwent_r_proto=''
709 d_setregid=''
710 d_setresgid=''
711 d_setresuid=''
712 d_setreuid=''
713 d_setrgid=''
714 d_setruid=''
715 d_setsent=''
716 d_setservent_r=''
717 setservent_r_proto=''
718 d_setsid=''
719 d_setvbuf=''
720 d_shm=''
721 d_shmat=''
722 d_shmatprototype=''
723 shmattype=''
724 d_shmctl=''
725 d_shmdt=''
726 d_shmget=''
727 d_sigaction=''
728 d_signbit=''
729 d_sigprocmask=''
730 d_sigsetjmp=''
731 usesitecustomize=''
732 d_snprintf=''
733 d_vsnprintf=''
734 d_sockatmark=''
735 d_sockatmarkproto=''
736 d_ip_mreq=''
737 d_ip_mreq_source=''
738 d_ipv6_mreq=''
739 d_ipv6_mreq_source=''
740 d_msg_ctrunc=''
741 d_msg_dontroute=''
742 d_msg_oob=''
743 d_msg_peek=''
744 d_msg_proxy=''
745 d_oldsock=''
746 d_scm_rights=''
747 d_sin6_scope_id=''
748 d_sockaddr_in6=''
749 d_sockaddr_sa_len=''
750 d_socket=''
751 d_sockpair=''
752 sockethdr=''
753 socketlib=''
754 d_socklen_t=''
755 d_socks5_init=''
756 d_sprintf_returns_strlen=''
757 d_sqrtl=''
758 d_srand48_r=''
759 srand48_r_proto=''
760 d_srandom_r=''
761 srandom_r_proto=''
762 d_sresgproto=''
763 d_sresuproto=''
764 d_statblks=''
765 d_statfs_f_flags=''
766 d_statfs_s=''
767 d_static_inline=''
768 perl_static_inline=''
769 d_fstatvfs=''
770 d_statvfs=''
771 d_stdio_cnt_lval=''
772 d_stdio_ptr_lval=''
773 d_stdio_ptr_lval_nochange_cnt=''
774 d_stdio_ptr_lval_sets_cnt=''
775 d_stdiobase=''
776 d_stdstdio=''
777 stdio_base=''
778 stdio_bufsiz=''
779 stdio_cnt=''
780 stdio_filbuf=''
781 stdio_ptr=''
782 d_index=''
783 d_strchr=''
784 d_strcoll=''
785 d_strctcpy=''
786 d_strerrm=''
787 d_strerror=''
788 d_sysernlst=''
789 d_syserrlst=''
790 d_strerror_r=''
791 strerror_r_proto=''
792 d_strftime=''
793 d_strlcat=''
794 d_strlcpy=''
795 d_strtod=''
796 d_strtol=''
797 d_strtold=''
798 d_strtoll=''
799 d_strtoq=''
800 d_strtoul=''
801 d_strtoull=''
802 d_strtouq=''
803 d_strxfrm=''
804 d_symlink=''
805 d_syscall=''
806 d_syscallproto=''
807 d_sysconf=''
808 d_system=''
809 d_tcgetpgrp=''
810 d_tcsetpgrp=''
811 d_telldirproto=''
812 d_time=''
813 timetype=''
814 d_asctime64=''
815 d_ctime64=''
816 d_difftime64=''
817 d_gmtime64=''
818 d_localtime64=''
819 d_mktime64=''
820 d_timegm=''
821 clocktype=''
822 d_times=''
823 d_tmpnam_r=''
824 tmpnam_r_proto=''
825 d_truncate=''
826 d_ttyname_r=''
827 ttyname_r_proto=''
828 d_tzname=''
829 d_u32align=''
830 d_ualarm=''
831 d_umask=''
832 d_semctl_semid_ds=''
833 d_semctl_semun=''
834 d_union_semun=''
835 d_unordered=''
836 d_unsetenv=''
837 d_usleep=''
838 d_usleepproto=''
839 d_ustat=''
840 d_pseudofork=''
841 d_vfork=''
842 usevfork=''
843 d_voidsig=''
844 signal_t=''
845 d_volatile=''
846 d_charvspr=''
847 d_vprintf=''
848 d_wait4=''
849 d_waitpid=''
850 d_wcscmp=''
851 d_wcstombs=''
852 d_wcsxfrm=''
853 d_wctomb=''
854 d_writev=''
855 dlext=''
856 bin_ELF=''
857 cccdlflags=''
858 ccdlflags=''
859 dlsrc=''
860 ld=''
861 ld_can_script=''
862 lddlflags=''
863 usedl=''
864 doublesize=''
865 ebcdic=''
866 fflushNULL=''
867 fflushall=''
868 fpossize=''
869 fpostype=''
870 gccansipedantic=''
871 gccosandvers=''
872 gccversion=''
873 gidformat=''
874 gidsign=''
875 gidsize=''
876 gidtype=''
877 groupstype=''
878 h_fcntl=''
879 h_sysfile=''
880 html1dir=''
881 html1direxp=''
882 installhtml1dir=''
883 html3dir=''
884 html3direxp=''
885 installhtml3dir=''
886 i_arpainet=''
887 i_assert=''
888 i_bfd=''
889 i_crypt=''
890 db_hashtype=''
891 db_prefixtype=''
892 db_version_major=''
893 db_version_minor=''
894 db_version_patch=''
895 i_db=''
896 i_dbm=''
897 i_rpcsvcdbm=''
898 d_dirnamlen=''
899 direntrytype=''
900 i_dirent=''
901 i_dlfcn=''
902 i_execinfo=''
903 i_fcntl=''
904 i_float=''
905 i_fp=''
906 i_fp_class=''
907 i_gdbm=''
908 d_grpasswd=''
909 i_grp=''
910 i_ieeefp=''
911 i_inttypes=''
912 i_langinfo=''
913 i_libutil=''
914 i_limits=''
915 i_locale=''
916 i_machcthr=''
917 i_malloc=''
918 i_mallocmalloc=''
919 i_math=''
920 i_memory=''
921 i_mntent=''
922 d_gdbm_ndbm_h_uses_prototypes=''
923 d_gdbmndbm_h_uses_prototypes=''
924 d_ndbm=''
925 d_ndbm_h_uses_prototypes=''
926 i_gdbm_ndbm=''
927 i_gdbmndbm=''
928 i_ndbm=''
929 i_netdb=''
930 i_neterrno=''
931 i_netinettcp=''
932 i_niin=''
933 i_sysin=''
934 i_poll=''
935 i_prot=''
936 i_pthread=''
937 d_ptrdiff_t=''
938 d_pwage=''
939 d_pwchange=''
940 d_pwclass=''
941 d_pwcomment=''
942 d_pwexpire=''
943 d_pwgecos=''
944 d_pwpasswd=''
945 d_pwquota=''
946 i_pwd=''
947 i_shadow=''
948 i_socks=''
949 i_stdbool=''
950 i_stddef=''
951 i_stdlib=''
952 i_string=''
953 strings=''
954 i_sunmath=''
955 i_sysaccess=''
956 i_sysdir=''
957 i_sysfile=''
958 d_voidtty=''
959 i_bsdioctl=''
960 i_sysfilio=''
961 i_sysioctl=''
962 i_syssockio=''
963 i_syslog=''
964 i_sysmman=''
965 i_sysmode=''
966 i_sysmount=''
967 i_sysndir=''
968 i_sysparam=''
969 i_syspoll=''
970 i_sysresrc=''
971 i_syssecrt=''
972 i_sysselct=''
973 i_sysstat=''
974 i_sysstatfs=''
975 i_sysstatvfs=''
976 i_systimes=''
977 i_systypes=''
978 i_sysuio=''
979 i_sysun=''
980 i_sysutsname=''
981 i_sysvfs=''
982 i_syswait=''
983 i_sgtty=''
984 i_termio=''
985 i_termios=''
986 d_tm_tm_gmtoff=''
987 d_tm_tm_zone=''
988 i_systime=''
989 i_systimek=''
990 i_time=''
991 timeincl=''
992 i_unistd=''
993 i_ustat=''
994 i_utime=''
995 i_values=''
996 i_stdarg=''
997 i_varargs=''
998 i_varhdr=''
999 i_vfork=''
1000 d_inc_version_list=''
1001 inc_version_list=''
1002 inc_version_list_init=''
1003 installprefix=''
1004 installprefixexp=''
1005 installstyle=''
1006 installusrbinperl=''
1007 intsize=''
1008 longsize=''
1009 shortsize=''
1010 issymlink=''
1011 libc=''
1012 ldlibpthname=''
1013 libperl=''
1014 shrpenv=''
1015 useshrplib=''
1016 glibpth=''
1017 incpth=''
1018 libpth=''
1019 loclibpth=''
1020 plibpth=''
1021 xlibpth=''
1022 ignore_versioned_solibs=''
1023 libs=''
1024 libsdirs=''
1025 libsfiles=''
1026 libsfound=''
1027 libspath=''
1028 lns=''
1029 d_PRIEUldbl=''
1030 d_PRIFUldbl=''
1031 d_PRIGUldbl=''
1032 d_PRIeldbl=''
1033 d_PRIfldbl=''
1034 d_PRIgldbl=''
1035 d_SCNfldbl=''
1036 sPRIEUldbl=''
1037 sPRIFUldbl=''
1038 sPRIGUldbl=''
1039 sPRIeldbl=''
1040 sPRIfldbl=''
1041 sPRIgldbl=''
1042 sSCNfldbl=''
1043 lseeksize=''
1044 lseektype=''
1045 make_set_make=''
1046 d_mymalloc=''
1047 freetype=''
1048 mallocobj=''
1049 mallocsrc=''
1050 malloctype=''
1051 usemallocwrap=''
1052 usemymalloc=''
1053 installman1dir=''
1054 man1dir=''
1055 man1direxp=''
1056 man1ext=''
1057 installman3dir=''
1058 man3dir=''
1059 man3direxp=''
1060 man3ext=''
1061 modetype=''
1062 multiarch=''
1063 mydomain=''
1064 myhostname=''
1065 phostname=''
1066 c=''
1067 n=''
1068 d_eofnblk=''
1069 eagain=''
1070 o_nonblock=''
1071 rd_nodata=''
1072 need_va_copy=''
1073 netdb_hlen_type=''
1074 netdb_host_type=''
1075 netdb_name_type=''
1076 netdb_net_type=''
1077 groupcat=''
1078 hostcat=''
1079 passcat=''
1080 orderlib=''
1081 ranlib=''
1082 d_perl_otherlibdirs=''
1083 otherlibdirs=''
1084 package=''
1085 spackage=''
1086 pager=''
1087 api_revision=''
1088 api_subversion=''
1089 api_version=''
1090 api_versionstring=''
1091 patchlevel=''
1092 perl_patchlevel=''
1093 revision=''
1094 subversion=''
1095 version=''
1096 version_patchlevel_string=''
1097 perl5=''
1098 perladmin=''
1099 perlpath=''
1100 d_nv_preserves_uv=''
1101 d_nv_zero_is_allbits_zero=''
1102 i16size=''
1103 i16type=''
1104 i32size=''
1105 i32type=''
1106 i64size=''
1107 i64type=''
1108 i8size=''
1109 i8type=''
1110 ivsize=''
1111 ivtype=''
1112 nv_overflows_integers_at=''
1113 nv_preserves_uv_bits=''
1114 nvsize=''
1115 nvtype=''
1116 u16size=''
1117 u16type=''
1118 u32size=''
1119 u32type=''
1120 u64size=''
1121 u64type=''
1122 u8size=''
1123 u8type=''
1124 uvsize=''
1125 uvtype=''
1126 ivdformat=''
1127 nvEUformat=''
1128 nvFUformat=''
1129 nvGUformat=''
1130 nveformat=''
1131 nvfformat=''
1132 nvgformat=''
1133 uvXUformat=''
1134 uvoformat=''
1135 uvuformat=''
1136 uvxformat=''
1137 pidtype=''
1138 prefix=''
1139 prefixexp=''
1140 installprivlib=''
1141 privlib=''
1142 privlibexp=''
1143 prototype=''
1144 ptrsize=''
1145 d_PRIXU64=''
1146 d_PRId64=''
1147 d_PRIi64=''
1148 d_PRIo64=''
1149 d_PRIu64=''
1150 d_PRIx64=''
1151 sPRIXU64=''
1152 sPRId64=''
1153 sPRIi64=''
1154 sPRIo64=''
1155 sPRIu64=''
1156 sPRIx64=''
1157 d_quad=''
1158 quadkind=''
1159 quadtype=''
1160 uquadtype=''
1161 drand01=''
1162 randbits=''
1163 randfunc=''
1164 randseedtype=''
1165 seedfunc=''
1166 installscript=''
1167 scriptdir=''
1168 scriptdirexp=''
1169 selectminbits=''
1170 selecttype=''
1171 sh=''
1172 targetsh=''
1173 sig_count=''
1174 sig_name=''
1175 sig_name_init=''
1176 sig_num=''
1177 sig_num_init=''
1178 sig_size=''
1179 d_sitearch=''
1180 installsitearch=''
1181 sitearch=''
1182 sitearchexp=''
1183 installsitebin=''
1184 sitebin=''
1185 sitebinexp=''
1186 installsitehtml1dir=''
1187 sitehtml1dir=''
1188 sitehtml1direxp=''
1189 installsitehtml3dir=''
1190 sitehtml3dir=''
1191 sitehtml3direxp=''
1192 installsitelib=''
1193 sitelib=''
1194 sitelib_stem=''
1195 sitelibexp=''
1196 installsiteman1dir=''
1197 siteman1dir=''
1198 siteman1direxp=''
1199 installsiteman3dir=''
1200 siteman3dir=''
1201 siteman3direxp=''
1202 siteprefix=''
1203 siteprefixexp=''
1204 installsitescript=''
1205 sitescript=''
1206 sitescriptexp=''
1207 sizesize=''
1208 sizetype=''
1209 d_libname_unique=''
1210 so=''
1211 socksizetype=''
1212 sharpbang=''
1213 shsharp=''
1214 spitshell=''
1215 src=''
1216 ssizetype=''
1217 st_ino_sign=''
1218 st_ino_size=''
1219 startperl=''
1220 startsh=''
1221 stdchar=''
1222 d_stdio_stream_array=''
1223 stdio_stream_array=''
1224 sysman=''
1225 sGMTIME_max=''
1226 sGMTIME_min=''
1227 sLOCALTIME_max=''
1228 sLOCALTIME_min=''
1229 trnl=''
1230 uidformat=''
1231 uidsign=''
1232 uidsize=''
1233 uidtype=''
1234 archname64=''
1235 use64bitall=''
1236 use64bitint=''
1237 usecbacktrace=''
1238 dtrace=''
1239 usedtrace=''
1240 usefaststdio=''
1241 usekernprocpathname=''
1242 ccflags_uselargefiles=''
1243 ldflags_uselargefiles=''
1244 libswanted_uselargefiles=''
1245 uselargefiles=''
1246 uselongdouble=''
1247 usemorebits=''
1248 usemultiplicity=''
1249 nm_opt=''
1250 nm_so_opt=''
1251 runnm=''
1252 usenm=''
1253 usensgetexecutablepath=''
1254 useperlio=''
1255 usesocks=''
1256 d_oldpthreads=''
1257 use5005threads=''
1258 useithreads=''
1259 usereentrant=''
1260 usethreads=''
1261 incpath=''
1262 mips_type=''
1263 usrinc=''
1264 vaproto=''
1265 d_vendorarch=''
1266 installvendorarch=''
1267 vendorarch=''
1268 vendorarchexp=''
1269 d_vendorbin=''
1270 installvendorbin=''
1271 vendorbin=''
1272 vendorbinexp=''
1273 installvendorhtml1dir=''
1274 vendorhtml1dir=''
1275 vendorhtml1direxp=''
1276 installvendorhtml3dir=''
1277 vendorhtml3dir=''
1278 vendorhtml3direxp=''
1279 d_vendorlib=''
1280 installvendorlib=''
1281 vendorlib=''
1282 vendorlib_stem=''
1283 vendorlibexp=''
1284 installvendorman1dir=''
1285 vendorman1dir=''
1286 vendorman1direxp=''
1287 installvendorman3dir=''
1288 vendorman3dir=''
1289 vendorman3direxp=''
1290 usevendorprefix=''
1291 vendorprefix=''
1292 vendorprefixexp=''
1293 d_vendorscript=''
1294 installvendorscript=''
1295 vendorscript=''
1296 vendorscriptexp=''
1297 versiononly=''
1298 yacc=''
1299 yaccflags=''
1300 CONFIG=''
1301
1302 : Detect odd OSs
1303 define='define'
1304 undef='undef'
1305 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1306 rmlist=''
1307
1308 : We must find out about Eunice early
1309 eunicefix=':'
1310 if test -f /etc/unixtovms; then
1311         eunicefix=/etc/unixtovms
1312 fi
1313 if test -f /etc/unixtovms.exe; then
1314         eunicefix=/etc/unixtovms.exe
1315 fi
1316
1317 : Set executable suffix now -- needed before hints available
1318 if test -f "/libs/version.library"; then
1319 : Amiga OS
1320     _exe=""
1321 elif test -f "/system/gnu_library/bin/ar.pm"; then
1322 : Stratus VOS
1323     _exe=".pm"
1324 elif test -n "$DJGPP"; then
1325 : DOS DJGPP
1326     _exe=".exe"
1327 elif test -f /kern/cookiejar; then
1328 : MiNT
1329     _exe=""
1330 elif test -d c:/. -o -n "$is_os2" ; then
1331 : OS/2 or cygwin
1332     _exe=".exe"
1333 fi
1334
1335 groupstype=''
1336 i_whoami=''
1337 : Trailing extension.  Override this in a hint file, if needed.
1338 : Extra object files, if any, needed on this platform.
1339 archobjs=''
1340 archname=''
1341 : Possible local include directories to search.
1342 : Set locincpth to "" in a hint file to defeat local include searches.
1343 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1344 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1345 :
1346 : no include file wanted by default
1347 inclwanted=''
1348
1349 : Enable -DEBUGGING and -DDEBUGGING from the command line
1350 EBUGGING=''
1351 DEBUGGING=''
1352
1353 libnames=''
1354 : change the next line if compiling for Xenix/286 on Xenix/386
1355 xlibpth='/usr/lib/386 /lib/386'
1356 : Possible local library directories to search.
1357 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1358 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1359
1360 : general looking path for locating libraries
1361 glibpth="/lib /usr/lib $xlibpth"
1362 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1363 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1364 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1365 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1366
1367 : Private path used by Configure to find libraries.  Its value
1368 : is prepended to libpth. This variable takes care of special
1369 : machines, like the mips.  Usually, it should be empty.
1370 plibpth=''
1371
1372 : default library list
1373 libswanted=''
1374 : some systems want to use only the non-versioned libso:s
1375 ignore_versioned_solibs=''
1376 : set usethreads on the Configure command line to enable threads.
1377 usereentrant='undef'
1378 ccname=''
1379 ccversion=''
1380 perllibs=''
1381 : set useposix=false in your hint file to disable the POSIX extension.
1382 useposix=true
1383 : set useopcode=false in your hint file to disable the Opcode extension.
1384 useopcode=true
1385 archname64=''
1386 ccflags_uselargefiles=''
1387 ldflags_uselargefiles=''
1388 libswanted_uselargefiles=''
1389 : set usemultiplicity on the Configure command line to enable multiplicity.
1390 : set usesocks on the Configure command line to enable socks.
1391 : List of libraries we want.
1392 : If anyone needs extra -lxxx, put those in a hint file.
1393 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1394 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1395 : We probably want to search /usr/shlib before most other libraries.
1396 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1397 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1398 glibpth="/usr/shlib $glibpth"
1399 : Do not use vfork unless overridden by a hint file.
1400 usevfork=false
1401
1402 : Find the basic shell for Bourne shell scripts
1403 case "$sh" in
1404 '')
1405         case "$SYSTYPE" in
1406         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1407         *) xxx='/bin/sh';;
1408         esac
1409         if test -f "$xxx"; then
1410                 sh="$xxx"
1411         else
1412                 : Build up a list and do a single loop so we can 'break' out.
1413                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1414                 for xxx in sh bash ksh pdksh ash; do
1415                         for p in $pth; do
1416                                 try="$try ${p}/${xxx}"
1417                         done
1418                 done
1419                 for xxx in $try; do
1420                         if test -f "$xxx"; then
1421                                 sh="$xxx";
1422                                 break
1423                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1424                                 sh="$xxx";
1425                                 break
1426                         elif test -f "$xxx.exe"; then
1427                                 sh="$xxx";
1428                                 break
1429                         fi
1430                 done
1431         fi
1432         ;;
1433 esac
1434
1435 case "$sh" in
1436 '')     cat >&2 <<EOM
1437 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1438
1439 Usually it's in /bin/sh.  How did you even get this far?
1440 Please contact me (Perl Maintainers) at perlbug@perl.org and
1441 we'll try to straighten this all out.
1442 EOM
1443         exit 1
1444         ;;
1445 esac
1446
1447 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1448 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1449 targetsh=$sh
1450
1451 : see if sh knows # comments
1452 if `$sh -c '#' >/dev/null 2>&1`; then
1453         shsharp=true
1454         spitshell=cat
1455         xcat=/bin/cat
1456         test -f $xcat$_exe || xcat=/usr/bin/cat
1457         if test ! -f $xcat$_exe; then
1458                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1459                         if test -f $p/cat$_exe; then
1460                                 xcat=$p/cat
1461                                 break
1462                         fi
1463                 done
1464                 if test ! -f $xcat$_exe; then
1465                         echo "Can't find cat anywhere!"
1466                         exit 1
1467                 fi
1468         fi
1469         echo "#!$xcat" >sharp
1470         $eunicefix sharp
1471         chmod +x sharp
1472         ./sharp > today 2>/dev/null
1473         if test -s today; then
1474                 sharpbang='#!'
1475         else
1476                 echo "#! $xcat" > sharp
1477                 $eunicefix sharp
1478                 chmod +x sharp
1479                 ./sharp > today 2>/dev/null
1480                 if test -s today; then
1481                         sharpbang='#! '
1482                 else
1483                         sharpbang=': use '
1484                 fi
1485         fi
1486 else
1487         echo " "
1488         echo "Your $sh doesn't grok # comments--I will strip them later on."
1489         shsharp=false
1490         cd ..
1491         echo "exec grep -v '^[  ]*#'" >spitshell
1492         chmod +x spitshell
1493         $eunicefix spitshell
1494         spitshell=`pwd`/spitshell
1495         cd UU
1496         echo "I presume that if # doesn't work, #! won't work either!"
1497         sharpbang=': use '
1498 fi
1499 rm -f sharp today
1500
1501 : figure out how to guarantee sh startup
1502 case "$startsh" in
1503 '') startsh=${sharpbang}${sh} ;;
1504 *)
1505 esac
1506 cat >sharp <<EOSS
1507 $startsh
1508 set abc
1509 test "$?abc" != 1
1510 EOSS
1511
1512 chmod +x sharp
1513 $eunicefix sharp
1514 if ./sharp; then
1515         : echo "Yup, it does."
1516 else
1517         echo "Hmm... '$startsh' does not guarantee sh startup..."
1518         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1519 fi
1520 rm -f sharp
1521
1522 : Save command line options in file UU/cmdline.opt for later use in
1523 : generating config.sh.
1524 cat > cmdline.opt <<EOSH
1525 : Configure command line arguments.
1526 config_arg0='$0'
1527 config_args='$*'
1528 config_argc=$#
1529 EOSH
1530 argn=1
1531 args_exp=''
1532 args_sep=''
1533 for arg in "$@"; do
1534         cat >>cmdline.opt <<EOSH
1535 config_arg$argn='$arg'
1536 EOSH
1537         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1538 $arg
1539 EOC
1540         arg_exp=`cat cmdl.opt`
1541         args_exp="$args_exp$args_sep'$arg_exp'"
1542         argn=`expr $argn + 1`
1543         args_sep=' '
1544 done
1545 rm -f cmdl.opt
1546
1547 : produce awk script to parse command line options
1548 cat >options.awk <<'EOF'
1549 BEGIN {
1550         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1551
1552         len = length(optstr);
1553         for (i = 1; i <= len; i++) {
1554                 c = substr(optstr, i, 1);
1555                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1556                 if (a == ":") {
1557                         arg[c] = 1;
1558                         i++;
1559                 }
1560                 opt[c] = 1;
1561         }
1562 }
1563 {
1564         expect = 0;
1565         str = $0;
1566         if (substr(str, 1, 1) != "-") {
1567                 printf("'%s'\n", str);
1568                 next;
1569         }
1570         len = length($0);
1571         for (i = 2; i <= len; i++) {
1572                 c = substr(str, i, 1);
1573                 if (!opt[c]) {
1574                         printf("-%s\n", substr(str, i));
1575                         next;
1576                 }
1577                 printf("-%s\n", c);
1578                 if (arg[c]) {
1579                         if (i < len)
1580                                 printf("'%s'\n", substr(str, i + 1));
1581                         else
1582                                 expect = 1;
1583                         next;
1584                 }
1585         }
1586 }
1587 END {
1588         if (expect)
1589                 print "?";
1590 }
1591 EOF
1592
1593 : process the command line options
1594 set X `for arg in "$@"; do echo "X$arg"; done |
1595         sed -e s/X// | awk -f options.awk`
1596 eval "set $*"
1597 shift
1598 rm -f options.awk
1599
1600 : set up default values
1601 fastread=''
1602 reuseval=false
1603 config_sh=''
1604 alldone=''
1605 error=''
1606 silent=''
1607 extractsh=''
1608 override=''
1609 knowitall=''
1610 rm -f optdef.sh posthint.sh
1611 cat >optdef.sh <<EOS
1612 $startsh
1613 EOS
1614
1615
1616 : option parsing
1617 while test $# -gt 0; do
1618         case "$1" in
1619         -d) shift; fastread=yes;;
1620         -e) shift; alldone=cont;;
1621         -f)
1622                 shift
1623                 cd ..
1624                 if test -r "$1"; then
1625                         config_sh="$1"
1626                 else
1627                         echo "$me: cannot read config file $1." >&2
1628                         error=true
1629                 fi
1630                 cd UU
1631                 shift;;
1632         --help|\
1633         -h) shift; error=true;;
1634         -r) shift; reuseval=true;;
1635         -s) shift; silent=true; realsilent=true;;
1636         -E) shift; alldone=exit;;
1637         -K) shift; knowitall=true;;
1638         -O) shift; override=true;;
1639         -S) shift; silent=true; extractsh=true;;
1640         -D)
1641                 shift
1642                 case "$1" in
1643                 *=)
1644                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1645                         echo "$me: ignoring -D $1" >&2
1646                         ;;
1647                 *=*) echo "$1" | \
1648                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1649                 *) echo "$1='define'" >> optdef.sh;;
1650                 esac
1651                 shift
1652                 ;;
1653         -U)
1654                 shift
1655                 case "$1" in
1656                 *=) echo "$1" >> optdef.sh;;
1657                 *=*)
1658                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1659                         echo "$me: ignoring -U $1" >&2
1660                         ;;
1661                 *) echo "$1='undef'" >> optdef.sh;;
1662                 esac
1663                 shift
1664                 ;;
1665         -A)
1666             shift
1667             xxx=''
1668             yyy="$1"
1669             zzz=''
1670             uuu=undef
1671             case "$yyy" in
1672             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1673                  case "$zzz" in
1674                  *:*) zzz='' ;;
1675                  *)   xxx=append
1676                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1677                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1678                  esac
1679                  ;;
1680             esac
1681             case "$xxx" in
1682             '')  case "$yyy" in
1683                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1684                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1685                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1686                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1687                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1688                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1689                  esac
1690                  ;;
1691             esac
1692             case "$xxx" in
1693             append)
1694                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1695             clear)
1696                 echo "$yyy=''"                  >> posthint.sh ;;
1697             define)
1698                 case "$zzz" in
1699                 '') zzz=define ;;
1700                 esac
1701                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1702             eval)
1703                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1704             prepend)
1705                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1706             undef)
1707                 case "$zzz" in
1708                 '') zzz="$uuu" ;;
1709                 esac
1710                 echo "$yyy=$zzz"                >> posthint.sh ;;
1711             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1712             esac
1713             shift
1714             ;;
1715         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1716             exit 0;;
1717         --) break;;
1718         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1719         *) break;;
1720         esac
1721 done
1722
1723 case "$error" in
1724 true)
1725         cat >&2 <<EOM
1726 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1727                  [-U symbol] [-U symbol=] [-A command:symbol...]
1728   -d : use defaults for all answers.
1729   -e : go on without questioning past the production of config.sh.
1730   -f : specify an alternate default configuration file.
1731   -h : print this help message and exit (with an error status).
1732   -r : reuse C symbols value if possible (skips costly nm extraction).
1733   -s : silent mode, only echoes questions and essential information.
1734   -D : define symbol to have some value:
1735          -D symbol         symbol gets the value 'define'
1736          -D symbol=value   symbol gets the value 'value'
1737        common used examples (see INSTALL for more info):
1738          -Duse64bitint            use 64bit integers
1739          -Duse64bitall            use 64bit integers and pointers
1740          -Dusethreads             use thread support
1741          -Dinc_version_list=none  do not include older perl trees in @INC
1742          -DEBUGGING=none          DEBUGGING options
1743          -Dcc=gcc                 choose your compiler
1744          -Dprefix=/opt/perl5      choose your destination
1745   -E : stop at the end of questions, after having produced config.sh.
1746   -K : do not use unless you know what you are doing.
1747   -O : let -D and -U override definitions from loaded configuration file.
1748   -S : perform variable substitutions on all .SH files (can mix with -f)
1749   -U : undefine symbol:
1750          -U symbol    symbol gets the value 'undef'
1751          -U symbol=   symbol gets completely empty
1752        e.g.:  -Uversiononly
1753   -A : manipulate symbol after the platform specific hints have been applied:
1754          -A append:symbol=value   append value to symbol
1755          -A symbol=value          like append:, but with a separating space
1756          -A define:symbol=value   define symbol to have value
1757          -A clear:symbol          define symbol to be ''
1758          -A define:symbol         define symbol to be 'define'
1759          -A eval:symbol=value     define symbol to be eval of value
1760          -A prepend:symbol=value  prepend value to symbol
1761          -A undef:symbol          define symbol to be 'undef'
1762          -A undef:symbol=         define symbol to be ''
1763        e.g.:  -A prepend:libswanted='cl pthread '
1764               -A ccflags=-DSOME_MACRO
1765   -V : print version number and exit (with a zero status).
1766 EOM
1767         exit 1
1768         ;;
1769 esac
1770
1771 : Sanity checks
1772 case "$fastread$alldone" in
1773 yescont|yesexit) ;;
1774 *)
1775         case "$extractsh" in
1776         true) ;;
1777         *)
1778                 if test ! -t 0; then
1779                         echo "Say 'sh Configure', not 'sh <Configure'"
1780                         exit 1
1781                 fi
1782                 ;;
1783         esac
1784         ;;
1785 esac
1786
1787 exec 4>&1
1788 case "$silent" in
1789 true) exec 1>/dev/null;;
1790 esac
1791
1792 : run the defines and the undefines, if any, but leave the file out there...
1793 touch optdef.sh
1794 . ./optdef.sh
1795 : create the posthint manipulation script and leave the file out there...
1796 touch posthint.sh
1797
1798 : set package name
1799 package='perl5'
1800 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1801 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1802 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1803 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1804 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1805 esac
1806
1807 : Some greps do not return status, grrr.
1808 echo "grimblepritz" >grimble
1809 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1810         contains=contains
1811 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1812         contains=grep
1813 else
1814         contains=contains
1815 fi
1816 rm -f grimble
1817 : the following should work in any shell
1818 case "$contains" in
1819 contains*)
1820         echo " "
1821         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1822         cat >contains <<'EOSS'
1823 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1824 EOSS
1825 chmod +x contains
1826 esac
1827
1828 : Find the path to the source tree
1829 case "$src" in
1830 '') case "$0" in
1831     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1832          case "$src" in
1833          /*)    ;;
1834          .)     ;;
1835          *)     src=`cd ../$src && pwd` ;;
1836          esac
1837          ;;
1838     *)   src='.';;
1839     esac;;
1840 esac
1841 case "$src" in
1842 '')     src=/
1843         rsrc=/
1844         ;;
1845 /*)     rsrc="$src";;
1846 *)      rsrc="../$src";;
1847 esac
1848 if test -f $rsrc/Configure && \
1849         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1850 then
1851    : found it, so we are ok.
1852 else
1853         rsrc=''
1854         for src in . .. ../.. ../../.. ../../../..; do
1855                 if test -f ../$src/Configure && \
1856                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1857                 then
1858                         rsrc=../$src
1859                         break
1860                 fi
1861         done
1862 fi
1863 case "$rsrc" in
1864 '')
1865         cat <<EOM >&4
1866
1867 Sorry, I can't seem to locate the source dir for $package.  Please start
1868 Configure with an explicit path -- i.e. /some/path/Configure.
1869
1870 EOM
1871         exit 1
1872         ;;
1873 ../.)   rsrc='..';;
1874 *)
1875         echo " "
1876         echo "Sources for $package found in \"$src\"." >&4
1877         ;;
1878 esac
1879
1880 : script used to extract .SH files with variable substitutions
1881 cat >extract <<'EOS'
1882 PERL_CONFIG_SH=true
1883 echo "Doing variable substitutions on .SH files..."
1884 if test -f MANIFEST; then
1885         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1886 else
1887         echo "(Looking for .SH files under the source directory.)"
1888         set x `(cd "$src"; find . -name "*.SH" -print)`
1889 fi
1890 shift
1891 case $# in
1892 0) set x `(cd "$src"; echo *.SH)`; shift;;
1893 esac
1894 if test ! -f "$src/$1"; then
1895         shift
1896 fi
1897 mkdir_p='
1898 name=$1;
1899 create="";
1900 while test $name; do
1901         if test ! -d "$name"; then
1902                 create="$name $create";
1903                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1904                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1905         else
1906                 name="";
1907         fi;
1908 done;
1909 for file in $create; do
1910         mkdir $file;
1911 done
1912 '
1913 for file in $*; do
1914         case "$src" in
1915         ".")
1916                 case "$file" in
1917                 */*)
1918                         dir=`expr X$file : 'X\(.*\)/'`
1919                         file=`expr X$file : 'X.*/\(.*\)'`
1920                         (cd "$dir" && . ./$file)
1921                         ;;
1922                 *)
1923                         . ./$file
1924                         ;;
1925                 esac
1926                 ;;
1927         *)
1928                 case "$file" in
1929                 */*)
1930                         dir=`expr X$file : 'X\(.*\)/'`
1931                         file=`expr X$file : 'X.*/\(.*\)'`
1932                         (set x $dir; shift; eval $mkdir_p)
1933                         sh <"$src/$dir/$file"
1934                         ;;
1935                 *)
1936                         sh <"$src/$file"
1937                         ;;
1938                 esac
1939                 ;;
1940         esac
1941 done
1942 if test -f "$src/config_h.SH"; then
1943         if test ! -f config.h; then
1944         : oops, they left it out of MANIFEST, probably, so do it anyway.
1945         . "$src/config_h.SH"
1946         fi
1947 fi
1948 EOS
1949
1950 : extract files and exit if asked to do so
1951 case "$extractsh" in
1952 true)
1953         case "$realsilent" in
1954         true) ;;
1955         *) exec 1>&4;;
1956         esac
1957         case "$config_sh" in
1958         '') config_sh='config.sh';;
1959         esac
1960         echo " "
1961         echo "Fetching answers from $config_sh..."
1962         cd ..
1963         . $config_sh
1964         test "$override" && . ./optdef.sh
1965         echo " "
1966         . UU/extract
1967         rm -rf UU
1968         echo "Extraction done."
1969         exit 0
1970         ;;
1971 esac
1972
1973 : Eunice requires " " instead of "", can you believe it
1974 echo " "
1975 : Here we go...
1976 echo "Beginning of configuration questions for $package."
1977
1978 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1979
1980 : first determine how to suppress newline on echo command
1981 echo " "
1982 echo "Checking echo to see how to suppress newlines..."
1983 (echo "hi there\c" ; echo " ") >.echotmp
1984 if $contains c .echotmp >/dev/null 2>&1 ; then
1985         echo "...using -n."
1986         n='-n'
1987         c=''
1988 else
1989         cat <<'EOM'
1990 ...using \c
1991 EOM
1992         n=''
1993         c='\c'
1994 fi
1995 echo $n "The star should be here-->$c"
1996 echo '*'
1997 rm -f .echotmp
1998
1999 : Now test for existence of everything in MANIFEST
2000 echo " "
2001 if test -f "$rsrc/MANIFEST"; then
2002         echo "First let's make sure your kit is complete.  Checking..." >&4
2003         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2004                 (split -l 50 2>/dev/null || split -50)
2005         rm -f missing
2006         tmppwd=`pwd`
2007         for filelist in x??; do
2008                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2009                         >/dev/null 2>>"$tmppwd/missing")
2010         done
2011         if test -s missing; then
2012                 cat missing >&4
2013                 cat >&4 <<'EOM'
2014
2015 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2016
2017 You have the option of continuing the configuration process, despite the
2018 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2019 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2020 and contact the author (perlbug@perl.org).
2021
2022 EOM
2023                 echo $n "Continue? [n] $c" >&4
2024                 read ans
2025                 case "$ans" in
2026                 y*)
2027                         echo "Continuing..." >&4
2028                         rm -f missing
2029                         ;;
2030                 *)
2031                         echo "ABORTING..." >&4
2032                         kill $$
2033                         ;;
2034                 esac
2035         else
2036                 echo "Looks good..."
2037         fi
2038 else
2039         echo "There is no MANIFEST file.  I hope your kit is complete !"
2040 fi
2041 rm -f missing x??
2042
2043 : Find the appropriate value for a newline for tr
2044 echo " "
2045 if test -n "$DJGPP"; then
2046        trnl='\012'
2047 fi
2048 if test X"$trnl" = X; then
2049         case "`echo foo|tr '\n' x 2>/dev/null`" in
2050         foox) trnl='\n' ;;
2051         esac
2052 fi
2053 if test X"$trnl" = X; then
2054         case "`echo foo|tr '\012' x 2>/dev/null`" in
2055         foox) trnl='\012' ;;
2056         esac
2057 fi
2058 if test X"$trnl" = X; then
2059        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2060        fooxy) trnl='\n\r' ;;
2061        esac
2062 fi
2063 if test X"$trnl" = X; then
2064         cat <<EOM >&2
2065
2066 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2067
2068 EOM
2069         exit 1
2070 fi
2071
2072 : compute the number of columns on the terminal for proper question formatting
2073 case "$COLUMNS" in
2074 '') COLUMNS='80';;
2075 esac
2076
2077 : set up the echo used in my read
2078 myecho="case \"\$xxxm\" in
2079 '') echo $n \"\$rp $c\" >&4;;
2080 *) case \"\$rp\" in
2081         '') echo $n \"[\$xxxm] $c\";;
2082         *)
2083                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2084                         echo \"\$rp\" >&4
2085                         echo $n \"[\$xxxm] $c\" >&4
2086                 else
2087                         echo $n \"\$rp [\$xxxm] $c\" >&4
2088                 fi
2089                 ;;
2090         esac;;
2091 esac"
2092
2093 : now set up to do reads with possible shell escape and default assignment
2094 cat <<EOSC >myread
2095 $startsh
2096 xxxm=\$dflt
2097 $myecho
2098 ans='!'
2099 case "\$fastread" in
2100 yes) case "\$dflt" in
2101         '') ;;
2102         *) ans='';
2103                 case "\$silent-\$rp" in
2104                 true-) ;;
2105                 *) echo " " >&4;;
2106                 esac;;
2107         esac;;
2108 *) case "\$silent" in
2109         true) case "\$rp" in
2110                 '') ans='';;
2111                 esac;;
2112         esac;;
2113 esac
2114 while expr "X\$ans" : "X!" >/dev/null; do
2115         read answ
2116         set x \$xxxm
2117         shift
2118         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2119         case  "\$answ" in
2120         "!")
2121                 sh 1>&4
2122                 echo " "
2123                 $myecho
2124                 ;;
2125         !*)
2126                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2127                 shift
2128                 sh 1>&4 -c "\$*"
2129                 echo " "
2130                 $myecho
2131                 ;;
2132         "\$ans")
2133                 case "\$ans" in
2134                 \\&*)
2135                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2136                         shift
2137                         case "\$1" in
2138                         -d)
2139                                 fastread=yes
2140                                 echo "(OK, I'll run with -d after this question.)" >&4
2141                                 ;;
2142                         -*)
2143                                 echo "*** Sorry, \$1 not supported yet." >&4
2144                                 ;;
2145                         esac
2146                         $myecho
2147                         ans=!
2148                         ;;
2149                 esac;;
2150         *)
2151                 case "\$aok" in
2152                 y)
2153                         echo "*** Substitution done -- please confirm."
2154                         xxxm="\$ans"
2155                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2156                         xxxm="\$ans"
2157                         ans=!
2158                         ;;
2159                 *)
2160                         echo "*** Error -- try again."
2161                         ans=!
2162                         ;;
2163                 esac
2164                 $myecho
2165                 ;;
2166         esac
2167         case "\$ans\$xxxm\$nostick" in
2168         '')
2169                 ans=!
2170                 $myecho
2171                 ;;
2172         esac
2173 done
2174 case "\$ans" in
2175 '') ans="\$xxxm";;
2176 esac
2177 EOSC
2178
2179 : create .config dir to save info across Configure sessions
2180 test -d ../.config || mkdir ../.config
2181 cat >../.config/README <<EOF
2182 This directory created by Configure to save information that should
2183 persist across sessions for $package.
2184
2185 You may safely delete it if you wish.
2186 EOF
2187
2188 : See if we are using a devel version and want that
2189 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2190 case "$usedevel" in
2191 $define|true|[yY]*)
2192     usedevel="$define" ;;
2193 *) case "$xversion" in
2194    *[13579])
2195         cat >&4 <<EOH
2196 *** WHOA THERE!!! ***
2197
2198     This is an UNSTABLE DEVELOPMENT release.
2199     The version of this $package distribution is $xversion, that is, odd,
2200     (as opposed to even) and that signifies a development release.
2201     If you want a maintenance release, you want an even-numbered version.
2202
2203     Do ***NOT*** install this into production use.
2204     Data corruption and crashes are possible.
2205
2206     It is most seriously suggested that you do not continue any further
2207     unless you want to help in developing and debugging Perl.
2208
2209     If you *still* want to build perl, you can answer 'y' now,
2210     or pass -Dusedevel to Configure.
2211
2212 EOH
2213         rp='Do you really want to continue?'
2214         dflt='n'
2215         . ./myread
2216         case "$ans" in
2217         [yY]) echo >&4 "Okay, continuing."
2218               usedevel="$define" ;;
2219         *) echo >&4 "Okay, bye."
2220            exit 1
2221            ;;
2222         esac
2223         ;;
2224     esac
2225     usedevel="$undef"
2226     ;;
2227 esac
2228 case "$usedevel" in
2229 $define|true|[yY]*)
2230         case "$versiononly" in
2231         '') versiononly="$define" ;;
2232         esac
2233         case "$installusrbinperl" in
2234         '') installusrbinperl="$undef" ;;
2235         esac
2236         ;;
2237 esac
2238
2239 : general instructions
2240 needman=true
2241 firsttime=true
2242 user=`(logname) 2>/dev/null`
2243 case "$user" in
2244 '') user=`whoami 2>&1`;;
2245 esac
2246 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2247         firsttime=false
2248         echo " "
2249         rp='Would you like to see the instructions?'
2250         dflt=n
2251         . ./myread
2252         case "$ans" in
2253         [yY]*) ;;
2254         *) needman=false;;
2255         esac
2256 fi
2257 if $needman; then
2258         cat <<EOH
2259
2260 This installation shell script will examine your system and ask you questions
2261 to determine how the perl5 package should be installed. If you get
2262 stuck on a question, you may use a ! shell escape to start a subshell or
2263 execute a command.  Many of the questions will have default answers in square
2264 brackets; typing carriage return will give you the default.
2265
2266 On some of the questions which ask for file or directory names you are allowed
2267 to use the ~name construct to specify the login directory belonging to "name",
2268 even if you don't have a shell which knows about that.  Questions where this is
2269 allowed will be marked "(~name ok)".
2270
2271 EOH
2272         rp=''
2273         dflt='Type carriage return to continue'
2274         . ./myread
2275         cat <<'EOH'
2276
2277 The prompter used in this script allows you to use shell variables and
2278 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2279 in the default answer, as if the default line was a set of arguments given to a
2280 script shell.  This means you may also use $* to repeat the whole default line,
2281 so you do not have to re-type everything to add something to the default.
2282
2283 Every time there is a substitution, you will have to confirm.  If there is an
2284 error (e.g. an unmatched backtick), the default answer will remain unchanged
2285 and you will be prompted again.
2286
2287 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2288 the questions and use the computed defaults (or the previous answers if there
2289 was already a config.sh file). Type 'Configure -h' for a list of options.
2290 You may also start interactively and then answer '& -d' at any prompt to turn
2291 on the non-interactive behaviour for the remainder of the execution.
2292
2293 EOH
2294         . ./myread
2295         cat <<EOH
2296
2297 Much effort has been expended to ensure that this shell script will run on any
2298 Unix system.  If despite that it blows up on yours, your best bet is to edit
2299 Configure and run it again.  If you can't run Configure for some reason,
2300 you'll have to generate a config.sh file by hand.  Whatever problems you
2301 have, let me (perlbug@perl.org) know how I blew it.
2302
2303 This installation script affects things in two ways:
2304
2305 1) it may do direct variable substitutions on some of the files included
2306    in this kit.
2307 2) it builds a config.h file for inclusion in C programs.  You may edit
2308    any of these files as the need arises after running this script.
2309
2310 If you make a mistake on a question, there is no easy way to back up to it
2311 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2312 files.  Configure will offer to let you do this before it runs the SH files.
2313
2314 EOH
2315         dflt='Type carriage return to continue'
2316         . ./myread
2317         case "$firsttime" in
2318         true) echo $user >>../.config/instruct;;
2319         esac
2320 fi
2321
2322 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2323 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2324 if test "X$sysroot" = X; then
2325     sysroot=""
2326 else
2327     case "$cc" in
2328         *gcc*|*g++*)
2329             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2330             # _sysroot is used in places where we need --sysroot=foo
2331             # but using the rest of the flags could cause issues.
2332             _sysroot="--sysroot=$sysroot";
2333             case "$ccflags" in
2334                 *sysroot*) ;;
2335                 'undef'|*)
2336                 ccflags="$ccflags $_sysroot"
2337             esac
2338             case "$ldflags" in
2339                 *sysroot*) ;;
2340                 'undef'|*)
2341                 ldflags="$ldflags $_sysroot"
2342             esac
2343             case "$cppflags" in
2344                 *sysroot*) ;;
2345                 'undef'|*)
2346                 cppflags="$cppflags $_sysroot"
2347             esac
2348             # lddlflags updated below in lddlflags section;
2349             # same with cccdlflags
2350             ;;
2351     esac
2352
2353     # Adjust some defaults to also use $sysroot
2354     for var in xlibpth loclibpth locincpth glibpth; do
2355         eval xxx=\$$var
2356         eval $var=''
2357         for path in $xxx; do
2358             eval $var=\"\$$var $sysroot$path\"
2359         done
2360     done
2361
2362 fi
2363
2364 : find out where common programs are
2365 echo " "
2366 echo "Locating common programs..." >&4
2367 cat <<EOSC >loc
2368 $startsh
2369 case \$# in
2370 0) exit 1;;
2371 esac
2372 thing=\$1
2373 shift
2374 dflt=\$1
2375 shift
2376 for dir in \$*; do
2377         case "\$thing" in
2378         .)
2379         if test -d \$dir/\$thing; then
2380                 echo \$dir
2381                 exit 0
2382         fi
2383         ;;
2384         *)
2385         for thisthing in \$dir/\$thing; do
2386                 : just loop through to pick last item
2387         done
2388         if test -f \$thisthing; then
2389                 echo \$thisthing
2390                 exit 0
2391         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2392                 echo \$thisthing
2393                 exit 0
2394         elif test -f \$dir/\$thing.exe; then
2395                 if test -n "$DJGPP"; then
2396                         echo \$dir/\$thing.exe
2397                 elif test "$eunicefix" != ":"; then
2398                         : on Eunice apparently
2399                         echo \$dir/\$thing
2400                 fi
2401                 exit 0
2402         fi
2403         ;;
2404         esac
2405 done
2406 echo \$dflt
2407 exit 1
2408 EOSC
2409 chmod +x loc
2410 $eunicefix loc
2411 loclist="
2412 awk
2413 cat
2414 chmod
2415 comm
2416 cp
2417 echo
2418 expr
2419 grep
2420 ls
2421 mkdir
2422 rm
2423 sed
2424 sort
2425 touch
2426 tr
2427 uniq
2428 "
2429 trylist="
2430 ar
2431 bison
2432 byacc
2433 cpp
2434 csh
2435 date
2436 egrep
2437 gmake
2438 gzip
2439 less
2440 ln
2441 make
2442 more
2443 nm
2444 nroff
2445 perl
2446 pg
2447 test
2448 uname
2449 zip
2450 "
2451 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2452 pth="$pth $sysroot/lib $sysroot/usr/lib"
2453 for file in $loclist; do
2454         eval xxx=\$$file
2455         case "$xxx" in
2456         /*|?:[\\/]*)
2457                 if test -f "$xxx"; then
2458                         : ok
2459                 else
2460                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2461                         xxx=`./loc $file $file $pth`
2462                 fi
2463                 ;;
2464         '') xxx=`./loc $file $file $pth`;;
2465         *) xxx=`./loc $xxx $xxx $pth`;;
2466         esac
2467         eval $file=$xxx$_exe
2468         eval _$file=$xxx
2469         case "$xxx" in
2470         /*)
2471                 echo $file is in $xxx.
2472                 ;;
2473         ?:[\\/]*)
2474                 echo $file is in $xxx.
2475                 ;;
2476         *)
2477                 echo "I don't know where '$file' is, and my life depends on it." >&4
2478                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2479                 exit 1
2480                 ;;
2481         esac
2482 done
2483 echo " "
2484 echo "Don't worry if any of the following aren't found..."
2485 say=offhand
2486 for file in $trylist; do
2487         eval xxx=\$$file
2488         case "$xxx" in
2489         /*|?:[\\/]*)
2490                 if test -f "$xxx"; then
2491                         : ok
2492                 else
2493                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2494                         xxx=`./loc $file $file $pth`
2495                 fi
2496                 ;;
2497         '') xxx=`./loc $file $file $pth`;;
2498         *) xxx=`./loc $xxx $xxx $pth`;;
2499         esac
2500         eval $file=$xxx$_exe
2501         eval _$file=$xxx
2502         case "$xxx" in
2503         /*)
2504                 echo $file is in $xxx.
2505                 ;;
2506         ?:[\\/]*)
2507                 echo $file is in $xxx.
2508                 ;;
2509         *)
2510                 echo "I don't see $file out there, $say."
2511                 say=either
2512                 ;;
2513         esac
2514 done
2515 case "$egrep" in
2516 egrep)
2517         echo "Substituting grep for egrep."
2518         egrep=$grep
2519         _egrep=$grep
2520         ;;
2521 esac
2522 case "$less" in
2523 '')     ;;
2524 *)      if $less -R </dev/null >/dev/null; then
2525                echo "Substituting less -R for less."
2526                less="$less -R"
2527                _less=$less
2528         fi
2529         ;;
2530 esac
2531 case "$ln" in
2532 ln)
2533         echo "Substituting cp for ln."
2534         ln=$cp
2535         _ln=$cp
2536         ;;
2537 esac
2538 case "$make" in
2539 make)
2540         case "$gmake" in
2541         gmake)
2542         echo "I can't find make or gmake, and my life depends on it." >&4
2543         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2544         exit 1
2545         ;;
2546         esac
2547         ;;
2548 esac
2549 case "$gmake" in
2550 gmake)  ;;
2551 *)      # We can't have osname yet.
2552         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2553                 # Assume that gmake, if found, is definitely GNU make
2554                 # and prefer it over the system make.
2555                 echo "Substituting gmake for make."
2556                 make=$gmake
2557                 _make=$gmake
2558         fi
2559         ;;
2560 esac
2561 case "$test" in
2562 test)
2563         echo "Hopefully test is built into your sh."
2564         ;;
2565 *)
2566         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2567                 echo "Using the test built into your sh."
2568                 test=test
2569                 _test=test
2570         fi
2571         ;;
2572 esac
2573 case "$echo" in
2574 echo)
2575         echo "Hopefully echo is built into your sh."
2576         ;;
2577 '') ;;
2578 *)
2579         echo " "
2580 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2581         $echo $n "hi there$c" >foo1
2582         echo $n "hi there$c" >foo2
2583         if cmp foo1 foo2 >/dev/null 2>&1; then
2584                 echo "They are compatible.  In fact, they may be identical."
2585         else
2586                 case "$n" in
2587                 '-n') n='' c='\c';;
2588                 *) n='-n' c='';;
2589                 esac
2590                 cat <<FOO
2591 They are not compatible!  You are probably running ksh on a non-USG system.
2592 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2593 have echo built in and we may have to run some Bourne shell scripts.  That
2594 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2595
2596 FOO
2597                 $echo $n "The star should be here-->$c"
2598                 $echo "*"
2599         fi
2600         $rm -f foo1 foo2
2601         ;;
2602 esac
2603
2604 # This question was auctioned at YAPC::Europe-2007 in Vienna
2605 # I never promised you could answer it. I only auctioned the question.
2606 cat <<FOO
2607 The following message is sponsored by
2608
2609   Dresden.pm<--The stars should be here.
2610
2611 Dear Perl user, system administrator or package
2612 maintainer, the Perl community sends greetings to
2613 you. Do you (emblematical) greet back [Y/n]? n
2614
2615 FOO
2616
2617 : Check what type of C compiler we use
2618 cat <<EOS >trygcc
2619 $startsh
2620 EOS
2621 cat <<'EOSC' >>trygcc
2622 case "$cc" in
2623 '') ;;
2624 *)  $rm -f try try.*
2625     $cat >try.c <<EOM
2626 int main(int argc, char *argv[]) {
2627   return 0;
2628 }
2629 EOM
2630     if $cc -o try $ccflags $ldflags try.c; then
2631        :
2632     else
2633         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2634         despair=yes
2635         trygcc=yes
2636         case "$cc" in
2637         *gcc*) trygcc=no ;;
2638         esac
2639         # Skip this test because it gives a false match on output like:
2640         #    ./trygcc: line 23: cc: command not found
2641         # case "`$cc -v -c try.c 2>&1`" in
2642         # *gcc*) trygcc=no ;;
2643         # esac
2644         if $test X"$trygcc" = Xyes; then
2645             if gcc -o try -c try.c; then
2646                 echo " "
2647                 echo "You seem to have a working gcc, though." >&4
2648                 # Switching compilers may undo the work of hints files.
2649                 # The most common problem is -D_REENTRANT for threads.
2650                 # This heuristic catches that case, but gets false positives
2651                 # if -Dusethreads was not actually specified.  Better to
2652                 # bail out here with a useful message than fail 
2653                 # mysteriously later. Should we perhaps just try to
2654                 # re-invoke Configure -Dcc=gcc config_args ?
2655                 if $test -f usethreads.cbu; then
2656                         $cat >&4 <<EOM 
2657
2658 *** However, any setting of the C compiler flags (e.g. for thread support)
2659 *** will be lost.  It may be necessary for you to restart Configure and
2660 *** add -Dcc=gcc to your Configure command line.
2661
2662 EOM
2663                         rp="Would you like to go ahead and try gcc anyway?"
2664                         dflt=n
2665                 else
2666                         rp="Would you like to use it?"
2667                         dflt=y
2668                 fi
2669                 if $test -f myread; then
2670                     . ./myread
2671                 else
2672                     if $test -f UU/myread; then
2673                         . ./UU/myread
2674                     else
2675                         echo "Cannot find myread, sorry.  Aborting." >&2
2676                         exit 1
2677                     fi
2678                 fi  
2679                 case "$ans" in
2680                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2681                 esac
2682             fi
2683         fi
2684     fi
2685     $rm -f try try.*
2686     ;;
2687 esac
2688 EOSC
2689
2690 cat <<EOS >checkcc
2691 $startsh
2692 EOS
2693 cat <<'EOSC' >>checkcc
2694 case "$cc" in        
2695 '') ;;
2696 *)  $rm -f try try.*              
2697     $cat >try.c <<EOM
2698 int main(int argc, char *argv[]) {
2699   return 0;
2700 }
2701 EOM
2702     if $cc -o try $ccflags $ldflags try.c; then
2703        :
2704     else
2705         if $test X"$despair" = Xyes; then
2706            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2707         fi
2708         $cat >&4 <<EOM         
2709 You need to find a working C compiler.
2710 Either (purchase and) install the C compiler supplied by your OS vendor,
2711 or for a free C compiler try http://gcc.gnu.org/
2712 I cannot continue any further, aborting.
2713 EOM
2714         exit 1
2715     fi
2716     $rm -f try try.*
2717     ;;
2718 esac
2719 EOSC
2720
2721 : determine whether symbolic links are supported
2722 echo " "
2723 $touch blurfl
2724 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2725         echo "Symbolic links are supported." >&4
2726         lns="$ln -s"
2727 else
2728         echo "Symbolic links are NOT supported." >&4
2729         lns="$ln"
2730 fi
2731 $rm -f blurfl sym
2732
2733 : determine whether symbolic links are supported
2734 echo " "
2735 case "$lns" in
2736 *"ln"*" -s")
2737         echo "Checking how to test for symbolic links..." >&4
2738         $lns blurfl sym
2739         if $test "X$issymlink" = X; then
2740                 case "$newsh" in
2741                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2742                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2743                 esac
2744                 if test $? = 0; then
2745                         issymlink="test -h"
2746                 else
2747                         echo "Your builtin 'test -h' may be broken." >&4
2748                         case "$test" in
2749                         /*)     ;;
2750                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2751                                 for p in $pth
2752                                 do
2753                                         if test -f "$p/$test"; then
2754                                                 test="$p/$test"
2755                                                 break
2756                                         fi
2757                                 done
2758                                 ;;
2759                         esac
2760                         case "$test" in
2761                         /*)
2762                                 echo "Trying external '$test -h'." >&4
2763                                 issymlink="$test -h"
2764                                 if $test ! -h sym >/dev/null 2>&1; then
2765                                         echo "External '$test -h' is broken, too." >&4
2766                                         issymlink=''
2767                                 fi
2768                                 ;;
2769                         *)      issymlink='' ;;
2770                         esac
2771                 fi
2772         fi
2773         if $test "X$issymlink" = X; then
2774                 if $test -L sym 2>/dev/null; then
2775                         issymlink="$test -L"
2776                         echo "The builtin '$test -L' worked." >&4
2777                 fi
2778         fi
2779         if $test "X$issymlink" != X; then
2780                 echo "You can test for symbolic links with '$issymlink'." >&4
2781         else
2782                 echo "I do not know how you can test for symbolic links." >&4
2783         fi
2784         $rm -f blurfl sym
2785         ;;
2786 *)      echo "No symbolic links, so not testing for their testing..." >&4
2787         ;;
2788 esac
2789 echo " "
2790
2791 : Make symlinks util
2792 case "$mksymlinks" in
2793 $define|true|[yY]*)
2794         case "$src" in
2795         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2796                 exit 1
2797                 ;;
2798         *)      case "$lns:$issymlink" in
2799                 *"ln"*" -s:"*"test -"?)
2800                         echo "Creating the symbolic links..." >&4
2801                         echo "(First creating the subdirectories...)" >&4
2802                         cd ..
2803                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2804                                 read directory
2805                                 test -z "$directory" && break
2806                                 mkdir -p $directory
2807                         done
2808                         # Sanity check 1.
2809                         if test ! -d t/base; then
2810                                 echo "Failed to create the subdirectories.  Aborting." >&4
2811                                 exit 1
2812                         fi
2813                         echo "(Then creating the symlinks...)" >&4
2814                         awk '{print $1}' $src/MANIFEST | while true; do
2815                                 read filename
2816                                 test -z "$filename" && break
2817                                 if test -f $filename; then
2818                                         if $issymlink $filename; then
2819                                                 rm -f $filename
2820                                         fi
2821                                 fi
2822                                 if test -f $filename; then
2823                                         echo "$filename already exists, not symlinking."
2824                                 else
2825                                         ln -s $src/$filename $filename
2826                                 fi
2827                         done
2828                         # Sanity check 2.
2829                         if test ! -f t/base/lex.t; then
2830                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2831                                 exit 1
2832                         fi
2833                         cd UU
2834                         ;;
2835                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2836                         ;;
2837                 esac
2838                 ;;
2839         esac
2840         ;;
2841 esac
2842
2843 : Check for Cross-Compilation
2844 if $test "X$targethost" = "X"; then
2845     targethost=""
2846 fi
2847 if $test "X$targetenv" = "X"; then
2848     targetenv=""
2849 fi
2850 case "$usecrosscompile" in
2851 $define|true|[yY]*)
2852         $echo "Cross-compiling..."
2853         croak=''
2854         case "$cc" in
2855         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2856             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2857             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2858             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2859             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2860             # leave out ld, choosing it is more complex
2861             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2862             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2863             # We are in a weird spot. Just before us, some values
2864             # were 'saved', to be restored after the hints are
2865             # run.  This means that the changes we made to ar,
2866             # nm and ranlib will get reverted.
2867             # To avoid that, we hijack the saving mechanism and
2868             # have it save our new values.
2869             for file in ar nm ranlib; do
2870                 eval xxx=\$$file
2871                 eval $file=$xxx$_exe
2872                 eval _$file=$xxx
2873             done
2874         ;;
2875         esac
2876         case "$targetarch" in
2877         '') echo "Targetarch not defined." >&4; croak=y ;;
2878         *)  echo "Using targetarch $targetarch." >&4 ;;
2879         esac
2880         case "$targethost" in
2881         '') echo "Targethost not defined." >&4; croak=y ;;
2882         *)  echo "Using targethost $targethost." >&4
2883         esac
2884         locincpth=' '
2885         loclibpth=' '
2886         case "$croak" in
2887         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2888         esac
2889     : compile a host miniperl and generate_uudmap, unless we got passed them
2890     if $test "X$hostperl" = X; then
2891       echo "Building host miniperl and generate_uudmap binaries" >&4
2892       before_host=`pwd`
2893       cd ..
2894       cd $src
2895       src=`pwd`
2896       rm -rf $src/host
2897       mkdir $src/host
2898       cd $src/host
2899       $src/Configure -des -Dusedevel -Dmksymlinks
2900       $make miniperl
2901       case "$hostgenerate" in
2902       '') $make generate_uudmap
2903           hostgenerate=$src/host/generate_uudmap
2904           ;;
2905        "$undef") hostgenerate=''
2906           ;;
2907       esac
2908       hostperl=$src/host/miniperl
2909       cd $before_host
2910     fi
2911     hostosname=`$hostperl -le 'print $^O'`
2912     ;;
2913 *)
2914     usecrosscompile="$undef"
2915     ;;
2916 esac
2917
2918 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2919 case "$targethost" in
2920     '') echo "Checking for cross-compile" >&4
2921     case "$usecrosscompile$multiarch" in
2922        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2923          if [ -f Makefile ]; then
2924            echo " "
2925            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2926          else
2927            echo "Configure done."
2928          fi
2929        exit 0
2930        ;;
2931      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2932         run=''
2933         to=:
2934         from=:
2935         ;;
2936     esac
2937     ;;
2938     *) echo "Using targethost $targethost." >&4
2939         case "$src" in
2940         /*) run=$src/Cross/run
2941             targetmkdir=$src/Cross/mkdir
2942             to=$src/Cross/to
2943             from=$src/Cross/from
2944             ;;
2945         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2946             run=$pwd/Cross/run
2947             targetmkdir=$pwd/Cross/mkdir
2948             to=$pwd/Cross/to
2949             from=$pwd/Cross/from
2950             ;;
2951         esac
2952         case "$targetrun" in
2953         '') targetrun=ssh ;;
2954         esac
2955         case "$targetto" in
2956         '') targetto=scp ;;
2957         esac
2958         case "$targetfrom" in
2959         '') targetfrom=scp ;;
2960         esac
2961         run=$run-$targetrun
2962         to=$to-$targetto
2963         from=$from-$targetfrom
2964         case "$targetdir" in
2965         '')  targetdir=/tmp
2966              echo "Guessing targetdir $targetdir." >&4
2967              ;;
2968         esac
2969         case "$targetuser" in
2970         '')  targetuser=root
2971              echo "Guessing targetuser $targetuser." >&4
2972              ;;
2973         esac
2974         case "$targetport" in
2975         '')  targetport=22
2976              echo "Guessing targetport $targetport." >&4
2977              ;;
2978         esac
2979         case "$targetfrom" in
2980         scp)    q=-q ;;
2981         *)      q='' ;;
2982         esac
2983         case "$targetrun" in
2984         ssh|rsh)
2985             cat >$run <<EOF
2986 #!/bin/sh
2987 env=''
2988 case "\$1" in
2989 -cwd)
2990   shift
2991   cwd=\$1
2992   shift
2993   ;;
2994 esac
2995 case "\$1" in
2996 -env)
2997   shift
2998   env=\$1
2999   shift
3000   ;;
3001 esac
3002 case "\$cwd" in
3003 '') cwd=$targetdir ;;
3004 esac
3005 exe=\$1
3006 shift
3007 $to \$exe
3008 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3009 EOF
3010             ;;
3011         adb)
3012             $touch $run
3013             ;;
3014         *)  echo "Unknown targetrun '$targetrun'" >&4
3015             exit 1
3016             ;;
3017         esac
3018         case "$targetmkdir" in
3019         */Cross/mkdir)
3020             cat >$targetmkdir <<EOF
3021 #!/bin/sh
3022 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3023 EOF
3024             $chmod a+rx $targetmkdir
3025             ;;
3026         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3027             exit 1
3028             ;;
3029         esac
3030         case "$targetto" in
3031         scp|rcp)
3032             cat >$to <<EOF
3033 #!/bin/sh
3034 for f in \$@
3035 do
3036   case "\$f" in
3037   /*)
3038     $targetmkdir \`dirname \$f\`
3039     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3040     ;;
3041   *)
3042     $targetmkdir $targetdir/\`dirname \$f\`
3043     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3044     ;;
3045   esac
3046 done
3047 exit 0
3048 EOF
3049             ;;
3050         cp) cat >$to <<EOF
3051 #!/bin/sh
3052 for f in \$@
3053 do
3054   case "\$f" in
3055   /*)
3056     $mkdir -p $targetdir/\`dirname \$f\`
3057     $cp \$f $targetdir/\$f || exit 1
3058     ;;
3059   *)
3060     $targetmkdir $targetdir/\`dirname \$f\`
3061     $cp \$f $targetdir/\$f || exit 1
3062     ;;
3063   esac
3064 done
3065 exit 0
3066 EOF
3067             ;;
3068         *)  echo "Unknown targetto '$targetto'" >&4
3069             exit 1
3070             ;;
3071         esac
3072         case "$targetfrom" in
3073         scp|rcp)
3074           cat >$from <<EOF
3075 #!/bin/sh
3076 for f in \$@
3077 do
3078   $rm -f \$f
3079   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3080 done
3081 exit 0
3082 EOF
3083             ;;
3084         cp) cat >$from <<EOF
3085 #!/bin/sh
3086 for f in \$@
3087 do
3088   $rm -f \$f
3089   cp $targetdir/\$f . || exit 1
3090 done
3091 exit 0
3092 EOF
3093             ;;
3094         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3095             exit 1
3096             ;;
3097         esac
3098         if $test ! -f $run; then
3099             echo "Target 'run' script '$run' not found." >&4
3100         else
3101             $chmod a+rx $run
3102         fi
3103         if $test ! -f $to; then
3104             echo "Target 'to' script '$to' not found." >&4
3105         else
3106             $chmod a+rx $to
3107         fi
3108         if $test ! -f $from; then
3109             echo "Target 'from' script '$from' not found." >&4
3110         else
3111             $chmod a+rx $from
3112         fi
3113         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3114             exit 1
3115         fi
3116         cat >&4 <<EOF
3117 Using '$run' for remote execution,
3118 and '$from' and '$to'
3119 for remote file transfer.
3120 EOF
3121         ;;
3122 *)      run=''
3123         to=:
3124         from=:
3125         usecrosscompile="$undef"
3126         targetarch=''
3127         ;;
3128 esac
3129
3130 : see whether [:lower:] and [:upper:] are supported character classes
3131 echo " "
3132 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3133 ABYZ)
3134         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3135         up='[:upper:]'
3136         low='[:lower:]'
3137         ;;
3138 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3139         # (0xd9 and 0xe2), therefore that is a nice testing point.
3140         if test "X$up" = X -o "X$low" = X; then
3141             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3142             rs) up='[A-Z]'
3143                 low='[a-z]'
3144                 ;;
3145             esac
3146         fi
3147         if test "X$up" = X -o "X$low" = X; then
3148             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3149             rs) up='A-Z'
3150                 low='a-z'
3151                 ;;
3152             esac
3153         fi
3154         if test "X$up" = X -o "X$low" = X; then
3155             case "`echo RS | od -x 2>/dev/null`" in
3156             *D9E2*|*d9e2*)
3157                 echo "Hey, this might be EBCDIC." >&4
3158                 if test "X$up" = X -o "X$low" = X; then
3159                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3160                     rs) up='[A-IJ-RS-Z]'
3161                         low='[a-ij-rs-z]'
3162                         ;;
3163                     esac
3164                 fi
3165                 if test "X$up" = X -o "X$low" = X; then
3166                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3167                     rs) up='A-IJ-RS-Z'
3168                         low='a-ij-rs-z'
3169                         ;;
3170                     esac
3171                 fi
3172                 ;;
3173             esac
3174         fi
3175 esac
3176 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3177 rs)
3178     echo "Using $up and $low to convert case." >&4
3179     ;;
3180 *)
3181     echo "I don't know how to translate letters from upper to lower case." >&4
3182     echo "Your tr is not acting any way I know of." >&4
3183     exit 1
3184     ;;
3185 esac
3186 : set up the translation script tr, must be called with ./tr of course
3187 cat >tr <<EOSC
3188 $startsh
3189 case "\$1\$2" in
3190 '[A-Z][a-z]') exec $tr '$up' '$low';;
3191 '[a-z][A-Z]') exec $tr '$low' '$up';;
3192 esac
3193 exec $tr "\$@"
3194 EOSC
3195 chmod +x tr
3196 $eunicefix tr
3197
3198 : Try to determine whether config.sh was made on this system
3199 case "$config_sh" in
3200 '')
3201 myuname=`$uname -a 2>/dev/null`
3202 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3203 # Downcase everything to avoid ambiguity.
3204 # Remove slashes and single quotes so we can use parts of this in
3205 # directory and file names.
3206 # Remove newlines so myuname is sane to use elsewhere.
3207 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3208 # because the A-Z/a-z are not consecutive.
3209 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3210         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3211 newmyuname="$myuname"
3212 dflt=n
3213 case "$knowitall" in
3214 '')
3215         if test -f ../config.sh; then
3216                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3217                         eval "`grep myuname= ../config.sh`"
3218                 fi
3219                 if test "X$myuname" = "X$newmyuname"; then
3220                         dflt=y
3221                 fi
3222         fi
3223         ;;
3224 *) dflt=y;;
3225 esac
3226
3227 : Get old answers from old config file if Configure was run on the
3228 : same system, otherwise use the hints.
3229 hint=default
3230 cd ..
3231 if test -f config.sh; then
3232         echo " "
3233         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3234         . UU/myread
3235         case "$ans" in
3236         n*|N*) echo "OK, I'll ignore it."
3237                 mv config.sh config.sh.old
3238                 myuname="$newmyuname"
3239                 ;;
3240         *)  echo "Fetching default answers from your old config.sh file..." >&4
3241                 tmp_n="$n"
3242                 tmp_c="$c"
3243                 tmp_sh="$sh"
3244                 . ./config.sh
3245                 cp config.sh UU
3246                 n="$tmp_n"
3247                 c="$tmp_c"
3248                 : Older versions did not always set $sh.  Catch re-use of such
3249                 : an old config.sh.
3250                 case "$sh" in
3251                 '') sh="$tmp_sh" ;;
3252                 esac
3253                 hint=previous
3254                 ;;
3255         esac
3256 fi
3257 . ./UU/checkcc
3258 if test ! -f config.sh; then
3259         $cat <<EOM
3260
3261 First time through, eh?  I have some defaults handy for some systems
3262 that need some extra help getting the Configure answers right:
3263
3264 EOM
3265         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3266         dflt=''
3267         : Half the following guesses are probably wrong... If you have better
3268         : tests or hints, please send them to perlbug@perl.org
3269         : The metaconfig authors would also appreciate a copy...
3270         $test -f /irix && osname=irix
3271         $test -f /xenix && osname=sco_xenix
3272         $test -f /dynix && osname=dynix
3273         $test -f /dnix && osname=dnix
3274         $test -f /lynx.os && osname=lynxos
3275         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3276         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3277         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3278         $test -f /bin/mips && /bin/mips && osname=mips
3279         $test -d /usr/apollo/bin && osname=apollo
3280         $test -f /etc/saf/_sactab && osname=svr4
3281         $test -d /usr/include/minix && osname=minix
3282         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3283         if $test -d /MachTen -o -d /MachTen_Folder; then
3284                 osname=machten
3285                 if $test -x /sbin/version; then
3286                         osvers=`/sbin/version | $awk '{print $2}' |
3287                         $sed -e 's/[A-Za-z]$//'`
3288                 elif $test -x /usr/etc/version; then
3289                         osvers=`/usr/etc/version | $awk '{print $2}' |
3290                         $sed -e 's/[A-Za-z]$//'`
3291                 else
3292                         osvers="$2.$3"
3293                 fi
3294         fi
3295
3296         $test -f /sys/posix.dll &&
3297                 $test -f /usr/bin/what &&
3298                 set X `/usr/bin/what /sys/posix.dll` &&
3299                 $test "$3" = UWIN &&
3300                 osname=uwin &&
3301                 osvers="$5"
3302
3303         if $test -f $uname; then
3304                 set X $myuname
3305                 shift
3306
3307                 case "$5" in
3308                 fps*) osname=fps ;;
3309                 mips*)
3310                         case "$4" in
3311                         umips) osname=umips ;;
3312                         *) osname=mips ;;
3313                         esac;;
3314                 [23]100) osname=mips ;;
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                 nonstop-ux) osname=nonstopux ;;
3413                 openbsd) osname=openbsd
3414                         osvers="$3"
3415                         ;;
3416                 os2)    osname=os2
3417                         osvers="$4"
3418                         ;;
3419                 POSIX-BC | posix-bc ) osname=posix-bc
3420                         osvers="$3"
3421                         ;;
3422                 powerux | power_ux | powermax_os | powermaxos | \
3423                 powerunix | power_unix) osname=powerux
3424                         osvers="$3"
3425                         ;;
3426                 qnx) osname=qnx
3427                         osvers="$4"
3428                         ;;
3429                 solaris) osname=solaris
3430                         case "$3" in
3431                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3432                         *)      osvers="$3" ;;
3433                         esac
3434                         ;;
3435                 sunos) osname=sunos
3436                         case "$3" in
3437                         5*) osname=solaris
3438                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3439                         *)      osvers="$3" ;;
3440                         esac
3441                         ;;
3442                 titanos) osname=titanos
3443                         case "$3" in
3444                         1*) osvers=1 ;;
3445                         2*) osvers=2 ;;
3446                         3*) osvers=3 ;;
3447                         4*) osvers=4 ;;
3448                         *)      osvers="$3" ;;
3449                         esac
3450                         ;;
3451                 ultrix) osname=ultrix
3452                         osvers="$3"
3453                         ;;
3454                 osf1|mls+)      case "$5" in
3455                                 alpha)
3456                                         osname=dec_osf
3457                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3458                                         case "$osvers" in
3459                                         [1-9].[0-9]*) ;;
3460                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3461                                         esac
3462                                         ;;
3463                         hp*)    osname=hp_osf1  ;;
3464                         mips)   osname=mips_osf1 ;;
3465                         esac
3466                         ;;
3467                 # UnixWare 7.1.2 is known as Open UNIX 8
3468                 openunix|unixware) osname=svr5
3469                         osvers="$4"
3470                         ;;
3471                 uts)    osname=uts
3472                         osvers="$3"
3473                         ;;
3474                 vos) osvers="$3"
3475                         ;;
3476                 $2) case "$osname" in
3477                         *isc*) ;;
3478                         *freebsd*) ;;
3479                         svr*)
3480                                 : svr4.x or possibly later
3481                                 case "svr$3" in
3482                                 ${osname}*)
3483                                         osname=svr$3
3484                                         osvers=$4
3485                                         ;;
3486                                 esac
3487                                 case "$osname" in
3488                                 svr4.0)
3489                                         : Check for ESIX
3490                                         if test -f /stand/boot ; then
3491                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3492                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3493                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3494                                                         if test -n "$isesix"; then
3495                                                                 osname=esix4
3496                                                         fi
3497                                                 fi
3498                                         fi
3499                                         ;;
3500                                 esac
3501                                 ;;
3502                         *)      if test -f /etc/systemid; then
3503                                         osname=sco
3504                                         set `echo $3 | $sed 's/\./ /g'` $4
3505                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3506                                                 osvers=$1.$2.$3
3507                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3508                                                 osvers=$1.$2
3509                                         elif $test -f $src/hints/sco_$1.sh; then
3510                                                 osvers=$1
3511                                         fi
3512                                 else
3513                                         case "$osname" in
3514                                         '') : Still unknown.  Probably a generic Sys V.
3515                                                 osname="sysv"
3516                                                 osvers="$3"
3517                                                 ;;
3518                                         esac
3519                                 fi
3520                                 ;;
3521                         esac
3522                         ;;
3523                 *)      case "$osname" in
3524                         '') : Still unknown.  Probably a generic BSD.
3525                                 osname="$1"
3526                                 osvers="$3"
3527                                 ;;
3528                         esac
3529                         ;;
3530                 esac
3531         else
3532                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3533                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3534                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3535                                 osname=news_os
3536                         fi
3537                         $rm -f UU/kernel.what
3538                 elif test -d c:/. -o -n "$is_os2" ; then
3539                         set X $myuname
3540                         osname=os2
3541                         osvers="$5"
3542                 fi
3543         fi
3544
3545         case "$targetarch" in
3546         '') ;;
3547         *)  hostarch=$osname
3548             case "$targetarch" in
3549                 nto*|*-nto-*)
3550                     # Will load qnx.sh, which should change osname to nto
3551                     osname=qnx
3552                     osvers=''
3553                     ;;
3554                 *linux-android*)
3555                     # Catch arm-linux-androideabi, mipsel-linux-android,
3556                     # and i686-linux-android
3557                     osname=linux-android
3558                     osvers=''
3559                     ;;
3560                 *linux*)
3561                     # Something like arm-linux-gnueabihf is really just
3562                     # plain linux.
3563                     osname=linux
3564                     osvers=''
3565                     ;;
3566                 *solaris*|*sunos*)
3567                     osname=solaris
3568                     # XXX perhaps we should just assume
3569                     # osvers to be 2, or maybe take the value
3570                     # from targetarch. Using $run before the
3571                     # hints are run is somewhat icky.
3572                     set X `$run $uname -a 2>/dev/null`
3573                     shift
3574                     case "$3" in
3575                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3576                         *)  osvers="$3" ;;
3577                     esac
3578                     ;;
3579                 *)
3580                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3581                     osvers=''
3582                 ;;
3583             esac
3584             ;;
3585         esac
3586
3587         : Now look for a hint file osname_osvers, unless one has been
3588         : specified already.
3589         case "$hintfile" in
3590         ''|' ')
3591                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3592                 : Also try without trailing minor version numbers.
3593                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3594                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3595                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3596                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3597                 case "$file" in
3598                 '') dflt=none ;;
3599                 *)  case "$osvers" in
3600                         '') dflt=$file
3601                                 ;;
3602                         *)  if $test -f $src/hints/$file.sh ; then
3603                                         dflt=$file
3604                                 elif $test -f $src/hints/$xfile.sh ; then
3605                                         dflt=$xfile
3606                                 elif $test -f $src/hints/$xxfile.sh ; then
3607                                         dflt=$xxfile
3608                                 elif $test -f $src/hints/$xxxfile.sh ; then
3609                                         dflt=$xxxfile
3610                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3611                                         dflt=$xxxxfile
3612                                 elif $test -f "$src/hints/${osname}.sh" ; then
3613                                         dflt="${osname}"
3614                                 else
3615                                         dflt=none
3616                                 fi
3617                                 ;;
3618                         esac
3619                         ;;
3620                 esac
3621                 if $test -f Policy.sh ; then
3622                         case "$dflt" in
3623                         *Policy*) ;;
3624                         none) dflt="Policy" ;;
3625                         *) dflt="Policy $dflt" ;;
3626                         esac
3627                 fi
3628                 ;;
3629         *)
3630                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3631                 ;;
3632         esac
3633
3634         if $test -f Policy.sh ; then
3635                 $cat <<EOM
3636
3637 There's also a Policy hint file available, which should make the
3638 site-specific (policy) questions easier to answer.
3639 EOM
3640
3641         fi
3642
3643         $cat <<EOM
3644
3645 You may give one or more space-separated answers, or "none" if appropriate.
3646 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3647 previous run of Configure, you may specify it as well as or instead of
3648 OS-specific hints.  If hints are provided for your OS, you should use them:
3649 although Perl can probably be built without hints on many platforms, using
3650 hints often improve performance and may enable features that Configure can't
3651 set up on its own. If there are no hints that match your OS, specify "none";
3652 DO NOT give a wrong version or a wrong OS.
3653
3654 EOM
3655
3656         rp="Which of these apply, if any?"
3657         . UU/myread
3658         tans=$ans
3659         for file in $tans; do
3660                 if $test X$file = XPolicy -a -f Policy.sh; then
3661                         . Policy.sh
3662                         $cat Policy.sh >> UU/config.sh
3663                 elif $test -f $src/hints/$file.sh; then
3664                         . $src/hints/$file.sh
3665                         $cat $src/hints/$file.sh >> UU/config.sh
3666                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3667                         : nothing
3668                 else
3669                         : Give one chance to correct a possible typo.
3670                         echo "$file.sh does not exist"
3671                         dflt=$file
3672                         rp="hint to use instead?"
3673                         . UU/myread
3674                         for file in $ans; do
3675                                 if $test -f "$src/hints/$file.sh"; then
3676                                         . $src/hints/$file.sh
3677                                         $cat $src/hints/$file.sh >> UU/config.sh
3678                                 elif $test X$ans = X -o X$ans = Xnone ; then
3679                                         : nothing
3680                                 else
3681                                         echo "$file.sh does not exist -- ignored."
3682                                 fi
3683                         done
3684                 fi
3685         done
3686
3687         hint=recommended
3688         : Remember our hint file for later.
3689         if $test -f "$src/hints/$file.sh" ; then
3690                 hintfile="$file"
3691         else
3692                 hintfile=''
3693         fi
3694 fi
3695 cd UU
3696 ;;
3697 *)
3698         echo " "
3699         echo "Fetching default answers from $config_sh..." >&4
3700         tmp_n="$n"
3701         tmp_c="$c"
3702         cd ..
3703         cp $config_sh config.sh 2>/dev/null
3704         chmod +w config.sh
3705         . ./config.sh
3706         cd UU
3707         cp ../config.sh .
3708         n="$tmp_n"
3709         c="$tmp_c"
3710         hint=previous
3711         ;;
3712 esac
3713 test "$override" && . ./optdef.sh
3714
3715 : Restore computed paths
3716 for file in $loclist $trylist; do
3717         eval $file="\$_$file"
3718 done
3719
3720 cat << EOM
3721
3722 Configure uses the operating system name and version to set some defaults.
3723 The default value is probably right if the name rings a bell. Otherwise,
3724 since spelling matters for me, either accept the default or answer "none"
3725 to leave it blank.
3726
3727 EOM
3728 case "$osname" in
3729         ''|' ')
3730                 case "$hintfile" in
3731                 ''|' '|none) dflt=none ;;
3732                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3733                 esac
3734                 ;;
3735         *) dflt="$osname" ;;
3736 esac
3737 rp="Operating system name?"
3738 . ./myread
3739 case "$ans" in
3740 none)  osname='' ;;
3741 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3742 esac
3743 echo " "
3744 case "$osvers" in
3745         ''|' ')
3746                 case "$hintfile" in
3747                 ''|' '|none) dflt=none ;;
3748                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3749                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3750                         case "$dflt" in
3751                         ''|' ') dflt=none ;;
3752                         esac
3753                         ;;
3754                 esac
3755                 ;;
3756         *) dflt="$osvers" ;;
3757 esac
3758 rp="Operating system version?"
3759 . ./myread
3760 case "$ans" in
3761 none)  osvers='' ;;
3762 *) osvers="$ans" ;;
3763 esac
3764
3765
3766 . ./posthint.sh
3767
3768 : who configured the system
3769 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3770 case "$cf_by" in
3771 "")
3772         cf_by=`(logname) 2>/dev/null`
3773         case "$cf_by" in
3774         "")
3775                 cf_by=`(whoami) 2>/dev/null`
3776                 case "$cf_by" in
3777                 "") cf_by=unknown ;;
3778                 esac ;;
3779         esac ;;
3780 esac
3781
3782 : decide how portable to be.  Allow command line overrides.
3783 case "$d_portable" in
3784 "$undef") ;;
3785 *)      d_portable="$define" ;;
3786 esac
3787
3788 : set up shell script to do ~ expansion
3789 cat >filexp <<EOSS
3790 $startsh
3791 : expand filename
3792 case "\$1" in
3793  \~/*|\~)
3794         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3795         ;;
3796  \~*)
3797         if $test -f /bin/csh; then
3798                 /bin/csh -f -c "glob \$1"
3799                 failed=\$?
3800                 echo ""
3801                 exit \$failed
3802         else
3803                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3804                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3805                 if $test ! -d "\$dir"; then
3806                         me=\`basename \$0\`
3807                         echo "\$me: can't locate home directory for: \$name" >&2
3808                         exit 1
3809                 fi
3810                 case "\$1" in
3811                 */*)
3812                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3813                         ;;
3814                 *)
3815                         echo \$dir
3816                         ;;
3817                 esac
3818         fi
3819         ;;
3820 *)
3821         echo \$1
3822         ;;
3823 esac
3824 EOSS
3825 chmod +x filexp
3826 $eunicefix filexp
3827
3828 : now set up to get a file name
3829 cat <<EOS >getfile
3830 $startsh
3831 EOS
3832 cat <<'EOSC' >>getfile
3833 tilde=''
3834 fullpath=''
3835 already=''
3836 skip=''
3837 none_ok=''
3838 exp_file=''
3839 nopath_ok=''
3840 orig_rp="$rp"
3841 orig_dflt="$dflt"
3842 case "$gfpth" in
3843 '') gfpth='.' ;;
3844 esac
3845
3846 case "$fn" in
3847 *\(*)
3848         : getfile will accept an answer from the comma-separated list
3849         : enclosed in parentheses even if it does not meet other criteria.
3850         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3851         fn=`echo $fn | sed 's/(.*)//'`
3852         ;;
3853 esac
3854
3855 case "$fn" in
3856 *:*)
3857         loc_file=`expr $fn : '.*:\(.*\)'`
3858         fn=`expr $fn : '\(.*\):.*'`
3859         ;;
3860 esac
3861
3862 case "$fn" in
3863 *~*) tilde=true;;
3864 esac
3865 case "$fn" in
3866 */*) fullpath=true;;
3867 esac
3868 case "$fn" in
3869 *+*) skip=true;;
3870 esac
3871 case "$fn" in
3872 *n*) none_ok=true;;
3873 esac
3874 case "$fn" in
3875 *e*) exp_file=true;;
3876 esac
3877 case "$fn" in
3878 *p*) nopath_ok=true;;
3879 esac
3880
3881 case "$fn" in
3882 *f*) type='File';;
3883 *d*) type='Directory';;
3884 *l*) type='Locate';;
3885 esac
3886
3887 what="$type"
3888 case "$what" in
3889 Locate) what='File';;
3890 esac
3891
3892 case "$exp_file" in
3893 '')
3894         case "$d_portable" in
3895         "$define") ;;
3896         *) exp_file=true;;
3897         esac
3898         ;;
3899 esac
3900
3901 cd ..
3902 while test "$type"; do
3903         redo=''
3904         rp="$orig_rp"
3905         dflt="$orig_dflt"
3906         case "$tilde" in
3907         true) rp="$rp (~name ok)";;
3908         esac
3909         . UU/myread
3910         if test -f UU/getfile.ok && \
3911                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3912         then
3913                 value="$ans"
3914                 ansexp="$ans"
3915                 break
3916         fi
3917         case "$ans" in
3918         none)
3919                 value=''
3920                 ansexp=''
3921                 case "$none_ok" in
3922                 true) type='';;
3923                 esac
3924                 ;;
3925         *)
3926                 case "$tilde" in
3927                 '') value="$ans"
3928                         ansexp="$ans";;
3929                 *)
3930                         value=`UU/filexp $ans`
3931                         case $? in
3932                         0)
3933                                 if test "$ans" != "$value"; then
3934                                         echo "(That expands to $value on this system.)"
3935                                 fi
3936                                 ;;
3937                         *) value="$ans";;
3938                         esac
3939                         ansexp="$value"
3940                         case "$exp_file" in
3941                         '') value="$ans";;
3942                         esac
3943                         ;;
3944                 esac
3945                 case "$fullpath" in
3946                 true)
3947                         case "$ansexp" in
3948                         /*) value="$ansexp" ;;
3949                         [a-zA-Z]:/*) value="$ansexp" ;;
3950                         *)
3951                                 redo=true
3952                                 case "$already" in
3953                                 true)
3954                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3955                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3956                                         ;;
3957                                 *)
3958                                 echo "Please give a full path name, starting with slash." >&4
3959                                         case "$tilde" in
3960                                         true)
3961                                 echo "Note that using ~name is ok provided it expands well." >&4
3962                                                 already=true
3963                                                 ;;
3964                                         esac
3965                                 esac
3966                                 ;;
3967                         esac
3968                         ;;
3969                 esac
3970                 case "$redo" in
3971                 '')
3972                         case "$type" in
3973                         File)
3974                                 for fp in $gfpth; do
3975                                         if test "X$fp" = X.; then
3976                                             pf="$ansexp"
3977                                         else    
3978                                             pf="$fp/$ansexp"
3979                                         fi
3980                                         if test -f "$pf"; then
3981                                                 type=''
3982                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3983                                         then
3984                                                 echo "($value is not a plain file, but that's ok.)"
3985                                                 type=''
3986                                         fi
3987                                         if test X"$type" = X; then
3988                                             value="$pf"
3989                                             break
3990                                         fi
3991                                 done
3992                                 ;;
3993                         Directory)
3994                                 for fp in $gfpth; do
3995                                         if test "X$fp" = X.; then
3996                                             dir="$ans"
3997                                             direxp="$ansexp"
3998                                         else    
3999                                             dir="$fp/$ansexp"
4000                                             direxp="$fp/$ansexp"
4001                                         fi
4002                                         if test -d "$direxp"; then
4003                                                 type=''
4004                                                 value="$dir"
4005                                                 break
4006                                         fi
4007                                 done
4008                                 ;;
4009                         Locate)
4010                                 if test -d "$ansexp"; then
4011                                         echo "(Looking for $loc_file in directory $value.)"
4012                                         value="$value/$loc_file"
4013                                         ansexp="$ansexp/$loc_file"
4014                                 fi
4015                                 if test -f "$ansexp"; then
4016                                         type=''
4017                                 fi
4018                                 case "$nopath_ok" in
4019                                 true)   case "$value" in
4020                                         */*) ;;
4021                                         *)      echo "Assuming $value will be in people's path."
4022                                                 type=''
4023                                                 ;;
4024                                         esac
4025                                         ;;
4026                                 esac
4027                                 ;;
4028                         esac
4029
4030                         case "$skip" in
4031                         true) type='';
4032                         esac
4033
4034                         case "$type" in
4035                         '') ;;
4036                         *)
4037                                 if test "$fastread" = yes; then
4038                                         dflt=y
4039                                 else
4040                                         dflt=n
4041                                 fi
4042                                 rp="$what $value doesn't exist.  Use that name anyway?"
4043                                 . UU/myread
4044                                 dflt=''
4045                                 case "$ans" in
4046                                 y*) type='';;
4047                                 *) echo " ";;
4048                                 esac
4049                                 ;;
4050                         esac
4051                         ;;
4052                 esac
4053                 ;;
4054         esac
4055 done
4056 cd UU
4057 ans="$value"
4058 rp="$orig_rp"
4059 dflt="$orig_dflt"
4060 rm -f getfile.ok
4061 test "X$gfpthkeep" != Xy && gfpth=""
4062 EOSC
4063
4064 : determine root of directory hierarchy where package will be installed.
4065 case "$prefix" in
4066 '')
4067         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4068         ;;
4069 *?/)
4070         dflt=`echo "$prefix" | sed 's/.$//'`
4071         ;;
4072 *)
4073         dflt="$prefix"
4074         ;;
4075 esac
4076 $cat <<EOM
4077
4078 By default, $package will be installed in $dflt/bin, manual pages
4079 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4080 installation directories. Typically this is something like /usr/local.
4081 If you wish to have binaries under /usr/bin but other parts of the
4082 installation under /usr/local, that's ok: you will be prompted
4083 separately for each of the installation directories, the prefix being
4084 only used to set the defaults.
4085
4086 EOM
4087 fn=d~
4088 rp='Installation prefix to use?'
4089 . ./getfile
4090 oldprefix=''
4091 case "$prefix" in
4092 '') ;;
4093 *)
4094         case "$ans" in
4095         "$prefix") ;;
4096         *) oldprefix="$prefix";;
4097         esac
4098         ;;
4099 esac
4100 prefix="$ans"
4101 prefixexp="$ansexp"
4102
4103 : allow them to override the AFS root
4104 case "$afsroot" in
4105 '')     afsroot=/afs ;;
4106 *)      afsroot=$afsroot ;;
4107 esac
4108
4109 : is AFS running?
4110 echo " "
4111 case "$afs" in
4112 $define|true)   afs=true ;;
4113 $undef|false)   afs=false ;;
4114 *)      if $test -d $afsroot; then
4115                 afs=true
4116         else
4117                 afs=false
4118         fi
4119         ;;
4120 esac
4121 if $afs; then
4122         echo "AFS may be running... I'll be extra cautious then..." >&4
4123 else
4124         echo "AFS does not seem to be running..." >&4
4125 fi
4126
4127 : determine installation prefix for where package is to be installed.
4128 if $afs; then
4129 $cat <<EOM
4130
4131 Since you are running AFS, I need to distinguish the directory in which
4132 files will reside from the directory in which they are installed (and from
4133 which they are presumably copied to the former directory by occult means).
4134
4135 EOM
4136         case "$installprefix" in
4137         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4138         *) dflt="$installprefix";;
4139         esac
4140 else
4141 $cat <<EOM
4142
4143 In some special cases, particularly when building $package for distribution,
4144 it is convenient to distinguish the directory in which files should be
4145 installed from the directory ($prefix) in which they will
4146 eventually reside.  For most users, these two directories are the same.
4147
4148 EOM
4149         case "$installprefix" in
4150         '') dflt=$prefix ;;
4151         *) dflt=$installprefix;;
4152         esac
4153 fi
4154 fn=d~
4155 rp='What installation prefix should I use for installing files?'
4156 . ./getfile
4157 installprefix="$ans"
4158 installprefixexp="$ansexp"
4159
4160 : Perform the prefixexp/installprefixexp correction if necessary
4161 cat <<EOS >installprefix
4162 $startsh
4163 EOS
4164 cat <<'EOSC' >>installprefix
4165 : Change installation prefix, if necessary.
4166 if $test X"$prefix" != X"$installprefix"; then
4167     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4168 else
4169     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4170 fi
4171 EOSC
4172 chmod +x installprefix
4173 $eunicefix installprefix
4174
4175 : Set variables such as privlib and privlibexp from the output of ./getfile
4176 : performing the prefixexp/installprefixexp correction if necessary.
4177 cat <<EOS >setprefixvar
4178 $startsh
4179 EOS
4180 cat <<'EOSC' >>setprefixvar
4181 eval "${prefixvar}=\"\$ans\""
4182 eval "${prefixvar}exp=\"\$ansexp\""
4183 . ./installprefix
4184 EOSC
4185 chmod +x setprefixvar
4186 $eunicefix setprefixvar
4187
4188 : set up the script used to warn in case of inconsistency
4189 cat <<EOS >whoa
4190 $startsh
4191 EOS
4192 cat <<'EOSC' >>whoa
4193 dflt=y
4194 case "$hint" in
4195     recommended)
4196         case "$hintfile" in
4197         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4198                 ;;
4199         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4200                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4201                 ;;
4202         esac
4203         ;;
4204     *)  echo " "
4205         echo "*** WHOA THERE!!! ***" >&4
4206         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4207         ;;
4208 esac
4209 rp="    Keep the $hint value?"
4210 . ./myread
4211 case "$ans" in
4212 y) td=$was; tu=$was;;
4213 esac
4214 EOSC
4215
4216 : function used to set '$1' to '$val'
4217 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4218 case "$val$was" in
4219 $define$undef) . ./whoa; eval "$var=\$td";;
4220 $undef$define) . ./whoa; eval "$var=\$tu";;
4221 *) eval "$var=$val";;
4222 esac'
4223
4224 : get the patchlevel
4225 echo " "
4226 echo "Getting the current patchlevel..." >&4
4227 if $test -r $rsrc/patchlevel.h;then
4228         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4229         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4230         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4231         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4232         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4233         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4234         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4235 else
4236         revision=0
4237         patchlevel=0
4238         subversion=0
4239         api_revision=0
4240         api_version=0
4241         api_subversion=0
4242         perl_patchlevel=0
4243         $echo "(You do not have patchlevel.h.  Eek.)"
4244 fi
4245 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4246 version_patchlevel_string="version $patchlevel subversion $subversion"
4247 case "$perl_patchlevel" in
4248 0|'') ;;
4249 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4250     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4251     ;;
4252 esac
4253
4254 $echo "(You have $package $version_patchlevel_string.)"
4255
4256 case "$osname" in
4257 dos|vms)
4258         : XXX Should be a Configure test for double-dots in filenames.
4259         version=`echo $revision $patchlevel $subversion | \
4260                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4261         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4262                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4263         ;;
4264 *)
4265         version=`echo $revision $patchlevel $subversion | \
4266                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4267         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4268                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4269         ;;
4270 esac
4271 : Special case the 5.005_xx maintenance series, which used 5.005
4272 : without any subversion label as a subdirectory in $sitelib
4273 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4274         api_versionstring='5.005'
4275 fi
4276
4277 : Do we want threads support and if so, what type
4278 case "$usethreads" in
4279 $define|true|[yY]*)     dflt='y';;
4280 *)     # Catch case where user specified ithreads or 5005threads but
4281        # forgot -Dusethreads (A.D. 4/2002)
4282        case "$useithreads$use5005threads" in
4283        *$define*)       dflt='y';;
4284        *)               dflt='n';;
4285        esac
4286        ;;
4287 esac
4288 cat <<EOM
4289
4290 Perl can be built to offer a form of threading support on some systems
4291 To do so, Configure can be run with -Dusethreads.
4292
4293 Note that Perl built with threading support runs slightly slower
4294 and uses slightly more memory than plain Perl.
4295
4296 If this doesn't make any sense to you, just accept the default '$dflt'.
4297 EOM
4298 rp='Build a threading Perl?'
4299 . ./myread
4300 case "$ans" in
4301 y|Y)    val="$define" ;;
4302 *)      val="$undef" ;;
4303 esac
4304 set usethreads
4305 eval $setvar
4306
4307 if $test $patchlevel -lt 9; then
4308     case "$usethreads" in
4309     $define)
4310         : Default to ithreads unless overridden on command line or with
4311         : old config.sh
4312         dflt='y'
4313         case "$use5005threads" in
4314                 $define|true|[yY]*)
4315                         echo "5.005 threads are no longer supported"
4316                         exit 1
4317                 ;;
4318         esac
4319         case "$useithreads" in
4320                 $undef|false|[nN]*) dflt='n';;
4321         esac
4322         rp='Use the newer interpreter-based ithreads?'
4323         . ./myread
4324         case "$ans" in
4325         y|Y)    val="$define" ;;
4326         *)      val="$undef" ;;
4327         esac
4328         set useithreads
4329         eval $setvar
4330         : Now set use5005threads to the opposite value.
4331         case "$useithreads" in
4332         $define) val="$undef" ;;
4333         *) val="$define" ;;
4334         esac
4335         set use5005threads
4336         eval $setvar
4337         ;;
4338     *)
4339         useithreads="$undef"
4340         use5005threads="$undef"
4341         ;;
4342     esac
4343
4344     case "$useithreads$use5005threads" in
4345     "$define$define")
4346         $cat >&4 <<EOM
4347
4348 You cannot have both the ithreads and the 5.005 threads enabled
4349 at the same time.  Disabling the 5.005 threads since they are
4350 much less stable than the ithreads.
4351
4352 EOM
4353         use5005threads="$undef"
4354         ;;
4355     esac
4356
4357 else
4358 : perl-5.9.x and later
4359
4360     if test X"$usethreads" = "X$define"; then
4361         case "$use5005threads" in
4362             $define|true|[yY]*)
4363                 $cat >&4 <<EOM
4364
4365 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4366
4367 EOM
4368             ;;
4369         esac
4370     fi
4371
4372     use5005threads="$undef"
4373     useithreads="$usethreads"
4374 fi
4375
4376 case "$d_oldpthreads" in
4377 '')     : Configure tests would be welcome here.  For now, assume undef.
4378         val="$undef" ;;
4379 *)      val="$d_oldpthreads" ;;
4380 esac
4381 set d_oldpthreads
4382 eval $setvar
4383
4384
4385 : Look for a hint-file generated 'call-back-unit'.  If the
4386 : user has specified that a threading perl is to be built,
4387 : we may need to set or change some other defaults.
4388 if $test -f usethreads.cbu; then
4389     echo "Your platform has some specific hints regarding threaded builds, using them..."
4390     . ./usethreads.cbu
4391 else
4392     case "$usethreads" in
4393         "$define"|true|[yY]*)
4394                 $cat <<EOM
4395 (Your platform does not have any specific hints for threaded builds.
4396  Assuming POSIX threads, then.)
4397 EOM
4398         ;;
4399     esac
4400 fi
4401
4402 : Check if multiplicity is required
4403 cat <<EOM
4404
4405 Perl can be built so that multiple Perl interpreters can coexist
4406 within the same Perl executable.
4407 EOM
4408
4409 case "$useithreads" in
4410 $define)
4411         cat <<EOM
4412 This multiple interpreter support is required for interpreter-based threads.
4413 EOM
4414         val="$define"
4415         ;;
4416 *)      case "$usemultiplicity" in
4417         $define|true|[yY]*)     dflt='y';;
4418         *) dflt='n';;
4419         esac
4420         echo " "
4421         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4422         rp='Build Perl for multiplicity?'
4423         . ./myread
4424         case "$ans" in
4425         y|Y)    val="$define" ;;
4426         *)      val="$undef" ;;
4427         esac
4428         ;;
4429 esac
4430 set usemultiplicity
4431 eval $setvar
4432
4433 : Check if morebits is requested
4434 case "$usemorebits" in
4435 "$define"|true|[yY]*)
4436         use64bitint="$define"
4437         uselongdouble="$define"
4438         usemorebits="$define"
4439         ;;
4440 *)      usemorebits="$undef"
4441         ;;
4442 esac
4443
4444 : Determine the C compiler to be used
4445 echo " "
4446 case "$cc" in
4447 '') dflt=cc;;
4448 *) dflt="$cc";;
4449 esac
4450 rp="Use which C compiler?"
4451 . ./myread
4452 cc="$ans"
4453
4454 : See whether they have no cc but they do have gcc
4455 . ./trygcc
4456 if $test -f cc.cbu; then
4457     . ./cc.cbu
4458 fi
4459 . ./checkcc
4460
4461 : make some quick guesses about what we are up against
4462 echo " "
4463 $echo $n "Hmm...  $c"
4464 echo exit 1 >bsd
4465 echo exit 1 >usg
4466 echo exit 1 >v7
4467 echo exit 1 >osf1
4468 echo exit 1 >eunice
4469 echo exit 1 >xenix
4470 echo exit 1 >venix
4471 echo exit 1 >os2
4472 d_bsd="$undef"
4473 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4474 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4475 then
4476         echo "Looks kind of like an OSF/1 system, but we'll see..."
4477         echo exit 0 >osf1
4478 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4479         xxx=`./loc addbib blurfl $pth`
4480         if $test -f $xxx; then
4481         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4482                 echo exit 0 >bsd
4483                 echo exit 0 >usg
4484         else
4485                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4486                         echo "Looks kind of like an extended USG system, but we'll see..."
4487                 else
4488                         echo "Looks kind of like a USG system, but we'll see..."
4489                 fi
4490                 echo exit 0 >usg
4491         fi
4492 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4493         echo "Looks kind of like a BSD system, but we'll see..."
4494         d_bsd="$define"
4495         echo exit 0 >bsd
4496 else
4497         echo "Looks kind of like a Version 7 system, but we'll see..."
4498         echo exit 0 >v7
4499 fi
4500 case "$eunicefix" in
4501 *unixtovms*)
4502         $cat <<'EOI'
4503 There is, however, a strange, musty smell in the air that reminds me of
4504 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4505 EOI
4506         echo exit 0 >eunice
4507         d_eunice="$define"
4508 : it so happens the Eunice I know will not run shell scripts in Unix format
4509         ;;
4510 *)
4511         echo " "
4512         echo "Congratulations.  You aren't running Eunice."
4513         d_eunice="$undef"
4514         ;;
4515 esac
4516 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4517 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4518 : semicolon as a patch separator
4519 case "$p_" in
4520 :) ;;
4521 *)
4522         $cat <<'EOI'
4523 I have the feeling something is not exactly right, however...don't tell me...
4524 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4525 (Or you may be running DOS with DJGPP.)
4526 EOI
4527         echo exit 0 >os2
4528         ;;
4529 esac
4530 if test -f /xenix; then
4531         echo "Actually, this looks more like a XENIX system..."
4532         echo exit 0 >xenix
4533         d_xenix="$define"
4534 else
4535         echo " "
4536         echo "It's not Xenix..."
4537         d_xenix="$undef"
4538 fi
4539 chmod +x xenix
4540 $eunicefix xenix
4541 if test -f /venix; then
4542         echo "Actually, this looks more like a VENIX system..."
4543         echo exit 0 >venix
4544 else
4545         echo " "
4546         if ./xenix; then
4547                 : null
4548         else
4549                 echo "Nor is it Venix..."
4550         fi
4551 fi
4552 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4553 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4554 $rm -f foo
4555
4556 : Check if we are using GNU gcc and what its version is
4557 echo " "
4558 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4559 $cat >try.c <<EOM
4560 #include <stdio.h>
4561 int main() {
4562 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4563 #ifdef __VERSION__
4564         printf("%s\n", __VERSION__);
4565 #else
4566         printf("%s\n", "1");
4567 #endif
4568 #endif
4569         return(0);
4570 }
4571 EOM
4572 if $cc -o try $ccflags $ldflags try.c; then
4573         gccversion=`$run ./try`
4574         case "$gccversion" in
4575         '') echo "You are not using GNU cc." ;;
4576         *)  echo "You are using GNU cc $gccversion."
4577             ccname=gcc
4578             ;;
4579         esac
4580 else
4581         echo " "
4582         echo "*** WHOA THERE!!! ***" >&4
4583         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4584         case "$knowitall" in
4585         '')
4586         echo "    You'd better start hunting for one and let me know about it." >&4
4587                 exit 1
4588                 ;;
4589         esac
4590 fi
4591 $rm -f try try.*
4592 case "$gccversion" in
4593 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4594 esac
4595 case "$gccversion" in
4596 '') gccosandvers='' ;;
4597 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4598    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4599    gccshortvers=''
4600    case "$gccosandvers" in
4601    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4602    $osname$osvers) ;; # looking good
4603    $osname*) cat <<EOM >&4
4604
4605 *** WHOA THERE!!! ***
4606
4607     Your gcc has not been compiled for the exact release of
4608     your operating system ($gccosandvers versus $osname$osvers).
4609
4610     In general it is a good idea to keep gcc synchronized with
4611     the operating system because otherwise serious problems
4612     may ensue when trying to compile software, like Perl.
4613
4614     I'm trying to be optimistic here, though, and will continue.
4615     If later during the configuration and build icky compilation
4616     problems appear (headerfile conflicts being the most common
4617     manifestation), I suggest reinstalling the gcc to match
4618     your operating system release.
4619
4620 EOM
4621       ;;
4622    *) gccosandvers='' ;; # failed to parse, better be silent
4623    esac
4624    ;;
4625 esac
4626 case "$ccname" in
4627 '') ccname="$cc" ;;
4628 esac
4629
4630 # gcc 3.* complain about adding -Idirectories that they already know about,
4631 # so we will take those off from locincpth.
4632 case "$gccversion" in
4633 3*)
4634     echo "main(){}">try.c
4635     for incdir in $locincpth; do
4636        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4637              grep '^c[cp]p*[01]: warning: changing search order '`
4638        if test "X$warn" != X; then
4639            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4640        fi
4641     done
4642     $rm -f try try.*
4643 esac
4644
4645 # gcc 4.9 by default does some optimizations that break perl.
4646 # see ticket 121505.
4647 #
4648 # The -fwrapv disables those optimizations (and probably others,) so
4649 # for gcc 4.9 (and later, since the optimizations probably won't go
4650 # away), add -fwrapv unless the user requests -fno-wrapv, which
4651 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4652 # which turns the overflows -fwrapv ignores into runtime errors.
4653 case "$gccversion" in
4654 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4655     case "$ccflags" in
4656     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4657     *) ccflags="$ccflags -fwrapv" ;;
4658     esac
4659 esac
4660
4661 : What should the include directory be ?
4662 : Use sysroot if set, so findhdr looks in the right place.
4663 echo " "
4664 $echo $n "Hmm...  $c"
4665 dflt="$sysroot/usr/include"
4666 incpath=''
4667 mips_type=''
4668 if $test -f /bin/mips && /bin/mips; then
4669         echo "Looks like a MIPS system..."
4670         $cat >usr.c <<'EOCP'
4671 #ifdef SYSTYPE_BSD43
4672 /bsd43
4673 #endif
4674 EOCP
4675         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4676                 dflt='/bsd43/usr/include'
4677                 incpath='/bsd43'
4678                 mips_type='BSD 4.3'
4679         else
4680                 mips_type='System V'
4681         fi
4682         $rm -f usr.c usr.out
4683         echo "and you're compiling with the $mips_type compiler and libraries."
4684         xxx_prompt=y
4685         echo "exit 0" >mips
4686 else
4687         echo "Doesn't look like a MIPS system."
4688         xxx_prompt=n
4689         echo "exit 1" >mips
4690 fi
4691 chmod +x mips
4692 $eunicefix mips
4693 case "$usrinc" in
4694 '') ;;
4695 *) dflt="$usrinc";;
4696 esac
4697 case "$xxx_prompt" in
4698 y)      fn=d/
4699         echo " "
4700         rp='Where are the include files you want to use?'
4701         . ./getfile
4702         usrinc="$ans"
4703         ;;
4704 *)      usrinc="$dflt"
4705         ;;
4706 esac
4707
4708 : see how we invoke the C preprocessor
4709 echo " "
4710 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4711 cat <<'EOT' >testcpp.c
4712 #define ABC abc
4713 #define XYZ xyz
4714 ABC.XYZ
4715 EOT
4716 cd ..
4717 if test ! -f cppstdin; then
4718         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4719                 # AIX cc -E doesn't show the absolute headerfile
4720                 # locations but we'll cheat by using the -M flag.
4721                 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
4722         else
4723                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4724         fi
4725 else
4726         echo "Keeping your $hint cppstdin wrapper."
4727 fi
4728 chmod 755 cppstdin
4729 wrapper=`pwd`/cppstdin
4730 ok='false'
4731 cd UU
4732
4733 if $test "X$cppstdin" != "X" && \
4734         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4735         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4736 then
4737         echo "You used to use $cppstdin $cppminus so we'll use that again."
4738         case "$cpprun" in
4739         '') echo "But let's see if we can live without a wrapper..." ;;
4740         *)
4741                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4742                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4743                 then
4744                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4745                         ok='true'
4746                 else
4747                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4748                 fi
4749                 ;;
4750         esac
4751 else
4752         case "$cppstdin" in
4753         '') ;;
4754         *)
4755                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4756                 ;;
4757         esac
4758 fi
4759
4760 if $ok; then
4761         : nothing
4762 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4763         $cc -E <testcpp.c >testcpp.out 2>&1; \
4764         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4765         echo "Yup, it does."
4766         x_cpp="$cc $cppflags -E"
4767         x_minus='';
4768 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4769         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4770         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4771         echo "Yup, it does."
4772         x_cpp="$cc $cppflags -E"
4773         x_minus='-';
4774 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4775         $cc -P <testcpp.c >testcpp.out 2>&1; \
4776         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4777         echo "Yipee, that works!"
4778         x_cpp="$cc $cppflags -P"
4779         x_minus='';
4780 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4781         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4782         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4783         echo "At long last!"
4784         x_cpp="$cc $cppflags -P"
4785         x_minus='-';
4786 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4787         $cpp <testcpp.c >testcpp.out 2>&1; \
4788         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4789         echo "It works!"
4790         x_cpp="$cpp $cppflags"
4791         x_minus='';
4792 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4793         $cpp - <testcpp.c >testcpp.out 2>&1; \
4794         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4795         echo "Hooray, it works!  I was beginning to wonder."
4796         x_cpp="$cpp $cppflags"
4797         x_minus='-';
4798 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4799         $wrapper <testcpp.c >testcpp.out 2>&1; \
4800         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4801         x_cpp="$wrapper"
4802         x_minus=''
4803         echo "Eureka!"
4804 else
4805         dflt=''
4806         rp="No dice.  I can't find a C preprocessor.  Name one:"
4807         . ./myread
4808         x_cpp="$ans"
4809         x_minus=''
4810         $x_cpp <testcpp.c >testcpp.out 2>&1
4811         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4812                 echo "OK, that will do." >&4
4813         else
4814 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4815                 exit 1
4816         fi
4817 fi
4818
4819 case "$ok" in
4820 false)
4821         cppstdin="$x_cpp"
4822         cppminus="$x_minus"
4823         cpprun="$x_cpp"
4824         cpplast="$x_minus"
4825         set X $x_cpp
4826         shift
4827         case "$1" in
4828         "$cpp")
4829                 echo "Perhaps can we force $cc -E using a wrapper..."
4830                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4831                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4832                 then
4833                         echo "Yup, we can."
4834                         cppstdin="$wrapper"
4835                         cppminus='';
4836                 else
4837                         echo "Nope, we'll have to live without it..."
4838                 fi
4839                 ;;
4840         esac
4841         case "$cpprun" in
4842         "$wrapper")
4843                 cpprun=''
4844                 cpplast=''
4845                 ;;
4846         esac
4847         ;;
4848 esac
4849
4850 case "$cppstdin" in
4851 "$wrapper"|'cppstdin') ;;
4852 *) $rm -f $wrapper;;
4853 esac
4854 $rm -f testcpp.c testcpp.out
4855
4856 : Adjust cppfilter for path component separator
4857 case "$osname" in
4858 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4859 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4860 *)   cppfilter='' ;;
4861 esac
4862
4863 : Use gcc to determine libpth and incpth
4864 # If using gcc or clang, we can get better values for libpth, incpth
4865 # and usrinc directly from the compiler.
4866 # Note that ccname for clang is also gcc.
4867 case "$ccname" in
4868     gcc)
4869         $echo 'extern int foo;' > try.c
4870         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4871         shift
4872         if $test $# -gt 0; then
4873             incpth="$incpth $*"
4874             incpth="`$echo $incpth|$sed 's/^ //'`"
4875             for i in $*; do
4876                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4877                 if $test -d $j; then
4878                     libpth="$libpth $j"
4879                 fi
4880             done
4881             libpth="`$echo $libpth|$sed 's/^ //'`"
4882             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4883                 if $test -d $xxx; then
4884                     case " $libpth " in
4885                     *" $xxx "*) ;;
4886                     *) libpth="$libpth $xxx";;
4887                     esac
4888                 fi
4889             done
4890         fi
4891         $rm -f try.c
4892         case "$usrinc" in
4893         '') for i in $incpth; do
4894                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4895                     usrinc="$i"
4896                     break
4897                 fi
4898             done
4899             ;;
4900         esac
4901
4902         case "$usecrosscompile" in
4903         $define|true|[yY]*)
4904             case "$incpth" in
4905                 '') echo "Incpth not defined." >&4; croak=y ;;
4906                 *)  echo "Using incpth '$incpth'." >&4 ;;
4907             esac
4908             case "$libpth" in
4909                 '') echo "Libpth not defined." >&4; croak=y ;;
4910                 *)  echo "Using libpth '$libpth'." >&4 ;;
4911             esac
4912             case "$usrinc" in
4913                 '') echo "Usrinc not defined." >&4; croak=y ;;
4914                 *)  echo "Using usrinc $usrinc." >&4 ;;
4915             esac
4916             case "$croak" in
4917                 y)
4918                 if test "X$sysroot" = X; then
4919                     echo "Cannot continue, aborting." >&4; exit 1
4920                 else
4921                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4922                 fi
4923                 ;;
4924             esac
4925             ;;
4926         esac
4927     ;;
4928 esac
4929
4930 : Default value for incpth is just usrinc
4931 case "$incpth" in
4932 '') incpth="$usrinc";;
4933 esac
4934
4935 : Set private lib path
4936 case "$plibpth" in
4937 '') if ./mips; then
4938         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4939     fi;;
4940 esac
4941 case "$libpth" in
4942 ' ') dlist='';;
4943 '') dlist="$loclibpth $plibpth $glibpth";;
4944 *) dlist="$libpth";;
4945 esac
4946
4947 : Now check and see which directories actually exist, avoiding duplicates
4948 for xxx in $dlist
4949 do
4950     if $test -d $xxx; then
4951                 case " $libpth " in
4952                 *" $xxx "*) ;;
4953                 *) libpth="$libpth $xxx";;
4954                 esac
4955     fi
4956 done
4957 $cat <<'EOM'
4958
4959 Some systems have incompatible or broken versions of libraries.  Among
4960 the directories listed in the question below, please remove any you
4961 know not to be holding relevant libraries, and add any that are needed.
4962 Say "none" for none.
4963
4964 EOM
4965
4966 if test "X$sysroot" != X; then
4967     $cat <<EOM
4968 You have set sysroot to $sysroot, please supply the directories excluding sysroot
4969
4970 EOM
4971 fi
4972
4973 case "$libpth" in
4974 '') dflt='none';;
4975 *)
4976         set X $libpth
4977         shift
4978         dflt=${1+"$@"}
4979         ;;
4980 esac
4981 rp="Directories to use for library searches?"
4982 . ./myread
4983 case "$ans" in
4984 none) libpth=' ';;
4985 *) libpth="$ans";;
4986 esac
4987
4988 : compute shared library extension
4989 case "$so" in
4990 '')
4991         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4992                 dflt='sl'
4993         else
4994                 dflt='so'
4995         fi
4996         ;;
4997 *) dflt="$so";;
4998 esac
4999 $cat <<EOM
5000
5001 On some systems, shared libraries may be available.  Answer 'none' if
5002 you want to suppress searching of shared libraries for the remainder
5003 of this configuration.
5004
5005 EOM
5006 rp='What is the file extension used for shared libraries?'
5007 . ./myread
5008 so="$ans"
5009
5010 : Does target system insist that shared library basenames are unique
5011 $cat << EOM
5012
5013 Some dynamic loaders assume that the *basename* of shared library filenames
5014 are globally unique.  We'll default this to undef as we assume your system
5015 is not this weird. Set to defined if you're on one of them.
5016
5017 EOM
5018
5019 dflt='n'
5020 rp='Make shared library basenames unique?'
5021 . ./myread
5022 case "$ans" in
5023 y|Y) val="$define" ;;
5024 *)   val="$undef"  ;;
5025 esac
5026 set d_libname_unique
5027 eval $setvar
5028
5029 : Define several unixisms.
5030 : Hints files or command line option can be used to override them.
5031 : The convoluted testing is in case hints files set either the old
5032 : or the new name.
5033 case "$_exe" in
5034 '')     case "$exe_ext" in
5035         '')     ;;
5036         *)      _exe="$exe_ext" ;;
5037         esac
5038         ;;
5039 esac
5040 case "$_a" in
5041 '')     case "$lib_ext" in
5042     '') _a='.a';;
5043         *)      _a="$lib_ext" ;;
5044         esac
5045         ;;
5046 esac
5047 case "$_o" in
5048 '') case "$obj_ext" in
5049         '')     _o='.o';;
5050         *)      _o="$obj_ext";;
5051         esac
5052         ;;
5053 esac
5054 case "$p_" in
5055 '') case "$path_sep" in
5056         '')     p_=':';;
5057         *)      p_="$path_sep";;
5058         esac
5059         ;;
5060 esac
5061 exe_ext=$_exe
5062 lib_ext=$_a
5063 obj_ext=$_o
5064 path_sep=$p_
5065
5066 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5067
5068 : Which makefile gets called first.  This is used by make depend.
5069 case "$firstmakefile" in
5070 '') firstmakefile='makefile';;
5071 esac
5072
5073 : Check is we will use socks
5074 case "$usesocks" in
5075 $define|true|[yY]*)     dflt='y';;
5076 *) dflt='n';;
5077 esac
5078 cat <<EOM
5079
5080 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5081 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5082 to use the PerlIO abstraction layer, this will be implicitly selected.
5083
5084 If this doesn't make any sense to you, just accept the default '$dflt'.
5085 EOM
5086 rp='Build Perl for SOCKS?'
5087 . ./myread
5088 case "$ans" in
5089 y|Y)    val="$define" ;;
5090 *)      val="$undef" ;;
5091 esac
5092 set usesocks
5093 eval $setvar
5094
5095 : Check for uselongdouble support
5096 case "$ccflags" in
5097 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5098 esac
5099
5100 case "$uselongdouble" in
5101 $define|true|[yY]*)     dflt='y';;
5102 *) dflt='n';;
5103 esac
5104 cat <<EOM
5105
5106 Perl can be built to take advantage of long doubles which
5107 (if available) may give more accuracy and range for floating point numbers.
5108
5109 If this doesn't make any sense to you, just accept the default '$dflt'.
5110 EOM
5111 rp='Try to use long doubles if available?'
5112 . ./myread
5113 case "$ans" in
5114 y|Y)    val="$define"   ;;
5115 *)      val="$undef"    ;;
5116 esac
5117 set uselongdouble
5118 eval $setvar
5119
5120 case "$uselongdouble" in
5121 true|[yY]*) uselongdouble="$define" ;;
5122 esac
5123
5124 : Look for a hint-file generated 'call-back-unit'.  If the
5125 : user has specified that long doubles should be used,
5126 : we may need to set or change some other defaults.
5127 if $test -f uselongdouble.cbu; then
5128     echo "Your platform has some specific hints regarding long doubles, using them..."
5129     . ./uselongdouble.cbu
5130 else
5131     case "$uselongdouble" in
5132         $define)
5133                 $cat <<EOM
5134 (Your platform does not have any specific hints for long doubles.)
5135 EOM
5136         ;;
5137     esac
5138 fi
5139
5140 : Looking for optional libraries
5141 echo " "
5142 echo "Checking for optional libraries..." >&4
5143 case "$libs" in
5144 ' '|'') dflt='';;
5145 *) dflt="$libs";;
5146 esac
5147 case "$libswanted" in
5148 '') libswanted='c_s';;
5149 esac
5150 case "$usesocks" in
5151 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5152 esac
5153 case "$usecbacktrace" in
5154 "$define") libswanted="$libswanted bfd" ;;
5155 esac
5156 libsfound=''
5157 libsfiles=''
5158 libsdirs=''
5159 libspath=''
5160 for thisdir in $libpth $xlibpth; do
5161   test -d $thisdir && libspath="$libspath $thisdir"
5162 done
5163 for thislib in $libswanted; do
5164         for thisdir in $libspath; do
5165             xxx=''
5166             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5167                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5168                 $test -f "$xxx" && eval $libscheck
5169                 $test -f "$xxx" && libstyle=shared
5170             fi
5171             if test ! -f "$xxx"; then
5172                 xxx=$thisdir/lib$thislib.$so
5173                 $test -f "$xxx" && eval $libscheck
5174                 $test -f "$xxx" && libstyle=shared
5175             fi
5176             if test ! -f "$xxx"; then
5177                 xxx=$thisdir/lib$thislib$_a
5178                 $test -f "$xxx" && eval $libscheck
5179                 $test -f "$xxx" && libstyle=static
5180             fi
5181             if test ! -f "$xxx"; then
5182                 xxx=$thisdir/$thislib$_a
5183                 $test -f "$xxx" && eval $libscheck
5184                 $test -f "$xxx" && libstyle=static
5185             fi
5186             if test ! -f "$xxx"; then
5187                 xxx=$thisdir/lib${thislib}_s$_a
5188                 $test -f "$xxx" && eval $libscheck
5189                 $test -f "$xxx" && libstyle=static
5190                 $test -f "$xxx" && thislib=${thislib}_s
5191             fi
5192             if test ! -f "$xxx"; then
5193                 xxx=$thisdir/Slib$thislib$_a
5194                 $test -f "$xxx" && eval $libscheck
5195                 $test -f "$xxx" && libstyle=static
5196             fi
5197             if $test -f "$xxx"; then
5198                 case "$libstyle" in
5199                 shared) echo "Found -l$thislib (shared)." ;;
5200                 static) echo "Found -l$thislib." ;;
5201                 *)      echo "Found -l$thislib ($libstyle)." ;;
5202                 esac
5203                 case " $dflt " in
5204                 *"-l$thislib "*);;
5205                 *) dflt="$dflt -l$thislib"
5206                    libsfound="$libsfound $xxx"
5207                    yyy=`basename $xxx`
5208                    libsfiles="$libsfiles $yyy"
5209                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5210                    case " $libsdirs " in
5211                    *" $yyy "*) ;;
5212                    *) libsdirs="$libsdirs $yyy" ;;
5213                    esac
5214                    ;;
5215                 esac
5216                 break
5217             fi
5218         done
5219         if $test ! -f "$xxx"; then
5220             echo "No -l$thislib."
5221         fi
5222 done
5223 set X $dflt
5224 shift
5225 dflt="$*"
5226 case "$libs" in
5227 '') dflt="$dflt";;
5228 *) dflt="$libs";;
5229 esac
5230 case "$dflt" in
5231 ' '|'') dflt='none';;
5232 esac
5233
5234 $cat <<EOM
5235
5236 In order to compile $package on your machine, a number of libraries
5237 are usually needed.  Include any other special libraries here as well.
5238 Say "none" for none.  The default list is almost always right.
5239 EOM
5240
5241 echo " "
5242 rp="What libraries to use?"
5243 . ./myread
5244 case "$ans" in
5245 none) libs=' ';;
5246 *) libs="$ans";;
5247 esac
5248
5249 : determine optimization, if desired, or use for debug flag also
5250 case "$optimize" in
5251 ' '|$undef) dflt='none';;
5252 '') dflt='-O';;
5253 *) dflt="$optimize";;
5254 esac
5255 $cat <<EOH
5256
5257 By default, $package compiles with the -O flag to use the optimizer.
5258 Alternately, you might want to use the symbolic debugger, which uses
5259 the -g flag (on traditional Unix systems).  Either flag can be
5260 specified here.  To use neither flag, specify the word "none".
5261
5262 EOH
5263 rp="What optimizer/debugger flag should be used?"
5264 . ./myread
5265 optimize="$ans"
5266 case "$optimize" in
5267 'none') optimize=" ";;
5268 esac
5269
5270 : Check what DEBUGGING is required from the command line
5271 : -DEBUGGING      or -DDEBUGGING or
5272 : -DEBUGGING=both                       = -g + -DDEBUGGING
5273 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5274 : -DEBUGGING=none or -UDEBUGGING        =
5275 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5276 case "$EBUGGING" in
5277 '')     ;;
5278 *)      DEBUGGING=$EBUGGING ;;
5279 esac
5280
5281 case "$DEBUGGING" in
5282 -g|both|$define)
5283     case "$optimize" in
5284         *-g*) ;;
5285         *)    optimize="$optimize -g" ;;
5286     esac ;;
5287 none|$undef)
5288     case "$optimize" in
5289         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5290                 shift
5291                 optimize="$*"
5292                 ;;
5293     esac ;;
5294 esac
5295
5296 dflt=''
5297 case "$DEBUGGING" in
5298 both|$define) dflt='-DDEBUGGING'
5299 esac
5300
5301 : argument order is deliberate, as the flag will start with - which set could
5302 : think is an option
5303 checkccflag='check=$1; flag=$2; callback=$3;
5304 echo " ";
5305 echo "Checking if your compiler accepts $flag" 2>&1;
5306 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5307 echo "int main(void) { return 0; }" > gcctest.c;
5308 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5309     echo "Yes, it does." 2>&1;
5310     if $test -s gcctest.out ; then
5311         echo "But your platform does not like it:";
5312         cat gcctest.out;
5313     else
5314         case "$ccflags" in
5315         *$check*)
5316             echo "Leaving current flags $ccflags alone." 2>&1
5317             ;;
5318         *) dflt="$dflt $flag";
5319             eval $callback
5320             ;;
5321         esac
5322     fi
5323 else
5324     echo "Nope, it does not, but that is ok." 2>&1;
5325 fi
5326 '
5327
5328 : We will not override a previous value, but we might want to
5329 : augment a hint file
5330 case "$hint" in
5331 default|recommended)
5332         case "$gccversion" in
5333         1*) dflt="$dflt -fpcc-struct-return" ;;
5334         esac
5335         case "$optimize:$DEBUGGING" in
5336         *-g*:old) dflt="$dflt -DDEBUGGING";;
5337         esac
5338         case "$gccversion" in
5339         2*) if $test -d /etc/conf/kconfig.d &&
5340                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5341                 then
5342                         # Interactive Systems (ISC) POSIX mode.
5343                         dflt="$dflt -posix"
5344                 fi
5345                 ;;
5346         esac
5347         case "$gccversion" in
5348         1*) ;;
5349         2.[0-8]*) ;;
5350         ?*)     set strict-aliasing -fno-strict-aliasing
5351                 eval $checkccflag
5352                 ;;
5353         esac
5354         # For gcc, adding -pipe speeds up compilations for some, but apparently
5355         # some assemblers can't read from stdin.  (It also slows down compilations
5356         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5357         case "$gccversion" in
5358         ?*)     set pipe -pipe
5359                 eval $checkccflag
5360                 ;;
5361         esac
5362
5363         # on x86_64 (at least) we require an extra library (libssp) in the
5364         # link command line. This library is not named, so I infer that it is
5365         # an implementation detail that may change. Hence the safest approach
5366         # is to add the flag to the flags passed to the compiler at link time,
5367         # as that way the compiler can do the right implementation dependant
5368         # thing. (NWC)
5369         case "$gccversion" in
5370         ?*)     set stack-protector -fstack-protector
5371                 eval $checkccflag
5372                 ;;
5373         esac
5374         ;;
5375 esac
5376
5377 case "$mips_type" in
5378 *BSD*|'') inclwanted="$locincpth $usrinc";;
5379 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5380 esac
5381 for thisincl in $inclwanted; do
5382         if $test -d $thisincl; then
5383                 if $test x$thisincl != x$usrinc; then
5384                         case "$dflt" in
5385                         *" -I$thisincl "*);;
5386                         *) dflt="$dflt -I$thisincl ";;
5387                         esac
5388                 fi
5389         fi
5390 done
5391
5392 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5393         xxx=true;
5394 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5395         xxx=true;
5396 else
5397         xxx=false;
5398 fi;
5399 if $xxx; then
5400         case "$dflt" in
5401         *$2*);;
5402         *) dflt="$dflt -D$2";;
5403         esac;
5404 fi'
5405
5406 set signal.h LANGUAGE_C; eval $inctest
5407
5408 case "$usesocks" in
5409 $define)
5410         ccflags="$ccflags -DSOCKS"
5411         ;;
5412 esac
5413
5414 case "$hint" in
5415 default|recommended) dflt="$ccflags $dflt" ;;
5416 *) dflt="$ccflags";;
5417 esac
5418
5419 case "$dflt" in
5420 ''|' ') dflt=none;;
5421 esac
5422
5423 $cat <<EOH
5424
5425 Your C compiler may want other flags.  For this question you should include
5426 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5427 but you should NOT include libraries or ld flags like -lwhatever.  If you
5428 want $package to honor its debug switch, you should include -DDEBUGGING here.
5429 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5430
5431 To use no flags, specify the word "none".
5432
5433 EOH
5434 set X $dflt
5435 shift
5436 dflt=${1+"$@"}
5437 rp="Any additional cc flags?"
5438 . ./myread
5439 case "$ans" in
5440 none) ccflags='';;
5441 *) ccflags="$ans";;
5442 esac
5443
5444 : the following weeds options from ccflags that are of no interest to cpp
5445 case "$cppflags" in
5446 '') cppflags="$ccflags" ;;
5447 *)  cppflags="$cppflags $ccflags" ;;
5448 esac
5449 case "$gccversion" in
5450 1*) cppflags="$cppflags -D__GNUC__"
5451 esac
5452 case "$mips_type" in
5453 '');;
5454 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5455 esac
5456 case "$cppflags" in
5457 '');;
5458 *)
5459         echo " "
5460         echo "Let me guess what the preprocessor flags are..." >&4
5461         set X $cppflags
5462         shift
5463         cppflags=''
5464         $cat >cpp.c <<'EOM'
5465 #define BLURFL foo
5466
5467 BLURFL xx LFRULB
5468 EOM
5469         previous=''
5470         for flag in $*
5471         do
5472                 case "$flag" in
5473                 -*) ftry="$flag";;
5474                 *) ftry="$previous $flag";;
5475                 esac
5476                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5477                         >cpp1.out 2>/dev/null && \
5478                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5479                         >cpp2.out 2>/dev/null && \
5480                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5481                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5482                 then
5483                         cppflags="$cppflags $ftry"
5484                         previous=''
5485                 else
5486                         previous="$flag"
5487                 fi
5488         done
5489         set X $cppflags
5490         shift
5491         cppflags=${1+"$@"}
5492         case "$cppflags" in
5493         *-*)  echo "They appear to be: $cppflags";;
5494         esac
5495         $rm -f cpp.c cpp?.out
5496         ;;
5497 esac
5498
5499 : flags used in final linking phase
5500 case "$ldflags" in
5501 '') if ./venix; then
5502                 dflt='-i -z'
5503         else
5504                 dflt=''
5505         fi
5506         case "$ccflags" in
5507         *-posix*) dflt="$dflt -posix" ;;
5508         esac
5509         ;;
5510 *) dflt="$ldflags";;
5511 esac
5512 # See note above about -fstack-protector
5513 case "$ccflags" in
5514 *-fstack-protector*)
5515         case "$dflt" in
5516         *-fstack-protector*) ;; # Don't add it again
5517         *) dflt="$dflt -fstack-protector" ;;
5518         esac
5519         ;;
5520 esac
5521
5522 : Try to guess additional flags to pick up local libraries.
5523 for thislibdir in $libpth; do
5524         case " $loclibpth " in
5525         *" $thislibdir "*)
5526                 case "$dflt " in
5527                 *"-L$thislibdir "*) ;;
5528                 *)  dflt="$dflt -L$thislibdir" ;;
5529                 esac
5530                 ;;
5531         esac
5532 done
5533
5534 case "$dflt" in
5535 '') dflt='none' ;;
5536 esac
5537
5538 $cat <<EOH
5539
5540 Your C linker may need flags.  For this question you should
5541 include -L/whatever and any other flags used by the C linker, but you
5542 should NOT include libraries like -lwhatever.
5543
5544 Make sure you include the appropriate -L/path flags if your C linker
5545 does not normally search all of the directories you specified above,
5546 namely
5547         $libpth
5548 To use no flags, specify the word "none".
5549
5550 EOH
5551
5552 rp="Any additional ld flags (NOT including libraries)?"
5553 . ./myread
5554 case "$ans" in
5555 none) ldflags='';;
5556 *) ldflags="$ans";;
5557 esac
5558 rmlist="$rmlist pdp11"
5559
5560 : coherency check
5561 echo " "
5562 echo "Checking your choice of C compiler and flags for coherency..." >&4
5563 $cat > try.c <<'EOF'
5564 #include <stdio.h>
5565 int main() { printf("Ok\n"); return(0); }
5566 EOF
5567 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5568 shift
5569 $cat >try.msg <<'EOM'
5570 I've tried to compile and run the following simple program:
5571
5572 EOM
5573 $cat try.c >> try.msg
5574
5575 $cat >> try.msg <<EOM
5576
5577 I used the command:
5578
5579         $*
5580         $run ./try
5581
5582 and I got the following output:
5583
5584 EOM
5585 dflt=y
5586 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5587         if $sh -c "$run ./try " >>try.msg 2>&1; then
5588                 xxx=`$run ./try`
5589                 case "$xxx" in
5590                 "Ok") dflt=n ;;
5591                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5592                 esac
5593         else
5594                 echo "The program compiled OK, but exited with status $?." >>try.msg
5595                 rp="You have a problem.  Shall I abort Configure"
5596                 dflt=y
5597         fi
5598 else
5599         echo "I can't compile the test program." >>try.msg
5600         rp="You have a BIG problem.  Shall I abort Configure"
5601         dflt=y
5602 fi
5603 case "$dflt" in
5604 y)
5605         $cat try.msg >&4
5606         case "$knowitall" in
5607         '')
5608                 echo "(The supplied flags or libraries might be incorrect.)"
5609                 ;;
5610         *) dflt=n;;
5611         esac
5612         echo " "
5613         . ./myread
5614         case "$ans" in
5615         n*|N*) ;;
5616         *)      echo "Ok.  Stopping Configure." >&4
5617                 exit 1
5618                 ;;
5619         esac
5620         ;;
5621 n) echo "OK, that should do.";;
5622 esac
5623 $rm_try gcctest gcctest.out
5624
5625 : define a shorthand compile call
5626 compile='
5627 mc_file=$1;
5628 shift;
5629 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5630 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5631 exit 1;
5632 fi;
5633 esac;
5634 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5635 : define a shorthand compile call for compilations that should be ok.
5636 compile_ok='
5637 mc_file=$1;
5638 shift;
5639 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5640
5641 : determine filename position in cpp output
5642 echo " "
5643 echo "Computing filename position in cpp output for #include directives..." >&4
5644 case "$osname" in
5645 vos) testaccess=-e ;;
5646 *)   testaccess=-r ;;
5647 esac
5648 echo '#include <stdio.h>' > foo.c
5649 $cat >fieldn <<EOF
5650 $startsh
5651 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5652 $grep '^[       ]*#.*stdio\.h' | \
5653 while read cline; do
5654         pos=1
5655         set \$cline
5656         while $test \$# -gt 0; do
5657                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5658                         echo "\$pos"
5659                         exit 0
5660                 fi
5661                 shift
5662                 pos=\`expr \$pos + 1\`
5663         done
5664 done
5665 EOF
5666 chmod +x fieldn
5667 fieldn=`./fieldn`
5668 $rm -f foo.c fieldn
5669 case $fieldn in
5670 '') pos='???';;
5671 1) pos=first;;
5672 2) pos=second;;
5673 3) pos=third;;
5674 *) pos="${fieldn}th";;
5675 esac
5676 echo "Your cpp writes the filename in the $pos field of the line."
5677
5678 : locate header file
5679 $cat >findhdr <<EOF
5680 $startsh
5681 wanted=\$1
5682 name=''
5683 for usrincdir in $incpth
5684 do
5685         if test -f \$usrincdir/\$wanted; then
5686                 echo "\$usrincdir/\$wanted"
5687                 exit 0
5688         fi
5689 done
5690 awkprg='{ print \$$fieldn }'
5691 echo "#include <\$wanted>" > foo\$\$.c
5692 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5693 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5694 while read cline; do
5695         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5696         case "\$name" in
5697         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5698         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5699         *) exit 2;;
5700         esac;
5701 done;
5702 #
5703 # status = 0: grep returned 0 lines, case statement not executed
5704 # status = 1: headerfile found
5705 # status = 2: while loop executed, no headerfile found
5706 #
5707 status=\$?
5708 $rm -f foo\$\$.c;
5709 if test \$status -eq 1; then
5710         exit 0;
5711 fi
5712 exit 1
5713 EOF
5714 chmod +x findhdr
5715
5716 : define an alternate in-header-list? function
5717 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5718 cont=true; xxf="echo \"<\$1> found.\" >&4";
5719 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5720 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5721 esac;
5722 case $# in 4) instead=instead;; *) instead="at last";; esac;
5723 while $test "$cont"; do
5724         xxx=`./findhdr $1`
5725         var=$2; eval "was=\$$2";
5726         if $test "$xxx" && $test -r "$xxx";
5727         then eval $xxf;
5728         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5729                 cont="";
5730         else eval $xxnf;
5731         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5732         set $yyy; shift; shift; yyy=$@;
5733         case $# in 0) cont="";;
5734         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5735                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5736         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5737                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5738         esac;
5739 done;
5740 while $test "$yyy";
5741 do set $yyy; var=$2; eval "was=\$$2";
5742         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5743         set $yyy; shift; shift; yyy=$@;
5744 done'
5745
5746 : see if stdlib is available
5747 set stdlib.h i_stdlib
5748 eval $inhdr
5749
5750 : check for lengths of integral types
5751 echo " "
5752 case "$intsize" in
5753 '')
5754         echo "Checking to see how big your integers are..." >&4
5755         $cat >try.c <<EOCP
5756 #include <stdio.h>
5757 #$i_stdlib I_STDLIB
5758 #ifdef I_STDLIB
5759 #include <stdlib.h>
5760 #endif
5761 int main()
5762 {
5763         printf("intsize=%d;\n", (int)sizeof(int));
5764         printf("longsize=%d;\n", (int)sizeof(long));
5765         printf("shortsize=%d;\n", (int)sizeof(short));
5766         exit(0);
5767 }
5768 EOCP
5769         set try
5770         if eval $compile_ok && $run ./try > /dev/null; then
5771                 eval `$run ./try`
5772                 echo "Your integers are $intsize bytes long."
5773                 echo "Your long integers are $longsize bytes long."
5774                 echo "Your short integers are $shortsize bytes long."
5775         else
5776                 $cat >&4 <<EOM
5777 !
5778 Help! I can't compile and run the intsize test program: please enlighten me!
5779 (This is probably a misconfiguration in your system or libraries, and
5780 you really ought to fix it.  Still, I'll try anyway.)
5781 !
5782 EOM
5783                 dflt=4
5784                 rp="What is the size of an integer (in bytes)?"
5785                 . ./myread
5786                 intsize="$ans"
5787                 dflt=$intsize
5788                 rp="What is the size of a long integer (in bytes)?"
5789                 . ./myread
5790                 longsize="$ans"
5791                 dflt=2
5792                 rp="What is the size of a short integer (in bytes)?"
5793                 . ./myread
5794                 shortsize="$ans"
5795         fi
5796         ;;
5797 esac
5798 $rm_try
5799
5800 : check for long long
5801 echo " "
5802 echo "Checking to see if you have long long..." >&4
5803 echo 'int main() { long long x = 7; return 0; }' > try.c
5804 set try
5805 if eval $compile; then
5806         val="$define"
5807         echo "You have long long."
5808 else
5809         val="$undef"
5810         echo "You do not have long long."
5811 fi
5812 $rm_try
5813 set d_longlong
5814 eval $setvar
5815
5816 : check for length of long long
5817 case "${d_longlong}${longlongsize}" in
5818 $define)
5819         echo " "
5820         echo "Checking to see how big your long longs are..." >&4
5821         $cat >try.c <<'EOCP'
5822 #include <stdio.h>
5823 int main()
5824 {
5825     printf("%d\n", (int)sizeof(long long));
5826     return(0);
5827 }
5828 EOCP
5829         set try
5830         if eval $compile_ok; then
5831                 longlongsize=`$run ./try`
5832                 echo "Your long longs are $longlongsize bytes long."
5833         else
5834                 dflt='8'
5835                 echo " "
5836                 echo "(I can't seem to compile the test program.  Guessing...)"
5837                 rp="What is the size of a long long (in bytes)?"
5838                 . ./myread
5839                 longlongsize="$ans"
5840         fi
5841         if $test "X$longsize" = "X$longlongsize"; then
5842                 echo "(That isn't any different from an ordinary long.)"
5843         fi
5844         ;;
5845 esac
5846 $rm_try
5847
5848 : see if inttypes.h is available
5849 : we want a real compile instead of Inhdr because some systems
5850 : have an inttypes.h which includes non-existent headers
5851 echo " "
5852 $cat >try.c <<EOCP
5853 #include <inttypes.h>
5854 int main() {
5855         static int32_t foo32 = 0x12345678;
5856 }
5857 EOCP
5858 set try
5859 if eval $compile; then
5860         echo "<inttypes.h> found." >&4
5861         val="$define"
5862 else
5863         echo "<inttypes.h> NOT found." >&4
5864         val="$undef"
5865 fi
5866 $rm_try
5867 set i_inttypes
5868 eval $setvar
5869
5870 : check for int64_t
5871 echo " "
5872 echo "Checking to see if you have int64_t..." >&4
5873 $cat >try.c <<EOCP
5874 #include <sys/types.h>
5875 #$i_inttypes I_INTTYPES
5876 #ifdef I_INTTYPES
5877 #include <inttypes.h>
5878 #endif
5879 int main() { int64_t x = 7; }
5880 EOCP
5881 set try
5882 if eval $compile; then
5883         val="$define"
5884         echo "You have int64_t."
5885 else
5886         val="$undef"
5887         echo "You do not have int64_t."
5888 fi
5889 $rm_try
5890 set d_int64_t
5891 eval $setvar
5892
5893 : Check if 64bit ints have a quad type
5894 echo " "
5895 echo "Checking which 64-bit integer type we could use..." >&4
5896
5897 case "$intsize" in
5898 8) val=int
5899    set quadtype
5900    eval $setvar
5901    val='"unsigned int"'
5902    set uquadtype
5903    eval $setvar
5904    quadkind=1
5905    ;;
5906 *) case "$longsize" in
5907    8) val=long
5908       set quadtype
5909       eval $setvar
5910       val='"unsigned long"'
5911       set uquadtype
5912       eval $setvar
5913       quadkind=2
5914       ;;
5915    *) case "$d_longlong:$longlongsize" in
5916       define:8)
5917         val='"long long"'
5918         set quadtype
5919         eval $setvar
5920         val='"unsigned long long"'
5921         set uquadtype
5922         eval $setvar
5923         quadkind=3
5924         ;;
5925       *) case "$d_int64_t" in
5926          define)
5927            val=int64_t
5928            set quadtype
5929            eval $setvar
5930            val=uint64_t
5931            set uquadtype
5932            eval $setvar
5933            quadkind=4
5934            ;;
5935          esac
5936          ;;
5937       esac
5938       ;;
5939    esac
5940    ;;
5941 esac
5942
5943 case "$quadtype" in
5944 '')     echo "Alas, no 64-bit integer types in sight." >&4
5945         d_quad="$undef"
5946         ;;
5947 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5948         d_quad="$define"
5949         ;;
5950 esac
5951
5952 : Do we want 64bit support
5953 case "$uselonglong" in
5954 "$define"|true|[yY]*)
5955         cat <<EOM >&4
5956
5957 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5958 EOM
5959         use64bitint="$define"
5960         ;;
5961 esac
5962 case "$use64bits" in
5963 "$define"|true|[yY]*)
5964         cat <<EOM >&4
5965
5966 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5967 EOM
5968         use64bitint="$define"
5969         ;;
5970 esac
5971 case "$use64bitints" in
5972 "$define"|true|[yY]*)
5973         cat <<EOM >&4
5974
5975 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5976 EOM
5977         use64bitint="$define"
5978         ;;
5979 esac
5980 case "$use64bitsint" in
5981 "$define"|true|[yY]*)
5982         cat <<EOM >&4
5983
5984 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5985 EOM
5986         use64bitint="$define"
5987         ;;
5988 esac
5989 case "$uselonglongs" in
5990 "$define"|true|[yY]*)
5991         cat <<EOM >&4
5992
5993 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5994 EOM
5995         use64bitint="$define"
5996         ;;
5997 esac
5998 case "$use64bitsall" in
5999 "$define"|true|[yY]*)
6000         cat <<EOM >&4
6001
6002 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6003 EOM
6004         use64bitall="$define"
6005         ;;
6006 esac
6007
6008 case "$ccflags" in
6009 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6010 esac
6011 case "$use64bitall" in
6012 "$define"|true|[yY]*) use64bitint="$define" ;;
6013 esac
6014
6015 case "$longsize" in
6016 8) cat <<EOM
6017
6018 You have natively 64-bit long integers.
6019 EOM
6020    val="$define"
6021    ;;
6022 *) case "$use64bitint" in
6023    "$define"|true|[yY]*) dflt='y';;
6024    *) dflt='n';;
6025    esac
6026    case "$d_quad" in
6027    "$define") ;;
6028    *) dflt='n' ;;
6029    esac
6030    cat <<EOM
6031
6032 Perl can be built to take advantage of 64-bit integer types
6033 on some systems.  To do so, Configure can be run with -Duse64bitint.
6034 Choosing this option will most probably introduce binary incompatibilities.
6035
6036 If this doesn't make any sense to you, just accept the default '$dflt'.
6037 (The default has been chosen based on your configuration.)
6038 EOM
6039    rp='Try to use 64-bit integers, if available?'
6040    . ./myread
6041    case "$ans" in
6042    [yY]*) val="$define" ;;
6043    *)     val="$undef"  ;;
6044    esac
6045    ;;
6046 esac
6047 set use64bitint
6048 eval $setvar
6049
6050 case "$use64bitall" in
6051 "$define"|true|[yY]*) dflt='y' ;;
6052 *) case "$longsize" in
6053    8) dflt='y' ;;
6054    *) dflt='n' ;;
6055    esac
6056    ;;
6057 esac
6058 cat <<EOM
6059
6060 You may also choose to try maximal 64-bitness.  It means using as much
6061 64-bitness as possible on the platform.  This in turn means even more
6062 binary incompatibilities.  On the other hand, your platform may not
6063 have any more 64-bitness available than what you already have chosen.
6064
6065 If this doesn't make any sense to you, just accept the default '$dflt'.
6066 (The default has been chosen based on your configuration.)
6067 EOM
6068 rp='Try to use maximal 64-bit support, if available?'
6069 . ./myread
6070 case "$ans" in
6071 [yY]*) val="$define" ;;
6072 *)     val="$undef"  ;;
6073 esac
6074 set use64bitall
6075 eval $setvar
6076 case "$use64bitall" in
6077 "$define")
6078         case "$use64bitint" in
6079         "$undef")
6080                 cat <<EOM
6081
6082 Since you have chosen a maximally 64-bit build, I'm also turning on
6083 the use of 64-bit integers.
6084 EOM
6085                 use64bitint="$define" ;;
6086         esac
6087         ;;
6088 esac
6089
6090 : Look for a hint-file generated 'call-back-unit'.  If the
6091 : user has specified that a 64-bit perl is to be built,
6092 : we may need to set or change some other defaults.
6093 if $test -f use64bitint.cbu; then
6094         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6095         . ./use64bitint.cbu
6096 fi
6097 case "$use64bitint" in
6098 "$define"|true|[yY]*)
6099         : This test was common to all the OpenBSD forks, and seems harmless for
6100         : other platforms:
6101         echo " "
6102         echo "Checking if your C library has broken 64-bit functions..." >&4
6103         cat >try.c <<EOCP
6104 #include <stdio.h>
6105 typedef $uquadtype myULL;
6106 int main (void)
6107 {
6108     struct {
6109         double d;
6110         myULL  u;
6111     } *p, test[] = {
6112         {4294967303.15, 4294967303ULL},
6113         {4294967294.2,  4294967294ULL},
6114         {4294967295.7,  4294967295ULL},
6115         {0.0, 0ULL}
6116     };
6117     for (p = test; p->u; p++) {
6118         myULL x = (myULL)p->d;
6119         if (x != p->u) {
6120             printf("buggy\n");
6121             return 0;
6122         }
6123     }
6124     printf("ok\n");
6125     return 0;
6126 }
6127 EOCP
6128         set try
6129         if eval $compile_ok; then
6130             libcquad=`$run ./try`
6131             echo "Your C library's 64-bit functions are $libcquad."
6132         else
6133             echo "(I can't seem to compile the test program.)"
6134             echo "Assuming that your C library's 64-bit functions are ok."
6135             libcquad="ok"
6136         fi
6137         $rm_try
6138
6139         case "$libcquad" in
6140             buggy*)
6141                 cat >&4 <<EOM
6142
6143 *** You have a C library with broken 64-bit functions.
6144 *** 64-bit support does not work reliably in this configuration.
6145 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6146 *** Cannot continue, aborting.
6147
6148 EOM
6149                 exit 1
6150                 ;;
6151         esac
6152         case "$longsize" in
6153         4) case "$archname64" in
6154            '') archname64=64int ;;
6155            esac
6156            ;;
6157         esac
6158         ;;
6159 esac
6160
6161 : Look for a hint-file generated 'call-back-unit'.  If the
6162 : user has specified that a maximally 64-bit perl is to be built,
6163 : we may need to set or change some other defaults.
6164 if $test -f use64bitall.cbu; then
6165         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6166         . ./use64bitall.cbu
6167 fi
6168 case "$use64bitall" in
6169 "$define"|true|[yY]*)
6170         case "$longsize" in
6171         4) case "$archname64" in
6172            ''|64int) archname64=64all ;;
6173            esac
6174            ;;
6175         esac
6176         ;;
6177 esac
6178
6179 case "$d_quad:$use64bitint" in
6180 $undef:$define)
6181         cat >&4 <<EOF
6182
6183 *** You have chosen to use 64-bit integers,
6184 *** but none can be found.
6185 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6186 *** Cannot continue, aborting.
6187
6188 EOF
6189         exit 1
6190         ;;
6191 esac
6192
6193 : check for length of double
6194 echo " "
6195 case "$doublesize" in
6196 '')
6197         echo "Checking to see how big your double precision numbers are..." >&4
6198         $cat >try.c <<EOCP
6199 #include <stdio.h>
6200 #$i_stdlib I_STDLIB
6201 #ifdef I_STDLIB
6202 #include <stdlib.h>
6203 #endif
6204 int main()
6205 {
6206     printf("%d\n", (int)sizeof(double));
6207     exit(0);
6208 }
6209 EOCP
6210         set try
6211         if eval $compile_ok; then
6212                 doublesize=`$run ./try`
6213                 echo "Your double is $doublesize bytes long."
6214         else
6215                 dflt='8'
6216                 echo "(I can't seem to compile the test program.  Guessing...)"
6217                 rp="What is the size of a double precision number (in bytes)?"
6218                 . ./myread
6219                 doublesize="$ans"
6220         fi
6221         ;;
6222 esac
6223 $rm_try
6224
6225 : check for long doubles
6226 echo " "
6227 echo "Checking to see if you have long double..." >&4
6228 echo 'int main() { long double x = 7.0; }' > try.c
6229 set try
6230 if eval $compile; then
6231         val="$define"
6232         echo "You have long double."
6233 else
6234         val="$undef"
6235         echo "You do not have long double."
6236 fi
6237 $rm_try
6238 set d_longdbl
6239 eval $setvar
6240
6241 : check for length of long double
6242 case "${d_longdbl}${longdblsize}" in
6243 $define)
6244         echo " "
6245         echo "Checking to see how big your long doubles are..." >&4
6246         $cat >try.c <<'EOCP'
6247 #include <stdio.h>
6248 int main()
6249 {
6250         printf("%d\n", sizeof(long double));
6251 }
6252 EOCP
6253         set try
6254         set try
6255         if eval $compile; then
6256                 longdblsize=`$run ./try`
6257                 echo "Your long doubles are $longdblsize bytes long."
6258         else
6259                 dflt='8'
6260                 echo " "
6261                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6262                 rp="What is the size of a long double (in bytes)?"
6263                 . ./myread
6264                 longdblsize="$ans"
6265         fi
6266         if $test "X$doublesize" = "X$longdblsize"; then
6267                 echo "That isn't any different from an ordinary double."
6268                 echo "I'll keep your setting anyway, but you may see some"
6269                 echo "harmless compilation warnings."
6270         fi
6271         ;;
6272 esac
6273 $rm_try
6274
6275 : determine the architecture name
6276 echo " "
6277 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6278         tarch=`arch`"-$osname"
6279 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6280         if uname -m > tmparch 2>&1 ; then
6281                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6282                         -e 's/$/'"-$osname/" tmparch`
6283         else
6284                 tarch="$osname"
6285         fi
6286         $rm -f tmparch
6287 else
6288         tarch="$osname"
6289 fi
6290 case "$myarchname" in
6291 ''|"$tarch") ;;
6292 *)
6293         echo "(Your architecture name used to be $myarchname.)"
6294         archname=''
6295         ;;
6296 esac
6297 case "$targetarch" in
6298 '') ;;
6299 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6300 esac
6301 myarchname="$tarch"
6302 case "$archname" in
6303 '') dflt="$tarch";;
6304 *) dflt="$archname";;
6305 esac
6306 rp='What is your architecture name'
6307 . ./myread
6308 archname="$ans"
6309
6310 : optionally add API version to the architecture for versioned archlibs
6311 case "$useversionedarchname" in
6312 $define|true|[yY]*) dflt='y';;
6313 *)                  dflt='n';;
6314 esac
6315 rp='Add the Perl API version to your archname?'
6316 . ./myread
6317 case "$ans" in
6318 y|Y)    useversionedarchname="$define" ;;
6319 *)      useversionedarchname="$undef" ;;
6320 esac
6321 case "$useversionedarchname" in
6322 $define)
6323         case "$archname" in
6324         *-$api_versionstring)
6325                 echo "...and architecture name already has -$api_versionstring" >&4
6326                 ;;
6327         *)
6328                 archname="$archname-$api_versionstring"
6329                 echo "...setting architecture name to $archname." >&4
6330                 ;;
6331         esac
6332         ;;
6333 esac
6334
6335 case "$usethreads" in
6336 $define)
6337         echo "Threads selected." >&4
6338         case "$archname" in
6339         *-thread*) echo "...and architecture name already has -thread." >&4
6340                 ;;
6341         *)      archname="$archname-thread"
6342                 echo "...setting architecture name to $archname." >&4
6343                 ;;
6344         esac
6345         ;;
6346 esac
6347 case "$usemultiplicity" in
6348 $define)
6349         echo "Multiplicity selected." >&4
6350         case "$archname" in
6351         *-multi*) echo "...and architecture name already has -multi." >&4
6352                 ;;
6353         *)      archname="$archname-multi"
6354                 echo "...setting architecture name to $archname." >&4
6355                 ;;
6356         esac
6357         ;;
6358 esac
6359 case "$use64bitint$use64bitall" in
6360 *"$define"*)
6361         case "$archname64" in
6362         '')
6363                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6364                 ;;
6365         *)
6366                 case "$use64bitint" in
6367                 "$define") echo "64 bit integers selected." >&4 ;;
6368                 esac
6369                 case "$use64bitall" in
6370                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6371                 esac
6372                 case "$archname" in
6373                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6374                         ;;
6375                 *)      archname="$archname-$archname64"
6376                         echo "...setting architecture name to $archname." >&4
6377                         ;;
6378                 esac
6379                 ;;
6380         esac
6381 esac
6382 case "$uselongdouble" in
6383 $define)
6384         echo "Long doubles selected." >&4
6385         case "$longdblsize" in
6386         $doublesize)
6387                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6388                 ;;
6389         *)
6390                 case "$archname" in
6391                 *-ld*) echo "...and architecture name already has -ld." >&4
6392                         ;;
6393                 *)      archname="$archname-ld"
6394                         echo "...setting architecture name to $archname." >&4
6395                         ;;
6396                 esac
6397                 ;;
6398         esac
6399         ;;
6400 esac
6401 if $test -f archname.cbu; then
6402         echo "Your platform has some specific hints for architecture name, using them..."
6403         . ./archname.cbu
6404 fi
6405
6406 : set the prefixit variable, to compute a suitable default value
6407 prefixit='case "$3" in
6408 ""|none)
6409         case "$oldprefix" in
6410         "") eval "$1=\"\$$2\"";;
6411         *)
6412                 case "$3" in
6413                 "") eval "$1=";;
6414                 none)
6415                         eval "tp=\"\$$2\"";
6416                         case "$tp" in
6417                         ""|" ") eval "$1=\"\$$2\"";;
6418                         *) eval "$1=";;
6419                         esac;;
6420                 esac;;
6421         esac;;
6422 *)
6423         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6424         case "$tp" in
6425         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6426         /*-$oldprefix/*|\~*-$oldprefix/*)
6427                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6428         *) eval "$1=\"\$$2\"";;
6429         esac;;
6430 esac'
6431
6432 : determine installation style
6433 : For now, try to deduce it from prefix unless it is already set.
6434 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6435 case "$installstyle" in
6436 '')     case "$prefix" in
6437                 *perl*) dflt='lib';;
6438                 *) dflt='lib/perl5' ;;
6439         esac
6440         ;;
6441 *)      dflt="$installstyle" ;;
6442 esac
6443 : Probably not worth prompting for this since we prompt for all
6444 : the directories individually, and the prompt would be too long and
6445 : confusing anyway.
6446 installstyle=$dflt
6447
6448 : determine where public executables go
6449 echo " "
6450 set dflt bin bin
6451 eval $prefixit
6452 fn=d~
6453 rp='Pathname where the public executables will reside?'
6454 . ./getfile
6455 if $test "X$ansexp" != "X$binexp"; then
6456         installbin=''
6457 fi
6458 prefixvar=bin
6459 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6460 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6461 :     this via initialinstalllocation
6462 . ./setprefixvar
6463
6464 case "$userelocatableinc" in
6465 $define|true|[yY]*)     dflt='y' ;;
6466 *)                      dflt='n' ;;
6467 esac
6468 cat <<EOM
6469
6470 Would you like to build Perl so that the installation is relocatable, so that
6471 library paths in @INC are determined relative to the path of the perl binary?
6472 This is not advised for system Perl installs, or if you need to run setid
6473 scripts or scripts under taint mode.
6474
6475 If this doesn't make any sense to you, just accept the default '$dflt'.
6476 EOM
6477 rp='Use relocatable @INC?'
6478 . ./myread
6479 case "$ans" in
6480 y|Y)    val="$define" ;;
6481 *)      val="$undef"  ;;
6482 esac
6483 set userelocatableinc
6484 eval $setvar
6485
6486 initialinstalllocation="$binexp"
6487 : Default prefix is now "up one level from where the binaries are"
6488 case "$userelocatableinc" in
6489 $define|true|[yY]*)
6490     bin=".../"
6491     binexp=".../"
6492     prefix=".../.."
6493     prefixexp=".../.."
6494     installprefixexp=".../.."
6495     ;;
6496 esac
6497
6498 : determine where private library files go
6499 : Usual default is /usr/local/lib/perl5/$version.
6500 : Also allow things like /opt/perl/lib/$version, since
6501 : /opt/perl/lib/perl5... would be redundant.
6502 : The default "style" setting is made in installstyle.U
6503 case "$installstyle" in
6504 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6505 *)       set dflt privlib lib/$version ;;
6506 esac
6507 eval $prefixit
6508 $cat <<EOM
6509
6510 There are some auxiliary files for $package that need to be put into a
6511 private library directory that is accessible by everyone.
6512
6513 EOM
6514 fn=$binexp
6515 fn=d~+
6516 rp='Pathname where the private library files will reside?'
6517 . ./getfile
6518 prefixvar=privlib
6519 . ./setprefixvar
6520
6521 : set the prefixup variable, to restore leading tilda escape
6522 prefixup='case "$prefixexp" in
6523 "$prefix") ;;
6524 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6525 esac'
6526
6527 : determine where public architecture dependent libraries go
6528 set archlib archlib
6529 eval $prefixit
6530 : privlib default is /usr/local/lib/$package/$version
6531 : archlib default is /usr/local/lib/$package/$version/$archname
6532 : privlib may have an optional trailing /share.
6533 tdflt=`echo $privlib | $sed 's,/share$,,'`
6534 tdflt=$tdflt/$archname
6535 case "$archlib" in
6536 '')     dflt=$tdflt
6537         ;;
6538 *)      dflt="$archlib"
6539     ;;
6540 esac
6541 $cat <<EOM
6542
6543 $spackage contains architecture-dependent library files.  If you are
6544 sharing libraries in a heterogeneous environment, you might store
6545 these files in a separate location.  Otherwise, you can just include
6546 them with the rest of the public library files.
6547
6548 EOM
6549 fn=$binexp
6550 fn=d+~
6551 rp='Where do you want to put the public architecture-dependent libraries?'
6552 . ./getfile
6553 prefixvar=archlib
6554 . ./setprefixvar
6555 if $test X"$archlib" = X"$privlib"; then
6556         d_archlib="$undef"
6557 else
6558         d_archlib="$define"
6559 fi
6560
6561 : see if setuid scripts can be secure
6562 $cat <<EOM
6563
6564 Some kernels have a bug that prevents setuid #! scripts from being
6565 secure.  Some sites have disabled setuid #! scripts because of this.
6566
6567 First let's decide if your kernel supports secure setuid #! scripts.
6568 (If setuid #! scripts would be secure but have been disabled anyway,
6569 don't say that they are secure if asked.)
6570
6571 EOM
6572
6573 val="$undef"
6574 if $test -d /dev/fd; then
6575         echo "#!$ls" >reflect
6576         chmod +x,u+s reflect
6577         ./reflect >flect 2>&1
6578         if $contains "/dev/fd" flect >/dev/null; then
6579                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6580                 val="$define"
6581         else
6582                 $cat <<EOM
6583 If you are not sure if they are secure, I can check but I'll need a
6584 username and password different from the one you are using right now.
6585 If you don't have such a username or don't want me to test, simply
6586 enter 'none'.
6587
6588 EOM
6589                 rp='Other username to test security of setuid scripts with?'
6590                 dflt='none'
6591                 . ./myread
6592                 case "$ans" in
6593                 n|none)
6594                         case "$d_suidsafe" in
6595                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6596                                 dflt=n;;
6597                         "$undef")
6598                                 echo "Well, the $hint value is *not* secure." >&4
6599                                 dflt=n;;
6600                         *)      echo "Well, the $hint value *is* secure." >&4
6601                                 dflt=y;;
6602                         esac
6603                         ;;
6604                 *)
6605                         $rm -f reflect flect
6606                         echo "#!$ls" >reflect
6607                         chmod +x,u+s reflect
6608                         echo >flect
6609                         chmod a+w flect
6610                         echo '"su" will (probably) prompt you for '"$ans's password."
6611                         su $ans -c './reflect >flect'
6612                         if $contains "/dev/fd" flect >/dev/null; then
6613                                 echo "Okay, it looks like setuid scripts are secure." >&4
6614                                 dflt=y
6615                         else
6616                                 echo "I don't think setuid scripts are secure." >&4
6617                                 dflt=n
6618                         fi
6619                         ;;
6620                 esac
6621                 rp='Does your kernel have *secure* setuid scripts?'
6622                 . ./myread
6623                 case "$ans" in
6624                 [yY]*)  val="$define";;
6625                 *)      val="$undef";;
6626                 esac
6627         fi
6628 else
6629         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6630         echo "(That's for file descriptors, not floppy disks.)"
6631         val="$undef"
6632 fi
6633 set d_suidsafe
6634 eval $setvar
6635
6636 $rm -f reflect flect
6637
6638 : now see if they want to do setuid emulation
6639 if $test $patchlevel -lt 11; then
6640 echo " "
6641 val="$undef"
6642 case "$d_suidsafe" in
6643 "$define")
6644         val="$undef"
6645         echo "No need to emulate SUID scripts since they are secure here." >&4
6646         ;;
6647 *)
6648         $cat <<EOM
6649 Some systems have disabled setuid scripts, especially systems where
6650 setuid scripts cannot be secure.  On systems where setuid scripts have
6651 been disabled, the setuid/setgid bits on scripts are currently
6652 useless.  It is possible for $package to detect those bits and emulate
6653 setuid/setgid in a secure fashion.  This emulation will only work if
6654 setuid scripts have been disabled in your kernel.
6655
6656 EOM
6657         case "$d_dosuid" in
6658         "$define") dflt=y ;;
6659         *) dflt=n ;;
6660         esac
6661         rp="Do you want to do setuid/setgid emulation?"
6662         . ./myread
6663         case "$ans" in
6664         [yY]*)  val="$define";;
6665         *)      val="$undef";;
6666         esac
6667         ;;
6668 esac
6669 set d_dosuid
6670 eval $setvar
6671 else
6672     case "$d_dosuid" in
6673         "$define")
6674         cat >&4 <<EOH
6675
6676 SUID emulation has been removed for 5.12
6677 Please re-run Configure without -Dd_dosuid
6678
6679 EOH
6680         exit 1;
6681         ;;
6682     esac
6683     d_dosuid=undef
6684 fi
6685
6686 : Find perl5.005 or later.
6687 echo "Looking for a previously installed perl5.005 or later... "
6688 case "$perl5" in
6689 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6690                 : Check if this perl is recent and can load a simple module
6691                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6692                         perl5=$tdir/perl
6693                         break;
6694                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6695                         perl5=$tdir/perl5
6696                         break;
6697                 fi
6698         done
6699         ;;
6700 *)      perl5="$perl5"
6701         ;;
6702 esac
6703 case "$perl5" in
6704 '')     echo "None found.  That's ok.";;
6705 *)      echo "Using $perl5." ;;
6706 esac
6707
6708 : Set the siteprefix variables
6709 $cat <<EOM
6710
6711 After $package is installed, you may wish to install various
6712 add-on modules and utilities.  Typically, these add-ons will
6713 be installed under $prefix with the rest
6714 of this package.  However, you may wish to install such add-ons
6715 elsewhere under a different prefix.
6716
6717 If you do not wish to put everything under a single prefix, that's
6718 ok.  You will be prompted for the individual locations; this siteprefix
6719 is only used to suggest the defaults.
6720
6721 The default should be fine for most people.
6722
6723 EOM
6724 fn=d~+
6725 rp='Installation prefix to use for add-on modules and utilities?'
6726 : XXX Here might be another good place for an installstyle setting.
6727 case "$siteprefix" in
6728 '') dflt=$prefix ;;
6729 *)  dflt=$siteprefix ;;
6730 esac
6731 . ./getfile
6732 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6733 oldsiteprefix=''
6734 case "$siteprefix" in
6735 '') ;;
6736 *)      case "$ans" in
6737         "$prefix") ;;
6738         *) oldsiteprefix="$prefix";;
6739         esac
6740         ;;
6741 esac
6742 siteprefix="$ans"
6743 siteprefixexp="$ansexp"
6744
6745 : determine where site specific libraries go.
6746 : Usual default is /usr/local/lib/perl5/site_perl/$version
6747 : The default "style" setting is made in installstyle.U
6748 : XXX No longer works with Prefixit stuff.
6749 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6750 case "$sitelib" in
6751 '') case "$installstyle" in
6752         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6753         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6754         esac
6755         ;;
6756 *)      dflt="$sitelib"
6757         ;;
6758 esac
6759 $cat <<EOM
6760
6761 The installation process will create a directory for
6762 site-specific extensions and modules.  Most users find it convenient
6763 to place all site-specific files in this directory rather than in the
6764 main distribution directory.
6765
6766 EOM
6767 fn=d~+
6768 rp='Pathname for the site-specific library files?'
6769 . ./getfile
6770 prefixvar=sitelib
6771 . ./setprefixvar
6772 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6773
6774 : Determine list of previous versions to include in @INC
6775 $cat > getverlist <<EOPL
6776 #!$perl5 -w
6777 use File::Basename;
6778 \$api_versionstring = "$api_versionstring";
6779 \$version = "$version";
6780 \$stem = "$sitelib_stem";
6781 \$archname = "$archname";
6782 EOPL
6783         $cat >> getverlist <<'EOPL'
6784 # The list found is store twice for each entry: the original name, and
6785 # the binary broken down version as pack "sss", so sorting is easy and
6786 # unambiguous. This will work for all versions that have a maximum of
6787 # three digit groups, separate by '.'s or '_'s. Names are extended with
6788 # ".0.0" to ensure at least three elements for the pack.
6789 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6790
6791 # Can't have leading @ because metaconfig interprets it as a command!
6792 ;@inc_version_list=();
6793 # XXX Redo to do opendir/readdir?
6794 if (-d $stem) {
6795     chdir($stem);
6796     ;@candidates = map {
6797         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6798     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6799 }
6800 else {
6801     ;@candidates = ();
6802 }
6803
6804 ($pversion, $aversion, $vsn5005) = map {
6805     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6806 foreach $d (@candidates) {
6807     if ($d->[1] lt $pversion) {
6808         if ($d->[1] ge $aversion) {
6809             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6810         }
6811         elsif ($d->[1] ge $vsn5005) {
6812             unshift(@inc_version_list, grep { -d } $d->[0]);
6813         }
6814     }
6815     else {
6816         # Skip newer version.  I.e. don't look in
6817         # 5.7.0 if we're installing 5.6.1.
6818     }
6819 }
6820
6821 if (@inc_version_list) {
6822     print join(' ', @inc_version_list);
6823 }
6824 else {
6825     # Blank space to preserve value for next Configure run.
6826     print " ";
6827 }
6828 EOPL
6829 chmod +x getverlist
6830 case "$inc_version_list" in
6831 '')     if test -x "$perl5$exe_ext"; then
6832                 dflt=`$perl5 getverlist`
6833         else
6834                 dflt='none'
6835         fi
6836         ;;
6837 $undef) dflt='none' ;;
6838 *)  eval dflt=\"$inc_version_list\" ;;
6839 esac
6840 case "$dflt" in
6841 ''|' ') dflt=none ;;
6842 esac
6843 case "$dflt" in
6844 5.005) dflt=none ;;
6845 esac
6846 $cat <<EOM
6847
6848 In order to ease the process of upgrading, this version of perl
6849 can be configured to use modules built and installed with earlier
6850 versions of perl that were installed under $prefix.  Specify here
6851 the list of earlier versions that this version of perl should check.
6852 If Configure detected no earlier versions of perl installed under
6853 $prefix, then the list will be empty.  Answer 'none' to tell perl
6854 to not search earlier versions.
6855
6856 The default should almost always be sensible, so if you're not sure,
6857 just accept the default.
6858 EOM
6859
6860 rp='List of earlier versions to include in @INC?'
6861 . ./myread
6862 case "$ans" in
6863 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6864 *) inc_version_list="$ans" ;;
6865 esac
6866 case "$inc_version_list" in
6867 ''|' ')
6868         inc_version_list_init='0'
6869         d_inc_version_list="$undef"
6870         ;;
6871 *)      inc_version_list_init=`echo $inc_version_list |
6872                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6873         d_inc_version_list="$define"
6874         ;;
6875 esac
6876 $rm -f getverlist
6877
6878 : see if malloc/malloc.h has to be included
6879 set malloc/malloc.h i_mallocmalloc
6880 eval $inhdr
6881
6882 : see if this is a malloc.h system
6883 : we want a real compile instead of Inhdr because some systems have a
6884 : malloc.h that just gives a compile error saying to use stdlib.h instead
6885 echo " "
6886 $cat >try.c <<EOCP
6887 #include <stdlib.h>
6888 #include <malloc.h>
6889 #$i_mallocmalloc I_MALLOCMALLOC
6890 #ifdef I_MALLOCMALLOC
6891 # include <malloc/malloc.h>
6892 #endif
6893
6894 int main () { return 0; }
6895 EOCP
6896 set try
6897 if eval $compile; then
6898     echo "<malloc.h> found." >&4
6899     val="$define"
6900 else
6901     echo "<malloc.h> NOT found." >&4
6902     val="$undef"
6903 fi
6904 $rm_try
6905 set i_malloc
6906 eval $setvar
6907
6908 : check for length of pointer
6909 echo " "
6910 case "$ptrsize" in
6911 '')
6912         echo "Checking to see how big your pointers are..." >&4
6913         $cat >>try.c <<EOCP
6914 #include <stdio.h>
6915 #$i_stdlib I_STDLIB
6916 #ifdef I_STDLIB
6917 #include <stdlib.h>
6918 #endif
6919 int main()
6920 {
6921     printf("%d\n", (int)sizeof(void *));
6922     exit(0);
6923 }
6924 EOCP
6925         set try
6926         if eval $compile_ok; then
6927                 ptrsize=`$run ./try`
6928                 echo "Your pointers are $ptrsize bytes long."
6929         else
6930                 dflt='4'
6931                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6932                 rp="What is the size of a pointer (in bytes)?"
6933                 . ./myread
6934                 ptrsize="$ans"
6935         fi
6936         ;;
6937 esac
6938 $rm_try
6939 case "$use64bitall" in
6940 "$define"|true|[yY]*)
6941         case "$ptrsize" in
6942         4)      cat <<EOM >&4
6943
6944 *** You have chosen a maximally 64-bit build,
6945 *** but your pointers are only 4 bytes wide.
6946 *** Please rerun Configure without -Duse64bitall.
6947 EOM
6948                 case "$d_quad" in
6949                 define)
6950                         cat <<EOM >&4
6951 *** Since you have quads, you could possibly try with -Duse64bitint.
6952 EOM
6953                         ;;
6954                 esac
6955                 cat <<EOM >&4
6956 *** Cannot continue, aborting.
6957
6958 EOM
6959
6960                 exit 1
6961                 ;;
6962         esac
6963         ;;
6964 esac
6965
6966
6967 : determine whether to use malloc wrapping
6968 echo " "
6969 case "$usemallocwrap" in
6970 [yY]*|true|$define)     dflt='y' ;;
6971 [nN]*|false|$undef)     dflt='n' ;;
6972 *)      case "$usedevel" in
6973         [yY]*|true|$define)     dflt='y' ;;
6974         *) dflt='n' ;;
6975         esac
6976         ;;
6977 esac
6978 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6979 . ./myread
6980 usemallocwrap="$ans"
6981 case "$ans" in
6982 y*|true)
6983         usemallocwrap="$define" ;;
6984 *)
6985         usemallocwrap="$undef" ;;
6986 esac
6987
6988 : determine which malloc to compile in
6989 echo " "
6990 case "$usemymalloc" in
6991 [yY]*|true|$define)     dflt='y' ;;
6992 [nN]*|false|$undef)     dflt='n' ;;
6993 *)      case "$ptrsize" in
6994         4) dflt='y' ;;
6995         *) dflt='n' ;;
6996         esac
6997         if test "$useithreads" = "$define"; then dflt='n'; fi
6998         ;;
6999 esac
7000 rp="Do you wish to attempt to use the malloc that comes with $package?"
7001 . ./myread
7002 usemymalloc="$ans"
7003 case "$ans" in
7004 y*|true)
7005         usemymalloc='y'
7006         mallocsrc='malloc.c'
7007         mallocobj="malloc$_o"
7008         d_mymalloc="$define"
7009         case "$libs" in
7010         *-lmalloc*)
7011                 : Remove malloc from list of libraries to use
7012                 echo "Removing unneeded -lmalloc from library list" >&4
7013                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7014                 shift
7015                 libs="$*"
7016                 echo "libs = $libs" >&4
7017                 ;;
7018         esac
7019         ;;
7020 *)
7021         usemymalloc='n'
7022         mallocsrc=''
7023         mallocobj=''
7024         d_mymalloc="$undef"
7025         ;;
7026 esac
7027
7028 : compute the return types of malloc and free
7029 echo " "
7030 $cat >malloc.c <<END
7031 #$i_malloc I_MALLOC
7032 #$i_stdlib I_STDLIB
7033 #include <stdio.h>
7034 #include <sys/types.h>
7035 #ifdef I_MALLOC
7036 #include <malloc.h>
7037 #endif
7038 #ifdef I_STDLIB
7039 #include <stdlib.h>
7040 #endif
7041 #ifdef TRY_MALLOC
7042 void *malloc();
7043 #endif
7044 #ifdef TRY_FREE
7045 void free();
7046 #endif
7047 END
7048 case "$malloctype" in
7049 '')
7050         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7051                 malloctype='void *'
7052         else
7053                 malloctype='char *'
7054         fi
7055         ;;
7056 esac
7057 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7058
7059 case "$freetype" in
7060 '')
7061         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7062                 freetype='void'
7063         else
7064                 freetype='int'
7065         fi
7066         ;;
7067 esac
7068 echo "Your system uses $freetype free(), it would seem." >&4
7069 $rm -f malloc.[co]
7070 : determine where site specific architecture-dependent libraries go.
7071 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7072 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7073 : sitelib may have an optional trailing /share.
7074 case "$sitearch" in
7075 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7076         dflt="$dflt/$archname"
7077         ;;
7078 *)      dflt="$sitearch"
7079         ;;
7080 esac
7081 set sitearch sitearch none
7082 eval $prefixit
7083 $cat <<EOM
7084
7085 The installation process will also create a directory for
7086 architecture-dependent site-specific extensions and modules.
7087
7088 EOM
7089 fn=d~+
7090 rp='Pathname for the site-specific architecture-dependent library files?'
7091 . ./getfile
7092 prefixvar=sitearch
7093 . ./setprefixvar
7094 if $test X"$sitearch" = X"$sitelib"; then
7095         d_sitearch="$undef"
7096 else
7097         d_sitearch="$define"
7098 fi
7099
7100 : Set the vendorprefix variables
7101 $cat <<EOM
7102
7103 The installation process will also create a directory for
7104 vendor-supplied add-ons.  Vendors who supply perl with their system
7105 may find it convenient to place all vendor-supplied files in this
7106 directory rather than in the main distribution directory.  This will
7107 ease upgrades between binary-compatible maintenance versions of perl.
7108
7109 Of course you may also use these directories in whatever way you see
7110 fit.  For example, you might use them to access modules shared over a
7111 company-wide network.
7112
7113 The default answer should be fine for most people.
7114 This causes further questions about vendor add-ons to be skipped
7115 and no vendor-specific directories will be configured for perl.
7116
7117 EOM
7118 rp='Do you want to configure vendor-specific add-on directories?'
7119 case "$usevendorprefix" in
7120 define|true|[yY]*) dflt=y ;;
7121 *)      : User may have set vendorprefix directly on Configure command line.
7122         case "$vendorprefix" in
7123         ''|' ') dflt=n ;;
7124         *)      dflt=y ;;
7125         esac
7126         ;;
7127 esac
7128 . ./myread
7129 case "$ans" in
7130 [yY]*)  fn=d~+
7131         rp='Installation prefix to use for vendor-supplied add-ons?'
7132         case "$vendorprefix" in
7133         '') dflt="$prefix" ;;
7134         *)  dflt=$vendorprefix ;;
7135         esac
7136         . ./getfile
7137         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7138         oldvendorprefix=''
7139         case "$vendorprefix" in
7140         '') ;;
7141         *)      case "$ans" in
7142                 "$prefix") ;;
7143                 *) oldvendorprefix="$prefix";;
7144                 esac
7145                 ;;
7146         esac
7147         usevendorprefix="$define"
7148         vendorprefix="$ans"
7149         vendorprefixexp="$ansexp"
7150         ;;
7151 *)      usevendorprefix="$undef"
7152         vendorprefix=''
7153         vendorprefixexp=''
7154         ;;
7155 esac
7156
7157 : Set the vendorlib variables
7158 case "$vendorprefix" in
7159 '')     d_vendorlib="$undef"
7160         vendorlib=''
7161         vendorlibexp=''
7162         ;;
7163 *)      d_vendorlib="$define"
7164         : determine where vendor-supplied modules go.
7165         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7166         case "$vendorlib" in
7167         '')
7168                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7169                 case "$installstyle" in
7170                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7171                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7172                 esac
7173                 ;;
7174         *)      dflt="$vendorlib"
7175                 ;;
7176         esac
7177         fn=d~+
7178         rp='Pathname for the vendor-supplied library files?'
7179         . ./getfile
7180         vendorlib="$ans"
7181         vendorlibexp="$ansexp"
7182         ;;
7183 esac
7184 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7185 prefixvar=vendorlib
7186 . ./installprefix
7187
7188 : Set the vendorarch variables
7189 case "$vendorprefix" in
7190 '')     d_vendorarch="$undef"
7191         vendorarch=''
7192         vendorarchexp=''
7193         ;;
7194 *)      d_vendorarch="$define"
7195         : determine where vendor-supplied architecture-dependent libraries go.
7196         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7197         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7198         : vendorlib may have an optional trailing /share.
7199         case "$vendorarch" in
7200         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7201                 dflt="$dflt/$archname"
7202                 ;;
7203         *)      dflt="$vendorarch" ;;
7204         esac
7205         fn=d~+
7206         rp='Pathname for vendor-supplied architecture-dependent files?'
7207         . ./getfile
7208         vendorarch="$ans"
7209         vendorarchexp="$ansexp"
7210         ;;
7211 esac
7212 prefixvar=vendorarch
7213 . ./installprefix
7214 if $test X"$vendorarch" = X"$vendorlib"; then
7215         d_vendorarch="$undef"
7216 else
7217         d_vendorarch="$define"
7218 fi
7219
7220 : Final catch-all directories to search
7221 $cat <<EOM
7222
7223 Lastly, you can have perl look in other directories for extensions and
7224 modules in addition to those already specified.
7225 These directories will be searched after
7226         $sitearch
7227         $sitelib
7228 EOM
7229 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7230 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7231 echo ' '
7232 case "$otherlibdirs" in
7233 ''|' ') dflt='none' ;;
7234 *)      dflt="$otherlibdirs" ;;
7235 esac
7236 $cat <<EOM
7237 Enter a colon-separated set of extra paths to include in perl's @INC
7238 search path, or enter 'none' for no extra paths.
7239
7240 EOM
7241
7242 rp='Colon-separated list of additional directories for perl to search?'
7243 . ./myread
7244 case "$ans" in
7245 ' '|''|none)    otherlibdirs=' ' ;;
7246 *)      otherlibdirs="$ans" ;;
7247 esac
7248 case "$otherlibdirs" in
7249 ' ') val=$undef ;;
7250 *)      val=$define ;;
7251 esac
7252 set d_perl_otherlibdirs
7253 eval $setvar
7254
7255 : Cruising for prototypes
7256 echo " "
7257 echo "Checking out function prototypes..." >&4
7258 $cat >prototype.c <<EOCP
7259 #$i_stdlib I_STDLIB
7260 #ifdef I_STDLIB
7261 #include <stdlib.h>
7262 #endif
7263 int main(int argc, char *argv[]) {
7264         exit(0);}
7265 EOCP
7266 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7267         echo "Your C compiler appears to support function prototypes."
7268         val="$define"
7269 else
7270         echo "Your C compiler doesn't seem to understand function prototypes."
7271         val="$undef"
7272 fi
7273 set prototype
7274 eval $setvar
7275 $rm -f prototype*
7276
7277 : Check if ansi2knr is required
7278 case "$prototype" in
7279 "$define") ;;
7280 *)      ansi2knr='ansi2knr'
7281         echo " "
7282         cat <<EOM >&4
7283
7284 $me:  FATAL ERROR:
7285 This version of $package can only be compiled by a compiler that 
7286 understands function prototypes.  Unfortunately, your C compiler 
7287         $cc $ccflags
7288 doesn't seem to understand them.  Sorry about that.
7289
7290 If GNU cc is available for your system, perhaps you could try that instead.  
7291
7292 Eventually, we hope to support building Perl with pre-ANSI compilers.
7293 If you would like to help in that effort, please contact <perlbug@perl.org>.
7294
7295 Aborting Configure now.
7296 EOM
7297         exit 2
7298         ;;
7299 esac
7300
7301 : DTrace support
7302 dflt_dtrace='/usr/sbin/dtrace'
7303 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7304
7305 cat <<EOM
7306
7307 Perl can be built to support DTrace on platforms that support it.
7308 DTrace is a diagnosis and performance analysis tool from Sun.
7309
7310 If this doesn't make any sense to you, just accept the default '$dflt'.
7311 EOM
7312
7313 while $test 1 ; do
7314         case "$usedtrace" in
7315         $define|true|[yY]*)
7316                 dflt='y'
7317                 ;;
7318         ?*)
7319                 dflt='y'
7320                 dflt_dtrace=$usedtrace
7321                 ;;
7322         *)
7323                 dflt='n'
7324                 ;;
7325         esac
7326
7327         rp='Support DTrace if available?'
7328         . ./myread
7329         case "$ans" in
7330         y|Y)    val="$define" ;;
7331         *)      val="$undef" ;;
7332         esac
7333         set usedtrace
7334         eval $setvar
7335
7336         test "X$usedtrace" != "X$define" && break
7337
7338         echo " "
7339         rp='Where is the dtrace executable?'
7340         dflt=$dflt_dtrace
7341         . ./getfile
7342         val="$ans"
7343         set dtrace
7344         eval $setvar
7345
7346         if $test -f $dtrace
7347         then
7348                 if $dtrace -h -s ../perldtrace.d \
7349                         -o perldtrace.tmp >/dev/null 2>&1 \
7350                         && rm -f perldtrace.tmp
7351                 then
7352                         echo " "
7353                         echo "Good: your $dtrace knows about the -h flag."
7354                 else
7355                         cat >&2 <<EOM
7356
7357 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7358 ***
7359 *** Your installed dtrace doesn't support the -h switch to compile a D
7360 *** program into a C header. Can't continue.
7361
7362 EOM
7363                         exit 1
7364                 fi
7365                 break;
7366         fi
7367
7368         case "$fastread" in
7369         yes)
7370                 cat >&2 <<EOM
7371
7372 *** $me:  Fatal Error:  $dtrace not found.
7373 *** Can't continue.
7374
7375 EOM
7376                 exit 1
7377                 ;;
7378         *)
7379                 echo "*** $dtrace was not found."
7380                 echo " "
7381                 ;;
7382         esac
7383 done
7384
7385 : See if we want extra modules installed
7386 echo " "
7387 case "$extras" in
7388 '') dflt='n';;
7389 *) dflt='y';;
7390 esac
7391 cat <<EOM
7392 Perl can be built with extra modules or bundles of modules which
7393 will be fetched from the CPAN and installed alongside Perl.
7394
7395 Notice that you will need access to the CPAN; either via the Internet,
7396 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7397 be asked later to configure the CPAN.pm module which will in turn do
7398 the installation of the rest of the extra modules or bundles.)
7399
7400 Notice also that if the modules require any external software such as
7401 libraries and headers (the libz library and the zlib.h header for the
7402 Compress::Zlib module, for example) you MUST have any such software
7403 already installed, this configuration process will NOT install such
7404 things for you.
7405
7406 If this doesn't make any sense to you, just accept the default '$dflt'.
7407 EOM
7408 rp='Install any extra modules (y or n)?'
7409 . ./myread
7410 case "$ans" in
7411 y|Y)
7412         cat <<EOM
7413
7414 Please list any extra modules or bundles to be installed from CPAN,
7415 with spaces between the names.  The names can be in any format the
7416 'install' command of CPAN.pm will understand.  (Answer 'none',
7417 without the quotes, to install no extra modules or bundles.)
7418 EOM
7419         rp='Extras?'
7420         dflt="$extras"
7421         . ./myread
7422         extras="$ans"
7423 esac
7424 case "$extras" in
7425 ''|'none')
7426         val=''
7427         $rm -f ../extras.lst
7428         ;;
7429 *)      echo "(Saving the list of extras for later...)"
7430         echo "$extras" > ../extras.lst
7431         val="'$extras'"
7432         ;;
7433 esac
7434 set extras
7435 eval $setvar
7436 echo " "
7437
7438 : determine where html pages for programs go
7439 set html1dir html1dir none
7440 eval $prefixit
7441 $cat <<EOM
7442
7443 If you wish to install html files for programs in $spackage, indicate
7444 the appropriate directory here.  To skip installing html files,
7445 answer "none".
7446 EOM
7447 case "$html1dir" in
7448 ''|none|$undef|' ') dflt=none ;;
7449 *) dflt=$html1dir ;;
7450 esac
7451 fn=dn+~
7452 rp="Directory for the main $spackage html pages?"
7453 . ./getfile
7454 prefixvar=html1dir
7455 . ./setprefixvar
7456 : Use ' ' for none so value is preserved next time through Configure
7457 $test X"$html1dir" = "X" && html1dir=' '
7458
7459 : determine where html pages for libraries and modules go
7460 set html3dir html3dir none
7461 eval $prefixit
7462 $cat <<EOM
7463
7464 If you wish to install html files for modules associated with $spackage,
7465 indicate the appropriate directory here.  To skip installing html files,
7466 answer "none".
7467 EOM
7468 : There is no obvious default.  If they have specified html1dir, then
7469 : try to key off that, possibly changing .../html1 into .../html3.
7470 case "$html3dir" in
7471 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7472 *) dflt=$html3dir ;;
7473 esac
7474 fn=dn+~
7475 rp="Directory for the $spackage module html pages?"
7476 . ./getfile
7477 prefixvar=html3dir
7478 . ./setprefixvar
7479 : Use ' ' for none so value is preserved next time through Configure
7480 $test X"$html3dir" = "X" && html3dir=' '
7481
7482 : determine whether to install perl also as /usr/bin/perl
7483
7484 echo " "
7485 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7486         $cat <<EOM
7487 Many scripts expect perl to be installed as /usr/bin/perl.
7488
7489 If you want to, I can install the perl you are about to compile
7490 as /usr/bin/perl (in addition to $bin/perl).
7491 EOM
7492         if test -f /usr/bin/perl; then
7493             $cat <<EOM
7494
7495 However, please note that because you already have a /usr/bin/perl,
7496 overwriting that with a new Perl would very probably cause problems.
7497 Therefore I'm assuming you don't want to do that (unless you insist).
7498
7499 EOM
7500             case "$installusrbinperl" in
7501             "$define"|[yY]*)    dflt='y';;
7502             *)                  dflt='n';;
7503             esac
7504         else
7505             $cat <<EOM
7506
7507 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7508
7509 EOM
7510             case "$installusrbinperl" in
7511             "$undef"|[nN]*)     dflt='n';;
7512             *)                  dflt='y';;
7513             esac
7514         fi
7515         rp="Do you want to install perl as /usr/bin/perl?"
7516         . ./myread
7517         case "$ans" in
7518         [yY]*)  val="$define";;
7519         *)      val="$undef" ;;
7520         esac
7521 else
7522         val="$undef"
7523 fi
7524 set installusrbinperl
7525 eval $setvar
7526
7527 : Check if we are using the GNU C library
7528 echo " "
7529 echo "Checking for GNU C Library..." >&4
7530 cat >try.c <<'EOCP'
7531 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7532    alone are insufficient to distinguish different versions, such as
7533    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7534    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7535 */
7536 #include <stdio.h>
7537 int main(void)
7538 {
7539 #ifdef __GLIBC__
7540 #   ifdef __GLIBC_MINOR__
7541 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7542 #           include <gnu/libc-version.h>
7543             printf("%s\n",  gnu_get_libc_version());
7544 #       else
7545             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7546 #       endif
7547 #   else
7548         printf("%d\n",  __GLIBC__);
7549 #   endif
7550     return 0;
7551 #else
7552     return 1;
7553 #endif
7554 }
7555 EOCP
7556 set try
7557 if eval $compile_ok && $run ./try > glibc.ver; then
7558         val="$define"
7559         gnulibc_version=`$cat glibc.ver`
7560         echo "You are using the GNU C Library version $gnulibc_version"
7561 else
7562         val="$undef"
7563         gnulibc_version=''
7564         echo "You are not using the GNU C Library"
7565 fi
7566 $rm_try glibc.ver
7567 set d_gnulibc
7568 eval $setvar
7569
7570 : see if nm is to be used to determine whether a symbol is defined or not
7571 case "$usenm" in
7572 '')
7573         dflt=''
7574         case "$d_gnulibc" in
7575         "$define")
7576                 echo " "
7577                 echo "nm probably won't work on the GNU C Library." >&4
7578                 dflt=n
7579                 ;;
7580         esac
7581         case "$dflt" in
7582         '')
7583                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7584                         echo " "
7585                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7586                         echo "'nm' won't be sufficient on this system." >&4
7587                         dflt=n
7588                 fi
7589                 ;;
7590         esac
7591         case "$dflt" in
7592         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7593                 if $test $dflt -gt 20; then
7594                         dflt=y
7595                 else
7596                         dflt=n
7597                 fi
7598                 ;;
7599         esac
7600         ;;
7601 *)
7602         case "$usenm" in
7603         true|$define) dflt=y;;
7604         *) dflt=n;;
7605         esac
7606         ;;
7607 esac
7608 $cat <<EOM
7609
7610 I can use $nm to extract the symbols from your C libraries. This
7611 is a time consuming task which may generate huge output on the disk (up
7612 to 3 megabytes) but that should make the symbols extraction faster. The
7613 alternative is to skip the 'nm' extraction part and to compile a small
7614 test program instead to determine whether each symbol is present. If
7615 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7616 this may be the best solution.
7617
7618 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7619
7620 EOM
7621 rp="Shall I use $nm to extract C symbols from the libraries?"
7622 . ./myread
7623 case "$ans" in
7624 [Nn]*) usenm=false;;
7625 *) usenm=true;;
7626 esac
7627
7628 runnm=$usenm
7629 case "$reuseval" in
7630 true) runnm=false;;
7631 esac
7632
7633 : nm options which may be necessary
7634 case "$nm_opt" in
7635 '') if $test -f /mach_boot; then
7636                 nm_opt=''       # Mach
7637         elif $test -d /usr/ccs/lib; then
7638                 nm_opt='-p'     # Solaris (and SunOS?)
7639         elif $test -f /dgux; then
7640                 nm_opt='-p'     # DG-UX
7641         elif $test -f /lib64/rld; then
7642                 nm_opt='-p'     # 64-bit Irix
7643         else
7644                 nm_opt=''
7645         fi;;
7646 esac
7647
7648 : nm options which may be necessary for shared libraries but illegal
7649 : for archive libraries.  Thank you, Linux.
7650 case "$nm_so_opt" in
7651 '')     case "$myuname" in
7652         *linux*|gnu*)
7653                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7654                         nm_so_opt='--dynamic'
7655                 fi
7656                 ;;
7657         esac
7658         ;;
7659 esac
7660
7661 : Figure out where the libc is located
7662 case "$runnm" in
7663 true)
7664 : get list of predefined functions in a handy place
7665 echo " "
7666 case "$libc" in
7667 '') libc=unknown
7668         case "$libs" in
7669         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7670         esac
7671         ;;
7672 esac
7673 case "$libs" in
7674 '') ;;
7675 *)  for thislib in $libs; do
7676         case "$thislib" in
7677         -lc|-lc_s)
7678                 : Handle C library specially below.
7679                 ;;
7680         -l*)
7681                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7682                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7683                         :
7684                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7685                         :
7686                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7687                         :
7688                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7689                         :
7690                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7691                         :
7692                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7693                         :
7694                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7695                         :
7696                 else
7697                         try=''
7698                 fi
7699                 libnames="$libnames $try"
7700                 ;;
7701         *) libnames="$libnames $thislib" ;;
7702         esac
7703         done
7704         ;;
7705 esac
7706 xxx=normal
7707 case "$libc" in
7708 unknown)
7709         set /lib/libc.$so
7710         for xxx in $libpth; do
7711                 $test -r $1 || set $xxx/libc.$so
7712                 : The messy sed command sorts on library version numbers.
7713                 $test -r $1 || \
7714                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7715                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7716                                 h
7717                                 s/[0-9][0-9]*/0000&/g
7718                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7719                                 G
7720                                 s/\n/ /' | \
7721                          $sort | $sed -e 's/^.* //'`
7722                 eval set \$$#
7723         done
7724         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
7725         $test -r $1 || set $sysroot/lib/libsys_s$_a
7726         ;;
7727 *)
7728         set blurfl
7729         ;;
7730 esac
7731 if $test -r "$1"; then
7732         echo "Your (shared) C library seems to be in $1."
7733         libc="$1"
7734 elif $test -r /lib/libc && $test -r /lib/clib; then
7735         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7736         xxx=apollo
7737         libc='/lib/clib /lib/libc'
7738         if $test -r /lib/syslib; then
7739                 echo "(Your math library is in /lib/syslib.)"
7740                 libc="$libc /lib/syslib"
7741         fi
7742 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7743         echo "Your C library seems to be in $libc, as you said before."
7744 elif $test -r $incpath/usr/lib/libc$_a; then
7745         libc=$incpath/usr/lib/libc$_a;
7746         echo "Your C library seems to be in $libc.  That's fine."
7747 elif $test -r /lib/libc$_a; then
7748         libc=/lib/libc$_a;
7749         echo "Your C library seems to be in $libc.  You're normal."
7750 else
7751         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7752                 :
7753         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7754                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7755         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7756                 :
7757         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7758                 :
7759         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7760                 :
7761         else
7762                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7763         fi
7764         if $test -r "$tans"; then
7765                 echo "Your C library seems to be in $tans, of all places."
7766                 libc=$tans
7767         else
7768                 libc='blurfl'
7769         fi
7770 fi
7771 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7772         dflt="$libc"
7773         cat <<EOM
7774
7775 If the guess above is wrong (which it might be if you're using a strange
7776 compiler, or your machine supports multiple models), you can override it here.
7777
7778 EOM
7779 else
7780         dflt=''
7781         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7782         cat >&4 <<EOM
7783 I can't seem to find your C library.  I've looked in the following places:
7784
7785 EOM
7786         $sed 's/^/      /' libpath
7787         cat <<EOM
7788
7789 None of these seems to contain your C library. I need to get its name...
7790
7791 EOM
7792 fi
7793 fn=f
7794 rp='Where is your C library?'
7795 . ./getfile
7796 libc="$ans"
7797
7798 echo " "
7799 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7800 set X `cat libnames`
7801 shift
7802 xxx=files
7803 case $# in 1) xxx=file; esac
7804 echo "Extracting names from the following $xxx for later perusal:" >&4
7805 echo " "
7806 $sed 's/^/      /' libnames >&4
7807 echo " "
7808 $echo $n "This may take a while...$c" >&4
7809
7810 for file in $*; do
7811         case $file in
7812         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7813         *) $nm $nm_opt $file 2>/dev/null;;
7814         esac
7815 done >libc.tmp
7816
7817 $echo $n ".$c"
7818 $grep fprintf libc.tmp > libc.ptf
7819 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7820 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7821 xxx='[ADTSIWi]'
7822 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7823         eval $xscan;\
7824         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7825                 eval $xrun
7826 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7827         eval $xscan;\
7828         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7829                 eval $xrun
7830 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7831         eval $xscan;\
7832         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7833                 eval $xrun
7834 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7835         eval $xscan;\
7836         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7837                 eval $xrun
7838 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7839         eval $xscan;\
7840         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7841                 eval $xrun
7842 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7843         eval $xscan;\
7844         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7845                 eval $xrun
7846 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7847                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7848         eval $xscan;\
7849         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7850                 eval $xrun
7851 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7852         eval $xscan;\
7853         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7854                 eval $xrun
7855 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7856         eval $xscan;\
7857         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7858                 eval $xrun
7859 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7860         eval $xscan;\
7861         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7862                 eval $xrun
7863 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7864         eval $xscan;\
7865         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7866                 eval $xrun
7867 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7868         eval $xscan;\
7869         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7870                 eval $xrun
7871 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7872         eval $xscan;\
7873         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7874                 eval $xrun
7875 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7876         eval $xscan;\
7877         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7878                 eval $xrun
7879 else
7880         $nm -p $* 2>/dev/null >libc.tmp
7881         $grep fprintf libc.tmp > libc.ptf
7882         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7883                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7884         then
7885                 nm_opt='-p'
7886                 eval $xrun
7887         else
7888                 echo " "
7889                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7890                 com=''
7891                 if $ar t $libc > libc.tmp && \
7892                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7893                 then
7894                         for thisname in $libnames $libc; do
7895                                 $ar t $thisname >>libc.tmp
7896                         done
7897                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7898                         echo "Ok." >&4
7899                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7900                         for thisname in $libnames $libc; do
7901                                 $ar tv $thisname >>libc.tmp
7902                                 emximp -o tmp.imp $thisname \
7903                                     2>/dev/null && \
7904                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7905                                     < tmp.imp >>libc.tmp
7906                                 $rm -f tmp.imp
7907                         done
7908                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7909                         echo "Ok." >&4
7910                 else
7911                         echo "$ar didn't seem to work right." >&4
7912                         echo "Maybe this is a Cray...trying bld instead..." >&4
7913                         if  bld t $libc | \
7914                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7915                                 $test -s libc.list
7916                         then
7917                                 for thisname in $libnames; do
7918                                         bld t $libnames | \
7919                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7920                                         $ar t $thisname >>libc.tmp
7921                                 done
7922                                 echo "Ok." >&4
7923                         else
7924                                 echo "That didn't work either.  Giving up." >&4
7925                                 exit 1
7926                         fi
7927                 fi
7928         fi
7929 fi
7930 nm_extract="$com"
7931 case "$PASE" in
7932 define)
7933     echo " "
7934     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7935     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7936     ;;
7937 *)  if $test -f /lib/syscalls.exp; then
7938         echo " "
7939         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7940         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7941                 /lib/syscalls.exp >>libc.list
7942     fi
7943     ;;
7944 esac
7945 ;;
7946 esac
7947 $rm -f libnames libpath
7948
7949 : Check if we are using C++
7950 echo " "
7951 echo "Checking for C++..." >&4
7952 $cat >try.c <<'EOCP'
7953 #include <stdio.h>
7954 int main(void)
7955 {
7956 #ifdef __cplusplus
7957     return 0;
7958 #else
7959     return 1;
7960 #endif
7961 }
7962 EOCP
7963 set try
7964 if eval $compile_ok && $run ./try; then
7965         val="$define"
7966         echo "You are using a C++ compiler."
7967 else
7968         val="$undef"
7969         echo "You are not using a C++ compiler."
7970 fi
7971 $rm_try cplusplus$$
7972 set d_cplusplus
7973 eval $setvar
7974
7975 : is a C symbol defined?
7976 csym='tlook=$1;
7977 case "$3" in
7978 -v) tf=libc.tmp; tdc="";;
7979 -a) tf=libc.tmp; tdc="[]";;
7980 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7981 esac;
7982 case "$d_cplusplus" in
7983     $define)    extern_C="extern \"C\"" ;;
7984     *)          extern_C="extern"       ;;
7985 esac;
7986 tx=yes;
7987 case "$reuseval-$4" in
7988 true-) ;;
7989 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7990 esac;
7991 case "$tx" in
7992 yes)
7993         tval=false;
7994         if $test "$runnm" = true; then
7995                 if $contains $tlook $tf >/dev/null 2>&1; then
7996                         tval=true;
7997                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7998                         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;
7999                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
8000                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
8001                         $rm_try;
8002                 fi;
8003         else
8004                 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;
8005                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
8006                 $rm_try;
8007         fi;
8008         ;;
8009 *)
8010         case "$tval" in
8011         $define) tval=true;;
8012         *) tval=false;;
8013         esac;
8014         ;;
8015 esac;
8016 eval "$2=$tval"'
8017
8018 : define an is-in-libc? function
8019 inlibc='echo " "; td=$define; tu=$undef;
8020 sym=$1; var=$2; eval "was=\$$2";
8021 tx=yes;
8022 case "$reuseval$was" in
8023 true) ;;
8024 true*) tx=no;;
8025 esac;
8026 case "$tx" in
8027 yes)
8028         set $sym tres -f;
8029         eval $csym;
8030         case "$tres" in
8031         true)
8032                 echo "$sym() found." >&4;
8033                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
8034         *)
8035                 echo "$sym() NOT found." >&4;
8036                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
8037         esac;;
8038 *)
8039         case "$was" in
8040         $define) echo "$sym() found." >&4;;
8041         *) echo "$sym() NOT found." >&4;;
8042         esac;;
8043 esac'
8044
8045 : see if dlopen exists
8046 xxx_runnm="$runnm"
8047 xxx_ccflags="$ccflags"
8048 runnm=false
8049 : with g++ one needs -shared to get is-in-libc to work for dlopen
8050 case "$gccversion" in
8051 '')     ;;
8052 *)      case "$d_cplusplus" in
8053         "$define") ccflags="$ccflags -shared" ;;
8054         esac
8055         ;;
8056 esac
8057 set dlopen d_dlopen
8058 eval $inlibc
8059 runnm="$xxx_runnm"
8060 ccflags="$xxx_ccflags"
8061
8062 : see if this is a unistd.h system
8063 set unistd.h i_unistd
8064 eval $inhdr
8065
8066 : determine which dynamic loading, if any, to compile in
8067 echo " "
8068 dldir="ext/DynaLoader"
8069 case "$usedl" in
8070     $define|y|true)
8071         dflt='y'
8072         usedl="$define"
8073         ;;
8074     $undef|n|false)
8075         dflt='n'
8076         usedl="$undef"
8077         ;;
8078     *)
8079         dflt='n'
8080         case "$d_dlopen" in
8081             $define) dflt='y' ;;
8082         esac
8083         : Does a dl_xxx.xs file exist for this operating system
8084         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8085         ;;
8086 esac
8087 rp="Do you wish to use dynamic loading?"
8088 . ./myread
8089 usedl="$ans"
8090 bin_ELF="$undef"
8091 case "$ans" in
8092     y*) usedl="$define"
8093         case "$dlsrc" in
8094             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8095                     dflt="$dldir/dl_${osname}.xs"
8096                 elif $test "$d_dlopen" = "$define" ; then
8097                     dflt="$dldir/dl_dlopen.xs"
8098                 else
8099                     dflt=''
8100                 fi
8101                 ;;
8102             *)  dflt="$dldir/$dlsrc"
8103                 ;;
8104         esac
8105         echo "The following dynamic loading files are available:"
8106         : Can not go over to $dldir because getfile has path hard-coded in.
8107         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8108         rp="Source file to use for dynamic loading"
8109         fn="fne"
8110         gfpth="$src"
8111         . ./getfile
8112         usedl="$define"
8113         : emulate basename
8114         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8115
8116         $cat << EOM
8117
8118 Some systems may require passing special flags to $cc -c to
8119 compile modules that will be used to create a shared library.
8120 To use no flags, say "none".
8121
8122 EOM
8123         case "$cccdlflags" in
8124             '') case "$gccversion" in
8125                 '') case "$osname" in
8126                         hpux)   dflt='+z' ;;
8127                         irix*)  dflt='-KPIC' ;;
8128                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8129                         sunos)  dflt='-pic' ;;
8130                         *)      dflt='none' ;;
8131                     esac
8132                     ;;
8133                 *)  case "$osname" in
8134                         darwin) dflt='none' ;;
8135                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8136                         *)      dflt='-fpic' ;;
8137                     esac ;;
8138                 esac ;;
8139             ' ') dflt='none' ;;
8140             *)   dflt="$cccdlflags" ;;
8141         esac
8142
8143         case "$dflt" in
8144             none) dflt='' ;;
8145         esac
8146
8147         # If -Dsysroot was specified, now's the time to add it
8148         # to cccdlflags
8149         if test "X$sysroot" != X; then
8150             case "$gccversion" in
8151                 '') ;;
8152                 *)  case "$dflt" in
8153                         *sysroot*) ;;
8154                         'undef'|*)
8155                             dflt="$dflt --sysroot=$sysroot" ;;
8156                     esac
8157                     ;;
8158             esac
8159         fi
8160
8161         case "$dflt" in
8162             '') dflt='none';;
8163         esac
8164
8165         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8166         . ./myread
8167         case "$ans" in
8168             none) cccdlflags=' ' ;;
8169             *)    cccdlflags="$ans" ;;
8170         esac
8171
8172         cat << EOM
8173
8174 Some systems use ld to create libraries that can be dynamically loaded,
8175 while other systems (such as those using ELF) use $cc.
8176
8177 EOM
8178
8179 : Determine if this is ELF
8180         $cat >try.c <<EOM
8181 /* Test for whether ELF binaries are produced */
8182 #include <fcntl.h>
8183 #$i_stdlib I_STDLIB
8184 #ifdef I_STDLIB
8185 #include <stdlib.h>
8186 #endif
8187 #$i_unistd I_UNISTD
8188 #ifdef I_UNISTD
8189 #include <unistd.h>
8190 #endif
8191 int main() {
8192     char b[4];
8193     int i = open("a.out",O_RDONLY);
8194     if(i == -1)
8195         exit(1); /* fail */
8196     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8197         exit(0); /* succeed (yes, it is ELF) */
8198     exit(1); /* fail */
8199 }
8200 EOM
8201         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8202             bin_ELF="$define"
8203         fi
8204         $rm_try
8205
8206         case "$ld" in
8207             '') if $test $bin_ELF = "$define"; then
8208                     cat <<EOM
8209 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8210 EOM
8211                     dflt="$cc"
8212                 else
8213                     echo "I'll use ld to build dynamic libraries."
8214                     dflt='ld'
8215                 fi
8216                 ;;
8217             *)  dflt="$ld"
8218                 ;;
8219         esac
8220
8221         rp="What command should be used to create dynamic libraries?"
8222         . ./myread
8223         ld="$ans"
8224
8225         cat << EOM
8226
8227 Some systems may require passing special flags to $ld to create a
8228 library that can be dynamically loaded.  If your ld flags include
8229 -L/other/path options to locate libraries outside your loader's normal
8230 search path, you may need to specify those -L options here as well.  To
8231 use no flags, say "none".
8232
8233 EOM
8234         case "$lddlflags" in
8235             '') case "$osname" in
8236                     haiku) dflt='-shared' ;;
8237                     hpux) dflt='-b';
8238                           case "$gccversion" in
8239                               '') dflt="$dflt +vnocompatwarnings" ;;
8240                           esac
8241                           ;;
8242                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8243                     solaris) # See [perl #66604].
8244                             # On Solaris 11, gcc -m64 on amd64
8245                             # appears not to understand -G.  gcc versions at
8246                             # least as old as 3.4.3 support -shared, so just
8247                             # use that with Solaris 11 and later, but keep
8248                             # the old behavior for older Solaris versions.
8249                             case "$gccversion" in
8250                                 '') dflt='-G' ;;
8251                                 *)  case "$osvers" in
8252                                         2.?|2.10) dflt='-G' ;;
8253                                         *) dflt='-shared' ;;
8254                                     esac
8255                                     ;;
8256                             esac
8257                             ;;
8258                     sunos) dflt='-assert nodefinitions' ;;
8259                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8260                     *)     dflt='none' ;;
8261                 esac
8262                 ;;
8263             *) dflt="$lddlflags" ;;
8264         esac
8265
8266         : Only do this for gcc, since, for example, qcc has no concept
8267         : of --sysroot.
8268         if $test "X$sysroot" != X; then
8269             case "$gccversion" in
8270                 '') ;;
8271                 *)  dflt="$dflt --sysroot $sysroot" ;;
8272             esac
8273         fi
8274
8275         : Try to guess additional flags to pick up local libraries.
8276         : Be careful not to append to a plain 'none'
8277         case "$dflt" in
8278             none) dflt='' ;;
8279         esac
8280         for thisflag in $ldflags; do
8281             case "$thisflag" in
8282                 -L*|-R*|-Wl,-R*)
8283                     case " $dflt " in
8284                         *" $thisflag "*) ;;
8285                         *) dflt="$dflt $thisflag" ;;
8286                     esac
8287                     ;;
8288             esac
8289         done
8290
8291         case "$dflt" in
8292             ''|' ') dflt='none' ;;
8293         esac
8294
8295         case "$ldflags" in
8296             *-fstack-protector*)
8297                 case "$dflt" in
8298                     *-fstack-protector*) ;; # Don't add it again
8299                     *) dflt="$dflt -fstack-protector" ;;
8300                 esac
8301                 ;;
8302         esac
8303
8304         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8305         . ./myread
8306         case "$ans" in
8307             none) lddlflags=' ' ;;
8308             *) lddlflags="$ans" ;;
8309         esac
8310
8311         cat <<EOM
8312
8313 Some systems may require passing special flags to $cc to indicate that
8314 the resulting executable will use dynamic linking.  To use no flags,
8315 say "none".
8316
8317 EOM
8318         case "$ccdlflags" in
8319             '') case "$osname" in
8320                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8321                     sunos)      dflt='none'   ;;
8322                     *)               dflt='none'   ;;
8323                 esac ;;
8324             ' ') dflt='none' ;;
8325             *)   dflt="$ccdlflags" ;;
8326         esac
8327         rp="Any special flags to pass to $cc to use dynamic linking?"
8328         . ./myread
8329         case "$ans" in
8330             none) ccdlflags=' ' ;;
8331             *)    ccdlflags="$ans" ;;
8332         esac
8333         ;;
8334
8335     *)  usedl="$undef"
8336         ld='ld'
8337         dlsrc='dl_none.xs'
8338         lddlflags=''
8339         ccdlflags=''
8340         ;;
8341 esac
8342
8343 ld_can_script="$undef"
8344 case "$bin_ELF$usedl" in
8345     $define$define)
8346         # Abuse try.h and a.out names for neat cleanup
8347         $cat >try.c <<EOM
8348 void foo() {}
8349 void bar() {}
8350 EOM
8351         $cat >try.h <<EOM
8352 LIBTEST_42 {
8353  global:
8354   foo;
8355  local: *;
8356  };
8357 EOM
8358         if $cc $cccdlflags $ccdlflags $ccflags \
8359                $ldflags $lddlflags -o a.out try.c \
8360                -Wl,--version-script=try.h >/dev/null 2>&1 \
8361            &&  $test -s a.out ; then
8362             echo "ld supports scripting" >&4
8363             ld_can_script="$define"
8364         else
8365             echo "ld does not support scripting" >&4
8366         fi
8367         $rm_try
8368         ;;
8369 esac
8370
8371 : Do we want a shared libperl?
8372 also=''
8373 case "$usedl" in
8374 $undef)
8375         # No dynamic loading being used, so don't bother even to prompt.
8376         useshrplib='false'
8377         ;;
8378 *)      case "$useshrplib" in
8379         '')     case "$osname" in
8380                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8381                         dflt=y
8382                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8383                         ;;
8384                 *)      dflt=n
8385                         ;;
8386                 esac
8387                 ;;
8388         $define|true|[Yy]*)
8389                 dflt=y
8390                 ;;
8391         *)      dflt=n
8392                 ;;
8393         esac
8394         $cat << EOM
8395
8396 The perl executable is normally obtained by linking perlmain.c with
8397 libperl${_a}, any static extensions (usually just DynaLoader), and
8398 any other libraries needed on this system (such as -lm, etc.).  Since
8399 your system supports dynamic loading, it is probably possible to build
8400 a shared libperl.$so.  If you will have more than one executable linked
8401 to libperl.$so, this will significantly reduce the size of each
8402 executable, but it may have a noticeable effect on performance.  The
8403 default is probably sensible for your system.
8404 $also
8405
8406 EOM
8407         rp="Build a shared libperl.$so (y/n)"
8408         . ./myread
8409         case "$ans" in
8410         true|$define|[Yy]*)
8411                 useshrplib='true'  ;;
8412         *)      useshrplib='false' ;;
8413         esac
8414         ;;
8415 esac
8416
8417 case "$useshrplib" in
8418 true)
8419         case "$userelocatableinc" in
8420         true|define)
8421                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8422                 echo "See INSTALL for an explanation why that won't work." >&4
8423                 exit 4
8424                 ;;
8425         esac
8426         case "$libperl" in
8427         '')
8428                 # Figure out a good name for libperl.so.  Since it gets stored in
8429                 # a version-specific architecture-dependent library, the version
8430                 # number isn't really that important, except for making cc/ld happy.
8431                 #
8432                 # A name such as libperl.so.10.1
8433                 majmin="libperl.$so.$patchlevel.$subversion"
8434                 # A name such as libperl.so.100
8435                 majonly=`echo $patchlevel $subversion |
8436                         $awk '{printf "%d%02d", $1, $2}'`
8437                 majonly=libperl.$so.$majonly
8438                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8439                 # rely on figuring it out from the naming of libc.
8440                 case "${osname}${osvers}" in
8441                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8442                         dflt=libperl.$so
8443                         ;;
8444                 cygwin*) # ld links now against the dll directly
8445                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8446                         majonly=`echo $patchlevel $subversion |
8447                                 $awk '{printf "%03d%03d", $1, $2}'`
8448                         majonly=cygperl5.$majonly.$so
8449                         dflt=$majmin
8450                         ;;
8451                 *)      # Try to guess based on whether libc has major.minor.
8452                         case "$libc" in
8453                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8454                         *libc.$so.[0-9]*) dflt=$majonly ;;
8455                         *)      dflt=libperl.$so ;;
8456                         esac
8457                         ;;
8458                 esac
8459                 ;;
8460         *)      dflt=$libperl
8461                 ;;
8462         esac
8463         cat << EOM
8464
8465 I need to select a good name for the shared libperl.  If your system uses
8466 library names with major and minor numbers, then you might want something
8467 like $majmin.  Alternatively, if your system uses a single version
8468 number for shared libraries, then you might want to use $majonly.
8469 Or, your system might be quite happy with a simple libperl.$so.
8470
8471 Since the shared libperl will get installed into a version-specific
8472 architecture-dependent directory, the version number of the shared perl
8473 library probably isn't important, so the default should be o.k.
8474
8475 EOM
8476         rp='What name do you want to give to the shared libperl?'
8477         . ./myread
8478         libperl=$ans
8479         echo "Ok, I'll use $libperl"
8480         ;;
8481 *)
8482         libperl="libperl${_a}"
8483         ;;
8484 esac
8485
8486 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8487 case "$shrpdir" in
8488 '') ;;
8489 *)      $cat >&4 <<EOM
8490 WARNING:  Use of the shrpdir variable for the installation location of
8491 the shared $libperl is not supported.  It was never documented and
8492 will not work in this version.  Let me (perlbug@perl.org)
8493 know of any problems this may cause.
8494
8495 EOM
8496         case "$shrpdir" in
8497         "$archlibexp/CORE")
8498                 $cat >&4 <<EOM
8499 But your current setting of $shrpdir is
8500 the default anyway, so it's harmless.
8501 EOM
8502                 ;;
8503         *)
8504                 $cat >&4 <<EOM
8505 Further, your current attempted setting of $shrpdir
8506 conflicts with the value of $archlibexp/CORE
8507 that installperl will use.
8508 EOM
8509                 ;;
8510         esac
8511         ;;
8512 esac
8513
8514 # How will the perl executable find the installed shared $libperl?
8515 # Add $xxx to ccdlflags.
8516 # If we can't figure out a command-line option, use $shrpenv to
8517 # set env LD_RUN_PATH.  The main perl makefile uses this.
8518 shrpdir=$archlibexp/CORE
8519 xxx=''
8520 tmp_shrpenv=''
8521 if "$useshrplib"; then
8522     case "$osname" in
8523         aix)
8524                 # We'll set it in Makefile.SH...
8525                 ;;
8526         solaris)
8527                 xxx="-R $shrpdir"
8528                 ;;
8529         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8530                 xxx="-Wl,-R$shrpdir"
8531                 ;;
8532         bsdos|linux|irix*|dec_osf|gnu*)
8533                 xxx="-Wl,-rpath,$shrpdir"
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         case "$hostcat" in
8802         nidump*) ;;
8803         *)
8804                 case "$hostcat" in
8805                 *ypcat*) dflt=y;;
8806                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8807                                 dflt=y
8808                         else
8809                                 dflt=n
8810                         fi;;
8811                 *) dflt=n;;
8812                 esac
8813                 echo " "
8814                 rp='Are you getting the hosts file via yellow pages?'
8815                 . ./myread
8816                 case "$ans" in
8817                 y*) hostcat='ypcat hosts';;
8818                 *) hostcat='cat /etc/hosts';;
8819                 esac
8820                 ;;
8821         esac
8822 fi
8823 case "$hostcat" in
8824 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8825 esac
8826 case "$groupcat" in
8827 '') test -f /etc/group && groupcat='cat /etc/group';;
8828 esac
8829 case "$passcat" in
8830 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8831 esac
8832
8833 : now get the host name
8834 echo " "
8835 echo "Figuring out host name..." >&4
8836 case "$myhostname" in
8837 '') cont=true
8838         echo 'Maybe "hostname" will work...'
8839         if tans=`sh -c hostname 2>&1` ; then
8840                 myhostname=$tans
8841                 phostname=hostname
8842                 cont=''
8843         fi
8844         ;;
8845 *) cont='';;
8846 esac
8847 if $test "$cont"; then
8848         if ./xenix; then
8849                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8850                 if tans=`cat /etc/systemid 2>&1` ; then
8851                         myhostname=$tans
8852                         phostname='cat /etc/systemid'
8853                         echo "Whadyaknow.  Xenix always was a bit strange..."
8854                         cont=''
8855                 fi
8856         elif $test -r /etc/systemid; then
8857                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8858         fi
8859 fi
8860 if $test "$cont"; then
8861         echo 'No, maybe "uuname -l" will work...'
8862         if tans=`sh -c 'uuname -l' 2>&1` ; then
8863                 myhostname=$tans
8864                 phostname='uuname -l'
8865         else
8866                 echo 'Strange.  Maybe "uname -n" will work...'
8867                 if tans=`sh -c 'uname -n' 2>&1` ; then
8868                         myhostname=$tans
8869                         phostname='uname -n'
8870                 else
8871                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8872                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8873                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8874                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8875                         else
8876                                 case "$myhostname" in
8877                                 '') echo "Does this machine have an identity crisis or something?"
8878                                         phostname='';;
8879                                 *)
8880                                         echo "Well, you said $myhostname before..."
8881                                         phostname='echo $myhostname';;
8882                                 esac
8883                         fi
8884                 fi
8885         fi
8886 fi
8887 case "$myhostname" in
8888 '') myhostname=noname ;;
8889 esac
8890 : you do not want to know about this
8891 set $myhostname
8892 myhostname=$1
8893
8894 : verify guess
8895 if $test "$myhostname" ; then
8896         dflt=y
8897         rp='Your host name appears to be "'$myhostname'".'" Right?"
8898         . ./myread
8899         case "$ans" in
8900         y*) ;;
8901         *) myhostname='';;
8902         esac
8903 fi
8904
8905 : bad guess or no guess
8906 while $test "X$myhostname" = X ; do
8907         dflt=''
8908         rp="Please type the (one word) name of your host:"
8909         . ./myread
8910         myhostname="$ans"
8911 done
8912
8913 : translate upper to lower if necessary
8914 case "$myhostname" in
8915 *[A-Z]*)
8916         echo "(Normalizing case in your host name)"
8917         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8918         ;;
8919 esac
8920
8921 case "$myhostname" in
8922 *.*)
8923         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8924         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8925         echo "(Trimming domain name from host name--host name is now $myhostname)"
8926         ;;
8927 *) case "$mydomain" in
8928         '')
8929                 {
8930                         test "X$hostcat" = "Xypcat hosts" &&
8931                         ypmatch "$myhostname" hosts 2>/dev/null |\
8932                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8933                         $test -s hosts
8934                 } || {
8935                         test "X$hostcat" != "X" &&
8936                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8937                                         /[       ]$myhostname[  . ]/p" > hosts
8938                 }
8939                 tmp_re="[       . ]"
8940                 if $test -f hosts; then
8941                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8942                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8943                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8944                                 hosts | $sort | $uniq | \
8945                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8946                         case `$echo X$dflt` in
8947                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8948                                 dflt=.
8949                                 ;;
8950                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8951                                 ;;
8952                         esac
8953                 else
8954                         echo "(I cannot locate a hosts database anywhere)"
8955                         dflt=.
8956                 fi
8957                 case "$dflt" in
8958                 .)
8959                         tans=`./loc resolv.conf X /etc /usr/etc`
8960                         if $test -f "$tans"; then
8961                                 echo "(Attempting domain name extraction from $tans)"
8962                                 dflt=.`$sed -n -e 's/   / /g' \
8963                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8964                                   -e 1q 2>/dev/null`
8965                                 case "$dflt" in
8966                                 .) dflt=.`$sed -n -e 's/        / /g' \
8967                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8968                                      -e 1q 2>/dev/null`
8969                                         ;;
8970                                 esac
8971                         fi
8972                         ;;
8973                 esac
8974                 case "$dflt" in
8975                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8976                         dflt=.`sh -c domainname 2>/dev/null`
8977                         case "$dflt" in
8978                         '') dflt='.';;
8979                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8980                         esac
8981                         ;;
8982                 esac
8983                 case "$dflt$osname" in
8984                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8985                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8986                         ;;
8987                 esac
8988                 case "$dflt" in
8989                 .) echo "(Lost all hope -- silly guess then)"
8990                         dflt='.nonet'
8991                         ;;
8992                 esac
8993                 $rm -f hosts
8994                 ;;
8995         *) dflt="$mydomain";;
8996         esac;;
8997 esac
8998 echo " "
8999 rp="What is your domain name?"
9000 . ./myread
9001 tans="$ans"
9002 case "$ans" in
9003 '') ;;
9004 .*) ;;
9005 *) tans=".$tans";;
9006 esac
9007 mydomain="$tans"
9008
9009 : translate upper to lower if necessary
9010 case "$mydomain" in
9011 *[A-Z]*)
9012         echo "(Normalizing case in your domain name)"
9013         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9014         ;;
9015 esac
9016
9017 : a little sanity check here
9018 case "$phostname" in
9019 '') ;;
9020 *)
9021         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9022         $myhostname$mydomain|$myhostname) ;;
9023         *)
9024                 case "$phostname" in
9025                 sed*)
9026                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9027                         ;;
9028                 *)
9029                         echo "(That doesn't agree with your $phostname command, by the way.)"
9030                         ;;
9031                 esac
9032         ;;
9033         esac
9034         ;;
9035 esac
9036
9037 : determine the e-mail address of the user who is running us
9038 $cat <<EOM
9039
9040 I need to get your e-mail address in Internet format if possible, i.e.
9041 something like user@host.domain. Please answer accurately since I have
9042 no easy means to double check it. The default value provided below
9043 is most probably close to reality but may not be valid from outside
9044 your organization...
9045
9046 EOM
9047 cont=x
9048 while test "$cont"; do
9049         case "$MAILDOMAIN" in
9050         '')
9051                 if $test -s /etc/mailname; then
9052                         maildomain=`$cat /etc/mailname`
9053                 else
9054                         maildomain="$myhostname$mydomain"
9055                 fi
9056                 ;;
9057         *)  maildomain="$MAILDOMAIN";;
9058         esac
9059         case "$cf_email" in
9060         '') dflt="$cf_by@$maildomain";;
9061         *)  dflt="$cf_email";;
9062         esac
9063         rp='What is your e-mail address?'
9064         . ./myread
9065         cf_email="$ans"
9066         case "$cf_email" in
9067         *@*.*) cont='' ;;
9068         *)
9069                 rp='Address does not look like an Internet one.  Use it anyway?'
9070                 case "$fastread" in
9071                 yes) dflt=y ;;
9072                 *) dflt=n ;;
9073                 esac
9074                 . ./myread
9075                 case "$ans" in
9076                 y*) cont='' ;;
9077                 *) echo " " ;;
9078                 esac
9079                 ;;
9080         esac
9081 done
9082
9083 : Ask e-mail of administrator
9084 $cat <<EOM
9085
9086 If you or somebody else will be maintaining perl at your site, please
9087 fill in the correct e-mail address here so that they may be contacted
9088 if necessary. Currently, the "perlbug" program included with perl
9089 will send mail to this address in addition to perlbug@perl.org. You may
9090 enter "none" for no administrator.
9091
9092 EOM
9093 case "$perladmin" in
9094 '') dflt="$cf_email";;
9095 *) dflt="$perladmin";;
9096 esac
9097 rp='Perl administrator e-mail address'
9098 . ./myread
9099 perladmin="$ans"
9100
9101 : determine whether to only install version-specific parts.
9102 echo " "
9103 $cat <<EOM
9104 Do you want to install only the version-specific parts of the perl
9105 distribution?  Usually you do *not* want to do this.
9106 EOM
9107 case "$versiononly" in
9108 "$define"|[Yy]*|true) dflt='y' ;;
9109 *) dflt='n';
9110 esac
9111 rp="Do you want to install only the version-specific parts of perl?"
9112 . ./myread
9113 case "$ans" in
9114 [yY]*)  val="$define";;
9115 *)      val="$undef" ;;
9116 esac
9117 set versiononly
9118 eval $setvar
9119
9120 case "$versiononly" in
9121 "$define") inc_version_list=''
9122            inc_version_list_init=0
9123            ;;
9124 esac
9125
9126 : figure out how to guarantee perl startup
9127 : XXX Note that this currently takes advantage of the bug that binexp ignores
9128 :     the Configure -Dinstallprefix setting, which in turn means that under
9129 :     relocatable @INC, initialinstalllocation is what binexp started as.
9130 case "$startperl" in
9131 '')
9132         case "$sharpbang" in
9133         *!)
9134                 $cat <<EOH
9135
9136 I can use the #! construct to start perl on your system. This will
9137 make startup of perl scripts faster, but may cause problems if you
9138 want to share those scripts and perl is not in a standard place
9139 ($initialinstalllocation/perl) on all your platforms. The alternative
9140 is to force a shell by starting the script with a single ':' character.
9141
9142 EOH
9143                 case "$versiononly" in
9144                 "$define")      dflt="$initialinstalllocation/perl$version";;
9145                 *)              dflt="$initialinstalllocation/perl";;
9146                 esac
9147                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9148                 . ./myread
9149                 case "$ans" in
9150                 none)   startperl=": # use perl";;
9151                 *)      startperl="#!$ans"
9152                         if $test 30 -lt `echo "$ans" | wc -c`; then
9153                                 $cat >&4 <<EOM
9154
9155 WARNING:  Some systems limit the #! command to 32 characters.
9156 If you experience difficulty running Perl scripts with #!, try
9157 installing Perl in a directory with a shorter pathname.
9158
9159 EOM
9160                         fi ;;
9161                 esac
9162                 ;;
9163         *) startperl=": # use perl"
9164                 ;;
9165         esac
9166         ;;
9167 esac
9168 echo "I'll use $startperl to start perl scripts."
9169
9170 : figure best path for perl in scripts
9171 case "$perlpath" in
9172 '')
9173         case "$versiononly" in
9174         "$define")      perlpath="$initialinstalllocation/perl$version";;
9175         *)              perlpath="$initialinstalllocation/perl";;
9176         esac
9177         case "$startperl" in
9178         *!*) ;;
9179         *)
9180                 $cat <<EOH
9181
9182 I will use the "eval 'exec'" idiom to start Perl on your system.
9183 I can use the full path of your Perl binary for this purpose, but
9184 doing so may cause problems if you want to share those scripts and
9185 Perl is not always in a standard place ($initialinstalllocation/perl).
9186
9187 EOH
9188                 dflt="$initialinstalllocation/perl"
9189                 rp="What path shall I use in \"eval 'exec'\"?"
9190                 . ./myread
9191                 perlpath="$ans"
9192                 ;;
9193         esac
9194         ;;
9195 esac
9196 case "$startperl" in
9197 *!*)    ;;
9198 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9199 esac
9200
9201 : determine where public executable scripts go
9202 set scriptdir scriptdir
9203 eval $prefixit
9204 case "$scriptdir" in
9205 '')
9206         dflt="$bin"
9207         : guess some guesses
9208         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9209         $test -d /usr/share/bin     && dflt=/usr/share/bin
9210         $test -d /usr/local/script  && dflt=/usr/local/script
9211         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9212         $test -d $prefixexp/script  && dflt=$prefixexp/script
9213         set dflt
9214         eval $prefixup
9215         ;;
9216 *)  dflt="$scriptdir"
9217         ;;
9218 esac
9219 $cat <<EOM
9220
9221 Some installations have a separate directory just for executable scripts so
9222 that they can mount it across multiple architectures but keep the scripts in
9223 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9224 Or you might just lump your scripts in with all your other executables.
9225
9226 EOM
9227 fn=d~
9228 rp='Where do you keep publicly executable scripts?'
9229 . ./getfile
9230 if $test "X$ansexp" != "X$scriptdirexp"; then
9231         installscript=''
9232 fi
9233 installscriptdir=''
9234 prefixvar=scriptdir
9235 . ./setprefixvar
9236 : A little fix up for an irregularly named variable.
9237 installscript="$installscriptdir"
9238
9239 : determine where add-on public executables go
9240 case "$sitebin" in
9241 '')     dflt=$siteprefix/bin ;;
9242 *)      dflt=$sitebin ;;
9243 esac
9244 fn=d~
9245 rp='Pathname where the add-on public executables should be installed?'
9246 . ./getfile
9247 prefixvar=sitebin
9248 . ./setprefixvar
9249
9250 : determine where add-on html pages go
9251 : There is no standard location, so try to copy the previously-selected
9252 : directory structure for the core html pages.
9253 case "$sitehtml1dir" in
9254 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9255 *)     dflt=$sitehtml1dir ;;
9256 esac
9257 case "$dflt" in
9258 ''|' ') dflt=none ;;
9259 esac
9260 fn=dn+~
9261 rp='Pathname where the site-specific html pages should be installed?'
9262 . ./getfile
9263 prefixvar=sitehtml1dir
9264 . ./setprefixvar
9265
9266 : determine where add-on library html pages go
9267 : There is no standard location, so try to copy the previously-selected
9268 : directory structure for the core html pages.
9269 case "$sitehtml3dir" in
9270 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9271 *)     dflt=$sitehtml3dir ;;
9272 esac
9273 case "$dflt" in
9274 ''|' ') dflt=none ;;
9275 esac
9276 fn=dn+~
9277 rp='Pathname where the site-specific library html pages should be installed?'
9278 . ./getfile
9279 prefixvar=sitehtml3dir
9280 . ./setprefixvar
9281
9282 : determine where add-on manual pages go
9283 case "$siteman1dir" in
9284 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9285 *)      dflt=$siteman1dir ;;
9286 esac
9287 case "$dflt" in
9288 ''|' ') dflt=none ;;
9289 esac
9290 fn=dn+~
9291 rp='Pathname where the site-specific manual pages should be installed?'
9292 . ./getfile
9293 prefixvar=siteman1dir
9294 . ./setprefixvar
9295
9296 : determine where add-on library man pages go
9297 case "$siteman3dir" in
9298 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9299 *)      dflt=$siteman3dir ;;
9300 esac
9301 case "$dflt" in
9302 ''|' ') dflt=none ;;
9303 esac
9304 fn=dn+~
9305 rp='Pathname where the site-specific library manual pages should be installed?'
9306 . ./getfile
9307 prefixvar=siteman3dir
9308 . ./setprefixvar
9309
9310 : determine where add-on public executable scripts go
9311 case "$sitescript" in
9312 '')     dflt=$siteprefix/script
9313         $test -d $dflt || dflt=$sitebin ;;
9314 *)  dflt="$sitescript" ;;
9315 esac
9316 fn=d~+
9317 rp='Pathname where add-on public executable scripts should be installed?'
9318 . ./getfile
9319 prefixvar=sitescript
9320 . ./setprefixvar
9321
9322 : see if backtrace exists
9323 set backtrace d_backtrace
9324 eval $inlibc
9325
9326 : add flags if using c backtrace
9327 case "$usecbacktrace" in
9328   "") usecbacktrace=$undef ;;
9329   [yY]*|true|$define)
9330     case "$d_backtrace" in
9331       [yY]*|true|$define)
9332         case " $ccflags " in
9333           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9334           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9335           esac
9336         ;;
9337       *)
9338         echo "This system does not support backtrace" >&4
9339         usecbacktrace=$undef
9340         ;;
9341       esac
9342     ;;
9343   esac
9344
9345 : Check if faststdio is requested and available
9346 case "$usefaststdio" in
9347 $define|true|[yY]*|'')
9348         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9349         case "$xversion" in
9350         [68])   dflt='y' ;;
9351         *)      dflt='n' ;;
9352         esac
9353         ;;
9354 *) dflt='n';;
9355 esac
9356 cat <<EOM
9357
9358 Perl can be built to use 'fast stdio', which means using the stdio
9359 library but also directly manipulating the stdio buffers to enable
9360 faster I/O.  Using stdio is better for backward compatibility (especially
9361 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9362 interface has been preferred instead of stdio.
9363
9364 If this doesn't make any sense to you, just accept the default '$dflt'.
9365 EOM
9366 rp='Use the "fast stdio" if available?'
9367 . ./myread
9368 case "$ans" in
9369 y|Y)    val="$define" ;;
9370 *)      val="$undef" ;;
9371 esac
9372 set usefaststdio
9373 eval $setvar
9374
9375
9376 : define an is-a-typedef? function
9377 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9378 case "$inclist" in
9379 "") inclist="sys/types.h";;
9380 esac;
9381 eval "varval=\$$var";
9382 case "$varval" in
9383 "")
9384         $rm -f temp.c;
9385         for inc in $inclist; do
9386                 echo "#include <$inc>" >>temp.c;
9387         done;
9388         echo "#ifdef $type" >> temp.c;
9389         echo "printf(\"We have $type\");" >> temp.c;
9390         echo "#endif" >> temp.c;
9391         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9392         if $contains $type temp.E >/dev/null 2>&1; then
9393                 eval "$var=\$type";
9394         else
9395                 eval "$var=\$def";
9396         fi;
9397         $rm -f temp.?;;
9398 *) eval "$var=\$varval";;
9399 esac'
9400
9401 : define an is-a-typedef? function that prompts if the type is not available.
9402 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9403 case "$inclist" in
9404 "") inclist="sys/types.h";;
9405 esac;
9406 eval "varval=\$$var";
9407 case "$varval" in
9408 "")
9409         $rm -f temp.c;
9410         for inc in $inclist; do
9411                 echo "#include <$inc>" >>temp.c;
9412         done;
9413         echo "#ifdef $type" >> temp.c;
9414         echo "printf(\"We have $type\");" >> temp.c;
9415         echo "#endif" >> temp.c;
9416         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9417         echo " " ;
9418         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9419         if $contains $type temp.E >/dev/null 2>&1; then
9420                 echo "$type found." >&4;
9421                 eval "$var=\$type";
9422         else
9423                 echo "$type NOT found." >&4;
9424                 dflt="$def";
9425                 . ./myread ;
9426                 eval "$var=\$ans";
9427         fi;
9428         $rm -f temp.?;;
9429 *) eval "$var=\$varval";;
9430 esac'
9431
9432 : see what type lseek is declared as in the kernel
9433 rp="What is the type used for lseek's offset on this system?"
9434 set off_t lseektype long stdio.h sys/types.h
9435 eval $typedef_ask
9436
9437 echo " "
9438 echo "Checking to see how big your file offsets are..." >&4
9439 $cat >try.c <<EOCP
9440 #include <sys/types.h>
9441 #include <stdio.h>
9442 int main()
9443 {
9444     printf("%d\n", (int)sizeof($lseektype));
9445     return(0);
9446 }
9447 EOCP
9448 set try
9449 if eval $compile_ok; then
9450         lseeksize=`$run ./try`
9451         echo "Your file offsets are $lseeksize bytes long."
9452 else
9453         dflt=$longsize
9454         echo " "
9455         echo "(I can't seem to compile the test program.  Guessing...)"
9456         rp="What is the size of your file offsets (in bytes)?"
9457         . ./myread
9458         lseeksize="$ans"
9459 fi
9460 $rm_try
9461
9462 : see what type file positions are declared as in the library
9463 rp="What is the type for file position used by fsetpos()?"
9464 set fpos_t fpostype long stdio.h sys/types.h
9465 eval $typedef_ask
9466
9467 : Check size for Fpos_t
9468 echo " "
9469 case "$fpostype" in
9470 *_t) zzz="$fpostype"    ;;
9471 *)   zzz="fpos_t"       ;;
9472 esac
9473 echo "Checking the size of $zzz..." >&4
9474 cat > try.c <<EOCP
9475 #include <sys/types.h>
9476 #include <stdio.h>
9477 #$i_stdlib I_STDLIB
9478 #ifdef I_STDLIB
9479 #include <stdlib.h>
9480 #endif
9481 int main() {
9482     printf("%d\n", (int)sizeof($fpostype));
9483     exit(0);
9484 }
9485 EOCP
9486 set try
9487 if eval $compile_ok; then
9488         yyy=`$run ./try`
9489         case "$yyy" in
9490         '')     fpossize=4
9491                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9492                 ;;
9493         *)      fpossize=$yyy
9494                 echo "Your $zzz is $fpossize bytes long."
9495                 ;;
9496         esac
9497 else
9498         dflt="$longsize"
9499         echo " " >&4
9500         echo "(I can't compile the test program.  Guessing...)" >&4
9501         rp="What is the size of your file positions (in bytes)?"
9502         . ./myread
9503         fpossize="$ans"
9504 fi
9505
9506 : Check for large file support
9507 # Backward compatibility (uselfs is deprecated).
9508 case "$uselfs" in
9509 "$define"|true|[yY]*)
9510         cat <<EOM >&4
9511
9512 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9513 EOM
9514         uselargefiles="$define"
9515         ;;
9516 esac
9517
9518 case "$lseeksize:$fpossize" in
9519 8:8) cat <<EOM
9520
9521 You can have files larger than 2 gigabytes.
9522 EOM
9523    val="$define" ;;
9524 *)    case "$uselargefiles" in
9525    "$undef"|false|[nN]*) dflt='n' ;;
9526    *)   dflt='y' ;;
9527    esac
9528    cat <<EOM
9529
9530 Perl can be built to understand large files (files larger than 2 gigabytes)
9531 on some systems.  To do so, Configure can be run with -Duselargefiles.
9532
9533 If this doesn't make any sense to you, just accept the default '$dflt'.
9534 EOM
9535    rp='Try to understand large files, if available?'
9536    . ./myread
9537    case "$ans" in
9538    y|Y)         val="$define" ;;
9539    *)           val="$undef"  ;;
9540    esac
9541    ;;
9542 esac
9543 set uselargefiles
9544 eval $setvar
9545 : Look for a hint-file generated 'call-back-unit'.  If the
9546 : user has specified that a large files perl is to be built,
9547 : we may need to set or change some other defaults.
9548 if $test -f uselargefiles.cbu; then
9549         echo "Your platform has some specific hints regarding large file builds, using them..."
9550         . ./uselargefiles.cbu
9551 fi
9552 case "$uselargefiles" in
9553 "$define")
9554         if $test -f uselargefiles.cbu; then
9555                 echo " "
9556                 echo "Rechecking to see how big your file offsets are..." >&4
9557                 $cat >try.c <<EOCP
9558 #include <sys/types.h>
9559 #include <stdio.h>
9560 int main()
9561 {
9562     printf("%d\n", (int)sizeof($lseektype));
9563     return(0);
9564 }
9565 EOCP
9566                 set try
9567                 if eval $compile_ok; then
9568                         lseeksize=`$run ./try`
9569                         $echo "Your file offsets are now $lseeksize bytes long."
9570                 else
9571                         dflt="$lseeksize"
9572                         echo " "
9573                         echo "(I can't seem to compile the test program.  Guessing...)"
9574                         rp="What is the size of your file offsets (in bytes)?"
9575                         . ./myread
9576                         lseeksize="$ans"
9577                 fi
9578                 case "$fpostype" in
9579                 *_t) zzz="$fpostype"    ;;
9580                 *)   zzz="fpos_t"       ;;
9581                 esac
9582                 $echo $n "Rechecking the size of $zzz...$c" >&4
9583                 $cat > try.c <<EOCP
9584 #include <sys/types.h>
9585 #include <stdio.h>
9586 #$i_stdlib I_STDLIB
9587 #ifdef I_STDLIB
9588 #include <stdlib.h>
9589 #endif
9590 int main() {
9591     printf("%d\n", (int)sizeof($fpostype));
9592     return(0);
9593 }
9594 EOCP
9595                 set try
9596                 if eval $compile_ok; then
9597                         yyy=`$run ./try`
9598                         dflt="$lseeksize"
9599                         case "$yyy" in
9600                         '')     echo " "
9601                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9602                                 ;;
9603                         *)      fpossize=$yyy
9604                                 echo " $fpossize bytes." >&4
9605                                 ;;
9606                         esac
9607                 else
9608                         dflt="$fpossize"
9609                         echo " "
9610                         echo "(I can't compile the test program.  Guessing...)" >&4
9611                         rp="What is the size of your file positions (in bytes)?"
9612                         . ./myread
9613                         fpossize="$ans"
9614                 fi
9615                 $rm_try
9616         fi
9617         ;;
9618 esac
9619
9620 : Check if we want perlio
9621 useperlio="$define"
9622
9623 : Set the vendorbin variables
9624 case "$vendorprefix" in
9625 '')     d_vendorbin="$undef"
9626         vendorbin=''
9627         vendorbinexp=''
9628         ;;
9629 *)      d_vendorbin="$define"
9630         : determine where vendor-supplied executables go.
9631         case "$vendorbin" in
9632         '') dflt=$vendorprefix/bin ;;
9633         *)      dflt="$vendorbin" ;;
9634         esac
9635         fn=d~+
9636         rp='Pathname for the vendor-supplied executables directory?'
9637         . ./getfile
9638         vendorbin="$ans"
9639         vendorbinexp="$ansexp"
9640         ;;
9641 esac
9642 prefixvar=vendorbin
9643 . ./installprefix
9644
9645 : Set the vendorhtml1dir variables
9646 case "$vendorprefix" in
9647 '')     vendorhtml1dir=''
9648         vendorhtml1direxp=''
9649         ;;
9650 *)      : determine where vendor-supplied html pages go.
9651         : There is no standard location, so try to copy the previously-selected
9652         : directory structure for the core html pages.
9653         : XXX Better default suggestions would be welcome.
9654         case "$vendorhtml1dir" in
9655         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9656         *)      dflt=$vendorhtml1dir ;;
9657         esac
9658         case "$dflt" in
9659         ''|' ') dflt=none ;;
9660         esac
9661         fn=dn+~
9662         rp='Pathname for the vendor-supplied html pages?'
9663         . ./getfile
9664         vendorhtml1dir="$ans"
9665         vendorhtml1direxp="$ansexp"
9666         ;;
9667 esac
9668 : Use ' ' for none so value is preserved next time through Configure
9669 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9670 prefixvar=vendorhtml1dir
9671 . ./installprefix
9672
9673 : Set the vendorhtml3dir variables
9674 case "$vendorprefix" in
9675 '')     vendorhtml3dir=''
9676         vendorhtml3direxp=''
9677         ;;
9678 *)      : determine where vendor-supplied module html pages go.
9679         : There is no standard location, so try to copy the previously-selected
9680         : directory structure for the core html pages.
9681         : XXX Better default suggestions would be welcome.
9682         case "$vendorhtml3dir" in
9683         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9684         *)      dflt=$vendorhtml3dir ;;
9685         esac
9686         case "$dflt" in
9687         ''|' ') dflt=none ;;
9688         esac
9689         fn=dn+~
9690         rp='Pathname for the vendor-supplied html pages?'
9691         . ./getfile
9692         vendorhtml3dir="$ans"
9693         vendorhtml3direxp="$ansexp"
9694         ;;
9695 esac
9696 : Use ' ' for none so value is preserved next time through Configure
9697 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9698 prefixvar=vendorhtml3dir
9699 . ./installprefix
9700
9701 : Set the vendorman1dir variables
9702 case "$vendorprefix" in
9703 '')     vendorman1dir=''
9704         vendorman1direxp=''
9705         ;;
9706 *)      : determine where vendor-supplied manual pages go.
9707         case "$vendorman1dir" in
9708         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9709         *)      dflt=$vendorman1dir ;;
9710         esac
9711         case "$dflt" in
9712         ''|' ') dflt=none ;;
9713         esac
9714         fn=nd~+
9715         rp='Pathname for the vendor-supplied manual section 1 pages?'
9716         . ./getfile
9717         vendorman1dir="$ans"
9718         vendorman1direxp="$ansexp"
9719         ;;
9720 esac
9721 : Use ' ' for none so value is preserved next time through Configure
9722 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9723 prefixvar=vendorman1dir
9724 . ./installprefix
9725
9726 : Set the vendorman3dir variables
9727 case "$vendorprefix" in
9728 '')     vendorman3dir=''
9729         vendorman3direxp=''
9730         ;;
9731 *)      : determine where vendor-supplied module manual pages go.
9732         case "$vendorman3dir" in
9733         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9734         *)      dflt=$vendorman3dir ;;
9735         esac
9736         case "$dflt" in
9737         ''|' ') dflt=none ;;
9738         esac
9739         fn=nd~+
9740         rp='Pathname for the vendor-supplied manual section 3 pages?'
9741         . ./getfile
9742         vendorman3dir="$ans"
9743         vendorman3direxp="$ansexp"
9744         ;;
9745 esac
9746 : Use ' ' for none so value is preserved next time through Configure
9747 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9748 prefixvar=vendorman3dir
9749 . ./installprefix
9750
9751 : Set the vendorscript variables
9752 case "$vendorprefix" in
9753 '')     d_vendorscript="$undef"
9754         vendorscript=''
9755         vendorscriptexp=''
9756         ;;
9757 *)      d_vendorscript="$define"
9758         : determine where vendor-supplied scripts go.
9759         case "$vendorscript" in
9760         '')     dflt=$vendorprefix/script
9761                 $test -d $dflt || dflt=$vendorbin ;;
9762         *)  dflt="$vendorscript" ;;
9763         esac
9764         $cat <<EOM
9765
9766 The installation process will create a directory for
9767 vendor-supplied scripts.
9768
9769 EOM
9770         fn=d~+
9771         rp='Pathname for the vendor-supplied scripts directory?'
9772         . ./getfile
9773         vendorscript="$ans"
9774         vendorscriptexp="$ansexp"
9775         ;;
9776 esac
9777 prefixvar=vendorscript
9778 . ./installprefix
9779
9780 : script used to emit important warnings
9781 cat >warn <<EOS
9782 $startsh
9783 if test \$# -gt 0; then
9784         echo "\$@" >msg
9785 else
9786         cat >msg
9787 fi
9788 echo "*** WARNING:" >&4
9789 sed -e 's/^/*** /' <msg >&4
9790 echo "*** " >&4
9791 cat msg >>config.msg
9792 echo " " >>config.msg
9793 rm -f msg
9794 EOS
9795 chmod +x warn
9796 $eunicefix warn
9797
9798 : see which of string.h or strings.h is needed
9799 echo " "
9800 strings=`./findhdr string.h`
9801 if $test "$strings" && $test -r "$strings"; then
9802         echo "Using <string.h> instead of <strings.h>." >&4
9803         val="$define"
9804 else
9805         val="$undef"
9806         strings=`./findhdr strings.h`
9807         if $test "$strings" && $test -r "$strings"; then
9808                 echo "Using <strings.h> instead of <string.h>." >&4
9809         else
9810                 ./warn "No string header found -- You'll surely have problems."
9811         fi
9812 fi
9813 set i_string
9814 eval $setvar
9815 case "$i_string" in
9816 "$undef") strings=`./findhdr strings.h`;;
9817 *)        strings=`./findhdr string.h`;;
9818 esac
9819
9820 : see if qgcvt exists
9821 set qgcvt d_qgcvt
9822 eval $inlibc
9823
9824 : Check print/scan long double stuff
9825 echo " "
9826
9827 if $test X"$d_longdbl" = X"$define"; then
9828
9829 echo "Checking how to print long doubles..." >&4
9830
9831 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9832         $cat >try.c <<'EOCP'
9833 #include <sys/types.h>
9834 #include <stdio.h>
9835 int main() {
9836   double d = 123.456;
9837   printf("%.3f\n", d);
9838 }
9839 EOCP
9840         set try
9841         if eval $compile; then
9842                 yyy=`$run ./try`
9843                 case "$yyy" in
9844                 123.456)
9845                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9846                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9847                         echo "We will use %f."
9848                         ;;
9849                 esac
9850         fi
9851 fi
9852
9853 if $test X"$sPRIfldbl" = X; then
9854         $cat >try.c <<'EOCP'
9855 #include <sys/types.h>
9856 #include <stdio.h>
9857 int main() {
9858   long double d = 123.456;
9859   printf("%.3Lf\n", d);
9860 }
9861 EOCP
9862         set try
9863         if eval $compile; then
9864                 yyy=`$run ./try`
9865                 case "$yyy" in
9866                 123.456)
9867                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9868                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9869                         echo "We will use %Lf."
9870                         ;;
9871                 esac
9872         fi
9873 fi
9874
9875 if $test X"$sPRIfldbl" = X; then
9876         $cat >try.c <<'EOCP'
9877 #include <sys/types.h>
9878 #include <stdio.h>
9879 int main() {
9880   long double d = 123.456;
9881   printf("%.3llf\n", d);
9882 }
9883 EOCP
9884         set try
9885         if eval $compile; then
9886                 yyy=`$run ./try`
9887                 case "$yyy" in
9888                 123.456)
9889                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9890                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9891                         echo "We will use %llf."
9892                         ;;
9893                 esac
9894         fi
9895 fi
9896
9897 if $test X"$sPRIfldbl" = X; then
9898         $cat >try.c <<'EOCP'
9899 #include <sys/types.h>
9900 #include <stdio.h>
9901 int main() {
9902   long double d = 123.456;
9903   printf("%.3lf\n", d);
9904 }
9905 EOCP
9906         set try
9907         if eval $compile; then
9908                 yyy=`$run ./try`
9909                 case "$yyy" in
9910                 123.456)
9911                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9912                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9913                         echo "We will use %lf."
9914                         ;;
9915                 esac
9916         fi
9917 fi
9918
9919 if $test X"$sPRIfldbl" = X; then
9920         echo "Cannot figure out how to print long doubles." >&4
9921 else
9922         sSCNfldbl=$sPRIfldbl    # expect consistency
9923 fi
9924
9925 $rm_try
9926
9927 fi # d_longdbl
9928
9929 case "$sPRIfldbl" in
9930 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9931         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9932         d_SCNfldbl="$undef";
9933         ;;
9934 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9935         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9936         d_SCNfldbl="$define";
9937         ;;
9938 esac
9939
9940 : Check how to convert floats to strings.
9941
9942 if test "X$d_Gconvert" = X; then
9943
9944 echo " "
9945 echo "Checking for an efficient way to convert floats to strings."
9946 echo " " > try.c
9947 case "$uselongdouble" in
9948 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9949 esac
9950 case "$d_longdbl" in
9951 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9952 esac
9953 case "$d_PRIgldbl" in
9954 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9955 esac
9956 $cat >>try.c <<EOP
9957 #ifdef TRY_gconvert
9958 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9959 char *myname = "gconvert";
9960 #endif
9961 #ifdef TRY_gcvt
9962 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9963 char *myname = "gcvt";
9964 #endif
9965 #ifdef TRY_qgcvt
9966 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9967 char *myname = "qgcvt";
9968 #define DOUBLETYPE long double
9969 #endif
9970 #ifdef TRY_sprintf
9971 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9972 #ifdef HAS_PRIgldbl
9973 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9974 #else
9975 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9976 #endif
9977 #else
9978 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9979 #endif
9980 char *myname = "sprintf";
9981 #endif
9982
9983 #ifndef DOUBLETYPE
9984 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9985 #define DOUBLETYPE long double
9986 #else
9987 #define DOUBLETYPE double
9988 #endif
9989 #endif
9990
9991 #include <stdio.h>
9992
9993 #$i_stdlib I_STDLIB
9994 #ifdef I_STDLIB
9995 #include <stdlib.h>
9996 #endif
9997 #$i_string I_STRING
9998 #ifdef I_STRING
9999 #  include <string.h>
10000 #else
10001 #  include <strings.h>
10002 #endif
10003
10004 int checkit(char *expect, char *got)
10005 {
10006     if (strcmp(expect, got)) {
10007                 printf("%s oddity:  Expected %s, got %s\n",
10008                         myname, expect, got);
10009                 exit(1);
10010         }
10011 }
10012
10013 int main()
10014 {
10015         char buf[64];
10016         buf[63] = '\0';
10017
10018         /* This must be 1st test on (which?) platform */
10019         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10020         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10021         checkit("0.1", buf);
10022
10023         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10024         checkit("0.01", buf);
10025
10026         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10027         checkit("0.001", buf);
10028
10029         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10030         checkit("0.0001", buf);
10031
10032         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10033         if (strlen(buf) > 5)
10034             checkit("9e-005", buf); /* for Microsoft ?? */
10035         else
10036             checkit("9e-05", buf);
10037
10038         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10039         checkit("1", buf);
10040
10041         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10042         checkit("1.1", buf);
10043
10044         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10045         checkit("1.01", buf);
10046
10047         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10048         checkit("1.001", buf);
10049
10050         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10051         checkit("1.0001", buf);
10052
10053         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10054         checkit("1.00001", buf);
10055
10056         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10057         checkit("1.000001", buf);
10058
10059         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10060         checkit("0", buf);
10061
10062         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10063         checkit("-1", buf);
10064
10065         /* Some Linux gcvt's give 1.e+5 here. */
10066         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10067         checkit("100000", buf);
10068
10069         /* Some Linux gcvt's give -1.e+5 here. */
10070         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10071         checkit("-100000", buf);
10072
10073         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10074         checkit("123.456", buf);
10075
10076         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10077         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10078         /* 34 should be enough to scare even long double
10079          * places into using the e notation. */
10080         if (strlen(buf) > 5)
10081             checkit("1e+034", buf); /* for Microsoft */
10082         else
10083             checkit("1e+34", buf);
10084
10085         /* For Perl, if you add additional tests here, also add them to
10086          * t/base/num.t for benefit of platforms not using Configure or
10087          * overriding d_Gconvert */
10088
10089         exit(0);
10090 }
10091 EOP
10092 : first add preferred functions to our list
10093 xxx_list=""
10094 for xxx_convert in $gconvert_preference; do
10095     case $xxx_convert in
10096     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10097     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10098     esac
10099 done
10100 : then add any others
10101 for xxx_convert in gconvert gcvt sprintf; do
10102     case "$xxx_list" in
10103     *$xxx_convert*) ;;
10104     *) xxx_list="$xxx_list $xxx_convert" ;;
10105     esac
10106 done
10107
10108 case "$d_longdbl$uselongdouble" in
10109 "$define$define")
10110     : again, add preferred functions to our list first
10111     xxx_ld_list=""
10112     for xxx_convert in $gconvert_ld_preference; do
10113         case $xxx_convert in
10114         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10115         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10116         esac
10117     done
10118     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10119     for xxx_convert in qgcvt sprintf $xxx_list; do
10120         case "$xxx_ld_list" in
10121         $xxx_convert*|*" $xxx_convert"*) ;;
10122         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10123         esac
10124     done
10125     : if sprintf cannot do long doubles, move it to the end
10126     if test "$d_PRIgldbl" != "$define"; then
10127         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10128     fi
10129     : if no qgcvt, remove it
10130     if test "$d_qgcvt" != "$define"; then
10131         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10132     fi
10133     : use the ld_list
10134     xxx_list="$xxx_ld_list"
10135     ;;
10136 esac
10137
10138 for xxx_convert in $xxx_list; do
10139         echo "Trying $xxx_convert..."
10140         $rm -f try try$_o core
10141         set try -DTRY_$xxx_convert
10142         if eval $compile; then
10143                 echo "$xxx_convert() found." >&4
10144                 if $run ./try; then
10145                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10146                         break;
10147                 else
10148                         echo "...But $xxx_convert didn't work as I expected."
10149                         xxx_convert=''
10150                 fi
10151         else
10152                 echo "$xxx_convert NOT found." >&4
10153         fi
10154 done
10155
10156 if test X$xxx_convert = X; then
10157     echo "*** WHOA THERE!!! ***" >&4
10158     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10159     xxx_convert=sprintf
10160 fi
10161
10162 case "$xxx_convert" in
10163 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10164 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10165 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10166 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10167    "$define$define$define")
10168       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10169    "$define$define$undef")
10170       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10171    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10172    esac
10173    ;;
10174 esac
10175
10176 fi
10177 $rm_try
10178
10179 : see if _fwalk exists
10180 set fwalk d__fwalk
10181 eval $inlibc
10182
10183 : Initialize h_fcntl
10184 h_fcntl=false
10185
10186 : Initialize h_sysfile
10187 h_sysfile=false
10188
10189 : access call always available on UNIX
10190 set access d_access
10191 eval $inlibc
10192
10193 : locate the flags for 'access()'
10194 case "$d_access" in
10195 "$define")
10196         echo " "
10197         $cat >access.c <<EOCP
10198 #include <sys/types.h>
10199 #ifdef I_FCNTL
10200 #include <fcntl.h>
10201 #endif
10202 #ifdef I_SYS_FILE
10203 #include <sys/file.h>
10204 #endif
10205 #ifdef I_UNISTD
10206 #include <unistd.h>
10207 #endif
10208 #$i_stdlib I_STDLIB
10209 #ifdef I_STDLIB
10210 #include <stdlib.h>
10211 #endif
10212 int main() {
10213         exit(R_OK);
10214 }
10215 EOCP
10216         : check sys/file.h first, no particular reason here
10217         if $test `./findhdr sys/file.h` && \
10218                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10219                 h_sysfile=true;
10220                 echo "<sys/file.h> defines the *_OK access constants." >&4
10221         elif $test `./findhdr fcntl.h` && \
10222                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10223                 h_fcntl=true;
10224                 echo "<fcntl.h> defines the *_OK access constants." >&4
10225         elif $test `./findhdr unistd.h` && \
10226                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10227                 echo "<unistd.h> defines the *_OK access constants." >&4
10228         else
10229                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10230         fi
10231         ;;
10232 esac
10233 $rm -f access*
10234
10235 : see if accessx exists
10236 set accessx d_accessx
10237 eval $inlibc
10238
10239 : see if aintl exists
10240 set aintl d_aintl
10241 eval $inlibc
10242
10243 : see if alarm exists
10244 set alarm d_alarm
10245 eval $inlibc
10246
10247 : see if 64bit time functions exists
10248
10249 set ctime64 d_ctime64
10250 eval $inlibc
10251
10252 set localtime64 d_localtime64
10253 eval $inlibc
10254
10255 set gmtime64 d_gmtime64
10256 eval $inlibc
10257
10258 set mktime64 d_mktime64
10259 eval $inlibc
10260
10261 set difftime64 d_difftime64
10262 eval $inlibc
10263
10264 set asctime64 d_asctime64
10265 eval $inlibc
10266
10267 : see if POSIX threads are available
10268 set pthread.h i_pthread
10269 eval $inhdr
10270
10271 : define a function to check prototypes
10272 $cat > protochk <<EOSH
10273 $startsh
10274 cc="$cc"
10275 optimize="$optimize"
10276 ccflags="$ccflags"
10277 prototype="$prototype"
10278 define="$define"
10279 rm_try="$rm_try"
10280 usethreads=$usethreads
10281 i_pthread=$i_pthread
10282 pthread_h_first=$pthread_h_first
10283 EOSH
10284
10285 $cat >> protochk <<'EOSH'
10286
10287 $rm_try
10288 foo="$1"
10289 shift
10290 while test $# -ge 2; do
10291         case "$1" in
10292                 $define) echo "#include <$2>" >> try.c ;;
10293                 literal) echo "$2" >> try.c ;;
10294         esac
10295     # Extra magic for the benefit of systems that need pthread.h
10296     # to be included early to correctly detect threadsafe functions.
10297     # Such functions must guarantee themselves, though, that the usethreads
10298     # and i_pthread have been defined, before calling protochk.
10299     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10300         echo "#include <pthread.h>" >> try.c
10301         pthread_h_done=yes
10302     fi
10303     shift 2
10304 done
10305 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10306 cat >> try.c <<'EOCP'
10307 #ifdef CAN_PROTOTYPE
10308 #define _(args) args
10309 #else
10310 #define _(args) ()
10311 #endif
10312 EOCP
10313 echo "$foo" >> try.c
10314 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10315 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10316 status=$?
10317 $rm_try
10318 exit $status
10319 EOSH
10320 chmod +x protochk
10321 $eunicefix protochk
10322
10323 : Define hasproto macro for Configure internal use
10324 hasproto='varname=$1; func=$2; shift; shift;
10325 while $test $# -ge 2; do
10326         case "$1" in
10327         $define) echo "#include <$2>";;
10328         esac ;
10329     shift 2;
10330 done > try.c;
10331 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10332 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10333         echo "$func() prototype found.";
10334         val="$define";
10335 else
10336         echo "$func() prototype NOT found.";
10337         val="$undef";
10338 fi;
10339 set $varname;
10340 eval $setvar;
10341 $rm_try tryout.c'
10342
10343 : see if sys/types.h has to be included
10344 set sys/types.h i_systypes
10345 eval $inhdr
10346
10347 : see if sys/select.h has to be included
10348 set sys/select.h i_sysselct
10349 eval $inhdr
10350
10351 : Define hasfield macro for Configure internal use
10352 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10353 while $test $# -ge 2; do
10354         case "$1" in
10355         $define) echo "#include <$2>";;
10356         esac ;
10357     shift 2;
10358 done > try.c;
10359 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10360 set try;
10361 if eval $compile; then
10362         val="$define";
10363 else
10364         val="$undef";
10365 fi;
10366 set $varname;
10367 eval $setvar;
10368 $rm_try'
10369
10370 : see if we should include time.h, sys/time.h, or both
10371 echo " "
10372 if test "X$timeincl" = X; then
10373         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10374         $echo $n "I'm now running the test program...$c"
10375         $cat >try.c <<EOCP
10376 #include <sys/types.h>
10377 #ifdef I_TIME
10378 #include <time.h>
10379 #endif
10380 #ifdef I_SYSTIME
10381 #ifdef SYSTIMEKERNEL
10382 #define KERNEL
10383 #endif
10384 #include <sys/time.h>
10385 #endif
10386 #ifdef I_SYSSELECT
10387 #include <sys/select.h>
10388 #endif
10389 #$i_stdlib I_STDLIB
10390 #ifdef I_STDLIB
10391 #include <stdlib.h>
10392 #endif
10393 int main()
10394 {
10395         struct tm foo;
10396 #ifdef S_TIMEVAL
10397         struct timeval bar;
10398 #endif
10399 #ifdef S_TIMEZONE
10400         struct timezone tzp;
10401 #endif
10402         if (foo.tm_sec == foo.tm_sec)
10403                 exit(0);
10404 #ifdef S_TIMEVAL
10405         if (bar.tv_sec == bar.tv_sec)
10406                 exit(0);
10407 #endif
10408         exit(1);
10409 }
10410 EOCP
10411         flags=''
10412         for s_timezone in '-DS_TIMEZONE' ''; do
10413         sysselect=''
10414         for s_timeval in '-DS_TIMEVAL' ''; do
10415         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10416         for i_time in '' '-DI_TIME'; do
10417         for i_systime in '-DI_SYSTIME' ''; do
10418                 case "$flags" in
10419                 '') $echo $n ".$c"
10420                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10421                         if eval $compile; then
10422                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10423                                 shift
10424                                 flags="$*"
10425                                 echo " "
10426                                 $echo $n "Succeeded with $flags$c"
10427                         fi
10428                         ;;
10429                 esac
10430         done
10431         done
10432         done
10433         done
10434         done
10435         timeincl=''
10436         echo " "
10437         case "$flags" in
10438         *SYSTIMEKERNEL*) i_systimek="$define"
10439                 timeincl=`./findhdr sys/time.h`
10440                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10441         *) i_systimek="$undef";;
10442         esac
10443         case "$flags" in
10444         *I_TIME*) i_time="$define"
10445                 timeincl=`./findhdr time.h`" $timeincl"
10446                 echo "We'll include <time.h>." >&4;;
10447         *) i_time="$undef";;
10448         esac
10449         case "$flags" in
10450         *I_SYSTIME*) i_systime="$define"
10451                 timeincl=`./findhdr sys/time.h`" $timeincl"
10452                 echo "We'll include <sys/time.h>." >&4;;
10453         *) i_systime="$undef";;
10454         esac
10455         $rm_try
10456 fi
10457 : see if struct tm knows about tm_zone
10458 case "$i_systime$i_time" in
10459 *$define*)
10460         echo " "
10461         echo "Checking to see if your struct tm has tm_zone field..." >&4
10462         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10463         eval $hasfield
10464         ;;
10465 *)      val="$undef"
10466         set d_tm_tm_zone
10467         eval $setvar
10468         ;;
10469 esac
10470 case "$d_tm_tm_zone" in
10471 "$define")      echo "Yes, it does."   ;;
10472 *)              echo "No, it doesn't." ;;
10473 esac
10474 : see if struct tm knows about tm_gmtoff
10475 case "$i_systime$i_time" in
10476 *$define*)
10477         echo " "
10478         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10479         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10480         eval $hasfield
10481         ;;
10482 *)      val="$undef"
10483         set d_tm_tm_gmtoff
10484         eval $setvar
10485         ;;
10486 esac
10487 case "$d_tm_tm_gmtoff" in
10488 "$define")      echo "Yes, it does."   ;;
10489 *)              echo "No, it doesn't." ;;
10490 esac
10491
10492 : see if asctime_r exists
10493 set asctime_r d_asctime_r
10494 eval $inlibc
10495 case "$d_asctime_r" in
10496 "$define")
10497         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10498         case "$d_asctime_r_proto:$usethreads" in
10499         ":define")      d_asctime_r_proto=define
10500                 set d_asctime_r_proto asctime_r $hdrs
10501                 eval $hasproto ;;
10502         *)      ;;
10503         esac
10504         case "$d_asctime_r_proto" in
10505         define)
10506         case "$asctime_r_proto" in
10507         ''|0) try='char* asctime_r(const struct tm*, char*);'
10508         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10509         esac
10510         case "$asctime_r_proto" in
10511         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10512         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10513         esac
10514         case "$asctime_r_proto" in
10515         ''|0) try='int asctime_r(const struct tm*, char*);'
10516         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10517         esac
10518         case "$asctime_r_proto" in
10519         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10520         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10521         esac
10522         case "$asctime_r_proto" in
10523         ''|0)   d_asctime_r=undef
10524                 asctime_r_proto=0
10525                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10526         * )     case "$asctime_r_proto" in
10527                 REENTRANT_PROTO*) ;;
10528                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10529                 esac
10530                 echo "Prototype: $try" ;;
10531         esac
10532         ;;
10533         *)      case "$usethreads" in
10534                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10535                 esac
10536                 d_asctime_r=undef
10537                 asctime_r_proto=0
10538                 ;;
10539         esac
10540         ;;
10541 *)      asctime_r_proto=0
10542         ;;
10543 esac
10544
10545 : see if atolf exists
10546 set atolf d_atolf
10547 eval $inlibc
10548
10549 : see if atoll exists
10550 set atoll d_atoll
10551 eval $inlibc
10552
10553 : Look for GCC-style attribute format
10554 case "$d_attribute_format" in
10555 '')
10556 echo " "
10557 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10558 $cat >attrib.c <<'EOCP'
10559 #include <stdio.h>
10560 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10561 EOCP
10562 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10563         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10564                 echo "Your C compiler doesn't support __attribute__((format))."
10565                 val="$undef"
10566         else
10567                 echo "Your C compiler supports __attribute__((format))."
10568                 val="$define"
10569         fi
10570 else
10571         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10572         val="$undef"
10573 fi
10574 ;;
10575 *) val="$d_attribute_format" ;;
10576 esac
10577 set d_attribute_format
10578 eval $setvar
10579 $rm -f attrib*
10580
10581 : Look for GCC-style attribute format with null format allowed
10582 case "$d_printf_format_null" in
10583 '') case "$d_attribute_format" in
10584     $define)
10585         echo " "
10586         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10587 $cat >attrib.c <<EOCP
10588 #include <stdio.h>
10589 #$i_stdlib I_STDLIB
10590 #ifdef I_STDLIB
10591 #include <stdlib.h>
10592 #endif
10593 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10594 int null_printf (char* pat,...) { return (int)pat; }
10595 int main () { exit(null_printf(NULL)); }
10596 EOCP
10597         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10598             : run the executable in case it produces a run-time warning
10599             if $run ./attrib >>attrib.out 2>&1; then
10600                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10601                     echo "Your C compiler doesn't allow __printf__ format to be null."
10602                     val="$undef"
10603                 else
10604                     echo "Your C compiler allows __printf__ format to be null."
10605                     val="$define"
10606                 fi
10607             else
10608             echo "Your C compiler executable failed with __printf__ format null."
10609             val="$undef"
10610         fi
10611     else
10612         echo "Your C compiler fails with __printf__ format null."
10613         val="$undef"
10614     fi
10615     ;;
10616     *)  val="$undef" ;;
10617     esac
10618 ;;
10619 *)  val="$d_printf_format_null" ;;
10620 esac
10621 set d_printf_format_null
10622 eval $setvar
10623 $rm -f attrib*
10624
10625 : Look for GCC-style attribute malloc
10626 case "$d_attribute_malloc" in
10627 '')
10628 echo " "
10629 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10630 $cat >attrib.c <<'EOCP'
10631 #include <stdio.h>
10632 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10633 EOCP
10634 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10635         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10636                 echo "Your C compiler doesn't support __attribute__((malloc))."
10637                 val="$undef"
10638         else
10639                 echo "Your C compiler supports __attribute__((malloc))."
10640                 val="$define"
10641         fi
10642 else
10643         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10644         val="$undef"
10645 fi
10646 ;;
10647 *) val="$d_attribute_malloc" ;;
10648 esac
10649 set d_attribute_malloc
10650 eval $setvar
10651 $rm -f attrib*
10652
10653 : Look for GCC-style attribute nonnull
10654 case "$d_attribute_nonnull" in
10655 '')
10656 echo " "
10657 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10658 $cat >attrib.c <<'EOCP'
10659 #include <stdio.h>
10660 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10661 EOCP
10662 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10663         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10664                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10665                 val="$undef"
10666         else
10667                 echo "Your C compiler supports __attribute__((nonnull))."
10668                 val="$define"
10669         fi
10670 else
10671         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10672         val="$undef"
10673 fi
10674 ;;
10675 *) val="$d_attribute_nonnull" ;;
10676 esac
10677 set d_attribute_nonnull
10678 eval $setvar
10679 $rm -f attrib*
10680
10681 : Look for GCC-style attribute noreturn
10682 case "$d_attribute_noreturn" in
10683 '')
10684 echo " "
10685 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10686 $cat >attrib.c <<'EOCP'
10687 #include <stdio.h>
10688 void fall_over_dead( void ) __attribute__((noreturn));
10689 EOCP
10690 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10691         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10692                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10693                 val="$undef"
10694         else
10695                 echo "Your C compiler supports __attribute__((noreturn))."
10696                 val="$define"
10697         fi
10698 else
10699         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10700         val="$undef"
10701 fi
10702 ;;
10703 *) val="$d_attribute_noreturn" ;;
10704 esac
10705 set d_attribute_noreturn
10706 eval $setvar
10707 $rm -f attrib*
10708
10709 : Look for GCC-style attribute pure
10710 case "$d_attribute_pure" in
10711 '')
10712 echo " "
10713 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10714 $cat >attrib.c <<'EOCP'
10715 #include <stdio.h>
10716 int square( int n ) __attribute__((pure));
10717 EOCP
10718 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10719         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10720                 echo "Your C compiler doesn't support __attribute__((pure))."
10721                 val="$undef"
10722         else
10723                 echo "Your C compiler supports __attribute__((pure))."
10724                 val="$define"
10725         fi
10726 else
10727         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10728         val="$undef"
10729 fi
10730 ;;
10731 *) val="$d_attribute_pure" ;;
10732 esac
10733 set d_attribute_pure
10734 eval $setvar
10735 $rm -f attrib*
10736
10737 : Look for GCC-style attribute unused
10738 case "$d_attribute_unused" in
10739 '')
10740 echo " "
10741 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10742 $cat >attrib.c <<'EOCP'
10743 #include <stdio.h>
10744 int do_something( int dummy __attribute__((unused)), int n );
10745 EOCP
10746 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10747         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10748                 echo "Your C compiler doesn't support __attribute__((unused))."
10749                 val="$undef"
10750         else
10751                 echo "Your C compiler supports __attribute__((unused))."
10752                 val="$define"
10753         fi
10754 else
10755         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10756         val="$undef"
10757 fi
10758 ;;
10759 *) val="$d_attribute_unused" ;;
10760 esac
10761 set d_attribute_unused
10762 eval $setvar
10763 $rm -f attrib*
10764
10765 : Look for GCC-style attribute deprecated
10766 case "$d_attribute_deprecated" in
10767 '')
10768 echo " "
10769 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10770 $cat >attrib.c <<'EOCP'
10771 #include <stdio.h>
10772 int I_am_deprecated(void) __attribute__((deprecated));
10773 EOCP
10774 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10775         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10776                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10777                 val="$undef"
10778         else
10779                 echo "Your C compiler supports __attribute__((deprecated))."
10780                 val="$define"
10781         fi
10782 else
10783         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10784         val="$undef"
10785 fi
10786 ;;
10787 *) val="$d_attribute_deprecated" ;;
10788 esac
10789 set d_attribute_deprecated
10790 eval $setvar
10791 $rm -f attrib*
10792
10793 : Look for GCC-style attribute warn_unused_result
10794 case "$d_attribute_warn_unused_result" in
10795 '')
10796 echo " "
10797 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10798 $cat >attrib.c <<'EOCP'
10799 #include <stdio.h>
10800 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10801 EOCP
10802 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10803         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10804                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10805                 val="$undef"
10806         else
10807                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10808                 val="$define"
10809         fi
10810 else
10811         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10812         val="$undef"
10813 fi
10814 ;;
10815 *) val="$d_attribute_warn_unused_result" ;;
10816 esac
10817 set d_attribute_warn_unused_result
10818 eval $setvar
10819 $rm -f attrib*
10820
10821 : see if bcmp exists
10822 set bcmp d_bcmp
10823 eval $inlibc
10824
10825 : see if bcopy exists
10826 set bcopy d_bcopy
10827 eval $inlibc
10828
10829 : see if getpgrp exists
10830 set getpgrp d_getpgrp
10831 eval $inlibc
10832
10833 case "$d_getpgrp" in
10834 "$define")
10835         echo " "
10836         echo "Checking to see which flavor of getpgrp is in use..."
10837         $cat >try.c <<EOP
10838 #$i_unistd I_UNISTD
10839 #include <sys/types.h>
10840 #ifdef I_UNISTD
10841 #  include <unistd.h>
10842 #endif
10843 #$i_stdlib I_STDLIB
10844 #ifdef I_STDLIB
10845 #include <stdlib.h>
10846 #endif
10847 int main()
10848 {
10849         if (getuid() == 0) {
10850                 printf("(I see you are running Configure as super-user...)\n");
10851                 setuid(1);
10852         }
10853 #ifdef TRY_BSD_PGRP
10854         if (getpgrp(1) == 0)
10855                 exit(0);
10856 #else
10857         if (getpgrp() > 0)
10858                 exit(0);
10859 #endif
10860         exit(1);
10861 }
10862 EOP
10863         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10864                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10865                 val="$define"
10866         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10867                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10868                 val="$undef"
10869         else
10870                 echo "I can't seem to compile and run the test program."
10871                 if ./usg; then
10872                         xxx="a USG one, i.e. you use getpgrp()."
10873                 else
10874                         # SVR4 systems can appear rather BSD-ish.
10875                         case "$i_unistd" in
10876                         $undef)
10877                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10878                                 val="$define"
10879                                 ;;
10880                         $define)
10881                                 xxx="probably a USG one, i.e. you use getpgrp()."
10882                                 val="$undef"
10883                                 ;;
10884                         esac
10885                 fi
10886                 echo "Assuming your getpgrp is $xxx" >&4
10887         fi
10888         ;;
10889 *) val="$undef";;
10890 esac
10891 set d_bsdgetpgrp
10892 eval $setvar
10893 $rm_try
10894
10895 : see if setpgrp exists
10896 set setpgrp d_setpgrp
10897 eval $inlibc
10898
10899 case "$d_setpgrp" in
10900 "$define")
10901         echo " "
10902         echo "Checking to see which flavor of setpgrp is in use..."
10903         $cat >try.c <<EOP
10904 #$i_unistd I_UNISTD
10905 #include <sys/types.h>
10906 #ifdef I_UNISTD
10907 #  include <unistd.h>
10908 #endif
10909 #$i_stdlib I_STDLIB
10910 #ifdef I_STDLIB
10911 #include <stdlib.h>
10912 #endif
10913 int main()
10914 {
10915         if (getuid() == 0) {
10916                 printf("(I see you are running Configure as super-user...)\n");
10917                 setuid(1);
10918         }
10919 #ifdef TRY_BSD_PGRP
10920         if (-1 == setpgrp(1, 1))
10921                 exit(0);
10922 #else
10923         if (setpgrp() != -1)
10924                 exit(0);
10925 #endif
10926         exit(1);
10927 }
10928 EOP
10929         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10930                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10931                 val="$define"
10932         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10933                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10934                 val="$undef"
10935         else
10936                 echo "(I can't seem to compile and run the test program.)"
10937                 if ./usg; then
10938                         xxx="a USG one, i.e. you use setpgrp()."
10939                 else
10940                         # SVR4 systems can appear rather BSD-ish.
10941                         case "$i_unistd" in
10942                         $undef)
10943                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10944                                 val="$define"
10945                                 ;;
10946                         $define)
10947                                 xxx="probably a USG one, i.e. you use setpgrp()."
10948                                 val="$undef"
10949                                 ;;
10950                         esac
10951                 fi
10952                 echo "Assuming your setpgrp is $xxx" >&4
10953         fi
10954         ;;
10955 *) val="$undef";;
10956 esac
10957 set d_bsdsetpgrp
10958 eval $setvar
10959 $rm_try
10960
10961 : Look for GCC-style __builtin_choose_expr
10962 case "$d_builtin_choose_expr" in
10963 '')
10964     echo " "
10965     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10966     $cat >try.c <<'EOCP'
10967 #include <assert.h>
10968 #include <stdlib.h>
10969 #include <stdio.h>
10970
10971 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10972
10973 int main(void) {
10974     assert( SYRINX(1) == 2112 );
10975     assert( SYRINX(1) != 5150 );
10976     assert( SYRINX(0) == 5150 );
10977     assert( SYRINX(0) != 2112 );
10978     puts( "All good!" );
10979     exit(0);
10980 }
10981
10982 EOCP
10983     set try
10984     if eval $compile && $run ./try; then
10985         echo "Your C compiler supports __builtin_choose_expr."
10986         val="$define"
10987     else
10988         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10989         val="$undef"
10990     fi
10991 ;;
10992 *) val="$d_builtin_choose_expr" ;;
10993 esac
10994
10995 set d_builtin_choose_expr
10996 eval $setvar
10997 $rm_try
10998
10999 : Look for GCC-style __builtin_expect
11000 case "$d_builtin_expect" in
11001 '')
11002     echo " "
11003     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11004     $cat >try.c <<'EOCP'
11005 int main(void) {
11006     int n = 50;
11007     if ( __builtin_expect(n, 0) ) n = 1;
11008     /* Remember shell exit code truth is 0, C truth is non-zero */
11009     return !(n == 1);
11010 }
11011 EOCP
11012     set try
11013     if eval $compile && $run ./try; then
11014         echo "Your C compiler supports __builtin_expect."
11015         val="$define"
11016     else
11017         echo "Your C compiler doesn't seem to understand __builtin_expect."
11018         val="$undef"
11019     fi
11020     ;;
11021 *) val="$d_builtin_expect" ;;
11022 esac
11023
11024 set d_builtin_expect
11025 eval $setvar
11026 $rm_try
11027
11028 : see if bzero exists
11029 set bzero d_bzero
11030 eval $inlibc
11031
11032 : see if stdarg is available
11033 echo " "
11034 if $test `./findhdr stdarg.h`; then
11035         echo "<stdarg.h> found." >&4
11036         valstd="$define"
11037 else
11038         echo "<stdarg.h> NOT found." >&4
11039         valstd="$undef"
11040 fi
11041
11042 : see if varargs is available
11043 echo " "
11044 if $test `./findhdr varargs.h`; then
11045         echo "<varargs.h> found." >&4
11046 else
11047         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11048 fi
11049
11050 : set up the varargs testing programs
11051 $cat > varargs.c <<EOP
11052 #ifdef I_STDARG
11053 #include <stdarg.h>
11054 #endif
11055 #ifdef I_VARARGS
11056 #include <varargs.h>
11057 #endif
11058
11059 #ifdef I_STDARG
11060 int f(char *p, ...)
11061 #else
11062 int f(va_alist)
11063 va_dcl
11064 #endif
11065 {
11066         va_list ap;
11067 #ifndef I_STDARG
11068         char *p;
11069 #endif
11070 #ifdef I_STDARG
11071         va_start(ap,p);
11072 #else
11073         va_start(ap);
11074         p = va_arg(ap, char *);
11075 #endif
11076         va_end(ap);
11077         return 0;
11078 }
11079 EOP
11080 $cat > varargs <<EOP
11081 $startsh
11082 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11083         echo "true"
11084 else
11085         echo "false"
11086 fi
11087 $rm -f varargs$_o
11088 EOP
11089 chmod +x varargs
11090
11091 : now check which varargs header should be included
11092 echo " "
11093 i_varhdr=''
11094 val=''
11095 case "$valstd" in
11096 "$define")
11097         if `./varargs I_STDARG`; then
11098                 val='stdarg.h'
11099         elif `./varargs I_VARARGS`; then
11100                 val='varargs.h'
11101         fi
11102         ;;
11103 *)
11104         if `./varargs I_VARARGS`; then
11105                 val='varargs.h'
11106         fi
11107         ;;
11108 esac
11109 case "$val" in
11110 '')
11111         echo " "
11112         echo "*** WHOA THERE!!! ***" >&4
11113         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11114         case "$knowitall" in
11115         '')
11116         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11117                 exit 1
11118                 ;;
11119         esac
11120 echo "I could not find the definition for va_dcl... You have problems..." >&4
11121         val="$undef"; set i_stdarg; eval $setvar
11122         val="$undef"; set i_varargs; eval $setvar
11123         ;;
11124 *)
11125         set i_varhdr
11126         eval $setvar
11127         case "$i_varhdr" in
11128         stdarg.h)
11129                 val="$define"; set i_stdarg; eval $setvar
11130                 val="$undef"; set i_varargs; eval $setvar
11131                 ;;
11132         varargs.h)
11133                 val="$undef"; set i_stdarg; eval $setvar
11134                 val="$define"; set i_varargs; eval $setvar
11135                 ;;
11136         esac
11137         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11138 esac
11139 $rm -f varargs*
11140
11141 : see if the Compiler supports C99 variadic macros
11142 case "$i_stdarg$i_stdlib" in
11143     "$define$define")
11144     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11145     $cat >try.c <<EOCP
11146 #include <stdio.h>
11147 #include <stdarg.h>
11148
11149 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11150
11151 int main() {
11152   char buf[20];
11153   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11154   puts(buf);
11155   return 0;
11156 }
11157 EOCP
11158     set try
11159     if eval $compile && $run ./try 2>&1 >/dev/null; then
11160         case "`$run ./try`" in
11161             "123 456 789")
11162             echo "You have C99 variadic macros." >&4
11163             d_c99_variadic_macros="$define"
11164             ;;
11165             *)
11166             echo "You don't have functional C99 variadic macros." >&4
11167             d_c99_variadic_macros="$undef"
11168             ;;
11169         esac
11170     else
11171         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11172         d_c99_variadic_macros="$undef"
11173     fi
11174     $rm_try
11175     ;;
11176     *)
11177     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11178     d_c99_variadic_macros="$undef"
11179     ;;
11180 esac
11181
11182 : see if signal is declared as pointer to function returning int or void
11183 echo " "
11184 xxx=`./findhdr signal.h`
11185 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11186 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11187         echo "You have int (*signal())() instead of void." >&4
11188         val="$undef"
11189 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11190         echo "You have void (*signal())()." >&4
11191         val="$define"
11192 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11193         echo "You have int (*signal())() instead of void." >&4
11194         val="$undef"
11195 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11196         echo "You have void (*signal())()." >&4
11197         val="$define"
11198 else
11199         case "$d_voidsig" in
11200         '')
11201         echo "I can't determine whether signal handler returns void or int..." >&4
11202                 dflt=void
11203                 rp="What type does your signal handler return?"
11204                 . ./myread
11205                 case "$ans" in
11206                 v*) val="$define";;
11207                 *) val="$undef";;
11208                 esac;;
11209         "$define")
11210                 echo "As you already told me, signal handler returns void." >&4
11211                 val="$define"
11212                 ;;
11213         *)      echo "As you already told me, signal handler returns int." >&4
11214                 val="$undef"
11215                 ;;
11216         esac
11217 fi
11218 set d_voidsig
11219 eval $setvar
11220 case "$d_voidsig" in
11221 "$define") signal_t="void";;
11222 *) signal_t="int";;
11223 esac
11224 $rm -f $$.tmp
11225
11226 : check for ability to cast large floats to 32-bit ints.
11227 echo " "
11228 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11229 if $test "$intsize" -ge 4; then
11230         xxx=int
11231 else
11232         xxx=long
11233 fi
11234 $cat >try.c <<EOCP
11235 #include <stdio.h>
11236 #$i_stdlib I_STDLIB
11237 #ifdef I_STDLIB
11238 #include <stdlib.h>
11239 #endif
11240 #include <sys/types.h>
11241 #include <signal.h>
11242 $signal_t blech(int s) { exit(3); }
11243 int main()
11244 {
11245         $xxx i32;
11246         double f, g;
11247         int result = 0;
11248         char str[16];
11249         signal(SIGFPE, blech);
11250
11251         /* Don't let compiler optimize the test away.  Store the number
11252            in a writable string for gcc to pass to sscanf under HP-UX.
11253         */
11254         sprintf(str, "2147483647");
11255         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11256         g = 10 * f;
11257         i32  = ($xxx) g;
11258
11259         /* x86 processors will probably give 0x8000 0000, which is a
11260            sign change.  We don't want that.  We want to mimic SPARC
11261            behavior here, which is to preserve the sign and give
11262            back 0x7fff ffff.
11263         */
11264         if (i32 != ($xxx) f)
11265                 result |= 1;
11266         exit(result);
11267 }
11268 EOCP
11269 set try
11270 if eval $compile_ok; then
11271         $run ./try
11272         yyy=$?
11273 else
11274         echo "(I can't seem to compile the test program--assuming it can't)"
11275         yyy=1
11276 fi
11277 case "$yyy" in
11278 0)      val="$define"
11279         echo "Yup, it can."
11280         ;;
11281 *)      val="$undef"
11282         echo "Nope, it can't."
11283         ;;
11284 esac
11285 set d_casti32
11286 eval $setvar
11287 $rm_try
11288
11289 : check for ability to cast negative floats to unsigned
11290 echo " "
11291 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11292 $cat >try.c <<EOCP
11293 #include <stdio.h>
11294 #$i_stdlib I_STDLIB
11295 #ifdef I_STDLIB
11296 #include <stdlib.h>
11297 #endif
11298 #include <sys/types.h>
11299 #include <signal.h>
11300 $signal_t blech(int s) { exit(7); }
11301 $signal_t blech_in_list(int s) { exit(4); }
11302 unsigned long dummy_long(unsigned long p) { return p; }
11303 unsigned int dummy_int(unsigned int p) { return p; }
11304 unsigned short dummy_short(unsigned short p) { return p; }
11305 int main()
11306 {
11307         double f;
11308         unsigned long along;
11309         unsigned int aint;
11310         unsigned short ashort;
11311         int result = 0;
11312         char str[16];
11313
11314         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11315            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11316            optimized the whole file away
11317         */
11318         /* Store the number in a writable string for gcc to pass to
11319            sscanf under HP-UX.
11320         */
11321         sprintf(str, "-123");
11322         sscanf(str, "%lf", &f);  /* f = -123.; */
11323
11324         signal(SIGFPE, blech);
11325         along = (unsigned long)f;
11326         aint = (unsigned int)f;
11327         ashort = (unsigned short)f;
11328         if (along != (unsigned long)-123)
11329                 result |= 1;
11330         if (aint != (unsigned int)-123)
11331                 result |= 1;
11332         if (ashort != (unsigned short)-123)
11333                 result |= 1;
11334         sprintf(str, "1073741824.");
11335         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11336         f = f + f;
11337         along = 0;
11338         along = (unsigned long)f;
11339         if (along != 0x80000000)
11340                 result |= 2;
11341         f -= 1.;
11342         along = 0;
11343         along = (unsigned long)f;
11344         if (along != 0x7fffffff)
11345                 result |= 1;
11346         f += 2.;
11347         along = 0;
11348         along = (unsigned long)f;
11349         if (along != 0x80000001)
11350                 result |= 2;
11351         if (result)
11352                 exit(result);
11353         signal(SIGFPE, blech_in_list);
11354         sprintf(str, "123.");
11355         sscanf(str, "%lf", &f);  /* f = 123.; */
11356         along = dummy_long((unsigned long)f);
11357         aint = dummy_int((unsigned int)f);
11358         ashort = dummy_short((unsigned short)f);
11359         if (along != (unsigned long)123)
11360                 result |= 4;
11361         if (aint != (unsigned int)123)
11362                 result |= 4;
11363         if (ashort != (unsigned short)123)
11364                 result |= 4;
11365         exit(result);
11366
11367 }
11368 EOCP
11369 set try
11370 if eval $compile_ok; then
11371         $run ./try
11372         castflags=$?
11373 else
11374         echo "(I can't seem to compile the test program--assuming it can't)"
11375         castflags=7
11376 fi
11377 case "$castflags" in
11378 0)      val="$define"
11379         echo "Yup, it can."
11380         ;;
11381 *)      val="$undef"
11382         echo "Nope, it can't."
11383         ;;
11384 esac
11385 set d_castneg
11386 eval $setvar
11387 $rm_try
11388
11389 : see if vprintf exists
11390 echo " "
11391 if set vprintf val -f d_vprintf; eval $csym; $val; then
11392         echo 'vprintf() found.' >&4
11393         val="$define"
11394         $cat >try.c <<EOF
11395 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11396 #$i_varargs I_VARARGS
11397
11398 #$i_stdlib I_STDLIB
11399 #$i_unistd I_UNISTD
11400
11401 #ifdef I_STDARG
11402 #  include <stdarg.h>
11403 #else /* I_VARARGS */
11404 #  include <varargs.h>
11405 #endif
11406
11407 #ifdef I_UNISTD
11408 #  include <unistd.h>
11409 #endif
11410
11411 #ifdef I_STDLIB
11412 #  include <stdlib.h>
11413 #endif
11414
11415 #include <stdio.h> /* vsprintf prototype */
11416
11417 #ifdef I_STDARG
11418 void xxx(int n, ...)
11419 {
11420     va_list args;
11421     char buf[10];
11422     va_start(args, n);
11423     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11424 }
11425 int main() { xxx(1, "foo"); }
11426
11427 #else /* I_VARARGS */
11428
11429 xxx(va_alist)
11430 va_dcl
11431 {
11432     va_list args;
11433     char buf[10];
11434     va_start(args);
11435     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11436 }
11437 int main() { xxx("foo"); }
11438
11439 #endif
11440
11441 EOF
11442         set try
11443         if eval $compile_ok; then
11444                 if $run ./try; then
11445                         echo "Your vsprintf() returns (int)." >&4
11446                         val2="$undef"
11447                 else
11448                         echo "Your vsprintf() returns (char*)." >&4
11449                         val2="$define"
11450                 fi
11451         else
11452                 echo 'I am unable to compile the vsprintf() test program.' >&4
11453                 # We shouldn't get here.  If we do, assume the standard signature,
11454                 # not the old BSD one.
11455                 echo 'Guessing that vsprintf() returns (int).' >&4
11456                 val2="$undef"
11457         fi
11458 else
11459         echo 'vprintf() NOT found.' >&4
11460         val="$undef"
11461         val2="$undef"
11462 fi
11463 $rm_try
11464 set d_vprintf
11465 eval $setvar
11466 val=$val2
11467 set d_charvspr
11468 eval $setvar
11469
11470 : see if chown exists
11471 set chown d_chown
11472 eval $inlibc
11473
11474 : see if chroot exists
11475 set chroot d_chroot
11476 eval $inlibc
11477
11478 : see if chsize exists
11479 set chsize d_chsize
11480 eval $inlibc
11481
11482 : see if class exists
11483 set class d_class
11484 eval $inlibc
11485
11486 : see if clearenv exists
11487 set clearenv d_clearenv
11488 eval $inlibc
11489
11490 : Define hasstruct macro for Configure internal use
11491 hasstruct='varname=$1; struct=$2; shift; shift;
11492 while $test $# -ge 2; do
11493         case "$1" in
11494         $define) echo "#include <$2>";;
11495         esac ;
11496     shift 2;
11497 done > try.c;
11498 echo "int main () { struct $struct foo; }" >> try.c;
11499 set try;
11500 if eval $compile; then
11501         val="$define";
11502 else
11503         val="$undef";
11504 fi;
11505 set $varname;
11506 eval $setvar;
11507 $rm_try'
11508
11509 : see whether socket exists
11510 socketlib=''
11511 sockethdr=''
11512 echo " "
11513 $echo $n "Hmm... $c" >&4
11514 if set socket val -f d_socket; eval $csym; $val; then
11515     echo "Looks like you have Berkeley networking support." >&4
11516     d_socket="$define"
11517     if set setsockopt val -f; eval $csym; $val; then
11518         d_oldsock="$undef"
11519     else
11520         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11521         d_oldsock="$define"
11522     fi
11523 else
11524     if $contains socklib libc.list >/dev/null 2>&1; then
11525         echo "Looks like you have Berkeley networking support." >&4
11526         d_socket="$define"
11527         : we will have to assume that it supports the 4.2 BSD interface
11528         d_oldsock="$undef"
11529     else
11530         echo "You don't have Berkeley networking in libc$_a..." >&4
11531         if test "X$d_socket" = "X$define"; then
11532             echo "...but you seem to believe that you have sockets." >&4
11533         else
11534             for net in net socket
11535             do
11536                 if test -f $sysroot/usr/lib/lib$net$_a; then
11537                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11538                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11539                     if $contains socket libc.list >/dev/null 2>&1; then
11540                         d_socket="$define"
11541                         socketlib="-l$net"
11542                         case "$net" in
11543                         net)
11544                             echo "...but the Wollongong group seems to have hacked it in." >&4
11545                             sockethdr="-I$sysroot/usr/netinclude"
11546                             ;;
11547                         esac
11548                         echo "Found Berkeley sockets interface in lib$net." >&4
11549                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11550                             d_oldsock="$undef"
11551                         else
11552                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11553                             d_oldsock="$define"
11554                         fi
11555                         break
11556                     fi
11557                 fi
11558             done
11559             if test "X$d_socket" != "X$define"; then
11560                echo "or anywhere else I see." >&4
11561                d_socket="$undef"
11562                d_oldsock="$undef"
11563             fi
11564         fi
11565     fi
11566 fi
11567
11568 : see if socketpair exists
11569 set socketpair d_sockpair
11570 eval $inlibc
11571
11572
11573 echo " "
11574 echo "Checking the availability sa_len in the sock struct ..." >&4
11575 $cat >try.c <<EOF
11576 #include <sys/types.h>
11577 #include <sys/socket.h>
11578 int main() {
11579 struct sockaddr sa;
11580 return (sa.sa_len);
11581 }
11582 EOF
11583 val="$undef"
11584 set try; if eval $compile; then
11585     val="$define"
11586 fi
11587 set d_sockaddr_sa_len; eval $setvar
11588 $rm_try
11589
11590 echo " "
11591 echo "Checking the availability struct sockaddr_in6 ..." >&4
11592 $cat >try.c <<EOF
11593 #include <sys/types.h>
11594 #include <sys/socket.h>
11595 #include <netinet/in.h>
11596 int main() {
11597 struct sockaddr_in6 sin6;
11598 return (sin6.sin6_family);
11599 }
11600 EOF
11601 val="$undef"
11602 set try; if eval $compile; then
11603     val="$define"
11604 fi
11605 set d_sockaddr_in6; eval $setvar
11606 $rm_try
11607
11608 echo " "
11609 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11610 $cat >try.c <<EOF
11611 #include <sys/types.h>
11612 #include <sys/socket.h>
11613 #include <netinet/in.h>
11614 int main() {
11615 struct sockaddr_in6 sin6;
11616 return (sin6.sin6_scope_id);
11617 }
11618 EOF
11619 val="$undef"
11620 set try; if eval $compile; then
11621     val="$define"
11622 fi
11623 set d_sin6_scope_id; eval $setvar
11624 $rm_try
11625
11626 echo " "
11627 echo "Checking the availability struct ip_mreq ..." >&4
11628 $cat >try.c <<EOF
11629 #include <sys/types.h>
11630 #include <sys/socket.h>
11631 #include <netinet/in.h>
11632 int main() {
11633 struct ip_mreq mreq;
11634 return (mreq.imr_multiaddr.s_addr);
11635 }
11636 EOF
11637 val="$undef"
11638 set try; if eval $compile; then
11639        val="$define"
11640 fi
11641 set d_ip_mreq; eval $setvar
11642 $rm_try
11643
11644 echo " "
11645 echo "Checking the availability struct ip_mreq_source ..." >&4
11646 $cat >try.c <<EOF
11647 #include <sys/types.h>
11648 #include <sys/socket.h>
11649 #include <netinet/in.h>
11650 int main() {
11651 struct ip_mreq_source mreq;
11652 return (mreq.imr_multiaddr.s_addr);
11653 }
11654 EOF
11655 val="$undef"
11656 set try; if eval $compile; then
11657        val="$define"
11658 fi
11659 set d_ip_mreq_source; eval $setvar
11660 $rm_try
11661
11662 echo " "
11663 echo "Checking the availability struct ipv6_mreq ..." >&4
11664 $cat >try.c <<EOF
11665 #include <sys/types.h>
11666 #include <sys/socket.h>
11667 #include <netinet/in.h>
11668 int main() {
11669 struct ipv6_mreq mreq;
11670 return (mreq.ipv6mr_interface);
11671 }
11672 EOF
11673 val="$undef"
11674 set try; if eval $compile; then
11675     val="$define"
11676 fi
11677 set d_ipv6_mreq; eval $setvar
11678 $rm_try
11679
11680 echo " "
11681 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11682 $cat >try.c <<EOF
11683 #include <sys/types.h>
11684 #include <sys/socket.h>
11685 #include <netinet/in.h>
11686 int main() {
11687 struct ipv6_mreq_source mreq;
11688 return (mreq.imr_multiaddr.s_addr);
11689 }
11690 EOF
11691 val="$undef"
11692 set try; if eval $compile; then
11693        val="$define"
11694 fi
11695 set d_ipv6_mreq_source; eval $setvar
11696 $rm_try
11697
11698 echo " "
11699 echo "Checking the availability of certain socket constants..." >&4
11700 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11701     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11702     $cat >try.c <<EOF
11703 #include <sys/types.h>
11704 #include <sys/socket.h>
11705 int main() {
11706     int i = $ENUM;
11707 }
11708 EOF
11709     val="$undef"
11710     set try; if eval $compile; then
11711         val="$define"
11712     fi
11713     set d_${enum}; eval $setvar
11714     $rm_try
11715 done
11716
11717 : see if this is a sys/uio.h system
11718 set sys/uio.h i_sysuio
11719 eval $inhdr
11720
11721 : Check for cmsghdr support
11722 echo " "
11723 echo "Checking to see if your system supports struct cmsghdr..." >&4
11724 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11725 eval $hasstruct
11726 case "$d_cmsghdr_s" in
11727 "$define")      echo "Yes, it does."   ;;
11728 *)              echo "No, it doesn't." ;;
11729 esac
11730
11731
11732 : check for const keyword
11733 echo " "
11734 echo 'Checking to see if your C compiler knows about "const"...' >&4
11735 $cat >const.c <<'EOCP'
11736 typedef struct spug { int drokk; } spug;
11737 int main()
11738 {
11739         const char *foo;
11740         const spug y = { 0 };
11741 }
11742 EOCP
11743 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11744         val="$define"
11745         echo "Yup, it does."
11746 else
11747         val="$undef"
11748         echo "Nope, it doesn't."
11749 fi
11750 set d_const
11751 eval $setvar
11752
11753 : see if copysignl exists
11754 set copysignl d_copysignl
11755 eval $inlibc
11756
11757 : see if crypt exists
11758 echo " "
11759 set crypt d_crypt
11760 eval $inlibc
11761 case "$d_crypt" in
11762 $define) cryptlib='' ;;
11763 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11764                 echo 'crypt() found.' >&4
11765                 val="$define"
11766                 cryptlib=''
11767         else
11768                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11769                 if $test -z "$cryptlib"; then
11770                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11771                 else
11772                         cryptlib=-lcrypt
11773                 fi
11774                 if $test -z "$cryptlib"; then
11775                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11776                 else
11777                         cryptlib=-lcrypt
11778                 fi
11779                 if $test -z "$cryptlib"; then
11780                         cryptlib=`./loc libcrypt$_a "" $libpth`
11781                 else
11782                         cryptlib=-lcrypt
11783                 fi
11784                 if $test -z "$cryptlib"; then
11785                         echo 'crypt() NOT found.' >&4
11786                         val="$undef"
11787                 else
11788                         val="$define"
11789                 fi
11790         fi
11791         set d_crypt
11792         eval $setvar
11793         ;;
11794 esac
11795
11796 : see if this is a crypt.h system
11797 set crypt.h i_crypt
11798 eval $inhdr
11799
11800 : see if crypt_r exists
11801 set crypt_r d_crypt_r
11802 eval $inlibc
11803 case "$d_crypt_r" in
11804 "$define")
11805         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11806         case "$d_crypt_r_proto:$usethreads" in
11807         ":define")      d_crypt_r_proto=define
11808                 set d_crypt_r_proto crypt_r $hdrs
11809                 eval $hasproto ;;
11810         *)      ;;
11811         esac
11812         case "$d_crypt_r_proto" in
11813         define)
11814         case "$crypt_r_proto" in
11815         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11816         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11817         esac
11818         case "$crypt_r_proto" in
11819         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11820         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11821         esac
11822         case "$crypt_r_proto" in
11823         ''|0)   d_crypt_r=undef
11824                 crypt_r_proto=0
11825                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11826         * )     case "$crypt_r_proto" in
11827                 REENTRANT_PROTO*) ;;
11828                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11829                 esac
11830                 echo "Prototype: $try" ;;
11831         esac
11832         ;;
11833         *)      case "$usethreads" in
11834                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11835                 esac
11836                 d_crypt_r=undef
11837                 crypt_r_proto=0
11838                 ;;
11839         esac
11840         ;;
11841 *)      crypt_r_proto=0
11842         ;;
11843 esac
11844
11845 : get csh whereabouts
11846 case "$csh" in
11847 'csh') val="$undef" ;;
11848 *) val="$define" ;;
11849 esac
11850 set d_csh
11851 eval $setvar
11852 : Respect a hint or command line value for full_csh.
11853 case "$full_csh" in
11854 '') full_csh=$csh ;;
11855 esac
11856
11857 : see if ctermid exists
11858 set ctermid d_ctermid
11859 eval $inlibc
11860
11861 : see if ctermid_r exists
11862 set ctermid_r d_ctermid_r
11863 eval $inlibc
11864 case "$d_ctermid_r" in
11865 "$define")
11866         hdrs="$i_systypes sys/types.h define stdio.h "
11867         case "$d_ctermid_r_proto:$usethreads" in
11868         ":define")      d_ctermid_r_proto=define
11869                 set d_ctermid_r_proto ctermid_r $hdrs
11870                 eval $hasproto ;;
11871         *)      ;;
11872         esac
11873         case "$d_ctermid_r_proto" in
11874         define)
11875         case "$ctermid_r_proto" in
11876         ''|0) try='char* ctermid_r(char*);'
11877         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11878         esac
11879         case "$ctermid_r_proto" in
11880         ''|0)   d_ctermid_r=undef
11881                 ctermid_r_proto=0
11882                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11883         * )     case "$ctermid_r_proto" in
11884                 REENTRANT_PROTO*) ;;
11885                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11886                 esac
11887                 echo "Prototype: $try" ;;
11888         esac
11889         ;;
11890         *)      case "$usethreads" in
11891                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11892                 esac
11893                 d_ctermid_r=undef
11894                 ctermid_r_proto=0
11895                 ;;
11896         esac
11897         ;;
11898 *)      ctermid_r_proto=0
11899         ;;
11900 esac
11901
11902 : see if ctime_r exists
11903 set ctime_r d_ctime_r
11904 eval $inlibc
11905 case "$d_ctime_r" in
11906 "$define")
11907         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11908         case "$d_ctime_r_proto:$usethreads" in
11909         ":define")      d_ctime_r_proto=define
11910                 set d_ctime_r_proto ctime_r $hdrs
11911                 eval $hasproto ;;
11912         *)      ;;
11913         esac
11914         case "$d_ctime_r_proto" in
11915         define)
11916         case "$ctime_r_proto" in
11917         ''|0) try='char* ctime_r(const time_t*, char*);'
11918         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11919         esac
11920         case "$ctime_r_proto" in
11921         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11922         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11923         esac
11924         case "$ctime_r_proto" in
11925         ''|0) try='int ctime_r(const time_t*, char*);'
11926         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11927         esac
11928         case "$ctime_r_proto" in
11929         ''|0) try='int ctime_r(const time_t*, char*, int);'
11930         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11931         esac
11932         case "$ctime_r_proto" in
11933         ''|0)   d_ctime_r=undef
11934                 ctime_r_proto=0
11935                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11936         * )     case "$ctime_r_proto" in
11937                 REENTRANT_PROTO*) ;;
11938                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11939                 esac
11940                 echo "Prototype: $try" ;;
11941         esac
11942         ;;
11943         *)      case "$usethreads" in
11944                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11945                 esac
11946                 d_ctime_r=undef
11947                 ctime_r_proto=0
11948                 ;;
11949         esac
11950         ;;
11951 *)      ctime_r_proto=0
11952         ;;
11953 esac
11954
11955 : see if cuserid exists
11956 set cuserid d_cuserid
11957 eval $inlibc
11958
11959 : see if this is a limits.h system
11960 set limits.h i_limits
11961 eval $inhdr
11962
11963 : see if this is a float.h system
11964 set float.h i_float
11965 eval $inhdr
11966
11967 : See if number of significant digits in a double precision number is known
11968 echo " "
11969 $cat >dbl_dig.c <<EOM
11970 #$i_limits I_LIMITS
11971 #$i_float I_FLOAT
11972 #ifdef I_LIMITS
11973 #include <limits.h>
11974 #endif
11975 #ifdef I_FLOAT
11976 #include <float.h>
11977 #endif
11978 #ifdef DBL_DIG
11979 printf("Contains DBL_DIG");
11980 #endif
11981 EOM
11982 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11983 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11984         echo "DBL_DIG found." >&4
11985         val="$define"
11986 else
11987         echo "DBL_DIG NOT found." >&4
11988         val="$undef"
11989 fi
11990 $rm -f dbl_dig.?
11991 set d_dbl_dig
11992 eval $setvar
11993
11994 : see if dbm.h is available
11995 : see if dbmclose exists
11996 set dbmclose d_dbmclose
11997 eval $inlibc
11998
11999 case "$d_dbmclose" in
12000 $define)
12001         set dbm.h i_dbm
12002         eval $inhdr
12003         case "$i_dbm" in
12004         $define)
12005                 val="$undef"
12006                 set i_rpcsvcdbm
12007                 eval $setvar
12008                 ;;
12009         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12010                 eval $inhdr
12011                 ;;
12012         esac
12013         ;;
12014 *)      echo "We won't be including <dbm.h>"
12015         val="$undef"
12016         set i_dbm
12017         eval $setvar
12018         val="$undef"
12019         set i_rpcsvcdbm
12020         eval $setvar
12021         ;;
12022 esac
12023
12024 : see if prototype for dbminit is available
12025 echo " "
12026 set d_dbminitproto dbminit $i_dbm dbm.h
12027 eval $hasproto
12028
12029 : see if difftime exists
12030 set difftime d_difftime
12031 eval $inlibc
12032
12033 : see if this is a dirent system
12034 echo " "
12035 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12036         val="$define"
12037         echo "<dirent.h> found." >&4
12038 else
12039         val="$undef"
12040         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12041                 echo "<sys/dir.h> found." >&4
12042                 echo " "
12043         else
12044                 xinc=`./findhdr sys/ndir.h`
12045         fi
12046         echo "<dirent.h> NOT found." >&4
12047 fi
12048 set i_dirent
12049 eval $setvar
12050
12051 : Look for type of directory structure.
12052 echo " "
12053 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12054
12055 case "$direntrytype" in
12056 ''|' ')
12057         case "$i_dirent" in
12058         $define) guess1='struct dirent' ;;
12059         *) guess1='struct direct'  ;;
12060         esac
12061         ;;
12062 *)      guess1="$direntrytype"
12063         ;;
12064 esac
12065
12066 case "$guess1" in
12067 'struct dirent') guess2='struct direct' ;;
12068 *) guess2='struct dirent' ;;
12069 esac
12070
12071 if $contains "$guess1" try.c >/dev/null 2>&1; then
12072         direntrytype="$guess1"
12073         echo "Your directory entries are $direntrytype." >&4
12074 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12075         direntrytype="$guess2"
12076         echo "Your directory entries seem to be $direntrytype." >&4
12077 else
12078         echo "I don't recognize your system's directory entries." >&4
12079         rp="What type is used for directory entries on this system?"
12080         dflt="$guess1"
12081         . ./myread
12082         direntrytype="$ans"
12083 fi
12084 $rm_try
12085
12086 : see if the directory entry stores field length
12087 echo " "
12088 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12089 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12090         echo "Good, your directory entry keeps length information in d_namlen." >&4
12091         val="$define"
12092 else
12093         echo "Your directory entry does not know about the d_namlen field." >&4
12094         val="$undef"
12095 fi
12096 set d_dirnamlen
12097 eval $setvar
12098 $rm_try
12099
12100 : Look for DIR.dd_fd
12101 case "$i_dirent" in
12102 "$define")
12103     echo "Checking to see if DIR has a dd_fd member variable" >&4
12104     $cat >try.c <<EOCP
12105 #$i_stdlib I_STDLIB
12106 #ifdef I_STDLIB
12107 #include <stdlib.h>
12108 #endif
12109 #include <dirent.h>
12110
12111 int main() {
12112     DIR dir;
12113     dir.dd_fd = 1;
12114     return 0;
12115 }
12116 EOCP
12117     val=$undef
12118     set try
12119     if eval $compile; then
12120         echo "Yes, it does."
12121         val="$define"
12122     else
12123         echo "No, it does not."
12124         val="$undef"
12125     fi
12126     ;;
12127 *)
12128     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12129     val="$undef"
12130     ;;
12131 esac
12132 set d_dir_dd_fd
12133 eval $setvar
12134 $rm_try
12135
12136 : see if this is an sysdir system
12137 set sys/dir.h i_sysdir
12138 eval $inhdr
12139
12140 : see if this is an sysndir system
12141 set sys/ndir.h i_sysndir
12142 eval $inhdr
12143
12144 : Look for dirfd
12145 echo " "
12146 $cat >dirfd.c <<EOM
12147 #include <stdio.h>
12148 #$i_stdlib I_STDLIB
12149 #ifdef I_STDLIB
12150 #include <stdlib.h>
12151 #endif
12152 #$i_dirent I_DIRENT             /**/
12153 #$i_sysdir I_SYS_DIR            /**/
12154 #$i_sysndir I_SYS_NDIR          /**/
12155 #$i_systypes I_SYS_TYPES        /**/
12156 #if defined(I_SYS_TYPES)
12157 #include <sys/types.h>
12158 #endif
12159 #if defined(I_DIRENT)
12160 #include <dirent.h>
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 dladdr exists
12196 set dladdr d_dladdr
12197 eval $inlibc
12198
12199 : see if dlerror exists
12200 xxx_runnm="$runnm"
12201 runnm=false
12202 set dlerror d_dlerror
12203 eval $inlibc
12204 runnm="$xxx_runnm"
12205
12206 : see if dlfcn is available
12207 set dlfcn.h i_dlfcn
12208 eval $inhdr
12209
12210 : Check what extension to use for shared libs
12211 case "$usedl" in
12212 $define|y|true)
12213         $cat << EOM
12214
12215 On a few systems, the dynamically loaded modules that perl generates and uses
12216 will need a different extension than shared libs. The default will probably
12217 be appropriate.
12218
12219 EOM
12220         case "$dlext" in
12221         '')     dflt="$so" ;;
12222         *)      dflt="$dlext" ;;
12223         esac
12224         rp='What is the extension of dynamically loaded modules'
12225         . ./myread
12226         dlext="$ans"
12227         ;;
12228 *)
12229         dlext="none"
12230         ;;
12231 esac
12232
12233 : Check if dlsym need a leading underscore
12234 echo " "
12235 val="$undef"
12236
12237 case "$dlsrc" in
12238 dl_dlopen.xs)
12239         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12240         $cat >dyna.c <<'EOM'
12241 fred () { }
12242 EOM
12243
12244 $cat >fred.c<<EOM
12245
12246 #include <stdio.h>
12247 #$i_stdlib I_STDLIB
12248 #ifdef I_STDLIB
12249 #include <stdlib.h>
12250 #endif
12251 #$i_dlfcn I_DLFCN
12252 #ifdef I_DLFCN
12253 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12254 #else
12255 #include <sys/types.h>
12256 #include <nlist.h>
12257 #include <link.h>
12258 #endif
12259
12260 extern int fred() ;
12261
12262 int main()
12263 {
12264     void * handle ;
12265     void * symbol ;
12266 #ifndef RTLD_LAZY
12267     int mode = 1 ;
12268 #else
12269     int mode = RTLD_LAZY ;
12270 #endif
12271     handle = dlopen("./dyna.$dlext", mode) ;
12272     if (handle == NULL) {
12273         printf ("1\n") ;
12274         fflush (stdout) ;
12275         exit(0);
12276     }
12277     symbol = dlsym(handle, "fred") ;
12278     if (symbol == NULL) {
12279         /* try putting a leading underscore */
12280         symbol = dlsym(handle, "_fred") ;
12281         if (symbol == NULL) {
12282             printf ("2\n") ;
12283             fflush (stdout) ;
12284             exit(0);
12285         }
12286         printf ("3\n") ;
12287     }
12288     else
12289         printf ("4\n") ;
12290     fflush (stdout) ;
12291     exit(0);
12292 }
12293 EOM
12294         : Call the object file tmp-dyna.o in case dlext=o.
12295         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12296                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12297                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12298                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12299                 xxx=`$run ./fred`
12300                 case $xxx in
12301                 1)      echo "Test program failed using dlopen." >&4
12302                         echo "Perhaps you should not use dynamic loading." >&4;;
12303                 2)      echo "Test program failed using dlsym." >&4
12304                         echo "Perhaps you should not use dynamic loading." >&4;;
12305                 3)      echo "dlsym needs a leading underscore" >&4
12306                         val="$define" ;;
12307                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12308                 esac
12309         else
12310                 echo "I can't compile and run the test program." >&4
12311                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12312         fi
12313         ;;
12314 esac
12315
12316 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12317
12318 set d_dlsymun
12319 eval $setvar
12320
12321 : see if drand48_r exists
12322 set drand48_r d_drand48_r
12323 eval $inlibc
12324 case "$d_drand48_r" in
12325 "$define")
12326         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12327         case "$d_drand48_r_proto:$usethreads" in
12328         ":define")      d_drand48_r_proto=define
12329                 set d_drand48_r_proto drand48_r $hdrs
12330                 eval $hasproto ;;
12331         *)      ;;
12332         esac
12333         case "$d_drand48_r_proto" in
12334         define)
12335         case "$drand48_r_proto" in
12336         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12337         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12338         esac
12339         case "$drand48_r_proto" in
12340         ''|0)   d_drand48_r=undef
12341                 drand48_r_proto=0
12342                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12343         * )     case "$drand48_r_proto" in
12344                 REENTRANT_PROTO*) ;;
12345                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12346                 esac
12347                 echo "Prototype: $try" ;;
12348         esac
12349         ;;
12350         *)      case "$usethreads" in
12351                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12352                 esac
12353                 d_drand48_r=undef
12354                 drand48_r_proto=0
12355                 ;;
12356         esac
12357         ;;
12358 *)      drand48_r_proto=0
12359         ;;
12360 esac
12361
12362 : see if prototype for drand48 is available
12363 echo " "
12364 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12365 eval $hasproto
12366
12367 : see if dup2 exists
12368 set dup2 d_dup2
12369 eval $inlibc
12370
12371 : see if eaccess exists
12372 set eaccess d_eaccess
12373 eval $inlibc
12374
12375 : see if endgrent exists
12376 set endgrent d_endgrent
12377 eval $inlibc
12378
12379 : see if this is an grp system
12380 set grp.h i_grp
12381 eval $inhdr
12382
12383 case "$i_grp" in
12384 $define)
12385         xxx=`./findhdr grp.h`
12386         $cppstdin $cppflags $cppminus < $xxx >$$.h
12387
12388         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12389                 val="$define"
12390         else
12391                 val="$undef"
12392         fi
12393         set d_grpasswd
12394         eval $setvar
12395
12396         $rm -f $$.h
12397         ;;
12398 *)
12399         val="$undef";
12400         set d_grpasswd; eval $setvar
12401         ;;
12402 esac
12403
12404 : see if endgrent_r exists
12405 set endgrent_r d_endgrent_r
12406 eval $inlibc
12407 case "$d_endgrent_r" in
12408 "$define")
12409         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12410         case "$d_endgrent_r_proto:$usethreads" in
12411         ":define")      d_endgrent_r_proto=define
12412                 set d_endgrent_r_proto endgrent_r $hdrs
12413                 eval $hasproto ;;
12414         *)      ;;
12415         esac
12416         case "$d_endgrent_r_proto" in
12417         define)
12418         case "$endgrent_r_proto" in
12419         ''|0) try='int endgrent_r(FILE**);'
12420         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12421         esac
12422         case "$endgrent_r_proto" in
12423         ''|0) try='void endgrent_r(FILE**);'
12424         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12425         esac
12426         case "$endgrent_r_proto" in
12427         ''|0)   d_endgrent_r=undef
12428                 endgrent_r_proto=0
12429                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12430         * )     case "$endgrent_r_proto" in
12431                 REENTRANT_PROTO*) ;;
12432                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12433                 esac
12434                 echo "Prototype: $try" ;;
12435         esac
12436         ;;
12437         *)      case "$usethreads" in
12438                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12439                 esac
12440                 d_endgrent_r=undef
12441                 endgrent_r_proto=0
12442                 ;;
12443         esac
12444         ;;
12445 *)      endgrent_r_proto=0
12446         ;;
12447 esac
12448
12449 : see if endhostent exists
12450 set endhostent d_endhent
12451 eval $inlibc
12452
12453 : see if this is a netdb.h system
12454 set netdb.h i_netdb
12455 eval $inhdr
12456
12457 : see if endhostent_r exists
12458 set endhostent_r d_endhostent_r
12459 eval $inlibc
12460 case "$d_endhostent_r" in
12461 "$define")
12462         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12463         case "$d_endhostent_r_proto:$usethreads" in
12464         ":define")      d_endhostent_r_proto=define
12465                 set d_endhostent_r_proto endhostent_r $hdrs
12466                 eval $hasproto ;;
12467         *)      ;;
12468         esac
12469         case "$d_endhostent_r_proto" in
12470         define)
12471         case "$endhostent_r_proto" in
12472         ''|0) try='int endhostent_r(struct hostent_data*);'
12473         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12474         esac
12475         case "$endhostent_r_proto" in
12476         ''|0) try='void endhostent_r(struct hostent_data*);'
12477         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12478         esac
12479         case "$endhostent_r_proto" in
12480         ''|0)   d_endhostent_r=undef
12481                 endhostent_r_proto=0
12482                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12483         * )     case "$endhostent_r_proto" in
12484                 REENTRANT_PROTO*) ;;
12485                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12486                 esac
12487                 echo "Prototype: $try" ;;
12488         esac
12489         ;;
12490         *)      case "$usethreads" in
12491                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12492                 esac
12493                 d_endhostent_r=undef
12494                 endhostent_r_proto=0
12495                 ;;
12496         esac
12497         ;;
12498 *)      endhostent_r_proto=0
12499         ;;
12500 esac
12501
12502 : see if endnetent exists
12503 set endnetent d_endnent
12504 eval $inlibc
12505
12506 : see if endnetent_r exists
12507 set endnetent_r d_endnetent_r
12508 eval $inlibc
12509 case "$d_endnetent_r" in
12510 "$define")
12511         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12512         case "$d_endnetent_r_proto:$usethreads" in
12513         ":define")      d_endnetent_r_proto=define
12514                 set d_endnetent_r_proto endnetent_r $hdrs
12515                 eval $hasproto ;;
12516         *)      ;;
12517         esac
12518         case "$d_endnetent_r_proto" in
12519         define)
12520         case "$endnetent_r_proto" in
12521         ''|0) try='int endnetent_r(struct netent_data*);'
12522         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12523         esac
12524         case "$endnetent_r_proto" in
12525         ''|0) try='void endnetent_r(struct netent_data*);'
12526         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12527         esac
12528         case "$endnetent_r_proto" in
12529         ''|0)   d_endnetent_r=undef
12530                 endnetent_r_proto=0
12531                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12532         * )     case "$endnetent_r_proto" in
12533                 REENTRANT_PROTO*) ;;
12534                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12535                 esac
12536                 echo "Prototype: $try" ;;
12537         esac
12538         ;;
12539         *)      case "$usethreads" in
12540                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12541                 esac
12542                 d_endnetent_r=undef
12543                 endnetent_r_proto=0
12544                 ;;
12545         esac
12546         ;;
12547 *)      endnetent_r_proto=0
12548         ;;
12549 esac
12550
12551 : see if endprotoent exists
12552 set endprotoent d_endpent
12553 eval $inlibc
12554
12555 : see if endprotoent_r exists
12556 set endprotoent_r d_endprotoent_r
12557 eval $inlibc
12558 case "$d_endprotoent_r" in
12559 "$define")
12560         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12561         case "$d_endprotoent_r_proto:$usethreads" in
12562         ":define")      d_endprotoent_r_proto=define
12563                 set d_endprotoent_r_proto endprotoent_r $hdrs
12564                 eval $hasproto ;;
12565         *)      ;;
12566         esac
12567         case "$d_endprotoent_r_proto" in
12568         define)
12569         case "$endprotoent_r_proto" in
12570         ''|0) try='int endprotoent_r(struct protoent_data*);'
12571         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12572         esac
12573         case "$endprotoent_r_proto" in
12574         ''|0) try='void endprotoent_r(struct protoent_data*);'
12575         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12576         esac
12577         case "$endprotoent_r_proto" in
12578         ''|0)   d_endprotoent_r=undef
12579                 endprotoent_r_proto=0
12580                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12581         * )     case "$endprotoent_r_proto" in
12582                 REENTRANT_PROTO*) ;;
12583                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12584                 esac
12585                 echo "Prototype: $try" ;;
12586         esac
12587         ;;
12588         *)      case "$usethreads" in
12589                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12590                 esac
12591                 d_endprotoent_r=undef
12592                 endprotoent_r_proto=0
12593                 ;;
12594         esac
12595         ;;
12596 *)      endprotoent_r_proto=0
12597         ;;
12598 esac
12599
12600 : see if endpwent exists
12601 set endpwent d_endpwent
12602 eval $inlibc
12603
12604 : see if this is a pwd.h system
12605 set pwd.h i_pwd
12606 eval $inhdr
12607
12608 case "$i_pwd" in
12609 $define)
12610         xxx=`./findhdr pwd.h`
12611         $cppstdin $cppflags $cppminus < $xxx >$$.h
12612
12613         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12614                 val="$define"
12615         else
12616                 val="$undef"
12617         fi
12618         set d_pwquota
12619         eval $setvar
12620
12621         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12622                 val="$define"
12623         else
12624                 val="$undef"
12625         fi
12626         set d_pwage
12627         eval $setvar
12628
12629         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12630                 val="$define"
12631         else
12632                 val="$undef"
12633         fi
12634         set d_pwchange
12635         eval $setvar
12636
12637         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12638                 val="$define"
12639         else
12640                 val="$undef"
12641         fi
12642         set d_pwclass
12643         eval $setvar
12644
12645         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12646                 val="$define"
12647         else
12648                 val="$undef"
12649         fi
12650         set d_pwexpire
12651         eval $setvar
12652
12653         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12654                 val="$define"
12655         else
12656                 val="$undef"
12657         fi
12658         set d_pwcomment
12659         eval $setvar
12660
12661         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12662                 val="$define"
12663         else
12664                 val="$undef"
12665         fi
12666         set d_pwgecos
12667         eval $setvar
12668
12669         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12670                 val="$define"
12671         else
12672                 val="$undef"
12673         fi
12674         set d_pwpasswd
12675         eval $setvar
12676
12677         $rm -f $$.h
12678         ;;
12679 *)
12680         val="$undef";
12681         set d_pwquota; eval $setvar
12682         set d_pwage; eval $setvar
12683         set d_pwchange; eval $setvar
12684         set d_pwclass; eval $setvar
12685         set d_pwexpire; eval $setvar
12686         set d_pwcomment; eval $setvar
12687         set d_pwgecos; eval $setvar
12688         set d_pwpasswd; eval $setvar
12689         ;;
12690 esac
12691
12692 : see if endpwent_r exists
12693 set endpwent_r d_endpwent_r
12694 eval $inlibc
12695 case "$d_endpwent_r" in
12696 "$define")
12697         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12698         case "$d_endpwent_r_proto:$usethreads" in
12699         ":define")      d_endpwent_r_proto=define
12700                 set d_endpwent_r_proto endpwent_r $hdrs
12701                 eval $hasproto ;;
12702         *)      ;;
12703         esac
12704         case "$d_endpwent_r_proto" in
12705         define)
12706         case "$endpwent_r_proto" in
12707         ''|0) try='int endpwent_r(FILE**);'
12708         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12709         esac
12710         case "$endpwent_r_proto" in
12711         ''|0) try='void endpwent_r(FILE**);'
12712         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12713         esac
12714         case "$endpwent_r_proto" in
12715         ''|0)   d_endpwent_r=undef
12716                 endpwent_r_proto=0
12717                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12718         * )     case "$endpwent_r_proto" in
12719                 REENTRANT_PROTO*) ;;
12720                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12721                 esac
12722                 echo "Prototype: $try" ;;
12723         esac
12724         ;;
12725         *)      case "$usethreads" in
12726                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12727                 esac
12728                 d_endpwent_r=undef
12729                 endpwent_r_proto=0
12730                 ;;
12731         esac
12732         ;;
12733 *)      endpwent_r_proto=0
12734         ;;
12735 esac
12736
12737 : see if endservent exists
12738 set endservent d_endsent
12739 eval $inlibc
12740
12741 : see if endservent_r exists
12742 set endservent_r d_endservent_r
12743 eval $inlibc
12744 case "$d_endservent_r" in
12745 "$define")
12746         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12747         case "$d_endservent_r_proto:$usethreads" in
12748         ":define")      d_endservent_r_proto=define
12749                 set d_endservent_r_proto endservent_r $hdrs
12750                 eval $hasproto ;;
12751         *)      ;;
12752         esac
12753         case "$d_endservent_r_proto" in
12754         define)
12755         case "$endservent_r_proto" in
12756         ''|0) try='int endservent_r(struct servent_data*);'
12757         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12758         esac
12759         case "$endservent_r_proto" in
12760         ''|0) try='void endservent_r(struct servent_data*);'
12761         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12762         esac
12763         case "$endservent_r_proto" in
12764         ''|0)   d_endservent_r=undef
12765                 endservent_r_proto=0
12766                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12767         * )     case "$endservent_r_proto" in
12768                 REENTRANT_PROTO*) ;;
12769                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12770                 esac
12771                 echo "Prototype: $try" ;;
12772         esac
12773         ;;
12774         *)      case "$usethreads" in
12775                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12776                 esac
12777                 d_endservent_r=undef
12778                 endservent_r_proto=0
12779                 ;;
12780         esac
12781         ;;
12782 *)      endservent_r_proto=0
12783         ;;
12784 esac
12785
12786 : Locate the flags for 'open()'
12787 echo " "
12788 $cat >try.c <<EOCP
12789 #include <sys/types.h>
12790 #ifdef I_FCNTL
12791 #include <fcntl.h>
12792 #endif
12793 #ifdef I_SYS_FILE
12794 #include <sys/file.h>
12795 #endif
12796 #$i_stdlib I_STDLIB
12797 #ifdef I_STDLIB
12798 #include <stdlib.h>
12799 #endif
12800 int main() {
12801         if(O_RDONLY);
12802 #ifdef O_TRUNC
12803         exit(0);
12804 #else
12805         exit(1);
12806 #endif
12807 }
12808 EOCP
12809 : check sys/file.h first to get FREAD on Sun
12810 if $test `./findhdr sys/file.h` && \
12811                 set try -DI_SYS_FILE && eval $compile; then
12812         h_sysfile=true;
12813         echo "<sys/file.h> defines the O_* constants..." >&4
12814         if $run ./try; then
12815                 echo "and you have the 3 argument form of open()." >&4
12816                 val="$define"
12817         else
12818                 echo "but not the 3 argument form of open().  Oh, well." >&4
12819                 val="$undef"
12820         fi
12821 elif $test `./findhdr fcntl.h` && \
12822                 set try -DI_FCNTL && eval $compile; then
12823         h_fcntl=true;
12824         echo "<fcntl.h> defines the O_* constants..." >&4
12825         if $run ./try; then
12826                 echo "and you have the 3 argument form of open()." >&4
12827                 val="$define"
12828         else
12829                 echo "but not the 3 argument form of open().  Oh, well." >&4
12830                 val="$undef"
12831         fi
12832 else
12833         val="$undef"
12834         echo "I can't find the O_* constant definitions!  You got problems." >&4
12835 fi
12836 set d_open3
12837 eval $setvar
12838 $rm_try
12839
12840 : see if this is a sys/file.h system
12841 val=''
12842 set sys/file.h val
12843 eval $inhdr
12844
12845 : do we need to include sys/file.h ?
12846 case "$val" in
12847 "$define")
12848         echo " "
12849         if $h_sysfile; then
12850                 val="$define"
12851                 echo "We'll be including <sys/file.h>." >&4
12852         else
12853                 val="$undef"
12854                 echo "We won't be including <sys/file.h>." >&4
12855         fi
12856         ;;
12857 *)
12858         h_sysfile=false
12859         ;;
12860 esac
12861 set i_sysfile
12862 eval $setvar
12863
12864 : see if fcntl.h is there
12865 val=''
12866 set fcntl.h val
12867 eval $inhdr
12868
12869 : see if we can include fcntl.h
12870 case "$val" in
12871 "$define")
12872         echo " "
12873         if $h_fcntl; then
12874                 val="$define"
12875                 echo "We'll be including <fcntl.h>." >&4
12876         else
12877                 val="$undef"
12878                 if $h_sysfile; then
12879         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12880                 else
12881                         echo "We won't be including <fcntl.h>." >&4
12882                 fi
12883         fi
12884         ;;
12885 *)
12886         h_fcntl=false
12887         val="$undef"
12888         ;;
12889 esac
12890 set i_fcntl
12891 eval $setvar
12892
12893 : see if fork exists
12894 set fork d_fork
12895 eval $inlibc
12896
12897 : see if pipe exists
12898 set pipe d_pipe
12899 eval $inlibc
12900
12901 : check for non-blocking I/O stuff
12902 case "$h_sysfile" in
12903 true) echo "#include <sys/file.h>" > head.c;;
12904 *)
12905        case "$h_fcntl" in
12906        true) echo "#include <fcntl.h>" > head.c;;
12907        *) echo "#include <sys/fcntl.h>" > head.c;;
12908        esac
12909        ;;
12910 esac
12911 echo " "
12912 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12913 case "$o_nonblock" in
12914 '')
12915         $cat head.c > try.c
12916         $cat >>try.c <<EOCP
12917 #include <stdio.h>
12918 #$i_stdlib I_STDLIB
12919 #ifdef I_STDLIB
12920 #include <stdlib.h>
12921 #endif
12922 #$i_fcntl I_FCNTL
12923 #ifdef I_FCNTL
12924 #include <fcntl.h>
12925 #endif
12926 int main() {
12927 #ifdef O_NONBLOCK
12928         printf("O_NONBLOCK\n");
12929         exit(0);
12930 #endif
12931 #ifdef O_NDELAY
12932         printf("O_NDELAY\n");
12933         exit(0);
12934 #endif
12935 #ifdef FNDELAY
12936         printf("FNDELAY\n");
12937         exit(0);
12938 #endif
12939         exit(0);
12940 }
12941 EOCP
12942         set try
12943         if eval $compile_ok; then
12944                 o_nonblock=`$run ./try`
12945                 case "$o_nonblock" in
12946                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12947                 *) echo "Seems like we can use $o_nonblock.";;
12948                 esac
12949         else
12950                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12951         fi
12952         ;;
12953 *) echo "Using $hint value $o_nonblock.";;
12954 esac
12955 $rm_try
12956
12957 echo " "
12958 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12959 case "$eagain" in
12960 '')
12961         case "$d_fork:$d_pipe" in
12962         define:define)
12963         $cat head.c > try.c
12964         $cat >>try.c <<EOCP
12965 #include <errno.h>
12966 #include <sys/types.h>
12967 #include <signal.h>
12968 #include <stdio.h>
12969 #$i_stdlib I_STDLIB
12970 #ifdef I_STDLIB
12971 #include <stdlib.h>
12972 #endif
12973 #$i_fcntl I_FCNTL
12974 #ifdef I_FCNTL
12975 #include <fcntl.h>
12976 #endif
12977 #define MY_O_NONBLOCK $o_nonblock
12978 #ifndef errno  /* XXX need better Configure test */
12979 extern int errno;
12980 #endif
12981 #$i_unistd I_UNISTD
12982 #ifdef I_UNISTD
12983 #include <unistd.h>
12984 #endif
12985 #$i_string I_STRING
12986 #ifdef I_STRING
12987 #include <string.h>
12988 #else
12989 #include <strings.h>
12990 #endif
12991 $signal_t blech(int x) { exit(3); }
12992 EOCP
12993         $cat >> try.c <<'EOCP'
12994 int main()
12995 {
12996         int pd[2];
12997         int pu[2];
12998         char buf[1];
12999         char string[100];
13000         int ret;
13001
13002         ret = pipe(pd); /* Down: child -> parent */
13003         if (ret != 0)
13004                 exit(3);
13005         ret = pipe(pu); /* Up: parent -> child */
13006         if (ret != 0)
13007                 exit(3);
13008         if (0 != fork()) {
13009                 close(pd[1]);   /* Parent reads from pd[0] */
13010                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13011 #ifdef F_SETFL
13012                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13013                         exit(1);
13014 #else
13015                 exit(4);
13016 #endif
13017                 signal(SIGALRM, blech);
13018                 alarm(5);
13019                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13020                         exit(2);
13021                 sprintf(string, "%d\n", ret);
13022                 ret = write(2, string, strlen(string));
13023                 if (ret != strlen(string))
13024                         exit(3);
13025                 alarm(0);
13026 #ifdef EAGAIN
13027                 if (errno == EAGAIN) {
13028                         printf("EAGAIN\n");
13029                         goto ok;
13030                 }
13031 #endif
13032 #ifdef EWOULDBLOCK
13033                 if (errno == EWOULDBLOCK)
13034                         printf("EWOULDBLOCK\n");
13035 #endif
13036         ok:
13037                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13038                 if (ret != 1)
13039                         exit(3);
13040                 sleep(2);                               /* Give it time to close our pipe */
13041                 alarm(5);
13042                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13043                 alarm(0);
13044                 sprintf(string, "%d\n", ret);
13045                 ret = write(4, string, strlen(string));
13046                 if (ret != strlen(string))
13047                         exit(3);
13048                 exit(0);
13049         }
13050
13051         close(pd[0]);                   /* We write to pd[1] */
13052         close(pu[1]);                   /* We read from pu[0] */
13053         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13054         if (ret != 1)
13055                 exit(3);
13056         close(pd[1]);                   /* Pipe pd is now fully closed! */
13057         exit(0);                                /* Bye bye, thank you for playing! */
13058 }
13059 EOCP
13060         set try
13061         if eval $compile_ok; then
13062                 echo "$startsh" >mtry
13063                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13064                 chmod +x mtry
13065                 $run ./mtry >/dev/null 2>&1
13066                 case $? in
13067                 0) eagain=`$cat try.out`;;
13068                 1) echo "Could not perform non-blocking setting!";;
13069                 2) echo "I did a successful read() for something that was not there!";;
13070                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13071                 4) echo "Could not find F_SETFL!";;
13072                 *) echo "Something terribly wrong happened during testing.";;
13073                 esac
13074                 rd_nodata=`$cat try.ret`
13075                 echo "A read() system call with no data present returns $rd_nodata."
13076                 case "$rd_nodata" in
13077                 0|-1) ;;
13078                 *)
13079                         echo "(That's peculiar, fixing that to be -1.)"
13080                         rd_nodata=-1
13081                         ;;
13082                 esac
13083                 case "$eagain" in
13084                 '')
13085                         echo "Forcing errno EAGAIN on read() with no data available."
13086                         eagain=EAGAIN
13087                         ;;
13088                 *)
13089                         echo "Your read() sets errno to $eagain when no data is available."
13090                         ;;
13091                 esac
13092                 status=`$cat try.err`
13093                 case "$status" in
13094                 0) echo "And it correctly returns 0 to signal EOF.";;
13095                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13096                 *) echo "However, your read() returns '$status' on EOF??";;
13097                 esac
13098                 val="$define"
13099                 if test "$status" = "$rd_nodata"; then
13100                         echo "WARNING: you can't distinguish between EOF and no data!"
13101                         val="$undef"
13102                 fi
13103         else
13104                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13105                 eagain=EAGAIN
13106         fi
13107         ;;
13108         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13109                 eagain=EAGAIN
13110                 val="$define"
13111                 ;;
13112         esac
13113         set d_eofnblk
13114         eval $setvar
13115         ;;
13116 *)
13117         echo "Using $hint value $eagain."
13118         echo "Your read() returns $rd_nodata when no data is present."
13119         case "$d_eofnblk" in
13120         "$define") echo "And you can see EOF because read() returns 0.";;
13121         "$undef") echo "But you can't see EOF status from read() returned value.";;
13122         *)
13123                 echo "(Assuming you can't see EOF status from read anyway.)"
13124                 d_eofnblk=$undef
13125                 ;;
13126         esac
13127         ;;
13128 esac
13129 $rm_try head.c mtry
13130
13131 : see if _ptr and _cnt from stdio act std
13132 echo " "
13133
13134 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13135         echo "(Looks like you have stdio.h from BSD.)"
13136         case "$stdio_ptr" in
13137         '') stdio_ptr='((fp)->_p)'
13138                 ptr_lval=$define
13139                 ;;
13140         *)      ptr_lval=$d_stdio_ptr_lval;;
13141         esac
13142         case "$stdio_cnt" in
13143         '') stdio_cnt='((fp)->_r)'
13144                 cnt_lval=$define
13145                 ;;
13146         *)      cnt_lval=$d_stdio_cnt_lval;;
13147         esac
13148         case "$stdio_base" in
13149         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13150         esac
13151         case "$stdio_bufsiz" in
13152         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13153         esac
13154 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13155         echo "(Looks like you have stdio.h from Linux.)"
13156         case "$stdio_ptr" in
13157         '') stdio_ptr='((fp)->_IO_read_ptr)'
13158                 ptr_lval=$define
13159                 ;;
13160         *)      ptr_lval=$d_stdio_ptr_lval;;
13161         esac
13162         case "$stdio_cnt" in
13163         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13164                 cnt_lval=$undef
13165                 ;;
13166         *)      cnt_lval=$d_stdio_cnt_lval;;
13167         esac
13168         case "$stdio_base" in
13169         '') stdio_base='((fp)->_IO_read_base)';;
13170         esac
13171         case "$stdio_bufsiz" in
13172         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13173         esac
13174 else
13175         case "$stdio_ptr" in
13176         '') stdio_ptr='((fp)->_ptr)'
13177                 ptr_lval=$define
13178                 ;;
13179         *)      ptr_lval=$d_stdio_ptr_lval;;
13180         esac
13181         case "$stdio_cnt" in
13182         '') stdio_cnt='((fp)->_cnt)'
13183                 cnt_lval=$define
13184                 ;;
13185         *)      cnt_lval=$d_stdio_cnt_lval;;
13186         esac
13187         case "$stdio_base" in
13188         '') stdio_base='((fp)->_base)';;
13189         esac
13190         case "$stdio_bufsiz" in
13191         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13192         esac
13193 fi
13194
13195 : test whether _ptr and _cnt really work
13196 echo "Checking how std your stdio is..." >&4
13197 $cat >try.c <<EOP
13198 #include <stdio.h>
13199 #$i_stdlib I_STDLIB
13200 #ifdef I_STDLIB
13201 #include <stdlib.h>
13202 #endif
13203 #define FILE_ptr(fp)    $stdio_ptr
13204 #define FILE_cnt(fp)    $stdio_cnt
13205 int main() {
13206         FILE *fp = fopen("try.c", "r");
13207         char c = getc(fp);
13208         if (
13209                 18 <= FILE_cnt(fp) &&
13210                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13211         )
13212                 exit(0);
13213         exit(1);
13214 }
13215 EOP
13216 val="$undef"
13217 set try
13218 if eval $compile && $to try.c; then
13219         if $run ./try; then
13220                 echo "Your stdio acts pretty std."
13221                 val="$define"
13222         else
13223                 echo "Your stdio isn't very std."
13224         fi
13225 else
13226         echo "Your stdio doesn't appear very std."
13227 fi
13228 $rm_try
13229
13230 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13231 # direct buffer manipulation no longer works.  The Configure tests
13232 # should be changed to correctly detect this, but until then,
13233 # the following check should at least let perl compile and run.
13234 # (This quick fix should be updated before 5.8.1.)
13235 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13236 # A. Dougherty, June 3, 2002.
13237 case "$d_gnulibc" in
13238 $define)
13239         case "$gnulibc_version" in
13240         2.[01]*)  ;;
13241         2.2) ;;
13242         2.2.[0-9]) ;;
13243         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13244                 val="$undef"
13245                 ;;
13246         esac
13247         ;;
13248 esac
13249 set d_stdstdio
13250 eval $setvar
13251
13252 : Can _ptr be used as an lvalue?
13253 case "$d_stdstdio$ptr_lval" in
13254 $define$define) val=$define ;;
13255 *) val=$undef ;;
13256 esac
13257 set d_stdio_ptr_lval
13258 eval $setvar
13259
13260 : Can _cnt be used as an lvalue?
13261 case "$d_stdstdio$cnt_lval" in
13262 $define$define) val=$define ;;
13263 *) val=$undef ;;
13264 esac
13265 set d_stdio_cnt_lval
13266 eval $setvar
13267
13268
13269 : test whether setting _ptr sets _cnt as a side effect
13270 d_stdio_ptr_lval_sets_cnt="$undef"
13271 d_stdio_ptr_lval_nochange_cnt="$undef"
13272 case "$d_stdio_ptr_lval$d_stdstdio" in
13273 $define$define)
13274         echo "Checking to see what happens if we set the stdio ptr..." >&4
13275 $cat >try.c <<EOP
13276 #include <stdio.h>
13277 /* Can we scream? */
13278 /* Eat dust sed :-) */
13279 /* In the buffer space, no one can hear you scream. */
13280 #$i_stdlib I_STDLIB
13281 #ifdef I_STDLIB
13282 #include <stdlib.h>
13283 #endif
13284 #define FILE_ptr(fp)    $stdio_ptr
13285 #define FILE_cnt(fp)    $stdio_cnt
13286 #include <sys/types.h>
13287 int main() {
13288         FILE *fp = fopen("try.c", "r");
13289         int c;
13290         char *ptr;
13291         size_t cnt;
13292         if (!fp) {
13293             puts("Fail even to read");
13294             exit(1);
13295         }
13296         c = getc(fp); /* Read away the first # */
13297         if (c == EOF) {
13298             puts("Fail even to read");
13299             exit(1);
13300         }
13301         if (!(
13302                 18 <= FILE_cnt(fp) &&
13303                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13304         )) {
13305                 puts("Fail even to read");
13306                 exit (1);
13307         }
13308         ptr = (char*) FILE_ptr(fp);
13309         cnt = (size_t)FILE_cnt(fp);
13310
13311         FILE_ptr(fp) += 42;
13312
13313         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13314                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13315                 exit (1);
13316         }
13317         if (FILE_cnt(fp) <= 20) {
13318                 printf ("Fail (<20 chars to test)");
13319                 exit (1);
13320         }
13321         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13322                 puts("Fail compare");
13323                 exit (1);
13324         }
13325         if (cnt == FILE_cnt(fp)) {
13326                 puts("Pass_unchanged");
13327                 exit (0);
13328         }
13329         if (FILE_cnt(fp) == (cnt - 42)) {
13330                 puts("Pass_changed");
13331                 exit (0);
13332         }
13333         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13334         return 1;
13335
13336 }
13337 EOP
13338         set try
13339         if eval $compile && $to try.c; then
13340                 case `$run ./try` in
13341                 Pass_changed)
13342                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13343                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13344                 Pass_unchanged)
13345                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13346                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13347                 Fail*)
13348                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13349                 *)
13350                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13351         esac
13352         else
13353                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13354         fi
13355         $rm_try
13356         ;;
13357 esac
13358
13359 : see if _base is also standard
13360 val="$undef"
13361 case "$d_stdstdio" in
13362 $define)
13363         $cat >try.c <<EOP
13364 #include <stdio.h>
13365 #$i_stdlib I_STDLIB
13366 #ifdef I_STDLIB
13367 #include <stdlib.h>
13368 #endif
13369 #define FILE_base(fp)   $stdio_base
13370 #define FILE_bufsiz(fp) $stdio_bufsiz
13371 int main() {
13372         FILE *fp = fopen("try.c", "r");
13373         char c = getc(fp);
13374         if (
13375                 19 <= FILE_bufsiz(fp) &&
13376                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13377         )
13378                 exit(0);
13379         exit(1);
13380 }
13381 EOP
13382         set try
13383         if eval $compile && $to try.c; then
13384                 if $run ./try; then
13385                         echo "And its _base field acts std."
13386                         val="$define"
13387                 else
13388                         echo "But its _base field isn't std."
13389                 fi
13390         else
13391                 echo "However, it seems to be lacking the _base field."
13392         fi
13393         $rm_try
13394         ;;
13395 esac
13396 set d_stdiobase
13397 eval $setvar
13398
13399 : see if fast_stdio exists
13400 val="$undef"
13401 case "$d_stdstdio:$d_stdio_ptr_lval" in
13402 "$define:$define")
13403         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13404         *$define*)
13405                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13406                 val="$define"
13407                 ;;
13408         esac
13409         ;;
13410 esac
13411 set d_faststdio
13412 eval $setvar
13413
13414
13415
13416 : see if fchdir exists
13417 set fchdir d_fchdir
13418 eval $inlibc
13419
13420 : see if fchmod exists
13421 set fchmod d_fchmod
13422 eval $inlibc
13423
13424 : see if fchown exists
13425 set fchown d_fchown
13426 eval $inlibc
13427
13428 : see if this is an fcntl system
13429 set fcntl d_fcntl
13430 eval $inlibc
13431
13432 : See if fcntl-based locking works.
13433 echo " "
13434 $cat >try.c <<EOCP
13435 #$i_stdlib I_STDLIB
13436 #ifdef I_STDLIB
13437 #include <stdlib.h>
13438 #endif
13439 #include <unistd.h>
13440 #include <fcntl.h>
13441 #include <signal.h>
13442 $signal_t blech(int x) { exit(3); }
13443 int main() {
13444 #if defined(F_SETLK) && defined(F_SETLKW)
13445      struct flock flock;
13446      int retval, fd;
13447      fd = open("try.c", O_RDONLY);
13448      flock.l_type = F_RDLCK;
13449      flock.l_whence = SEEK_SET;
13450      flock.l_start = flock.l_len = 0;
13451      signal(SIGALRM, blech);
13452      alarm(10);
13453      retval = fcntl(fd, F_SETLK, &flock);
13454      close(fd);
13455      (retval < 0 ? exit(2) : exit(0));
13456 #else
13457      exit(2);
13458 #endif
13459 }
13460 EOCP
13461 echo "Checking if fcntl-based file locking works... "
13462 case "$d_fcntl" in
13463 "$define")
13464         set try
13465         if eval $compile_ok; then
13466                 if $run ./try; then
13467                         echo "Yes, it seems to work."
13468                         val="$define"
13469                 else
13470                         echo "Nope, it didn't work."
13471                         val="$undef"
13472                         case "$?" in
13473                         3) $cat >&4 <<EOM
13474 ***
13475 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13476 *** This is (almost) impossible.
13477 *** If your NFS lock daemons are not feeling well, something like
13478 *** this may happen, please investigate.  Cannot continue, aborting.
13479 ***
13480 EOM
13481                                 exit 1
13482                                 ;;
13483                         esac
13484                 fi
13485         else
13486                 echo "I'm unable to compile the test program, so I'll assume not."
13487                 val="$undef"
13488         fi
13489         ;;
13490 *) val="$undef";
13491         echo "Nope, since you don't even have fcntl()."
13492         ;;
13493 esac
13494 set d_fcntl_can_lock
13495 eval $setvar
13496 $rm_try
13497
13498 : check for fd_set items
13499 $cat <<EOM
13500
13501 Checking to see how well your C compiler handles fd_set and friends ...
13502 EOM
13503 $cat >try.c <<EOCP
13504 #$i_stdlib I_STDLIB
13505 #ifdef I_STDLIB
13506 #include <stdlib.h>
13507 #endif
13508 #$i_systime I_SYS_TIME
13509 #$i_sysselct I_SYS_SELECT
13510 #$d_socket HAS_SOCKET
13511 #include <sys/types.h>
13512 #ifdef HAS_SOCKET
13513 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13514 #endif
13515 #ifdef I_SYS_TIME
13516 #include <sys/time.h>
13517 #endif
13518 #ifdef I_SYS_SELECT
13519 #include <sys/select.h>
13520 #endif
13521 int main() {
13522         fd_set fds;
13523
13524 #ifdef TRYBITS
13525         if(fds.fds_bits);
13526 #endif
13527
13528 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13529         exit(0);
13530 #else
13531         exit(1);
13532 #endif
13533 }
13534 EOCP
13535 set try -DTRYBITS
13536 if eval $compile; then
13537         d_fds_bits="$define"
13538         d_fd_set="$define"
13539         echo "Well, your system knows about the normal fd_set typedef..." >&4
13540         if $run ./try; then
13541                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13542                 d_fd_macros="$define"
13543         else
13544                 $cat >&4 <<'EOM'
13545 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13546 EOM
13547                 d_fd_macros="$undef"
13548         fi
13549 else
13550         $cat <<'EOM'
13551 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13552 EOM
13553         set try
13554         if eval $compile; then
13555                 d_fds_bits="$undef"
13556                 d_fd_set="$define"
13557                 echo "Well, your system has some sort of fd_set available..." >&4
13558                 if $run ./try; then
13559                         echo "and you have the normal fd_set macros." >&4
13560                         d_fd_macros="$define"
13561                 else
13562                         $cat <<'EOM'
13563 but not the normal fd_set macros!  Gross!  More work for me...
13564 EOM
13565                         d_fd_macros="$undef"
13566                 fi
13567         else
13568         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13569                 d_fd_set="$undef"
13570                 d_fds_bits="$undef"
13571                 d_fd_macros="$undef"
13572         fi
13573 fi
13574 $rm_try
13575
13576 : see if fgetpos exists
13577 set fgetpos d_fgetpos
13578 eval $inlibc
13579
13580 : see if finite exists
13581 set finite d_finite
13582 eval $inlibc
13583
13584 : see if finitel exists
13585 set finitel d_finitel
13586 eval $inlibc
13587
13588 : see if flock exists
13589 set flock d_flock
13590 eval $inlibc
13591
13592 : see if prototype for flock is available
13593 echo " "
13594 set d_flockproto flock $i_sysfile sys/file.h
13595 eval $hasproto
13596
13597 : see if fp_class exists
13598 set fp_class d_fp_class
13599 eval $inlibc
13600
13601 : see if pathconf exists
13602 set pathconf d_pathconf
13603 eval $inlibc
13604
13605 : see if fpathconf exists
13606 set fpathconf d_fpathconf
13607 eval $inlibc
13608
13609 : see if fpclass exists
13610 set fpclass d_fpclass
13611 eval $inlibc
13612
13613 : see if fpclassify exists
13614 set fpclassify d_fpclassify
13615 eval $inlibc
13616
13617 : see if fpclassl exists
13618 set fpclassl d_fpclassl
13619 eval $inlibc
13620
13621 : check for fpos64_t
13622 echo " "
13623 echo "Checking to see if you have fpos64_t..." >&4
13624 $cat >try.c <<EOCP
13625 #include <stdio.h>
13626 int main() { fpos64_t x = 7; }
13627 EOCP
13628 set try
13629 if eval $compile; then
13630         val="$define"
13631         echo "You have fpos64_t."
13632 else
13633         val="$undef"
13634         echo "You do not have fpos64_t."
13635         case "$fpossize" in
13636         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13637         esac
13638 fi
13639 $rm_try
13640 set d_fpos64_t
13641 eval $setvar
13642
13643 : see if frexpl exists
13644 set frexpl d_frexpl
13645 eval $inlibc
13646
13647 : see if this is a sys/param system
13648 set sys/param.h i_sysparam
13649 eval $inhdr
13650
13651 : see if this is a sys/mount.h system
13652 set sys/mount.h i_sysmount
13653 eval $inhdr
13654
13655 : Check for fs_data_s
13656 echo " "
13657 echo "Checking to see if your system supports struct fs_data..." >&4
13658 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13659 eval $hasstruct
13660 case "$d_fs_data_s" in
13661 "$define")      echo "Yes, it does."   ;;
13662 *)              echo "No, it doesn't." ;;
13663 esac
13664
13665 : see if fseeko exists
13666 set fseeko d_fseeko
13667 eval $inlibc
13668 case "$longsize" in
13669 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13670 esac
13671
13672 : see if fsetpos exists
13673 set fsetpos d_fsetpos
13674 eval $inlibc
13675
13676 : see if fstatfs exists
13677 set fstatfs d_fstatfs
13678 eval $inlibc
13679
13680 : see if statvfs exists
13681 set statvfs d_statvfs
13682 eval $inlibc
13683
13684 : see if fstatvfs exists
13685 set fstatvfs d_fstatvfs
13686 eval $inlibc
13687
13688
13689 : see if fsync exists
13690 set fsync d_fsync
13691 eval $inlibc
13692
13693 : see if ftello exists
13694 set ftello d_ftello
13695 eval $inlibc
13696 case "$longsize" in
13697 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13698 esac
13699
13700 : check for a working futimes
13701 d_futimes="$undef"
13702 echo " "
13703 echo "Checking if you have a working futimes()" >&4
13704 $cat >try.c <<EOCP
13705 #include <stdio.h>
13706 #include <sys/time.h>
13707 #include <errno.h>
13708 #include <fcntl.h>
13709
13710 int main ()
13711 {
13712     int fd, rv;
13713     fd = open ("try.c", O_RDWR);
13714     if (-1 == fd) exit (1);
13715     rv = futimes (fd, NULL);
13716     exit (rv == -1 ? errno : 0);
13717 }
13718 EOCP
13719 set try
13720 if eval $compile; then
13721     `$run ./try`
13722     rc=$?
13723     case "$rc" in
13724         0)  echo "Yes, you have" >&4
13725             d_futimes="$define"
13726             ;;
13727         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13728             ;;
13729     esac
13730 else
13731     echo "No, it does not (probably harmless)" >&4
13732 fi
13733 $rm_try
13734
13735 : see if ndbm.h is available
13736 set ndbm.h i_ndbm
13737 eval $inhdr
13738 : Compatibility location for RedHat 7.1
13739 set gdbm/ndbm.h i_gdbmndbm
13740 eval $inhdr
13741 : Compatibility location for Debian 4.0
13742 set gdbm-ndbm.h i_gdbm_ndbm
13743 eval $inhdr
13744
13745 val="$undef"
13746 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13747         : see if dbm_open exists
13748         set dbm_open d_dbm_open
13749         eval $inlibc
13750         case "$d_dbm_open" in
13751         $undef)
13752                 i_ndbm="$undef"
13753                 i_gdbmndbm="$undef"
13754                 i_gdbm_ndbm="$undef"
13755                 echo "We won't be including <ndbm.h>"
13756                 val="$undef"
13757                 ;;
13758         *) val="$define"
13759            ;;
13760         esac
13761 fi
13762 set d_ndbm
13763 eval $setvar
13764
13765 ndbm_hdr_protochk='name=$1; hdr=$2;
13766 eval "ihdr=\$""i_$name";
13767 val="$undef";
13768 if $test "$ihdr" = "$define"; then
13769         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13770         case "$d_cplusplus" in
13771         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13772         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13773         esac;
13774         case "$val" in
13775         $define) $echo "Your <$hdr> seems to have prototypes";;
13776         *) $echo "Your <$hdr> does not seem to have prototypes";;
13777         esac;
13778 fi;
13779 set "d_${name}_h_uses_prototypes";
13780 eval $setvar'
13781
13782 set ndbm ndbm.h
13783 eval $ndbm_hdr_protochk
13784 set gdbmndbm gdbm/ndbm.h
13785 eval $ndbm_hdr_protochk
13786 set gdbm_ndbm gdbm-ndbm.h
13787 eval $ndbm_hdr_protochk
13788
13789 : see if getaddrinfo exists
13790 set getaddrinfo d_getaddrinfo
13791 eval $inlibc
13792
13793 : see if getcwd exists
13794 set getcwd d_getcwd
13795 eval $inlibc
13796
13797 : see if getespwnam exists
13798 set getespwnam d_getespwnam
13799 eval $inlibc
13800
13801 : see if getfsstat exists
13802 set getfsstat d_getfsstat
13803 eval $inlibc
13804
13805 : see if getgrent exists
13806 set getgrent d_getgrent
13807 eval $inlibc
13808
13809 : see if getgrent_r exists
13810 set getgrent_r d_getgrent_r
13811 eval $inlibc
13812 case "$d_getgrent_r" in
13813 "$define")
13814         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13815         case "$d_getgrent_r_proto:$usethreads" in
13816         ":define")      d_getgrent_r_proto=define
13817                 set d_getgrent_r_proto getgrent_r $hdrs
13818                 eval $hasproto ;;
13819         *)      ;;
13820         esac
13821         case "$d_getgrent_r_proto" in
13822         define)
13823         case "$getgrent_r_proto" in
13824         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13825         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13826         esac
13827         case "$getgrent_r_proto" in
13828         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13829         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13830         esac
13831         case "$getgrent_r_proto" in
13832         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13833         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13834         esac
13835         case "$getgrent_r_proto" in
13836         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13837         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13838         esac
13839         case "$getgrent_r_proto" in
13840         ''|0) try='int getgrent_r(struct group*, char*, int);'
13841         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13842         esac
13843         case "$getgrent_r_proto" in
13844         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13845         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13846         esac
13847         case "$getgrent_r_proto" in
13848         ''|0)   d_getgrent_r=undef
13849                 getgrent_r_proto=0
13850                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13851         * )     case "$getgrent_r_proto" in
13852                 REENTRANT_PROTO*) ;;
13853                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13854                 esac
13855                 echo "Prototype: $try" ;;
13856         esac
13857         ;;
13858         *)      case "$usethreads" in
13859                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13860                 esac
13861                 d_getgrent_r=undef
13862                 getgrent_r_proto=0
13863                 ;;
13864         esac
13865         ;;
13866 *)      getgrent_r_proto=0
13867         ;;
13868 esac
13869
13870 : see if getgrgid_r exists
13871 set getgrgid_r d_getgrgid_r
13872 eval $inlibc
13873 case "$d_getgrgid_r" in
13874 "$define")
13875         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13876         case "$d_getgrgid_r_proto:$usethreads" in
13877         ":define")      d_getgrgid_r_proto=define
13878                 set d_getgrgid_r_proto getgrgid_r $hdrs
13879                 eval $hasproto ;;
13880         *)      ;;
13881         esac
13882         case "$d_getgrgid_r_proto" in
13883         define)
13884         case "$getgrgid_r_proto" in
13885         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13886         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13887         esac
13888         case "$getgrgid_r_proto" in
13889         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13890         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13891         esac
13892         case "$getgrgid_r_proto" in
13893         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13894         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13895         esac
13896         case "$getgrgid_r_proto" in
13897         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13898         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13899         esac
13900         case "$getgrgid_r_proto" in
13901         ''|0)   d_getgrgid_r=undef
13902                 getgrgid_r_proto=0
13903                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13904         * )     case "$getgrgid_r_proto" in
13905                 REENTRANT_PROTO*) ;;
13906                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13907                 esac
13908                 echo "Prototype: $try" ;;
13909         esac
13910         ;;
13911         *)      case "$usethreads" in
13912                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13913                 esac
13914                 d_getgrgid_r=undef
13915                 getgrgid_r_proto=0
13916                 ;;
13917         esac
13918         ;;
13919 *)      getgrgid_r_proto=0
13920         ;;
13921 esac
13922
13923 : see if getgrnam_r exists
13924 set getgrnam_r d_getgrnam_r
13925 eval $inlibc
13926 case "$d_getgrnam_r" in
13927 "$define")
13928         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13929         case "$d_getgrnam_r_proto:$usethreads" in
13930         ":define")      d_getgrnam_r_proto=define
13931                 set d_getgrnam_r_proto getgrnam_r $hdrs
13932                 eval $hasproto ;;
13933         *)      ;;
13934         esac
13935         case "$d_getgrnam_r_proto" in
13936         define)
13937         case "$getgrnam_r_proto" in
13938         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13939         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13940         esac
13941         case "$getgrnam_r_proto" in
13942         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13943         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13944         esac
13945         case "$getgrnam_r_proto" in
13946         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13947         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13948         esac
13949         case "$getgrnam_r_proto" in
13950         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13951         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13952         esac
13953         case "$getgrnam_r_proto" in
13954         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13955         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13956         esac
13957         case "$getgrnam_r_proto" in
13958         ''|0)   d_getgrnam_r=undef
13959                 getgrnam_r_proto=0
13960                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13961         * )     case "$getgrnam_r_proto" in
13962                 REENTRANT_PROTO*) ;;
13963                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13964                 esac
13965                 echo "Prototype: $try" ;;
13966         esac
13967         ;;
13968         *)      case "$usethreads" in
13969                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13970                 esac
13971                 d_getgrnam_r=undef
13972                 getgrnam_r_proto=0
13973                 ;;
13974         esac
13975         ;;
13976 *)      getgrnam_r_proto=0
13977         ;;
13978 esac
13979
13980 : see if gethostbyaddr exists
13981 set gethostbyaddr d_gethbyaddr
13982 eval $inlibc
13983
13984 : see if gethostbyname exists
13985 set gethostbyname d_gethbyname
13986 eval $inlibc
13987
13988 : see if gethostent exists
13989 set gethostent d_gethent
13990 eval $inlibc
13991
13992 : see how we will look up host name
13993 echo " "
13994 call=''
13995 if set gethostname val -f d_gethname; eval $csym; $val; then
13996         echo 'gethostname() found.' >&4
13997         d_gethname="$define"
13998         call=gethostname
13999 fi
14000 if set uname val -f d_uname; eval $csym; $val; then
14001         if ./xenix; then
14002                 $cat <<'EOM'
14003 uname() was found, but you're running xenix, and older versions of xenix
14004 have a broken uname(). If you don't really know whether your xenix is old
14005 enough to have a broken system call, use the default answer.
14006
14007 EOM
14008                 dflt=y
14009                 case "$d_uname" in
14010                 "$define") dflt=n;;
14011                 esac
14012                 rp='Is your uname() broken?'
14013                 . ./myread
14014                 case "$ans" in
14015                 n*) d_uname="$define"; call=uname;;
14016                 esac
14017         else
14018                 echo 'uname() found.' >&4
14019                 d_uname="$define"
14020                 case "$call" in
14021                 '') call=uname ;;
14022                 esac
14023         fi
14024 fi
14025 case "$d_gethname" in
14026 '') d_gethname="$undef";;
14027 esac
14028 case "$d_uname" in
14029 '') d_uname="$undef";;
14030 esac
14031 case "$d_uname$d_gethname" in
14032 *define*)
14033         dflt=n
14034         cat <<EOM
14035
14036 Every now and then someone has a $call() that lies about the hostname
14037 but can't be fixed for political or economic reasons.  If you wish, I can
14038 pretend $call() isn't there and maybe compute hostname at run-time
14039 thanks to the '$phostname' command.
14040
14041 EOM
14042         rp="Shall I ignore $call() from now on?"
14043         . ./myread
14044         case "$ans" in
14045         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14046         esac;;
14047 esac
14048 case "$phostname" in
14049 '') aphostname='';;
14050 *) case "$aphostname" in
14051         /*) ;;
14052         *) set X $phostname
14053                 shift
14054                 file=$1
14055                 shift
14056                 file=`./loc $file $file $pth`
14057                 aphostname=`echo $file $*`
14058                 ;;
14059         esac
14060         ;;
14061 esac
14062 case "$d_uname$d_gethname" in
14063 *define*) ;;
14064 *)
14065         case "$phostname" in
14066         '')
14067                 echo "There will be no way for $package to get your hostname." >&4;;
14068         *)
14069         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14070                 ;;
14071         esac;;
14072 esac
14073 case "$d_phostname" in
14074 '') d_phostname="$undef";;
14075 esac
14076
14077 : see if gethostbyaddr_r exists
14078 set gethostbyaddr_r d_gethostbyaddr_r
14079 eval $inlibc
14080 case "$d_gethostbyaddr_r" in
14081 "$define")
14082         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14083         case "$d_gethostbyaddr_r_proto:$usethreads" in
14084         ":define")      d_gethostbyaddr_r_proto=define
14085                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14086                 eval $hasproto ;;
14087         *)      ;;
14088         esac
14089         case "$d_gethostbyaddr_r_proto" in
14090         define)
14091         case "$gethostbyaddr_r_proto" in
14092         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14093         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14094         esac
14095         case "$gethostbyaddr_r_proto" in
14096         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14097         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14098         esac
14099         case "$gethostbyaddr_r_proto" in
14100         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14101         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14102         esac
14103         case "$gethostbyaddr_r_proto" in
14104         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14105         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14106         esac
14107         case "$gethostbyaddr_r_proto" in
14108         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14109         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14110         esac
14111         case "$gethostbyaddr_r_proto" in
14112         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14113         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14114         esac
14115         case "$gethostbyaddr_r_proto" in
14116         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14117         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14118         esac
14119         case "$gethostbyaddr_r_proto" in
14120         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14121         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14122         esac
14123         case "$gethostbyaddr_r_proto" in
14124         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14125         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14126         esac
14127         case "$gethostbyaddr_r_proto" in
14128         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14129         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14130         esac
14131         case "$gethostbyaddr_r_proto" in
14132         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14133         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14134         esac
14135         case "$gethostbyaddr_r_proto" in
14136         ''|0)   d_gethostbyaddr_r=undef
14137                 gethostbyaddr_r_proto=0
14138                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14139         * )     case "$gethostbyaddr_r_proto" in
14140                 REENTRANT_PROTO*) ;;
14141                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14142                 esac
14143                 echo "Prototype: $try" ;;
14144         esac
14145         ;;
14146         *)      case "$usethreads" in
14147                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14148                 esac
14149                 d_gethostbyaddr_r=undef
14150                 gethostbyaddr_r_proto=0
14151                 ;;
14152         esac
14153         ;;
14154 *)      gethostbyaddr_r_proto=0
14155         ;;
14156 esac
14157
14158 : see if gethostbyname_r exists
14159 set gethostbyname_r d_gethostbyname_r
14160 eval $inlibc
14161 case "$d_gethostbyname_r" in
14162 "$define")
14163         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14164         case "$d_gethostbyname_r_proto:$usethreads" in
14165         ":define")      d_gethostbyname_r_proto=define
14166                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14167                 eval $hasproto ;;
14168         *)      ;;
14169         esac
14170         case "$d_gethostbyname_r_proto" in
14171         define)
14172         case "$gethostbyname_r_proto" in
14173         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14174         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14175         esac
14176         case "$gethostbyname_r_proto" in
14177         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14178         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14179         esac
14180         case "$gethostbyname_r_proto" in
14181         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14182         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14183         esac
14184         case "$gethostbyname_r_proto" in
14185         ''|0)   d_gethostbyname_r=undef
14186                 gethostbyname_r_proto=0
14187                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14188         * )     case "$gethostbyname_r_proto" in
14189                 REENTRANT_PROTO*) ;;
14190                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14191                 esac
14192                 echo "Prototype: $try" ;;
14193         esac
14194         ;;
14195         *)      case "$usethreads" in
14196                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14197                 esac
14198                 d_gethostbyname_r=undef
14199                 gethostbyname_r_proto=0
14200                 ;;
14201         esac
14202         ;;
14203 *)      gethostbyname_r_proto=0
14204         ;;
14205 esac
14206
14207 : see if gethostent_r exists
14208 set gethostent_r d_gethostent_r
14209 eval $inlibc
14210 case "$d_gethostent_r" in
14211 "$define")
14212         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14213         case "$d_gethostent_r_proto:$usethreads" in
14214         ":define")      d_gethostent_r_proto=define
14215                 set d_gethostent_r_proto gethostent_r $hdrs
14216                 eval $hasproto ;;
14217         *)      ;;
14218         esac
14219         case "$d_gethostent_r_proto" in
14220         define)
14221         case "$gethostent_r_proto" in
14222         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14223         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14224         esac
14225         case "$gethostent_r_proto" in
14226         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14227         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14228         esac
14229         case "$gethostent_r_proto" in
14230         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14231         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14232         esac
14233         case "$gethostent_r_proto" in
14234         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14235         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14236         esac
14237         case "$gethostent_r_proto" in
14238         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14239         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14240         esac
14241         case "$gethostent_r_proto" in
14242         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14243         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14244         esac
14245         case "$gethostent_r_proto" in
14246         ''|0)   d_gethostent_r=undef
14247                 gethostent_r_proto=0
14248                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14249         * )     case "$gethostent_r_proto" in
14250                 REENTRANT_PROTO*) ;;
14251                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14252                 esac
14253                 echo "Prototype: $try" ;;
14254         esac
14255         ;;
14256         *)      case "$usethreads" in
14257                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14258                 esac
14259                 d_gethostent_r=undef
14260                 gethostent_r_proto=0
14261                 ;;
14262         esac
14263         ;;
14264 *)      gethostent_r_proto=0
14265         ;;
14266 esac
14267
14268 : see if prototypes for various gethostxxx netdb.h functions are available
14269 echo " "
14270 set d_gethostprotos gethostent $i_netdb netdb.h
14271 eval $hasproto
14272
14273 : see if getitimer exists
14274 set getitimer d_getitimer
14275 eval $inlibc
14276
14277 : see if getlogin exists
14278 set getlogin d_getlogin
14279 eval $inlibc
14280
14281 : see if getlogin_r exists
14282 set getlogin_r d_getlogin_r
14283 eval $inlibc
14284 case "$d_getlogin_r" in
14285 "$define")
14286         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14287         case "$d_getlogin_r_proto:$usethreads" in
14288         ":define")      d_getlogin_r_proto=define
14289                 set d_getlogin_r_proto getlogin_r $hdrs
14290                 eval $hasproto ;;
14291         *)      ;;
14292         esac
14293         case "$d_getlogin_r_proto" in
14294         define)
14295         case "$getlogin_r_proto" in
14296         ''|0) try='int getlogin_r(char*, size_t);'
14297         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14298         esac
14299         case "$getlogin_r_proto" in
14300         ''|0) try='int getlogin_r(char*, int);'
14301         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14302         esac
14303         case "$getlogin_r_proto" in
14304         ''|0) try='char* getlogin_r(char*, size_t);'
14305         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14306         esac
14307         case "$getlogin_r_proto" in
14308         ''|0) try='char* getlogin_r(char*, int);'
14309         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14310         esac
14311         case "$getlogin_r_proto" in
14312         ''|0)   d_getlogin_r=undef
14313                 getlogin_r_proto=0
14314                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14315         * )     case "$getlogin_r_proto" in
14316                 REENTRANT_PROTO*) ;;
14317                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14318                 esac
14319                 echo "Prototype: $try" ;;
14320         esac
14321         ;;
14322         *)      case "$usethreads" in
14323                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14324                 esac
14325                 d_getlogin_r=undef
14326                 getlogin_r_proto=0
14327                 ;;
14328         esac
14329         ;;
14330 *)      getlogin_r_proto=0
14331         ;;
14332 esac
14333
14334 : see if getmnt exists
14335 set getmnt d_getmnt
14336 eval $inlibc
14337
14338 : see if getmntent exists
14339 set getmntent d_getmntent
14340 eval $inlibc
14341
14342 : see if getnameinfo exists
14343 set getnameinfo d_getnameinfo
14344 eval $inlibc
14345
14346 : see if getnetbyaddr exists
14347 set getnetbyaddr d_getnbyaddr
14348 eval $inlibc
14349
14350 : see if getnetbyname exists
14351 set getnetbyname d_getnbyname
14352 eval $inlibc
14353
14354 : see if getnetent exists
14355 set getnetent d_getnent
14356 eval $inlibc
14357
14358 : see if getnetbyaddr_r exists
14359 set getnetbyaddr_r d_getnetbyaddr_r
14360 eval $inlibc
14361 case "$d_getnetbyaddr_r" in
14362 "$define")
14363         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14364         case "$d_getnetbyaddr_r_proto:$usethreads" in
14365         ":define")      d_getnetbyaddr_r_proto=define
14366                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14367                 eval $hasproto ;;
14368         *)      ;;
14369         esac
14370         case "$d_getnetbyaddr_r_proto" in
14371         define)
14372         case "$getnetbyaddr_r_proto" in
14373         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14374         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14375         esac
14376         case "$getnetbyaddr_r_proto" in
14377         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14378         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14379         esac
14380         case "$getnetbyaddr_r_proto" in
14381         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14382         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14383         esac
14384         case "$getnetbyaddr_r_proto" in
14385         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14386         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14387         esac
14388         case "$getnetbyaddr_r_proto" in
14389         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14390         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14391         esac
14392         case "$getnetbyaddr_r_proto" in
14393         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14394         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14395         esac
14396         case "$getnetbyaddr_r_proto" in
14397         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14398         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14399         esac
14400         case "$getnetbyaddr_r_proto" in
14401         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14402         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14403         esac
14404         case "$getnetbyaddr_r_proto" in
14405         ''|0)   d_getnetbyaddr_r=undef
14406                 getnetbyaddr_r_proto=0
14407                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14408         * )     case "$getnetbyaddr_r_proto" in
14409                 REENTRANT_PROTO*) ;;
14410                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14411                 esac
14412                 echo "Prototype: $try" ;;
14413         esac
14414         ;;
14415         *)      case "$usethreads" in
14416                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14417                 esac
14418                 d_getnetbyaddr_r=undef
14419                 getnetbyaddr_r_proto=0
14420                 ;;
14421         esac
14422         ;;
14423 *)      getnetbyaddr_r_proto=0
14424         ;;
14425 esac
14426
14427 : see if getnetbyname_r exists
14428 set getnetbyname_r d_getnetbyname_r
14429 eval $inlibc
14430 case "$d_getnetbyname_r" in
14431 "$define")
14432         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14433         case "$d_getnetbyname_r_proto:$usethreads" in
14434         ":define")      d_getnetbyname_r_proto=define
14435                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14436                 eval $hasproto ;;
14437         *)      ;;
14438         esac
14439         case "$d_getnetbyname_r_proto" in
14440         define)
14441         case "$getnetbyname_r_proto" in
14442         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14443         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14444         esac
14445         case "$getnetbyname_r_proto" in
14446         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14447         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14448         esac
14449         case "$getnetbyname_r_proto" in
14450         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14451         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14452         esac
14453         case "$getnetbyname_r_proto" in
14454         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14455         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14456         esac
14457         case "$getnetbyname_r_proto" in
14458         ''|0)   d_getnetbyname_r=undef
14459                 getnetbyname_r_proto=0
14460                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14461         * )     case "$getnetbyname_r_proto" in
14462                 REENTRANT_PROTO*) ;;
14463                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14464                 esac
14465                 echo "Prototype: $try" ;;
14466         esac
14467         ;;
14468         *)      case "$usethreads" in
14469                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14470                 esac
14471                 d_getnetbyname_r=undef
14472                 getnetbyname_r_proto=0
14473                 ;;
14474         esac
14475         ;;
14476 *)      getnetbyname_r_proto=0
14477         ;;
14478 esac
14479
14480 : see if getnetent_r exists
14481 set getnetent_r d_getnetent_r
14482 eval $inlibc
14483 case "$d_getnetent_r" in
14484 "$define")
14485         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14486         case "$d_getnetent_r_proto:$usethreads" in
14487         ":define")      d_getnetent_r_proto=define
14488                 set d_getnetent_r_proto getnetent_r $hdrs
14489                 eval $hasproto ;;
14490         *)      ;;
14491         esac
14492         case "$d_getnetent_r_proto" in
14493         define)
14494         case "$getnetent_r_proto" in
14495         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14496         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14497         esac
14498         case "$getnetent_r_proto" in
14499         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14500         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14501         esac
14502         case "$getnetent_r_proto" in
14503         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14504         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14505         esac
14506         case "$getnetent_r_proto" in
14507         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14508         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14509         esac
14510         case "$getnetent_r_proto" in
14511         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14512         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14513         esac
14514         case "$getnetent_r_proto" in
14515         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14516         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14517         esac
14518         case "$getnetent_r_proto" in
14519         ''|0)   d_getnetent_r=undef
14520                 getnetent_r_proto=0
14521                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14522         * )     case "$getnetent_r_proto" in
14523                 REENTRANT_PROTO*) ;;
14524                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14525                 esac
14526                 echo "Prototype: $try" ;;
14527         esac
14528         ;;
14529         *)      case "$usethreads" in
14530                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14531                 esac
14532                 d_getnetent_r=undef
14533                 getnetent_r_proto=0
14534                 ;;
14535         esac
14536         ;;
14537 *)      getnetent_r_proto=0
14538         ;;
14539 esac
14540
14541 : see if prototypes for various getnetxxx netdb.h functions are available
14542 echo " "
14543 set d_getnetprotos getnetent $i_netdb netdb.h
14544 eval $hasproto
14545
14546 : see if getpagesize exists
14547 set getpagesize d_getpagsz
14548 eval $inlibc
14549
14550 : Optional checks for getprotobyname and getprotobynumber
14551
14552 : see if getprotobyname exists
14553 set getprotobyname d_getpbyname
14554 eval $inlibc
14555
14556 : see if getprotobynumber exists
14557 set getprotobynumber d_getpbynumber
14558 eval $inlibc
14559
14560 : see if getprotoent exists
14561 set getprotoent d_getpent
14562 eval $inlibc
14563
14564 : see if getpgid exists
14565 set getpgid d_getpgid
14566 eval $inlibc
14567
14568 : see if getpgrp2 exists
14569 set getpgrp2 d_getpgrp2
14570 eval $inlibc
14571
14572 : see if getppid exists
14573 set getppid d_getppid
14574 eval $inlibc
14575
14576 : see if getpriority exists
14577 set getpriority d_getprior
14578 eval $inlibc
14579
14580 : see if getprotobyname_r exists
14581 set getprotobyname_r d_getprotobyname_r
14582 eval $inlibc
14583 case "$d_getprotobyname_r" in
14584 "$define")
14585         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14586         case "$d_getprotobyname_r_proto:$usethreads" in
14587         ":define")      d_getprotobyname_r_proto=define
14588                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14589                 eval $hasproto ;;
14590         *)      ;;
14591         esac
14592         case "$d_getprotobyname_r_proto" in
14593         define)
14594         case "$getprotobyname_r_proto" in
14595         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14596         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14597         esac
14598         case "$getprotobyname_r_proto" in
14599         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14600         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14601         esac
14602         case "$getprotobyname_r_proto" in
14603         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14604         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14605         esac
14606         case "$getprotobyname_r_proto" in
14607         ''|0)   d_getprotobyname_r=undef
14608                 getprotobyname_r_proto=0
14609                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14610         * )     case "$getprotobyname_r_proto" in
14611                 REENTRANT_PROTO*) ;;
14612                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14613                 esac
14614                 echo "Prototype: $try" ;;
14615         esac
14616         ;;
14617         *)      case "$usethreads" in
14618                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14619                 esac
14620                 d_getprotobyname_r=undef
14621                 getprotobyname_r_proto=0
14622                 ;;
14623         esac
14624         ;;
14625 *)      getprotobyname_r_proto=0
14626         ;;
14627 esac
14628
14629 : see if getprotobynumber_r exists
14630 set getprotobynumber_r d_getprotobynumber_r
14631 eval $inlibc
14632 case "$d_getprotobynumber_r" in
14633 "$define")
14634         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14635         case "$d_getprotobynumber_r_proto:$usethreads" in
14636         ":define")      d_getprotobynumber_r_proto=define
14637                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14638                 eval $hasproto ;;
14639         *)      ;;
14640         esac
14641         case "$d_getprotobynumber_r_proto" in
14642         define)
14643         case "$getprotobynumber_r_proto" in
14644         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14645         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14646         esac
14647         case "$getprotobynumber_r_proto" in
14648         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14649         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14650         esac
14651         case "$getprotobynumber_r_proto" in
14652         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14653         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14654         esac
14655         case "$getprotobynumber_r_proto" in
14656         ''|0)   d_getprotobynumber_r=undef
14657                 getprotobynumber_r_proto=0
14658                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14659         * )     case "$getprotobynumber_r_proto" in
14660                 REENTRANT_PROTO*) ;;
14661                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14662                 esac
14663                 echo "Prototype: $try" ;;
14664         esac
14665         ;;
14666         *)      case "$usethreads" in
14667                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14668                 esac
14669                 d_getprotobynumber_r=undef
14670                 getprotobynumber_r_proto=0
14671                 ;;
14672         esac
14673         ;;
14674 *)      getprotobynumber_r_proto=0
14675         ;;
14676 esac
14677
14678 : see if getprotoent_r exists
14679 set getprotoent_r d_getprotoent_r
14680 eval $inlibc
14681 case "$d_getprotoent_r" in
14682 "$define")
14683         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14684         case "$d_getprotoent_r_proto:$usethreads" in
14685         ":define")      d_getprotoent_r_proto=define
14686                 set d_getprotoent_r_proto getprotoent_r $hdrs
14687                 eval $hasproto ;;
14688         *)      ;;
14689         esac
14690         case "$d_getprotoent_r_proto" in
14691         define)
14692         case "$getprotoent_r_proto" in
14693         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14694         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14695         esac
14696         case "$getprotoent_r_proto" in
14697         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14698         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14699         esac
14700         case "$getprotoent_r_proto" in
14701         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14702         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14703         esac
14704         case "$getprotoent_r_proto" in
14705         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14706         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14707         esac
14708         case "$getprotoent_r_proto" in
14709         ''|0)   d_getprotoent_r=undef
14710                 getprotoent_r_proto=0
14711                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14712         * )     case "$getprotoent_r_proto" in
14713                 REENTRANT_PROTO*) ;;
14714                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14715                 esac
14716                 echo "Prototype: $try" ;;
14717         esac
14718         ;;
14719         *)      case "$usethreads" in
14720                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14721                 esac
14722                 d_getprotoent_r=undef
14723                 getprotoent_r_proto=0
14724                 ;;
14725         esac
14726         ;;
14727 *)      getprotoent_r_proto=0
14728         ;;
14729 esac
14730
14731 : see if prototypes for various getprotoxxx netdb.h functions are available
14732 echo " "
14733 set d_getprotoprotos getprotoent $i_netdb netdb.h
14734 eval $hasproto
14735
14736 : see if getprpwnam exists
14737 set getprpwnam d_getprpwnam
14738 eval $inlibc
14739
14740 : see if getpwent exists
14741 set getpwent d_getpwent
14742 eval $inlibc
14743
14744 : see if getpwent_r exists
14745 set getpwent_r d_getpwent_r
14746 eval $inlibc
14747 case "$d_getpwent_r" in
14748 "$define")
14749         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14750         case "$d_getpwent_r_proto:$usethreads" in
14751         ":define")      d_getpwent_r_proto=define
14752                 set d_getpwent_r_proto getpwent_r $hdrs
14753                 eval $hasproto ;;
14754         *)      ;;
14755         esac
14756         case "$d_getpwent_r_proto" in
14757         define)
14758         case "$getpwent_r_proto" in
14759         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14760         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14761         esac
14762         case "$getpwent_r_proto" in
14763         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14764         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14765         esac
14766         case "$getpwent_r_proto" in
14767         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14768         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14769         esac
14770         case "$getpwent_r_proto" in
14771         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14772         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14773         esac
14774         case "$getpwent_r_proto" in
14775         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14776         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14777         esac
14778         case "$getpwent_r_proto" in
14779         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14780         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14781         esac
14782         case "$getpwent_r_proto" in
14783         ''|0)   d_getpwent_r=undef
14784                 getpwent_r_proto=0
14785                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14786         * )     case "$getpwent_r_proto" in
14787                 REENTRANT_PROTO*) ;;
14788                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14789                 esac
14790                 echo "Prototype: $try" ;;
14791         esac
14792         ;;
14793         *)      case "$usethreads" in
14794                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14795                 esac
14796                 d_getpwent_r=undef
14797                 getpwent_r_proto=0
14798                 ;;
14799         esac
14800         ;;
14801 *)      getpwent_r_proto=0
14802         ;;
14803 esac
14804
14805 : see if getpwnam_r exists
14806 set getpwnam_r d_getpwnam_r
14807 eval $inlibc
14808 case "$d_getpwnam_r" in
14809 "$define")
14810         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14811         case "$d_getpwnam_r_proto:$usethreads" in
14812         ":define")      d_getpwnam_r_proto=define
14813                 set d_getpwnam_r_proto getpwnam_r $hdrs
14814                 eval $hasproto ;;
14815         *)      ;;
14816         esac
14817         case "$d_getpwnam_r_proto" in
14818         define)
14819         case "$getpwnam_r_proto" in
14820         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14821         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14822         esac
14823         case "$getpwnam_r_proto" in
14824         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14825         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14826         esac
14827         case "$getpwnam_r_proto" in
14828         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14829         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14830         esac
14831         case "$getpwnam_r_proto" in
14832         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14833         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14834         esac
14835         case "$getpwnam_r_proto" in
14836         ''|0)   d_getpwnam_r=undef
14837                 getpwnam_r_proto=0
14838                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14839         * )     case "$getpwnam_r_proto" in
14840                 REENTRANT_PROTO*) ;;
14841                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14842                 esac
14843                 echo "Prototype: $try" ;;
14844         esac
14845         ;;
14846         *)      case "$usethreads" in
14847                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14848                 esac
14849                 d_getpwnam_r=undef
14850                 getpwnam_r_proto=0
14851                 ;;
14852         esac
14853         ;;
14854 *)      getpwnam_r_proto=0
14855         ;;
14856 esac
14857
14858 : see if getpwuid_r exists
14859 set getpwuid_r d_getpwuid_r
14860 eval $inlibc
14861 case "$d_getpwuid_r" in
14862 "$define")
14863         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14864         case "$d_getpwuid_r_proto:$usethreads" in
14865         ":define")      d_getpwuid_r_proto=define
14866                 set d_getpwuid_r_proto getpwuid_r $hdrs
14867                 eval $hasproto ;;
14868         *)      ;;
14869         esac
14870         case "$d_getpwuid_r_proto" in
14871         define)
14872         case "$getpwuid_r_proto" in
14873         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14874         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14875         esac
14876         case "$getpwuid_r_proto" in
14877         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14878         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14879         esac
14880         case "$getpwuid_r_proto" in
14881         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14882         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14883         esac
14884         case "$getpwuid_r_proto" in
14885         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14886         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14887         esac
14888         case "$getpwuid_r_proto" in
14889         ''|0)   d_getpwuid_r=undef
14890                 getpwuid_r_proto=0
14891                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14892         * )     case "$getpwuid_r_proto" in
14893                 REENTRANT_PROTO*) ;;
14894                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14895                 esac
14896                 echo "Prototype: $try" ;;
14897         esac
14898         ;;
14899         *)      case "$usethreads" in
14900                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14901                 esac
14902                 d_getpwuid_r=undef
14903                 getpwuid_r_proto=0
14904                 ;;
14905         esac
14906         ;;
14907 *)      getpwuid_r_proto=0
14908         ;;
14909 esac
14910
14911 : Optional checks for getsbyname and getsbyport
14912
14913 : see if getservbyname exists
14914 set getservbyname d_getsbyname
14915 eval $inlibc
14916
14917 : see if getservbyport exists
14918 set getservbyport d_getsbyport
14919 eval $inlibc
14920
14921 : see if getservent exists
14922 set getservent d_getsent
14923 eval $inlibc
14924
14925 : see if getservbyname_r exists
14926 set getservbyname_r d_getservbyname_r
14927 eval $inlibc
14928 case "$d_getservbyname_r" in
14929 "$define")
14930         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14931         case "$d_getservbyname_r_proto:$usethreads" in
14932         ":define")      d_getservbyname_r_proto=define
14933                 set d_getservbyname_r_proto getservbyname_r $hdrs
14934                 eval $hasproto ;;
14935         *)      ;;
14936         esac
14937         case "$d_getservbyname_r_proto" in
14938         define)
14939         case "$getservbyname_r_proto" in
14940         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14941         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14942         esac
14943         case "$getservbyname_r_proto" in
14944         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14945         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14946         esac
14947         case "$getservbyname_r_proto" in
14948         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14949         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14950         esac
14951         case "$getservbyname_r_proto" in
14952         ''|0)   d_getservbyname_r=undef
14953                 getservbyname_r_proto=0
14954                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14955         * )     case "$getservbyname_r_proto" in
14956                 REENTRANT_PROTO*) ;;
14957                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14958                 esac
14959                 echo "Prototype: $try" ;;
14960         esac
14961         ;;
14962         *)      case "$usethreads" in
14963                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14964                 esac
14965                 d_getservbyname_r=undef
14966                 getservbyname_r_proto=0
14967                 ;;
14968         esac
14969         ;;
14970 *)      getservbyname_r_proto=0
14971         ;;
14972 esac
14973
14974 : see if getservbyport_r exists
14975 set getservbyport_r d_getservbyport_r
14976 eval $inlibc
14977 case "$d_getservbyport_r" in
14978 "$define")
14979         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14980         case "$d_getservbyport_r_proto:$usethreads" in
14981         ":define")      d_getservbyport_r_proto=define
14982                 set d_getservbyport_r_proto getservbyport_r $hdrs
14983                 eval $hasproto ;;
14984         *)      ;;
14985         esac
14986         case "$d_getservbyport_r_proto" in
14987         define)
14988         case "$getservbyport_r_proto" in
14989         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14990         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14991         esac
14992         case "$getservbyport_r_proto" in
14993         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14994         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14995         esac
14996         case "$getservbyport_r_proto" in
14997         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14998         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14999         esac
15000         case "$getservbyport_r_proto" in
15001         ''|0)   d_getservbyport_r=undef
15002                 getservbyport_r_proto=0
15003                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15004         * )     case "$getservbyport_r_proto" in
15005                 REENTRANT_PROTO*) ;;
15006                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15007                 esac
15008                 echo "Prototype: $try" ;;
15009         esac
15010         ;;
15011         *)      case "$usethreads" in
15012                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15013                 esac
15014                 d_getservbyport_r=undef
15015                 getservbyport_r_proto=0
15016                 ;;
15017         esac
15018         ;;
15019 *)      getservbyport_r_proto=0
15020         ;;
15021 esac
15022
15023 : see if getservent_r exists
15024 set getservent_r d_getservent_r
15025 eval $inlibc
15026 case "$d_getservent_r" in
15027 "$define")
15028         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15029         case "$d_getservent_r_proto:$usethreads" in
15030         ":define")      d_getservent_r_proto=define
15031                 set d_getservent_r_proto getservent_r $hdrs
15032                 eval $hasproto ;;
15033         *)      ;;
15034         esac
15035         case "$d_getservent_r_proto" in
15036         define)
15037         case "$getservent_r_proto" in
15038         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15039         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15040         esac
15041         case "$getservent_r_proto" in
15042         ''|0) try='int getservent_r(struct servent*, char*, int);'
15043         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15044         esac
15045         case "$getservent_r_proto" in
15046         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15047         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15048         esac
15049         case "$getservent_r_proto" in
15050         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15051         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15052         esac
15053         case "$getservent_r_proto" in
15054         ''|0)   d_getservent_r=undef
15055                 getservent_r_proto=0
15056                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15057         * )     case "$getservent_r_proto" in
15058                 REENTRANT_PROTO*) ;;
15059                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15060                 esac
15061                 echo "Prototype: $try" ;;
15062         esac
15063         ;;
15064         *)      case "$usethreads" in
15065                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15066                 esac
15067                 d_getservent_r=undef
15068                 getservent_r_proto=0
15069                 ;;
15070         esac
15071         ;;
15072 *)      getservent_r_proto=0
15073         ;;
15074 esac
15075
15076 : see if prototypes for various getservxxx netdb.h functions are available
15077 echo " "
15078 set d_getservprotos getservent $i_netdb netdb.h
15079 eval $hasproto
15080
15081 : see if getspnam exists
15082 set getspnam d_getspnam
15083 eval $inlibc
15084
15085 : see if this is a shadow.h system
15086 set shadow.h i_shadow
15087 eval $inhdr
15088
15089 : see if getspnam_r exists
15090 set getspnam_r d_getspnam_r
15091 eval $inlibc
15092 case "$d_getspnam_r" in
15093 "$define")
15094         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15095         case "$d_getspnam_r_proto:$usethreads" in
15096         ":define")      d_getspnam_r_proto=define
15097                 set d_getspnam_r_proto getspnam_r $hdrs
15098                 eval $hasproto ;;
15099         *)      ;;
15100         esac
15101         case "$d_getspnam_r_proto" in
15102         define)
15103         case "$getspnam_r_proto" in
15104         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15105         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15106         esac
15107         case "$getspnam_r_proto" in
15108         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15109         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15110         esac
15111         case "$getspnam_r_proto" in
15112         ''|0)   d_getspnam_r=undef
15113                 getspnam_r_proto=0
15114                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15115         * )     case "$getspnam_r_proto" in
15116                 REENTRANT_PROTO*) ;;
15117                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15118                 esac
15119                 echo "Prototype: $try" ;;
15120         esac
15121         ;;
15122         *)      case "$usethreads" in
15123                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15124                 esac
15125                 d_getspnam_r=undef
15126                 getspnam_r_proto=0
15127                 ;;
15128         esac
15129         ;;
15130 *)      getspnam_r_proto=0
15131         ;;
15132 esac
15133
15134 : see if gettimeofday or ftime exists
15135 set gettimeofday d_gettimeod
15136 eval $inlibc
15137 case "$d_gettimeod" in
15138 "$undef")
15139         set ftime d_ftime 
15140         eval $inlibc
15141         ;;
15142 *)
15143         val="$undef"; set d_ftime; eval $setvar
15144         ;;
15145 esac
15146 case "$d_gettimeod$d_ftime" in
15147 "$undef$undef")
15148         echo " "
15149         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15150         ;;
15151 esac
15152
15153 : see if gmtime_r exists
15154 set gmtime_r d_gmtime_r
15155 eval $inlibc
15156 case "$d_gmtime_r" in
15157 "$define")
15158         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15159         case "$d_gmtime_r_proto:$usethreads" in
15160         ":define")      d_gmtime_r_proto=define
15161                 set d_gmtime_r_proto gmtime_r $hdrs
15162                 eval $hasproto ;;
15163         *)      ;;
15164         esac
15165         case "$d_gmtime_r_proto" in
15166         define)
15167         case "$gmtime_r_proto" in
15168         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15169         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15170         esac
15171         case "$gmtime_r_proto" in
15172         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15173         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15174         esac
15175         case "$gmtime_r_proto" in
15176         ''|0)   d_gmtime_r=undef
15177                 gmtime_r_proto=0
15178                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15179         * )     case "$gmtime_r_proto" in
15180                 REENTRANT_PROTO*) ;;
15181                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15182                 esac
15183                 echo "Prototype: $try" ;;
15184         esac
15185         ;;
15186         *)      case "$usethreads" in
15187                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15188                 esac
15189                 d_gmtime_r=undef
15190                 gmtime_r_proto=0
15191                 ;;
15192         esac
15193         ;;
15194 *)      gmtime_r_proto=0
15195         ;;
15196 esac
15197
15198 : see if hasmntopt exists
15199 set hasmntopt d_hasmntopt
15200 eval $inlibc
15201
15202 : see if this is a netinet/in.h or sys/in.h system
15203 set netinet/in.h i_niin sys/in.h i_sysin
15204 eval $inhdr
15205
15206 : see if arpa/inet.h has to be included
15207 set arpa/inet.h i_arpainet
15208 eval $inhdr
15209
15210 : see if htonl --and friends-- exists
15211 val=''
15212 set htonl val
15213 eval $inlibc
15214
15215 : Maybe they are macros.
15216 case "$val" in
15217 $undef)
15218         $cat >htonl.c <<EOM
15219 #include <stdio.h>
15220 #include <sys/types.h>
15221 #$i_niin I_NETINET_IN
15222 #$i_sysin I_SYS_IN
15223 #$i_arpainet I_ARPA_INET
15224 #ifdef I_NETINET_IN
15225 #include <netinet/in.h>
15226 #endif
15227 #ifdef I_SYS_IN
15228 #include <sys/in.h>
15229 #endif
15230 #ifdef I_ARPA_INET
15231 #include <arpa/inet.h>
15232 #endif
15233 #ifdef htonl
15234 printf("Defined as a macro.");
15235 #endif
15236 EOM
15237         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15238         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15239                 val="$define"
15240                 echo "But it seems to be defined as a macro." >&4
15241         fi
15242         $rm -f htonl.?
15243         ;;
15244 esac
15245 set d_htonl
15246 eval $setvar
15247
15248 : see if ilogbl exists
15249 set ilogbl d_ilogbl
15250 eval $inlibc
15251
15252 : index or strchr
15253 echo " "
15254 if set index val -f; eval $csym; $val; then
15255         if set strchr val -f d_strchr; eval $csym; $val; then
15256                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15257                         val="$define"
15258                         vali="$undef"
15259                         echo "strchr() found." >&4
15260                 else
15261                         val="$undef"
15262                         vali="$define"
15263                         echo "index() found." >&4
15264                 fi
15265         else
15266                 val="$undef"
15267                 vali="$define"
15268                 echo "index() found." >&4
15269         fi
15270 else
15271         if set strchr val -f d_strchr; eval $csym; $val; then
15272                 val="$define"
15273                 vali="$undef"
15274                 echo "strchr() found." >&4
15275         else
15276                 echo "No index() or strchr() found!" >&4
15277                 val="$undef"
15278                 vali="$undef"
15279         fi
15280 fi
15281 set d_strchr; eval $setvar
15282 val="$vali"
15283 set d_index; eval $setvar
15284
15285 : check whether inet_aton exists
15286 set inet_aton d_inetaton
15287 eval $inlibc
15288
15289 : see if inet_ntop exists
15290 set inet_ntop d_inetntop
15291 eval $inlibc
15292
15293 : see if inet_pton exists
15294 set inet_pton d_inetpton
15295 eval $inlibc
15296
15297 : Look for isascii
15298 echo " "
15299 $cat >isascii.c <<EOCP
15300 #include <stdio.h>
15301 #include <ctype.h>
15302 #$i_stdlib I_STDLIB
15303 #ifdef I_STDLIB
15304 #include <stdlib.h>
15305 #endif
15306 int main() {
15307         int c = 'A';
15308         if (isascii(c))
15309                 exit(0);
15310         else
15311                 exit(1);
15312 }
15313 EOCP
15314 set isascii
15315 if eval $compile; then
15316         echo "isascii() found." >&4
15317         val="$define"
15318 else
15319         echo "isascii() NOT found." >&4
15320         val="$undef"
15321 fi
15322 set d_isascii
15323 eval $setvar
15324 $rm -f isascii*
15325
15326 : Look for isblank
15327 echo " "
15328 $cat >isblank.c <<'EOCP'
15329 #include <stdio.h>
15330 #include <ctype.h>
15331 int main() {
15332         int c = ' ';
15333         if (isblank(c))
15334                 return 0 ;
15335         else
15336                 return 1 ;
15337 }
15338 EOCP
15339 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15340         echo "isblank() found." >&4
15341         val="$define"
15342 else
15343         echo "isblank() NOT found." >&4
15344         val="$undef"
15345 fi
15346 set d_isblank
15347 eval $setvar
15348 $rm -f isblank*
15349
15350 : see if isfinite exists
15351 set isfinite d_isfinite
15352 eval $inlibc
15353
15354 : see if isinf exists
15355 set isinf d_isinf
15356 eval $inlibc
15357
15358 : see if isnan exists
15359 set isnan d_isnan
15360 eval $inlibc
15361
15362 : see if isnanl exists
15363 set isnanl d_isnanl
15364 eval $inlibc
15365
15366 : see if killpg exists
15367 set killpg d_killpg
15368 eval $inlibc
15369
15370 : see if lchown exists
15371 echo " "
15372 $cat > try.c <<'EOCP'
15373 /* System header to define __stub macros and hopefully few prototypes,
15374     which can conflict with char lchown(); below.  */
15375 #include <assert.h>
15376 /* Override any gcc2 internal prototype to avoid an error.  */
15377 /* We use char because int might match the return type of a gcc2
15378    builtin and then its argument prototype would still apply.  */
15379 char lchown();
15380 int main() {
15381     /*  The GNU C library defines this for functions which it implements
15382         to always fail with ENOSYS.  Some functions are actually named
15383         something starting with __ and the normal name is an alias.  */
15384 #if defined (__stub_lchown) || defined (__stub___lchown)
15385 choke me
15386 #else
15387 lchown();
15388 #endif
15389 ; return 0; }
15390 EOCP
15391 set try
15392 if eval $compile; then
15393     $echo "lchown() found." >&4
15394     val="$define"
15395 else
15396     $echo "lchown() NOT found." >&4
15397     val="$undef"
15398 fi
15399 set d_lchown
15400 eval $setvar
15401
15402 : See if number of significant digits in a double precision number is known
15403 echo " "
15404 $cat >ldbl_dig.c <<EOM
15405 #$i_limits I_LIMITS
15406 #$i_float I_FLOAT
15407 #ifdef I_LIMITS
15408 #include <limits.h>
15409 #endif
15410 #ifdef I_FLOAT
15411 #include <float.h>
15412 #endif
15413 #ifdef LDBL_DIG
15414 printf("Contains LDBL_DIG");
15415 #endif
15416 EOM
15417 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15418 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15419         echo "LDBL_DIG found." >&4
15420         val="$define"
15421 else
15422         echo "LDBL_DIG NOT found." >&4
15423         val="$undef"
15424 fi
15425 $rm -f ldbl_dig.?
15426 set d_ldbl_dig
15427 eval $setvar
15428
15429 : see if this is a math.h system
15430 set math.h i_math
15431 eval $inhdr
15432
15433 : check to see if math.h defines _LIB_VERSION
15434 d_libm_lib_version="$undef"
15435 case $i_math in
15436     $define)
15437         echo " "
15438         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15439         $cat >try.c <<EOCP
15440 #include <unistd.h>
15441 #include <math.h>
15442 int main (int argc, char *argv[])
15443 {
15444     printf ("%d\n", _LIB_VERSION);
15445     return (0);
15446     } /* main */
15447 EOCP
15448         set try
15449         if eval $compile; then
15450             foo=`$run ./try`
15451             echo "Yes, it does ($foo)" >&4
15452             d_libm_lib_version="$define"
15453         else
15454             echo "No, it does not (probably harmless)" >&4
15455             fi
15456         $rm_try
15457         ;;
15458
15459     esac
15460
15461 : see if link exists
15462 set link d_link
15463 eval $inlibc
15464
15465 : see if localtime_r exists
15466 set localtime_r d_localtime_r
15467 eval $inlibc
15468 case "$d_localtime_r" in
15469 "$define")
15470         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15471         case "$d_localtime_r_proto:$usethreads" in
15472         ":define")      d_localtime_r_proto=define
15473                 set d_localtime_r_proto localtime_r $hdrs
15474                 eval $hasproto ;;
15475         *)      ;;
15476         esac
15477         case "$d_localtime_r_proto" in
15478         define)
15479         case "$localtime_r_proto" in
15480         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15481         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15482         esac
15483         case "$localtime_r_proto" in
15484         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15485         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15486         esac
15487         case "$localtime_r_proto" in
15488         ''|0)   d_localtime_r=undef
15489                 localtime_r_proto=0
15490                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15491         * )     case "$localtime_r_proto" in
15492                 REENTRANT_PROTO*) ;;
15493                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15494                 esac
15495                 echo "Prototype: $try" ;;
15496         esac
15497         ;;
15498         *)      case "$usethreads" in
15499                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15500                 esac
15501                 d_localtime_r=undef
15502                 localtime_r_proto=0
15503                 ;;
15504         esac
15505         ;;
15506 *)      localtime_r_proto=0
15507         ;;
15508 esac
15509
15510 : see if localtime_r calls tzset
15511 case "$localtime_r_proto" in
15512 REENTRANT_PROTO*)
15513         $cat >try.c <<EOCP
15514 /*  Does our libc's localtime_r call tzset ?
15515  *  return 0 if so, 1 otherwise.
15516  */
15517 #$i_systypes    I_SYS_TYPES
15518 #$i_unistd      I_UNISTD
15519 #$i_time        I_TIME
15520 #$i_stdlib      I_STDLIB
15521 #$i_string      I_STRING
15522 #$i_malloc      I_MALLOC
15523 #ifdef I_SYS_TYPES
15524 #  include <sys/types.h>
15525 #endif
15526 #ifdef I_UNISTD
15527 #  include <unistd.h>
15528 #endif
15529 #ifdef I_TIME
15530 #  include <time.h>
15531 #endif
15532 #ifdef I_STDLIB
15533 #include <stdlib.h>
15534 #endif
15535 #ifdef I_STRING
15536 #  include <string.h>
15537 #else
15538 #  include <strings.h>
15539 #endif
15540 #ifdef I_MALLOC
15541 #  include <malloc.h>
15542 #endif
15543 int main()
15544 {
15545     time_t t = time(0L);
15546     char w_tz[]="TZ" "=GMT+5",
15547          e_tz[]="TZ" "=GMT-5",
15548         *tz_e = (char*)malloc(16),
15549         *tz_w = (char*)malloc(16);
15550     struct tm tm_e, tm_w;
15551     memset(&tm_e,'\0',sizeof(struct tm));
15552     memset(&tm_w,'\0',sizeof(struct tm));
15553     strcpy(tz_e,e_tz);
15554     strcpy(tz_w,w_tz);
15555
15556     putenv(tz_e);
15557     localtime_r(&t, &tm_e);
15558
15559     putenv(tz_w);
15560     localtime_r(&t, &tm_w);
15561
15562     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15563         return 1;
15564     return 0;
15565 }
15566 EOCP
15567         set try
15568         if eval $compile; then
15569             if $run ./try; then
15570                 d_localtime_r_needs_tzset=undef;
15571             else
15572                 d_localtime_r_needs_tzset=define;
15573             fi;
15574         else
15575             d_localtime_r_needs_tzset=undef;
15576         fi;
15577      ;;
15578   *)
15579      d_localtime_r_needs_tzset=undef;
15580      ;;
15581 esac
15582 $rm_try
15583
15584 : see if localeconv exists
15585 set localeconv d_locconv
15586 eval $inlibc
15587
15588 : see if lockf exists
15589 set lockf d_lockf
15590 eval $inlibc
15591
15592 : see if prototype for lseek is available
15593 echo " "
15594 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15595 eval $hasproto
15596
15597 : see if lstat exists
15598 set lstat d_lstat
15599 eval $inlibc
15600
15601 : see if madvise exists
15602 set madvise d_madvise
15603 eval $inlibc
15604
15605 : see if malloc_size exists
15606 set malloc_size d_malloc_size
15607 eval $inlibc
15608
15609 : see if malloc_size_good exists
15610 set malloc_good_size d_malloc_good_size
15611 eval $inlibc
15612
15613 : see if mblen exists
15614 set mblen d_mblen
15615 eval $inlibc
15616
15617 : see if mbstowcs exists
15618 set mbstowcs d_mbstowcs
15619 eval $inlibc
15620
15621 : see if mbtowc exists
15622 set mbtowc d_mbtowc
15623 eval $inlibc
15624
15625 : see if memchr exists
15626 set memchr d_memchr
15627 eval $inlibc
15628
15629 : see if memcmp exists
15630 set memcmp d_memcmp
15631 eval $inlibc
15632
15633 : see if memcpy exists
15634 set memcpy d_memcpy
15635 eval $inlibc
15636
15637 : see if memmove exists
15638 set memmove d_memmove
15639 eval $inlibc
15640
15641 : see if memset exists
15642 set memset d_memset
15643 eval $inlibc
15644
15645 : see if mkdir exists
15646 set mkdir d_mkdir
15647 eval $inlibc
15648
15649 : see if mkdtemp exists
15650 set mkdtemp d_mkdtemp
15651 eval $inlibc
15652
15653 : see if mkfifo exists
15654 set mkfifo d_mkfifo
15655 eval $inlibc
15656
15657 : see if mkstemp exists
15658 set mkstemp d_mkstemp
15659 eval $inlibc
15660
15661 : see if mkstemps exists
15662 set mkstemps d_mkstemps
15663 eval $inlibc
15664
15665 : see if mktime exists
15666 set mktime d_mktime
15667 eval $inlibc
15668
15669 : see if this is a sys/mman.h system
15670 set sys/mman.h i_sysmman
15671 eval $inhdr
15672
15673 : see if mmap exists
15674 set mmap d_mmap
15675 eval $inlibc
15676 : see what shmat returns
15677 : default to something harmless
15678 mmaptype='void *'
15679 case "$i_sysmman$d_mmap" in
15680 "$define$define")
15681         $cat >mmap.c <<'END'
15682 #include <sys/mman.h>
15683 void *mmap();
15684 END
15685         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15686                 mmaptype='void *'
15687         else
15688                 mmaptype='caddr_t'
15689         fi
15690         echo "and it returns ($mmaptype)." >&4
15691         ;;
15692 esac
15693
15694
15695
15696 : see if sqrtl exists
15697 set sqrtl d_sqrtl
15698 eval $inlibc
15699
15700 : see if scalbnl exists
15701 set scalbnl d_scalbnl
15702 eval $inlibc
15703
15704 : see if modfl exists
15705 set modfl d_modfl
15706 eval $inlibc
15707
15708 : see if prototype for modfl is available
15709 echo " "
15710 set d_modflproto modfl $i_math math.h
15711 eval $hasproto
15712
15713 d_modfl_pow32_bug="$undef"
15714
15715 case "$d_longdbl$d_modfl" in
15716 $define$define)
15717         $cat <<EOM
15718 Checking to see whether your modfl() is okay for large values...
15719 EOM
15720 $cat >try.c <<EOCP
15721 #include <math.h>
15722 #include <stdio.h>
15723 EOCP
15724 if $test "X$d_modflproto" != "X$define"; then
15725         $cat >>try.c <<EOCP
15726 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15727 long double modfl (long double, long double *);
15728 EOCP
15729 fi
15730 $cat >>try.c <<EOCP
15731 int main() {
15732     long double nv = 4294967303.15;
15733     long double v, w;
15734     v = modfl(nv, &w);
15735 #ifdef __GLIBC__
15736     printf("glibc");
15737 #endif
15738     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15739     return 0;
15740 }
15741 EOCP
15742         case "$osname:$gccversion" in
15743         aix:)   saveccflags="$ccflags"
15744                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15745         esac
15746         set try
15747         if eval $compile; then
15748                 foo=`$run ./try`
15749                 case "$foo" in
15750                 *" 4294967303.150000 1.150000 4294967302.000000")
15751                         echo >&4 "Your modfl() is broken for large values."
15752                         d_modfl_pow32_bug="$define"
15753                         case "$foo" in
15754                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15755                         ;;
15756                         esac
15757                         ;;
15758                 *" 4294967303.150000 0.150000 4294967303.000000")
15759                         echo >&4 "Your modfl() seems okay for large values."
15760                         ;;
15761                 *)      echo >&4 "I don't understand your modfl() at all."
15762                         d_modfl="$undef"
15763                         ;;
15764                 esac
15765                 $rm_try
15766         else
15767                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15768                 d_modfl="$undef"
15769         fi
15770         case "$osname:$gccversion" in
15771         aix:)   ccflags="$saveccflags" ;; # restore
15772         esac
15773         ;;
15774 esac
15775
15776 if $test "$uselongdouble" = "$define"; then
15777     message=""
15778     if $test "$d_sqrtl" != "$define"; then
15779         message="$message sqrtl"
15780     fi
15781     if $test "$d_modfl" != "$define"; then
15782         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15783             echo "You have both aintl and copysignl, so I can emulate modfl."
15784         else
15785             message="$message modfl"
15786         fi
15787     fi
15788     if $test "$d_frexpl" != "$define"; then
15789         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15790             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15791         else
15792             message="$message frexpl"
15793         fi
15794     fi
15795
15796     if $test "$message" != ""; then
15797         $cat <<EOM >&4
15798
15799 *** You requested the use of long doubles but you do not seem to have
15800 *** the following mathematical functions needed for long double support:
15801 ***    $message
15802 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15803 *** Cannot continue, aborting.
15804
15805 EOM
15806
15807         exit 1
15808     fi
15809 fi
15810
15811 : see if mprotect exists
15812 set mprotect d_mprotect
15813 eval $inlibc
15814
15815 : see if msgctl exists
15816 set msgctl d_msgctl
15817 eval $inlibc
15818
15819 : see if msgget exists
15820 set msgget d_msgget
15821 eval $inlibc
15822
15823 : see if msgsnd exists
15824 set msgsnd d_msgsnd
15825 eval $inlibc
15826
15827 : see if msgrcv exists
15828 set msgrcv d_msgrcv
15829 eval $inlibc
15830
15831 : see how much of the 'msg*(2)' library is present.
15832 h_msg=true
15833 echo " "
15834 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15835 *"$undef"*) h_msg=false;;
15836 esac
15837 case "$osname" in
15838 freebsd)
15839     case "`ipcs 2>&1`" in
15840     "SVID messages"*"not configured"*)
15841         echo "Your $osname does not have the msg*(2) configured." >&4
15842         h_msg=false
15843         val="$undef"
15844         set msgctl d_msgctl
15845         eval $setvar
15846         set msgget d_msgget
15847         eval $setvar
15848         set msgsnd d_msgsnd
15849         eval $setvar
15850         set msgrcv d_msgrcv
15851         eval $setvar
15852         ;;
15853     esac
15854     ;;
15855 esac
15856 : we could also check for sys/ipc.h ...
15857 if $h_msg && $test `./findhdr sys/msg.h`; then
15858         echo "You have the full msg*(2) library." >&4
15859         val="$define"
15860 else
15861         echo "You don't have the full msg*(2) library." >&4
15862         val="$undef"
15863 fi
15864 set d_msg
15865 eval $setvar
15866
15867 : Check for msghdr_s
15868 echo " "
15869 echo "Checking to see if your system supports struct msghdr..." >&4
15870 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15871 eval $hasstruct
15872 case "$d_msghdr_s" in
15873 "$define")      echo "Yes, it does."   ;;
15874 *)              echo "No, it doesn't." ;;
15875 esac
15876
15877
15878 : see if msync exists
15879 set msync d_msync
15880 eval $inlibc
15881
15882 : see if munmap exists
15883 set munmap d_munmap
15884 eval $inlibc
15885
15886 : see if nice exists
15887 set nice d_nice
15888 eval $inlibc
15889
15890 : see if this is a langinfo.h system
15891 set langinfo.h i_langinfo
15892 eval $inhdr
15893
15894 : see if nl_langinfo exists
15895 set nl_langinfo d_nl_langinfo
15896 eval $inlibc
15897
15898 : check for volatile keyword
15899 echo " "
15900 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15901 $cat >try.c <<'EOCP'
15902 int main()
15903 {
15904         typedef struct _goo_struct goo_struct;
15905         goo_struct * volatile goo = ((goo_struct *)0);
15906         struct _goo_struct {
15907                 long long_int;
15908                 int reg_int;
15909                 char char_var;
15910         };
15911         typedef unsigned short foo_t;
15912         char *volatile foo;
15913         volatile int bar;
15914         volatile foo_t blech;
15915         foo = foo;
15916 }
15917 EOCP
15918 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15919         val="$define"
15920         echo "Yup, it does."
15921 else
15922         val="$undef"
15923         echo "Nope, it doesn't."
15924 fi
15925 set d_volatile
15926 eval $setvar
15927 $rm_try
15928
15929 : Check basic sizes
15930 echo " "
15931 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15932
15933 case "$use64bitint:$d_quad:$quadtype" in
15934 define:define:?*)
15935         ivtype="$quadtype"
15936         uvtype="$uquadtype"
15937         ivsize=8
15938         uvsize=8
15939         ;;
15940 *)      ivtype="long"
15941         uvtype="unsigned long"
15942         ivsize=$longsize
15943         uvsize=$longsize
15944         ;;
15945 esac
15946
15947 case "$uselongdouble:$d_longdbl" in
15948 define:define)
15949         nvtype="long double"
15950         nvsize=$longdblsize
15951         ;;
15952 *)      nvtype=double
15953         nvsize=$doublesize
15954         ;;
15955 esac
15956
15957 $echo "(IV will be "$ivtype", $ivsize bytes)"
15958 $echo "(UV will be "$uvtype", $uvsize bytes)"
15959 $echo "(NV will be "$nvtype", $nvsize bytes)"
15960
15961 $cat >try.c <<EOCP
15962 #$i_inttypes I_INTTYPES
15963 #ifdef I_INTTYPES
15964 #include <inttypes.h>
15965 #endif
15966 #include <stdio.h>
15967 int main() {
15968 #ifdef INT8
15969    int8_t i =  INT8_MAX;
15970   uint8_t u = UINT8_MAX;
15971   printf("int8_t\n");
15972 #endif
15973 #ifdef INT16
15974    int16_t i =  INT16_MAX;
15975   uint16_t u = UINT16_MAX;
15976   printf("int16_t\n");
15977 #endif
15978 #ifdef INT32
15979    int32_t i =  INT32_MAX;
15980   uint32_t u = UINT32_MAX;
15981   printf("int32_t\n");
15982 #endif
15983 }
15984 EOCP
15985
15986 i8type="signed char"
15987 u8type="unsigned char"
15988 i8size=1
15989 u8size=1
15990
15991 case "$i16type" in
15992 '')     case "$shortsize" in
15993         2)      i16type=short
15994                 u16type="unsigned short"
15995                 i16size=$shortsize
15996                 u16size=$shortsize
15997                 ;;
15998         esac
15999         ;;
16000 esac
16001 case "$i16type" in
16002 '')     set try -DINT16
16003         if eval $compile; then
16004                 case "`$run ./try`" in
16005                 int16_t)
16006                         i16type=int16_t
16007                         u16type=uint16_t
16008                         i16size=2
16009                         u16size=2
16010                         ;;
16011                 esac
16012         fi
16013         ;;
16014 esac
16015 case "$i16type" in
16016 '')     if $test $shortsize -ge 2; then
16017                 i16type=short
16018                 u16type="unsigned short"
16019                 i16size=$shortsize
16020                 u16size=$shortsize
16021         fi
16022         ;;
16023 esac
16024
16025 case "$i32type" in
16026 '')     case "$longsize" in
16027         4)      i32type=long
16028                 u32type="unsigned long"
16029                 i32size=$longsize
16030                 u32size=$longsize
16031                 ;;
16032         *)      case "$intsize" in
16033                 4)      i32type=int
16034                         u32type="unsigned int"
16035                         i32size=$intsize
16036                         u32size=$intsize
16037                         ;;
16038                 esac
16039                 ;;
16040         esac
16041         ;;
16042 esac
16043 case "$i32type" in
16044 '')     set try -DINT32
16045         if eval $compile; then
16046                 case "`$run ./try`" in
16047                 int32_t)
16048                         i32type=int32_t
16049                         u32type=uint32_t
16050                         i32size=4
16051                         u32size=4
16052                         ;;
16053                 esac
16054         fi
16055         ;;
16056 esac
16057 case "$i32type" in
16058 '')     if $test $intsize -ge 4; then
16059                 i32type=int
16060                 u32type="unsigned int"
16061                 i32size=$intsize
16062                 u32size=$intsize
16063         fi
16064         ;;
16065 esac
16066
16067 case "$i64type" in
16068 '')     case "$d_quad:$quadtype" in
16069         define:?*)
16070                 i64type="$quadtype"
16071                 u64type="$uquadtype"
16072                 i64size=8
16073                 u64size=8
16074                 ;;
16075         esac
16076         ;;
16077 esac
16078
16079 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16080 : volatile so that the compiler has to store it out to memory.
16081 if test X"$d_volatile" = X"$define"; then
16082         volatile=volatile
16083 fi
16084 $cat <<EOP >try.c
16085 #include <stdio.h>
16086 #$i_stdlib I_STDLIB
16087 #ifdef I_STDLIB
16088 #include <stdlib.h>
16089 #endif
16090 #include <sys/types.h>
16091 #include <signal.h>
16092 #ifdef SIGFPE
16093 $volatile int bletched = 0;
16094 $signal_t blech(int s) { bletched = 1; }
16095 #endif
16096 int main() {
16097     $uvtype u = 0;
16098     $nvtype d;
16099     int     n = 8 * $uvsize;
16100     int     i;
16101 #ifdef SIGFPE
16102     signal(SIGFPE, blech);
16103 #endif
16104
16105     for (i = 0; i < n; i++) {
16106       u = u << 1 | ($uvtype)1;
16107       d = ($nvtype)u;
16108       if (($uvtype)d != u)
16109         break;
16110       if (d <= 0)
16111         break;
16112       d = ($nvtype)(u - 1);
16113       if (($uvtype)d != (u - 1))
16114         break;
16115 #ifdef SIGFPE
16116       if (bletched)
16117         break;
16118 #endif
16119     }
16120     printf("%d\n", ((i == n) ? -n : i));
16121     exit(0);
16122 }
16123 EOP
16124 set try
16125
16126 d_nv_preserves_uv="$undef"
16127 if eval $compile; then
16128         nv_preserves_uv_bits="`$run ./try`"
16129 fi
16130 case "$nv_preserves_uv_bits" in
16131 \-[1-9]*)
16132         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16133         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16134         d_nv_preserves_uv="$define"
16135         ;;
16136 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16137         d_nv_preserves_uv="$undef" ;;
16138 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16139         nv_preserves_uv_bits="0" ;;
16140 esac
16141 $rm_try
16142
16143 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16144 : volatile so that the compiler has to store it out to memory.
16145 if test X"$d_volatile" = X"$define"; then
16146         volatile=volatile
16147 fi
16148 $cat <<EOP >try.c
16149 #include <stdio.h>
16150
16151 typedef $nvtype NV;
16152
16153 int
16154 main() {
16155   NV value = 2;
16156   int count = 1;
16157
16158   while(count < 256) {
16159     $volatile NV up = value + 1.0;
16160     $volatile NV negated = -value;
16161     $volatile NV down = negated - 1.0;
16162     $volatile NV got_up = up - value;
16163     int up_good = got_up == 1.0;
16164     int got_down = down - negated;
16165     int down_good = got_down == -1.0;
16166
16167     if (down_good != up_good) {
16168       fprintf(stderr,
16169               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16170               up_good, (double) got_up, down_good, (double) got_down,
16171               count, (double) value);
16172       return 1;
16173     }
16174     if (!up_good) {
16175       while (1) {
16176         if (count > 8) {
16177           count -= 8;
16178           fputs("256.0", stdout);
16179         } else {
16180           count--;
16181           fputs("2.0", stdout);
16182         }
16183         if (!count) {
16184           puts("");
16185           return 0;
16186         }
16187         fputs("*", stdout);
16188       }
16189     }
16190     value *= 2;
16191     ++count;
16192   }
16193   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16194           count, (double) value);
16195   return 1;
16196 }
16197 EOP
16198 set try
16199
16200 nv_overflows_integers_at='0'
16201 if eval $compile; then
16202     xxx="`$run ./try`"
16203     case "$?" in
16204         0)
16205             case "$xxx" in
16206                 2*)  cat >&4 <<EOM
16207 The largest integer your NVs can preserve is equal to $xxx
16208 EOM
16209                     nv_overflows_integers_at="$xxx"
16210                     ;;
16211                 *)  cat >&4 <<EOM
16212 Cannot determine the largest integer value your NVs can hold, unexpected output
16213 '$xxx'
16214 EOM
16215                     ;;
16216             esac
16217             ;;
16218         *)  cat >&4 <<EOM
16219 Cannot determine the largest integer value your NVs can hold
16220 EOM
16221             ;;
16222     esac
16223 fi
16224 $rm_try
16225
16226 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16227 : volatile so that the compiler has to store it out to memory.
16228 if test X"$d_volatile" = X"$define"; then
16229         volatile=volatile
16230 fi
16231 $cat <<EOP >try.c
16232 #include <stdio.h>
16233 #$i_stdlib I_STDLIB
16234 #ifdef I_STDLIB
16235 #include <stdlib.h>
16236 #endif
16237 #$i_string I_STRING
16238 #ifdef I_STRING
16239 #  include <string.h>
16240 #else
16241 #  include <strings.h>
16242 #endif
16243 #include <sys/types.h>
16244 #include <signal.h>
16245 #ifdef SIGFPE
16246 $volatile int bletched = 0;
16247 $signal_t blech(int s) { bletched = 1; }
16248 #endif
16249
16250 int checkit($nvtype d, char *where) {
16251     unsigned char *p = (char *)&d;
16252     unsigned char *end = p + sizeof(d);
16253     int fail = 0;
16254
16255     while (p < end)
16256         fail += *p++;
16257
16258     if (!fail)
16259         return 0;
16260
16261     p = (char *)&d;
16262     printf("No - %s: 0x", where);
16263     while (p < end)
16264         printf ("%02X", *p++);
16265     printf("\n");
16266     return 1;
16267 }
16268
16269 int main(int argc, char **argv) {
16270     $nvtype d = 0.0;
16271     int fail = 0;
16272     fail += checkit(d, "0.0");
16273
16274     /* The compiler shouldn't be assuming that bletched is 0  */
16275     d = bletched;
16276
16277     fail += checkit(d, "bleched");
16278
16279 #ifdef SIGFPE
16280     signal(SIGFPE, blech);
16281 #endif
16282
16283     /* Paranoia - the compiler should have no way of knowing that ANSI says
16284        that argv[argc] will always be NULL.  Actually, if it did assume this it
16285        would be buggy, as this is C and main() can be called from elsewhere in
16286        the program.  */
16287     d = argv[argc] ? 1 : 0;
16288
16289     if (d) {
16290         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16291     }
16292
16293     fail += checkit(d, "ternary");
16294
16295     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16296
16297     if (d != 0.0) {
16298         printf("No - memset doesn't give 0.0\n");
16299         /* This might just blow up:  */
16300         printf("(gives %g)\n", d);
16301         return 1;
16302     }
16303
16304 #ifdef SIGFPE
16305     if (bletched) {
16306         printf("No - something bleched\n");
16307         return 1;
16308     }
16309 #endif
16310     if (fail) {
16311       printf("No - %d fail(s)\n", fail);
16312       return 1;
16313     }
16314     printf("Yes\n");
16315     return 0;
16316 }
16317 EOP
16318 set try
16319
16320 d_nv_zero_is_allbits_zero="$undef"
16321 if eval $compile; then
16322     xxx="`$run ./try`"
16323     case "$?" in
16324         0)
16325             case "$xxx" in
16326                 Yes)  cat >&4 <<EOM
16327 0.0 is represented as all bits zero in memory
16328 EOM
16329                     d_nv_zero_is_allbits_zero="$define"
16330                     ;;
16331                 *)  cat >&4 <<EOM
16332 0.0 is not represented as all bits zero in memory
16333 EOM
16334                     d_nv_zero_is_allbits_zero="$undef"
16335                     ;;
16336             esac
16337             ;;
16338         *)  cat >&4 <<EOM
16339 0.0 is not represented as all bits zero in memory
16340 EOM
16341             d_nv_zero_is_allbits_zero="$undef"
16342             ;;
16343     esac
16344 fi
16345 $rm_try
16346
16347 : check for off64_t
16348 echo " "
16349 echo "Checking to see if you have off64_t..." >&4
16350 $cat >try.c <<EOCP
16351 #include <sys/types.h>
16352 #include <unistd.h>
16353 int main() { off64_t x = 7; }
16354 EOCP
16355 set try
16356 if eval $compile; then
16357         val="$define"
16358         echo "You have off64_t."
16359 else
16360         val="$undef"
16361         echo "You do not have off64_t."
16362         case "$lseeksize" in
16363         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16364         esac
16365 fi
16366 $rm_try
16367 set d_off64_t
16368 eval $setvar
16369
16370 : check for ptrdiff_t
16371 echo " "
16372 echo "Checking to see if you have ptrdiff_t..." >&4
16373 $cat >try.c <<EOCP
16374 #include <stddef.h>
16375 int main() { ptrdiff_t x = 7; }
16376 EOCP
16377 set try
16378 if eval $compile; then
16379         val="$define"
16380         echo "You have ptrdiff_t."
16381 else
16382         val="$undef"
16383         echo "You do not have ptrdiff_t."
16384 fi
16385 $rm_try
16386 set d_ptrdiff_t
16387 eval $setvar
16388
16389 : how to create joinable pthreads
16390 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16391         echo " "
16392         echo "Checking what constant to use for creating joinable pthreads..." >&4
16393         $cat >try.c <<'EOCP'
16394 #include <pthread.h>
16395 int main() {
16396     int detachstate = JOINABLE;
16397 }
16398 EOCP
16399         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16400         if eval $compile; then
16401                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16402                 val="$undef" # Yes, undef.
16403                 set d_old_pthread_create_joinable
16404                 eval $setvar
16405                 val=""
16406                 set old_pthread_create_joinable
16407                 eval $setvar
16408         else
16409                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16410                 if eval $compile; then
16411                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16412                         val="$define"
16413                         set d_old_pthread_create_joinable
16414                         eval $setvar
16415                         val=PTHREAD_CREATE_UNDETACHED
16416                         set old_pthread_create_joinable
16417                         eval $setvar
16418                 else
16419                         set try -DJOINABLE=__UNDETACHED
16420                         if eval $compile; then
16421                                 echo "You seem to use __UNDETACHED." >&4
16422                                 val="$define"
16423                                 set d_old_pthread_create_joinable
16424                                 eval $setvar
16425                                 val=__UNDETACHED
16426                                 set old_pthread_create_joinable
16427                                 eval $setvar
16428                         else
16429                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16430                                 val="$define"
16431                                 set d_old_pthread_create_joinable
16432                                 eval $setvar
16433                                 val=0
16434                                 set old_pthread_create_joinable
16435                                 eval $setvar
16436                         fi
16437                 fi
16438         fi
16439         $rm_try
16440 else
16441     d_old_pthread_create_joinable="$undef"
16442     old_pthread_create_joinable=""
16443 fi
16444
16445 : see if pause exists
16446 set pause d_pause
16447 eval $inlibc
16448
16449 : see if poll exists
16450 set poll d_poll
16451 eval $inlibc
16452
16453 : see if prctl exists
16454 set prctl d_prctl
16455 eval $inlibc
16456
16457 : see if prctl supports PR_SET_NAME
16458 d_prctl_set_name=$undef
16459 case $d_prctl in
16460     $define)
16461         $cat >try.c <<EOM
16462 #include <sys/prctl.h>
16463
16464 int main (int argc, char *argv[])
16465 {
16466     return (prctl (PR_SET_NAME, "Test"));
16467     } /* main */
16468 EOM
16469         set try
16470         if eval $compile_ok && $run ./try; then
16471             echo "Your prctl (PR_SET_NAME, ...) works"
16472             d_prctl_set_name=$define
16473             fi
16474         $rm_try
16475         ;;
16476     esac
16477
16478 : see if readlink exists
16479 set readlink d_readlink
16480 eval $inlibc
16481
16482 : Check if exe is symlink to abs path of executing program
16483 echo " "
16484 procselfexe=''
16485 val="$undef"
16486 case "$d_readlink" in
16487     "$define")
16488         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16489         : more tidy to avoid an extra level of symlink
16490         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16491         while test $# -gt 0; do
16492             type=$1; try=$2
16493             shift; shift
16494             if $issymlink $try; then
16495                 $ls -l $try > reflect
16496                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16497                     echo "You have $type-like $try."
16498                     procselfexe='"'$try'"'
16499                     val="$define"
16500                     : This will break out of the loop
16501                     set X; shift
16502                 fi
16503             fi
16504         done
16505         ;;
16506 esac
16507 $rm -f reflect
16508 set d_procselfexe
16509 eval $setvar
16510
16511 : backward compatibility for d_hvfork
16512 if test X$d_hvfork != X; then
16513         d_vfork="$d_hvfork"
16514         d_hvfork=''
16515 fi
16516 : see if there is a vfork
16517 val=''
16518 set vfork val
16519 eval $inlibc
16520
16521 d_pseudofork=$undef
16522
16523 : Ok, but do we want to use it. vfork is reportedly unreliable in
16524 : perl on Solaris 2.x, and probably elsewhere.
16525 case "$val" in
16526 $define)
16527         echo " "
16528         case "$usevfork" in
16529         false) dflt='n';;
16530         *) dflt='y';;
16531         esac
16532         cat <<'EOM'
16533
16534 Perl can only use a vfork() that doesn't suffer from strict
16535 restrictions on calling functions or modifying global data in
16536 the child.  For example, glibc-2.1 contains such a vfork()
16537 that is unsuitable.  If your system provides a proper fork()
16538 call, chances are that you do NOT want perl to use vfork().
16539
16540 EOM
16541         rp="Do you still want to use vfork()?"
16542         . ./myread
16543         case "$ans" in
16544         y|Y) ;;
16545         *)
16546                 echo "Ok, we won't use vfork()."
16547                 val="$undef"
16548                 ;;
16549         esac
16550         ;;
16551 esac
16552 set d_vfork
16553 eval $setvar
16554 case "$d_vfork" in
16555 $define) usevfork='true';;
16556 *) usevfork='false';;
16557 esac
16558
16559 : see whether the pthread_atfork exists
16560 $cat >try.c <<EOP
16561 #include <pthread.h>
16562 #include <stdio.h>
16563 int main() {
16564 #ifdef  PTHREAD_ATFORK
16565         pthread_atfork(NULL,NULL,NULL);
16566 #endif
16567 }
16568 EOP
16569
16570 : see if pthread_atfork exists
16571 set try -DPTHREAD_ATFORK
16572 if eval $compile; then
16573     val="$define"
16574 else
16575     val="$undef"
16576 fi
16577 case "$usethreads" in
16578 $define)
16579         case "$val" in
16580         $define) echo 'pthread_atfork found.' >&4        ;;
16581         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16582         esac
16583 esac
16584 set d_pthread_atfork
16585 eval $setvar
16586
16587 : see if pthread_attr_setscope exists
16588 set pthread_attr_setscope d_pthread_attr_setscope
16589 eval $inlibc
16590
16591 : see whether the various POSIXish _yields exist
16592 $cat >try.c <<EOP
16593 #include <pthread.h>
16594 #include <stdio.h>
16595 int main() {
16596 #ifdef SCHED_YIELD
16597         sched_yield();
16598 #else
16599 #ifdef PTHREAD_YIELD
16600         pthread_yield();
16601 #else
16602 #ifdef PTHREAD_YIELD_NULL
16603         pthread_yield(NULL);
16604 #endif
16605 #endif
16606 #endif
16607 }
16608 EOP
16609 : see if sched_yield exists
16610 set try -DSCHED_YIELD
16611 if eval $compile; then
16612     val="$define"
16613     sched_yield='sched_yield()'
16614 else
16615     val="$undef"
16616 fi
16617 case "$usethreads" in
16618 $define)
16619         case "$val" in
16620         $define) echo 'sched_yield() found.' >&4        ;;
16621         *)       echo 'sched_yield() NOT found.' >&4    ;;
16622         esac
16623 esac
16624 set d_sched_yield
16625 eval $setvar
16626
16627 : see if pthread_yield exists
16628 set try -DPTHREAD_YIELD
16629 if eval $compile; then
16630     val="$define"
16631     case "$sched_yield" in
16632     '') sched_yield='pthread_yield()' ;;
16633     esac
16634 else
16635     set try -DPTHREAD_YIELD_NULL
16636     if eval $compile; then
16637         val="$define"
16638         case "$sched_yield" in
16639         '') sched_yield='pthread_yield(NULL)' ;;
16640         esac
16641     else
16642         val="$undef"
16643     fi
16644 fi
16645 case "$usethreads" in
16646 $define)
16647         case "$val" in
16648         $define) echo 'pthread_yield() found.' >&4      ;;
16649         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16650         esac
16651         ;;
16652 esac
16653 set d_pthread_yield
16654 eval $setvar
16655 case "$sched_yield" in
16656 '') sched_yield=undef ;;
16657 esac
16658 $rm_try
16659
16660 : see if random_r exists
16661 set random_r d_random_r
16662 eval $inlibc
16663 case "$d_random_r" in
16664 "$define")
16665         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16666         case "$d_random_r_proto:$usethreads" in
16667         ":define")      d_random_r_proto=define
16668                 set d_random_r_proto random_r $hdrs
16669                 eval $hasproto ;;
16670         *)      ;;
16671         esac
16672         case "$d_random_r_proto" in
16673         define)
16674         case "$random_r_proto" in
16675         ''|0) try='int random_r(int*, struct random_data*);'
16676         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16677         esac
16678         case "$random_r_proto" in
16679         ''|0) try='int random_r(long*, struct random_data*);'
16680         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16681         esac
16682         case "$random_r_proto" in
16683         ''|0) try='int random_r(struct random_data*, int32_t*);'
16684         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16685         esac
16686         case "$random_r_proto" in
16687         ''|0)   d_random_r=undef
16688                 random_r_proto=0
16689                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16690         * )     case "$random_r_proto" in
16691                 REENTRANT_PROTO*) ;;
16692                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16693                 esac
16694                 echo "Prototype: $try" ;;
16695         esac
16696         ;;
16697         *)      case "$usethreads" in
16698                 define) echo "random_r has no prototype, not using it." >&4 ;;
16699                 esac
16700                 d_random_r=undef
16701                 random_r_proto=0
16702                 ;;
16703         esac
16704         ;;
16705 *)      random_r_proto=0
16706         ;;
16707 esac
16708
16709 : see if readdir and friends exist
16710 set readdir d_readdir
16711 eval $inlibc
16712 set seekdir d_seekdir
16713 eval $inlibc
16714 set telldir d_telldir
16715 eval $inlibc
16716 set rewinddir d_rewinddir
16717 eval $inlibc
16718
16719 : see if readdir64_r exists
16720 set readdir64_r d_readdir64_r
16721 eval $inlibc
16722 case "$d_readdir64_r" in
16723 "$define")
16724         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16725         case "$d_readdir64_r_proto:$usethreads" in
16726         ":define")      d_readdir64_r_proto=define
16727                 set d_readdir64_r_proto readdir64_r $hdrs
16728                 eval $hasproto ;;
16729         *)      ;;
16730         esac
16731         case "$d_readdir64_r_proto" in
16732         define)
16733         case "$readdir64_r_proto" in
16734         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16735         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16736         esac
16737         case "$readdir64_r_proto" in
16738         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16739         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16740         esac
16741         case "$readdir64_r_proto" in
16742         ''|0)   d_readdir64_r=undef
16743                 readdir64_r_proto=0
16744                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16745         * )     case "$readdir64_r_proto" in
16746                 REENTRANT_PROTO*) ;;
16747                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16748                 esac
16749                 echo "Prototype: $try" ;;
16750         esac
16751         ;;
16752         *)      case "$usethreads" in
16753                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16754                 esac
16755                 d_readdir64_r=undef
16756                 readdir64_r_proto=0
16757                 ;;
16758         esac
16759         ;;
16760 *)      readdir64_r_proto=0
16761         ;;
16762 esac
16763
16764 : see if readdir_r exists
16765 set readdir_r d_readdir_r
16766 eval $inlibc
16767 case "$d_readdir_r" in
16768 "$define")
16769         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16770         case "$d_readdir_r_proto:$usethreads" in
16771         ":define")      d_readdir_r_proto=define
16772                 set d_readdir_r_proto readdir_r $hdrs
16773                 eval $hasproto ;;
16774         *)      ;;
16775         esac
16776         case "$d_readdir_r_proto" in
16777         define)
16778         case "$readdir_r_proto" in
16779         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16780         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16781         esac
16782         case "$readdir_r_proto" in
16783         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16784         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16785         esac
16786         case "$readdir_r_proto" in
16787         ''|0)   d_readdir_r=undef
16788                 readdir_r_proto=0
16789                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16790         * )     case "$readdir_r_proto" in
16791                 REENTRANT_PROTO*) ;;
16792                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16793                 esac
16794                 echo "Prototype: $try" ;;
16795         esac
16796         ;;
16797         *)      case "$usethreads" in
16798                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16799                 esac
16800                 d_readdir_r=undef
16801                 readdir_r_proto=0
16802                 ;;
16803         esac
16804         ;;
16805 *)      readdir_r_proto=0
16806         ;;
16807 esac
16808
16809 : see if readv exists
16810 set readv d_readv
16811 eval $inlibc
16812
16813 : see if recvmsg exists
16814 set recvmsg d_recvmsg
16815 eval $inlibc
16816
16817 : see if rename exists
16818 set rename d_rename
16819 eval $inlibc
16820
16821 : see if rmdir exists
16822 set rmdir d_rmdir
16823 eval $inlibc
16824
16825 : see if memory.h is available.
16826 val=''
16827 set memory.h val
16828 eval $inhdr
16829
16830 : See if it conflicts with string.h
16831 case "$val" in
16832 $define)
16833         case "$strings" in
16834         '') ;;
16835         *)
16836                 $cppstdin $cppflags $cppminus < $strings > mem.h
16837                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16838                         echo " "
16839                         echo "We won't be including <memory.h>."
16840                         val="$undef"
16841                 fi
16842                 $rm -f mem.h
16843                 ;;
16844         esac
16845 esac
16846 set i_memory
16847 eval $setvar
16848
16849 : can bcopy handle overlapping blocks?
16850 echo " "
16851 val="$undef"
16852 case "$d_memmove" in
16853 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16854 *)      case "$d_bcopy" in
16855         "$define")
16856                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16857                 $cat >try.c <<EOCP
16858 #$i_memory I_MEMORY
16859 #$i_stdlib I_STDLIB
16860 #$i_string I_STRING
16861 #$i_unistd I_UNISTD
16862 EOCP
16863         $cat >>try.c <<'EOCP'
16864 #include <stdio.h>
16865 #ifdef I_MEMORY
16866 #  include <memory.h>
16867 #endif
16868 #ifdef I_STDLIB
16869 #  include <stdlib.h>
16870 #endif
16871 #ifdef I_STRING
16872 #  include <string.h>
16873 #else
16874 #  include <strings.h>
16875 #endif
16876 #ifdef I_UNISTD
16877 #  include <unistd.h>  /* Needed for NetBSD */
16878 #endif
16879 int main()
16880 {
16881 char buf[128], abc[128];
16882 char *b;
16883 int len;
16884 int off;
16885 int align;
16886
16887 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16888    try to store the string in read-only memory. */
16889 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16890
16891 for (align = 7; align >= 0; align--) {
16892         for (len = 36; len; len--) {
16893                 b = buf+align;
16894                 bcopy(abc, b, len);
16895                 for (off = 1; off <= len; off++) {
16896                         bcopy(b, b+off, len);
16897                         bcopy(b+off, b, len);
16898                         if (bcmp(b, abc, len))
16899                                 exit(1);
16900                 }
16901         }
16902 }
16903 exit(0);
16904 }
16905 EOCP
16906                 set try
16907                 if eval $compile_ok; then
16908                         if $run ./try 2>/dev/null; then
16909                                 echo "Yes, it can."
16910                                 val="$define"
16911                         else
16912                                 echo "It can't, sorry."
16913                         fi
16914                 else
16915                         echo "(I can't compile the test program, so we'll assume not...)"
16916                 fi
16917                 ;;
16918         esac
16919         $rm_try
16920         ;;
16921 esac
16922 set d_safebcpy
16923 eval $setvar
16924
16925 : can memcpy handle overlapping blocks?
16926 echo " "
16927 val="$undef"
16928 case "$d_memmove" in
16929 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16930 *)      case "$d_memcpy" in
16931         "$define")
16932                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16933                 $cat >try.c <<EOCP
16934 #$i_memory I_MEMORY
16935 #$i_stdlib I_STDLIB
16936 #$i_string I_STRING
16937 #$i_unistd I_UNISTD
16938 EOCP
16939         $cat >>try.c <<'EOCP'
16940 #include <stdio.h>
16941 #ifdef I_MEMORY
16942 #  include <memory.h>
16943 #endif
16944 #ifdef I_STDLIB
16945 #  include <stdlib.h>
16946 #endif
16947 #ifdef I_STRING
16948 #  include <string.h>
16949 #else
16950 #  include <strings.h>
16951 #endif
16952 #ifdef I_UNISTD
16953 #  include <unistd.h>  /* Needed for NetBSD */
16954 #endif
16955 int main()
16956 {
16957 char buf[128], abc[128];
16958 char *b;
16959 int len;
16960 int off;
16961 int align;
16962
16963 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16964    try to store the string in read-only memory. */
16965 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16966
16967 for (align = 7; align >= 0; align--) {
16968         for (len = 36; len; len--) {
16969                 b = buf+align;
16970                 memcpy(b, abc, len);
16971                 for (off = 1; off <= len; off++) {
16972                         memcpy(b+off, b, len);
16973                         memcpy(b, b+off, len);
16974                         if (memcmp(b, abc, len))
16975                                 exit(1);
16976                 }
16977         }
16978 }
16979 exit(0);
16980 }
16981 EOCP
16982                 set try
16983                 if eval $compile_ok; then
16984                         if $run ./try 2>/dev/null; then
16985                                 echo "Yes, it can."
16986                                 val="$define"
16987                         else
16988                                 echo "It can't, sorry."
16989                         fi
16990                 else
16991                         echo "(I can't compile the test program, so we'll assume not...)"
16992                 fi
16993                 ;;
16994         esac
16995         $rm_try
16996         ;;
16997 esac
16998 set d_safemcpy
16999 eval $setvar
17000
17001 : can memcmp be trusted to compare relative magnitude?
17002 val="$undef"
17003 case "$d_memcmp" in
17004 "$define")
17005         echo " "
17006         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17007         $cat >try.c <<EOCP
17008 #$i_memory I_MEMORY
17009 #$i_stdlib I_STDLIB
17010 #$i_string I_STRING
17011 #$i_unistd I_UNISTD
17012 EOCP
17013         $cat >>try.c <<'EOCP'
17014 #include <stdio.h>
17015 #ifdef I_MEMORY
17016 #  include <memory.h>
17017 #endif
17018 #ifdef I_STDLIB
17019 #  include <stdlib.h>
17020 #endif
17021 #ifdef I_STRING
17022 #  include <string.h>
17023 #else
17024 #  include <strings.h>
17025 #endif
17026 #ifdef I_UNISTD
17027 #  include <unistd.h>  /* Needed for NetBSD */
17028 #endif
17029 int main()
17030 {
17031 char a = -1;
17032 char b = 0;
17033 if ((a < b) && memcmp(&a, &b, 1) < 0)
17034         exit(1);
17035 exit(0);
17036 }
17037 EOCP
17038         set try
17039         if eval $compile_ok; then
17040                 if $run ./try 2>/dev/null; then
17041                         echo "Yes, it can."
17042                         val="$define"
17043                 else
17044                         echo "No, it can't (it uses signed chars)."
17045                 fi
17046         else
17047                 echo "(I can't compile the test program, so we'll assume not...)"
17048         fi
17049         ;;
17050 esac
17051 $rm_try
17052 set d_sanemcmp
17053 eval $setvar
17054
17055 : see if prototype for sbrk is available
17056 echo " "
17057 set d_sbrkproto sbrk $i_unistd unistd.h
17058 eval $hasproto
17059
17060 : see if select exists
17061 set select d_select
17062 eval $inlibc
17063
17064 : see if semctl exists
17065 set semctl d_semctl
17066 eval $inlibc
17067
17068 : see if semget exists
17069 set semget d_semget
17070 eval $inlibc
17071
17072 : see if semop exists
17073 set semop d_semop
17074 eval $inlibc
17075
17076 : see how much of the 'sem*(2)' library is present.
17077 h_sem=true
17078 echo " "
17079 case "$d_semctl$d_semget$d_semop" in
17080 *"$undef"*) h_sem=false;;
17081 esac
17082 case "$osname" in
17083 freebsd)
17084     case "`ipcs 2>&1`" in
17085     "SVID messages"*"not configured"*)
17086         echo "Your $osname does not have the sem*(2) configured." >&4
17087         h_sem=false
17088         val="$undef"
17089         set semctl d_semctl
17090         eval $setvar
17091         set semget d_semget
17092         eval $setvar
17093         set semop d_semop
17094         eval $setvar
17095         ;;
17096     esac
17097     ;;
17098 esac
17099 : we could also check for sys/ipc.h ...
17100 if $h_sem && $test `./findhdr sys/sem.h`; then
17101         echo "You have the full sem*(2) library." >&4
17102         val="$define"
17103 else
17104         echo "You don't have the full sem*(2) library." >&4
17105         val="$undef"
17106 fi
17107 set d_sem
17108 eval $setvar
17109
17110 : see whether sys/sem.h defines union semun
17111 echo " "
17112 $cat > try.c <<'END'
17113 #include <sys/types.h>
17114 #include <sys/ipc.h>
17115 #include <sys/sem.h>
17116 int main () { union semun semun; semun.buf = 0; }
17117 END
17118 set try
17119 if eval $compile; then
17120     echo "You have union semun in <sys/sem.h>." >&4
17121     val="$define"
17122 else
17123     echo "You do not have union semun in <sys/sem.h>." >&4
17124     val="$undef"
17125 fi
17126 $rm_try
17127 set d_union_semun
17128 eval $setvar
17129
17130 : see how to do semctl IPC_STAT
17131 case "$d_sem" in
17132 $define)
17133     echo " "
17134     $cat > tryh.h <<END
17135 #ifndef S_IRUSR
17136 #   ifdef S_IREAD
17137 #       define S_IRUSR S_IREAD
17138 #       define S_IWUSR S_IWRITE
17139 #       define S_IXUSR S_IEXEC
17140 #   else
17141 #       define S_IRUSR 0400
17142 #       define S_IWUSR 0200
17143 #       define S_IXUSR 0100
17144 #   endif
17145 #   define S_IRGRP (S_IRUSR>>3)
17146 #   define S_IWGRP (S_IWUSR>>3)
17147 #   define S_IXGRP (S_IXUSR>>3)
17148 #   define S_IROTH (S_IRUSR>>6)
17149 #   define S_IWOTH (S_IWUSR>>6)
17150 #   define S_IXOTH (S_IXUSR>>6)
17151 #endif
17152 #ifndef S_IRWXU
17153 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17154 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17155 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17156 #endif
17157 END
17158     : see whether semctl IPC_STAT can use union semun
17159     case "$d_semctl_semun" in
17160     '')
17161       val="$undef"
17162       $cat > try.c <<END
17163 #include <sys/types.h>
17164 #include <sys/ipc.h>
17165 #include <sys/sem.h>
17166 #include <sys/stat.h>
17167 #include <stdio.h>
17168 #include <errno.h>
17169 #include "tryh.h"
17170 #ifndef errno
17171 extern int errno;
17172 #endif
17173 #$d_union_semun HAS_UNION_SEMUN
17174 int main() {
17175     union semun
17176 #ifndef HAS_UNION_SEMUN
17177     {
17178         int val;
17179         struct semid_ds *buf;
17180         unsigned short *array;
17181     }
17182 #endif
17183     arg;
17184     int sem, st;
17185
17186 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17187     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17188     if (sem > -1) {
17189         struct semid_ds argbuf;
17190         arg.buf = &argbuf;
17191 #       ifdef IPC_STAT
17192         st = semctl(sem, 0, IPC_STAT, arg);
17193         if (st == 0)
17194             printf("semun\n");
17195         else
17196 #       endif /* IPC_STAT */
17197             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17198 #       ifdef IPC_RMID
17199         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17200 #       endif /* IPC_RMID */
17201             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17202     } else
17203 #endif /* IPC_PRIVATE && ... */
17204         printf("semget failed: errno = %d\n", errno);
17205   return 0;
17206 }
17207 END
17208       set try
17209       if eval $compile; then
17210           xxx=`$run ./try`
17211           case "$xxx" in
17212           semun) val="$define" ;;
17213           esac
17214       fi
17215       $rm_try
17216       set d_semctl_semun
17217       eval $setvar
17218       ;;
17219     esac
17220     case "$d_semctl_semun" in
17221     $define)
17222         echo "You can use union semun for semctl IPC_STAT." >&4
17223         also='also'
17224         ;;
17225     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17226         also=''
17227         ;;
17228     esac
17229
17230     : see whether semctl IPC_STAT can use struct semid_ds pointer
17231     case "$d_semctl_semid_ds" in
17232     '')
17233       val="$undef"
17234       $cat > try.c <<'END'
17235 #include <sys/types.h>
17236 #include <sys/ipc.h>
17237 #include <sys/sem.h>
17238 #include <sys/stat.h>
17239 #include "tryh.h"
17240 #include <stdio.h>
17241 #include <errno.h>
17242 #ifndef errno
17243 extern int errno;
17244 #endif
17245 int main() {
17246     struct semid_ds arg;
17247     int sem, st;
17248
17249 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17250     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17251     if (sem > -1) {
17252 #       ifdef IPC_STAT
17253         st = semctl(sem, 0, IPC_STAT, &arg);
17254         if (st == 0)
17255             printf("semid_ds\n");
17256         else
17257 #       endif /* IPC_STAT */
17258             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17259 #       ifdef IPC_RMID
17260         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17261 #       endif /* IPC_RMID */
17262             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17263     } else
17264 #endif /* IPC_PRIVATE && ... */
17265         printf("semget failed: errno = %d\n", errno);
17266
17267     return 0;
17268 }
17269 END
17270       set try
17271       if eval $compile; then
17272           xxx=`$run ./try`
17273           case "$xxx" in
17274           semid_ds) val="$define" ;;
17275           esac
17276       fi
17277       $rm_try
17278       set d_semctl_semid_ds
17279       eval $setvar
17280       ;;
17281     esac
17282     case "$d_semctl_semid_ds" in
17283     $define)
17284         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17285         ;;
17286     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17287         ;;
17288     esac
17289     ;;
17290 *)  val="$undef"
17291
17292     # We do not have the full sem*(2) library, so assume we can not
17293     # use either.
17294
17295     set d_semctl_semun
17296     eval $setvar
17297
17298     set d_semctl_semid_ds
17299     eval $setvar
17300     ;;
17301 esac
17302 $rm_try tryh.h
17303
17304 : see if sendmsg exists
17305 set sendmsg d_sendmsg
17306 eval $inlibc
17307
17308 : see if setegid exists
17309 set setegid d_setegid
17310 eval $inlibc
17311
17312 : see if seteuid exists
17313 set seteuid d_seteuid
17314 eval $inlibc
17315
17316 : see if setgrent exists
17317 set setgrent d_setgrent
17318 eval $inlibc
17319
17320 : see if setgrent_r exists
17321 set setgrent_r d_setgrent_r
17322 eval $inlibc
17323 case "$d_setgrent_r" in
17324 "$define")
17325         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17326         case "$d_setgrent_r_proto:$usethreads" in
17327         ":define")      d_setgrent_r_proto=define
17328                 set d_setgrent_r_proto setgrent_r $hdrs
17329                 eval $hasproto ;;
17330         *)      ;;
17331         esac
17332         case "$d_setgrent_r_proto" in
17333         define)
17334         case "$setgrent_r_proto" in
17335         ''|0) try='int setgrent_r(FILE**);'
17336         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17337         esac
17338         case "$setgrent_r_proto" in
17339         ''|0) try='void setgrent_r(FILE**);'
17340         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17341         esac
17342         case "$setgrent_r_proto" in
17343         ''|0)   d_setgrent_r=undef
17344                 setgrent_r_proto=0
17345                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17346         * )     case "$setgrent_r_proto" in
17347                 REENTRANT_PROTO*) ;;
17348                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17349                 esac
17350                 echo "Prototype: $try" ;;
17351         esac
17352         ;;
17353         *)      case "$usethreads" in
17354                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17355                 esac
17356                 d_setgrent_r=undef
17357                 setgrent_r_proto=0
17358                 ;;
17359         esac
17360         ;;
17361 *)      setgrent_r_proto=0
17362         ;;
17363 esac
17364
17365 : see if sethostent exists
17366 set sethostent d_sethent
17367 eval $inlibc
17368
17369 : see if sethostent_r exists
17370 set sethostent_r d_sethostent_r
17371 eval $inlibc
17372 case "$d_sethostent_r" in
17373 "$define")
17374         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17375         case "$d_sethostent_r_proto:$usethreads" in
17376         ":define")      d_sethostent_r_proto=define
17377                 set d_sethostent_r_proto sethostent_r $hdrs
17378                 eval $hasproto ;;
17379         *)      ;;
17380         esac
17381         case "$d_sethostent_r_proto" in
17382         define)
17383         case "$sethostent_r_proto" in
17384         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17385         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17386         esac
17387         case "$sethostent_r_proto" in
17388         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17389         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17390         esac
17391         case "$sethostent_r_proto" in
17392         ''|0)   d_sethostent_r=undef
17393                 sethostent_r_proto=0
17394                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17395         * )     case "$sethostent_r_proto" in
17396                 REENTRANT_PROTO*) ;;
17397                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17398                 esac
17399                 echo "Prototype: $try" ;;
17400         esac
17401         ;;
17402         *)      case "$usethreads" in
17403                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17404                 esac
17405                 d_sethostent_r=undef
17406                 sethostent_r_proto=0
17407                 ;;
17408         esac
17409         ;;
17410 *)      sethostent_r_proto=0
17411         ;;
17412 esac
17413
17414 : see if setitimer exists
17415 set setitimer d_setitimer
17416 eval $inlibc
17417
17418 : see if setlinebuf exists
17419 set setlinebuf d_setlinebuf
17420 eval $inlibc
17421
17422 : see if setlocale exists
17423 set setlocale d_setlocale
17424 eval $inlibc
17425
17426 : see if locale.h is available
17427 set locale.h i_locale
17428 eval $inhdr
17429
17430 : see if setlocale_r exists
17431 set setlocale_r d_setlocale_r
17432 eval $inlibc
17433 case "$d_setlocale_r" in
17434 "$define")
17435         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17436         case "$d_setlocale_r_proto:$usethreads" in
17437         ":define")      d_setlocale_r_proto=define
17438                 set d_setlocale_r_proto setlocale_r $hdrs
17439                 eval $hasproto ;;
17440         *)      ;;
17441         esac
17442         case "$d_setlocale_r_proto" in
17443         define)
17444         case "$setlocale_r_proto" in
17445         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17446         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17447         esac
17448         case "$setlocale_r_proto" in
17449         ''|0)   d_setlocale_r=undef
17450                 setlocale_r_proto=0
17451                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17452         * )     case "$setlocale_r_proto" in
17453                 REENTRANT_PROTO*) ;;
17454                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17455                 esac
17456                 echo "Prototype: $try" ;;
17457         esac
17458         ;;
17459         *)      case "$usethreads" in
17460                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17461                 esac
17462                 d_setlocale_r=undef
17463                 setlocale_r_proto=0
17464                 ;;
17465         esac
17466         ;;
17467 *)      setlocale_r_proto=0
17468         ;;
17469 esac
17470
17471 : see if setnetent exists
17472 set setnetent d_setnent
17473 eval $inlibc
17474
17475 : see if setnetent_r exists
17476 set setnetent_r d_setnetent_r
17477 eval $inlibc
17478 case "$d_setnetent_r" in
17479 "$define")
17480         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17481         case "$d_setnetent_r_proto:$usethreads" in
17482         ":define")      d_setnetent_r_proto=define
17483                 set d_setnetent_r_proto setnetent_r $hdrs
17484                 eval $hasproto ;;
17485         *)      ;;
17486         esac
17487         case "$d_setnetent_r_proto" in
17488         define)
17489         case "$setnetent_r_proto" in
17490         ''|0) try='int setnetent_r(int, struct netent_data*);'
17491         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17492         esac
17493         case "$setnetent_r_proto" in
17494         ''|0) try='void setnetent_r(int, struct netent_data*);'
17495         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17496         esac
17497         case "$setnetent_r_proto" in
17498         ''|0)   d_setnetent_r=undef
17499                 setnetent_r_proto=0
17500                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17501         * )     case "$setnetent_r_proto" in
17502                 REENTRANT_PROTO*) ;;
17503                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17504                 esac
17505                 echo "Prototype: $try" ;;
17506         esac
17507         ;;
17508         *)      case "$usethreads" in
17509                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17510                 esac
17511                 d_setnetent_r=undef
17512                 setnetent_r_proto=0
17513                 ;;
17514         esac
17515         ;;
17516 *)      setnetent_r_proto=0
17517         ;;
17518 esac
17519
17520 : see if setprotoent exists
17521 set setprotoent d_setpent
17522 eval $inlibc
17523
17524 : see if setpgid exists
17525 set setpgid d_setpgid
17526 eval $inlibc
17527
17528 : see if setpgrp2 exists
17529 set setpgrp2 d_setpgrp2
17530 eval $inlibc
17531
17532 : see if setpriority exists
17533 set setpriority d_setprior
17534 eval $inlibc
17535
17536 : see if setproctitle exists
17537 set setproctitle d_setproctitle
17538 eval $inlibc
17539
17540 : see if setprotoent_r exists
17541 set setprotoent_r d_setprotoent_r
17542 eval $inlibc
17543 case "$d_setprotoent_r" in
17544 "$define")
17545         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17546         case "$d_setprotoent_r_proto:$usethreads" in
17547         ":define")      d_setprotoent_r_proto=define
17548                 set d_setprotoent_r_proto setprotoent_r $hdrs
17549                 eval $hasproto ;;
17550         *)      ;;
17551         esac
17552         case "$d_setprotoent_r_proto" in
17553         define)
17554         case "$setprotoent_r_proto" in
17555         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17556         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17557         esac
17558         case "$setprotoent_r_proto" in
17559         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17560         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17561         esac
17562         case "$setprotoent_r_proto" in
17563         ''|0)   d_setprotoent_r=undef
17564                 setprotoent_r_proto=0
17565                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17566         * )     case "$setprotoent_r_proto" in
17567                 REENTRANT_PROTO*) ;;
17568                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17569                 esac
17570                 echo "Prototype: $try" ;;
17571         esac
17572         ;;
17573         *)      case "$usethreads" in
17574                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17575                 esac
17576                 d_setprotoent_r=undef
17577                 setprotoent_r_proto=0
17578                 ;;
17579         esac
17580         ;;
17581 *)      setprotoent_r_proto=0
17582         ;;
17583 esac
17584
17585 : see if setpwent exists
17586 set setpwent d_setpwent
17587 eval $inlibc
17588
17589 : see if setpwent_r exists
17590 set setpwent_r d_setpwent_r
17591 eval $inlibc
17592 case "$d_setpwent_r" in
17593 "$define")
17594         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17595         case "$d_setpwent_r_proto:$usethreads" in
17596         ":define")      d_setpwent_r_proto=define
17597                 set d_setpwent_r_proto setpwent_r $hdrs
17598                 eval $hasproto ;;
17599         *)      ;;
17600         esac
17601         case "$d_setpwent_r_proto" in
17602         define)
17603         case "$setpwent_r_proto" in
17604         ''|0) try='int setpwent_r(FILE**);'
17605         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17606         esac
17607         case "$setpwent_r_proto" in
17608         ''|0) try='void setpwent_r(FILE**);'
17609         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17610         esac
17611         case "$setpwent_r_proto" in
17612         ''|0)   d_setpwent_r=undef
17613                 setpwent_r_proto=0
17614                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17615         * )     case "$setpwent_r_proto" in
17616                 REENTRANT_PROTO*) ;;
17617                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17618                 esac
17619                 echo "Prototype: $try" ;;
17620         esac
17621         ;;
17622         *)      case "$usethreads" in
17623                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17624                 esac
17625                 d_setpwent_r=undef
17626                 setpwent_r_proto=0
17627                 ;;
17628         esac
17629         ;;
17630 *)      setpwent_r_proto=0
17631         ;;
17632 esac
17633
17634 : see if setregid exists
17635 set setregid d_setregid
17636 eval $inlibc
17637 set setresgid d_setresgid
17638 eval $inlibc
17639
17640 : see if setreuid exists
17641 set setreuid d_setreuid
17642 eval $inlibc
17643 set setresuid d_setresuid
17644 eval $inlibc
17645
17646 : see if setrgid exists
17647 set setrgid d_setrgid
17648 eval $inlibc
17649
17650 : see if setruid exists
17651 set setruid d_setruid
17652 eval $inlibc
17653
17654 : see if setservent exists
17655 set setservent d_setsent
17656 eval $inlibc
17657
17658 : see if setservent_r exists
17659 set setservent_r d_setservent_r
17660 eval $inlibc
17661 case "$d_setservent_r" in
17662 "$define")
17663         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17664         case "$d_setservent_r_proto:$usethreads" in
17665         ":define")      d_setservent_r_proto=define
17666                 set d_setservent_r_proto setservent_r $hdrs
17667                 eval $hasproto ;;
17668         *)      ;;
17669         esac
17670         case "$d_setservent_r_proto" in
17671         define)
17672         case "$setservent_r_proto" in
17673         ''|0) try='int setservent_r(int, struct servent_data*);'
17674         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17675         esac
17676         case "$setservent_r_proto" in
17677         ''|0) try='void setservent_r(int, struct servent_data*);'
17678         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17679         esac
17680         case "$setservent_r_proto" in
17681         ''|0)   d_setservent_r=undef
17682                 setservent_r_proto=0
17683                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17684         * )     case "$setservent_r_proto" in
17685                 REENTRANT_PROTO*) ;;
17686                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17687                 esac
17688                 echo "Prototype: $try" ;;
17689         esac
17690         ;;
17691         *)      case "$usethreads" in
17692                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17693                 esac
17694                 d_setservent_r=undef
17695                 setservent_r_proto=0
17696                 ;;
17697         esac
17698         ;;
17699 *)      setservent_r_proto=0
17700         ;;
17701 esac
17702
17703 : see if setsid exists
17704 set setsid d_setsid
17705 eval $inlibc
17706
17707 : see if setvbuf exists
17708 set setvbuf d_setvbuf
17709 eval $inlibc
17710
17711 : see if shmctl exists
17712 set shmctl d_shmctl
17713 eval $inlibc
17714
17715 : see if shmget exists
17716 set shmget d_shmget
17717 eval $inlibc
17718
17719 : see if shmat exists
17720 set shmat d_shmat
17721 eval $inlibc
17722 : see what shmat returns
17723 case "$d_shmat" in
17724 "$define")
17725         $cat >shmat.c <<'END'
17726 #include <sys/shm.h>
17727 void *shmat();
17728 END
17729         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17730                 shmattype='void *'
17731         else
17732                 shmattype='char *'
17733         fi
17734         echo "and it returns ($shmattype)." >&4
17735         : see if a prototype for shmat is available
17736         xxx=`./findhdr sys/shm.h`
17737         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17738         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17739                 val="$define"
17740         else
17741                 val="$undef"
17742         fi
17743         $rm -f shmat.[co]
17744         ;;
17745 *)
17746         val="$undef"
17747         ;;
17748 esac
17749 set d_shmatprototype
17750 eval $setvar
17751
17752 : see if shmdt exists
17753 set shmdt d_shmdt
17754 eval $inlibc
17755
17756 : see how much of the 'shm*(2)' library is present.
17757 h_shm=true
17758 echo " "
17759 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17760 *"$undef"*) h_shm=false;;
17761 esac
17762 case "$osname" in
17763 freebsd)
17764     case "`ipcs 2>&1`" in
17765     "SVID shared memory"*"not configured"*)
17766         echo "Your $osname does not have the shm*(2) configured." >&4
17767         h_shm=false
17768         val="$undef"
17769         set shmctl d_shmctl
17770         eval $setvar
17771         set shmget d_shmget
17772         eval $setvar
17773         set shmat d_shmat
17774         eval $setvar
17775         set shmdt d_shmdt
17776         eval $setvar
17777         ;;
17778     esac
17779     ;;
17780 esac
17781 : we could also check for sys/ipc.h ...
17782 if $h_shm && $test `./findhdr sys/shm.h`; then
17783         echo "You have the full shm*(2) library." >&4
17784         val="$define"
17785 else
17786         echo "You don't have the full shm*(2) library." >&4
17787         val="$undef"
17788 fi
17789 set d_shm
17790 eval $setvar
17791
17792 : see if we have sigaction
17793 echo " "
17794 if set sigaction val -f d_sigaction; eval $csym; $val; then
17795         echo 'sigaction() found.' >&4
17796         $cat > try.c <<EOP
17797 #include <stdio.h>
17798 #include <sys/types.h>
17799 #include <signal.h>
17800 #$i_stdlib I_STDLIB
17801 #ifdef I_STDLIB
17802 #include <stdlib.h>
17803 #endif
17804 int main()
17805 {
17806     struct sigaction act, oact;
17807     act.sa_flags = 0;
17808     oact.sa_handler = 0;
17809     /* so that act and oact are used */
17810     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17811 }
17812 EOP
17813         set try
17814         if eval $compile_ok; then
17815                 val="$define"
17816         else
17817                 echo "But you don't seem to have a usable struct sigaction." >&4
17818                 val="$undef"
17819         fi
17820 else
17821         echo 'sigaction NOT found.' >&4
17822         val="$undef"
17823 fi
17824 set d_sigaction; eval $setvar
17825 $rm_try
17826
17827 : see if this is a sunmath.h system
17828 set sunmath.h i_sunmath
17829 eval $inhdr
17830
17831 : see if signbit exists
17832 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17833 $cat >try.c <<EOCP
17834 #$i_math I_MATH
17835 #$i_sunmath I_SUNMATH
17836 #ifdef I_MATH
17837 #  include <math.h>
17838 #endif
17839 #ifdef I_SUNMATH  /* Solaris special math library */
17840 #  include <sunmath.h>
17841 #endif
17842 #define NV $nvtype
17843 int main(int argc, char **argv)
17844 {
17845     NV x = 0.0;
17846     NV y = -0.0;
17847     if ((signbit(x) == 0) && (signbit(y) != 0))
17848         return 0;
17849     else
17850         return 1;
17851 }
17852 EOCP
17853 val="$undef"
17854 set try
17855 if eval $compile; then
17856     if $run ./try; then
17857         $echo "Yes." >&4
17858         val="$define"
17859     else
17860         $echo "Signbit seems to be available, but doesn't work as I expected."
17861         $echo "I won't use it." >&4
17862         val="$undef"
17863     fi
17864 else
17865     $echo "Nope." >&4
17866     dflt="$undef"
17867 fi
17868 set d_signbit
17869 eval $setvar
17870 $rm_try
17871
17872 : see if sigprocmask exists
17873 set sigprocmask d_sigprocmask
17874 eval $inlibc
17875
17876 : see if sigsetjmp exists
17877 echo " "
17878 case "$d_sigsetjmp" in
17879 '')
17880         $cat >try.c <<EOP
17881 #include <setjmp.h>
17882 #$i_stdlib I_STDLIB
17883 #ifdef I_STDLIB
17884 #include <stdlib.h>
17885 #endif
17886 sigjmp_buf env;
17887 int set = 1;
17888 int main()
17889 {
17890         if (sigsetjmp(env,1))
17891                 exit(set);
17892         set = 0;
17893         siglongjmp(env, 1);
17894         exit(1);
17895 }
17896 EOP
17897         set try
17898         if eval $compile; then
17899                 if $run ./try >/dev/null 2>&1; then
17900                         echo "POSIX sigsetjmp found." >&4
17901                         val="$define"
17902                 else
17903                         $cat >&4 <<EOM
17904 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17905 I'll ignore them.
17906 EOM
17907                         val="$undef"
17908                 fi
17909         else
17910                 echo "sigsetjmp not found." >&4
17911                 val="$undef"
17912         fi
17913         ;;
17914 *) val="$d_sigsetjmp"
17915         case "$d_sigsetjmp" in
17916         $define) echo "POSIX sigsetjmp found." >&4;;
17917         $undef) echo "sigsetjmp not found." >&4;;
17918         esac
17919         ;;
17920 esac
17921 set d_sigsetjmp
17922 eval $setvar
17923 $rm_try
17924
17925 : see if snprintf exists
17926 set snprintf d_snprintf
17927 eval $inlibc
17928
17929 : see if vsnprintf exists
17930 set vsnprintf d_vsnprintf
17931 eval $inlibc
17932
17933 case "$d_snprintf-$d_vsnprintf" in
17934 "$define-$define")
17935     $cat <<EOM
17936 Checking whether your snprintf() and vsnprintf() work okay...
17937 EOM
17938     $cat >try.c <<'EOCP'
17939 /* v?snprintf testing logic courtesy of Russ Allbery.
17940  * According to C99:
17941  * - if the buffer is too short it still must be \0-terminated
17942  * - if the buffer is too short the potentially required length
17943  *   must be returned and not -1
17944  * - if the buffer is NULL the potentially required length
17945  *   must be returned and not -1 or core dump
17946  */
17947 #include <stdio.h>
17948 #include <stdarg.h>
17949
17950 char buf[2];
17951
17952 int test (char *format, ...)
17953 {
17954     va_list args;
17955     int count;
17956
17957     va_start (args, format);
17958     count = vsnprintf (buf, sizeof buf, format, args);
17959     va_end (args);
17960     return count;
17961 }
17962
17963 int main ()
17964 {
17965     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17966              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17967 }
17968 EOCP
17969     set try
17970     if eval $compile; then
17971         `$run ./try`
17972         case "$?" in
17973         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17974         *) cat <<EOM >&4
17975 Your snprintf() and snprintf() don't seem to be working okay.
17976 EOM
17977            d_snprintf="$undef"
17978            d_vsnprintf="$undef"
17979            ;;
17980         esac
17981     else
17982         echo "(I can't seem to compile the test program--assuming they don't)"
17983         d_snprintf="$undef"
17984         d_vsnprintf="$undef"
17985     fi
17986     $rm_try
17987     ;;
17988 esac
17989
17990 : see if sockatmark exists
17991 set sockatmark d_sockatmark
17992 eval $inlibc
17993
17994 : see if prototype for sockatmark is available
17995 echo " "
17996 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17997 eval $hasproto
17998
17999 : see if socks5_init exists
18000 set socks5_init d_socks5_init
18001 eval $inlibc
18002
18003 : see if sprintf returns the length of the string in the buffer as per ANSI
18004 $echo "Checking whether sprintf returns the length of the string..." >&4
18005 $cat <<EOP >try.c
18006 #include <stdio.h>
18007 #$i_stdlib I_STDLIB
18008 #ifdef I_STDLIB
18009 #include <stdlib.h>
18010 #endif
18011 #$i_string I_STRING
18012 #ifdef I_STRING
18013 #  include <string.h>
18014 #else
18015 #  include <strings.h>
18016 #endif
18017 #$i_math I_MATH
18018 #ifdef I_MATH
18019 #include <math.h>
18020 #endif
18021
18022 char buffer[256];
18023
18024 int check (size_t expect, int test) {
18025   size_t got = strlen(buffer);
18026   if (expect == got)
18027     return 0;
18028
18029   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18030        test, buffer);
18031   exit (test);
18032 }
18033
18034 int main(int argc, char **argv) {
18035   int test = 0;
18036
18037   check(sprintf(buffer, ""), ++test);
18038   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18039   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18040
18041   return 0;
18042 }
18043 EOP
18044 set try
18045
18046 if eval $compile; then
18047     xxx="`$run ./try`"
18048     case "$?" in
18049         0) cat >&4 <<EOM
18050 sprintf returns the length of the string (as ANSI says it should)
18051 EOM
18052         d_sprintf_returns_strlen="$define"
18053         ;;
18054         *) cat >&4 <<EOM
18055 sprintf does not return the length of the string (how old is this system?)
18056 EOM
18057         d_sprintf_returns_strlen="$undef"
18058         ;;
18059     esac
18060 else
18061     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18062     d_sprintf_returns_strlen="$undef"
18063 fi
18064 $rm_try
18065
18066 : see if srand48_r exists
18067 set srand48_r d_srand48_r
18068 eval $inlibc
18069 case "$d_srand48_r" in
18070 "$define")
18071         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18072         case "$d_srand48_r_proto:$usethreads" in
18073         ":define")      d_srand48_r_proto=define
18074                 set d_srand48_r_proto srand48_r $hdrs
18075                 eval $hasproto ;;
18076         *)      ;;
18077         esac
18078         case "$d_srand48_r_proto" in
18079         define)
18080         case "$srand48_r_proto" in
18081         ''|0) try='int srand48_r(long, struct drand48_data*);'
18082         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18083         esac
18084         case "$srand48_r_proto" in
18085         ''|0)   d_srand48_r=undef
18086                 srand48_r_proto=0
18087                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18088         * )     case "$srand48_r_proto" in
18089                 REENTRANT_PROTO*) ;;
18090                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18091                 esac
18092                 echo "Prototype: $try" ;;
18093         esac
18094         ;;
18095         *)      case "$usethreads" in
18096                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18097                 esac
18098                 d_srand48_r=undef
18099                 srand48_r_proto=0
18100                 ;;
18101         esac
18102         ;;
18103 *)      srand48_r_proto=0
18104         ;;
18105 esac
18106
18107 : see if srandom_r exists
18108 set srandom_r d_srandom_r
18109 eval $inlibc
18110 case "$d_srandom_r" in
18111 "$define")
18112         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18113         case "$d_srandom_r_proto:$usethreads" in
18114         ":define")      d_srandom_r_proto=define
18115                 set d_srandom_r_proto srandom_r $hdrs
18116                 eval $hasproto ;;
18117         *)      ;;
18118         esac
18119         case "$d_srandom_r_proto" in
18120         define)
18121         case "$srandom_r_proto" in
18122         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18123         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18124         esac
18125         case "$srandom_r_proto" in
18126         ''|0)   d_srandom_r=undef
18127                 srandom_r_proto=0
18128                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18129         * )     case "$srandom_r_proto" in
18130                 REENTRANT_PROTO*) ;;
18131                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18132                 esac
18133                 echo "Prototype: $try" ;;
18134         esac
18135         ;;
18136         *)      case "$usethreads" in
18137                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18138                 esac
18139                 d_srandom_r=undef
18140                 srandom_r_proto=0
18141                 ;;
18142         esac
18143         ;;
18144 *)      srandom_r_proto=0
18145         ;;
18146 esac
18147
18148 : see if prototype for setresgid is available
18149 echo " "
18150 set d_sresgproto setresgid $i_unistd unistd.h
18151 eval $hasproto
18152
18153 : see if prototype for setresuid is available
18154 echo " "
18155 set d_sresuproto setresuid $i_unistd unistd.h
18156 eval $hasproto
18157
18158 : see if sys/stat.h is available
18159 set sys/stat.h i_sysstat
18160 eval $inhdr
18161
18162 : see if stat knows about block sizes
18163 echo " "
18164 echo "Checking to see if your struct stat has st_blocks field..." >&4
18165 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18166 eval $hasfield
18167
18168 : see if this is a sys/vfs.h system
18169 set sys/vfs.h i_sysvfs
18170 eval $inhdr
18171
18172 : see if this is a sys/statfs.h system
18173 set sys/statfs.h i_sysstatfs
18174 eval $inhdr
18175
18176 : Check for statfs_s
18177 echo " "
18178 echo "Checking to see if your system supports struct statfs..." >&4
18179 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
18180 eval $hasstruct
18181 case "$d_statfs_s" in
18182 "$define")      echo "Yes, it does."   ;;
18183 *)              echo "No, it doesn't." ;;
18184 esac
18185
18186
18187 : see if struct statfs knows about f_flags
18188 case "$d_statfs_s" in
18189 define)
18190         echo " "
18191         echo "Checking to see if your struct statfs has f_flags field..." >&4
18192         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
18193         eval $hasfield
18194         ;;
18195 *)      val="$undef"
18196         set d_statfs_f_flags
18197         eval $setvar
18198         ;;
18199 esac
18200 case "$d_statfs_f_flags" in
18201 "$define")      echo "Yes, it does."   ;;
18202 *)              echo "No, it doesn't." ;;
18203 esac
18204
18205 : see what flavor, if any, of static inline is supported
18206 echo " "
18207 echo "Checking to see if your system supports static inline..."
18208 $cat > try.c <<'EOCP'
18209 #include <stdlib.h>
18210 extern int f_via_a(int x);
18211 extern int f_via_b(int x);
18212 int main(int argc, char **argv)
18213 {
18214     int y;
18215
18216     y = f_via_a(0);
18217 #ifdef USE_B
18218     y = f_via_b(0);
18219 #endif
18220     if (y == 42) {
18221         return EXIT_SUCCESS;
18222     }
18223     else {
18224         return EXIT_FAILURE;
18225     }
18226 }
18227 EOCP
18228 $cat > a.c <<'EOCP'
18229 static INLINE int f(int x) {
18230     int y;
18231     y = x + 42;
18232     return y;
18233 }
18234
18235 int f_via_a(int x)
18236 {
18237     return f(x);
18238 }
18239 EOCP
18240 $cat > b.c <<'EOCP'
18241 extern int f(int x);
18242
18243 int f_via_b(int x)
18244 {
18245     return f(x);
18246 }
18247 EOCP
18248
18249 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18250 case "$perl_static_inline" in
18251 '')     # Check the various possibilities, and break out on success.
18252         # For gcc, prefer __inline__, which will still permit
18253         # cflags.SH to add in -ansi.
18254         case "$gccversion" in
18255                 '') xxx="inline __inline__ __inline _inline";;
18256                 *)  xxx="__inline__ inline __inline _inline";;
18257         esac
18258         for inline in $xxx; do
18259                 set try -DINLINE=$inline a.c
18260                 if eval $compile && $run ./try; then
18261                         # Now make sure there is no external linkage of static
18262                         # functions
18263                         set try -DINLINE=$inline -DUSE_B a.c b.c
18264                         if eval $compile && $run ./try; then
18265                                 $echo "Your compiler supports static $inline, " >&4
18266                                 $echo "but it also creates an external definition," >&4
18267                                 $echo "so I won't use it." >&4
18268                                 val=$undef
18269                         else
18270                                 $echo "Your compiler supports static $inline." >&4
18271                                 val=$define
18272                                 perl_static_inline="static $inline";
18273                                 break;
18274                         fi
18275                 else
18276                         $echo "Your compiler does NOT support static $inline." >&4
18277                         val="$undef"
18278                 fi
18279         done
18280         ;;
18281 *inline*) # Some variant of inline exists.
18282         echo "Keeping your $hint value of $perl_static_inline."
18283         val=$define
18284         ;;
18285 static)  # No inline capabilities
18286         echo "Keeping your $hint value of $perl_static_inline."
18287         val=$undef
18288         ;;
18289 *)  # Unrecognized previous value -- blindly trust the supplied
18290         # value and hope it makes sense.  Use old value for
18291         # d_static_inline, if there is one.
18292         echo "Keeping your $hint value of $perl_static_inline."
18293         case "$d_static_inline" in
18294                 '') val=$define ;;
18295                 *)  val=$d_static_inline ;;
18296         esac
18297         ;;
18298 esac
18299 # Fallback to plain 'static' if nothing worked.
18300 case "$perl_static_inline" in
18301 '')
18302         perl_static_inline="static"
18303         val=$undef
18304         ;;
18305 esac
18306 set d_static_inline
18307 eval $setvar
18308 $rm -f a.[co] b.[co]
18309 $rm_try
18310
18311 : Check stream access
18312 $cat >&4 <<EOM
18313 Checking how to access stdio streams by file descriptor number...
18314 EOM
18315 case "$stdio_stream_array" in
18316 '')     $cat >try.c <<EOCP
18317 #include <stdio.h>
18318 int main() {
18319   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18320     printf("yes\n");
18321 }
18322 EOCP
18323         for s in _iob __iob __sF
18324         do
18325                 set try -DSTDIO_STREAM_ARRAY=$s
18326                 if eval $compile; then
18327                         case "`$run ./try`" in
18328                         yes)    stdio_stream_array=$s; break ;;
18329                         esac
18330                 fi
18331         done
18332         $rm_try
18333 esac
18334 case "$stdio_stream_array" in
18335 '')     $cat >&4 <<EOM
18336 I can't figure out how to access stdio streams by file descriptor number.
18337 EOM
18338         d_stdio_stream_array="$undef"
18339         ;;
18340 *)      $cat >&4 <<EOM
18341 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18342 EOM
18343         d_stdio_stream_array="$define"
18344         ;;
18345 esac
18346
18347 : see if strcoll exists
18348 set strcoll d_strcoll
18349 eval $inlibc
18350
18351 : check for structure copying
18352 echo " "
18353 echo "Checking to see if your C compiler can copy structs..." >&4
18354 $cat >try.c <<'EOCP'
18355 int main()
18356 {
18357         struct blurfl {
18358                 int dyick;
18359         } foo, bar;
18360
18361         foo = bar;
18362 }
18363 EOCP
18364 if $cc -c try.c >/dev/null 2>&1 ; then
18365         val="$define"
18366         echo "Yup, it can."
18367 else
18368         val="$undef"
18369         echo "Nope, it can't."
18370 fi
18371 set d_strctcpy
18372 eval $setvar
18373 $rm_try
18374
18375 : see if strerror and/or sys_errlist[] exist
18376 echo " "
18377 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18378     if set strerror val -f d_strerror; eval $csym; $val; then
18379                 echo 'strerror() found.' >&4
18380                 d_strerror="$define"
18381                 d_strerrm='strerror(e)'
18382                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18383                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18384                         d_syserrlst="$define"
18385                 else
18386                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18387                         d_syserrlst="$undef"
18388                 fi
18389     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18390                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18391                 echo 'strerror() found in string header.' >&4
18392                 d_strerror="$define"
18393                 d_strerrm='strerror(e)'
18394                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18395                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18396                                 d_syserrlst="$define"
18397                 else
18398                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18399                         d_syserrlst="$undef"
18400                 fi
18401     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18402                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18403                 d_strerror="$undef"
18404                 d_syserrlst="$define"
18405                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18406     else
18407                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18408                 d_strerror="$undef"
18409                 d_syserrlst="$undef"
18410                 d_strerrm='"unknown"'
18411     fi
18412 fi
18413
18414 : see if strerror_r exists
18415 set strerror_r d_strerror_r
18416 eval $inlibc
18417 case "$d_strerror_r" in
18418 "$define")
18419         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18420         case "$d_strerror_r_proto:$usethreads" in
18421         ":define")      d_strerror_r_proto=define
18422                 set d_strerror_r_proto strerror_r $hdrs
18423                 eval $hasproto ;;
18424         *)      ;;
18425         esac
18426         case "$d_strerror_r_proto" in
18427         define)
18428         case "$strerror_r_proto" in
18429         ''|0) try='int strerror_r(int, char*, size_t);'
18430         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18431         esac
18432         case "$strerror_r_proto" in
18433         ''|0) try='int strerror_r(int, char*, int);'
18434         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18435         esac
18436         case "$strerror_r_proto" in
18437         ''|0) try='char* strerror_r(int, char*, size_t);'
18438         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18439         esac
18440         case "$strerror_r_proto" in
18441         ''|0)   d_strerror_r=undef
18442                 strerror_r_proto=0
18443                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18444         * )     case "$strerror_r_proto" in
18445                 REENTRANT_PROTO*) ;;
18446                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18447                 esac
18448                 echo "Prototype: $try" ;;
18449         esac
18450         ;;
18451         *)      case "$usethreads" in
18452                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18453                 esac
18454                 d_strerror_r=undef
18455                 strerror_r_proto=0
18456                 ;;
18457         esac
18458         ;;
18459 *)      strerror_r_proto=0
18460         ;;
18461 esac
18462
18463 : see if strftime exists
18464 set strftime d_strftime
18465 eval $inlibc
18466
18467 : see if strlcat exists
18468 set strlcat d_strlcat
18469 eval $inlibc
18470
18471 : see if strlcpy exists
18472 set strlcpy d_strlcpy
18473 eval $inlibc
18474
18475 : see if strtod exists
18476 set strtod d_strtod
18477 eval $inlibc
18478
18479 : see if strtol exists
18480 set strtol d_strtol
18481 eval $inlibc
18482
18483 : see if strtold exists
18484 set strtold d_strtold
18485 eval $inlibc
18486
18487 : see if strtoll exists
18488 set strtoll d_strtoll
18489 eval $inlibc
18490
18491 case "$d_longlong-$d_strtoll" in
18492 "$define-$define")
18493         $cat <<EOM
18494 Checking whether your strtoll() works okay...
18495 EOM
18496         $cat >try.c <<'EOCP'
18497 #include <errno.h>
18498 #ifdef __hpux
18499 #define strtoll __strtoll
18500 #endif
18501 #ifdef __EMX__
18502 #define strtoll _strtoll
18503 #endif
18504 #include <stdio.h>
18505 extern long long int strtoll(char *s, char **, int);
18506 static int bad = 0;
18507 int check(char *s, long long ell, int een) {
18508         long long gll;
18509         errno = 0;
18510         gll = strtoll(s, 0, 10);
18511         if (!((gll == ell) && (errno == een)))
18512                 bad++;
18513 }
18514 int main() {
18515         check(" 1",                                      1LL, 0);
18516         check(" 0",                                      0LL, 0);
18517         check("-1",                                     -1LL, 0);
18518         check("-9223372036854775808", -9223372036854775808LL, 0);
18519         check("-9223372036854775808", -9223372036854775808LL, 0);
18520         check(" 9223372036854775807",  9223372036854775807LL, 0);
18521         check("-9223372036854775808", -9223372036854775808LL, 0);
18522         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18523         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18524         if (!bad)
18525                 printf("ok\n");
18526 }
18527 EOCP
18528         set try
18529         if eval $compile; then
18530                 yyy=`$run ./try`
18531                 case "$yyy" in
18532                 ok) echo "Your strtoll() seems to be working okay." ;;
18533                 *) cat <<EOM >&4
18534 Your strtoll() doesn't seem to be working okay.
18535 EOM
18536                    d_strtoll="$undef"
18537                    ;;
18538                 esac
18539         else
18540                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18541                 d_strtoll="$undef"
18542         fi
18543         ;;
18544 esac
18545
18546 : see if strtoq exists
18547 set strtoq d_strtoq
18548 eval $inlibc
18549
18550 : see if strtoul exists
18551 set strtoul d_strtoul
18552 eval $inlibc
18553
18554 case "$d_strtoul" in
18555 "$define")
18556         $cat <<EOM
18557 Checking whether your strtoul() works okay...
18558 EOM
18559         $cat >try.c <<'EOCP'
18560 #include <errno.h>
18561 #include <stdio.h>
18562 extern unsigned long int strtoul(char *s, char **, int);
18563 static int bad = 0;
18564 void check(char *s, unsigned long eul, int een) {
18565         unsigned long gul;
18566         errno = 0;
18567         gul = strtoul(s, 0, 10);
18568         if (!((gul == eul) && (errno == een)))
18569                 bad++;
18570 }
18571 int main() {
18572         check(" 1", 1L, 0);
18573         check(" 0", 0L, 0);
18574 EOCP
18575         case "$longsize" in
18576         8)
18577             $cat >>try.c <<'EOCP'
18578         check("18446744073709551615", 18446744073709551615UL, 0);
18579         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18580 #if 0 /* strtoul() for /^-/ strings is undefined. */
18581         check("-1", 18446744073709551615UL, 0);
18582         check("-18446744073709551614", 2, 0);
18583         check("-18446744073709551615", 1, 0);
18584         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18585         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18586 #endif
18587 EOCP
18588                 ;;
18589         4)
18590                     $cat >>try.c <<'EOCP'
18591         check("4294967295", 4294967295UL, 0);
18592         check("4294967296", 4294967295UL, ERANGE);
18593 #if 0 /* strtoul() for /^-/ strings is undefined. */
18594         check("-1", 4294967295UL, 0);
18595         check("-4294967294", 2, 0);
18596         check("-4294967295", 1, 0);
18597         check("-4294967296", 4294967295UL, ERANGE);
18598         check("-4294967297", 4294967295UL, ERANGE);
18599 #endif
18600 EOCP
18601                 ;;
18602         *)
18603 : Should we write these tests to be more portable by sprintf-ing
18604 : ~0 and then manipulating that char string as input for strtol?
18605                 ;;
18606         esac
18607         $cat >>try.c <<'EOCP'
18608         if (!bad)
18609                 printf("ok\n");
18610         return 0;
18611 }
18612 EOCP
18613         set try
18614         if eval $compile; then
18615                 case "`$run ./try`" in
18616                 ok) echo "Your strtoul() seems to be working okay." ;;
18617                 *) cat <<EOM >&4
18618 Your strtoul() doesn't seem to be working okay.
18619 EOM
18620                    d_strtoul="$undef"
18621                    ;;
18622                 esac
18623         else
18624                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18625                 d_strtoul="$undef"
18626         fi
18627         ;;
18628 esac
18629
18630 : see if strtoull exists
18631 set strtoull d_strtoull
18632 eval $inlibc
18633
18634 case "$d_longlong-$d_strtoull" in
18635 "$define-$define")
18636         $cat <<EOM
18637 Checking whether your strtoull() works okay...
18638 EOM
18639         $cat >try.c <<'EOCP'
18640 #include <errno.h>
18641 #ifdef __hpux
18642 #define strtoull __strtoull
18643 #endif
18644 #include <stdio.h>
18645 extern unsigned long long int strtoull(char *s, char **, int);
18646 static int bad = 0;
18647 int check(char *s, long long eull, int een) {
18648         long long gull;
18649         errno = 0;
18650         gull = strtoull(s, 0, 10);
18651         if (!((gull == eull) && (errno == een)))
18652                 bad++;
18653 }
18654 int main() {
18655         check(" 1",                                        1LL, 0);
18656         check(" 0",                                        0LL, 0);
18657         check("18446744073709551615",  18446744073709551615ULL, 0);
18658         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18659 #if 0 /* strtoull() for /^-/ strings is undefined. */
18660         check("-1",                    18446744073709551615ULL, 0);
18661         check("-18446744073709551614",                     2LL, 0);
18662         check("-18446744073709551615",                     1LL, 0);
18663         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18664         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18665 #endif
18666         if (!bad)
18667                 printf("ok\n");
18668 }
18669 EOCP
18670         set try
18671         if eval $compile; then
18672                 case "`$run ./try`" in
18673                 ok) echo "Your strtoull() seems to be working okay." ;;
18674                 *) cat <<EOM >&4
18675 Your strtoull() doesn't seem to be working okay.
18676 EOM
18677                    d_strtoull="$undef"
18678                    ;;
18679                 esac
18680         else
18681                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18682                 d_strtoull="$undef"
18683         fi
18684         ;;
18685 esac
18686
18687 : see if strtouq exists
18688 set strtouq d_strtouq
18689 eval $inlibc
18690
18691 case "$d_strtouq" in
18692 "$define")
18693         $cat <<EOM
18694 Checking whether your strtouq() works okay...
18695 EOM
18696         $cat >try.c <<'EOCP'
18697 #include <errno.h>
18698 #include <stdio.h>
18699 extern unsigned long long int strtouq(char *s, char **, int);
18700 static int bad = 0;
18701 void check(char *s, unsigned long long eull, int een) {
18702         unsigned long long gull;
18703         errno = 0;
18704         gull = strtouq(s, 0, 10);
18705         if (!((gull == eull) && (errno == een)))
18706                 bad++;
18707 }
18708 int main() {
18709         check(" 1",                                        1LL, 0);
18710         check(" 0",                                        0LL, 0);
18711         check("18446744073709551615",  18446744073709551615ULL, 0);
18712         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18713 #if 0 /* strtouq() for /^-/ strings is undefined. */
18714         check("-1",                    18446744073709551615ULL, 0);
18715         check("-18446744073709551614",                     2LL, 0);
18716         check("-18446744073709551615",                     1LL, 0);
18717         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18718         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18719 #endif
18720         if (!bad)
18721                 printf("ok\n");
18722         return 0;
18723 }
18724 EOCP
18725         set try
18726         if eval $compile; then
18727                 case "`$run ./try`" in
18728                 ok) echo "Your strtouq() seems to be working okay." ;;
18729                 *) cat <<EOM >&4
18730 Your strtouq() doesn't seem to be working okay.
18731 EOM
18732                    d_strtouq="$undef"
18733                    ;;
18734                 esac
18735         else
18736                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18737                 d_strtouq="$undef"
18738         fi
18739         ;;
18740 esac
18741
18742 : see if strxfrm exists
18743 set strxfrm d_strxfrm
18744 eval $inlibc
18745
18746 : see if symlink exists
18747 set symlink d_symlink
18748 eval $inlibc
18749
18750 : see if syscall exists
18751 set syscall d_syscall
18752 eval $inlibc
18753
18754 : see if prototype for syscall is available
18755 echo " "
18756 set d_syscallproto syscall $i_unistd unistd.h
18757 eval $hasproto
18758
18759 : see if sysconf exists
18760 set sysconf d_sysconf
18761 eval $inlibc
18762
18763 : see if system exists
18764 set system d_system
18765 eval $inlibc
18766
18767 : see if tcgetpgrp exists
18768 set tcgetpgrp d_tcgetpgrp
18769 eval $inlibc
18770
18771 : see if tcsetpgrp exists
18772 set tcsetpgrp d_tcsetpgrp
18773 eval $inlibc
18774
18775 : see if prototype for telldir is available
18776 echo " "
18777 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18778 eval $hasproto
18779
18780 : see if time exists
18781 echo " "
18782 if test "X$d_time" = X -o X"$timetype" = X; then
18783     if set time val -f d_time; eval $csym; $val; then
18784                 echo 'time() found.' >&4
18785                 val="$define"
18786                 rp="What is the type returned by time() on this system?"
18787                 set time_t timetype long stdio.h sys/types.h
18788                 eval $typedef_ask
18789     else
18790                 echo 'time() not found, hope that will do.' >&4
18791                 val="$undef"
18792                 timetype='int';
18793     fi
18794     set d_time
18795     eval $setvar
18796 fi
18797
18798 : see if timegm exists
18799 set timegm d_timegm
18800 eval $inlibc
18801
18802 : see if this is a sys/times.h system
18803 set sys/times.h i_systimes
18804 eval $inhdr
18805
18806 : see if times exists
18807 echo " "
18808 if set times val -f d_times; eval $csym; $val; then
18809         echo 'times() found.' >&4
18810         d_times="$define"
18811         inc=''
18812         case "$i_systimes" in
18813         "$define") inc='sys/times.h';;
18814         esac
18815         rp="What is the type returned by times() on this system?"
18816         set clock_t clocktype long stdio.h sys/types.h $inc
18817         eval $typedef_ask
18818 else
18819         echo 'times() NOT found, hope that will do.' >&4
18820         d_times="$undef"
18821         clocktype='int'
18822 fi
18823
18824 : see if tmpnam_r exists
18825 set tmpnam_r d_tmpnam_r
18826 eval $inlibc
18827 case "$d_tmpnam_r" in
18828 "$define")
18829         hdrs="$i_systypes sys/types.h define stdio.h "
18830         case "$d_tmpnam_r_proto:$usethreads" in
18831         ":define")      d_tmpnam_r_proto=define
18832                 set d_tmpnam_r_proto tmpnam_r $hdrs
18833                 eval $hasproto ;;
18834         *)      ;;
18835         esac
18836         case "$d_tmpnam_r_proto" in
18837         define)
18838         case "$tmpnam_r_proto" in
18839         ''|0) try='char* tmpnam_r(char*);'
18840         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18841         esac
18842         case "$tmpnam_r_proto" in
18843         ''|0)   d_tmpnam_r=undef
18844                 tmpnam_r_proto=0
18845                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18846         * )     case "$tmpnam_r_proto" in
18847                 REENTRANT_PROTO*) ;;
18848                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18849                 esac
18850                 echo "Prototype: $try" ;;
18851         esac
18852         ;;
18853         *)      case "$usethreads" in
18854                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18855                 esac
18856                 d_tmpnam_r=undef
18857                 tmpnam_r_proto=0
18858                 ;;
18859         esac
18860         ;;
18861 *)      tmpnam_r_proto=0
18862         ;;
18863 esac
18864
18865 : see if truncate exists
18866 set truncate d_truncate
18867 eval $inlibc
18868
18869 : see if ttyname_r exists
18870 set ttyname_r d_ttyname_r
18871 eval $inlibc
18872 case "$d_ttyname_r" in
18873 "$define")
18874         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18875         case "$d_ttyname_r_proto:$usethreads" in
18876         ":define")      d_ttyname_r_proto=define
18877                 set d_ttyname_r_proto ttyname_r $hdrs
18878                 eval $hasproto ;;
18879         *)      ;;
18880         esac
18881         case "$d_ttyname_r_proto" in
18882         define)
18883         case "$ttyname_r_proto" in
18884         ''|0) try='int ttyname_r(int, char*, size_t);'
18885         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18886         esac
18887         case "$ttyname_r_proto" in
18888         ''|0) try='int ttyname_r(int, char*, int);'
18889         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18890         esac
18891         case "$ttyname_r_proto" in
18892         ''|0) try='char* ttyname_r(int, char*, int);'
18893         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18894         esac
18895         case "$ttyname_r_proto" in
18896         ''|0)   d_ttyname_r=undef
18897                 ttyname_r_proto=0
18898                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18899         * )     case "$ttyname_r_proto" in
18900                 REENTRANT_PROTO*) ;;
18901                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18902                 esac
18903                 echo "Prototype: $try" ;;
18904         esac
18905         ;;
18906         *)      case "$usethreads" in
18907                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18908                 esac
18909                 d_ttyname_r=undef
18910                 ttyname_r_proto=0
18911                 ;;
18912         esac
18913         ;;
18914 *)      ttyname_r_proto=0
18915         ;;
18916 esac
18917
18918 : see if tzname[] exists
18919 echo " "
18920 if set tzname val -a d_tzname; eval $csym; $val; then
18921         val="$define"
18922         echo 'tzname[] found.' >&4
18923 else
18924         val="$undef"
18925         echo 'tzname[] NOT found.' >&4
18926 fi
18927 set d_tzname
18928 eval $setvar
18929
18930 : Check if is a multiplatform env
18931 case "$osname" in
18932 darwin) multiarch="$define" ;;
18933 esac
18934 case "$multiarch" in
18935 ''|[nN]*) multiarch="$undef" ;;
18936 esac
18937
18938 : check for ordering of bytes in a UV
18939 echo " "
18940 case "$multiarch" in
18941 *$define*)
18942         $cat <<EOM
18943 You seem to be doing a multiarchitecture build,
18944 skipping the byteorder check.
18945
18946 EOM
18947         byteorder='ffff'
18948         ;;
18949 *)
18950         case "$byteorder" in
18951         '')
18952                 $cat <<'EOM'
18953 In the following, larger digits indicate more significance.  A big-endian
18954 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18955 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18956 machines may have weird orders like 3412.  A Cray will report 87654321,
18957 an Alpha will report 12345678. If the test program works the default is
18958 probably right.
18959 I'm now running the test program...
18960 EOM
18961                 $cat >try.c <<EOCP
18962 #include <stdio.h>
18963 #$i_stdlib I_STDLIB
18964 #ifdef I_STDLIB
18965 #include <stdlib.h>
18966 #endif
18967 #include <sys/types.h>
18968 typedef $uvtype UV;
18969 int main()
18970 {
18971         int i;
18972         union {
18973                 UV l;
18974                 char c[$uvsize];
18975         } u;
18976
18977         if ($uvsize > 4)
18978                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18979         else
18980                 u.l = (UV)0x04030201;
18981         for (i = 0; i < $uvsize; i++)
18982                 printf("%c", u.c[i]+'0');
18983         printf("\n");
18984         exit(0);
18985 }
18986 EOCP
18987                 xxx_prompt=y
18988                 set try
18989                 if eval $compile && $run ./try > /dev/null; then
18990                         dflt=`$run ./try`
18991                         case "$dflt" in
18992                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18993                                 echo "(The test program ran ok.)"
18994                                 echo "byteorder=$dflt"
18995                                 xxx_prompt=n
18996                         ;;
18997                         ????|????????) echo "(The test program ran ok.)" ;;
18998                         *) echo "(The test program didn't run right for some reason.)" ;;
18999                         esac
19000                 else
19001                         dflt='4321'
19002                         cat <<'EOM'
19003 (I can't seem to compile the test program.  Guessing big-endian...)
19004 EOM
19005                 fi
19006                 case "$xxx_prompt" in
19007                 y)
19008                         rp="What is the order of bytes in $uvtype?"
19009                         . ./myread
19010                         byteorder="$ans"
19011                         ;;
19012                 *)      byteorder=$dflt
19013                         ;;
19014                 esac
19015                 ;;
19016         esac
19017         $rm_try
19018         ;;
19019 esac
19020
19021 : Checking 32bit alignedness
19022 $cat <<EOM
19023
19024 Checking to see whether you can access character data unalignedly...
19025 EOM
19026 case "$d_u32align" in
19027 '')   $cat >try.c <<EOCP
19028 #include <stdio.h>
19029 #$i_stdlib I_STDLIB
19030 #ifdef I_STDLIB
19031 #include <stdlib.h>
19032 #endif
19033 #define U32 $u32type
19034 #define BYTEORDER 0x$byteorder
19035 #define U8 $u8type
19036 #include <signal.h>
19037 #ifdef SIGBUS
19038 $signal_t bletch(int s) { exit(4); }
19039 #endif
19040 int main() {
19041 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19042     volatile U8 buf[8];
19043     volatile U32 *up;
19044     int i;
19045
19046     if (sizeof(U32) != 4) {
19047         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19048         exit(1);
19049     }
19050
19051     fflush(stdout);
19052
19053 #ifdef SIGBUS
19054     signal(SIGBUS, bletch);
19055 #endif
19056
19057     buf[0] = 0;
19058     buf[1] = 0;
19059     buf[2] = 0;
19060     buf[3] = 1;
19061     buf[4] = 0;
19062     buf[5] = 0;
19063     buf[6] = 0;
19064     buf[7] = 1;
19065
19066     for (i = 0; i < 4; i++) {
19067         up = (U32*)(buf + i);
19068         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19069                (*up == 1 << (8*(3-i)))  /* little-endian */
19070               )
19071            )
19072         {
19073             printf("read failed (%x)\n", *up);
19074             exit(2);
19075         }
19076     }
19077
19078     /* write test */
19079     for (i = 0; i < 4; i++) {
19080         up = (U32*)(buf + i);
19081         *up = 0xBeef;
19082         if (*up != 0xBeef) {
19083             printf("write failed (%x)\n", *up);
19084             exit(3);
19085         }
19086     }
19087
19088     exit(0);
19089 #else
19090     printf("1\n");
19091     exit(1);
19092 #endif
19093     return 0;
19094 }
19095 EOCP
19096 set try
19097 if eval $compile_ok; then
19098         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19099         $run ./try 2>&1 >/dev/null
19100         case "$?" in
19101         0)      cat >&4 <<EOM
19102 You can access character data pretty unalignedly.
19103 EOM
19104                 d_u32align="$undef"
19105                 ;;
19106         *)      cat >&4 <<EOM
19107 It seems that you must access character data in an aligned manner.
19108 EOM
19109                 d_u32align="$define"
19110                 ;;
19111         esac
19112 else
19113         rp='Can you access character data at unaligned addresses?'
19114         dflt='n'
19115         . ./myread
19116         case "$ans" in
19117         [yY]*)  d_u32align="$undef"  ;;
19118         *)      d_u32align="$define" ;;
19119         esac
19120 fi
19121 $rm_try
19122 ;;
19123 esac
19124
19125 : see if ualarm exists
19126 set ualarm d_ualarm
19127 eval $inlibc
19128
19129 : see if umask exists
19130 set umask d_umask
19131 eval $inlibc
19132
19133 : see if unordered exists
19134 set unordered d_unordered
19135 eval $inlibc
19136
19137 : see if unsetenv exists
19138 set unsetenv d_unsetenv
19139 eval $inlibc
19140
19141 : see if usleep exists
19142 set usleep d_usleep
19143 eval $inlibc
19144
19145 : see if prototype for usleep is available
19146 echo " "
19147 set d_usleepproto usleep $i_unistd unistd.h
19148 eval $hasproto
19149
19150 : see if ustat exists
19151 set ustat d_ustat
19152 eval $inlibc
19153
19154 : see if closedir exists
19155 set closedir d_closedir
19156 eval $inlibc
19157
19158 case "$d_closedir" in
19159 "$define")
19160         echo " "
19161         echo "Checking whether closedir() returns a status..." >&4
19162         cat > try.c <<EOM
19163 #$i_dirent I_DIRENT             /**/
19164 #$i_sysdir I_SYS_DIR            /**/
19165 #$i_sysndir I_SYS_NDIR          /**/
19166 #$i_systypes I_SYS_TYPES        /**/
19167
19168 #if defined(I_SYS_TYPES)
19169 #include <sys/types.h>
19170 #endif
19171 #if defined(I_DIRENT)
19172 #include <dirent.h>
19173 #else
19174 #ifdef I_SYS_NDIR
19175 #include <sys/ndir.h>
19176 #else
19177 #ifdef I_SYS_DIR
19178 #ifdef hp9000s500
19179 #include <ndir.h>       /* may be wrong in the future */
19180 #else
19181 #include <sys/dir.h>
19182 #endif
19183 #endif
19184 #endif
19185 #endif
19186 int main() { return closedir(opendir(".")); }
19187 EOM
19188         set try
19189         if eval $compile_ok; then
19190                 if $run ./try > /dev/null 2>&1 ; then
19191                         echo "Yes, it does."
19192                         val="$undef"
19193                 else
19194                         echo "No, it doesn't."
19195                         val="$define"
19196                 fi
19197         else
19198                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19199                 val="$define"
19200         fi
19201         ;;
19202 *)
19203         val="$undef";
19204         ;;
19205 esac
19206 set d_void_closedir
19207 eval $setvar
19208 $rm_try
19209
19210 : see if there is a wait4
19211 set wait4 d_wait4
19212 eval $inlibc
19213
19214 : see if waitpid exists
19215 set waitpid d_waitpid
19216 eval $inlibc
19217
19218 : look for wcscmp
19219 echo " "
19220 $cat >try.c <<'EOCP'
19221 #include <stdio.h>
19222 #include <wchar.h>
19223 int main ()
19224 {
19225     wchar_t *s = L" ";
19226     return (wcscmp (s, s) ? 1 : 0);
19227     }
19228 EOCP
19229 set try
19230 val="$undef"
19231 if eval $compile; then
19232     `$run ./try`
19233     case "$?" in
19234         0)  echo "A working wcscmp() found." >&4
19235             val="$define" ;;
19236         *)  echo "wcscmp() found, but it doesn't work" >&4
19237             ;;
19238         esac
19239 else
19240     echo "wcscmp() NOT found." >&4
19241     fi
19242 set d_wcscmp
19243 eval $setvar
19244 $rm_try
19245
19246 : see if wcstombs exists
19247 set wcstombs d_wcstombs
19248 eval $inlibc
19249
19250 : look for wcsxfrm
19251 echo " "
19252 $cat >try.c <<'EOCP'
19253 #include <errno.h>
19254 #include <wchar.h>
19255 int main ()
19256 {
19257     wchar_t dst[4], *src = L" ";
19258     errno = 0;
19259     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19260     }
19261 EOCP
19262 set try
19263 val="$undef"
19264 if eval $compile; then
19265     `$run ./try`
19266     case "$?" in
19267         0)  echo "A working wcsxfrm() found." >&4
19268             val="$define" ;;
19269         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19270             ;;
19271         esac
19272 else
19273     echo "wcsxfrm() NOT found." >&4
19274     fi
19275 set d_wcsxfrm
19276 eval $setvar
19277 $rm_try
19278
19279 : see if wctomb exists
19280 set wctomb d_wctomb
19281 eval $inlibc
19282
19283 : see if writev exists
19284 set writev d_writev
19285 eval $inlibc
19286
19287 : check for alignment requirements
19288 echo " "
19289 case "$alignbytes" in
19290     '') echo "Checking alignment constraints..." >&4
19291         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19292             $cat >try.c <<'EOCP'
19293 typedef long double NV;
19294 EOCP
19295         else
19296             $cat >try.c <<'EOCP'
19297 typedef double NV;
19298 EOCP
19299         fi
19300         $cat >>try.c <<'EOCP'
19301 #include <stdio.h>
19302 struct foobar {
19303     char foo;
19304     NV bar;
19305 } try_algn;
19306 int main()
19307 {
19308     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19309     return(0);
19310 }
19311 EOCP
19312         set try
19313         if eval $compile_ok; then
19314             dflt=`$run ./try`
19315         else
19316             dflt='8'
19317             echo "(I can't seem to compile the test program...)"
19318         fi
19319         case "$multiarch" in
19320             *$define*)
19321                 : The usual safe value is 8, but Darwin with -Duselongdouble
19322                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19323                 : Configure to pick a larger value if needed.
19324                 if $test "$dflt" -lt 8; then
19325                     dflt='8'
19326                     echo "Setting alignment to 8 for multiarch support.">&4
19327                 fi
19328                 ;;
19329         esac
19330         ;;
19331     *) dflt="$alignbytes"
19332         ;;
19333 esac
19334 rp="Doubles must be aligned on a how-many-byte boundary?"
19335 . ./myread
19336 alignbytes="$ans"
19337 $rm_try
19338
19339 : set the base revision
19340 baserev=5.0
19341
19342 : length of character in bytes. Is always 1, otherwise it is not C
19343 : This used to be a test using sizeof
19344 charsize=1
19345
19346 : Check for the number of bits in a character
19347 case "$charbits" in
19348 '')     echo "Checking how long a character is (in bits)..." >&4
19349         $cat >try.c <<EOCP
19350 #include <stdio.h>
19351 int main ()
19352 {
19353     int n;
19354     unsigned char c;
19355     for (c = 1, n = 0; c; c <<= 1, n++) ;
19356     printf ("%d\n", n);
19357     return (0);
19358     }
19359 EOCP
19360         set try
19361         if eval $compile_ok; then
19362                 dflt=`$run ./try`
19363         else
19364                 dflt='8'
19365                 echo "(I can't seem to compile the test program.  Guessing...)"
19366         fi
19367         ;;
19368 *)
19369         dflt="$charbits"
19370         ;;
19371 esac
19372 rp="What is the length of a character (in bits)?"
19373 . ./myread
19374 charbits="$ans"
19375 $rm_try
19376 case "$charbits" in
19377 8)      ;;
19378 *)      cat >&4 << EOM
19379 Your system has an unsigned character size of $charbits bits, which
19380 is rather unusual (normally it is 8 bits).  Perl likely will not work
19381 correctly on your system, with subtle bugs in various places.
19382 EOM
19383         rp='Do you really want to continue?'
19384         dflt='n'
19385         . ./myread
19386         case "$ans" in
19387                 [yY])   echo >&4 "Okay, continuing."    ;;
19388                 *)      exit 1                          ;;
19389         esac
19390 esac
19391
19392 : how do we concatenate cpp tokens here?
19393 echo " "
19394 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19395 $cat >cpp_stuff.c <<'EOCP'
19396 #define RCAT(a,b)a/**/b
19397 #define ACAT(a,b)a ## b
19398 RCAT(Rei,ser)
19399 ACAT(Cir,cus)
19400 EOCP
19401 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19402 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19403         echo "Oh!  Smells like ANSI's been here." >&4
19404         echo "We can catify or stringify, separately or together!"
19405         cpp_stuff=42
19406 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19407         echo "Ah, yes!  The good old days!" >&4
19408         echo "However, in the good old days we don't know how to stringify and"
19409         echo "catify at the same time."
19410         cpp_stuff=1
19411 else
19412         $cat >&4 <<EOM
19413 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19414 You're going to have to edit the values of CAT[2-5] in config.h...
19415 EOM
19416         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19417 fi
19418 $rm -f cpp_stuff.*
19419
19420 : see if this is a db.h system
19421 set db.h i_db
19422 eval $inhdr
19423
19424 case "$i_db" in
19425 $define)
19426         : Check db version.
19427         echo " "
19428         echo "Checking Berkeley DB version ..." >&4
19429         $cat >try.c <<EOCP
19430 #$d_const HASCONST
19431 #ifndef HASCONST
19432 #define const
19433 #endif
19434 #include <sys/types.h>
19435 #include <stdio.h>
19436 #$i_stdlib I_STDLIB
19437 #ifdef I_STDLIB
19438 #include <stdlib.h>
19439 #endif
19440 #include <db.h>
19441 int main(int argc, char *argv[])
19442 {
19443 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19444     int Major, Minor, Patch ;
19445     unsigned long Version ;
19446     (void)db_version(&Major, &Minor, &Patch) ;
19447     if (argc == 2) {
19448         printf("%d %d %d %d %d %d\n",
19449                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19450                Major, Minor, Patch);
19451         exit(0);
19452     }
19453     printf("You have Berkeley DB Version 2 or greater.\n");
19454
19455     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19456                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19457     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19458                 Major, Minor, Patch) ;
19459
19460     /* check that db.h & libdb are compatible */
19461     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19462         printf("db.h and libdb are incompatible.\n") ;
19463         exit(3);
19464     }
19465
19466     printf("db.h and libdb are compatible.\n") ;
19467
19468     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19469                 + DB_VERSION_PATCH ;
19470
19471     /* needs to be >= 2.3.4 */
19472     if (Version < 2003004) {
19473     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19474         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19475         exit(2);
19476     }
19477
19478     exit(0);
19479 #else
19480 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19481     if (argc == 2) {
19482         printf("1 0 0\n");
19483         exit(0);
19484     }
19485     printf("You have Berkeley DB Version 1.\n");
19486     exit(0);    /* DB version < 2: the coast is clear. */
19487 #else
19488     exit(1);    /* <db.h> not Berkeley DB? */
19489 #endif
19490 #endif
19491 }
19492 EOCP
19493         set try
19494         if eval $compile_ok && $run ./try; then
19495                 echo 'Looks OK.' >&4
19496                 set `$run ./try 1`
19497                 db_version_major=$1
19498                 db_version_minor=$2
19499                 db_version_patch=$3
19500         else
19501                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19502                 i_db=$undef
19503                 case " $libs " in
19504                 *"-ldb "*)
19505                         : Remove db from list of libraries to use
19506                         echo "Removing unusable -ldb from library list" >&4
19507                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19508                         shift
19509                         libs="$*"
19510                         echo "libs = $libs" >&4
19511                         ;;
19512                 esac
19513         fi
19514         $rm_try
19515         ;;
19516 esac
19517
19518 case "$i_db" in
19519 define)
19520         : Check the return type needed for hash
19521         echo " "
19522         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19523         $cat >try.c <<EOCP
19524 #$d_const HASCONST
19525 #ifndef HASCONST
19526 #define const
19527 #endif
19528 #include <sys/types.h>
19529 #include <db.h>
19530
19531 #ifndef DB_VERSION_MAJOR
19532 u_int32_t hash_cb (const void* ptr, size_t size)
19533 {
19534 }
19535 HASHINFO info;
19536 int main()
19537 {
19538         info.hash = hash_cb;
19539 }
19540 #endif
19541 EOCP
19542         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19543                 if $contains warning try.out >>/dev/null 2>&1 ; then
19544                         db_hashtype='int'
19545                 else
19546                         db_hashtype='u_int32_t'
19547                 fi
19548         else
19549                 : XXX Maybe we should just give up here.
19550                 db_hashtype=u_int32_t
19551                 $cat try.out >&4
19552                 echo "Help:  I can't seem to compile the db test program." >&4
19553                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19554         fi
19555         $rm_try
19556         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19557         ;;
19558 *)      db_hashtype=u_int32_t
19559         ;;
19560 esac
19561 case "$i_db" in
19562 define)
19563         : Check the return type needed for prefix
19564         echo " "
19565         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19566         cat >try.c <<EOCP
19567 #$d_const HASCONST
19568 #ifndef HASCONST
19569 #define const
19570 #endif
19571 #include <sys/types.h>
19572 #include <db.h>
19573
19574 #ifndef DB_VERSION_MAJOR
19575 size_t prefix_cb (const DBT *key1, const DBT *key2)
19576 {
19577 }
19578 BTREEINFO info;
19579 int main()
19580 {
19581         info.prefix = prefix_cb;
19582 }
19583 #endif
19584 EOCP
19585         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19586                 if $contains warning try.out >>/dev/null 2>&1 ; then
19587                         db_prefixtype='int'
19588                 else
19589                         db_prefixtype='size_t'
19590                 fi
19591         else
19592                 db_prefixtype='size_t'
19593                 : XXX Maybe we should just give up here.
19594                 $cat try.out >&4
19595                 echo "Help:  I can't seem to compile the db test program." >&4
19596                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19597         fi
19598         $rm_try
19599         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19600         ;;
19601 *)      db_prefixtype='size_t'
19602         ;;
19603 esac
19604
19605 : How can we generate normalized random numbers ?
19606 echo " "
19607 echo "Using our internal random number implementation..." >&4
19608
19609 case "$ccflags" in
19610 *-Dmy_rand=*|*-Dmy_srand=*)
19611         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19612         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19613         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19614         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19615         ;;
19616 esac
19617
19618 randfunc=Perl_drand48
19619 drand01="Perl_drand48()"
19620 seedfunc="Perl_drand48_init"
19621 randbits=48
19622 randseedtype=U32
19623
19624 : Determine if this is an EBCDIC system
19625 echo " "
19626 echo "Determining whether or not we are on an EBCDIC system..." >&4
19627 $cat >try.c <<'EOM'
19628 int main()
19629 {
19630   if ('M'==0xd4) return 0;
19631   return 1;
19632 }
19633 EOM
19634
19635 val=$undef
19636 set try
19637 if eval $compile_ok; then
19638         if $run ./try; then
19639                 echo "You seem to speak EBCDIC." >&4
19640                 val="$define"
19641         else
19642                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19643         fi
19644 else
19645         echo "I'm unable to compile the test program." >&4
19646         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19647 fi
19648 $rm_try
19649 set ebcdic
19650 eval $setvar
19651
19652 : Check how to flush
19653 echo " "
19654 $cat >&4 <<EOM
19655 Checking how to flush all pending stdio output...
19656 EOM
19657 # I only know how to find the first 32 possibly open files on SunOS.
19658 # See also hints/sunos_4_1.sh and util.c  --AD
19659 case "$osname" in
19660 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19661 esac
19662 $cat >>try.c <<EOCP
19663 #include <stdio.h>
19664 #$i_stdlib I_STDLIB
19665 #ifdef I_STDLIB
19666 #include <stdlib.h>
19667 #endif
19668 #$i_unistd I_UNISTD
19669 #ifdef I_UNISTD
19670 # include <unistd.h>
19671 #endif
19672 #$d_sysconf HAS_SYSCONF
19673 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19674 #ifdef HAS_STDIO_STREAM_ARRAY
19675 # define STDIO_STREAM_ARRAY $stdio_stream_array
19676 #endif
19677 int main() {
19678   FILE* p;
19679   unlink("try.out");
19680   p = fopen("try.out", "w");
19681 #ifdef TRY_FPUTC
19682   fputc('x', p);
19683 #else
19684 # ifdef TRY_FPRINTF
19685   fprintf(p, "x");
19686 # endif
19687 #endif
19688 #ifdef TRY_FFLUSH_NULL
19689   fflush(NULL);
19690 #endif
19691 #ifdef TRY_FFLUSH_ALL
19692   {
19693     long open_max = -1;
19694 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19695     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19696 # else
19697 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19698     open_max = sysconf(_SC_OPEN_MAX);
19699 #  else
19700 #   ifdef FOPEN_MAX
19701     open_max = FOPEN_MAX;
19702 #   else
19703 #    ifdef OPEN_MAX
19704     open_max = OPEN_MAX;
19705 #    else
19706 #     ifdef _NFILE
19707     open_max = _NFILE;
19708 #     endif
19709 #    endif
19710 #   endif
19711 #  endif
19712 # endif
19713 # ifdef HAS_STDIO_STREAM_ARRAY
19714     if (open_max > 0) {
19715       long i;
19716       for (i = 0; i < open_max; i++)
19717             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19718                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19719                 STDIO_STREAM_ARRAY[i]._flag)
19720                 fflush(&STDIO_STREAM_ARRAY[i]);
19721     }
19722   }
19723 # endif
19724 #endif
19725   _exit(42);
19726 }
19727 EOCP
19728 : first we have to find out how _not_ to flush
19729 $to try.c
19730 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19731     output=''
19732     set try -DTRY_FPUTC
19733     if eval $compile; then
19734             $run ./try 2>/dev/null
19735             code="$?"
19736             $from try.out
19737             if $test ! -s try.out -a "X$code" = X42; then
19738                 output=-DTRY_FPUTC
19739             fi
19740     fi
19741     case "$output" in
19742     '')
19743             set try -DTRY_FPRINTF
19744             if eval $compile; then
19745                     $run ./try 2>/dev/null
19746                     code="$?"
19747                     $from try.out
19748                     if $test ! -s try.out -a "X$code" = X42; then
19749                         output=-DTRY_FPRINTF
19750                     fi
19751             fi
19752         ;;
19753     esac
19754 fi
19755 : check for fflush NULL behavior
19756 case "$fflushNULL" in
19757 '')     set try -DTRY_FFLUSH_NULL $output
19758         if eval $compile; then
19759                 $run ./try 2>/dev/null
19760                 code="$?"
19761                 $from try.out
19762                 if $test -s try.out -a "X$code" = X42; then
19763                         fflushNULL="`$cat try.out`"
19764                 else
19765                         if $test "X$code" != X42; then
19766                                 $cat >&4 <<EOM
19767 (If this test failed, don't worry, we'll try another method shortly.)
19768 EOM
19769                         fi
19770                 fi
19771         fi
19772         $rm -f core try.core core.try.*
19773         case "$fflushNULL" in
19774         x)      $cat >&4 <<EOM
19775 Your fflush(NULL) works okay for output streams.
19776 Let's see if it clobbers input pipes...
19777 EOM
19778 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19779 # bug that improperly flushes the input end of pipes.  So we avoid the
19780 # autoflush on fork/system/exec support for now. :-(
19781 $cat >tryp.c <<EOCP
19782 #include <stdio.h>
19783 int
19784 main(int argc, char **argv)
19785 {
19786     char buf[1024];
19787     int i;
19788     char *bp = buf;
19789     while (1) {
19790         while ((i = getc(stdin)) != -1
19791                && (*bp++ = i) != '\n'
19792                && bp < &buf[1024])
19793         /* DO NOTHING */ ;
19794         *bp = '\0';
19795         fprintf(stdout, "%s", buf);
19796         fflush(NULL);
19797         if (i == -1)
19798             return 0;
19799         bp = buf;
19800     }
19801 }
19802 EOCP
19803                 fflushNULL="$define"
19804                 set tryp
19805                 if eval $compile; then
19806                     $rm -f tryp.out
19807                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
19808                     if $test "X$targethost" != X; then
19809                         $to tryp.c
19810                         $to tryp
19811                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19812                     else
19813                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19814                     fi
19815                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19816                        $cat >&4 <<EOM
19817 fflush(NULL) seems to behave okay with input streams.
19818 EOM
19819                         fflushNULL="$define"
19820                     else
19821                         $cat >&4 <<EOM
19822 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19823 EOM
19824                         fflushNULL="$undef"
19825                     fi
19826                 fi
19827                 $rm -f core tryp.c tryp.core core.tryp.*
19828                 ;;
19829         '')     $cat >&4 <<EOM
19830 Your fflush(NULL) isn't working (contrary to ANSI C).
19831 EOM
19832                 fflushNULL="$undef"
19833                 ;;
19834         *)      $cat >&4 <<EOM
19835 Cannot figure out whether your fflush(NULL) works or not.
19836 I'm assuming it doesn't (contrary to ANSI C).
19837 EOM
19838                 fflushNULL="$undef"
19839                 ;;
19840         esac
19841         ;;
19842 $define|true|[yY]*)
19843         fflushNULL="$define"
19844         ;;
19845 *)
19846         fflushNULL="$undef"
19847         ;;
19848 esac
19849 : check explicit looping only if NULL did not work, and if the pipe
19850 : bug does not show up on an explicit flush too
19851 case "$fflushNULL" in
19852 "$undef")
19853         $cat >tryp.c <<EOCP
19854 #include <stdio.h>
19855 int
19856 main(int argc, char **argv)
19857 {
19858     char buf[1024];
19859     int i;
19860     char *bp = buf;
19861     while (1) {
19862         while ((i = getc(stdin)) != -1
19863                && (*bp++ = i) != '\n'
19864                && bp < &buf[1024])
19865         /* DO NOTHING */ ;
19866         *bp = '\0';
19867         fprintf(stdout, "%s", buf);
19868         fflush(stdin);
19869         if (i == -1)
19870             return 0;
19871         bp = buf;
19872     }
19873 }
19874 EOCP
19875         set tryp
19876         if eval $compile; then
19877             $rm -f tryp.out
19878             if $test "X$targethost" != X; then
19879                 $to tryp.c
19880                 $to tryp
19881                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19882             else
19883                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19884             fi
19885             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19886                $cat >&4 <<EOM
19887 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19888 EOM
19889                 : now check for fflushall behaviour
19890                 case "$fflushall" in
19891                 '')     set try -DTRY_FFLUSH_ALL $output
19892                         if eval $compile; then
19893                                 $cat >&4 <<EOM
19894 (Now testing the other method--but note that this also may fail.)
19895 EOM
19896                                 $run ./try 2>/dev/null
19897                                 code=$?
19898                                 $from try.out
19899                                 if $test -s try.out -a "X$code" = X42; then
19900                                         fflushall="`$cat try.out`"
19901                                 fi
19902                         fi
19903                         $rm_try
19904                         case "$fflushall" in
19905                         x)      $cat >&4 <<EOM
19906 Whew. Flushing explicitly all the stdio streams works.
19907 EOM
19908                                 fflushall="$define"
19909                                 ;;
19910                         '')     $cat >&4 <<EOM
19911 Sigh. Flushing explicitly all the stdio streams doesn't work.
19912 EOM
19913                                 fflushall="$undef"
19914                                 ;;
19915                         *)      $cat >&4 <<EOM
19916 Cannot figure out whether flushing stdio streams explicitly works or not.
19917 I'm assuming it doesn't.
19918 EOM
19919                                 fflushall="$undef"
19920                                 ;;
19921                         esac
19922                         ;;
19923                 "$define"|true|[yY]*)
19924                         fflushall="$define"
19925                         ;;
19926                 *)
19927                         fflushall="$undef"
19928                         ;;
19929                 esac
19930             else
19931                 $cat >&4 <<EOM
19932 All is futile.  Even fflush(stdin) clobbers input pipes!
19933 EOM
19934                 fflushall="$undef"
19935             fi
19936         else
19937             fflushall="$undef"
19938         fi
19939         $rm -f core tryp.c tryp.core core.tryp.*
19940         ;;
19941 *)      fflushall="$undef"
19942         ;;
19943 esac
19944
19945 case "$fflushNULL$fflushall" in
19946 undefundef)
19947         $cat <<EOM
19948 OK, I give up.  I cannot figure out how to flush pending stdio output.
19949 We won't be flushing handles at all before fork/exec/popen.
19950 EOM
19951         ;;
19952 esac
19953 $rm_try tryp
19954
19955 : Store the full pathname to the ar program for use in the C program
19956 : Respect a hint or command line value for full_ar.
19957 case "$full_ar" in
19958 '') full_ar=$ar ;;
19959 esac
19960
19961 : Store the full pathname to the sed program for use in the C program
19962 full_sed=$sed
19963
19964 : see what type gids are declared as in the kernel
19965 echo " "
19966 echo "Looking for the type for group ids returned by getgid()."
19967 set gid_t gidtype xxx stdio.h sys/types.h
19968 eval $typedef
19969 case "$gidtype" in
19970 xxx)
19971         xxx=`./findhdr sys/user.h`
19972         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19973         case $1 in
19974         unsigned) dflt="$1 $2" ;;
19975         *) dflt="$1" ;;
19976         esac
19977         ;;
19978 *) dflt="$gidtype";;
19979 esac
19980 case "$gidtype" in
19981 gid_t) echo "gid_t found." ;;
19982 *)      rp="What is the type for group ids returned by getgid()?"
19983         . ./myread
19984         gidtype="$ans"
19985         ;;
19986 esac
19987
19988 : Check the size of GID
19989 echo " "
19990 case "$gidtype" in
19991 *_t) zzz="$gidtype"     ;;
19992 *)   zzz="gid"          ;;
19993 esac
19994 echo "Checking the size of $zzz..." >&4
19995 cat > try.c <<EOCP
19996 #include <sys/types.h>
19997 #include <stdio.h>
19998 #$i_stdlib I_STDLIB
19999 #ifdef I_STDLIB
20000 #include <stdlib.h>
20001 #endif
20002 int main() {
20003     printf("%d\n", (int)sizeof($gidtype));
20004     exit(0);
20005 }
20006 EOCP
20007 set try
20008 if eval $compile_ok; then
20009         yyy=`$run ./try`
20010         case "$yyy" in
20011         '')     gidsize=4
20012                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20013                 ;;
20014         *)      gidsize=$yyy
20015                 echo "Your $zzz is $gidsize bytes long."
20016                 ;;
20017         esac
20018 else
20019         gidsize=4
20020         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20021 fi
20022
20023
20024 : Check if GID is signed
20025 echo " "
20026 case "$gidtype" in
20027 *_t) zzz="$gidtype"     ;;
20028 *)   zzz="gid"          ;;
20029 esac
20030 echo "Checking the sign of $zzz..." >&4
20031 cat > try.c <<EOCP
20032 #include <sys/types.h>
20033 #include <stdio.h>
20034 int main() {
20035         $gidtype foo = -1;
20036         if (foo < 0)
20037                 printf("-1\n");
20038         else
20039                 printf("1\n");
20040 }
20041 EOCP
20042 set try
20043 if eval $compile; then
20044         yyy=`$run ./try`
20045         case "$yyy" in
20046         '')     gidsign=1
20047                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20048                 ;;
20049         *)      gidsign=$yyy
20050                 case "$gidsign" in
20051                  1) echo "Your $zzz is unsigned." ;;
20052                 -1) echo "Your $zzz is signed."   ;;
20053                 esac
20054                 ;;
20055         esac
20056 else
20057         gidsign=1
20058         echo "(I can't compile the test program--guessing unsigned.)" >&4
20059 fi
20060
20061
20062 : Check 64bit sizes
20063 echo " "
20064
20065 if $test X"$quadtype" != X; then
20066
20067 echo "Checking how to print 64-bit integers..." >&4
20068
20069 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20070         $cat >try.c <<'EOCP'
20071 #include <sys/types.h>
20072 #include <stdio.h>
20073 int main() {
20074   int q = 12345678901;
20075   printf("%ld\n", q);
20076 }
20077 EOCP
20078         set try
20079         if eval $compile; then
20080                 yyy=`$run ./try`
20081                 case "$yyy" in
20082                 12345678901)
20083                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20084                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20085                         echo "We will use %d."
20086                         ;;
20087                 esac
20088         fi
20089 fi
20090
20091 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20092         $cat >try.c <<'EOCP'
20093 #include <sys/types.h>
20094 #include <stdio.h>
20095 int main() {
20096   long q = 12345678901;
20097   printf("%ld\n", q);
20098 }
20099 EOCP
20100         set try
20101         if eval $compile; then
20102                 yyy=`$run ./try`
20103                 case "$yyy" in
20104                 12345678901)
20105                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20106                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20107                         echo "We will use %ld."
20108                         ;;
20109                 esac
20110         fi
20111 fi
20112
20113 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20114         $cat >try.c <<'EOCP'
20115 #include <sys/types.h>
20116 #include <inttypes.h>
20117 #include <stdio.h>
20118 int main() {
20119   int64_t q = 12345678901;
20120   printf("%" PRId64 "\n", q);
20121 }
20122 EOCP
20123         set try
20124         if eval $compile; then
20125                 yyy=`$run ./try`
20126                 case "$yyy" in
20127                 12345678901)
20128                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20129                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20130                         echo "We will use the C9X style."
20131                         ;;
20132                 esac
20133         fi
20134 fi
20135
20136 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20137         $cat >try.c <<EOCP
20138 #include <sys/types.h>
20139 #include <stdio.h>
20140 int main() {
20141   $quadtype q = 12345678901;
20142   printf("%Ld\n", q);
20143 }
20144 EOCP
20145         set try
20146         if eval $compile; then
20147                 yyy=`$run ./try`
20148                 case "$yyy" in
20149                 12345678901)
20150                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20151                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20152                         echo "We will use %Ld."
20153                         ;;
20154                 esac
20155         fi
20156 fi
20157
20158 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20159         $cat >try.c <<'EOCP'
20160 #include <sys/types.h>
20161 #include <stdio.h>
20162 int main() {
20163   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20164   printf("%lld\n", q);
20165 }
20166 EOCP
20167         set try
20168         if eval $compile; then
20169                 yyy=`$run ./try`
20170                 case "$yyy" in
20171                 12345678901)
20172                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20173                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20174                         echo "We will use the %lld style."
20175                         ;;
20176                 esac
20177         fi
20178 fi
20179
20180 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20181         $cat >try.c <<EOCP
20182 #include <sys/types.h>
20183 #include <stdio.h>
20184 int main() {
20185   $quadtype q = 12345678901;
20186   printf("%qd\n", q);
20187 }
20188 EOCP
20189         set try
20190         if eval $compile; then
20191                 yyy=`$run ./try`
20192                 case "$yyy" in
20193                 12345678901)
20194                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20195                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20196                         echo "We will use %qd."
20197                         ;;
20198                 esac
20199         fi
20200 fi
20201
20202 if $test X"$sPRId64" = X; then
20203         echo "Cannot figure out how to print 64-bit integers." >&4
20204 fi
20205 $rm_try
20206
20207 fi
20208
20209 case "$sPRId64" in
20210 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20211         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20212         ;;
20213 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20214         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20215         ;;
20216 esac
20217
20218 : Check format strings for internal types
20219 echo " "
20220 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20221
20222 if $test X"$ivsize" = X8; then
20223         ivdformat="$sPRId64"
20224         uvuformat="$sPRIu64"
20225         uvoformat="$sPRIo64"
20226         uvxformat="$sPRIx64"
20227         uvXUformat="$sPRIXU64"
20228 else
20229         if $test X"$ivsize" = X"$longsize"; then
20230                 ivdformat='"ld"'
20231                 uvuformat='"lu"'
20232                 uvoformat='"lo"'
20233                 uvxformat='"lx"'
20234                 uvXUformat='"lX"'
20235         else
20236                 if $test X"$ivsize" = X"$intsize"; then
20237                         ivdformat='"d"'
20238                         uvuformat='"u"'
20239                         uvoformat='"o"'
20240                         uvxformat='"x"'
20241                         uvXUformat='"X"'
20242                 else
20243                         : far out
20244                         if $test X"$ivsize" = X"$shortsize"; then
20245                                 ivdformat='"hd"'
20246                                 uvuformat='"hu"'
20247                                 uvoformat='"ho"'
20248                                 uvxformat='"hx"'
20249                                 uvXUformat='"hX"'
20250                         fi
20251                 fi
20252         fi
20253 fi
20254
20255 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20256         nveformat="$sPRIeldbl"
20257         nvfformat="$sPRIfldbl"
20258         nvgformat="$sPRIgldbl"
20259         nvEUformat="$sPRIEUldbl"
20260         nvFUformat="$sPRIFUldbl"
20261         nvGUformat="$sPRIGUldbl"
20262 else
20263         nveformat='"e"'
20264         nvfformat='"f"'
20265         nvgformat='"g"'
20266         nvEUformat='"E"'
20267         nvFUformat='"F"'
20268         nvGUformat='"G"'
20269 fi
20270
20271 case "$ivdformat" in
20272 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20273     exit 1
20274     ;;
20275 esac
20276
20277 : Check format string for GID
20278
20279 echo " "
20280 $echo "Checking the format string to be used for gids..." >&4
20281
20282 case "$gidsign" in
20283 -1)     if $test X"$gidsize" = X"$ivsize"; then
20284                 gidformat="$ivdformat"
20285         else
20286                 if $test X"$gidsize" = X"$longsize"; then
20287                         gidformat='"ld"'
20288                 else
20289                         if $test X"$gidsize" = X"$intsize"; then
20290                                 gidformat='"d"'
20291                         else
20292                                 if $test X"$gidsize" = X"$shortsize"; then
20293                                         gidformat='"hd"'
20294                                 fi
20295                         fi
20296                 fi
20297         fi
20298         ;;
20299 *)      if $test X"$gidsize" = X"$uvsize"; then
20300                 gidformat="$uvuformat"
20301         else
20302                 if $test X"$gidsize" = X"$longsize"; then
20303                         gidformat='"lu"'
20304                 else
20305                         if $test X"$gidsize" = X"$intsize"; then
20306                                 gidformat='"u"'
20307                         else
20308                                 if $test X"$gidsize" = X"$shortsize"; then
20309                                         gidformat='"hu"'
20310                                 fi
20311                         fi
20312                 fi
20313         fi
20314         ;;
20315 esac
20316
20317 : see if getgroups exists
20318 set getgroups d_getgrps
20319 eval $inlibc
20320
20321 : see if setgroups exists
20322 set setgroups d_setgrps
20323 eval $inlibc
20324
20325 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20326 echo " "
20327 case "$d_getgrps$d_setgrps" in
20328 *define*)
20329         case "$groupstype" in
20330         '') dflt="$gidtype" ;;
20331         *)  dflt="$groupstype" ;;
20332         esac
20333         $cat <<EOM
20334 What type of pointer is the second argument to getgroups() and setgroups()?
20335 Usually this is the same as group ids, $gidtype, but not always.
20336
20337 EOM
20338         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20339         . ./myread
20340         groupstype="$ans"
20341         ;;
20342 *)  groupstype="$gidtype";;
20343 esac
20344
20345 : check whether make sets MAKE
20346 echo " "
20347 echo "Checking if your $make program sets \$(MAKE)..." >&4
20348 case "$make_set_make" in
20349 '')
20350         $sed 's/^X //' > testmake.mak << 'EOF'
20351 Xall:
20352 X       @echo 'maketemp="$(MAKE)"'
20353 EOF
20354         case "`$make -f testmake.mak 2>/dev/null`" in
20355         *maketemp=*) make_set_make='#' ;;
20356         *)      make_set_make="MAKE=$make" ;;
20357         esac
20358         $rm -f testmake.mak
20359         ;;
20360 esac
20361 case "$make_set_make" in
20362 '#') echo "Yup, it does.";;
20363 *) echo "Nope, it doesn't.";;
20364 esac
20365
20366 : see what type is used for mode_t
20367 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20368 set mode_t modetype int stdio.h sys/types.h
20369 eval $typedef_ask
20370
20371 : see if we need va_copy
20372 echo " "
20373 case "$i_stdarg" in
20374 "$define")
20375         $cat >try.c <<EOCP
20376 #include <stdarg.h>
20377 #include <stdio.h>
20378 #$i_stdlib I_STDLIB
20379 #ifdef I_STDLIB
20380 #include <stdlib.h>
20381 #endif
20382 #include <signal.h>
20383
20384 int
20385 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20386 {
20387   return vfprintf(f, fmt, *valp);
20388 }
20389
20390 int
20391 myvfprintf(FILE *f, const  char *fmt, va_list val)
20392 {
20393   return ivfprintf(f, fmt, &val);
20394 }
20395
20396 int
20397 myprintf(char *fmt, ...)
20398 {
20399   va_list val;
20400   va_start(val, fmt);
20401   return myvfprintf(stdout, fmt, val);
20402 }
20403
20404 int
20405 main(int ac, char **av)
20406 {
20407   signal(SIGSEGV, exit);
20408
20409   myprintf("%s%cs all right, then\n", "that", '\'');
20410   exit(0);
20411 }
20412 EOCP
20413         set try
20414         if eval $compile && $run ./try 2>&1 >/dev/null; then
20415                 case "`$run ./try`" in
20416                 "that's all right, then")
20417                         okay=yes
20418                         ;;
20419                 esac
20420         fi
20421         case "$okay" in
20422         yes)    echo "It seems that you don't need va_copy()." >&4
20423                 need_va_copy="$undef"
20424                 ;;
20425         *)      echo "It seems that va_copy() or similar will be needed." >&4
20426                 need_va_copy="$define"
20427                 ;;
20428         esac
20429         $rm_try
20430         ;;
20431 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20432         need_va_copy="$undef"
20433         ;;
20434 esac
20435
20436 : see what type is used for size_t
20437 rp="What is the type used for the length parameter for string functions?"
20438 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20439 eval $typedef_ask
20440
20441 : check for type of arguments to gethostbyaddr. 
20442 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20443         case "$d_gethbyaddr" in
20444         $define)
20445                 $cat <<EOM
20446
20447 Checking to see what type of arguments are accepted by gethostbyaddr().
20448 EOM
20449                 hdrs="$define sys/types.h
20450                         $d_socket sys/socket.h 
20451                         $i_niin netinet/in.h 
20452                         $i_netdb netdb.h
20453                         $i_unistd unistd.h"
20454                 : The first arg can 'char *' or 'void *'
20455                 : The second arg is some of integral type
20456                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20457                         for yyy in size_t long int; do
20458                                 case "$netdb_host_type" in
20459                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20460                                         if ./protochk "$try" $hdrs; then
20461                                                 echo "Your system accepts $xxx for the first arg."
20462                                                 echo "...and $yyy for the second arg."
20463                                                 netdb_host_type="$xxx"
20464                                                 netdb_hlen_type="$yyy"
20465                                         fi
20466                                         ;;
20467                                 esac
20468                         done
20469                 done
20470                 : In case none of those worked, prompt the user.
20471                 case "$netdb_host_type" in
20472                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20473                         dflt='char *'
20474                         . ./myread
20475                         netdb_host_type=$ans
20476                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20477                         dflt="$sizetype"
20478                         . ./myread
20479                         netdb_hlen_type=$ans
20480                         ;;
20481                 esac
20482                 ;;
20483         *)      : no gethostbyaddr, so pick harmless defaults
20484                 netdb_host_type='char *'
20485                 netdb_hlen_type="$sizetype"
20486                 ;;
20487         esac
20488         # Remove the "const" if needed. -- but then we'll have a 
20489         # prototype clash!
20490         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20491 fi
20492
20493 : check for type of argument to gethostbyname. 
20494 if test "X$netdb_name_type" = X ; then
20495         case "$d_gethbyname" in
20496         $define)
20497                 $cat <<EOM
20498
20499 Checking to see what type of argument is accepted by gethostbyname().
20500 EOM
20501                 hdrs="$define sys/types.h
20502                         $d_socket sys/socket.h 
20503                         $i_niin netinet/in.h 
20504                         $i_netdb netdb.h
20505                         $i_unistd unistd.h"
20506                 for xxx in "const char *" "char *"; do
20507                         case "$netdb_name_type" in
20508                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20509                                 if ./protochk "$try" $hdrs; then
20510                                         echo "Your system accepts $xxx."
20511                                         netdb_name_type="$xxx"
20512                                 fi
20513                                 ;;
20514                         esac
20515                 done
20516                 : In case none of those worked, prompt the user.
20517                 case "$netdb_name_type" in
20518                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20519                         dflt='char *'
20520                         . ./myread
20521                         netdb_name_type=$ans
20522                         ;;
20523                 esac
20524                 ;;
20525         *)      : no gethostbyname, so pick harmless default
20526                 netdb_name_type='char *'
20527                 ;;
20528         esac
20529 fi
20530
20531 : check for type of 1st argument to getnetbyaddr. 
20532 if test "X$netdb_net_type" = X ; then
20533         case "$d_getnbyaddr" in
20534         $define)
20535                 $cat <<EOM
20536
20537 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20538 EOM
20539                 hdrs="$define sys/types.h
20540                         $d_socket sys/socket.h 
20541                         $i_niin netinet/in.h 
20542                         $i_netdb netdb.h
20543                         $i_unistd unistd.h"
20544                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20545                         case "$netdb_net_type" in
20546                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20547                                 if ./protochk "$try" $hdrs; then
20548                                         echo "Your system accepts $xxx."
20549                                         netdb_net_type="$xxx"
20550                                 fi
20551                                 ;;
20552                         esac
20553                 done
20554                 : In case none of those worked, prompt the user.
20555                 case "$netdb_net_type" in
20556                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20557                         dflt='long'
20558                         . ./myread
20559                         netdb_net_type=$ans
20560                         ;;
20561                 esac
20562                 ;;
20563         *)      : no getnetbyaddr, so pick harmless default
20564                 netdb_net_type='long'
20565                 ;;
20566         esac
20567 fi
20568 : locate the preferred pager for this system
20569 fn=f/
20570 case "$pager" in
20571 '')
20572         dflt=''
20573         case "$pg" in
20574         /*) dflt=$pg;;
20575         [a-zA-Z]:/*) dflt=$pg;;
20576         esac
20577         case "$more" in
20578         /*) dflt=$more;;
20579         [a-zA-Z]:/*) dflt=$more;;
20580         esac
20581         case "$less" in
20582         /*) dflt=$less;;
20583         [a-zA-Z]:/*) dflt=$less;;
20584         esac
20585         case "$dflt" in
20586         '') dflt=/usr/ucb/more;;
20587         esac
20588         ;;
20589 *)      dflt="$pager"
20590         ;;
20591 esac
20592 fn="f/($dflt)"
20593 echo " "
20594 rp='What pager is used on your system?'
20595 . ./getfile
20596 pager="$ans"
20597
20598 : see what type pids are declared as in the kernel
20599 rp="What is the type of process ids on this system?"
20600 set pid_t pidtype int stdio.h sys/types.h
20601 eval $typedef_ask
20602
20603 : see if ar generates random libraries by itself
20604 echo " "
20605 echo "Checking how to generate random libraries on your machine..." >&4
20606 echo 'int bar1() { return bar2(); }' > bar1.c
20607 echo 'int bar2() { return 2; }' > bar2.c
20608 $cat > foo.c <<EOP
20609 #$i_stdlib I_STDLIB
20610 #ifdef I_STDLIB
20611 #include <stdlib.h>
20612 #endif
20613 int main() { printf("%d\n", bar1()); exit(0); }
20614 EOP
20615 $cc $ccflags -c bar1.c >/dev/null 2>&1
20616 $cc $ccflags -c bar2.c >/dev/null 2>&1
20617 $cc $ccflags -c foo.c >/dev/null 2>&1
20618 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20619 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20620         $run ./foobar >/dev/null 2>&1; then
20621         echo "$ar appears to generate random libraries itself."
20622         orderlib=false
20623         if [ "X$ranlib" = "X" ]; then
20624             ranlib=":"
20625         fi
20626 elif $ar s bar$_a >/dev/null 2>&1 &&
20627         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20628         $run ./foobar >/dev/null 2>&1; then
20629                 echo "a table of contents needs to be added with '$ar s'."
20630                 orderlib=false
20631                 ranlib="$ar s"
20632 elif $ar ts bar$_a >/dev/null 2>&1 &&
20633         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20634         $run ./foobar >/dev/null 2>&1; then
20635                 echo "a table of contents needs to be added with '$ar ts'."
20636                 orderlib=false
20637                 ranlib="$ar ts"
20638 else
20639         case "$ranlib" in
20640         :) ranlib='';;
20641         '')
20642                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20643                 $test -f $ranlib || ranlib=''
20644                 ;;
20645         esac
20646         if $test -n "$ranlib"; then
20647                 echo "your system has '$ranlib'; we'll use that."
20648                 orderlib=false
20649         else
20650                 echo "your system doesn't seem to support random libraries"
20651                 echo "so we'll use lorder and tsort to order the libraries."
20652                 orderlib=true
20653                 ranlib=":"
20654         fi
20655 fi
20656 $rm -f foo* bar*
20657
20658 : see if this is a values.h system
20659 set values.h i_values
20660 eval $inhdr
20661
20662 : Check the max offset that gmtime and localtime accept
20663 echo "Checking max offsets that gmtime () accepts"
20664
20665 case $i_values in
20666     define) yyy="#include <values.h>" ;;
20667     *)      yyy="" ;;
20668     esac
20669
20670 case "$sGMTIME_min/$sGMTIME_max" in
20671     0/0|/)
20672         $cat >try.c <<EOCP
20673 #include <sys/types.h>
20674 #include <stdio.h>
20675 #include <time.h>
20676 $yyy
20677
20678 int i;
20679 struct tm *tmp;
20680 time_t pt;
20681
20682 void gm_check (time_t t, int min_year, int max_year)
20683 {
20684     tmp = gmtime (&t);
20685     if ( tmp == NULL ||
20686         /* Check tm_year overflow */
20687          tmp->tm_year < min_year || tmp->tm_year > max_year)
20688         tmp = NULL;
20689     else
20690         pt = t;
20691     } /* gm_check */
20692
20693 int check_max ()
20694 {
20695     tmp = NULL;
20696     pt  = 0;
20697 #ifdef MAXLONG
20698     gm_check (MAXLONG, 69, 0x7fffffff);
20699 #endif
20700     if (tmp == NULL || tmp->tm_year < 0) {
20701         for (i = 63; i >= 0; i--) {
20702             time_t x = pt | ((time_t)1 << i);
20703             if (x < 0 || x < pt) continue;
20704             gm_check (x, 69, 0x7fffffff);
20705             }
20706         }
20707     printf ("sGMTIME_max=%ld\n", pt);
20708     return (0);
20709     } /* check_max */
20710
20711 int check_min ()
20712 {
20713     tmp = NULL;
20714     pt  = 0;
20715 #ifdef MINLONG
20716     gm_check (MINLONG, -1900, 70);
20717 #endif
20718     if (tmp == NULL) {
20719         for (i = 36; i >= 0; i--) {
20720             time_t x = pt - ((time_t)1 << i);
20721             if (x > 0) continue;
20722             gm_check (x, -1900, 70);
20723             }
20724         }
20725     printf ("sGMTIME_min=%ld\n", pt);
20726     return (0);
20727     } /* check_min */
20728
20729 int main (int argc, char *argv[])
20730 {
20731     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20732     check_max ();
20733     check_min ();
20734     return (0);
20735     } /* main */
20736 EOCP
20737         set try
20738         if eval $compile; then
20739             eval `$run ./try`
20740         else
20741             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20742             fi
20743         $rm_try
20744         ;;
20745     esac
20746
20747 echo "Checking max offsets that localtime () accepts"
20748
20749 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20750     0/0|/)
20751         $cat >try.c <<EOCP
20752 #include <sys/types.h>
20753 #include <stdio.h>
20754 #include <time.h>
20755 $yyy
20756
20757 int i;
20758 struct tm *tmp;
20759 time_t pt;
20760
20761 void local_check (time_t t, int min_year, int max_year)
20762 {
20763     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20764         tmp = NULL;
20765     else
20766         tmp = localtime (&t);
20767     if ( tmp == NULL ||
20768         /* Check tm_year overflow */
20769          tmp->tm_year < min_year || tmp->tm_year > max_year)
20770         tmp = NULL;
20771     else
20772         pt = t;
20773     } /* local_check */
20774
20775 int check_max ()
20776 {
20777     tmp = NULL;
20778     pt  = 0;
20779 #ifdef MAXLONG
20780     local_check (MAXLONG, 69, 0x7fffffff);
20781 #endif
20782     if (tmp == NULL || tmp->tm_year < 0) {
20783         for (i = 63; i >= 0; i--) {
20784             time_t x = pt | ((time_t)1 << i);
20785             if (x < 0 || x < pt) continue;
20786             local_check (x, 69, 0x7fffffff);
20787             }
20788         }
20789     printf ("sLOCALTIME_max=%ld\n", pt);
20790     return (0);
20791    } /* check_max */
20792
20793 int check_min ()
20794 {
20795     tmp = NULL;
20796     pt  = 0;
20797 #ifdef MINLONG
20798     local_check (MINLONG, -1900, 70);
20799 #endif
20800     if (tmp == NULL) {
20801         for (i = 36; i >= 0; i--) {
20802             time_t x = pt - ((time_t)1 << i);
20803             if (x > 0) continue;
20804             local_check (x, -1900, 70);
20805             }
20806         }
20807     printf ("sLOCALTIME_min=%ld\n", pt);
20808     return (0);
20809     } /* check_min */
20810
20811 int main (int argc, char *argv[])
20812 {
20813     check_max ();
20814     check_min ();
20815     return (0);
20816     } /* main */
20817 EOCP
20818         set try
20819         if eval $compile; then
20820             eval `$run ./try`
20821         else
20822             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20823             fi
20824         $rm_try
20825         ;;
20826     esac
20827
20828 : check for type of arguments to select.
20829 case "$selecttype" in
20830 '') case "$d_select" in
20831         $define)
20832                 echo " "
20833                 $cat <<EOM
20834 Checking to see what type of arguments are accepted by select().
20835 EOM
20836                 hdrs="$define sys/types.h
20837                         $i_systime sys/time.h
20838                         $i_sysselct sys/select.h
20839                         $d_socket sys/socket.h"
20840                 : The first arg can be int, unsigned, or size_t
20841                 : The last arg may or may not be 'const'
20842                 val=''
20843                 : void pointer has been seen but using that
20844                 : breaks the selectminbits test
20845                 for xxx in 'fd_set *' 'int *'; do
20846                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20847                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20848                                         case "$val" in
20849                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20850                                                 if ./protochk "$try" $hdrs; then
20851                                                         echo "Your system accepts $xxx."
20852                                                         val="$xxx"
20853                                                 fi
20854                                                 ;;
20855                                         esac
20856                                 done
20857                         done
20858                 done
20859                 case "$val" in
20860                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20861                         case "$d_fd_set" in
20862                                 $define) dflt="fd_set *" ;;
20863                                 *)              dflt="int *" ;;
20864                         esac
20865                         . ./myread
20866                         val=$ans
20867                         ;;
20868                 esac
20869                 selecttype="$val"
20870                 ;;
20871         *)      : no select, so pick a harmless default
20872                 selecttype='int *'
20873                 ;;
20874         esac
20875         ;;
20876 esac
20877
20878 : check for the select 'width'
20879 case "$selectminbits" in
20880 '') safebits=`expr $ptrsize \* 8`
20881     case "$d_select" in
20882         $define)
20883                 $cat <<EOM
20884
20885 Checking to see on how many bits at a time your select() operates...
20886 EOM
20887                 $cat >try.c <<EOCP
20888 #include <sys/types.h>
20889 #$i_time I_TIME
20890 #$i_systime I_SYS_TIME
20891 #$i_systimek I_SYS_TIME_KERNEL
20892 #ifdef I_TIME
20893 #   include <time.h>
20894 #endif
20895 #ifdef I_SYS_TIME
20896 #   ifdef I_SYS_TIME_KERNEL
20897 #       define KERNEL
20898 #   endif
20899 #   include <sys/time.h>
20900 #   ifdef I_SYS_TIME_KERNEL
20901 #       undef KERNEL
20902 #   endif
20903 #endif
20904 #$i_sysselct I_SYS_SELECT
20905 #ifdef I_SYS_SELECT
20906 #include <sys/select.h>
20907 #endif
20908 #$d_socket HAS_SOCKET
20909 #ifdef HAS_SOCKET
20910 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20911 #endif
20912 #include <stdio.h>
20913 #$i_stdlib I_STDLIB
20914 #ifdef I_STDLIB
20915 #include <stdlib.h>
20916 #endif
20917 $selecttype b;
20918 #define S sizeof(*(b))
20919 #define MINBITS 64
20920 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20921 #define NBITS  (NBYTES * 8)
20922 int main() {
20923     char *s = (char *)malloc(NBYTES);
20924     struct timeval t;
20925     int i;
20926     FILE* fp;
20927     int fd;
20928
20929     if (!s)
20930         exit(1);
20931     fclose(stdin);
20932     fp = fopen("try.c", "r");
20933     if (fp == 0)
20934       exit(2);
20935     fd = fileno(fp);
20936     if (fd < 0)
20937       exit(3);
20938     b = ($selecttype)s;
20939     for (i = 0; i < NBITS; i++)
20940         FD_SET(i, b);
20941     t.tv_sec  = 0;
20942     t.tv_usec = 0;
20943     select(fd + 1, b, 0, 0, &t);
20944     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20945     free(s);
20946     printf("%d\n", i + 1);
20947     return 0;
20948 }
20949 EOCP
20950                 set try
20951                 if eval $compile_ok; then
20952                         selectminbits=`$run ./try`
20953                         case "$selectminbits" in
20954                         '')     cat >&4 <<EOM
20955 Cannot figure out on how many bits at a time your select() operates.
20956 I'll play safe and guess it is $safebits bits.
20957 EOM
20958                                 selectminbits=$safebits
20959                                 bits="$safebits bits"
20960                                 ;;
20961                         1)      bits="1 bit" ;;
20962                         *)      bits="$selectminbits bits" ;;
20963                         esac
20964                         echo "Your select() operates on $bits at a time." >&4
20965                 else
20966                         rp='What is the minimum number of bits your select() operates on?'
20967                         case "$byteorder" in
20968                         12345678)       dflt=64 ;;
20969                         1234)           dflt=32 ;;
20970                         *)              dflt=1  ;;
20971                         esac
20972                         . ./myread
20973                         val=$ans
20974                         selectminbits="$val"
20975                 fi
20976                 $rm_try
20977                 ;;
20978         *)      : no select, so pick a harmless default
20979                 selectminbits=$safebits
20980                 ;;
20981         esac
20982         ;;
20983 esac
20984
20985 : Trace out the files included by signal.h, then look for SIGxxx names.
20986 if [ "X$fieldn" = X ]; then
20987         : Just make some guesses.  We check them later.
20988         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
20989 else
20990         xxx=`echo '#include <signal.h>' |
20991         $cppstdin $cppminus $cppflags 2>/dev/null |
20992         $grep '^[       ]*#.*include' |
20993         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20994                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20995 fi
20996 xxxfiles=''
20997 for xx in $xxx /dev/null ; do
20998         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20999 done
21000 case "$xxxfiles" in
21001 '')     xxxfiles=`./findhdr signal.h` ;;
21002 esac
21003 xxx=`awk '
21004 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21005         print substr($2, 4, 20)
21006 }
21007 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21008         print substr($3, 4, 20)
21009 }' $xxxfiles`
21010 : Append some common names just in case the awk scan failed.
21011 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21012 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21013 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21014 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21015 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21016
21017 : generate a few handy files for later
21018 $cat > signal.c <<EOCP
21019 #include <sys/types.h>
21020 #include <signal.h>
21021 #$i_stdlib I_STDLIB
21022 #ifdef I_STDLIB
21023 #include <stdlib.h>
21024 #endif
21025 #include <stdio.h>
21026 int main() {
21027
21028 /* Strange style to avoid deeply-nested #if/#else/#endif */
21029 #ifndef NSIG
21030 #  ifdef _NSIG
21031 #    define NSIG (_NSIG)
21032 #  endif
21033 #endif
21034
21035 #ifndef NSIG
21036 #  ifdef SIGMAX
21037 #    define NSIG (SIGMAX+1)
21038 #  endif
21039 #endif
21040
21041 #ifndef NSIG
21042 #  ifdef SIG_MAX
21043 #    define NSIG (SIG_MAX+1)
21044 #  endif
21045 #endif
21046
21047 #ifndef NSIG
21048 #  ifdef _SIG_MAX
21049 #    define NSIG (_SIG_MAX+1)
21050 #  endif
21051 #endif
21052
21053 #ifndef NSIG
21054 #  ifdef MAXSIG
21055 #    define NSIG (MAXSIG+1)
21056 #  endif
21057 #endif
21058
21059 #ifndef NSIG
21060 #  ifdef MAX_SIG
21061 #    define NSIG (MAX_SIG+1)
21062 #  endif
21063 #endif
21064
21065 #ifndef NSIG
21066 #  ifdef SIGARRAYSIZE
21067 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21068 #  endif
21069 #endif
21070
21071 #ifndef NSIG
21072 #  ifdef _sys_nsig
21073 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21074 #  endif
21075 #endif
21076
21077 /* Default to some arbitrary number that's big enough to get most
21078    of the common signals.
21079 */
21080 #ifndef NSIG
21081 #    define NSIG 50
21082 #endif
21083
21084 printf("NSIG %d\n", NSIG);
21085
21086 #ifndef JUST_NSIG
21087
21088 EOCP
21089
21090 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21091 {
21092         printf "#ifdef SIG"; printf $1; printf "\n"
21093         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21094         printf $1; printf ");\n"
21095         printf "#endif\n"
21096 }
21097 END {
21098         printf "#endif /* JUST_NSIG */\n";
21099         printf "exit(0);\n}\n";
21100 }
21101 ' >>signal.c
21102 $cat >signal.awk <<'EOP'
21103 BEGIN { ndups = 0 }
21104 $1 ~ /^NSIG$/ { nsig = $2 }
21105 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21106     if ($2 > maxsig) { maxsig = $2 }
21107     if (sig_name[$2]) {
21108         dup_name[ndups] = $1
21109         dup_num[ndups] = $2
21110         ndups++
21111     }
21112     else {
21113         sig_name[$2] = $1
21114         sig_num[$2] = $2
21115     }
21116 }
21117 END {
21118     if (nsig == 0) {
21119         nsig = maxsig + 1
21120     }
21121     printf("NSIG %d\n", nsig);
21122     for (n = 1; n < nsig; n++) {
21123         if (sig_name[n]) {
21124             printf("%s %d\n", sig_name[n], sig_num[n])
21125         }
21126         else {
21127             printf("NUM%d %d\n", n, n)
21128         }
21129     }
21130     for (n = 0; n < ndups; n++) {
21131         printf("%s %d\n", dup_name[n], dup_num[n])
21132     }
21133 }
21134 EOP
21135 $cat >signal_cmd <<EOS
21136 $startsh
21137 if $test -s signal.lst; then
21138     echo "Using your existing signal.lst file"
21139         exit 0
21140 fi
21141 xxx="$xxx"
21142 EOS
21143 $cat >>signal_cmd <<'EOS'
21144
21145 set signal
21146 if eval $compile_ok; then
21147         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21148                 $uniq | $awk -f signal.awk >signal.lst
21149 else
21150         echo "(I can't seem be able to compile the whole test program)" >&4
21151         echo "(I'll try it in little pieces.)" >&4
21152         set signal -DJUST_NSIG
21153         if eval $compile_ok; then
21154                 $run ./signal$_exe > signal.nsg
21155                 $cat signal.nsg
21156         else
21157                 echo "I can't seem to figure out how many signals you have." >&4
21158                 echo "Guessing 50." >&4
21159                 echo 'NSIG 50' > signal.nsg
21160         fi
21161         : Now look at all the signal names, one at a time.
21162         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21163                 $cat > signal.c <<EOCP
21164 #include <sys/types.h>
21165 #include <signal.h>
21166 #include <stdio.h>
21167 int main() {
21168 printf("$xx %d\n", SIG${xx});
21169 return 0;
21170 }
21171 EOCP
21172                 set signal
21173                 if eval $compile; then
21174                         echo "SIG${xx} found."
21175                         $run ./signal$_exe  >> signal.ls1
21176                 else
21177                         echo "SIG${xx} NOT found."
21178                 fi
21179         done
21180         if $test -s signal.ls1; then
21181                 $cat signal.nsg signal.ls1 |
21182                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21183         fi
21184
21185 fi
21186 if $test -s signal.lst; then
21187         :
21188 else
21189         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21190         echo 'kill -l' >signal
21191         set X `csh -f <signal`
21192         $rm -f signal
21193         shift
21194         case $# in
21195         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21196         esac
21197         echo $@ | $tr ' ' $trnl | \
21198             $awk '{ printf "%s %d\n", $1, ++s; }
21199                   END { printf "NSIG %d\n", ++s }' >signal.lst
21200 fi
21201 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21202 EOS
21203 chmod a+x signal_cmd
21204 $eunicefix signal_cmd
21205
21206 : generate list of signal names
21207 echo " "
21208 case "$sig_name_init" in
21209 '') doinit=yes ;;
21210 *)  case "$sig_num_init" in
21211     ''|*,*) doinit=yes ;;
21212     esac ;;
21213 esac
21214 case "$doinit" in
21215 yes)
21216         echo "Generating a list of signal names and numbers..." >&4
21217         . ./signal_cmd
21218         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21219         sig_name=`$awk 'BEGIN { printf "ZERO " }
21220                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21221         sig_num=`$awk  'BEGIN { printf "0 " }
21222                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21223         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21224                              !/^NSIG/   { printf "\"%s\", ", $1 }
21225                              END        { printf "0\n" }' signal.lst`
21226         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21227                              !/^NSIG/   { printf "%d, ", $2}
21228                              END        { printf "0\n"}' signal.lst`
21229         ;;
21230 esac
21231 echo "The following $sig_count signals are available:"
21232 echo " "
21233 echo $sig_name | $awk \
21234 'BEGIN { linelen = 0 }
21235 {
21236         for (i = 1; i <= NF; i++) {
21237                 name = "SIG" $i " "
21238                 linelen = linelen + length(name)
21239                 if (linelen > 70) {
21240                         printf "\n"
21241                         linelen = length(name)
21242                 }
21243                 printf "%s", name
21244         }
21245         printf "\n"
21246 }'
21247 sig_size=`echo $sig_name | awk '{print NF}'`
21248 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21249
21250 : Check size of size
21251 echo " "
21252 case "$sizetype" in
21253 *_t) zzz="$sizetype"    ;;
21254 *)   zzz="filesize"     ;;
21255 esac
21256 echo "Checking the size of $zzz..." >&4
21257 cat > try.c <<EOCP
21258 #include <sys/types.h>
21259 #include <stdio.h>
21260 #$i_stdlib I_STDLIB
21261 #ifdef I_STDLIB
21262 #include <stdlib.h>
21263 #endif
21264 int main() {
21265     printf("%d\n", (int)sizeof($sizetype));
21266     exit(0);
21267 }
21268 EOCP
21269 set try
21270 if eval $compile_ok; then
21271         yyy=`$run ./try`
21272         case "$yyy" in
21273         '')     sizesize=4
21274                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21275                 ;;
21276         *)      sizesize=$yyy
21277                 echo "Your $zzz size is $sizesize bytes."
21278                 ;;
21279         esac
21280 else
21281         sizesize=4
21282         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21283 fi
21284
21285
21286 : check for socklen_t
21287 echo " "
21288 echo "Checking to see if you have socklen_t..." >&4
21289 $cat >try.c <<EOCP
21290 #include <sys/types.h>
21291 #$d_socket HAS_SOCKET
21292 #ifdef HAS_SOCKET
21293 #include <sys/socket.h>
21294 #endif
21295 int main() { socklen_t x = 16; }
21296 EOCP
21297 set try
21298 if eval $compile; then
21299         val="$define"
21300         echo "You have socklen_t."
21301 else
21302         val="$undef"
21303         echo "You do not have socklen_t."
21304         case "$sizetype" in
21305         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21306         esac
21307 fi
21308 $rm_try
21309 set d_socklen_t
21310 eval $setvar
21311
21312 : see if this is a socks.h system
21313 set socks.h i_socks
21314 eval $inhdr
21315
21316 : check for type of the size argument to socket calls
21317 case "$d_socket" in
21318 "$define")
21319         $cat <<EOM
21320
21321 Checking to see what type is the last argument of accept().
21322 EOM
21323         yyy=''
21324         case "$d_socklen_t" in
21325         "$define") yyy="$yyy socklen_t"
21326         esac
21327         yyy="$yyy $sizetype int long unsigned"
21328         for xxx in $yyy; do
21329                 case "$socksizetype" in
21330                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21331                         case "$usesocks" in
21332                         "$define")
21333                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21334                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21335                                         socksizetype="$xxx"
21336                                 fi
21337                                 ;;
21338                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21339                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21340                                         socksizetype="$xxx"
21341                                 fi
21342                                 ;;
21343                         esac
21344                         ;;
21345                 esac
21346         done
21347 : In case none of those worked, prompt the user.
21348         case "$socksizetype" in
21349         '')     rp='What is the type for socket address structure sizes?'
21350                 dflt='int'
21351                 . ./myread
21352                 socksizetype=$ans
21353                 ;;
21354         esac
21355         ;;
21356 *)      : no sockets, so pick relatively harmless default
21357         socksizetype='int'
21358         ;;
21359 esac
21360
21361 : see what type is used for signed size_t
21362 set ssize_t ssizetype int stdio.h sys/types.h
21363 eval $typedef
21364 dflt="$ssizetype"
21365 $cat > try.c <<EOM
21366 #include <stdio.h>
21367 #$i_stdlib I_STDLIB
21368 #ifdef I_STDLIB
21369 #include <stdlib.h>
21370 #endif
21371 #include <sys/types.h>
21372 #define Size_t $sizetype
21373 #define SSize_t $dflt
21374 int main()
21375 {
21376         if (sizeof(Size_t) == sizeof(SSize_t))
21377                 printf("$dflt\n");
21378         else if (sizeof(Size_t) == sizeof(int))
21379                 printf("int\n");
21380         else
21381                 printf("long\n");
21382         exit(0);
21383 }
21384 EOM
21385 echo " "
21386 set try
21387 if eval $compile_ok && $run ./try > /dev/null; then
21388         ssizetype=`$run ./try`
21389         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21390 else
21391         $cat >&4 <<EOM
21392 Help! I can't compile and run the ssize_t test program: please enlighten me!
21393 (This is probably a misconfiguration in your system or libraries, and
21394 you really ought to fix it.  Still, I'll try anyway.)
21395
21396 I need a type that is the same size as $sizetype, but is guaranteed to
21397 be signed.  Common values are ssize_t, int and long.
21398
21399 EOM
21400         rp="What signed type is the same size as $sizetype?"
21401         . ./myread
21402         ssizetype="$ans"
21403 fi
21404 $rm_try
21405
21406 : Check the size of st_ino
21407 $echo " "
21408 $echo "Checking the size of st_ino..." >&4
21409 $cat > try.c <<EOCP
21410 #include <sys/stat.h>
21411 #include <stdio.h>
21412 #$i_stdlib I_STDLIB
21413 #ifdef I_STDLIB
21414 #include <stdlib.h>
21415 #endif
21416 int main() {
21417     struct stat st;
21418     printf("%d\n", (int)sizeof(st.st_ino));
21419     exit(0);
21420 }
21421 EOCP
21422 set try
21423 if eval $compile_ok; then
21424         val=`$run ./try`
21425         case "$val" in
21426         '')     st_ino_size=4
21427                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21428                 ;;
21429         *)      st_ino_size=$val
21430                 $echo "Your st_ino is $st_ino_size bytes long."
21431                 ;;
21432         esac
21433 else
21434         st_ino_size=4
21435         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21436 fi
21437 $rm_try
21438
21439 : Check if st_ino is signed
21440 $echo " "
21441 $echo "Checking the sign of st_ino..." >&4
21442 $cat > try.c <<EOCP
21443 #include <sys/stat.h>
21444 #include <stdio.h>
21445 int main() {
21446         struct stat foo;
21447         foo.st_ino = -1;
21448         if (foo.st_ino < 0)
21449                 printf("-1\n");
21450         else
21451                 printf("1\n");
21452 }
21453 EOCP
21454 set try
21455 if eval $compile; then
21456         val=`$run ./try`
21457         case "$val" in
21458         '')     st_ino_sign=1
21459                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21460                 ;;
21461         *)      st_ino_sign=$val
21462                 case "$st_ino_sign" in
21463                  1) $echo "Your st_ino is unsigned." ;;
21464                 -1) $echo "Your st_ino is signed."   ;;
21465                 esac
21466                 ;;
21467         esac
21468 else
21469         st_ino_sign=1
21470         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21471 fi
21472 $rm_try
21473
21474 : see what type of char stdio uses.
21475 echo " "
21476 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21477 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21478         echo "Your stdio uses unsigned chars." >&4
21479         stdchar="unsigned char"
21480 else
21481         echo "Your stdio uses signed chars." >&4
21482         stdchar="char"
21483 fi
21484 $rm -f stdioh
21485
21486 : see what type uids are declared as in the kernel
21487 echo " "
21488 echo "Looking for the type for user ids returned by getuid()."
21489 set uid_t uidtype xxx stdio.h sys/types.h
21490 eval $typedef
21491 case "$uidtype" in
21492 xxx)
21493         xxx=`./findhdr sys/user.h`
21494         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21495         case $1 in
21496         unsigned) dflt="$1 $2" ;;
21497         *) dflt="$1" ;;
21498         esac
21499         ;;
21500 *) dflt="$uidtype";;
21501 esac
21502 case "$uidtype" in
21503 uid_t)  echo "uid_t found." ;;
21504 *)      rp="What is the type for user ids returned by getuid()?"
21505         . ./myread
21506         uidtype="$ans"
21507         ;;
21508 esac
21509
21510 : Check size of UID
21511 echo " "
21512 case "$uidtype" in
21513 *_t) zzz="$uidtype"     ;;
21514 *)   zzz="uid"          ;;
21515 esac
21516 echo "Checking the size of $zzz..." >&4
21517 cat > try.c <<EOCP
21518 #include <sys/types.h>
21519 #include <stdio.h>
21520 #$i_stdlib I_STDLIB
21521 #ifdef I_STDLIB
21522 #include <stdlib.h>
21523 #endif
21524 int main() {
21525     printf("%d\n", (int)sizeof($uidtype));
21526     exit(0);
21527 }
21528 EOCP
21529 set try
21530 if eval $compile_ok; then
21531         yyy=`$run ./try`
21532         case "$yyy" in
21533         '')     uidsize=4
21534                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21535                 ;;
21536         *)      uidsize=$yyy
21537                 echo "Your $zzz is $uidsize bytes long."
21538                 ;;
21539         esac
21540 else
21541         uidsize=4
21542         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21543 fi
21544
21545 : Check if UID is signed
21546 echo " "
21547 case "$uidtype" in
21548 *_t) zzz="$uidtype"     ;;
21549 *)   zzz="uid"          ;;
21550 esac
21551 echo "Checking the sign of $zzz..." >&4
21552 cat > try.c <<EOCP
21553 #include <sys/types.h>
21554 #include <stdio.h>
21555 int main() {
21556         $uidtype foo = -1;
21557         if (foo < 0)
21558                 printf("-1\n");
21559         else
21560                 printf("1\n");
21561 }
21562 EOCP
21563 set try
21564 if eval $compile; then
21565         yyy=`$run ./try`
21566         case "$yyy" in
21567         '')     uidsign=1
21568                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21569                 ;;
21570         *)      uidsign=$yyy
21571                 case "$uidsign" in
21572                  1) echo "Your $zzz is unsigned." ;;
21573                 -1) echo "Your $zzz is signed."   ;;
21574                 esac
21575                 ;;
21576         esac
21577 else
21578         uidsign=1
21579         echo "(I can't compile the test program--guessing unsigned.)" >&4
21580 fi
21581
21582
21583 : Check format string for UID
21584 echo " "
21585 $echo "Checking the format string to be used for uids..." >&4
21586
21587 case "$uidsign" in
21588 -1)     if $test X"$uidsize" = X"$ivsize"; then
21589                 uidformat="$ivdformat"
21590         else
21591                 if $test X"$uidsize" = X"$longsize"; then
21592                         uidformat='"ld"'
21593                 else
21594                         if $test X"$uidsize" = X"$intsize"; then
21595                                 uidformat='"d"'
21596                         else
21597                                 if $test X"$uidsize" = X"$shortsize"; then
21598                                         uidformat='"hd"'
21599                                 fi
21600                         fi
21601                 fi
21602         fi
21603         ;;
21604 *)      if $test X"$uidsize" = X"$uvsize"; then
21605                 uidformat="$uvuformat"
21606         else
21607                 if $test X"$uidsize" = X"$longsize"; then
21608                         uidformat='"lu"'
21609                 else
21610                         if $test X"$uidsize" = X"$intsize"; then
21611                                 uidformat='"u"'
21612                         else
21613                                 if $test X"$uidsize" = X"$shortsize"; then
21614                                         uidformat='"hu"'
21615                                 fi
21616                         fi
21617                 fi
21618         fi
21619         ;;
21620 esac
21621
21622 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21623 echo " "
21624 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21625 $cat >try.c <<'EOM'
21626 /* Intentionally a long probe as I'd like to sanity check that the exact
21627    approach is going to work, as thinking it will work, but only having it
21628    part working at runtime is worse than not having it.  */
21629
21630 #include <sys/types.h>
21631 #include <sys/sysctl.h>
21632 #include <sys/param.h>
21633 #include <stdio.h>
21634 #include <string.h>
21635 #include <stdlib.h>
21636 #include <unistd.h>
21637
21638 int
21639 main(int argc, char **argv) {
21640     char *buffer;
21641     char *argv_leaf = strrchr(argv[0], '/');
21642     char *buffer_leaf;
21643     size_t size = 0;
21644     int mib[4];
21645
21646     mib[0] = CTL_KERN;
21647     mib[1] = KERN_PROC;
21648     mib[2] = KERN_PROC_PATHNAME;
21649     mib[3] = -1;
21650
21651     if (!argv_leaf) {
21652         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21653         return 1;
21654     }
21655
21656     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21657         perror("sysctl");
21658         return 2;
21659     }
21660
21661     if (size < strlen(argv_leaf) + 1) {
21662         fprintf(stderr, "size %lu is too short for a path\n",
21663                 (unsigned long) size);
21664         return 3;
21665     }
21666
21667     if (size > MAXPATHLEN * MAXPATHLEN) {
21668         fprintf(stderr, "size %lu is too long for a path\n",
21669                 (unsigned long) size);
21670         return 4;
21671     }
21672
21673     buffer = malloc(size);
21674     if (!buffer) {
21675         perror("malloc");
21676         return 5;
21677     }
21678
21679     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21680         perror("sysctl");
21681         return 6;
21682     }
21683
21684     if (strlen(buffer) + 1 != size) {
21685         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21686                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21687         return 7;
21688     }
21689
21690
21691     if (*buffer != '/') {
21692         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21693         return 8;
21694     }
21695
21696     if (strstr(buffer, "/./")) {
21697         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21698         return 9;
21699     }
21700
21701     if (strstr(buffer, "/../")) {
21702         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21703         return 10;
21704     }
21705
21706     buffer_leaf = strrchr(buffer, '/');
21707     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21708         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21709         return 11;
21710     }
21711
21712     free(buffer);
21713
21714     return 0;
21715 }
21716 EOM
21717
21718 val=$undef
21719 set try
21720 if eval $compile; then
21721         if $run ./try; then
21722                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21723                 val="$define"
21724         else
21725                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21726                 val="$undef"
21727         fi
21728 else
21729         echo "I'm unable to compile the test program." >&4
21730         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21731         val="$undef"
21732 fi
21733 $rm_try
21734 set usekernprocpathname
21735 eval $setvar
21736
21737 : Determine if we can use _NSGetExecutablePath to find executing program
21738 echo " "
21739 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21740 $cat >try.c <<'EOM'
21741 /* Intentionally a long probe as I'd like to sanity check that the exact
21742    approach is going to work, as thinking it will work, but only having it
21743    part working at runtime is worse than not having it.  */
21744 #include <mach-o/dyld.h>
21745 #include <stdio.h>
21746 #include <stdlib.h>
21747 #include <sys/param.h>
21748 #include <string.h>
21749
21750 int
21751 main(int argc, char **argv) {
21752     char buf[1];
21753     uint32_t size = sizeof(buf);
21754     int result;
21755     char *buffer;
21756     char *tidied;
21757     char *argv_leaf = strrchr(argv[0], '/');
21758     char *tidied_leaf;
21759
21760     if (!argv_leaf) {
21761         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21762         return 1;
21763     }
21764
21765     _NSGetExecutablePath(buf, &size);
21766     if (size > MAXPATHLEN * MAXPATHLEN) {
21767         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21768                 (unsigned int) size);
21769         return 2;
21770     }
21771
21772     buffer = malloc(size);
21773     if (!buffer) {
21774         perror("malloc");
21775         return 3;
21776     }
21777
21778     result = _NSGetExecutablePath(buffer, &size);
21779     if (result != 0) {
21780         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21781                 result, (unsigned int) size);
21782         return 4;
21783     }
21784
21785     tidied = realpath(buffer, NULL);
21786     if (!tidied) {
21787         perror("realpath");
21788         return 5;
21789     }
21790
21791     free(buffer);
21792
21793     if (*tidied != '/') {
21794         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21795         return 6;
21796     }
21797
21798     if (strstr(tidied, "/./")) {
21799         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21800         return 7;
21801     }
21802
21803     if (strstr(tidied, "/../")) {
21804         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21805         return 8;
21806     }
21807
21808     tidied_leaf = strrchr(tidied, '/');
21809     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21810         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21811         return 9;
21812     }
21813
21814     free(tidied);
21815
21816     return 0;
21817 }
21818 EOM
21819
21820 val=$undef
21821 set try
21822 if eval $compile; then
21823         if $run ./try; then
21824                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21825                 val="$define"
21826         else
21827                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21828         fi
21829 else
21830         echo "I'm unable to compile the test program." >&4
21831         echo "I'll assume no _NSGetExecutablePath here." >&4
21832 fi
21833 $rm_try
21834 set usensgetexecutablepath
21835 eval $setvar
21836
21837 : Check if site customization support was requested
21838 case "$usesitecustomize" in
21839     $define|true|[Yy]*)
21840         usesitecustomize="$define"
21841         ;;
21842     *)
21843         usesitecustomize="$undef"
21844         ;;
21845     esac
21846
21847 : see if prototypes support variable argument declarations
21848 echo " "
21849 case "$prototype$i_stdarg" in
21850 $define$define)
21851         echo "It appears we'll be able to prototype varargs functions." >&4
21852         val="$define"
21853         ;;
21854 *)
21855         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21856         val="$undef"
21857         ;;
21858 esac
21859 set vaproto
21860 eval $setvar
21861
21862 : determine compiler compiler
21863 case "$yacc" in
21864 '')
21865         dflt=yacc;;
21866 *)
21867         dflt="$yacc";;
21868 esac
21869 echo " "
21870 comp='yacc'
21871 if $test -f "$byacc$_exe"; then
21872         dflt="$byacc"
21873         comp="byacc or $comp"
21874 fi
21875 if $test -f "$bison$_exe"; then
21876         comp="$comp or bison -y"
21877 fi
21878 rp="Which compiler compiler ($comp) shall I use?"
21879 . ./myread
21880 yacc="$ans"
21881 case "$yacc" in
21882 *bis*)
21883         case "$yacc" in
21884         *-y*) ;;
21885         *)
21886                 yacc="$yacc -y"
21887                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21888                 ;;
21889         esac
21890         ;;
21891 esac
21892
21893 : see if this is a assert.h system
21894 set assert.h i_assert
21895 eval $inhdr
21896
21897 : see if this is a bfd.h system
21898 set bfd.h i_bfd
21899 eval $inhdr
21900
21901 : see if this is an execinfo.h system
21902 set execinfo.h i_execinfo
21903 eval $inhdr
21904
21905 : see if this is a fp.h system
21906 set fp.h i_fp
21907 eval $inhdr
21908
21909 : see if this is a fp_class.h system
21910 set fp_class.h i_fp_class
21911 eval $inhdr
21912
21913 : see if gdbm.h is available
21914 set gdbm.h t_gdbm
21915 eval $inhdr
21916 case "$t_gdbm" in
21917 $define)
21918         : see if gdbm_open exists
21919         set gdbm_open d_gdbm_open
21920         eval $inlibc
21921         case "$d_gdbm_open" in
21922         $undef)
21923                 t_gdbm="$undef"
21924                 echo "We won't be including <gdbm.h>"
21925                 ;;
21926         esac
21927         ;;
21928 esac
21929 val="$t_gdbm"
21930 set i_gdbm
21931 eval $setvar
21932
21933 : see if this is a ieeefp.h system
21934 case "$i_ieeefp" in
21935 '' ) set ieeefp.h i_ieeefp
21936      eval $inhdr
21937      ;;
21938 esac
21939
21940 : see if this is a libutil.h system
21941 set libutil.h i_libutil
21942 eval $inhdr
21943
21944 : see if mach cthreads are available
21945 if test "X$usethreads" = "X$define"; then
21946         set mach/cthreads.h i_machcthr
21947         eval $inhdr
21948 else
21949         i_machcthr="$undef"
21950 fi
21951
21952 : see if this is a mntent.h system
21953 set mntent.h i_mntent
21954 eval $inhdr
21955
21956 : see if net/errno.h is available
21957 val=''
21958 set net/errno.h val
21959 eval $inhdr
21960
21961 : Unfortunately, it causes problems on some systems.  Arrgh.
21962 case "$val" in
21963 $define)
21964         cat > try.c <<'EOM'
21965 #include <stdio.h>
21966 #include <errno.h>
21967 #include <net/errno.h>
21968 int func()
21969 {
21970         return ENOTSOCK;
21971 }
21972 EOM
21973         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21974                 echo "We'll be including <net/errno.h>." >&4
21975         else
21976                 echo "We won't be including <net/errno.h>." >&4
21977                 val="$undef"
21978         fi
21979         $rm_try
21980         ;;
21981 esac
21982 set i_neterrno
21983 eval $setvar
21984
21985 : see if netinet/tcp.h is available
21986 set netinet/tcp.h i_netinettcp
21987 eval $inhdr
21988
21989 : see if this is a poll.h system
21990 set poll.h i_poll
21991 eval $inhdr
21992
21993 : see if this is a prot.h system
21994 set prot.h i_prot
21995 eval $inhdr
21996
21997 : Preprocessor symbols
21998 echo " "
21999 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22000 $cat <<'EOSH' > Cppsym.know
22001 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370
22002 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
22003 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
22004 ansi ANSI_C_SOURCE apollo ardent ARM32 ARM arch_ppc arch_pwr
22005 atarist att386 att3b BeOS BIG_ENDIAN BIT_MSF
22006 bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
22007 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
22008 bull byteorder byte_order c cadmus clang clipper CMU COFF COMPILER_VERSION
22009 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
22010 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
22011 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
22012 FILE_OFFSET_BITS FreeBSD FORTIFY_SOURCE
22013 GCC_NEW_VARARGS gcos gcx gimpel
22014 GLIBC GLIBC_MINOR
22015 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
22016 H3050R H3050RX hbullx20 hcx host_mips
22017 hp200 hp300 hp700 HP700 hp800 hp9000
22018 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22019 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
22020 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
22021 IA32 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22022 INLINE_INTRINSICS INTRINSICS INT64 INTEL interdata is68k itanium ksr1
22023 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
22024 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
22025 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
22026 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
22027 M68000 m68k m88100 m88k M88KBCS_TARGET M_AMD64 M_ARM M_ARMT M_COFF
22028 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3
22029 M_SYS5 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX MACH machine MachTen
22030 MATH_HAS_NO_SIDE_EFFECTS
22031 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
22032 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
22033 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
22034 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
22035 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
22036 NetBSD news1500 news1700 news1800 news1900 news3700
22037 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
22038 ns32016 ns32332 ns32k nsc32000
22039 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22040 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
22041 pc532 pdp11 PGC PIC plexus PORTAR posix
22042 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22043 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc
22044 PROTOTYPES ppc PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
22045 riscix riscos RT S390 S390x SA110 scs SCO sequent sgi SGI_SOURCE SH SH3
22046 sinix SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
22047 sony sony_news sonyrisc sparc sparcv8 sparcv9 sparclite spectrum
22048 stardent stdc STDC_EXT stratos sun sun3 sun386
22049 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
22050 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
22051 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
22052 sysV68 sysV88 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan
22053 TM3200 TM5400 TM5600
22054 tower tower32 tower32_200 tower32_600 tower32_700
22055 tower32_800 tower32_850 tss
22056 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
22057 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
22058 unix UNIX95 UNIX99 unixpc unos
22059 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
22060 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
22061 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
22062 USGr4 USGr4_2
22063 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
22064 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
22065 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22066 z8000 zarch
22067 EOSH
22068 # Maybe put other stuff here too.
22069 cat <<EOSH >>Cppsym.know
22070 $osname
22071 EOSH
22072 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22073 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22074 $cat Cppsym.know > Cppsym.c
22075 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22076 $rm -f Cppsym.a Cppsym.b Cppsym.c
22077 cat <<EOSH > Cppsym
22078 $startsh
22079 if $test \$# -gt 0; then
22080     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22081     if $test -s Cppsym.got; then
22082         $rm -f Cppsym.got
22083         exit 0
22084     fi
22085     $rm -f Cppsym.got
22086     exit 1
22087 else
22088     $tr " " "$trnl" | ./Cppsym.try
22089     exit 0
22090 fi
22091 EOSH
22092 chmod +x Cppsym
22093 $eunicefix Cppsym
22094 cat <<EOSH > Cppsym.try
22095 $startsh
22096 cat <<'EOCP' > try.c
22097 #include <stdio.h>
22098 #if cpp_stuff == 1
22099 #define STRINGIFY(a)    "a"
22100 #endif
22101 #if cpp_stuff == 42
22102 #define StGiFy(a)  #a
22103 #define STRINGIFY(a)    StGiFy(a)
22104 #endif
22105 #if $cpp_stuff != 1 && $cpp_stuff != 42
22106 #   include "Bletch: How does this C preprocessor stringify macros?"
22107 #endif
22108 int main() {
22109 EOCP
22110 $awk \\
22111 EOSH
22112 cat <<'EOSH' >> Cppsym.try
22113 'length($1) > 0 {
22114     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22115     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22116     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22117     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22118 }'       >> try.c
22119 echo 'return 0;}' >> try.c
22120 EOSH
22121 cat <<EOSH >> Cppsym.try
22122 ccflags="$ccflags"
22123 case "$osname-$gccversion" in
22124 irix-) ccflags="\$ccflags -woff 1178" ;;
22125 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22126 esac
22127 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22128 EOSH
22129 chmod +x Cppsym.try
22130 $eunicefix Cppsym.try
22131 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22132 : Add in any Linux cpp "predefined macros":
22133 case "$osname::$gccversion" in
22134   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22135     tHdrH=_tmpHdr
22136     rm -f $tHdrH'.h' $tHdrH
22137     touch $tHdrH'.h'
22138     # Filter out macro arguments, such as Linux's __INT8_C(c)
22139     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22140        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22141        if [ -s $tHdrH'_cppsym.real' ]; then
22142           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22143        fi
22144     fi
22145     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22146   ;;
22147 esac
22148 : now check the C compiler for additional symbols
22149 postprocess_cc_v=''
22150 case "$osname" in
22151 aix) postprocess_cc_v="|$tr , ' '" ;;
22152 esac
22153 $cat >ccsym <<EOS
22154 $startsh
22155 $cat >tmp.c <<EOF
22156 extern int foo;
22157 EOF
22158 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22159 do
22160         case "\$i" in
22161         -D*) echo "\$i" | $sed 's/^-D//';;
22162         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22163         esac
22164 done
22165 $rm_try
22166 EOS
22167 postprocess_cc_v=''
22168 chmod +x ccsym
22169 $eunicefix ccsym
22170 ./ccsym > ccsym1.raw
22171 if $test -s ccsym1.raw; then
22172        $sort ccsym1.raw | $uniq >ccsym.raw
22173 else
22174        mv ccsym1.raw ccsym.raw
22175 fi
22176
22177 $awk '/\=/ { print $0; next }
22178         { print $0"=1" }' ccsym.raw >ccsym.list
22179 $comm -13 Cppsym.true ccsym.list >ccsym.own
22180 $comm -12 Cppsym.true ccsym.list >ccsym.com
22181 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22182 also=''
22183 if $test -z ccsym.raw; then
22184         echo "Your C compiler doesn't seem to define any symbols!" >&4
22185         echo " "
22186         echo "However, your C preprocessor defines the following symbols:"
22187         $cat Cppsym.true
22188         ccsymbols=''
22189         cppsymbols=`$cat Cppsym.true`
22190         cppsymbols=`echo $cppsymbols`
22191         cppccsymbols="$cppsymbols"
22192 else
22193         if $test -s ccsym.com; then
22194                 echo "Your C compiler and pre-processor define these symbols:"
22195                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22196                 also='also '
22197                 symbols='ones'
22198                 cppccsymbols=`$cat ccsym.com`
22199                 cppccsymbols=`echo $cppccsymbols`
22200                 $test "$silent" || sleep 1
22201         fi
22202         if $test -s ccsym.cpp; then
22203                 $test "$also" && echo " "
22204                 echo "Your C pre-processor ${also}defines the following symbols:"
22205                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22206                 also='further '
22207                 cppsymbols=`$cat ccsym.cpp`
22208                 cppsymbols=`echo $cppsymbols`
22209                 $test "$silent" || sleep 1
22210         fi
22211         if $test -s ccsym.own; then
22212                 $test "$also" && echo " "
22213                 echo "Your C compiler ${also}defines the following cpp symbols:"
22214                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22215                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22216                 ccsymbols=`$cat ccsym.own`
22217                 ccsymbols=`echo $ccsymbols`
22218                 $test "$silent" || sleep 1
22219         fi
22220 fi
22221
22222 : add -D_FORTIFY_SOURCE if feasible and not already there
22223 case "$gccversion" in
22224 4.*)    case "$optimize$ccflags" in
22225         *-O*)   case "$ccflags$cppsymbols" in
22226                 *_FORTIFY_SOURCE=*) # Don't add it again.
22227                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22228                         ;;
22229                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22230                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22231                         ;;
22232                 esac
22233                 ;;
22234         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22235                 ;;
22236         esac
22237         ;;
22238 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
22239         ;;
22240 esac
22241
22242 : see if this is a termio system
22243 val="$undef"
22244 val2="$undef"
22245 val3="$undef"
22246 if $test `./findhdr termios.h`; then
22247     set tcsetattr i_termios
22248     eval $inlibc
22249     val3="$i_termios"
22250 fi
22251 echo " "
22252 case "$val3" in
22253     "$define") echo "You have POSIX termios.h... good!" >&4;;
22254     *)  if ./Cppsym pyr; then
22255             case "`$run /bin/universe`" in
22256                 ucb) if $test `./findhdr sgtty.h`; then
22257                         val2="$define"
22258                         echo "<sgtty.h> found." >&4
22259                     else
22260                         echo "System is pyramid with BSD universe."
22261                         ./warn "<sgtty.h> not found--you could have problems."
22262                     fi;;
22263                 *)  if $test `./findhdr termio.h`; then
22264                         val="$define"
22265                         echo "<termio.h> found." >&4
22266                     else
22267                         echo "System is pyramid with USG universe."
22268                         ./warn "<termio.h> not found--you could have problems."
22269                     fi;;
22270             esac
22271         elif ./usg; then
22272             if $test `./findhdr termio.h`; then
22273                 echo "<termio.h> found." >&4
22274                 val="$define"
22275             elif $test `./findhdr sgtty.h`; then
22276                 echo "<sgtty.h> found." >&4
22277                 val2="$define"
22278             else
22279                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22280             fi
22281         else
22282             if $test `./findhdr sgtty.h`; then
22283                 echo "<sgtty.h> found." >&4
22284                 val2="$define"
22285             elif $test `./findhdr termio.h`; then
22286                 echo "<termio.h> found." >&4
22287                 val="$define"
22288             else
22289                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22290             fi
22291         fi;;
22292 esac
22293 set i_termio; eval $setvar
22294 val=$val2; set i_sgtty; eval $setvar
22295 val=$val3; set i_termios; eval $setvar
22296
22297 : see if stdbool is available
22298 : we want a real compile instead of Inhdr because some Solaris systems
22299 : have stdbool.h, but it can only be used if the compiler indicates it
22300 : is sufficiently c99-compliant.
22301 echo " "
22302 $cat >try.c <<EOCP
22303 #include <stdio.h>
22304 #include <stdbool.h>
22305 int func(bool x)
22306 {
22307     return x ? 1 : 0;
22308 }
22309 int main(int argc, char **argv)
22310 {
22311     return func(0);
22312 }
22313 EOCP
22314 set try
22315 if eval $compile; then
22316         echo "<stdbool.h> found." >&4
22317         val="$define"
22318 else
22319         echo "<stdbool.h> NOT found." >&4
22320         val="$undef"
22321 fi
22322 $rm_try
22323 set i_stdbool
22324 eval $setvar
22325
22326 : see if stddef is available
22327 set stddef.h i_stddef
22328 eval $inhdr
22329
22330 : see if sys/access.h is available
22331 set sys/access.h i_sysaccess
22332 eval $inhdr
22333
22334 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22335 set sys/filio.h i_sysfilio
22336 eval $inhdr
22337 echo " "
22338 if $test `./findhdr sys/ioctl.h`; then
22339         val="$define"
22340         echo '<sys/ioctl.h> found.' >&4
22341 else
22342         val="$undef"
22343         if $test $i_sysfilio = "$define"; then
22344             echo '<sys/ioctl.h> NOT found.' >&4
22345         else
22346                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22347                 $test $i_termio = "$define" && xxx="termio.h"
22348                 $test $i_termios = "$define" && xxx="termios.h"
22349 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22350         fi
22351 fi
22352 set i_sysioctl
22353 eval $setvar
22354
22355 : see if socket ioctl defs are in sys/sockio.h
22356 echo " "
22357 xxx=`./findhdr sys/sockio.h`
22358 if $test "$xxx"; then
22359         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22360                 val="$define"
22361                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22362         else
22363                 val="$undef"
22364                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22365         fi
22366 else
22367         val="$undef"
22368         $cat <<EOM
22369 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22370 EOM
22371 fi
22372 set i_syssockio
22373 eval $setvar
22374
22375 : see if this is a syslog.h system
22376 set syslog.h i_syslog
22377 eval $inhdr
22378
22379 : see if this is a sys/mode.h system
22380 set sys/mode.h i_sysmode
22381 eval $inhdr
22382
22383 : see if there is a sys/poll.h file
22384 set sys/poll.h i_syspoll
22385 eval $inhdr
22386
22387 : see if sys/resource.h has to be included
22388 set sys/resource.h i_sysresrc
22389 eval $inhdr
22390
22391 : see if sys/security.h is available
22392 set sys/security.h i_syssecrt
22393 eval $inhdr
22394
22395 : see if this is a sys/statvfs.h system
22396 set sys/statvfs.h i_sysstatvfs
22397 eval $inhdr
22398
22399 : see if this is a sys/un.h system
22400 set sys/un.h i_sysun
22401 eval $inhdr
22402
22403 : see if this is a sys/utsname.h system
22404 set sys/utsname.h i_sysutsname
22405 eval $inhdr
22406
22407 : see if this is a syswait system
22408 set sys/wait.h i_syswait
22409 eval $inhdr
22410
22411 : see if this is a ustat.h system
22412 set ustat.h i_ustat
22413 eval $inhdr
22414
22415 : see if this is an utime system
22416 set utime.h i_utime
22417 eval $inhdr
22418
22419 : see if this is a vfork system
22420 case "$d_vfork" in
22421 "$define")
22422         set vfork.h i_vfork
22423         eval $inhdr
22424         ;;
22425 *)
22426         i_vfork="$undef"
22427         ;;
22428 esac
22429
22430 : Check extensions
22431 echo " "
22432 echo "Looking for extensions..." >&4
22433 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22434 : contain old or inaccurate or duplicate values.
22435 nonxs_extensions=''
22436 xs_extensions=''
22437 : We do not use find because it might not be available.
22438 : We do not just use MANIFEST because the user may have dropped
22439 : some additional extensions into the source tree and expect them
22440 : to be built.
22441
22442 : Function to recursively find available extensions, ignoring DynaLoader
22443 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22444 : In 5.10.1 and later, extensions are stored in directories
22445 : like File-Glob instead of the older File/Glob/.
22446 find_extensions='
22447     for xxx in *; do
22448         case "$xxx" in
22449             DynaLoader|dynaload) ;;
22450             *)
22451             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22452             case "$this_ext" in
22453                 Scalar/List/Utils) this_ext="List/Util" ;;
22454                 PathTools)         this_ext="Cwd"       ;;
22455             esac;
22456             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
22457             if $contains " $this_ext " $tdir/$$.tmp; then
22458                 echo >&4;
22459                 echo "Duplicate directories detected for extension $xxx" >&4;
22460                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22461                 case "$knowitall" in
22462                 "") dflt=y;;
22463                 *) dflt=n;;
22464                 esac;
22465                 . ../UU/myread;
22466                 case "$ans" in
22467                 n*|N*) ;;
22468                 *) echo >&4;
22469                     echo "Ok.  Stopping Configure." >&4;
22470                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22471                     exit 1;;
22472                 esac;
22473                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22474             fi;
22475             $ls -1 $xxx > $tdir/$$.tmp;
22476             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
22477                 xs_extensions="$xs_extensions $this_ext";
22478             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
22479                 xs_extensions="$xs_extensions $this_ext";
22480             elif $test -d $xxx; then
22481                 nonxs_extensions="$nonxs_extensions $this_ext";
22482             fi;
22483             $rm -f $tdir/$$.tmp;
22484             ;;
22485         esac;
22486     done'
22487 tdir=`pwd`
22488 cd "$rsrc/cpan"
22489 set X
22490 shift
22491 eval $find_extensions
22492 cd "$rsrc/dist"
22493 set X
22494 shift
22495 eval $find_extensions
22496 cd "$rsrc/ext"
22497 set X
22498 shift
22499 eval $find_extensions
22500 set X $xs_extensions
22501 shift
22502 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22503 set X $nonxs_extensions
22504 shift
22505 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22506 cd "$tdir"
22507 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22508
22509 : Now see which are supported on this system.
22510 avail_ext=''
22511 for xxx in $xs_extensions ; do
22512         case "$xxx" in
22513         DB_File|db_file)
22514                 case "$i_db" in
22515                 $define) avail_ext="$avail_ext $xxx" ;;
22516                 esac
22517                 ;;
22518         GDBM_File|gdbm_fil)
22519                 case "$i_gdbm" in
22520                 $define) avail_ext="$avail_ext $xxx" ;;
22521                 esac
22522                 ;;
22523         I18N/Langinfo|i18n_lan)
22524                 case "$i_langinfo$d_nl_langinfo" in
22525                 $define$define) avail_ext="$avail_ext $xxx" ;;
22526                 esac
22527                 ;;
22528         IPC/SysV|ipc/sysv)
22529                 : XXX Do we need a useipcsysv variable here
22530                 case "${d_msg}${d_sem}${d_shm}" in
22531                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22532                 esac
22533                 ;;
22534         NDBM_File|ndbm_fil)
22535                 case "$d_ndbm" in
22536                 $define)
22537                     case "$osname-$use64bitint" in
22538                     hpux-define)
22539                         case "$libs" in
22540                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22541                         esac
22542                         ;;
22543                     *) avail_ext="$avail_ext $xxx" ;;
22544                     esac
22545                     ;;
22546                 esac
22547                 ;;
22548         ODBM_File|odbm_fil)
22549                 case "${i_dbm}${i_rpcsvcdbm}" in
22550                 *"${define}"*)
22551                     case "$d_cplusplus" in
22552                     define) ;; # delete as a function name will not work
22553                     *)  case "$osname-$use64bitint" in
22554                         hpux-define)
22555                             case "$libs" in
22556                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22557                             esac
22558                             ;;
22559                         *) avail_ext="$avail_ext $xxx" ;;
22560                         esac
22561                         ;;
22562                     esac
22563                     ;;
22564                 esac
22565                 ;;
22566         Opcode|opcode)
22567                 case "$useopcode" in
22568                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22569                 esac
22570                 ;;
22571         POSIX|posix)
22572                 case "$useposix" in
22573                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22574                 esac
22575                 ;;
22576         Socket|socket)
22577                 case "$d_socket" in
22578                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22579                 esac
22580                 ;;
22581         Sys/Syslog|sys/syslog)
22582                 : XXX syslog requires socket
22583                 case "$d_socket" in
22584                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22585                 esac
22586                 ;;
22587         Thread|thread)
22588                 case "$usethreads" in
22589                 true|$define|y)
22590                         case "$use5005threads" in
22591                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22592                         esac
22593                 esac
22594                 ;;
22595         threads|threads/shared)
22596                 # threads and threads::shared are special cases.
22597                 # To stop people from asking "Perl 5.8.0 was supposed
22598                 # to have this new fancy threads implementation but my
22599                 # perl doesn't have it" and from people trying to
22600                 # (re)install the threads module using CPAN.pm and
22601                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22602                 # the threads.pm and threads/shared.pm will always be
22603                 # there, croaking informatively ("you need to rebuild
22604                 # all of Perl with threads, sorry") when threads haven't
22605                 # been compiled in.
22606                 # --jhi
22607                 avail_ext="$avail_ext $xxx"
22608                 ;;
22609         VMS*)
22610                 ;;
22611         Win32*)
22612                 case "$osname" in
22613                 cygwin) avail_ext="$avail_ext $xxx" ;;
22614                 esac
22615                 ;;
22616         XS/APItest|xs/apitest)
22617                 # This is just for testing.  Skip it unless we have dynamic loading.
22618
22619                 case "$usedl" in
22620                 $define) avail_ext="$avail_ext $xxx" ;;
22621                 esac
22622                 ;;
22623         XS/Typemap|xs/typemap)
22624                 # This is just for testing.  Skip it unless we have dynamic loading.
22625                 case "$usedl" in
22626                 $define) avail_ext="$avail_ext $xxx" ;;
22627                 esac
22628                 ;;
22629         *)      avail_ext="$avail_ext $xxx"
22630                 ;;
22631         esac
22632 done
22633
22634 set X $avail_ext
22635 shift
22636 avail_ext="$*"
22637
22638 case "$onlyextensions" in
22639 '') ;;
22640 *)  keepextensions=''
22641     echo "You have requested that only certain extensions be included..." >&4
22642     for i in $onlyextensions; do
22643         case " $avail_ext " in
22644         *" $i "*)
22645             echo "Keeping extension $i."
22646             keepextensions="$keepextensions $i"
22647             ;;
22648         *) echo "Ignoring extension $i." ;;
22649         esac
22650     done
22651     avail_ext="$keepextensions"
22652     ;;
22653 esac
22654
22655 case "$noextensions" in
22656 '') ;;
22657 *)  keepextensions=''
22658     echo "You have requested that certain extensions be ignored..." >&4
22659     for i in $avail_ext; do
22660         case " $noextensions " in
22661         *" $i "*) echo "Ignoring extension $i." ;;
22662         *) echo "Keeping extension $i.";
22663            keepextensions="$keepextensions $i"
22664            ;;
22665         esac
22666     done
22667     avail_ext="$keepextensions"
22668     ;;
22669 esac
22670
22671 : Now see which nonxs extensions are supported on this system.
22672 : For now assume all are.
22673 nonxs_ext=''
22674 for xxx in $nonxs_extensions ; do
22675         case "$xxx" in
22676         VMS*)
22677                 ;;
22678         *)      nonxs_ext="$nonxs_ext $xxx"
22679                 ;;
22680         esac
22681 done
22682
22683 set X $nonxs_ext
22684 shift
22685 nonxs_ext="$*"
22686
22687 case $usedl in
22688 $define)
22689         $cat <<EOM
22690 A number of extensions are supplied with $package.  You may choose to
22691 compile these extensions for dynamic loading (the default), compile
22692 them into the $package executable (static loading), or not include
22693 them at all.  Answer "none" to include no extensions.
22694 Note that DynaLoader is always built and need not be mentioned here.
22695
22696 EOM
22697         case "$dynamic_ext" in
22698         '')
22699                 : Exclude those listed in static_ext
22700                 dflt=''
22701                 for xxx in $avail_ext; do
22702                         case " $static_ext " in
22703                         *" $xxx "*) ;;
22704                         *) dflt="$dflt $xxx" ;;
22705                         esac
22706                 done
22707                 set X $dflt
22708                 shift
22709                 dflt="$*"
22710                 ;;
22711         *)      dflt="$dynamic_ext"
22712                 # Perhaps we are reusing an old out-of-date config.sh.
22713                 case "$hint" in
22714                 previous)
22715                         if test X"$dynamic_ext" != X"$avail_ext"; then
22716                                 $cat <<EOM
22717 NOTICE:  Your previous config.sh list may be incorrect.
22718 The extensions now available to you are
22719         ${avail_ext}
22720 but the default list from your previous config.sh is
22721         ${dynamic_ext}
22722
22723 EOM
22724                         fi
22725                         ;;
22726                 esac
22727                 ;;
22728         esac
22729         case "$dflt" in
22730         '')     dflt=none;;
22731         esac
22732         rp="What extensions do you wish to load dynamically?"
22733         . ./myread
22734         case "$ans" in
22735         none) dynamic_ext=' ' ;;
22736         *) dynamic_ext="$ans" ;;
22737         esac
22738
22739         case "$static_ext" in
22740         '')
22741                 : Exclude those already listed in dynamic linking
22742                 dflt=''
22743                 for xxx in $avail_ext; do
22744                         case " $dynamic_ext " in
22745                         *" $xxx "*) ;;
22746                         *) dflt="$dflt $xxx" ;;
22747                         esac
22748                 done
22749                 set X $dflt
22750                 shift
22751                 dflt="$*"
22752                 ;;
22753         *)  dflt="$static_ext"
22754                 ;;
22755         esac
22756
22757         case "$dflt" in
22758         '')     dflt=none;;
22759         esac
22760         rp="What extensions do you wish to load statically?"
22761         . ./myread
22762         case "$ans" in
22763         none) static_ext=' ' ;;
22764         *) static_ext="$ans" ;;
22765         esac
22766         ;;
22767 *)
22768         $cat <<EOM
22769 A number of extensions are supplied with $package.  Answer "none"
22770 to include no extensions.
22771 Note that DynaLoader is always built and need not be mentioned here.
22772
22773 EOM
22774         case "$static_ext" in
22775         '') dflt="$avail_ext" ;;
22776         *)      dflt="$static_ext"
22777                 # Perhaps we are reusing an old out-of-date config.sh.
22778                 case "$hint" in
22779                 previous)
22780                         if test X"$static_ext" != X"$avail_ext"; then
22781                                 $cat <<EOM
22782 NOTICE:  Your previous config.sh list may be incorrect.
22783 The extensions now available to you are
22784         ${avail_ext}
22785 but the default list from your previous config.sh is
22786         ${static_ext}
22787
22788 EOM
22789                         fi
22790                         ;;
22791                 esac
22792                 ;;
22793         esac
22794         : Exclude those that are not xs extensions
22795         case "$dflt" in
22796         '')     dflt=none;;
22797         esac
22798         rp="What extensions do you wish to include?"
22799         . ./myread
22800         case "$ans" in
22801         none) static_ext=' ' ;;
22802         *) static_ext="$ans" ;;
22803         esac
22804         ;;
22805 esac
22806 #
22807 # Encode is a special case.  If we are building Encode as a static
22808 # extension, we need to explicitly list its subextensions as well.
22809 # For other nested extensions, this is handled automatically by
22810 # the appropriate Makefile.PL.
22811 case " $static_ext " in
22812         *" Encode "*) # Add the subextensions of Encode
22813         cd "$rsrc/cpan"
22814         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22815                 static_ext="$static_ext Encode/$xxx"
22816                 known_extensions="$known_extensions Encode/$xxx"
22817         done
22818         cd "$tdir"
22819         ;;
22820 esac
22821
22822 set X $dynamic_ext $static_ext $nonxs_ext
22823 shift
22824 extensions="$*"
22825
22826 # Sanity check:  We require an extension suitable for use with
22827 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22828 # should show up as failures in the test suite, but it's helpful to
22829 # catch them now.) The 'extensions' list is normally sorted
22830 # alphabetically, so we need to accept either
22831 #    DB_File ... Fcntl ... IO  ....
22832 # or something like
22833 #    Fcntl ... NDBM_File ... IO  ....
22834 case " $extensions"  in
22835 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22836 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22837 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22838 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22839    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22840    ;;
22841 esac
22842
22843 : Remove libraries needed only for extensions
22844 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22845 : The exception is SunOS 4.x, which needs them.
22846 case "${osname}X${osvers}" in
22847 sunos*X4*)
22848     perllibs="$libs"
22849     ;;
22850 *) case "$usedl" in
22851     $define|true|[yY]*)
22852             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22853             shift
22854             perllibs="$*"
22855             ;;
22856     *)  perllibs="$libs"
22857             ;;
22858     esac
22859     ;;
22860 esac
22861
22862 : Remove build directory name from cppstdin so it can be used from
22863 : either the present location or the final installed location.
22864 echo " "
22865 : Get out of the UU directory to get correct path name.
22866 cd ..
22867 case "$cppstdin" in
22868 `pwd`/cppstdin)
22869         echo "Stripping down cppstdin path name"
22870         cppstdin=cppstdin
22871         ;;
22872 esac
22873 cd UU
22874
22875 : end of configuration questions
22876 echo " "
22877 echo "End of configuration questions."
22878 echo " "
22879
22880 : back to where it started
22881 if test -d ../UU; then
22882         cd ..
22883 fi
22884
22885 : configuration may be unconditionally patched via a 'config.arch' file
22886 if $test -f config.arch; then
22887         echo "I see a config.arch file, loading it." >&4
22888         . ./config.arch
22889 fi
22890
22891 : configuration may be patched via a 'config.over' file
22892 if $test -f config.over; then
22893         echo " "
22894         dflt=y
22895         rp='I see a config.over file.  Do you wish to load it?'
22896         . UU/myread
22897         case "$ans" in
22898         n*) echo "OK, I'll ignore it.";;
22899         *)      . ./config.over
22900                 echo "Configuration override changes have been loaded."
22901                 ;;
22902         esac
22903 fi
22904
22905 : in case they want portability, strip down executable paths
22906 case "$d_portable" in
22907 "$define")
22908         echo " "
22909         echo "Stripping down executable paths..." >&4
22910         for file in $loclist $trylist; do
22911                 eval temp=\$$file
22912                 eval $file=`basename $temp`
22913         done
22914         ;;
22915 esac
22916
22917 : create config.sh file
22918 echo " "
22919 echo "Creating config.sh..." >&4
22920 $spitshell <<EOT >config.sh
22921 $startsh
22922 #
22923 # This file was produced by running the Configure script. It holds all the
22924 # definitions figured out by Configure. Should you modify one of these values,
22925 # do not forget to propagate your changes by running "Configure -der". You may
22926 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22927 #
22928
22929 # Package name      : $package
22930 # Source directory  : $src
22931 # Configuration time: $cf_time
22932 # Configured by     : $cf_by
22933 # Target system     : $myuname
22934
22935 EOT
22936 : Add in command line options if available
22937 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22938
22939 $spitshell <<EOT >>config.sh
22940
22941 Author='$Author'
22942 Date='$Date'
22943 Header='$Header'
22944 Id='$Id'
22945 Locker='$Locker'
22946 Log='$Log'
22947 RCSfile='$RCSfile'
22948 Revision='$Revision'
22949 Source='$Source'
22950 State='$State'
22951 _a='$_a'
22952 _exe='$_exe'
22953 _o='$_o'
22954 afs='$afs'
22955 afsroot='$afsroot'
22956 alignbytes='$alignbytes'
22957 ansi2knr='$ansi2knr'
22958 aphostname='$aphostname'
22959 api_revision='$api_revision'
22960 api_subversion='$api_subversion'
22961 api_version='$api_version'
22962 api_versionstring='$api_versionstring'
22963 ar='$ar'
22964 archlib='$archlib'
22965 archlibexp='$archlibexp'
22966 archname64='$archname64'
22967 archname='$archname'
22968 archobjs='$archobjs'
22969 asctime_r_proto='$asctime_r_proto'
22970 awk='$awk'
22971 baserev='$baserev'
22972 bash='$bash'
22973 bin='$bin'
22974 bin_ELF='$bin_ELF'
22975 binexp='$binexp'
22976 bison='$bison'
22977 byacc='$byacc'
22978 byteorder='$byteorder'
22979 c='$c'
22980 castflags='$castflags'
22981 cat='$cat'
22982 cc='$cc'
22983 cccdlflags='$cccdlflags'
22984 ccdlflags='$ccdlflags'
22985 ccflags='$ccflags'
22986 ccflags_uselargefiles='$ccflags_uselargefiles'
22987 ccname='$ccname'
22988 ccsymbols='$ccsymbols'
22989 ccversion='$ccversion'
22990 cf_by='$cf_by'
22991 cf_email='$cf_email'
22992 cf_time='$cf_time'
22993 charbits='$charbits'
22994 charsize='$charsize'
22995 chgrp='$chgrp'
22996 chmod='$chmod'
22997 chown='$chown'
22998 clocktype='$clocktype'
22999 comm='$comm'
23000 compress='$compress'
23001 contains='$contains'
23002 cp='$cp'
23003 cpio='$cpio'
23004 cpp='$cpp'
23005 cpp_stuff='$cpp_stuff'
23006 cppccsymbols='$cppccsymbols'
23007 cppflags='$cppflags'
23008 cpplast='$cpplast'
23009 cppminus='$cppminus'
23010 cpprun='$cpprun'
23011 cppstdin='$cppstdin'
23012 cppsymbols='$cppsymbols'
23013 crypt_r_proto='$crypt_r_proto'
23014 cryptlib='$cryptlib'
23015 csh='$csh'
23016 ctermid_r_proto='$ctermid_r_proto'
23017 ctime_r_proto='$ctime_r_proto'
23018 d_Gconvert='$d_Gconvert'
23019 d_PRIEUldbl='$d_PRIEUldbl'
23020 d_PRIFUldbl='$d_PRIFUldbl'
23021 d_PRIGUldbl='$d_PRIGUldbl'
23022 d_PRIXU64='$d_PRIXU64'
23023 d_PRId64='$d_PRId64'
23024 d_PRIeldbl='$d_PRIeldbl'
23025 d_PRIfldbl='$d_PRIfldbl'
23026 d_PRIgldbl='$d_PRIgldbl'
23027 d_PRIi64='$d_PRIi64'
23028 d_PRIo64='$d_PRIo64'
23029 d_PRIu64='$d_PRIu64'
23030 d_PRIx64='$d_PRIx64'
23031 d_SCNfldbl='$d_SCNfldbl'
23032 d__fwalk='$d__fwalk'
23033 d_access='$d_access'
23034 d_accessx='$d_accessx'
23035 d_aintl='$d_aintl'
23036 d_alarm='$d_alarm'
23037 d_archlib='$d_archlib'
23038 d_asctime64='$d_asctime64'
23039 d_asctime_r='$d_asctime_r'
23040 d_atolf='$d_atolf'
23041 d_atoll='$d_atoll'
23042 d_attribute_deprecated='$d_attribute_deprecated'
23043 d_attribute_format='$d_attribute_format'
23044 d_attribute_malloc='$d_attribute_malloc'
23045 d_attribute_nonnull='$d_attribute_nonnull'
23046 d_attribute_noreturn='$d_attribute_noreturn'
23047 d_attribute_pure='$d_attribute_pure'
23048 d_attribute_unused='$d_attribute_unused'
23049 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23050 d_backtrace='$d_backtrace'
23051 d_bcmp='$d_bcmp'
23052 d_bcopy='$d_bcopy'
23053 d_bsd='$d_bsd'
23054 d_bsdgetpgrp='$d_bsdgetpgrp'
23055 d_bsdsetpgrp='$d_bsdsetpgrp'
23056 d_builtin_choose_expr='$d_builtin_choose_expr'
23057 d_builtin_expect='$d_builtin_expect'
23058 d_bzero='$d_bzero'
23059 d_c99_variadic_macros='$d_c99_variadic_macros'
23060 d_casti32='$d_casti32'
23061 d_castneg='$d_castneg'
23062 d_charvspr='$d_charvspr'
23063 d_chown='$d_chown'
23064 d_chroot='$d_chroot'
23065 d_chsize='$d_chsize'
23066 d_class='$d_class'
23067 d_clearenv='$d_clearenv'
23068 d_closedir='$d_closedir'
23069 d_cmsghdr_s='$d_cmsghdr_s'
23070 d_const='$d_const'
23071 d_copysignl='$d_copysignl'
23072 d_cplusplus='$d_cplusplus'
23073 d_crypt='$d_crypt'
23074 d_crypt_r='$d_crypt_r'
23075 d_csh='$d_csh'
23076 d_ctermid='$d_ctermid'
23077 d_ctermid_r='$d_ctermid_r'
23078 d_ctime64='$d_ctime64'
23079 d_ctime_r='$d_ctime_r'
23080 d_cuserid='$d_cuserid'
23081 d_dbl_dig='$d_dbl_dig'
23082 d_dbminitproto='$d_dbminitproto'
23083 d_difftime64='$d_difftime64'
23084 d_difftime='$d_difftime'
23085 d_dir_dd_fd='$d_dir_dd_fd'
23086 d_dirfd='$d_dirfd'
23087 d_dirnamlen='$d_dirnamlen'
23088 d_dladdr='$d_dladdr'
23089 d_dlerror='$d_dlerror'
23090 d_dlopen='$d_dlopen'
23091 d_dlsymun='$d_dlsymun'
23092 d_dosuid='$d_dosuid'
23093 d_drand48_r='$d_drand48_r'
23094 d_drand48proto='$d_drand48proto'
23095 d_dup2='$d_dup2'
23096 d_eaccess='$d_eaccess'
23097 d_endgrent='$d_endgrent'
23098 d_endgrent_r='$d_endgrent_r'
23099 d_endhent='$d_endhent'
23100 d_endhostent_r='$d_endhostent_r'
23101 d_endnent='$d_endnent'
23102 d_endnetent_r='$d_endnetent_r'
23103 d_endpent='$d_endpent'
23104 d_endprotoent_r='$d_endprotoent_r'
23105 d_endpwent='$d_endpwent'
23106 d_endpwent_r='$d_endpwent_r'
23107 d_endsent='$d_endsent'
23108 d_endservent_r='$d_endservent_r'
23109 d_eofnblk='$d_eofnblk'
23110 d_eunice='$d_eunice'
23111 d_faststdio='$d_faststdio'
23112 d_fchdir='$d_fchdir'
23113 d_fchmod='$d_fchmod'
23114 d_fchown='$d_fchown'
23115 d_fcntl='$d_fcntl'
23116 d_fcntl_can_lock='$d_fcntl_can_lock'
23117 d_fd_macros='$d_fd_macros'
23118 d_fd_set='$d_fd_set'
23119 d_fds_bits='$d_fds_bits'
23120 d_fgetpos='$d_fgetpos'
23121 d_finite='$d_finite'
23122 d_finitel='$d_finitel'
23123 d_flexfnam='$d_flexfnam'
23124 d_flock='$d_flock'
23125 d_flockproto='$d_flockproto'
23126 d_fork='$d_fork'
23127 d_fp_class='$d_fp_class'
23128 d_fpathconf='$d_fpathconf'
23129 d_fpclass='$d_fpclass'
23130 d_fpclassify='$d_fpclassify'
23131 d_fpclassl='$d_fpclassl'
23132 d_fpos64_t='$d_fpos64_t'
23133 d_frexpl='$d_frexpl'
23134 d_fs_data_s='$d_fs_data_s'
23135 d_fseeko='$d_fseeko'
23136 d_fsetpos='$d_fsetpos'
23137 d_fstatfs='$d_fstatfs'
23138 d_fstatvfs='$d_fstatvfs'
23139 d_fsync='$d_fsync'
23140 d_ftello='$d_ftello'
23141 d_ftime='$d_ftime'
23142 d_futimes='$d_futimes'
23143 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23144 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23145 d_getaddrinfo='$d_getaddrinfo'
23146 d_getcwd='$d_getcwd'
23147 d_getespwnam='$d_getespwnam'
23148 d_getfsstat='$d_getfsstat'
23149 d_getgrent='$d_getgrent'
23150 d_getgrent_r='$d_getgrent_r'
23151 d_getgrgid_r='$d_getgrgid_r'
23152 d_getgrnam_r='$d_getgrnam_r'
23153 d_getgrps='$d_getgrps'
23154 d_gethbyaddr='$d_gethbyaddr'
23155 d_gethbyname='$d_gethbyname'
23156 d_gethent='$d_gethent'
23157 d_gethname='$d_gethname'
23158 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23159 d_gethostbyname_r='$d_gethostbyname_r'
23160 d_gethostent_r='$d_gethostent_r'
23161 d_gethostprotos='$d_gethostprotos'
23162 d_getitimer='$d_getitimer'
23163 d_getlogin='$d_getlogin'
23164 d_getlogin_r='$d_getlogin_r'
23165 d_getmnt='$d_getmnt'
23166 d_getmntent='$d_getmntent'
23167 d_getnameinfo='$d_getnameinfo'
23168 d_getnbyaddr='$d_getnbyaddr'
23169 d_getnbyname='$d_getnbyname'
23170 d_getnent='$d_getnent'
23171 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23172 d_getnetbyname_r='$d_getnetbyname_r'
23173 d_getnetent_r='$d_getnetent_r'
23174 d_getnetprotos='$d_getnetprotos'
23175 d_getpagsz='$d_getpagsz'
23176 d_getpbyname='$d_getpbyname'
23177 d_getpbynumber='$d_getpbynumber'
23178 d_getpent='$d_getpent'
23179 d_getpgid='$d_getpgid'
23180 d_getpgrp2='$d_getpgrp2'
23181 d_getpgrp='$d_getpgrp'
23182 d_getppid='$d_getppid'
23183 d_getprior='$d_getprior'
23184 d_getprotobyname_r='$d_getprotobyname_r'
23185 d_getprotobynumber_r='$d_getprotobynumber_r'
23186 d_getprotoent_r='$d_getprotoent_r'
23187 d_getprotoprotos='$d_getprotoprotos'
23188 d_getprpwnam='$d_getprpwnam'
23189 d_getpwent='$d_getpwent'
23190 d_getpwent_r='$d_getpwent_r'
23191 d_getpwnam_r='$d_getpwnam_r'
23192 d_getpwuid_r='$d_getpwuid_r'
23193 d_getsbyname='$d_getsbyname'
23194 d_getsbyport='$d_getsbyport'
23195 d_getsent='$d_getsent'
23196 d_getservbyname_r='$d_getservbyname_r'
23197 d_getservbyport_r='$d_getservbyport_r'
23198 d_getservent_r='$d_getservent_r'
23199 d_getservprotos='$d_getservprotos'
23200 d_getspnam='$d_getspnam'
23201 d_getspnam_r='$d_getspnam_r'
23202 d_gettimeod='$d_gettimeod'
23203 d_gmtime64='$d_gmtime64'
23204 d_gmtime_r='$d_gmtime_r'
23205 d_gnulibc='$d_gnulibc'
23206 d_grpasswd='$d_grpasswd'
23207 d_hasmntopt='$d_hasmntopt'
23208 d_htonl='$d_htonl'
23209 d_ilogbl='$d_ilogbl'
23210 d_inc_version_list='$d_inc_version_list'
23211 d_index='$d_index'
23212 d_inetaton='$d_inetaton'
23213 d_inetntop='$d_inetntop'
23214 d_inetpton='$d_inetpton'
23215 d_int64_t='$d_int64_t'
23216 d_ip_mreq='$d_ip_mreq'
23217 d_ip_mreq_source='$d_ip_mreq_source'
23218 d_ipv6_mreq='$d_ipv6_mreq'
23219 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23220 d_isascii='$d_isascii'
23221 d_isblank='$d_isblank'
23222 d_isfinite='$d_isfinite'
23223 d_isinf='$d_isinf'
23224 d_isnan='$d_isnan'
23225 d_isnanl='$d_isnanl'
23226 d_killpg='$d_killpg'
23227 d_lchown='$d_lchown'
23228 d_ldbl_dig='$d_ldbl_dig'
23229 d_libm_lib_version='$d_libm_lib_version'
23230 d_libname_unique='$d_libname_unique'
23231 d_link='$d_link'
23232 d_localtime64='$d_localtime64'
23233 d_localtime_r='$d_localtime_r'
23234 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23235 d_locconv='$d_locconv'
23236 d_lockf='$d_lockf'
23237 d_longdbl='$d_longdbl'
23238 d_longlong='$d_longlong'
23239 d_lseekproto='$d_lseekproto'
23240 d_lstat='$d_lstat'
23241 d_madvise='$d_madvise'
23242 d_malloc_good_size='$d_malloc_good_size'
23243 d_malloc_size='$d_malloc_size'
23244 d_mblen='$d_mblen'
23245 d_mbstowcs='$d_mbstowcs'
23246 d_mbtowc='$d_mbtowc'
23247 d_memchr='$d_memchr'
23248 d_memcmp='$d_memcmp'
23249 d_memcpy='$d_memcpy'
23250 d_memmove='$d_memmove'
23251 d_memset='$d_memset'
23252 d_mkdir='$d_mkdir'
23253 d_mkdtemp='$d_mkdtemp'
23254 d_mkfifo='$d_mkfifo'
23255 d_mkstemp='$d_mkstemp'
23256 d_mkstemps='$d_mkstemps'
23257 d_mktime64='$d_mktime64'
23258 d_mktime='$d_mktime'
23259 d_mmap='$d_mmap'
23260 d_modfl='$d_modfl'
23261 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23262 d_modflproto='$d_modflproto'
23263 d_mprotect='$d_mprotect'
23264 d_msg='$d_msg'
23265 d_msg_ctrunc='$d_msg_ctrunc'
23266 d_msg_dontroute='$d_msg_dontroute'
23267 d_msg_oob='$d_msg_oob'
23268 d_msg_peek='$d_msg_peek'
23269 d_msg_proxy='$d_msg_proxy'
23270 d_msgctl='$d_msgctl'
23271 d_msgget='$d_msgget'
23272 d_msghdr_s='$d_msghdr_s'
23273 d_msgrcv='$d_msgrcv'
23274 d_msgsnd='$d_msgsnd'
23275 d_msync='$d_msync'
23276 d_munmap='$d_munmap'
23277 d_mymalloc='$d_mymalloc'
23278 d_ndbm='$d_ndbm'
23279 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23280 d_nice='$d_nice'
23281 d_nl_langinfo='$d_nl_langinfo'
23282 d_nv_preserves_uv='$d_nv_preserves_uv'
23283 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23284 d_off64_t='$d_off64_t'
23285 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23286 d_oldpthreads='$d_oldpthreads'
23287 d_oldsock='$d_oldsock'
23288 d_open3='$d_open3'
23289 d_pathconf='$d_pathconf'
23290 d_pause='$d_pause'
23291 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23292 d_phostname='$d_phostname'
23293 d_pipe='$d_pipe'
23294 d_poll='$d_poll'
23295 d_portable='$d_portable'
23296 d_prctl='$d_prctl'
23297 d_prctl_set_name='$d_prctl_set_name'
23298 d_printf_format_null='$d_printf_format_null'
23299 d_procselfexe='$d_procselfexe'
23300 d_pseudofork='$d_pseudofork'
23301 d_pthread_atfork='$d_pthread_atfork'
23302 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23303 d_pthread_yield='$d_pthread_yield'
23304 d_ptrdiff_t='$d_ptrdiff_t'
23305 d_pwage='$d_pwage'
23306 d_pwchange='$d_pwchange'
23307 d_pwclass='$d_pwclass'
23308 d_pwcomment='$d_pwcomment'
23309 d_pwexpire='$d_pwexpire'
23310 d_pwgecos='$d_pwgecos'
23311 d_pwpasswd='$d_pwpasswd'
23312 d_pwquota='$d_pwquota'
23313 d_qgcvt='$d_qgcvt'
23314 d_quad='$d_quad'
23315 d_random_r='$d_random_r'
23316 d_readdir64_r='$d_readdir64_r'
23317 d_readdir='$d_readdir'
23318 d_readdir_r='$d_readdir_r'
23319 d_readlink='$d_readlink'
23320 d_readv='$d_readv'
23321 d_recvmsg='$d_recvmsg'
23322 d_rename='$d_rename'
23323 d_rewinddir='$d_rewinddir'
23324 d_rmdir='$d_rmdir'
23325 d_safebcpy='$d_safebcpy'
23326 d_safemcpy='$d_safemcpy'
23327 d_sanemcmp='$d_sanemcmp'
23328 d_sbrkproto='$d_sbrkproto'
23329 d_scalbnl='$d_scalbnl'
23330 d_sched_yield='$d_sched_yield'
23331 d_scm_rights='$d_scm_rights'
23332 d_seekdir='$d_seekdir'
23333 d_select='$d_select'
23334 d_sem='$d_sem'
23335 d_semctl='$d_semctl'
23336 d_semctl_semid_ds='$d_semctl_semid_ds'
23337 d_semctl_semun='$d_semctl_semun'
23338 d_semget='$d_semget'
23339 d_semop='$d_semop'
23340 d_sendmsg='$d_sendmsg'
23341 d_setegid='$d_setegid'
23342 d_seteuid='$d_seteuid'
23343 d_setgrent='$d_setgrent'
23344 d_setgrent_r='$d_setgrent_r'
23345 d_setgrps='$d_setgrps'
23346 d_sethent='$d_sethent'
23347 d_sethostent_r='$d_sethostent_r'
23348 d_setitimer='$d_setitimer'
23349 d_setlinebuf='$d_setlinebuf'
23350 d_setlocale='$d_setlocale'
23351 d_setlocale_r='$d_setlocale_r'
23352 d_setnent='$d_setnent'
23353 d_setnetent_r='$d_setnetent_r'
23354 d_setpent='$d_setpent'
23355 d_setpgid='$d_setpgid'
23356 d_setpgrp2='$d_setpgrp2'
23357 d_setpgrp='$d_setpgrp'
23358 d_setprior='$d_setprior'
23359 d_setproctitle='$d_setproctitle'
23360 d_setprotoent_r='$d_setprotoent_r'
23361 d_setpwent='$d_setpwent'
23362 d_setpwent_r='$d_setpwent_r'
23363 d_setregid='$d_setregid'
23364 d_setresgid='$d_setresgid'
23365 d_setresuid='$d_setresuid'
23366 d_setreuid='$d_setreuid'
23367 d_setrgid='$d_setrgid'
23368 d_setruid='$d_setruid'
23369 d_setsent='$d_setsent'
23370 d_setservent_r='$d_setservent_r'
23371 d_setsid='$d_setsid'
23372 d_setvbuf='$d_setvbuf'
23373 d_shm='$d_shm'
23374 d_shmat='$d_shmat'
23375 d_shmatprototype='$d_shmatprototype'
23376 d_shmctl='$d_shmctl'
23377 d_shmdt='$d_shmdt'
23378 d_shmget='$d_shmget'
23379 d_sigaction='$d_sigaction'
23380 d_signbit='$d_signbit'
23381 d_sigprocmask='$d_sigprocmask'
23382 d_sigsetjmp='$d_sigsetjmp'
23383 d_sin6_scope_id='$d_sin6_scope_id'
23384 d_sitearch='$d_sitearch'
23385 d_snprintf='$d_snprintf'
23386 d_sockaddr_in6='$d_sockaddr_in6'
23387 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23388 d_sockatmark='$d_sockatmark'
23389 d_sockatmarkproto='$d_sockatmarkproto'
23390 d_socket='$d_socket'
23391 d_socklen_t='$d_socklen_t'
23392 d_sockpair='$d_sockpair'
23393 d_socks5_init='$d_socks5_init'
23394 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23395 d_sqrtl='$d_sqrtl'
23396 d_srand48_r='$d_srand48_r'
23397 d_srandom_r='$d_srandom_r'
23398 d_sresgproto='$d_sresgproto'
23399 d_sresuproto='$d_sresuproto'
23400 d_statblks='$d_statblks'
23401 d_statfs_f_flags='$d_statfs_f_flags'
23402 d_statfs_s='$d_statfs_s'
23403 d_static_inline='$d_static_inline'
23404 d_statvfs='$d_statvfs'
23405 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23406 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23407 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23408 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23409 d_stdio_stream_array='$d_stdio_stream_array'
23410 d_stdiobase='$d_stdiobase'
23411 d_stdstdio='$d_stdstdio'
23412 d_strchr='$d_strchr'
23413 d_strcoll='$d_strcoll'
23414 d_strctcpy='$d_strctcpy'
23415 d_strerrm='$d_strerrm'
23416 d_strerror='$d_strerror'
23417 d_strerror_r='$d_strerror_r'
23418 d_strftime='$d_strftime'
23419 d_strlcat='$d_strlcat'
23420 d_strlcpy='$d_strlcpy'
23421 d_strtod='$d_strtod'
23422 d_strtol='$d_strtol'
23423 d_strtold='$d_strtold'
23424 d_strtoll='$d_strtoll'
23425 d_strtoq='$d_strtoq'
23426 d_strtoul='$d_strtoul'
23427 d_strtoull='$d_strtoull'
23428 d_strtouq='$d_strtouq'
23429 d_strxfrm='$d_strxfrm'
23430 d_suidsafe='$d_suidsafe'
23431 d_symlink='$d_symlink'
23432 d_syscall='$d_syscall'
23433 d_syscallproto='$d_syscallproto'
23434 d_sysconf='$d_sysconf'
23435 d_sysernlst='$d_sysernlst'
23436 d_syserrlst='$d_syserrlst'
23437 d_system='$d_system'
23438 d_tcgetpgrp='$d_tcgetpgrp'
23439 d_tcsetpgrp='$d_tcsetpgrp'
23440 d_telldir='$d_telldir'
23441 d_telldirproto='$d_telldirproto'
23442 d_time='$d_time'
23443 d_timegm='$d_timegm'
23444 d_times='$d_times'
23445 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23446 d_tm_tm_zone='$d_tm_tm_zone'
23447 d_tmpnam_r='$d_tmpnam_r'
23448 d_truncate='$d_truncate'
23449 d_ttyname_r='$d_ttyname_r'
23450 d_tzname='$d_tzname'
23451 d_u32align='$d_u32align'
23452 d_ualarm='$d_ualarm'
23453 d_umask='$d_umask'
23454 d_uname='$d_uname'
23455 d_union_semun='$d_union_semun'
23456 d_unordered='$d_unordered'
23457 d_unsetenv='$d_unsetenv'
23458 d_usleep='$d_usleep'
23459 d_usleepproto='$d_usleepproto'
23460 d_ustat='$d_ustat'
23461 d_vendorarch='$d_vendorarch'
23462 d_vendorbin='$d_vendorbin'
23463 d_vendorlib='$d_vendorlib'
23464 d_vendorscript='$d_vendorscript'
23465 d_vfork='$d_vfork'
23466 d_void_closedir='$d_void_closedir'
23467 d_voidsig='$d_voidsig'
23468 d_voidtty='$d_voidtty'
23469 d_volatile='$d_volatile'
23470 d_vprintf='$d_vprintf'
23471 d_vsnprintf='$d_vsnprintf'
23472 d_wait4='$d_wait4'
23473 d_waitpid='$d_waitpid'
23474 d_wcscmp='$d_wcscmp'
23475 d_wcstombs='$d_wcstombs'
23476 d_wcsxfrm='$d_wcsxfrm'
23477 d_wctomb='$d_wctomb'
23478 d_writev='$d_writev'
23479 d_xenix='$d_xenix'
23480 date='$date'
23481 db_hashtype='$db_hashtype'
23482 db_prefixtype='$db_prefixtype'
23483 db_version_major='$db_version_major'
23484 db_version_minor='$db_version_minor'
23485 db_version_patch='$db_version_patch'
23486 direntrytype='$direntrytype'
23487 dlext='$dlext'
23488 dlsrc='$dlsrc'
23489 doublesize='$doublesize'
23490 drand01='$drand01'
23491 drand48_r_proto='$drand48_r_proto'
23492 dtrace='$dtrace'
23493 dynamic_ext='$dynamic_ext'
23494 eagain='$eagain'
23495 ebcdic='$ebcdic'
23496 echo='$echo'
23497 egrep='$egrep'
23498 emacs='$emacs'
23499 endgrent_r_proto='$endgrent_r_proto'
23500 endhostent_r_proto='$endhostent_r_proto'
23501 endnetent_r_proto='$endnetent_r_proto'
23502 endprotoent_r_proto='$endprotoent_r_proto'
23503 endpwent_r_proto='$endpwent_r_proto'
23504 endservent_r_proto='$endservent_r_proto'
23505 eunicefix='$eunicefix'
23506 exe_ext='$exe_ext'
23507 expr='$expr'
23508 extensions='$extensions'
23509 extern_C='$extern_C'
23510 extras='$extras'
23511 fflushNULL='$fflushNULL'
23512 fflushall='$fflushall'
23513 find='$find'
23514 firstmakefile='$firstmakefile'
23515 flex='$flex'
23516 fpossize='$fpossize'
23517 fpostype='$fpostype'
23518 freetype='$freetype'
23519 from='$from'
23520 full_ar='$full_ar'
23521 full_csh='$full_csh'
23522 full_sed='$full_sed'
23523 gccansipedantic='$gccansipedantic'
23524 gccosandvers='$gccosandvers'
23525 gccversion='$gccversion'
23526 getgrent_r_proto='$getgrent_r_proto'
23527 getgrgid_r_proto='$getgrgid_r_proto'
23528 getgrnam_r_proto='$getgrnam_r_proto'
23529 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23530 gethostbyname_r_proto='$gethostbyname_r_proto'
23531 gethostent_r_proto='$gethostent_r_proto'
23532 getlogin_r_proto='$getlogin_r_proto'
23533 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23534 getnetbyname_r_proto='$getnetbyname_r_proto'
23535 getnetent_r_proto='$getnetent_r_proto'
23536 getprotobyname_r_proto='$getprotobyname_r_proto'
23537 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23538 getprotoent_r_proto='$getprotoent_r_proto'
23539 getpwent_r_proto='$getpwent_r_proto'
23540 getpwnam_r_proto='$getpwnam_r_proto'
23541 getpwuid_r_proto='$getpwuid_r_proto'
23542 getservbyname_r_proto='$getservbyname_r_proto'
23543 getservbyport_r_proto='$getservbyport_r_proto'
23544 getservent_r_proto='$getservent_r_proto'
23545 getspnam_r_proto='$getspnam_r_proto'
23546 gidformat='$gidformat'
23547 gidsign='$gidsign'
23548 gidsize='$gidsize'
23549 gidtype='$gidtype'
23550 glibpth='$glibpth'
23551 gmake='$gmake'
23552 gmtime_r_proto='$gmtime_r_proto'
23553 gnulibc_version='$gnulibc_version'
23554 grep='$grep'
23555 groupcat='$groupcat'
23556 groupstype='$groupstype'
23557 gzip='$gzip'
23558 h_fcntl='$h_fcntl'
23559 h_sysfile='$h_sysfile'
23560 hint='$hint'
23561 hostcat='$hostcat'
23562 hostgenerate='$hostgenerate'
23563 hostosname='$hostosname'
23564 hostperl='$hostperl'
23565 html1dir='$html1dir'
23566 html1direxp='$html1direxp'
23567 html3dir='$html3dir'
23568 html3direxp='$html3direxp'
23569 i16size='$i16size'
23570 i16type='$i16type'
23571 i32size='$i32size'
23572 i32type='$i32type'
23573 i64size='$i64size'
23574 i64type='$i64type'
23575 i8size='$i8size'
23576 i8type='$i8type'
23577 i_arpainet='$i_arpainet'
23578 i_assert='$i_assert'
23579 i_bfd='$i_bfd'
23580 i_bsdioctl='$i_bsdioctl'
23581 i_crypt='$i_crypt'
23582 i_db='$i_db'
23583 i_dbm='$i_dbm'
23584 i_dirent='$i_dirent'
23585 i_dlfcn='$i_dlfcn'
23586 i_execinfo='$i_execinfo'
23587 i_fcntl='$i_fcntl'
23588 i_float='$i_float'
23589 i_fp='$i_fp'
23590 i_fp_class='$i_fp_class'
23591 i_gdbm='$i_gdbm'
23592 i_gdbm_ndbm='$i_gdbm_ndbm'
23593 i_gdbmndbm='$i_gdbmndbm'
23594 i_grp='$i_grp'
23595 i_ieeefp='$i_ieeefp'
23596 i_inttypes='$i_inttypes'
23597 i_langinfo='$i_langinfo'
23598 i_libutil='$i_libutil'
23599 i_limits='$i_limits'
23600 i_locale='$i_locale'
23601 i_machcthr='$i_machcthr'
23602 i_malloc='$i_malloc'
23603 i_mallocmalloc='$i_mallocmalloc'
23604 i_math='$i_math'
23605 i_memory='$i_memory'
23606 i_mntent='$i_mntent'
23607 i_ndbm='$i_ndbm'
23608 i_netdb='$i_netdb'
23609 i_neterrno='$i_neterrno'
23610 i_netinettcp='$i_netinettcp'
23611 i_niin='$i_niin'
23612 i_poll='$i_poll'
23613 i_prot='$i_prot'
23614 i_pthread='$i_pthread'
23615 i_pwd='$i_pwd'
23616 i_rpcsvcdbm='$i_rpcsvcdbm'
23617 i_sgtty='$i_sgtty'
23618 i_shadow='$i_shadow'
23619 i_socks='$i_socks'
23620 i_stdarg='$i_stdarg'
23621 i_stdbool='$i_stdbool'
23622 i_stddef='$i_stddef'
23623 i_stdlib='$i_stdlib'
23624 i_string='$i_string'
23625 i_sunmath='$i_sunmath'
23626 i_sysaccess='$i_sysaccess'
23627 i_sysdir='$i_sysdir'
23628 i_sysfile='$i_sysfile'
23629 i_sysfilio='$i_sysfilio'
23630 i_sysin='$i_sysin'
23631 i_sysioctl='$i_sysioctl'
23632 i_syslog='$i_syslog'
23633 i_sysmman='$i_sysmman'
23634 i_sysmode='$i_sysmode'
23635 i_sysmount='$i_sysmount'
23636 i_sysndir='$i_sysndir'
23637 i_sysparam='$i_sysparam'
23638 i_syspoll='$i_syspoll'
23639 i_sysresrc='$i_sysresrc'
23640 i_syssecrt='$i_syssecrt'
23641 i_sysselct='$i_sysselct'
23642 i_syssockio='$i_syssockio'
23643 i_sysstat='$i_sysstat'
23644 i_sysstatfs='$i_sysstatfs'
23645 i_sysstatvfs='$i_sysstatvfs'
23646 i_systime='$i_systime'
23647 i_systimek='$i_systimek'
23648 i_systimes='$i_systimes'
23649 i_systypes='$i_systypes'
23650 i_sysuio='$i_sysuio'
23651 i_sysun='$i_sysun'
23652 i_sysutsname='$i_sysutsname'
23653 i_sysvfs='$i_sysvfs'
23654 i_syswait='$i_syswait'
23655 i_termio='$i_termio'
23656 i_termios='$i_termios'
23657 i_time='$i_time'
23658 i_unistd='$i_unistd'
23659 i_ustat='$i_ustat'
23660 i_utime='$i_utime'
23661 i_values='$i_values'
23662 i_varargs='$i_varargs'
23663 i_varhdr='$i_varhdr'
23664 i_vfork='$i_vfork'
23665 ignore_versioned_solibs='$ignore_versioned_solibs'
23666 inc_version_list='$inc_version_list'
23667 inc_version_list_init='$inc_version_list_init'
23668 incpath='$incpath'
23669 incpth='$incpth'
23670 inews='$inews'
23671 initialinstalllocation='$initialinstalllocation'
23672 installarchlib='$installarchlib'
23673 installbin='$installbin'
23674 installhtml1dir='$installhtml1dir'
23675 installhtml3dir='$installhtml3dir'
23676 installman1dir='$installman1dir'
23677 installman3dir='$installman3dir'
23678 installprefix='$installprefix'
23679 installprefixexp='$installprefixexp'
23680 installprivlib='$installprivlib'
23681 installscript='$installscript'
23682 installsitearch='$installsitearch'
23683 installsitebin='$installsitebin'
23684 installsitehtml1dir='$installsitehtml1dir'
23685 installsitehtml3dir='$installsitehtml3dir'
23686 installsitelib='$installsitelib'
23687 installsiteman1dir='$installsiteman1dir'
23688 installsiteman3dir='$installsiteman3dir'
23689 installsitescript='$installsitescript'
23690 installstyle='$installstyle'
23691 installusrbinperl='$installusrbinperl'
23692 installvendorarch='$installvendorarch'
23693 installvendorbin='$installvendorbin'
23694 installvendorhtml1dir='$installvendorhtml1dir'
23695 installvendorhtml3dir='$installvendorhtml3dir'
23696 installvendorlib='$installvendorlib'
23697 installvendorman1dir='$installvendorman1dir'
23698 installvendorman3dir='$installvendorman3dir'
23699 installvendorscript='$installvendorscript'
23700 intsize='$intsize'
23701 issymlink='$issymlink'
23702 ivdformat='$ivdformat'
23703 ivsize='$ivsize'
23704 ivtype='$ivtype'
23705 known_extensions='$known_extensions'
23706 ksh='$ksh'
23707 ld='$ld'
23708 ld_can_script='$ld_can_script'
23709 lddlflags='$lddlflags'
23710 ldflags='$ldflags'
23711 ldflags_uselargefiles='$ldflags_uselargefiles'
23712 ldlibpthname='$ldlibpthname'
23713 less='$less'
23714 lib_ext='$lib_ext'
23715 libc='$libc'
23716 libperl='$libperl'
23717 libpth='$libpth'
23718 libs='$libs'
23719 libsdirs='$libsdirs'
23720 libsfiles='$libsfiles'
23721 libsfound='$libsfound'
23722 libspath='$libspath'
23723 libswanted='$libswanted'
23724 libswanted_uselargefiles='$libswanted_uselargefiles'
23725 line='$line'
23726 lint='$lint'
23727 lkflags='$lkflags'
23728 ln='$ln'
23729 lns='$lns'
23730 localtime_r_proto='$localtime_r_proto'
23731 locincpth='$locincpth'
23732 loclibpth='$loclibpth'
23733 longdblsize='$longdblsize'
23734 longlongsize='$longlongsize'
23735 longsize='$longsize'
23736 lp='$lp'
23737 lpr='$lpr'
23738 ls='$ls'
23739 lseeksize='$lseeksize'
23740 lseektype='$lseektype'
23741 mail='$mail'
23742 mailx='$mailx'
23743 make='$make'
23744 make_set_make='$make_set_make'
23745 mallocobj='$mallocobj'
23746 mallocsrc='$mallocsrc'
23747 malloctype='$malloctype'
23748 man1dir='$man1dir'
23749 man1direxp='$man1direxp'
23750 man1ext='$man1ext'
23751 man3dir='$man3dir'
23752 man3direxp='$man3direxp'
23753 man3ext='$man3ext'
23754 mips_type='$mips_type'
23755 mistrustnm='$mistrustnm'
23756 mkdir='$mkdir'
23757 mmaptype='$mmaptype'
23758 modetype='$modetype'
23759 more='$more'
23760 multiarch='$multiarch'
23761 mv='$mv'
23762 myarchname='$myarchname'
23763 mydomain='$mydomain'
23764 myhostname='$myhostname'
23765 myuname='$myuname'
23766 n='$n'
23767 need_va_copy='$need_va_copy'
23768 netdb_hlen_type='$netdb_hlen_type'
23769 netdb_host_type='$netdb_host_type'
23770 netdb_name_type='$netdb_name_type'
23771 netdb_net_type='$netdb_net_type'
23772 nm='$nm'
23773 nm_opt='$nm_opt'
23774 nm_so_opt='$nm_so_opt'
23775 nonxs_ext='$nonxs_ext'
23776 nroff='$nroff'
23777 nvEUformat='$nvEUformat'
23778 nvFUformat='$nvFUformat'
23779 nvGUformat='$nvGUformat'
23780 nv_overflows_integers_at='$nv_overflows_integers_at'
23781 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23782 nveformat='$nveformat'
23783 nvfformat='$nvfformat'
23784 nvgformat='$nvgformat'
23785 nvsize='$nvsize'
23786 nvtype='$nvtype'
23787 o_nonblock='$o_nonblock'
23788 obj_ext='$obj_ext'
23789 old_pthread_create_joinable='$old_pthread_create_joinable'
23790 optimize='$optimize'
23791 orderlib='$orderlib'
23792 osname='$osname'
23793 osvers='$osvers'
23794 otherlibdirs='$otherlibdirs'
23795 package='$package'
23796 pager='$pager'
23797 passcat='$passcat'
23798 patchlevel='$patchlevel'
23799 path_sep='$path_sep'
23800 perl5='$perl5'
23801 perl='$perl'
23802 perl_patchlevel='$perl_patchlevel'
23803 perl_static_inline='$perl_static_inline'
23804 perladmin='$perladmin'
23805 perllibs='$perllibs'
23806 perlpath='$perlpath'
23807 pg='$pg'
23808 phostname='$phostname'
23809 pidtype='$pidtype'
23810 plibpth='$plibpth'
23811 pmake='$pmake'
23812 pr='$pr'
23813 prefix='$prefix'
23814 prefixexp='$prefixexp'
23815 privlib='$privlib'
23816 privlibexp='$privlibexp'
23817 procselfexe='$procselfexe'
23818 prototype='$prototype'
23819 ptrsize='$ptrsize'
23820 quadkind='$quadkind'
23821 quadtype='$quadtype'
23822 randbits='$randbits'
23823 randfunc='$randfunc'
23824 random_r_proto='$random_r_proto'
23825 randseedtype='$randseedtype'
23826 ranlib='$ranlib'
23827 rd_nodata='$rd_nodata'
23828 readdir64_r_proto='$readdir64_r_proto'
23829 readdir_r_proto='$readdir_r_proto'
23830 revision='$revision'
23831 rm='$rm'
23832 rm_try='$rm_try'
23833 rmail='$rmail'
23834 run='$run'
23835 runnm='$runnm'
23836 sGMTIME_max='$sGMTIME_max'
23837 sGMTIME_min='$sGMTIME_min'
23838 sLOCALTIME_max='$sLOCALTIME_max'
23839 sLOCALTIME_min='$sLOCALTIME_min'
23840 sPRIEUldbl='$sPRIEUldbl'
23841 sPRIFUldbl='$sPRIFUldbl'
23842 sPRIGUldbl='$sPRIGUldbl'
23843 sPRIXU64='$sPRIXU64'
23844 sPRId64='$sPRId64'
23845 sPRIeldbl='$sPRIeldbl'
23846 sPRIfldbl='$sPRIfldbl'
23847 sPRIgldbl='$sPRIgldbl'
23848 sPRIi64='$sPRIi64'
23849 sPRIo64='$sPRIo64'
23850 sPRIu64='$sPRIu64'
23851 sPRIx64='$sPRIx64'
23852 sSCNfldbl='$sSCNfldbl'
23853 sched_yield='$sched_yield'
23854 scriptdir='$scriptdir'
23855 scriptdirexp='$scriptdirexp'
23856 sed='$sed'
23857 seedfunc='$seedfunc'
23858 selectminbits='$selectminbits'
23859 selecttype='$selecttype'
23860 sendmail='$sendmail'
23861 setgrent_r_proto='$setgrent_r_proto'
23862 sethostent_r_proto='$sethostent_r_proto'
23863 setlocale_r_proto='$setlocale_r_proto'
23864 setnetent_r_proto='$setnetent_r_proto'
23865 setprotoent_r_proto='$setprotoent_r_proto'
23866 setpwent_r_proto='$setpwent_r_proto'
23867 setservent_r_proto='$setservent_r_proto'
23868 sh='$sh'
23869 shar='$shar'
23870 sharpbang='$sharpbang'
23871 shmattype='$shmattype'
23872 shortsize='$shortsize'
23873 shrpenv='$shrpenv'
23874 shsharp='$shsharp'
23875 sig_count='$sig_count'
23876 sig_name='$sig_name'
23877 sig_name_init='$sig_name_init'
23878 sig_num='$sig_num'
23879 sig_num_init='$sig_num_init'
23880 sig_size='$sig_size'
23881 signal_t='$signal_t'
23882 sitearch='$sitearch'
23883 sitearchexp='$sitearchexp'
23884 sitebin='$sitebin'
23885 sitebinexp='$sitebinexp'
23886 sitehtml1dir='$sitehtml1dir'
23887 sitehtml1direxp='$sitehtml1direxp'
23888 sitehtml3dir='$sitehtml3dir'
23889 sitehtml3direxp='$sitehtml3direxp'
23890 sitelib='$sitelib'
23891 sitelib_stem='$sitelib_stem'
23892 sitelibexp='$sitelibexp'
23893 siteman1dir='$siteman1dir'
23894 siteman1direxp='$siteman1direxp'
23895 siteman3dir='$siteman3dir'
23896 siteman3direxp='$siteman3direxp'
23897 siteprefix='$siteprefix'
23898 siteprefixexp='$siteprefixexp'
23899 sitescript='$sitescript'
23900 sitescriptexp='$sitescriptexp'
23901 sizesize='$sizesize'
23902 sizetype='$sizetype'
23903 sleep='$sleep'
23904 smail='$smail'
23905 so='$so'
23906 sockethdr='$sockethdr'
23907 socketlib='$socketlib'
23908 socksizetype='$socksizetype'
23909 sort='$sort'
23910 spackage='$spackage'
23911 spitshell='$spitshell'
23912 srand48_r_proto='$srand48_r_proto'
23913 srandom_r_proto='$srandom_r_proto'
23914 src='$src'
23915 ssizetype='$ssizetype'
23916 st_ino_sign='$st_ino_sign'
23917 st_ino_size='$st_ino_size'
23918 startperl='$startperl'
23919 startsh='$startsh'
23920 static_ext='$static_ext'
23921 stdchar='$stdchar'
23922 stdio_base='$stdio_base'
23923 stdio_bufsiz='$stdio_bufsiz'
23924 stdio_cnt='$stdio_cnt'
23925 stdio_filbuf='$stdio_filbuf'
23926 stdio_ptr='$stdio_ptr'
23927 stdio_stream_array='$stdio_stream_array'
23928 strerror_r_proto='$strerror_r_proto'
23929 strings='$strings'
23930 submit='$submit'
23931 subversion='$subversion'
23932 sysman='$sysman'
23933 sysroot='$sysroot'
23934 tail='$tail'
23935 tar='$tar'
23936 targetarch='$targetarch'
23937 targetdir='$targetdir'
23938 targetenv='$targetenv'
23939 targethost='$targethost'
23940 targetmkdir='$targetmkdir'
23941 targetport='$targetport'
23942 targetsh='$targetsh'
23943 tbl='$tbl'
23944 tee='$tee'
23945 test='$test'
23946 timeincl='$timeincl'
23947 timetype='$timetype'
23948 tmpnam_r_proto='$tmpnam_r_proto'
23949 to='$to'
23950 touch='$touch'
23951 tr='$tr'
23952 trnl='$trnl'
23953 troff='$troff'
23954 ttyname_r_proto='$ttyname_r_proto'
23955 u16size='$u16size'
23956 u16type='$u16type'
23957 u32size='$u32size'
23958 u32type='$u32type'
23959 u64size='$u64size'
23960 u64type='$u64type'
23961 u8size='$u8size'
23962 u8type='$u8type'
23963 uidformat='$uidformat'
23964 uidsign='$uidsign'
23965 uidsize='$uidsize'
23966 uidtype='$uidtype'
23967 uname='$uname'
23968 uniq='$uniq'
23969 uquadtype='$uquadtype'
23970 use5005threads='$use5005threads'
23971 use64bitall='$use64bitall'
23972 use64bitint='$use64bitint'
23973 usecbacktrace='$usecbacktrace'
23974 usecrosscompile='$usecrosscompile'
23975 usedevel='$usedevel'
23976 usedl='$usedl'
23977 usedtrace='$usedtrace'
23978 usefaststdio='$usefaststdio'
23979 useithreads='$useithreads'
23980 usekernprocpathname='$usekernprocpathname'
23981 uselargefiles='$uselargefiles'
23982 uselongdouble='$uselongdouble'
23983 usemallocwrap='$usemallocwrap'
23984 usemorebits='$usemorebits'
23985 usemultiplicity='$usemultiplicity'
23986 usemymalloc='$usemymalloc'
23987 usenm='$usenm'
23988 usensgetexecutablepath='$usensgetexecutablepath'
23989 useopcode='$useopcode'
23990 useperlio='$useperlio'
23991 useposix='$useposix'
23992 usereentrant='$usereentrant'
23993 userelocatableinc='$userelocatableinc'
23994 useshrplib='$useshrplib'
23995 usesitecustomize='$usesitecustomize'
23996 usesocks='$usesocks'
23997 usethreads='$usethreads'
23998 usevendorprefix='$usevendorprefix'
23999 useversionedarchname='$useversionedarchname'
24000 usevfork='$usevfork'
24001 usrinc='$usrinc'
24002 uuname='$uuname'
24003 uvXUformat='$uvXUformat'
24004 uvoformat='$uvoformat'
24005 uvsize='$uvsize'
24006 uvtype='$uvtype'
24007 uvuformat='$uvuformat'
24008 uvxformat='$uvxformat'
24009 vaproto='$vaproto'
24010 vendorarch='$vendorarch'
24011 vendorarchexp='$vendorarchexp'
24012 vendorbin='$vendorbin'
24013 vendorbinexp='$vendorbinexp'
24014 vendorhtml1dir='$vendorhtml1dir'
24015 vendorhtml1direxp='$vendorhtml1direxp'
24016 vendorhtml3dir='$vendorhtml3dir'
24017 vendorhtml3direxp='$vendorhtml3direxp'
24018 vendorlib='$vendorlib'
24019 vendorlib_stem='$vendorlib_stem'
24020 vendorlibexp='$vendorlibexp'
24021 vendorman1dir='$vendorman1dir'
24022 vendorman1direxp='$vendorman1direxp'
24023 vendorman3dir='$vendorman3dir'
24024 vendorman3direxp='$vendorman3direxp'
24025 vendorprefix='$vendorprefix'
24026 vendorprefixexp='$vendorprefixexp'
24027 vendorscript='$vendorscript'
24028 vendorscriptexp='$vendorscriptexp'
24029 version='$version'
24030 version_patchlevel_string='$version_patchlevel_string'
24031 versiononly='$versiononly'
24032 vi='$vi'
24033 xlibpth='$xlibpth'
24034 yacc='$yacc'
24035 yaccflags='$yaccflags'
24036 zcat='$zcat'
24037 zip='$zip'
24038 EOT
24039
24040 : add special variables
24041 $test -f $src/patchlevel.h && \
24042 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24043 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24044 echo "PERL_CONFIG_SH=true" >>config.sh
24045
24046 : propagate old symbols
24047 if $test -f UU/config.sh; then
24048         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24049         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24050                 config.sh config.sh UU/oldconfig.sh |\
24051                 $sort | $uniq -u >UU/oldsyms
24052         set X `$cat UU/oldsyms`
24053         shift
24054         case $# in
24055         0) ;;
24056         *)
24057                 $cat <<EOM
24058 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24059 EOM
24060                 echo ": Variables propagated from previous config.sh file." >>config.sh
24061                 for sym in `$cat UU/oldsyms`; do
24062                         echo "    Propagating $hint variable "'$'"$sym..."
24063                         eval 'tmp="$'"${sym}"'"'
24064                         echo "$tmp" | \
24065                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24066                 done
24067                 ;;
24068         esac
24069 fi
24070
24071 : preserve RCS keywords in files with variable substitution, grrr
24072 Id='$Id'
24073
24074 : Finish up by extracting the .SH files
24075 case "$alldone" in
24076 exit)
24077         $rm -rf UU
24078         echo "Extraction done."
24079         exit 0
24080         ;;
24081 cont)
24082         ;;
24083 '')
24084         dflt=''
24085         nostick=true
24086         $cat <<EOM
24087
24088 If you'd like to make any changes to the config.sh file before I begin
24089 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24090
24091 EOM
24092         rp="Press return or use a shell escape to edit config.sh:"
24093         . UU/myread
24094         nostick=''
24095         case "$ans" in
24096         '') ;;
24097         *) : in case they cannot read
24098                 sh 1>&4 -c "$ans";;
24099         esac
24100         ;;
24101 esac
24102
24103 : if this fails, just run all the .SH files by hand
24104 . ./config.sh
24105
24106 echo " "
24107 exec 1>&4
24108 pwd=`pwd`
24109 . ./UU/extract
24110 cd "$pwd"
24111
24112 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24113         dflt=y
24114         case "$silent" in
24115         true) ;;
24116         *)
24117                 $cat <<EOM
24118
24119 Now you need to generate make dependencies by running "$make depend".
24120 You might prefer to run it in background: "$make depend > makedepend.out &"
24121 It can take a while, so you might not want to run it right now.
24122
24123 EOM
24124                 ;;
24125         esac
24126         rp="Run $make depend now?"
24127         . UU/myread
24128         case "$ans" in
24129         y*)
24130                 $make depend && echo "Now you must run '$make'."
24131                 ;;
24132         *)
24133                 echo "You must run '$make depend' then '$make'."
24134                 ;;
24135         esac
24136 elif test -f [Mm]akefile; then
24137         echo " "
24138         echo "Now you must run a $make."
24139 else
24140         echo "Configure done."
24141 fi
24142
24143 if $test -f Policy.sh; then
24144     $cat <<EOM
24145
24146 If you compile $package on a different machine or from a different object
24147 directory, copy the Policy.sh file from this object directory to the
24148 new one before you run Configure -- this will help you with most of
24149 the policy defaults.
24150
24151 EOM
24152 fi
24153 if $test -f config.msg; then
24154     echo "Hmm.  I also noted the following information while running:"
24155     echo " "
24156     $cat config.msg >&4
24157     $rm -f config.msg
24158 fi
24159 $rm -f kit*isdone ark*isdone
24160 $rm -rf UU
24161
24162 : End of Configure
24163