This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Configure scan for the kind of long double we have
[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 longdblkind=''
597 longdblsize=''
598 d_longlong=''
599 longlongsize=''
600 d_lseekproto=''
601 d_lstat=''
602 d_madvise=''
603 d_malloc_good_size=''
604 d_malloc_size=''
605 d_mblen=''
606 d_mbstowcs=''
607 d_mbtowc=''
608 d_memchr=''
609 d_memcmp=''
610 d_memcpy=''
611 d_memmove=''
612 d_memset=''
613 d_mkdir=''
614 d_mkdtemp=''
615 d_mkfifo=''
616 d_mkstemp=''
617 d_mkstemps=''
618 d_mktime=''
619 d_mmap=''
620 mmaptype=''
621 d_modfl=''
622 d_modfl_pow32_bug=''
623 d_modflproto=''
624 d_mprotect=''
625 d_msg=''
626 d_msgctl=''
627 d_msgget=''
628 d_msghdr_s=''
629 d_msgrcv=''
630 d_msgsnd=''
631 d_msync=''
632 d_munmap=''
633 d_nice=''
634 d_nl_langinfo=''
635 d_off64_t=''
636 d_open3=''
637 d_fpathconf=''
638 d_pathconf=''
639 d_pause=''
640 d_pipe=''
641 d_poll=''
642 d_portable=''
643 d_prctl=''
644 d_prctl_set_name=''
645 d_procselfexe=''
646 procselfexe=''
647 d_old_pthread_create_joinable=''
648 old_pthread_create_joinable=''
649 d_pthread_atfork=''
650 d_pthread_attr_setscope=''
651 d_pthread_yield=''
652 d_sched_yield=''
653 sched_yield=''
654 d_ptrdiff_t=''
655 d_qgcvt=''
656 d_random_r=''
657 random_r_proto=''
658 d_readdir64_r=''
659 readdir64_r_proto=''
660 d_readdir=''
661 d_rewinddir=''
662 d_seekdir=''
663 d_telldir=''
664 d_readdir_r=''
665 readdir_r_proto=''
666 d_readlink=''
667 d_readv=''
668 d_recvmsg=''
669 d_rename=''
670 d_rmdir=''
671 d_safebcpy=''
672 d_safemcpy=''
673 d_sanemcmp=''
674 d_sbrkproto=''
675 d_scalbnl=''
676 d_select=''
677 d_sem=''
678 d_semctl=''
679 d_semget=''
680 d_semop=''
681 d_sendmsg=''
682 d_setegid=''
683 d_seteuid=''
684 d_setgrent=''
685 d_setgrent_r=''
686 setgrent_r_proto=''
687 d_setgrps=''
688 d_sethent=''
689 d_sethostent_r=''
690 sethostent_r_proto=''
691 d_setitimer=''
692 d_setlinebuf=''
693 d_setlocale=''
694 d_setlocale_r=''
695 setlocale_r_proto=''
696 d_setnent=''
697 d_setnetent_r=''
698 setnetent_r_proto=''
699 d_setpent=''
700 d_setpgid=''
701 d_setpgrp2=''
702 d_bsdsetpgrp=''
703 d_setpgrp=''
704 d_setprior=''
705 d_setproctitle=''
706 d_setprotoent_r=''
707 setprotoent_r_proto=''
708 d_setpwent=''
709 d_setpwent_r=''
710 setpwent_r_proto=''
711 d_setregid=''
712 d_setresgid=''
713 d_setresuid=''
714 d_setreuid=''
715 d_setrgid=''
716 d_setruid=''
717 d_setsent=''
718 d_setservent_r=''
719 setservent_r_proto=''
720 d_setsid=''
721 d_setvbuf=''
722 d_shm=''
723 d_shmat=''
724 d_shmatprototype=''
725 shmattype=''
726 d_shmctl=''
727 d_shmdt=''
728 d_shmget=''
729 d_sigaction=''
730 d_signbit=''
731 d_sigprocmask=''
732 d_sigsetjmp=''
733 usesitecustomize=''
734 d_snprintf=''
735 d_vsnprintf=''
736 d_sockatmark=''
737 d_sockatmarkproto=''
738 d_ip_mreq=''
739 d_ip_mreq_source=''
740 d_ipv6_mreq=''
741 d_ipv6_mreq_source=''
742 d_msg_ctrunc=''
743 d_msg_dontroute=''
744 d_msg_oob=''
745 d_msg_peek=''
746 d_msg_proxy=''
747 d_oldsock=''
748 d_scm_rights=''
749 d_sin6_scope_id=''
750 d_sockaddr_in6=''
751 d_sockaddr_sa_len=''
752 d_socket=''
753 d_sockpair=''
754 sockethdr=''
755 socketlib=''
756 d_socklen_t=''
757 d_socks5_init=''
758 d_sprintf_returns_strlen=''
759 d_sqrtl=''
760 d_srand48_r=''
761 srand48_r_proto=''
762 d_srandom_r=''
763 srandom_r_proto=''
764 d_sresgproto=''
765 d_sresuproto=''
766 d_statblks=''
767 d_statfs_f_flags=''
768 d_statfs_s=''
769 d_static_inline=''
770 perl_static_inline=''
771 d_fstatvfs=''
772 d_statvfs=''
773 d_stdio_cnt_lval=''
774 d_stdio_ptr_lval=''
775 d_stdio_ptr_lval_nochange_cnt=''
776 d_stdio_ptr_lval_sets_cnt=''
777 d_stdiobase=''
778 d_stdstdio=''
779 stdio_base=''
780 stdio_bufsiz=''
781 stdio_cnt=''
782 stdio_filbuf=''
783 stdio_ptr=''
784 d_index=''
785 d_strchr=''
786 d_strcoll=''
787 d_strctcpy=''
788 d_strerrm=''
789 d_strerror=''
790 d_sysernlst=''
791 d_syserrlst=''
792 d_strerror_r=''
793 strerror_r_proto=''
794 d_strftime=''
795 d_strlcat=''
796 d_strlcpy=''
797 d_strtod=''
798 d_strtol=''
799 d_strtold=''
800 d_strtoll=''
801 d_strtoq=''
802 d_strtoul=''
803 d_strtoull=''
804 d_strtouq=''
805 d_strxfrm=''
806 d_symlink=''
807 d_syscall=''
808 d_syscallproto=''
809 d_sysconf=''
810 d_system=''
811 d_tcgetpgrp=''
812 d_tcsetpgrp=''
813 d_telldirproto=''
814 d_time=''
815 timetype=''
816 d_asctime64=''
817 d_ctime64=''
818 d_difftime64=''
819 d_gmtime64=''
820 d_localtime64=''
821 d_mktime64=''
822 d_timegm=''
823 clocktype=''
824 d_times=''
825 d_tmpnam_r=''
826 tmpnam_r_proto=''
827 d_truncate=''
828 d_ttyname_r=''
829 ttyname_r_proto=''
830 d_tzname=''
831 d_u32align=''
832 d_ualarm=''
833 d_umask=''
834 d_semctl_semid_ds=''
835 d_semctl_semun=''
836 d_union_semun=''
837 d_unordered=''
838 d_unsetenv=''
839 d_usleep=''
840 d_usleepproto=''
841 d_ustat=''
842 d_pseudofork=''
843 d_vfork=''
844 usevfork=''
845 d_voidsig=''
846 signal_t=''
847 d_volatile=''
848 d_charvspr=''
849 d_vprintf=''
850 d_wait4=''
851 d_waitpid=''
852 d_wcscmp=''
853 d_wcstombs=''
854 d_wcsxfrm=''
855 d_wctomb=''
856 d_writev=''
857 dlext=''
858 bin_ELF=''
859 cccdlflags=''
860 ccdlflags=''
861 dlsrc=''
862 ld=''
863 ld_can_script=''
864 lddlflags=''
865 usedl=''
866 doublesize=''
867 ebcdic=''
868 fflushNULL=''
869 fflushall=''
870 fpossize=''
871 fpostype=''
872 gccansipedantic=''
873 gccosandvers=''
874 gccversion=''
875 gidformat=''
876 gidsign=''
877 gidsize=''
878 gidtype=''
879 groupstype=''
880 h_fcntl=''
881 h_sysfile=''
882 html1dir=''
883 html1direxp=''
884 installhtml1dir=''
885 html3dir=''
886 html3direxp=''
887 installhtml3dir=''
888 i_arpainet=''
889 i_assert=''
890 i_bfd=''
891 i_crypt=''
892 db_hashtype=''
893 db_prefixtype=''
894 db_version_major=''
895 db_version_minor=''
896 db_version_patch=''
897 i_db=''
898 i_dbm=''
899 i_rpcsvcdbm=''
900 d_dirnamlen=''
901 direntrytype=''
902 i_dirent=''
903 i_dlfcn=''
904 i_execinfo=''
905 i_fcntl=''
906 i_float=''
907 i_fp=''
908 i_fp_class=''
909 i_gdbm=''
910 d_grpasswd=''
911 i_grp=''
912 i_ieeefp=''
913 i_inttypes=''
914 i_langinfo=''
915 i_libutil=''
916 i_limits=''
917 i_locale=''
918 i_machcthr=''
919 i_malloc=''
920 i_mallocmalloc=''
921 i_math=''
922 i_memory=''
923 i_mntent=''
924 d_gdbm_ndbm_h_uses_prototypes=''
925 d_gdbmndbm_h_uses_prototypes=''
926 d_ndbm=''
927 d_ndbm_h_uses_prototypes=''
928 i_gdbm_ndbm=''
929 i_gdbmndbm=''
930 i_ndbm=''
931 i_netdb=''
932 i_neterrno=''
933 i_netinettcp=''
934 i_niin=''
935 i_sysin=''
936 i_poll=''
937 i_prot=''
938 i_pthread=''
939 d_pwage=''
940 d_pwchange=''
941 d_pwclass=''
942 d_pwcomment=''
943 d_pwexpire=''
944 d_pwgecos=''
945 d_pwpasswd=''
946 d_pwquota=''
947 i_pwd=''
948 i_shadow=''
949 i_socks=''
950 i_stdbool=''
951 i_stddef=''
952 i_stdlib=''
953 i_string=''
954 strings=''
955 i_sunmath=''
956 i_sysaccess=''
957 i_sysdir=''
958 i_sysfile=''
959 d_voidtty=''
960 i_bsdioctl=''
961 i_sysfilio=''
962 i_sysioctl=''
963 i_syssockio=''
964 i_syslog=''
965 i_sysmman=''
966 i_sysmode=''
967 i_sysmount=''
968 i_sysndir=''
969 i_sysparam=''
970 i_syspoll=''
971 i_sysresrc=''
972 i_syssecrt=''
973 i_sysselct=''
974 i_sysstat=''
975 i_sysstatfs=''
976 i_sysstatvfs=''
977 i_systimes=''
978 i_systypes=''
979 i_sysuio=''
980 i_sysun=''
981 i_sysutsname=''
982 i_sysvfs=''
983 i_syswait=''
984 i_sgtty=''
985 i_termio=''
986 i_termios=''
987 d_tm_tm_gmtoff=''
988 d_tm_tm_zone=''
989 i_systime=''
990 i_systimek=''
991 i_time=''
992 timeincl=''
993 i_unistd=''
994 i_ustat=''
995 i_utime=''
996 i_values=''
997 i_stdarg=''
998 i_varargs=''
999 i_varhdr=''
1000 i_vfork=''
1001 d_inc_version_list=''
1002 inc_version_list=''
1003 inc_version_list_init=''
1004 installprefix=''
1005 installprefixexp=''
1006 installstyle=''
1007 installusrbinperl=''
1008 intsize=''
1009 longsize=''
1010 shortsize=''
1011 issymlink=''
1012 libc=''
1013 ldlibpthname=''
1014 libperl=''
1015 shrpenv=''
1016 useshrplib=''
1017 glibpth=''
1018 incpth=''
1019 libpth=''
1020 loclibpth=''
1021 plibpth=''
1022 xlibpth=''
1023 ignore_versioned_solibs=''
1024 libs=''
1025 libsdirs=''
1026 libsfiles=''
1027 libsfound=''
1028 libspath=''
1029 lns=''
1030 d_PRIEUldbl=''
1031 d_PRIFUldbl=''
1032 d_PRIGUldbl=''
1033 d_PRIeldbl=''
1034 d_PRIfldbl=''
1035 d_PRIgldbl=''
1036 d_SCNfldbl=''
1037 sPRIEUldbl=''
1038 sPRIFUldbl=''
1039 sPRIGUldbl=''
1040 sPRIeldbl=''
1041 sPRIfldbl=''
1042 sPRIgldbl=''
1043 sSCNfldbl=''
1044 lseeksize=''
1045 lseektype=''
1046 make_set_make=''
1047 d_mymalloc=''
1048 freetype=''
1049 mallocobj=''
1050 mallocsrc=''
1051 malloctype=''
1052 usemallocwrap=''
1053 usemymalloc=''
1054 installman1dir=''
1055 man1dir=''
1056 man1direxp=''
1057 man1ext=''
1058 installman3dir=''
1059 man3dir=''
1060 man3direxp=''
1061 man3ext=''
1062 modetype=''
1063 multiarch=''
1064 mydomain=''
1065 myhostname=''
1066 phostname=''
1067 c=''
1068 n=''
1069 d_eofnblk=''
1070 eagain=''
1071 o_nonblock=''
1072 rd_nodata=''
1073 need_va_copy=''
1074 netdb_hlen_type=''
1075 netdb_host_type=''
1076 netdb_name_type=''
1077 netdb_net_type=''
1078 groupcat=''
1079 hostcat=''
1080 passcat=''
1081 orderlib=''
1082 ranlib=''
1083 d_perl_otherlibdirs=''
1084 otherlibdirs=''
1085 package=''
1086 spackage=''
1087 pager=''
1088 api_revision=''
1089 api_subversion=''
1090 api_version=''
1091 api_versionstring=''
1092 patchlevel=''
1093 perl_patchlevel=''
1094 revision=''
1095 subversion=''
1096 version=''
1097 version_patchlevel_string=''
1098 perl5=''
1099 perladmin=''
1100 perlpath=''
1101 d_nv_preserves_uv=''
1102 d_nv_zero_is_allbits_zero=''
1103 i16size=''
1104 i16type=''
1105 i32size=''
1106 i32type=''
1107 i64size=''
1108 i64type=''
1109 i8size=''
1110 i8type=''
1111 ivsize=''
1112 ivtype=''
1113 nv_overflows_integers_at=''
1114 nv_preserves_uv_bits=''
1115 nvsize=''
1116 nvtype=''
1117 u16size=''
1118 u16type=''
1119 u32size=''
1120 u32type=''
1121 u64size=''
1122 u64type=''
1123 u8size=''
1124 u8type=''
1125 uvsize=''
1126 uvtype=''
1127 ivdformat=''
1128 nvEUformat=''
1129 nvFUformat=''
1130 nvGUformat=''
1131 nveformat=''
1132 nvfformat=''
1133 nvgformat=''
1134 uvXUformat=''
1135 uvoformat=''
1136 uvuformat=''
1137 uvxformat=''
1138 pidtype=''
1139 prefix=''
1140 prefixexp=''
1141 installprivlib=''
1142 privlib=''
1143 privlibexp=''
1144 prototype=''
1145 ptrsize=''
1146 d_PRIXU64=''
1147 d_PRId64=''
1148 d_PRIi64=''
1149 d_PRIo64=''
1150 d_PRIu64=''
1151 d_PRIx64=''
1152 sPRIXU64=''
1153 sPRId64=''
1154 sPRIi64=''
1155 sPRIo64=''
1156 sPRIu64=''
1157 sPRIx64=''
1158 d_quad=''
1159 quadkind=''
1160 quadtype=''
1161 uquadtype=''
1162 drand01=''
1163 randbits=''
1164 randfunc=''
1165 randseedtype=''
1166 seedfunc=''
1167 installscript=''
1168 scriptdir=''
1169 scriptdirexp=''
1170 selectminbits=''
1171 selecttype=''
1172 sh=''
1173 targetsh=''
1174 sig_count=''
1175 sig_name=''
1176 sig_name_init=''
1177 sig_num=''
1178 sig_num_init=''
1179 sig_size=''
1180 d_sitearch=''
1181 installsitearch=''
1182 sitearch=''
1183 sitearchexp=''
1184 installsitebin=''
1185 sitebin=''
1186 sitebinexp=''
1187 installsitehtml1dir=''
1188 sitehtml1dir=''
1189 sitehtml1direxp=''
1190 installsitehtml3dir=''
1191 sitehtml3dir=''
1192 sitehtml3direxp=''
1193 installsitelib=''
1194 sitelib=''
1195 sitelib_stem=''
1196 sitelibexp=''
1197 installsiteman1dir=''
1198 siteman1dir=''
1199 siteman1direxp=''
1200 installsiteman3dir=''
1201 siteman3dir=''
1202 siteman3direxp=''
1203 siteprefix=''
1204 siteprefixexp=''
1205 installsitescript=''
1206 sitescript=''
1207 sitescriptexp=''
1208 sizesize=''
1209 sizetype=''
1210 d_libname_unique=''
1211 so=''
1212 socksizetype=''
1213 sharpbang=''
1214 shsharp=''
1215 spitshell=''
1216 src=''
1217 ssizetype=''
1218 st_ino_sign=''
1219 st_ino_size=''
1220 startperl=''
1221 startsh=''
1222 stdchar=''
1223 d_stdio_stream_array=''
1224 stdio_stream_array=''
1225 sysman=''
1226 sGMTIME_max=''
1227 sGMTIME_min=''
1228 sLOCALTIME_max=''
1229 sLOCALTIME_min=''
1230 trnl=''
1231 uidformat=''
1232 uidsign=''
1233 uidsize=''
1234 uidtype=''
1235 archname64=''
1236 use64bitall=''
1237 use64bitint=''
1238 usecbacktrace=''
1239 dtrace=''
1240 usedtrace=''
1241 usefaststdio=''
1242 usekernprocpathname=''
1243 ccflags_uselargefiles=''
1244 ldflags_uselargefiles=''
1245 libswanted_uselargefiles=''
1246 uselargefiles=''
1247 uselongdouble=''
1248 usemorebits=''
1249 usemultiplicity=''
1250 nm_opt=''
1251 nm_so_opt=''
1252 runnm=''
1253 usenm=''
1254 usensgetexecutablepath=''
1255 useperlio=''
1256 usesocks=''
1257 d_oldpthreads=''
1258 use5005threads=''
1259 useithreads=''
1260 usereentrant=''
1261 usethreads=''
1262 incpath=''
1263 mips_type=''
1264 usrinc=''
1265 vaproto=''
1266 d_vendorarch=''
1267 installvendorarch=''
1268 vendorarch=''
1269 vendorarchexp=''
1270 d_vendorbin=''
1271 installvendorbin=''
1272 vendorbin=''
1273 vendorbinexp=''
1274 installvendorhtml1dir=''
1275 vendorhtml1dir=''
1276 vendorhtml1direxp=''
1277 installvendorhtml3dir=''
1278 vendorhtml3dir=''
1279 vendorhtml3direxp=''
1280 d_vendorlib=''
1281 installvendorlib=''
1282 vendorlib=''
1283 vendorlib_stem=''
1284 vendorlibexp=''
1285 installvendorman1dir=''
1286 vendorman1dir=''
1287 vendorman1direxp=''
1288 installvendorman3dir=''
1289 vendorman3dir=''
1290 vendorman3direxp=''
1291 usevendorprefix=''
1292 vendorprefix=''
1293 vendorprefixexp=''
1294 d_vendorscript=''
1295 installvendorscript=''
1296 vendorscript=''
1297 vendorscriptexp=''
1298 versiononly=''
1299 yacc=''
1300 yaccflags=''
1301 CONFIG=''
1302
1303 : Detect odd OSs
1304 define='define'
1305 undef='undef'
1306 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1307 rmlist=''
1308
1309 : We must find out about Eunice early
1310 eunicefix=':'
1311 if test -f /etc/unixtovms; then
1312         eunicefix=/etc/unixtovms
1313 fi
1314 if test -f /etc/unixtovms.exe; then
1315         eunicefix=/etc/unixtovms.exe
1316 fi
1317
1318 : Set executable suffix now -- needed before hints available
1319 if test -f "/libs/version.library"; then
1320 : Amiga OS
1321     _exe=""
1322 elif test -f "/system/gnu_library/bin/ar.pm"; then
1323 : Stratus VOS
1324     _exe=".pm"
1325 elif test -n "$DJGPP"; then
1326 : DOS DJGPP
1327     _exe=".exe"
1328 elif test -f /kern/cookiejar; then
1329 : MiNT
1330     _exe=""
1331 elif test -d c:/. -o -n "$is_os2" ; then
1332 : OS/2 or cygwin
1333     _exe=".exe"
1334 fi
1335
1336 groupstype=''
1337 i_whoami=''
1338 : Trailing extension.  Override this in a hint file, if needed.
1339 : Extra object files, if any, needed on this platform.
1340 archobjs=''
1341 archname=''
1342 : Possible local include directories to search.
1343 : Set locincpth to "" in a hint file to defeat local include searches.
1344 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1345 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1346 :
1347 : no include file wanted by default
1348 inclwanted=''
1349
1350 : Enable -DEBUGGING and -DDEBUGGING from the command line
1351 EBUGGING=''
1352 DEBUGGING=''
1353
1354 libnames=''
1355 : change the next line if compiling for Xenix/286 on Xenix/386
1356 xlibpth='/usr/lib/386 /lib/386'
1357 : Possible local library directories to search.
1358 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1359 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1360
1361 : general looking path for locating libraries
1362 glibpth="/lib /usr/lib $xlibpth"
1363 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1364 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1365 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1366 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1367
1368 : Private path used by Configure to find libraries.  Its value
1369 : is prepended to libpth. This variable takes care of special
1370 : machines, like the mips.  Usually, it should be empty.
1371 plibpth=''
1372
1373 : default library list
1374 libswanted=''
1375 : some systems want to use only the non-versioned libso:s
1376 ignore_versioned_solibs=''
1377 : set usethreads on the Configure command line to enable threads.
1378 usereentrant='undef'
1379 ccname=''
1380 ccversion=''
1381 perllibs=''
1382 : set useposix=false in your hint file to disable the POSIX extension.
1383 useposix=true
1384 : set useopcode=false in your hint file to disable the Opcode extension.
1385 useopcode=true
1386 archname64=''
1387 ccflags_uselargefiles=''
1388 ldflags_uselargefiles=''
1389 libswanted_uselargefiles=''
1390 : set usemultiplicity on the Configure command line to enable multiplicity.
1391 : set usesocks on the Configure command line to enable socks.
1392 : List of libraries we want.
1393 : If anyone needs extra -lxxx, put those in a hint file.
1394 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1395 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1396 : We probably want to search /usr/shlib before most other libraries.
1397 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1398 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1399 glibpth="/usr/shlib $glibpth"
1400 : Do not use vfork unless overridden by a hint file.
1401 usevfork=false
1402
1403 : Find the basic shell for Bourne shell scripts
1404 case "$sh" in
1405 '')
1406         case "$SYSTYPE" in
1407         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1408         *) xxx='/bin/sh';;
1409         esac
1410         if test -f "$xxx"; then
1411                 sh="$xxx"
1412         else
1413                 : Build up a list and do a single loop so we can 'break' out.
1414                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1415                 for xxx in sh bash ksh pdksh ash; do
1416                         for p in $pth; do
1417                                 try="$try ${p}/${xxx}"
1418                         done
1419                 done
1420                 for xxx in $try; do
1421                         if test -f "$xxx"; then
1422                                 sh="$xxx";
1423                                 break
1424                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1425                                 sh="$xxx";
1426                                 break
1427                         elif test -f "$xxx.exe"; then
1428                                 sh="$xxx";
1429                                 break
1430                         fi
1431                 done
1432         fi
1433         ;;
1434 esac
1435
1436 case "$sh" in
1437 '')     cat >&2 <<EOM
1438 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1439
1440 Usually it's in /bin/sh.  How did you even get this far?
1441 Please contact me (Perl Maintainers) at perlbug@perl.org and
1442 we'll try to straighten this all out.
1443 EOM
1444         exit 1
1445         ;;
1446 esac
1447
1448 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1449 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1450 targetsh=$sh
1451
1452 : see if sh knows # comments
1453 if `$sh -c '#' >/dev/null 2>&1`; then
1454         shsharp=true
1455         spitshell=cat
1456         xcat=/bin/cat
1457         test -f $xcat$_exe || xcat=/usr/bin/cat
1458         if test ! -f $xcat$_exe; then
1459                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1460                         if test -f $p/cat$_exe; then
1461                                 xcat=$p/cat
1462                                 break
1463                         fi
1464                 done
1465                 if test ! -f $xcat$_exe; then
1466                         echo "Can't find cat anywhere!"
1467                         exit 1
1468                 fi
1469         fi
1470         echo "#!$xcat" >sharp
1471         $eunicefix sharp
1472         chmod +x sharp
1473         ./sharp > today 2>/dev/null
1474         if test -s today; then
1475                 sharpbang='#!'
1476         else
1477                 echo "#! $xcat" > sharp
1478                 $eunicefix sharp
1479                 chmod +x sharp
1480                 ./sharp > today 2>/dev/null
1481                 if test -s today; then
1482                         sharpbang='#! '
1483                 else
1484                         sharpbang=': use '
1485                 fi
1486         fi
1487 else
1488         echo " "
1489         echo "Your $sh doesn't grok # comments--I will strip them later on."
1490         shsharp=false
1491         cd ..
1492         echo "exec grep -v '^[  ]*#'" >spitshell
1493         chmod +x spitshell
1494         $eunicefix spitshell
1495         spitshell=`pwd`/spitshell
1496         cd UU
1497         echo "I presume that if # doesn't work, #! won't work either!"
1498         sharpbang=': use '
1499 fi
1500 rm -f sharp today
1501
1502 : figure out how to guarantee sh startup
1503 case "$startsh" in
1504 '') startsh=${sharpbang}${sh} ;;
1505 *)
1506 esac
1507 cat >sharp <<EOSS
1508 $startsh
1509 set abc
1510 test "$?abc" != 1
1511 EOSS
1512
1513 chmod +x sharp
1514 $eunicefix sharp
1515 if ./sharp; then
1516         : echo "Yup, it does."
1517 else
1518         echo "Hmm... '$startsh' does not guarantee sh startup..."
1519         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1520 fi
1521 rm -f sharp
1522
1523 : Save command line options in file UU/cmdline.opt for later use in
1524 : generating config.sh.
1525 cat > cmdline.opt <<EOSH
1526 : Configure command line arguments.
1527 config_arg0='$0'
1528 config_args='$*'
1529 config_argc=$#
1530 EOSH
1531 argn=1
1532 args_exp=''
1533 args_sep=''
1534 for arg in "$@"; do
1535         cat >>cmdline.opt <<EOSH
1536 config_arg$argn='$arg'
1537 EOSH
1538         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1539 $arg
1540 EOC
1541         arg_exp=`cat cmdl.opt`
1542         args_exp="$args_exp$args_sep'$arg_exp'"
1543         argn=`expr $argn + 1`
1544         args_sep=' '
1545 done
1546 rm -f cmdl.opt
1547
1548 : produce awk script to parse command line options
1549 cat >options.awk <<'EOF'
1550 BEGIN {
1551         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1552
1553         len = length(optstr);
1554         for (i = 1; i <= len; i++) {
1555                 c = substr(optstr, i, 1);
1556                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1557                 if (a == ":") {
1558                         arg[c] = 1;
1559                         i++;
1560                 }
1561                 opt[c] = 1;
1562         }
1563 }
1564 {
1565         expect = 0;
1566         str = $0;
1567         if (substr(str, 1, 1) != "-") {
1568                 printf("'%s'\n", str);
1569                 next;
1570         }
1571         len = length($0);
1572         for (i = 2; i <= len; i++) {
1573                 c = substr(str, i, 1);
1574                 if (!opt[c]) {
1575                         printf("-%s\n", substr(str, i));
1576                         next;
1577                 }
1578                 printf("-%s\n", c);
1579                 if (arg[c]) {
1580                         if (i < len)
1581                                 printf("'%s'\n", substr(str, i + 1));
1582                         else
1583                                 expect = 1;
1584                         next;
1585                 }
1586         }
1587 }
1588 END {
1589         if (expect)
1590                 print "?";
1591 }
1592 EOF
1593
1594 : process the command line options
1595 set X `for arg in "$@"; do echo "X$arg"; done |
1596         sed -e s/X// | awk -f options.awk`
1597 eval "set $*"
1598 shift
1599 rm -f options.awk
1600
1601 : set up default values
1602 fastread=''
1603 reuseval=false
1604 config_sh=''
1605 alldone=''
1606 error=''
1607 silent=''
1608 extractsh=''
1609 override=''
1610 knowitall=''
1611 rm -f optdef.sh posthint.sh
1612 cat >optdef.sh <<EOS
1613 $startsh
1614 EOS
1615
1616
1617 : option parsing
1618 while test $# -gt 0; do
1619         case "$1" in
1620         -d) shift; fastread=yes;;
1621         -e) shift; alldone=cont;;
1622         -f)
1623                 shift
1624                 cd ..
1625                 if test -r "$1"; then
1626                         config_sh="$1"
1627                 else
1628                         echo "$me: cannot read config file $1." >&2
1629                         error=true
1630                 fi
1631                 cd UU
1632                 shift;;
1633         --help|\
1634         -h) shift; error=true;;
1635         -r) shift; reuseval=true;;
1636         -s) shift; silent=true; realsilent=true;;
1637         -E) shift; alldone=exit;;
1638         -K) shift; knowitall=true;;
1639         -O) shift; override=true;;
1640         -S) shift; silent=true; extractsh=true;;
1641         -D)
1642                 shift
1643                 case "$1" in
1644                 *=)
1645                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1646                         echo "$me: ignoring -D $1" >&2
1647                         ;;
1648                 *=*) echo "$1" | \
1649                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1650                 *) echo "$1='define'" >> optdef.sh;;
1651                 esac
1652                 shift
1653                 ;;
1654         -U)
1655                 shift
1656                 case "$1" in
1657                 *=) echo "$1" >> optdef.sh;;
1658                 *=*)
1659                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1660                         echo "$me: ignoring -U $1" >&2
1661                         ;;
1662                 *) echo "$1='undef'" >> optdef.sh;;
1663                 esac
1664                 shift
1665                 ;;
1666         -A)
1667             shift
1668             xxx=''
1669             yyy="$1"
1670             zzz=''
1671             uuu=undef
1672             case "$yyy" in
1673             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1674                  case "$zzz" in
1675                  *:*) zzz='' ;;
1676                  *)   xxx=append
1677                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1678                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1679                  esac
1680                  ;;
1681             esac
1682             case "$xxx" in
1683             '')  case "$yyy" in
1684                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1685                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1686                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1687                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1688                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1689                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1690                  esac
1691                  ;;
1692             esac
1693             case "$xxx" in
1694             append)
1695                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1696             clear)
1697                 echo "$yyy=''"                  >> posthint.sh ;;
1698             define)
1699                 case "$zzz" in
1700                 '') zzz=define ;;
1701                 esac
1702                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1703             eval)
1704                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1705             prepend)
1706                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1707             undef)
1708                 case "$zzz" in
1709                 '') zzz="$uuu" ;;
1710                 esac
1711                 echo "$yyy=$zzz"                >> posthint.sh ;;
1712             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1713             esac
1714             shift
1715             ;;
1716         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1717             exit 0;;
1718         --) break;;
1719         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1720         *) break;;
1721         esac
1722 done
1723
1724 case "$error" in
1725 true)
1726         cat >&2 <<EOM
1727 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1728                  [-U symbol] [-U symbol=] [-A command:symbol...]
1729   -d : use defaults for all answers.
1730   -e : go on without questioning past the production of config.sh.
1731   -f : specify an alternate default configuration file.
1732   -h : print this help message and exit (with an error status).
1733   -r : reuse C symbols value if possible (skips costly nm extraction).
1734   -s : silent mode, only echoes questions and essential information.
1735   -D : define symbol to have some value:
1736          -D symbol         symbol gets the value 'define'
1737          -D symbol=value   symbol gets the value 'value'
1738        common used examples (see INSTALL for more info):
1739          -Duse64bitint            use 64bit integers
1740          -Duse64bitall            use 64bit integers and pointers
1741          -Dusethreads             use thread support
1742          -Dinc_version_list=none  do not include older perl trees in @INC
1743          -DEBUGGING=none          DEBUGGING options
1744          -Dcc=gcc                 choose your compiler
1745          -Dprefix=/opt/perl5      choose your destination
1746   -E : stop at the end of questions, after having produced config.sh.
1747   -K : do not use unless you know what you are doing.
1748   -O : let -D and -U override definitions from loaded configuration file.
1749   -S : perform variable substitutions on all .SH files (can mix with -f)
1750   -U : undefine symbol:
1751          -U symbol    symbol gets the value 'undef'
1752          -U symbol=   symbol gets completely empty
1753        e.g.:  -Uversiononly
1754   -A : manipulate symbol after the platform specific hints have been applied:
1755          -A append:symbol=value   append value to symbol
1756          -A symbol=value          like append:, but with a separating space
1757          -A define:symbol=value   define symbol to have value
1758          -A clear:symbol          define symbol to be ''
1759          -A define:symbol         define symbol to be 'define'
1760          -A eval:symbol=value     define symbol to be eval of value
1761          -A prepend:symbol=value  prepend value to symbol
1762          -A undef:symbol          define symbol to be 'undef'
1763          -A undef:symbol=         define symbol to be ''
1764        e.g.:  -A prepend:libswanted='cl pthread '
1765               -A ccflags=-DSOME_MACRO
1766   -V : print version number and exit (with a zero status).
1767 EOM
1768         exit 1
1769         ;;
1770 esac
1771
1772 : Sanity checks
1773 case "$fastread$alldone" in
1774 yescont|yesexit) ;;
1775 *)
1776         case "$extractsh" in
1777         true) ;;
1778         *)
1779                 if test ! -t 0; then
1780                         echo "Say 'sh Configure', not 'sh <Configure'"
1781                         exit 1
1782                 fi
1783                 ;;
1784         esac
1785         ;;
1786 esac
1787
1788 exec 4>&1
1789 case "$silent" in
1790 true) exec 1>/dev/null;;
1791 esac
1792
1793 : run the defines and the undefines, if any, but leave the file out there...
1794 touch optdef.sh
1795 . ./optdef.sh
1796 : create the posthint manipulation script and leave the file out there...
1797 touch posthint.sh
1798
1799 : set package name
1800 package='perl5'
1801 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1802 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1803 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1804 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1805 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1806 esac
1807
1808 : Some greps do not return status, grrr.
1809 echo "grimblepritz" >grimble
1810 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1811         contains=contains
1812 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1813         contains=grep
1814 else
1815         contains=contains
1816 fi
1817 rm -f grimble
1818 : the following should work in any shell
1819 case "$contains" in
1820 contains*)
1821         echo " "
1822         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1823         cat >contains <<'EOSS'
1824 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1825 EOSS
1826 chmod +x contains
1827 esac
1828
1829 : Find the path to the source tree
1830 case "$src" in
1831 '') case "$0" in
1832     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1833          case "$src" in
1834          /*)    ;;
1835          .)     ;;
1836          *)     src=`cd ../$src && pwd` ;;
1837          esac
1838          ;;
1839     *)   src='.';;
1840     esac;;
1841 esac
1842 case "$src" in
1843 '')     src=/
1844         rsrc=/
1845         ;;
1846 /*)     rsrc="$src";;
1847 *)      rsrc="../$src";;
1848 esac
1849 if test -f $rsrc/Configure && \
1850         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1851 then
1852    : found it, so we are ok.
1853 else
1854         rsrc=''
1855         for src in . .. ../.. ../../.. ../../../..; do
1856                 if test -f ../$src/Configure && \
1857                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1858                 then
1859                         rsrc=../$src
1860                         break
1861                 fi
1862         done
1863 fi
1864 case "$rsrc" in
1865 '')
1866         cat <<EOM >&4
1867
1868 Sorry, I can't seem to locate the source dir for $package.  Please start
1869 Configure with an explicit path -- i.e. /some/path/Configure.
1870
1871 EOM
1872         exit 1
1873         ;;
1874 ../.)   rsrc='..';;
1875 *)
1876         echo " "
1877         echo "Sources for $package found in \"$src\"." >&4
1878         ;;
1879 esac
1880
1881 : script used to extract .SH files with variable substitutions
1882 cat >extract <<'EOS'
1883 PERL_CONFIG_SH=true
1884 echo "Doing variable substitutions on .SH files..."
1885 if test -f MANIFEST; then
1886         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1887 else
1888         echo "(Looking for .SH files under the source directory.)"
1889         set x `(cd "$src"; find . -name "*.SH" -print)`
1890 fi
1891 shift
1892 case $# in
1893 0) set x `(cd "$src"; echo *.SH)`; shift;;
1894 esac
1895 if test ! -f "$src/$1"; then
1896         shift
1897 fi
1898 mkdir_p='
1899 name=$1;
1900 create="";
1901 while test $name; do
1902         if test ! -d "$name"; then
1903                 create="$name $create";
1904                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1905                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1906         else
1907                 name="";
1908         fi;
1909 done;
1910 for file in $create; do
1911         mkdir $file;
1912 done
1913 '
1914 for file in $*; do
1915         case "$src" in
1916         ".")
1917                 case "$file" in
1918                 */*)
1919                         dir=`expr X$file : 'X\(.*\)/'`
1920                         file=`expr X$file : 'X.*/\(.*\)'`
1921                         (cd "$dir" && . ./$file)
1922                         ;;
1923                 *)
1924                         . ./$file
1925                         ;;
1926                 esac
1927                 ;;
1928         *)
1929                 case "$file" in
1930                 */*)
1931                         dir=`expr X$file : 'X\(.*\)/'`
1932                         file=`expr X$file : 'X.*/\(.*\)'`
1933                         (set x $dir; shift; eval $mkdir_p)
1934                         sh <"$src/$dir/$file"
1935                         ;;
1936                 *)
1937                         sh <"$src/$file"
1938                         ;;
1939                 esac
1940                 ;;
1941         esac
1942 done
1943 if test -f "$src/config_h.SH"; then
1944         if test ! -f config.h; then
1945         : oops, they left it out of MANIFEST, probably, so do it anyway.
1946         . "$src/config_h.SH"
1947         fi
1948 fi
1949 EOS
1950
1951 : extract files and exit if asked to do so
1952 case "$extractsh" in
1953 true)
1954         case "$realsilent" in
1955         true) ;;
1956         *) exec 1>&4;;
1957         esac
1958         case "$config_sh" in
1959         '') config_sh='config.sh';;
1960         esac
1961         echo " "
1962         echo "Fetching answers from $config_sh..."
1963         cd ..
1964         . $config_sh
1965         test "$override" && . ./optdef.sh
1966         echo " "
1967         . UU/extract
1968         rm -rf UU
1969         echo "Extraction done."
1970         exit 0
1971         ;;
1972 esac
1973
1974 : Eunice requires " " instead of "", can you believe it
1975 echo " "
1976 : Here we go...
1977 echo "Beginning of configuration questions for $package."
1978
1979 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1980
1981 : first determine how to suppress newline on echo command
1982 echo " "
1983 echo "Checking echo to see how to suppress newlines..."
1984 (echo "hi there\c" ; echo " ") >.echotmp
1985 if $contains c .echotmp >/dev/null 2>&1 ; then
1986         echo "...using -n."
1987         n='-n'
1988         c=''
1989 else
1990         cat <<'EOM'
1991 ...using \c
1992 EOM
1993         n=''
1994         c='\c'
1995 fi
1996 echo $n "The star should be here-->$c"
1997 echo '*'
1998 rm -f .echotmp
1999
2000 : Now test for existence of everything in MANIFEST
2001 echo " "
2002 if test -f "$rsrc/MANIFEST"; then
2003         echo "First let's make sure your kit is complete.  Checking..." >&4
2004         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2005                 (split -l 50 2>/dev/null || split -50)
2006         rm -f missing
2007         tmppwd=`pwd`
2008         for filelist in x??; do
2009                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2010                         >/dev/null 2>>"$tmppwd/missing")
2011         done
2012         if test -s missing; then
2013                 cat missing >&4
2014                 cat >&4 <<'EOM'
2015
2016 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2017
2018 You have the option of continuing the configuration process, despite the
2019 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2020 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2021 and contact the author (perlbug@perl.org).
2022
2023 EOM
2024                 echo $n "Continue? [n] $c" >&4
2025                 read ans
2026                 case "$ans" in
2027                 y*)
2028                         echo "Continuing..." >&4
2029                         rm -f missing
2030                         ;;
2031                 *)
2032                         echo "ABORTING..." >&4
2033                         kill $$
2034                         ;;
2035                 esac
2036         else
2037                 echo "Looks good..."
2038         fi
2039 else
2040         echo "There is no MANIFEST file.  I hope your kit is complete !"
2041 fi
2042 rm -f missing x??
2043
2044 : Find the appropriate value for a newline for tr
2045 echo " "
2046 if test -n "$DJGPP"; then
2047        trnl='\012'
2048 fi
2049 if test X"$trnl" = X; then
2050         case "`echo foo|tr '\n' x 2>/dev/null`" in
2051         foox) trnl='\n' ;;
2052         esac
2053 fi
2054 if test X"$trnl" = X; then
2055         case "`echo foo|tr '\012' x 2>/dev/null`" in
2056         foox) trnl='\012' ;;
2057         esac
2058 fi
2059 if test X"$trnl" = X; then
2060        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2061        fooxy) trnl='\n\r' ;;
2062        esac
2063 fi
2064 if test X"$trnl" = X; then
2065         cat <<EOM >&2
2066
2067 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2068
2069 EOM
2070         exit 1
2071 fi
2072
2073 : compute the number of columns on the terminal for proper question formatting
2074 case "$COLUMNS" in
2075 '') COLUMNS='80';;
2076 esac
2077
2078 : set up the echo used in my read
2079 myecho="case \"\$xxxm\" in
2080 '') echo $n \"\$rp $c\" >&4;;
2081 *) case \"\$rp\" in
2082         '') echo $n \"[\$xxxm] $c\";;
2083         *)
2084                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2085                         echo \"\$rp\" >&4
2086                         echo $n \"[\$xxxm] $c\" >&4
2087                 else
2088                         echo $n \"\$rp [\$xxxm] $c\" >&4
2089                 fi
2090                 ;;
2091         esac;;
2092 esac"
2093
2094 : now set up to do reads with possible shell escape and default assignment
2095 cat <<EOSC >myread
2096 $startsh
2097 xxxm=\$dflt
2098 $myecho
2099 ans='!'
2100 case "\$fastread" in
2101 yes) case "\$dflt" in
2102         '') ;;
2103         *) ans='';
2104                 case "\$silent-\$rp" in
2105                 true-) ;;
2106                 *) echo " " >&4;;
2107                 esac;;
2108         esac;;
2109 *) case "\$silent" in
2110         true) case "\$rp" in
2111                 '') ans='';;
2112                 esac;;
2113         esac;;
2114 esac
2115 while expr "X\$ans" : "X!" >/dev/null; do
2116         read answ
2117         set x \$xxxm
2118         shift
2119         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2120         case  "\$answ" in
2121         "!")
2122                 sh 1>&4
2123                 echo " "
2124                 $myecho
2125                 ;;
2126         !*)
2127                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2128                 shift
2129                 sh 1>&4 -c "\$*"
2130                 echo " "
2131                 $myecho
2132                 ;;
2133         "\$ans")
2134                 case "\$ans" in
2135                 \\&*)
2136                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2137                         shift
2138                         case "\$1" in
2139                         -d)
2140                                 fastread=yes
2141                                 echo "(OK, I'll run with -d after this question.)" >&4
2142                                 ;;
2143                         -*)
2144                                 echo "*** Sorry, \$1 not supported yet." >&4
2145                                 ;;
2146                         esac
2147                         $myecho
2148                         ans=!
2149                         ;;
2150                 esac;;
2151         *)
2152                 case "\$aok" in
2153                 y)
2154                         echo "*** Substitution done -- please confirm."
2155                         xxxm="\$ans"
2156                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2157                         xxxm="\$ans"
2158                         ans=!
2159                         ;;
2160                 *)
2161                         echo "*** Error -- try again."
2162                         ans=!
2163                         ;;
2164                 esac
2165                 $myecho
2166                 ;;
2167         esac
2168         case "\$ans\$xxxm\$nostick" in
2169         '')
2170                 ans=!
2171                 $myecho
2172                 ;;
2173         esac
2174 done
2175 case "\$ans" in
2176 '') ans="\$xxxm";;
2177 esac
2178 EOSC
2179
2180 : create .config dir to save info across Configure sessions
2181 test -d ../.config || mkdir ../.config
2182 cat >../.config/README <<EOF
2183 This directory created by Configure to save information that should
2184 persist across sessions for $package.
2185
2186 You may safely delete it if you wish.
2187 EOF
2188
2189 : See if we are using a devel version and want that
2190 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2191 case "$usedevel" in
2192 $define|true|[yY]*)
2193     usedevel="$define" ;;
2194 *) case "$xversion" in
2195    *[13579])
2196         cat >&4 <<EOH
2197 *** WHOA THERE!!! ***
2198
2199     This is an UNSTABLE DEVELOPMENT release.
2200     The version of this $package distribution is $xversion, that is, odd,
2201     (as opposed to even) and that signifies a development release.
2202     If you want a maintenance release, you want an even-numbered version.
2203
2204     Do ***NOT*** install this into production use.
2205     Data corruption and crashes are possible.
2206
2207     It is most seriously suggested that you do not continue any further
2208     unless you want to help in developing and debugging Perl.
2209
2210     If you *still* want to build perl, you can answer 'y' now,
2211     or pass -Dusedevel to Configure.
2212
2213 EOH
2214         rp='Do you really want to continue?'
2215         dflt='n'
2216         . ./myread
2217         case "$ans" in
2218         [yY]) echo >&4 "Okay, continuing."
2219               usedevel="$define" ;;
2220         *) echo >&4 "Okay, bye."
2221            exit 1
2222            ;;
2223         esac
2224         ;;
2225     esac
2226     usedevel="$undef"
2227     ;;
2228 esac
2229 case "$usedevel" in
2230 $define|true|[yY]*)
2231         case "$versiononly" in
2232         '') versiononly="$define" ;;
2233         esac
2234         case "$installusrbinperl" in
2235         '') installusrbinperl="$undef" ;;
2236         esac
2237         ;;
2238 esac
2239
2240 : general instructions
2241 needman=true
2242 firsttime=true
2243 user=`(logname) 2>/dev/null`
2244 case "$user" in
2245 '') user=`whoami 2>&1`;;
2246 esac
2247 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2248         firsttime=false
2249         echo " "
2250         rp='Would you like to see the instructions?'
2251         dflt=n
2252         . ./myread
2253         case "$ans" in
2254         [yY]*) ;;
2255         *) needman=false;;
2256         esac
2257 fi
2258 if $needman; then
2259         cat <<EOH
2260
2261 This installation shell script will examine your system and ask you questions
2262 to determine how the perl5 package should be installed. If you get
2263 stuck on a question, you may use a ! shell escape to start a subshell or
2264 execute a command.  Many of the questions will have default answers in square
2265 brackets; typing carriage return will give you the default.
2266
2267 On some of the questions which ask for file or directory names you are allowed
2268 to use the ~name construct to specify the login directory belonging to "name",
2269 even if you don't have a shell which knows about that.  Questions where this is
2270 allowed will be marked "(~name ok)".
2271
2272 EOH
2273         rp=''
2274         dflt='Type carriage return to continue'
2275         . ./myread
2276         cat <<'EOH'
2277
2278 The prompter used in this script allows you to use shell variables and
2279 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2280 in the default answer, as if the default line was a set of arguments given to a
2281 script shell.  This means you may also use $* to repeat the whole default line,
2282 so you do not have to re-type everything to add something to the default.
2283
2284 Every time there is a substitution, you will have to confirm.  If there is an
2285 error (e.g. an unmatched backtick), the default answer will remain unchanged
2286 and you will be prompted again.
2287
2288 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2289 the questions and use the computed defaults (or the previous answers if there
2290 was already a config.sh file). Type 'Configure -h' for a list of options.
2291 You may also start interactively and then answer '& -d' at any prompt to turn
2292 on the non-interactive behaviour for the remainder of the execution.
2293
2294 EOH
2295         . ./myread
2296         cat <<EOH
2297
2298 Much effort has been expended to ensure that this shell script will run on any
2299 Unix system.  If despite that it blows up on yours, your best bet is to edit
2300 Configure and run it again.  If you can't run Configure for some reason,
2301 you'll have to generate a config.sh file by hand.  Whatever problems you
2302 have, let me (perlbug@perl.org) know how I blew it.
2303
2304 This installation script affects things in two ways:
2305
2306 1) it may do direct variable substitutions on some of the files included
2307    in this kit.
2308 2) it builds a config.h file for inclusion in C programs.  You may edit
2309    any of these files as the need arises after running this script.
2310
2311 If you make a mistake on a question, there is no easy way to back up to it
2312 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2313 files.  Configure will offer to let you do this before it runs the SH files.
2314
2315 EOH
2316         dflt='Type carriage return to continue'
2317         . ./myread
2318         case "$firsttime" in
2319         true) echo $user >>../.config/instruct;;
2320         esac
2321 fi
2322
2323 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2324 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2325 if test "X$sysroot" = X; then
2326     sysroot=""
2327 else
2328     case "$cc" in
2329         *gcc*|*g++*)
2330             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2331             # _sysroot is used in places where we need --sysroot=foo
2332             # but using the rest of the flags could cause issues.
2333             _sysroot="--sysroot=$sysroot";
2334             case "$ccflags" in
2335                 *sysroot*) ;;
2336                 'undef'|*)
2337                 ccflags="$ccflags $_sysroot"
2338             esac
2339             case "$ldflags" in
2340                 *sysroot*) ;;
2341                 'undef'|*)
2342                 ldflags="$ldflags $_sysroot"
2343             esac
2344             case "$cppflags" in
2345                 *sysroot*) ;;
2346                 'undef'|*)
2347                 cppflags="$cppflags $_sysroot"
2348             esac
2349             # lddlflags updated below in lddlflags section;
2350             # same with cccdlflags
2351             ;;
2352     esac
2353
2354     # Adjust some defaults to also use $sysroot
2355     for var in xlibpth loclibpth locincpth glibpth; do
2356         eval xxx=\$$var
2357         eval $var=''
2358         for path in $xxx; do
2359             eval $var=\"\$$var $sysroot$path\"
2360         done
2361     done
2362
2363 fi
2364
2365 : find out where common programs are
2366 echo " "
2367 echo "Locating common programs..." >&4
2368 cat <<EOSC >loc
2369 $startsh
2370 case \$# in
2371 0) exit 1;;
2372 esac
2373 thing=\$1
2374 shift
2375 dflt=\$1
2376 shift
2377 for dir in \$*; do
2378         case "\$thing" in
2379         .)
2380         if test -d \$dir/\$thing; then
2381                 echo \$dir
2382                 exit 0
2383         fi
2384         ;;
2385         *)
2386         for thisthing in \$dir/\$thing; do
2387                 : just loop through to pick last item
2388         done
2389         if test -f \$thisthing; then
2390                 echo \$thisthing
2391                 exit 0
2392         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2393                 echo \$thisthing
2394                 exit 0
2395         elif test -f \$dir/\$thing.exe; then
2396                 if test -n "$DJGPP"; then
2397                         echo \$dir/\$thing.exe
2398                 elif test "$eunicefix" != ":"; then
2399                         : on Eunice apparently
2400                         echo \$dir/\$thing
2401                 fi
2402                 exit 0
2403         fi
2404         ;;
2405         esac
2406 done
2407 echo \$dflt
2408 exit 1
2409 EOSC
2410 chmod +x loc
2411 $eunicefix loc
2412 loclist="
2413 awk
2414 cat
2415 chmod
2416 comm
2417 cp
2418 echo
2419 expr
2420 grep
2421 ls
2422 mkdir
2423 rm
2424 sed
2425 sort
2426 touch
2427 tr
2428 uniq
2429 "
2430 trylist="
2431 ar
2432 bison
2433 byacc
2434 cpp
2435 csh
2436 date
2437 egrep
2438 gmake
2439 gzip
2440 less
2441 ln
2442 make
2443 more
2444 nm
2445 nroff
2446 perl
2447 pg
2448 test
2449 uname
2450 zip
2451 "
2452 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2453 pth="$pth $sysroot/lib $sysroot/usr/lib"
2454 for file in $loclist; do
2455         eval xxx=\$$file
2456         case "$xxx" in
2457         /*|?:[\\/]*)
2458                 if test -f "$xxx"; then
2459                         : ok
2460                 else
2461                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2462                         xxx=`./loc $file $file $pth`
2463                 fi
2464                 ;;
2465         '') xxx=`./loc $file $file $pth`;;
2466         *) xxx=`./loc $xxx $xxx $pth`;;
2467         esac
2468         eval $file=$xxx$_exe
2469         eval _$file=$xxx
2470         case "$xxx" in
2471         /*)
2472                 echo $file is in $xxx.
2473                 ;;
2474         ?:[\\/]*)
2475                 echo $file is in $xxx.
2476                 ;;
2477         *)
2478                 echo "I don't know where '$file' is, and my life depends on it." >&4
2479                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2480                 exit 1
2481                 ;;
2482         esac
2483 done
2484 echo " "
2485 echo "Don't worry if any of the following aren't found..."
2486 say=offhand
2487 for file in $trylist; do
2488         eval xxx=\$$file
2489         case "$xxx" in
2490         /*|?:[\\/]*)
2491                 if test -f "$xxx"; then
2492                         : ok
2493                 else
2494                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2495                         xxx=`./loc $file $file $pth`
2496                 fi
2497                 ;;
2498         '') xxx=`./loc $file $file $pth`;;
2499         *) xxx=`./loc $xxx $xxx $pth`;;
2500         esac
2501         eval $file=$xxx$_exe
2502         eval _$file=$xxx
2503         case "$xxx" in
2504         /*)
2505                 echo $file is in $xxx.
2506                 ;;
2507         ?:[\\/]*)
2508                 echo $file is in $xxx.
2509                 ;;
2510         *)
2511                 echo "I don't see $file out there, $say."
2512                 say=either
2513                 ;;
2514         esac
2515 done
2516 case "$egrep" in
2517 egrep)
2518         echo "Substituting grep for egrep."
2519         egrep=$grep
2520         _egrep=$grep
2521         ;;
2522 esac
2523 case "$less" in
2524 '')     ;;
2525 *)      if $less -R </dev/null >/dev/null 2>&1; then
2526                echo "Substituting less -R for less."
2527                less="$less -R"
2528                _less=$less
2529         fi
2530         ;;
2531 esac
2532 case "$ln" in
2533 ln)
2534         echo "Substituting cp for ln."
2535         ln=$cp
2536         _ln=$cp
2537         ;;
2538 esac
2539 case "$make" in
2540 make)
2541         case "$gmake" in
2542         gmake)
2543         echo "I can't find make or gmake, and my life depends on it." >&4
2544         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2545         exit 1
2546         ;;
2547         esac
2548         ;;
2549 esac
2550 case "$gmake" in
2551 gmake)  ;;
2552 *)      # We can't have osname yet.
2553         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2554                 # Assume that gmake, if found, is definitely GNU make
2555                 # and prefer it over the system make.
2556                 echo "Substituting gmake for make."
2557                 make=$gmake
2558                 _make=$gmake
2559         fi
2560         ;;
2561 esac
2562 case "$test" in
2563 test)
2564         echo "Hopefully test is built into your sh."
2565         ;;
2566 *)
2567         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2568                 echo "Using the test built into your sh."
2569                 test=test
2570                 _test=test
2571         fi
2572         ;;
2573 esac
2574 case "$echo" in
2575 echo)
2576         echo "Hopefully echo is built into your sh."
2577         ;;
2578 '') ;;
2579 *)
2580         echo " "
2581 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2582         $echo $n "hi there$c" >foo1
2583         echo $n "hi there$c" >foo2
2584         if cmp foo1 foo2 >/dev/null 2>&1; then
2585                 echo "They are compatible.  In fact, they may be identical."
2586         else
2587                 case "$n" in
2588                 '-n') n='' c='\c';;
2589                 *) n='-n' c='';;
2590                 esac
2591                 cat <<FOO
2592 They are not compatible!  You are probably running ksh on a non-USG system.
2593 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2594 have echo built in and we may have to run some Bourne shell scripts.  That
2595 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2596
2597 FOO
2598                 $echo $n "The star should be here-->$c"
2599                 $echo "*"
2600         fi
2601         $rm -f foo1 foo2
2602         ;;
2603 esac
2604
2605 # This question was auctioned at YAPC::Europe-2007 in Vienna
2606 # I never promised you could answer it. I only auctioned the question.
2607 cat <<FOO
2608 The following message is sponsored by
2609
2610   Dresden.pm<--The stars should be here.
2611
2612 Dear Perl user, system administrator or package
2613 maintainer, the Perl community sends greetings to
2614 you. Do you (emblematical) greet back [Y/n]? n
2615
2616 FOO
2617
2618 : Check what type of C compiler we use
2619 cat <<EOS >trygcc
2620 $startsh
2621 EOS
2622 cat <<'EOSC' >>trygcc
2623 case "$cc" in
2624 '') ;;
2625 *)  $rm -f try try.*
2626     $cat >try.c <<EOM
2627 int main(int argc, char *argv[]) {
2628   return 0;
2629 }
2630 EOM
2631     if $cc -o try $ccflags $ldflags try.c; then
2632        :
2633     else
2634         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2635         despair=yes
2636         trygcc=yes
2637         case "$cc" in
2638         *gcc*) trygcc=no ;;
2639         esac
2640         # Skip this test because it gives a false match on output like:
2641         #    ./trygcc: line 23: cc: command not found
2642         # case "`$cc -v -c try.c 2>&1`" in
2643         # *gcc*) trygcc=no ;;
2644         # esac
2645         if $test X"$trygcc" = Xyes; then
2646             if gcc -o try -c try.c; then
2647                 echo " "
2648                 echo "You seem to have a working gcc, though." >&4
2649                 # Switching compilers may undo the work of hints files.
2650                 # The most common problem is -D_REENTRANT for threads.
2651                 # This heuristic catches that case, but gets false positives
2652                 # if -Dusethreads was not actually specified.  Better to
2653                 # bail out here with a useful message than fail 
2654                 # mysteriously later. Should we perhaps just try to
2655                 # re-invoke Configure -Dcc=gcc config_args ?
2656                 if $test -f usethreads.cbu; then
2657                         $cat >&4 <<EOM 
2658
2659 *** However, any setting of the C compiler flags (e.g. for thread support)
2660 *** will be lost.  It may be necessary for you to restart Configure and
2661 *** add -Dcc=gcc to your Configure command line.
2662
2663 EOM
2664                         rp="Would you like to go ahead and try gcc anyway?"
2665                         dflt=n
2666                 else
2667                         rp="Would you like to use it?"
2668                         dflt=y
2669                 fi
2670                 if $test -f myread; then
2671                     . ./myread
2672                 else
2673                     if $test -f UU/myread; then
2674                         . ./UU/myread
2675                     else
2676                         echo "Cannot find myread, sorry.  Aborting." >&2
2677                         exit 1
2678                     fi
2679                 fi  
2680                 case "$ans" in
2681                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2682                 esac
2683             fi
2684         fi
2685     fi
2686     $rm -f try try.*
2687     ;;
2688 esac
2689 EOSC
2690
2691 cat <<EOS >checkcc
2692 $startsh
2693 EOS
2694 cat <<'EOSC' >>checkcc
2695 case "$cc" in        
2696 '') ;;
2697 *)  $rm -f try try.*              
2698     $cat >try.c <<EOM
2699 int main(int argc, char *argv[]) {
2700   return 0;
2701 }
2702 EOM
2703     if $cc -o try $ccflags $ldflags try.c; then
2704        :
2705     else
2706         if $test X"$despair" = Xyes; then
2707            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2708         fi
2709         $cat >&4 <<EOM         
2710 You need to find a working C compiler.
2711 Either (purchase and) install the C compiler supplied by your OS vendor,
2712 or for a free C compiler try http://gcc.gnu.org/
2713 I cannot continue any further, aborting.
2714 EOM
2715         exit 1
2716     fi
2717     $rm -f try try.*
2718     ;;
2719 esac
2720 EOSC
2721
2722 : determine whether symbolic links are supported
2723 echo " "
2724 $touch blurfl
2725 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2726         echo "Symbolic links are supported." >&4
2727         lns="$ln -s"
2728 else
2729         echo "Symbolic links are NOT supported." >&4
2730         lns="$ln"
2731 fi
2732 $rm -f blurfl sym
2733
2734 : determine whether symbolic links are supported
2735 echo " "
2736 case "$lns" in
2737 *"ln"*" -s")
2738         echo "Checking how to test for symbolic links..." >&4
2739         $lns blurfl sym
2740         if $test "X$issymlink" = X; then
2741                 case "$newsh" in
2742                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2743                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2744                 esac
2745                 if test $? = 0; then
2746                         issymlink="test -h"
2747                 else
2748                         echo "Your builtin 'test -h' may be broken." >&4
2749                         case "$test" in
2750                         /*)     ;;
2751                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2752                                 for p in $pth
2753                                 do
2754                                         if test -f "$p/$test"; then
2755                                                 test="$p/$test"
2756                                                 break
2757                                         fi
2758                                 done
2759                                 ;;
2760                         esac
2761                         case "$test" in
2762                         /*)
2763                                 echo "Trying external '$test -h'." >&4
2764                                 issymlink="$test -h"
2765                                 if $test ! -h sym >/dev/null 2>&1; then
2766                                         echo "External '$test -h' is broken, too." >&4
2767                                         issymlink=''
2768                                 fi
2769                                 ;;
2770                         *)      issymlink='' ;;
2771                         esac
2772                 fi
2773         fi
2774         if $test "X$issymlink" = X; then
2775                 if $test -L sym 2>/dev/null; then
2776                         issymlink="$test -L"
2777                         echo "The builtin '$test -L' worked." >&4
2778                 fi
2779         fi
2780         if $test "X$issymlink" != X; then
2781                 echo "You can test for symbolic links with '$issymlink'." >&4
2782         else
2783                 echo "I do not know how you can test for symbolic links." >&4
2784         fi
2785         $rm -f blurfl sym
2786         ;;
2787 *)      echo "No symbolic links, so not testing for their testing..." >&4
2788         ;;
2789 esac
2790 echo " "
2791
2792 : Make symlinks util
2793 case "$mksymlinks" in
2794 $define|true|[yY]*)
2795         case "$src" in
2796         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2797                 exit 1
2798                 ;;
2799         *)      case "$lns:$issymlink" in
2800                 *"ln"*" -s:"*"test -"?)
2801                         echo "Creating the symbolic links..." >&4
2802                         echo "(First creating the subdirectories...)" >&4
2803                         cd ..
2804                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2805                                 read directory
2806                                 test -z "$directory" && break
2807                                 mkdir -p $directory
2808                         done
2809                         # Sanity check 1.
2810                         if test ! -d t/base; then
2811                                 echo "Failed to create the subdirectories.  Aborting." >&4
2812                                 exit 1
2813                         fi
2814                         echo "(Then creating the symlinks...)" >&4
2815                         awk '{print $1}' $src/MANIFEST | while true; do
2816                                 read filename
2817                                 test -z "$filename" && break
2818                                 if test -f $filename; then
2819                                         if $issymlink $filename; then
2820                                                 rm -f $filename
2821                                         fi
2822                                 fi
2823                                 if test -f $filename; then
2824                                         echo "$filename already exists, not symlinking."
2825                                 else
2826                                         ln -s $src/$filename $filename
2827                                 fi
2828                         done
2829                         # Sanity check 2.
2830                         if test ! -f t/base/lex.t; then
2831                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2832                                 exit 1
2833                         fi
2834                         cd UU
2835                         ;;
2836                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2837                         ;;
2838                 esac
2839                 ;;
2840         esac
2841         ;;
2842 esac
2843
2844 : Check for Cross-Compilation
2845 if $test "X$targethost" = "X"; then
2846     targethost=""
2847 fi
2848 if $test "X$targetenv" = "X"; then
2849     targetenv=""
2850 fi
2851 case "$usecrosscompile" in
2852 $define|true|[yY]*)
2853         $echo "Cross-compiling..."
2854         croak=''
2855         case "$cc" in
2856         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2857             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2858             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2859             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2860             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2861             # leave out ld, choosing it is more complex
2862             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2863             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2864             # We are in a weird spot. Just before us, some values
2865             # were 'saved', to be restored after the hints are
2866             # run.  This means that the changes we made to ar,
2867             # nm and ranlib will get reverted.
2868             # To avoid that, we hijack the saving mechanism and
2869             # have it save our new values.
2870             for file in ar nm ranlib; do
2871                 eval xxx=\$$file
2872                 eval $file=$xxx$_exe
2873                 eval _$file=$xxx
2874             done
2875         ;;
2876         esac
2877         case "$targetarch" in
2878         '') echo "Targetarch not defined." >&4; croak=y ;;
2879         *)  echo "Using targetarch $targetarch." >&4 ;;
2880         esac
2881         case "$targethost" in
2882         '') echo "Targethost not defined." >&4; croak=y ;;
2883         *)  echo "Using targethost $targethost." >&4
2884         esac
2885         locincpth=' '
2886         loclibpth=' '
2887         case "$croak" in
2888         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2889         esac
2890     : compile a host miniperl and generate_uudmap, unless we got passed them
2891     if $test "X$hostperl" = X; then
2892       echo "Building host miniperl and generate_uudmap binaries" >&4
2893       before_host=`pwd`
2894       cd ..
2895       cd $src
2896       src=`pwd`
2897       rm -rf $src/host
2898       mkdir $src/host
2899       cd $src/host
2900       $src/Configure -des -Dusedevel -Dmksymlinks
2901       $make miniperl
2902       case "$hostgenerate" in
2903       '') $make generate_uudmap
2904           hostgenerate=$src/host/generate_uudmap
2905           ;;
2906        "$undef") hostgenerate=''
2907           ;;
2908       esac
2909       hostperl=$src/host/miniperl
2910       cd $before_host
2911     fi
2912     hostosname=`$hostperl -le 'print $^O'`
2913     ;;
2914 *)
2915     usecrosscompile="$undef"
2916     ;;
2917 esac
2918
2919 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2920 case "$targethost" in
2921     '') echo "Checking for cross-compile" >&4
2922     case "$usecrosscompile$multiarch" in
2923        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2924          if [ -f Makefile ]; then
2925            echo " "
2926            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2927          else
2928            echo "Configure done."
2929          fi
2930        exit 0
2931        ;;
2932      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2933         run=''
2934         to=:
2935         from=:
2936         ;;
2937     esac
2938     ;;
2939     *) echo "Using targethost $targethost." >&4
2940         case "$src" in
2941         /*) run=$src/Cross/run
2942             targetmkdir=$src/Cross/mkdir
2943             to=$src/Cross/to
2944             from=$src/Cross/from
2945             ;;
2946         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2947             run=$pwd/Cross/run
2948             targetmkdir=$pwd/Cross/mkdir
2949             to=$pwd/Cross/to
2950             from=$pwd/Cross/from
2951             ;;
2952         esac
2953         case "$targetrun" in
2954         '') targetrun=ssh ;;
2955         esac
2956         case "$targetto" in
2957         '') targetto=scp ;;
2958         esac
2959         case "$targetfrom" in
2960         '') targetfrom=scp ;;
2961         esac
2962         run=$run-$targetrun
2963         to=$to-$targetto
2964         from=$from-$targetfrom
2965         case "$targetdir" in
2966         '')  targetdir=/tmp
2967              echo "Guessing targetdir $targetdir." >&4
2968              ;;
2969         esac
2970         case "$targetuser" in
2971         '')  targetuser=root
2972              echo "Guessing targetuser $targetuser." >&4
2973              ;;
2974         esac
2975         case "$targetport" in
2976         '')  targetport=22
2977              echo "Guessing targetport $targetport." >&4
2978              ;;
2979         esac
2980         case "$targetfrom" in
2981         scp)    q=-q ;;
2982         *)      q='' ;;
2983         esac
2984         case "$targetrun" in
2985         ssh|rsh)
2986             cat >$run <<EOF
2987 #!/bin/sh
2988 env=''
2989 case "\$1" in
2990 -cwd)
2991   shift
2992   cwd=\$1
2993   shift
2994   ;;
2995 esac
2996 case "\$1" in
2997 -env)
2998   shift
2999   env=\$1
3000   shift
3001   ;;
3002 esac
3003 case "\$cwd" in
3004 '') cwd=$targetdir ;;
3005 esac
3006 exe=\$1
3007 shift
3008 $to \$exe
3009 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3010 EOF
3011             ;;
3012         adb)
3013             $touch $run
3014             ;;
3015         *)  echo "Unknown targetrun '$targetrun'" >&4
3016             exit 1
3017             ;;
3018         esac
3019         case "$targetmkdir" in
3020         */Cross/mkdir)
3021             cat >$targetmkdir <<EOF
3022 #!/bin/sh
3023 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3024 EOF
3025             $chmod a+rx $targetmkdir
3026             ;;
3027         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3028             exit 1
3029             ;;
3030         esac
3031         case "$targetto" in
3032         scp|rcp)
3033             cat >$to <<EOF
3034 #!/bin/sh
3035 for f in \$@
3036 do
3037   case "\$f" in
3038   /*)
3039     $targetmkdir \`dirname \$f\`
3040     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3041     ;;
3042   *)
3043     $targetmkdir $targetdir/\`dirname \$f\`
3044     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3045     ;;
3046   esac
3047 done
3048 exit 0
3049 EOF
3050             ;;
3051         cp) cat >$to <<EOF
3052 #!/bin/sh
3053 for f in \$@
3054 do
3055   case "\$f" in
3056   /*)
3057     $mkdir -p $targetdir/\`dirname \$f\`
3058     $cp \$f $targetdir/\$f || exit 1
3059     ;;
3060   *)
3061     $targetmkdir $targetdir/\`dirname \$f\`
3062     $cp \$f $targetdir/\$f || exit 1
3063     ;;
3064   esac
3065 done
3066 exit 0
3067 EOF
3068             ;;
3069         *)  echo "Unknown targetto '$targetto'" >&4
3070             exit 1
3071             ;;
3072         esac
3073         case "$targetfrom" in
3074         scp|rcp)
3075           cat >$from <<EOF
3076 #!/bin/sh
3077 for f in \$@
3078 do
3079   $rm -f \$f
3080   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3081 done
3082 exit 0
3083 EOF
3084             ;;
3085         cp) cat >$from <<EOF
3086 #!/bin/sh
3087 for f in \$@
3088 do
3089   $rm -f \$f
3090   cp $targetdir/\$f . || exit 1
3091 done
3092 exit 0
3093 EOF
3094             ;;
3095         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3096             exit 1
3097             ;;
3098         esac
3099         if $test ! -f $run; then
3100             echo "Target 'run' script '$run' not found." >&4
3101         else
3102             $chmod a+rx $run
3103         fi
3104         if $test ! -f $to; then
3105             echo "Target 'to' script '$to' not found." >&4
3106         else
3107             $chmod a+rx $to
3108         fi
3109         if $test ! -f $from; then
3110             echo "Target 'from' script '$from' not found." >&4
3111         else
3112             $chmod a+rx $from
3113         fi
3114         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3115             exit 1
3116         fi
3117         cat >&4 <<EOF
3118 Using '$run' for remote execution,
3119 and '$from' and '$to'
3120 for remote file transfer.
3121 EOF
3122         ;;
3123 *)      run=''
3124         to=:
3125         from=:
3126         usecrosscompile="$undef"
3127         targetarch=''
3128         ;;
3129 esac
3130
3131 : see whether [:lower:] and [:upper:] are supported character classes
3132 echo " "
3133 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3134 ABYZ)
3135         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3136         up='[:upper:]'
3137         low='[:lower:]'
3138         ;;
3139 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3140         # (0xd9 and 0xe2), therefore that is a nice testing point.
3141         if test "X$up" = X -o "X$low" = X; then
3142             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3143             rs) up='[A-Z]'
3144                 low='[a-z]'
3145                 ;;
3146             esac
3147         fi
3148         if test "X$up" = X -o "X$low" = X; then
3149             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3150             rs) up='A-Z'
3151                 low='a-z'
3152                 ;;
3153             esac
3154         fi
3155         if test "X$up" = X -o "X$low" = X; then
3156             case "`echo RS | od -x 2>/dev/null`" in
3157             *D9E2*|*d9e2*)
3158                 echo "Hey, this might be EBCDIC." >&4
3159                 if test "X$up" = X -o "X$low" = X; then
3160                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3161                     rs) up='[A-IJ-RS-Z]'
3162                         low='[a-ij-rs-z]'
3163                         ;;
3164                     esac
3165                 fi
3166                 if test "X$up" = X -o "X$low" = X; then
3167                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3168                     rs) up='A-IJ-RS-Z'
3169                         low='a-ij-rs-z'
3170                         ;;
3171                     esac
3172                 fi
3173                 ;;
3174             esac
3175         fi
3176 esac
3177 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3178 rs)
3179     echo "Using $up and $low to convert case." >&4
3180     ;;
3181 *)
3182     echo "I don't know how to translate letters from upper to lower case." >&4
3183     echo "Your tr is not acting any way I know of." >&4
3184     exit 1
3185     ;;
3186 esac
3187 : set up the translation script tr, must be called with ./tr of course
3188 cat >tr <<EOSC
3189 $startsh
3190 case "\$1\$2" in
3191 '[A-Z][a-z]') exec $tr '$up' '$low';;
3192 '[a-z][A-Z]') exec $tr '$low' '$up';;
3193 esac
3194 exec $tr "\$@"
3195 EOSC
3196 chmod +x tr
3197 $eunicefix tr
3198
3199 : Try to determine whether config.sh was made on this system
3200 case "$config_sh" in
3201 '')
3202 myuname=`$uname -a 2>/dev/null`
3203 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3204 # Downcase everything to avoid ambiguity.
3205 # Remove slashes and single quotes so we can use parts of this in
3206 # directory and file names.
3207 # Remove newlines so myuname is sane to use elsewhere.
3208 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3209 # because the A-Z/a-z are not consecutive.
3210 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3211         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3212 newmyuname="$myuname"
3213 dflt=n
3214 case "$knowitall" in
3215 '')
3216         if test -f ../config.sh; then
3217                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3218                         eval "`grep myuname= ../config.sh`"
3219                 fi
3220                 if test "X$myuname" = "X$newmyuname"; then
3221                         dflt=y
3222                 fi
3223         fi
3224         ;;
3225 *) dflt=y;;
3226 esac
3227
3228 : Get old answers from old config file if Configure was run on the
3229 : same system, otherwise use the hints.
3230 hint=default
3231 cd ..
3232 if test -f config.sh; then
3233         echo " "
3234         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3235         . UU/myread
3236         case "$ans" in
3237         n*|N*) echo "OK, I'll ignore it."
3238                 mv config.sh config.sh.old
3239                 myuname="$newmyuname"
3240                 ;;
3241         *)  echo "Fetching default answers from your old config.sh file..." >&4
3242                 tmp_n="$n"
3243                 tmp_c="$c"
3244                 tmp_sh="$sh"
3245                 . ./config.sh
3246                 cp config.sh UU
3247                 n="$tmp_n"
3248                 c="$tmp_c"
3249                 : Older versions did not always set $sh.  Catch re-use of such
3250                 : an old config.sh.
3251                 case "$sh" in
3252                 '') sh="$tmp_sh" ;;
3253                 esac
3254                 hint=previous
3255                 ;;
3256         esac
3257 fi
3258 . ./UU/checkcc
3259 if test ! -f config.sh; then
3260         $cat <<EOM
3261
3262 First time through, eh?  I have some defaults handy for some systems
3263 that need some extra help getting the Configure answers right:
3264
3265 EOM
3266         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3267         dflt=''
3268         : Half the following guesses are probably wrong... If you have better
3269         : tests or hints, please send them to perlbug@perl.org
3270         : The metaconfig authors would also appreciate a copy...
3271         $test -f /irix && osname=irix
3272         $test -f /xenix && osname=sco_xenix
3273         $test -f /dynix && osname=dynix
3274         $test -f /dnix && osname=dnix
3275         $test -f /lynx.os && osname=lynxos
3276         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3277         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3278         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3279         $test -f /bin/mips && /bin/mips && osname=mips
3280         $test -d /usr/apollo/bin && osname=apollo
3281         $test -f /etc/saf/_sactab && osname=svr4
3282         $test -d /usr/include/minix && osname=minix
3283         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3284         if $test -d /MachTen -o -d /MachTen_Folder; then
3285                 osname=machten
3286                 if $test -x /sbin/version; then
3287                         osvers=`/sbin/version | $awk '{print $2}' |
3288                         $sed -e 's/[A-Za-z]$//'`
3289                 elif $test -x /usr/etc/version; then
3290                         osvers=`/usr/etc/version | $awk '{print $2}' |
3291                         $sed -e 's/[A-Za-z]$//'`
3292                 else
3293                         osvers="$2.$3"
3294                 fi
3295         fi
3296
3297         $test -f /sys/posix.dll &&
3298                 $test -f /usr/bin/what &&
3299                 set X `/usr/bin/what /sys/posix.dll` &&
3300                 $test "$3" = UWIN &&
3301                 osname=uwin &&
3302                 osvers="$5"
3303
3304         if $test -f $uname; then
3305                 set X $myuname
3306                 shift
3307
3308                 case "$5" in
3309                 fps*) osname=fps ;;
3310                 mips*)
3311                         case "$4" in
3312                         umips) osname=umips ;;
3313                         *) osname=mips ;;
3314                         esac;;
3315                 [23]100) osname=mips ;;
3316                 i386*)
3317                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3318                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3319                                 osname='sco'
3320                                 osvers=$tmp
3321                         elif $test -f /etc/kconfig; then
3322                                 osname=isc
3323                                 if test "$lns" = "$ln -s"; then
3324                                         osvers=4
3325                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3326                                         osvers=3
3327                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3328                                         osvers=2
3329                                 fi
3330                         fi
3331                         tmp=''
3332                         ;;
3333                 pc*)
3334                         if test -n "$DJGPP"; then
3335                                 osname=dos
3336                                 osvers=djgpp
3337                         fi
3338                         ;;
3339                 esac
3340
3341                 case "$1" in
3342                 aix) osname=aix
3343                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3344                         case "$tmp" in
3345                         # oslevel can fail with:
3346                         # oslevel: Unable to acquire lock.
3347                         *not\ found) osvers="$4"."$3" ;;
3348                         '<3240'|'<>3240') osvers=3.2.0 ;;
3349                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3350                         '=3250'|'>3250') osvers=3.2.5 ;;
3351                         *) osvers=$tmp;;
3352                         esac
3353                         ;;
3354                 bitrig) osname=bitrig
3355                         osvers="$3"
3356                         ;;
3357                 bsd386) osname=bsd386
3358                         osvers=`$uname -r`
3359                         ;;
3360                 cygwin*) osname=cygwin
3361                         osvers="$3"
3362                         ;;
3363                 *dc.osx) osname=dcosx
3364                         osvers="$3"
3365                         ;;
3366                 dnix) osname=dnix
3367                         osvers="$3"
3368                         ;;
3369                 domainos) osname=apollo
3370                         osvers="$3"
3371                         ;;
3372                 dgux)   osname=dgux
3373                         osvers="$3"
3374                         ;;
3375                 dragonfly) osname=dragonfly
3376                         osvers="$3"
3377                         ;;
3378                 dynixptx*) osname=dynixptx
3379                         osvers=`echo "$4"|sed 's/^v//'`
3380                         ;;
3381                 freebsd) osname=freebsd
3382                         osvers="$3" ;;
3383                 genix)  osname=genix ;;
3384                 gnu)    osname=gnu
3385                         osvers="$3" ;;
3386                 hp*)    osname=hpux
3387                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3388                         ;;
3389                 irix*)  osname=irix
3390                         case "$3" in
3391                         4*) osvers=4 ;;
3392                         5*) osvers=5 ;;
3393                         *)      osvers="$3" ;;
3394                         esac
3395                         ;;
3396                 linux)  osname=linux
3397                         case "$3" in
3398                         *)      osvers="$3" ;;
3399                         esac
3400                         $test -f /system/lib/libandroid.so && osname=linux-android
3401                         ;;
3402                 MiNT)   osname=mint
3403                         ;;
3404                 netbsd*) osname=netbsd
3405                         osvers="$3"
3406                         ;;
3407                 news-os) osvers="$3"
3408                         case "$3" in
3409                         4*) osname=newsos4 ;;
3410                         *) osname=newsos ;;
3411                         esac
3412                         ;;
3413                 nonstop-ux) osname=nonstopux ;;
3414                 openbsd) osname=openbsd
3415                         osvers="$3"
3416                         ;;
3417                 os2)    osname=os2
3418                         osvers="$4"
3419                         ;;
3420                 POSIX-BC | posix-bc ) osname=posix-bc
3421                         osvers="$3"
3422                         ;;
3423                 powerux | power_ux | powermax_os | powermaxos | \
3424                 powerunix | power_unix) osname=powerux
3425                         osvers="$3"
3426                         ;;
3427                 qnx) osname=qnx
3428                         osvers="$4"
3429                         ;;
3430                 solaris) osname=solaris
3431                         case "$3" in
3432                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3433                         *)      osvers="$3" ;;
3434                         esac
3435                         ;;
3436                 sunos) osname=sunos
3437                         case "$3" in
3438                         5*) osname=solaris
3439                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3440                         *)      osvers="$3" ;;
3441                         esac
3442                         ;;
3443                 titanos) osname=titanos
3444                         case "$3" in
3445                         1*) osvers=1 ;;
3446                         2*) osvers=2 ;;
3447                         3*) osvers=3 ;;
3448                         4*) osvers=4 ;;
3449                         *)      osvers="$3" ;;
3450                         esac
3451                         ;;
3452                 ultrix) osname=ultrix
3453                         osvers="$3"
3454                         ;;
3455                 osf1|mls+)      case "$5" in
3456                                 alpha)
3457                                         osname=dec_osf
3458                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3459                                         case "$osvers" in
3460                                         [1-9].[0-9]*) ;;
3461                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3462                                         esac
3463                                         ;;
3464                         hp*)    osname=hp_osf1  ;;
3465                         mips)   osname=mips_osf1 ;;
3466                         esac
3467                         ;;
3468                 # UnixWare 7.1.2 is known as Open UNIX 8
3469                 openunix|unixware) osname=svr5
3470                         osvers="$4"
3471                         ;;
3472                 uts)    osname=uts
3473                         osvers="$3"
3474                         ;;
3475                 vos) osvers="$3"
3476                         ;;
3477                 $2) case "$osname" in
3478                         *isc*) ;;
3479                         *freebsd*) ;;
3480                         svr*)
3481                                 : svr4.x or possibly later
3482                                 case "svr$3" in
3483                                 ${osname}*)
3484                                         osname=svr$3
3485                                         osvers=$4
3486                                         ;;
3487                                 esac
3488                                 case "$osname" in
3489                                 svr4.0)
3490                                         : Check for ESIX
3491                                         if test -f /stand/boot ; then
3492                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3493                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3494                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3495                                                         if test -n "$isesix"; then
3496                                                                 osname=esix4
3497                                                         fi
3498                                                 fi
3499                                         fi
3500                                         ;;
3501                                 esac
3502                                 ;;
3503                         *)      if test -f /etc/systemid; then
3504                                         osname=sco
3505                                         set `echo $3 | $sed 's/\./ /g'` $4
3506                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3507                                                 osvers=$1.$2.$3
3508                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3509                                                 osvers=$1.$2
3510                                         elif $test -f $src/hints/sco_$1.sh; then
3511                                                 osvers=$1
3512                                         fi
3513                                 else
3514                                         case "$osname" in
3515                                         '') : Still unknown.  Probably a generic Sys V.
3516                                                 osname="sysv"
3517                                                 osvers="$3"
3518                                                 ;;
3519                                         esac
3520                                 fi
3521                                 ;;
3522                         esac
3523                         ;;
3524                 *)      case "$osname" in
3525                         '') : Still unknown.  Probably a generic BSD.
3526                                 osname="$1"
3527                                 osvers="$3"
3528                                 ;;
3529                         esac
3530                         ;;
3531                 esac
3532         else
3533                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3534                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3535                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3536                                 osname=news_os
3537                         fi
3538                         $rm -f UU/kernel.what
3539                 elif test -d c:/. -o -n "$is_os2" ; then
3540                         set X $myuname
3541                         osname=os2
3542                         osvers="$5"
3543                 fi
3544         fi
3545
3546         case "$targetarch" in
3547         '') ;;
3548         *)  hostarch=$osname
3549             case "$targetarch" in
3550                 nto*|*-nto-*)
3551                     # Will load qnx.sh, which should change osname to nto
3552                     osname=qnx
3553                     osvers=''
3554                     ;;
3555                 *linux-android*)
3556                     # Catch arm-linux-androideabi, mipsel-linux-android,
3557                     # and i686-linux-android
3558                     osname=linux-android
3559                     osvers=''
3560                     ;;
3561                 *linux*)
3562                     # Something like arm-linux-gnueabihf is really just
3563                     # plain linux.
3564                     osname=linux
3565                     osvers=''
3566                     ;;
3567                 *solaris*|*sunos*)
3568                     osname=solaris
3569                     # XXX perhaps we should just assume
3570                     # osvers to be 2, or maybe take the value
3571                     # from targetarch. Using $run before the
3572                     # hints are run is somewhat icky.
3573                     set X `$run $uname -a 2>/dev/null`
3574                     shift
3575                     case "$3" in
3576                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3577                         *)  osvers="$3" ;;
3578                     esac
3579                     ;;
3580                 *)
3581                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3582                     osvers=''
3583                 ;;
3584             esac
3585             ;;
3586         esac
3587
3588         : Now look for a hint file osname_osvers, unless one has been
3589         : specified already.
3590         case "$hintfile" in
3591         ''|' ')
3592                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3593                 : Also try without trailing minor version numbers.
3594                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3595                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3596                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3597                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3598                 case "$file" in
3599                 '') dflt=none ;;
3600                 *)  case "$osvers" in
3601                         '') dflt=$file
3602                                 ;;
3603                         *)  if $test -f $src/hints/$file.sh ; then
3604                                         dflt=$file
3605                                 elif $test -f $src/hints/$xfile.sh ; then
3606                                         dflt=$xfile
3607                                 elif $test -f $src/hints/$xxfile.sh ; then
3608                                         dflt=$xxfile
3609                                 elif $test -f $src/hints/$xxxfile.sh ; then
3610                                         dflt=$xxxfile
3611                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3612                                         dflt=$xxxxfile
3613                                 elif $test -f "$src/hints/${osname}.sh" ; then
3614                                         dflt="${osname}"
3615                                 else
3616                                         dflt=none
3617                                 fi
3618                                 ;;
3619                         esac
3620                         ;;
3621                 esac
3622                 if $test -f Policy.sh ; then
3623                         case "$dflt" in
3624                         *Policy*) ;;
3625                         none) dflt="Policy" ;;
3626                         *) dflt="Policy $dflt" ;;
3627                         esac
3628                 fi
3629                 ;;
3630         *)
3631                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3632                 ;;
3633         esac
3634
3635         if $test -f Policy.sh ; then
3636                 $cat <<EOM
3637
3638 There's also a Policy hint file available, which should make the
3639 site-specific (policy) questions easier to answer.
3640 EOM
3641
3642         fi
3643
3644         $cat <<EOM
3645
3646 You may give one or more space-separated answers, or "none" if appropriate.
3647 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3648 previous run of Configure, you may specify it as well as or instead of
3649 OS-specific hints.  If hints are provided for your OS, you should use them:
3650 although Perl can probably be built without hints on many platforms, using
3651 hints often improve performance and may enable features that Configure can't
3652 set up on its own. If there are no hints that match your OS, specify "none";
3653 DO NOT give a wrong version or a wrong OS.
3654
3655 EOM
3656
3657         rp="Which of these apply, if any?"
3658         . UU/myread
3659         tans=$ans
3660         for file in $tans; do
3661                 if $test X$file = XPolicy -a -f Policy.sh; then
3662                         . Policy.sh
3663                         $cat Policy.sh >> UU/config.sh
3664                 elif $test -f $src/hints/$file.sh; then
3665                         . $src/hints/$file.sh
3666                         $cat $src/hints/$file.sh >> UU/config.sh
3667                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3668                         : nothing
3669                 else
3670                         : Give one chance to correct a possible typo.
3671                         echo "$file.sh does not exist"
3672                         dflt=$file
3673                         rp="hint to use instead?"
3674                         . UU/myread
3675                         for file in $ans; do
3676                                 if $test -f "$src/hints/$file.sh"; then
3677                                         . $src/hints/$file.sh
3678                                         $cat $src/hints/$file.sh >> UU/config.sh
3679                                 elif $test X$ans = X -o X$ans = Xnone ; then
3680                                         : nothing
3681                                 else
3682                                         echo "$file.sh does not exist -- ignored."
3683                                 fi
3684                         done
3685                 fi
3686         done
3687
3688         hint=recommended
3689         : Remember our hint file for later.
3690         if $test -f "$src/hints/$file.sh" ; then
3691                 hintfile="$file"
3692         else
3693                 hintfile=''
3694         fi
3695 fi
3696 cd UU
3697 ;;
3698 *)
3699         echo " "
3700         echo "Fetching default answers from $config_sh..." >&4
3701         tmp_n="$n"
3702         tmp_c="$c"
3703         cd ..
3704         cp $config_sh config.sh 2>/dev/null
3705         chmod +w config.sh
3706         . ./config.sh
3707         cd UU
3708         cp ../config.sh .
3709         n="$tmp_n"
3710         c="$tmp_c"
3711         hint=previous
3712         ;;
3713 esac
3714 test "$override" && . ./optdef.sh
3715
3716 : Restore computed paths
3717 for file in $loclist $trylist; do
3718         eval $file="\$_$file"
3719 done
3720
3721 cat << EOM
3722
3723 Configure uses the operating system name and version to set some defaults.
3724 The default value is probably right if the name rings a bell. Otherwise,
3725 since spelling matters for me, either accept the default or answer "none"
3726 to leave it blank.
3727
3728 EOM
3729 case "$osname" in
3730         ''|' ')
3731                 case "$hintfile" in
3732                 ''|' '|none) dflt=none ;;
3733                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3734                 esac
3735                 ;;
3736         *) dflt="$osname" ;;
3737 esac
3738 rp="Operating system name?"
3739 . ./myread
3740 case "$ans" in
3741 none)  osname='' ;;
3742 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3743 esac
3744 echo " "
3745 case "$osvers" in
3746         ''|' ')
3747                 case "$hintfile" in
3748                 ''|' '|none) dflt=none ;;
3749                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3750                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3751                         case "$dflt" in
3752                         ''|' ') dflt=none ;;
3753                         esac
3754                         ;;
3755                 esac
3756                 ;;
3757         *) dflt="$osvers" ;;
3758 esac
3759 rp="Operating system version?"
3760 . ./myread
3761 case "$ans" in
3762 none)  osvers='' ;;
3763 *) osvers="$ans" ;;
3764 esac
3765
3766
3767 . ./posthint.sh
3768
3769 : who configured the system
3770 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3771 case "$cf_by" in
3772 "")
3773         cf_by=`(logname) 2>/dev/null`
3774         case "$cf_by" in
3775         "")
3776                 cf_by=`(whoami) 2>/dev/null`
3777                 case "$cf_by" in
3778                 "") cf_by=unknown ;;
3779                 esac ;;
3780         esac ;;
3781 esac
3782
3783 : decide how portable to be.  Allow command line overrides.
3784 case "$d_portable" in
3785 "$undef") ;;
3786 *)      d_portable="$define" ;;
3787 esac
3788
3789 : set up shell script to do ~ expansion
3790 cat >filexp <<EOSS
3791 $startsh
3792 : expand filename
3793 case "\$1" in
3794  \~/*|\~)
3795         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3796         ;;
3797  \~*)
3798         if $test -f /bin/csh; then
3799                 /bin/csh -f -c "glob \$1"
3800                 failed=\$?
3801                 echo ""
3802                 exit \$failed
3803         else
3804                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3805                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3806                 if $test ! -d "\$dir"; then
3807                         me=\`basename \$0\`
3808                         echo "\$me: can't locate home directory for: \$name" >&2
3809                         exit 1
3810                 fi
3811                 case "\$1" in
3812                 */*)
3813                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3814                         ;;
3815                 *)
3816                         echo \$dir
3817                         ;;
3818                 esac
3819         fi
3820         ;;
3821 *)
3822         echo \$1
3823         ;;
3824 esac
3825 EOSS
3826 chmod +x filexp
3827 $eunicefix filexp
3828
3829 : now set up to get a file name
3830 cat <<EOS >getfile
3831 $startsh
3832 EOS
3833 cat <<'EOSC' >>getfile
3834 tilde=''
3835 fullpath=''
3836 already=''
3837 skip=''
3838 none_ok=''
3839 exp_file=''
3840 nopath_ok=''
3841 orig_rp="$rp"
3842 orig_dflt="$dflt"
3843 case "$gfpth" in
3844 '') gfpth='.' ;;
3845 esac
3846
3847 case "$fn" in
3848 *\(*)
3849         : getfile will accept an answer from the comma-separated list
3850         : enclosed in parentheses even if it does not meet other criteria.
3851         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3852         fn=`echo $fn | sed 's/(.*)//'`
3853         ;;
3854 esac
3855
3856 case "$fn" in
3857 *:*)
3858         loc_file=`expr $fn : '.*:\(.*\)'`
3859         fn=`expr $fn : '\(.*\):.*'`
3860         ;;
3861 esac
3862
3863 case "$fn" in
3864 *~*) tilde=true;;
3865 esac
3866 case "$fn" in
3867 */*) fullpath=true;;
3868 esac
3869 case "$fn" in
3870 *+*) skip=true;;
3871 esac
3872 case "$fn" in
3873 *n*) none_ok=true;;
3874 esac
3875 case "$fn" in
3876 *e*) exp_file=true;;
3877 esac
3878 case "$fn" in
3879 *p*) nopath_ok=true;;
3880 esac
3881
3882 case "$fn" in
3883 *f*) type='File';;
3884 *d*) type='Directory';;
3885 *l*) type='Locate';;
3886 esac
3887
3888 what="$type"
3889 case "$what" in
3890 Locate) what='File';;
3891 esac
3892
3893 case "$exp_file" in
3894 '')
3895         case "$d_portable" in
3896         "$define") ;;
3897         *) exp_file=true;;
3898         esac
3899         ;;
3900 esac
3901
3902 cd ..
3903 while test "$type"; do
3904         redo=''
3905         rp="$orig_rp"
3906         dflt="$orig_dflt"
3907         case "$tilde" in
3908         true) rp="$rp (~name ok)";;
3909         esac
3910         . UU/myread
3911         if test -f UU/getfile.ok && \
3912                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3913         then
3914                 value="$ans"
3915                 ansexp="$ans"
3916                 break
3917         fi
3918         case "$ans" in
3919         none)
3920                 value=''
3921                 ansexp=''
3922                 case "$none_ok" in
3923                 true) type='';;
3924                 esac
3925                 ;;
3926         *)
3927                 case "$tilde" in
3928                 '') value="$ans"
3929                         ansexp="$ans";;
3930                 *)
3931                         value=`UU/filexp $ans`
3932                         case $? in
3933                         0)
3934                                 if test "$ans" != "$value"; then
3935                                         echo "(That expands to $value on this system.)"
3936                                 fi
3937                                 ;;
3938                         *) value="$ans";;
3939                         esac
3940                         ansexp="$value"
3941                         case "$exp_file" in
3942                         '') value="$ans";;
3943                         esac
3944                         ;;
3945                 esac
3946                 case "$fullpath" in
3947                 true)
3948                         case "$ansexp" in
3949                         /*) value="$ansexp" ;;
3950                         [a-zA-Z]:/*) value="$ansexp" ;;
3951                         *)
3952                                 redo=true
3953                                 case "$already" in
3954                                 true)
3955                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3956                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3957                                         ;;
3958                                 *)
3959                                 echo "Please give a full path name, starting with slash." >&4
3960                                         case "$tilde" in
3961                                         true)
3962                                 echo "Note that using ~name is ok provided it expands well." >&4
3963                                                 already=true
3964                                                 ;;
3965                                         esac
3966                                 esac
3967                                 ;;
3968                         esac
3969                         ;;
3970                 esac
3971                 case "$redo" in
3972                 '')
3973                         case "$type" in
3974                         File)
3975                                 for fp in $gfpth; do
3976                                         if test "X$fp" = X.; then
3977                                             pf="$ansexp"
3978                                         else    
3979                                             pf="$fp/$ansexp"
3980                                         fi
3981                                         if test -f "$pf"; then
3982                                                 type=''
3983                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3984                                         then
3985                                                 echo "($value is not a plain file, but that's ok.)"
3986                                                 type=''
3987                                         fi
3988                                         if test X"$type" = X; then
3989                                             value="$pf"
3990                                             break
3991                                         fi
3992                                 done
3993                                 ;;
3994                         Directory)
3995                                 for fp in $gfpth; do
3996                                         if test "X$fp" = X.; then
3997                                             dir="$ans"
3998                                             direxp="$ansexp"
3999                                         else    
4000                                             dir="$fp/$ansexp"
4001                                             direxp="$fp/$ansexp"
4002                                         fi
4003                                         if test -d "$direxp"; then
4004                                                 type=''
4005                                                 value="$dir"
4006                                                 break
4007                                         fi
4008                                 done
4009                                 ;;
4010                         Locate)
4011                                 if test -d "$ansexp"; then
4012                                         echo "(Looking for $loc_file in directory $value.)"
4013                                         value="$value/$loc_file"
4014                                         ansexp="$ansexp/$loc_file"
4015                                 fi
4016                                 if test -f "$ansexp"; then
4017                                         type=''
4018                                 fi
4019                                 case "$nopath_ok" in
4020                                 true)   case "$value" in
4021                                         */*) ;;
4022                                         *)      echo "Assuming $value will be in people's path."
4023                                                 type=''
4024                                                 ;;
4025                                         esac
4026                                         ;;
4027                                 esac
4028                                 ;;
4029                         esac
4030
4031                         case "$skip" in
4032                         true) type='';
4033                         esac
4034
4035                         case "$type" in
4036                         '') ;;
4037                         *)
4038                                 if test "$fastread" = yes; then
4039                                         dflt=y
4040                                 else
4041                                         dflt=n
4042                                 fi
4043                                 rp="$what $value doesn't exist.  Use that name anyway?"
4044                                 . UU/myread
4045                                 dflt=''
4046                                 case "$ans" in
4047                                 y*) type='';;
4048                                 *) echo " ";;
4049                                 esac
4050                                 ;;
4051                         esac
4052                         ;;
4053                 esac
4054                 ;;
4055         esac
4056 done
4057 cd UU
4058 ans="$value"
4059 rp="$orig_rp"
4060 dflt="$orig_dflt"
4061 rm -f getfile.ok
4062 test "X$gfpthkeep" != Xy && gfpth=""
4063 EOSC
4064
4065 : determine root of directory hierarchy where package will be installed.
4066 case "$prefix" in
4067 '')
4068         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4069         ;;
4070 *?/)
4071         dflt=`echo "$prefix" | sed 's/.$//'`
4072         ;;
4073 *)
4074         dflt="$prefix"
4075         ;;
4076 esac
4077 $cat <<EOM
4078
4079 By default, $package will be installed in $dflt/bin, manual pages
4080 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4081 installation directories. Typically this is something like /usr/local.
4082 If you wish to have binaries under /usr/bin but other parts of the
4083 installation under /usr/local, that's ok: you will be prompted
4084 separately for each of the installation directories, the prefix being
4085 only used to set the defaults.
4086
4087 EOM
4088 fn=d~
4089 rp='Installation prefix to use?'
4090 . ./getfile
4091 oldprefix=''
4092 case "$prefix" in
4093 '') ;;
4094 *)
4095         case "$ans" in
4096         "$prefix") ;;
4097         *) oldprefix="$prefix";;
4098         esac
4099         ;;
4100 esac
4101 prefix="$ans"
4102 prefixexp="$ansexp"
4103
4104 : allow them to override the AFS root
4105 case "$afsroot" in
4106 '')     afsroot=/afs ;;
4107 *)      afsroot=$afsroot ;;
4108 esac
4109
4110 : is AFS running?
4111 echo " "
4112 case "$afs" in
4113 $define|true)   afs=true ;;
4114 $undef|false)   afs=false ;;
4115 *)      if $test -d $afsroot; then
4116                 afs=true
4117         else
4118                 afs=false
4119         fi
4120         ;;
4121 esac
4122 if $afs; then
4123         echo "AFS may be running... I'll be extra cautious then..." >&4
4124 else
4125         echo "AFS does not seem to be running..." >&4
4126 fi
4127
4128 : determine installation prefix for where package is to be installed.
4129 if $afs; then
4130 $cat <<EOM
4131
4132 Since you are running AFS, I need to distinguish the directory in which
4133 files will reside from the directory in which they are installed (and from
4134 which they are presumably copied to the former directory by occult means).
4135
4136 EOM
4137         case "$installprefix" in
4138         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4139         *) dflt="$installprefix";;
4140         esac
4141 else
4142 $cat <<EOM
4143
4144 In some special cases, particularly when building $package for distribution,
4145 it is convenient to distinguish the directory in which files should be
4146 installed from the directory ($prefix) in which they will
4147 eventually reside.  For most users, these two directories are the same.
4148
4149 EOM
4150         case "$installprefix" in
4151         '') dflt=$prefix ;;
4152         *) dflt=$installprefix;;
4153         esac
4154 fi
4155 fn=d~
4156 rp='What installation prefix should I use for installing files?'
4157 . ./getfile
4158 installprefix="$ans"
4159 installprefixexp="$ansexp"
4160
4161 : Perform the prefixexp/installprefixexp correction if necessary
4162 cat <<EOS >installprefix
4163 $startsh
4164 EOS
4165 cat <<'EOSC' >>installprefix
4166 : Change installation prefix, if necessary.
4167 if $test X"$prefix" != X"$installprefix"; then
4168     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4169 else
4170     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4171 fi
4172 EOSC
4173 chmod +x installprefix
4174 $eunicefix installprefix
4175
4176 : Set variables such as privlib and privlibexp from the output of ./getfile
4177 : performing the prefixexp/installprefixexp correction if necessary.
4178 cat <<EOS >setprefixvar
4179 $startsh
4180 EOS
4181 cat <<'EOSC' >>setprefixvar
4182 eval "${prefixvar}=\"\$ans\""
4183 eval "${prefixvar}exp=\"\$ansexp\""
4184 . ./installprefix
4185 EOSC
4186 chmod +x setprefixvar
4187 $eunicefix setprefixvar
4188
4189 : set up the script used to warn in case of inconsistency
4190 cat <<EOS >whoa
4191 $startsh
4192 EOS
4193 cat <<'EOSC' >>whoa
4194 dflt=y
4195 case "$hint" in
4196     recommended)
4197         case "$hintfile" in
4198         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4199                 ;;
4200         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4201                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4202                 ;;
4203         esac
4204         ;;
4205     *)  echo " "
4206         echo "*** WHOA THERE!!! ***" >&4
4207         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4208         ;;
4209 esac
4210 rp="    Keep the $hint value?"
4211 . ./myread
4212 case "$ans" in
4213 y) td=$was; tu=$was;;
4214 esac
4215 EOSC
4216
4217 : function used to set '$1' to '$val'
4218 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4219 case "$val$was" in
4220 $define$undef) . ./whoa; eval "$var=\$td";;
4221 $undef$define) . ./whoa; eval "$var=\$tu";;
4222 *) eval "$var=$val";;
4223 esac'
4224
4225 : get the patchlevel
4226 echo " "
4227 echo "Getting the current patchlevel..." >&4
4228 if $test -r $rsrc/patchlevel.h;then
4229         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4230         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4231         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4232         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4233         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4234         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4235         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4236 else
4237         revision=0
4238         patchlevel=0
4239         subversion=0
4240         api_revision=0
4241         api_version=0
4242         api_subversion=0
4243         perl_patchlevel=0
4244         $echo "(You do not have patchlevel.h.  Eek.)"
4245 fi
4246 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4247 version_patchlevel_string="version $patchlevel subversion $subversion"
4248 case "$perl_patchlevel" in
4249 0|'') ;;
4250 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4251     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4252     ;;
4253 esac
4254
4255 $echo "(You have $package $version_patchlevel_string.)"
4256
4257 case "$osname" in
4258 dos|vms)
4259         : XXX Should be a Configure test for double-dots in filenames.
4260         version=`echo $revision $patchlevel $subversion | \
4261                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4262         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4263                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4264         ;;
4265 *)
4266         version=`echo $revision $patchlevel $subversion | \
4267                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4268         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4269                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4270         ;;
4271 esac
4272 : Special case the 5.005_xx maintenance series, which used 5.005
4273 : without any subversion label as a subdirectory in $sitelib
4274 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4275         api_versionstring='5.005'
4276 fi
4277
4278 : Do we want threads support and if so, what type
4279 case "$usethreads" in
4280 $define|true|[yY]*)     dflt='y';;
4281 *)     # Catch case where user specified ithreads or 5005threads but
4282        # forgot -Dusethreads (A.D. 4/2002)
4283        case "$useithreads$use5005threads" in
4284        *$define*)       dflt='y';;
4285        *)               dflt='n';;
4286        esac
4287        ;;
4288 esac
4289 cat <<EOM
4290
4291 Perl can be built to offer a form of threading support on some systems
4292 To do so, Configure can be run with -Dusethreads.
4293
4294 Note that Perl built with threading support runs slightly slower
4295 and uses slightly more memory than plain Perl.
4296
4297 If this doesn't make any sense to you, just accept the default '$dflt'.
4298 EOM
4299 rp='Build a threading Perl?'
4300 . ./myread
4301 case "$ans" in
4302 y|Y)    val="$define" ;;
4303 *)      val="$undef" ;;
4304 esac
4305 set usethreads
4306 eval $setvar
4307
4308 if $test $patchlevel -lt 9; then
4309     case "$usethreads" in
4310     $define)
4311         : Default to ithreads unless overridden on command line or with
4312         : old config.sh
4313         dflt='y'
4314         case "$use5005threads" in
4315                 $define|true|[yY]*)
4316                         echo "5.005 threads are no longer supported"
4317                         exit 1
4318                 ;;
4319         esac
4320         case "$useithreads" in
4321                 $undef|false|[nN]*) dflt='n';;
4322         esac
4323         rp='Use the newer interpreter-based ithreads?'
4324         . ./myread
4325         case "$ans" in
4326         y|Y)    val="$define" ;;
4327         *)      val="$undef" ;;
4328         esac
4329         set useithreads
4330         eval $setvar
4331         : Now set use5005threads to the opposite value.
4332         case "$useithreads" in
4333         $define) val="$undef" ;;
4334         *) val="$define" ;;
4335         esac
4336         set use5005threads
4337         eval $setvar
4338         ;;
4339     *)
4340         useithreads="$undef"
4341         use5005threads="$undef"
4342         ;;
4343     esac
4344
4345     case "$useithreads$use5005threads" in
4346     "$define$define")
4347         $cat >&4 <<EOM
4348
4349 You cannot have both the ithreads and the 5.005 threads enabled
4350 at the same time.  Disabling the 5.005 threads since they are
4351 much less stable than the ithreads.
4352
4353 EOM
4354         use5005threads="$undef"
4355         ;;
4356     esac
4357
4358 else
4359 : perl-5.9.x and later
4360
4361     if test X"$usethreads" = "X$define"; then
4362         case "$use5005threads" in
4363             $define|true|[yY]*)
4364                 $cat >&4 <<EOM
4365
4366 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4367
4368 EOM
4369             ;;
4370         esac
4371     fi
4372
4373     use5005threads="$undef"
4374     useithreads="$usethreads"
4375 fi
4376
4377 case "$d_oldpthreads" in
4378 '')     : Configure tests would be welcome here.  For now, assume undef.
4379         val="$undef" ;;
4380 *)      val="$d_oldpthreads" ;;
4381 esac
4382 set d_oldpthreads
4383 eval $setvar
4384
4385
4386 : Look for a hint-file generated 'call-back-unit'.  If the
4387 : user has specified that a threading perl is to be built,
4388 : we may need to set or change some other defaults.
4389 if $test -f usethreads.cbu; then
4390     echo "Your platform has some specific hints regarding threaded builds, using them..."
4391     . ./usethreads.cbu
4392 else
4393     case "$usethreads" in
4394         "$define"|true|[yY]*)
4395                 $cat <<EOM
4396 (Your platform does not have any specific hints for threaded builds.
4397  Assuming POSIX threads, then.)
4398 EOM
4399         ;;
4400     esac
4401 fi
4402
4403 : Check if multiplicity is required
4404 cat <<EOM
4405
4406 Perl can be built so that multiple Perl interpreters can coexist
4407 within the same Perl executable.
4408 EOM
4409
4410 case "$useithreads" in
4411 $define)
4412         cat <<EOM
4413 This multiple interpreter support is required for interpreter-based threads.
4414 EOM
4415         val="$define"
4416         ;;
4417 *)      case "$usemultiplicity" in
4418         $define|true|[yY]*)     dflt='y';;
4419         *) dflt='n';;
4420         esac
4421         echo " "
4422         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4423         rp='Build Perl for multiplicity?'
4424         . ./myread
4425         case "$ans" in
4426         y|Y)    val="$define" ;;
4427         *)      val="$undef" ;;
4428         esac
4429         ;;
4430 esac
4431 set usemultiplicity
4432 eval $setvar
4433
4434 : Check if morebits is requested
4435 case "$usemorebits" in
4436 "$define"|true|[yY]*)
4437         use64bitint="$define"
4438         uselongdouble="$define"
4439         usemorebits="$define"
4440         ;;
4441 *)      usemorebits="$undef"
4442         ;;
4443 esac
4444
4445 : Determine the C compiler to be used
4446 echo " "
4447 case "$cc" in
4448 '') dflt=cc;;
4449 *) dflt="$cc";;
4450 esac
4451 rp="Use which C compiler?"
4452 . ./myread
4453 cc="$ans"
4454
4455 : See whether they have no cc but they do have gcc
4456 . ./trygcc
4457 if $test -f cc.cbu; then
4458     . ./cc.cbu
4459 fi
4460 . ./checkcc
4461
4462 : make some quick guesses about what we are up against
4463 echo " "
4464 $echo $n "Hmm...  $c"
4465 echo exit 1 >bsd
4466 echo exit 1 >usg
4467 echo exit 1 >v7
4468 echo exit 1 >osf1
4469 echo exit 1 >eunice
4470 echo exit 1 >xenix
4471 echo exit 1 >venix
4472 echo exit 1 >os2
4473 d_bsd="$undef"
4474 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4475 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4476 then
4477         echo "Looks kind of like an OSF/1 system, but we'll see..."
4478         echo exit 0 >osf1
4479 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4480         xxx=`./loc addbib blurfl $pth`
4481         if $test -f $xxx; then
4482         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4483                 echo exit 0 >bsd
4484                 echo exit 0 >usg
4485         else
4486                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4487                         echo "Looks kind of like an extended USG system, but we'll see..."
4488                 else
4489                         echo "Looks kind of like a USG system, but we'll see..."
4490                 fi
4491                 echo exit 0 >usg
4492         fi
4493 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4494         echo "Looks kind of like a BSD system, but we'll see..."
4495         d_bsd="$define"
4496         echo exit 0 >bsd
4497 else
4498         echo "Looks kind of like a Version 7 system, but we'll see..."
4499         echo exit 0 >v7
4500 fi
4501 case "$eunicefix" in
4502 *unixtovms*)
4503         $cat <<'EOI'
4504 There is, however, a strange, musty smell in the air that reminds me of
4505 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4506 EOI
4507         echo exit 0 >eunice
4508         d_eunice="$define"
4509 : it so happens the Eunice I know will not run shell scripts in Unix format
4510         ;;
4511 *)
4512         echo " "
4513         echo "Congratulations.  You aren't running Eunice."
4514         d_eunice="$undef"
4515         ;;
4516 esac
4517 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4518 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4519 : semicolon as a patch separator
4520 case "$p_" in
4521 :) ;;
4522 *)
4523         $cat <<'EOI'
4524 I have the feeling something is not exactly right, however...don't tell me...
4525 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4526 (Or you may be running DOS with DJGPP.)
4527 EOI
4528         echo exit 0 >os2
4529         ;;
4530 esac
4531 if test -f /xenix; then
4532         echo "Actually, this looks more like a XENIX system..."
4533         echo exit 0 >xenix
4534         d_xenix="$define"
4535 else
4536         echo " "
4537         echo "It's not Xenix..."
4538         d_xenix="$undef"
4539 fi
4540 chmod +x xenix
4541 $eunicefix xenix
4542 if test -f /venix; then
4543         echo "Actually, this looks more like a VENIX system..."
4544         echo exit 0 >venix
4545 else
4546         echo " "
4547         if ./xenix; then
4548                 : null
4549         else
4550                 echo "Nor is it Venix..."
4551         fi
4552 fi
4553 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4554 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4555 $rm -f foo
4556
4557 : Check if we are using GNU gcc and what its version is
4558 echo " "
4559 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4560 $cat >try.c <<EOM
4561 #include <stdio.h>
4562 int main() {
4563 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4564 #ifdef __VERSION__
4565         printf("%s\n", __VERSION__);
4566 #else
4567         printf("%s\n", "1");
4568 #endif
4569 #endif
4570         return(0);
4571 }
4572 EOM
4573 if $cc -o try $ccflags $ldflags try.c; then
4574         gccversion=`$run ./try`
4575         case "$gccversion" in
4576         '') echo "You are not using GNU cc." ;;
4577         *)  echo "You are using GNU cc $gccversion."
4578             ccname=gcc
4579             ;;
4580         esac
4581 else
4582         echo " "
4583         echo "*** WHOA THERE!!! ***" >&4
4584         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4585         case "$knowitall" in
4586         '')
4587         echo "    You'd better start hunting for one and let me know about it." >&4
4588                 exit 1
4589                 ;;
4590         esac
4591 fi
4592 $rm -f try try.*
4593 case "$gccversion" in
4594 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4595 esac
4596 case "$gccversion" in
4597 '') gccosandvers='' ;;
4598 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4599    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4600    gccshortvers=''
4601    case "$gccosandvers" in
4602    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4603    $osname$osvers) ;; # looking good
4604    $osname*) cat <<EOM >&4
4605
4606 *** WHOA THERE!!! ***
4607
4608     Your gcc has not been compiled for the exact release of
4609     your operating system ($gccosandvers versus $osname$osvers).
4610
4611     In general it is a good idea to keep gcc synchronized with
4612     the operating system because otherwise serious problems
4613     may ensue when trying to compile software, like Perl.
4614
4615     I'm trying to be optimistic here, though, and will continue.
4616     If later during the configuration and build icky compilation
4617     problems appear (headerfile conflicts being the most common
4618     manifestation), I suggest reinstalling the gcc to match
4619     your operating system release.
4620
4621 EOM
4622       ;;
4623    *) gccosandvers='' ;; # failed to parse, better be silent
4624    esac
4625    ;;
4626 esac
4627 case "$ccname" in
4628 '') ccname="$cc" ;;
4629 esac
4630
4631 # gcc 3.* complain about adding -Idirectories that they already know about,
4632 # so we will take those off from locincpth.
4633 case "$gccversion" in
4634 3*)
4635     echo "main(){}">try.c
4636     for incdir in $locincpth; do
4637        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4638              grep '^c[cp]p*[01]: warning: changing search order '`
4639        if test "X$warn" != X; then
4640            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4641        fi
4642     done
4643     $rm -f try try.*
4644 esac
4645
4646 # gcc 4.9 by default does some optimizations that break perl.
4647 # see ticket 121505.
4648 #
4649 # The -fwrapv disables those optimizations (and probably others,) so
4650 # for gcc 4.9 (and later, since the optimizations probably won't go
4651 # away), add -fwrapv unless the user requests -fno-wrapv, which
4652 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4653 # which turns the overflows -fwrapv ignores into runtime errors.
4654 case "$gccversion" in
4655 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4656     case "$ccflags" in
4657     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4658     *) ccflags="$ccflags -fwrapv" ;;
4659     esac
4660 esac
4661
4662 : What should the include directory be ?
4663 : Use sysroot if set, so findhdr looks in the right place.
4664 echo " "
4665 $echo $n "Hmm...  $c"
4666 dflt="$sysroot/usr/include"
4667 incpath=''
4668 mips_type=''
4669 if $test -f /bin/mips && /bin/mips; then
4670         echo "Looks like a MIPS system..."
4671         $cat >usr.c <<'EOCP'
4672 #ifdef SYSTYPE_BSD43
4673 /bsd43
4674 #endif
4675 EOCP
4676         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4677                 dflt='/bsd43/usr/include'
4678                 incpath='/bsd43'
4679                 mips_type='BSD 4.3'
4680         else
4681                 mips_type='System V'
4682         fi
4683         $rm -f usr.c usr.out
4684         echo "and you're compiling with the $mips_type compiler and libraries."
4685         xxx_prompt=y
4686         echo "exit 0" >mips
4687 else
4688         echo "Doesn't look like a MIPS system."
4689         xxx_prompt=n
4690         echo "exit 1" >mips
4691 fi
4692 chmod +x mips
4693 $eunicefix mips
4694 case "$usrinc" in
4695 '') ;;
4696 *) dflt="$usrinc";;
4697 esac
4698 case "$xxx_prompt" in
4699 y)      fn=d/
4700         echo " "
4701         rp='Where are the include files you want to use?'
4702         . ./getfile
4703         usrinc="$ans"
4704         ;;
4705 *)      usrinc="$dflt"
4706         ;;
4707 esac
4708
4709 : see how we invoke the C preprocessor
4710 echo " "
4711 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4712 cat <<'EOT' >testcpp.c
4713 #define ABC abc
4714 #define XYZ xyz
4715 ABC.XYZ
4716 EOT
4717 cd ..
4718 if test ! -f cppstdin; then
4719         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4720                 # AIX cc -E doesn't show the absolute headerfile
4721                 # locations but we'll cheat by using the -M flag.
4722                 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
4723         else
4724                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4725         fi
4726 else
4727         echo "Keeping your $hint cppstdin wrapper."
4728 fi
4729 chmod 755 cppstdin
4730 wrapper=`pwd`/cppstdin
4731 ok='false'
4732 cd UU
4733
4734 if $test "X$cppstdin" != "X" && \
4735         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4736         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4737 then
4738         echo "You used to use $cppstdin $cppminus so we'll use that again."
4739         case "$cpprun" in
4740         '') echo "But let's see if we can live without a wrapper..." ;;
4741         *)
4742                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4743                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4744                 then
4745                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4746                         ok='true'
4747                 else
4748                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4749                 fi
4750                 ;;
4751         esac
4752 else
4753         case "$cppstdin" in
4754         '') ;;
4755         *)
4756                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4757                 ;;
4758         esac
4759 fi
4760
4761 if $ok; then
4762         : nothing
4763 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4764         $cc -E <testcpp.c >testcpp.out 2>&1; \
4765         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4766         echo "Yup, it does."
4767         x_cpp="$cc $cppflags -E"
4768         x_minus='';
4769 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4770         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4771         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4772         echo "Yup, it does."
4773         x_cpp="$cc $cppflags -E"
4774         x_minus='-';
4775 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4776         $cc -P <testcpp.c >testcpp.out 2>&1; \
4777         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4778         echo "Yipee, that works!"
4779         x_cpp="$cc $cppflags -P"
4780         x_minus='';
4781 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4782         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4783         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4784         echo "At long last!"
4785         x_cpp="$cc $cppflags -P"
4786         x_minus='-';
4787 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4788         $cpp <testcpp.c >testcpp.out 2>&1; \
4789         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4790         echo "It works!"
4791         x_cpp="$cpp $cppflags"
4792         x_minus='';
4793 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4794         $cpp - <testcpp.c >testcpp.out 2>&1; \
4795         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4796         echo "Hooray, it works!  I was beginning to wonder."
4797         x_cpp="$cpp $cppflags"
4798         x_minus='-';
4799 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4800         $wrapper <testcpp.c >testcpp.out 2>&1; \
4801         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4802         x_cpp="$wrapper"
4803         x_minus=''
4804         echo "Eureka!"
4805 else
4806         dflt=''
4807         rp="No dice.  I can't find a C preprocessor.  Name one:"
4808         . ./myread
4809         x_cpp="$ans"
4810         x_minus=''
4811         $x_cpp <testcpp.c >testcpp.out 2>&1
4812         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4813                 echo "OK, that will do." >&4
4814         else
4815 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4816                 exit 1
4817         fi
4818 fi
4819
4820 case "$ok" in
4821 false)
4822         cppstdin="$x_cpp"
4823         cppminus="$x_minus"
4824         cpprun="$x_cpp"
4825         cpplast="$x_minus"
4826         set X $x_cpp
4827         shift
4828         case "$1" in
4829         "$cpp")
4830                 echo "Perhaps can we force $cc -E using a wrapper..."
4831                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4832                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4833                 then
4834                         echo "Yup, we can."
4835                         cppstdin="$wrapper"
4836                         cppminus='';
4837                 else
4838                         echo "Nope, we'll have to live without it..."
4839                 fi
4840                 ;;
4841         esac
4842         case "$cpprun" in
4843         "$wrapper")
4844                 cpprun=''
4845                 cpplast=''
4846                 ;;
4847         esac
4848         ;;
4849 esac
4850
4851 case "$cppstdin" in
4852 "$wrapper"|'cppstdin') ;;
4853 *) $rm -f $wrapper;;
4854 esac
4855 $rm -f testcpp.c testcpp.out
4856
4857 : Adjust cppfilter for path component separator
4858 case "$osname" in
4859 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4860 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4861 *)   cppfilter='' ;;
4862 esac
4863
4864 : Use gcc to determine libpth and incpth
4865 # If using gcc or clang, we can get better values for libpth, incpth
4866 # and usrinc directly from the compiler.
4867 # Note that ccname for clang is also gcc.
4868 case "$ccname" in
4869     gcc)
4870         $echo 'extern int foo;' > try.c
4871         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4872         shift
4873         if $test $# -gt 0; then
4874             incpth="$incpth $*"
4875             incpth="`$echo $incpth|$sed 's/^ //'`"
4876             for i in $*; do
4877                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4878                 if $test -d $j; then
4879                     libpth="$libpth $j"
4880                 fi
4881             done
4882             libpth="`$echo $libpth|$sed 's/^ //'`"
4883             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4884                 if $test -d $xxx; then
4885                     case " $libpth " in
4886                     *" $xxx "*) ;;
4887                     *) libpth="$libpth $xxx";;
4888                     esac
4889                 fi
4890             done
4891         fi
4892         $rm -f try.c
4893         case "$usrinc" in
4894         '') for i in $incpth; do
4895                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4896                     usrinc="$i"
4897                     break
4898                 fi
4899             done
4900             ;;
4901         esac
4902
4903         case "$usecrosscompile" in
4904         $define|true|[yY]*)
4905             case "$incpth" in
4906                 '') echo "Incpth not defined." >&4; croak=y ;;
4907                 *)  echo "Using incpth '$incpth'." >&4 ;;
4908             esac
4909             case "$libpth" in
4910                 '') echo "Libpth not defined." >&4; croak=y ;;
4911                 *)  echo "Using libpth '$libpth'." >&4 ;;
4912             esac
4913             case "$usrinc" in
4914                 '') echo "Usrinc not defined." >&4; croak=y ;;
4915                 *)  echo "Using usrinc $usrinc." >&4 ;;
4916             esac
4917             case "$croak" in
4918                 y)
4919                 if test "X$sysroot" = X; then
4920                     echo "Cannot continue, aborting." >&4; exit 1
4921                 else
4922                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4923                 fi
4924                 ;;
4925             esac
4926             ;;
4927         esac
4928     ;;
4929 esac
4930
4931 : Default value for incpth is just usrinc
4932 case "$incpth" in
4933 '') incpth="$usrinc";;
4934 esac
4935
4936 : Set private lib path
4937 case "$plibpth" in
4938 '') if ./mips; then
4939         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4940     fi;;
4941 esac
4942 case "$libpth" in
4943 ' ') dlist='';;
4944 '') dlist="$loclibpth $plibpth $glibpth";;
4945 *) dlist="$libpth";;
4946 esac
4947
4948 : Now check and see which directories actually exist, avoiding duplicates
4949 for xxx in $dlist
4950 do
4951     if $test -d $xxx; then
4952                 case " $libpth " in
4953                 *" $xxx "*) ;;
4954                 *) libpth="$libpth $xxx";;
4955                 esac
4956     fi
4957 done
4958 $cat <<'EOM'
4959
4960 Some systems have incompatible or broken versions of libraries.  Among
4961 the directories listed in the question below, please remove any you
4962 know not to be holding relevant libraries, and add any that are needed.
4963 Say "none" for none.
4964
4965 EOM
4966
4967 if test "X$sysroot" != X; then
4968     $cat <<EOM
4969 You have set sysroot to $sysroot, please supply the directories excluding sysroot
4970
4971 EOM
4972 fi
4973
4974 case "$libpth" in
4975 '') dflt='none';;
4976 *)
4977         set X $libpth
4978         shift
4979         dflt=${1+"$@"}
4980         ;;
4981 esac
4982 rp="Directories to use for library searches?"
4983 . ./myread
4984 case "$ans" in
4985 none) libpth=' ';;
4986 *) libpth="$ans";;
4987 esac
4988
4989 : compute shared library extension
4990 case "$so" in
4991 '')
4992         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4993                 dflt='sl'
4994         else
4995                 dflt='so'
4996         fi
4997         ;;
4998 *) dflt="$so";;
4999 esac
5000 $cat <<EOM
5001
5002 On some systems, shared libraries may be available.  Answer 'none' if
5003 you want to suppress searching of shared libraries for the remainder
5004 of this configuration.
5005
5006 EOM
5007 rp='What is the file extension used for shared libraries?'
5008 . ./myread
5009 so="$ans"
5010
5011 : Does target system insist that shared library basenames are unique
5012 $cat << EOM
5013
5014 Some dynamic loaders assume that the *basename* of shared library filenames
5015 are globally unique.  We'll default this to undef as we assume your system
5016 is not this weird. Set to defined if you're on one of them.
5017
5018 EOM
5019
5020 dflt='n'
5021 rp='Make shared library basenames unique?'
5022 . ./myread
5023 case "$ans" in
5024 y|Y) val="$define" ;;
5025 *)   val="$undef"  ;;
5026 esac
5027 set d_libname_unique
5028 eval $setvar
5029
5030 : Define several unixisms.
5031 : Hints files or command line option can be used to override them.
5032 : The convoluted testing is in case hints files set either the old
5033 : or the new name.
5034 case "$_exe" in
5035 '')     case "$exe_ext" in
5036         '')     ;;
5037         *)      _exe="$exe_ext" ;;
5038         esac
5039         ;;
5040 esac
5041 case "$_a" in
5042 '')     case "$lib_ext" in
5043     '') _a='.a';;
5044         *)      _a="$lib_ext" ;;
5045         esac
5046         ;;
5047 esac
5048 case "$_o" in
5049 '') case "$obj_ext" in
5050         '')     _o='.o';;
5051         *)      _o="$obj_ext";;
5052         esac
5053         ;;
5054 esac
5055 case "$p_" in
5056 '') case "$path_sep" in
5057         '')     p_=':';;
5058         *)      p_="$path_sep";;
5059         esac
5060         ;;
5061 esac
5062 exe_ext=$_exe
5063 lib_ext=$_a
5064 obj_ext=$_o
5065 path_sep=$p_
5066
5067 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5068
5069 : Which makefile gets called first.  This is used by make depend.
5070 case "$firstmakefile" in
5071 '') firstmakefile='makefile';;
5072 esac
5073
5074 : Check is we will use socks
5075 case "$usesocks" in
5076 $define|true|[yY]*)     dflt='y';;
5077 *) dflt='n';;
5078 esac
5079 cat <<EOM
5080
5081 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5082 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5083 to use the PerlIO abstraction layer, this will be implicitly selected.
5084
5085 If this doesn't make any sense to you, just accept the default '$dflt'.
5086 EOM
5087 rp='Build Perl for SOCKS?'
5088 . ./myread
5089 case "$ans" in
5090 y|Y)    val="$define" ;;
5091 *)      val="$undef" ;;
5092 esac
5093 set usesocks
5094 eval $setvar
5095
5096 : Check for uselongdouble support
5097 case "$ccflags" in
5098 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5099 esac
5100
5101 case "$uselongdouble" in
5102 $define|true|[yY]*)     dflt='y';;
5103 *) dflt='n';;
5104 esac
5105 cat <<EOM
5106
5107 Perl can be built to take advantage of long doubles which
5108 (if available) may give more accuracy and range for floating point numbers.
5109
5110 If this doesn't make any sense to you, just accept the default '$dflt'.
5111 EOM
5112 rp='Try to use long doubles if available?'
5113 . ./myread
5114 case "$ans" in
5115 y|Y)    val="$define"   ;;
5116 *)      val="$undef"    ;;
5117 esac
5118 set uselongdouble
5119 eval $setvar
5120
5121 case "$uselongdouble" in
5122 true|[yY]*) uselongdouble="$define" ;;
5123 esac
5124
5125 : Look for a hint-file generated 'call-back-unit'.  If the
5126 : user has specified that long doubles should be used,
5127 : we may need to set or change some other defaults.
5128 if $test -f uselongdouble.cbu; then
5129     echo "Your platform has some specific hints regarding long doubles, using them..."
5130     . ./uselongdouble.cbu
5131 else
5132     case "$uselongdouble" in
5133         $define)
5134                 $cat <<EOM
5135 (Your platform does not have any specific hints for long doubles.)
5136 EOM
5137         ;;
5138     esac
5139 fi
5140
5141 : Looking for optional libraries
5142 echo " "
5143 echo "Checking for optional libraries..." >&4
5144 case "$libs" in
5145 ' '|'') dflt='';;
5146 *) dflt="$libs";;
5147 esac
5148 case "$libswanted" in
5149 '') libswanted='c_s';;
5150 esac
5151 case "$usesocks" in
5152 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5153 esac
5154 case "$usecbacktrace" in
5155 "$define") libswanted="$libswanted bfd" ;;
5156 esac
5157 libsfound=''
5158 libsfiles=''
5159 libsdirs=''
5160 libspath=''
5161 for thisdir in $libpth $xlibpth; do
5162   test -d $thisdir && libspath="$libspath $thisdir"
5163 done
5164 for thislib in $libswanted; do
5165         for thisdir in $libspath; do
5166             xxx=''
5167             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5168                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5169                 $test -f "$xxx" && eval $libscheck
5170                 $test -f "$xxx" && libstyle=shared
5171             fi
5172             if test ! -f "$xxx"; then
5173                 xxx=$thisdir/lib$thislib.$so
5174                 $test -f "$xxx" && eval $libscheck
5175                 $test -f "$xxx" && libstyle=shared
5176             fi
5177             if test ! -f "$xxx"; then
5178                 xxx=$thisdir/lib$thislib$_a
5179                 $test -f "$xxx" && eval $libscheck
5180                 $test -f "$xxx" && libstyle=static
5181             fi
5182             if test ! -f "$xxx"; then
5183                 xxx=$thisdir/$thislib$_a
5184                 $test -f "$xxx" && eval $libscheck
5185                 $test -f "$xxx" && libstyle=static
5186             fi
5187             if test ! -f "$xxx"; then
5188                 xxx=$thisdir/lib${thislib}_s$_a
5189                 $test -f "$xxx" && eval $libscheck
5190                 $test -f "$xxx" && libstyle=static
5191                 $test -f "$xxx" && thislib=${thislib}_s
5192             fi
5193             if test ! -f "$xxx"; then
5194                 xxx=$thisdir/Slib$thislib$_a
5195                 $test -f "$xxx" && eval $libscheck
5196                 $test -f "$xxx" && libstyle=static
5197             fi
5198             if $test -f "$xxx"; then
5199                 case "$libstyle" in
5200                 shared) echo "Found -l$thislib (shared)." ;;
5201                 static) echo "Found -l$thislib." ;;
5202                 *)      echo "Found -l$thislib ($libstyle)." ;;
5203                 esac
5204                 case " $dflt " in
5205                 *"-l$thislib "*);;
5206                 *) dflt="$dflt -l$thislib"
5207                    libsfound="$libsfound $xxx"
5208                    yyy=`basename $xxx`
5209                    libsfiles="$libsfiles $yyy"
5210                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5211                    case " $libsdirs " in
5212                    *" $yyy "*) ;;
5213                    *) libsdirs="$libsdirs $yyy" ;;
5214                    esac
5215                    ;;
5216                 esac
5217                 break
5218             fi
5219         done
5220         if $test ! -f "$xxx"; then
5221             echo "No -l$thislib."
5222         fi
5223 done
5224 set X $dflt
5225 shift
5226 dflt="$*"
5227 case "$libs" in
5228 '') dflt="$dflt";;
5229 *) dflt="$libs";;
5230 esac
5231 case "$dflt" in
5232 ' '|'') dflt='none';;
5233 esac
5234
5235 $cat <<EOM
5236
5237 In order to compile $package on your machine, a number of libraries
5238 are usually needed.  Include any other special libraries here as well.
5239 Say "none" for none.  The default list is almost always right.
5240 EOM
5241
5242 echo " "
5243 rp="What libraries to use?"
5244 . ./myread
5245 case "$ans" in
5246 none) libs=' ';;
5247 *) libs="$ans";;
5248 esac
5249
5250 : determine optimization, if desired, or use for debug flag also
5251 case "$optimize" in
5252 ' '|$undef) dflt='none';;
5253 '') dflt='-O';;
5254 *) dflt="$optimize";;
5255 esac
5256 $cat <<EOH
5257
5258 By default, $package compiles with the -O flag to use the optimizer.
5259 Alternately, you might want to use the symbolic debugger, which uses
5260 the -g flag (on traditional Unix systems).  Either flag can be
5261 specified here.  To use neither flag, specify the word "none".
5262
5263 EOH
5264 rp="What optimizer/debugger flag should be used?"
5265 . ./myread
5266 optimize="$ans"
5267 case "$optimize" in
5268 'none') optimize=" ";;
5269 esac
5270
5271 : Check what DEBUGGING is required from the command line
5272 : -DEBUGGING      or -DDEBUGGING or
5273 : -DEBUGGING=both                       = -g + -DDEBUGGING
5274 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5275 : -DEBUGGING=none or -UDEBUGGING        =
5276 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5277 case "$EBUGGING" in
5278 '')     ;;
5279 *)      DEBUGGING=$EBUGGING ;;
5280 esac
5281
5282 case "$DEBUGGING" in
5283 -g|both|$define)
5284     case "$optimize" in
5285         *-g*) ;;
5286         *)    optimize="$optimize -g" ;;
5287     esac ;;
5288 none|$undef)
5289     case "$optimize" in
5290         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5291                 shift
5292                 optimize="$*"
5293                 ;;
5294     esac ;;
5295 esac
5296
5297 dflt=''
5298 case "$DEBUGGING" in
5299 both|$define) dflt='-DDEBUGGING'
5300 esac
5301
5302 : argument order is deliberate, as the flag will start with - which set could
5303 : think is an option
5304 checkccflag='check=$1; flag=$2; callback=$3;
5305 echo " ";
5306 echo "Checking if your compiler accepts $flag" 2>&1;
5307 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5308 echo "int main(void) { return 0; }" > gcctest.c;
5309 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5310     echo "Yes, it does." 2>&1;
5311     if $test -s gcctest.out ; then
5312         echo "But your platform does not like it:";
5313         cat gcctest.out;
5314     else
5315         case "$ccflags" in
5316         *$check*)
5317             echo "Leaving current flags $ccflags alone." 2>&1
5318             ;;
5319         *) dflt="$dflt $flag";
5320             eval $callback
5321             ;;
5322         esac
5323     fi
5324 else
5325     echo "Nope, it does not, but that is ok." 2>&1;
5326 fi
5327 '
5328
5329 : We will not override a previous value, but we might want to
5330 : augment a hint file
5331 case "$hint" in
5332 default|recommended)
5333         case "$gccversion" in
5334         1*) dflt="$dflt -fpcc-struct-return" ;;
5335         esac
5336         case "$optimize:$DEBUGGING" in
5337         *-g*:old) dflt="$dflt -DDEBUGGING";;
5338         esac
5339         case "$gccversion" in
5340         2*) if $test -d /etc/conf/kconfig.d &&
5341                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5342                 then
5343                         # Interactive Systems (ISC) POSIX mode.
5344                         dflt="$dflt -posix"
5345                 fi
5346                 ;;
5347         esac
5348         case "$gccversion" in
5349         1*) ;;
5350         2.[0-8]*) ;;
5351         ?*)     set strict-aliasing -fno-strict-aliasing
5352                 eval $checkccflag
5353                 ;;
5354         esac
5355         # For gcc, adding -pipe speeds up compilations for some, but apparently
5356         # some assemblers can't read from stdin.  (It also slows down compilations
5357         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5358         case "$gccversion" in
5359         ?*)     set pipe -pipe
5360                 eval $checkccflag
5361                 ;;
5362         esac
5363
5364         # on x86_64 (at least) we require an extra library (libssp) in the
5365         # link command line. This library is not named, so I infer that it is
5366         # an implementation detail that may change. Hence the safest approach
5367         # is to add the flag to the flags passed to the compiler at link time,
5368         # as that way the compiler can do the right implementation dependant
5369         # thing. (NWC)
5370         case "$gccversion" in
5371         ?*)     set stack-protector -fstack-protector
5372                 eval $checkccflag
5373                 ;;
5374         esac
5375         ;;
5376 esac
5377
5378 case "$mips_type" in
5379 *BSD*|'') inclwanted="$locincpth $usrinc";;
5380 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5381 esac
5382 for thisincl in $inclwanted; do
5383         if $test -d $thisincl; then
5384                 if $test x$thisincl != x$usrinc; then
5385                         case "$dflt" in
5386                         *" -I$thisincl "*);;
5387                         *) dflt="$dflt -I$thisincl ";;
5388                         esac
5389                 fi
5390         fi
5391 done
5392
5393 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5394         xxx=true;
5395 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5396         xxx=true;
5397 else
5398         xxx=false;
5399 fi;
5400 if $xxx; then
5401         case "$dflt" in
5402         *$2*);;
5403         *) dflt="$dflt -D$2";;
5404         esac;
5405 fi'
5406
5407 set signal.h LANGUAGE_C; eval $inctest
5408
5409 case "$usesocks" in
5410 $define)
5411         ccflags="$ccflags -DSOCKS"
5412         ;;
5413 esac
5414
5415 case "$hint" in
5416 default|recommended) dflt="$ccflags $dflt" ;;
5417 *) dflt="$ccflags";;
5418 esac
5419
5420 case "$dflt" in
5421 ''|' ') dflt=none;;
5422 esac
5423
5424 $cat <<EOH
5425
5426 Your C compiler may want other flags.  For this question you should include
5427 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5428 but you should NOT include libraries or ld flags like -lwhatever.  If you
5429 want $package to honor its debug switch, you should include -DDEBUGGING here.
5430 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5431
5432 To use no flags, specify the word "none".
5433
5434 EOH
5435 set X $dflt
5436 shift
5437 dflt=${1+"$@"}
5438 rp="Any additional cc flags?"
5439 . ./myread
5440 case "$ans" in
5441 none) ccflags='';;
5442 *) ccflags="$ans";;
5443 esac
5444
5445 : the following weeds options from ccflags that are of no interest to cpp
5446 case "$cppflags" in
5447 '') cppflags="$ccflags" ;;
5448 *)  cppflags="$cppflags $ccflags" ;;
5449 esac
5450 case "$gccversion" in
5451 1*) cppflags="$cppflags -D__GNUC__"
5452 esac
5453 case "$mips_type" in
5454 '');;
5455 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5456 esac
5457 case "$cppflags" in
5458 '');;
5459 *)
5460         echo " "
5461         echo "Let me guess what the preprocessor flags are..." >&4
5462         set X $cppflags
5463         shift
5464         cppflags=''
5465         $cat >cpp.c <<'EOM'
5466 #define BLURFL foo
5467
5468 BLURFL xx LFRULB
5469 EOM
5470         previous=''
5471         for flag in $*
5472         do
5473                 case "$flag" in
5474                 -*) ftry="$flag";;
5475                 *) ftry="$previous $flag";;
5476                 esac
5477                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5478                         >cpp1.out 2>/dev/null && \
5479                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5480                         >cpp2.out 2>/dev/null && \
5481                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5482                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5483                 then
5484                         cppflags="$cppflags $ftry"
5485                         previous=''
5486                 else
5487                         previous="$flag"
5488                 fi
5489         done
5490         set X $cppflags
5491         shift
5492         cppflags=${1+"$@"}
5493         case "$cppflags" in
5494         *-*)  echo "They appear to be: $cppflags";;
5495         esac
5496         $rm -f cpp.c cpp?.out
5497         ;;
5498 esac
5499
5500 : flags used in final linking phase
5501 case "$ldflags" in
5502 '') if ./venix; then
5503                 dflt='-i -z'
5504         else
5505                 dflt=''
5506         fi
5507         case "$ccflags" in
5508         *-posix*) dflt="$dflt -posix" ;;
5509         esac
5510         ;;
5511 *) dflt="$ldflags";;
5512 esac
5513 # See note above about -fstack-protector
5514 case "$ccflags" in
5515 *-fstack-protector*)
5516         case "$dflt" in
5517         *-fstack-protector*) ;; # Don't add it again
5518         *) dflt="$dflt -fstack-protector" ;;
5519         esac
5520         ;;
5521 esac
5522
5523 : Try to guess additional flags to pick up local libraries.
5524 for thislibdir in $libpth; do
5525         case " $loclibpth " in
5526         *" $thislibdir "*)
5527                 case "$dflt " in
5528                 *"-L$thislibdir "*) ;;
5529                 *)  dflt="$dflt -L$thislibdir" ;;
5530                 esac
5531                 ;;
5532         esac
5533 done
5534
5535 case "$dflt" in
5536 '') dflt='none' ;;
5537 esac
5538
5539 $cat <<EOH
5540
5541 Your C linker may need flags.  For this question you should
5542 include -L/whatever and any other flags used by the C linker, but you
5543 should NOT include libraries like -lwhatever.
5544
5545 Make sure you include the appropriate -L/path flags if your C linker
5546 does not normally search all of the directories you specified above,
5547 namely
5548         $libpth
5549 To use no flags, specify the word "none".
5550
5551 EOH
5552
5553 rp="Any additional ld flags (NOT including libraries)?"
5554 . ./myread
5555 case "$ans" in
5556 none) ldflags='';;
5557 *) ldflags="$ans";;
5558 esac
5559 rmlist="$rmlist pdp11"
5560
5561 : coherency check
5562 echo " "
5563 echo "Checking your choice of C compiler and flags for coherency..." >&4
5564 $cat > try.c <<'EOF'
5565 #include <stdio.h>
5566 int main() { printf("Ok\n"); return(0); }
5567 EOF
5568 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5569 shift
5570 $cat >try.msg <<'EOM'
5571 I've tried to compile and run the following simple program:
5572
5573 EOM
5574 $cat try.c >> try.msg
5575
5576 $cat >> try.msg <<EOM
5577
5578 I used the command:
5579
5580         $*
5581         $run ./try
5582
5583 and I got the following output:
5584
5585 EOM
5586 dflt=y
5587 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5588         if $sh -c "$run ./try " >>try.msg 2>&1; then
5589                 xxx=`$run ./try`
5590                 case "$xxx" in
5591                 "Ok") dflt=n ;;
5592                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5593                 esac
5594         else
5595                 echo "The program compiled OK, but exited with status $?." >>try.msg
5596                 rp="You have a problem.  Shall I abort Configure"
5597                 dflt=y
5598         fi
5599 else
5600         echo "I can't compile the test program." >>try.msg
5601         rp="You have a BIG problem.  Shall I abort Configure"
5602         dflt=y
5603 fi
5604 case "$dflt" in
5605 y)
5606         $cat try.msg >&4
5607         case "$knowitall" in
5608         '')
5609                 echo "(The supplied flags or libraries might be incorrect.)"
5610                 ;;
5611         *) dflt=n;;
5612         esac
5613         echo " "
5614         . ./myread
5615         case "$ans" in
5616         n*|N*) ;;
5617         *)      echo "Ok.  Stopping Configure." >&4
5618                 exit 1
5619                 ;;
5620         esac
5621         ;;
5622 n) echo "OK, that should do.";;
5623 esac
5624 $rm_try gcctest gcctest.out
5625
5626 : define a shorthand compile call
5627 compile='
5628 mc_file=$1;
5629 shift;
5630 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5631 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5632 exit 1;
5633 fi;
5634 esac;
5635 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5636 : define a shorthand compile call for compilations that should be ok.
5637 compile_ok='
5638 mc_file=$1;
5639 shift;
5640 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5641
5642 : determine filename position in cpp output
5643 echo " "
5644 echo "Computing filename position in cpp output for #include directives..." >&4
5645 case "$osname" in
5646 vos) testaccess=-e ;;
5647 *)   testaccess=-r ;;
5648 esac
5649 echo '#include <stdio.h>' > foo.c
5650 $cat >fieldn <<EOF
5651 $startsh
5652 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5653 $grep '^[       ]*#.*stdio\.h' | \
5654 while read cline; do
5655         pos=1
5656         set \$cline
5657         while $test \$# -gt 0; do
5658                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5659                         echo "\$pos"
5660                         exit 0
5661                 fi
5662                 shift
5663                 pos=\`expr \$pos + 1\`
5664         done
5665 done
5666 EOF
5667 chmod +x fieldn
5668 fieldn=`./fieldn`
5669 $rm -f foo.c fieldn
5670 case $fieldn in
5671 '') pos='???';;
5672 1) pos=first;;
5673 2) pos=second;;
5674 3) pos=third;;
5675 *) pos="${fieldn}th";;
5676 esac
5677 echo "Your cpp writes the filename in the $pos field of the line."
5678
5679 : locate header file
5680 $cat >findhdr <<EOF
5681 $startsh
5682 wanted=\$1
5683 name=''
5684 for usrincdir in $incpth
5685 do
5686         if test -f \$usrincdir/\$wanted; then
5687                 echo "\$usrincdir/\$wanted"
5688                 exit 0
5689         fi
5690 done
5691 awkprg='{ print \$$fieldn }'
5692 echo "#include <\$wanted>" > foo\$\$.c
5693 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5694 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5695 while read cline; do
5696         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5697         case "\$name" in
5698         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5699         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5700         *) exit 2;;
5701         esac;
5702 done;
5703 #
5704 # status = 0: grep returned 0 lines, case statement not executed
5705 # status = 1: headerfile found
5706 # status = 2: while loop executed, no headerfile found
5707 #
5708 status=\$?
5709 $rm -f foo\$\$.c;
5710 if test \$status -eq 1; then
5711         exit 0;
5712 fi
5713 exit 1
5714 EOF
5715 chmod +x findhdr
5716
5717 : define an alternate in-header-list? function
5718 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5719 cont=true; xxf="echo \"<\$1> found.\" >&4";
5720 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5721 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5722 esac;
5723 case $# in 4) instead=instead;; *) instead="at last";; esac;
5724 while $test "$cont"; do
5725         xxx=`./findhdr $1`
5726         var=$2; eval "was=\$$2";
5727         if $test "$xxx" && $test -r "$xxx";
5728         then eval $xxf;
5729         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5730                 cont="";
5731         else eval $xxnf;
5732         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5733         set $yyy; shift; shift; yyy=$@;
5734         case $# in 0) cont="";;
5735         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5736                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5737         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5738                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5739         esac;
5740 done;
5741 while $test "$yyy";
5742 do set $yyy; var=$2; eval "was=\$$2";
5743         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5744         set $yyy; shift; shift; yyy=$@;
5745 done'
5746
5747 : see if stdlib is available
5748 set stdlib.h i_stdlib
5749 eval $inhdr
5750
5751 : check for lengths of integral types
5752 echo " "
5753 case "$intsize" in
5754 '')
5755         echo "Checking to see how big your integers are..." >&4
5756         $cat >try.c <<EOCP
5757 #include <stdio.h>
5758 #$i_stdlib I_STDLIB
5759 #ifdef I_STDLIB
5760 #include <stdlib.h>
5761 #endif
5762 int main()
5763 {
5764         printf("intsize=%d;\n", (int)sizeof(int));
5765         printf("longsize=%d;\n", (int)sizeof(long));
5766         printf("shortsize=%d;\n", (int)sizeof(short));
5767         exit(0);
5768 }
5769 EOCP
5770         set try
5771         if eval $compile_ok && $run ./try > /dev/null; then
5772                 eval `$run ./try`
5773                 echo "Your integers are $intsize bytes long."
5774                 echo "Your long integers are $longsize bytes long."
5775                 echo "Your short integers are $shortsize bytes long."
5776         else
5777                 $cat >&4 <<EOM
5778 !
5779 Help! I can't compile and run the intsize test program: please enlighten me!
5780 (This is probably a misconfiguration in your system or libraries, and
5781 you really ought to fix it.  Still, I'll try anyway.)
5782 !
5783 EOM
5784                 dflt=4
5785                 rp="What is the size of an integer (in bytes)?"
5786                 . ./myread
5787                 intsize="$ans"
5788                 dflt=$intsize
5789                 rp="What is the size of a long integer (in bytes)?"
5790                 . ./myread
5791                 longsize="$ans"
5792                 dflt=2
5793                 rp="What is the size of a short integer (in bytes)?"
5794                 . ./myread
5795                 shortsize="$ans"
5796         fi
5797         ;;
5798 esac
5799 $rm_try
5800
5801 : check for long long
5802 echo " "
5803 echo "Checking to see if you have long long..." >&4
5804 echo 'int main() { long long x = 7; return 0; }' > try.c
5805 set try
5806 if eval $compile; then
5807         val="$define"
5808         echo "You have long long."
5809 else
5810         val="$undef"
5811         echo "You do not have long long."
5812 fi
5813 $rm_try
5814 set d_longlong
5815 eval $setvar
5816
5817 : check for length of long long
5818 case "${d_longlong}${longlongsize}" in
5819 $define)
5820         echo " "
5821         echo "Checking to see how big your long longs are..." >&4
5822         $cat >try.c <<'EOCP'
5823 #include <stdio.h>
5824 int main()
5825 {
5826     printf("%d\n", (int)sizeof(long long));
5827     return(0);
5828 }
5829 EOCP
5830         set try
5831         if eval $compile_ok; then
5832                 longlongsize=`$run ./try`
5833                 echo "Your long longs are $longlongsize bytes long."
5834         else
5835                 dflt='8'
5836                 echo " "
5837                 echo "(I can't seem to compile the test program.  Guessing...)"
5838                 rp="What is the size of a long long (in bytes)?"
5839                 . ./myread
5840                 longlongsize="$ans"
5841         fi
5842         if $test "X$longsize" = "X$longlongsize"; then
5843                 echo "(That isn't any different from an ordinary long.)"
5844         fi
5845         ;;
5846 esac
5847 $rm_try
5848
5849 : see if inttypes.h is available
5850 : we want a real compile instead of Inhdr because some systems
5851 : have an inttypes.h which includes non-existent headers
5852 echo " "
5853 $cat >try.c <<EOCP
5854 #include <inttypes.h>
5855 int main() {
5856         static int32_t foo32 = 0x12345678;
5857 }
5858 EOCP
5859 set try
5860 if eval $compile; then
5861         echo "<inttypes.h> found." >&4
5862         val="$define"
5863 else
5864         echo "<inttypes.h> NOT found." >&4
5865         val="$undef"
5866 fi
5867 $rm_try
5868 set i_inttypes
5869 eval $setvar
5870
5871 : check for int64_t
5872 echo " "
5873 echo "Checking to see if you have int64_t..." >&4
5874 $cat >try.c <<EOCP
5875 #include <sys/types.h>
5876 #$i_inttypes I_INTTYPES
5877 #ifdef I_INTTYPES
5878 #include <inttypes.h>
5879 #endif
5880 int main() { int64_t x = 7; }
5881 EOCP
5882 set try
5883 if eval $compile; then
5884         val="$define"
5885         echo "You have int64_t."
5886 else
5887         val="$undef"
5888         echo "You do not have int64_t."
5889 fi
5890 $rm_try
5891 set d_int64_t
5892 eval $setvar
5893
5894 : Check if 64bit ints have a quad type
5895 echo " "
5896 echo "Checking which 64-bit integer type we could use..." >&4
5897
5898 case "$intsize" in
5899 8) val=int
5900    set quadtype
5901    eval $setvar
5902    val='"unsigned int"'
5903    set uquadtype
5904    eval $setvar
5905    quadkind=1
5906    ;;
5907 *) case "$longsize" in
5908    8) val=long
5909       set quadtype
5910       eval $setvar
5911       val='"unsigned long"'
5912       set uquadtype
5913       eval $setvar
5914       quadkind=2
5915       ;;
5916    *) case "$d_longlong:$longlongsize" in
5917       define:8)
5918         val='"long long"'
5919         set quadtype
5920         eval $setvar
5921         val='"unsigned long long"'
5922         set uquadtype
5923         eval $setvar
5924         quadkind=3
5925         ;;
5926       *) case "$d_int64_t" in
5927          define)
5928            val=int64_t
5929            set quadtype
5930            eval $setvar
5931            val=uint64_t
5932            set uquadtype
5933            eval $setvar
5934            quadkind=4
5935            ;;
5936          esac
5937          ;;
5938       esac
5939       ;;
5940    esac
5941    ;;
5942 esac
5943
5944 case "$quadtype" in
5945 '')     echo "Alas, no 64-bit integer types in sight." >&4
5946         d_quad="$undef"
5947         ;;
5948 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5949         d_quad="$define"
5950         ;;
5951 esac
5952
5953 : Do we want 64bit support
5954 case "$uselonglong" in
5955 "$define"|true|[yY]*)
5956         cat <<EOM >&4
5957
5958 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5959 EOM
5960         use64bitint="$define"
5961         ;;
5962 esac
5963 case "$use64bits" in
5964 "$define"|true|[yY]*)
5965         cat <<EOM >&4
5966
5967 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5968 EOM
5969         use64bitint="$define"
5970         ;;
5971 esac
5972 case "$use64bitints" in
5973 "$define"|true|[yY]*)
5974         cat <<EOM >&4
5975
5976 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5977 EOM
5978         use64bitint="$define"
5979         ;;
5980 esac
5981 case "$use64bitsint" in
5982 "$define"|true|[yY]*)
5983         cat <<EOM >&4
5984
5985 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5986 EOM
5987         use64bitint="$define"
5988         ;;
5989 esac
5990 case "$uselonglongs" in
5991 "$define"|true|[yY]*)
5992         cat <<EOM >&4
5993
5994 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5995 EOM
5996         use64bitint="$define"
5997         ;;
5998 esac
5999 case "$use64bitsall" in
6000 "$define"|true|[yY]*)
6001         cat <<EOM >&4
6002
6003 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6004 EOM
6005         use64bitall="$define"
6006         ;;
6007 esac
6008
6009 case "$ccflags" in
6010 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6011 esac
6012 case "$use64bitall" in
6013 "$define"|true|[yY]*) use64bitint="$define" ;;
6014 esac
6015
6016 case "$longsize" in
6017 8) cat <<EOM
6018
6019 You have natively 64-bit long integers.
6020 EOM
6021    val="$define"
6022    ;;
6023 *) case "$use64bitint" in
6024    "$define"|true|[yY]*) dflt='y';;
6025    *) dflt='n';;
6026    esac
6027    case "$d_quad" in
6028    "$define") ;;
6029    *) dflt='n' ;;
6030    esac
6031    cat <<EOM
6032
6033 Perl can be built to take advantage of 64-bit integer types
6034 on some systems.  To do so, Configure can be run with -Duse64bitint.
6035 Choosing this option will most probably introduce binary incompatibilities.
6036
6037 If this doesn't make any sense to you, just accept the default '$dflt'.
6038 (The default has been chosen based on your configuration.)
6039 EOM
6040    rp='Try to use 64-bit integers, if available?'
6041    . ./myread
6042    case "$ans" in
6043    [yY]*) val="$define" ;;
6044    *)     val="$undef"  ;;
6045    esac
6046    ;;
6047 esac
6048 set use64bitint
6049 eval $setvar
6050
6051 case "$use64bitall" in
6052 "$define"|true|[yY]*) dflt='y' ;;
6053 *) case "$longsize" in
6054    8) dflt='y' ;;
6055    *) dflt='n' ;;
6056    esac
6057    ;;
6058 esac
6059 cat <<EOM
6060
6061 You may also choose to try maximal 64-bitness.  It means using as much
6062 64-bitness as possible on the platform.  This in turn means even more
6063 binary incompatibilities.  On the other hand, your platform may not
6064 have any more 64-bitness available than what you already have chosen.
6065
6066 If this doesn't make any sense to you, just accept the default '$dflt'.
6067 (The default has been chosen based on your configuration.)
6068 EOM
6069 rp='Try to use maximal 64-bit support, if available?'
6070 . ./myread
6071 case "$ans" in
6072 [yY]*) val="$define" ;;
6073 *)     val="$undef"  ;;
6074 esac
6075 set use64bitall
6076 eval $setvar
6077 case "$use64bitall" in
6078 "$define")
6079         case "$use64bitint" in
6080         "$undef")
6081                 cat <<EOM
6082
6083 Since you have chosen a maximally 64-bit build, I'm also turning on
6084 the use of 64-bit integers.
6085 EOM
6086                 use64bitint="$define" ;;
6087         esac
6088         ;;
6089 esac
6090
6091 : Look for a hint-file generated 'call-back-unit'.  If the
6092 : user has specified that a 64-bit perl is to be built,
6093 : we may need to set or change some other defaults.
6094 if $test -f use64bitint.cbu; then
6095         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6096         . ./use64bitint.cbu
6097 fi
6098 case "$use64bitint" in
6099 "$define"|true|[yY]*)
6100         : This test was common to all the OpenBSD forks, and seems harmless for
6101         : other platforms:
6102         echo " "
6103         echo "Checking if your C library has broken 64-bit functions..." >&4
6104         cat >try.c <<EOCP
6105 #include <stdio.h>
6106 typedef $uquadtype myULL;
6107 int main (void)
6108 {
6109     struct {
6110         double d;
6111         myULL  u;
6112     } *p, test[] = {
6113         {4294967303.15, 4294967303ULL},
6114         {4294967294.2,  4294967294ULL},
6115         {4294967295.7,  4294967295ULL},
6116         {0.0, 0ULL}
6117     };
6118     for (p = test; p->u; p++) {
6119         myULL x = (myULL)p->d;
6120         if (x != p->u) {
6121             printf("buggy\n");
6122             return 0;
6123         }
6124     }
6125     printf("ok\n");
6126     return 0;
6127 }
6128 EOCP
6129         set try
6130         if eval $compile_ok; then
6131             libcquad=`$run ./try`
6132             echo "Your C library's 64-bit functions are $libcquad."
6133         else
6134             echo "(I can't seem to compile the test program.)"
6135             echo "Assuming that your C library's 64-bit functions are ok."
6136             libcquad="ok"
6137         fi
6138         $rm_try
6139
6140         case "$libcquad" in
6141             buggy*)
6142                 cat >&4 <<EOM
6143
6144 *** You have a C library with broken 64-bit functions.
6145 *** 64-bit support does not work reliably in this configuration.
6146 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6147 *** Cannot continue, aborting.
6148
6149 EOM
6150                 exit 1
6151                 ;;
6152         esac
6153         case "$longsize" in
6154         4) case "$archname64" in
6155            '') archname64=64int ;;
6156            esac
6157            ;;
6158         esac
6159         ;;
6160 esac
6161
6162 : Look for a hint-file generated 'call-back-unit'.  If the
6163 : user has specified that a maximally 64-bit perl is to be built,
6164 : we may need to set or change some other defaults.
6165 if $test -f use64bitall.cbu; then
6166         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6167         . ./use64bitall.cbu
6168 fi
6169 case "$use64bitall" in
6170 "$define"|true|[yY]*)
6171         case "$longsize" in
6172         4) case "$archname64" in
6173            ''|64int) archname64=64all ;;
6174            esac
6175            ;;
6176         esac
6177         ;;
6178 esac
6179
6180 case "$d_quad:$use64bitint" in
6181 $undef:$define)
6182         cat >&4 <<EOF
6183
6184 *** You have chosen to use 64-bit integers,
6185 *** but none can be found.
6186 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6187 *** Cannot continue, aborting.
6188
6189 EOF
6190         exit 1
6191         ;;
6192 esac
6193
6194 : check for length of double
6195 echo " "
6196 case "$doublesize" in
6197 '')
6198         echo "Checking to see how big your double precision numbers are..." >&4
6199         $cat >try.c <<EOCP
6200 #include <stdio.h>
6201 #$i_stdlib I_STDLIB
6202 #ifdef I_STDLIB
6203 #include <stdlib.h>
6204 #endif
6205 int main()
6206 {
6207     printf("%d\n", (int)sizeof(double));
6208     exit(0);
6209 }
6210 EOCP
6211         set try
6212         if eval $compile_ok; then
6213                 doublesize=`$run ./try`
6214                 echo "Your double is $doublesize bytes long."
6215         else
6216                 dflt='8'
6217                 echo "(I can't seem to compile the test program.  Guessing...)"
6218                 rp="What is the size of a double precision number (in bytes)?"
6219                 . ./myread
6220                 doublesize="$ans"
6221         fi
6222         ;;
6223 esac
6224 $rm_try
6225
6226 : check for long doubles
6227 echo " "
6228 echo "Checking to see if you have long double..." >&4
6229 echo 'int main() { long double x = 7.0; }' > try.c
6230 set try
6231 if eval $compile; then
6232         val="$define"
6233         echo "You have long double."
6234 else
6235         val="$undef"
6236         echo "You do not have long double."
6237 fi
6238 $rm_try
6239 set d_longdbl
6240 eval $setvar
6241
6242 : check for length of long double
6243 case "${d_longdbl}${longdblsize}" in
6244 $define)
6245         echo " "
6246         echo "Checking to see how big your long doubles are..." >&4
6247         $cat >try.c <<'EOCP'
6248 #include <stdio.h>
6249 int main()
6250 {
6251         printf("%d\n", sizeof(long double));
6252 }
6253 EOCP
6254         set try
6255         set try
6256         if eval $compile; then
6257                 longdblsize=`$run ./try`
6258                 echo "Your long doubles are $longdblsize bytes long."
6259         else
6260                 dflt='8'
6261                 echo " "
6262                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6263                 rp="What is the size of a long double (in bytes)?"
6264                 . ./myread
6265                 longdblsize="$ans"
6266         fi
6267         if $test "X$doublesize" = "X$longdblsize"; then
6268                 echo "That isn't any different from an ordinary double."
6269                 echo "I'll keep your setting anyway, but you may see some"
6270                 echo "harmless compilation warnings."
6271         fi
6272         ;;
6273 esac
6274 $rm_try
6275
6276 : determine the architecture name
6277 echo " "
6278 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6279         tarch=`arch`"-$osname"
6280 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6281         if uname -m > tmparch 2>&1 ; then
6282                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6283                         -e 's/$/'"-$osname/" tmparch`
6284         else
6285                 tarch="$osname"
6286         fi
6287         $rm -f tmparch
6288 else
6289         tarch="$osname"
6290 fi
6291 case "$myarchname" in
6292 ''|"$tarch") ;;
6293 *)
6294         echo "(Your architecture name used to be $myarchname.)"
6295         archname=''
6296         ;;
6297 esac
6298 case "$targetarch" in
6299 '') ;;
6300 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6301 esac
6302 myarchname="$tarch"
6303 case "$archname" in
6304 '') dflt="$tarch";;
6305 *) dflt="$archname";;
6306 esac
6307 rp='What is your architecture name'
6308 . ./myread
6309 archname="$ans"
6310
6311 : optionally add API version to the architecture for versioned archlibs
6312 case "$useversionedarchname" in
6313 $define|true|[yY]*) dflt='y';;
6314 *)                  dflt='n';;
6315 esac
6316 rp='Add the Perl API version to your archname?'
6317 . ./myread
6318 case "$ans" in
6319 y|Y)    useversionedarchname="$define" ;;
6320 *)      useversionedarchname="$undef" ;;
6321 esac
6322 case "$useversionedarchname" in
6323 $define)
6324         case "$archname" in
6325         *-$api_versionstring)
6326                 echo "...and architecture name already has -$api_versionstring" >&4
6327                 ;;
6328         *)
6329                 archname="$archname-$api_versionstring"
6330                 echo "...setting architecture name to $archname." >&4
6331                 ;;
6332         esac
6333         ;;
6334 esac
6335
6336 case "$usethreads" in
6337 $define)
6338         echo "Threads selected." >&4
6339         case "$archname" in
6340         *-thread*) echo "...and architecture name already has -thread." >&4
6341                 ;;
6342         *)      archname="$archname-thread"
6343                 echo "...setting architecture name to $archname." >&4
6344                 ;;
6345         esac
6346         ;;
6347 esac
6348 case "$usemultiplicity" in
6349 $define)
6350         echo "Multiplicity selected." >&4
6351         case "$archname" in
6352         *-multi*) echo "...and architecture name already has -multi." >&4
6353                 ;;
6354         *)      archname="$archname-multi"
6355                 echo "...setting architecture name to $archname." >&4
6356                 ;;
6357         esac
6358         ;;
6359 esac
6360 case "$use64bitint$use64bitall" in
6361 *"$define"*)
6362         case "$archname64" in
6363         '')
6364                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6365                 ;;
6366         *)
6367                 case "$use64bitint" in
6368                 "$define") echo "64 bit integers selected." >&4 ;;
6369                 esac
6370                 case "$use64bitall" in
6371                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6372                 esac
6373                 case "$archname" in
6374                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6375                         ;;
6376                 *)      archname="$archname-$archname64"
6377                         echo "...setting architecture name to $archname." >&4
6378                         ;;
6379                 esac
6380                 ;;
6381         esac
6382 esac
6383 case "$uselongdouble" in
6384 $define)
6385         echo "Long doubles selected." >&4
6386         case "$longdblsize" in
6387         $doublesize)
6388                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6389                 ;;
6390         *)
6391                 case "$archname" in
6392                 *-ld*) echo "...and architecture name already has -ld." >&4
6393                         ;;
6394                 *)      archname="$archname-ld"
6395                         echo "...setting architecture name to $archname." >&4
6396                         ;;
6397                 esac
6398                 ;;
6399         esac
6400         ;;
6401 esac
6402 if $test -f archname.cbu; then
6403         echo "Your platform has some specific hints for architecture name, using them..."
6404         . ./archname.cbu
6405 fi
6406
6407 : set the prefixit variable, to compute a suitable default value
6408 prefixit='case "$3" in
6409 ""|none)
6410         case "$oldprefix" in
6411         "") eval "$1=\"\$$2\"";;
6412         *)
6413                 case "$3" in
6414                 "") eval "$1=";;
6415                 none)
6416                         eval "tp=\"\$$2\"";
6417                         case "$tp" in
6418                         ""|" ") eval "$1=\"\$$2\"";;
6419                         *) eval "$1=";;
6420                         esac;;
6421                 esac;;
6422         esac;;
6423 *)
6424         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6425         case "$tp" in
6426         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6427         /*-$oldprefix/*|\~*-$oldprefix/*)
6428                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6429         *) eval "$1=\"\$$2\"";;
6430         esac;;
6431 esac'
6432
6433 : determine installation style
6434 : For now, try to deduce it from prefix unless it is already set.
6435 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6436 case "$installstyle" in
6437 '')     case "$prefix" in
6438                 *perl*) dflt='lib';;
6439                 *) dflt='lib/perl5' ;;
6440         esac
6441         ;;
6442 *)      dflt="$installstyle" ;;
6443 esac
6444 : Probably not worth prompting for this since we prompt for all
6445 : the directories individually, and the prompt would be too long and
6446 : confusing anyway.
6447 installstyle=$dflt
6448
6449 : determine where public executables go
6450 echo " "
6451 set dflt bin bin
6452 eval $prefixit
6453 fn=d~
6454 rp='Pathname where the public executables will reside?'
6455 . ./getfile
6456 if $test "X$ansexp" != "X$binexp"; then
6457         installbin=''
6458 fi
6459 prefixvar=bin
6460 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6461 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6462 :     this via initialinstalllocation
6463 . ./setprefixvar
6464
6465 case "$userelocatableinc" in
6466 $define|true|[yY]*)     dflt='y' ;;
6467 *)                      dflt='n' ;;
6468 esac
6469 cat <<EOM
6470
6471 Would you like to build Perl so that the installation is relocatable, so that
6472 library paths in @INC are determined relative to the path of the perl binary?
6473 This is not advised for system Perl installs, or if you need to run setid
6474 scripts or scripts under taint mode.
6475
6476 If this doesn't make any sense to you, just accept the default '$dflt'.
6477 EOM
6478 rp='Use relocatable @INC?'
6479 . ./myread
6480 case "$ans" in
6481 y|Y)    val="$define" ;;
6482 *)      val="$undef"  ;;
6483 esac
6484 set userelocatableinc
6485 eval $setvar
6486
6487 initialinstalllocation="$binexp"
6488 : Default prefix is now "up one level from where the binaries are"
6489 case "$userelocatableinc" in
6490 $define|true|[yY]*)
6491     bin=".../"
6492     binexp=".../"
6493     prefix=".../.."
6494     prefixexp=".../.."
6495     installprefixexp=".../.."
6496     ;;
6497 esac
6498
6499 : determine where private library files go
6500 : Usual default is /usr/local/lib/perl5/$version.
6501 : Also allow things like /opt/perl/lib/$version, since
6502 : /opt/perl/lib/perl5... would be redundant.
6503 : The default "style" setting is made in installstyle.U
6504 case "$installstyle" in
6505 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6506 *)       set dflt privlib lib/$version ;;
6507 esac
6508 eval $prefixit
6509 $cat <<EOM
6510
6511 There are some auxiliary files for $package that need to be put into a
6512 private library directory that is accessible by everyone.
6513
6514 EOM
6515 fn=$binexp
6516 fn=d~+
6517 rp='Pathname where the private library files will reside?'
6518 . ./getfile
6519 prefixvar=privlib
6520 . ./setprefixvar
6521
6522 : set the prefixup variable, to restore leading tilda escape
6523 prefixup='case "$prefixexp" in
6524 "$prefix") ;;
6525 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6526 esac'
6527
6528 : determine where public architecture dependent libraries go
6529 set archlib archlib
6530 eval $prefixit
6531 : privlib default is /usr/local/lib/$package/$version
6532 : archlib default is /usr/local/lib/$package/$version/$archname
6533 : privlib may have an optional trailing /share.
6534 tdflt=`echo $privlib | $sed 's,/share$,,'`
6535 tdflt=$tdflt/$archname
6536 case "$archlib" in
6537 '')     dflt=$tdflt
6538         ;;
6539 *)      dflt="$archlib"
6540     ;;
6541 esac
6542 $cat <<EOM
6543
6544 $spackage contains architecture-dependent library files.  If you are
6545 sharing libraries in a heterogeneous environment, you might store
6546 these files in a separate location.  Otherwise, you can just include
6547 them with the rest of the public library files.
6548
6549 EOM
6550 fn=$binexp
6551 fn=d+~
6552 rp='Where do you want to put the public architecture-dependent libraries?'
6553 . ./getfile
6554 prefixvar=archlib
6555 . ./setprefixvar
6556 if $test X"$archlib" = X"$privlib"; then
6557         d_archlib="$undef"
6558 else
6559         d_archlib="$define"
6560 fi
6561
6562 : see if setuid scripts can be secure
6563 $cat <<EOM
6564
6565 Some kernels have a bug that prevents setuid #! scripts from being
6566 secure.  Some sites have disabled setuid #! scripts because of this.
6567
6568 First let's decide if your kernel supports secure setuid #! scripts.
6569 (If setuid #! scripts would be secure but have been disabled anyway,
6570 don't say that they are secure if asked.)
6571
6572 EOM
6573
6574 val="$undef"
6575 if $test -d /dev/fd; then
6576         echo "#!$ls" >reflect
6577         chmod +x,u+s reflect
6578         ./reflect >flect 2>&1
6579         if $contains "/dev/fd" flect >/dev/null; then
6580                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6581                 val="$define"
6582         else
6583                 $cat <<EOM
6584 If you are not sure if they are secure, I can check but I'll need a
6585 username and password different from the one you are using right now.
6586 If you don't have such a username or don't want me to test, simply
6587 enter 'none'.
6588
6589 EOM
6590                 rp='Other username to test security of setuid scripts with?'
6591                 dflt='none'
6592                 . ./myread
6593                 case "$ans" in
6594                 n|none)
6595                         case "$d_suidsafe" in
6596                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6597                                 dflt=n;;
6598                         "$undef")
6599                                 echo "Well, the $hint value is *not* secure." >&4
6600                                 dflt=n;;
6601                         *)      echo "Well, the $hint value *is* secure." >&4
6602                                 dflt=y;;
6603                         esac
6604                         ;;
6605                 *)
6606                         $rm -f reflect flect
6607                         echo "#!$ls" >reflect
6608                         chmod +x,u+s reflect
6609                         echo >flect
6610                         chmod a+w flect
6611                         echo '"su" will (probably) prompt you for '"$ans's password."
6612                         su $ans -c './reflect >flect'
6613                         if $contains "/dev/fd" flect >/dev/null; then
6614                                 echo "Okay, it looks like setuid scripts are secure." >&4
6615                                 dflt=y
6616                         else
6617                                 echo "I don't think setuid scripts are secure." >&4
6618                                 dflt=n
6619                         fi
6620                         ;;
6621                 esac
6622                 rp='Does your kernel have *secure* setuid scripts?'
6623                 . ./myread
6624                 case "$ans" in
6625                 [yY]*)  val="$define";;
6626                 *)      val="$undef";;
6627                 esac
6628         fi
6629 else
6630         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6631         echo "(That's for file descriptors, not floppy disks.)"
6632         val="$undef"
6633 fi
6634 set d_suidsafe
6635 eval $setvar
6636
6637 $rm -f reflect flect
6638
6639 : now see if they want to do setuid emulation
6640 if $test $patchlevel -lt 11; then
6641 echo " "
6642 val="$undef"
6643 case "$d_suidsafe" in
6644 "$define")
6645         val="$undef"
6646         echo "No need to emulate SUID scripts since they are secure here." >&4
6647         ;;
6648 *)
6649         $cat <<EOM
6650 Some systems have disabled setuid scripts, especially systems where
6651 setuid scripts cannot be secure.  On systems where setuid scripts have
6652 been disabled, the setuid/setgid bits on scripts are currently
6653 useless.  It is possible for $package to detect those bits and emulate
6654 setuid/setgid in a secure fashion.  This emulation will only work if
6655 setuid scripts have been disabled in your kernel.
6656
6657 EOM
6658         case "$d_dosuid" in
6659         "$define") dflt=y ;;
6660         *) dflt=n ;;
6661         esac
6662         rp="Do you want to do setuid/setgid emulation?"
6663         . ./myread
6664         case "$ans" in
6665         [yY]*)  val="$define";;
6666         *)      val="$undef";;
6667         esac
6668         ;;
6669 esac
6670 set d_dosuid
6671 eval $setvar
6672 else
6673     case "$d_dosuid" in
6674         "$define")
6675         cat >&4 <<EOH
6676
6677 SUID emulation has been removed for 5.12
6678 Please re-run Configure without -Dd_dosuid
6679
6680 EOH
6681         exit 1;
6682         ;;
6683     esac
6684     d_dosuid=undef
6685 fi
6686
6687 : Find perl5.005 or later.
6688 echo "Looking for a previously installed perl5.005 or later... "
6689 case "$perl5" in
6690 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6691                 : Check if this perl is recent and can load a simple module
6692                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6693                         perl5=$tdir/perl
6694                         break;
6695                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6696                         perl5=$tdir/perl5
6697                         break;
6698                 fi
6699         done
6700         ;;
6701 *)      perl5="$perl5"
6702         ;;
6703 esac
6704 case "$perl5" in
6705 '')     echo "None found.  That's ok.";;
6706 *)      echo "Using $perl5." ;;
6707 esac
6708
6709 : Set the siteprefix variables
6710 $cat <<EOM
6711
6712 After $package is installed, you may wish to install various
6713 add-on modules and utilities.  Typically, these add-ons will
6714 be installed under $prefix with the rest
6715 of this package.  However, you may wish to install such add-ons
6716 elsewhere under a different prefix.
6717
6718 If you do not wish to put everything under a single prefix, that's
6719 ok.  You will be prompted for the individual locations; this siteprefix
6720 is only used to suggest the defaults.
6721
6722 The default should be fine for most people.
6723
6724 EOM
6725 fn=d~+
6726 rp='Installation prefix to use for add-on modules and utilities?'
6727 : XXX Here might be another good place for an installstyle setting.
6728 case "$siteprefix" in
6729 '') dflt=$prefix ;;
6730 *)  dflt=$siteprefix ;;
6731 esac
6732 . ./getfile
6733 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6734 oldsiteprefix=''
6735 case "$siteprefix" in
6736 '') ;;
6737 *)      case "$ans" in
6738         "$prefix") ;;
6739         *) oldsiteprefix="$prefix";;
6740         esac
6741         ;;
6742 esac
6743 siteprefix="$ans"
6744 siteprefixexp="$ansexp"
6745
6746 : determine where site specific libraries go.
6747 : Usual default is /usr/local/lib/perl5/site_perl/$version
6748 : The default "style" setting is made in installstyle.U
6749 : XXX No longer works with Prefixit stuff.
6750 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6751 case "$sitelib" in
6752 '') case "$installstyle" in
6753         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6754         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6755         esac
6756         ;;
6757 *)      dflt="$sitelib"
6758         ;;
6759 esac
6760 $cat <<EOM
6761
6762 The installation process will create a directory for
6763 site-specific extensions and modules.  Most users find it convenient
6764 to place all site-specific files in this directory rather than in the
6765 main distribution directory.
6766
6767 EOM
6768 fn=d~+
6769 rp='Pathname for the site-specific library files?'
6770 . ./getfile
6771 prefixvar=sitelib
6772 . ./setprefixvar
6773 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6774
6775 : Determine list of previous versions to include in @INC
6776 $cat > getverlist <<EOPL
6777 #!$perl5 -w
6778 use File::Basename;
6779 \$api_versionstring = "$api_versionstring";
6780 \$version = "$version";
6781 \$stem = "$sitelib_stem";
6782 \$archname = "$archname";
6783 EOPL
6784         $cat >> getverlist <<'EOPL'
6785 # The list found is store twice for each entry: the original name, and
6786 # the binary broken down version as pack "sss", so sorting is easy and
6787 # unambiguous. This will work for all versions that have a maximum of
6788 # three digit groups, separate by '.'s or '_'s. Names are extended with
6789 # ".0.0" to ensure at least three elements for the pack.
6790 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6791
6792 # Can't have leading @ because metaconfig interprets it as a command!
6793 ;@inc_version_list=();
6794 # XXX Redo to do opendir/readdir?
6795 if (-d $stem) {
6796     chdir($stem);
6797     ;@candidates = map {
6798         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6799     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6800 }
6801 else {
6802     ;@candidates = ();
6803 }
6804
6805 ($pversion, $aversion, $vsn5005) = map {
6806     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6807 foreach $d (@candidates) {
6808     if ($d->[1] lt $pversion) {
6809         if ($d->[1] ge $aversion) {
6810             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6811         }
6812         elsif ($d->[1] ge $vsn5005) {
6813             unshift(@inc_version_list, grep { -d } $d->[0]);
6814         }
6815     }
6816     else {
6817         # Skip newer version.  I.e. don't look in
6818         # 5.7.0 if we're installing 5.6.1.
6819     }
6820 }
6821
6822 if (@inc_version_list) {
6823     print join(' ', @inc_version_list);
6824 }
6825 else {
6826     # Blank space to preserve value for next Configure run.
6827     print " ";
6828 }
6829 EOPL
6830 chmod +x getverlist
6831 case "$inc_version_list" in
6832 '')     if test -x "$perl5$exe_ext"; then
6833                 dflt=`$perl5 getverlist`
6834         else
6835                 dflt='none'
6836         fi
6837         ;;
6838 $undef) dflt='none' ;;
6839 *)  eval dflt=\"$inc_version_list\" ;;
6840 esac
6841 case "$dflt" in
6842 ''|' ') dflt=none ;;
6843 esac
6844 case "$dflt" in
6845 5.005) dflt=none ;;
6846 esac
6847 $cat <<EOM
6848
6849 In order to ease the process of upgrading, this version of perl
6850 can be configured to use modules built and installed with earlier
6851 versions of perl that were installed under $prefix.  Specify here
6852 the list of earlier versions that this version of perl should check.
6853 If Configure detected no earlier versions of perl installed under
6854 $prefix, then the list will be empty.  Answer 'none' to tell perl
6855 to not search earlier versions.
6856
6857 The default should almost always be sensible, so if you're not sure,
6858 just accept the default.
6859 EOM
6860
6861 rp='List of earlier versions to include in @INC?'
6862 . ./myread
6863 case "$ans" in
6864 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6865 *) inc_version_list="$ans" ;;
6866 esac
6867 case "$inc_version_list" in
6868 ''|' ')
6869         inc_version_list_init='0'
6870         d_inc_version_list="$undef"
6871         ;;
6872 *)      inc_version_list_init=`echo $inc_version_list |
6873                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6874         d_inc_version_list="$define"
6875         ;;
6876 esac
6877 $rm -f getverlist
6878
6879 : see if malloc/malloc.h has to be included
6880 set malloc/malloc.h i_mallocmalloc
6881 eval $inhdr
6882
6883 : see if this is a malloc.h system
6884 : we want a real compile instead of Inhdr because some systems have a
6885 : malloc.h that just gives a compile error saying to use stdlib.h instead
6886 echo " "
6887 $cat >try.c <<EOCP
6888 #include <stdlib.h>
6889 #include <malloc.h>
6890 #$i_mallocmalloc I_MALLOCMALLOC
6891 #ifdef I_MALLOCMALLOC
6892 # include <malloc/malloc.h>
6893 #endif
6894
6895 int main () { return 0; }
6896 EOCP
6897 set try
6898 if eval $compile; then
6899     echo "<malloc.h> found." >&4
6900     val="$define"
6901 else
6902     echo "<malloc.h> NOT found." >&4
6903     val="$undef"
6904 fi
6905 $rm_try
6906 set i_malloc
6907 eval $setvar
6908
6909 : check for length of pointer
6910 echo " "
6911 case "$ptrsize" in
6912 '')
6913         echo "Checking to see how big your pointers are..." >&4
6914         $cat >>try.c <<EOCP
6915 #include <stdio.h>
6916 #$i_stdlib I_STDLIB
6917 #ifdef I_STDLIB
6918 #include <stdlib.h>
6919 #endif
6920 int main()
6921 {
6922     printf("%d\n", (int)sizeof(void *));
6923     exit(0);
6924 }
6925 EOCP
6926         set try
6927         if eval $compile_ok; then
6928                 ptrsize=`$run ./try`
6929                 echo "Your pointers are $ptrsize bytes long."
6930         else
6931                 dflt='4'
6932                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6933                 rp="What is the size of a pointer (in bytes)?"
6934                 . ./myread
6935                 ptrsize="$ans"
6936         fi
6937         ;;
6938 esac
6939 $rm_try
6940 case "$use64bitall" in
6941 "$define"|true|[yY]*)
6942         case "$ptrsize" in
6943         4)      cat <<EOM >&4
6944
6945 *** You have chosen a maximally 64-bit build,
6946 *** but your pointers are only 4 bytes wide.
6947 *** Please rerun Configure without -Duse64bitall.
6948 EOM
6949                 case "$d_quad" in
6950                 define)
6951                         cat <<EOM >&4
6952 *** Since you have quads, you could possibly try with -Duse64bitint.
6953 EOM
6954                         ;;
6955                 esac
6956                 cat <<EOM >&4
6957 *** Cannot continue, aborting.
6958
6959 EOM
6960
6961                 exit 1
6962                 ;;
6963         esac
6964         ;;
6965 esac
6966
6967
6968 : determine whether to use malloc wrapping
6969 echo " "
6970 case "$usemallocwrap" in
6971 [yY]*|true|$define)     dflt='y' ;;
6972 [nN]*|false|$undef)     dflt='n' ;;
6973 *)      case "$usedevel" in
6974         [yY]*|true|$define)     dflt='y' ;;
6975         *) dflt='n' ;;
6976         esac
6977         ;;
6978 esac
6979 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6980 . ./myread
6981 usemallocwrap="$ans"
6982 case "$ans" in
6983 y*|true)
6984         usemallocwrap="$define" ;;
6985 *)
6986         usemallocwrap="$undef" ;;
6987 esac
6988
6989 : determine which malloc to compile in
6990 echo " "
6991 case "$usemymalloc" in
6992 [yY]*|true|$define)     dflt='y' ;;
6993 [nN]*|false|$undef)     dflt='n' ;;
6994 *)      case "$ptrsize" in
6995         4) dflt='y' ;;
6996         *) dflt='n' ;;
6997         esac
6998         if test "$useithreads" = "$define"; then dflt='n'; fi
6999         ;;
7000 esac
7001 rp="Do you wish to attempt to use the malloc that comes with $package?"
7002 . ./myread
7003 usemymalloc="$ans"
7004 case "$ans" in
7005 y*|true)
7006         usemymalloc='y'
7007         mallocsrc='malloc.c'
7008         mallocobj="malloc$_o"
7009         d_mymalloc="$define"
7010         case "$libs" in
7011         *-lmalloc*)
7012                 : Remove malloc from list of libraries to use
7013                 echo "Removing unneeded -lmalloc from library list" >&4
7014                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7015                 shift
7016                 libs="$*"
7017                 echo "libs = $libs" >&4
7018                 ;;
7019         esac
7020         ;;
7021 *)
7022         usemymalloc='n'
7023         mallocsrc=''
7024         mallocobj=''
7025         d_mymalloc="$undef"
7026         ;;
7027 esac
7028
7029 : compute the return types of malloc and free
7030 echo " "
7031 $cat >malloc.c <<END
7032 #$i_malloc I_MALLOC
7033 #$i_stdlib I_STDLIB
7034 #include <stdio.h>
7035 #include <sys/types.h>
7036 #ifdef I_MALLOC
7037 #include <malloc.h>
7038 #endif
7039 #ifdef I_STDLIB
7040 #include <stdlib.h>
7041 #endif
7042 #ifdef TRY_MALLOC
7043 void *malloc();
7044 #endif
7045 #ifdef TRY_FREE
7046 void free();
7047 #endif
7048 END
7049 case "$malloctype" in
7050 '')
7051         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7052                 malloctype='void *'
7053         else
7054                 malloctype='char *'
7055         fi
7056         ;;
7057 esac
7058 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7059
7060 case "$freetype" in
7061 '')
7062         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7063                 freetype='void'
7064         else
7065                 freetype='int'
7066         fi
7067         ;;
7068 esac
7069 echo "Your system uses $freetype free(), it would seem." >&4
7070 $rm -f malloc.[co]
7071 : determine where site specific architecture-dependent libraries go.
7072 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7073 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7074 : sitelib may have an optional trailing /share.
7075 case "$sitearch" in
7076 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7077         dflt="$dflt/$archname"
7078         ;;
7079 *)      dflt="$sitearch"
7080         ;;
7081 esac
7082 set sitearch sitearch none
7083 eval $prefixit
7084 $cat <<EOM
7085
7086 The installation process will also create a directory for
7087 architecture-dependent site-specific extensions and modules.
7088
7089 EOM
7090 fn=d~+
7091 rp='Pathname for the site-specific architecture-dependent library files?'
7092 . ./getfile
7093 prefixvar=sitearch
7094 . ./setprefixvar
7095 if $test X"$sitearch" = X"$sitelib"; then
7096         d_sitearch="$undef"
7097 else
7098         d_sitearch="$define"
7099 fi
7100
7101 : Set the vendorprefix variables
7102 $cat <<EOM
7103
7104 The installation process will also create a directory for
7105 vendor-supplied add-ons.  Vendors who supply perl with their system
7106 may find it convenient to place all vendor-supplied files in this
7107 directory rather than in the main distribution directory.  This will
7108 ease upgrades between binary-compatible maintenance versions of perl.
7109
7110 Of course you may also use these directories in whatever way you see
7111 fit.  For example, you might use them to access modules shared over a
7112 company-wide network.
7113
7114 The default answer should be fine for most people.
7115 This causes further questions about vendor add-ons to be skipped
7116 and no vendor-specific directories will be configured for perl.
7117
7118 EOM
7119 rp='Do you want to configure vendor-specific add-on directories?'
7120 case "$usevendorprefix" in
7121 define|true|[yY]*) dflt=y ;;
7122 *)      : User may have set vendorprefix directly on Configure command line.
7123         case "$vendorprefix" in
7124         ''|' ') dflt=n ;;
7125         *)      dflt=y ;;
7126         esac
7127         ;;
7128 esac
7129 . ./myread
7130 case "$ans" in
7131 [yY]*)  fn=d~+
7132         rp='Installation prefix to use for vendor-supplied add-ons?'
7133         case "$vendorprefix" in
7134         '') dflt="$prefix" ;;
7135         *)  dflt=$vendorprefix ;;
7136         esac
7137         . ./getfile
7138         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7139         oldvendorprefix=''
7140         case "$vendorprefix" in
7141         '') ;;
7142         *)      case "$ans" in
7143                 "$prefix") ;;
7144                 *) oldvendorprefix="$prefix";;
7145                 esac
7146                 ;;
7147         esac
7148         usevendorprefix="$define"
7149         vendorprefix="$ans"
7150         vendorprefixexp="$ansexp"
7151         ;;
7152 *)      usevendorprefix="$undef"
7153         vendorprefix=''
7154         vendorprefixexp=''
7155         ;;
7156 esac
7157
7158 : Set the vendorlib variables
7159 case "$vendorprefix" in
7160 '')     d_vendorlib="$undef"
7161         vendorlib=''
7162         vendorlibexp=''
7163         ;;
7164 *)      d_vendorlib="$define"
7165         : determine where vendor-supplied modules go.
7166         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7167         case "$vendorlib" in
7168         '')
7169                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7170                 case "$installstyle" in
7171                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7172                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7173                 esac
7174                 ;;
7175         *)      dflt="$vendorlib"
7176                 ;;
7177         esac
7178         fn=d~+
7179         rp='Pathname for the vendor-supplied library files?'
7180         . ./getfile
7181         vendorlib="$ans"
7182         vendorlibexp="$ansexp"
7183         ;;
7184 esac
7185 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7186 prefixvar=vendorlib
7187 . ./installprefix
7188
7189 : Set the vendorarch variables
7190 case "$vendorprefix" in
7191 '')     d_vendorarch="$undef"
7192         vendorarch=''
7193         vendorarchexp=''
7194         ;;
7195 *)      d_vendorarch="$define"
7196         : determine where vendor-supplied architecture-dependent libraries go.
7197         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7198         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7199         : vendorlib may have an optional trailing /share.
7200         case "$vendorarch" in
7201         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7202                 dflt="$dflt/$archname"
7203                 ;;
7204         *)      dflt="$vendorarch" ;;
7205         esac
7206         fn=d~+
7207         rp='Pathname for vendor-supplied architecture-dependent files?'
7208         . ./getfile
7209         vendorarch="$ans"
7210         vendorarchexp="$ansexp"
7211         ;;
7212 esac
7213 prefixvar=vendorarch
7214 . ./installprefix
7215 if $test X"$vendorarch" = X"$vendorlib"; then
7216         d_vendorarch="$undef"
7217 else
7218         d_vendorarch="$define"
7219 fi
7220
7221 : Final catch-all directories to search
7222 $cat <<EOM
7223
7224 Lastly, you can have perl look in other directories for extensions and
7225 modules in addition to those already specified.
7226 These directories will be searched after
7227         $sitearch
7228         $sitelib
7229 EOM
7230 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7231 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7232 echo ' '
7233 case "$otherlibdirs" in
7234 ''|' ') dflt='none' ;;
7235 *)      dflt="$otherlibdirs" ;;
7236 esac
7237 $cat <<EOM
7238 Enter a colon-separated set of extra paths to include in perl's @INC
7239 search path, or enter 'none' for no extra paths.
7240
7241 EOM
7242
7243 rp='Colon-separated list of additional directories for perl to search?'
7244 . ./myread
7245 case "$ans" in
7246 ' '|''|none)    otherlibdirs=' ' ;;
7247 *)      otherlibdirs="$ans" ;;
7248 esac
7249 case "$otherlibdirs" in
7250 ' ') val=$undef ;;
7251 *)      val=$define ;;
7252 esac
7253 set d_perl_otherlibdirs
7254 eval $setvar
7255
7256 : Cruising for prototypes
7257 echo " "
7258 echo "Checking out function prototypes..." >&4
7259 $cat >prototype.c <<EOCP
7260 #$i_stdlib I_STDLIB
7261 #ifdef I_STDLIB
7262 #include <stdlib.h>
7263 #endif
7264 int main(int argc, char *argv[]) {
7265         exit(0);}
7266 EOCP
7267 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7268         echo "Your C compiler appears to support function prototypes."
7269         val="$define"
7270 else
7271         echo "Your C compiler doesn't seem to understand function prototypes."
7272         val="$undef"
7273 fi
7274 set prototype
7275 eval $setvar
7276 $rm -f prototype*
7277
7278 : Check if ansi2knr is required
7279 case "$prototype" in
7280 "$define") ;;
7281 *)      ansi2knr='ansi2knr'
7282         echo " "
7283         cat <<EOM >&4
7284
7285 $me:  FATAL ERROR:
7286 This version of $package can only be compiled by a compiler that 
7287 understands function prototypes.  Unfortunately, your C compiler 
7288         $cc $ccflags
7289 doesn't seem to understand them.  Sorry about that.
7290
7291 If GNU cc is available for your system, perhaps you could try that instead.  
7292
7293 Eventually, we hope to support building Perl with pre-ANSI compilers.
7294 If you would like to help in that effort, please contact <perlbug@perl.org>.
7295
7296 Aborting Configure now.
7297 EOM
7298         exit 2
7299         ;;
7300 esac
7301
7302 : DTrace support
7303 dflt_dtrace='/usr/sbin/dtrace'
7304 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7305
7306 cat <<EOM
7307
7308 Perl can be built to support DTrace on platforms that support it.
7309 DTrace is a diagnosis and performance analysis tool from Sun.
7310
7311 If this doesn't make any sense to you, just accept the default '$dflt'.
7312 EOM
7313
7314 while $test 1 ; do
7315         case "$usedtrace" in
7316         $define|true|[yY]*)
7317                 dflt='y'
7318                 ;;
7319         ?*)
7320                 dflt='y'
7321                 dflt_dtrace=$usedtrace
7322                 ;;
7323         *)
7324                 dflt='n'
7325                 ;;
7326         esac
7327
7328         rp='Support DTrace if available?'
7329         . ./myread
7330         case "$ans" in
7331         y|Y)    val="$define" ;;
7332         *)      val="$undef" ;;
7333         esac
7334         set usedtrace
7335         eval $setvar
7336
7337         test "X$usedtrace" != "X$define" && break
7338
7339         echo " "
7340         rp='Where is the dtrace executable?'
7341         dflt=$dflt_dtrace
7342         . ./getfile
7343         val="$ans"
7344         set dtrace
7345         eval $setvar
7346
7347         if $test -f $dtrace
7348         then
7349                 if $dtrace -h -s ../perldtrace.d \
7350                         -o perldtrace.tmp >/dev/null 2>&1 \
7351                         && rm -f perldtrace.tmp
7352                 then
7353                         echo " "
7354                         echo "Good: your $dtrace knows about the -h flag."
7355                 else
7356                         cat >&2 <<EOM
7357
7358 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7359 ***
7360 *** Your installed dtrace doesn't support the -h switch to compile a D
7361 *** program into a C header. Can't continue.
7362
7363 EOM
7364                         exit 1
7365                 fi
7366                 break;
7367         fi
7368
7369         case "$fastread" in
7370         yes)
7371                 cat >&2 <<EOM
7372
7373 *** $me:  Fatal Error:  $dtrace not found.
7374 *** Can't continue.
7375
7376 EOM
7377                 exit 1
7378                 ;;
7379         *)
7380                 echo "*** $dtrace was not found."
7381                 echo " "
7382                 ;;
7383         esac
7384 done
7385
7386 : See if we want extra modules installed
7387 echo " "
7388 case "$extras" in
7389 '') dflt='n';;
7390 *) dflt='y';;
7391 esac
7392 cat <<EOM
7393 Perl can be built with extra modules or bundles of modules which
7394 will be fetched from the CPAN and installed alongside Perl.
7395
7396 Notice that you will need access to the CPAN; either via the Internet,
7397 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7398 be asked later to configure the CPAN.pm module which will in turn do
7399 the installation of the rest of the extra modules or bundles.)
7400
7401 Notice also that if the modules require any external software such as
7402 libraries and headers (the libz library and the zlib.h header for the
7403 Compress::Zlib module, for example) you MUST have any such software
7404 already installed, this configuration process will NOT install such
7405 things for you.
7406
7407 If this doesn't make any sense to you, just accept the default '$dflt'.
7408 EOM
7409 rp='Install any extra modules (y or n)?'
7410 . ./myread
7411 case "$ans" in
7412 y|Y)
7413         cat <<EOM
7414
7415 Please list any extra modules or bundles to be installed from CPAN,
7416 with spaces between the names.  The names can be in any format the
7417 'install' command of CPAN.pm will understand.  (Answer 'none',
7418 without the quotes, to install no extra modules or bundles.)
7419 EOM
7420         rp='Extras?'
7421         dflt="$extras"
7422         . ./myread
7423         extras="$ans"
7424 esac
7425 case "$extras" in
7426 ''|'none')
7427         val=''
7428         $rm -f ../extras.lst
7429         ;;
7430 *)      echo "(Saving the list of extras for later...)"
7431         echo "$extras" > ../extras.lst
7432         val="'$extras'"
7433         ;;
7434 esac
7435 set extras
7436 eval $setvar
7437 echo " "
7438
7439 : determine where html pages for programs go
7440 set html1dir html1dir none
7441 eval $prefixit
7442 $cat <<EOM
7443
7444 If you wish to install html files for programs in $spackage, indicate
7445 the appropriate directory here.  To skip installing html files,
7446 answer "none".
7447 EOM
7448 case "$html1dir" in
7449 ''|none|$undef|' ') dflt=none ;;
7450 *) dflt=$html1dir ;;
7451 esac
7452 fn=dn+~
7453 rp="Directory for the main $spackage html pages?"
7454 . ./getfile
7455 prefixvar=html1dir
7456 . ./setprefixvar
7457 : Use ' ' for none so value is preserved next time through Configure
7458 $test X"$html1dir" = "X" && html1dir=' '
7459
7460 : determine where html pages for libraries and modules go
7461 set html3dir html3dir none
7462 eval $prefixit
7463 $cat <<EOM
7464
7465 If you wish to install html files for modules associated with $spackage,
7466 indicate the appropriate directory here.  To skip installing html files,
7467 answer "none".
7468 EOM
7469 : There is no obvious default.  If they have specified html1dir, then
7470 : try to key off that, possibly changing .../html1 into .../html3.
7471 case "$html3dir" in
7472 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7473 *) dflt=$html3dir ;;
7474 esac
7475 fn=dn+~
7476 rp="Directory for the $spackage module html pages?"
7477 . ./getfile
7478 prefixvar=html3dir
7479 . ./setprefixvar
7480 : Use ' ' for none so value is preserved next time through Configure
7481 $test X"$html3dir" = "X" && html3dir=' '
7482
7483 : determine whether to install perl also as /usr/bin/perl
7484
7485 echo " "
7486 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7487         $cat <<EOM
7488 Many scripts expect perl to be installed as /usr/bin/perl.
7489
7490 If you want to, I can install the perl you are about to compile
7491 as /usr/bin/perl (in addition to $bin/perl).
7492 EOM
7493         if test -f /usr/bin/perl; then
7494             $cat <<EOM
7495
7496 However, please note that because you already have a /usr/bin/perl,
7497 overwriting that with a new Perl would very probably cause problems.
7498 Therefore I'm assuming you don't want to do that (unless you insist).
7499
7500 EOM
7501             case "$installusrbinperl" in
7502             "$define"|[yY]*)    dflt='y';;
7503             *)                  dflt='n';;
7504             esac
7505         else
7506             $cat <<EOM
7507
7508 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7509
7510 EOM
7511             case "$installusrbinperl" in
7512             "$undef"|[nN]*)     dflt='n';;
7513             *)                  dflt='y';;
7514             esac
7515         fi
7516         rp="Do you want to install perl as /usr/bin/perl?"
7517         . ./myread
7518         case "$ans" in
7519         [yY]*)  val="$define";;
7520         *)      val="$undef" ;;
7521         esac
7522 else
7523         val="$undef"
7524 fi
7525 set installusrbinperl
7526 eval $setvar
7527
7528 : Check if we are using the GNU C library
7529 echo " "
7530 echo "Checking for GNU C Library..." >&4
7531 cat >try.c <<'EOCP'
7532 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7533    alone are insufficient to distinguish different versions, such as
7534    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7535    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7536 */
7537 #include <stdio.h>
7538 int main(void)
7539 {
7540 #ifdef __GLIBC__
7541 #   ifdef __GLIBC_MINOR__
7542 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7543 #           include <gnu/libc-version.h>
7544             printf("%s\n",  gnu_get_libc_version());
7545 #       else
7546             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7547 #       endif
7548 #   else
7549         printf("%d\n",  __GLIBC__);
7550 #   endif
7551     return 0;
7552 #else
7553     return 1;
7554 #endif
7555 }
7556 EOCP
7557 set try
7558 if eval $compile_ok && $run ./try > glibc.ver; then
7559         val="$define"
7560         gnulibc_version=`$cat glibc.ver`
7561         echo "You are using the GNU C Library version $gnulibc_version"
7562 else
7563         val="$undef"
7564         gnulibc_version=''
7565         echo "You are not using the GNU C Library"
7566 fi
7567 $rm_try glibc.ver
7568 set d_gnulibc
7569 eval $setvar
7570
7571 : see if nm is to be used to determine whether a symbol is defined or not
7572 case "$usenm" in
7573 '')
7574         dflt=''
7575         case "$d_gnulibc" in
7576         "$define")
7577                 echo " "
7578                 echo "nm probably won't work on the GNU C Library." >&4
7579                 dflt=n
7580                 ;;
7581         esac
7582         case "$dflt" in
7583         '')
7584                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7585                         echo " "
7586                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7587                         echo "'nm' won't be sufficient on this system." >&4
7588                         dflt=n
7589                 fi
7590                 ;;
7591         esac
7592         case "$dflt" in
7593         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7594                 if $test $dflt -gt 20; then
7595                         dflt=y
7596                 else
7597                         dflt=n
7598                 fi
7599                 ;;
7600         esac
7601         ;;
7602 *)
7603         case "$usenm" in
7604         true|$define) dflt=y;;
7605         *) dflt=n;;
7606         esac
7607         ;;
7608 esac
7609 $cat <<EOM
7610
7611 I can use $nm to extract the symbols from your C libraries. This
7612 is a time consuming task which may generate huge output on the disk (up
7613 to 3 megabytes) but that should make the symbols extraction faster. The
7614 alternative is to skip the 'nm' extraction part and to compile a small
7615 test program instead to determine whether each symbol is present. If
7616 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7617 this may be the best solution.
7618
7619 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7620
7621 EOM
7622 rp="Shall I use $nm to extract C symbols from the libraries?"
7623 . ./myread
7624 case "$ans" in
7625 [Nn]*) usenm=false;;
7626 *) usenm=true;;
7627 esac
7628
7629 runnm=$usenm
7630 case "$reuseval" in
7631 true) runnm=false;;
7632 esac
7633
7634 : nm options which may be necessary
7635 case "$nm_opt" in
7636 '') if $test -f /mach_boot; then
7637                 nm_opt=''       # Mach
7638         elif $test -d /usr/ccs/lib; then
7639                 nm_opt='-p'     # Solaris (and SunOS?)
7640         elif $test -f /dgux; then
7641                 nm_opt='-p'     # DG-UX
7642         elif $test -f /lib64/rld; then
7643                 nm_opt='-p'     # 64-bit Irix
7644         else
7645                 nm_opt=''
7646         fi;;
7647 esac
7648
7649 : nm options which may be necessary for shared libraries but illegal
7650 : for archive libraries.  Thank you, Linux.
7651 case "$nm_so_opt" in
7652 '')     case "$myuname" in
7653         *linux*|gnu*)
7654                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7655                         nm_so_opt='--dynamic'
7656                 fi
7657                 ;;
7658         esac
7659         ;;
7660 esac
7661
7662 : Figure out where the libc is located
7663 case "$runnm" in
7664 true)
7665 : get list of predefined functions in a handy place
7666 echo " "
7667 case "$libc" in
7668 '') libc=unknown
7669         case "$libs" in
7670         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7671         esac
7672         ;;
7673 esac
7674 case "$libs" in
7675 '') ;;
7676 *)  for thislib in $libs; do
7677         case "$thislib" in
7678         -lc|-lc_s)
7679                 : Handle C library specially below.
7680                 ;;
7681         -l*)
7682                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7683                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7684                         :
7685                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7686                         :
7687                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7688                         :
7689                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7690                         :
7691                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7692                         :
7693                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7694                         :
7695                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7696                         :
7697                 else
7698                         try=''
7699                 fi
7700                 libnames="$libnames $try"
7701                 ;;
7702         *) libnames="$libnames $thislib" ;;
7703         esac
7704         done
7705         ;;
7706 esac
7707 xxx=normal
7708 case "$libc" in
7709 unknown)
7710         set /lib/libc.$so
7711         for xxx in $libpth; do
7712                 $test -r $1 || set $xxx/libc.$so
7713                 : The messy sed command sorts on library version numbers.
7714                 $test -r $1 || \
7715                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7716                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7717                                 h
7718                                 s/[0-9][0-9]*/0000&/g
7719                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7720                                 G
7721                                 s/\n/ /' | \
7722                          $sort | $sed -e 's/^.* //'`
7723                 eval set \$$#
7724         done
7725         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
7726         $test -r $1 || set $sysroot/lib/libsys_s$_a
7727         ;;
7728 *)
7729         set blurfl
7730         ;;
7731 esac
7732 if $test -r "$1"; then
7733         echo "Your (shared) C library seems to be in $1."
7734         libc="$1"
7735 elif $test -r /lib/libc && $test -r /lib/clib; then
7736         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7737         xxx=apollo
7738         libc='/lib/clib /lib/libc'
7739         if $test -r /lib/syslib; then
7740                 echo "(Your math library is in /lib/syslib.)"
7741                 libc="$libc /lib/syslib"
7742         fi
7743 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7744         echo "Your C library seems to be in $libc, as you said before."
7745 elif $test -r $incpath/usr/lib/libc$_a; then
7746         libc=$incpath/usr/lib/libc$_a;
7747         echo "Your C library seems to be in $libc.  That's fine."
7748 elif $test -r /lib/libc$_a; then
7749         libc=/lib/libc$_a;
7750         echo "Your C library seems to be in $libc.  You're normal."
7751 else
7752         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7753                 :
7754         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7755                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7756         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7757                 :
7758         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7759                 :
7760         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7761                 :
7762         else
7763                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7764         fi
7765         if $test -r "$tans"; then
7766                 echo "Your C library seems to be in $tans, of all places."
7767                 libc=$tans
7768         else
7769                 libc='blurfl'
7770         fi
7771 fi
7772 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7773         dflt="$libc"
7774         cat <<EOM
7775
7776 If the guess above is wrong (which it might be if you're using a strange
7777 compiler, or your machine supports multiple models), you can override it here.
7778
7779 EOM
7780 else
7781         dflt=''
7782         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7783         cat >&4 <<EOM
7784 I can't seem to find your C library.  I've looked in the following places:
7785
7786 EOM
7787         $sed 's/^/      /' libpath
7788         cat <<EOM
7789
7790 None of these seems to contain your C library. I need to get its name...
7791
7792 EOM
7793 fi
7794 fn=f
7795 rp='Where is your C library?'
7796 . ./getfile
7797 libc="$ans"
7798
7799 echo " "
7800 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7801 set X `cat libnames`
7802 shift
7803 xxx=files
7804 case $# in 1) xxx=file; esac
7805 echo "Extracting names from the following $xxx for later perusal:" >&4
7806 echo " "
7807 $sed 's/^/      /' libnames >&4
7808 echo " "
7809 $echo $n "This may take a while...$c" >&4
7810
7811 for file in $*; do
7812         case $file in
7813         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7814         *) $nm $nm_opt $file 2>/dev/null;;
7815         esac
7816 done >libc.tmp
7817
7818 $echo $n ".$c"
7819 $grep fprintf libc.tmp > libc.ptf
7820 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7821 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7822 xxx='[ADTSIWi]'
7823 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7824         eval $xscan;\
7825         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7826                 eval $xrun
7827 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7828         eval $xscan;\
7829         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7830                 eval $xrun
7831 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7832         eval $xscan;\
7833         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7834                 eval $xrun
7835 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7836         eval $xscan;\
7837         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7838                 eval $xrun
7839 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7840         eval $xscan;\
7841         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7842                 eval $xrun
7843 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7844         eval $xscan;\
7845         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7846                 eval $xrun
7847 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7848                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7849         eval $xscan;\
7850         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7851                 eval $xrun
7852 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7853         eval $xscan;\
7854         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7855                 eval $xrun
7856 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7857         eval $xscan;\
7858         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7859                 eval $xrun
7860 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7861         eval $xscan;\
7862         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7863                 eval $xrun
7864 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7865         eval $xscan;\
7866         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7867                 eval $xrun
7868 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7869         eval $xscan;\
7870         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7871                 eval $xrun
7872 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7873         eval $xscan;\
7874         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7875                 eval $xrun
7876 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7877         eval $xscan;\
7878         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7879                 eval $xrun
7880 else
7881         $nm -p $* 2>/dev/null >libc.tmp
7882         $grep fprintf libc.tmp > libc.ptf
7883         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7884                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7885         then
7886                 nm_opt='-p'
7887                 eval $xrun
7888         else
7889                 echo " "
7890                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7891                 com=''
7892                 if $ar t $libc > libc.tmp && \
7893                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7894                 then
7895                         for thisname in $libnames $libc; do
7896                                 $ar t $thisname >>libc.tmp
7897                         done
7898                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7899                         echo "Ok." >&4
7900                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7901                         for thisname in $libnames $libc; do
7902                                 $ar tv $thisname >>libc.tmp
7903                                 emximp -o tmp.imp $thisname \
7904                                     2>/dev/null && \
7905                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7906                                     < tmp.imp >>libc.tmp
7907                                 $rm -f tmp.imp
7908                         done
7909                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7910                         echo "Ok." >&4
7911                 else
7912                         echo "$ar didn't seem to work right." >&4
7913                         echo "Maybe this is a Cray...trying bld instead..." >&4
7914                         if  bld t $libc | \
7915                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7916                                 $test -s libc.list
7917                         then
7918                                 for thisname in $libnames; do
7919                                         bld t $libnames | \
7920                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7921                                         $ar t $thisname >>libc.tmp
7922                                 done
7923                                 echo "Ok." >&4
7924                         else
7925                                 echo "That didn't work either.  Giving up." >&4
7926                                 exit 1
7927                         fi
7928                 fi
7929         fi
7930 fi
7931 nm_extract="$com"
7932 case "$PASE" in
7933 define)
7934     echo " "
7935     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7936     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7937     ;;
7938 *)  if $test -f /lib/syscalls.exp; then
7939         echo " "
7940         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7941         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7942                 /lib/syscalls.exp >>libc.list
7943     fi
7944     ;;
7945 esac
7946 ;;
7947 esac
7948 $rm -f libnames libpath
7949
7950 : Check if we are using C++
7951 echo " "
7952 echo "Checking for C++..." >&4
7953 $cat >try.c <<'EOCP'
7954 #include <stdio.h>
7955 int main(void)
7956 {
7957 #ifdef __cplusplus
7958     return 0;
7959 #else
7960     return 1;
7961 #endif
7962 }
7963 EOCP
7964 set try
7965 if eval $compile_ok && $run ./try; then
7966         val="$define"
7967         echo "You are using a C++ compiler."
7968 else
7969         val="$undef"
7970         echo "You are not using a C++ compiler."
7971 fi
7972 $rm_try cplusplus$$
7973 set d_cplusplus
7974 eval $setvar
7975
7976 : is a C symbol defined?
7977 csym='tlook=$1;
7978 case "$3" in
7979 -v) tf=libc.tmp; tdc="";;
7980 -a) tf=libc.tmp; tdc="[]";;
7981 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7982 esac;
7983 case "$d_cplusplus" in
7984     $define)    extern_C="extern \"C\"" ;;
7985     *)          extern_C="extern"       ;;
7986 esac;
7987 tx=yes;
7988 case "$reuseval-$4" in
7989 true-) ;;
7990 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7991 esac;
7992 case "$tx" in
7993 yes)
7994         tval=false;
7995         if $test "$runnm" = true; then
7996                 if $contains $tlook $tf >/dev/null 2>&1; then
7997                         tval=true;
7998                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7999                         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;
8000                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
8001                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
8002                         $rm_try;
8003                 fi;
8004         else
8005                 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;
8006                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
8007                 $rm_try;
8008         fi;
8009         ;;
8010 *)
8011         case "$tval" in
8012         $define) tval=true;;
8013         *) tval=false;;
8014         esac;
8015         ;;
8016 esac;
8017 eval "$2=$tval"'
8018
8019 : define an is-in-libc? function
8020 inlibc='echo " "; td=$define; tu=$undef;
8021 sym=$1; var=$2; eval "was=\$$2";
8022 tx=yes;
8023 case "$reuseval$was" in
8024 true) ;;
8025 true*) tx=no;;
8026 esac;
8027 case "$tx" in
8028 yes)
8029         set $sym tres -f;
8030         eval $csym;
8031         case "$tres" in
8032         true)
8033                 echo "$sym() found." >&4;
8034                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
8035         *)
8036                 echo "$sym() NOT found." >&4;
8037                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
8038         esac;;
8039 *)
8040         case "$was" in
8041         $define) echo "$sym() found." >&4;;
8042         *) echo "$sym() NOT found." >&4;;
8043         esac;;
8044 esac'
8045
8046 : see if dlopen exists
8047 xxx_runnm="$runnm"
8048 xxx_ccflags="$ccflags"
8049 runnm=false
8050 : with g++ one needs -shared to get is-in-libc to work for dlopen
8051 case "$gccversion" in
8052 '')     ;;
8053 *)      case "$d_cplusplus" in
8054         "$define") ccflags="$ccflags -shared" ;;
8055         esac
8056         ;;
8057 esac
8058 set dlopen d_dlopen
8059 eval $inlibc
8060 runnm="$xxx_runnm"
8061 ccflags="$xxx_ccflags"
8062
8063 : see if this is a unistd.h system
8064 set unistd.h i_unistd
8065 eval $inhdr
8066
8067 : determine which dynamic loading, if any, to compile in
8068 echo " "
8069 dldir="ext/DynaLoader"
8070 case "$usedl" in
8071     $define|y|true)
8072         dflt='y'
8073         usedl="$define"
8074         ;;
8075     $undef|n|false)
8076         dflt='n'
8077         usedl="$undef"
8078         ;;
8079     *)
8080         dflt='n'
8081         case "$d_dlopen" in
8082             $define) dflt='y' ;;
8083         esac
8084         : Does a dl_xxx.xs file exist for this operating system
8085         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8086         ;;
8087 esac
8088 rp="Do you wish to use dynamic loading?"
8089 . ./myread
8090 usedl="$ans"
8091 bin_ELF="$undef"
8092 case "$ans" in
8093     y*) usedl="$define"
8094         case "$dlsrc" in
8095             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8096                     dflt="$dldir/dl_${osname}.xs"
8097                 elif $test "$d_dlopen" = "$define" ; then
8098                     dflt="$dldir/dl_dlopen.xs"
8099                 else
8100                     dflt=''
8101                 fi
8102                 ;;
8103             *)  dflt="$dldir/$dlsrc"
8104                 ;;
8105         esac
8106         echo "The following dynamic loading files are available:"
8107         : Can not go over to $dldir because getfile has path hard-coded in.
8108         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8109         rp="Source file to use for dynamic loading"
8110         fn="fne"
8111         gfpth="$src"
8112         . ./getfile
8113         usedl="$define"
8114         : emulate basename
8115         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8116
8117         $cat << EOM
8118
8119 Some systems may require passing special flags to $cc -c to
8120 compile modules that will be used to create a shared library.
8121 To use no flags, say "none".
8122
8123 EOM
8124         case "$cccdlflags" in
8125             '') case "$gccversion" in
8126                 '') case "$osname" in
8127                         hpux)   dflt='+z' ;;
8128                         irix*)  dflt='-KPIC' ;;
8129                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8130                         sunos)  dflt='-pic' ;;
8131                         *)      dflt='none' ;;
8132                     esac
8133                     ;;
8134                 *)  case "$osname" in
8135                         darwin) dflt='none' ;;
8136                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8137                         *)      dflt='-fpic' ;;
8138                     esac ;;
8139                 esac ;;
8140             ' ') dflt='none' ;;
8141             *)   dflt="$cccdlflags" ;;
8142         esac
8143
8144         case "$dflt" in
8145             none) dflt='' ;;
8146         esac
8147
8148         # If -Dsysroot was specified, now's the time to add it
8149         # to cccdlflags
8150         if test "X$sysroot" != X; then
8151             case "$gccversion" in
8152                 '') ;;
8153                 *)  case "$dflt" in
8154                         *sysroot*) ;;
8155                         'undef'|*)
8156                             dflt="$dflt --sysroot=$sysroot" ;;
8157                     esac
8158                     ;;
8159             esac
8160         fi
8161
8162         case "$dflt" in
8163             '') dflt='none';;
8164         esac
8165
8166         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8167         . ./myread
8168         case "$ans" in
8169             none) cccdlflags=' ' ;;
8170             *)    cccdlflags="$ans" ;;
8171         esac
8172
8173         cat << EOM
8174
8175 Some systems use ld to create libraries that can be dynamically loaded,
8176 while other systems (such as those using ELF) use $cc.
8177
8178 EOM
8179
8180 : Determine if this is ELF
8181         $cat >try.c <<EOM
8182 /* Test for whether ELF binaries are produced */
8183 #include <fcntl.h>
8184 #$i_stdlib I_STDLIB
8185 #ifdef I_STDLIB
8186 #include <stdlib.h>
8187 #endif
8188 #$i_unistd I_UNISTD
8189 #ifdef I_UNISTD
8190 #include <unistd.h>
8191 #endif
8192 int main() {
8193     char b[4];
8194     int i = open("a.out",O_RDONLY);
8195     if(i == -1)
8196         exit(1); /* fail */
8197     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8198         exit(0); /* succeed (yes, it is ELF) */
8199     exit(1); /* fail */
8200 }
8201 EOM
8202         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8203             bin_ELF="$define"
8204         fi
8205         $rm_try
8206
8207         case "$ld" in
8208             '') if $test $bin_ELF = "$define"; then
8209                     cat <<EOM
8210 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8211 EOM
8212                     dflt="$cc"
8213                 else
8214                     echo "I'll use ld to build dynamic libraries."
8215                     dflt='ld'
8216                 fi
8217                 ;;
8218             *)  dflt="$ld"
8219                 ;;
8220         esac
8221
8222         rp="What command should be used to create dynamic libraries?"
8223         . ./myread
8224         ld="$ans"
8225
8226         cat << EOM
8227
8228 Some systems may require passing special flags to $ld to create a
8229 library that can be dynamically loaded.  If your ld flags include
8230 -L/other/path options to locate libraries outside your loader's normal
8231 search path, you may need to specify those -L options here as well.  To
8232 use no flags, say "none".
8233
8234 EOM
8235         case "$lddlflags" in
8236             '') case "$osname" in
8237                     haiku) dflt='-shared' ;;
8238                     hpux) dflt='-b';
8239                           case "$gccversion" in
8240                               '') dflt="$dflt +vnocompatwarnings" ;;
8241                           esac
8242                           ;;
8243                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8244                     solaris) # See [perl #66604].
8245                             # On Solaris 11, gcc -m64 on amd64
8246                             # appears not to understand -G.  gcc versions at
8247                             # least as old as 3.4.3 support -shared, so just
8248                             # use that with Solaris 11 and later, but keep
8249                             # the old behavior for older Solaris versions.
8250                             case "$gccversion" in
8251                                 '') dflt='-G' ;;
8252                                 *)  case "$osvers" in
8253                                         2.?|2.10) dflt='-G' ;;
8254                                         *) dflt='-shared' ;;
8255                                     esac
8256                                     ;;
8257                             esac
8258                             ;;
8259                     sunos) dflt='-assert nodefinitions' ;;
8260                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8261                     *)     dflt='none' ;;
8262                 esac
8263                 ;;
8264             *) dflt="$lddlflags" ;;
8265         esac
8266
8267         : Only do this for gcc, since, for example, qcc has no concept
8268         : of --sysroot.
8269         if $test "X$sysroot" != X; then
8270             case "$gccversion" in
8271                 '') ;;
8272                 *)  dflt="$dflt --sysroot $sysroot" ;;
8273             esac
8274         fi
8275
8276         : Try to guess additional flags to pick up local libraries.
8277         : Be careful not to append to a plain 'none'
8278         case "$dflt" in
8279             none) dflt='' ;;
8280         esac
8281         for thisflag in $ldflags; do
8282             case "$thisflag" in
8283                 -L*|-R*|-Wl,-R*)
8284                     case " $dflt " in
8285                         *" $thisflag "*) ;;
8286                         *) dflt="$dflt $thisflag" ;;
8287                     esac
8288                     ;;
8289             esac
8290         done
8291
8292         case "$dflt" in
8293             ''|' ') dflt='none' ;;
8294         esac
8295
8296         case "$ldflags" in
8297             *-fstack-protector*)
8298                 case "$dflt" in
8299                     *-fstack-protector*) ;; # Don't add it again
8300                     *) dflt="$dflt -fstack-protector" ;;
8301                 esac
8302                 ;;
8303         esac
8304
8305         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8306         . ./myread
8307         case "$ans" in
8308             none) lddlflags=' ' ;;
8309             *) lddlflags="$ans" ;;
8310         esac
8311
8312         cat <<EOM
8313
8314 Some systems may require passing special flags to $cc to indicate that
8315 the resulting executable will use dynamic linking.  To use no flags,
8316 say "none".
8317
8318 EOM
8319         case "$ccdlflags" in
8320             '') case "$osname" in
8321                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8322                     sunos)             dflt='none'   ;;
8323                     *)                 dflt='none'   ;;
8324                 esac ;;
8325             ' ') dflt='none' ;;
8326             *)   dflt="$ccdlflags" ;;
8327         esac
8328         rp="Any special flags to pass to $cc to use dynamic linking?"
8329         . ./myread
8330         case "$ans" in
8331             none) ccdlflags=' ' ;;
8332             *)    ccdlflags="$ans" ;;
8333         esac
8334         ;;
8335
8336     *)  usedl="$undef"
8337         ld='ld'
8338         dlsrc='dl_none.xs'
8339         lddlflags=''
8340         ccdlflags=''
8341         ;;
8342 esac
8343
8344 ld_can_script="$undef"
8345 case "$bin_ELF$usedl" in
8346     $define$define)
8347         # Abuse try.h and a.out names for neat cleanup
8348         $cat >try.c <<EOM
8349 void foo() {}
8350 void bar() {}
8351 EOM
8352         $cat >try.h <<EOM
8353 LIBTEST_42 {
8354  global:
8355   foo;
8356  local: *;
8357  };
8358 EOM
8359         if $cc $cccdlflags $ccdlflags $ccflags \
8360                $ldflags $lddlflags -o a.out try.c \
8361                -Wl,--version-script=try.h >/dev/null 2>&1 \
8362            &&  $test -s a.out ; then
8363             echo "ld supports scripting" >&4
8364             ld_can_script="$define"
8365         else
8366             echo "ld does not support scripting" >&4
8367         fi
8368         $rm_try
8369         ;;
8370 esac
8371
8372 : Do we want a shared libperl?
8373 also=''
8374 case "$usedl" in
8375 $undef)
8376         # No dynamic loading being used, so don't bother even to prompt.
8377         useshrplib='false'
8378         ;;
8379 *)      case "$useshrplib" in
8380         '')     case "$osname" in
8381                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8382                         dflt=y
8383                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8384                         ;;
8385                 *)      dflt=n
8386                         ;;
8387                 esac
8388                 ;;
8389         $define|true|[Yy]*)
8390                 dflt=y
8391                 ;;
8392         *)      dflt=n
8393                 ;;
8394         esac
8395         $cat << EOM
8396
8397 The perl executable is normally obtained by linking perlmain.c with
8398 libperl${_a}, any static extensions (usually just DynaLoader), and
8399 any other libraries needed on this system (such as -lm, etc.).  Since
8400 your system supports dynamic loading, it is probably possible to build
8401 a shared libperl.$so.  If you will have more than one executable linked
8402 to libperl.$so, this will significantly reduce the size of each
8403 executable, but it may have a noticeable effect on performance.  The
8404 default is probably sensible for your system.
8405 $also
8406
8407 EOM
8408         rp="Build a shared libperl.$so (y/n)"
8409         . ./myread
8410         case "$ans" in
8411         true|$define|[Yy]*)
8412                 useshrplib='true'  ;;
8413         *)      useshrplib='false' ;;
8414         esac
8415         ;;
8416 esac
8417
8418 case "$useshrplib" in
8419 true)
8420         case "$userelocatableinc" in
8421         true|define)
8422                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8423                 echo "See INSTALL for an explanation why that won't work." >&4
8424                 exit 4
8425                 ;;
8426         esac
8427         case "$libperl" in
8428         '')
8429                 # Figure out a good name for libperl.so.  Since it gets stored in
8430                 # a version-specific architecture-dependent library, the version
8431                 # number isn't really that important, except for making cc/ld happy.
8432                 #
8433                 # A name such as libperl.so.10.1
8434                 majmin="libperl.$so.$patchlevel.$subversion"
8435                 # A name such as libperl.so.100
8436                 majonly=`echo $patchlevel $subversion |
8437                         $awk '{printf "%d%02d", $1, $2}'`
8438                 majonly=libperl.$so.$majonly
8439                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8440                 # rely on figuring it out from the naming of libc.
8441                 case "${osname}${osvers}" in
8442                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8443                         dflt=libperl.$so
8444                         ;;
8445                 cygwin*) # ld links now against the dll directly
8446                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8447                         majonly=`echo $patchlevel $subversion |
8448                                 $awk '{printf "%03d%03d", $1, $2}'`
8449                         majonly=cygperl5.$majonly.$so
8450                         dflt=$majmin
8451                         ;;
8452                 *)      # Try to guess based on whether libc has major.minor.
8453                         case "$libc" in
8454                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8455                         *libc.$so.[0-9]*) dflt=$majonly ;;
8456                         *)      dflt=libperl.$so ;;
8457                         esac
8458                         ;;
8459                 esac
8460                 ;;
8461         *)      dflt=$libperl
8462                 ;;
8463         esac
8464         cat << EOM
8465
8466 I need to select a good name for the shared libperl.  If your system uses
8467 library names with major and minor numbers, then you might want something
8468 like $majmin.  Alternatively, if your system uses a single version
8469 number for shared libraries, then you might want to use $majonly.
8470 Or, your system might be quite happy with a simple libperl.$so.
8471
8472 Since the shared libperl will get installed into a version-specific
8473 architecture-dependent directory, the version number of the shared perl
8474 library probably isn't important, so the default should be o.k.
8475
8476 EOM
8477         rp='What name do you want to give to the shared libperl?'
8478         . ./myread
8479         libperl=$ans
8480         echo "Ok, I'll use $libperl"
8481         ;;
8482 *)
8483         libperl="libperl${_a}"
8484         ;;
8485 esac
8486
8487 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8488 case "$shrpdir" in
8489 '') ;;
8490 *)      $cat >&4 <<EOM
8491 WARNING:  Use of the shrpdir variable for the installation location of
8492 the shared $libperl is not supported.  It was never documented and
8493 will not work in this version.  Let me (perlbug@perl.org)
8494 know of any problems this may cause.
8495
8496 EOM
8497         case "$shrpdir" in
8498         "$archlibexp/CORE")
8499                 $cat >&4 <<EOM
8500 But your current setting of $shrpdir is
8501 the default anyway, so it's harmless.
8502 EOM
8503                 ;;
8504         *)
8505                 $cat >&4 <<EOM
8506 Further, your current attempted setting of $shrpdir
8507 conflicts with the value of $archlibexp/CORE
8508 that installperl will use.
8509 EOM
8510                 ;;
8511         esac
8512         ;;
8513 esac
8514
8515 # How will the perl executable find the installed shared $libperl?
8516 # Add $xxx to ccdlflags.
8517 # If we can't figure out a command-line option, use $shrpenv to
8518 # set env LD_RUN_PATH.  The main perl makefile uses this.
8519 shrpdir=$archlibexp/CORE
8520 xxx=''
8521 tmp_shrpenv=''
8522 if "$useshrplib"; then
8523     case "$osname" in
8524         aix)
8525                 # We'll set it in Makefile.SH...
8526                 ;;
8527         solaris)
8528                 xxx="-R $shrpdir"
8529                 ;;
8530         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8531                 xxx="-Wl,-R$shrpdir"
8532                 ;;
8533         bsdos|linux|irix*|dec_osf|gnu*)
8534                 xxx="-Wl,-rpath,$shrpdir"
8535                 ;;
8536         haiku)
8537                 # Haiku doesn't like the default, either.
8538                 ;;
8539         hpux*)
8540                 # hpux doesn't like the default, either.
8541                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8542                 ;;
8543         cygwin)
8544                 # cygwin needs only ldlibpth
8545                 ;;
8546         *)
8547                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8548                 ;;
8549         esac
8550         case "$xxx" in
8551         '') ;;
8552         *)
8553                 # Only add $xxx if it isn't already in ccdlflags.
8554                 case " $ccdlflags " in
8555                 *" $xxx "*)     ;;
8556                 *)      ccdlflags="$ccdlflags $xxx"
8557                         cat <<EOM >&4
8558
8559 Adding $xxx to the flags
8560 passed to $ld so that the perl executable will find the
8561 installed shared $libperl.
8562
8563 EOM
8564                         ;;
8565                 esac
8566                 ;;
8567         esac
8568 fi
8569 # Fix ccdlflags in AIX for building external extensions.
8570 # (For building Perl itself bare -bE:perl.exp is needed,
8571 #  Makefile.SH takes care of this.)
8572 case "$osname" in
8573 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8574 esac
8575 # Respect a hint or command-line value.
8576 case "$shrpenv" in
8577 '') shrpenv="$tmp_shrpenv" ;;
8578 esac
8579 case "$ldlibpthname" in
8580 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8581 none)   ldlibpthname='' ;;
8582 esac
8583
8584 : determine where manual pages are on this system
8585 echo " "
8586 case "$sysman" in
8587 '')
8588         syspath='/usr/share/man/man1 /usr/man/man1'
8589         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8590         syspath="$syspath /usr/man/u_man/man1"
8591         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8592         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8593         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8594         sysman=`./loc . /usr/man/man1 $syspath`
8595         ;;
8596 esac
8597 if $test -d "$sysman"; then
8598         echo "System manual is in $sysman." >&4
8599 else
8600         echo "Could not find manual pages in source form." >&4
8601 fi
8602
8603 : determine where manual pages go
8604 set man1dir man1dir none
8605 eval $prefixit
8606 $cat <<EOM
8607
8608 $spackage has manual pages available in source form.
8609 EOM
8610 case "$nroff" in
8611 nroff)
8612         echo "However, you don't have nroff, so they're probably useless to you."
8613         case "$man1dir" in
8614         '') man1dir="none";;
8615         esac;;
8616 esac
8617 echo "If you don't want the manual sources installed, answer 'none'."
8618 case "$man1dir" in
8619 ' ') dflt=none
8620         ;;
8621 '')
8622         lookpath="$prefixexp/share/man/man1"
8623         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8624         lookpath="$lookpath $prefixexp/man/p_man/man1"
8625         lookpath="$lookpath $prefixexp/man/u_man/man1"
8626         lookpath="$lookpath $prefixexp/man/man.1"
8627         case "$sysman" in
8628         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8629         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8630         esac
8631         set dflt
8632         eval $prefixup
8633         ;;
8634 *)  dflt="$man1dir"
8635         ;;
8636 esac
8637 echo " "
8638 fn=dn+~
8639 rp="Where do the main $spackage manual pages (source) go?"
8640 . ./getfile
8641 if $test "X$man1direxp" != "X$ansexp"; then
8642         installman1dir=''
8643 fi
8644 prefixvar=man1dir
8645 . ./setprefixvar
8646
8647 case "$man1dir" in
8648 '')     man1dir=' '
8649         installman1dir='';;
8650 esac
8651
8652 : What suffix to use on installed man pages
8653
8654 case "$man1dir" in
8655 ' ')
8656         man1ext='0'
8657         ;;
8658 *)
8659         rp="What suffix should be used for the main $spackage man pages?"
8660         case "$man1ext" in
8661         '')     case "$man1dir" in
8662                 *1)  dflt=1 ;;
8663                 *1p) dflt=1p ;;
8664                 *1pm) dflt=1pm ;;
8665                 *l) dflt=l;;
8666                 *n) dflt=n;;
8667                 *o) dflt=o;;
8668                 *p) dflt=p;;
8669                 *C) dflt=C;;
8670                 *L) dflt=L;;
8671                 *L1) dflt=L1;;
8672                 *) dflt=1;;
8673                 esac
8674                 ;;
8675         *)      dflt="$man1ext";;
8676         esac
8677         . ./myread
8678         man1ext="$ans"
8679         ;;
8680 esac
8681
8682 : see if we can have long filenames
8683 echo " "
8684 first=123456789abcdef
8685 $rm -f $first
8686 if (echo hi >$first) 2>/dev/null; then
8687         if $test -f 123456789abcde; then
8688                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8689                 val="$undef"
8690         else
8691                 echo 'You can have filenames longer than 14 characters.'>&4
8692                 val="$define"
8693         fi
8694 else
8695         $cat <<'EOM'
8696 You can't have filenames longer than 14 chars.
8697 You can't even think about them!
8698 EOM
8699         val="$undef"
8700 fi
8701 set d_flexfnam
8702 eval $setvar
8703 $rm -rf 123456789abcde*
8704
8705 : determine where library module manual pages go
8706 set man3dir man3dir none
8707 eval $prefixit
8708 $cat <<EOM
8709
8710 $spackage has manual pages for many of the library modules.
8711 EOM
8712
8713 case "$nroff" in
8714 nroff)
8715         $cat <<'EOM'
8716 However, you don't have nroff, so they're probably useless to you.
8717 EOM
8718         case "$man3dir" in
8719         '') man3dir="none";;
8720         esac;;
8721 esac
8722
8723 case "$d_flexfnam" in
8724 undef)
8725         $cat <<'EOM'
8726 However, your system can't handle the long file names like File::Basename.3.
8727 EOM
8728         case "$man3dir" in
8729         '') man3dir="none";;
8730         esac;;
8731 esac
8732
8733 echo "If you don't want the manual sources installed, answer 'none'."
8734 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8735 case "$man3dir" in
8736 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8737         if $test -d "$privlib/man/man3"; then
8738                 cat <<EOM >&4
8739
8740 WARNING:  Previous versions of perl installed man3 pages into
8741 $privlib/man/man3.  This version will suggest a
8742 new default of $dflt.
8743 EOM
8744                 tdflt=$dflt
8745                 dflt='n'
8746                 rp='Do you wish to preserve the old behavior?(y/n)'
8747                 . ./myread
8748                 case "$ans" in
8749                 y*) dflt="$privlib/man/man3" ;;
8750                 *)  dflt=$tdflt ;;
8751                 esac
8752     fi
8753         ;;
8754 *)      dflt="$man3dir" ;;
8755 esac
8756 case "$dflt" in
8757 ' ') dflt=none ;;
8758 esac
8759 echo " "
8760 fn=dn+~
8761 rp="Where do the $package library man pages (source) go?"
8762 . ./getfile
8763 prefixvar=man3dir
8764 . ./setprefixvar
8765
8766 case "$man3dir" in
8767 '')     man3dir=' '
8768         installman3dir='';;
8769 esac
8770
8771 : What suffix to use on installed man pages
8772 case "$man3dir" in
8773 ' ')
8774         man3ext='0'
8775         ;;
8776 *)
8777         rp="What suffix should be used for the $package library man pages?"
8778         case "$man3ext" in
8779         '')     case "$man3dir" in
8780                 *3)  dflt=3 ;;
8781                 *3p) dflt=3p ;;
8782                 *3pm) dflt=3pm ;;
8783                 *l) dflt=l;;
8784                 *n) dflt=n;;
8785                 *o) dflt=o;;
8786                 *p) dflt=p;;
8787                 *C) dflt=C;;
8788                 *L) dflt=L;;
8789                 *L3) dflt=L3;;
8790                 *) dflt=3;;
8791                 esac
8792                 ;;
8793         *)      dflt="$man3ext";;
8794         esac
8795         . ./myread
8796         man3ext="$ans"
8797         ;;
8798 esac
8799
8800 : see if we have to deal with yellow pages, now NIS.
8801 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8802         case "$hostcat" in
8803         nidump*) ;;
8804         *)
8805                 case "$hostcat" in
8806                 *ypcat*) dflt=y;;
8807                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8808                                 dflt=y
8809                         else
8810                                 dflt=n
8811                         fi;;
8812                 *) dflt=n;;
8813                 esac
8814                 echo " "
8815                 rp='Are you getting the hosts file via yellow pages?'
8816                 . ./myread
8817                 case "$ans" in
8818                 y*) hostcat='ypcat hosts';;
8819                 *) hostcat='cat /etc/hosts';;
8820                 esac
8821                 ;;
8822         esac
8823 fi
8824 case "$hostcat" in
8825 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8826 esac
8827 case "$groupcat" in
8828 '') test -f /etc/group && groupcat='cat /etc/group';;
8829 esac
8830 case "$passcat" in
8831 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8832 esac
8833
8834 : now get the host name
8835 echo " "
8836 echo "Figuring out host name..." >&4
8837 case "$myhostname" in
8838 '') cont=true
8839         echo 'Maybe "hostname" will work...'
8840         if tans=`sh -c hostname 2>&1` ; then
8841                 myhostname=$tans
8842                 phostname=hostname
8843                 cont=''
8844         fi
8845         ;;
8846 *) cont='';;
8847 esac
8848 if $test "$cont"; then
8849         if ./xenix; then
8850                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8851                 if tans=`cat /etc/systemid 2>&1` ; then
8852                         myhostname=$tans
8853                         phostname='cat /etc/systemid'
8854                         echo "Whadyaknow.  Xenix always was a bit strange..."
8855                         cont=''
8856                 fi
8857         elif $test -r /etc/systemid; then
8858                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8859         fi
8860 fi
8861 if $test "$cont"; then
8862         echo 'No, maybe "uuname -l" will work...'
8863         if tans=`sh -c 'uuname -l' 2>&1` ; then
8864                 myhostname=$tans
8865                 phostname='uuname -l'
8866         else
8867                 echo 'Strange.  Maybe "uname -n" will work...'
8868                 if tans=`sh -c 'uname -n' 2>&1` ; then
8869                         myhostname=$tans
8870                         phostname='uname -n'
8871                 else
8872                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8873                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8874                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8875                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8876                         else
8877                                 case "$myhostname" in
8878                                 '') echo "Does this machine have an identity crisis or something?"
8879                                         phostname='';;
8880                                 *)
8881                                         echo "Well, you said $myhostname before..."
8882                                         phostname='echo $myhostname';;
8883                                 esac
8884                         fi
8885                 fi
8886         fi
8887 fi
8888 case "$myhostname" in
8889 '') myhostname=noname ;;
8890 esac
8891 : you do not want to know about this
8892 set $myhostname
8893 myhostname=$1
8894
8895 : verify guess
8896 if $test "$myhostname" ; then
8897         dflt=y
8898         rp='Your host name appears to be "'$myhostname'".'" Right?"
8899         . ./myread
8900         case "$ans" in
8901         y*) ;;
8902         *) myhostname='';;
8903         esac
8904 fi
8905
8906 : bad guess or no guess
8907 while $test "X$myhostname" = X ; do
8908         dflt=''
8909         rp="Please type the (one word) name of your host:"
8910         . ./myread
8911         myhostname="$ans"
8912 done
8913
8914 : translate upper to lower if necessary
8915 case "$myhostname" in
8916 *[A-Z]*)
8917         echo "(Normalizing case in your host name)"
8918         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8919         ;;
8920 esac
8921
8922 case "$myhostname" in
8923 *.*)
8924         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8925         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8926         echo "(Trimming domain name from host name--host name is now $myhostname)"
8927         ;;
8928 *) case "$mydomain" in
8929         '')
8930                 {
8931                         test "X$hostcat" = "Xypcat hosts" &&
8932                         ypmatch "$myhostname" hosts 2>/dev/null |\
8933                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8934                         $test -s hosts
8935                 } || {
8936                         test "X$hostcat" != "X" &&
8937                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8938                                         /[       ]$myhostname[  . ]/p" > hosts
8939                 }
8940                 tmp_re="[       . ]"
8941                 if $test -f hosts; then
8942                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8943                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8944                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8945                                 hosts | $sort | $uniq | \
8946                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8947                         case `$echo X$dflt` in
8948                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8949                                 dflt=.
8950                                 ;;
8951                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8952                                 ;;
8953                         esac
8954                 else
8955                         echo "(I cannot locate a hosts database anywhere)"
8956                         dflt=.
8957                 fi
8958                 case "$dflt" in
8959                 .)
8960                         tans=`./loc resolv.conf X /etc /usr/etc`
8961                         if $test -f "$tans"; then
8962                                 echo "(Attempting domain name extraction from $tans)"
8963                                 dflt=.`$sed -n -e 's/   / /g' \
8964                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8965                                   -e 1q 2>/dev/null`
8966                                 case "$dflt" in
8967                                 .) dflt=.`$sed -n -e 's/        / /g' \
8968                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8969                                      -e 1q 2>/dev/null`
8970                                         ;;
8971                                 esac
8972                         fi
8973                         ;;
8974                 esac
8975                 case "$dflt" in
8976                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8977                         dflt=.`sh -c domainname 2>/dev/null`
8978                         case "$dflt" in
8979                         '') dflt='.';;
8980                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8981                         esac
8982                         ;;
8983                 esac
8984                 case "$dflt$osname" in
8985                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8986                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8987                         ;;
8988                 esac
8989                 case "$dflt" in
8990                 .) echo "(Lost all hope -- silly guess then)"
8991                         dflt='.nonet'
8992                         ;;
8993                 esac
8994                 $rm -f hosts
8995                 ;;
8996         *) dflt="$mydomain";;
8997         esac;;
8998 esac
8999 echo " "
9000 rp="What is your domain name?"
9001 . ./myread
9002 tans="$ans"
9003 case "$ans" in
9004 '') ;;
9005 .*) ;;
9006 *) tans=".$tans";;
9007 esac
9008 mydomain="$tans"
9009
9010 : translate upper to lower if necessary
9011 case "$mydomain" in
9012 *[A-Z]*)
9013         echo "(Normalizing case in your domain name)"
9014         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9015         ;;
9016 esac
9017
9018 : a little sanity check here
9019 case "$phostname" in
9020 '') ;;
9021 *)
9022         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9023         $myhostname$mydomain|$myhostname) ;;
9024         *)
9025                 case "$phostname" in
9026                 sed*)
9027                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9028                         ;;
9029                 *)
9030                         echo "(That doesn't agree with your $phostname command, by the way.)"
9031                         ;;
9032                 esac
9033         ;;
9034         esac
9035         ;;
9036 esac
9037
9038 : determine the e-mail address of the user who is running us
9039 $cat <<EOM
9040
9041 I need to get your e-mail address in Internet format if possible, i.e.
9042 something like user@host.domain. Please answer accurately since I have
9043 no easy means to double check it. The default value provided below
9044 is most probably close to reality but may not be valid from outside
9045 your organization...
9046
9047 EOM
9048 cont=x
9049 while test "$cont"; do
9050         case "$MAILDOMAIN" in
9051         '')
9052                 if $test -s /etc/mailname; then
9053                         maildomain=`$cat /etc/mailname`
9054                 else
9055                         maildomain="$myhostname$mydomain"
9056                 fi
9057                 ;;
9058         *)  maildomain="$MAILDOMAIN";;
9059         esac
9060         case "$cf_email" in
9061         '') dflt="$cf_by@$maildomain";;
9062         *)  dflt="$cf_email";;
9063         esac
9064         rp='What is your e-mail address?'
9065         . ./myread
9066         cf_email="$ans"
9067         case "$cf_email" in
9068         *@*.*) cont='' ;;
9069         *)
9070                 rp='Address does not look like an Internet one.  Use it anyway?'
9071                 case "$fastread" in
9072                 yes) dflt=y ;;
9073                 *) dflt=n ;;
9074                 esac
9075                 . ./myread
9076                 case "$ans" in
9077                 y*) cont='' ;;
9078                 *) echo " " ;;
9079                 esac
9080                 ;;
9081         esac
9082 done
9083
9084 : Ask e-mail of administrator
9085 $cat <<EOM
9086
9087 If you or somebody else will be maintaining perl at your site, please
9088 fill in the correct e-mail address here so that they may be contacted
9089 if necessary. Currently, the "perlbug" program included with perl
9090 will send mail to this address in addition to perlbug@perl.org. You may
9091 enter "none" for no administrator.
9092
9093 EOM
9094 case "$perladmin" in
9095 '') dflt="$cf_email";;
9096 *) dflt="$perladmin";;
9097 esac
9098 rp='Perl administrator e-mail address'
9099 . ./myread
9100 perladmin="$ans"
9101
9102 : determine whether to only install version-specific parts.
9103 echo " "
9104 $cat <<EOM
9105 Do you want to install only the version-specific parts of the perl
9106 distribution?  Usually you do *not* want to do this.
9107 EOM
9108 case "$versiononly" in
9109 "$define"|[Yy]*|true) dflt='y' ;;
9110 *) dflt='n';
9111 esac
9112 rp="Do you want to install only the version-specific parts of perl?"
9113 . ./myread
9114 case "$ans" in
9115 [yY]*)  val="$define";;
9116 *)      val="$undef" ;;
9117 esac
9118 set versiononly
9119 eval $setvar
9120
9121 case "$versiononly" in
9122 "$define") inc_version_list=''
9123            inc_version_list_init=0
9124            ;;
9125 esac
9126
9127 : figure out how to guarantee perl startup
9128 : XXX Note that this currently takes advantage of the bug that binexp ignores
9129 :     the Configure -Dinstallprefix setting, which in turn means that under
9130 :     relocatable @INC, initialinstalllocation is what binexp started as.
9131 case "$startperl" in
9132 '')
9133         case "$sharpbang" in
9134         *!)
9135                 $cat <<EOH
9136
9137 I can use the #! construct to start perl on your system. This will
9138 make startup of perl scripts faster, but may cause problems if you
9139 want to share those scripts and perl is not in a standard place
9140 ($initialinstalllocation/perl) on all your platforms. The alternative
9141 is to force a shell by starting the script with a single ':' character.
9142
9143 EOH
9144                 case "$versiononly" in
9145                 "$define")      dflt="$initialinstalllocation/perl$version";;
9146                 *)              dflt="$initialinstalllocation/perl";;
9147                 esac
9148                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9149                 . ./myread
9150                 case "$ans" in
9151                 none)   startperl=": # use perl";;
9152                 *)      startperl="#!$ans"
9153                         if $test 30 -lt `echo "$ans" | wc -c`; then
9154                                 $cat >&4 <<EOM
9155
9156 WARNING:  Some systems limit the #! command to 32 characters.
9157 If you experience difficulty running Perl scripts with #!, try
9158 installing Perl in a directory with a shorter pathname.
9159
9160 EOM
9161                         fi ;;
9162                 esac
9163                 ;;
9164         *) startperl=": # use perl"
9165                 ;;
9166         esac
9167         ;;
9168 esac
9169 echo "I'll use $startperl to start perl scripts."
9170
9171 : figure best path for perl in scripts
9172 case "$perlpath" in
9173 '')
9174         case "$versiononly" in
9175         "$define")      perlpath="$initialinstalllocation/perl$version";;
9176         *)              perlpath="$initialinstalllocation/perl";;
9177         esac
9178         case "$startperl" in
9179         *!*) ;;
9180         *)
9181                 $cat <<EOH
9182
9183 I will use the "eval 'exec'" idiom to start Perl on your system.
9184 I can use the full path of your Perl binary for this purpose, but
9185 doing so may cause problems if you want to share those scripts and
9186 Perl is not always in a standard place ($initialinstalllocation/perl).
9187
9188 EOH
9189                 dflt="$initialinstalllocation/perl"
9190                 rp="What path shall I use in \"eval 'exec'\"?"
9191                 . ./myread
9192                 perlpath="$ans"
9193                 ;;
9194         esac
9195         ;;
9196 esac
9197 case "$startperl" in
9198 *!*)    ;;
9199 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9200 esac
9201
9202 : determine where public executable scripts go
9203 set scriptdir scriptdir
9204 eval $prefixit
9205 case "$scriptdir" in
9206 '')
9207         dflt="$bin"
9208         : guess some guesses
9209         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9210         $test -d /usr/share/bin     && dflt=/usr/share/bin
9211         $test -d /usr/local/script  && dflt=/usr/local/script
9212         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9213         $test -d $prefixexp/script  && dflt=$prefixexp/script
9214         set dflt
9215         eval $prefixup
9216         ;;
9217 *)  dflt="$scriptdir"
9218         ;;
9219 esac
9220 $cat <<EOM
9221
9222 Some installations have a separate directory just for executable scripts so
9223 that they can mount it across multiple architectures but keep the scripts in
9224 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9225 Or you might just lump your scripts in with all your other executables.
9226
9227 EOM
9228 fn=d~
9229 rp='Where do you keep publicly executable scripts?'
9230 . ./getfile
9231 if $test "X$ansexp" != "X$scriptdirexp"; then
9232         installscript=''
9233 fi
9234 installscriptdir=''
9235 prefixvar=scriptdir
9236 . ./setprefixvar
9237 : A little fix up for an irregularly named variable.
9238 installscript="$installscriptdir"
9239
9240 : determine where add-on public executables go
9241 case "$sitebin" in
9242 '')     dflt=$siteprefix/bin ;;
9243 *)      dflt=$sitebin ;;
9244 esac
9245 fn=d~
9246 rp='Pathname where the add-on public executables should be installed?'
9247 . ./getfile
9248 prefixvar=sitebin
9249 . ./setprefixvar
9250
9251 : determine where add-on html pages go
9252 : There is no standard location, so try to copy the previously-selected
9253 : directory structure for the core html pages.
9254 case "$sitehtml1dir" in
9255 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9256 *)     dflt=$sitehtml1dir ;;
9257 esac
9258 case "$dflt" in
9259 ''|' ') dflt=none ;;
9260 esac
9261 fn=dn+~
9262 rp='Pathname where the site-specific html pages should be installed?'
9263 . ./getfile
9264 prefixvar=sitehtml1dir
9265 . ./setprefixvar
9266
9267 : determine where add-on library html pages go
9268 : There is no standard location, so try to copy the previously-selected
9269 : directory structure for the core html pages.
9270 case "$sitehtml3dir" in
9271 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9272 *)     dflt=$sitehtml3dir ;;
9273 esac
9274 case "$dflt" in
9275 ''|' ') dflt=none ;;
9276 esac
9277 fn=dn+~
9278 rp='Pathname where the site-specific library html pages should be installed?'
9279 . ./getfile
9280 prefixvar=sitehtml3dir
9281 . ./setprefixvar
9282
9283 : determine where add-on manual pages go
9284 case "$siteman1dir" in
9285 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9286 *)      dflt=$siteman1dir ;;
9287 esac
9288 case "$dflt" in
9289 ''|' ') dflt=none ;;
9290 esac
9291 fn=dn+~
9292 rp='Pathname where the site-specific manual pages should be installed?'
9293 . ./getfile
9294 prefixvar=siteman1dir
9295 . ./setprefixvar
9296
9297 : determine where add-on library man pages go
9298 case "$siteman3dir" in
9299 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9300 *)      dflt=$siteman3dir ;;
9301 esac
9302 case "$dflt" in
9303 ''|' ') dflt=none ;;
9304 esac
9305 fn=dn+~
9306 rp='Pathname where the site-specific library manual pages should be installed?'
9307 . ./getfile
9308 prefixvar=siteman3dir
9309 . ./setprefixvar
9310
9311 : determine where add-on public executable scripts go
9312 case "$sitescript" in
9313 '')     dflt=$siteprefix/script
9314         $test -d $dflt || dflt=$sitebin ;;
9315 *)  dflt="$sitescript" ;;
9316 esac
9317 fn=d~+
9318 rp='Pathname where add-on public executable scripts should be installed?'
9319 . ./getfile
9320 prefixvar=sitescript
9321 . ./setprefixvar
9322
9323 : see if backtrace exists
9324 set backtrace d_backtrace
9325 eval $inlibc
9326
9327 : add flags if using c backtrace
9328 case "$usecbacktrace" in
9329   "") usecbacktrace=$undef ;;
9330   [yY]*|true|$define)
9331     case "$d_backtrace" in
9332       [yY]*|true|$define)
9333         case " $ccflags " in
9334           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9335           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9336           esac
9337         ;;
9338       *)
9339         echo "This system does not support backtrace" >&4
9340         usecbacktrace=$undef
9341         ;;
9342       esac
9343     ;;
9344   esac
9345
9346 : Check if faststdio is requested and available
9347 case "$usefaststdio" in
9348 $define|true|[yY]*|'')
9349         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9350         case "$xversion" in
9351         [68])   dflt='y' ;;
9352         *)      dflt='n' ;;
9353         esac
9354         ;;
9355 *) dflt='n';;
9356 esac
9357 cat <<EOM
9358
9359 Perl can be built to use 'fast stdio', which means using the stdio
9360 library but also directly manipulating the stdio buffers to enable
9361 faster I/O.  Using stdio is better for backward compatibility (especially
9362 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9363 interface has been preferred instead of stdio.
9364
9365 If this doesn't make any sense to you, just accept the default '$dflt'.
9366 EOM
9367 rp='Use the "fast stdio" if available?'
9368 . ./myread
9369 case "$ans" in
9370 y|Y)    val="$define" ;;
9371 *)      val="$undef" ;;
9372 esac
9373 set usefaststdio
9374 eval $setvar
9375
9376
9377 : define an is-a-typedef? function
9378 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9379 case "$inclist" in
9380 "") inclist="sys/types.h";;
9381 esac;
9382 eval "varval=\$$var";
9383 case "$varval" in
9384 "")
9385         $rm -f temp.c;
9386         for inc in $inclist; do
9387                 echo "#include <$inc>" >>temp.c;
9388         done;
9389         echo "#ifdef $type" >> temp.c;
9390         echo "printf(\"We have $type\");" >> temp.c;
9391         echo "#endif" >> temp.c;
9392         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9393         if $contains $type temp.E >/dev/null 2>&1; then
9394                 eval "$var=\$type";
9395         else
9396                 eval "$var=\$def";
9397         fi;
9398         $rm -f temp.?;;
9399 *) eval "$var=\$varval";;
9400 esac'
9401
9402 : define an is-a-typedef? function that prompts if the type is not available.
9403 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9404 case "$inclist" in
9405 "") inclist="sys/types.h";;
9406 esac;
9407 eval "varval=\$$var";
9408 case "$varval" in
9409 "")
9410         $rm -f temp.c;
9411         for inc in $inclist; do
9412                 echo "#include <$inc>" >>temp.c;
9413         done;
9414         echo "#ifdef $type" >> temp.c;
9415         echo "printf(\"We have $type\");" >> temp.c;
9416         echo "#endif" >> temp.c;
9417         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9418         echo " " ;
9419         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9420         if $contains $type temp.E >/dev/null 2>&1; then
9421                 echo "$type found." >&4;
9422                 eval "$var=\$type";
9423         else
9424                 echo "$type NOT found." >&4;
9425                 dflt="$def";
9426                 . ./myread ;
9427                 eval "$var=\$ans";
9428         fi;
9429         $rm -f temp.?;;
9430 *) eval "$var=\$varval";;
9431 esac'
9432
9433 : see what type lseek is declared as in the kernel
9434 rp="What is the type used for lseek's offset on this system?"
9435 set off_t lseektype long stdio.h sys/types.h
9436 eval $typedef_ask
9437
9438 echo " "
9439 echo "Checking to see how big your file offsets are..." >&4
9440 $cat >try.c <<EOCP
9441 #include <sys/types.h>
9442 #include <stdio.h>
9443 int main()
9444 {
9445     printf("%d\n", (int)sizeof($lseektype));
9446     return(0);
9447 }
9448 EOCP
9449 set try
9450 if eval $compile_ok; then
9451         lseeksize=`$run ./try`
9452         echo "Your file offsets are $lseeksize bytes long."
9453 else
9454         dflt=$longsize
9455         echo " "
9456         echo "(I can't seem to compile the test program.  Guessing...)"
9457         rp="What is the size of your file offsets (in bytes)?"
9458         . ./myread
9459         lseeksize="$ans"
9460 fi
9461 $rm_try
9462
9463 : see what type file positions are declared as in the library
9464 rp="What is the type for file position used by fsetpos()?"
9465 set fpos_t fpostype long stdio.h sys/types.h
9466 eval $typedef_ask
9467
9468 : Check size for Fpos_t
9469 echo " "
9470 case "$fpostype" in
9471 *_t) zzz="$fpostype"    ;;
9472 *)   zzz="fpos_t"       ;;
9473 esac
9474 echo "Checking the size of $zzz..." >&4
9475 cat > try.c <<EOCP
9476 #include <sys/types.h>
9477 #include <stdio.h>
9478 #$i_stdlib I_STDLIB
9479 #ifdef I_STDLIB
9480 #include <stdlib.h>
9481 #endif
9482 int main() {
9483     printf("%d\n", (int)sizeof($fpostype));
9484     exit(0);
9485 }
9486 EOCP
9487 set try
9488 if eval $compile_ok; then
9489         yyy=`$run ./try`
9490         case "$yyy" in
9491         '')     fpossize=4
9492                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9493                 ;;
9494         *)      fpossize=$yyy
9495                 echo "Your $zzz is $fpossize bytes long."
9496                 ;;
9497         esac
9498 else
9499         dflt="$longsize"
9500         echo " " >&4
9501         echo "(I can't compile the test program.  Guessing...)" >&4
9502         rp="What is the size of your file positions (in bytes)?"
9503         . ./myread
9504         fpossize="$ans"
9505 fi
9506
9507 : Check for large file support
9508 # Backward compatibility (uselfs is deprecated).
9509 case "$uselfs" in
9510 "$define"|true|[yY]*)
9511         cat <<EOM >&4
9512
9513 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9514 EOM
9515         uselargefiles="$define"
9516         ;;
9517 esac
9518
9519 case "$lseeksize:$fpossize" in
9520 8:8) cat <<EOM
9521
9522 You can have files larger than 2 gigabytes.
9523 EOM
9524    val="$define" ;;
9525 *)    case "$uselargefiles" in
9526    "$undef"|false|[nN]*) dflt='n' ;;
9527    *)   dflt='y' ;;
9528    esac
9529    cat <<EOM
9530
9531 Perl can be built to understand large files (files larger than 2 gigabytes)
9532 on some systems.  To do so, Configure can be run with -Duselargefiles.
9533
9534 If this doesn't make any sense to you, just accept the default '$dflt'.
9535 EOM
9536    rp='Try to understand large files, if available?'
9537    . ./myread
9538    case "$ans" in
9539    y|Y)         val="$define" ;;
9540    *)           val="$undef"  ;;
9541    esac
9542    ;;
9543 esac
9544 set uselargefiles
9545 eval $setvar
9546 : Look for a hint-file generated 'call-back-unit'.  If the
9547 : user has specified that a large files perl is to be built,
9548 : we may need to set or change some other defaults.
9549 if $test -f uselargefiles.cbu; then
9550         echo "Your platform has some specific hints regarding large file builds, using them..."
9551         . ./uselargefiles.cbu
9552 fi
9553 case "$uselargefiles" in
9554 "$define")
9555         if $test -f uselargefiles.cbu; then
9556                 echo " "
9557                 echo "Rechecking to see how big your file offsets are..." >&4
9558                 $cat >try.c <<EOCP
9559 #include <sys/types.h>
9560 #include <stdio.h>
9561 int main()
9562 {
9563     printf("%d\n", (int)sizeof($lseektype));
9564     return(0);
9565 }
9566 EOCP
9567                 set try
9568                 if eval $compile_ok; then
9569                         lseeksize=`$run ./try`
9570                         $echo "Your file offsets are now $lseeksize bytes long."
9571                 else
9572                         dflt="$lseeksize"
9573                         echo " "
9574                         echo "(I can't seem to compile the test program.  Guessing...)"
9575                         rp="What is the size of your file offsets (in bytes)?"
9576                         . ./myread
9577                         lseeksize="$ans"
9578                 fi
9579                 case "$fpostype" in
9580                 *_t) zzz="$fpostype"    ;;
9581                 *)   zzz="fpos_t"       ;;
9582                 esac
9583                 $echo $n "Rechecking the size of $zzz...$c" >&4
9584                 $cat > try.c <<EOCP
9585 #include <sys/types.h>
9586 #include <stdio.h>
9587 #$i_stdlib I_STDLIB
9588 #ifdef I_STDLIB
9589 #include <stdlib.h>
9590 #endif
9591 int main() {
9592     printf("%d\n", (int)sizeof($fpostype));
9593     return(0);
9594 }
9595 EOCP
9596                 set try
9597                 if eval $compile_ok; then
9598                         yyy=`$run ./try`
9599                         dflt="$lseeksize"
9600                         case "$yyy" in
9601                         '')     echo " "
9602                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9603                                 ;;
9604                         *)      fpossize=$yyy
9605                                 echo " $fpossize bytes." >&4
9606                                 ;;
9607                         esac
9608                 else
9609                         dflt="$fpossize"
9610                         echo " "
9611                         echo "(I can't compile the test program.  Guessing...)" >&4
9612                         rp="What is the size of your file positions (in bytes)?"
9613                         . ./myread
9614                         fpossize="$ans"
9615                 fi
9616                 $rm_try
9617         fi
9618         ;;
9619 esac
9620
9621 : Check if we want perlio
9622 useperlio="$define"
9623
9624 : Set the vendorbin variables
9625 case "$vendorprefix" in
9626 '')     d_vendorbin="$undef"
9627         vendorbin=''
9628         vendorbinexp=''
9629         ;;
9630 *)      d_vendorbin="$define"
9631         : determine where vendor-supplied executables go.
9632         case "$vendorbin" in
9633         '') dflt=$vendorprefix/bin ;;
9634         *)      dflt="$vendorbin" ;;
9635         esac
9636         fn=d~+
9637         rp='Pathname for the vendor-supplied executables directory?'
9638         . ./getfile
9639         vendorbin="$ans"
9640         vendorbinexp="$ansexp"
9641         ;;
9642 esac
9643 prefixvar=vendorbin
9644 . ./installprefix
9645
9646 : Set the vendorhtml1dir variables
9647 case "$vendorprefix" in
9648 '')     vendorhtml1dir=''
9649         vendorhtml1direxp=''
9650         ;;
9651 *)      : determine where vendor-supplied html pages go.
9652         : There is no standard location, so try to copy the previously-selected
9653         : directory structure for the core html pages.
9654         : XXX Better default suggestions would be welcome.
9655         case "$vendorhtml1dir" in
9656         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9657         *)      dflt=$vendorhtml1dir ;;
9658         esac
9659         case "$dflt" in
9660         ''|' ') dflt=none ;;
9661         esac
9662         fn=dn+~
9663         rp='Pathname for the vendor-supplied html pages?'
9664         . ./getfile
9665         vendorhtml1dir="$ans"
9666         vendorhtml1direxp="$ansexp"
9667         ;;
9668 esac
9669 : Use ' ' for none so value is preserved next time through Configure
9670 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9671 prefixvar=vendorhtml1dir
9672 . ./installprefix
9673
9674 : Set the vendorhtml3dir variables
9675 case "$vendorprefix" in
9676 '')     vendorhtml3dir=''
9677         vendorhtml3direxp=''
9678         ;;
9679 *)      : determine where vendor-supplied module html pages go.
9680         : There is no standard location, so try to copy the previously-selected
9681         : directory structure for the core html pages.
9682         : XXX Better default suggestions would be welcome.
9683         case "$vendorhtml3dir" in
9684         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9685         *)      dflt=$vendorhtml3dir ;;
9686         esac
9687         case "$dflt" in
9688         ''|' ') dflt=none ;;
9689         esac
9690         fn=dn+~
9691         rp='Pathname for the vendor-supplied html pages?'
9692         . ./getfile
9693         vendorhtml3dir="$ans"
9694         vendorhtml3direxp="$ansexp"
9695         ;;
9696 esac
9697 : Use ' ' for none so value is preserved next time through Configure
9698 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9699 prefixvar=vendorhtml3dir
9700 . ./installprefix
9701
9702 : Set the vendorman1dir variables
9703 case "$vendorprefix" in
9704 '')     vendorman1dir=''
9705         vendorman1direxp=''
9706         ;;
9707 *)      : determine where vendor-supplied manual pages go.
9708         case "$vendorman1dir" in
9709         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9710         *)      dflt=$vendorman1dir ;;
9711         esac
9712         case "$dflt" in
9713         ''|' ') dflt=none ;;
9714         esac
9715         fn=nd~+
9716         rp='Pathname for the vendor-supplied manual section 1 pages?'
9717         . ./getfile
9718         vendorman1dir="$ans"
9719         vendorman1direxp="$ansexp"
9720         ;;
9721 esac
9722 : Use ' ' for none so value is preserved next time through Configure
9723 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9724 prefixvar=vendorman1dir
9725 . ./installprefix
9726
9727 : Set the vendorman3dir variables
9728 case "$vendorprefix" in
9729 '')     vendorman3dir=''
9730         vendorman3direxp=''
9731         ;;
9732 *)      : determine where vendor-supplied module manual pages go.
9733         case "$vendorman3dir" in
9734         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9735         *)      dflt=$vendorman3dir ;;
9736         esac
9737         case "$dflt" in
9738         ''|' ') dflt=none ;;
9739         esac
9740         fn=nd~+
9741         rp='Pathname for the vendor-supplied manual section 3 pages?'
9742         . ./getfile
9743         vendorman3dir="$ans"
9744         vendorman3direxp="$ansexp"
9745         ;;
9746 esac
9747 : Use ' ' for none so value is preserved next time through Configure
9748 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9749 prefixvar=vendorman3dir
9750 . ./installprefix
9751
9752 : Set the vendorscript variables
9753 case "$vendorprefix" in
9754 '')     d_vendorscript="$undef"
9755         vendorscript=''
9756         vendorscriptexp=''
9757         ;;
9758 *)      d_vendorscript="$define"
9759         : determine where vendor-supplied scripts go.
9760         case "$vendorscript" in
9761         '')     dflt=$vendorprefix/script
9762                 $test -d $dflt || dflt=$vendorbin ;;
9763         *)  dflt="$vendorscript" ;;
9764         esac
9765         $cat <<EOM
9766
9767 The installation process will create a directory for
9768 vendor-supplied scripts.
9769
9770 EOM
9771         fn=d~+
9772         rp='Pathname for the vendor-supplied scripts directory?'
9773         . ./getfile
9774         vendorscript="$ans"
9775         vendorscriptexp="$ansexp"
9776         ;;
9777 esac
9778 prefixvar=vendorscript
9779 . ./installprefix
9780
9781 : script used to emit important warnings
9782 cat >warn <<EOS
9783 $startsh
9784 if test \$# -gt 0; then
9785         echo "\$@" >msg
9786 else
9787         cat >msg
9788 fi
9789 echo "*** WARNING:" >&4
9790 sed -e 's/^/*** /' <msg >&4
9791 echo "*** " >&4
9792 cat msg >>config.msg
9793 echo " " >>config.msg
9794 rm -f msg
9795 EOS
9796 chmod +x warn
9797 $eunicefix warn
9798
9799 : see which of string.h or strings.h is needed
9800 echo " "
9801 strings=`./findhdr string.h`
9802 if $test "$strings" && $test -r "$strings"; then
9803         echo "Using <string.h> instead of <strings.h>." >&4
9804         val="$define"
9805 else
9806         val="$undef"
9807         strings=`./findhdr strings.h`
9808         if $test "$strings" && $test -r "$strings"; then
9809                 echo "Using <strings.h> instead of <string.h>." >&4
9810         else
9811                 ./warn "No string header found -- You'll surely have problems."
9812         fi
9813 fi
9814 set i_string
9815 eval $setvar
9816 case "$i_string" in
9817 "$undef") strings=`./findhdr strings.h`;;
9818 *)        strings=`./findhdr string.h`;;
9819 esac
9820
9821 : see if qgcvt exists
9822 set qgcvt d_qgcvt
9823 eval $inlibc
9824
9825 : Check print/scan long double stuff
9826 echo " "
9827
9828 if $test X"$d_longdbl" = X"$define"; then
9829
9830 echo "Checking how to print long doubles..." >&4
9831
9832 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9833         $cat >try.c <<'EOCP'
9834 #include <sys/types.h>
9835 #include <stdio.h>
9836 int main() {
9837   double d = 123.456;
9838   printf("%.3f\n", d);
9839 }
9840 EOCP
9841         set try
9842         if eval $compile; then
9843                 yyy=`$run ./try`
9844                 case "$yyy" in
9845                 123.456)
9846                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9847                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9848                         echo "We will use %f."
9849                         ;;
9850                 esac
9851         fi
9852 fi
9853
9854 if $test X"$sPRIfldbl" = X; then
9855         $cat >try.c <<'EOCP'
9856 #include <sys/types.h>
9857 #include <stdio.h>
9858 int main() {
9859   long double d = 123.456;
9860   printf("%.3Lf\n", d);
9861 }
9862 EOCP
9863         set try
9864         if eval $compile; then
9865                 yyy=`$run ./try`
9866                 case "$yyy" in
9867                 123.456)
9868                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9869                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9870                         echo "We will use %Lf."
9871                         ;;
9872                 esac
9873         fi
9874 fi
9875
9876 if $test X"$sPRIfldbl" = X; then
9877         $cat >try.c <<'EOCP'
9878 #include <sys/types.h>
9879 #include <stdio.h>
9880 int main() {
9881   long double d = 123.456;
9882   printf("%.3llf\n", d);
9883 }
9884 EOCP
9885         set try
9886         if eval $compile; then
9887                 yyy=`$run ./try`
9888                 case "$yyy" in
9889                 123.456)
9890                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9891                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9892                         echo "We will use %llf."
9893                         ;;
9894                 esac
9895         fi
9896 fi
9897
9898 if $test X"$sPRIfldbl" = X; then
9899         $cat >try.c <<'EOCP'
9900 #include <sys/types.h>
9901 #include <stdio.h>
9902 int main() {
9903   long double d = 123.456;
9904   printf("%.3lf\n", d);
9905 }
9906 EOCP
9907         set try
9908         if eval $compile; then
9909                 yyy=`$run ./try`
9910                 case "$yyy" in
9911                 123.456)
9912                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9913                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9914                         echo "We will use %lf."
9915                         ;;
9916                 esac
9917         fi
9918 fi
9919
9920 if $test X"$sPRIfldbl" = X; then
9921         echo "Cannot figure out how to print long doubles." >&4
9922 else
9923         sSCNfldbl=$sPRIfldbl    # expect consistency
9924 fi
9925
9926 $rm_try
9927
9928 fi # d_longdbl
9929
9930 case "$sPRIfldbl" in
9931 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9932         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9933         d_SCNfldbl="$undef";
9934         ;;
9935 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9936         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9937         d_SCNfldbl="$define";
9938         ;;
9939 esac
9940
9941 : Check how to convert floats to strings.
9942
9943 if test "X$d_Gconvert" = X; then
9944
9945 echo " "
9946 echo "Checking for an efficient way to convert floats to strings."
9947 echo " " > try.c
9948 case "$uselongdouble" in
9949 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9950 esac
9951 case "$d_longdbl" in
9952 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9953 esac
9954 case "$d_PRIgldbl" in
9955 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9956 esac
9957 $cat >>try.c <<EOP
9958 #ifdef TRY_gconvert
9959 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9960 char *myname = "gconvert";
9961 #endif
9962 #ifdef TRY_gcvt
9963 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9964 char *myname = "gcvt";
9965 #endif
9966 #ifdef TRY_qgcvt
9967 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9968 char *myname = "qgcvt";
9969 #define DOUBLETYPE long double
9970 #endif
9971 #ifdef TRY_sprintf
9972 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9973 #ifdef HAS_PRIgldbl
9974 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9975 #else
9976 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9977 #endif
9978 #else
9979 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9980 #endif
9981 char *myname = "sprintf";
9982 #endif
9983
9984 #ifndef DOUBLETYPE
9985 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9986 #define DOUBLETYPE long double
9987 #else
9988 #define DOUBLETYPE double
9989 #endif
9990 #endif
9991
9992 #include <stdio.h>
9993
9994 #$i_stdlib I_STDLIB
9995 #ifdef I_STDLIB
9996 #include <stdlib.h>
9997 #endif
9998 #$i_string I_STRING
9999 #ifdef I_STRING
10000 #  include <string.h>
10001 #else
10002 #  include <strings.h>
10003 #endif
10004
10005 int checkit(char *expect, char *got)
10006 {
10007     if (strcmp(expect, got)) {
10008                 printf("%s oddity:  Expected %s, got %s\n",
10009                         myname, expect, got);
10010                 exit(1);
10011         }
10012 }
10013
10014 int main()
10015 {
10016         char buf[64];
10017         buf[63] = '\0';
10018
10019         /* This must be 1st test on (which?) platform */
10020         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10021         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10022         checkit("0.1", buf);
10023
10024         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10025         checkit("0.01", buf);
10026
10027         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10028         checkit("0.001", buf);
10029
10030         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10031         checkit("0.0001", buf);
10032
10033         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10034         if (strlen(buf) > 5)
10035             checkit("9e-005", buf); /* for Microsoft ?? */
10036         else
10037             checkit("9e-05", buf);
10038
10039         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10040         checkit("1", buf);
10041
10042         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10043         checkit("1.1", buf);
10044
10045         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10046         checkit("1.01", buf);
10047
10048         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10049         checkit("1.001", buf);
10050
10051         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10052         checkit("1.0001", buf);
10053
10054         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10055         checkit("1.00001", buf);
10056
10057         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10058         checkit("1.000001", buf);
10059
10060         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10061         checkit("0", buf);
10062
10063         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10064         checkit("-1", buf);
10065
10066         /* Some Linux gcvt's give 1.e+5 here. */
10067         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10068         checkit("100000", buf);
10069
10070         /* Some Linux gcvt's give -1.e+5 here. */
10071         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10072         checkit("-100000", buf);
10073
10074         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10075         checkit("123.456", buf);
10076
10077         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10078         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10079         /* 34 should be enough to scare even long double
10080          * places into using the e notation. */
10081         if (strlen(buf) > 5)
10082             checkit("1e+034", buf); /* for Microsoft */
10083         else
10084             checkit("1e+34", buf);
10085
10086         /* For Perl, if you add additional tests here, also add them to
10087          * t/base/num.t for benefit of platforms not using Configure or
10088          * overriding d_Gconvert */
10089
10090         exit(0);
10091 }
10092 EOP
10093 : first add preferred functions to our list
10094 xxx_list=""
10095 for xxx_convert in $gconvert_preference; do
10096     case $xxx_convert in
10097     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10098     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10099     esac
10100 done
10101 : then add any others
10102 for xxx_convert in gconvert gcvt sprintf; do
10103     case "$xxx_list" in
10104     *$xxx_convert*) ;;
10105     *) xxx_list="$xxx_list $xxx_convert" ;;
10106     esac
10107 done
10108
10109 case "$d_longdbl$uselongdouble" in
10110 "$define$define")
10111     : again, add preferred functions to our list first
10112     xxx_ld_list=""
10113     for xxx_convert in $gconvert_ld_preference; do
10114         case $xxx_convert in
10115         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10116         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10117         esac
10118     done
10119     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10120     for xxx_convert in qgcvt sprintf $xxx_list; do
10121         case "$xxx_ld_list" in
10122         $xxx_convert*|*" $xxx_convert"*) ;;
10123         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10124         esac
10125     done
10126     : if sprintf cannot do long doubles, move it to the end
10127     if test "$d_PRIgldbl" != "$define"; then
10128         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10129     fi
10130     : if no qgcvt, remove it
10131     if test "$d_qgcvt" != "$define"; then
10132         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10133     fi
10134     : use the ld_list
10135     xxx_list="$xxx_ld_list"
10136     ;;
10137 esac
10138
10139 for xxx_convert in $xxx_list; do
10140         echo "Trying $xxx_convert..."
10141         $rm -f try try$_o core
10142         set try -DTRY_$xxx_convert
10143         if eval $compile; then
10144                 echo "$xxx_convert() found." >&4
10145                 if $run ./try; then
10146                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10147                         break;
10148                 else
10149                         echo "...But $xxx_convert didn't work as I expected."
10150                         xxx_convert=''
10151                 fi
10152         else
10153                 echo "$xxx_convert NOT found." >&4
10154         fi
10155 done
10156
10157 if test X$xxx_convert = X; then
10158     echo "*** WHOA THERE!!! ***" >&4
10159     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10160     xxx_convert=sprintf
10161 fi
10162
10163 case "$xxx_convert" in
10164 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10165 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10166 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10167 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10168    "$define$define$define")
10169       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10170    "$define$define$undef")
10171       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10172    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10173    esac
10174    ;;
10175 esac
10176
10177 fi
10178 $rm_try
10179
10180 : see if _fwalk exists
10181 set fwalk d__fwalk
10182 eval $inlibc
10183
10184 : Initialize h_fcntl
10185 h_fcntl=false
10186
10187 : Initialize h_sysfile
10188 h_sysfile=false
10189
10190 : access call always available on UNIX
10191 set access d_access
10192 eval $inlibc
10193
10194 : locate the flags for 'access()'
10195 case "$d_access" in
10196 "$define")
10197         echo " "
10198         $cat >access.c <<EOCP
10199 #include <sys/types.h>
10200 #ifdef I_FCNTL
10201 #include <fcntl.h>
10202 #endif
10203 #ifdef I_SYS_FILE
10204 #include <sys/file.h>
10205 #endif
10206 #ifdef I_UNISTD
10207 #include <unistd.h>
10208 #endif
10209 #$i_stdlib I_STDLIB
10210 #ifdef I_STDLIB
10211 #include <stdlib.h>
10212 #endif
10213 int main() {
10214         exit(R_OK);
10215 }
10216 EOCP
10217         : check sys/file.h first, no particular reason here
10218         if $test `./findhdr sys/file.h` && \
10219                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10220                 h_sysfile=true;
10221                 echo "<sys/file.h> defines the *_OK access constants." >&4
10222         elif $test `./findhdr fcntl.h` && \
10223                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10224                 h_fcntl=true;
10225                 echo "<fcntl.h> defines the *_OK access constants." >&4
10226         elif $test `./findhdr unistd.h` && \
10227                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10228                 echo "<unistd.h> defines the *_OK access constants." >&4
10229         else
10230                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10231         fi
10232         ;;
10233 esac
10234 $rm -f access*
10235
10236 : see if accessx exists
10237 set accessx d_accessx
10238 eval $inlibc
10239
10240 : see if aintl exists
10241 set aintl d_aintl
10242 eval $inlibc
10243
10244 : see if alarm exists
10245 set alarm d_alarm
10246 eval $inlibc
10247
10248 : see if 64bit time functions exists
10249
10250 set ctime64 d_ctime64
10251 eval $inlibc
10252
10253 set localtime64 d_localtime64
10254 eval $inlibc
10255
10256 set gmtime64 d_gmtime64
10257 eval $inlibc
10258
10259 set mktime64 d_mktime64
10260 eval $inlibc
10261
10262 set difftime64 d_difftime64
10263 eval $inlibc
10264
10265 set asctime64 d_asctime64
10266 eval $inlibc
10267
10268 : see if POSIX threads are available
10269 set pthread.h i_pthread
10270 eval $inhdr
10271
10272 : define a function to check prototypes
10273 $cat > protochk <<EOSH
10274 $startsh
10275 cc="$cc"
10276 optimize="$optimize"
10277 ccflags="$ccflags"
10278 prototype="$prototype"
10279 define="$define"
10280 rm_try="$rm_try"
10281 usethreads=$usethreads
10282 i_pthread=$i_pthread
10283 pthread_h_first=$pthread_h_first
10284 EOSH
10285
10286 $cat >> protochk <<'EOSH'
10287
10288 $rm_try
10289 foo="$1"
10290 shift
10291 while test $# -ge 2; do
10292         case "$1" in
10293                 $define) echo "#include <$2>" >> try.c ;;
10294                 literal) echo "$2" >> try.c ;;
10295         esac
10296     # Extra magic for the benefit of systems that need pthread.h
10297     # to be included early to correctly detect threadsafe functions.
10298     # Such functions must guarantee themselves, though, that the usethreads
10299     # and i_pthread have been defined, before calling protochk.
10300     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10301         echo "#include <pthread.h>" >> try.c
10302         pthread_h_done=yes
10303     fi
10304     shift 2
10305 done
10306 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10307 cat >> try.c <<'EOCP'
10308 #ifdef CAN_PROTOTYPE
10309 #define _(args) args
10310 #else
10311 #define _(args) ()
10312 #endif
10313 EOCP
10314 echo "$foo" >> try.c
10315 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10316 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10317 status=$?
10318 $rm_try
10319 exit $status
10320 EOSH
10321 chmod +x protochk
10322 $eunicefix protochk
10323
10324 : Define hasproto macro for Configure internal use
10325 hasproto='varname=$1; func=$2; shift; shift;
10326 while $test $# -ge 2; do
10327         case "$1" in
10328         $define) echo "#include <$2>";;
10329         esac ;
10330     shift 2;
10331 done > try.c;
10332 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10333 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10334         echo "$func() prototype found.";
10335         val="$define";
10336 else
10337         echo "$func() prototype NOT found.";
10338         val="$undef";
10339 fi;
10340 set $varname;
10341 eval $setvar;
10342 $rm_try tryout.c'
10343
10344 : see if sys/types.h has to be included
10345 set sys/types.h i_systypes
10346 eval $inhdr
10347
10348 : see if sys/select.h has to be included
10349 set sys/select.h i_sysselct
10350 eval $inhdr
10351
10352 : Define hasfield macro for Configure internal use
10353 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10354 while $test $# -ge 2; do
10355         case "$1" in
10356         $define) echo "#include <$2>";;
10357         esac ;
10358     shift 2;
10359 done > try.c;
10360 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10361 set try;
10362 if eval $compile; then
10363         val="$define";
10364 else
10365         val="$undef";
10366 fi;
10367 set $varname;
10368 eval $setvar;
10369 $rm_try'
10370
10371 : see if we should include time.h, sys/time.h, or both
10372 echo " "
10373 if test "X$timeincl" = X; then
10374         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10375         $echo $n "I'm now running the test program...$c"
10376         $cat >try.c <<EOCP
10377 #include <sys/types.h>
10378 #ifdef I_TIME
10379 #include <time.h>
10380 #endif
10381 #ifdef I_SYSTIME
10382 #ifdef SYSTIMEKERNEL
10383 #define KERNEL
10384 #endif
10385 #include <sys/time.h>
10386 #endif
10387 #ifdef I_SYSSELECT
10388 #include <sys/select.h>
10389 #endif
10390 #$i_stdlib I_STDLIB
10391 #ifdef I_STDLIB
10392 #include <stdlib.h>
10393 #endif
10394 int main()
10395 {
10396         struct tm foo;
10397 #ifdef S_TIMEVAL
10398         struct timeval bar;
10399 #endif
10400 #ifdef S_TIMEZONE
10401         struct timezone tzp;
10402 #endif
10403         if (foo.tm_sec == foo.tm_sec)
10404                 exit(0);
10405 #ifdef S_TIMEVAL
10406         if (bar.tv_sec == bar.tv_sec)
10407                 exit(0);
10408 #endif
10409         exit(1);
10410 }
10411 EOCP
10412         flags=''
10413         for s_timezone in '-DS_TIMEZONE' ''; do
10414         sysselect=''
10415         for s_timeval in '-DS_TIMEVAL' ''; do
10416         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10417         for i_time in '' '-DI_TIME'; do
10418         for i_systime in '-DI_SYSTIME' ''; do
10419                 case "$flags" in
10420                 '') $echo $n ".$c"
10421                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10422                         if eval $compile; then
10423                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10424                                 shift
10425                                 flags="$*"
10426                                 echo " "
10427                                 $echo $n "Succeeded with $flags$c"
10428                         fi
10429                         ;;
10430                 esac
10431         done
10432         done
10433         done
10434         done
10435         done
10436         timeincl=''
10437         echo " "
10438         case "$flags" in
10439         *SYSTIMEKERNEL*) i_systimek="$define"
10440                 timeincl=`./findhdr sys/time.h`
10441                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10442         *) i_systimek="$undef";;
10443         esac
10444         case "$flags" in
10445         *I_TIME*) i_time="$define"
10446                 timeincl=`./findhdr time.h`" $timeincl"
10447                 echo "We'll include <time.h>." >&4;;
10448         *) i_time="$undef";;
10449         esac
10450         case "$flags" in
10451         *I_SYSTIME*) i_systime="$define"
10452                 timeincl=`./findhdr sys/time.h`" $timeincl"
10453                 echo "We'll include <sys/time.h>." >&4;;
10454         *) i_systime="$undef";;
10455         esac
10456         $rm_try
10457 fi
10458 : see if struct tm knows about tm_zone
10459 case "$i_systime$i_time" in
10460 *$define*)
10461         echo " "
10462         echo "Checking to see if your struct tm has tm_zone field..." >&4
10463         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10464         eval $hasfield
10465         ;;
10466 *)      val="$undef"
10467         set d_tm_tm_zone
10468         eval $setvar
10469         ;;
10470 esac
10471 case "$d_tm_tm_zone" in
10472 "$define")      echo "Yes, it does."   ;;
10473 *)              echo "No, it doesn't." ;;
10474 esac
10475 : see if struct tm knows about tm_gmtoff
10476 case "$i_systime$i_time" in
10477 *$define*)
10478         echo " "
10479         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10480         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10481         eval $hasfield
10482         ;;
10483 *)      val="$undef"
10484         set d_tm_tm_gmtoff
10485         eval $setvar
10486         ;;
10487 esac
10488 case "$d_tm_tm_gmtoff" in
10489 "$define")      echo "Yes, it does."   ;;
10490 *)              echo "No, it doesn't." ;;
10491 esac
10492
10493 : see if asctime_r exists
10494 set asctime_r d_asctime_r
10495 eval $inlibc
10496 case "$d_asctime_r" in
10497 "$define")
10498         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10499         case "$d_asctime_r_proto:$usethreads" in
10500         ":define")      d_asctime_r_proto=define
10501                 set d_asctime_r_proto asctime_r $hdrs
10502                 eval $hasproto ;;
10503         *)      ;;
10504         esac
10505         case "$d_asctime_r_proto" in
10506         define)
10507         case "$asctime_r_proto" in
10508         ''|0) try='char* asctime_r(const struct tm*, char*);'
10509         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10510         esac
10511         case "$asctime_r_proto" in
10512         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10513         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10514         esac
10515         case "$asctime_r_proto" in
10516         ''|0) try='int asctime_r(const struct tm*, char*);'
10517         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10518         esac
10519         case "$asctime_r_proto" in
10520         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10521         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10522         esac
10523         case "$asctime_r_proto" in
10524         ''|0)   d_asctime_r=undef
10525                 asctime_r_proto=0
10526                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10527         * )     case "$asctime_r_proto" in
10528                 REENTRANT_PROTO*) ;;
10529                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10530                 esac
10531                 echo "Prototype: $try" ;;
10532         esac
10533         ;;
10534         *)      case "$usethreads" in
10535                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10536                 esac
10537                 d_asctime_r=undef
10538                 asctime_r_proto=0
10539                 ;;
10540         esac
10541         ;;
10542 *)      asctime_r_proto=0
10543         ;;
10544 esac
10545
10546 : see if atolf exists
10547 set atolf d_atolf
10548 eval $inlibc
10549
10550 : see if atoll exists
10551 set atoll d_atoll
10552 eval $inlibc
10553
10554 : Look for GCC-style attribute format
10555 case "$d_attribute_format" in
10556 '')
10557 echo " "
10558 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10559 $cat >attrib.c <<'EOCP'
10560 #include <stdio.h>
10561 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10562 EOCP
10563 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10564         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10565                 echo "Your C compiler doesn't support __attribute__((format))."
10566                 val="$undef"
10567         else
10568                 echo "Your C compiler supports __attribute__((format))."
10569                 val="$define"
10570         fi
10571 else
10572         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10573         val="$undef"
10574 fi
10575 ;;
10576 *) val="$d_attribute_format" ;;
10577 esac
10578 set d_attribute_format
10579 eval $setvar
10580 $rm -f attrib*
10581
10582 : Look for GCC-style attribute format with null format allowed
10583 case "$d_printf_format_null" in
10584 '') case "$d_attribute_format" in
10585     $define)
10586         echo " "
10587         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10588 $cat >attrib.c <<EOCP
10589 #include <stdio.h>
10590 #$i_stdlib I_STDLIB
10591 #ifdef I_STDLIB
10592 #include <stdlib.h>
10593 #endif
10594 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10595 int null_printf (char* pat,...) { return (int)pat; }
10596 int main () { exit(null_printf(NULL)); }
10597 EOCP
10598         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10599             : run the executable in case it produces a run-time warning
10600             if $run ./attrib >>attrib.out 2>&1; then
10601                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10602                     echo "Your C compiler doesn't allow __printf__ format to be null."
10603                     val="$undef"
10604                 else
10605                     echo "Your C compiler allows __printf__ format to be null."
10606                     val="$define"
10607                 fi
10608             else
10609             echo "Your C compiler executable failed with __printf__ format null."
10610             val="$undef"
10611         fi
10612     else
10613         echo "Your C compiler fails with __printf__ format null."
10614         val="$undef"
10615     fi
10616     ;;
10617     *)  val="$undef" ;;
10618     esac
10619 ;;
10620 *)  val="$d_printf_format_null" ;;
10621 esac
10622 set d_printf_format_null
10623 eval $setvar
10624 $rm -f attrib*
10625
10626 : Look for GCC-style attribute malloc
10627 case "$d_attribute_malloc" in
10628 '')
10629 echo " "
10630 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10631 $cat >attrib.c <<'EOCP'
10632 #include <stdio.h>
10633 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10634 EOCP
10635 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10636         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10637                 echo "Your C compiler doesn't support __attribute__((malloc))."
10638                 val="$undef"
10639         else
10640                 echo "Your C compiler supports __attribute__((malloc))."
10641                 val="$define"
10642         fi
10643 else
10644         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10645         val="$undef"
10646 fi
10647 ;;
10648 *) val="$d_attribute_malloc" ;;
10649 esac
10650 set d_attribute_malloc
10651 eval $setvar
10652 $rm -f attrib*
10653
10654 : Look for GCC-style attribute nonnull
10655 case "$d_attribute_nonnull" in
10656 '')
10657 echo " "
10658 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10659 $cat >attrib.c <<'EOCP'
10660 #include <stdio.h>
10661 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10662 EOCP
10663 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10664         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10665                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10666                 val="$undef"
10667         else
10668                 echo "Your C compiler supports __attribute__((nonnull))."
10669                 val="$define"
10670         fi
10671 else
10672         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10673         val="$undef"
10674 fi
10675 ;;
10676 *) val="$d_attribute_nonnull" ;;
10677 esac
10678 set d_attribute_nonnull
10679 eval $setvar
10680 $rm -f attrib*
10681
10682 : Look for GCC-style attribute noreturn
10683 case "$d_attribute_noreturn" in
10684 '')
10685 echo " "
10686 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10687 $cat >attrib.c <<'EOCP'
10688 #include <stdio.h>
10689 void fall_over_dead( void ) __attribute__((noreturn));
10690 EOCP
10691 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10692         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10693                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10694                 val="$undef"
10695         else
10696                 echo "Your C compiler supports __attribute__((noreturn))."
10697                 val="$define"
10698         fi
10699 else
10700         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10701         val="$undef"
10702 fi
10703 ;;
10704 *) val="$d_attribute_noreturn" ;;
10705 esac
10706 set d_attribute_noreturn
10707 eval $setvar
10708 $rm -f attrib*
10709
10710 : Look for GCC-style attribute pure
10711 case "$d_attribute_pure" in
10712 '')
10713 echo " "
10714 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10715 $cat >attrib.c <<'EOCP'
10716 #include <stdio.h>
10717 int square( int n ) __attribute__((pure));
10718 EOCP
10719 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10720         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10721                 echo "Your C compiler doesn't support __attribute__((pure))."
10722                 val="$undef"
10723         else
10724                 echo "Your C compiler supports __attribute__((pure))."
10725                 val="$define"
10726         fi
10727 else
10728         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10729         val="$undef"
10730 fi
10731 ;;
10732 *) val="$d_attribute_pure" ;;
10733 esac
10734 set d_attribute_pure
10735 eval $setvar
10736 $rm -f attrib*
10737
10738 : Look for GCC-style attribute unused
10739 case "$d_attribute_unused" in
10740 '')
10741 echo " "
10742 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10743 $cat >attrib.c <<'EOCP'
10744 #include <stdio.h>
10745 int do_something( int dummy __attribute__((unused)), int n );
10746 EOCP
10747 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10748         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10749                 echo "Your C compiler doesn't support __attribute__((unused))."
10750                 val="$undef"
10751         else
10752                 echo "Your C compiler supports __attribute__((unused))."
10753                 val="$define"
10754         fi
10755 else
10756         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10757         val="$undef"
10758 fi
10759 ;;
10760 *) val="$d_attribute_unused" ;;
10761 esac
10762 set d_attribute_unused
10763 eval $setvar
10764 $rm -f attrib*
10765
10766 : Look for GCC-style attribute deprecated
10767 case "$d_attribute_deprecated" in
10768 '')
10769 echo " "
10770 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10771 $cat >attrib.c <<'EOCP'
10772 #include <stdio.h>
10773 int I_am_deprecated(void) __attribute__((deprecated));
10774 EOCP
10775 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10776         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10777                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10778                 val="$undef"
10779         else
10780                 echo "Your C compiler supports __attribute__((deprecated))."
10781                 val="$define"
10782         fi
10783 else
10784         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10785         val="$undef"
10786 fi
10787 ;;
10788 *) val="$d_attribute_deprecated" ;;
10789 esac
10790 set d_attribute_deprecated
10791 eval $setvar
10792 $rm -f attrib*
10793
10794 : Look for GCC-style attribute warn_unused_result
10795 case "$d_attribute_warn_unused_result" in
10796 '')
10797 echo " "
10798 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10799 $cat >attrib.c <<'EOCP'
10800 #include <stdio.h>
10801 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10802 EOCP
10803 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10804         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10805                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10806                 val="$undef"
10807         else
10808                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10809                 val="$define"
10810         fi
10811 else
10812         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10813         val="$undef"
10814 fi
10815 ;;
10816 *) val="$d_attribute_warn_unused_result" ;;
10817 esac
10818 set d_attribute_warn_unused_result
10819 eval $setvar
10820 $rm -f attrib*
10821
10822 : see if bcmp exists
10823 set bcmp d_bcmp
10824 eval $inlibc
10825
10826 : see if bcopy exists
10827 set bcopy d_bcopy
10828 eval $inlibc
10829
10830 : see if getpgrp exists
10831 set getpgrp d_getpgrp
10832 eval $inlibc
10833
10834 case "$d_getpgrp" in
10835 "$define")
10836         echo " "
10837         echo "Checking to see which flavor of getpgrp is in use..."
10838         $cat >try.c <<EOP
10839 #$i_unistd I_UNISTD
10840 #include <sys/types.h>
10841 #ifdef I_UNISTD
10842 #  include <unistd.h>
10843 #endif
10844 #$i_stdlib I_STDLIB
10845 #ifdef I_STDLIB
10846 #include <stdlib.h>
10847 #endif
10848 int main()
10849 {
10850         if (getuid() == 0) {
10851                 printf("(I see you are running Configure as super-user...)\n");
10852                 setuid(1);
10853         }
10854 #ifdef TRY_BSD_PGRP
10855         if (getpgrp(1) == 0)
10856                 exit(0);
10857 #else
10858         if (getpgrp() > 0)
10859                 exit(0);
10860 #endif
10861         exit(1);
10862 }
10863 EOP
10864         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10865                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10866                 val="$define"
10867         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10868                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10869                 val="$undef"
10870         else
10871                 echo "I can't seem to compile and run the test program."
10872                 if ./usg; then
10873                         xxx="a USG one, i.e. you use getpgrp()."
10874                 else
10875                         # SVR4 systems can appear rather BSD-ish.
10876                         case "$i_unistd" in
10877                         $undef)
10878                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10879                                 val="$define"
10880                                 ;;
10881                         $define)
10882                                 xxx="probably a USG one, i.e. you use getpgrp()."
10883                                 val="$undef"
10884                                 ;;
10885                         esac
10886                 fi
10887                 echo "Assuming your getpgrp is $xxx" >&4
10888         fi
10889         ;;
10890 *) val="$undef";;
10891 esac
10892 set d_bsdgetpgrp
10893 eval $setvar
10894 $rm_try
10895
10896 : see if setpgrp exists
10897 set setpgrp d_setpgrp
10898 eval $inlibc
10899
10900 case "$d_setpgrp" in
10901 "$define")
10902         echo " "
10903         echo "Checking to see which flavor of setpgrp is in use..."
10904         $cat >try.c <<EOP
10905 #$i_unistd I_UNISTD
10906 #include <sys/types.h>
10907 #ifdef I_UNISTD
10908 #  include <unistd.h>
10909 #endif
10910 #$i_stdlib I_STDLIB
10911 #ifdef I_STDLIB
10912 #include <stdlib.h>
10913 #endif
10914 int main()
10915 {
10916         if (getuid() == 0) {
10917                 printf("(I see you are running Configure as super-user...)\n");
10918                 setuid(1);
10919         }
10920 #ifdef TRY_BSD_PGRP
10921         if (-1 == setpgrp(1, 1))
10922                 exit(0);
10923 #else
10924         if (setpgrp() != -1)
10925                 exit(0);
10926 #endif
10927         exit(1);
10928 }
10929 EOP
10930         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10931                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10932                 val="$define"
10933         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10934                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10935                 val="$undef"
10936         else
10937                 echo "(I can't seem to compile and run the test program.)"
10938                 if ./usg; then
10939                         xxx="a USG one, i.e. you use setpgrp()."
10940                 else
10941                         # SVR4 systems can appear rather BSD-ish.
10942                         case "$i_unistd" in
10943                         $undef)
10944                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10945                                 val="$define"
10946                                 ;;
10947                         $define)
10948                                 xxx="probably a USG one, i.e. you use setpgrp()."
10949                                 val="$undef"
10950                                 ;;
10951                         esac
10952                 fi
10953                 echo "Assuming your setpgrp is $xxx" >&4
10954         fi
10955         ;;
10956 *) val="$undef";;
10957 esac
10958 set d_bsdsetpgrp
10959 eval $setvar
10960 $rm_try
10961
10962 : Look for GCC-style __builtin_choose_expr
10963 case "$d_builtin_choose_expr" in
10964 '')
10965     echo " "
10966     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10967     $cat >try.c <<'EOCP'
10968 #include <assert.h>
10969 #include <stdlib.h>
10970 #include <stdio.h>
10971
10972 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10973
10974 int main(void) {
10975     assert( SYRINX(1) == 2112 );
10976     assert( SYRINX(1) != 5150 );
10977     assert( SYRINX(0) == 5150 );
10978     assert( SYRINX(0) != 2112 );
10979     puts( "All good!" );
10980     exit(0);
10981 }
10982
10983 EOCP
10984     set try
10985     if eval $compile && $run ./try; then
10986         echo "Your C compiler supports __builtin_choose_expr."
10987         val="$define"
10988     else
10989         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10990         val="$undef"
10991     fi
10992 ;;
10993 *) val="$d_builtin_choose_expr" ;;
10994 esac
10995
10996 set d_builtin_choose_expr
10997 eval $setvar
10998 $rm_try
10999
11000 : Look for GCC-style __builtin_expect
11001 case "$d_builtin_expect" in
11002 '')
11003     echo " "
11004     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11005     $cat >try.c <<'EOCP'
11006 int main(void) {
11007     int n = 50;
11008     if ( __builtin_expect(n, 0) ) n = 1;
11009     /* Remember shell exit code truth is 0, C truth is non-zero */
11010     return !(n == 1);
11011 }
11012 EOCP
11013     set try
11014     if eval $compile && $run ./try; then
11015         echo "Your C compiler supports __builtin_expect."
11016         val="$define"
11017     else
11018         echo "Your C compiler doesn't seem to understand __builtin_expect."
11019         val="$undef"
11020     fi
11021     ;;
11022 *) val="$d_builtin_expect" ;;
11023 esac
11024
11025 set d_builtin_expect
11026 eval $setvar
11027 $rm_try
11028
11029 : see if bzero exists
11030 set bzero d_bzero
11031 eval $inlibc
11032
11033 : see if stdarg is available
11034 echo " "
11035 if $test `./findhdr stdarg.h`; then
11036         echo "<stdarg.h> found." >&4
11037         valstd="$define"
11038 else
11039         echo "<stdarg.h> NOT found." >&4
11040         valstd="$undef"
11041 fi
11042
11043 : see if varargs is available
11044 echo " "
11045 if $test `./findhdr varargs.h`; then
11046         echo "<varargs.h> found." >&4
11047 else
11048         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11049 fi
11050
11051 : set up the varargs testing programs
11052 $cat > varargs.c <<EOP
11053 #ifdef I_STDARG
11054 #include <stdarg.h>
11055 #endif
11056 #ifdef I_VARARGS
11057 #include <varargs.h>
11058 #endif
11059
11060 #ifdef I_STDARG
11061 int f(char *p, ...)
11062 #else
11063 int f(va_alist)
11064 va_dcl
11065 #endif
11066 {
11067         va_list ap;
11068 #ifndef I_STDARG
11069         char *p;
11070 #endif
11071 #ifdef I_STDARG
11072         va_start(ap,p);
11073 #else
11074         va_start(ap);
11075         p = va_arg(ap, char *);
11076 #endif
11077         va_end(ap);
11078         return 0;
11079 }
11080 EOP
11081 $cat > varargs <<EOP
11082 $startsh
11083 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11084         echo "true"
11085 else
11086         echo "false"
11087 fi
11088 $rm -f varargs$_o
11089 EOP
11090 chmod +x varargs
11091
11092 : now check which varargs header should be included
11093 echo " "
11094 i_varhdr=''
11095 val=''
11096 case "$valstd" in
11097 "$define")
11098         if `./varargs I_STDARG`; then
11099                 val='stdarg.h'
11100         elif `./varargs I_VARARGS`; then
11101                 val='varargs.h'
11102         fi
11103         ;;
11104 *)
11105         if `./varargs I_VARARGS`; then
11106                 val='varargs.h'
11107         fi
11108         ;;
11109 esac
11110 case "$val" in
11111 '')
11112         echo " "
11113         echo "*** WHOA THERE!!! ***" >&4
11114         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11115         case "$knowitall" in
11116         '')
11117         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11118                 exit 1
11119                 ;;
11120         esac
11121 echo "I could not find the definition for va_dcl... You have problems..." >&4
11122         val="$undef"; set i_stdarg; eval $setvar
11123         val="$undef"; set i_varargs; eval $setvar
11124         ;;
11125 *)
11126         set i_varhdr
11127         eval $setvar
11128         case "$i_varhdr" in
11129         stdarg.h)
11130                 val="$define"; set i_stdarg; eval $setvar
11131                 val="$undef"; set i_varargs; eval $setvar
11132                 ;;
11133         varargs.h)
11134                 val="$undef"; set i_stdarg; eval $setvar
11135                 val="$define"; set i_varargs; eval $setvar
11136                 ;;
11137         esac
11138         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11139 esac
11140 $rm -f varargs*
11141
11142 : see if the Compiler supports C99 variadic macros
11143 case "$i_stdarg$i_stdlib" in
11144     "$define$define")
11145     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11146     $cat >try.c <<EOCP
11147 #include <stdio.h>
11148 #include <stdarg.h>
11149
11150 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11151
11152 int main() {
11153   char buf[20];
11154   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11155   puts(buf);
11156   return 0;
11157 }
11158 EOCP
11159     set try
11160     if eval $compile && $run ./try 2>&1 >/dev/null; then
11161         case "`$run ./try`" in
11162             "123 456 789")
11163             echo "You have C99 variadic macros." >&4
11164             d_c99_variadic_macros="$define"
11165             ;;
11166             *)
11167             echo "You don't have functional C99 variadic macros." >&4
11168             d_c99_variadic_macros="$undef"
11169             ;;
11170         esac
11171     else
11172         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11173         d_c99_variadic_macros="$undef"
11174     fi
11175     $rm_try
11176     ;;
11177     *)
11178     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11179     d_c99_variadic_macros="$undef"
11180     ;;
11181 esac
11182
11183 : see if signal is declared as pointer to function returning int or void
11184 echo " "
11185 xxx=`./findhdr signal.h`
11186 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11187 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11188         echo "You have int (*signal())() instead of void." >&4
11189         val="$undef"
11190 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11191         echo "You have void (*signal())()." >&4
11192         val="$define"
11193 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11194         echo "You have int (*signal())() instead of void." >&4
11195         val="$undef"
11196 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11197         echo "You have void (*signal())()." >&4
11198         val="$define"
11199 else
11200         case "$d_voidsig" in
11201         '')
11202         echo "I can't determine whether signal handler returns void or int..." >&4
11203                 dflt=void
11204                 rp="What type does your signal handler return?"
11205                 . ./myread
11206                 case "$ans" in
11207                 v*) val="$define";;
11208                 *) val="$undef";;
11209                 esac;;
11210         "$define")
11211                 echo "As you already told me, signal handler returns void." >&4
11212                 val="$define"
11213                 ;;
11214         *)      echo "As you already told me, signal handler returns int." >&4
11215                 val="$undef"
11216                 ;;
11217         esac
11218 fi
11219 set d_voidsig
11220 eval $setvar
11221 case "$d_voidsig" in
11222 "$define") signal_t="void";;
11223 *) signal_t="int";;
11224 esac
11225 $rm -f $$.tmp
11226
11227 : check for ability to cast large floats to 32-bit ints.
11228 echo " "
11229 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11230 if $test "$intsize" -ge 4; then
11231         xxx=int
11232 else
11233         xxx=long
11234 fi
11235 $cat >try.c <<EOCP
11236 #include <stdio.h>
11237 #$i_stdlib I_STDLIB
11238 #ifdef I_STDLIB
11239 #include <stdlib.h>
11240 #endif
11241 #include <sys/types.h>
11242 #include <signal.h>
11243 $signal_t blech(int s) { exit(3); }
11244 int main()
11245 {
11246         $xxx i32;
11247         double f, g;
11248         int result = 0;
11249         char str[16];
11250         signal(SIGFPE, blech);
11251
11252         /* Don't let compiler optimize the test away.  Store the number
11253            in a writable string for gcc to pass to sscanf under HP-UX.
11254         */
11255         sprintf(str, "2147483647");
11256         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11257         g = 10 * f;
11258         i32  = ($xxx) g;
11259
11260         /* x86 processors will probably give 0x8000 0000, which is a
11261            sign change.  We don't want that.  We want to mimic SPARC
11262            behavior here, which is to preserve the sign and give
11263            back 0x7fff ffff.
11264         */
11265         if (i32 != ($xxx) f)
11266                 result |= 1;
11267         exit(result);
11268 }
11269 EOCP
11270 set try
11271 if eval $compile_ok; then
11272         $run ./try
11273         yyy=$?
11274 else
11275         echo "(I can't seem to compile the test program--assuming it can't)"
11276         yyy=1
11277 fi
11278 case "$yyy" in
11279 0)      val="$define"
11280         echo "Yup, it can."
11281         ;;
11282 *)      val="$undef"
11283         echo "Nope, it can't."
11284         ;;
11285 esac
11286 set d_casti32
11287 eval $setvar
11288 $rm_try
11289
11290 : check for ability to cast negative floats to unsigned
11291 echo " "
11292 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11293 $cat >try.c <<EOCP
11294 #include <stdio.h>
11295 #$i_stdlib I_STDLIB
11296 #ifdef I_STDLIB
11297 #include <stdlib.h>
11298 #endif
11299 #include <sys/types.h>
11300 #include <signal.h>
11301 $signal_t blech(int s) { exit(7); }
11302 $signal_t blech_in_list(int s) { exit(4); }
11303 unsigned long dummy_long(unsigned long p) { return p; }
11304 unsigned int dummy_int(unsigned int p) { return p; }
11305 unsigned short dummy_short(unsigned short p) { return p; }
11306 int main()
11307 {
11308         double f;
11309         unsigned long along;
11310         unsigned int aint;
11311         unsigned short ashort;
11312         int result = 0;
11313         char str[16];
11314
11315         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11316            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11317            optimized the whole file away
11318         */
11319         /* Store the number in a writable string for gcc to pass to
11320            sscanf under HP-UX.
11321         */
11322         sprintf(str, "-123");
11323         sscanf(str, "%lf", &f);  /* f = -123.; */
11324
11325         signal(SIGFPE, blech);
11326         along = (unsigned long)f;
11327         aint = (unsigned int)f;
11328         ashort = (unsigned short)f;
11329         if (along != (unsigned long)-123)
11330                 result |= 1;
11331         if (aint != (unsigned int)-123)
11332                 result |= 1;
11333         if (ashort != (unsigned short)-123)
11334                 result |= 1;
11335         sprintf(str, "1073741824.");
11336         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11337         f = f + f;
11338         along = 0;
11339         along = (unsigned long)f;
11340         if (along != 0x80000000)
11341                 result |= 2;
11342         f -= 1.;
11343         along = 0;
11344         along = (unsigned long)f;
11345         if (along != 0x7fffffff)
11346                 result |= 1;
11347         f += 2.;
11348         along = 0;
11349         along = (unsigned long)f;
11350         if (along != 0x80000001)
11351                 result |= 2;
11352         if (result)
11353                 exit(result);
11354         signal(SIGFPE, blech_in_list);
11355         sprintf(str, "123.");
11356         sscanf(str, "%lf", &f);  /* f = 123.; */
11357         along = dummy_long((unsigned long)f);
11358         aint = dummy_int((unsigned int)f);
11359         ashort = dummy_short((unsigned short)f);
11360         if (along != (unsigned long)123)
11361                 result |= 4;
11362         if (aint != (unsigned int)123)
11363                 result |= 4;
11364         if (ashort != (unsigned short)123)
11365                 result |= 4;
11366         exit(result);
11367
11368 }
11369 EOCP
11370 set try
11371 if eval $compile_ok; then
11372         $run ./try
11373         castflags=$?
11374 else
11375         echo "(I can't seem to compile the test program--assuming it can't)"
11376         castflags=7
11377 fi
11378 case "$castflags" in
11379 0)      val="$define"
11380         echo "Yup, it can."
11381         ;;
11382 *)      val="$undef"
11383         echo "Nope, it can't."
11384         ;;
11385 esac
11386 set d_castneg
11387 eval $setvar
11388 $rm_try
11389
11390 : see if vprintf exists
11391 echo " "
11392 if set vprintf val -f d_vprintf; eval $csym; $val; then
11393         echo 'vprintf() found.' >&4
11394         val="$define"
11395         $cat >try.c <<EOF
11396 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11397 #$i_varargs I_VARARGS
11398
11399 #$i_stdlib I_STDLIB
11400 #$i_unistd I_UNISTD
11401
11402 #ifdef I_STDARG
11403 #  include <stdarg.h>
11404 #else /* I_VARARGS */
11405 #  include <varargs.h>
11406 #endif
11407
11408 #ifdef I_UNISTD
11409 #  include <unistd.h>
11410 #endif
11411
11412 #ifdef I_STDLIB
11413 #  include <stdlib.h>
11414 #endif
11415
11416 #include <stdio.h> /* vsprintf prototype */
11417
11418 #ifdef I_STDARG
11419 void xxx(int n, ...)
11420 {
11421     va_list args;
11422     char buf[10];
11423     va_start(args, n);
11424     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11425 }
11426 int main() { xxx(1, "foo"); }
11427
11428 #else /* I_VARARGS */
11429
11430 xxx(va_alist)
11431 va_dcl
11432 {
11433     va_list args;
11434     char buf[10];
11435     va_start(args);
11436     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11437 }
11438 int main() { xxx("foo"); }
11439
11440 #endif
11441
11442 EOF
11443         set try
11444         if eval $compile_ok; then
11445                 if $run ./try; then
11446                         echo "Your vsprintf() returns (int)." >&4
11447                         val2="$undef"
11448                 else
11449                         echo "Your vsprintf() returns (char*)." >&4
11450                         val2="$define"
11451                 fi
11452         else
11453                 echo 'I am unable to compile the vsprintf() test program.' >&4
11454                 # We shouldn't get here.  If we do, assume the standard signature,
11455                 # not the old BSD one.
11456                 echo 'Guessing that vsprintf() returns (int).' >&4
11457                 val2="$undef"
11458         fi
11459 else
11460         echo 'vprintf() NOT found.' >&4
11461         val="$undef"
11462         val2="$undef"
11463 fi
11464 $rm_try
11465 set d_vprintf
11466 eval $setvar
11467 val=$val2
11468 set d_charvspr
11469 eval $setvar
11470
11471 : see if chown exists
11472 set chown d_chown
11473 eval $inlibc
11474
11475 : see if chroot exists
11476 set chroot d_chroot
11477 eval $inlibc
11478
11479 : see if chsize exists
11480 set chsize d_chsize
11481 eval $inlibc
11482
11483 : see if class exists
11484 set class d_class
11485 eval $inlibc
11486
11487 : see if clearenv exists
11488 set clearenv d_clearenv
11489 eval $inlibc
11490
11491 : Define hasstruct macro for Configure internal use
11492 hasstruct='varname=$1; struct=$2; shift; shift;
11493 while $test $# -ge 2; do
11494         case "$1" in
11495         $define) echo "#include <$2>";;
11496         esac ;
11497     shift 2;
11498 done > try.c;
11499 echo "int main () { struct $struct foo; }" >> try.c;
11500 set try;
11501 if eval $compile; then
11502         val="$define";
11503 else
11504         val="$undef";
11505 fi;
11506 set $varname;
11507 eval $setvar;
11508 $rm_try'
11509
11510 : see whether socket exists
11511 socketlib=''
11512 sockethdr=''
11513 echo " "
11514 $echo $n "Hmm... $c" >&4
11515 if set socket val -f d_socket; eval $csym; $val; then
11516     echo "Looks like you have Berkeley networking support." >&4
11517     d_socket="$define"
11518     if set setsockopt val -f; eval $csym; $val; then
11519         d_oldsock="$undef"
11520     else
11521         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11522         d_oldsock="$define"
11523     fi
11524 else
11525     if $contains socklib libc.list >/dev/null 2>&1; then
11526         echo "Looks like you have Berkeley networking support." >&4
11527         d_socket="$define"
11528         : we will have to assume that it supports the 4.2 BSD interface
11529         d_oldsock="$undef"
11530     else
11531         echo "You don't have Berkeley networking in libc$_a..." >&4
11532         if test "X$d_socket" = "X$define"; then
11533             echo "...but you seem to believe that you have sockets." >&4
11534         else
11535             for net in net socket
11536             do
11537                 if test -f $sysroot/usr/lib/lib$net$_a; then
11538                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11539                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11540                     if $contains socket libc.list >/dev/null 2>&1; then
11541                         d_socket="$define"
11542                         socketlib="-l$net"
11543                         case "$net" in
11544                         net)
11545                             echo "...but the Wollongong group seems to have hacked it in." >&4
11546                             sockethdr="-I$sysroot/usr/netinclude"
11547                             ;;
11548                         esac
11549                         echo "Found Berkeley sockets interface in lib$net." >&4
11550                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11551                             d_oldsock="$undef"
11552                         else
11553                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11554                             d_oldsock="$define"
11555                         fi
11556                         break
11557                     fi
11558                 fi
11559             done
11560             if test "X$d_socket" != "X$define"; then
11561                echo "or anywhere else I see." >&4
11562                d_socket="$undef"
11563                d_oldsock="$undef"
11564             fi
11565         fi
11566     fi
11567 fi
11568
11569 : see if socketpair exists
11570 set socketpair d_sockpair
11571 eval $inlibc
11572
11573
11574 echo " "
11575 echo "Checking the availability sa_len in the sock struct ..." >&4
11576 $cat >try.c <<EOF
11577 #include <sys/types.h>
11578 #include <sys/socket.h>
11579 int main() {
11580 struct sockaddr sa;
11581 return (sa.sa_len);
11582 }
11583 EOF
11584 val="$undef"
11585 set try; if eval $compile; then
11586     val="$define"
11587 fi
11588 set d_sockaddr_sa_len; eval $setvar
11589 $rm_try
11590
11591 echo " "
11592 echo "Checking the availability struct sockaddr_in6 ..." >&4
11593 $cat >try.c <<EOF
11594 #include <sys/types.h>
11595 #include <sys/socket.h>
11596 #include <netinet/in.h>
11597 int main() {
11598 struct sockaddr_in6 sin6;
11599 return (sin6.sin6_family);
11600 }
11601 EOF
11602 val="$undef"
11603 set try; if eval $compile; then
11604     val="$define"
11605 fi
11606 set d_sockaddr_in6; eval $setvar
11607 $rm_try
11608
11609 echo " "
11610 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11611 $cat >try.c <<EOF
11612 #include <sys/types.h>
11613 #include <sys/socket.h>
11614 #include <netinet/in.h>
11615 int main() {
11616 struct sockaddr_in6 sin6;
11617 return (sin6.sin6_scope_id);
11618 }
11619 EOF
11620 val="$undef"
11621 set try; if eval $compile; then
11622     val="$define"
11623 fi
11624 set d_sin6_scope_id; eval $setvar
11625 $rm_try
11626
11627 echo " "
11628 echo "Checking the availability struct ip_mreq ..." >&4
11629 $cat >try.c <<EOF
11630 #include <sys/types.h>
11631 #include <sys/socket.h>
11632 #include <netinet/in.h>
11633 int main() {
11634 struct ip_mreq mreq;
11635 return (mreq.imr_multiaddr.s_addr);
11636 }
11637 EOF
11638 val="$undef"
11639 set try; if eval $compile; then
11640        val="$define"
11641 fi
11642 set d_ip_mreq; eval $setvar
11643 $rm_try
11644
11645 echo " "
11646 echo "Checking the availability struct ip_mreq_source ..." >&4
11647 $cat >try.c <<EOF
11648 #include <sys/types.h>
11649 #include <sys/socket.h>
11650 #include <netinet/in.h>
11651 int main() {
11652 struct ip_mreq_source mreq;
11653 return (mreq.imr_multiaddr.s_addr);
11654 }
11655 EOF
11656 val="$undef"
11657 set try; if eval $compile; then
11658        val="$define"
11659 fi
11660 set d_ip_mreq_source; eval $setvar
11661 $rm_try
11662
11663 echo " "
11664 echo "Checking the availability struct ipv6_mreq ..." >&4
11665 $cat >try.c <<EOF
11666 #include <sys/types.h>
11667 #include <sys/socket.h>
11668 #include <netinet/in.h>
11669 int main() {
11670 struct ipv6_mreq mreq;
11671 return (mreq.ipv6mr_interface);
11672 }
11673 EOF
11674 val="$undef"
11675 set try; if eval $compile; then
11676     val="$define"
11677 fi
11678 set d_ipv6_mreq; eval $setvar
11679 $rm_try
11680
11681 echo " "
11682 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11683 $cat >try.c <<EOF
11684 #include <sys/types.h>
11685 #include <sys/socket.h>
11686 #include <netinet/in.h>
11687 int main() {
11688 struct ipv6_mreq_source mreq;
11689 return (mreq.imr_multiaddr.s_addr);
11690 }
11691 EOF
11692 val="$undef"
11693 set try; if eval $compile; then
11694        val="$define"
11695 fi
11696 set d_ipv6_mreq_source; eval $setvar
11697 $rm_try
11698
11699 echo " "
11700 echo "Checking the availability of certain socket constants..." >&4
11701 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11702     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11703     $cat >try.c <<EOF
11704 #include <sys/types.h>
11705 #include <sys/socket.h>
11706 int main() {
11707     int i = $ENUM;
11708 }
11709 EOF
11710     val="$undef"
11711     set try; if eval $compile; then
11712         val="$define"
11713     fi
11714     set d_${enum}; eval $setvar
11715     $rm_try
11716 done
11717
11718 : see if this is a sys/uio.h system
11719 set sys/uio.h i_sysuio
11720 eval $inhdr
11721
11722 : Check for cmsghdr support
11723 echo " "
11724 echo "Checking to see if your system supports struct cmsghdr..." >&4
11725 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11726 eval $hasstruct
11727 case "$d_cmsghdr_s" in
11728 "$define")      echo "Yes, it does."   ;;
11729 *)              echo "No, it doesn't." ;;
11730 esac
11731
11732
11733 : check for const keyword
11734 echo " "
11735 echo 'Checking to see if your C compiler knows about "const"...' >&4
11736 $cat >const.c <<'EOCP'
11737 typedef struct spug { int drokk; } spug;
11738 int main()
11739 {
11740         const char *foo;
11741         const spug y = { 0 };
11742 }
11743 EOCP
11744 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11745         val="$define"
11746         echo "Yup, it does."
11747 else
11748         val="$undef"
11749         echo "Nope, it doesn't."
11750 fi
11751 set d_const
11752 eval $setvar
11753
11754 : see if copysignl exists
11755 set copysignl d_copysignl
11756 eval $inlibc
11757
11758 : see if crypt exists
11759 echo " "
11760 set crypt d_crypt
11761 eval $inlibc
11762 case "$d_crypt" in
11763 $define) cryptlib='' ;;
11764 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11765                 echo 'crypt() found.' >&4
11766                 val="$define"
11767                 cryptlib=''
11768         else
11769                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11770                 if $test -z "$cryptlib"; then
11771                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11772                 else
11773                         cryptlib=-lcrypt
11774                 fi
11775                 if $test -z "$cryptlib"; then
11776                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11777                 else
11778                         cryptlib=-lcrypt
11779                 fi
11780                 if $test -z "$cryptlib"; then
11781                         cryptlib=`./loc libcrypt$_a "" $libpth`
11782                 else
11783                         cryptlib=-lcrypt
11784                 fi
11785                 if $test -z "$cryptlib"; then
11786                         echo 'crypt() NOT found.' >&4
11787                         val="$undef"
11788                 else
11789                         val="$define"
11790                 fi
11791         fi
11792         set d_crypt
11793         eval $setvar
11794         ;;
11795 esac
11796
11797 : see if this is a crypt.h system
11798 set crypt.h i_crypt
11799 eval $inhdr
11800
11801 : see if crypt_r exists
11802 set crypt_r d_crypt_r
11803 eval $inlibc
11804 case "$d_crypt_r" in
11805 "$define")
11806         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11807         case "$d_crypt_r_proto:$usethreads" in
11808         ":define")      d_crypt_r_proto=define
11809                 set d_crypt_r_proto crypt_r $hdrs
11810                 eval $hasproto ;;
11811         *)      ;;
11812         esac
11813         case "$d_crypt_r_proto" in
11814         define)
11815         case "$crypt_r_proto" in
11816         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11817         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11818         esac
11819         case "$crypt_r_proto" in
11820         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11821         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11822         esac
11823         case "$crypt_r_proto" in
11824         ''|0)   d_crypt_r=undef
11825                 crypt_r_proto=0
11826                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11827         * )     case "$crypt_r_proto" in
11828                 REENTRANT_PROTO*) ;;
11829                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11830                 esac
11831                 echo "Prototype: $try" ;;
11832         esac
11833         ;;
11834         *)      case "$usethreads" in
11835                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11836                 esac
11837                 d_crypt_r=undef
11838                 crypt_r_proto=0
11839                 ;;
11840         esac
11841         ;;
11842 *)      crypt_r_proto=0
11843         ;;
11844 esac
11845
11846 : get csh whereabouts
11847 case "$csh" in
11848 'csh') val="$undef" ;;
11849 *) val="$define" ;;
11850 esac
11851 set d_csh
11852 eval $setvar
11853 : Respect a hint or command line value for full_csh.
11854 case "$full_csh" in
11855 '') full_csh=$csh ;;
11856 esac
11857
11858 : see if ctermid exists
11859 set ctermid d_ctermid
11860 eval $inlibc
11861
11862 : see if ctermid_r exists
11863 set ctermid_r d_ctermid_r
11864 eval $inlibc
11865 case "$d_ctermid_r" in
11866 "$define")
11867         hdrs="$i_systypes sys/types.h define stdio.h "
11868         case "$d_ctermid_r_proto:$usethreads" in
11869         ":define")      d_ctermid_r_proto=define
11870                 set d_ctermid_r_proto ctermid_r $hdrs
11871                 eval $hasproto ;;
11872         *)      ;;
11873         esac
11874         case "$d_ctermid_r_proto" in
11875         define)
11876         case "$ctermid_r_proto" in
11877         ''|0) try='char* ctermid_r(char*);'
11878         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11879         esac
11880         case "$ctermid_r_proto" in
11881         ''|0)   d_ctermid_r=undef
11882                 ctermid_r_proto=0
11883                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11884         * )     case "$ctermid_r_proto" in
11885                 REENTRANT_PROTO*) ;;
11886                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11887                 esac
11888                 echo "Prototype: $try" ;;
11889         esac
11890         ;;
11891         *)      case "$usethreads" in
11892                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11893                 esac
11894                 d_ctermid_r=undef
11895                 ctermid_r_proto=0
11896                 ;;
11897         esac
11898         ;;
11899 *)      ctermid_r_proto=0
11900         ;;
11901 esac
11902
11903 : see if ctime_r exists
11904 set ctime_r d_ctime_r
11905 eval $inlibc
11906 case "$d_ctime_r" in
11907 "$define")
11908         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11909         case "$d_ctime_r_proto:$usethreads" in
11910         ":define")      d_ctime_r_proto=define
11911                 set d_ctime_r_proto ctime_r $hdrs
11912                 eval $hasproto ;;
11913         *)      ;;
11914         esac
11915         case "$d_ctime_r_proto" in
11916         define)
11917         case "$ctime_r_proto" in
11918         ''|0) try='char* ctime_r(const time_t*, char*);'
11919         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11920         esac
11921         case "$ctime_r_proto" in
11922         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11923         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11924         esac
11925         case "$ctime_r_proto" in
11926         ''|0) try='int ctime_r(const time_t*, char*);'
11927         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11928         esac
11929         case "$ctime_r_proto" in
11930         ''|0) try='int ctime_r(const time_t*, char*, int);'
11931         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11932         esac
11933         case "$ctime_r_proto" in
11934         ''|0)   d_ctime_r=undef
11935                 ctime_r_proto=0
11936                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11937         * )     case "$ctime_r_proto" in
11938                 REENTRANT_PROTO*) ;;
11939                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11940                 esac
11941                 echo "Prototype: $try" ;;
11942         esac
11943         ;;
11944         *)      case "$usethreads" in
11945                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11946                 esac
11947                 d_ctime_r=undef
11948                 ctime_r_proto=0
11949                 ;;
11950         esac
11951         ;;
11952 *)      ctime_r_proto=0
11953         ;;
11954 esac
11955
11956 : see if cuserid exists
11957 set cuserid d_cuserid
11958 eval $inlibc
11959
11960 : see if this is a limits.h system
11961 set limits.h i_limits
11962 eval $inhdr
11963
11964 : see if this is a float.h system
11965 set float.h i_float
11966 eval $inhdr
11967
11968 : See if number of significant digits in a double precision number is known
11969 echo " "
11970 $cat >dbl_dig.c <<EOM
11971 #$i_limits I_LIMITS
11972 #$i_float I_FLOAT
11973 #ifdef I_LIMITS
11974 #include <limits.h>
11975 #endif
11976 #ifdef I_FLOAT
11977 #include <float.h>
11978 #endif
11979 #ifdef DBL_DIG
11980 printf("Contains DBL_DIG");
11981 #endif
11982 EOM
11983 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11984 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11985         echo "DBL_DIG found." >&4
11986         val="$define"
11987 else
11988         echo "DBL_DIG NOT found." >&4
11989         val="$undef"
11990 fi
11991 $rm -f dbl_dig.?
11992 set d_dbl_dig
11993 eval $setvar
11994
11995 : see if dbm.h is available
11996 : see if dbmclose exists
11997 set dbmclose d_dbmclose
11998 eval $inlibc
11999
12000 case "$d_dbmclose" in
12001 $define)
12002         set dbm.h i_dbm
12003         eval $inhdr
12004         case "$i_dbm" in
12005         $define)
12006                 val="$undef"
12007                 set i_rpcsvcdbm
12008                 eval $setvar
12009                 ;;
12010         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12011                 eval $inhdr
12012                 ;;
12013         esac
12014         ;;
12015 *)      echo "We won't be including <dbm.h>"
12016         val="$undef"
12017         set i_dbm
12018         eval $setvar
12019         val="$undef"
12020         set i_rpcsvcdbm
12021         eval $setvar
12022         ;;
12023 esac
12024
12025 : see if prototype for dbminit is available
12026 echo " "
12027 set d_dbminitproto dbminit $i_dbm dbm.h
12028 eval $hasproto
12029
12030 : see if difftime exists
12031 set difftime d_difftime
12032 eval $inlibc
12033
12034 : see if this is a dirent system
12035 echo " "
12036 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12037         val="$define"
12038         echo "<dirent.h> found." >&4
12039 else
12040         val="$undef"
12041         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12042                 echo "<sys/dir.h> found." >&4
12043                 echo " "
12044         else
12045                 xinc=`./findhdr sys/ndir.h`
12046         fi
12047         echo "<dirent.h> NOT found." >&4
12048 fi
12049 set i_dirent
12050 eval $setvar
12051
12052 : Look for type of directory structure.
12053 echo " "
12054 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12055
12056 case "$direntrytype" in
12057 ''|' ')
12058         case "$i_dirent" in
12059         $define) guess1='struct dirent' ;;
12060         *) guess1='struct direct'  ;;
12061         esac
12062         ;;
12063 *)      guess1="$direntrytype"
12064         ;;
12065 esac
12066
12067 case "$guess1" in
12068 'struct dirent') guess2='struct direct' ;;
12069 *) guess2='struct dirent' ;;
12070 esac
12071
12072 if $contains "$guess1" try.c >/dev/null 2>&1; then
12073         direntrytype="$guess1"
12074         echo "Your directory entries are $direntrytype." >&4
12075 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12076         direntrytype="$guess2"
12077         echo "Your directory entries seem to be $direntrytype." >&4
12078 else
12079         echo "I don't recognize your system's directory entries." >&4
12080         rp="What type is used for directory entries on this system?"
12081         dflt="$guess1"
12082         . ./myread
12083         direntrytype="$ans"
12084 fi
12085 $rm_try
12086
12087 : see if the directory entry stores field length
12088 echo " "
12089 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12090 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12091         echo "Good, your directory entry keeps length information in d_namlen." >&4
12092         val="$define"
12093 else
12094         echo "Your directory entry does not know about the d_namlen field." >&4
12095         val="$undef"
12096 fi
12097 set d_dirnamlen
12098 eval $setvar
12099 $rm_try
12100
12101 : Look for DIR.dd_fd
12102 case "$i_dirent" in
12103 "$define")
12104     echo "Checking to see if DIR has a dd_fd member variable" >&4
12105     $cat >try.c <<EOCP
12106 #$i_stdlib I_STDLIB
12107 #ifdef I_STDLIB
12108 #include <stdlib.h>
12109 #endif
12110 #include <dirent.h>
12111
12112 int main() {
12113     DIR dir;
12114     dir.dd_fd = 1;
12115     return 0;
12116 }
12117 EOCP
12118     val=$undef
12119     set try
12120     if eval $compile; then
12121         echo "Yes, it does."
12122         val="$define"
12123     else
12124         echo "No, it does not."
12125         val="$undef"
12126     fi
12127     ;;
12128 *)
12129     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12130     val="$undef"
12131     ;;
12132 esac
12133 set d_dir_dd_fd
12134 eval $setvar
12135 $rm_try
12136
12137 : see if this is an sysdir system
12138 set sys/dir.h i_sysdir
12139 eval $inhdr
12140
12141 : see if this is an sysndir system
12142 set sys/ndir.h i_sysndir
12143 eval $inhdr
12144
12145 : Look for dirfd
12146 echo " "
12147 $cat >dirfd.c <<EOM
12148 #include <stdio.h>
12149 #$i_stdlib I_STDLIB
12150 #ifdef I_STDLIB
12151 #include <stdlib.h>
12152 #endif
12153 #$i_dirent I_DIRENT             /**/
12154 #$i_sysdir I_SYS_DIR            /**/
12155 #$i_sysndir I_SYS_NDIR          /**/
12156 #$i_systypes I_SYS_TYPES        /**/
12157 #if defined(I_SYS_TYPES)
12158 #include <sys/types.h>
12159 #endif
12160 #if defined(I_DIRENT)
12161 #include <dirent.h>
12162 #else
12163 #ifdef I_SYS_NDIR
12164 #include <sys/ndir.h>
12165 #else
12166 #ifdef I_SYS_DIR
12167 #ifdef hp9000s500
12168 #include <ndir.h>       /* may be wrong in the future */
12169 #else
12170 #include <sys/dir.h>
12171 #endif
12172 #endif
12173 #endif
12174 #endif
12175 int main() {
12176         DIR *dirp = opendir(".");
12177         if (dirfd(dirp) >= 0)
12178                 exit(0);
12179         else
12180                 exit(1);
12181 }
12182 EOM
12183 val=$undef
12184 set dirfd
12185 if eval $compile; then
12186         val="$define"
12187 fi
12188 case "$val" in
12189 $define)        echo "dirfd() found." >&4       ;;
12190 *)              echo "dirfd() NOT found." >&4   ;;
12191 esac
12192 set d_dirfd
12193 eval $setvar
12194 $rm -f dirfd*
12195
12196 : see if dladdr exists
12197 set dladdr d_dladdr
12198 eval $inlibc
12199
12200 : see if dlerror exists
12201 xxx_runnm="$runnm"
12202 runnm=false
12203 set dlerror d_dlerror
12204 eval $inlibc
12205 runnm="$xxx_runnm"
12206
12207 : see if dlfcn is available
12208 set dlfcn.h i_dlfcn
12209 eval $inhdr
12210
12211 : Check what extension to use for shared libs
12212 case "$usedl" in
12213 $define|y|true)
12214         $cat << EOM
12215
12216 On a few systems, the dynamically loaded modules that perl generates and uses
12217 will need a different extension than shared libs. The default will probably
12218 be appropriate.
12219
12220 EOM
12221         case "$dlext" in
12222         '')     dflt="$so" ;;
12223         *)      dflt="$dlext" ;;
12224         esac
12225         rp='What is the extension of dynamically loaded modules'
12226         . ./myread
12227         dlext="$ans"
12228         ;;
12229 *)
12230         dlext="none"
12231         ;;
12232 esac
12233
12234 : Check if dlsym need a leading underscore
12235 echo " "
12236 val="$undef"
12237
12238 case "$dlsrc" in
12239 dl_dlopen.xs)
12240         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12241         $cat >dyna.c <<'EOM'
12242 fred () { }
12243 EOM
12244
12245 $cat >fred.c<<EOM
12246
12247 #include <stdio.h>
12248 #$i_stdlib I_STDLIB
12249 #ifdef I_STDLIB
12250 #include <stdlib.h>
12251 #endif
12252 #$i_dlfcn I_DLFCN
12253 #ifdef I_DLFCN
12254 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12255 #else
12256 #include <sys/types.h>
12257 #include <nlist.h>
12258 #include <link.h>
12259 #endif
12260
12261 extern int fred() ;
12262
12263 int main()
12264 {
12265     void * handle ;
12266     void * symbol ;
12267 #ifndef RTLD_LAZY
12268     int mode = 1 ;
12269 #else
12270     int mode = RTLD_LAZY ;
12271 #endif
12272     handle = dlopen("./dyna.$dlext", mode) ;
12273     if (handle == NULL) {
12274         printf ("1\n") ;
12275         fflush (stdout) ;
12276         exit(0);
12277     }
12278     symbol = dlsym(handle, "fred") ;
12279     if (symbol == NULL) {
12280         /* try putting a leading underscore */
12281         symbol = dlsym(handle, "_fred") ;
12282         if (symbol == NULL) {
12283             printf ("2\n") ;
12284             fflush (stdout) ;
12285             exit(0);
12286         }
12287         printf ("3\n") ;
12288     }
12289     else
12290         printf ("4\n") ;
12291     fflush (stdout) ;
12292     exit(0);
12293 }
12294 EOM
12295         : Call the object file tmp-dyna.o in case dlext=o.
12296         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12297                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12298                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12299                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12300                 xxx=`$run ./fred`
12301                 case $xxx in
12302                 1)      echo "Test program failed using dlopen." >&4
12303                         echo "Perhaps you should not use dynamic loading." >&4;;
12304                 2)      echo "Test program failed using dlsym." >&4
12305                         echo "Perhaps you should not use dynamic loading." >&4;;
12306                 3)      echo "dlsym needs a leading underscore" >&4
12307                         val="$define" ;;
12308                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12309                 esac
12310         else
12311                 echo "I can't compile and run the test program." >&4
12312                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12313         fi
12314         ;;
12315 esac
12316
12317 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12318
12319 set d_dlsymun
12320 eval $setvar
12321
12322 : see if drand48_r exists
12323 set drand48_r d_drand48_r
12324 eval $inlibc
12325 case "$d_drand48_r" in
12326 "$define")
12327         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12328         case "$d_drand48_r_proto:$usethreads" in
12329         ":define")      d_drand48_r_proto=define
12330                 set d_drand48_r_proto drand48_r $hdrs
12331                 eval $hasproto ;;
12332         *)      ;;
12333         esac
12334         case "$d_drand48_r_proto" in
12335         define)
12336         case "$drand48_r_proto" in
12337         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12338         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12339         esac
12340         case "$drand48_r_proto" in
12341         ''|0)   d_drand48_r=undef
12342                 drand48_r_proto=0
12343                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12344         * )     case "$drand48_r_proto" in
12345                 REENTRANT_PROTO*) ;;
12346                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12347                 esac
12348                 echo "Prototype: $try" ;;
12349         esac
12350         ;;
12351         *)      case "$usethreads" in
12352                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12353                 esac
12354                 d_drand48_r=undef
12355                 drand48_r_proto=0
12356                 ;;
12357         esac
12358         ;;
12359 *)      drand48_r_proto=0
12360         ;;
12361 esac
12362
12363 : see if prototype for drand48 is available
12364 echo " "
12365 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12366 eval $hasproto
12367
12368 : see if dup2 exists
12369 set dup2 d_dup2
12370 eval $inlibc
12371
12372 : see if eaccess exists
12373 set eaccess d_eaccess
12374 eval $inlibc
12375
12376 : see if endgrent exists
12377 set endgrent d_endgrent
12378 eval $inlibc
12379
12380 : see if this is an grp system
12381 set grp.h i_grp
12382 eval $inhdr
12383
12384 case "$i_grp" in
12385 $define)
12386         xxx=`./findhdr grp.h`
12387         $cppstdin $cppflags $cppminus < $xxx >$$.h
12388
12389         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12390                 val="$define"
12391         else
12392                 val="$undef"
12393         fi
12394         set d_grpasswd
12395         eval $setvar
12396
12397         $rm -f $$.h
12398         ;;
12399 *)
12400         val="$undef";
12401         set d_grpasswd; eval $setvar
12402         ;;
12403 esac
12404
12405 : see if endgrent_r exists
12406 set endgrent_r d_endgrent_r
12407 eval $inlibc
12408 case "$d_endgrent_r" in
12409 "$define")
12410         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12411         case "$d_endgrent_r_proto:$usethreads" in
12412         ":define")      d_endgrent_r_proto=define
12413                 set d_endgrent_r_proto endgrent_r $hdrs
12414                 eval $hasproto ;;
12415         *)      ;;
12416         esac
12417         case "$d_endgrent_r_proto" in
12418         define)
12419         case "$endgrent_r_proto" in
12420         ''|0) try='int endgrent_r(FILE**);'
12421         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12422         esac
12423         case "$endgrent_r_proto" in
12424         ''|0) try='void endgrent_r(FILE**);'
12425         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12426         esac
12427         case "$endgrent_r_proto" in
12428         ''|0)   d_endgrent_r=undef
12429                 endgrent_r_proto=0
12430                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12431         * )     case "$endgrent_r_proto" in
12432                 REENTRANT_PROTO*) ;;
12433                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12434                 esac
12435                 echo "Prototype: $try" ;;
12436         esac
12437         ;;
12438         *)      case "$usethreads" in
12439                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12440                 esac
12441                 d_endgrent_r=undef
12442                 endgrent_r_proto=0
12443                 ;;
12444         esac
12445         ;;
12446 *)      endgrent_r_proto=0
12447         ;;
12448 esac
12449
12450 : see if endhostent exists
12451 set endhostent d_endhent
12452 eval $inlibc
12453
12454 : see if this is a netdb.h system
12455 set netdb.h i_netdb
12456 eval $inhdr
12457
12458 : see if endhostent_r exists
12459 set endhostent_r d_endhostent_r
12460 eval $inlibc
12461 case "$d_endhostent_r" in
12462 "$define")
12463         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12464         case "$d_endhostent_r_proto:$usethreads" in
12465         ":define")      d_endhostent_r_proto=define
12466                 set d_endhostent_r_proto endhostent_r $hdrs
12467                 eval $hasproto ;;
12468         *)      ;;
12469         esac
12470         case "$d_endhostent_r_proto" in
12471         define)
12472         case "$endhostent_r_proto" in
12473         ''|0) try='int endhostent_r(struct hostent_data*);'
12474         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12475         esac
12476         case "$endhostent_r_proto" in
12477         ''|0) try='void endhostent_r(struct hostent_data*);'
12478         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12479         esac
12480         case "$endhostent_r_proto" in
12481         ''|0)   d_endhostent_r=undef
12482                 endhostent_r_proto=0
12483                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12484         * )     case "$endhostent_r_proto" in
12485                 REENTRANT_PROTO*) ;;
12486                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12487                 esac
12488                 echo "Prototype: $try" ;;
12489         esac
12490         ;;
12491         *)      case "$usethreads" in
12492                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12493                 esac
12494                 d_endhostent_r=undef
12495                 endhostent_r_proto=0
12496                 ;;
12497         esac
12498         ;;
12499 *)      endhostent_r_proto=0
12500         ;;
12501 esac
12502
12503 : see if endnetent exists
12504 set endnetent d_endnent
12505 eval $inlibc
12506
12507 : see if endnetent_r exists
12508 set endnetent_r d_endnetent_r
12509 eval $inlibc
12510 case "$d_endnetent_r" in
12511 "$define")
12512         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12513         case "$d_endnetent_r_proto:$usethreads" in
12514         ":define")      d_endnetent_r_proto=define
12515                 set d_endnetent_r_proto endnetent_r $hdrs
12516                 eval $hasproto ;;
12517         *)      ;;
12518         esac
12519         case "$d_endnetent_r_proto" in
12520         define)
12521         case "$endnetent_r_proto" in
12522         ''|0) try='int endnetent_r(struct netent_data*);'
12523         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12524         esac
12525         case "$endnetent_r_proto" in
12526         ''|0) try='void endnetent_r(struct netent_data*);'
12527         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12528         esac
12529         case "$endnetent_r_proto" in
12530         ''|0)   d_endnetent_r=undef
12531                 endnetent_r_proto=0
12532                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12533         * )     case "$endnetent_r_proto" in
12534                 REENTRANT_PROTO*) ;;
12535                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12536                 esac
12537                 echo "Prototype: $try" ;;
12538         esac
12539         ;;
12540         *)      case "$usethreads" in
12541                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12542                 esac
12543                 d_endnetent_r=undef
12544                 endnetent_r_proto=0
12545                 ;;
12546         esac
12547         ;;
12548 *)      endnetent_r_proto=0
12549         ;;
12550 esac
12551
12552 : see if endprotoent exists
12553 set endprotoent d_endpent
12554 eval $inlibc
12555
12556 : see if endprotoent_r exists
12557 set endprotoent_r d_endprotoent_r
12558 eval $inlibc
12559 case "$d_endprotoent_r" in
12560 "$define")
12561         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12562         case "$d_endprotoent_r_proto:$usethreads" in
12563         ":define")      d_endprotoent_r_proto=define
12564                 set d_endprotoent_r_proto endprotoent_r $hdrs
12565                 eval $hasproto ;;
12566         *)      ;;
12567         esac
12568         case "$d_endprotoent_r_proto" in
12569         define)
12570         case "$endprotoent_r_proto" in
12571         ''|0) try='int endprotoent_r(struct protoent_data*);'
12572         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12573         esac
12574         case "$endprotoent_r_proto" in
12575         ''|0) try='void endprotoent_r(struct protoent_data*);'
12576         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12577         esac
12578         case "$endprotoent_r_proto" in
12579         ''|0)   d_endprotoent_r=undef
12580                 endprotoent_r_proto=0
12581                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12582         * )     case "$endprotoent_r_proto" in
12583                 REENTRANT_PROTO*) ;;
12584                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12585                 esac
12586                 echo "Prototype: $try" ;;
12587         esac
12588         ;;
12589         *)      case "$usethreads" in
12590                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12591                 esac
12592                 d_endprotoent_r=undef
12593                 endprotoent_r_proto=0
12594                 ;;
12595         esac
12596         ;;
12597 *)      endprotoent_r_proto=0
12598         ;;
12599 esac
12600
12601 : see if endpwent exists
12602 set endpwent d_endpwent
12603 eval $inlibc
12604
12605 : see if this is a pwd.h system
12606 set pwd.h i_pwd
12607 eval $inhdr
12608
12609 case "$i_pwd" in
12610 $define)
12611         xxx=`./findhdr pwd.h`
12612         $cppstdin $cppflags $cppminus < $xxx >$$.h
12613
12614         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12615                 val="$define"
12616         else
12617                 val="$undef"
12618         fi
12619         set d_pwquota
12620         eval $setvar
12621
12622         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12623                 val="$define"
12624         else
12625                 val="$undef"
12626         fi
12627         set d_pwage
12628         eval $setvar
12629
12630         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12631                 val="$define"
12632         else
12633                 val="$undef"
12634         fi
12635         set d_pwchange
12636         eval $setvar
12637
12638         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12639                 val="$define"
12640         else
12641                 val="$undef"
12642         fi
12643         set d_pwclass
12644         eval $setvar
12645
12646         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12647                 val="$define"
12648         else
12649                 val="$undef"
12650         fi
12651         set d_pwexpire
12652         eval $setvar
12653
12654         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12655                 val="$define"
12656         else
12657                 val="$undef"
12658         fi
12659         set d_pwcomment
12660         eval $setvar
12661
12662         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12663                 val="$define"
12664         else
12665                 val="$undef"
12666         fi
12667         set d_pwgecos
12668         eval $setvar
12669
12670         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12671                 val="$define"
12672         else
12673                 val="$undef"
12674         fi
12675         set d_pwpasswd
12676         eval $setvar
12677
12678         $rm -f $$.h
12679         ;;
12680 *)
12681         val="$undef";
12682         set d_pwquota; eval $setvar
12683         set d_pwage; eval $setvar
12684         set d_pwchange; eval $setvar
12685         set d_pwclass; eval $setvar
12686         set d_pwexpire; eval $setvar
12687         set d_pwcomment; eval $setvar
12688         set d_pwgecos; eval $setvar
12689         set d_pwpasswd; eval $setvar
12690         ;;
12691 esac
12692
12693 : see if endpwent_r exists
12694 set endpwent_r d_endpwent_r
12695 eval $inlibc
12696 case "$d_endpwent_r" in
12697 "$define")
12698         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12699         case "$d_endpwent_r_proto:$usethreads" in
12700         ":define")      d_endpwent_r_proto=define
12701                 set d_endpwent_r_proto endpwent_r $hdrs
12702                 eval $hasproto ;;
12703         *)      ;;
12704         esac
12705         case "$d_endpwent_r_proto" in
12706         define)
12707         case "$endpwent_r_proto" in
12708         ''|0) try='int endpwent_r(FILE**);'
12709         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12710         esac
12711         case "$endpwent_r_proto" in
12712         ''|0) try='void endpwent_r(FILE**);'
12713         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12714         esac
12715         case "$endpwent_r_proto" in
12716         ''|0)   d_endpwent_r=undef
12717                 endpwent_r_proto=0
12718                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12719         * )     case "$endpwent_r_proto" in
12720                 REENTRANT_PROTO*) ;;
12721                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12722                 esac
12723                 echo "Prototype: $try" ;;
12724         esac
12725         ;;
12726         *)      case "$usethreads" in
12727                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12728                 esac
12729                 d_endpwent_r=undef
12730                 endpwent_r_proto=0
12731                 ;;
12732         esac
12733         ;;
12734 *)      endpwent_r_proto=0
12735         ;;
12736 esac
12737
12738 : see if endservent exists
12739 set endservent d_endsent
12740 eval $inlibc
12741
12742 : see if endservent_r exists
12743 set endservent_r d_endservent_r
12744 eval $inlibc
12745 case "$d_endservent_r" in
12746 "$define")
12747         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12748         case "$d_endservent_r_proto:$usethreads" in
12749         ":define")      d_endservent_r_proto=define
12750                 set d_endservent_r_proto endservent_r $hdrs
12751                 eval $hasproto ;;
12752         *)      ;;
12753         esac
12754         case "$d_endservent_r_proto" in
12755         define)
12756         case "$endservent_r_proto" in
12757         ''|0) try='int endservent_r(struct servent_data*);'
12758         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12759         esac
12760         case "$endservent_r_proto" in
12761         ''|0) try='void endservent_r(struct servent_data*);'
12762         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12763         esac
12764         case "$endservent_r_proto" in
12765         ''|0)   d_endservent_r=undef
12766                 endservent_r_proto=0
12767                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12768         * )     case "$endservent_r_proto" in
12769                 REENTRANT_PROTO*) ;;
12770                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12771                 esac
12772                 echo "Prototype: $try" ;;
12773         esac
12774         ;;
12775         *)      case "$usethreads" in
12776                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12777                 esac
12778                 d_endservent_r=undef
12779                 endservent_r_proto=0
12780                 ;;
12781         esac
12782         ;;
12783 *)      endservent_r_proto=0
12784         ;;
12785 esac
12786
12787 : Locate the flags for 'open()'
12788 echo " "
12789 $cat >try.c <<EOCP
12790 #include <sys/types.h>
12791 #ifdef I_FCNTL
12792 #include <fcntl.h>
12793 #endif
12794 #ifdef I_SYS_FILE
12795 #include <sys/file.h>
12796 #endif
12797 #$i_stdlib I_STDLIB
12798 #ifdef I_STDLIB
12799 #include <stdlib.h>
12800 #endif
12801 int main() {
12802         if(O_RDONLY);
12803 #ifdef O_TRUNC
12804         exit(0);
12805 #else
12806         exit(1);
12807 #endif
12808 }
12809 EOCP
12810 : check sys/file.h first to get FREAD on Sun
12811 if $test `./findhdr sys/file.h` && \
12812                 set try -DI_SYS_FILE && eval $compile; then
12813         h_sysfile=true;
12814         echo "<sys/file.h> defines the O_* constants..." >&4
12815         if $run ./try; then
12816                 echo "and you have the 3 argument form of open()." >&4
12817                 val="$define"
12818         else
12819                 echo "but not the 3 argument form of open().  Oh, well." >&4
12820                 val="$undef"
12821         fi
12822 elif $test `./findhdr fcntl.h` && \
12823                 set try -DI_FCNTL && eval $compile; then
12824         h_fcntl=true;
12825         echo "<fcntl.h> defines the O_* constants..." >&4
12826         if $run ./try; then
12827                 echo "and you have the 3 argument form of open()." >&4
12828                 val="$define"
12829         else
12830                 echo "but not the 3 argument form of open().  Oh, well." >&4
12831                 val="$undef"
12832         fi
12833 else
12834         val="$undef"
12835         echo "I can't find the O_* constant definitions!  You got problems." >&4
12836 fi
12837 set d_open3
12838 eval $setvar
12839 $rm_try
12840
12841 : see if this is a sys/file.h system
12842 val=''
12843 set sys/file.h val
12844 eval $inhdr
12845
12846 : do we need to include sys/file.h ?
12847 case "$val" in
12848 "$define")
12849         echo " "
12850         if $h_sysfile; then
12851                 val="$define"
12852                 echo "We'll be including <sys/file.h>." >&4
12853         else
12854                 val="$undef"
12855                 echo "We won't be including <sys/file.h>." >&4
12856         fi
12857         ;;
12858 *)
12859         h_sysfile=false
12860         ;;
12861 esac
12862 set i_sysfile
12863 eval $setvar
12864
12865 : see if fcntl.h is there
12866 val=''
12867 set fcntl.h val
12868 eval $inhdr
12869
12870 : see if we can include fcntl.h
12871 case "$val" in
12872 "$define")
12873         echo " "
12874         if $h_fcntl; then
12875                 val="$define"
12876                 echo "We'll be including <fcntl.h>." >&4
12877         else
12878                 val="$undef"
12879                 if $h_sysfile; then
12880         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12881                 else
12882                         echo "We won't be including <fcntl.h>." >&4
12883                 fi
12884         fi
12885         ;;
12886 *)
12887         h_fcntl=false
12888         val="$undef"
12889         ;;
12890 esac
12891 set i_fcntl
12892 eval $setvar
12893
12894 : see if fork exists
12895 set fork d_fork
12896 eval $inlibc
12897
12898 : see if pipe exists
12899 set pipe d_pipe
12900 eval $inlibc
12901
12902 : check for non-blocking I/O stuff
12903 case "$h_sysfile" in
12904 true) echo "#include <sys/file.h>" > head.c;;
12905 *)
12906        case "$h_fcntl" in
12907        true) echo "#include <fcntl.h>" > head.c;;
12908        *) echo "#include <sys/fcntl.h>" > head.c;;
12909        esac
12910        ;;
12911 esac
12912 echo " "
12913 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12914 case "$o_nonblock" in
12915 '')
12916         $cat head.c > try.c
12917         $cat >>try.c <<EOCP
12918 #include <stdio.h>
12919 #$i_stdlib I_STDLIB
12920 #ifdef I_STDLIB
12921 #include <stdlib.h>
12922 #endif
12923 #$i_fcntl I_FCNTL
12924 #ifdef I_FCNTL
12925 #include <fcntl.h>
12926 #endif
12927 int main() {
12928 #ifdef O_NONBLOCK
12929         printf("O_NONBLOCK\n");
12930         exit(0);
12931 #endif
12932 #ifdef O_NDELAY
12933         printf("O_NDELAY\n");
12934         exit(0);
12935 #endif
12936 #ifdef FNDELAY
12937         printf("FNDELAY\n");
12938         exit(0);
12939 #endif
12940         exit(0);
12941 }
12942 EOCP
12943         set try
12944         if eval $compile_ok; then
12945                 o_nonblock=`$run ./try`
12946                 case "$o_nonblock" in
12947                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12948                 *) echo "Seems like we can use $o_nonblock.";;
12949                 esac
12950         else
12951                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12952         fi
12953         ;;
12954 *) echo "Using $hint value $o_nonblock.";;
12955 esac
12956 $rm_try
12957
12958 echo " "
12959 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12960 case "$eagain" in
12961 '')
12962         case "$d_fork:$d_pipe" in
12963         define:define)
12964         $cat head.c > try.c
12965         $cat >>try.c <<EOCP
12966 #include <errno.h>
12967 #include <sys/types.h>
12968 #include <signal.h>
12969 #include <stdio.h>
12970 #$i_stdlib I_STDLIB
12971 #ifdef I_STDLIB
12972 #include <stdlib.h>
12973 #endif
12974 #$i_fcntl I_FCNTL
12975 #ifdef I_FCNTL
12976 #include <fcntl.h>
12977 #endif
12978 #define MY_O_NONBLOCK $o_nonblock
12979 #ifndef errno  /* XXX need better Configure test */
12980 extern int errno;
12981 #endif
12982 #$i_unistd I_UNISTD
12983 #ifdef I_UNISTD
12984 #include <unistd.h>
12985 #endif
12986 #$i_string I_STRING
12987 #ifdef I_STRING
12988 #include <string.h>
12989 #else
12990 #include <strings.h>
12991 #endif
12992 $signal_t blech(int x) { exit(3); }
12993 EOCP
12994         $cat >> try.c <<'EOCP'
12995 int main()
12996 {
12997         int pd[2];
12998         int pu[2];
12999         char buf[1];
13000         char string[100];
13001         int ret;
13002
13003         ret = pipe(pd); /* Down: child -> parent */
13004         if (ret != 0)
13005                 exit(3);
13006         ret = pipe(pu); /* Up: parent -> child */
13007         if (ret != 0)
13008                 exit(3);
13009         if (0 != fork()) {
13010                 close(pd[1]);   /* Parent reads from pd[0] */
13011                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13012 #ifdef F_SETFL
13013                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13014                         exit(1);
13015 #else
13016                 exit(4);
13017 #endif
13018                 signal(SIGALRM, blech);
13019                 alarm(5);
13020                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13021                         exit(2);
13022                 sprintf(string, "%d\n", ret);
13023                 ret = write(2, string, strlen(string));
13024                 if (ret != strlen(string))
13025                         exit(3);
13026                 alarm(0);
13027 #ifdef EAGAIN
13028                 if (errno == EAGAIN) {
13029                         printf("EAGAIN\n");
13030                         goto ok;
13031                 }
13032 #endif
13033 #ifdef EWOULDBLOCK
13034                 if (errno == EWOULDBLOCK)
13035                         printf("EWOULDBLOCK\n");
13036 #endif
13037         ok:
13038                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13039                 if (ret != 1)
13040                         exit(3);
13041                 sleep(2);                               /* Give it time to close our pipe */
13042                 alarm(5);
13043                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13044                 alarm(0);
13045                 sprintf(string, "%d\n", ret);
13046                 ret = write(4, string, strlen(string));
13047                 if (ret != strlen(string))
13048                         exit(3);
13049                 exit(0);
13050         }
13051
13052         close(pd[0]);                   /* We write to pd[1] */
13053         close(pu[1]);                   /* We read from pu[0] */
13054         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13055         if (ret != 1)
13056                 exit(3);
13057         close(pd[1]);                   /* Pipe pd is now fully closed! */
13058         exit(0);                                /* Bye bye, thank you for playing! */
13059 }
13060 EOCP
13061         set try
13062         if eval $compile_ok; then
13063                 echo "$startsh" >mtry
13064                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13065                 chmod +x mtry
13066                 $run ./mtry >/dev/null 2>&1
13067                 case $? in
13068                 0) eagain=`$cat try.out`;;
13069                 1) echo "Could not perform non-blocking setting!";;
13070                 2) echo "I did a successful read() for something that was not there!";;
13071                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13072                 4) echo "Could not find F_SETFL!";;
13073                 *) echo "Something terribly wrong happened during testing.";;
13074                 esac
13075                 rd_nodata=`$cat try.ret`
13076                 echo "A read() system call with no data present returns $rd_nodata."
13077                 case "$rd_nodata" in
13078                 0|-1) ;;
13079                 *)
13080                         echo "(That's peculiar, fixing that to be -1.)"
13081                         rd_nodata=-1
13082                         ;;
13083                 esac
13084                 case "$eagain" in
13085                 '')
13086                         echo "Forcing errno EAGAIN on read() with no data available."
13087                         eagain=EAGAIN
13088                         ;;
13089                 *)
13090                         echo "Your read() sets errno to $eagain when no data is available."
13091                         ;;
13092                 esac
13093                 status=`$cat try.err`
13094                 case "$status" in
13095                 0) echo "And it correctly returns 0 to signal EOF.";;
13096                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13097                 *) echo "However, your read() returns '$status' on EOF??";;
13098                 esac
13099                 val="$define"
13100                 if test "$status" = "$rd_nodata"; then
13101                         echo "WARNING: you can't distinguish between EOF and no data!"
13102                         val="$undef"
13103                 fi
13104         else
13105                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13106                 eagain=EAGAIN
13107         fi
13108         ;;
13109         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13110                 eagain=EAGAIN
13111                 val="$define"
13112                 ;;
13113         esac
13114         set d_eofnblk
13115         eval $setvar
13116         ;;
13117 *)
13118         echo "Using $hint value $eagain."
13119         echo "Your read() returns $rd_nodata when no data is present."
13120         case "$d_eofnblk" in
13121         "$define") echo "And you can see EOF because read() returns 0.";;
13122         "$undef") echo "But you can't see EOF status from read() returned value.";;
13123         *)
13124                 echo "(Assuming you can't see EOF status from read anyway.)"
13125                 d_eofnblk=$undef
13126                 ;;
13127         esac
13128         ;;
13129 esac
13130 $rm_try head.c mtry
13131
13132 : see if _ptr and _cnt from stdio act std
13133 echo " "
13134
13135 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13136         echo "(Looks like you have stdio.h from BSD.)"
13137         case "$stdio_ptr" in
13138         '') stdio_ptr='((fp)->_p)'
13139                 ptr_lval=$define
13140                 ;;
13141         *)      ptr_lval=$d_stdio_ptr_lval;;
13142         esac
13143         case "$stdio_cnt" in
13144         '') stdio_cnt='((fp)->_r)'
13145                 cnt_lval=$define
13146                 ;;
13147         *)      cnt_lval=$d_stdio_cnt_lval;;
13148         esac
13149         case "$stdio_base" in
13150         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13151         esac
13152         case "$stdio_bufsiz" in
13153         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13154         esac
13155 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13156         echo "(Looks like you have stdio.h from Linux.)"
13157         case "$stdio_ptr" in
13158         '') stdio_ptr='((fp)->_IO_read_ptr)'
13159                 ptr_lval=$define
13160                 ;;
13161         *)      ptr_lval=$d_stdio_ptr_lval;;
13162         esac
13163         case "$stdio_cnt" in
13164         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13165                 cnt_lval=$undef
13166                 ;;
13167         *)      cnt_lval=$d_stdio_cnt_lval;;
13168         esac
13169         case "$stdio_base" in
13170         '') stdio_base='((fp)->_IO_read_base)';;
13171         esac
13172         case "$stdio_bufsiz" in
13173         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13174         esac
13175 else
13176         case "$stdio_ptr" in
13177         '') stdio_ptr='((fp)->_ptr)'
13178                 ptr_lval=$define
13179                 ;;
13180         *)      ptr_lval=$d_stdio_ptr_lval;;
13181         esac
13182         case "$stdio_cnt" in
13183         '') stdio_cnt='((fp)->_cnt)'
13184                 cnt_lval=$define
13185                 ;;
13186         *)      cnt_lval=$d_stdio_cnt_lval;;
13187         esac
13188         case "$stdio_base" in
13189         '') stdio_base='((fp)->_base)';;
13190         esac
13191         case "$stdio_bufsiz" in
13192         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13193         esac
13194 fi
13195
13196 : test whether _ptr and _cnt really work
13197 echo "Checking how std your stdio is..." >&4
13198 $cat >try.c <<EOP
13199 #include <stdio.h>
13200 #$i_stdlib I_STDLIB
13201 #ifdef I_STDLIB
13202 #include <stdlib.h>
13203 #endif
13204 #define FILE_ptr(fp)    $stdio_ptr
13205 #define FILE_cnt(fp)    $stdio_cnt
13206 int main() {
13207         FILE *fp = fopen("try.c", "r");
13208         char c = getc(fp);
13209         if (
13210                 18 <= FILE_cnt(fp) &&
13211                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13212         )
13213                 exit(0);
13214         exit(1);
13215 }
13216 EOP
13217 val="$undef"
13218 set try
13219 if eval $compile && $to try.c; then
13220         if $run ./try; then
13221                 echo "Your stdio acts pretty std."
13222                 val="$define"
13223         else
13224                 echo "Your stdio isn't very std."
13225         fi
13226 else
13227         echo "Your stdio doesn't appear very std."
13228 fi
13229 $rm_try
13230
13231 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13232 # direct buffer manipulation no longer works.  The Configure tests
13233 # should be changed to correctly detect this, but until then,
13234 # the following check should at least let perl compile and run.
13235 # (This quick fix should be updated before 5.8.1.)
13236 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13237 # A. Dougherty, June 3, 2002.
13238 case "$d_gnulibc" in
13239 $define)
13240         case "$gnulibc_version" in
13241         2.[01]*)  ;;
13242         2.2) ;;
13243         2.2.[0-9]) ;;
13244         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13245                 val="$undef"
13246                 ;;
13247         esac
13248         ;;
13249 esac
13250 set d_stdstdio
13251 eval $setvar
13252
13253 : Can _ptr be used as an lvalue?
13254 case "$d_stdstdio$ptr_lval" in
13255 $define$define) val=$define ;;
13256 *) val=$undef ;;
13257 esac
13258 set d_stdio_ptr_lval
13259 eval $setvar
13260
13261 : Can _cnt be used as an lvalue?
13262 case "$d_stdstdio$cnt_lval" in
13263 $define$define) val=$define ;;
13264 *) val=$undef ;;
13265 esac
13266 set d_stdio_cnt_lval
13267 eval $setvar
13268
13269
13270 : test whether setting _ptr sets _cnt as a side effect
13271 d_stdio_ptr_lval_sets_cnt="$undef"
13272 d_stdio_ptr_lval_nochange_cnt="$undef"
13273 case "$d_stdio_ptr_lval$d_stdstdio" in
13274 $define$define)
13275         echo "Checking to see what happens if we set the stdio ptr..." >&4
13276 $cat >try.c <<EOP
13277 #include <stdio.h>
13278 /* Can we scream? */
13279 /* Eat dust sed :-) */
13280 /* In the buffer space, no one can hear you scream. */
13281 #$i_stdlib I_STDLIB
13282 #ifdef I_STDLIB
13283 #include <stdlib.h>
13284 #endif
13285 #define FILE_ptr(fp)    $stdio_ptr
13286 #define FILE_cnt(fp)    $stdio_cnt
13287 #include <sys/types.h>
13288 int main() {
13289         FILE *fp = fopen("try.c", "r");
13290         int c;
13291         char *ptr;
13292         size_t cnt;
13293         if (!fp) {
13294             puts("Fail even to read");
13295             exit(1);
13296         }
13297         c = getc(fp); /* Read away the first # */
13298         if (c == EOF) {
13299             puts("Fail even to read");
13300             exit(1);
13301         }
13302         if (!(
13303                 18 <= FILE_cnt(fp) &&
13304                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13305         )) {
13306                 puts("Fail even to read");
13307                 exit (1);
13308         }
13309         ptr = (char*) FILE_ptr(fp);
13310         cnt = (size_t)FILE_cnt(fp);
13311
13312         FILE_ptr(fp) += 42;
13313
13314         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13315                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13316                 exit (1);
13317         }
13318         if (FILE_cnt(fp) <= 20) {
13319                 printf ("Fail (<20 chars to test)");
13320                 exit (1);
13321         }
13322         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13323                 puts("Fail compare");
13324                 exit (1);
13325         }
13326         if (cnt == FILE_cnt(fp)) {
13327                 puts("Pass_unchanged");
13328                 exit (0);
13329         }
13330         if (FILE_cnt(fp) == (cnt - 42)) {
13331                 puts("Pass_changed");
13332                 exit (0);
13333         }
13334         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13335         return 1;
13336
13337 }
13338 EOP
13339         set try
13340         if eval $compile && $to try.c; then
13341                 case `$run ./try` in
13342                 Pass_changed)
13343                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13344                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13345                 Pass_unchanged)
13346                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13347                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13348                 Fail*)
13349                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13350                 *)
13351                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13352         esac
13353         else
13354                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13355         fi
13356         $rm_try
13357         ;;
13358 esac
13359
13360 : see if _base is also standard
13361 val="$undef"
13362 case "$d_stdstdio" in
13363 $define)
13364         $cat >try.c <<EOP
13365 #include <stdio.h>
13366 #$i_stdlib I_STDLIB
13367 #ifdef I_STDLIB
13368 #include <stdlib.h>
13369 #endif
13370 #define FILE_base(fp)   $stdio_base
13371 #define FILE_bufsiz(fp) $stdio_bufsiz
13372 int main() {
13373         FILE *fp = fopen("try.c", "r");
13374         char c = getc(fp);
13375         if (
13376                 19 <= FILE_bufsiz(fp) &&
13377                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13378         )
13379                 exit(0);
13380         exit(1);
13381 }
13382 EOP
13383         set try
13384         if eval $compile && $to try.c; then
13385                 if $run ./try; then
13386                         echo "And its _base field acts std."
13387                         val="$define"
13388                 else
13389                         echo "But its _base field isn't std."
13390                 fi
13391         else
13392                 echo "However, it seems to be lacking the _base field."
13393         fi
13394         $rm_try
13395         ;;
13396 esac
13397 set d_stdiobase
13398 eval $setvar
13399
13400 : see if fast_stdio exists
13401 val="$undef"
13402 case "$d_stdstdio:$d_stdio_ptr_lval" in
13403 "$define:$define")
13404         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13405         *$define*)
13406                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13407                 val="$define"
13408                 ;;
13409         esac
13410         ;;
13411 esac
13412 set d_faststdio
13413 eval $setvar
13414
13415
13416
13417 : see if fchdir exists
13418 set fchdir d_fchdir
13419 eval $inlibc
13420
13421 : see if fchmod exists
13422 set fchmod d_fchmod
13423 eval $inlibc
13424
13425 : see if fchown exists
13426 set fchown d_fchown
13427 eval $inlibc
13428
13429 : see if this is an fcntl system
13430 set fcntl d_fcntl
13431 eval $inlibc
13432
13433 : See if fcntl-based locking works.
13434 echo " "
13435 $cat >try.c <<EOCP
13436 #$i_stdlib I_STDLIB
13437 #ifdef I_STDLIB
13438 #include <stdlib.h>
13439 #endif
13440 #include <unistd.h>
13441 #include <fcntl.h>
13442 #include <signal.h>
13443 $signal_t blech(int x) { exit(3); }
13444 int main() {
13445 #if defined(F_SETLK) && defined(F_SETLKW)
13446      struct flock flock;
13447      int retval, fd;
13448      fd = open("try.c", O_RDONLY);
13449      flock.l_type = F_RDLCK;
13450      flock.l_whence = SEEK_SET;
13451      flock.l_start = flock.l_len = 0;
13452      signal(SIGALRM, blech);
13453      alarm(10);
13454      retval = fcntl(fd, F_SETLK, &flock);
13455      close(fd);
13456      (retval < 0 ? exit(2) : exit(0));
13457 #else
13458      exit(2);
13459 #endif
13460 }
13461 EOCP
13462 echo "Checking if fcntl-based file locking works... "
13463 case "$d_fcntl" in
13464 "$define")
13465         set try
13466         if eval $compile_ok; then
13467                 if $run ./try; then
13468                         echo "Yes, it seems to work."
13469                         val="$define"
13470                 else
13471                         echo "Nope, it didn't work."
13472                         val="$undef"
13473                         case "$?" in
13474                         3) $cat >&4 <<EOM
13475 ***
13476 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13477 *** This is (almost) impossible.
13478 *** If your NFS lock daemons are not feeling well, something like
13479 *** this may happen, please investigate.  Cannot continue, aborting.
13480 ***
13481 EOM
13482                                 exit 1
13483                                 ;;
13484                         esac
13485                 fi
13486         else
13487                 echo "I'm unable to compile the test program, so I'll assume not."
13488                 val="$undef"
13489         fi
13490         ;;
13491 *) val="$undef";
13492         echo "Nope, since you don't even have fcntl()."
13493         ;;
13494 esac
13495 set d_fcntl_can_lock
13496 eval $setvar
13497 $rm_try
13498
13499 : check for fd_set items
13500 $cat <<EOM
13501
13502 Checking to see how well your C compiler handles fd_set and friends ...
13503 EOM
13504 $cat >try.c <<EOCP
13505 #$i_stdlib I_STDLIB
13506 #ifdef I_STDLIB
13507 #include <stdlib.h>
13508 #endif
13509 #$i_systime I_SYS_TIME
13510 #$i_sysselct I_SYS_SELECT
13511 #$d_socket HAS_SOCKET
13512 #include <sys/types.h>
13513 #ifdef HAS_SOCKET
13514 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13515 #endif
13516 #ifdef I_SYS_TIME
13517 #include <sys/time.h>
13518 #endif
13519 #ifdef I_SYS_SELECT
13520 #include <sys/select.h>
13521 #endif
13522 int main() {
13523         fd_set fds;
13524
13525 #ifdef TRYBITS
13526         if(fds.fds_bits);
13527 #endif
13528
13529 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13530         exit(0);
13531 #else
13532         exit(1);
13533 #endif
13534 }
13535 EOCP
13536 set try -DTRYBITS
13537 if eval $compile; then
13538         d_fds_bits="$define"
13539         d_fd_set="$define"
13540         echo "Well, your system knows about the normal fd_set typedef..." >&4
13541         if $run ./try; then
13542                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13543                 d_fd_macros="$define"
13544         else
13545                 $cat >&4 <<'EOM'
13546 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13547 EOM
13548                 d_fd_macros="$undef"
13549         fi
13550 else
13551         $cat <<'EOM'
13552 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13553 EOM
13554         set try
13555         if eval $compile; then
13556                 d_fds_bits="$undef"
13557                 d_fd_set="$define"
13558                 echo "Well, your system has some sort of fd_set available..." >&4
13559                 if $run ./try; then
13560                         echo "and you have the normal fd_set macros." >&4
13561                         d_fd_macros="$define"
13562                 else
13563                         $cat <<'EOM'
13564 but not the normal fd_set macros!  Gross!  More work for me...
13565 EOM
13566                         d_fd_macros="$undef"
13567                 fi
13568         else
13569         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13570                 d_fd_set="$undef"
13571                 d_fds_bits="$undef"
13572                 d_fd_macros="$undef"
13573         fi
13574 fi
13575 $rm_try
13576
13577 : see if fgetpos exists
13578 set fgetpos d_fgetpos
13579 eval $inlibc
13580
13581 : see if finite exists
13582 set finite d_finite
13583 eval $inlibc
13584
13585 : see if finitel exists
13586 set finitel d_finitel
13587 eval $inlibc
13588
13589 : see if flock exists
13590 set flock d_flock
13591 eval $inlibc
13592
13593 : see if prototype for flock is available
13594 echo " "
13595 set d_flockproto flock $i_sysfile sys/file.h
13596 eval $hasproto
13597
13598 : see if fp_class exists
13599 set fp_class d_fp_class
13600 eval $inlibc
13601
13602 : see if pathconf exists
13603 set pathconf d_pathconf
13604 eval $inlibc
13605
13606 : see if fpathconf exists
13607 set fpathconf d_fpathconf
13608 eval $inlibc
13609
13610 : see if fpclass exists
13611 set fpclass d_fpclass
13612 eval $inlibc
13613
13614 : see if fpclassify exists
13615 set fpclassify d_fpclassify
13616 eval $inlibc
13617
13618 : see if fpclassl exists
13619 set fpclassl d_fpclassl
13620 eval $inlibc
13621
13622 : check for fpos64_t
13623 echo " "
13624 echo "Checking to see if you have fpos64_t..." >&4
13625 $cat >try.c <<EOCP
13626 #include <stdio.h>
13627 int main() { fpos64_t x = 7; }
13628 EOCP
13629 set try
13630 if eval $compile; then
13631         val="$define"
13632         echo "You have fpos64_t."
13633 else
13634         val="$undef"
13635         echo "You do not have fpos64_t."
13636         case "$fpossize" in
13637         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13638         esac
13639 fi
13640 $rm_try
13641 set d_fpos64_t
13642 eval $setvar
13643
13644 : see if frexpl exists
13645 set frexpl d_frexpl
13646 eval $inlibc
13647
13648 : see if this is a sys/param system
13649 set sys/param.h i_sysparam
13650 eval $inhdr
13651
13652 : see if this is a sys/mount.h system
13653 set sys/mount.h i_sysmount
13654 eval $inhdr
13655
13656 : Check for fs_data_s
13657 echo " "
13658 echo "Checking to see if your system supports struct fs_data..." >&4
13659 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13660 eval $hasstruct
13661 case "$d_fs_data_s" in
13662 "$define")      echo "Yes, it does."   ;;
13663 *)              echo "No, it doesn't." ;;
13664 esac
13665
13666 : see if fseeko exists
13667 set fseeko d_fseeko
13668 eval $inlibc
13669 case "$longsize" in
13670 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13671 esac
13672
13673 : see if fsetpos exists
13674 set fsetpos d_fsetpos
13675 eval $inlibc
13676
13677 : see if fstatfs exists
13678 set fstatfs d_fstatfs
13679 eval $inlibc
13680
13681 : see if statvfs exists
13682 set statvfs d_statvfs
13683 eval $inlibc
13684
13685 : see if fstatvfs exists
13686 set fstatvfs d_fstatvfs
13687 eval $inlibc
13688
13689
13690 : see if fsync exists
13691 set fsync d_fsync
13692 eval $inlibc
13693
13694 : see if ftello exists
13695 set ftello d_ftello
13696 eval $inlibc
13697 case "$longsize" in
13698 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13699 esac
13700
13701 : check for a working futimes
13702 d_futimes="$undef"
13703 echo " "
13704 echo "Checking if you have a working futimes()" >&4
13705 $cat >try.c <<EOCP
13706 #include <stdio.h>
13707 #include <sys/time.h>
13708 #include <errno.h>
13709 #include <fcntl.h>
13710
13711 int main ()
13712 {
13713     int fd, rv;
13714     fd = open ("try.c", O_RDWR);
13715     if (-1 == fd) exit (1);
13716     rv = futimes (fd, NULL);
13717     exit (rv == -1 ? errno : 0);
13718 }
13719 EOCP
13720 set try
13721 if eval $compile; then
13722     `$run ./try`
13723     rc=$?
13724     case "$rc" in
13725         0)  echo "Yes, you have" >&4
13726             d_futimes="$define"
13727             ;;
13728         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13729             ;;
13730     esac
13731 else
13732     echo "No, it does not (probably harmless)" >&4
13733 fi
13734 $rm_try
13735
13736 : see if ndbm.h is available
13737 set ndbm.h i_ndbm
13738 eval $inhdr
13739 : Compatibility location for RedHat 7.1
13740 set gdbm/ndbm.h i_gdbmndbm
13741 eval $inhdr
13742 : Compatibility location for Debian 4.0
13743 set gdbm-ndbm.h i_gdbm_ndbm
13744 eval $inhdr
13745
13746 val="$undef"
13747 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13748         : see if dbm_open exists
13749         set dbm_open d_dbm_open
13750         eval $inlibc
13751         case "$d_dbm_open" in
13752         $undef)
13753                 i_ndbm="$undef"
13754                 i_gdbmndbm="$undef"
13755                 i_gdbm_ndbm="$undef"
13756                 echo "We won't be including <ndbm.h>"
13757                 val="$undef"
13758                 ;;
13759         *) val="$define"
13760            ;;
13761         esac
13762 fi
13763 set d_ndbm
13764 eval $setvar
13765
13766 ndbm_hdr_protochk='name=$1; hdr=$2;
13767 eval "ihdr=\$""i_$name";
13768 val="$undef";
13769 if $test "$ihdr" = "$define"; then
13770         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13771         case "$d_cplusplus" in
13772         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13773         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13774         esac;
13775         case "$val" in
13776         $define) $echo "Your <$hdr> seems to have prototypes";;
13777         *) $echo "Your <$hdr> does not seem to have prototypes";;
13778         esac;
13779 fi;
13780 set "d_${name}_h_uses_prototypes";
13781 eval $setvar'
13782
13783 set ndbm ndbm.h
13784 eval $ndbm_hdr_protochk
13785 set gdbmndbm gdbm/ndbm.h
13786 eval $ndbm_hdr_protochk
13787 set gdbm_ndbm gdbm-ndbm.h
13788 eval $ndbm_hdr_protochk
13789
13790 : see if getaddrinfo exists
13791 set getaddrinfo d_getaddrinfo
13792 eval $inlibc
13793
13794 : see if getcwd exists
13795 set getcwd d_getcwd
13796 eval $inlibc
13797
13798 : see if getespwnam exists
13799 set getespwnam d_getespwnam
13800 eval $inlibc
13801
13802 : see if getfsstat exists
13803 set getfsstat d_getfsstat
13804 eval $inlibc
13805
13806 : see if getgrent exists
13807 set getgrent d_getgrent
13808 eval $inlibc
13809
13810 : see if getgrent_r exists
13811 set getgrent_r d_getgrent_r
13812 eval $inlibc
13813 case "$d_getgrent_r" in
13814 "$define")
13815         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13816         case "$d_getgrent_r_proto:$usethreads" in
13817         ":define")      d_getgrent_r_proto=define
13818                 set d_getgrent_r_proto getgrent_r $hdrs
13819                 eval $hasproto ;;
13820         *)      ;;
13821         esac
13822         case "$d_getgrent_r_proto" in
13823         define)
13824         case "$getgrent_r_proto" in
13825         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13826         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13827         esac
13828         case "$getgrent_r_proto" in
13829         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13830         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13831         esac
13832         case "$getgrent_r_proto" in
13833         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13834         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13835         esac
13836         case "$getgrent_r_proto" in
13837         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13838         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13839         esac
13840         case "$getgrent_r_proto" in
13841         ''|0) try='int getgrent_r(struct group*, char*, int);'
13842         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13843         esac
13844         case "$getgrent_r_proto" in
13845         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13846         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13847         esac
13848         case "$getgrent_r_proto" in
13849         ''|0)   d_getgrent_r=undef
13850                 getgrent_r_proto=0
13851                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13852         * )     case "$getgrent_r_proto" in
13853                 REENTRANT_PROTO*) ;;
13854                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13855                 esac
13856                 echo "Prototype: $try" ;;
13857         esac
13858         ;;
13859         *)      case "$usethreads" in
13860                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13861                 esac
13862                 d_getgrent_r=undef
13863                 getgrent_r_proto=0
13864                 ;;
13865         esac
13866         ;;
13867 *)      getgrent_r_proto=0
13868         ;;
13869 esac
13870
13871 : see if getgrgid_r exists
13872 set getgrgid_r d_getgrgid_r
13873 eval $inlibc
13874 case "$d_getgrgid_r" in
13875 "$define")
13876         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13877         case "$d_getgrgid_r_proto:$usethreads" in
13878         ":define")      d_getgrgid_r_proto=define
13879                 set d_getgrgid_r_proto getgrgid_r $hdrs
13880                 eval $hasproto ;;
13881         *)      ;;
13882         esac
13883         case "$d_getgrgid_r_proto" in
13884         define)
13885         case "$getgrgid_r_proto" in
13886         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13887         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13888         esac
13889         case "$getgrgid_r_proto" in
13890         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13891         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13892         esac
13893         case "$getgrgid_r_proto" in
13894         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13895         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13896         esac
13897         case "$getgrgid_r_proto" in
13898         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13899         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13900         esac
13901         case "$getgrgid_r_proto" in
13902         ''|0)   d_getgrgid_r=undef
13903                 getgrgid_r_proto=0
13904                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13905         * )     case "$getgrgid_r_proto" in
13906                 REENTRANT_PROTO*) ;;
13907                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13908                 esac
13909                 echo "Prototype: $try" ;;
13910         esac
13911         ;;
13912         *)      case "$usethreads" in
13913                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13914                 esac
13915                 d_getgrgid_r=undef
13916                 getgrgid_r_proto=0
13917                 ;;
13918         esac
13919         ;;
13920 *)      getgrgid_r_proto=0
13921         ;;
13922 esac
13923
13924 : see if getgrnam_r exists
13925 set getgrnam_r d_getgrnam_r
13926 eval $inlibc
13927 case "$d_getgrnam_r" in
13928 "$define")
13929         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13930         case "$d_getgrnam_r_proto:$usethreads" in
13931         ":define")      d_getgrnam_r_proto=define
13932                 set d_getgrnam_r_proto getgrnam_r $hdrs
13933                 eval $hasproto ;;
13934         *)      ;;
13935         esac
13936         case "$d_getgrnam_r_proto" in
13937         define)
13938         case "$getgrnam_r_proto" in
13939         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13940         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13941         esac
13942         case "$getgrnam_r_proto" in
13943         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13944         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13945         esac
13946         case "$getgrnam_r_proto" in
13947         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13948         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13949         esac
13950         case "$getgrnam_r_proto" in
13951         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13952         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13953         esac
13954         case "$getgrnam_r_proto" in
13955         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13956         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13957         esac
13958         case "$getgrnam_r_proto" in
13959         ''|0)   d_getgrnam_r=undef
13960                 getgrnam_r_proto=0
13961                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13962         * )     case "$getgrnam_r_proto" in
13963                 REENTRANT_PROTO*) ;;
13964                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13965                 esac
13966                 echo "Prototype: $try" ;;
13967         esac
13968         ;;
13969         *)      case "$usethreads" in
13970                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13971                 esac
13972                 d_getgrnam_r=undef
13973                 getgrnam_r_proto=0
13974                 ;;
13975         esac
13976         ;;
13977 *)      getgrnam_r_proto=0
13978         ;;
13979 esac
13980
13981 : see if gethostbyaddr exists
13982 set gethostbyaddr d_gethbyaddr
13983 eval $inlibc
13984
13985 : see if gethostbyname exists
13986 set gethostbyname d_gethbyname
13987 eval $inlibc
13988
13989 : see if gethostent exists
13990 set gethostent d_gethent
13991 eval $inlibc
13992
13993 : see how we will look up host name
13994 echo " "
13995 call=''
13996 if set gethostname val -f d_gethname; eval $csym; $val; then
13997         echo 'gethostname() found.' >&4
13998         d_gethname="$define"
13999         call=gethostname
14000 fi
14001 if set uname val -f d_uname; eval $csym; $val; then
14002         if ./xenix; then
14003                 $cat <<'EOM'
14004 uname() was found, but you're running xenix, and older versions of xenix
14005 have a broken uname(). If you don't really know whether your xenix is old
14006 enough to have a broken system call, use the default answer.
14007
14008 EOM
14009                 dflt=y
14010                 case "$d_uname" in
14011                 "$define") dflt=n;;
14012                 esac
14013                 rp='Is your uname() broken?'
14014                 . ./myread
14015                 case "$ans" in
14016                 n*) d_uname="$define"; call=uname;;
14017                 esac
14018         else
14019                 echo 'uname() found.' >&4
14020                 d_uname="$define"
14021                 case "$call" in
14022                 '') call=uname ;;
14023                 esac
14024         fi
14025 fi
14026 case "$d_gethname" in
14027 '') d_gethname="$undef";;
14028 esac
14029 case "$d_uname" in
14030 '') d_uname="$undef";;
14031 esac
14032 case "$d_uname$d_gethname" in
14033 *define*)
14034         dflt=n
14035         cat <<EOM
14036
14037 Every now and then someone has a $call() that lies about the hostname
14038 but can't be fixed for political or economic reasons.  If you wish, I can
14039 pretend $call() isn't there and maybe compute hostname at run-time
14040 thanks to the '$phostname' command.
14041
14042 EOM
14043         rp="Shall I ignore $call() from now on?"
14044         . ./myread
14045         case "$ans" in
14046         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14047         esac;;
14048 esac
14049 case "$phostname" in
14050 '') aphostname='';;
14051 *) case "$aphostname" in
14052         /*) ;;
14053         *) set X $phostname
14054                 shift
14055                 file=$1
14056                 shift
14057                 file=`./loc $file $file $pth`
14058                 aphostname=`echo $file $*`
14059                 ;;
14060         esac
14061         ;;
14062 esac
14063 case "$d_uname$d_gethname" in
14064 *define*) ;;
14065 *)
14066         case "$phostname" in
14067         '')
14068                 echo "There will be no way for $package to get your hostname." >&4;;
14069         *)
14070         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14071                 ;;
14072         esac;;
14073 esac
14074 case "$d_phostname" in
14075 '') d_phostname="$undef";;
14076 esac
14077
14078 : see if gethostbyaddr_r exists
14079 set gethostbyaddr_r d_gethostbyaddr_r
14080 eval $inlibc
14081 case "$d_gethostbyaddr_r" in
14082 "$define")
14083         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14084         case "$d_gethostbyaddr_r_proto:$usethreads" in
14085         ":define")      d_gethostbyaddr_r_proto=define
14086                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14087                 eval $hasproto ;;
14088         *)      ;;
14089         esac
14090         case "$d_gethostbyaddr_r_proto" in
14091         define)
14092         case "$gethostbyaddr_r_proto" in
14093         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14094         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14095         esac
14096         case "$gethostbyaddr_r_proto" in
14097         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14098         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14099         esac
14100         case "$gethostbyaddr_r_proto" in
14101         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14102         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14103         esac
14104         case "$gethostbyaddr_r_proto" in
14105         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14106         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14107         esac
14108         case "$gethostbyaddr_r_proto" in
14109         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14110         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14111         esac
14112         case "$gethostbyaddr_r_proto" in
14113         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14114         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14115         esac
14116         case "$gethostbyaddr_r_proto" in
14117         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14118         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14119         esac
14120         case "$gethostbyaddr_r_proto" in
14121         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14122         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14123         esac
14124         case "$gethostbyaddr_r_proto" in
14125         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14126         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14127         esac
14128         case "$gethostbyaddr_r_proto" in
14129         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14130         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14131         esac
14132         case "$gethostbyaddr_r_proto" in
14133         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14134         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14135         esac
14136         case "$gethostbyaddr_r_proto" in
14137         ''|0)   d_gethostbyaddr_r=undef
14138                 gethostbyaddr_r_proto=0
14139                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14140         * )     case "$gethostbyaddr_r_proto" in
14141                 REENTRANT_PROTO*) ;;
14142                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14143                 esac
14144                 echo "Prototype: $try" ;;
14145         esac
14146         ;;
14147         *)      case "$usethreads" in
14148                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14149                 esac
14150                 d_gethostbyaddr_r=undef
14151                 gethostbyaddr_r_proto=0
14152                 ;;
14153         esac
14154         ;;
14155 *)      gethostbyaddr_r_proto=0
14156         ;;
14157 esac
14158
14159 : see if gethostbyname_r exists
14160 set gethostbyname_r d_gethostbyname_r
14161 eval $inlibc
14162 case "$d_gethostbyname_r" in
14163 "$define")
14164         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14165         case "$d_gethostbyname_r_proto:$usethreads" in
14166         ":define")      d_gethostbyname_r_proto=define
14167                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14168                 eval $hasproto ;;
14169         *)      ;;
14170         esac
14171         case "$d_gethostbyname_r_proto" in
14172         define)
14173         case "$gethostbyname_r_proto" in
14174         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14175         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14176         esac
14177         case "$gethostbyname_r_proto" in
14178         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14179         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14180         esac
14181         case "$gethostbyname_r_proto" in
14182         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14183         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14184         esac
14185         case "$gethostbyname_r_proto" in
14186         ''|0)   d_gethostbyname_r=undef
14187                 gethostbyname_r_proto=0
14188                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14189         * )     case "$gethostbyname_r_proto" in
14190                 REENTRANT_PROTO*) ;;
14191                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14192                 esac
14193                 echo "Prototype: $try" ;;
14194         esac
14195         ;;
14196         *)      case "$usethreads" in
14197                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14198                 esac
14199                 d_gethostbyname_r=undef
14200                 gethostbyname_r_proto=0
14201                 ;;
14202         esac
14203         ;;
14204 *)      gethostbyname_r_proto=0
14205         ;;
14206 esac
14207
14208 : see if gethostent_r exists
14209 set gethostent_r d_gethostent_r
14210 eval $inlibc
14211 case "$d_gethostent_r" in
14212 "$define")
14213         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14214         case "$d_gethostent_r_proto:$usethreads" in
14215         ":define")      d_gethostent_r_proto=define
14216                 set d_gethostent_r_proto gethostent_r $hdrs
14217                 eval $hasproto ;;
14218         *)      ;;
14219         esac
14220         case "$d_gethostent_r_proto" in
14221         define)
14222         case "$gethostent_r_proto" in
14223         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14224         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14225         esac
14226         case "$gethostent_r_proto" in
14227         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14228         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14229         esac
14230         case "$gethostent_r_proto" in
14231         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14232         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14233         esac
14234         case "$gethostent_r_proto" in
14235         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14236         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14237         esac
14238         case "$gethostent_r_proto" in
14239         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14240         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14241         esac
14242         case "$gethostent_r_proto" in
14243         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14244         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14245         esac
14246         case "$gethostent_r_proto" in
14247         ''|0)   d_gethostent_r=undef
14248                 gethostent_r_proto=0
14249                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14250         * )     case "$gethostent_r_proto" in
14251                 REENTRANT_PROTO*) ;;
14252                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14253                 esac
14254                 echo "Prototype: $try" ;;
14255         esac
14256         ;;
14257         *)      case "$usethreads" in
14258                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14259                 esac
14260                 d_gethostent_r=undef
14261                 gethostent_r_proto=0
14262                 ;;
14263         esac
14264         ;;
14265 *)      gethostent_r_proto=0
14266         ;;
14267 esac
14268
14269 : see if prototypes for various gethostxxx netdb.h functions are available
14270 echo " "
14271 set d_gethostprotos gethostent $i_netdb netdb.h
14272 eval $hasproto
14273
14274 : see if getitimer exists
14275 set getitimer d_getitimer
14276 eval $inlibc
14277
14278 : see if getlogin exists
14279 set getlogin d_getlogin
14280 eval $inlibc
14281
14282 : see if getlogin_r exists
14283 set getlogin_r d_getlogin_r
14284 eval $inlibc
14285 case "$d_getlogin_r" in
14286 "$define")
14287         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14288         case "$d_getlogin_r_proto:$usethreads" in
14289         ":define")      d_getlogin_r_proto=define
14290                 set d_getlogin_r_proto getlogin_r $hdrs
14291                 eval $hasproto ;;
14292         *)      ;;
14293         esac
14294         case "$d_getlogin_r_proto" in
14295         define)
14296         case "$getlogin_r_proto" in
14297         ''|0) try='int getlogin_r(char*, size_t);'
14298         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14299         esac
14300         case "$getlogin_r_proto" in
14301         ''|0) try='int getlogin_r(char*, int);'
14302         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14303         esac
14304         case "$getlogin_r_proto" in
14305         ''|0) try='char* getlogin_r(char*, size_t);'
14306         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14307         esac
14308         case "$getlogin_r_proto" in
14309         ''|0) try='char* getlogin_r(char*, int);'
14310         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14311         esac
14312         case "$getlogin_r_proto" in
14313         ''|0)   d_getlogin_r=undef
14314                 getlogin_r_proto=0
14315                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14316         * )     case "$getlogin_r_proto" in
14317                 REENTRANT_PROTO*) ;;
14318                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14319                 esac
14320                 echo "Prototype: $try" ;;
14321         esac
14322         ;;
14323         *)      case "$usethreads" in
14324                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14325                 esac
14326                 d_getlogin_r=undef
14327                 getlogin_r_proto=0
14328                 ;;
14329         esac
14330         ;;
14331 *)      getlogin_r_proto=0
14332         ;;
14333 esac
14334
14335 : see if getmnt exists
14336 set getmnt d_getmnt
14337 eval $inlibc
14338
14339 : see if getmntent exists
14340 set getmntent d_getmntent
14341 eval $inlibc
14342
14343 : see if getnameinfo exists
14344 set getnameinfo d_getnameinfo
14345 eval $inlibc
14346
14347 : see if getnetbyaddr exists
14348 set getnetbyaddr d_getnbyaddr
14349 eval $inlibc
14350
14351 : see if getnetbyname exists
14352 set getnetbyname d_getnbyname
14353 eval $inlibc
14354
14355 : see if getnetent exists
14356 set getnetent d_getnent
14357 eval $inlibc
14358
14359 : see if getnetbyaddr_r exists
14360 set getnetbyaddr_r d_getnetbyaddr_r
14361 eval $inlibc
14362 case "$d_getnetbyaddr_r" in
14363 "$define")
14364         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14365         case "$d_getnetbyaddr_r_proto:$usethreads" in
14366         ":define")      d_getnetbyaddr_r_proto=define
14367                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14368                 eval $hasproto ;;
14369         *)      ;;
14370         esac
14371         case "$d_getnetbyaddr_r_proto" in
14372         define)
14373         case "$getnetbyaddr_r_proto" in
14374         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14375         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14376         esac
14377         case "$getnetbyaddr_r_proto" in
14378         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14379         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14380         esac
14381         case "$getnetbyaddr_r_proto" in
14382         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14383         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14384         esac
14385         case "$getnetbyaddr_r_proto" in
14386         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14387         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14388         esac
14389         case "$getnetbyaddr_r_proto" in
14390         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14391         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14392         esac
14393         case "$getnetbyaddr_r_proto" in
14394         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14395         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14396         esac
14397         case "$getnetbyaddr_r_proto" in
14398         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14399         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14400         esac
14401         case "$getnetbyaddr_r_proto" in
14402         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14403         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14404         esac
14405         case "$getnetbyaddr_r_proto" in
14406         ''|0)   d_getnetbyaddr_r=undef
14407                 getnetbyaddr_r_proto=0
14408                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14409         * )     case "$getnetbyaddr_r_proto" in
14410                 REENTRANT_PROTO*) ;;
14411                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14412                 esac
14413                 echo "Prototype: $try" ;;
14414         esac
14415         ;;
14416         *)      case "$usethreads" in
14417                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14418                 esac
14419                 d_getnetbyaddr_r=undef
14420                 getnetbyaddr_r_proto=0
14421                 ;;
14422         esac
14423         ;;
14424 *)      getnetbyaddr_r_proto=0
14425         ;;
14426 esac
14427
14428 : see if getnetbyname_r exists
14429 set getnetbyname_r d_getnetbyname_r
14430 eval $inlibc
14431 case "$d_getnetbyname_r" in
14432 "$define")
14433         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14434         case "$d_getnetbyname_r_proto:$usethreads" in
14435         ":define")      d_getnetbyname_r_proto=define
14436                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14437                 eval $hasproto ;;
14438         *)      ;;
14439         esac
14440         case "$d_getnetbyname_r_proto" in
14441         define)
14442         case "$getnetbyname_r_proto" in
14443         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14444         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14445         esac
14446         case "$getnetbyname_r_proto" in
14447         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14448         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14449         esac
14450         case "$getnetbyname_r_proto" in
14451         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14452         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14453         esac
14454         case "$getnetbyname_r_proto" in
14455         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14456         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14457         esac
14458         case "$getnetbyname_r_proto" in
14459         ''|0)   d_getnetbyname_r=undef
14460                 getnetbyname_r_proto=0
14461                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14462         * )     case "$getnetbyname_r_proto" in
14463                 REENTRANT_PROTO*) ;;
14464                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14465                 esac
14466                 echo "Prototype: $try" ;;
14467         esac
14468         ;;
14469         *)      case "$usethreads" in
14470                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14471                 esac
14472                 d_getnetbyname_r=undef
14473                 getnetbyname_r_proto=0
14474                 ;;
14475         esac
14476         ;;
14477 *)      getnetbyname_r_proto=0
14478         ;;
14479 esac
14480
14481 : see if getnetent_r exists
14482 set getnetent_r d_getnetent_r
14483 eval $inlibc
14484 case "$d_getnetent_r" in
14485 "$define")
14486         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14487         case "$d_getnetent_r_proto:$usethreads" in
14488         ":define")      d_getnetent_r_proto=define
14489                 set d_getnetent_r_proto getnetent_r $hdrs
14490                 eval $hasproto ;;
14491         *)      ;;
14492         esac
14493         case "$d_getnetent_r_proto" in
14494         define)
14495         case "$getnetent_r_proto" in
14496         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14497         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14498         esac
14499         case "$getnetent_r_proto" in
14500         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14501         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14502         esac
14503         case "$getnetent_r_proto" in
14504         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14505         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14506         esac
14507         case "$getnetent_r_proto" in
14508         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14509         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14510         esac
14511         case "$getnetent_r_proto" in
14512         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14513         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14514         esac
14515         case "$getnetent_r_proto" in
14516         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14517         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14518         esac
14519         case "$getnetent_r_proto" in
14520         ''|0)   d_getnetent_r=undef
14521                 getnetent_r_proto=0
14522                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14523         * )     case "$getnetent_r_proto" in
14524                 REENTRANT_PROTO*) ;;
14525                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14526                 esac
14527                 echo "Prototype: $try" ;;
14528         esac
14529         ;;
14530         *)      case "$usethreads" in
14531                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14532                 esac
14533                 d_getnetent_r=undef
14534                 getnetent_r_proto=0
14535                 ;;
14536         esac
14537         ;;
14538 *)      getnetent_r_proto=0
14539         ;;
14540 esac
14541
14542 : see if prototypes for various getnetxxx netdb.h functions are available
14543 echo " "
14544 set d_getnetprotos getnetent $i_netdb netdb.h
14545 eval $hasproto
14546
14547 : see if getpagesize exists
14548 set getpagesize d_getpagsz
14549 eval $inlibc
14550
14551 : Optional checks for getprotobyname and getprotobynumber
14552
14553 : see if getprotobyname exists
14554 set getprotobyname d_getpbyname
14555 eval $inlibc
14556
14557 : see if getprotobynumber exists
14558 set getprotobynumber d_getpbynumber
14559 eval $inlibc
14560
14561 : see if getprotoent exists
14562 set getprotoent d_getpent
14563 eval $inlibc
14564
14565 : see if getpgid exists
14566 set getpgid d_getpgid
14567 eval $inlibc
14568
14569 : see if getpgrp2 exists
14570 set getpgrp2 d_getpgrp2
14571 eval $inlibc
14572
14573 : see if getppid exists
14574 set getppid d_getppid
14575 eval $inlibc
14576
14577 : see if getpriority exists
14578 set getpriority d_getprior
14579 eval $inlibc
14580
14581 : see if getprotobyname_r exists
14582 set getprotobyname_r d_getprotobyname_r
14583 eval $inlibc
14584 case "$d_getprotobyname_r" in
14585 "$define")
14586         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14587         case "$d_getprotobyname_r_proto:$usethreads" in
14588         ":define")      d_getprotobyname_r_proto=define
14589                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14590                 eval $hasproto ;;
14591         *)      ;;
14592         esac
14593         case "$d_getprotobyname_r_proto" in
14594         define)
14595         case "$getprotobyname_r_proto" in
14596         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14597         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14598         esac
14599         case "$getprotobyname_r_proto" in
14600         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14601         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14602         esac
14603         case "$getprotobyname_r_proto" in
14604         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14605         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14606         esac
14607         case "$getprotobyname_r_proto" in
14608         ''|0)   d_getprotobyname_r=undef
14609                 getprotobyname_r_proto=0
14610                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14611         * )     case "$getprotobyname_r_proto" in
14612                 REENTRANT_PROTO*) ;;
14613                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14614                 esac
14615                 echo "Prototype: $try" ;;
14616         esac
14617         ;;
14618         *)      case "$usethreads" in
14619                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14620                 esac
14621                 d_getprotobyname_r=undef
14622                 getprotobyname_r_proto=0
14623                 ;;
14624         esac
14625         ;;
14626 *)      getprotobyname_r_proto=0
14627         ;;
14628 esac
14629
14630 : see if getprotobynumber_r exists
14631 set getprotobynumber_r d_getprotobynumber_r
14632 eval $inlibc
14633 case "$d_getprotobynumber_r" in
14634 "$define")
14635         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14636         case "$d_getprotobynumber_r_proto:$usethreads" in
14637         ":define")      d_getprotobynumber_r_proto=define
14638                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14639                 eval $hasproto ;;
14640         *)      ;;
14641         esac
14642         case "$d_getprotobynumber_r_proto" in
14643         define)
14644         case "$getprotobynumber_r_proto" in
14645         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14646         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14647         esac
14648         case "$getprotobynumber_r_proto" in
14649         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14650         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14651         esac
14652         case "$getprotobynumber_r_proto" in
14653         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14654         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14655         esac
14656         case "$getprotobynumber_r_proto" in
14657         ''|0)   d_getprotobynumber_r=undef
14658                 getprotobynumber_r_proto=0
14659                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14660         * )     case "$getprotobynumber_r_proto" in
14661                 REENTRANT_PROTO*) ;;
14662                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14663                 esac
14664                 echo "Prototype: $try" ;;
14665         esac
14666         ;;
14667         *)      case "$usethreads" in
14668                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14669                 esac
14670                 d_getprotobynumber_r=undef
14671                 getprotobynumber_r_proto=0
14672                 ;;
14673         esac
14674         ;;
14675 *)      getprotobynumber_r_proto=0
14676         ;;
14677 esac
14678
14679 : see if getprotoent_r exists
14680 set getprotoent_r d_getprotoent_r
14681 eval $inlibc
14682 case "$d_getprotoent_r" in
14683 "$define")
14684         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14685         case "$d_getprotoent_r_proto:$usethreads" in
14686         ":define")      d_getprotoent_r_proto=define
14687                 set d_getprotoent_r_proto getprotoent_r $hdrs
14688                 eval $hasproto ;;
14689         *)      ;;
14690         esac
14691         case "$d_getprotoent_r_proto" in
14692         define)
14693         case "$getprotoent_r_proto" in
14694         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14695         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14696         esac
14697         case "$getprotoent_r_proto" in
14698         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14699         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14700         esac
14701         case "$getprotoent_r_proto" in
14702         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14703         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14704         esac
14705         case "$getprotoent_r_proto" in
14706         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14707         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14708         esac
14709         case "$getprotoent_r_proto" in
14710         ''|0)   d_getprotoent_r=undef
14711                 getprotoent_r_proto=0
14712                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14713         * )     case "$getprotoent_r_proto" in
14714                 REENTRANT_PROTO*) ;;
14715                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14716                 esac
14717                 echo "Prototype: $try" ;;
14718         esac
14719         ;;
14720         *)      case "$usethreads" in
14721                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14722                 esac
14723                 d_getprotoent_r=undef
14724                 getprotoent_r_proto=0
14725                 ;;
14726         esac
14727         ;;
14728 *)      getprotoent_r_proto=0
14729         ;;
14730 esac
14731
14732 : see if prototypes for various getprotoxxx netdb.h functions are available
14733 echo " "
14734 set d_getprotoprotos getprotoent $i_netdb netdb.h
14735 eval $hasproto
14736
14737 : see if getprpwnam exists
14738 set getprpwnam d_getprpwnam
14739 eval $inlibc
14740
14741 : see if getpwent exists
14742 set getpwent d_getpwent
14743 eval $inlibc
14744
14745 : see if getpwent_r exists
14746 set getpwent_r d_getpwent_r
14747 eval $inlibc
14748 case "$d_getpwent_r" in
14749 "$define")
14750         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14751         case "$d_getpwent_r_proto:$usethreads" in
14752         ":define")      d_getpwent_r_proto=define
14753                 set d_getpwent_r_proto getpwent_r $hdrs
14754                 eval $hasproto ;;
14755         *)      ;;
14756         esac
14757         case "$d_getpwent_r_proto" in
14758         define)
14759         case "$getpwent_r_proto" in
14760         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14761         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14762         esac
14763         case "$getpwent_r_proto" in
14764         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14765         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14766         esac
14767         case "$getpwent_r_proto" in
14768         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14769         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14770         esac
14771         case "$getpwent_r_proto" in
14772         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14773         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14774         esac
14775         case "$getpwent_r_proto" in
14776         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14777         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14778         esac
14779         case "$getpwent_r_proto" in
14780         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14781         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14782         esac
14783         case "$getpwent_r_proto" in
14784         ''|0)   d_getpwent_r=undef
14785                 getpwent_r_proto=0
14786                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14787         * )     case "$getpwent_r_proto" in
14788                 REENTRANT_PROTO*) ;;
14789                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14790                 esac
14791                 echo "Prototype: $try" ;;
14792         esac
14793         ;;
14794         *)      case "$usethreads" in
14795                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14796                 esac
14797                 d_getpwent_r=undef
14798                 getpwent_r_proto=0
14799                 ;;
14800         esac
14801         ;;
14802 *)      getpwent_r_proto=0
14803         ;;
14804 esac
14805
14806 : see if getpwnam_r exists
14807 set getpwnam_r d_getpwnam_r
14808 eval $inlibc
14809 case "$d_getpwnam_r" in
14810 "$define")
14811         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14812         case "$d_getpwnam_r_proto:$usethreads" in
14813         ":define")      d_getpwnam_r_proto=define
14814                 set d_getpwnam_r_proto getpwnam_r $hdrs
14815                 eval $hasproto ;;
14816         *)      ;;
14817         esac
14818         case "$d_getpwnam_r_proto" in
14819         define)
14820         case "$getpwnam_r_proto" in
14821         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14822         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14823         esac
14824         case "$getpwnam_r_proto" in
14825         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14826         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14827         esac
14828         case "$getpwnam_r_proto" in
14829         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14830         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14831         esac
14832         case "$getpwnam_r_proto" in
14833         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14834         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14835         esac
14836         case "$getpwnam_r_proto" in
14837         ''|0)   d_getpwnam_r=undef
14838                 getpwnam_r_proto=0
14839                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14840         * )     case "$getpwnam_r_proto" in
14841                 REENTRANT_PROTO*) ;;
14842                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14843                 esac
14844                 echo "Prototype: $try" ;;
14845         esac
14846         ;;
14847         *)      case "$usethreads" in
14848                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14849                 esac
14850                 d_getpwnam_r=undef
14851                 getpwnam_r_proto=0
14852                 ;;
14853         esac
14854         ;;
14855 *)      getpwnam_r_proto=0
14856         ;;
14857 esac
14858
14859 : see if getpwuid_r exists
14860 set getpwuid_r d_getpwuid_r
14861 eval $inlibc
14862 case "$d_getpwuid_r" in
14863 "$define")
14864         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14865         case "$d_getpwuid_r_proto:$usethreads" in
14866         ":define")      d_getpwuid_r_proto=define
14867                 set d_getpwuid_r_proto getpwuid_r $hdrs
14868                 eval $hasproto ;;
14869         *)      ;;
14870         esac
14871         case "$d_getpwuid_r_proto" in
14872         define)
14873         case "$getpwuid_r_proto" in
14874         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14875         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14876         esac
14877         case "$getpwuid_r_proto" in
14878         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14879         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14880         esac
14881         case "$getpwuid_r_proto" in
14882         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14883         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14884         esac
14885         case "$getpwuid_r_proto" in
14886         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14887         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14888         esac
14889         case "$getpwuid_r_proto" in
14890         ''|0)   d_getpwuid_r=undef
14891                 getpwuid_r_proto=0
14892                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14893         * )     case "$getpwuid_r_proto" in
14894                 REENTRANT_PROTO*) ;;
14895                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14896                 esac
14897                 echo "Prototype: $try" ;;
14898         esac
14899         ;;
14900         *)      case "$usethreads" in
14901                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14902                 esac
14903                 d_getpwuid_r=undef
14904                 getpwuid_r_proto=0
14905                 ;;
14906         esac
14907         ;;
14908 *)      getpwuid_r_proto=0
14909         ;;
14910 esac
14911
14912 : Optional checks for getsbyname and getsbyport
14913
14914 : see if getservbyname exists
14915 set getservbyname d_getsbyname
14916 eval $inlibc
14917
14918 : see if getservbyport exists
14919 set getservbyport d_getsbyport
14920 eval $inlibc
14921
14922 : see if getservent exists
14923 set getservent d_getsent
14924 eval $inlibc
14925
14926 : see if getservbyname_r exists
14927 set getservbyname_r d_getservbyname_r
14928 eval $inlibc
14929 case "$d_getservbyname_r" in
14930 "$define")
14931         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14932         case "$d_getservbyname_r_proto:$usethreads" in
14933         ":define")      d_getservbyname_r_proto=define
14934                 set d_getservbyname_r_proto getservbyname_r $hdrs
14935                 eval $hasproto ;;
14936         *)      ;;
14937         esac
14938         case "$d_getservbyname_r_proto" in
14939         define)
14940         case "$getservbyname_r_proto" in
14941         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14942         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14943         esac
14944         case "$getservbyname_r_proto" in
14945         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14946         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14947         esac
14948         case "$getservbyname_r_proto" in
14949         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14950         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14951         esac
14952         case "$getservbyname_r_proto" in
14953         ''|0)   d_getservbyname_r=undef
14954                 getservbyname_r_proto=0
14955                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14956         * )     case "$getservbyname_r_proto" in
14957                 REENTRANT_PROTO*) ;;
14958                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14959                 esac
14960                 echo "Prototype: $try" ;;
14961         esac
14962         ;;
14963         *)      case "$usethreads" in
14964                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14965                 esac
14966                 d_getservbyname_r=undef
14967                 getservbyname_r_proto=0
14968                 ;;
14969         esac
14970         ;;
14971 *)      getservbyname_r_proto=0
14972         ;;
14973 esac
14974
14975 : see if getservbyport_r exists
14976 set getservbyport_r d_getservbyport_r
14977 eval $inlibc
14978 case "$d_getservbyport_r" in
14979 "$define")
14980         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14981         case "$d_getservbyport_r_proto:$usethreads" in
14982         ":define")      d_getservbyport_r_proto=define
14983                 set d_getservbyport_r_proto getservbyport_r $hdrs
14984                 eval $hasproto ;;
14985         *)      ;;
14986         esac
14987         case "$d_getservbyport_r_proto" in
14988         define)
14989         case "$getservbyport_r_proto" in
14990         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14991         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14992         esac
14993         case "$getservbyport_r_proto" in
14994         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14995         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14996         esac
14997         case "$getservbyport_r_proto" in
14998         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14999         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15000         esac
15001         case "$getservbyport_r_proto" in
15002         ''|0)   d_getservbyport_r=undef
15003                 getservbyport_r_proto=0
15004                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15005         * )     case "$getservbyport_r_proto" in
15006                 REENTRANT_PROTO*) ;;
15007                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15008                 esac
15009                 echo "Prototype: $try" ;;
15010         esac
15011         ;;
15012         *)      case "$usethreads" in
15013                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15014                 esac
15015                 d_getservbyport_r=undef
15016                 getservbyport_r_proto=0
15017                 ;;
15018         esac
15019         ;;
15020 *)      getservbyport_r_proto=0
15021         ;;
15022 esac
15023
15024 : see if getservent_r exists
15025 set getservent_r d_getservent_r
15026 eval $inlibc
15027 case "$d_getservent_r" in
15028 "$define")
15029         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15030         case "$d_getservent_r_proto:$usethreads" in
15031         ":define")      d_getservent_r_proto=define
15032                 set d_getservent_r_proto getservent_r $hdrs
15033                 eval $hasproto ;;
15034         *)      ;;
15035         esac
15036         case "$d_getservent_r_proto" in
15037         define)
15038         case "$getservent_r_proto" in
15039         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15040         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15041         esac
15042         case "$getservent_r_proto" in
15043         ''|0) try='int getservent_r(struct servent*, char*, int);'
15044         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15045         esac
15046         case "$getservent_r_proto" in
15047         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15048         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15049         esac
15050         case "$getservent_r_proto" in
15051         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15052         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15053         esac
15054         case "$getservent_r_proto" in
15055         ''|0)   d_getservent_r=undef
15056                 getservent_r_proto=0
15057                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15058         * )     case "$getservent_r_proto" in
15059                 REENTRANT_PROTO*) ;;
15060                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15061                 esac
15062                 echo "Prototype: $try" ;;
15063         esac
15064         ;;
15065         *)      case "$usethreads" in
15066                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15067                 esac
15068                 d_getservent_r=undef
15069                 getservent_r_proto=0
15070                 ;;
15071         esac
15072         ;;
15073 *)      getservent_r_proto=0
15074         ;;
15075 esac
15076
15077 : see if prototypes for various getservxxx netdb.h functions are available
15078 echo " "
15079 set d_getservprotos getservent $i_netdb netdb.h
15080 eval $hasproto
15081
15082 : see if getspnam exists
15083 set getspnam d_getspnam
15084 eval $inlibc
15085
15086 : see if this is a shadow.h system
15087 set shadow.h i_shadow
15088 eval $inhdr
15089
15090 : see if getspnam_r exists
15091 set getspnam_r d_getspnam_r
15092 eval $inlibc
15093 case "$d_getspnam_r" in
15094 "$define")
15095         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15096         case "$d_getspnam_r_proto:$usethreads" in
15097         ":define")      d_getspnam_r_proto=define
15098                 set d_getspnam_r_proto getspnam_r $hdrs
15099                 eval $hasproto ;;
15100         *)      ;;
15101         esac
15102         case "$d_getspnam_r_proto" in
15103         define)
15104         case "$getspnam_r_proto" in
15105         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15106         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15107         esac
15108         case "$getspnam_r_proto" in
15109         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15110         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15111         esac
15112         case "$getspnam_r_proto" in
15113         ''|0)   d_getspnam_r=undef
15114                 getspnam_r_proto=0
15115                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15116         * )     case "$getspnam_r_proto" in
15117                 REENTRANT_PROTO*) ;;
15118                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15119                 esac
15120                 echo "Prototype: $try" ;;
15121         esac
15122         ;;
15123         *)      case "$usethreads" in
15124                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15125                 esac
15126                 d_getspnam_r=undef
15127                 getspnam_r_proto=0
15128                 ;;
15129         esac
15130         ;;
15131 *)      getspnam_r_proto=0
15132         ;;
15133 esac
15134
15135 : see if gettimeofday or ftime exists
15136 set gettimeofday d_gettimeod
15137 eval $inlibc
15138 case "$d_gettimeod" in
15139 "$undef")
15140         set ftime d_ftime 
15141         eval $inlibc
15142         ;;
15143 *)
15144         val="$undef"; set d_ftime; eval $setvar
15145         ;;
15146 esac
15147 case "$d_gettimeod$d_ftime" in
15148 "$undef$undef")
15149         echo " "
15150         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15151         ;;
15152 esac
15153
15154 : see if gmtime_r exists
15155 set gmtime_r d_gmtime_r
15156 eval $inlibc
15157 case "$d_gmtime_r" in
15158 "$define")
15159         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15160         case "$d_gmtime_r_proto:$usethreads" in
15161         ":define")      d_gmtime_r_proto=define
15162                 set d_gmtime_r_proto gmtime_r $hdrs
15163                 eval $hasproto ;;
15164         *)      ;;
15165         esac
15166         case "$d_gmtime_r_proto" in
15167         define)
15168         case "$gmtime_r_proto" in
15169         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15170         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15171         esac
15172         case "$gmtime_r_proto" in
15173         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15174         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15175         esac
15176         case "$gmtime_r_proto" in
15177         ''|0)   d_gmtime_r=undef
15178                 gmtime_r_proto=0
15179                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15180         * )     case "$gmtime_r_proto" in
15181                 REENTRANT_PROTO*) ;;
15182                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15183                 esac
15184                 echo "Prototype: $try" ;;
15185         esac
15186         ;;
15187         *)      case "$usethreads" in
15188                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15189                 esac
15190                 d_gmtime_r=undef
15191                 gmtime_r_proto=0
15192                 ;;
15193         esac
15194         ;;
15195 *)      gmtime_r_proto=0
15196         ;;
15197 esac
15198
15199 : see if hasmntopt exists
15200 set hasmntopt d_hasmntopt
15201 eval $inlibc
15202
15203 : see if this is a netinet/in.h or sys/in.h system
15204 set netinet/in.h i_niin sys/in.h i_sysin
15205 eval $inhdr
15206
15207 : see if arpa/inet.h has to be included
15208 set arpa/inet.h i_arpainet
15209 eval $inhdr
15210
15211 : see if htonl --and friends-- exists
15212 val=''
15213 set htonl val
15214 eval $inlibc
15215
15216 : Maybe they are macros.
15217 case "$val" in
15218 $undef)
15219         $cat >htonl.c <<EOM
15220 #include <stdio.h>
15221 #include <sys/types.h>
15222 #$i_niin I_NETINET_IN
15223 #$i_sysin I_SYS_IN
15224 #$i_arpainet I_ARPA_INET
15225 #ifdef I_NETINET_IN
15226 #include <netinet/in.h>
15227 #endif
15228 #ifdef I_SYS_IN
15229 #include <sys/in.h>
15230 #endif
15231 #ifdef I_ARPA_INET
15232 #include <arpa/inet.h>
15233 #endif
15234 #ifdef htonl
15235 printf("Defined as a macro.");
15236 #endif
15237 EOM
15238         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15239         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15240                 val="$define"
15241                 echo "But it seems to be defined as a macro." >&4
15242         fi
15243         $rm -f htonl.?
15244         ;;
15245 esac
15246 set d_htonl
15247 eval $setvar
15248
15249 : see if ilogbl exists
15250 set ilogbl d_ilogbl
15251 eval $inlibc
15252
15253 : index or strchr
15254 echo " "
15255 if set index val -f; eval $csym; $val; then
15256         if set strchr val -f d_strchr; eval $csym; $val; then
15257                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15258                         val="$define"
15259                         vali="$undef"
15260                         echo "strchr() found." >&4
15261                 else
15262                         val="$undef"
15263                         vali="$define"
15264                         echo "index() found." >&4
15265                 fi
15266         else
15267                 val="$undef"
15268                 vali="$define"
15269                 echo "index() found." >&4
15270         fi
15271 else
15272         if set strchr val -f d_strchr; eval $csym; $val; then
15273                 val="$define"
15274                 vali="$undef"
15275                 echo "strchr() found." >&4
15276         else
15277                 echo "No index() or strchr() found!" >&4
15278                 val="$undef"
15279                 vali="$undef"
15280         fi
15281 fi
15282 set d_strchr; eval $setvar
15283 val="$vali"
15284 set d_index; eval $setvar
15285
15286 : check whether inet_aton exists
15287 set inet_aton d_inetaton
15288 eval $inlibc
15289
15290 : see if inet_ntop exists
15291 set inet_ntop d_inetntop
15292 eval $inlibc
15293
15294 : see if inet_pton exists
15295 set inet_pton d_inetpton
15296 eval $inlibc
15297
15298 : Look for isascii
15299 echo " "
15300 $cat >isascii.c <<EOCP
15301 #include <stdio.h>
15302 #include <ctype.h>
15303 #$i_stdlib I_STDLIB
15304 #ifdef I_STDLIB
15305 #include <stdlib.h>
15306 #endif
15307 int main() {
15308         int c = 'A';
15309         if (isascii(c))
15310                 exit(0);
15311         else
15312                 exit(1);
15313 }
15314 EOCP
15315 set isascii
15316 if eval $compile; then
15317         echo "isascii() found." >&4
15318         val="$define"
15319 else
15320         echo "isascii() NOT found." >&4
15321         val="$undef"
15322 fi
15323 set d_isascii
15324 eval $setvar
15325 $rm -f isascii*
15326
15327 : Look for isblank
15328 echo " "
15329 $cat >isblank.c <<'EOCP'
15330 #include <stdio.h>
15331 #include <ctype.h>
15332 int main() {
15333         int c = ' ';
15334         if (isblank(c))
15335                 return 0 ;
15336         else
15337                 return 1 ;
15338 }
15339 EOCP
15340 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15341         echo "isblank() found." >&4
15342         val="$define"
15343 else
15344         echo "isblank() NOT found." >&4
15345         val="$undef"
15346 fi
15347 set d_isblank
15348 eval $setvar
15349 $rm -f isblank*
15350
15351 : see if isfinite exists
15352 set isfinite d_isfinite
15353 eval $inlibc
15354
15355 : see if isinf exists
15356 set isinf d_isinf
15357 eval $inlibc
15358
15359 : see if isnan exists
15360 set isnan d_isnan
15361 eval $inlibc
15362
15363 : see if isnanl exists
15364 set isnanl d_isnanl
15365 eval $inlibc
15366
15367 : see if killpg exists
15368 set killpg d_killpg
15369 eval $inlibc
15370
15371 : see if lchown exists
15372 echo " "
15373 $cat > try.c <<'EOCP'
15374 /* System header to define __stub macros and hopefully few prototypes,
15375     which can conflict with char lchown(); below.  */
15376 #include <assert.h>
15377 /* Override any gcc2 internal prototype to avoid an error.  */
15378 /* We use char because int might match the return type of a gcc2
15379    builtin and then its argument prototype would still apply.  */
15380 char lchown();
15381 int main() {
15382     /*  The GNU C library defines this for functions which it implements
15383         to always fail with ENOSYS.  Some functions are actually named
15384         something starting with __ and the normal name is an alias.  */
15385 #if defined (__stub_lchown) || defined (__stub___lchown)
15386 choke me
15387 #else
15388 lchown();
15389 #endif
15390 ; return 0; }
15391 EOCP
15392 set try
15393 if eval $compile; then
15394     $echo "lchown() found." >&4
15395     val="$define"
15396 else
15397     $echo "lchown() NOT found." >&4
15398     val="$undef"
15399 fi
15400 set d_lchown
15401 eval $setvar
15402
15403 : See if number of significant digits in a double precision number is known
15404 echo " "
15405 $cat >ldbl_dig.c <<EOM
15406 #$i_limits I_LIMITS
15407 #$i_float I_FLOAT
15408 #ifdef I_LIMITS
15409 #include <limits.h>
15410 #endif
15411 #ifdef I_FLOAT
15412 #include <float.h>
15413 #endif
15414 #ifdef LDBL_DIG
15415 printf("Contains LDBL_DIG");
15416 #endif
15417 EOM
15418 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15419 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15420         echo "LDBL_DIG found." >&4
15421         val="$define"
15422 else
15423         echo "LDBL_DIG NOT found." >&4
15424         val="$undef"
15425 fi
15426 $rm -f ldbl_dig.?
15427 set d_ldbl_dig
15428 eval $setvar
15429
15430 : see if this is a math.h system
15431 set math.h i_math
15432 eval $inhdr
15433
15434 : check to see if math.h defines _LIB_VERSION
15435 d_libm_lib_version="$undef"
15436 case $i_math in
15437     $define)
15438         echo " "
15439         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15440         $cat >try.c <<EOCP
15441 #include <unistd.h>
15442 #include <math.h>
15443 int main (int argc, char *argv[])
15444 {
15445     printf ("%d\n", _LIB_VERSION);
15446     return (0);
15447     } /* main */
15448 EOCP
15449         set try
15450         if eval $compile; then
15451             foo=`$run ./try`
15452             echo "Yes, it does ($foo)" >&4
15453             d_libm_lib_version="$define"
15454         else
15455             echo "No, it does not (probably harmless)" >&4
15456             fi
15457         $rm_try
15458         ;;
15459
15460     esac
15461
15462 : see if link exists
15463 set link d_link
15464 eval $inlibc
15465
15466 : see if localtime_r exists
15467 set localtime_r d_localtime_r
15468 eval $inlibc
15469 case "$d_localtime_r" in
15470 "$define")
15471         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15472         case "$d_localtime_r_proto:$usethreads" in
15473         ":define")      d_localtime_r_proto=define
15474                 set d_localtime_r_proto localtime_r $hdrs
15475                 eval $hasproto ;;
15476         *)      ;;
15477         esac
15478         case "$d_localtime_r_proto" in
15479         define)
15480         case "$localtime_r_proto" in
15481         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15482         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15483         esac
15484         case "$localtime_r_proto" in
15485         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15486         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15487         esac
15488         case "$localtime_r_proto" in
15489         ''|0)   d_localtime_r=undef
15490                 localtime_r_proto=0
15491                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15492         * )     case "$localtime_r_proto" in
15493                 REENTRANT_PROTO*) ;;
15494                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15495                 esac
15496                 echo "Prototype: $try" ;;
15497         esac
15498         ;;
15499         *)      case "$usethreads" in
15500                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15501                 esac
15502                 d_localtime_r=undef
15503                 localtime_r_proto=0
15504                 ;;
15505         esac
15506         ;;
15507 *)      localtime_r_proto=0
15508         ;;
15509 esac
15510
15511 : see if localtime_r calls tzset
15512 case "$localtime_r_proto" in
15513 REENTRANT_PROTO*)
15514         $cat >try.c <<EOCP
15515 /*  Does our libc's localtime_r call tzset ?
15516  *  return 0 if so, 1 otherwise.
15517  */
15518 #$i_systypes    I_SYS_TYPES
15519 #$i_unistd      I_UNISTD
15520 #$i_time        I_TIME
15521 #$i_stdlib      I_STDLIB
15522 #$i_string      I_STRING
15523 #$i_malloc      I_MALLOC
15524 #ifdef I_SYS_TYPES
15525 #  include <sys/types.h>
15526 #endif
15527 #ifdef I_UNISTD
15528 #  include <unistd.h>
15529 #endif
15530 #ifdef I_TIME
15531 #  include <time.h>
15532 #endif
15533 #ifdef I_STDLIB
15534 #include <stdlib.h>
15535 #endif
15536 #ifdef I_STRING
15537 #  include <string.h>
15538 #else
15539 #  include <strings.h>
15540 #endif
15541 #ifdef I_MALLOC
15542 #  include <malloc.h>
15543 #endif
15544 int main()
15545 {
15546     time_t t = time(0L);
15547     char w_tz[]="TZ" "=GMT+5",
15548          e_tz[]="TZ" "=GMT-5",
15549         *tz_e = (char*)malloc(16),
15550         *tz_w = (char*)malloc(16);
15551     struct tm tm_e, tm_w;
15552     memset(&tm_e,'\0',sizeof(struct tm));
15553     memset(&tm_w,'\0',sizeof(struct tm));
15554     strcpy(tz_e,e_tz);
15555     strcpy(tz_w,w_tz);
15556
15557     putenv(tz_e);
15558     localtime_r(&t, &tm_e);
15559
15560     putenv(tz_w);
15561     localtime_r(&t, &tm_w);
15562
15563     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15564         return 1;
15565     return 0;
15566 }
15567 EOCP
15568         set try
15569         if eval $compile; then
15570             if $run ./try; then
15571                 d_localtime_r_needs_tzset=undef;
15572             else
15573                 d_localtime_r_needs_tzset=define;
15574             fi;
15575         else
15576             d_localtime_r_needs_tzset=undef;
15577         fi;
15578      ;;
15579   *)
15580      d_localtime_r_needs_tzset=undef;
15581      ;;
15582 esac
15583 $rm_try
15584
15585 : see if localeconv exists
15586 set localeconv d_locconv
15587 eval $inlibc
15588
15589 : see if lockf exists
15590 set lockf d_lockf
15591 eval $inlibc
15592
15593 : see if prototype for lseek is available
15594 echo " "
15595 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15596 eval $hasproto
15597
15598 : see if lstat exists
15599 set lstat d_lstat
15600 eval $inlibc
15601
15602 : see if madvise exists
15603 set madvise d_madvise
15604 eval $inlibc
15605
15606 : see if malloc_size exists
15607 set malloc_size d_malloc_size
15608 eval $inlibc
15609
15610 : see if malloc_size_good exists
15611 set malloc_good_size d_malloc_good_size
15612 eval $inlibc
15613
15614 : see if mblen exists
15615 set mblen d_mblen
15616 eval $inlibc
15617
15618 : see if mbstowcs exists
15619 set mbstowcs d_mbstowcs
15620 eval $inlibc
15621
15622 : see if mbtowc exists
15623 set mbtowc d_mbtowc
15624 eval $inlibc
15625
15626 : see if memchr exists
15627 set memchr d_memchr
15628 eval $inlibc
15629
15630 : see if memcmp exists
15631 set memcmp d_memcmp
15632 eval $inlibc
15633
15634 : see if memcpy exists
15635 set memcpy d_memcpy
15636 eval $inlibc
15637
15638 : see if memmove exists
15639 set memmove d_memmove
15640 eval $inlibc
15641
15642 : see if memset exists
15643 set memset d_memset
15644 eval $inlibc
15645
15646 : see if mkdir exists
15647 set mkdir d_mkdir
15648 eval $inlibc
15649
15650 : see if mkdtemp exists
15651 set mkdtemp d_mkdtemp
15652 eval $inlibc
15653
15654 : see if mkfifo exists
15655 set mkfifo d_mkfifo
15656 eval $inlibc
15657
15658 : see if mkstemp exists
15659 set mkstemp d_mkstemp
15660 eval $inlibc
15661
15662 : see if mkstemps exists
15663 set mkstemps d_mkstemps
15664 eval $inlibc
15665
15666 : see if mktime exists
15667 set mktime d_mktime
15668 eval $inlibc
15669
15670 : see if this is a sys/mman.h system
15671 set sys/mman.h i_sysmman
15672 eval $inhdr
15673
15674 : see if mmap exists
15675 set mmap d_mmap
15676 eval $inlibc
15677 : see what shmat returns
15678 : default to something harmless
15679 mmaptype='void *'
15680 case "$i_sysmman$d_mmap" in
15681 "$define$define")
15682         $cat >mmap.c <<'END'
15683 #include <sys/mman.h>
15684 void *mmap();
15685 END
15686         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15687                 mmaptype='void *'
15688         else
15689                 mmaptype='caddr_t'
15690         fi
15691         echo "and it returns ($mmaptype)." >&4
15692         ;;
15693 esac
15694
15695
15696
15697 : see if sqrtl exists
15698 set sqrtl d_sqrtl
15699 eval $inlibc
15700
15701 : see if scalbnl exists
15702 set scalbnl d_scalbnl
15703 eval $inlibc
15704
15705 : see if modfl exists
15706 set modfl d_modfl
15707 eval $inlibc
15708
15709 : see if prototype for modfl is available
15710 echo " "
15711 set d_modflproto modfl $i_math math.h
15712 eval $hasproto
15713
15714 d_modfl_pow32_bug="$undef"
15715
15716 case "$d_longdbl$d_modfl" in
15717 $define$define)
15718         $cat <<EOM
15719 Checking to see whether your modfl() is okay for large values...
15720 EOM
15721 $cat >try.c <<EOCP
15722 #include <math.h>
15723 #include <stdio.h>
15724 EOCP
15725 if $test "X$d_modflproto" != "X$define"; then
15726         $cat >>try.c <<EOCP
15727 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15728 long double modfl (long double, long double *);
15729 EOCP
15730 fi
15731 $cat >>try.c <<EOCP
15732 int main() {
15733     long double nv = 4294967303.15;
15734     long double v, w;
15735     v = modfl(nv, &w);
15736 #ifdef __GLIBC__
15737     printf("glibc");
15738 #endif
15739     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15740     return 0;
15741 }
15742 EOCP
15743         case "$osname:$gccversion" in
15744         aix:)   saveccflags="$ccflags"
15745                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15746         esac
15747         set try
15748         if eval $compile; then
15749                 foo=`$run ./try`
15750                 case "$foo" in
15751                 *" 4294967303.150000 1.150000 4294967302.000000")
15752                         echo >&4 "Your modfl() is broken for large values."
15753                         d_modfl_pow32_bug="$define"
15754                         case "$foo" in
15755                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15756                         ;;
15757                         esac
15758                         ;;
15759                 *" 4294967303.150000 0.150000 4294967303.000000")
15760                         echo >&4 "Your modfl() seems okay for large values."
15761                         ;;
15762                 *)      echo >&4 "I don't understand your modfl() at all."
15763                         d_modfl="$undef"
15764                         ;;
15765                 esac
15766                 $rm_try
15767         else
15768                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15769                 d_modfl="$undef"
15770         fi
15771         case "$osname:$gccversion" in
15772         aix:)   ccflags="$saveccflags" ;; # restore
15773         esac
15774         ;;
15775 esac
15776
15777 if $test "$uselongdouble" = "$define"; then
15778     message=""
15779     if $test "$d_sqrtl" != "$define"; then
15780         message="$message sqrtl"
15781     fi
15782     if $test "$d_modfl" != "$define"; then
15783         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15784             echo "You have both aintl and copysignl, so I can emulate modfl."
15785         else
15786             message="$message modfl"
15787         fi
15788     fi
15789     if $test "$d_frexpl" != "$define"; then
15790         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15791             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15792         else
15793             message="$message frexpl"
15794         fi
15795     fi
15796
15797     if $test "$message" != ""; then
15798         $cat <<EOM >&4
15799
15800 *** You requested the use of long doubles but you do not seem to have
15801 *** the following mathematical functions needed for long double support:
15802 ***    $message
15803 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15804 *** Cannot continue, aborting.
15805
15806 EOM
15807
15808         exit 1
15809     fi
15810 fi
15811
15812 : see if mprotect exists
15813 set mprotect d_mprotect
15814 eval $inlibc
15815
15816 : see if msgctl exists
15817 set msgctl d_msgctl
15818 eval $inlibc
15819
15820 : see if msgget exists
15821 set msgget d_msgget
15822 eval $inlibc
15823
15824 : see if msgsnd exists
15825 set msgsnd d_msgsnd
15826 eval $inlibc
15827
15828 : see if msgrcv exists
15829 set msgrcv d_msgrcv
15830 eval $inlibc
15831
15832 : see how much of the 'msg*(2)' library is present.
15833 h_msg=true
15834 echo " "
15835 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15836 *"$undef"*) h_msg=false;;
15837 esac
15838 case "$osname" in
15839 freebsd)
15840     case "`ipcs 2>&1`" in
15841     "SVID messages"*"not configured"*)
15842         echo "Your $osname does not have the msg*(2) configured." >&4
15843         h_msg=false
15844         val="$undef"
15845         set msgctl d_msgctl
15846         eval $setvar
15847         set msgget d_msgget
15848         eval $setvar
15849         set msgsnd d_msgsnd
15850         eval $setvar
15851         set msgrcv d_msgrcv
15852         eval $setvar
15853         ;;
15854     esac
15855     ;;
15856 esac
15857 : we could also check for sys/ipc.h ...
15858 if $h_msg && $test `./findhdr sys/msg.h`; then
15859         echo "You have the full msg*(2) library." >&4
15860         val="$define"
15861 else
15862         echo "You don't have the full msg*(2) library." >&4
15863         val="$undef"
15864 fi
15865 set d_msg
15866 eval $setvar
15867
15868 : Check for msghdr_s
15869 echo " "
15870 echo "Checking to see if your system supports struct msghdr..." >&4
15871 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15872 eval $hasstruct
15873 case "$d_msghdr_s" in
15874 "$define")      echo "Yes, it does."   ;;
15875 *)              echo "No, it doesn't." ;;
15876 esac
15877
15878
15879 : see if msync exists
15880 set msync d_msync
15881 eval $inlibc
15882
15883 : see if munmap exists
15884 set munmap d_munmap
15885 eval $inlibc
15886
15887 : see if nice exists
15888 set nice d_nice
15889 eval $inlibc
15890
15891 : see if this is a langinfo.h system
15892 set langinfo.h i_langinfo
15893 eval $inhdr
15894
15895 : see if nl_langinfo exists
15896 set nl_langinfo d_nl_langinfo
15897 eval $inlibc
15898
15899 : check for volatile keyword
15900 echo " "
15901 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15902 $cat >try.c <<'EOCP'
15903 int main()
15904 {
15905         typedef struct _goo_struct goo_struct;
15906         goo_struct * volatile goo = ((goo_struct *)0);
15907         struct _goo_struct {
15908                 long long_int;
15909                 int reg_int;
15910                 char char_var;
15911         };
15912         typedef unsigned short foo_t;
15913         char *volatile foo;
15914         volatile int bar;
15915         volatile foo_t blech;
15916         foo = foo;
15917 }
15918 EOCP
15919 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15920         val="$define"
15921         echo "Yup, it does."
15922 else
15923         val="$undef"
15924         echo "Nope, it doesn't."
15925 fi
15926 set d_volatile
15927 eval $setvar
15928 $rm_try
15929
15930 : Check basic sizes
15931 echo " "
15932 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15933
15934 case "$use64bitint:$d_quad:$quadtype" in
15935 define:define:?*)
15936         ivtype="$quadtype"
15937         uvtype="$uquadtype"
15938         ivsize=8
15939         uvsize=8
15940         ;;
15941 *)      ivtype="long"
15942         uvtype="unsigned long"
15943         ivsize=$longsize
15944         uvsize=$longsize
15945         ;;
15946 esac
15947
15948 case "$uselongdouble:$d_longdbl" in
15949 define:define)
15950         nvtype="long double"
15951         nvsize=$longdblsize
15952         ;;
15953 *)      nvtype=double
15954         nvsize=$doublesize
15955         ;;
15956 esac
15957
15958 $echo "(IV will be "$ivtype", $ivsize bytes)"
15959 $echo "(UV will be "$uvtype", $uvsize bytes)"
15960 $echo "(NV will be "$nvtype", $nvsize bytes)"
15961
15962 $echo "Checking the kind of long doubles you have..." >&4
15963 : volatile so that the compiler has to store it out to memory.
15964 if test X"$d_volatile" = X"$define"; then
15965         volatile=volatile
15966 fi
15967 case "$d_longdbl" in
15968 define)
15969 $cat <<EOP >try.c
15970 #$i_float I_FLOAT
15971 #$i_stdlib I_STDLIB
15972 #define LONGDBLSIZE $longdblsize
15973 #ifdef I_FLOAT
15974 #include <float.h>
15975 #endif
15976 #ifdef I_STDLIB
15977 #include <stdlib.h>
15978 #endif
15979 #include <stdio.h>
15980 static const long double d = -0.1L;
15981 int main() {
15982   unsigned const char* b = (unsigned const char*)(&d);
15983 #if LDBL_MANT_DIG == 113 && LONGDBLSIZE == 16
15984   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
15985     /* IEEE 754 128-bit little-endian */
15986     printf("1\n");
15987     exit(0);
15988   }
15989   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
15990     /* IEEE 128-bit big-endian, e.g. solaris sparc */
15991     printf("2\n");
15992     exit(0);
15993   }
15994 #endif
15995 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
15996   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
15997     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
15998      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
15999      * Also known as "extended precision". */
16000     printf("3\n");
16001     exit(0);
16002   }
16003   if (b[LONGDBLSIZE - 11] == 0x00 && b[LONGDBLSIZE - 10] == 0xBF &&
16004       b[LONGDBLSIZE -  1] == 0xCD) {
16005     /* is there ever big-endian 80-bit, really? */
16006     printf("4\n");
16007     exit(0);
16008   }
16009 #endif
16010 #if LDBL_MANT_DIG == 106 && LONGDBLSIZE == 16
16011   /* software "double double", the 106 is 53+53 */
16012   if (b[0] == 0xCD && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
16013     /* double double 128-bit little-endian */
16014     printf("5\n");
16015     exit(0);
16016   }
16017   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
16018     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
16019      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
16020     printf("6\n");
16021     exit(0);
16022   }
16023 #endif
16024   printf("-1\n"); /* unknown */
16025   exit(0);
16026 }
16027 EOP
16028 set try
16029 if eval $compile; then
16030     longdblkind=`$run ./try`
16031 else
16032     longdblkind=-1
16033 fi
16034 ;;
16035 *) longdblkind=0 ;;
16036 esac
16037 case "$longdblkind" in
16038 0) echo "Your long doubles are doubles." >&4 ;;
16039 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
16040 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
16041 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
16042 *) echo "Cannot figure out your long double." >&4 ;;
16043 esac
16044 $rm_try
16045
16046 $cat >try.c <<EOCP
16047 #$i_inttypes I_INTTYPES
16048 #ifdef I_INTTYPES
16049 #include <inttypes.h>
16050 #endif
16051 #include <stdio.h>
16052 int main() {
16053 #ifdef INT8
16054    int8_t i =  INT8_MAX;
16055   uint8_t u = UINT8_MAX;
16056   printf("int8_t\n");
16057 #endif
16058 #ifdef INT16
16059    int16_t i =  INT16_MAX;
16060   uint16_t u = UINT16_MAX;
16061   printf("int16_t\n");
16062 #endif
16063 #ifdef INT32
16064    int32_t i =  INT32_MAX;
16065   uint32_t u = UINT32_MAX;
16066   printf("int32_t\n");
16067 #endif
16068 }
16069 EOCP
16070
16071 i8type="signed char"
16072 u8type="unsigned char"
16073 i8size=1
16074 u8size=1
16075
16076 case "$i16type" in
16077 '')     case "$shortsize" in
16078         2)      i16type=short
16079                 u16type="unsigned short"
16080                 i16size=$shortsize
16081                 u16size=$shortsize
16082                 ;;
16083         esac
16084         ;;
16085 esac
16086 case "$i16type" in
16087 '')     set try -DINT16
16088         if eval $compile; then
16089                 case "`$run ./try`" in
16090                 int16_t)
16091                         i16type=int16_t
16092                         u16type=uint16_t
16093                         i16size=2
16094                         u16size=2
16095                         ;;
16096                 esac
16097         fi
16098         ;;
16099 esac
16100 case "$i16type" in
16101 '')     if $test $shortsize -ge 2; then
16102                 i16type=short
16103                 u16type="unsigned short"
16104                 i16size=$shortsize
16105                 u16size=$shortsize
16106         fi
16107         ;;
16108 esac
16109
16110 case "$i32type" in
16111 '')     case "$longsize" in
16112         4)      i32type=long
16113                 u32type="unsigned long"
16114                 i32size=$longsize
16115                 u32size=$longsize
16116                 ;;
16117         *)      case "$intsize" in
16118                 4)      i32type=int
16119                         u32type="unsigned int"
16120                         i32size=$intsize
16121                         u32size=$intsize
16122                         ;;
16123                 esac
16124                 ;;
16125         esac
16126         ;;
16127 esac
16128 case "$i32type" in
16129 '')     set try -DINT32
16130         if eval $compile; then
16131                 case "`$run ./try`" in
16132                 int32_t)
16133                         i32type=int32_t
16134                         u32type=uint32_t
16135                         i32size=4
16136                         u32size=4
16137                         ;;
16138                 esac
16139         fi
16140         ;;
16141 esac
16142 case "$i32type" in
16143 '')     if $test $intsize -ge 4; then
16144                 i32type=int
16145                 u32type="unsigned int"
16146                 i32size=$intsize
16147                 u32size=$intsize
16148         fi
16149         ;;
16150 esac
16151
16152 case "$i64type" in
16153 '')     case "$d_quad:$quadtype" in
16154         define:?*)
16155                 i64type="$quadtype"
16156                 u64type="$uquadtype"
16157                 i64size=8
16158                 u64size=8
16159                 ;;
16160         esac
16161         ;;
16162 esac
16163
16164 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16165 : volatile so that the compiler has to store it out to memory.
16166 if test X"$d_volatile" = X"$define"; then
16167         volatile=volatile
16168 fi
16169 $cat <<EOP >try.c
16170 #include <stdio.h>
16171 #$i_stdlib I_STDLIB
16172 #ifdef I_STDLIB
16173 #include <stdlib.h>
16174 #endif
16175 #include <sys/types.h>
16176 #include <signal.h>
16177 #ifdef SIGFPE
16178 $volatile int bletched = 0;
16179 $signal_t blech(int s) { bletched = 1; }
16180 #endif
16181 int main() {
16182     $uvtype u = 0;
16183     $nvtype d;
16184     int     n = 8 * $uvsize;
16185     int     i;
16186 #ifdef SIGFPE
16187     signal(SIGFPE, blech);
16188 #endif
16189
16190     for (i = 0; i < n; i++) {
16191       u = u << 1 | ($uvtype)1;
16192       d = ($nvtype)u;
16193       if (($uvtype)d != u)
16194         break;
16195       if (d <= 0)
16196         break;
16197       d = ($nvtype)(u - 1);
16198       if (($uvtype)d != (u - 1))
16199         break;
16200 #ifdef SIGFPE
16201       if (bletched)
16202         break;
16203 #endif
16204     }
16205     printf("%d\n", ((i == n) ? -n : i));
16206     exit(0);
16207 }
16208 EOP
16209 set try
16210
16211 d_nv_preserves_uv="$undef"
16212 if eval $compile; then
16213         nv_preserves_uv_bits="`$run ./try`"
16214 fi
16215 case "$nv_preserves_uv_bits" in
16216 \-[1-9]*)
16217         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16218         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16219         d_nv_preserves_uv="$define"
16220         ;;
16221 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16222         d_nv_preserves_uv="$undef" ;;
16223 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16224         nv_preserves_uv_bits="0" ;;
16225 esac
16226 $rm_try
16227
16228 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16229 : volatile so that the compiler has to store it out to memory.
16230 if test X"$d_volatile" = X"$define"; then
16231         volatile=volatile
16232 fi
16233 $cat <<EOP >try.c
16234 #include <stdio.h>
16235
16236 typedef $nvtype NV;
16237
16238 int
16239 main() {
16240   NV value = 2;
16241   int count = 1;
16242
16243   while(count < 256) {
16244     $volatile NV up = value + 1.0;
16245     $volatile NV negated = -value;
16246     $volatile NV down = negated - 1.0;
16247     $volatile NV got_up = up - value;
16248     int up_good = got_up == 1.0;
16249     int got_down = down - negated;
16250     int down_good = got_down == -1.0;
16251
16252     if (down_good != up_good) {
16253       fprintf(stderr,
16254               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16255               up_good, (double) got_up, down_good, (double) got_down,
16256               count, (double) value);
16257       return 1;
16258     }
16259     if (!up_good) {
16260       while (1) {
16261         if (count > 8) {
16262           count -= 8;
16263           fputs("256.0", stdout);
16264         } else {
16265           count--;
16266           fputs("2.0", stdout);
16267         }
16268         if (!count) {
16269           puts("");
16270           return 0;
16271         }
16272         fputs("*", stdout);
16273       }
16274     }
16275     value *= 2;
16276     ++count;
16277   }
16278   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16279           count, (double) value);
16280   return 1;
16281 }
16282 EOP
16283 set try
16284
16285 nv_overflows_integers_at='0'
16286 if eval $compile; then
16287     xxx="`$run ./try`"
16288     case "$?" in
16289         0)
16290             case "$xxx" in
16291                 2*)  cat >&4 <<EOM
16292 The largest integer your NVs can preserve is equal to $xxx
16293 EOM
16294                     nv_overflows_integers_at="$xxx"
16295                     ;;
16296                 *)  cat >&4 <<EOM
16297 Cannot determine the largest integer value your NVs can hold, unexpected output
16298 '$xxx'
16299 EOM
16300                     ;;
16301             esac
16302             ;;
16303         *)  cat >&4 <<EOM
16304 Cannot determine the largest integer value your NVs can hold
16305 EOM
16306             ;;
16307     esac
16308 fi
16309 $rm_try
16310
16311 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16312 : volatile so that the compiler has to store it out to memory.
16313 if test X"$d_volatile" = X"$define"; then
16314         volatile=volatile
16315 fi
16316 $cat <<EOP >try.c
16317 #include <stdio.h>
16318 #$i_stdlib I_STDLIB
16319 #ifdef I_STDLIB
16320 #include <stdlib.h>
16321 #endif
16322 #$i_string I_STRING
16323 #ifdef I_STRING
16324 #  include <string.h>
16325 #else
16326 #  include <strings.h>
16327 #endif
16328 #include <sys/types.h>
16329 #include <signal.h>
16330 #ifdef SIGFPE
16331 $volatile int bletched = 0;
16332 $signal_t blech(int s) { bletched = 1; }
16333 #endif
16334
16335 int checkit($nvtype d, char *where) {
16336     unsigned char *p = (char *)&d;
16337     unsigned char *end = p + sizeof(d);
16338     int fail = 0;
16339
16340     while (p < end)
16341         fail += *p++;
16342
16343     if (!fail)
16344         return 0;
16345
16346     p = (char *)&d;
16347     printf("No - %s: 0x", where);
16348     while (p < end)
16349         printf ("%02X", *p++);
16350     printf("\n");
16351     return 1;
16352 }
16353
16354 int main(int argc, char **argv) {
16355     $nvtype d = 0.0;
16356     int fail = 0;
16357     fail += checkit(d, "0.0");
16358
16359     /* The compiler shouldn't be assuming that bletched is 0  */
16360     d = bletched;
16361
16362     fail += checkit(d, "bleched");
16363
16364 #ifdef SIGFPE
16365     signal(SIGFPE, blech);
16366 #endif
16367
16368     /* Paranoia - the compiler should have no way of knowing that ANSI says
16369        that argv[argc] will always be NULL.  Actually, if it did assume this it
16370        would be buggy, as this is C and main() can be called from elsewhere in
16371        the program.  */
16372     d = argv[argc] ? 1 : 0;
16373
16374     if (d) {
16375         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16376     }
16377
16378     fail += checkit(d, "ternary");
16379
16380     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16381
16382     if (d != 0.0) {
16383         printf("No - memset doesn't give 0.0\n");
16384         /* This might just blow up:  */
16385         printf("(gives %g)\n", d);
16386         return 1;
16387     }
16388
16389 #ifdef SIGFPE
16390     if (bletched) {
16391         printf("No - something bleched\n");
16392         return 1;
16393     }
16394 #endif
16395     if (fail) {
16396       printf("No - %d fail(s)\n", fail);
16397       return 1;
16398     }
16399     printf("Yes\n");
16400     return 0;
16401 }
16402 EOP
16403 set try
16404
16405 d_nv_zero_is_allbits_zero="$undef"
16406 if eval $compile; then
16407     xxx="`$run ./try`"
16408     case "$?" in
16409         0)
16410             case "$xxx" in
16411                 Yes)  cat >&4 <<EOM
16412 0.0 is represented as all bits zero in memory
16413 EOM
16414                     d_nv_zero_is_allbits_zero="$define"
16415                     ;;
16416                 *)  cat >&4 <<EOM
16417 0.0 is not represented as all bits zero in memory
16418 EOM
16419                     d_nv_zero_is_allbits_zero="$undef"
16420                     ;;
16421             esac
16422             ;;
16423         *)  cat >&4 <<EOM
16424 0.0 is not represented as all bits zero in memory
16425 EOM
16426             d_nv_zero_is_allbits_zero="$undef"
16427             ;;
16428     esac
16429 fi
16430 $rm_try
16431
16432 : check for off64_t
16433 echo " "
16434 echo "Checking to see if you have off64_t..." >&4
16435 $cat >try.c <<EOCP
16436 #include <sys/types.h>
16437 #include <unistd.h>
16438 int main() { off64_t x = 7; }
16439 EOCP
16440 set try
16441 if eval $compile; then
16442         val="$define"
16443         echo "You have off64_t."
16444 else
16445         val="$undef"
16446         echo "You do not have off64_t."
16447         case "$lseeksize" in
16448         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16449         esac
16450 fi
16451 $rm_try
16452 set d_off64_t
16453 eval $setvar
16454
16455 : how to create joinable pthreads
16456 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16457         echo " "
16458         echo "Checking what constant to use for creating joinable pthreads..." >&4
16459         $cat >try.c <<'EOCP'
16460 #include <pthread.h>
16461 int main() {
16462     int detachstate = JOINABLE;
16463 }
16464 EOCP
16465         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16466         if eval $compile; then
16467                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16468                 val="$undef" # Yes, undef.
16469                 set d_old_pthread_create_joinable
16470                 eval $setvar
16471                 val=""
16472                 set old_pthread_create_joinable
16473                 eval $setvar
16474         else
16475                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16476                 if eval $compile; then
16477                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16478                         val="$define"
16479                         set d_old_pthread_create_joinable
16480                         eval $setvar
16481                         val=PTHREAD_CREATE_UNDETACHED
16482                         set old_pthread_create_joinable
16483                         eval $setvar
16484                 else
16485                         set try -DJOINABLE=__UNDETACHED
16486                         if eval $compile; then
16487                                 echo "You seem to use __UNDETACHED." >&4
16488                                 val="$define"
16489                                 set d_old_pthread_create_joinable
16490                                 eval $setvar
16491                                 val=__UNDETACHED
16492                                 set old_pthread_create_joinable
16493                                 eval $setvar
16494                         else
16495                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16496                                 val="$define"
16497                                 set d_old_pthread_create_joinable
16498                                 eval $setvar
16499                                 val=0
16500                                 set old_pthread_create_joinable
16501                                 eval $setvar
16502                         fi
16503                 fi
16504         fi
16505         $rm_try
16506 else
16507     d_old_pthread_create_joinable="$undef"
16508     old_pthread_create_joinable=""
16509 fi
16510
16511 : see if pause exists
16512 set pause d_pause
16513 eval $inlibc
16514
16515 : see if poll exists
16516 set poll d_poll
16517 eval $inlibc
16518
16519 : see if prctl exists
16520 set prctl d_prctl
16521 eval $inlibc
16522
16523 : see if prctl supports PR_SET_NAME
16524 d_prctl_set_name=$undef
16525 case $d_prctl in
16526     $define)
16527         $cat >try.c <<EOM
16528 #include <sys/prctl.h>
16529
16530 int main (int argc, char *argv[])
16531 {
16532     return (prctl (PR_SET_NAME, "Test"));
16533     } /* main */
16534 EOM
16535         set try
16536         if eval $compile_ok && $run ./try; then
16537             echo "Your prctl (PR_SET_NAME, ...) works"
16538             d_prctl_set_name=$define
16539             fi
16540         $rm_try
16541         ;;
16542     esac
16543
16544 : see if readlink exists
16545 set readlink d_readlink
16546 eval $inlibc
16547
16548 : Check if exe is symlink to abs path of executing program
16549 echo " "
16550 procselfexe=''
16551 val="$undef"
16552 case "$d_readlink" in
16553     "$define")
16554         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16555         : more tidy to avoid an extra level of symlink
16556         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16557         while test $# -gt 0; do
16558             type=$1; try=$2
16559             shift; shift
16560             if $issymlink $try; then
16561                 $ls -l $try > reflect
16562                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16563                     echo "You have $type-like $try."
16564                     procselfexe='"'$try'"'
16565                     val="$define"
16566                     : This will break out of the loop
16567                     set X; shift
16568                 fi
16569             fi
16570         done
16571         ;;
16572 esac
16573 $rm -f reflect
16574 set d_procselfexe
16575 eval $setvar
16576
16577 : backward compatibility for d_hvfork
16578 if test X$d_hvfork != X; then
16579         d_vfork="$d_hvfork"
16580         d_hvfork=''
16581 fi
16582 : see if there is a vfork
16583 val=''
16584 set vfork val
16585 eval $inlibc
16586
16587 d_pseudofork=$undef
16588
16589 : Ok, but do we want to use it. vfork is reportedly unreliable in
16590 : perl on Solaris 2.x, and probably elsewhere.
16591 case "$val" in
16592 $define)
16593         echo " "
16594         case "$usevfork" in
16595         false) dflt='n';;
16596         *) dflt='y';;
16597         esac
16598         cat <<'EOM'
16599
16600 Perl can only use a vfork() that doesn't suffer from strict
16601 restrictions on calling functions or modifying global data in
16602 the child.  For example, glibc-2.1 contains such a vfork()
16603 that is unsuitable.  If your system provides a proper fork()
16604 call, chances are that you do NOT want perl to use vfork().
16605
16606 EOM
16607         rp="Do you still want to use vfork()?"
16608         . ./myread
16609         case "$ans" in
16610         y|Y) ;;
16611         *)
16612                 echo "Ok, we won't use vfork()."
16613                 val="$undef"
16614                 ;;
16615         esac
16616         ;;
16617 esac
16618 set d_vfork
16619 eval $setvar
16620 case "$d_vfork" in
16621 $define) usevfork='true';;
16622 *) usevfork='false';;
16623 esac
16624
16625 : see whether the pthread_atfork exists
16626 $cat >try.c <<EOP
16627 #include <pthread.h>
16628 #include <stdio.h>
16629 int main() {
16630 #ifdef  PTHREAD_ATFORK
16631         pthread_atfork(NULL,NULL,NULL);
16632 #endif
16633 }
16634 EOP
16635
16636 : see if pthread_atfork exists
16637 set try -DPTHREAD_ATFORK
16638 if eval $compile; then
16639     val="$define"
16640 else
16641     val="$undef"
16642 fi
16643 case "$usethreads" in
16644 $define)
16645         case "$val" in
16646         $define) echo 'pthread_atfork found.' >&4        ;;
16647         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16648         esac
16649 esac
16650 set d_pthread_atfork
16651 eval $setvar
16652
16653 : see if pthread_attr_setscope exists
16654 set pthread_attr_setscope d_pthread_attr_setscope
16655 eval $inlibc
16656
16657 : see whether the various POSIXish _yields exist
16658 $cat >try.c <<EOP
16659 #include <pthread.h>
16660 #include <stdio.h>
16661 int main() {
16662 #ifdef SCHED_YIELD
16663         sched_yield();
16664 #else
16665 #ifdef PTHREAD_YIELD
16666         pthread_yield();
16667 #else
16668 #ifdef PTHREAD_YIELD_NULL
16669         pthread_yield(NULL);
16670 #endif
16671 #endif
16672 #endif
16673 }
16674 EOP
16675 : see if sched_yield exists
16676 set try -DSCHED_YIELD
16677 if eval $compile; then
16678     val="$define"
16679     sched_yield='sched_yield()'
16680 else
16681     val="$undef"
16682 fi
16683 case "$usethreads" in
16684 $define)
16685         case "$val" in
16686         $define) echo 'sched_yield() found.' >&4        ;;
16687         *)       echo 'sched_yield() NOT found.' >&4    ;;
16688         esac
16689 esac
16690 set d_sched_yield
16691 eval $setvar
16692
16693 : see if pthread_yield exists
16694 set try -DPTHREAD_YIELD
16695 if eval $compile; then
16696     val="$define"
16697     case "$sched_yield" in
16698     '') sched_yield='pthread_yield()' ;;
16699     esac
16700 else
16701     set try -DPTHREAD_YIELD_NULL
16702     if eval $compile; then
16703         val="$define"
16704         case "$sched_yield" in
16705         '') sched_yield='pthread_yield(NULL)' ;;
16706         esac
16707     else
16708         val="$undef"
16709     fi
16710 fi
16711 case "$usethreads" in
16712 $define)
16713         case "$val" in
16714         $define) echo 'pthread_yield() found.' >&4      ;;
16715         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16716         esac
16717         ;;
16718 esac
16719 set d_pthread_yield
16720 eval $setvar
16721 case "$sched_yield" in
16722 '') sched_yield=undef ;;
16723 esac
16724 $rm_try
16725
16726 : check for ptrdiff_t
16727 echo " "
16728 echo "Checking to see if you have ptrdiff_t..." >&4
16729 $cat >try.c <<EOCP
16730 #include <stddef.h>
16731 int main() { ptrdiff_t x = 7; }
16732 EOCP
16733 set try
16734 if eval $compile; then
16735         val="$define"
16736         echo "You have ptrdiff_t."
16737 else
16738         val="$undef"
16739         echo "You do not have ptrdiff_t."
16740 fi
16741 $rm_try
16742 set d_ptrdiff_t
16743 eval $setvar
16744
16745 : see if random_r exists
16746 set random_r d_random_r
16747 eval $inlibc
16748 case "$d_random_r" in
16749 "$define")
16750         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16751         case "$d_random_r_proto:$usethreads" in
16752         ":define")      d_random_r_proto=define
16753                 set d_random_r_proto random_r $hdrs
16754                 eval $hasproto ;;
16755         *)      ;;
16756         esac
16757         case "$d_random_r_proto" in
16758         define)
16759         case "$random_r_proto" in
16760         ''|0) try='int random_r(int*, struct random_data*);'
16761         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16762         esac
16763         case "$random_r_proto" in
16764         ''|0) try='int random_r(long*, struct random_data*);'
16765         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16766         esac
16767         case "$random_r_proto" in
16768         ''|0) try='int random_r(struct random_data*, int32_t*);'
16769         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16770         esac
16771         case "$random_r_proto" in
16772         ''|0)   d_random_r=undef
16773                 random_r_proto=0
16774                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16775         * )     case "$random_r_proto" in
16776                 REENTRANT_PROTO*) ;;
16777                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16778                 esac
16779                 echo "Prototype: $try" ;;
16780         esac
16781         ;;
16782         *)      case "$usethreads" in
16783                 define) echo "random_r has no prototype, not using it." >&4 ;;
16784                 esac
16785                 d_random_r=undef
16786                 random_r_proto=0
16787                 ;;
16788         esac
16789         ;;
16790 *)      random_r_proto=0
16791         ;;
16792 esac
16793
16794 : see if readdir and friends exist
16795 set readdir d_readdir
16796 eval $inlibc
16797 set seekdir d_seekdir
16798 eval $inlibc
16799 set telldir d_telldir
16800 eval $inlibc
16801 set rewinddir d_rewinddir
16802 eval $inlibc
16803
16804 : see if readdir64_r exists
16805 set readdir64_r d_readdir64_r
16806 eval $inlibc
16807 case "$d_readdir64_r" in
16808 "$define")
16809         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16810         case "$d_readdir64_r_proto:$usethreads" in
16811         ":define")      d_readdir64_r_proto=define
16812                 set d_readdir64_r_proto readdir64_r $hdrs
16813                 eval $hasproto ;;
16814         *)      ;;
16815         esac
16816         case "$d_readdir64_r_proto" in
16817         define)
16818         case "$readdir64_r_proto" in
16819         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16820         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16821         esac
16822         case "$readdir64_r_proto" in
16823         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16824         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16825         esac
16826         case "$readdir64_r_proto" in
16827         ''|0)   d_readdir64_r=undef
16828                 readdir64_r_proto=0
16829                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16830         * )     case "$readdir64_r_proto" in
16831                 REENTRANT_PROTO*) ;;
16832                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16833                 esac
16834                 echo "Prototype: $try" ;;
16835         esac
16836         ;;
16837         *)      case "$usethreads" in
16838                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16839                 esac
16840                 d_readdir64_r=undef
16841                 readdir64_r_proto=0
16842                 ;;
16843         esac
16844         ;;
16845 *)      readdir64_r_proto=0
16846         ;;
16847 esac
16848
16849 : see if readdir_r exists
16850 set readdir_r d_readdir_r
16851 eval $inlibc
16852 case "$d_readdir_r" in
16853 "$define")
16854         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16855         case "$d_readdir_r_proto:$usethreads" in
16856         ":define")      d_readdir_r_proto=define
16857                 set d_readdir_r_proto readdir_r $hdrs
16858                 eval $hasproto ;;
16859         *)      ;;
16860         esac
16861         case "$d_readdir_r_proto" in
16862         define)
16863         case "$readdir_r_proto" in
16864         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16865         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16866         esac
16867         case "$readdir_r_proto" in
16868         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16869         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16870         esac
16871         case "$readdir_r_proto" in
16872         ''|0)   d_readdir_r=undef
16873                 readdir_r_proto=0
16874                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16875         * )     case "$readdir_r_proto" in
16876                 REENTRANT_PROTO*) ;;
16877                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16878                 esac
16879                 echo "Prototype: $try" ;;
16880         esac
16881         ;;
16882         *)      case "$usethreads" in
16883                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16884                 esac
16885                 d_readdir_r=undef
16886                 readdir_r_proto=0
16887                 ;;
16888         esac
16889         ;;
16890 *)      readdir_r_proto=0
16891         ;;
16892 esac
16893
16894 : see if readv exists
16895 set readv d_readv
16896 eval $inlibc
16897
16898 : see if recvmsg exists
16899 set recvmsg d_recvmsg
16900 eval $inlibc
16901
16902 : see if rename exists
16903 set rename d_rename
16904 eval $inlibc
16905
16906 : see if rmdir exists
16907 set rmdir d_rmdir
16908 eval $inlibc
16909
16910 : see if memory.h is available.
16911 val=''
16912 set memory.h val
16913 eval $inhdr
16914
16915 : See if it conflicts with string.h
16916 case "$val" in
16917 $define)
16918         case "$strings" in
16919         '') ;;
16920         *)
16921                 $cppstdin $cppflags $cppminus < $strings > mem.h
16922                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16923                         echo " "
16924                         echo "We won't be including <memory.h>."
16925                         val="$undef"
16926                 fi
16927                 $rm -f mem.h
16928                 ;;
16929         esac
16930 esac
16931 set i_memory
16932 eval $setvar
16933
16934 : can bcopy handle overlapping blocks?
16935 echo " "
16936 val="$undef"
16937 case "$d_memmove" in
16938 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16939 *)      case "$d_bcopy" in
16940         "$define")
16941                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16942                 $cat >try.c <<EOCP
16943 #$i_memory I_MEMORY
16944 #$i_stdlib I_STDLIB
16945 #$i_string I_STRING
16946 #$i_unistd I_UNISTD
16947 EOCP
16948         $cat >>try.c <<'EOCP'
16949 #include <stdio.h>
16950 #ifdef I_MEMORY
16951 #  include <memory.h>
16952 #endif
16953 #ifdef I_STDLIB
16954 #  include <stdlib.h>
16955 #endif
16956 #ifdef I_STRING
16957 #  include <string.h>
16958 #else
16959 #  include <strings.h>
16960 #endif
16961 #ifdef I_UNISTD
16962 #  include <unistd.h>  /* Needed for NetBSD */
16963 #endif
16964 int main()
16965 {
16966 char buf[128], abc[128];
16967 char *b;
16968 int len;
16969 int off;
16970 int align;
16971
16972 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16973    try to store the string in read-only memory. */
16974 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16975
16976 for (align = 7; align >= 0; align--) {
16977         for (len = 36; len; len--) {
16978                 b = buf+align;
16979                 bcopy(abc, b, len);
16980                 for (off = 1; off <= len; off++) {
16981                         bcopy(b, b+off, len);
16982                         bcopy(b+off, b, len);
16983                         if (bcmp(b, abc, len))
16984                                 exit(1);
16985                 }
16986         }
16987 }
16988 exit(0);
16989 }
16990 EOCP
16991                 set try
16992                 if eval $compile_ok; then
16993                         if $run ./try 2>/dev/null; then
16994                                 echo "Yes, it can."
16995                                 val="$define"
16996                         else
16997                                 echo "It can't, sorry."
16998                         fi
16999                 else
17000                         echo "(I can't compile the test program, so we'll assume not...)"
17001                 fi
17002                 ;;
17003         esac
17004         $rm_try
17005         ;;
17006 esac
17007 set d_safebcpy
17008 eval $setvar
17009
17010 : can memcpy handle overlapping blocks?
17011 echo " "
17012 val="$undef"
17013 case "$d_memmove" in
17014 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17015 *)      case "$d_memcpy" in
17016         "$define")
17017                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17018                 $cat >try.c <<EOCP
17019 #$i_memory I_MEMORY
17020 #$i_stdlib I_STDLIB
17021 #$i_string I_STRING
17022 #$i_unistd I_UNISTD
17023 EOCP
17024         $cat >>try.c <<'EOCP'
17025 #include <stdio.h>
17026 #ifdef I_MEMORY
17027 #  include <memory.h>
17028 #endif
17029 #ifdef I_STDLIB
17030 #  include <stdlib.h>
17031 #endif
17032 #ifdef I_STRING
17033 #  include <string.h>
17034 #else
17035 #  include <strings.h>
17036 #endif
17037 #ifdef I_UNISTD
17038 #  include <unistd.h>  /* Needed for NetBSD */
17039 #endif
17040 int main()
17041 {
17042 char buf[128], abc[128];
17043 char *b;
17044 int len;
17045 int off;
17046 int align;
17047
17048 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17049    try to store the string in read-only memory. */
17050 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17051
17052 for (align = 7; align >= 0; align--) {
17053         for (len = 36; len; len--) {
17054                 b = buf+align;
17055                 memcpy(b, abc, len);
17056                 for (off = 1; off <= len; off++) {
17057                         memcpy(b+off, b, len);
17058                         memcpy(b, b+off, len);
17059                         if (memcmp(b, abc, len))
17060                                 exit(1);
17061                 }
17062         }
17063 }
17064 exit(0);
17065 }
17066 EOCP
17067                 set try
17068                 if eval $compile_ok; then
17069                         if $run ./try 2>/dev/null; then
17070                                 echo "Yes, it can."
17071                                 val="$define"
17072                         else
17073                                 echo "It can't, sorry."
17074                         fi
17075                 else
17076                         echo "(I can't compile the test program, so we'll assume not...)"
17077                 fi
17078                 ;;
17079         esac
17080         $rm_try
17081         ;;
17082 esac
17083 set d_safemcpy
17084 eval $setvar
17085
17086 : can memcmp be trusted to compare relative magnitude?
17087 val="$undef"
17088 case "$d_memcmp" in
17089 "$define")
17090         echo " "
17091         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17092         $cat >try.c <<EOCP
17093 #$i_memory I_MEMORY
17094 #$i_stdlib I_STDLIB
17095 #$i_string I_STRING
17096 #$i_unistd I_UNISTD
17097 EOCP
17098         $cat >>try.c <<'EOCP'
17099 #include <stdio.h>
17100 #ifdef I_MEMORY
17101 #  include <memory.h>
17102 #endif
17103 #ifdef I_STDLIB
17104 #  include <stdlib.h>
17105 #endif
17106 #ifdef I_STRING
17107 #  include <string.h>
17108 #else
17109 #  include <strings.h>
17110 #endif
17111 #ifdef I_UNISTD
17112 #  include <unistd.h>  /* Needed for NetBSD */
17113 #endif
17114 int main()
17115 {
17116 char a = -1;
17117 char b = 0;
17118 if ((a < b) && memcmp(&a, &b, 1) < 0)
17119         exit(1);
17120 exit(0);
17121 }
17122 EOCP
17123         set try
17124         if eval $compile_ok; then
17125                 if $run ./try 2>/dev/null; then
17126                         echo "Yes, it can."
17127                         val="$define"
17128                 else
17129                         echo "No, it can't (it uses signed chars)."
17130                 fi
17131         else
17132                 echo "(I can't compile the test program, so we'll assume not...)"
17133         fi
17134         ;;
17135 esac
17136 $rm_try
17137 set d_sanemcmp
17138 eval $setvar
17139
17140 : see if prototype for sbrk is available
17141 echo " "
17142 set d_sbrkproto sbrk $i_unistd unistd.h
17143 eval $hasproto
17144
17145 : see if select exists
17146 set select d_select
17147 eval $inlibc
17148
17149 : see if semctl exists
17150 set semctl d_semctl
17151 eval $inlibc
17152
17153 : see if semget exists
17154 set semget d_semget
17155 eval $inlibc
17156
17157 : see if semop exists
17158 set semop d_semop
17159 eval $inlibc
17160
17161 : see how much of the 'sem*(2)' library is present.
17162 h_sem=true
17163 echo " "
17164 case "$d_semctl$d_semget$d_semop" in
17165 *"$undef"*) h_sem=false;;
17166 esac
17167 case "$osname" in
17168 freebsd)
17169     case "`ipcs 2>&1`" in
17170     "SVID messages"*"not configured"*)
17171         echo "Your $osname does not have the sem*(2) configured." >&4
17172         h_sem=false
17173         val="$undef"
17174         set semctl d_semctl
17175         eval $setvar
17176         set semget d_semget
17177         eval $setvar
17178         set semop d_semop
17179         eval $setvar
17180         ;;
17181     esac
17182     ;;
17183 esac
17184 : we could also check for sys/ipc.h ...
17185 if $h_sem && $test `./findhdr sys/sem.h`; then
17186         echo "You have the full sem*(2) library." >&4
17187         val="$define"
17188 else
17189         echo "You don't have the full sem*(2) library." >&4
17190         val="$undef"
17191 fi
17192 set d_sem
17193 eval $setvar
17194
17195 : see whether sys/sem.h defines union semun
17196 echo " "
17197 $cat > try.c <<'END'
17198 #include <sys/types.h>
17199 #include <sys/ipc.h>
17200 #include <sys/sem.h>
17201 int main () { union semun semun; semun.buf = 0; }
17202 END
17203 set try
17204 if eval $compile; then
17205     echo "You have union semun in <sys/sem.h>." >&4
17206     val="$define"
17207 else
17208     echo "You do not have union semun in <sys/sem.h>." >&4
17209     val="$undef"
17210 fi
17211 $rm_try
17212 set d_union_semun
17213 eval $setvar
17214
17215 : see how to do semctl IPC_STAT
17216 case "$d_sem" in
17217 $define)
17218     echo " "
17219     $cat > tryh.h <<END
17220 #ifndef S_IRUSR
17221 #   ifdef S_IREAD
17222 #       define S_IRUSR S_IREAD
17223 #       define S_IWUSR S_IWRITE
17224 #       define S_IXUSR S_IEXEC
17225 #   else
17226 #       define S_IRUSR 0400
17227 #       define S_IWUSR 0200
17228 #       define S_IXUSR 0100
17229 #   endif
17230 #   define S_IRGRP (S_IRUSR>>3)
17231 #   define S_IWGRP (S_IWUSR>>3)
17232 #   define S_IXGRP (S_IXUSR>>3)
17233 #   define S_IROTH (S_IRUSR>>6)
17234 #   define S_IWOTH (S_IWUSR>>6)
17235 #   define S_IXOTH (S_IXUSR>>6)
17236 #endif
17237 #ifndef S_IRWXU
17238 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17239 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17240 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17241 #endif
17242 END
17243     : see whether semctl IPC_STAT can use union semun
17244     case "$d_semctl_semun" in
17245     '')
17246       val="$undef"
17247       $cat > try.c <<END
17248 #include <sys/types.h>
17249 #include <sys/ipc.h>
17250 #include <sys/sem.h>
17251 #include <sys/stat.h>
17252 #include <stdio.h>
17253 #include <errno.h>
17254 #include "tryh.h"
17255 #ifndef errno
17256 extern int errno;
17257 #endif
17258 #$d_union_semun HAS_UNION_SEMUN
17259 int main() {
17260     union semun
17261 #ifndef HAS_UNION_SEMUN
17262     {
17263         int val;
17264         struct semid_ds *buf;
17265         unsigned short *array;
17266     }
17267 #endif
17268     arg;
17269     int sem, st;
17270
17271 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17272     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17273     if (sem > -1) {
17274         struct semid_ds argbuf;
17275         arg.buf = &argbuf;
17276 #       ifdef IPC_STAT
17277         st = semctl(sem, 0, IPC_STAT, arg);
17278         if (st == 0)
17279             printf("semun\n");
17280         else
17281 #       endif /* IPC_STAT */
17282             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17283 #       ifdef IPC_RMID
17284         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17285 #       endif /* IPC_RMID */
17286             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17287     } else
17288 #endif /* IPC_PRIVATE && ... */
17289         printf("semget failed: errno = %d\n", errno);
17290   return 0;
17291 }
17292 END
17293       set try
17294       if eval $compile; then
17295           xxx=`$run ./try`
17296           case "$xxx" in
17297           semun) val="$define" ;;
17298           esac
17299       fi
17300       $rm_try
17301       set d_semctl_semun
17302       eval $setvar
17303       ;;
17304     esac
17305     case "$d_semctl_semun" in
17306     $define)
17307         echo "You can use union semun for semctl IPC_STAT." >&4
17308         also='also'
17309         ;;
17310     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17311         also=''
17312         ;;
17313     esac
17314
17315     : see whether semctl IPC_STAT can use struct semid_ds pointer
17316     case "$d_semctl_semid_ds" in
17317     '')
17318       val="$undef"
17319       $cat > try.c <<'END'
17320 #include <sys/types.h>
17321 #include <sys/ipc.h>
17322 #include <sys/sem.h>
17323 #include <sys/stat.h>
17324 #include "tryh.h"
17325 #include <stdio.h>
17326 #include <errno.h>
17327 #ifndef errno
17328 extern int errno;
17329 #endif
17330 int main() {
17331     struct semid_ds arg;
17332     int sem, st;
17333
17334 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17335     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17336     if (sem > -1) {
17337 #       ifdef IPC_STAT
17338         st = semctl(sem, 0, IPC_STAT, &arg);
17339         if (st == 0)
17340             printf("semid_ds\n");
17341         else
17342 #       endif /* IPC_STAT */
17343             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17344 #       ifdef IPC_RMID
17345         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17346 #       endif /* IPC_RMID */
17347             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17348     } else
17349 #endif /* IPC_PRIVATE && ... */
17350         printf("semget failed: errno = %d\n", errno);
17351
17352     return 0;
17353 }
17354 END
17355       set try
17356       if eval $compile; then
17357           xxx=`$run ./try`
17358           case "$xxx" in
17359           semid_ds) val="$define" ;;
17360           esac
17361       fi
17362       $rm_try
17363       set d_semctl_semid_ds
17364       eval $setvar
17365       ;;
17366     esac
17367     case "$d_semctl_semid_ds" in
17368     $define)
17369         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17370         ;;
17371     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17372         ;;
17373     esac
17374     ;;
17375 *)  val="$undef"
17376
17377     # We do not have the full sem*(2) library, so assume we can not
17378     # use either.
17379
17380     set d_semctl_semun
17381     eval $setvar
17382
17383     set d_semctl_semid_ds
17384     eval $setvar
17385     ;;
17386 esac
17387 $rm_try tryh.h
17388
17389 : see if sendmsg exists
17390 set sendmsg d_sendmsg
17391 eval $inlibc
17392
17393 : see if setegid exists
17394 set setegid d_setegid
17395 eval $inlibc
17396
17397 : see if seteuid exists
17398 set seteuid d_seteuid
17399 eval $inlibc
17400
17401 : see if setgrent exists
17402 set setgrent d_setgrent
17403 eval $inlibc
17404
17405 : see if setgrent_r exists
17406 set setgrent_r d_setgrent_r
17407 eval $inlibc
17408 case "$d_setgrent_r" in
17409 "$define")
17410         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17411         case "$d_setgrent_r_proto:$usethreads" in
17412         ":define")      d_setgrent_r_proto=define
17413                 set d_setgrent_r_proto setgrent_r $hdrs
17414                 eval $hasproto ;;
17415         *)      ;;
17416         esac
17417         case "$d_setgrent_r_proto" in
17418         define)
17419         case "$setgrent_r_proto" in
17420         ''|0) try='int setgrent_r(FILE**);'
17421         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17422         esac
17423         case "$setgrent_r_proto" in
17424         ''|0) try='void setgrent_r(FILE**);'
17425         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17426         esac
17427         case "$setgrent_r_proto" in
17428         ''|0)   d_setgrent_r=undef
17429                 setgrent_r_proto=0
17430                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17431         * )     case "$setgrent_r_proto" in
17432                 REENTRANT_PROTO*) ;;
17433                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17434                 esac
17435                 echo "Prototype: $try" ;;
17436         esac
17437         ;;
17438         *)      case "$usethreads" in
17439                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17440                 esac
17441                 d_setgrent_r=undef
17442                 setgrent_r_proto=0
17443                 ;;
17444         esac
17445         ;;
17446 *)      setgrent_r_proto=0
17447         ;;
17448 esac
17449
17450 : see if sethostent exists
17451 set sethostent d_sethent
17452 eval $inlibc
17453
17454 : see if sethostent_r exists
17455 set sethostent_r d_sethostent_r
17456 eval $inlibc
17457 case "$d_sethostent_r" in
17458 "$define")
17459         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17460         case "$d_sethostent_r_proto:$usethreads" in
17461         ":define")      d_sethostent_r_proto=define
17462                 set d_sethostent_r_proto sethostent_r $hdrs
17463                 eval $hasproto ;;
17464         *)      ;;
17465         esac
17466         case "$d_sethostent_r_proto" in
17467         define)
17468         case "$sethostent_r_proto" in
17469         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17470         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17471         esac
17472         case "$sethostent_r_proto" in
17473         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17474         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17475         esac
17476         case "$sethostent_r_proto" in
17477         ''|0)   d_sethostent_r=undef
17478                 sethostent_r_proto=0
17479                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17480         * )     case "$sethostent_r_proto" in
17481                 REENTRANT_PROTO*) ;;
17482                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17483                 esac
17484                 echo "Prototype: $try" ;;
17485         esac
17486         ;;
17487         *)      case "$usethreads" in
17488                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17489                 esac
17490                 d_sethostent_r=undef
17491                 sethostent_r_proto=0
17492                 ;;
17493         esac
17494         ;;
17495 *)      sethostent_r_proto=0
17496         ;;
17497 esac
17498
17499 : see if setitimer exists
17500 set setitimer d_setitimer
17501 eval $inlibc
17502
17503 : see if setlinebuf exists
17504 set setlinebuf d_setlinebuf
17505 eval $inlibc
17506
17507 : see if setlocale exists
17508 set setlocale d_setlocale
17509 eval $inlibc
17510
17511 : see if locale.h is available
17512 set locale.h i_locale
17513 eval $inhdr
17514
17515 : see if setlocale_r exists
17516 set setlocale_r d_setlocale_r
17517 eval $inlibc
17518 case "$d_setlocale_r" in
17519 "$define")
17520         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17521         case "$d_setlocale_r_proto:$usethreads" in
17522         ":define")      d_setlocale_r_proto=define
17523                 set d_setlocale_r_proto setlocale_r $hdrs
17524                 eval $hasproto ;;
17525         *)      ;;
17526         esac
17527         case "$d_setlocale_r_proto" in
17528         define)
17529         case "$setlocale_r_proto" in
17530         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17531         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17532         esac
17533         case "$setlocale_r_proto" in
17534         ''|0)   d_setlocale_r=undef
17535                 setlocale_r_proto=0
17536                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17537         * )     case "$setlocale_r_proto" in
17538                 REENTRANT_PROTO*) ;;
17539                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17540                 esac
17541                 echo "Prototype: $try" ;;
17542         esac
17543         ;;
17544         *)      case "$usethreads" in
17545                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17546                 esac
17547                 d_setlocale_r=undef
17548                 setlocale_r_proto=0
17549                 ;;
17550         esac
17551         ;;
17552 *)      setlocale_r_proto=0
17553         ;;
17554 esac
17555
17556 : see if setnetent exists
17557 set setnetent d_setnent
17558 eval $inlibc
17559
17560 : see if setnetent_r exists
17561 set setnetent_r d_setnetent_r
17562 eval $inlibc
17563 case "$d_setnetent_r" in
17564 "$define")
17565         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17566         case "$d_setnetent_r_proto:$usethreads" in
17567         ":define")      d_setnetent_r_proto=define
17568                 set d_setnetent_r_proto setnetent_r $hdrs
17569                 eval $hasproto ;;
17570         *)      ;;
17571         esac
17572         case "$d_setnetent_r_proto" in
17573         define)
17574         case "$setnetent_r_proto" in
17575         ''|0) try='int setnetent_r(int, struct netent_data*);'
17576         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17577         esac
17578         case "$setnetent_r_proto" in
17579         ''|0) try='void setnetent_r(int, struct netent_data*);'
17580         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17581         esac
17582         case "$setnetent_r_proto" in
17583         ''|0)   d_setnetent_r=undef
17584                 setnetent_r_proto=0
17585                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17586         * )     case "$setnetent_r_proto" in
17587                 REENTRANT_PROTO*) ;;
17588                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17589                 esac
17590                 echo "Prototype: $try" ;;
17591         esac
17592         ;;
17593         *)      case "$usethreads" in
17594                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17595                 esac
17596                 d_setnetent_r=undef
17597                 setnetent_r_proto=0
17598                 ;;
17599         esac
17600         ;;
17601 *)      setnetent_r_proto=0
17602         ;;
17603 esac
17604
17605 : see if setprotoent exists
17606 set setprotoent d_setpent
17607 eval $inlibc
17608
17609 : see if setpgid exists
17610 set setpgid d_setpgid
17611 eval $inlibc
17612
17613 : see if setpgrp2 exists
17614 set setpgrp2 d_setpgrp2
17615 eval $inlibc
17616
17617 : see if setpriority exists
17618 set setpriority d_setprior
17619 eval $inlibc
17620
17621 : see if setproctitle exists
17622 set setproctitle d_setproctitle
17623 eval $inlibc
17624
17625 : see if setprotoent_r exists
17626 set setprotoent_r d_setprotoent_r
17627 eval $inlibc
17628 case "$d_setprotoent_r" in
17629 "$define")
17630         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17631         case "$d_setprotoent_r_proto:$usethreads" in
17632         ":define")      d_setprotoent_r_proto=define
17633                 set d_setprotoent_r_proto setprotoent_r $hdrs
17634                 eval $hasproto ;;
17635         *)      ;;
17636         esac
17637         case "$d_setprotoent_r_proto" in
17638         define)
17639         case "$setprotoent_r_proto" in
17640         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17641         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17642         esac
17643         case "$setprotoent_r_proto" in
17644         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17645         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17646         esac
17647         case "$setprotoent_r_proto" in
17648         ''|0)   d_setprotoent_r=undef
17649                 setprotoent_r_proto=0
17650                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17651         * )     case "$setprotoent_r_proto" in
17652                 REENTRANT_PROTO*) ;;
17653                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17654                 esac
17655                 echo "Prototype: $try" ;;
17656         esac
17657         ;;
17658         *)      case "$usethreads" in
17659                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17660                 esac
17661                 d_setprotoent_r=undef
17662                 setprotoent_r_proto=0
17663                 ;;
17664         esac
17665         ;;
17666 *)      setprotoent_r_proto=0
17667         ;;
17668 esac
17669
17670 : see if setpwent exists
17671 set setpwent d_setpwent
17672 eval $inlibc
17673
17674 : see if setpwent_r exists
17675 set setpwent_r d_setpwent_r
17676 eval $inlibc
17677 case "$d_setpwent_r" in
17678 "$define")
17679         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17680         case "$d_setpwent_r_proto:$usethreads" in
17681         ":define")      d_setpwent_r_proto=define
17682                 set d_setpwent_r_proto setpwent_r $hdrs
17683                 eval $hasproto ;;
17684         *)      ;;
17685         esac
17686         case "$d_setpwent_r_proto" in
17687         define)
17688         case "$setpwent_r_proto" in
17689         ''|0) try='int setpwent_r(FILE**);'
17690         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17691         esac
17692         case "$setpwent_r_proto" in
17693         ''|0) try='void setpwent_r(FILE**);'
17694         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17695         esac
17696         case "$setpwent_r_proto" in
17697         ''|0)   d_setpwent_r=undef
17698                 setpwent_r_proto=0
17699                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17700         * )     case "$setpwent_r_proto" in
17701                 REENTRANT_PROTO*) ;;
17702                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17703                 esac
17704                 echo "Prototype: $try" ;;
17705         esac
17706         ;;
17707         *)      case "$usethreads" in
17708                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17709                 esac
17710                 d_setpwent_r=undef
17711                 setpwent_r_proto=0
17712                 ;;
17713         esac
17714         ;;
17715 *)      setpwent_r_proto=0
17716         ;;
17717 esac
17718
17719 : see if setregid exists
17720 set setregid d_setregid
17721 eval $inlibc
17722 set setresgid d_setresgid
17723 eval $inlibc
17724
17725 : see if setreuid exists
17726 set setreuid d_setreuid
17727 eval $inlibc
17728 set setresuid d_setresuid
17729 eval $inlibc
17730
17731 : see if setrgid exists
17732 set setrgid d_setrgid
17733 eval $inlibc
17734
17735 : see if setruid exists
17736 set setruid d_setruid
17737 eval $inlibc
17738
17739 : see if setservent exists
17740 set setservent d_setsent
17741 eval $inlibc
17742
17743 : see if setservent_r exists
17744 set setservent_r d_setservent_r
17745 eval $inlibc
17746 case "$d_setservent_r" in
17747 "$define")
17748         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17749         case "$d_setservent_r_proto:$usethreads" in
17750         ":define")      d_setservent_r_proto=define
17751                 set d_setservent_r_proto setservent_r $hdrs
17752                 eval $hasproto ;;
17753         *)      ;;
17754         esac
17755         case "$d_setservent_r_proto" in
17756         define)
17757         case "$setservent_r_proto" in
17758         ''|0) try='int setservent_r(int, struct servent_data*);'
17759         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17760         esac
17761         case "$setservent_r_proto" in
17762         ''|0) try='void setservent_r(int, struct servent_data*);'
17763         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17764         esac
17765         case "$setservent_r_proto" in
17766         ''|0)   d_setservent_r=undef
17767                 setservent_r_proto=0
17768                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17769         * )     case "$setservent_r_proto" in
17770                 REENTRANT_PROTO*) ;;
17771                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17772                 esac
17773                 echo "Prototype: $try" ;;
17774         esac
17775         ;;
17776         *)      case "$usethreads" in
17777                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17778                 esac
17779                 d_setservent_r=undef
17780                 setservent_r_proto=0
17781                 ;;
17782         esac
17783         ;;
17784 *)      setservent_r_proto=0
17785         ;;
17786 esac
17787
17788 : see if setsid exists
17789 set setsid d_setsid
17790 eval $inlibc
17791
17792 : see if setvbuf exists
17793 set setvbuf d_setvbuf
17794 eval $inlibc
17795
17796 : see if shmctl exists
17797 set shmctl d_shmctl
17798 eval $inlibc
17799
17800 : see if shmget exists
17801 set shmget d_shmget
17802 eval $inlibc
17803
17804 : see if shmat exists
17805 set shmat d_shmat
17806 eval $inlibc
17807 : see what shmat returns
17808 case "$d_shmat" in
17809 "$define")
17810         $cat >shmat.c <<'END'
17811 #include <sys/shm.h>
17812 void *shmat();
17813 END
17814         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17815                 shmattype='void *'
17816         else
17817                 shmattype='char *'
17818         fi
17819         echo "and it returns ($shmattype)." >&4
17820         : see if a prototype for shmat is available
17821         xxx=`./findhdr sys/shm.h`
17822         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17823         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17824                 val="$define"
17825         else
17826                 val="$undef"
17827         fi
17828         $rm -f shmat.[co]
17829         ;;
17830 *)
17831         val="$undef"
17832         ;;
17833 esac
17834 set d_shmatprototype
17835 eval $setvar
17836
17837 : see if shmdt exists
17838 set shmdt d_shmdt
17839 eval $inlibc
17840
17841 : see how much of the 'shm*(2)' library is present.
17842 h_shm=true
17843 echo " "
17844 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17845 *"$undef"*) h_shm=false;;
17846 esac
17847 case "$osname" in
17848 freebsd)
17849     case "`ipcs 2>&1`" in
17850     "SVID shared memory"*"not configured"*)
17851         echo "Your $osname does not have the shm*(2) configured." >&4
17852         h_shm=false
17853         val="$undef"
17854         set shmctl d_shmctl
17855         eval $setvar
17856         set shmget d_shmget
17857         eval $setvar
17858         set shmat d_shmat
17859         eval $setvar
17860         set shmdt d_shmdt
17861         eval $setvar
17862         ;;
17863     esac
17864     ;;
17865 esac
17866 : we could also check for sys/ipc.h ...
17867 if $h_shm && $test `./findhdr sys/shm.h`; then
17868         echo "You have the full shm*(2) library." >&4
17869         val="$define"
17870 else
17871         echo "You don't have the full shm*(2) library." >&4
17872         val="$undef"
17873 fi
17874 set d_shm
17875 eval $setvar
17876
17877 : see if we have sigaction
17878 echo " "
17879 if set sigaction val -f d_sigaction; eval $csym; $val; then
17880         echo 'sigaction() found.' >&4
17881         $cat > try.c <<EOP
17882 #include <stdio.h>
17883 #include <sys/types.h>
17884 #include <signal.h>
17885 #$i_stdlib I_STDLIB
17886 #ifdef I_STDLIB
17887 #include <stdlib.h>
17888 #endif
17889 int main()
17890 {
17891     struct sigaction act, oact;
17892     act.sa_flags = 0;
17893     oact.sa_handler = 0;
17894     /* so that act and oact are used */
17895     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17896 }
17897 EOP
17898         set try
17899         if eval $compile_ok; then
17900                 val="$define"
17901         else
17902                 echo "But you don't seem to have a usable struct sigaction." >&4
17903                 val="$undef"
17904         fi
17905 else
17906         echo 'sigaction NOT found.' >&4
17907         val="$undef"
17908 fi
17909 set d_sigaction; eval $setvar
17910 $rm_try
17911
17912 : see if this is a sunmath.h system
17913 set sunmath.h i_sunmath
17914 eval $inhdr
17915
17916 : see if signbit exists
17917 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17918 $cat >try.c <<EOCP
17919 #$i_math I_MATH
17920 #$i_sunmath I_SUNMATH
17921 #ifdef I_MATH
17922 #  include <math.h>
17923 #endif
17924 #ifdef I_SUNMATH  /* Solaris special math library */
17925 #  include <sunmath.h>
17926 #endif
17927 #define NV $nvtype
17928 int main(int argc, char **argv)
17929 {
17930     NV x = 0.0;
17931     NV y = -0.0;
17932     if ((signbit(x) == 0) && (signbit(y) != 0))
17933         return 0;
17934     else
17935         return 1;
17936 }
17937 EOCP
17938 val="$undef"
17939 set try
17940 if eval $compile; then
17941     if $run ./try; then
17942         $echo "Yes." >&4
17943         val="$define"
17944     else
17945         $echo "Signbit seems to be available, but doesn't work as I expected."
17946         $echo "I won't use it." >&4
17947         val="$undef"
17948     fi
17949 else
17950     $echo "Nope." >&4
17951     dflt="$undef"
17952 fi
17953 set d_signbit
17954 eval $setvar
17955 $rm_try
17956
17957 : see if sigprocmask exists
17958 set sigprocmask d_sigprocmask
17959 eval $inlibc
17960
17961 : see if sigsetjmp exists
17962 echo " "
17963 case "$d_sigsetjmp" in
17964 '')
17965         $cat >try.c <<EOP
17966 #include <setjmp.h>
17967 #$i_stdlib I_STDLIB
17968 #ifdef I_STDLIB
17969 #include <stdlib.h>
17970 #endif
17971 sigjmp_buf env;
17972 int set = 1;
17973 int main()
17974 {
17975         if (sigsetjmp(env,1))
17976                 exit(set);
17977         set = 0;
17978         siglongjmp(env, 1);
17979         exit(1);
17980 }
17981 EOP
17982         set try
17983         if eval $compile; then
17984                 if $run ./try >/dev/null 2>&1; then
17985                         echo "POSIX sigsetjmp found." >&4
17986                         val="$define"
17987                 else
17988                         $cat >&4 <<EOM
17989 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17990 I'll ignore them.
17991 EOM
17992                         val="$undef"
17993                 fi
17994         else
17995                 echo "sigsetjmp not found." >&4
17996                 val="$undef"
17997         fi
17998         ;;
17999 *) val="$d_sigsetjmp"
18000         case "$d_sigsetjmp" in
18001         $define) echo "POSIX sigsetjmp found." >&4;;
18002         $undef) echo "sigsetjmp not found." >&4;;
18003         esac
18004         ;;
18005 esac
18006 set d_sigsetjmp
18007 eval $setvar
18008 $rm_try
18009
18010 : see if snprintf exists
18011 set snprintf d_snprintf
18012 eval $inlibc
18013
18014 : see if vsnprintf exists
18015 set vsnprintf d_vsnprintf
18016 eval $inlibc
18017
18018 case "$d_snprintf-$d_vsnprintf" in
18019 "$define-$define")
18020     $cat <<EOM
18021 Checking whether your snprintf() and vsnprintf() work okay...
18022 EOM
18023     $cat >try.c <<'EOCP'
18024 /* v?snprintf testing logic courtesy of Russ Allbery.
18025  * According to C99:
18026  * - if the buffer is too short it still must be \0-terminated
18027  * - if the buffer is too short the potentially required length
18028  *   must be returned and not -1
18029  * - if the buffer is NULL the potentially required length
18030  *   must be returned and not -1 or core dump
18031  */
18032 #include <stdio.h>
18033 #include <stdarg.h>
18034
18035 char buf[2];
18036
18037 int test (char *format, ...)
18038 {
18039     va_list args;
18040     int count;
18041
18042     va_start (args, format);
18043     count = vsnprintf (buf, sizeof buf, format, args);
18044     va_end (args);
18045     return count;
18046 }
18047
18048 int main ()
18049 {
18050     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18051              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18052 }
18053 EOCP
18054     set try
18055     if eval $compile; then
18056         `$run ./try`
18057         case "$?" in
18058         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18059         *) cat <<EOM >&4
18060 Your snprintf() and snprintf() don't seem to be working okay.
18061 EOM
18062            d_snprintf="$undef"
18063            d_vsnprintf="$undef"
18064            ;;
18065         esac
18066     else
18067         echo "(I can't seem to compile the test program--assuming they don't)"
18068         d_snprintf="$undef"
18069         d_vsnprintf="$undef"
18070     fi
18071     $rm_try
18072     ;;
18073 esac
18074
18075 : see if sockatmark exists
18076 set sockatmark d_sockatmark
18077 eval $inlibc
18078
18079 : see if prototype for sockatmark is available
18080 echo " "
18081 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18082 eval $hasproto
18083
18084 : see if socks5_init exists
18085 set socks5_init d_socks5_init
18086 eval $inlibc
18087
18088 : see if sprintf returns the length of the string in the buffer as per ANSI
18089 $echo "Checking whether sprintf returns the length of the string..." >&4
18090 $cat <<EOP >try.c
18091 #include <stdio.h>
18092 #$i_stdlib I_STDLIB
18093 #ifdef I_STDLIB
18094 #include <stdlib.h>
18095 #endif
18096 #$i_string I_STRING
18097 #ifdef I_STRING
18098 #  include <string.h>
18099 #else
18100 #  include <strings.h>
18101 #endif
18102 #$i_math I_MATH
18103 #ifdef I_MATH
18104 #include <math.h>
18105 #endif
18106
18107 char buffer[256];
18108
18109 int check (size_t expect, int test) {
18110   size_t got = strlen(buffer);
18111   if (expect == got)
18112     return 0;
18113
18114   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18115        test, buffer);
18116   exit (test);
18117 }
18118
18119 int main(int argc, char **argv) {
18120   int test = 0;
18121
18122   check(sprintf(buffer, ""), ++test);
18123   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18124   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18125
18126   return 0;
18127 }
18128 EOP
18129 set try
18130
18131 if eval $compile; then
18132     xxx="`$run ./try`"
18133     case "$?" in
18134         0) cat >&4 <<EOM
18135 sprintf returns the length of the string (as ANSI says it should)
18136 EOM
18137         d_sprintf_returns_strlen="$define"
18138         ;;
18139         *) cat >&4 <<EOM
18140 sprintf does not return the length of the string (how old is this system?)
18141 EOM
18142         d_sprintf_returns_strlen="$undef"
18143         ;;
18144     esac
18145 else
18146     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18147     d_sprintf_returns_strlen="$undef"
18148 fi
18149 $rm_try
18150
18151 : see if srand48_r exists
18152 set srand48_r d_srand48_r
18153 eval $inlibc
18154 case "$d_srand48_r" in
18155 "$define")
18156         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18157         case "$d_srand48_r_proto:$usethreads" in
18158         ":define")      d_srand48_r_proto=define
18159                 set d_srand48_r_proto srand48_r $hdrs
18160                 eval $hasproto ;;
18161         *)      ;;
18162         esac
18163         case "$d_srand48_r_proto" in
18164         define)
18165         case "$srand48_r_proto" in
18166         ''|0) try='int srand48_r(long, struct drand48_data*);'
18167         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18168         esac
18169         case "$srand48_r_proto" in
18170         ''|0)   d_srand48_r=undef
18171                 srand48_r_proto=0
18172                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18173         * )     case "$srand48_r_proto" in
18174                 REENTRANT_PROTO*) ;;
18175                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18176                 esac
18177                 echo "Prototype: $try" ;;
18178         esac
18179         ;;
18180         *)      case "$usethreads" in
18181                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18182                 esac
18183                 d_srand48_r=undef
18184                 srand48_r_proto=0
18185                 ;;
18186         esac
18187         ;;
18188 *)      srand48_r_proto=0
18189         ;;
18190 esac
18191
18192 : see if srandom_r exists
18193 set srandom_r d_srandom_r
18194 eval $inlibc
18195 case "$d_srandom_r" in
18196 "$define")
18197         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18198         case "$d_srandom_r_proto:$usethreads" in
18199         ":define")      d_srandom_r_proto=define
18200                 set d_srandom_r_proto srandom_r $hdrs
18201                 eval $hasproto ;;
18202         *)      ;;
18203         esac
18204         case "$d_srandom_r_proto" in
18205         define)
18206         case "$srandom_r_proto" in
18207         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18208         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18209         esac
18210         case "$srandom_r_proto" in
18211         ''|0)   d_srandom_r=undef
18212                 srandom_r_proto=0
18213                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18214         * )     case "$srandom_r_proto" in
18215                 REENTRANT_PROTO*) ;;
18216                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18217                 esac
18218                 echo "Prototype: $try" ;;
18219         esac
18220         ;;
18221         *)      case "$usethreads" in
18222                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18223                 esac
18224                 d_srandom_r=undef
18225                 srandom_r_proto=0
18226                 ;;
18227         esac
18228         ;;
18229 *)      srandom_r_proto=0
18230         ;;
18231 esac
18232
18233 : see if prototype for setresgid is available
18234 echo " "
18235 set d_sresgproto setresgid $i_unistd unistd.h
18236 eval $hasproto
18237
18238 : see if prototype for setresuid is available
18239 echo " "
18240 set d_sresuproto setresuid $i_unistd unistd.h
18241 eval $hasproto
18242
18243 : see if sys/stat.h is available
18244 set sys/stat.h i_sysstat
18245 eval $inhdr
18246
18247 : see if stat knows about block sizes
18248 echo " "
18249 echo "Checking to see if your struct stat has st_blocks field..." >&4
18250 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18251 eval $hasfield
18252
18253 : see if this is a sys/vfs.h system
18254 set sys/vfs.h i_sysvfs
18255 eval $inhdr
18256
18257 : see if this is a sys/statfs.h system
18258 set sys/statfs.h i_sysstatfs
18259 eval $inhdr
18260
18261 : Check for statfs_s
18262 echo " "
18263 echo "Checking to see if your system supports struct statfs..." >&4
18264 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
18265 eval $hasstruct
18266 case "$d_statfs_s" in
18267 "$define")      echo "Yes, it does."   ;;
18268 *)              echo "No, it doesn't." ;;
18269 esac
18270
18271
18272 : see if struct statfs knows about f_flags
18273 case "$d_statfs_s" in
18274 define)
18275         echo " "
18276         echo "Checking to see if your struct statfs has f_flags field..." >&4
18277         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
18278         eval $hasfield
18279         ;;
18280 *)      val="$undef"
18281         set d_statfs_f_flags
18282         eval $setvar
18283         ;;
18284 esac
18285 case "$d_statfs_f_flags" in
18286 "$define")      echo "Yes, it does."   ;;
18287 *)              echo "No, it doesn't." ;;
18288 esac
18289
18290 : see what flavor, if any, of static inline is supported
18291 echo " "
18292 echo "Checking to see if your system supports static inline..."
18293 $cat > try.c <<'EOCP'
18294 #include <stdlib.h>
18295 extern int f_via_a(int x);
18296 extern int f_via_b(int x);
18297 int main(int argc, char **argv)
18298 {
18299     int y;
18300
18301     y = f_via_a(0);
18302 #ifdef USE_B
18303     y = f_via_b(0);
18304 #endif
18305     if (y == 42) {
18306         return EXIT_SUCCESS;
18307     }
18308     else {
18309         return EXIT_FAILURE;
18310     }
18311 }
18312 EOCP
18313 $cat > a.c <<'EOCP'
18314 static INLINE int f(int x) {
18315     int y;
18316     y = x + 42;
18317     return y;
18318 }
18319
18320 int f_via_a(int x)
18321 {
18322     return f(x);
18323 }
18324 EOCP
18325 $cat > b.c <<'EOCP'
18326 extern int f(int x);
18327
18328 int f_via_b(int x)
18329 {
18330     return f(x);
18331 }
18332 EOCP
18333
18334 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18335 case "$perl_static_inline" in
18336 '')     # Check the various possibilities, and break out on success.
18337         # For gcc, prefer __inline__, which will still permit
18338         # cflags.SH to add in -ansi.
18339         case "$gccversion" in
18340                 '') xxx="inline __inline__ __inline _inline";;
18341                 *)  xxx="__inline__ inline __inline _inline";;
18342         esac
18343         for inline in $xxx; do
18344                 set try -DINLINE=$inline a.c
18345                 if eval $compile && $run ./try; then
18346                         # Now make sure there is no external linkage of static
18347                         # functions
18348                         set try -DINLINE=$inline -DUSE_B a.c b.c
18349                         if eval $compile && $run ./try; then
18350                                 $echo "Your compiler supports static $inline, " >&4
18351                                 $echo "but it also creates an external definition," >&4
18352                                 $echo "so I won't use it." >&4
18353                                 val=$undef
18354                         else
18355                                 $echo "Your compiler supports static $inline." >&4
18356                                 val=$define
18357                                 perl_static_inline="static $inline";
18358                                 break;
18359                         fi
18360                 else
18361                         $echo "Your compiler does NOT support static $inline." >&4
18362                         val="$undef"
18363                 fi
18364         done
18365         ;;
18366 *inline*) # Some variant of inline exists.
18367         echo "Keeping your $hint value of $perl_static_inline."
18368         val=$define
18369         ;;
18370 static)  # No inline capabilities
18371         echo "Keeping your $hint value of $perl_static_inline."
18372         val=$undef
18373         ;;
18374 *)  # Unrecognized previous value -- blindly trust the supplied
18375         # value and hope it makes sense.  Use old value for
18376         # d_static_inline, if there is one.
18377         echo "Keeping your $hint value of $perl_static_inline."
18378         case "$d_static_inline" in
18379                 '') val=$define ;;
18380                 *)  val=$d_static_inline ;;
18381         esac
18382         ;;
18383 esac
18384 # Fallback to plain 'static' if nothing worked.
18385 case "$perl_static_inline" in
18386 '')
18387         perl_static_inline="static"
18388         val=$undef
18389         ;;
18390 esac
18391 set d_static_inline
18392 eval $setvar
18393 $rm -f a.[co] b.[co]
18394 $rm_try
18395
18396 : Check stream access
18397 $cat >&4 <<EOM
18398 Checking how to access stdio streams by file descriptor number...
18399 EOM
18400 case "$stdio_stream_array" in
18401 '')     $cat >try.c <<EOCP
18402 #include <stdio.h>
18403 int main() {
18404   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18405     printf("yes\n");
18406 }
18407 EOCP
18408         for s in _iob __iob __sF
18409         do
18410                 set try -DSTDIO_STREAM_ARRAY=$s
18411                 if eval $compile; then
18412                         case "`$run ./try`" in
18413                         yes)    stdio_stream_array=$s; break ;;
18414                         esac
18415                 fi
18416         done
18417         $rm_try
18418 esac
18419 case "$stdio_stream_array" in
18420 '')     $cat >&4 <<EOM
18421 I can't figure out how to access stdio streams by file descriptor number.
18422 EOM
18423         d_stdio_stream_array="$undef"
18424         ;;
18425 *)      $cat >&4 <<EOM
18426 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18427 EOM
18428         d_stdio_stream_array="$define"
18429         ;;
18430 esac
18431
18432 : see if strcoll exists
18433 set strcoll d_strcoll
18434 eval $inlibc
18435
18436 : check for structure copying
18437 echo " "
18438 echo "Checking to see if your C compiler can copy structs..." >&4
18439 $cat >try.c <<'EOCP'
18440 int main()
18441 {
18442         struct blurfl {
18443                 int dyick;
18444         } foo, bar;
18445
18446         foo = bar;
18447 }
18448 EOCP
18449 if $cc -c try.c >/dev/null 2>&1 ; then
18450         val="$define"
18451         echo "Yup, it can."
18452 else
18453         val="$undef"
18454         echo "Nope, it can't."
18455 fi
18456 set d_strctcpy
18457 eval $setvar
18458 $rm_try
18459
18460 : see if strerror and/or sys_errlist[] exist
18461 echo " "
18462 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18463     if set strerror val -f d_strerror; eval $csym; $val; then
18464                 echo 'strerror() found.' >&4
18465                 d_strerror="$define"
18466                 d_strerrm='strerror(e)'
18467                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18468                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18469                         d_syserrlst="$define"
18470                 else
18471                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18472                         d_syserrlst="$undef"
18473                 fi
18474     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18475                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18476                 echo 'strerror() found in string header.' >&4
18477                 d_strerror="$define"
18478                 d_strerrm='strerror(e)'
18479                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18480                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18481                                 d_syserrlst="$define"
18482                 else
18483                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18484                         d_syserrlst="$undef"
18485                 fi
18486     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18487                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18488                 d_strerror="$undef"
18489                 d_syserrlst="$define"
18490                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18491     else
18492                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18493                 d_strerror="$undef"
18494                 d_syserrlst="$undef"
18495                 d_strerrm='"unknown"'
18496     fi
18497 fi
18498
18499 : see if strerror_r exists
18500 set strerror_r d_strerror_r
18501 eval $inlibc
18502 case "$d_strerror_r" in
18503 "$define")
18504         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18505         case "$d_strerror_r_proto:$usethreads" in
18506         ":define")      d_strerror_r_proto=define
18507                 set d_strerror_r_proto strerror_r $hdrs
18508                 eval $hasproto ;;
18509         *)      ;;
18510         esac
18511         case "$d_strerror_r_proto" in
18512         define)
18513         case "$strerror_r_proto" in
18514         ''|0) try='int strerror_r(int, char*, size_t);'
18515         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18516         esac
18517         case "$strerror_r_proto" in
18518         ''|0) try='int strerror_r(int, char*, int);'
18519         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18520         esac
18521         case "$strerror_r_proto" in
18522         ''|0) try='char* strerror_r(int, char*, size_t);'
18523         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18524         esac
18525         case "$strerror_r_proto" in
18526         ''|0)   d_strerror_r=undef
18527                 strerror_r_proto=0
18528                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18529         * )     case "$strerror_r_proto" in
18530                 REENTRANT_PROTO*) ;;
18531                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18532                 esac
18533                 echo "Prototype: $try" ;;
18534         esac
18535         ;;
18536         *)      case "$usethreads" in
18537                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18538                 esac
18539                 d_strerror_r=undef
18540                 strerror_r_proto=0
18541                 ;;
18542         esac
18543         ;;
18544 *)      strerror_r_proto=0
18545         ;;
18546 esac
18547
18548 : see if strftime exists
18549 set strftime d_strftime
18550 eval $inlibc
18551
18552 : see if strlcat exists
18553 set strlcat d_strlcat
18554 eval $inlibc
18555
18556 : see if strlcpy exists
18557 set strlcpy d_strlcpy
18558 eval $inlibc
18559
18560 : see if strtod exists
18561 set strtod d_strtod
18562 eval $inlibc
18563
18564 : see if strtol exists
18565 set strtol d_strtol
18566 eval $inlibc
18567
18568 : see if strtold exists
18569 set strtold d_strtold
18570 eval $inlibc
18571
18572 : see if strtoll exists
18573 set strtoll d_strtoll
18574 eval $inlibc
18575
18576 case "$d_longlong-$d_strtoll" in
18577 "$define-$define")
18578         $cat <<EOM
18579 Checking whether your strtoll() works okay...
18580 EOM
18581         $cat >try.c <<'EOCP'
18582 #include <errno.h>
18583 #ifdef __hpux
18584 #define strtoll __strtoll
18585 #endif
18586 #ifdef __EMX__
18587 #define strtoll _strtoll
18588 #endif
18589 #include <stdio.h>
18590 extern long long int strtoll(char *s, char **, int);
18591 static int bad = 0;
18592 int check(char *s, long long ell, int een) {
18593         long long gll;
18594         errno = 0;
18595         gll = strtoll(s, 0, 10);
18596         if (!((gll == ell) && (errno == een)))
18597                 bad++;
18598 }
18599 int main() {
18600         check(" 1",                                      1LL, 0);
18601         check(" 0",                                      0LL, 0);
18602         check("-1",                                     -1LL, 0);
18603         check("-9223372036854775808", -9223372036854775808LL, 0);
18604         check("-9223372036854775808", -9223372036854775808LL, 0);
18605         check(" 9223372036854775807",  9223372036854775807LL, 0);
18606         check("-9223372036854775808", -9223372036854775808LL, 0);
18607         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18608         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18609         if (!bad)
18610                 printf("ok\n");
18611 }
18612 EOCP
18613         set try
18614         if eval $compile; then
18615                 yyy=`$run ./try`
18616                 case "$yyy" in
18617                 ok) echo "Your strtoll() seems to be working okay." ;;
18618                 *) cat <<EOM >&4
18619 Your strtoll() doesn't seem to be working okay.
18620 EOM
18621                    d_strtoll="$undef"
18622                    ;;
18623                 esac
18624         else
18625                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18626                 d_strtoll="$undef"
18627         fi
18628         ;;
18629 esac
18630
18631 : see if strtoq exists
18632 set strtoq d_strtoq
18633 eval $inlibc
18634
18635 : see if strtoul exists
18636 set strtoul d_strtoul
18637 eval $inlibc
18638
18639 case "$d_strtoul" in
18640 "$define")
18641         $cat <<EOM
18642 Checking whether your strtoul() works okay...
18643 EOM
18644         $cat >try.c <<'EOCP'
18645 #include <errno.h>
18646 #include <stdio.h>
18647 extern unsigned long int strtoul(char *s, char **, int);
18648 static int bad = 0;
18649 void check(char *s, unsigned long eul, int een) {
18650         unsigned long gul;
18651         errno = 0;
18652         gul = strtoul(s, 0, 10);
18653         if (!((gul == eul) && (errno == een)))
18654                 bad++;
18655 }
18656 int main() {
18657         check(" 1", 1L, 0);
18658         check(" 0", 0L, 0);
18659 EOCP
18660         case "$longsize" in
18661         8)
18662             $cat >>try.c <<'EOCP'
18663         check("18446744073709551615", 18446744073709551615UL, 0);
18664         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18665 #if 0 /* strtoul() for /^-/ strings is undefined. */
18666         check("-1", 18446744073709551615UL, 0);
18667         check("-18446744073709551614", 2, 0);
18668         check("-18446744073709551615", 1, 0);
18669         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18670         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18671 #endif
18672 EOCP
18673                 ;;
18674         4)
18675                     $cat >>try.c <<'EOCP'
18676         check("4294967295", 4294967295UL, 0);
18677         check("4294967296", 4294967295UL, ERANGE);
18678 #if 0 /* strtoul() for /^-/ strings is undefined. */
18679         check("-1", 4294967295UL, 0);
18680         check("-4294967294", 2, 0);
18681         check("-4294967295", 1, 0);
18682         check("-4294967296", 4294967295UL, ERANGE);
18683         check("-4294967297", 4294967295UL, ERANGE);
18684 #endif
18685 EOCP
18686                 ;;
18687         *)
18688 : Should we write these tests to be more portable by sprintf-ing
18689 : ~0 and then manipulating that char string as input for strtol?
18690                 ;;
18691         esac
18692         $cat >>try.c <<'EOCP'
18693         if (!bad)
18694                 printf("ok\n");
18695         return 0;
18696 }
18697 EOCP
18698         set try
18699         if eval $compile; then
18700                 case "`$run ./try`" in
18701                 ok) echo "Your strtoul() seems to be working okay." ;;
18702                 *) cat <<EOM >&4
18703 Your strtoul() doesn't seem to be working okay.
18704 EOM
18705                    d_strtoul="$undef"
18706                    ;;
18707                 esac
18708         else
18709                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18710                 d_strtoul="$undef"
18711         fi
18712         ;;
18713 esac
18714
18715 : see if strtoull exists
18716 set strtoull d_strtoull
18717 eval $inlibc
18718
18719 case "$d_longlong-$d_strtoull" in
18720 "$define-$define")
18721         $cat <<EOM
18722 Checking whether your strtoull() works okay...
18723 EOM
18724         $cat >try.c <<'EOCP'
18725 #include <errno.h>
18726 #ifdef __hpux
18727 #define strtoull __strtoull
18728 #endif
18729 #include <stdio.h>
18730 extern unsigned long long int strtoull(char *s, char **, int);
18731 static int bad = 0;
18732 int check(char *s, long long eull, int een) {
18733         long long gull;
18734         errno = 0;
18735         gull = strtoull(s, 0, 10);
18736         if (!((gull == eull) && (errno == een)))
18737                 bad++;
18738 }
18739 int main() {
18740         check(" 1",                                        1LL, 0);
18741         check(" 0",                                        0LL, 0);
18742         check("18446744073709551615",  18446744073709551615ULL, 0);
18743         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18744 #if 0 /* strtoull() for /^-/ strings is undefined. */
18745         check("-1",                    18446744073709551615ULL, 0);
18746         check("-18446744073709551614",                     2LL, 0);
18747         check("-18446744073709551615",                     1LL, 0);
18748         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18749         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18750 #endif
18751         if (!bad)
18752                 printf("ok\n");
18753 }
18754 EOCP
18755         set try
18756         if eval $compile; then
18757                 case "`$run ./try`" in
18758                 ok) echo "Your strtoull() seems to be working okay." ;;
18759                 *) cat <<EOM >&4
18760 Your strtoull() doesn't seem to be working okay.
18761 EOM
18762                    d_strtoull="$undef"
18763                    ;;
18764                 esac
18765         else
18766                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18767                 d_strtoull="$undef"
18768         fi
18769         ;;
18770 esac
18771
18772 : see if strtouq exists
18773 set strtouq d_strtouq
18774 eval $inlibc
18775
18776 case "$d_strtouq" in
18777 "$define")
18778         $cat <<EOM
18779 Checking whether your strtouq() works okay...
18780 EOM
18781         $cat >try.c <<'EOCP'
18782 #include <errno.h>
18783 #include <stdio.h>
18784 extern unsigned long long int strtouq(char *s, char **, int);
18785 static int bad = 0;
18786 void check(char *s, unsigned long long eull, int een) {
18787         unsigned long long gull;
18788         errno = 0;
18789         gull = strtouq(s, 0, 10);
18790         if (!((gull == eull) && (errno == een)))
18791                 bad++;
18792 }
18793 int main() {
18794         check(" 1",                                        1LL, 0);
18795         check(" 0",                                        0LL, 0);
18796         check("18446744073709551615",  18446744073709551615ULL, 0);
18797         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18798 #if 0 /* strtouq() for /^-/ strings is undefined. */
18799         check("-1",                    18446744073709551615ULL, 0);
18800         check("-18446744073709551614",                     2LL, 0);
18801         check("-18446744073709551615",                     1LL, 0);
18802         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18803         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18804 #endif
18805         if (!bad)
18806                 printf("ok\n");
18807         return 0;
18808 }
18809 EOCP
18810         set try
18811         if eval $compile; then
18812                 case "`$run ./try`" in
18813                 ok) echo "Your strtouq() seems to be working okay." ;;
18814                 *) cat <<EOM >&4
18815 Your strtouq() doesn't seem to be working okay.
18816 EOM
18817                    d_strtouq="$undef"
18818                    ;;
18819                 esac
18820         else
18821                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18822                 d_strtouq="$undef"
18823         fi
18824         ;;
18825 esac
18826
18827 : see if strxfrm exists
18828 set strxfrm d_strxfrm
18829 eval $inlibc
18830
18831 : see if symlink exists
18832 set symlink d_symlink
18833 eval $inlibc
18834
18835 : see if syscall exists
18836 set syscall d_syscall
18837 eval $inlibc
18838
18839 : see if prototype for syscall is available
18840 echo " "
18841 set d_syscallproto syscall $i_unistd unistd.h
18842 eval $hasproto
18843
18844 : see if sysconf exists
18845 set sysconf d_sysconf
18846 eval $inlibc
18847
18848 : see if system exists
18849 set system d_system
18850 eval $inlibc
18851
18852 : see if tcgetpgrp exists
18853 set tcgetpgrp d_tcgetpgrp
18854 eval $inlibc
18855
18856 : see if tcsetpgrp exists
18857 set tcsetpgrp d_tcsetpgrp
18858 eval $inlibc
18859
18860 : see if prototype for telldir is available
18861 echo " "
18862 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18863 eval $hasproto
18864
18865 : see if time exists
18866 echo " "
18867 if test "X$d_time" = X -o X"$timetype" = X; then
18868     if set time val -f d_time; eval $csym; $val; then
18869                 echo 'time() found.' >&4
18870                 val="$define"
18871                 rp="What is the type returned by time() on this system?"
18872                 set time_t timetype long stdio.h sys/types.h
18873                 eval $typedef_ask
18874     else
18875                 echo 'time() not found, hope that will do.' >&4
18876                 val="$undef"
18877                 timetype='int';
18878     fi
18879     set d_time
18880     eval $setvar
18881 fi
18882
18883 : see if timegm exists
18884 set timegm d_timegm
18885 eval $inlibc
18886
18887 : see if this is a sys/times.h system
18888 set sys/times.h i_systimes
18889 eval $inhdr
18890
18891 : see if times exists
18892 echo " "
18893 if set times val -f d_times; eval $csym; $val; then
18894         echo 'times() found.' >&4
18895         d_times="$define"
18896         inc=''
18897         case "$i_systimes" in
18898         "$define") inc='sys/times.h';;
18899         esac
18900         rp="What is the type returned by times() on this system?"
18901         set clock_t clocktype long stdio.h sys/types.h $inc
18902         eval $typedef_ask
18903 else
18904         echo 'times() NOT found, hope that will do.' >&4
18905         d_times="$undef"
18906         clocktype='int'
18907 fi
18908
18909 : see if tmpnam_r exists
18910 set tmpnam_r d_tmpnam_r
18911 eval $inlibc
18912 case "$d_tmpnam_r" in
18913 "$define")
18914         hdrs="$i_systypes sys/types.h define stdio.h "
18915         case "$d_tmpnam_r_proto:$usethreads" in
18916         ":define")      d_tmpnam_r_proto=define
18917                 set d_tmpnam_r_proto tmpnam_r $hdrs
18918                 eval $hasproto ;;
18919         *)      ;;
18920         esac
18921         case "$d_tmpnam_r_proto" in
18922         define)
18923         case "$tmpnam_r_proto" in
18924         ''|0) try='char* tmpnam_r(char*);'
18925         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18926         esac
18927         case "$tmpnam_r_proto" in
18928         ''|0)   d_tmpnam_r=undef
18929                 tmpnam_r_proto=0
18930                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18931         * )     case "$tmpnam_r_proto" in
18932                 REENTRANT_PROTO*) ;;
18933                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18934                 esac
18935                 echo "Prototype: $try" ;;
18936         esac
18937         ;;
18938         *)      case "$usethreads" in
18939                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18940                 esac
18941                 d_tmpnam_r=undef
18942                 tmpnam_r_proto=0
18943                 ;;
18944         esac
18945         ;;
18946 *)      tmpnam_r_proto=0
18947         ;;
18948 esac
18949
18950 : see if truncate exists
18951 set truncate d_truncate
18952 eval $inlibc
18953
18954 : see if ttyname_r exists
18955 set ttyname_r d_ttyname_r
18956 eval $inlibc
18957 case "$d_ttyname_r" in
18958 "$define")
18959         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18960         case "$d_ttyname_r_proto:$usethreads" in
18961         ":define")      d_ttyname_r_proto=define
18962                 set d_ttyname_r_proto ttyname_r $hdrs
18963                 eval $hasproto ;;
18964         *)      ;;
18965         esac
18966         case "$d_ttyname_r_proto" in
18967         define)
18968         case "$ttyname_r_proto" in
18969         ''|0) try='int ttyname_r(int, char*, size_t);'
18970         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18971         esac
18972         case "$ttyname_r_proto" in
18973         ''|0) try='int ttyname_r(int, char*, int);'
18974         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18975         esac
18976         case "$ttyname_r_proto" in
18977         ''|0) try='char* ttyname_r(int, char*, int);'
18978         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18979         esac
18980         case "$ttyname_r_proto" in
18981         ''|0)   d_ttyname_r=undef
18982                 ttyname_r_proto=0
18983                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18984         * )     case "$ttyname_r_proto" in
18985                 REENTRANT_PROTO*) ;;
18986                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18987                 esac
18988                 echo "Prototype: $try" ;;
18989         esac
18990         ;;
18991         *)      case "$usethreads" in
18992                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18993                 esac
18994                 d_ttyname_r=undef
18995                 ttyname_r_proto=0
18996                 ;;
18997         esac
18998         ;;
18999 *)      ttyname_r_proto=0
19000         ;;
19001 esac
19002
19003 : see if tzname[] exists
19004 echo " "
19005 if set tzname val -a d_tzname; eval $csym; $val; then
19006         val="$define"
19007         echo 'tzname[] found.' >&4
19008 else
19009         val="$undef"
19010         echo 'tzname[] NOT found.' >&4
19011 fi
19012 set d_tzname
19013 eval $setvar
19014
19015 : Check if is a multiplatform env
19016 case "$osname" in
19017 darwin) multiarch="$define" ;;
19018 esac
19019 case "$multiarch" in
19020 ''|[nN]*) multiarch="$undef" ;;
19021 esac
19022
19023 : check for ordering of bytes in a UV
19024 echo " "
19025 case "$multiarch" in
19026 *$define*)
19027         $cat <<EOM
19028 You seem to be doing a multiarchitecture build,
19029 skipping the byteorder check.
19030
19031 EOM
19032         byteorder='ffff'
19033         ;;
19034 *)
19035         case "$byteorder" in
19036         '')
19037                 $cat <<'EOM'
19038 In the following, larger digits indicate more significance.  A big-endian
19039 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19040 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19041 machines may have weird orders like 3412.  A Cray will report 87654321,
19042 an Alpha will report 12345678. If the test program works the default is
19043 probably right.
19044 I'm now running the test program...
19045 EOM
19046                 $cat >try.c <<EOCP
19047 #include <stdio.h>
19048 #$i_stdlib I_STDLIB
19049 #ifdef I_STDLIB
19050 #include <stdlib.h>
19051 #endif
19052 #include <sys/types.h>
19053 typedef $uvtype UV;
19054 int main()
19055 {
19056         int i;
19057         union {
19058                 UV l;
19059                 char c[$uvsize];
19060         } u;
19061
19062         if ($uvsize > 4)
19063                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19064         else
19065                 u.l = (UV)0x04030201;
19066         for (i = 0; i < $uvsize; i++)
19067                 printf("%c", u.c[i]+'0');
19068         printf("\n");
19069         exit(0);
19070 }
19071 EOCP
19072                 xxx_prompt=y
19073                 set try
19074                 if eval $compile && $run ./try > /dev/null; then
19075                         dflt=`$run ./try`
19076                         case "$dflt" in
19077                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19078                                 echo "(The test program ran ok.)"
19079                                 echo "byteorder=$dflt"
19080                                 xxx_prompt=n
19081                         ;;
19082                         ????|????????) echo "(The test program ran ok.)" ;;
19083                         *) echo "(The test program didn't run right for some reason.)" ;;
19084                         esac
19085                 else
19086                         dflt='4321'
19087                         cat <<'EOM'
19088 (I can't seem to compile the test program.  Guessing big-endian...)
19089 EOM
19090                 fi
19091                 case "$xxx_prompt" in
19092                 y)
19093                         rp="What is the order of bytes in $uvtype?"
19094                         . ./myread
19095                         byteorder="$ans"
19096                         ;;
19097                 *)      byteorder=$dflt
19098                         ;;
19099                 esac
19100                 ;;
19101         esac
19102         $rm_try
19103         ;;
19104 esac
19105
19106 : Checking 32bit alignedness
19107 $cat <<EOM
19108
19109 Checking to see whether you can access character data unalignedly...
19110 EOM
19111 case "$d_u32align" in
19112 '')   $cat >try.c <<EOCP
19113 #include <stdio.h>
19114 #$i_stdlib I_STDLIB
19115 #ifdef I_STDLIB
19116 #include <stdlib.h>
19117 #endif
19118 #define U32 $u32type
19119 #define BYTEORDER 0x$byteorder
19120 #define U8 $u8type
19121 #include <signal.h>
19122 #ifdef SIGBUS
19123 $signal_t bletch(int s) { exit(4); }
19124 #endif
19125 int main() {
19126 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19127     volatile U8 buf[8];
19128     volatile U32 *up;
19129     int i;
19130
19131     if (sizeof(U32) != 4) {
19132         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19133         exit(1);
19134     }
19135
19136     fflush(stdout);
19137
19138 #ifdef SIGBUS
19139     signal(SIGBUS, bletch);
19140 #endif
19141
19142     buf[0] = 0;
19143     buf[1] = 0;
19144     buf[2] = 0;
19145     buf[3] = 1;
19146     buf[4] = 0;
19147     buf[5] = 0;
19148     buf[6] = 0;
19149     buf[7] = 1;
19150
19151     for (i = 0; i < 4; i++) {
19152         up = (U32*)(buf + i);
19153         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19154                (*up == 1 << (8*(3-i)))  /* little-endian */
19155               )
19156            )
19157         {
19158             printf("read failed (%x)\n", *up);
19159             exit(2);
19160         }
19161     }
19162
19163     /* write test */
19164     for (i = 0; i < 4; i++) {
19165         up = (U32*)(buf + i);
19166         *up = 0xBeef;
19167         if (*up != 0xBeef) {
19168             printf("write failed (%x)\n", *up);
19169             exit(3);
19170         }
19171     }
19172
19173     exit(0);
19174 #else
19175     printf("1\n");
19176     exit(1);
19177 #endif
19178     return 0;
19179 }
19180 EOCP
19181 set try
19182 if eval $compile_ok; then
19183         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19184         $run ./try 2>&1 >/dev/null
19185         case "$?" in
19186         0)      cat >&4 <<EOM
19187 You can access character data pretty unalignedly.
19188 EOM
19189                 d_u32align="$undef"
19190                 ;;
19191         *)      cat >&4 <<EOM
19192 It seems that you must access character data in an aligned manner.
19193 EOM
19194                 d_u32align="$define"
19195                 ;;
19196         esac
19197 else
19198         rp='Can you access character data at unaligned addresses?'
19199         dflt='n'
19200         . ./myread
19201         case "$ans" in
19202         [yY]*)  d_u32align="$undef"  ;;
19203         *)      d_u32align="$define" ;;
19204         esac
19205 fi
19206 $rm_try
19207 ;;
19208 esac
19209
19210 : see if ualarm exists
19211 set ualarm d_ualarm
19212 eval $inlibc
19213
19214 : see if umask exists
19215 set umask d_umask
19216 eval $inlibc
19217
19218 : see if unordered exists
19219 set unordered d_unordered
19220 eval $inlibc
19221
19222 : see if unsetenv exists
19223 set unsetenv d_unsetenv
19224 eval $inlibc
19225
19226 : see if usleep exists
19227 set usleep d_usleep
19228 eval $inlibc
19229
19230 : see if prototype for usleep is available
19231 echo " "
19232 set d_usleepproto usleep $i_unistd unistd.h
19233 eval $hasproto
19234
19235 : see if ustat exists
19236 set ustat d_ustat
19237 eval $inlibc
19238
19239 : see if closedir exists
19240 set closedir d_closedir
19241 eval $inlibc
19242
19243 case "$d_closedir" in
19244 "$define")
19245         echo " "
19246         echo "Checking whether closedir() returns a status..." >&4
19247         cat > try.c <<EOM
19248 #$i_dirent I_DIRENT             /**/
19249 #$i_sysdir I_SYS_DIR            /**/
19250 #$i_sysndir I_SYS_NDIR          /**/
19251 #$i_systypes I_SYS_TYPES        /**/
19252
19253 #if defined(I_SYS_TYPES)
19254 #include <sys/types.h>
19255 #endif
19256 #if defined(I_DIRENT)
19257 #include <dirent.h>
19258 #else
19259 #ifdef I_SYS_NDIR
19260 #include <sys/ndir.h>
19261 #else
19262 #ifdef I_SYS_DIR
19263 #ifdef hp9000s500
19264 #include <ndir.h>       /* may be wrong in the future */
19265 #else
19266 #include <sys/dir.h>
19267 #endif
19268 #endif
19269 #endif
19270 #endif
19271 int main() { return closedir(opendir(".")); }
19272 EOM
19273         set try
19274         if eval $compile_ok; then
19275                 if $run ./try > /dev/null 2>&1 ; then
19276                         echo "Yes, it does."
19277                         val="$undef"
19278                 else
19279                         echo "No, it doesn't."
19280                         val="$define"
19281                 fi
19282         else
19283                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19284                 val="$define"
19285         fi
19286         ;;
19287 *)
19288         val="$undef";
19289         ;;
19290 esac
19291 set d_void_closedir
19292 eval $setvar
19293 $rm_try
19294
19295 : see if there is a wait4
19296 set wait4 d_wait4
19297 eval $inlibc
19298
19299 : see if waitpid exists
19300 set waitpid d_waitpid
19301 eval $inlibc
19302
19303 : look for wcscmp
19304 echo " "
19305 $cat >try.c <<'EOCP'
19306 #include <stdio.h>
19307 #include <wchar.h>
19308 int main ()
19309 {
19310     wchar_t *s = L" ";
19311     return (wcscmp (s, s) ? 1 : 0);
19312     }
19313 EOCP
19314 set try
19315 val="$undef"
19316 if eval $compile; then
19317     `$run ./try`
19318     case "$?" in
19319         0)  echo "A working wcscmp() found." >&4
19320             val="$define" ;;
19321         *)  echo "wcscmp() found, but it doesn't work" >&4
19322             ;;
19323         esac
19324 else
19325     echo "wcscmp() NOT found." >&4
19326     fi
19327 set d_wcscmp
19328 eval $setvar
19329 $rm_try
19330
19331 : see if wcstombs exists
19332 set wcstombs d_wcstombs
19333 eval $inlibc
19334
19335 : look for wcsxfrm
19336 echo " "
19337 $cat >try.c <<'EOCP'
19338 #include <errno.h>
19339 #include <wchar.h>
19340 int main ()
19341 {
19342     wchar_t dst[4], *src = L" ";
19343     errno = 0;
19344     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19345     }
19346 EOCP
19347 set try
19348 val="$undef"
19349 if eval $compile; then
19350     `$run ./try`
19351     case "$?" in
19352         0)  echo "A working wcsxfrm() found." >&4
19353             val="$define" ;;
19354         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19355             ;;
19356         esac
19357 else
19358     echo "wcsxfrm() NOT found." >&4
19359     fi
19360 set d_wcsxfrm
19361 eval $setvar
19362 $rm_try
19363
19364 : see if wctomb exists
19365 set wctomb d_wctomb
19366 eval $inlibc
19367
19368 : see if writev exists
19369 set writev d_writev
19370 eval $inlibc
19371
19372 : check for alignment requirements
19373 echo " "
19374 case "$alignbytes" in
19375     '') echo "Checking alignment constraints..." >&4
19376         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19377             $cat >try.c <<'EOCP'
19378 typedef long double NV;
19379 EOCP
19380         else
19381             $cat >try.c <<'EOCP'
19382 typedef double NV;
19383 EOCP
19384         fi
19385         $cat >>try.c <<'EOCP'
19386 #include <stdio.h>
19387 struct foobar {
19388     char foo;
19389     NV bar;
19390 } try_algn;
19391 int main()
19392 {
19393     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19394     return(0);
19395 }
19396 EOCP
19397         set try
19398         if eval $compile_ok; then
19399             dflt=`$run ./try`
19400         else
19401             dflt='8'
19402             echo "(I can't seem to compile the test program...)"
19403         fi
19404         case "$multiarch" in
19405             *$define*)
19406                 : The usual safe value is 8, but Darwin with -Duselongdouble
19407                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19408                 : Configure to pick a larger value if needed.
19409                 if $test "$dflt" -lt 8; then
19410                     dflt='8'
19411                     echo "Setting alignment to 8 for multiarch support.">&4
19412                 fi
19413                 ;;
19414         esac
19415         ;;
19416     *) dflt="$alignbytes"
19417         ;;
19418 esac
19419 rp="Doubles must be aligned on a how-many-byte boundary?"
19420 . ./myread
19421 alignbytes="$ans"
19422 $rm_try
19423
19424 : set the base revision
19425 baserev=5.0
19426
19427 : length of character in bytes. Is always 1, otherwise it is not C
19428 : This used to be a test using sizeof
19429 charsize=1
19430
19431 : Check for the number of bits in a character
19432 case "$charbits" in
19433 '')     echo "Checking how long a character is (in bits)..." >&4
19434         $cat >try.c <<EOCP
19435 #include <stdio.h>
19436 int main ()
19437 {
19438     int n;
19439     unsigned char c;
19440     for (c = 1, n = 0; c; c <<= 1, n++) ;
19441     printf ("%d\n", n);
19442     return (0);
19443     }
19444 EOCP
19445         set try
19446         if eval $compile_ok; then
19447                 dflt=`$run ./try`
19448         else
19449                 dflt='8'
19450                 echo "(I can't seem to compile the test program.  Guessing...)"
19451         fi
19452         ;;
19453 *)
19454         dflt="$charbits"
19455         ;;
19456 esac
19457 rp="What is the length of a character (in bits)?"
19458 . ./myread
19459 charbits="$ans"
19460 $rm_try
19461 case "$charbits" in
19462 8)      ;;
19463 *)      cat >&4 << EOM
19464 Your system has an unsigned character size of $charbits bits, which
19465 is rather unusual (normally it is 8 bits).  Perl likely will not work
19466 correctly on your system, with subtle bugs in various places.
19467 EOM
19468         rp='Do you really want to continue?'
19469         dflt='n'
19470         . ./myread
19471         case "$ans" in
19472                 [yY])   echo >&4 "Okay, continuing."    ;;
19473                 *)      exit 1                          ;;
19474         esac
19475 esac
19476
19477 : how do we concatenate cpp tokens here?
19478 echo " "
19479 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19480 $cat >cpp_stuff.c <<'EOCP'
19481 #define RCAT(a,b)a/**/b
19482 #define ACAT(a,b)a ## b
19483 RCAT(Rei,ser)
19484 ACAT(Cir,cus)
19485 EOCP
19486 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19487 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19488         echo "Oh!  Smells like ANSI's been here." >&4
19489         echo "We can catify or stringify, separately or together!"
19490         cpp_stuff=42
19491 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19492         echo "Ah, yes!  The good old days!" >&4
19493         echo "However, in the good old days we don't know how to stringify and"
19494         echo "catify at the same time."
19495         cpp_stuff=1
19496 else
19497         $cat >&4 <<EOM
19498 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19499 You're going to have to edit the values of CAT[2-5] in config.h...
19500 EOM
19501         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19502 fi
19503 $rm -f cpp_stuff.*
19504
19505 : see if this is a db.h system
19506 set db.h i_db
19507 eval $inhdr
19508
19509 case "$i_db" in
19510 $define)
19511         : Check db version.
19512         echo " "
19513         echo "Checking Berkeley DB version ..." >&4
19514         $cat >try.c <<EOCP
19515 #$d_const HASCONST
19516 #ifndef HASCONST
19517 #define const
19518 #endif
19519 #include <sys/types.h>
19520 #include <stdio.h>
19521 #$i_stdlib I_STDLIB
19522 #ifdef I_STDLIB
19523 #include <stdlib.h>
19524 #endif
19525 #include <db.h>
19526 int main(int argc, char *argv[])
19527 {
19528 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19529     int Major, Minor, Patch ;
19530     unsigned long Version ;
19531     (void)db_version(&Major, &Minor, &Patch) ;
19532     if (argc == 2) {
19533         printf("%d %d %d %d %d %d\n",
19534                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19535                Major, Minor, Patch);
19536         exit(0);
19537     }
19538     printf("You have Berkeley DB Version 2 or greater.\n");
19539
19540     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19541                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19542     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19543                 Major, Minor, Patch) ;
19544
19545     /* check that db.h & libdb are compatible */
19546     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19547         printf("db.h and libdb are incompatible.\n") ;
19548         exit(3);
19549     }
19550
19551     printf("db.h and libdb are compatible.\n") ;
19552
19553     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19554                 + DB_VERSION_PATCH ;
19555
19556     /* needs to be >= 2.3.4 */
19557     if (Version < 2003004) {
19558     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19559         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19560         exit(2);
19561     }
19562
19563     exit(0);
19564 #else
19565 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19566     if (argc == 2) {
19567         printf("1 0 0\n");
19568         exit(0);
19569     }
19570     printf("You have Berkeley DB Version 1.\n");
19571     exit(0);    /* DB version < 2: the coast is clear. */
19572 #else
19573     exit(1);    /* <db.h> not Berkeley DB? */
19574 #endif
19575 #endif
19576 }
19577 EOCP
19578         set try
19579         if eval $compile_ok && $run ./try; then
19580                 echo 'Looks OK.' >&4
19581                 set `$run ./try 1`
19582                 db_version_major=$1
19583                 db_version_minor=$2
19584                 db_version_patch=$3
19585         else
19586                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19587                 i_db=$undef
19588                 case " $libs " in
19589                 *"-ldb "*)
19590                         : Remove db from list of libraries to use
19591                         echo "Removing unusable -ldb from library list" >&4
19592                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19593                         shift
19594                         libs="$*"
19595                         echo "libs = $libs" >&4
19596                         ;;
19597                 esac
19598         fi
19599         $rm_try
19600         ;;
19601 esac
19602
19603 case "$i_db" in
19604 define)
19605         : Check the return type needed for hash
19606         echo " "
19607         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19608         $cat >try.c <<EOCP
19609 #$d_const HASCONST
19610 #ifndef HASCONST
19611 #define const
19612 #endif
19613 #include <sys/types.h>
19614 #include <db.h>
19615
19616 #ifndef DB_VERSION_MAJOR
19617 u_int32_t hash_cb (const void* ptr, size_t size)
19618 {
19619 }
19620 HASHINFO info;
19621 int main()
19622 {
19623         info.hash = hash_cb;
19624 }
19625 #endif
19626 EOCP
19627         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19628                 if $contains warning try.out >>/dev/null 2>&1 ; then
19629                         db_hashtype='int'
19630                 else
19631                         db_hashtype='u_int32_t'
19632                 fi
19633         else
19634                 : XXX Maybe we should just give up here.
19635                 db_hashtype=u_int32_t
19636                 $cat try.out >&4
19637                 echo "Help:  I can't seem to compile the db test program." >&4
19638                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19639         fi
19640         $rm_try
19641         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19642         ;;
19643 *)      db_hashtype=u_int32_t
19644         ;;
19645 esac
19646 case "$i_db" in
19647 define)
19648         : Check the return type needed for prefix
19649         echo " "
19650         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19651         cat >try.c <<EOCP
19652 #$d_const HASCONST
19653 #ifndef HASCONST
19654 #define const
19655 #endif
19656 #include <sys/types.h>
19657 #include <db.h>
19658
19659 #ifndef DB_VERSION_MAJOR
19660 size_t prefix_cb (const DBT *key1, const DBT *key2)
19661 {
19662 }
19663 BTREEINFO info;
19664 int main()
19665 {
19666         info.prefix = prefix_cb;
19667 }
19668 #endif
19669 EOCP
19670         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19671                 if $contains warning try.out >>/dev/null 2>&1 ; then
19672                         db_prefixtype='int'
19673                 else
19674                         db_prefixtype='size_t'
19675                 fi
19676         else
19677                 db_prefixtype='size_t'
19678                 : XXX Maybe we should just give up here.
19679                 $cat try.out >&4
19680                 echo "Help:  I can't seem to compile the db test program." >&4
19681                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19682         fi
19683         $rm_try
19684         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19685         ;;
19686 *)      db_prefixtype='size_t'
19687         ;;
19688 esac
19689
19690 : How can we generate normalized random numbers ?
19691 echo " "
19692 echo "Using our internal random number implementation..." >&4
19693
19694 case "$ccflags" in
19695 *-Dmy_rand=*|*-Dmy_srand=*)
19696         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19697         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19698         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19699         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19700         ;;
19701 esac
19702
19703 randfunc=Perl_drand48
19704 drand01="Perl_drand48()"
19705 seedfunc="Perl_drand48_init"
19706 randbits=48
19707 randseedtype=U32
19708
19709 : Determine if this is an EBCDIC system
19710 echo " "
19711 echo "Determining whether or not we are on an EBCDIC system..." >&4
19712 $cat >try.c <<'EOM'
19713 int main()
19714 {
19715   if ('M'==0xd4) return 0;
19716   return 1;
19717 }
19718 EOM
19719
19720 val=$undef
19721 set try
19722 if eval $compile_ok; then
19723         if $run ./try; then
19724                 echo "You seem to speak EBCDIC." >&4
19725                 val="$define"
19726         else
19727                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19728         fi
19729 else
19730         echo "I'm unable to compile the test program." >&4
19731         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19732 fi
19733 $rm_try
19734 set ebcdic
19735 eval $setvar
19736
19737 : Check how to flush
19738 echo " "
19739 $cat >&4 <<EOM
19740 Checking how to flush all pending stdio output...
19741 EOM
19742 # I only know how to find the first 32 possibly open files on SunOS.
19743 # See also hints/sunos_4_1.sh and util.c  --AD
19744 case "$osname" in
19745 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19746 esac
19747 $cat >>try.c <<EOCP
19748 #include <stdio.h>
19749 #$i_stdlib I_STDLIB
19750 #ifdef I_STDLIB
19751 #include <stdlib.h>
19752 #endif
19753 #$i_unistd I_UNISTD
19754 #ifdef I_UNISTD
19755 # include <unistd.h>
19756 #endif
19757 #$d_sysconf HAS_SYSCONF
19758 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19759 #ifdef HAS_STDIO_STREAM_ARRAY
19760 # define STDIO_STREAM_ARRAY $stdio_stream_array
19761 #endif
19762 int main() {
19763   FILE* p;
19764   unlink("try.out");
19765   p = fopen("try.out", "w");
19766 #ifdef TRY_FPUTC
19767   fputc('x', p);
19768 #else
19769 # ifdef TRY_FPRINTF
19770   fprintf(p, "x");
19771 # endif
19772 #endif
19773 #ifdef TRY_FFLUSH_NULL
19774   fflush(NULL);
19775 #endif
19776 #ifdef TRY_FFLUSH_ALL
19777   {
19778     long open_max = -1;
19779 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19780     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19781 # else
19782 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19783     open_max = sysconf(_SC_OPEN_MAX);
19784 #  else
19785 #   ifdef FOPEN_MAX
19786     open_max = FOPEN_MAX;
19787 #   else
19788 #    ifdef OPEN_MAX
19789     open_max = OPEN_MAX;
19790 #    else
19791 #     ifdef _NFILE
19792     open_max = _NFILE;
19793 #     endif
19794 #    endif
19795 #   endif
19796 #  endif
19797 # endif
19798 # ifdef HAS_STDIO_STREAM_ARRAY
19799     if (open_max > 0) {
19800       long i;
19801       for (i = 0; i < open_max; i++)
19802             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19803                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19804                 STDIO_STREAM_ARRAY[i]._flag)
19805                 fflush(&STDIO_STREAM_ARRAY[i]);
19806     }
19807   }
19808 # endif
19809 #endif
19810   _exit(42);
19811 }
19812 EOCP
19813 : first we have to find out how _not_ to flush
19814 $to try.c
19815 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19816     output=''
19817     set try -DTRY_FPUTC
19818     if eval $compile; then
19819             $run ./try 2>/dev/null
19820             code="$?"
19821             $from try.out
19822             if $test ! -s try.out -a "X$code" = X42; then
19823                 output=-DTRY_FPUTC
19824             fi
19825     fi
19826     case "$output" in
19827     '')
19828             set try -DTRY_FPRINTF
19829             if eval $compile; then
19830                     $run ./try 2>/dev/null
19831                     code="$?"
19832                     $from try.out
19833                     if $test ! -s try.out -a "X$code" = X42; then
19834                         output=-DTRY_FPRINTF
19835                     fi
19836             fi
19837         ;;
19838     esac
19839 fi
19840 : check for fflush NULL behavior
19841 case "$fflushNULL" in
19842 '')     set try -DTRY_FFLUSH_NULL $output
19843         if eval $compile; then
19844                 $run ./try 2>/dev/null
19845                 code="$?"
19846                 $from try.out
19847                 if $test -s try.out -a "X$code" = X42; then
19848                         fflushNULL="`$cat try.out`"
19849                 else
19850                         if $test "X$code" != X42; then
19851                                 $cat >&4 <<EOM
19852 (If this test failed, don't worry, we'll try another method shortly.)
19853 EOM
19854                         fi
19855                 fi
19856         fi
19857         $rm -f core try.core core.try.*
19858         case "$fflushNULL" in
19859         x)      $cat >&4 <<EOM
19860 Your fflush(NULL) works okay for output streams.
19861 Let's see if it clobbers input pipes...
19862 EOM
19863 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19864 # bug that improperly flushes the input end of pipes.  So we avoid the
19865 # autoflush on fork/system/exec support for now. :-(
19866 $cat >tryp.c <<EOCP
19867 #include <stdio.h>
19868 int
19869 main(int argc, char **argv)
19870 {
19871     char buf[1024];
19872     int i;
19873     char *bp = buf;
19874     while (1) {
19875         while ((i = getc(stdin)) != -1
19876                && (*bp++ = i) != '\n'
19877                && bp < &buf[1024])
19878         /* DO NOTHING */ ;
19879         *bp = '\0';
19880         fprintf(stdout, "%s", buf);
19881         fflush(NULL);
19882         if (i == -1)
19883             return 0;
19884         bp = buf;
19885     }
19886 }
19887 EOCP
19888                 fflushNULL="$define"
19889                 set tryp
19890                 if eval $compile; then
19891                     $rm -f tryp.out
19892                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
19893                     if $test "X$targethost" != X; then
19894                         $to tryp.c
19895                         $to tryp
19896                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19897                     else
19898                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19899                     fi
19900                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19901                        $cat >&4 <<EOM
19902 fflush(NULL) seems to behave okay with input streams.
19903 EOM
19904                         fflushNULL="$define"
19905                     else
19906                         $cat >&4 <<EOM
19907 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19908 EOM
19909                         fflushNULL="$undef"
19910                     fi
19911                 fi
19912                 $rm -f core tryp.c tryp.core core.tryp.*
19913                 ;;
19914         '')     $cat >&4 <<EOM
19915 Your fflush(NULL) isn't working (contrary to ANSI C).
19916 EOM
19917                 fflushNULL="$undef"
19918                 ;;
19919         *)      $cat >&4 <<EOM
19920 Cannot figure out whether your fflush(NULL) works or not.
19921 I'm assuming it doesn't (contrary to ANSI C).
19922 EOM
19923                 fflushNULL="$undef"
19924                 ;;
19925         esac
19926         ;;
19927 $define|true|[yY]*)
19928         fflushNULL="$define"
19929         ;;
19930 *)
19931         fflushNULL="$undef"
19932         ;;
19933 esac
19934 : check explicit looping only if NULL did not work, and if the pipe
19935 : bug does not show up on an explicit flush too
19936 case "$fflushNULL" in
19937 "$undef")
19938         $cat >tryp.c <<EOCP
19939 #include <stdio.h>
19940 int
19941 main(int argc, char **argv)
19942 {
19943     char buf[1024];
19944     int i;
19945     char *bp = buf;
19946     while (1) {
19947         while ((i = getc(stdin)) != -1
19948                && (*bp++ = i) != '\n'
19949                && bp < &buf[1024])
19950         /* DO NOTHING */ ;
19951         *bp = '\0';
19952         fprintf(stdout, "%s", buf);
19953         fflush(stdin);
19954         if (i == -1)
19955             return 0;
19956         bp = buf;
19957     }
19958 }
19959 EOCP
19960         set tryp
19961         if eval $compile; then
19962             $rm -f tryp.out
19963             if $test "X$targethost" != X; then
19964                 $to tryp.c
19965                 $to tryp
19966                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19967             else
19968                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19969             fi
19970             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19971                $cat >&4 <<EOM
19972 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19973 EOM
19974                 : now check for fflushall behaviour
19975                 case "$fflushall" in
19976                 '')     set try -DTRY_FFLUSH_ALL $output
19977                         if eval $compile; then
19978                                 $cat >&4 <<EOM
19979 (Now testing the other method--but note that this also may fail.)
19980 EOM
19981                                 $run ./try 2>/dev/null
19982                                 code=$?
19983                                 $from try.out
19984                                 if $test -s try.out -a "X$code" = X42; then
19985                                         fflushall="`$cat try.out`"
19986                                 fi
19987                         fi
19988                         $rm_try
19989                         case "$fflushall" in
19990                         x)      $cat >&4 <<EOM
19991 Whew. Flushing explicitly all the stdio streams works.
19992 EOM
19993                                 fflushall="$define"
19994                                 ;;
19995                         '')     $cat >&4 <<EOM
19996 Sigh. Flushing explicitly all the stdio streams doesn't work.
19997 EOM
19998                                 fflushall="$undef"
19999                                 ;;
20000                         *)      $cat >&4 <<EOM
20001 Cannot figure out whether flushing stdio streams explicitly works or not.
20002 I'm assuming it doesn't.
20003 EOM
20004                                 fflushall="$undef"
20005                                 ;;
20006                         esac
20007                         ;;
20008                 "$define"|true|[yY]*)
20009                         fflushall="$define"
20010                         ;;
20011                 *)
20012                         fflushall="$undef"
20013                         ;;
20014                 esac
20015             else
20016                 $cat >&4 <<EOM
20017 All is futile.  Even fflush(stdin) clobbers input pipes!
20018 EOM
20019                 fflushall="$undef"
20020             fi
20021         else
20022             fflushall="$undef"
20023         fi
20024         $rm -f core tryp.c tryp.core core.tryp.*
20025         ;;
20026 *)      fflushall="$undef"
20027         ;;
20028 esac
20029
20030 case "$fflushNULL$fflushall" in
20031 undefundef)
20032         $cat <<EOM
20033 OK, I give up.  I cannot figure out how to flush pending stdio output.
20034 We won't be flushing handles at all before fork/exec/popen.
20035 EOM
20036         ;;
20037 esac
20038 $rm_try tryp
20039
20040 : Store the full pathname to the ar program for use in the C program
20041 : Respect a hint or command line value for full_ar.
20042 case "$full_ar" in
20043 '') full_ar=$ar ;;
20044 esac
20045
20046 : Store the full pathname to the sed program for use in the C program
20047 full_sed=$sed
20048
20049 : see what type gids are declared as in the kernel
20050 echo " "
20051 echo "Looking for the type for group ids returned by getgid()."
20052 set gid_t gidtype xxx stdio.h sys/types.h
20053 eval $typedef
20054 case "$gidtype" in
20055 xxx)
20056         xxx=`./findhdr sys/user.h`
20057         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20058         case $1 in
20059         unsigned) dflt="$1 $2" ;;
20060         *) dflt="$1" ;;
20061         esac
20062         ;;
20063 *) dflt="$gidtype";;
20064 esac
20065 case "$gidtype" in
20066 gid_t) echo "gid_t found." ;;
20067 *)      rp="What is the type for group ids returned by getgid()?"
20068         . ./myread
20069         gidtype="$ans"
20070         ;;
20071 esac
20072
20073 : Check the size of GID
20074 echo " "
20075 case "$gidtype" in
20076 *_t) zzz="$gidtype"     ;;
20077 *)   zzz="gid"          ;;
20078 esac
20079 echo "Checking the size of $zzz..." >&4
20080 cat > try.c <<EOCP
20081 #include <sys/types.h>
20082 #include <stdio.h>
20083 #$i_stdlib I_STDLIB
20084 #ifdef I_STDLIB
20085 #include <stdlib.h>
20086 #endif
20087 int main() {
20088     printf("%d\n", (int)sizeof($gidtype));
20089     exit(0);
20090 }
20091 EOCP
20092 set try
20093 if eval $compile_ok; then
20094         yyy=`$run ./try`
20095         case "$yyy" in
20096         '')     gidsize=4
20097                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20098                 ;;
20099         *)      gidsize=$yyy
20100                 echo "Your $zzz is $gidsize bytes long."
20101                 ;;
20102         esac
20103 else
20104         gidsize=4
20105         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20106 fi
20107
20108
20109 : Check if GID is signed
20110 echo " "
20111 case "$gidtype" in
20112 *_t) zzz="$gidtype"     ;;
20113 *)   zzz="gid"          ;;
20114 esac
20115 echo "Checking the sign of $zzz..." >&4
20116 cat > try.c <<EOCP
20117 #include <sys/types.h>
20118 #include <stdio.h>
20119 int main() {
20120         $gidtype foo = -1;
20121         if (foo < 0)
20122                 printf("-1\n");
20123         else
20124                 printf("1\n");
20125 }
20126 EOCP
20127 set try
20128 if eval $compile; then
20129         yyy=`$run ./try`
20130         case "$yyy" in
20131         '')     gidsign=1
20132                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20133                 ;;
20134         *)      gidsign=$yyy
20135                 case "$gidsign" in
20136                  1) echo "Your $zzz is unsigned." ;;
20137                 -1) echo "Your $zzz is signed."   ;;
20138                 esac
20139                 ;;
20140         esac
20141 else
20142         gidsign=1
20143         echo "(I can't compile the test program--guessing unsigned.)" >&4
20144 fi
20145
20146
20147 : Check 64bit sizes
20148 echo " "
20149
20150 if $test X"$quadtype" != X; then
20151
20152 echo "Checking how to print 64-bit integers..." >&4
20153
20154 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20155         $cat >try.c <<'EOCP'
20156 #include <sys/types.h>
20157 #include <stdio.h>
20158 int main() {
20159   int q = 12345678901;
20160   printf("%ld\n", q);
20161 }
20162 EOCP
20163         set try
20164         if eval $compile; then
20165                 yyy=`$run ./try`
20166                 case "$yyy" in
20167                 12345678901)
20168                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20169                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20170                         echo "We will use %d."
20171                         ;;
20172                 esac
20173         fi
20174 fi
20175
20176 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20177         $cat >try.c <<'EOCP'
20178 #include <sys/types.h>
20179 #include <stdio.h>
20180 int main() {
20181   long q = 12345678901;
20182   printf("%ld\n", q);
20183 }
20184 EOCP
20185         set try
20186         if eval $compile; then
20187                 yyy=`$run ./try`
20188                 case "$yyy" in
20189                 12345678901)
20190                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20191                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20192                         echo "We will use %ld."
20193                         ;;
20194                 esac
20195         fi
20196 fi
20197
20198 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20199         $cat >try.c <<'EOCP'
20200 #include <sys/types.h>
20201 #include <inttypes.h>
20202 #include <stdio.h>
20203 int main() {
20204   int64_t q = 12345678901;
20205   printf("%" PRId64 "\n", q);
20206 }
20207 EOCP
20208         set try
20209         if eval $compile; then
20210                 yyy=`$run ./try`
20211                 case "$yyy" in
20212                 12345678901)
20213                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20214                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20215                         echo "We will use the C9X style."
20216                         ;;
20217                 esac
20218         fi
20219 fi
20220
20221 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20222         $cat >try.c <<EOCP
20223 #include <sys/types.h>
20224 #include <stdio.h>
20225 int main() {
20226   $quadtype q = 12345678901;
20227   printf("%Ld\n", q);
20228 }
20229 EOCP
20230         set try
20231         if eval $compile; then
20232                 yyy=`$run ./try`
20233                 case "$yyy" in
20234                 12345678901)
20235                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20236                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20237                         echo "We will use %Ld."
20238                         ;;
20239                 esac
20240         fi
20241 fi
20242
20243 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20244         $cat >try.c <<'EOCP'
20245 #include <sys/types.h>
20246 #include <stdio.h>
20247 int main() {
20248   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20249   printf("%lld\n", q);
20250 }
20251 EOCP
20252         set try
20253         if eval $compile; then
20254                 yyy=`$run ./try`
20255                 case "$yyy" in
20256                 12345678901)
20257                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20258                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20259                         echo "We will use the %lld style."
20260                         ;;
20261                 esac
20262         fi
20263 fi
20264
20265 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20266         $cat >try.c <<EOCP
20267 #include <sys/types.h>
20268 #include <stdio.h>
20269 int main() {
20270   $quadtype q = 12345678901;
20271   printf("%qd\n", q);
20272 }
20273 EOCP
20274         set try
20275         if eval $compile; then
20276                 yyy=`$run ./try`
20277                 case "$yyy" in
20278                 12345678901)
20279                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20280                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20281                         echo "We will use %qd."
20282                         ;;
20283                 esac
20284         fi
20285 fi
20286
20287 if $test X"$sPRId64" = X; then
20288         echo "Cannot figure out how to print 64-bit integers." >&4
20289 fi
20290 $rm_try
20291
20292 fi
20293
20294 case "$sPRId64" in
20295 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20296         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20297         ;;
20298 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20299         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20300         ;;
20301 esac
20302
20303 : Check format strings for internal types
20304 echo " "
20305 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20306
20307 if $test X"$ivsize" = X8; then
20308         ivdformat="$sPRId64"
20309         uvuformat="$sPRIu64"
20310         uvoformat="$sPRIo64"
20311         uvxformat="$sPRIx64"
20312         uvXUformat="$sPRIXU64"
20313 else
20314         if $test X"$ivsize" = X"$longsize"; then
20315                 ivdformat='"ld"'
20316                 uvuformat='"lu"'
20317                 uvoformat='"lo"'
20318                 uvxformat='"lx"'
20319                 uvXUformat='"lX"'
20320         else
20321                 if $test X"$ivsize" = X"$intsize"; then
20322                         ivdformat='"d"'
20323                         uvuformat='"u"'
20324                         uvoformat='"o"'
20325                         uvxformat='"x"'
20326                         uvXUformat='"X"'
20327                 else
20328                         : far out
20329                         if $test X"$ivsize" = X"$shortsize"; then
20330                                 ivdformat='"hd"'
20331                                 uvuformat='"hu"'
20332                                 uvoformat='"ho"'
20333                                 uvxformat='"hx"'
20334                                 uvXUformat='"hX"'
20335                         fi
20336                 fi
20337         fi
20338 fi
20339
20340 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20341         nveformat="$sPRIeldbl"
20342         nvfformat="$sPRIfldbl"
20343         nvgformat="$sPRIgldbl"
20344         nvEUformat="$sPRIEUldbl"
20345         nvFUformat="$sPRIFUldbl"
20346         nvGUformat="$sPRIGUldbl"
20347 else
20348         nveformat='"e"'
20349         nvfformat='"f"'
20350         nvgformat='"g"'
20351         nvEUformat='"E"'
20352         nvFUformat='"F"'
20353         nvGUformat='"G"'
20354 fi
20355
20356 case "$ivdformat" in
20357 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20358     exit 1
20359     ;;
20360 esac
20361
20362 : Check format string for GID
20363
20364 echo " "
20365 $echo "Checking the format string to be used for gids..." >&4
20366
20367 case "$gidsign" in
20368 -1)     if $test X"$gidsize" = X"$ivsize"; then
20369                 gidformat="$ivdformat"
20370         else
20371                 if $test X"$gidsize" = X"$longsize"; then
20372                         gidformat='"ld"'
20373                 else
20374                         if $test X"$gidsize" = X"$intsize"; then
20375                                 gidformat='"d"'
20376                         else
20377                                 if $test X"$gidsize" = X"$shortsize"; then
20378                                         gidformat='"hd"'
20379                                 fi
20380                         fi
20381                 fi
20382         fi
20383         ;;
20384 *)      if $test X"$gidsize" = X"$uvsize"; then
20385                 gidformat="$uvuformat"
20386         else
20387                 if $test X"$gidsize" = X"$longsize"; then
20388                         gidformat='"lu"'
20389                 else
20390                         if $test X"$gidsize" = X"$intsize"; then
20391                                 gidformat='"u"'
20392                         else
20393                                 if $test X"$gidsize" = X"$shortsize"; then
20394                                         gidformat='"hu"'
20395                                 fi
20396                         fi
20397                 fi
20398         fi
20399         ;;
20400 esac
20401
20402 : see if getgroups exists
20403 set getgroups d_getgrps
20404 eval $inlibc
20405
20406 : see if setgroups exists
20407 set setgroups d_setgrps
20408 eval $inlibc
20409
20410 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20411 echo " "
20412 case "$d_getgrps$d_setgrps" in
20413 *define*)
20414         case "$groupstype" in
20415         '') dflt="$gidtype" ;;
20416         *)  dflt="$groupstype" ;;
20417         esac
20418         $cat <<EOM
20419 What type of pointer is the second argument to getgroups() and setgroups()?
20420 Usually this is the same as group ids, $gidtype, but not always.
20421
20422 EOM
20423         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20424         . ./myread
20425         groupstype="$ans"
20426         ;;
20427 *)  groupstype="$gidtype";;
20428 esac
20429
20430 : check whether make sets MAKE
20431 echo " "
20432 echo "Checking if your $make program sets \$(MAKE)..." >&4
20433 case "$make_set_make" in
20434 '')
20435         $sed 's/^X //' > testmake.mak << 'EOF'
20436 Xall:
20437 X       @echo 'maketemp="$(MAKE)"'
20438 EOF
20439         case "`$make -f testmake.mak 2>/dev/null`" in
20440         *maketemp=*) make_set_make='#' ;;
20441         *)      make_set_make="MAKE=$make" ;;
20442         esac
20443         $rm -f testmake.mak
20444         ;;
20445 esac
20446 case "$make_set_make" in
20447 '#') echo "Yup, it does.";;
20448 *) echo "Nope, it doesn't.";;
20449 esac
20450
20451 : see what type is used for mode_t
20452 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20453 set mode_t modetype int stdio.h sys/types.h
20454 eval $typedef_ask
20455
20456 : see if we need va_copy
20457 echo " "
20458 case "$i_stdarg" in
20459 "$define")
20460         $cat >try.c <<EOCP
20461 #include <stdarg.h>
20462 #include <stdio.h>
20463 #$i_stdlib I_STDLIB
20464 #ifdef I_STDLIB
20465 #include <stdlib.h>
20466 #endif
20467 #include <signal.h>
20468
20469 int
20470 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20471 {
20472   return vfprintf(f, fmt, *valp);
20473 }
20474
20475 int
20476 myvfprintf(FILE *f, const  char *fmt, va_list val)
20477 {
20478   return ivfprintf(f, fmt, &val);
20479 }
20480
20481 int
20482 myprintf(char *fmt, ...)
20483 {
20484   va_list val;
20485   va_start(val, fmt);
20486   return myvfprintf(stdout, fmt, val);
20487 }
20488
20489 int
20490 main(int ac, char **av)
20491 {
20492   signal(SIGSEGV, exit);
20493
20494   myprintf("%s%cs all right, then\n", "that", '\'');
20495   exit(0);
20496 }
20497 EOCP
20498         set try
20499         if eval $compile && $run ./try 2>&1 >/dev/null; then
20500                 case "`$run ./try`" in
20501                 "that's all right, then")
20502                         okay=yes
20503                         ;;
20504                 esac
20505         fi
20506         case "$okay" in
20507         yes)    echo "It seems that you don't need va_copy()." >&4
20508                 need_va_copy="$undef"
20509                 ;;
20510         *)      echo "It seems that va_copy() or similar will be needed." >&4
20511                 need_va_copy="$define"
20512                 ;;
20513         esac
20514         $rm_try
20515         ;;
20516 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20517         need_va_copy="$undef"
20518         ;;
20519 esac
20520
20521 : see what type is used for size_t
20522 rp="What is the type used for the length parameter for string functions?"
20523 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20524 eval $typedef_ask
20525
20526 : check for type of arguments to gethostbyaddr. 
20527 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20528         case "$d_gethbyaddr" in
20529         $define)
20530                 $cat <<EOM
20531
20532 Checking to see what type of arguments are accepted by gethostbyaddr().
20533 EOM
20534                 hdrs="$define sys/types.h
20535                         $d_socket sys/socket.h 
20536                         $i_niin netinet/in.h 
20537                         $i_netdb netdb.h
20538                         $i_unistd unistd.h"
20539                 : The first arg can 'char *' or 'void *'
20540                 : The second arg is some of integral type
20541                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20542                         for yyy in size_t long int; do
20543                                 case "$netdb_host_type" in
20544                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20545                                         if ./protochk "$try" $hdrs; then
20546                                                 echo "Your system accepts $xxx for the first arg."
20547                                                 echo "...and $yyy for the second arg."
20548                                                 netdb_host_type="$xxx"
20549                                                 netdb_hlen_type="$yyy"
20550                                         fi
20551                                         ;;
20552                                 esac
20553                         done
20554                 done
20555                 : In case none of those worked, prompt the user.
20556                 case "$netdb_host_type" in
20557                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20558                         dflt='char *'
20559                         . ./myread
20560                         netdb_host_type=$ans
20561                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20562                         dflt="$sizetype"
20563                         . ./myread
20564                         netdb_hlen_type=$ans
20565                         ;;
20566                 esac
20567                 ;;
20568         *)      : no gethostbyaddr, so pick harmless defaults
20569                 netdb_host_type='char *'
20570                 netdb_hlen_type="$sizetype"
20571                 ;;
20572         esac
20573         # Remove the "const" if needed. -- but then we'll have a 
20574         # prototype clash!
20575         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20576 fi
20577
20578 : check for type of argument to gethostbyname. 
20579 if test "X$netdb_name_type" = X ; then
20580         case "$d_gethbyname" in
20581         $define)
20582                 $cat <<EOM
20583
20584 Checking to see what type of argument is accepted by gethostbyname().
20585 EOM
20586                 hdrs="$define sys/types.h
20587                         $d_socket sys/socket.h 
20588                         $i_niin netinet/in.h 
20589                         $i_netdb netdb.h
20590                         $i_unistd unistd.h"
20591                 for xxx in "const char *" "char *"; do
20592                         case "$netdb_name_type" in
20593                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20594                                 if ./protochk "$try" $hdrs; then
20595                                         echo "Your system accepts $xxx."
20596                                         netdb_name_type="$xxx"
20597                                 fi
20598                                 ;;
20599                         esac
20600                 done
20601                 : In case none of those worked, prompt the user.
20602                 case "$netdb_name_type" in
20603                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20604                         dflt='char *'
20605                         . ./myread
20606                         netdb_name_type=$ans
20607                         ;;
20608                 esac
20609                 ;;
20610         *)      : no gethostbyname, so pick harmless default
20611                 netdb_name_type='char *'
20612                 ;;
20613         esac
20614 fi
20615
20616 : check for type of 1st argument to getnetbyaddr. 
20617 if test "X$netdb_net_type" = X ; then
20618         case "$d_getnbyaddr" in
20619         $define)
20620                 $cat <<EOM
20621
20622 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20623 EOM
20624                 hdrs="$define sys/types.h
20625                         $d_socket sys/socket.h 
20626                         $i_niin netinet/in.h 
20627                         $i_netdb netdb.h
20628                         $i_unistd unistd.h"
20629                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20630                         case "$netdb_net_type" in
20631                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20632                                 if ./protochk "$try" $hdrs; then
20633                                         echo "Your system accepts $xxx."
20634                                         netdb_net_type="$xxx"
20635                                 fi
20636                                 ;;
20637                         esac
20638                 done
20639                 : In case none of those worked, prompt the user.
20640                 case "$netdb_net_type" in
20641                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20642                         dflt='long'
20643                         . ./myread
20644                         netdb_net_type=$ans
20645                         ;;
20646                 esac
20647                 ;;
20648         *)      : no getnetbyaddr, so pick harmless default
20649                 netdb_net_type='long'
20650                 ;;
20651         esac
20652 fi
20653 : locate the preferred pager for this system
20654 fn=f/
20655 case "$pager" in
20656 '')
20657         dflt=''
20658         case "$pg" in
20659         /*) dflt=$pg;;
20660         [a-zA-Z]:/*) dflt=$pg;;
20661         esac
20662         case "$more" in
20663         /*) dflt=$more;;
20664         [a-zA-Z]:/*) dflt=$more;;
20665         esac
20666         case "$less" in
20667         /*) dflt=$less;;
20668         [a-zA-Z]:/*) dflt=$less;;
20669         esac
20670         case "$dflt" in
20671         '') dflt=/usr/ucb/more;;
20672         esac
20673         ;;
20674 *)      dflt="$pager"
20675         ;;
20676 esac
20677 fn="f/($dflt)"
20678 echo " "
20679 rp='What pager is used on your system?'
20680 . ./getfile
20681 pager="$ans"
20682
20683 : see what type pids are declared as in the kernel
20684 rp="What is the type of process ids on this system?"
20685 set pid_t pidtype int stdio.h sys/types.h
20686 eval $typedef_ask
20687
20688 : see if ar generates random libraries by itself
20689 echo " "
20690 echo "Checking how to generate random libraries on your machine..." >&4
20691 echo 'int bar1() { return bar2(); }' > bar1.c
20692 echo 'int bar2() { return 2; }' > bar2.c
20693 $cat > foo.c <<EOP
20694 #$i_stdlib I_STDLIB
20695 #ifdef I_STDLIB
20696 #include <stdlib.h>
20697 #endif
20698 int main() { printf("%d\n", bar1()); exit(0); }
20699 EOP
20700 $cc $ccflags -c bar1.c >/dev/null 2>&1
20701 $cc $ccflags -c bar2.c >/dev/null 2>&1
20702 $cc $ccflags -c foo.c >/dev/null 2>&1
20703 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20704 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20705         $run ./foobar >/dev/null 2>&1; then
20706         echo "$ar appears to generate random libraries itself."
20707         orderlib=false
20708         if [ "X$ranlib" = "X" ]; then
20709             ranlib=":"
20710         fi
20711 elif $ar s bar$_a >/dev/null 2>&1 &&
20712         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20713         $run ./foobar >/dev/null 2>&1; then
20714                 echo "a table of contents needs to be added with '$ar s'."
20715                 orderlib=false
20716                 ranlib="$ar s"
20717 elif $ar ts bar$_a >/dev/null 2>&1 &&
20718         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20719         $run ./foobar >/dev/null 2>&1; then
20720                 echo "a table of contents needs to be added with '$ar ts'."
20721                 orderlib=false
20722                 ranlib="$ar ts"
20723 else
20724         case "$ranlib" in
20725         :) ranlib='';;
20726         '')
20727                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20728                 $test -f $ranlib || ranlib=''
20729                 ;;
20730         esac
20731         if $test -n "$ranlib"; then
20732                 echo "your system has '$ranlib'; we'll use that."
20733                 orderlib=false
20734         else
20735                 echo "your system doesn't seem to support random libraries"
20736                 echo "so we'll use lorder and tsort to order the libraries."
20737                 orderlib=true
20738                 ranlib=":"
20739         fi
20740 fi
20741 $rm -f foo* bar*
20742
20743 : see if this is a values.h system
20744 set values.h i_values
20745 eval $inhdr
20746
20747 : Check the max offset that gmtime and localtime accept
20748 echo "Checking max offsets that gmtime () accepts"
20749
20750 case $i_values in
20751     define) yyy="#include <values.h>" ;;
20752     *)      yyy="" ;;
20753     esac
20754
20755 case "$sGMTIME_min/$sGMTIME_max" in
20756     0/0|/)
20757         $cat >try.c <<EOCP
20758 #include <sys/types.h>
20759 #include <stdio.h>
20760 #include <time.h>
20761 $yyy
20762
20763 int i;
20764 struct tm *tmp;
20765 time_t pt;
20766
20767 void gm_check (time_t t, int min_year, int max_year)
20768 {
20769     tmp = gmtime (&t);
20770     if ( tmp == NULL ||
20771         /* Check tm_year overflow */
20772          tmp->tm_year < min_year || tmp->tm_year > max_year)
20773         tmp = NULL;
20774     else
20775         pt = t;
20776     } /* gm_check */
20777
20778 int check_max ()
20779 {
20780     tmp = NULL;
20781     pt  = 0;
20782 #ifdef MAXLONG
20783     gm_check (MAXLONG, 69, 0x7fffffff);
20784 #endif
20785     if (tmp == NULL || tmp->tm_year < 0) {
20786         for (i = 63; i >= 0; i--) {
20787             time_t x = pt | ((time_t)1 << i);
20788             if (x < 0 || x < pt) continue;
20789             gm_check (x, 69, 0x7fffffff);
20790             }
20791         }
20792     printf ("sGMTIME_max=%ld\n", pt);
20793     return (0);
20794     } /* check_max */
20795
20796 int check_min ()
20797 {
20798     tmp = NULL;
20799     pt  = 0;
20800 #ifdef MINLONG
20801     gm_check (MINLONG, -1900, 70);
20802 #endif
20803     if (tmp == NULL) {
20804         for (i = 36; i >= 0; i--) {
20805             time_t x = pt - ((time_t)1 << i);
20806             if (x > 0) continue;
20807             gm_check (x, -1900, 70);
20808             }
20809         }
20810     printf ("sGMTIME_min=%ld\n", pt);
20811     return (0);
20812     } /* check_min */
20813
20814 int main (int argc, char *argv[])
20815 {
20816     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20817     check_max ();
20818     check_min ();
20819     return (0);
20820     } /* main */
20821 EOCP
20822         set try
20823         if eval $compile; then
20824             eval `$run ./try`
20825         else
20826             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20827             fi
20828         $rm_try
20829         ;;
20830     esac
20831
20832 echo "Checking max offsets that localtime () accepts"
20833
20834 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20835     0/0|/)
20836         $cat >try.c <<EOCP
20837 #include <sys/types.h>
20838 #include <stdio.h>
20839 #include <time.h>
20840 $yyy
20841
20842 int i;
20843 struct tm *tmp;
20844 time_t pt;
20845
20846 void local_check (time_t t, int min_year, int max_year)
20847 {
20848     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20849         tmp = NULL;
20850     else
20851         tmp = localtime (&t);
20852     if ( tmp == NULL ||
20853         /* Check tm_year overflow */
20854          tmp->tm_year < min_year || tmp->tm_year > max_year)
20855         tmp = NULL;
20856     else
20857         pt = t;
20858     } /* local_check */
20859
20860 int check_max ()
20861 {
20862     tmp = NULL;
20863     pt  = 0;
20864 #ifdef MAXLONG
20865     local_check (MAXLONG, 69, 0x7fffffff);
20866 #endif
20867     if (tmp == NULL || tmp->tm_year < 0) {
20868         for (i = 63; i >= 0; i--) {
20869             time_t x = pt | ((time_t)1 << i);
20870             if (x < 0 || x < pt) continue;
20871             local_check (x, 69, 0x7fffffff);
20872             }
20873         }
20874     printf ("sLOCALTIME_max=%ld\n", pt);
20875     return (0);
20876    } /* check_max */
20877
20878 int check_min ()
20879 {
20880     tmp = NULL;
20881     pt  = 0;
20882 #ifdef MINLONG
20883     local_check (MINLONG, -1900, 70);
20884 #endif
20885     if (tmp == NULL) {
20886         for (i = 36; i >= 0; i--) {
20887             time_t x = pt - ((time_t)1 << i);
20888             if (x > 0) continue;
20889             local_check (x, -1900, 70);
20890             }
20891         }
20892     printf ("sLOCALTIME_min=%ld\n", pt);
20893     return (0);
20894     } /* check_min */
20895
20896 int main (int argc, char *argv[])
20897 {
20898     check_max ();
20899     check_min ();
20900     return (0);
20901     } /* main */
20902 EOCP
20903         set try
20904         if eval $compile; then
20905             eval `$run ./try`
20906         else
20907             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20908             fi
20909         $rm_try
20910         ;;
20911     esac
20912
20913 : check for type of arguments to select.
20914 case "$selecttype" in
20915 '') case "$d_select" in
20916         $define)
20917                 echo " "
20918                 $cat <<EOM
20919 Checking to see what type of arguments are accepted by select().
20920 EOM
20921                 hdrs="$define sys/types.h
20922                         $i_systime sys/time.h
20923                         $i_sysselct sys/select.h
20924                         $d_socket sys/socket.h"
20925                 : The first arg can be int, unsigned, or size_t
20926                 : The last arg may or may not be 'const'
20927                 val=''
20928                 : void pointer has been seen but using that
20929                 : breaks the selectminbits test
20930                 for xxx in 'fd_set *' 'int *'; do
20931                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20932                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20933                                         case "$val" in
20934                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20935                                                 if ./protochk "$try" $hdrs; then
20936                                                         echo "Your system accepts $xxx."
20937                                                         val="$xxx"
20938                                                 fi
20939                                                 ;;
20940                                         esac
20941                                 done
20942                         done
20943                 done
20944                 case "$val" in
20945                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20946                         case "$d_fd_set" in
20947                                 $define) dflt="fd_set *" ;;
20948                                 *)              dflt="int *" ;;
20949                         esac
20950                         . ./myread
20951                         val=$ans
20952                         ;;
20953                 esac
20954                 selecttype="$val"
20955                 ;;
20956         *)      : no select, so pick a harmless default
20957                 selecttype='int *'
20958                 ;;
20959         esac
20960         ;;
20961 esac
20962
20963 : check for the select 'width'
20964 case "$selectminbits" in
20965 '') safebits=`expr $ptrsize \* 8`
20966     case "$d_select" in
20967         $define)
20968                 $cat <<EOM
20969
20970 Checking to see on how many bits at a time your select() operates...
20971 EOM
20972                 $cat >try.c <<EOCP
20973 #include <sys/types.h>
20974 #$i_time I_TIME
20975 #$i_systime I_SYS_TIME
20976 #$i_systimek I_SYS_TIME_KERNEL
20977 #ifdef I_TIME
20978 #   include <time.h>
20979 #endif
20980 #ifdef I_SYS_TIME
20981 #   ifdef I_SYS_TIME_KERNEL
20982 #       define KERNEL
20983 #   endif
20984 #   include <sys/time.h>
20985 #   ifdef I_SYS_TIME_KERNEL
20986 #       undef KERNEL
20987 #   endif
20988 #endif
20989 #$i_sysselct I_SYS_SELECT
20990 #ifdef I_SYS_SELECT
20991 #include <sys/select.h>
20992 #endif
20993 #$d_socket HAS_SOCKET
20994 #ifdef HAS_SOCKET
20995 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20996 #endif
20997 #include <stdio.h>
20998 #$i_stdlib I_STDLIB
20999 #ifdef I_STDLIB
21000 #include <stdlib.h>
21001 #endif
21002 $selecttype b;
21003 #define S sizeof(*(b))
21004 #define MINBITS 64
21005 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21006 #define NBITS  (NBYTES * 8)
21007 int main() {
21008     char *s = (char *)malloc(NBYTES);
21009     struct timeval t;
21010     int i;
21011     FILE* fp;
21012     int fd;
21013
21014     if (!s)
21015         exit(1);
21016     fclose(stdin);
21017     fp = fopen("try.c", "r");
21018     if (fp == 0)
21019       exit(2);
21020     fd = fileno(fp);
21021     if (fd < 0)
21022       exit(3);
21023     b = ($selecttype)s;
21024     for (i = 0; i < NBITS; i++)
21025         FD_SET(i, b);
21026     t.tv_sec  = 0;
21027     t.tv_usec = 0;
21028     select(fd + 1, b, 0, 0, &t);
21029     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21030     free(s);
21031     printf("%d\n", i + 1);
21032     return 0;
21033 }
21034 EOCP
21035                 set try
21036                 if eval $compile_ok; then
21037                         selectminbits=`$run ./try`
21038                         case "$selectminbits" in
21039                         '')     cat >&4 <<EOM
21040 Cannot figure out on how many bits at a time your select() operates.
21041 I'll play safe and guess it is $safebits bits.
21042 EOM
21043                                 selectminbits=$safebits
21044                                 bits="$safebits bits"
21045                                 ;;
21046                         1)      bits="1 bit" ;;
21047                         *)      bits="$selectminbits bits" ;;
21048                         esac
21049                         echo "Your select() operates on $bits at a time." >&4
21050                 else
21051                         rp='What is the minimum number of bits your select() operates on?'
21052                         case "$byteorder" in
21053                         12345678)       dflt=64 ;;
21054                         1234)           dflt=32 ;;
21055                         *)              dflt=1  ;;
21056                         esac
21057                         . ./myread
21058                         val=$ans
21059                         selectminbits="$val"
21060                 fi
21061                 $rm_try
21062                 ;;
21063         *)      : no select, so pick a harmless default
21064                 selectminbits=$safebits
21065                 ;;
21066         esac
21067         ;;
21068 esac
21069
21070 : Trace out the files included by signal.h, then look for SIGxxx names.
21071 if [ "X$fieldn" = X ]; then
21072         : Just make some guesses.  We check them later.
21073         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21074 else
21075         xxx=`echo '#include <signal.h>' |
21076         $cppstdin $cppminus $cppflags 2>/dev/null |
21077         $grep '^[       ]*#.*include' |
21078         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21079                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21080 fi
21081 xxxfiles=''
21082 for xx in $xxx /dev/null ; do
21083         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21084 done
21085 case "$xxxfiles" in
21086 '')     xxxfiles=`./findhdr signal.h` ;;
21087 esac
21088 xxx=`awk '
21089 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21090         print substr($2, 4, 20)
21091 }
21092 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21093         print substr($3, 4, 20)
21094 }' $xxxfiles`
21095 : Append some common names just in case the awk scan failed.
21096 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21097 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21098 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21099 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21100 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21101
21102 : generate a few handy files for later
21103 $cat > signal.c <<EOCP
21104 #include <sys/types.h>
21105 #include <signal.h>
21106 #$i_stdlib I_STDLIB
21107 #ifdef I_STDLIB
21108 #include <stdlib.h>
21109 #endif
21110 #include <stdio.h>
21111 int main() {
21112
21113 /* Strange style to avoid deeply-nested #if/#else/#endif */
21114 #ifndef NSIG
21115 #  ifdef _NSIG
21116 #    define NSIG (_NSIG)
21117 #  endif
21118 #endif
21119
21120 #ifndef NSIG
21121 #  ifdef SIGMAX
21122 #    define NSIG (SIGMAX+1)
21123 #  endif
21124 #endif
21125
21126 #ifndef NSIG
21127 #  ifdef SIG_MAX
21128 #    define NSIG (SIG_MAX+1)
21129 #  endif
21130 #endif
21131
21132 #ifndef NSIG
21133 #  ifdef _SIG_MAX
21134 #    define NSIG (_SIG_MAX+1)
21135 #  endif
21136 #endif
21137
21138 #ifndef NSIG
21139 #  ifdef MAXSIG
21140 #    define NSIG (MAXSIG+1)
21141 #  endif
21142 #endif
21143
21144 #ifndef NSIG
21145 #  ifdef MAX_SIG
21146 #    define NSIG (MAX_SIG+1)
21147 #  endif
21148 #endif
21149
21150 #ifndef NSIG
21151 #  ifdef SIGARRAYSIZE
21152 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21153 #  endif
21154 #endif
21155
21156 #ifndef NSIG
21157 #  ifdef _sys_nsig
21158 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21159 #  endif
21160 #endif
21161
21162 /* Default to some arbitrary number that's big enough to get most
21163    of the common signals.
21164 */
21165 #ifndef NSIG
21166 #    define NSIG 50
21167 #endif
21168
21169 printf("NSIG %d\n", NSIG);
21170
21171 #ifndef JUST_NSIG
21172
21173 EOCP
21174
21175 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21176 {
21177         printf "#ifdef SIG"; printf $1; printf "\n"
21178         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21179         printf $1; printf ");\n"
21180         printf "#endif\n"
21181 }
21182 END {
21183         printf "#endif /* JUST_NSIG */\n";
21184         printf "exit(0);\n}\n";
21185 }
21186 ' >>signal.c
21187 $cat >signal.awk <<'EOP'
21188 BEGIN { ndups = 0 }
21189 $1 ~ /^NSIG$/ { nsig = $2 }
21190 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21191     if ($2 > maxsig) { maxsig = $2 }
21192     if (sig_name[$2]) {
21193         dup_name[ndups] = $1
21194         dup_num[ndups] = $2
21195         ndups++
21196     }
21197     else {
21198         sig_name[$2] = $1
21199         sig_num[$2] = $2
21200     }
21201 }
21202 END {
21203     if (nsig == 0) {
21204         nsig = maxsig + 1
21205     }
21206     printf("NSIG %d\n", nsig);
21207     for (n = 1; n < nsig; n++) {
21208         if (sig_name[n]) {
21209             printf("%s %d\n", sig_name[n], sig_num[n])
21210         }
21211         else {
21212             printf("NUM%d %d\n", n, n)
21213         }
21214     }
21215     for (n = 0; n < ndups; n++) {
21216         printf("%s %d\n", dup_name[n], dup_num[n])
21217     }
21218 }
21219 EOP
21220 $cat >signal_cmd <<EOS
21221 $startsh
21222 if $test -s signal.lst; then
21223     echo "Using your existing signal.lst file"
21224         exit 0
21225 fi
21226 xxx="$xxx"
21227 EOS
21228 $cat >>signal_cmd <<'EOS'
21229
21230 set signal
21231 if eval $compile_ok; then
21232         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21233                 $uniq | $awk -f signal.awk >signal.lst
21234 else
21235         echo "(I can't seem be able to compile the whole test program)" >&4
21236         echo "(I'll try it in little pieces.)" >&4
21237         set signal -DJUST_NSIG
21238         if eval $compile_ok; then
21239                 $run ./signal$_exe > signal.nsg
21240                 $cat signal.nsg
21241         else
21242                 echo "I can't seem to figure out how many signals you have." >&4
21243                 echo "Guessing 50." >&4
21244                 echo 'NSIG 50' > signal.nsg
21245         fi
21246         : Now look at all the signal names, one at a time.
21247         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21248                 $cat > signal.c <<EOCP
21249 #include <sys/types.h>
21250 #include <signal.h>
21251 #include <stdio.h>
21252 int main() {
21253 printf("$xx %d\n", SIG${xx});
21254 return 0;
21255 }
21256 EOCP
21257                 set signal
21258                 if eval $compile; then
21259                         echo "SIG${xx} found."
21260                         $run ./signal$_exe  >> signal.ls1
21261                 else
21262                         echo "SIG${xx} NOT found."
21263                 fi
21264         done
21265         if $test -s signal.ls1; then
21266                 $cat signal.nsg signal.ls1 |
21267                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21268         fi
21269
21270 fi
21271 if $test -s signal.lst; then
21272         :
21273 else
21274         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21275         echo 'kill -l' >signal
21276         set X `csh -f <signal`
21277         $rm -f signal
21278         shift
21279         case $# in
21280         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21281         esac
21282         echo $@ | $tr ' ' $trnl | \
21283             $awk '{ printf "%s %d\n", $1, ++s; }
21284                   END { printf "NSIG %d\n", ++s }' >signal.lst
21285 fi
21286 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21287 EOS
21288 chmod a+x signal_cmd
21289 $eunicefix signal_cmd
21290
21291 : generate list of signal names
21292 echo " "
21293 case "$sig_name_init" in
21294 '') doinit=yes ;;
21295 *)  case "$sig_num_init" in
21296     ''|*,*) doinit=yes ;;
21297     esac ;;
21298 esac
21299 case "$doinit" in
21300 yes)
21301         echo "Generating a list of signal names and numbers..." >&4
21302         . ./signal_cmd
21303         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21304         sig_name=`$awk 'BEGIN { printf "ZERO " }
21305                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21306         sig_num=`$awk  'BEGIN { printf "0 " }
21307                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21308         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21309                              !/^NSIG/   { printf "\"%s\", ", $1 }
21310                              END        { printf "0\n" }' signal.lst`
21311         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21312                              !/^NSIG/   { printf "%d, ", $2}
21313                              END        { printf "0\n"}' signal.lst`
21314         ;;
21315 esac
21316 echo "The following $sig_count signals are available:"
21317 echo " "
21318 echo $sig_name | $awk \
21319 'BEGIN { linelen = 0 }
21320 {
21321         for (i = 1; i <= NF; i++) {
21322                 name = "SIG" $i " "
21323                 linelen = linelen + length(name)
21324                 if (linelen > 70) {
21325                         printf "\n"
21326                         linelen = length(name)
21327                 }
21328                 printf "%s", name
21329         }
21330         printf "\n"
21331 }'
21332 sig_size=`echo $sig_name | awk '{print NF}'`
21333 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21334
21335 : Check size of size
21336 echo " "
21337 case "$sizetype" in
21338 *_t) zzz="$sizetype"    ;;
21339 *)   zzz="filesize"     ;;
21340 esac
21341 echo "Checking the size of $zzz..." >&4
21342 cat > try.c <<EOCP
21343 #include <sys/types.h>
21344 #include <stdio.h>
21345 #$i_stdlib I_STDLIB
21346 #ifdef I_STDLIB
21347 #include <stdlib.h>
21348 #endif
21349 int main() {
21350     printf("%d\n", (int)sizeof($sizetype));
21351     exit(0);
21352 }
21353 EOCP
21354 set try
21355 if eval $compile_ok; then
21356         yyy=`$run ./try`
21357         case "$yyy" in
21358         '')     sizesize=4
21359                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21360                 ;;
21361         *)      sizesize=$yyy
21362                 echo "Your $zzz size is $sizesize bytes."
21363                 ;;
21364         esac
21365 else
21366         sizesize=4
21367         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21368 fi
21369
21370
21371 : check for socklen_t
21372 echo " "
21373 echo "Checking to see if you have socklen_t..." >&4
21374 $cat >try.c <<EOCP
21375 #include <sys/types.h>
21376 #$d_socket HAS_SOCKET
21377 #ifdef HAS_SOCKET
21378 #include <sys/socket.h>
21379 #endif
21380 int main() { socklen_t x = 16; }
21381 EOCP
21382 set try
21383 if eval $compile; then
21384         val="$define"
21385         echo "You have socklen_t."
21386 else
21387         val="$undef"
21388         echo "You do not have socklen_t."
21389         case "$sizetype" in
21390         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21391         esac
21392 fi
21393 $rm_try
21394 set d_socklen_t
21395 eval $setvar
21396
21397 : see if this is a socks.h system
21398 set socks.h i_socks
21399 eval $inhdr
21400
21401 : check for type of the size argument to socket calls
21402 case "$d_socket" in
21403 "$define")
21404         $cat <<EOM
21405
21406 Checking to see what type is the last argument of accept().
21407 EOM
21408         yyy=''
21409         case "$d_socklen_t" in
21410         "$define") yyy="$yyy socklen_t"
21411         esac
21412         yyy="$yyy $sizetype int long unsigned"
21413         for xxx in $yyy; do
21414                 case "$socksizetype" in
21415                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21416                         case "$usesocks" in
21417                         "$define")
21418                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21419                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21420                                         socksizetype="$xxx"
21421                                 fi
21422                                 ;;
21423                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21424                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21425                                         socksizetype="$xxx"
21426                                 fi
21427                                 ;;
21428                         esac
21429                         ;;
21430                 esac
21431         done
21432 : In case none of those worked, prompt the user.
21433         case "$socksizetype" in
21434         '')     rp='What is the type for socket address structure sizes?'
21435                 dflt='int'
21436                 . ./myread
21437                 socksizetype=$ans
21438                 ;;
21439         esac
21440         ;;
21441 *)      : no sockets, so pick relatively harmless default
21442         socksizetype='int'
21443         ;;
21444 esac
21445
21446 : see what type is used for signed size_t
21447 set ssize_t ssizetype int stdio.h sys/types.h
21448 eval $typedef
21449 dflt="$ssizetype"
21450 $cat > try.c <<EOM
21451 #include <stdio.h>
21452 #$i_stdlib I_STDLIB
21453 #ifdef I_STDLIB
21454 #include <stdlib.h>
21455 #endif
21456 #include <sys/types.h>
21457 #define Size_t $sizetype
21458 #define SSize_t $dflt
21459 int main()
21460 {
21461         if (sizeof(Size_t) == sizeof(SSize_t))
21462                 printf("$dflt\n");
21463         else if (sizeof(Size_t) == sizeof(int))
21464                 printf("int\n");
21465         else
21466                 printf("long\n");
21467         exit(0);
21468 }
21469 EOM
21470 echo " "
21471 set try
21472 if eval $compile_ok && $run ./try > /dev/null; then
21473         ssizetype=`$run ./try`
21474         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21475 else
21476         $cat >&4 <<EOM
21477 Help! I can't compile and run the ssize_t test program: please enlighten me!
21478 (This is probably a misconfiguration in your system or libraries, and
21479 you really ought to fix it.  Still, I'll try anyway.)
21480
21481 I need a type that is the same size as $sizetype, but is guaranteed to
21482 be signed.  Common values are ssize_t, int and long.
21483
21484 EOM
21485         rp="What signed type is the same size as $sizetype?"
21486         . ./myread
21487         ssizetype="$ans"
21488 fi
21489 $rm_try
21490
21491 : Check the size of st_ino
21492 $echo " "
21493 $echo "Checking the size of st_ino..." >&4
21494 $cat > try.c <<EOCP
21495 #include <sys/stat.h>
21496 #include <stdio.h>
21497 #$i_stdlib I_STDLIB
21498 #ifdef I_STDLIB
21499 #include <stdlib.h>
21500 #endif
21501 int main() {
21502     struct stat st;
21503     printf("%d\n", (int)sizeof(st.st_ino));
21504     exit(0);
21505 }
21506 EOCP
21507 set try
21508 if eval $compile_ok; then
21509         val=`$run ./try`
21510         case "$val" in
21511         '')     st_ino_size=4
21512                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21513                 ;;
21514         *)      st_ino_size=$val
21515                 $echo "Your st_ino is $st_ino_size bytes long."
21516                 ;;
21517         esac
21518 else
21519         st_ino_size=4
21520         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21521 fi
21522 $rm_try
21523
21524 : Check if st_ino is signed
21525 $echo " "
21526 $echo "Checking the sign of st_ino..." >&4
21527 $cat > try.c <<EOCP
21528 #include <sys/stat.h>
21529 #include <stdio.h>
21530 int main() {
21531         struct stat foo;
21532         foo.st_ino = -1;
21533         if (foo.st_ino < 0)
21534                 printf("-1\n");
21535         else
21536                 printf("1\n");
21537 }
21538 EOCP
21539 set try
21540 if eval $compile; then
21541         val=`$run ./try`
21542         case "$val" in
21543         '')     st_ino_sign=1
21544                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21545                 ;;
21546         *)      st_ino_sign=$val
21547                 case "$st_ino_sign" in
21548                  1) $echo "Your st_ino is unsigned." ;;
21549                 -1) $echo "Your st_ino is signed."   ;;
21550                 esac
21551                 ;;
21552         esac
21553 else
21554         st_ino_sign=1
21555         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21556 fi
21557 $rm_try
21558
21559 : see what type of char stdio uses.
21560 echo " "
21561 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21562 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21563         echo "Your stdio uses unsigned chars." >&4
21564         stdchar="unsigned char"
21565 else
21566         echo "Your stdio uses signed chars." >&4
21567         stdchar="char"
21568 fi
21569 $rm -f stdioh
21570
21571 : see what type uids are declared as in the kernel
21572 echo " "
21573 echo "Looking for the type for user ids returned by getuid()."
21574 set uid_t uidtype xxx stdio.h sys/types.h
21575 eval $typedef
21576 case "$uidtype" in
21577 xxx)
21578         xxx=`./findhdr sys/user.h`
21579         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21580         case $1 in
21581         unsigned) dflt="$1 $2" ;;
21582         *) dflt="$1" ;;
21583         esac
21584         ;;
21585 *) dflt="$uidtype";;
21586 esac
21587 case "$uidtype" in
21588 uid_t)  echo "uid_t found." ;;
21589 *)      rp="What is the type for user ids returned by getuid()?"
21590         . ./myread
21591         uidtype="$ans"
21592         ;;
21593 esac
21594
21595 : Check size of UID
21596 echo " "
21597 case "$uidtype" in
21598 *_t) zzz="$uidtype"     ;;
21599 *)   zzz="uid"          ;;
21600 esac
21601 echo "Checking the size of $zzz..." >&4
21602 cat > try.c <<EOCP
21603 #include <sys/types.h>
21604 #include <stdio.h>
21605 #$i_stdlib I_STDLIB
21606 #ifdef I_STDLIB
21607 #include <stdlib.h>
21608 #endif
21609 int main() {
21610     printf("%d\n", (int)sizeof($uidtype));
21611     exit(0);
21612 }
21613 EOCP
21614 set try
21615 if eval $compile_ok; then
21616         yyy=`$run ./try`
21617         case "$yyy" in
21618         '')     uidsize=4
21619                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21620                 ;;
21621         *)      uidsize=$yyy
21622                 echo "Your $zzz is $uidsize bytes long."
21623                 ;;
21624         esac
21625 else
21626         uidsize=4
21627         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21628 fi
21629
21630 : Check if UID is signed
21631 echo " "
21632 case "$uidtype" in
21633 *_t) zzz="$uidtype"     ;;
21634 *)   zzz="uid"          ;;
21635 esac
21636 echo "Checking the sign of $zzz..." >&4
21637 cat > try.c <<EOCP
21638 #include <sys/types.h>
21639 #include <stdio.h>
21640 int main() {
21641         $uidtype foo = -1;
21642         if (foo < 0)
21643                 printf("-1\n");
21644         else
21645                 printf("1\n");
21646 }
21647 EOCP
21648 set try
21649 if eval $compile; then
21650         yyy=`$run ./try`
21651         case "$yyy" in
21652         '')     uidsign=1
21653                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21654                 ;;
21655         *)      uidsign=$yyy
21656                 case "$uidsign" in
21657                  1) echo "Your $zzz is unsigned." ;;
21658                 -1) echo "Your $zzz is signed."   ;;
21659                 esac
21660                 ;;
21661         esac
21662 else
21663         uidsign=1
21664         echo "(I can't compile the test program--guessing unsigned.)" >&4
21665 fi
21666
21667
21668 : Check format string for UID
21669 echo " "
21670 $echo "Checking the format string to be used for uids..." >&4
21671
21672 case "$uidsign" in
21673 -1)     if $test X"$uidsize" = X"$ivsize"; then
21674                 uidformat="$ivdformat"
21675         else
21676                 if $test X"$uidsize" = X"$longsize"; then
21677                         uidformat='"ld"'
21678                 else
21679                         if $test X"$uidsize" = X"$intsize"; then
21680                                 uidformat='"d"'
21681                         else
21682                                 if $test X"$uidsize" = X"$shortsize"; then
21683                                         uidformat='"hd"'
21684                                 fi
21685                         fi
21686                 fi
21687         fi
21688         ;;
21689 *)      if $test X"$uidsize" = X"$uvsize"; then
21690                 uidformat="$uvuformat"
21691         else
21692                 if $test X"$uidsize" = X"$longsize"; then
21693                         uidformat='"lu"'
21694                 else
21695                         if $test X"$uidsize" = X"$intsize"; then
21696                                 uidformat='"u"'
21697                         else
21698                                 if $test X"$uidsize" = X"$shortsize"; then
21699                                         uidformat='"hu"'
21700                                 fi
21701                         fi
21702                 fi
21703         fi
21704         ;;
21705 esac
21706
21707 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21708 echo " "
21709 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21710 $cat >try.c <<'EOM'
21711 /* Intentionally a long probe as I'd like to sanity check that the exact
21712    approach is going to work, as thinking it will work, but only having it
21713    part working at runtime is worse than not having it.  */
21714
21715 #include <sys/types.h>
21716 #include <sys/sysctl.h>
21717 #include <sys/param.h>
21718 #include <stdio.h>
21719 #include <string.h>
21720 #include <stdlib.h>
21721 #include <unistd.h>
21722
21723 int
21724 main(int argc, char **argv) {
21725     char *buffer;
21726     char *argv_leaf = strrchr(argv[0], '/');
21727     char *buffer_leaf;
21728     size_t size = 0;
21729     int mib[4];
21730
21731     mib[0] = CTL_KERN;
21732     mib[1] = KERN_PROC;
21733     mib[2] = KERN_PROC_PATHNAME;
21734     mib[3] = -1;
21735
21736     if (!argv_leaf) {
21737         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21738         return 1;
21739     }
21740
21741     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21742         perror("sysctl");
21743         return 2;
21744     }
21745
21746     if (size < strlen(argv_leaf) + 1) {
21747         fprintf(stderr, "size %lu is too short for a path\n",
21748                 (unsigned long) size);
21749         return 3;
21750     }
21751
21752     if (size > MAXPATHLEN * MAXPATHLEN) {
21753         fprintf(stderr, "size %lu is too long for a path\n",
21754                 (unsigned long) size);
21755         return 4;
21756     }
21757
21758     buffer = malloc(size);
21759     if (!buffer) {
21760         perror("malloc");
21761         return 5;
21762     }
21763
21764     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21765         perror("sysctl");
21766         return 6;
21767     }
21768
21769     if (strlen(buffer) + 1 != size) {
21770         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21771                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21772         return 7;
21773     }
21774
21775
21776     if (*buffer != '/') {
21777         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21778         return 8;
21779     }
21780
21781     if (strstr(buffer, "/./")) {
21782         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21783         return 9;
21784     }
21785
21786     if (strstr(buffer, "/../")) {
21787         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21788         return 10;
21789     }
21790
21791     buffer_leaf = strrchr(buffer, '/');
21792     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21793         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21794         return 11;
21795     }
21796
21797     free(buffer);
21798
21799     return 0;
21800 }
21801 EOM
21802
21803 val=$undef
21804 set try
21805 if eval $compile; then
21806         if $run ./try; then
21807                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21808                 val="$define"
21809         else
21810                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21811                 val="$undef"
21812         fi
21813 else
21814         echo "I'm unable to compile the test program." >&4
21815         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21816         val="$undef"
21817 fi
21818 $rm_try
21819 set usekernprocpathname
21820 eval $setvar
21821
21822 : Determine if we can use _NSGetExecutablePath to find executing program
21823 echo " "
21824 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21825 $cat >try.c <<'EOM'
21826 /* Intentionally a long probe as I'd like to sanity check that the exact
21827    approach is going to work, as thinking it will work, but only having it
21828    part working at runtime is worse than not having it.  */
21829 #include <mach-o/dyld.h>
21830 #include <stdio.h>
21831 #include <stdlib.h>
21832 #include <sys/param.h>
21833 #include <string.h>
21834
21835 int
21836 main(int argc, char **argv) {
21837     char buf[1];
21838     uint32_t size = sizeof(buf);
21839     int result;
21840     char *buffer;
21841     char *tidied;
21842     char *argv_leaf = strrchr(argv[0], '/');
21843     char *tidied_leaf;
21844
21845     if (!argv_leaf) {
21846         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21847         return 1;
21848     }
21849
21850     _NSGetExecutablePath(buf, &size);
21851     if (size > MAXPATHLEN * MAXPATHLEN) {
21852         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21853                 (unsigned int) size);
21854         return 2;
21855     }
21856
21857     buffer = malloc(size);
21858     if (!buffer) {
21859         perror("malloc");
21860         return 3;
21861     }
21862
21863     result = _NSGetExecutablePath(buffer, &size);
21864     if (result != 0) {
21865         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21866                 result, (unsigned int) size);
21867         return 4;
21868     }
21869
21870     tidied = realpath(buffer, NULL);
21871     if (!tidied) {
21872         perror("realpath");
21873         return 5;
21874     }
21875
21876     free(buffer);
21877
21878     if (*tidied != '/') {
21879         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21880         return 6;
21881     }
21882
21883     if (strstr(tidied, "/./")) {
21884         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21885         return 7;
21886     }
21887
21888     if (strstr(tidied, "/../")) {
21889         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21890         return 8;
21891     }
21892
21893     tidied_leaf = strrchr(tidied, '/');
21894     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21895         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21896         return 9;
21897     }
21898
21899     free(tidied);
21900
21901     return 0;
21902 }
21903 EOM
21904
21905 val=$undef
21906 set try
21907 if eval $compile; then
21908         if $run ./try; then
21909                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21910                 val="$define"
21911         else
21912                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21913         fi
21914 else
21915         echo "I'm unable to compile the test program." >&4
21916         echo "I'll assume no _NSGetExecutablePath here." >&4
21917 fi
21918 $rm_try
21919 set usensgetexecutablepath
21920 eval $setvar
21921
21922 : Check if site customization support was requested
21923 case "$usesitecustomize" in
21924     $define|true|[Yy]*)
21925         usesitecustomize="$define"
21926         ;;
21927     *)
21928         usesitecustomize="$undef"
21929         ;;
21930     esac
21931
21932 : see if prototypes support variable argument declarations
21933 echo " "
21934 case "$prototype$i_stdarg" in
21935 $define$define)
21936         echo "It appears we'll be able to prototype varargs functions." >&4
21937         val="$define"
21938         ;;
21939 *)
21940         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21941         val="$undef"
21942         ;;
21943 esac
21944 set vaproto
21945 eval $setvar
21946
21947 : determine compiler compiler
21948 case "$yacc" in
21949 '')
21950         dflt=yacc;;
21951 *)
21952         dflt="$yacc";;
21953 esac
21954 echo " "
21955 comp='yacc'
21956 if $test -f "$byacc$_exe"; then
21957         dflt="$byacc"
21958         comp="byacc or $comp"
21959 fi
21960 if $test -f "$bison$_exe"; then
21961         comp="$comp or bison -y"
21962 fi
21963 rp="Which compiler compiler ($comp) shall I use?"
21964 . ./myread
21965 yacc="$ans"
21966 case "$yacc" in
21967 *bis*)
21968         case "$yacc" in
21969         *-y*) ;;
21970         *)
21971                 yacc="$yacc -y"
21972                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21973                 ;;
21974         esac
21975         ;;
21976 esac
21977
21978 : see if this is a assert.h system
21979 set assert.h i_assert
21980 eval $inhdr
21981
21982 : see if this is a bfd.h system
21983 set bfd.h i_bfd
21984 eval $inhdr
21985
21986 : see if this is an execinfo.h system
21987 set execinfo.h i_execinfo
21988 eval $inhdr
21989
21990 : see if this is a fp.h system
21991 set fp.h i_fp
21992 eval $inhdr
21993
21994 : see if this is a fp_class.h system
21995 set fp_class.h i_fp_class
21996 eval $inhdr
21997
21998 : see if gdbm.h is available
21999 set gdbm.h t_gdbm
22000 eval $inhdr
22001 case "$t_gdbm" in
22002 $define)
22003         : see if gdbm_open exists
22004         set gdbm_open d_gdbm_open
22005         eval $inlibc
22006         case "$d_gdbm_open" in
22007         $undef)
22008                 t_gdbm="$undef"
22009                 echo "We won't be including <gdbm.h>"
22010                 ;;
22011         esac
22012         ;;
22013 esac
22014 val="$t_gdbm"
22015 set i_gdbm
22016 eval $setvar
22017
22018 : see if this is a ieeefp.h system
22019 case "$i_ieeefp" in
22020 '' ) set ieeefp.h i_ieeefp
22021      eval $inhdr
22022      ;;
22023 esac
22024
22025 : see if this is a libutil.h system
22026 set libutil.h i_libutil
22027 eval $inhdr
22028
22029 : see if mach cthreads are available
22030 if test "X$usethreads" = "X$define"; then
22031         set mach/cthreads.h i_machcthr
22032         eval $inhdr
22033 else
22034         i_machcthr="$undef"
22035 fi
22036
22037 : see if this is a mntent.h system
22038 set mntent.h i_mntent
22039 eval $inhdr
22040
22041 : see if net/errno.h is available
22042 val=''
22043 set net/errno.h val
22044 eval $inhdr
22045
22046 : Unfortunately, it causes problems on some systems.  Arrgh.
22047 case "$val" in
22048 $define)
22049         cat > try.c <<'EOM'
22050 #include <stdio.h>
22051 #include <errno.h>
22052 #include <net/errno.h>
22053 int func()
22054 {
22055         return ENOTSOCK;
22056 }
22057 EOM
22058         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22059                 echo "We'll be including <net/errno.h>." >&4
22060         else
22061                 echo "We won't be including <net/errno.h>." >&4
22062                 val="$undef"
22063         fi
22064         $rm_try
22065         ;;
22066 esac
22067 set i_neterrno
22068 eval $setvar
22069
22070 : see if netinet/tcp.h is available
22071 set netinet/tcp.h i_netinettcp
22072 eval $inhdr
22073
22074 : see if this is a poll.h system
22075 set poll.h i_poll
22076 eval $inhdr
22077
22078 : see if this is a prot.h system
22079 set prot.h i_prot
22080 eval $inhdr
22081
22082 : Preprocessor symbols
22083 echo " "
22084 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22085 $cat <<'EOSH' > Cppsym.know
22086 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22087 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22088 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22089 arch_pwr ardent ARM ARM32 atarist att386 att3b
22090 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22091 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22092 byteorder byte_order
22093 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22094 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22095 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22096 ELF encore EPI EXTENSIONS
22097 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22098 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22099 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22100 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22101 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22102 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22103 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22104 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22105 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22106 ksr1
22107 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22108 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22109 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22110 luna88k Lynx
22111 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22112 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22113 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22114 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22115 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22116 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22117 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22118 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22119 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22120 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22121 ns32000 ns32016 ns32332 ns32k nsc32000
22122 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22123 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22124 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22125 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22126 QK_USER QNX
22127 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22128 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22129 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22130 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22131 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22132 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22133 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22134 SYSV4 SYSV5 sysV68 sysV88
22135 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22136 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22137 tower32_800 tower32_850 tss
22138 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22139 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22140 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22141 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22142 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22143 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22144 uxpm uxps
22145 vax venix VMESA vms
22146 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22147 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22148 z8000 zarch
22149 EOSH
22150 # Maybe put other stuff here too.
22151 ./tr '-' '_' <<EOSH >>Cppsym.know
22152 $osname
22153 EOSH
22154 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22155 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22156 $cat Cppsym.know > Cppsym.c
22157 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22158 $rm -f Cppsym.a Cppsym.b Cppsym.c
22159 cat <<EOSH > Cppsym
22160 $startsh
22161 if $test \$# -gt 0; then
22162     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22163     if $test -s Cppsym.got; then
22164         $rm -f Cppsym.got
22165         exit 0
22166     fi
22167     $rm -f Cppsym.got
22168     exit 1
22169 else
22170     $tr " " "$trnl" | ./Cppsym.try
22171     exit 0
22172 fi
22173 EOSH
22174 chmod +x Cppsym
22175 $eunicefix Cppsym
22176 cat <<EOSH > Cppsym.try
22177 $startsh
22178 cat <<'EOCP' > try.c
22179 #include <stdio.h>
22180 #if cpp_stuff == 1
22181 #define STRINGIFY(a)    "a"
22182 #endif
22183 #if cpp_stuff == 42
22184 #define StGiFy(a)  #a
22185 #define STRINGIFY(a)    StGiFy(a)
22186 #endif
22187 #if $cpp_stuff != 1 && $cpp_stuff != 42
22188 #   include "Bletch: How does this C preprocessor stringify macros?"
22189 #endif
22190 int main() {
22191 EOCP
22192 $awk \\
22193 EOSH
22194 cat <<'EOSH' >> Cppsym.try
22195 'length($1) > 0 {
22196     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22197     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22198     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22199     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22200 }'       >> try.c
22201 echo 'return 0;}' >> try.c
22202 EOSH
22203 cat <<EOSH >> Cppsym.try
22204 ccflags="$ccflags"
22205 case "$osname-$gccversion" in
22206 irix-) ccflags="\$ccflags -woff 1178" ;;
22207 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22208 esac
22209 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22210 EOSH
22211 chmod +x Cppsym.try
22212 $eunicefix Cppsym.try
22213 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22214 : Add in any Linux cpp "predefined macros":
22215 case "$osname::$gccversion" in
22216   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22217     tHdrH=_tmpHdr
22218     rm -f $tHdrH'.h' $tHdrH
22219     touch $tHdrH'.h'
22220     # Filter out macro arguments, such as Linux's __INT8_C(c)
22221     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22222        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22223        if [ -s $tHdrH'_cppsym.real' ]; then
22224           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22225        fi
22226     fi
22227     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22228   ;;
22229 esac
22230 : now check the C compiler for additional symbols
22231 postprocess_cc_v=''
22232 case "$osname" in
22233 aix) postprocess_cc_v="|$tr , ' '" ;;
22234 esac
22235 $cat >ccsym <<EOS
22236 $startsh
22237 $cat >tmp.c <<EOF
22238 extern int foo;
22239 EOF
22240 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22241 do
22242         case "\$i" in
22243         -D*) echo "\$i" | $sed 's/^-D//';;
22244         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22245         esac
22246 done
22247 $rm_try
22248 EOS
22249 postprocess_cc_v=''
22250 chmod +x ccsym
22251 $eunicefix ccsym
22252 ./ccsym > ccsym1.raw
22253 if $test -s ccsym1.raw; then
22254     $sort ccsym1.raw | $uniq >ccsym.raw
22255 else
22256     mv ccsym1.raw ccsym.raw
22257 fi
22258
22259 $awk '/\=/ { print $0; next }
22260         { print $0"=1" }' ccsym.raw >ccsym.list
22261 $comm -13 Cppsym.true ccsym.list >ccsym.own
22262 $comm -12 Cppsym.true ccsym.list >ccsym.com
22263 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22264 also=''
22265 if $test -z ccsym.raw; then
22266         echo "Your C compiler doesn't seem to define any symbols!" >&4
22267         echo " "
22268         echo "However, your C preprocessor defines the following symbols:"
22269         $cat Cppsym.true
22270         ccsymbols=''
22271         cppsymbols=`$cat Cppsym.true`
22272         cppsymbols=`echo $cppsymbols`
22273         cppccsymbols="$cppsymbols"
22274 else
22275         if $test -s ccsym.com; then
22276                 echo "Your C compiler and pre-processor define these symbols:"
22277                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22278                 also='also '
22279                 symbols='ones'
22280                 cppccsymbols=`$cat ccsym.com`
22281                 cppccsymbols=`echo $cppccsymbols`
22282                 $test "$silent" || sleep 1
22283         fi
22284         if $test -s ccsym.cpp; then
22285                 $test "$also" && echo " "
22286                 echo "Your C pre-processor ${also}defines the following symbols:"
22287                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22288                 also='further '
22289                 cppsymbols=`$cat ccsym.cpp`
22290                 cppsymbols=`echo $cppsymbols`
22291                 $test "$silent" || sleep 1
22292         fi
22293         if $test -s ccsym.own; then
22294                 $test "$also" && echo " "
22295                 echo "Your C compiler ${also}defines the following cpp symbols:"
22296                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22297                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22298                 ccsymbols=`$cat ccsym.own`
22299                 ccsymbols=`echo $ccsymbols`
22300                 $test "$silent" || sleep 1
22301         fi
22302 fi
22303
22304 : add -D_FORTIFY_SOURCE if feasible and not already there
22305 case "$gccversion" in
22306 4.*)    case "$optimize$ccflags" in
22307         *-O*)   case "$ccflags$cppsymbols" in
22308                 *_FORTIFY_SOURCE=*) # Don't add it again.
22309                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22310                         ;;
22311                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22312                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22313                         ;;
22314                 esac
22315                 ;;
22316         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22317                 ;;
22318         esac
22319         ;;
22320 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
22321         ;;
22322 esac
22323
22324 : see if this is a termio system
22325 val="$undef"
22326 val2="$undef"
22327 val3="$undef"
22328 if $test `./findhdr termios.h`; then
22329     set tcsetattr i_termios
22330     eval $inlibc
22331     val3="$i_termios"
22332 fi
22333 echo " "
22334 case "$val3" in
22335     "$define") echo "You have POSIX termios.h... good!" >&4;;
22336     *)  if ./Cppsym pyr; then
22337             case "`$run /bin/universe`" in
22338                 ucb) if $test `./findhdr sgtty.h`; then
22339                         val2="$define"
22340                         echo "<sgtty.h> found." >&4
22341                     else
22342                         echo "System is pyramid with BSD universe."
22343                         ./warn "<sgtty.h> not found--you could have problems."
22344                     fi;;
22345                 *)  if $test `./findhdr termio.h`; then
22346                         val="$define"
22347                         echo "<termio.h> found." >&4
22348                     else
22349                         echo "System is pyramid with USG universe."
22350                         ./warn "<termio.h> not found--you could have problems."
22351                     fi;;
22352             esac
22353         elif ./usg; then
22354             if $test `./findhdr termio.h`; then
22355                 echo "<termio.h> found." >&4
22356                 val="$define"
22357             elif $test `./findhdr sgtty.h`; then
22358                 echo "<sgtty.h> found." >&4
22359                 val2="$define"
22360             else
22361                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22362             fi
22363         else
22364             if $test `./findhdr sgtty.h`; then
22365                 echo "<sgtty.h> found." >&4
22366                 val2="$define"
22367             elif $test `./findhdr termio.h`; then
22368                 echo "<termio.h> found." >&4
22369                 val="$define"
22370             else
22371                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22372             fi
22373         fi;;
22374 esac
22375 set i_termio; eval $setvar
22376 val=$val2; set i_sgtty; eval $setvar
22377 val=$val3; set i_termios; eval $setvar
22378
22379 : see if stdbool is available
22380 : we want a real compile instead of Inhdr because some Solaris systems
22381 : have stdbool.h, but it can only be used if the compiler indicates it
22382 : is sufficiently c99-compliant.
22383 echo " "
22384 $cat >try.c <<EOCP
22385 #include <stdio.h>
22386 #include <stdbool.h>
22387 int func(bool x)
22388 {
22389     return x ? 1 : 0;
22390 }
22391 int main(int argc, char **argv)
22392 {
22393     return func(0);
22394 }
22395 EOCP
22396 set try
22397 if eval $compile; then
22398         echo "<stdbool.h> found." >&4
22399         val="$define"
22400 else
22401         echo "<stdbool.h> NOT found." >&4
22402         val="$undef"
22403 fi
22404 $rm_try
22405 set i_stdbool
22406 eval $setvar
22407
22408 : see if stddef is available
22409 set stddef.h i_stddef
22410 eval $inhdr
22411
22412 : see if sys/access.h is available
22413 set sys/access.h i_sysaccess
22414 eval $inhdr
22415
22416 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22417 set sys/filio.h i_sysfilio
22418 eval $inhdr
22419 echo " "
22420 if $test `./findhdr sys/ioctl.h`; then
22421         val="$define"
22422         echo '<sys/ioctl.h> found.' >&4
22423 else
22424         val="$undef"
22425         if $test $i_sysfilio = "$define"; then
22426             echo '<sys/ioctl.h> NOT found.' >&4
22427         else
22428                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22429                 $test $i_termio = "$define" && xxx="termio.h"
22430                 $test $i_termios = "$define" && xxx="termios.h"
22431 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22432         fi
22433 fi
22434 set i_sysioctl
22435 eval $setvar
22436
22437 : see if socket ioctl defs are in sys/sockio.h
22438 echo " "
22439 xxx=`./findhdr sys/sockio.h`
22440 if $test "$xxx"; then
22441         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22442                 val="$define"
22443                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22444         else
22445                 val="$undef"
22446                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22447         fi
22448 else
22449         val="$undef"
22450         $cat <<EOM
22451 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22452 EOM
22453 fi
22454 set i_syssockio
22455 eval $setvar
22456
22457 : see if this is a syslog.h system
22458 set syslog.h i_syslog
22459 eval $inhdr
22460
22461 : see if this is a sys/mode.h system
22462 set sys/mode.h i_sysmode
22463 eval $inhdr
22464
22465 : see if there is a sys/poll.h file
22466 set sys/poll.h i_syspoll
22467 eval $inhdr
22468
22469 : see if sys/resource.h has to be included
22470 set sys/resource.h i_sysresrc
22471 eval $inhdr
22472
22473 : see if sys/security.h is available
22474 set sys/security.h i_syssecrt
22475 eval $inhdr
22476
22477 : see if this is a sys/statvfs.h system
22478 set sys/statvfs.h i_sysstatvfs
22479 eval $inhdr
22480
22481 : see if this is a sys/un.h system
22482 set sys/un.h i_sysun
22483 eval $inhdr
22484
22485 : see if this is a sys/utsname.h system
22486 set sys/utsname.h i_sysutsname
22487 eval $inhdr
22488
22489 : see if this is a syswait system
22490 set sys/wait.h i_syswait
22491 eval $inhdr
22492
22493 : see if this is a ustat.h system
22494 set ustat.h i_ustat
22495 eval $inhdr
22496
22497 : see if this is an utime system
22498 set utime.h i_utime
22499 eval $inhdr
22500
22501 : see if this is a vfork system
22502 case "$d_vfork" in
22503 "$define")
22504         set vfork.h i_vfork
22505         eval $inhdr
22506         ;;
22507 *)
22508         i_vfork="$undef"
22509         ;;
22510 esac
22511
22512 : Check extensions
22513 echo " "
22514 echo "Looking for extensions..." >&4
22515 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22516 : contain old or inaccurate or duplicate values.
22517 nonxs_extensions=''
22518 xs_extensions=''
22519 : We do not use find because it might not be available.
22520 : We do not just use MANIFEST because the user may have dropped
22521 : some additional extensions into the source tree and expect them
22522 : to be built.
22523
22524 : Function to recursively find available extensions, ignoring DynaLoader
22525 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22526 : In 5.10.1 and later, extensions are stored in directories
22527 : like File-Glob instead of the older File/Glob/.
22528 find_extensions='
22529     for xxx in *; do
22530         case "$xxx" in
22531             DynaLoader|dynaload) ;;
22532             *)
22533             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22534             case "$this_ext" in
22535                 Scalar/List/Utils) this_ext="List/Util" ;;
22536                 PathTools)         this_ext="Cwd"       ;;
22537             esac;
22538             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
22539             if $contains " $this_ext " $tdir/$$.tmp; then
22540                 echo >&4;
22541                 echo "Duplicate directories detected for extension $xxx" >&4;
22542                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22543                 case "$knowitall" in
22544                 "") dflt=y;;
22545                 *) dflt=n;;
22546                 esac;
22547                 . ../UU/myread;
22548                 case "$ans" in
22549                 n*|N*) ;;
22550                 *) echo >&4;
22551                     echo "Ok.  Stopping Configure." >&4;
22552                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22553                     exit 1;;
22554                 esac;
22555                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22556             fi;
22557             $ls -1 $xxx > $tdir/$$.tmp;
22558             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
22559                 xs_extensions="$xs_extensions $this_ext";
22560             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
22561                 xs_extensions="$xs_extensions $this_ext";
22562             elif $test -d $xxx; then
22563                 nonxs_extensions="$nonxs_extensions $this_ext";
22564             fi;
22565             $rm -f $tdir/$$.tmp;
22566             ;;
22567         esac;
22568     done'
22569 tdir=`pwd`
22570 cd "$rsrc/cpan"
22571 set X
22572 shift
22573 eval $find_extensions
22574 cd "$rsrc/dist"
22575 set X
22576 shift
22577 eval $find_extensions
22578 cd "$rsrc/ext"
22579 set X
22580 shift
22581 eval $find_extensions
22582 set X $xs_extensions
22583 shift
22584 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22585 set X $nonxs_extensions
22586 shift
22587 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22588 cd "$tdir"
22589 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22590
22591 : Now see which are supported on this system.
22592 avail_ext=''
22593 for xxx in $xs_extensions ; do
22594         case "$xxx" in
22595         DB_File|db_file)
22596                 case "$i_db" in
22597                 $define) avail_ext="$avail_ext $xxx" ;;
22598                 esac
22599                 ;;
22600         GDBM_File|gdbm_fil)
22601                 case "$i_gdbm" in
22602                 $define) avail_ext="$avail_ext $xxx" ;;
22603                 esac
22604                 ;;
22605         I18N/Langinfo|i18n_lan)
22606                 case "$i_langinfo$d_nl_langinfo" in
22607                 $define$define) avail_ext="$avail_ext $xxx" ;;
22608                 esac
22609                 ;;
22610         IPC/SysV|ipc/sysv)
22611                 : XXX Do we need a useipcsysv variable here
22612                 case "${d_msg}${d_sem}${d_shm}" in
22613                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22614                 esac
22615                 ;;
22616         NDBM_File|ndbm_fil)
22617                 case "$d_ndbm" in
22618                 $define)
22619                     case "$osname-$use64bitint" in
22620                     hpux-define)
22621                         case "$libs" in
22622                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22623                         esac
22624                         ;;
22625                     *) avail_ext="$avail_ext $xxx" ;;
22626                     esac
22627                     ;;
22628                 esac
22629                 ;;
22630         ODBM_File|odbm_fil)
22631                 case "${i_dbm}${i_rpcsvcdbm}" in
22632                 *"${define}"*)
22633                     case "$d_cplusplus" in
22634                     define) ;; # delete as a function name will not work
22635                     *)  case "$osname-$use64bitint" in
22636                         hpux-define)
22637                             case "$libs" in
22638                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22639                             esac
22640                             ;;
22641                         *) avail_ext="$avail_ext $xxx" ;;
22642                         esac
22643                         ;;
22644                     esac
22645                     ;;
22646                 esac
22647                 ;;
22648         Opcode|opcode)
22649                 case "$useopcode" in
22650                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22651                 esac
22652                 ;;
22653         POSIX|posix)
22654                 case "$useposix" in
22655                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22656                 esac
22657                 ;;
22658         Socket|socket)
22659                 case "$d_socket" in
22660                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22661                 esac
22662                 ;;
22663         Sys/Syslog|sys/syslog)
22664                 : XXX syslog requires socket
22665                 case "$d_socket" in
22666                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22667                 esac
22668                 ;;
22669         Thread|thread)
22670                 case "$usethreads" in
22671                 true|$define|y)
22672                         case "$use5005threads" in
22673                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22674                         esac
22675                 esac
22676                 ;;
22677         threads|threads/shared)
22678                 # threads and threads::shared are special cases.
22679                 # To stop people from asking "Perl 5.8.0 was supposed
22680                 # to have this new fancy threads implementation but my
22681                 # perl doesn't have it" and from people trying to
22682                 # (re)install the threads module using CPAN.pm and
22683                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22684                 # the threads.pm and threads/shared.pm will always be
22685                 # there, croaking informatively ("you need to rebuild
22686                 # all of Perl with threads, sorry") when threads haven't
22687                 # been compiled in.
22688                 # --jhi
22689                 avail_ext="$avail_ext $xxx"
22690                 ;;
22691         VMS*)
22692                 ;;
22693         Win32*)
22694                 case "$osname" in
22695                 cygwin) avail_ext="$avail_ext $xxx" ;;
22696                 esac
22697                 ;;
22698         XS/APItest|xs/apitest)
22699                 # This is just for testing.  Skip it unless we have dynamic loading.
22700
22701                 case "$usedl" in
22702                 $define) avail_ext="$avail_ext $xxx" ;;
22703                 esac
22704                 ;;
22705         XS/Typemap|xs/typemap)
22706                 # This is just for testing.  Skip it unless we have dynamic loading.
22707                 case "$usedl" in
22708                 $define) avail_ext="$avail_ext $xxx" ;;
22709                 esac
22710                 ;;
22711         *)      avail_ext="$avail_ext $xxx"
22712                 ;;
22713         esac
22714 done
22715
22716 set X $avail_ext
22717 shift
22718 avail_ext="$*"
22719
22720 case "$onlyextensions" in
22721 '') ;;
22722 *)  keepextensions=''
22723     echo "You have requested that only certain extensions be included..." >&4
22724     for i in $onlyextensions; do
22725         case " $avail_ext " in
22726         *" $i "*)
22727             echo "Keeping extension $i."
22728             keepextensions="$keepextensions $i"
22729             ;;
22730         *) echo "Ignoring extension $i." ;;
22731         esac
22732     done
22733     avail_ext="$keepextensions"
22734     ;;
22735 esac
22736
22737 case "$noextensions" in
22738 '') ;;
22739 *)  keepextensions=''
22740     echo "You have requested that certain extensions be ignored..." >&4
22741     for i in $avail_ext; do
22742         case " $noextensions " in
22743         *" $i "*) echo "Ignoring extension $i." ;;
22744         *) echo "Keeping extension $i.";
22745            keepextensions="$keepextensions $i"
22746            ;;
22747         esac
22748     done
22749     avail_ext="$keepextensions"
22750     ;;
22751 esac
22752
22753 : Now see which nonxs extensions are supported on this system.
22754 : For now assume all are.
22755 nonxs_ext=''
22756 for xxx in $nonxs_extensions ; do
22757         case "$xxx" in
22758         VMS*)
22759                 ;;
22760         *)      nonxs_ext="$nonxs_ext $xxx"
22761                 ;;
22762         esac
22763 done
22764
22765 set X $nonxs_ext
22766 shift
22767 nonxs_ext="$*"
22768
22769 case $usedl in
22770 $define)
22771         $cat <<EOM
22772 A number of extensions are supplied with $package.  You may choose to
22773 compile these extensions for dynamic loading (the default), compile
22774 them into the $package executable (static loading), or not include
22775 them at all.  Answer "none" to include no extensions.
22776 Note that DynaLoader is always built and need not be mentioned here.
22777
22778 EOM
22779         case "$dynamic_ext" in
22780         '')
22781                 : Exclude those listed in static_ext
22782                 dflt=''
22783                 for xxx in $avail_ext; do
22784                         case " $static_ext " in
22785                         *" $xxx "*) ;;
22786                         *) dflt="$dflt $xxx" ;;
22787                         esac
22788                 done
22789                 set X $dflt
22790                 shift
22791                 dflt="$*"
22792                 ;;
22793         *)      dflt="$dynamic_ext"
22794                 # Perhaps we are reusing an old out-of-date config.sh.
22795                 case "$hint" in
22796                 previous)
22797                         if test X"$dynamic_ext" != X"$avail_ext"; then
22798                                 $cat <<EOM
22799 NOTICE:  Your previous config.sh list may be incorrect.
22800 The extensions now available to you are
22801         ${avail_ext}
22802 but the default list from your previous config.sh is
22803         ${dynamic_ext}
22804
22805 EOM
22806                         fi
22807                         ;;
22808                 esac
22809                 ;;
22810         esac
22811         case "$dflt" in
22812         '')     dflt=none;;
22813         esac
22814         rp="What extensions do you wish to load dynamically?"
22815         . ./myread
22816         case "$ans" in
22817         none) dynamic_ext=' ' ;;
22818         *) dynamic_ext="$ans" ;;
22819         esac
22820
22821         case "$static_ext" in
22822         '')
22823                 : Exclude those already listed in dynamic linking
22824                 dflt=''
22825                 for xxx in $avail_ext; do
22826                         case " $dynamic_ext " in
22827                         *" $xxx "*) ;;
22828                         *) dflt="$dflt $xxx" ;;
22829                         esac
22830                 done
22831                 set X $dflt
22832                 shift
22833                 dflt="$*"
22834                 ;;
22835         *)  dflt="$static_ext"
22836                 ;;
22837         esac
22838
22839         case "$dflt" in
22840         '')     dflt=none;;
22841         esac
22842         rp="What extensions do you wish to load statically?"
22843         . ./myread
22844         case "$ans" in
22845         none) static_ext=' ' ;;
22846         *) static_ext="$ans" ;;
22847         esac
22848         ;;
22849 *)
22850         $cat <<EOM
22851 A number of extensions are supplied with $package.  Answer "none"
22852 to include no extensions.
22853 Note that DynaLoader is always built and need not be mentioned here.
22854
22855 EOM
22856         case "$static_ext" in
22857         '') dflt="$avail_ext" ;;
22858         *)      dflt="$static_ext"
22859                 # Perhaps we are reusing an old out-of-date config.sh.
22860                 case "$hint" in
22861                 previous)
22862                         if test X"$static_ext" != X"$avail_ext"; then
22863                                 $cat <<EOM
22864 NOTICE:  Your previous config.sh list may be incorrect.
22865 The extensions now available to you are
22866         ${avail_ext}
22867 but the default list from your previous config.sh is
22868         ${static_ext}
22869
22870 EOM
22871                         fi
22872                         ;;
22873                 esac
22874                 ;;
22875         esac
22876         : Exclude those that are not xs extensions
22877         case "$dflt" in
22878         '')     dflt=none;;
22879         esac
22880         rp="What extensions do you wish to include?"
22881         . ./myread
22882         case "$ans" in
22883         none) static_ext=' ' ;;
22884         *) static_ext="$ans" ;;
22885         esac
22886         ;;
22887 esac
22888 #
22889 # Encode is a special case.  If we are building Encode as a static
22890 # extension, we need to explicitly list its subextensions as well.
22891 # For other nested extensions, this is handled automatically by
22892 # the appropriate Makefile.PL.
22893 case " $static_ext " in
22894         *" Encode "*) # Add the subextensions of Encode
22895         cd "$rsrc/cpan"
22896         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22897                 static_ext="$static_ext Encode/$xxx"
22898                 known_extensions="$known_extensions Encode/$xxx"
22899         done
22900         cd "$tdir"
22901         ;;
22902 esac
22903
22904 set X $dynamic_ext $static_ext $nonxs_ext
22905 shift
22906 extensions="$*"
22907
22908 # Sanity check:  We require an extension suitable for use with
22909 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22910 # should show up as failures in the test suite, but it's helpful to
22911 # catch them now.) The 'extensions' list is normally sorted
22912 # alphabetically, so we need to accept either
22913 #    DB_File ... Fcntl ... IO  ....
22914 # or something like
22915 #    Fcntl ... NDBM_File ... IO  ....
22916 case " $extensions"  in
22917 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22918 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22919 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22920 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22921    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22922    ;;
22923 esac
22924
22925 : Remove libraries needed only for extensions
22926 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22927 : The exception is SunOS 4.x, which needs them.
22928 case "${osname}X${osvers}" in
22929 sunos*X4*)
22930     perllibs="$libs"
22931     ;;
22932 *) case "$usedl" in
22933     $define|true|[yY]*)
22934             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22935             shift
22936             perllibs="$*"
22937             ;;
22938     *)  perllibs="$libs"
22939             ;;
22940     esac
22941     ;;
22942 esac
22943
22944 : Remove build directory name from cppstdin so it can be used from
22945 : either the present location or the final installed location.
22946 echo " "
22947 : Get out of the UU directory to get correct path name.
22948 cd ..
22949 case "$cppstdin" in
22950 `pwd`/cppstdin)
22951         echo "Stripping down cppstdin path name"
22952         cppstdin=cppstdin
22953         ;;
22954 esac
22955 cd UU
22956
22957 : end of configuration questions
22958 echo " "
22959 echo "End of configuration questions."
22960 echo " "
22961
22962 : back to where it started
22963 if test -d ../UU; then
22964         cd ..
22965 fi
22966
22967 : configuration may be unconditionally patched via a 'config.arch' file
22968 if $test -f config.arch; then
22969         echo "I see a config.arch file, loading it." >&4
22970         . ./config.arch
22971 fi
22972
22973 : configuration may be patched via a 'config.over' file
22974 if $test -f config.over; then
22975         echo " "
22976         dflt=y
22977         rp='I see a config.over file.  Do you wish to load it?'
22978         . UU/myread
22979         case "$ans" in
22980         n*) echo "OK, I'll ignore it.";;
22981         *)      . ./config.over
22982                 echo "Configuration override changes have been loaded."
22983                 ;;
22984         esac
22985 fi
22986
22987 : in case they want portability, strip down executable paths
22988 case "$d_portable" in
22989 "$define")
22990         echo " "
22991         echo "Stripping down executable paths..." >&4
22992         for file in $loclist $trylist; do
22993                 eval temp=\$$file
22994                 eval $file=`basename $temp`
22995         done
22996         ;;
22997 esac
22998
22999 : create config.sh file
23000 echo " "
23001 echo "Creating config.sh..." >&4
23002 $spitshell <<EOT >config.sh
23003 $startsh
23004 #
23005 # This file was produced by running the Configure script. It holds all the
23006 # definitions figured out by Configure. Should you modify one of these values,
23007 # do not forget to propagate your changes by running "Configure -der". You may
23008 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23009 #
23010
23011 # Package name      : $package
23012 # Source directory  : $src
23013 # Configuration time: $cf_time
23014 # Configured by     : $cf_by
23015 # Target system     : $myuname
23016
23017 EOT
23018 : Add in command line options if available
23019 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23020
23021 $spitshell <<EOT >>config.sh
23022
23023 Author='$Author'
23024 Date='$Date'
23025 Header='$Header'
23026 Id='$Id'
23027 Locker='$Locker'
23028 Log='$Log'
23029 RCSfile='$RCSfile'
23030 Revision='$Revision'
23031 Source='$Source'
23032 State='$State'
23033 _a='$_a'
23034 _exe='$_exe'
23035 _o='$_o'
23036 afs='$afs'
23037 afsroot='$afsroot'
23038 alignbytes='$alignbytes'
23039 ansi2knr='$ansi2knr'
23040 aphostname='$aphostname'
23041 api_revision='$api_revision'
23042 api_subversion='$api_subversion'
23043 api_version='$api_version'
23044 api_versionstring='$api_versionstring'
23045 ar='$ar'
23046 archlib='$archlib'
23047 archlibexp='$archlibexp'
23048 archname64='$archname64'
23049 archname='$archname'
23050 archobjs='$archobjs'
23051 asctime_r_proto='$asctime_r_proto'
23052 awk='$awk'
23053 baserev='$baserev'
23054 bash='$bash'
23055 bin='$bin'
23056 bin_ELF='$bin_ELF'
23057 binexp='$binexp'
23058 bison='$bison'
23059 byacc='$byacc'
23060 byteorder='$byteorder'
23061 c='$c'
23062 castflags='$castflags'
23063 cat='$cat'
23064 cc='$cc'
23065 cccdlflags='$cccdlflags'
23066 ccdlflags='$ccdlflags'
23067 ccflags='$ccflags'
23068 ccflags_uselargefiles='$ccflags_uselargefiles'
23069 ccname='$ccname'
23070 ccsymbols='$ccsymbols'
23071 ccversion='$ccversion'
23072 cf_by='$cf_by'
23073 cf_email='$cf_email'
23074 cf_time='$cf_time'
23075 charbits='$charbits'
23076 charsize='$charsize'
23077 chgrp='$chgrp'
23078 chmod='$chmod'
23079 chown='$chown'
23080 clocktype='$clocktype'
23081 comm='$comm'
23082 compress='$compress'
23083 contains='$contains'
23084 cp='$cp'
23085 cpio='$cpio'
23086 cpp='$cpp'
23087 cpp_stuff='$cpp_stuff'
23088 cppccsymbols='$cppccsymbols'
23089 cppflags='$cppflags'
23090 cpplast='$cpplast'
23091 cppminus='$cppminus'
23092 cpprun='$cpprun'
23093 cppstdin='$cppstdin'
23094 cppsymbols='$cppsymbols'
23095 crypt_r_proto='$crypt_r_proto'
23096 cryptlib='$cryptlib'
23097 csh='$csh'
23098 ctermid_r_proto='$ctermid_r_proto'
23099 ctime_r_proto='$ctime_r_proto'
23100 d_Gconvert='$d_Gconvert'
23101 d_PRIEUldbl='$d_PRIEUldbl'
23102 d_PRIFUldbl='$d_PRIFUldbl'
23103 d_PRIGUldbl='$d_PRIGUldbl'
23104 d_PRIXU64='$d_PRIXU64'
23105 d_PRId64='$d_PRId64'
23106 d_PRIeldbl='$d_PRIeldbl'
23107 d_PRIfldbl='$d_PRIfldbl'
23108 d_PRIgldbl='$d_PRIgldbl'
23109 d_PRIi64='$d_PRIi64'
23110 d_PRIo64='$d_PRIo64'
23111 d_PRIu64='$d_PRIu64'
23112 d_PRIx64='$d_PRIx64'
23113 d_SCNfldbl='$d_SCNfldbl'
23114 d__fwalk='$d__fwalk'
23115 d_access='$d_access'
23116 d_accessx='$d_accessx'
23117 d_aintl='$d_aintl'
23118 d_alarm='$d_alarm'
23119 d_archlib='$d_archlib'
23120 d_asctime64='$d_asctime64'
23121 d_asctime_r='$d_asctime_r'
23122 d_atolf='$d_atolf'
23123 d_atoll='$d_atoll'
23124 d_attribute_deprecated='$d_attribute_deprecated'
23125 d_attribute_format='$d_attribute_format'
23126 d_attribute_malloc='$d_attribute_malloc'
23127 d_attribute_nonnull='$d_attribute_nonnull'
23128 d_attribute_noreturn='$d_attribute_noreturn'
23129 d_attribute_pure='$d_attribute_pure'
23130 d_attribute_unused='$d_attribute_unused'
23131 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23132 d_backtrace='$d_backtrace'
23133 d_bcmp='$d_bcmp'
23134 d_bcopy='$d_bcopy'
23135 d_bsd='$d_bsd'
23136 d_bsdgetpgrp='$d_bsdgetpgrp'
23137 d_bsdsetpgrp='$d_bsdsetpgrp'
23138 d_builtin_choose_expr='$d_builtin_choose_expr'
23139 d_builtin_expect='$d_builtin_expect'
23140 d_bzero='$d_bzero'
23141 d_c99_variadic_macros='$d_c99_variadic_macros'
23142 d_casti32='$d_casti32'
23143 d_castneg='$d_castneg'
23144 d_charvspr='$d_charvspr'
23145 d_chown='$d_chown'
23146 d_chroot='$d_chroot'
23147 d_chsize='$d_chsize'
23148 d_class='$d_class'
23149 d_clearenv='$d_clearenv'
23150 d_closedir='$d_closedir'
23151 d_cmsghdr_s='$d_cmsghdr_s'
23152 d_const='$d_const'
23153 d_copysignl='$d_copysignl'
23154 d_cplusplus='$d_cplusplus'
23155 d_crypt='$d_crypt'
23156 d_crypt_r='$d_crypt_r'
23157 d_csh='$d_csh'
23158 d_ctermid='$d_ctermid'
23159 d_ctermid_r='$d_ctermid_r'
23160 d_ctime64='$d_ctime64'
23161 d_ctime_r='$d_ctime_r'
23162 d_cuserid='$d_cuserid'
23163 d_dbl_dig='$d_dbl_dig'
23164 d_dbminitproto='$d_dbminitproto'
23165 d_difftime64='$d_difftime64'
23166 d_difftime='$d_difftime'
23167 d_dir_dd_fd='$d_dir_dd_fd'
23168 d_dirfd='$d_dirfd'
23169 d_dirnamlen='$d_dirnamlen'
23170 d_dladdr='$d_dladdr'
23171 d_dlerror='$d_dlerror'
23172 d_dlopen='$d_dlopen'
23173 d_dlsymun='$d_dlsymun'
23174 d_dosuid='$d_dosuid'
23175 d_drand48_r='$d_drand48_r'
23176 d_drand48proto='$d_drand48proto'
23177 d_dup2='$d_dup2'
23178 d_eaccess='$d_eaccess'
23179 d_endgrent='$d_endgrent'
23180 d_endgrent_r='$d_endgrent_r'
23181 d_endhent='$d_endhent'
23182 d_endhostent_r='$d_endhostent_r'
23183 d_endnent='$d_endnent'
23184 d_endnetent_r='$d_endnetent_r'
23185 d_endpent='$d_endpent'
23186 d_endprotoent_r='$d_endprotoent_r'
23187 d_endpwent='$d_endpwent'
23188 d_endpwent_r='$d_endpwent_r'
23189 d_endsent='$d_endsent'
23190 d_endservent_r='$d_endservent_r'
23191 d_eofnblk='$d_eofnblk'
23192 d_eunice='$d_eunice'
23193 d_faststdio='$d_faststdio'
23194 d_fchdir='$d_fchdir'
23195 d_fchmod='$d_fchmod'
23196 d_fchown='$d_fchown'
23197 d_fcntl='$d_fcntl'
23198 d_fcntl_can_lock='$d_fcntl_can_lock'
23199 d_fd_macros='$d_fd_macros'
23200 d_fd_set='$d_fd_set'
23201 d_fds_bits='$d_fds_bits'
23202 d_fgetpos='$d_fgetpos'
23203 d_finite='$d_finite'
23204 d_finitel='$d_finitel'
23205 d_flexfnam='$d_flexfnam'
23206 d_flock='$d_flock'
23207 d_flockproto='$d_flockproto'
23208 d_fork='$d_fork'
23209 d_fp_class='$d_fp_class'
23210 d_fpathconf='$d_fpathconf'
23211 d_fpclass='$d_fpclass'
23212 d_fpclassify='$d_fpclassify'
23213 d_fpclassl='$d_fpclassl'
23214 d_fpos64_t='$d_fpos64_t'
23215 d_frexpl='$d_frexpl'
23216 d_fs_data_s='$d_fs_data_s'
23217 d_fseeko='$d_fseeko'
23218 d_fsetpos='$d_fsetpos'
23219 d_fstatfs='$d_fstatfs'
23220 d_fstatvfs='$d_fstatvfs'
23221 d_fsync='$d_fsync'
23222 d_ftello='$d_ftello'
23223 d_ftime='$d_ftime'
23224 d_futimes='$d_futimes'
23225 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23226 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23227 d_getaddrinfo='$d_getaddrinfo'
23228 d_getcwd='$d_getcwd'
23229 d_getespwnam='$d_getespwnam'
23230 d_getfsstat='$d_getfsstat'
23231 d_getgrent='$d_getgrent'
23232 d_getgrent_r='$d_getgrent_r'
23233 d_getgrgid_r='$d_getgrgid_r'
23234 d_getgrnam_r='$d_getgrnam_r'
23235 d_getgrps='$d_getgrps'
23236 d_gethbyaddr='$d_gethbyaddr'
23237 d_gethbyname='$d_gethbyname'
23238 d_gethent='$d_gethent'
23239 d_gethname='$d_gethname'
23240 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23241 d_gethostbyname_r='$d_gethostbyname_r'
23242 d_gethostent_r='$d_gethostent_r'
23243 d_gethostprotos='$d_gethostprotos'
23244 d_getitimer='$d_getitimer'
23245 d_getlogin='$d_getlogin'
23246 d_getlogin_r='$d_getlogin_r'
23247 d_getmnt='$d_getmnt'
23248 d_getmntent='$d_getmntent'
23249 d_getnameinfo='$d_getnameinfo'
23250 d_getnbyaddr='$d_getnbyaddr'
23251 d_getnbyname='$d_getnbyname'
23252 d_getnent='$d_getnent'
23253 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23254 d_getnetbyname_r='$d_getnetbyname_r'
23255 d_getnetent_r='$d_getnetent_r'
23256 d_getnetprotos='$d_getnetprotos'
23257 d_getpagsz='$d_getpagsz'
23258 d_getpbyname='$d_getpbyname'
23259 d_getpbynumber='$d_getpbynumber'
23260 d_getpent='$d_getpent'
23261 d_getpgid='$d_getpgid'
23262 d_getpgrp2='$d_getpgrp2'
23263 d_getpgrp='$d_getpgrp'
23264 d_getppid='$d_getppid'
23265 d_getprior='$d_getprior'
23266 d_getprotobyname_r='$d_getprotobyname_r'
23267 d_getprotobynumber_r='$d_getprotobynumber_r'
23268 d_getprotoent_r='$d_getprotoent_r'
23269 d_getprotoprotos='$d_getprotoprotos'
23270 d_getprpwnam='$d_getprpwnam'
23271 d_getpwent='$d_getpwent'
23272 d_getpwent_r='$d_getpwent_r'
23273 d_getpwnam_r='$d_getpwnam_r'
23274 d_getpwuid_r='$d_getpwuid_r'
23275 d_getsbyname='$d_getsbyname'
23276 d_getsbyport='$d_getsbyport'
23277 d_getsent='$d_getsent'
23278 d_getservbyname_r='$d_getservbyname_r'
23279 d_getservbyport_r='$d_getservbyport_r'
23280 d_getservent_r='$d_getservent_r'
23281 d_getservprotos='$d_getservprotos'
23282 d_getspnam='$d_getspnam'
23283 d_getspnam_r='$d_getspnam_r'
23284 d_gettimeod='$d_gettimeod'
23285 d_gmtime64='$d_gmtime64'
23286 d_gmtime_r='$d_gmtime_r'
23287 d_gnulibc='$d_gnulibc'
23288 d_grpasswd='$d_grpasswd'
23289 d_hasmntopt='$d_hasmntopt'
23290 d_htonl='$d_htonl'
23291 d_ilogbl='$d_ilogbl'
23292 d_inc_version_list='$d_inc_version_list'
23293 d_index='$d_index'
23294 d_inetaton='$d_inetaton'
23295 d_inetntop='$d_inetntop'
23296 d_inetpton='$d_inetpton'
23297 d_int64_t='$d_int64_t'
23298 d_ip_mreq='$d_ip_mreq'
23299 d_ip_mreq_source='$d_ip_mreq_source'
23300 d_ipv6_mreq='$d_ipv6_mreq'
23301 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23302 d_isascii='$d_isascii'
23303 d_isblank='$d_isblank'
23304 d_isfinite='$d_isfinite'
23305 d_isinf='$d_isinf'
23306 d_isnan='$d_isnan'
23307 d_isnanl='$d_isnanl'
23308 d_killpg='$d_killpg'
23309 d_lchown='$d_lchown'
23310 d_ldbl_dig='$d_ldbl_dig'
23311 d_libm_lib_version='$d_libm_lib_version'
23312 d_libname_unique='$d_libname_unique'
23313 d_link='$d_link'
23314 d_localtime64='$d_localtime64'
23315 d_localtime_r='$d_localtime_r'
23316 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23317 d_locconv='$d_locconv'
23318 d_lockf='$d_lockf'
23319 d_longdbl='$d_longdbl'
23320 d_longlong='$d_longlong'
23321 d_lseekproto='$d_lseekproto'
23322 d_lstat='$d_lstat'
23323 d_madvise='$d_madvise'
23324 d_malloc_good_size='$d_malloc_good_size'
23325 d_malloc_size='$d_malloc_size'
23326 d_mblen='$d_mblen'
23327 d_mbstowcs='$d_mbstowcs'
23328 d_mbtowc='$d_mbtowc'
23329 d_memchr='$d_memchr'
23330 d_memcmp='$d_memcmp'
23331 d_memcpy='$d_memcpy'
23332 d_memmove='$d_memmove'
23333 d_memset='$d_memset'
23334 d_mkdir='$d_mkdir'
23335 d_mkdtemp='$d_mkdtemp'
23336 d_mkfifo='$d_mkfifo'
23337 d_mkstemp='$d_mkstemp'
23338 d_mkstemps='$d_mkstemps'
23339 d_mktime64='$d_mktime64'
23340 d_mktime='$d_mktime'
23341 d_mmap='$d_mmap'
23342 d_modfl='$d_modfl'
23343 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23344 d_modflproto='$d_modflproto'
23345 d_mprotect='$d_mprotect'
23346 d_msg='$d_msg'
23347 d_msg_ctrunc='$d_msg_ctrunc'
23348 d_msg_dontroute='$d_msg_dontroute'
23349 d_msg_oob='$d_msg_oob'
23350 d_msg_peek='$d_msg_peek'
23351 d_msg_proxy='$d_msg_proxy'
23352 d_msgctl='$d_msgctl'
23353 d_msgget='$d_msgget'
23354 d_msghdr_s='$d_msghdr_s'
23355 d_msgrcv='$d_msgrcv'
23356 d_msgsnd='$d_msgsnd'
23357 d_msync='$d_msync'
23358 d_munmap='$d_munmap'
23359 d_mymalloc='$d_mymalloc'
23360 d_ndbm='$d_ndbm'
23361 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23362 d_nice='$d_nice'
23363 d_nl_langinfo='$d_nl_langinfo'
23364 d_nv_preserves_uv='$d_nv_preserves_uv'
23365 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23366 d_off64_t='$d_off64_t'
23367 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23368 d_oldpthreads='$d_oldpthreads'
23369 d_oldsock='$d_oldsock'
23370 d_open3='$d_open3'
23371 d_pathconf='$d_pathconf'
23372 d_pause='$d_pause'
23373 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23374 d_phostname='$d_phostname'
23375 d_pipe='$d_pipe'
23376 d_poll='$d_poll'
23377 d_portable='$d_portable'
23378 d_prctl='$d_prctl'
23379 d_prctl_set_name='$d_prctl_set_name'
23380 d_printf_format_null='$d_printf_format_null'
23381 d_procselfexe='$d_procselfexe'
23382 d_pseudofork='$d_pseudofork'
23383 d_pthread_atfork='$d_pthread_atfork'
23384 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23385 d_pthread_yield='$d_pthread_yield'
23386 d_ptrdiff_t='$d_ptrdiff_t'
23387 d_pwage='$d_pwage'
23388 d_pwchange='$d_pwchange'
23389 d_pwclass='$d_pwclass'
23390 d_pwcomment='$d_pwcomment'
23391 d_pwexpire='$d_pwexpire'
23392 d_pwgecos='$d_pwgecos'
23393 d_pwpasswd='$d_pwpasswd'
23394 d_pwquota='$d_pwquota'
23395 d_qgcvt='$d_qgcvt'
23396 d_quad='$d_quad'
23397 d_random_r='$d_random_r'
23398 d_readdir64_r='$d_readdir64_r'
23399 d_readdir='$d_readdir'
23400 d_readdir_r='$d_readdir_r'
23401 d_readlink='$d_readlink'
23402 d_readv='$d_readv'
23403 d_recvmsg='$d_recvmsg'
23404 d_rename='$d_rename'
23405 d_rewinddir='$d_rewinddir'
23406 d_rmdir='$d_rmdir'
23407 d_safebcpy='$d_safebcpy'
23408 d_safemcpy='$d_safemcpy'
23409 d_sanemcmp='$d_sanemcmp'
23410 d_sbrkproto='$d_sbrkproto'
23411 d_scalbnl='$d_scalbnl'
23412 d_sched_yield='$d_sched_yield'
23413 d_scm_rights='$d_scm_rights'
23414 d_seekdir='$d_seekdir'
23415 d_select='$d_select'
23416 d_sem='$d_sem'
23417 d_semctl='$d_semctl'
23418 d_semctl_semid_ds='$d_semctl_semid_ds'
23419 d_semctl_semun='$d_semctl_semun'
23420 d_semget='$d_semget'
23421 d_semop='$d_semop'
23422 d_sendmsg='$d_sendmsg'
23423 d_setegid='$d_setegid'
23424 d_seteuid='$d_seteuid'
23425 d_setgrent='$d_setgrent'
23426 d_setgrent_r='$d_setgrent_r'
23427 d_setgrps='$d_setgrps'
23428 d_sethent='$d_sethent'
23429 d_sethostent_r='$d_sethostent_r'
23430 d_setitimer='$d_setitimer'
23431 d_setlinebuf='$d_setlinebuf'
23432 d_setlocale='$d_setlocale'
23433 d_setlocale_r='$d_setlocale_r'
23434 d_setnent='$d_setnent'
23435 d_setnetent_r='$d_setnetent_r'
23436 d_setpent='$d_setpent'
23437 d_setpgid='$d_setpgid'
23438 d_setpgrp2='$d_setpgrp2'
23439 d_setpgrp='$d_setpgrp'
23440 d_setprior='$d_setprior'
23441 d_setproctitle='$d_setproctitle'
23442 d_setprotoent_r='$d_setprotoent_r'
23443 d_setpwent='$d_setpwent'
23444 d_setpwent_r='$d_setpwent_r'
23445 d_setregid='$d_setregid'
23446 d_setresgid='$d_setresgid'
23447 d_setresuid='$d_setresuid'
23448 d_setreuid='$d_setreuid'
23449 d_setrgid='$d_setrgid'
23450 d_setruid='$d_setruid'
23451 d_setsent='$d_setsent'
23452 d_setservent_r='$d_setservent_r'
23453 d_setsid='$d_setsid'
23454 d_setvbuf='$d_setvbuf'
23455 d_shm='$d_shm'
23456 d_shmat='$d_shmat'
23457 d_shmatprototype='$d_shmatprototype'
23458 d_shmctl='$d_shmctl'
23459 d_shmdt='$d_shmdt'
23460 d_shmget='$d_shmget'
23461 d_sigaction='$d_sigaction'
23462 d_signbit='$d_signbit'
23463 d_sigprocmask='$d_sigprocmask'
23464 d_sigsetjmp='$d_sigsetjmp'
23465 d_sin6_scope_id='$d_sin6_scope_id'
23466 d_sitearch='$d_sitearch'
23467 d_snprintf='$d_snprintf'
23468 d_sockaddr_in6='$d_sockaddr_in6'
23469 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23470 d_sockatmark='$d_sockatmark'
23471 d_sockatmarkproto='$d_sockatmarkproto'
23472 d_socket='$d_socket'
23473 d_socklen_t='$d_socklen_t'
23474 d_sockpair='$d_sockpair'
23475 d_socks5_init='$d_socks5_init'
23476 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23477 d_sqrtl='$d_sqrtl'
23478 d_srand48_r='$d_srand48_r'
23479 d_srandom_r='$d_srandom_r'
23480 d_sresgproto='$d_sresgproto'
23481 d_sresuproto='$d_sresuproto'
23482 d_statblks='$d_statblks'
23483 d_statfs_f_flags='$d_statfs_f_flags'
23484 d_statfs_s='$d_statfs_s'
23485 d_static_inline='$d_static_inline'
23486 d_statvfs='$d_statvfs'
23487 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23488 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23489 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23490 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23491 d_stdio_stream_array='$d_stdio_stream_array'
23492 d_stdiobase='$d_stdiobase'
23493 d_stdstdio='$d_stdstdio'
23494 d_strchr='$d_strchr'
23495 d_strcoll='$d_strcoll'
23496 d_strctcpy='$d_strctcpy'
23497 d_strerrm='$d_strerrm'
23498 d_strerror='$d_strerror'
23499 d_strerror_r='$d_strerror_r'
23500 d_strftime='$d_strftime'
23501 d_strlcat='$d_strlcat'
23502 d_strlcpy='$d_strlcpy'
23503 d_strtod='$d_strtod'
23504 d_strtol='$d_strtol'
23505 d_strtold='$d_strtold'
23506 d_strtoll='$d_strtoll'
23507 d_strtoq='$d_strtoq'
23508 d_strtoul='$d_strtoul'
23509 d_strtoull='$d_strtoull'
23510 d_strtouq='$d_strtouq'
23511 d_strxfrm='$d_strxfrm'
23512 d_suidsafe='$d_suidsafe'
23513 d_symlink='$d_symlink'
23514 d_syscall='$d_syscall'
23515 d_syscallproto='$d_syscallproto'
23516 d_sysconf='$d_sysconf'
23517 d_sysernlst='$d_sysernlst'
23518 d_syserrlst='$d_syserrlst'
23519 d_system='$d_system'
23520 d_tcgetpgrp='$d_tcgetpgrp'
23521 d_tcsetpgrp='$d_tcsetpgrp'
23522 d_telldir='$d_telldir'
23523 d_telldirproto='$d_telldirproto'
23524 d_time='$d_time'
23525 d_timegm='$d_timegm'
23526 d_times='$d_times'
23527 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23528 d_tm_tm_zone='$d_tm_tm_zone'
23529 d_tmpnam_r='$d_tmpnam_r'
23530 d_truncate='$d_truncate'
23531 d_ttyname_r='$d_ttyname_r'
23532 d_tzname='$d_tzname'
23533 d_u32align='$d_u32align'
23534 d_ualarm='$d_ualarm'
23535 d_umask='$d_umask'
23536 d_uname='$d_uname'
23537 d_union_semun='$d_union_semun'
23538 d_unordered='$d_unordered'
23539 d_unsetenv='$d_unsetenv'
23540 d_usleep='$d_usleep'
23541 d_usleepproto='$d_usleepproto'
23542 d_ustat='$d_ustat'
23543 d_vendorarch='$d_vendorarch'
23544 d_vendorbin='$d_vendorbin'
23545 d_vendorlib='$d_vendorlib'
23546 d_vendorscript='$d_vendorscript'
23547 d_vfork='$d_vfork'
23548 d_void_closedir='$d_void_closedir'
23549 d_voidsig='$d_voidsig'
23550 d_voidtty='$d_voidtty'
23551 d_volatile='$d_volatile'
23552 d_vprintf='$d_vprintf'
23553 d_vsnprintf='$d_vsnprintf'
23554 d_wait4='$d_wait4'
23555 d_waitpid='$d_waitpid'
23556 d_wcscmp='$d_wcscmp'
23557 d_wcstombs='$d_wcstombs'
23558 d_wcsxfrm='$d_wcsxfrm'
23559 d_wctomb='$d_wctomb'
23560 d_writev='$d_writev'
23561 d_xenix='$d_xenix'
23562 date='$date'
23563 db_hashtype='$db_hashtype'
23564 db_prefixtype='$db_prefixtype'
23565 db_version_major='$db_version_major'
23566 db_version_minor='$db_version_minor'
23567 db_version_patch='$db_version_patch'
23568 direntrytype='$direntrytype'
23569 dlext='$dlext'
23570 dlsrc='$dlsrc'
23571 doublesize='$doublesize'
23572 drand01='$drand01'
23573 drand48_r_proto='$drand48_r_proto'
23574 dtrace='$dtrace'
23575 dynamic_ext='$dynamic_ext'
23576 eagain='$eagain'
23577 ebcdic='$ebcdic'
23578 echo='$echo'
23579 egrep='$egrep'
23580 emacs='$emacs'
23581 endgrent_r_proto='$endgrent_r_proto'
23582 endhostent_r_proto='$endhostent_r_proto'
23583 endnetent_r_proto='$endnetent_r_proto'
23584 endprotoent_r_proto='$endprotoent_r_proto'
23585 endpwent_r_proto='$endpwent_r_proto'
23586 endservent_r_proto='$endservent_r_proto'
23587 eunicefix='$eunicefix'
23588 exe_ext='$exe_ext'
23589 expr='$expr'
23590 extensions='$extensions'
23591 extern_C='$extern_C'
23592 extras='$extras'
23593 fflushNULL='$fflushNULL'
23594 fflushall='$fflushall'
23595 find='$find'
23596 firstmakefile='$firstmakefile'
23597 flex='$flex'
23598 fpossize='$fpossize'
23599 fpostype='$fpostype'
23600 freetype='$freetype'
23601 from='$from'
23602 full_ar='$full_ar'
23603 full_csh='$full_csh'
23604 full_sed='$full_sed'
23605 gccansipedantic='$gccansipedantic'
23606 gccosandvers='$gccosandvers'
23607 gccversion='$gccversion'
23608 getgrent_r_proto='$getgrent_r_proto'
23609 getgrgid_r_proto='$getgrgid_r_proto'
23610 getgrnam_r_proto='$getgrnam_r_proto'
23611 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23612 gethostbyname_r_proto='$gethostbyname_r_proto'
23613 gethostent_r_proto='$gethostent_r_proto'
23614 getlogin_r_proto='$getlogin_r_proto'
23615 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23616 getnetbyname_r_proto='$getnetbyname_r_proto'
23617 getnetent_r_proto='$getnetent_r_proto'
23618 getprotobyname_r_proto='$getprotobyname_r_proto'
23619 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23620 getprotoent_r_proto='$getprotoent_r_proto'
23621 getpwent_r_proto='$getpwent_r_proto'
23622 getpwnam_r_proto='$getpwnam_r_proto'
23623 getpwuid_r_proto='$getpwuid_r_proto'
23624 getservbyname_r_proto='$getservbyname_r_proto'
23625 getservbyport_r_proto='$getservbyport_r_proto'
23626 getservent_r_proto='$getservent_r_proto'
23627 getspnam_r_proto='$getspnam_r_proto'
23628 gidformat='$gidformat'
23629 gidsign='$gidsign'
23630 gidsize='$gidsize'
23631 gidtype='$gidtype'
23632 glibpth='$glibpth'
23633 gmake='$gmake'
23634 gmtime_r_proto='$gmtime_r_proto'
23635 gnulibc_version='$gnulibc_version'
23636 grep='$grep'
23637 groupcat='$groupcat'
23638 groupstype='$groupstype'
23639 gzip='$gzip'
23640 h_fcntl='$h_fcntl'
23641 h_sysfile='$h_sysfile'
23642 hint='$hint'
23643 hostcat='$hostcat'
23644 hostgenerate='$hostgenerate'
23645 hostosname='$hostosname'
23646 hostperl='$hostperl'
23647 html1dir='$html1dir'
23648 html1direxp='$html1direxp'
23649 html3dir='$html3dir'
23650 html3direxp='$html3direxp'
23651 i16size='$i16size'
23652 i16type='$i16type'
23653 i32size='$i32size'
23654 i32type='$i32type'
23655 i64size='$i64size'
23656 i64type='$i64type'
23657 i8size='$i8size'
23658 i8type='$i8type'
23659 i_arpainet='$i_arpainet'
23660 i_assert='$i_assert'
23661 i_bfd='$i_bfd'
23662 i_bsdioctl='$i_bsdioctl'
23663 i_crypt='$i_crypt'
23664 i_db='$i_db'
23665 i_dbm='$i_dbm'
23666 i_dirent='$i_dirent'
23667 i_dlfcn='$i_dlfcn'
23668 i_execinfo='$i_execinfo'
23669 i_fcntl='$i_fcntl'
23670 i_float='$i_float'
23671 i_fp='$i_fp'
23672 i_fp_class='$i_fp_class'
23673 i_gdbm='$i_gdbm'
23674 i_gdbm_ndbm='$i_gdbm_ndbm'
23675 i_gdbmndbm='$i_gdbmndbm'
23676 i_grp='$i_grp'
23677 i_ieeefp='$i_ieeefp'
23678 i_inttypes='$i_inttypes'
23679 i_langinfo='$i_langinfo'
23680 i_libutil='$i_libutil'
23681 i_limits='$i_limits'
23682 i_locale='$i_locale'
23683 i_machcthr='$i_machcthr'
23684 i_malloc='$i_malloc'
23685 i_mallocmalloc='$i_mallocmalloc'
23686 i_math='$i_math'
23687 i_memory='$i_memory'
23688 i_mntent='$i_mntent'
23689 i_ndbm='$i_ndbm'
23690 i_netdb='$i_netdb'
23691 i_neterrno='$i_neterrno'
23692 i_netinettcp='$i_netinettcp'
23693 i_niin='$i_niin'
23694 i_poll='$i_poll'
23695 i_prot='$i_prot'
23696 i_pthread='$i_pthread'
23697 i_pwd='$i_pwd'
23698 i_rpcsvcdbm='$i_rpcsvcdbm'
23699 i_sgtty='$i_sgtty'
23700 i_shadow='$i_shadow'
23701 i_socks='$i_socks'
23702 i_stdarg='$i_stdarg'
23703 i_stdbool='$i_stdbool'
23704 i_stddef='$i_stddef'
23705 i_stdlib='$i_stdlib'
23706 i_string='$i_string'
23707 i_sunmath='$i_sunmath'
23708 i_sysaccess='$i_sysaccess'
23709 i_sysdir='$i_sysdir'
23710 i_sysfile='$i_sysfile'
23711 i_sysfilio='$i_sysfilio'
23712 i_sysin='$i_sysin'
23713 i_sysioctl='$i_sysioctl'
23714 i_syslog='$i_syslog'
23715 i_sysmman='$i_sysmman'
23716 i_sysmode='$i_sysmode'
23717 i_sysmount='$i_sysmount'
23718 i_sysndir='$i_sysndir'
23719 i_sysparam='$i_sysparam'
23720 i_syspoll='$i_syspoll'
23721 i_sysresrc='$i_sysresrc'
23722 i_syssecrt='$i_syssecrt'
23723 i_sysselct='$i_sysselct'
23724 i_syssockio='$i_syssockio'
23725 i_sysstat='$i_sysstat'
23726 i_sysstatfs='$i_sysstatfs'
23727 i_sysstatvfs='$i_sysstatvfs'
23728 i_systime='$i_systime'
23729 i_systimek='$i_systimek'
23730 i_systimes='$i_systimes'
23731 i_systypes='$i_systypes'
23732 i_sysuio='$i_sysuio'
23733 i_sysun='$i_sysun'
23734 i_sysutsname='$i_sysutsname'
23735 i_sysvfs='$i_sysvfs'
23736 i_syswait='$i_syswait'
23737 i_termio='$i_termio'
23738 i_termios='$i_termios'
23739 i_time='$i_time'
23740 i_unistd='$i_unistd'
23741 i_ustat='$i_ustat'
23742 i_utime='$i_utime'
23743 i_values='$i_values'
23744 i_varargs='$i_varargs'
23745 i_varhdr='$i_varhdr'
23746 i_vfork='$i_vfork'
23747 ignore_versioned_solibs='$ignore_versioned_solibs'
23748 inc_version_list='$inc_version_list'
23749 inc_version_list_init='$inc_version_list_init'
23750 incpath='$incpath'
23751 incpth='$incpth'
23752 inews='$inews'
23753 initialinstalllocation='$initialinstalllocation'
23754 installarchlib='$installarchlib'
23755 installbin='$installbin'
23756 installhtml1dir='$installhtml1dir'
23757 installhtml3dir='$installhtml3dir'
23758 installman1dir='$installman1dir'
23759 installman3dir='$installman3dir'
23760 installprefix='$installprefix'
23761 installprefixexp='$installprefixexp'
23762 installprivlib='$installprivlib'
23763 installscript='$installscript'
23764 installsitearch='$installsitearch'
23765 installsitebin='$installsitebin'
23766 installsitehtml1dir='$installsitehtml1dir'
23767 installsitehtml3dir='$installsitehtml3dir'
23768 installsitelib='$installsitelib'
23769 installsiteman1dir='$installsiteman1dir'
23770 installsiteman3dir='$installsiteman3dir'
23771 installsitescript='$installsitescript'
23772 installstyle='$installstyle'
23773 installusrbinperl='$installusrbinperl'
23774 installvendorarch='$installvendorarch'
23775 installvendorbin='$installvendorbin'
23776 installvendorhtml1dir='$installvendorhtml1dir'
23777 installvendorhtml3dir='$installvendorhtml3dir'
23778 installvendorlib='$installvendorlib'
23779 installvendorman1dir='$installvendorman1dir'
23780 installvendorman3dir='$installvendorman3dir'
23781 installvendorscript='$installvendorscript'
23782 intsize='$intsize'
23783 issymlink='$issymlink'
23784 ivdformat='$ivdformat'
23785 ivsize='$ivsize'
23786 ivtype='$ivtype'
23787 known_extensions='$known_extensions'
23788 ksh='$ksh'
23789 ld='$ld'
23790 ld_can_script='$ld_can_script'
23791 lddlflags='$lddlflags'
23792 ldflags='$ldflags'
23793 ldflags_uselargefiles='$ldflags_uselargefiles'
23794 ldlibpthname='$ldlibpthname'
23795 less='$less'
23796 lib_ext='$lib_ext'
23797 libc='$libc'
23798 libperl='$libperl'
23799 libpth='$libpth'
23800 libs='$libs'
23801 libsdirs='$libsdirs'
23802 libsfiles='$libsfiles'
23803 libsfound='$libsfound'
23804 libspath='$libspath'
23805 libswanted='$libswanted'
23806 libswanted_uselargefiles='$libswanted_uselargefiles'
23807 line='$line'
23808 lint='$lint'
23809 lkflags='$lkflags'
23810 ln='$ln'
23811 lns='$lns'
23812 localtime_r_proto='$localtime_r_proto'
23813 locincpth='$locincpth'
23814 loclibpth='$loclibpth'
23815 longdblkind='$longdblkind'
23816 longdblsize='$longdblsize'
23817 longlongsize='$longlongsize'
23818 longsize='$longsize'
23819 lp='$lp'
23820 lpr='$lpr'
23821 ls='$ls'
23822 lseeksize='$lseeksize'
23823 lseektype='$lseektype'
23824 mail='$mail'
23825 mailx='$mailx'
23826 make='$make'
23827 make_set_make='$make_set_make'
23828 mallocobj='$mallocobj'
23829 mallocsrc='$mallocsrc'
23830 malloctype='$malloctype'
23831 man1dir='$man1dir'
23832 man1direxp='$man1direxp'
23833 man1ext='$man1ext'
23834 man3dir='$man3dir'
23835 man3direxp='$man3direxp'
23836 man3ext='$man3ext'
23837 mips_type='$mips_type'
23838 mistrustnm='$mistrustnm'
23839 mkdir='$mkdir'
23840 mmaptype='$mmaptype'
23841 modetype='$modetype'
23842 more='$more'
23843 multiarch='$multiarch'
23844 mv='$mv'
23845 myarchname='$myarchname'
23846 mydomain='$mydomain'
23847 myhostname='$myhostname'
23848 myuname='$myuname'
23849 n='$n'
23850 need_va_copy='$need_va_copy'
23851 netdb_hlen_type='$netdb_hlen_type'
23852 netdb_host_type='$netdb_host_type'
23853 netdb_name_type='$netdb_name_type'
23854 netdb_net_type='$netdb_net_type'
23855 nm='$nm'
23856 nm_opt='$nm_opt'
23857 nm_so_opt='$nm_so_opt'
23858 nonxs_ext='$nonxs_ext'
23859 nroff='$nroff'
23860 nvEUformat='$nvEUformat'
23861 nvFUformat='$nvFUformat'
23862 nvGUformat='$nvGUformat'
23863 nv_overflows_integers_at='$nv_overflows_integers_at'
23864 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23865 nveformat='$nveformat'
23866 nvfformat='$nvfformat'
23867 nvgformat='$nvgformat'
23868 nvsize='$nvsize'
23869 nvtype='$nvtype'
23870 o_nonblock='$o_nonblock'
23871 obj_ext='$obj_ext'
23872 old_pthread_create_joinable='$old_pthread_create_joinable'
23873 optimize='$optimize'
23874 orderlib='$orderlib'
23875 osname='$osname'
23876 osvers='$osvers'
23877 otherlibdirs='$otherlibdirs'
23878 package='$package'
23879 pager='$pager'
23880 passcat='$passcat'
23881 patchlevel='$patchlevel'
23882 path_sep='$path_sep'
23883 perl5='$perl5'
23884 perl='$perl'
23885 perl_patchlevel='$perl_patchlevel'
23886 perl_static_inline='$perl_static_inline'
23887 perladmin='$perladmin'
23888 perllibs='$perllibs'
23889 perlpath='$perlpath'
23890 pg='$pg'
23891 phostname='$phostname'
23892 pidtype='$pidtype'
23893 plibpth='$plibpth'
23894 pmake='$pmake'
23895 pr='$pr'
23896 prefix='$prefix'
23897 prefixexp='$prefixexp'
23898 privlib='$privlib'
23899 privlibexp='$privlibexp'
23900 procselfexe='$procselfexe'
23901 prototype='$prototype'
23902 ptrsize='$ptrsize'
23903 quadkind='$quadkind'
23904 quadtype='$quadtype'
23905 randbits='$randbits'
23906 randfunc='$randfunc'
23907 random_r_proto='$random_r_proto'
23908 randseedtype='$randseedtype'
23909 ranlib='$ranlib'
23910 rd_nodata='$rd_nodata'
23911 readdir64_r_proto='$readdir64_r_proto'
23912 readdir_r_proto='$readdir_r_proto'
23913 revision='$revision'
23914 rm='$rm'
23915 rm_try='$rm_try'
23916 rmail='$rmail'
23917 run='$run'
23918 runnm='$runnm'
23919 sGMTIME_max='$sGMTIME_max'
23920 sGMTIME_min='$sGMTIME_min'
23921 sLOCALTIME_max='$sLOCALTIME_max'
23922 sLOCALTIME_min='$sLOCALTIME_min'
23923 sPRIEUldbl='$sPRIEUldbl'
23924 sPRIFUldbl='$sPRIFUldbl'
23925 sPRIGUldbl='$sPRIGUldbl'
23926 sPRIXU64='$sPRIXU64'
23927 sPRId64='$sPRId64'
23928 sPRIeldbl='$sPRIeldbl'
23929 sPRIfldbl='$sPRIfldbl'
23930 sPRIgldbl='$sPRIgldbl'
23931 sPRIi64='$sPRIi64'
23932 sPRIo64='$sPRIo64'
23933 sPRIu64='$sPRIu64'
23934 sPRIx64='$sPRIx64'
23935 sSCNfldbl='$sSCNfldbl'
23936 sched_yield='$sched_yield'
23937 scriptdir='$scriptdir'
23938 scriptdirexp='$scriptdirexp'
23939 sed='$sed'
23940 seedfunc='$seedfunc'
23941 selectminbits='$selectminbits'
23942 selecttype='$selecttype'
23943 sendmail='$sendmail'
23944 setgrent_r_proto='$setgrent_r_proto'
23945 sethostent_r_proto='$sethostent_r_proto'
23946 setlocale_r_proto='$setlocale_r_proto'
23947 setnetent_r_proto='$setnetent_r_proto'
23948 setprotoent_r_proto='$setprotoent_r_proto'
23949 setpwent_r_proto='$setpwent_r_proto'
23950 setservent_r_proto='$setservent_r_proto'
23951 sh='$sh'
23952 shar='$shar'
23953 sharpbang='$sharpbang'
23954 shmattype='$shmattype'
23955 shortsize='$shortsize'
23956 shrpenv='$shrpenv'
23957 shsharp='$shsharp'
23958 sig_count='$sig_count'
23959 sig_name='$sig_name'
23960 sig_name_init='$sig_name_init'
23961 sig_num='$sig_num'
23962 sig_num_init='$sig_num_init'
23963 sig_size='$sig_size'
23964 signal_t='$signal_t'
23965 sitearch='$sitearch'
23966 sitearchexp='$sitearchexp'
23967 sitebin='$sitebin'
23968 sitebinexp='$sitebinexp'
23969 sitehtml1dir='$sitehtml1dir'
23970 sitehtml1direxp='$sitehtml1direxp'
23971 sitehtml3dir='$sitehtml3dir'
23972 sitehtml3direxp='$sitehtml3direxp'
23973 sitelib='$sitelib'
23974 sitelib_stem='$sitelib_stem'
23975 sitelibexp='$sitelibexp'
23976 siteman1dir='$siteman1dir'
23977 siteman1direxp='$siteman1direxp'
23978 siteman3dir='$siteman3dir'
23979 siteman3direxp='$siteman3direxp'
23980 siteprefix='$siteprefix'
23981 siteprefixexp='$siteprefixexp'
23982 sitescript='$sitescript'
23983 sitescriptexp='$sitescriptexp'
23984 sizesize='$sizesize'
23985 sizetype='$sizetype'
23986 sleep='$sleep'
23987 smail='$smail'
23988 so='$so'
23989 sockethdr='$sockethdr'
23990 socketlib='$socketlib'
23991 socksizetype='$socksizetype'
23992 sort='$sort'
23993 spackage='$spackage'
23994 spitshell='$spitshell'
23995 srand48_r_proto='$srand48_r_proto'
23996 srandom_r_proto='$srandom_r_proto'
23997 src='$src'
23998 ssizetype='$ssizetype'
23999 st_ino_sign='$st_ino_sign'
24000 st_ino_size='$st_ino_size'
24001 startperl='$startperl'
24002 startsh='$startsh'
24003 static_ext='$static_ext'
24004 stdchar='$stdchar'
24005 stdio_base='$stdio_base'
24006 stdio_bufsiz='$stdio_bufsiz'
24007 stdio_cnt='$stdio_cnt'
24008 stdio_filbuf='$stdio_filbuf'
24009 stdio_ptr='$stdio_ptr'
24010 stdio_stream_array='$stdio_stream_array'
24011 strerror_r_proto='$strerror_r_proto'
24012 strings='$strings'
24013 submit='$submit'
24014 subversion='$subversion'
24015 sysman='$sysman'
24016 sysroot='$sysroot'
24017 tail='$tail'
24018 tar='$tar'
24019 targetarch='$targetarch'
24020 targetdir='$targetdir'
24021 targetenv='$targetenv'
24022 targethost='$targethost'
24023 targetmkdir='$targetmkdir'
24024 targetport='$targetport'
24025 targetsh='$targetsh'
24026 tbl='$tbl'
24027 tee='$tee'
24028 test='$test'
24029 timeincl='$timeincl'
24030 timetype='$timetype'
24031 tmpnam_r_proto='$tmpnam_r_proto'
24032 to='$to'
24033 touch='$touch'
24034 tr='$tr'
24035 trnl='$trnl'
24036 troff='$troff'
24037 ttyname_r_proto='$ttyname_r_proto'
24038 u16size='$u16size'
24039 u16type='$u16type'
24040 u32size='$u32size'
24041 u32type='$u32type'
24042 u64size='$u64size'
24043 u64type='$u64type'
24044 u8size='$u8size'
24045 u8type='$u8type'
24046 uidformat='$uidformat'
24047 uidsign='$uidsign'
24048 uidsize='$uidsize'
24049 uidtype='$uidtype'
24050 uname='$uname'
24051 uniq='$uniq'
24052 uquadtype='$uquadtype'
24053 use5005threads='$use5005threads'
24054 use64bitall='$use64bitall'
24055 use64bitint='$use64bitint'
24056 usecbacktrace='$usecbacktrace'
24057 usecrosscompile='$usecrosscompile'
24058 usedevel='$usedevel'
24059 usedl='$usedl'
24060 usedtrace='$usedtrace'
24061 usefaststdio='$usefaststdio'
24062 useithreads='$useithreads'
24063 usekernprocpathname='$usekernprocpathname'
24064 uselargefiles='$uselargefiles'
24065 uselongdouble='$uselongdouble'
24066 usemallocwrap='$usemallocwrap'
24067 usemorebits='$usemorebits'
24068 usemultiplicity='$usemultiplicity'
24069 usemymalloc='$usemymalloc'
24070 usenm='$usenm'
24071 usensgetexecutablepath='$usensgetexecutablepath'
24072 useopcode='$useopcode'
24073 useperlio='$useperlio'
24074 useposix='$useposix'
24075 usereentrant='$usereentrant'
24076 userelocatableinc='$userelocatableinc'
24077 useshrplib='$useshrplib'
24078 usesitecustomize='$usesitecustomize'
24079 usesocks='$usesocks'
24080 usethreads='$usethreads'
24081 usevendorprefix='$usevendorprefix'
24082 useversionedarchname='$useversionedarchname'
24083 usevfork='$usevfork'
24084 usrinc='$usrinc'
24085 uuname='$uuname'
24086 uvXUformat='$uvXUformat'
24087 uvoformat='$uvoformat'
24088 uvsize='$uvsize'
24089 uvtype='$uvtype'
24090 uvuformat='$uvuformat'
24091 uvxformat='$uvxformat'
24092 vaproto='$vaproto'
24093 vendorarch='$vendorarch'
24094 vendorarchexp='$vendorarchexp'
24095 vendorbin='$vendorbin'
24096 vendorbinexp='$vendorbinexp'
24097 vendorhtml1dir='$vendorhtml1dir'
24098 vendorhtml1direxp='$vendorhtml1direxp'
24099 vendorhtml3dir='$vendorhtml3dir'
24100 vendorhtml3direxp='$vendorhtml3direxp'
24101 vendorlib='$vendorlib'
24102 vendorlib_stem='$vendorlib_stem'
24103 vendorlibexp='$vendorlibexp'
24104 vendorman1dir='$vendorman1dir'
24105 vendorman1direxp='$vendorman1direxp'
24106 vendorman3dir='$vendorman3dir'
24107 vendorman3direxp='$vendorman3direxp'
24108 vendorprefix='$vendorprefix'
24109 vendorprefixexp='$vendorprefixexp'
24110 vendorscript='$vendorscript'
24111 vendorscriptexp='$vendorscriptexp'
24112 version='$version'
24113 version_patchlevel_string='$version_patchlevel_string'
24114 versiononly='$versiononly'
24115 vi='$vi'
24116 xlibpth='$xlibpth'
24117 yacc='$yacc'
24118 yaccflags='$yaccflags'
24119 zcat='$zcat'
24120 zip='$zip'
24121 EOT
24122
24123 : add special variables
24124 $test -f $src/patchlevel.h && \
24125 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24126 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24127 echo "PERL_CONFIG_SH=true" >>config.sh
24128
24129 : propagate old symbols
24130 if $test -f UU/config.sh; then
24131         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24132         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24133                 config.sh config.sh UU/oldconfig.sh |\
24134                 $sort | $uniq -u >UU/oldsyms
24135         set X `$cat UU/oldsyms`
24136         shift
24137         case $# in
24138         0) ;;
24139         *)
24140                 $cat <<EOM
24141 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24142 EOM
24143                 echo ": Variables propagated from previous config.sh file." >>config.sh
24144                 for sym in `$cat UU/oldsyms`; do
24145                         echo "    Propagating $hint variable "'$'"$sym..."
24146                         eval 'tmp="$'"${sym}"'"'
24147                         echo "$tmp" | \
24148                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24149                 done
24150                 ;;
24151         esac
24152 fi
24153
24154 : preserve RCS keywords in files with variable substitution, grrr
24155 Id='$Id'
24156
24157 : Finish up by extracting the .SH files
24158 case "$alldone" in
24159 exit)
24160         $rm -rf UU
24161         echo "Extraction done."
24162         exit 0
24163         ;;
24164 cont)
24165         ;;
24166 '')
24167         dflt=''
24168         nostick=true
24169         $cat <<EOM
24170
24171 If you'd like to make any changes to the config.sh file before I begin
24172 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24173
24174 EOM
24175         rp="Press return or use a shell escape to edit config.sh:"
24176         . UU/myread
24177         nostick=''
24178         case "$ans" in
24179         '') ;;
24180         *) : in case they cannot read
24181                 sh 1>&4 -c "$ans";;
24182         esac
24183         ;;
24184 esac
24185
24186 : if this fails, just run all the .SH files by hand
24187 . ./config.sh
24188
24189 echo " "
24190 exec 1>&4
24191 pwd=`pwd`
24192 . ./UU/extract
24193 cd "$pwd"
24194
24195 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24196         dflt=y
24197         case "$silent" in
24198         true) ;;
24199         *)
24200                 $cat <<EOM
24201
24202 Now you need to generate make dependencies by running "$make depend".
24203 You might prefer to run it in background: "$make depend > makedepend.out &"
24204 It can take a while, so you might not want to run it right now.
24205
24206 EOM
24207                 ;;
24208         esac
24209         rp="Run $make depend now?"
24210         . UU/myread
24211         case "$ans" in
24212         y*)
24213                 $make depend && echo "Now you must run '$make'."
24214                 ;;
24215         *)
24216                 echo "You must run '$make depend' then '$make'."
24217                 ;;
24218         esac
24219 elif test -f [Mm]akefile; then
24220         echo " "
24221         echo "Now you must run a $make."
24222 else
24223         echo "Configure done."
24224 fi
24225
24226 if $test -f Policy.sh; then
24227     $cat <<EOM
24228
24229 If you compile $package on a different machine or from a different object
24230 directory, copy the Policy.sh file from this object directory to the
24231 new one before you run Configure -- this will help you with most of
24232 the policy defaults.
24233
24234 EOM
24235 fi
24236 if $test -f config.msg; then
24237     echo "Hmm.  I also noted the following information while running:"
24238     echo " "
24239     $cat config.msg >&4
24240     $rm -f config.msg
24241 fi
24242 $rm -f kit*isdone ark*isdone
24243 $rm -rf UU
24244
24245 : End of Configure
24246