This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regen/unicode_constants.pl: Update to use EBCDIC utilities
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.code.sf.net/p/dist/code/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated on Wed Apr  9 12:24:24 CEST 2014 [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin|*msys) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 hostgenerate=''
210 hostosname=''
211 hostperl=''
212 run=''
213 targetarch=''
214 targetdir=''
215 targetenv=''
216 targethost=''
217 targetmkdir=''
218 targetport=''
219 to=''
220 usecrosscompile=''
221 extern_C=''
222 mistrustnm=''
223 usedevel=''
224 perllibs=''
225 dynamic_ext=''
226 extensions=''
227 known_extensions=''
228 nonxs_ext=''
229 static_ext=''
230 useopcode=''
231 useposix=''
232 extras=''
233 d_bsd=''
234 d_eunice=''
235 d_xenix=''
236 eunicefix=''
237 ar=''
238 awk=''
239 bash=''
240 bison=''
241 byacc=''
242 cat=''
243 chgrp=''
244 chmod=''
245 chown=''
246 comm=''
247 compress=''
248 cp=''
249 cpio=''
250 cpp=''
251 csh=''
252 date=''
253 echo=''
254 egrep=''
255 emacs=''
256 expr=''
257 find=''
258 flex=''
259 gmake=''
260 grep=''
261 gzip=''
262 inews=''
263 ksh=''
264 less=''
265 line=''
266 lint=''
267 ln=''
268 lp=''
269 lpr=''
270 ls=''
271 mail=''
272 mailx=''
273 make=''
274 mkdir=''
275 more=''
276 mv=''
277 nm=''
278 nroff=''
279 perl=''
280 pg=''
281 pmake=''
282 pr=''
283 rm=''
284 rmail=''
285 sed=''
286 sendmail=''
287 shar=''
288 sleep=''
289 smail=''
290 sort=''
291 submit=''
292 tail=''
293 tar=''
294 tbl=''
295 tee=''
296 test=''
297 touch=''
298 tr=''
299 troff=''
300 uname=''
301 uniq=''
302 uuname=''
303 vi=''
304 zcat=''
305 zip=''
306 full_ar=''
307 full_sed=''
308 libswanted=''
309 hint=''
310 myuname=''
311 osname=''
312 osvers=''
313 Author=''
314 Date=''
315 Header=''
316 Id=''
317 Locker=''
318 Log=''
319 RCSfile=''
320 Revision=''
321 Source=''
322 State=''
323 sysroot=''
324 _a=''
325 _exe=''
326 _o=''
327 archobjs=''
328 exe_ext=''
329 firstmakefile=''
330 lib_ext=''
331 obj_ext=''
332 path_sep=''
333 rm_try=''
334 afs=''
335 afsroot=''
336 alignbytes=''
337 ansi2knr=''
338 archlib=''
339 archlibexp=''
340 d_archlib=''
341 installarchlib=''
342 archname=''
343 myarchname=''
344 useversionedarchname=''
345 d_atolf=''
346 d_atoll=''
347 baserev=''
348 bin=''
349 binexp=''
350 initialinstalllocation=''
351 installbin=''
352 userelocatableinc=''
353 byteorder=''
354 cc=''
355 ccflags=''
356 cppflags=''
357 ldflags=''
358 lkflags=''
359 locincpth=''
360 optimize=''
361 cf_email=''
362 cf_by=''
363 cf_time=''
364 charbits=''
365 charsize=''
366 contains=''
367 cpp_stuff=''
368 cpplast=''
369 cppminus=''
370 cpprun=''
371 cppstdin=''
372 d__fwalk=''
373 d_access=''
374 d_accessx=''
375 d_aintl=''
376 d_alarm=''
377 asctime_r_proto=''
378 d_asctime_r=''
379 d_attribute_deprecated=''
380 d_attribute_format=''
381 d_attribute_malloc=''
382 d_attribute_nonnull=''
383 d_attribute_noreturn=''
384 d_attribute_pure=''
385 d_attribute_unused=''
386 d_attribute_warn_unused_result=''
387 d_printf_format_null=''
388 d_bcmp=''
389 d_bcopy=''
390 d_builtin_choose_expr=''
391 d_builtin_expect=''
392 d_bzero=''
393 d_c99_variadic_macros=''
394 d_casti32=''
395 castflags=''
396 d_castneg=''
397 d_chown=''
398 d_chroot=''
399 d_chsize=''
400 d_class=''
401 d_clearenv=''
402 d_closedir=''
403 d_void_closedir=''
404 d_cmsghdr_s=''
405 d_const=''
406 d_copysignl=''
407 d_cplusplus=''
408 cryptlib=''
409 d_crypt=''
410 crypt_r_proto=''
411 d_crypt_r=''
412 d_csh=''
413 full_csh=''
414 d_ctermid=''
415 ctermid_r_proto=''
416 d_ctermid_r=''
417 ctime_r_proto=''
418 d_ctime_r=''
419 d_cuserid=''
420 d_dbl_dig=''
421 d_dbminitproto=''
422 d_difftime=''
423 d_dir_dd_fd=''
424 d_dirfd=''
425 d_dlerror=''
426 d_dlopen=''
427 d_dlsymun=''
428 d_dosuid=''
429 d_suidsafe=''
430 d_drand48_r=''
431 drand48_r_proto=''
432 d_drand48proto=''
433 d_dup2=''
434 d_eaccess=''
435 d_endgrent=''
436 d_endgrent_r=''
437 endgrent_r_proto=''
438 d_endhent=''
439 d_endhostent_r=''
440 endhostent_r_proto=''
441 d_endnent=''
442 d_endnetent_r=''
443 endnetent_r_proto=''
444 d_endpent=''
445 d_endprotoent_r=''
446 endprotoent_r_proto=''
447 d_endpwent=''
448 d_endpwent_r=''
449 endpwent_r_proto=''
450 d_endsent=''
451 d_endservent_r=''
452 endservent_r_proto=''
453 d_faststdio=''
454 d_fchdir=''
455 d_fchmod=''
456 d_fchown=''
457 d_fcntl=''
458 d_fcntl_can_lock=''
459 d_fd_macros=''
460 d_fd_set=''
461 d_fds_bits=''
462 d_fgetpos=''
463 d_finite=''
464 d_finitel=''
465 d_flexfnam=''
466 d_flock=''
467 d_flockproto=''
468 d_fork=''
469 d_fp_class=''
470 d_fpclass=''
471 d_fpclassify=''
472 d_fpclassl=''
473 d_fpos64_t=''
474 d_frexpl=''
475 d_fs_data_s=''
476 d_fseeko=''
477 d_fsetpos=''
478 d_fstatfs=''
479 d_fsync=''
480 d_ftello=''
481 d_ftime=''
482 d_gettimeod=''
483 d_futimes=''
484 d_Gconvert=''
485 d_getaddrinfo=''
486 d_getcwd=''
487 d_getespwnam=''
488 d_getfsstat=''
489 d_getgrent=''
490 d_getgrent_r=''
491 getgrent_r_proto=''
492 d_getgrgid_r=''
493 getgrgid_r_proto=''
494 d_getgrnam_r=''
495 getgrnam_r_proto=''
496 d_getgrps=''
497 d_gethbyaddr=''
498 d_gethbyname=''
499 d_gethent=''
500 aphostname=''
501 d_gethname=''
502 d_phostname=''
503 d_uname=''
504 d_gethostbyaddr_r=''
505 gethostbyaddr_r_proto=''
506 d_gethostbyname_r=''
507 gethostbyname_r_proto=''
508 d_gethostent_r=''
509 gethostent_r_proto=''
510 d_gethostprotos=''
511 d_getitimer=''
512 d_getlogin=''
513 d_getlogin_r=''
514 getlogin_r_proto=''
515 d_getmnt=''
516 d_getmntent=''
517 d_getnameinfo=''
518 d_getnbyaddr=''
519 d_getnbyname=''
520 d_getnent=''
521 d_getnetbyaddr_r=''
522 getnetbyaddr_r_proto=''
523 d_getnetbyname_r=''
524 getnetbyname_r_proto=''
525 d_getnetent_r=''
526 getnetent_r_proto=''
527 d_getnetprotos=''
528 d_getpagsz=''
529 d_getpent=''
530 d_getpgid=''
531 d_getpgrp2=''
532 d_bsdgetpgrp=''
533 d_getpgrp=''
534 d_getppid=''
535 d_getprior=''
536 d_getpbyname=''
537 d_getpbynumber=''
538 d_getprotobyname_r=''
539 getprotobyname_r_proto=''
540 d_getprotobynumber_r=''
541 getprotobynumber_r_proto=''
542 d_getprotoent_r=''
543 getprotoent_r_proto=''
544 d_getprotoprotos=''
545 d_getprpwnam=''
546 d_getpwent=''
547 d_getpwent_r=''
548 getpwent_r_proto=''
549 d_getpwnam_r=''
550 getpwnam_r_proto=''
551 d_getpwuid_r=''
552 getpwuid_r_proto=''
553 d_getsent=''
554 d_getservbyname_r=''
555 getservbyname_r_proto=''
556 d_getservbyport_r=''
557 getservbyport_r_proto=''
558 d_getservent_r=''
559 getservent_r_proto=''
560 d_getservprotos=''
561 d_getspnam=''
562 d_getspnam_r=''
563 getspnam_r_proto=''
564 d_getsbyname=''
565 d_getsbyport=''
566 d_gmtime_r=''
567 gmtime_r_proto=''
568 d_gnulibc=''
569 gnulibc_version=''
570 d_hasmntopt=''
571 d_htonl=''
572 d_ilogbl=''
573 d_inetaton=''
574 d_inetntop=''
575 d_inetpton=''
576 d_int64_t=''
577 d_isascii=''
578 d_isblank=''
579 d_isfinite=''
580 d_isinf=''
581 d_isnan=''
582 d_isnanl=''
583 d_killpg=''
584 d_lchown=''
585 d_ldbl_dig=''
586 d_libm_lib_version=''
587 d_link=''
588 d_localtime_r=''
589 d_localtime_r_needs_tzset=''
590 localtime_r_proto=''
591 d_locconv=''
592 d_lockf=''
593 d_longdbl=''
594 longdblsize=''
595 d_longlong=''
596 longlongsize=''
597 d_lseekproto=''
598 d_lstat=''
599 d_madvise=''
600 d_malloc_good_size=''
601 d_malloc_size=''
602 d_mblen=''
603 d_mbstowcs=''
604 d_mbtowc=''
605 d_memchr=''
606 d_memcmp=''
607 d_memcpy=''
608 d_memmove=''
609 d_memset=''
610 d_mkdir=''
611 d_mkdtemp=''
612 d_mkfifo=''
613 d_mkstemp=''
614 d_mkstemps=''
615 d_mktime=''
616 d_mmap=''
617 mmaptype=''
618 d_modfl=''
619 d_modfl_pow32_bug=''
620 d_modflproto=''
621 d_mprotect=''
622 d_msg=''
623 d_msgctl=''
624 d_msgget=''
625 d_msghdr_s=''
626 d_msgrcv=''
627 d_msgsnd=''
628 d_msync=''
629 d_munmap=''
630 d_nice=''
631 d_nl_langinfo=''
632 d_off64_t=''
633 d_open3=''
634 d_fpathconf=''
635 d_pathconf=''
636 d_pause=''
637 d_pipe=''
638 d_poll=''
639 d_portable=''
640 d_prctl=''
641 d_prctl_set_name=''
642 d_procselfexe=''
643 procselfexe=''
644 d_old_pthread_create_joinable=''
645 old_pthread_create_joinable=''
646 d_pthread_atfork=''
647 d_pthread_attr_setscope=''
648 d_pthread_yield=''
649 d_sched_yield=''
650 sched_yield=''
651 d_qgcvt=''
652 d_random_r=''
653 random_r_proto=''
654 d_readdir64_r=''
655 readdir64_r_proto=''
656 d_readdir=''
657 d_rewinddir=''
658 d_seekdir=''
659 d_telldir=''
660 d_readdir_r=''
661 readdir_r_proto=''
662 d_readlink=''
663 d_readv=''
664 d_recvmsg=''
665 d_rename=''
666 d_rmdir=''
667 d_safebcpy=''
668 d_safemcpy=''
669 d_sanemcmp=''
670 d_sbrkproto=''
671 d_scalbnl=''
672 d_select=''
673 d_sem=''
674 d_semctl=''
675 d_semget=''
676 d_semop=''
677 d_sendmsg=''
678 d_setegid=''
679 d_seteuid=''
680 d_setgrent=''
681 d_setgrent_r=''
682 setgrent_r_proto=''
683 d_setgrps=''
684 d_sethent=''
685 d_sethostent_r=''
686 sethostent_r_proto=''
687 d_setitimer=''
688 d_setlinebuf=''
689 d_setlocale=''
690 d_setlocale_r=''
691 setlocale_r_proto=''
692 d_setnent=''
693 d_setnetent_r=''
694 setnetent_r_proto=''
695 d_setpent=''
696 d_setpgid=''
697 d_setpgrp2=''
698 d_bsdsetpgrp=''
699 d_setpgrp=''
700 d_setprior=''
701 d_setproctitle=''
702 d_setprotoent_r=''
703 setprotoent_r_proto=''
704 d_setpwent=''
705 d_setpwent_r=''
706 setpwent_r_proto=''
707 d_setregid=''
708 d_setresgid=''
709 d_setresuid=''
710 d_setreuid=''
711 d_setrgid=''
712 d_setruid=''
713 d_setsent=''
714 d_setservent_r=''
715 setservent_r_proto=''
716 d_setsid=''
717 d_setvbuf=''
718 d_shm=''
719 d_shmat=''
720 d_shmatprototype=''
721 shmattype=''
722 d_shmctl=''
723 d_shmdt=''
724 d_shmget=''
725 d_sigaction=''
726 d_signbit=''
727 d_sigprocmask=''
728 d_sigsetjmp=''
729 usesitecustomize=''
730 d_snprintf=''
731 d_vsnprintf=''
732 d_sockatmark=''
733 d_sockatmarkproto=''
734 d_ip_mreq=''
735 d_ip_mreq_source=''
736 d_ipv6_mreq=''
737 d_ipv6_mreq_source=''
738 d_msg_ctrunc=''
739 d_msg_dontroute=''
740 d_msg_oob=''
741 d_msg_peek=''
742 d_msg_proxy=''
743 d_oldsock=''
744 d_scm_rights=''
745 d_sin6_scope_id=''
746 d_sockaddr_in6=''
747 d_sockaddr_sa_len=''
748 d_socket=''
749 d_sockpair=''
750 sockethdr=''
751 socketlib=''
752 d_socklen_t=''
753 d_socks5_init=''
754 d_sprintf_returns_strlen=''
755 d_sqrtl=''
756 d_srand48_r=''
757 srand48_r_proto=''
758 d_srandom_r=''
759 srandom_r_proto=''
760 d_sresgproto=''
761 d_sresuproto=''
762 d_statblks=''
763 d_statfs_f_flags=''
764 d_statfs_s=''
765 d_static_inline=''
766 perl_static_inline=''
767 d_fstatvfs=''
768 d_statvfs=''
769 d_stdio_cnt_lval=''
770 d_stdio_ptr_lval=''
771 d_stdio_ptr_lval_nochange_cnt=''
772 d_stdio_ptr_lval_sets_cnt=''
773 d_stdiobase=''
774 d_stdstdio=''
775 stdio_base=''
776 stdio_bufsiz=''
777 stdio_cnt=''
778 stdio_filbuf=''
779 stdio_ptr=''
780 d_index=''
781 d_strchr=''
782 d_strcoll=''
783 d_strctcpy=''
784 d_strerrm=''
785 d_strerror=''
786 d_sysernlst=''
787 d_syserrlst=''
788 d_strerror_r=''
789 strerror_r_proto=''
790 d_strftime=''
791 d_strlcat=''
792 d_strlcpy=''
793 d_strtod=''
794 d_strtol=''
795 d_strtold=''
796 d_strtoll=''
797 d_strtoq=''
798 d_strtoul=''
799 d_strtoull=''
800 d_strtouq=''
801 d_strxfrm=''
802 d_symlink=''
803 d_syscall=''
804 d_syscallproto=''
805 d_sysconf=''
806 d_system=''
807 d_tcgetpgrp=''
808 d_tcsetpgrp=''
809 d_telldirproto=''
810 d_time=''
811 timetype=''
812 d_asctime64=''
813 d_ctime64=''
814 d_difftime64=''
815 d_gmtime64=''
816 d_localtime64=''
817 d_mktime64=''
818 d_timegm=''
819 clocktype=''
820 d_times=''
821 d_tmpnam_r=''
822 tmpnam_r_proto=''
823 d_truncate=''
824 d_ttyname_r=''
825 ttyname_r_proto=''
826 d_tzname=''
827 d_u32align=''
828 d_ualarm=''
829 d_umask=''
830 d_semctl_semid_ds=''
831 d_semctl_semun=''
832 d_union_semun=''
833 d_unordered=''
834 d_unsetenv=''
835 d_usleep=''
836 d_usleepproto=''
837 d_ustat=''
838 d_pseudofork=''
839 d_vfork=''
840 usevfork=''
841 d_voidsig=''
842 signal_t=''
843 d_volatile=''
844 d_charvspr=''
845 d_vprintf=''
846 d_wait4=''
847 d_waitpid=''
848 d_wcstombs=''
849 d_wctomb=''
850 d_writev=''
851 dlext=''
852 bin_ELF=''
853 cccdlflags=''
854 ccdlflags=''
855 dlsrc=''
856 ld=''
857 ld_can_script=''
858 lddlflags=''
859 usedl=''
860 doublesize=''
861 bootstrap_charset=''
862 ebcdic=''
863 fflushNULL=''
864 fflushall=''
865 fpossize=''
866 fpostype=''
867 gccansipedantic=''
868 gccosandvers=''
869 gccversion=''
870 gidformat=''
871 gidsign=''
872 gidsize=''
873 gidtype=''
874 groupstype=''
875 h_fcntl=''
876 h_sysfile=''
877 html1dir=''
878 html1direxp=''
879 installhtml1dir=''
880 html3dir=''
881 html3direxp=''
882 installhtml3dir=''
883 i_arpainet=''
884 i_assert=''
885 i_crypt=''
886 db_hashtype=''
887 db_prefixtype=''
888 db_version_major=''
889 db_version_minor=''
890 db_version_patch=''
891 i_db=''
892 i_dbm=''
893 i_rpcsvcdbm=''
894 d_dirnamlen=''
895 direntrytype=''
896 i_dirent=''
897 i_dlfcn=''
898 i_fcntl=''
899 i_float=''
900 i_fp=''
901 i_fp_class=''
902 i_gdbm=''
903 d_grpasswd=''
904 i_grp=''
905 i_ieeefp=''
906 i_inttypes=''
907 i_langinfo=''
908 i_libutil=''
909 i_limits=''
910 i_locale=''
911 i_machcthr=''
912 i_malloc=''
913 i_mallocmalloc=''
914 i_math=''
915 i_memory=''
916 i_mntent=''
917 d_gdbm_ndbm_h_uses_prototypes=''
918 d_gdbmndbm_h_uses_prototypes=''
919 d_ndbm=''
920 d_ndbm_h_uses_prototypes=''
921 i_gdbm_ndbm=''
922 i_gdbmndbm=''
923 i_ndbm=''
924 i_netdb=''
925 i_neterrno=''
926 i_netinettcp=''
927 i_niin=''
928 i_sysin=''
929 i_poll=''
930 i_prot=''
931 i_pthread=''
932 d_pwage=''
933 d_pwchange=''
934 d_pwclass=''
935 d_pwcomment=''
936 d_pwexpire=''
937 d_pwgecos=''
938 d_pwpasswd=''
939 d_pwquota=''
940 i_pwd=''
941 i_shadow=''
942 i_socks=''
943 i_stdbool=''
944 i_stddef=''
945 i_stdlib=''
946 i_string=''
947 strings=''
948 i_sunmath=''
949 i_sysaccess=''
950 i_sysdir=''
951 i_sysfile=''
952 d_voidtty=''
953 i_bsdioctl=''
954 i_sysfilio=''
955 i_sysioctl=''
956 i_syssockio=''
957 i_syslog=''
958 i_sysmman=''
959 i_sysmode=''
960 i_sysmount=''
961 i_sysndir=''
962 i_sysparam=''
963 i_syspoll=''
964 i_sysresrc=''
965 i_syssecrt=''
966 i_sysselct=''
967 i_sysstat=''
968 i_sysstatfs=''
969 i_sysstatvfs=''
970 i_systimes=''
971 i_systypes=''
972 i_sysuio=''
973 i_sysun=''
974 i_sysutsname=''
975 i_sysvfs=''
976 i_syswait=''
977 i_sgtty=''
978 i_termio=''
979 i_termios=''
980 d_tm_tm_gmtoff=''
981 d_tm_tm_zone=''
982 i_systime=''
983 i_systimek=''
984 i_time=''
985 timeincl=''
986 i_unistd=''
987 i_ustat=''
988 i_utime=''
989 i_values=''
990 i_stdarg=''
991 i_varargs=''
992 i_varhdr=''
993 i_vfork=''
994 d_inc_version_list=''
995 inc_version_list=''
996 inc_version_list_init=''
997 installprefix=''
998 installprefixexp=''
999 installstyle=''
1000 installusrbinperl=''
1001 intsize=''
1002 longsize=''
1003 shortsize=''
1004 issymlink=''
1005 libc=''
1006 ldlibpthname=''
1007 libperl=''
1008 shrpenv=''
1009 useshrplib=''
1010 glibpth=''
1011 incpth=''
1012 libpth=''
1013 loclibpth=''
1014 plibpth=''
1015 xlibpth=''
1016 ignore_versioned_solibs=''
1017 libs=''
1018 libsdirs=''
1019 libsfiles=''
1020 libsfound=''
1021 libspath=''
1022 lns=''
1023 d_PRIEUldbl=''
1024 d_PRIFUldbl=''
1025 d_PRIGUldbl=''
1026 d_PRIeldbl=''
1027 d_PRIfldbl=''
1028 d_PRIgldbl=''
1029 d_SCNfldbl=''
1030 sPRIEUldbl=''
1031 sPRIFUldbl=''
1032 sPRIGUldbl=''
1033 sPRIeldbl=''
1034 sPRIfldbl=''
1035 sPRIgldbl=''
1036 sSCNfldbl=''
1037 lseeksize=''
1038 lseektype=''
1039 mad=''
1040 madlyh=''
1041 madlyobj=''
1042 madlysrc=''
1043 make_set_make=''
1044 d_mymalloc=''
1045 freetype=''
1046 mallocobj=''
1047 mallocsrc=''
1048 malloctype=''
1049 usemallocwrap=''
1050 usemymalloc=''
1051 installman1dir=''
1052 man1dir=''
1053 man1direxp=''
1054 man1ext=''
1055 installman3dir=''
1056 man3dir=''
1057 man3direxp=''
1058 man3ext=''
1059 modetype=''
1060 multiarch=''
1061 mydomain=''
1062 myhostname=''
1063 phostname=''
1064 c=''
1065 n=''
1066 d_eofnblk=''
1067 eagain=''
1068 o_nonblock=''
1069 rd_nodata=''
1070 need_va_copy=''
1071 netdb_hlen_type=''
1072 netdb_host_type=''
1073 netdb_name_type=''
1074 netdb_net_type=''
1075 groupcat=''
1076 hostcat=''
1077 passcat=''
1078 orderlib=''
1079 ranlib=''
1080 d_perl_otherlibdirs=''
1081 otherlibdirs=''
1082 package=''
1083 spackage=''
1084 pager=''
1085 api_revision=''
1086 api_subversion=''
1087 api_version=''
1088 api_versionstring=''
1089 patchlevel=''
1090 perl_patchlevel=''
1091 revision=''
1092 subversion=''
1093 version=''
1094 version_patchlevel_string=''
1095 perl5=''
1096 perladmin=''
1097 perlpath=''
1098 d_nv_preserves_uv=''
1099 d_nv_zero_is_allbits_zero=''
1100 i16size=''
1101 i16type=''
1102 i32size=''
1103 i32type=''
1104 i64size=''
1105 i64type=''
1106 i8size=''
1107 i8type=''
1108 ivsize=''
1109 ivtype=''
1110 nv_overflows_integers_at=''
1111 nv_preserves_uv_bits=''
1112 nvsize=''
1113 nvtype=''
1114 u16size=''
1115 u16type=''
1116 u32size=''
1117 u32type=''
1118 u64size=''
1119 u64type=''
1120 u8size=''
1121 u8type=''
1122 uvsize=''
1123 uvtype=''
1124 ivdformat=''
1125 nvEUformat=''
1126 nvFUformat=''
1127 nvGUformat=''
1128 nveformat=''
1129 nvfformat=''
1130 nvgformat=''
1131 uvXUformat=''
1132 uvoformat=''
1133 uvuformat=''
1134 uvxformat=''
1135 pidtype=''
1136 prefix=''
1137 prefixexp=''
1138 installprivlib=''
1139 privlib=''
1140 privlibexp=''
1141 prototype=''
1142 ptrsize=''
1143 d_PRIXU64=''
1144 d_PRId64=''
1145 d_PRIi64=''
1146 d_PRIo64=''
1147 d_PRIu64=''
1148 d_PRIx64=''
1149 sPRIXU64=''
1150 sPRId64=''
1151 sPRIi64=''
1152 sPRIo64=''
1153 sPRIu64=''
1154 sPRIx64=''
1155 d_quad=''
1156 quadkind=''
1157 quadtype=''
1158 uquadtype=''
1159 drand01=''
1160 randbits=''
1161 randfunc=''
1162 randseedtype=''
1163 seedfunc=''
1164 installscript=''
1165 scriptdir=''
1166 scriptdirexp=''
1167 selectminbits=''
1168 selecttype=''
1169 sh=''
1170 targetsh=''
1171 sig_count=''
1172 sig_name=''
1173 sig_name_init=''
1174 sig_num=''
1175 sig_num_init=''
1176 sig_size=''
1177 d_sitearch=''
1178 installsitearch=''
1179 sitearch=''
1180 sitearchexp=''
1181 installsitebin=''
1182 sitebin=''
1183 sitebinexp=''
1184 installsitehtml1dir=''
1185 sitehtml1dir=''
1186 sitehtml1direxp=''
1187 installsitehtml3dir=''
1188 sitehtml3dir=''
1189 sitehtml3direxp=''
1190 installsitelib=''
1191 sitelib=''
1192 sitelib_stem=''
1193 sitelibexp=''
1194 installsiteman1dir=''
1195 siteman1dir=''
1196 siteman1direxp=''
1197 installsiteman3dir=''
1198 siteman3dir=''
1199 siteman3direxp=''
1200 siteprefix=''
1201 siteprefixexp=''
1202 installsitescript=''
1203 sitescript=''
1204 sitescriptexp=''
1205 sizesize=''
1206 sizetype=''
1207 d_libname_unique=''
1208 so=''
1209 socksizetype=''
1210 sharpbang=''
1211 shsharp=''
1212 spitshell=''
1213 src=''
1214 ssizetype=''
1215 st_ino_sign=''
1216 st_ino_size=''
1217 startperl=''
1218 startsh=''
1219 stdchar=''
1220 d_stdio_stream_array=''
1221 stdio_stream_array=''
1222 sysman=''
1223 sGMTIME_max=''
1224 sGMTIME_min=''
1225 sLOCALTIME_max=''
1226 sLOCALTIME_min=''
1227 trnl=''
1228 uidformat=''
1229 uidsign=''
1230 uidsize=''
1231 uidtype=''
1232 archname64=''
1233 use64bitall=''
1234 use64bitint=''
1235 dtrace=''
1236 usedtrace=''
1237 usefaststdio=''
1238 usekernprocpathname=''
1239 ccflags_uselargefiles=''
1240 ldflags_uselargefiles=''
1241 libswanted_uselargefiles=''
1242 uselargefiles=''
1243 uselongdouble=''
1244 usemorebits=''
1245 usemultiplicity=''
1246 nm_opt=''
1247 nm_so_opt=''
1248 runnm=''
1249 usenm=''
1250 usensgetexecutablepath=''
1251 useperlio=''
1252 usesocks=''
1253 d_oldpthreads=''
1254 use5005threads=''
1255 useithreads=''
1256 usereentrant=''
1257 usethreads=''
1258 incpath=''
1259 mips_type=''
1260 usrinc=''
1261 vaproto=''
1262 d_vendorarch=''
1263 installvendorarch=''
1264 vendorarch=''
1265 vendorarchexp=''
1266 d_vendorbin=''
1267 installvendorbin=''
1268 vendorbin=''
1269 vendorbinexp=''
1270 installvendorhtml1dir=''
1271 vendorhtml1dir=''
1272 vendorhtml1direxp=''
1273 installvendorhtml3dir=''
1274 vendorhtml3dir=''
1275 vendorhtml3direxp=''
1276 d_vendorlib=''
1277 installvendorlib=''
1278 vendorlib=''
1279 vendorlib_stem=''
1280 vendorlibexp=''
1281 installvendorman1dir=''
1282 vendorman1dir=''
1283 vendorman1direxp=''
1284 installvendorman3dir=''
1285 vendorman3dir=''
1286 vendorman3direxp=''
1287 usevendorprefix=''
1288 vendorprefix=''
1289 vendorprefixexp=''
1290 d_vendorscript=''
1291 installvendorscript=''
1292 vendorscript=''
1293 vendorscriptexp=''
1294 versiononly=''
1295 yacc=''
1296 yaccflags=''
1297 CONFIG=''
1298
1299 : Detect odd OSs
1300 define='define'
1301 undef='undef'
1302 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1303 rmlist=''
1304
1305 : We must find out about Eunice early
1306 eunicefix=':'
1307 if test -f /etc/unixtovms; then
1308         eunicefix=/etc/unixtovms
1309 fi
1310 if test -f /etc/unixtovms.exe; then
1311         eunicefix=/etc/unixtovms.exe
1312 fi
1313
1314 : Set executable suffix now -- needed before hints available
1315 if test -f "/libs/version.library"; then
1316 : Amiga OS
1317     _exe=""
1318 elif test -f "/system/gnu_library/bin/ar.pm"; then
1319 : Stratus VOS
1320     _exe=".pm"
1321 elif test -n "$DJGPP"; then
1322 : DOS DJGPP
1323     _exe=".exe"
1324 elif test -f /kern/cookiejar; then
1325 : MiNT
1326     _exe=""
1327 elif test -d c:/. -o -n "$is_os2" ; then
1328 : OS/2 or cygwin
1329     _exe=".exe"
1330 fi
1331
1332 groupstype=''
1333 i_whoami=''
1334 : Trailing extension.  Override this in a hint file, if needed.
1335 : Extra object files, if any, needed on this platform.
1336 archobjs=''
1337 archname=''
1338 : Possible local include directories to search.
1339 : Set locincpth to "" in a hint file to defeat local include searches.
1340 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1341 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1342 :
1343 : no include file wanted by default
1344 inclwanted=''
1345
1346 : Enable -DEBUGGING and -DDEBUGGING from the command line
1347 EBUGGING=''
1348 DEBUGGING=''
1349
1350 libnames=''
1351 : change the next line if compiling for Xenix/286 on Xenix/386
1352 xlibpth='/usr/lib/386 /lib/386'
1353 : Possible local library directories to search.
1354 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1355 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1356
1357 : general looking path for locating libraries
1358 glibpth="/lib /usr/lib $xlibpth"
1359 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1360 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1361 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1362 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1363
1364 : Private path used by Configure to find libraries.  Its value
1365 : is prepended to libpth. This variable takes care of special
1366 : machines, like the mips.  Usually, it should be empty.
1367 plibpth=''
1368
1369 : default library list
1370 libswanted=''
1371 : some systems want to use only the non-versioned libso:s
1372 ignore_versioned_solibs=''
1373 : set usethreads on the Configure command line to enable threads.
1374 usereentrant='undef'
1375 ccname=''
1376 ccversion=''
1377 perllibs=''
1378 : set useposix=false in your hint file to disable the POSIX extension.
1379 useposix=true
1380 : set useopcode=false in your hint file to disable the Opcode extension.
1381 useopcode=true
1382 archname64=''
1383 ccflags_uselargefiles=''
1384 ldflags_uselargefiles=''
1385 libswanted_uselargefiles=''
1386 : set usemultiplicity on the Configure command line to enable multiplicity.
1387 : set usesocks on the Configure command line to enable socks.
1388 : List of libraries we want.
1389 : If anyone needs extra -lxxx, put those in a hint file.
1390 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1391 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1392 : We probably want to search /usr/shlib before most other libraries.
1393 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1394 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1395 glibpth="/usr/shlib $glibpth"
1396 : Do not use vfork unless overridden by a hint file.
1397 usevfork=false
1398
1399 : Find the basic shell for Bourne shell scripts
1400 case "$sh" in
1401 '')
1402         case "$SYSTYPE" in
1403         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1404         *) xxx='/bin/sh';;
1405         esac
1406         if test -f "$xxx"; then
1407                 sh="$xxx"
1408         else
1409                 : Build up a list and do a single loop so we can 'break' out.
1410                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1411                 for xxx in sh bash ksh pdksh ash; do
1412                         for p in $pth; do
1413                                 try="$try ${p}/${xxx}"
1414                         done
1415                 done
1416                 for xxx in $try; do
1417                         if test -f "$xxx"; then
1418                                 sh="$xxx";
1419                                 break
1420                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1421                                 sh="$xxx";
1422                                 break
1423                         elif test -f "$xxx.exe"; then
1424                                 sh="$xxx";
1425                                 break
1426                         fi
1427                 done
1428         fi
1429         ;;
1430 esac
1431
1432 case "$sh" in
1433 '')     cat >&2 <<EOM
1434 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1435
1436 Usually it's in /bin/sh.  How did you even get this far?
1437 Please contact me (Perl Maintainers) at perlbug@perl.org and
1438 we'll try to straighten this all out.
1439 EOM
1440         exit 1
1441         ;;
1442 esac
1443
1444 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1445 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1446 targetsh=$sh
1447
1448 : see if sh knows # comments
1449 if `$sh -c '#' >/dev/null 2>&1`; then
1450         shsharp=true
1451         spitshell=cat
1452         xcat=/bin/cat
1453         test -f $xcat$_exe || xcat=/usr/bin/cat
1454         if test ! -f $xcat$_exe; then
1455                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1456                         if test -f $p/cat$_exe; then
1457                                 xcat=$p/cat
1458                                 break
1459                         fi
1460                 done
1461                 if test ! -f $xcat$_exe; then
1462                         echo "Can't find cat anywhere!"
1463                         exit 1
1464                 fi
1465         fi
1466         echo "#!$xcat" >sharp
1467         $eunicefix sharp
1468         chmod +x sharp
1469         ./sharp > today 2>/dev/null
1470         if test -s today; then
1471                 sharpbang='#!'
1472         else
1473                 echo "#! $xcat" > sharp
1474                 $eunicefix sharp
1475                 chmod +x sharp
1476                 ./sharp > today 2>/dev/null
1477                 if test -s today; then
1478                         sharpbang='#! '
1479                 else
1480                         sharpbang=': use '
1481                 fi
1482         fi
1483 else
1484         echo " "
1485         echo "Your $sh doesn't grok # comments--I will strip them later on."
1486         shsharp=false
1487         cd ..
1488         echo "exec grep -v '^[  ]*#'" >spitshell
1489         chmod +x spitshell
1490         $eunicefix spitshell
1491         spitshell=`pwd`/spitshell
1492         cd UU
1493         echo "I presume that if # doesn't work, #! won't work either!"
1494         sharpbang=': use '
1495 fi
1496 rm -f sharp today
1497
1498 : figure out how to guarantee sh startup
1499 case "$startsh" in
1500 '') startsh=${sharpbang}${sh} ;;
1501 *)
1502 esac
1503 cat >sharp <<EOSS
1504 $startsh
1505 set abc
1506 test "$?abc" != 1
1507 EOSS
1508
1509 chmod +x sharp
1510 $eunicefix sharp
1511 if ./sharp; then
1512         : echo "Yup, it does."
1513 else
1514         echo "Hmm... '$startsh' does not guarantee sh startup..."
1515         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1516 fi
1517 rm -f sharp
1518
1519 : Save command line options in file UU/cmdline.opt for later use in
1520 : generating config.sh.
1521 cat > cmdline.opt <<EOSH
1522 : Configure command line arguments.
1523 config_arg0='$0'
1524 config_args='$*'
1525 config_argc=$#
1526 EOSH
1527 argn=1
1528 args_exp=''
1529 args_sep=''
1530 for arg in "$@"; do
1531         cat >>cmdline.opt <<EOSH
1532 config_arg$argn='$arg'
1533 EOSH
1534         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1535 $arg
1536 EOC
1537         arg_exp=`cat cmdl.opt`
1538         args_exp="$args_exp$args_sep'$arg_exp'"
1539         argn=`expr $argn + 1`
1540         args_sep=' '
1541 done
1542 rm -f cmdl.opt
1543
1544 : produce awk script to parse command line options
1545 cat >options.awk <<'EOF'
1546 BEGIN {
1547         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1548
1549         len = length(optstr);
1550         for (i = 1; i <= len; i++) {
1551                 c = substr(optstr, i, 1);
1552                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1553                 if (a == ":") {
1554                         arg[c] = 1;
1555                         i++;
1556                 }
1557                 opt[c] = 1;
1558         }
1559 }
1560 {
1561         expect = 0;
1562         str = $0;
1563         if (substr(str, 1, 1) != "-") {
1564                 printf("'%s'\n", str);
1565                 next;
1566         }
1567         len = length($0);
1568         for (i = 2; i <= len; i++) {
1569                 c = substr(str, i, 1);
1570                 if (!opt[c]) {
1571                         printf("-%s\n", substr(str, i));
1572                         next;
1573                 }
1574                 printf("-%s\n", c);
1575                 if (arg[c]) {
1576                         if (i < len)
1577                                 printf("'%s'\n", substr(str, i + 1));
1578                         else
1579                                 expect = 1;
1580                         next;
1581                 }
1582         }
1583 }
1584 END {
1585         if (expect)
1586                 print "?";
1587 }
1588 EOF
1589
1590 : process the command line options
1591 set X `for arg in "$@"; do echo "X$arg"; done |
1592         sed -e s/X// | awk -f options.awk`
1593 eval "set $*"
1594 shift
1595 rm -f options.awk
1596
1597 : set up default values
1598 fastread=''
1599 reuseval=false
1600 config_sh=''
1601 alldone=''
1602 error=''
1603 silent=''
1604 extractsh=''
1605 override=''
1606 knowitall=''
1607 rm -f optdef.sh posthint.sh
1608 cat >optdef.sh <<EOS
1609 $startsh
1610 EOS
1611
1612
1613 : option parsing
1614 while test $# -gt 0; do
1615         case "$1" in
1616         -d) shift; fastread=yes;;
1617         -e) shift; alldone=cont;;
1618         -f)
1619                 shift
1620                 cd ..
1621                 if test -r "$1"; then
1622                         config_sh="$1"
1623                 else
1624                         echo "$me: cannot read config file $1." >&2
1625                         error=true
1626                 fi
1627                 cd UU
1628                 shift;;
1629         --help|\
1630         -h) shift; error=true;;
1631         -r) shift; reuseval=true;;
1632         -s) shift; silent=true; realsilent=true;;
1633         -E) shift; alldone=exit;;
1634         -K) shift; knowitall=true;;
1635         -O) shift; override=true;;
1636         -S) shift; silent=true; extractsh=true;;
1637         -D)
1638                 shift
1639                 case "$1" in
1640                 *=)
1641                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1642                         echo "$me: ignoring -D $1" >&2
1643                         ;;
1644                 *=*) echo "$1" | \
1645                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1646                 *) echo "$1='define'" >> optdef.sh;;
1647                 esac
1648                 shift
1649                 ;;
1650         -U)
1651                 shift
1652                 case "$1" in
1653                 *=) echo "$1" >> optdef.sh;;
1654                 *=*)
1655                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1656                         echo "$me: ignoring -U $1" >&2
1657                         ;;
1658                 *) echo "$1='undef'" >> optdef.sh;;
1659                 esac
1660                 shift
1661                 ;;
1662         -A)
1663             shift
1664             xxx=''
1665             yyy="$1"
1666             zzz=''
1667             uuu=undef
1668             case "$yyy" in
1669             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1670                  case "$zzz" in
1671                  *:*) zzz='' ;;
1672                  *)   xxx=append
1673                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1674                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1675                  esac
1676                  ;;
1677             esac
1678             case "$xxx" in
1679             '')  case "$yyy" in
1680                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1681                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1682                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1683                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1684                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1685                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1686                  esac
1687                  ;;
1688             esac
1689             case "$xxx" in
1690             append)
1691                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1692             clear)
1693                 echo "$yyy=''"                  >> posthint.sh ;;
1694             define)
1695                 case "$zzz" in
1696                 '') zzz=define ;;
1697                 esac
1698                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1699             eval)
1700                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1701             prepend)
1702                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1703             undef)
1704                 case "$zzz" in
1705                 '') zzz="$uuu" ;;
1706                 esac
1707                 echo "$yyy=$zzz"                >> posthint.sh ;;
1708             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1709             esac
1710             shift
1711             ;;
1712         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1713             exit 0;;
1714         --) break;;
1715         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1716         *) break;;
1717         esac
1718 done
1719
1720 case "$error" in
1721 true)
1722         cat >&2 <<EOM
1723 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1724                  [-U symbol] [-U symbol=] [-A command:symbol...]
1725   -d : use defaults for all answers.
1726   -e : go on without questioning past the production of config.sh.
1727   -f : specify an alternate default configuration file.
1728   -h : print this help message and exit (with an error status).
1729   -r : reuse C symbols value if possible (skips costly nm extraction).
1730   -s : silent mode, only echoes questions and essential information.
1731   -D : define symbol to have some value:
1732          -D symbol         symbol gets the value 'define'
1733          -D symbol=value   symbol gets the value 'value'
1734        common used examples (see INSTALL for more info):
1735          -Duse64bitint            use 64bit integers
1736          -Duse64bitall            use 64bit integers and pointers
1737          -Dusethreads             use thread support
1738          -Dinc_version_list=none  do not include older perl trees in @INC
1739          -DEBUGGING=none          DEBUGGING options
1740          -Dcc=gcc                 choose your compiler
1741          -Dprefix=/opt/perl5      choose your destination
1742   -E : stop at the end of questions, after having produced config.sh.
1743   -K : do not use unless you know what you are doing.
1744   -O : let -D and -U override definitions from loaded configuration file.
1745   -S : perform variable substitutions on all .SH files (can mix with -f)
1746   -U : undefine symbol:
1747          -U symbol    symbol gets the value 'undef'
1748          -U symbol=   symbol gets completely empty
1749        e.g.:  -Uversiononly
1750   -A : manipulate symbol after the platform specific hints have been applied:
1751          -A append:symbol=value   append value to symbol
1752          -A symbol=value          like append:, but with a separating space
1753          -A define:symbol=value   define symbol to have value
1754          -A clear:symbol          define symbol to be ''
1755          -A define:symbol         define symbol to be 'define'
1756          -A eval:symbol=value     define symbol to be eval of value
1757          -A prepend:symbol=value  prepend value to symbol
1758          -A undef:symbol          define symbol to be 'undef'
1759          -A undef:symbol=         define symbol to be ''
1760        e.g.:  -A prepend:libswanted='cl pthread '
1761               -A ccflags=-DSOME_MACRO
1762   -V : print version number and exit (with a zero status).
1763 EOM
1764         exit 1
1765         ;;
1766 esac
1767
1768 : Sanity checks
1769 case "$fastread$alldone" in
1770 yescont|yesexit) ;;
1771 *)
1772         case "$extractsh" in
1773         true) ;;
1774         *)
1775                 if test ! -t 0; then
1776                         echo "Say 'sh Configure', not 'sh <Configure'"
1777                         exit 1
1778                 fi
1779                 ;;
1780         esac
1781         ;;
1782 esac
1783
1784 exec 4>&1
1785 case "$silent" in
1786 true) exec 1>/dev/null;;
1787 esac
1788
1789 : run the defines and the undefines, if any, but leave the file out there...
1790 touch optdef.sh
1791 . ./optdef.sh
1792 : create the posthint manipulation script and leave the file out there...
1793 touch posthint.sh
1794
1795 : set package name
1796 package='perl5'
1797 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1798 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1799 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1800 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1801 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1802 esac
1803
1804 : Some greps do not return status, grrr.
1805 echo "grimblepritz" >grimble
1806 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1807         contains=contains
1808 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1809         contains=grep
1810 else
1811         contains=contains
1812 fi
1813 rm -f grimble
1814 : the following should work in any shell
1815 case "$contains" in
1816 contains*)
1817         echo " "
1818         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1819         cat >contains <<'EOSS'
1820 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1821 EOSS
1822 chmod +x contains
1823 esac
1824
1825 : Find the path to the source tree
1826 case "$src" in
1827 '') case "$0" in
1828     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1829          case "$src" in
1830          /*)    ;;
1831          .)     ;;
1832          *)     src=`cd ../$src && pwd` ;;
1833          esac
1834          ;;
1835     *)   src='.';;
1836     esac;;
1837 esac
1838 case "$src" in
1839 '')     src=/
1840         rsrc=/
1841         ;;
1842 /*)     rsrc="$src";;
1843 *)      rsrc="../$src";;
1844 esac
1845 if test -f $rsrc/Configure && \
1846         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1847 then
1848    : found it, so we are ok.
1849 else
1850         rsrc=''
1851         for src in . .. ../.. ../../.. ../../../..; do
1852                 if test -f ../$src/Configure && \
1853                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1854                 then
1855                         rsrc=../$src
1856                         break
1857                 fi
1858         done
1859 fi
1860 case "$rsrc" in
1861 '')
1862         cat <<EOM >&4
1863
1864 Sorry, I can't seem to locate the source dir for $package.  Please start
1865 Configure with an explicit path -- i.e. /some/path/Configure.
1866
1867 EOM
1868         exit 1
1869         ;;
1870 ../.)   rsrc='..';;
1871 *)
1872         echo " "
1873         echo "Sources for $package found in \"$src\"." >&4
1874         ;;
1875 esac
1876
1877 : script used to extract .SH files with variable substitutions
1878 cat >extract <<'EOS'
1879 PERL_CONFIG_SH=true
1880 echo "Doing variable substitutions on .SH files..."
1881 if test -f MANIFEST; then
1882         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1883 else
1884         echo "(Looking for .SH files under the source directory.)"
1885         set x `(cd "$src"; find . -name "*.SH" -print)`
1886 fi
1887 shift
1888 case $# in
1889 0) set x `(cd "$src"; echo *.SH)`; shift;;
1890 esac
1891 if test ! -f "$src/$1"; then
1892         shift
1893 fi
1894 mkdir_p='
1895 name=$1;
1896 create="";
1897 while test $name; do
1898         if test ! -d "$name"; then
1899                 create="$name $create";
1900                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1901                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1902         else
1903                 name="";
1904         fi;
1905 done;
1906 for file in $create; do
1907         mkdir $file;
1908 done
1909 '
1910 for file in $*; do
1911         case "$src" in
1912         ".")
1913                 case "$file" in
1914                 */*)
1915                         dir=`expr X$file : 'X\(.*\)/'`
1916                         file=`expr X$file : 'X.*/\(.*\)'`
1917                         (cd "$dir" && . ./$file)
1918                         ;;
1919                 *)
1920                         . ./$file
1921                         ;;
1922                 esac
1923                 ;;
1924         *)
1925                 case "$file" in
1926                 */*)
1927                         dir=`expr X$file : 'X\(.*\)/'`
1928                         file=`expr X$file : 'X.*/\(.*\)'`
1929                         (set x $dir; shift; eval $mkdir_p)
1930                         sh <"$src/$dir/$file"
1931                         ;;
1932                 *)
1933                         sh <"$src/$file"
1934                         ;;
1935                 esac
1936                 ;;
1937         esac
1938 done
1939 if test -f "$src/config_h.SH"; then
1940         if test ! -f config.h; then
1941         : oops, they left it out of MANIFEST, probably, so do it anyway.
1942         . "$src/config_h.SH"
1943         fi
1944 fi
1945 EOS
1946
1947 : extract files and exit if asked to do so
1948 case "$extractsh" in
1949 true)
1950         case "$realsilent" in
1951         true) ;;
1952         *) exec 1>&4;;
1953         esac
1954         case "$config_sh" in
1955         '') config_sh='config.sh';;
1956         esac
1957         echo " "
1958         echo "Fetching answers from $config_sh..."
1959         cd ..
1960         . $config_sh
1961         test "$override" && . ./optdef.sh
1962         echo " "
1963         . UU/extract
1964         rm -rf UU
1965         echo "Extraction done."
1966         exit 0
1967         ;;
1968 esac
1969
1970 : Eunice requires " " instead of "", can you believe it
1971 echo " "
1972 : Here we go...
1973 echo "Beginning of configuration questions for $package."
1974
1975 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1976
1977 : first determine how to suppress newline on echo command
1978 echo " "
1979 echo "Checking echo to see how to suppress newlines..."
1980 (echo "hi there\c" ; echo " ") >.echotmp
1981 if $contains c .echotmp >/dev/null 2>&1 ; then
1982         echo "...using -n."
1983         n='-n'
1984         c=''
1985 else
1986         cat <<'EOM'
1987 ...using \c
1988 EOM
1989         n=''
1990         c='\c'
1991 fi
1992 echo $n "The star should be here-->$c"
1993 echo '*'
1994 rm -f .echotmp
1995
1996 : Now test for existence of everything in MANIFEST
1997 echo " "
1998 if test -f "$rsrc/MANIFEST"; then
1999         echo "First let's make sure your kit is complete.  Checking..." >&4
2000         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2001                 (split -l 50 2>/dev/null || split -50)
2002         rm -f missing
2003         tmppwd=`pwd`
2004         for filelist in x??; do
2005                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2006                         >/dev/null 2>>"$tmppwd/missing")
2007         done
2008         if test -s missing; then
2009                 cat missing >&4
2010                 cat >&4 <<'EOM'
2011
2012 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2013
2014 You have the option of continuing the configuration process, despite the
2015 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2016 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2017 and contact the author (perlbug@perl.org).
2018
2019 EOM
2020                 echo $n "Continue? [n] $c" >&4
2021                 read ans
2022                 case "$ans" in
2023                 y*)
2024                         echo "Continuing..." >&4
2025                         rm -f missing
2026                         ;;
2027                 *)
2028                         echo "ABORTING..." >&4
2029                         kill $$
2030                         ;;
2031                 esac
2032         else
2033                 echo "Looks good..."
2034         fi
2035 else
2036         echo "There is no MANIFEST file.  I hope your kit is complete !"
2037 fi
2038 rm -f missing x??
2039
2040 : Find the appropriate value for a newline for tr
2041 echo " "
2042 if test -n "$DJGPP"; then
2043        trnl='\012'
2044 fi
2045 if test X"$trnl" = X; then
2046         case "`echo foo|tr '\n' x 2>/dev/null`" in
2047         foox) trnl='\n' ;;
2048         esac
2049 fi
2050 if test X"$trnl" = X; then
2051         case "`echo foo|tr '\012' x 2>/dev/null`" in
2052         foox) trnl='\012' ;;
2053         esac
2054 fi
2055 if test X"$trnl" = X; then
2056        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2057        fooxy) trnl='\n\r' ;;
2058        esac
2059 fi
2060 if test X"$trnl" = X; then
2061         cat <<EOM >&2
2062
2063 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2064
2065 EOM
2066         exit 1
2067 fi
2068
2069 : compute the number of columns on the terminal for proper question formatting
2070 case "$COLUMNS" in
2071 '') COLUMNS='80';;
2072 esac
2073
2074 : set up the echo used in my read
2075 myecho="case \"\$xxxm\" in
2076 '') echo $n \"\$rp $c\" >&4;;
2077 *) case \"\$rp\" in
2078         '') echo $n \"[\$xxxm] $c\";;
2079         *)
2080                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2081                         echo \"\$rp\" >&4
2082                         echo $n \"[\$xxxm] $c\" >&4
2083                 else
2084                         echo $n \"\$rp [\$xxxm] $c\" >&4
2085                 fi
2086                 ;;
2087         esac;;
2088 esac"
2089
2090 : now set up to do reads with possible shell escape and default assignment
2091 cat <<EOSC >myread
2092 $startsh
2093 xxxm=\$dflt
2094 $myecho
2095 ans='!'
2096 case "\$fastread" in
2097 yes) case "\$dflt" in
2098         '') ;;
2099         *) ans='';
2100                 case "\$silent-\$rp" in
2101                 true-) ;;
2102                 *) echo " " >&4;;
2103                 esac;;
2104         esac;;
2105 *) case "\$silent" in
2106         true) case "\$rp" in
2107                 '') ans='';;
2108                 esac;;
2109         esac;;
2110 esac
2111 while expr "X\$ans" : "X!" >/dev/null; do
2112         read answ
2113         set x \$xxxm
2114         shift
2115         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2116         case  "\$answ" in
2117         "!")
2118                 sh 1>&4
2119                 echo " "
2120                 $myecho
2121                 ;;
2122         !*)
2123                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2124                 shift
2125                 sh 1>&4 -c "\$*"
2126                 echo " "
2127                 $myecho
2128                 ;;
2129         "\$ans")
2130                 case "\$ans" in
2131                 \\&*)
2132                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2133                         shift
2134                         case "\$1" in
2135                         -d)
2136                                 fastread=yes
2137                                 echo "(OK, I'll run with -d after this question.)" >&4
2138                                 ;;
2139                         -*)
2140                                 echo "*** Sorry, \$1 not supported yet." >&4
2141                                 ;;
2142                         esac
2143                         $myecho
2144                         ans=!
2145                         ;;
2146                 esac;;
2147         *)
2148                 case "\$aok" in
2149                 y)
2150                         echo "*** Substitution done -- please confirm."
2151                         xxxm="\$ans"
2152                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2153                         xxxm="\$ans"
2154                         ans=!
2155                         ;;
2156                 *)
2157                         echo "*** Error -- try again."
2158                         ans=!
2159                         ;;
2160                 esac
2161                 $myecho
2162                 ;;
2163         esac
2164         case "\$ans\$xxxm\$nostick" in
2165         '')
2166                 ans=!
2167                 $myecho
2168                 ;;
2169         esac
2170 done
2171 case "\$ans" in
2172 '') ans="\$xxxm";;
2173 esac
2174 EOSC
2175
2176 : create .config dir to save info across Configure sessions
2177 test -d ../.config || mkdir ../.config
2178 cat >../.config/README <<EOF
2179 This directory created by Configure to save information that should
2180 persist across sessions for $package.
2181
2182 You may safely delete it if you wish.
2183 EOF
2184
2185 : See if we are using a devel version and want that
2186 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2187 case "$usedevel" in
2188 $define|true|[yY]*)
2189     usedevel="$define" ;;
2190 *) case "$xversion" in
2191    *[13579])
2192         cat >&4 <<EOH
2193 *** WHOA THERE!!! ***
2194
2195     This is an UNSTABLE DEVELOPMENT release.
2196     The version of this $package distribution is $xversion, that is, odd,
2197     (as opposed to even) and that signifies a development release.
2198     If you want a maintenance release, you want an even-numbered version.
2199
2200     Do ***NOT*** install this into production use.
2201     Data corruption and crashes are possible.
2202
2203     It is most seriously suggested that you do not continue any further
2204     unless you want to help in developing and debugging Perl.
2205
2206     If you *still* want to build perl, you can answer 'y' now,
2207     or pass -Dusedevel to Configure.
2208
2209 EOH
2210         rp='Do you really want to continue?'
2211         dflt='n'
2212         . ./myread
2213         case "$ans" in
2214         [yY]) echo >&4 "Okay, continuing."
2215               usedevel="$define" ;;
2216         *) echo >&4 "Okay, bye."
2217            exit 1
2218            ;;
2219         esac
2220         ;;
2221     esac
2222     usedevel="$undef"
2223     ;;
2224 esac
2225 case "$usedevel" in
2226 $define|true|[yY]*)
2227         case "$versiononly" in
2228         '') versiononly="$define" ;;
2229         esac
2230         case "$installusrbinperl" in
2231         '') installusrbinperl="$undef" ;;
2232         esac
2233         ;;
2234 esac
2235
2236 : general instructions
2237 needman=true
2238 firsttime=true
2239 user=`(logname) 2>/dev/null`
2240 case "$user" in
2241 '') user=`whoami 2>&1`;;
2242 esac
2243 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2244         firsttime=false
2245         echo " "
2246         rp='Would you like to see the instructions?'
2247         dflt=n
2248         . ./myread
2249         case "$ans" in
2250         [yY]*) ;;
2251         *) needman=false;;
2252         esac
2253 fi
2254 if $needman; then
2255         cat <<EOH
2256
2257 This installation shell script will examine your system and ask you questions
2258 to determine how the perl5 package should be installed. If you get
2259 stuck on a question, you may use a ! shell escape to start a subshell or
2260 execute a command.  Many of the questions will have default answers in square
2261 brackets; typing carriage return will give you the default.
2262
2263 On some of the questions which ask for file or directory names you are allowed
2264 to use the ~name construct to specify the login directory belonging to "name",
2265 even if you don't have a shell which knows about that.  Questions where this is
2266 allowed will be marked "(~name ok)".
2267
2268 EOH
2269         rp=''
2270         dflt='Type carriage return to continue'
2271         . ./myread
2272         cat <<'EOH'
2273
2274 The prompter used in this script allows you to use shell variables and
2275 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2276 in the default answer, as if the default line was a set of arguments given to a
2277 script shell.  This means you may also use $* to repeat the whole default line,
2278 so you do not have to re-type everything to add something to the default.
2279
2280 Every time there is a substitution, you will have to confirm.  If there is an
2281 error (e.g. an unmatched backtick), the default answer will remain unchanged
2282 and you will be prompted again.
2283
2284 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2285 the questions and use the computed defaults (or the previous answers if there
2286 was already a config.sh file). Type 'Configure -h' for a list of options.
2287 You may also start interactively and then answer '& -d' at any prompt to turn
2288 on the non-interactive behaviour for the remainder of the execution.
2289
2290 EOH
2291         . ./myread
2292         cat <<EOH
2293
2294 Much effort has been expended to ensure that this shell script will run on any
2295 Unix system.  If despite that it blows up on yours, your best bet is to edit
2296 Configure and run it again.  If you can't run Configure for some reason,
2297 you'll have to generate a config.sh file by hand.  Whatever problems you
2298 have, let me (perlbug@perl.org) know how I blew it.
2299
2300 This installation script affects things in two ways:
2301
2302 1) it may do direct variable substitutions on some of the files included
2303    in this kit.
2304 2) it builds a config.h file for inclusion in C programs.  You may edit
2305    any of these files as the need arises after running this script.
2306
2307 If you make a mistake on a question, there is no easy way to back up to it
2308 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2309 files.  Configure will offer to let you do this before it runs the SH files.
2310
2311 EOH
2312         dflt='Type carriage return to continue'
2313         . ./myread
2314         case "$firsttime" in
2315         true) echo $user >>../.config/instruct;;
2316         esac
2317 fi
2318
2319 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2320 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2321 if test "X$sysroot" = X; then
2322     sysroot=""
2323 else
2324     case "$cc" in
2325         *gcc*|*g++*)
2326             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2327             # _sysroot is used in places where we need --sysroot=foo
2328             # but using the rest of the flags could cause issues.
2329             _sysroot="--sysroot=$sysroot";
2330             case "$ccflags" in
2331                 *sysroot*) ;;
2332                 'undef'|*)
2333                 ccflags="$ccflags $_sysroot"
2334             esac
2335             case "$ldflags" in
2336                 *sysroot*) ;;
2337                 'undef'|*)
2338                 ldflags="$ldflags $_sysroot"
2339             esac
2340             case "$cppflags" in
2341                 *sysroot*) ;;
2342                 'undef'|*)
2343                 cppflags="$cppflags $_sysroot"
2344             esac
2345             # lddlflags updated below in lddlflags section;
2346             # same with cccdlflags
2347             ;;
2348     esac
2349
2350     # Adjust some defaults to also use $sysroot
2351     for var in xlibpth loclibpth locincpth glibpth; do
2352         eval xxx=\$$var
2353         eval $var=''
2354         for path in $xxx; do
2355             eval $var=\"\$$var $sysroot$path\"
2356         done
2357     done
2358
2359 fi
2360
2361 : find out where common programs are
2362 echo " "
2363 echo "Locating common programs..." >&4
2364 cat <<EOSC >loc
2365 $startsh
2366 case \$# in
2367 0) exit 1;;
2368 esac
2369 thing=\$1
2370 shift
2371 dflt=\$1
2372 shift
2373 for dir in \$*; do
2374         case "\$thing" in
2375         .)
2376         if test -d \$dir/\$thing; then
2377                 echo \$dir
2378                 exit 0
2379         fi
2380         ;;
2381         *)
2382         for thisthing in \$dir/\$thing; do
2383                 : just loop through to pick last item
2384         done
2385         if test -f \$thisthing; then
2386                 echo \$thisthing
2387                 exit 0
2388         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2389                 echo \$thisthing
2390                 exit 0
2391         elif test -f \$dir/\$thing.exe; then
2392                 if test -n "$DJGPP"; then
2393                         echo \$dir/\$thing.exe
2394                 elif test "$eunicefix" != ":"; then
2395                         : on Eunice apparently
2396                         echo \$dir/\$thing
2397                 fi
2398                 exit 0
2399         fi
2400         ;;
2401         esac
2402 done
2403 echo \$dflt
2404 exit 1
2405 EOSC
2406 chmod +x loc
2407 $eunicefix loc
2408 loclist="
2409 awk
2410 cat
2411 chmod
2412 comm
2413 cp
2414 echo
2415 expr
2416 grep
2417 ls
2418 mkdir
2419 rm
2420 sed
2421 sort
2422 touch
2423 tr
2424 uniq
2425 "
2426 trylist="
2427 ar
2428 bison
2429 byacc
2430 cpp
2431 csh
2432 date
2433 egrep
2434 gmake
2435 gzip
2436 less
2437 ln
2438 make
2439 more
2440 nm
2441 nroff
2442 perl
2443 pg
2444 test
2445 uname
2446 zip
2447 "
2448 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2449 pth="$pth $sysroot/lib $sysroot/usr/lib"
2450 for file in $loclist; do
2451         eval xxx=\$$file
2452         case "$xxx" in
2453         /*|?:[\\/]*)
2454                 if test -f "$xxx"; then
2455                         : ok
2456                 else
2457                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2458                         xxx=`./loc $file $file $pth`
2459                 fi
2460                 ;;
2461         '') xxx=`./loc $file $file $pth`;;
2462         *) xxx=`./loc $xxx $xxx $pth`;;
2463         esac
2464         eval $file=$xxx$_exe
2465         eval _$file=$xxx
2466         case "$xxx" in
2467         /*)
2468                 echo $file is in $xxx.
2469                 ;;
2470         ?:[\\/]*)
2471                 echo $file is in $xxx.
2472                 ;;
2473         *)
2474                 echo "I don't know where '$file' is, and my life depends on it." >&4
2475                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2476                 exit 1
2477                 ;;
2478         esac
2479 done
2480 echo " "
2481 echo "Don't worry if any of the following aren't found..."
2482 say=offhand
2483 for file in $trylist; do
2484         eval xxx=\$$file
2485         case "$xxx" in
2486         /*|?:[\\/]*)
2487                 if test -f "$xxx"; then
2488                         : ok
2489                 else
2490                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2491                         xxx=`./loc $file $file $pth`
2492                 fi
2493                 ;;
2494         '') xxx=`./loc $file $file $pth`;;
2495         *) xxx=`./loc $xxx $xxx $pth`;;
2496         esac
2497         eval $file=$xxx$_exe
2498         eval _$file=$xxx
2499         case "$xxx" in
2500         /*)
2501                 echo $file is in $xxx.
2502                 ;;
2503         ?:[\\/]*)
2504                 echo $file is in $xxx.
2505                 ;;
2506         *)
2507                 echo "I don't see $file out there, $say."
2508                 say=either
2509                 ;;
2510         esac
2511 done
2512 case "$egrep" in
2513 egrep)
2514         echo "Substituting grep for egrep."
2515         egrep=$grep
2516         _egrep=$grep
2517         ;;
2518 esac
2519 case "$less" in
2520 '')     ;;
2521 *)      if $less -R </dev/null >/dev/null; then
2522                echo "Substituting less -R for less."
2523                less="$less -R"
2524                _less=$less
2525         fi
2526         ;;
2527 esac
2528 case "$ln" in
2529 ln)
2530         echo "Substituting cp for ln."
2531         ln=$cp
2532         _ln=$cp
2533         ;;
2534 esac
2535 case "$make" in
2536 make)
2537         case "$gmake" in
2538         gmake)
2539         echo "I can't find make or gmake, and my life depends on it." >&4
2540         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2541         exit 1
2542         ;;
2543         esac
2544         ;;
2545 esac
2546 case "$gmake" in
2547 gmake)  ;;
2548 *)      # We can't have osname yet.
2549         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2550                 # Assume that gmake, if found, is definitely GNU make
2551                 # and prefer it over the system make.
2552                 echo "Substituting gmake for make."
2553                 make=$gmake
2554                 _make=$gmake
2555         fi
2556         ;;
2557 esac
2558 case "$test" in
2559 test)
2560         echo "Hopefully test is built into your sh."
2561         ;;
2562 *)
2563         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2564                 echo "Using the test built into your sh."
2565                 test=test
2566                 _test=test
2567         fi
2568         ;;
2569 esac
2570 case "$echo" in
2571 echo)
2572         echo "Hopefully echo is built into your sh."
2573         ;;
2574 '') ;;
2575 *)
2576         echo " "
2577 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2578         $echo $n "hi there$c" >foo1
2579         echo $n "hi there$c" >foo2
2580         if cmp foo1 foo2 >/dev/null 2>&1; then
2581                 echo "They are compatible.  In fact, they may be identical."
2582         else
2583                 case "$n" in
2584                 '-n') n='' c='\c';;
2585                 *) n='-n' c='';;
2586                 esac
2587                 cat <<FOO
2588 They are not compatible!  You are probably running ksh on a non-USG system.
2589 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2590 have echo built in and we may have to run some Bourne shell scripts.  That
2591 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2592
2593 FOO
2594                 $echo $n "The star should be here-->$c"
2595                 $echo "*"
2596         fi
2597         $rm -f foo1 foo2
2598         ;;
2599 esac
2600
2601 # This question was auctioned at YAPC::Europe-2007 in Vienna
2602 # I never promised you could answer it. I only auctioned the question.
2603 cat <<FOO
2604 The following message is sponsored by
2605
2606   Dresden.pm<--The stars should be here.
2607
2608 Dear Perl user, system administrator or package
2609 maintainer, the Perl community sends greetings to
2610 you. Do you (emblematical) greet back [Y/n]? n
2611
2612 FOO
2613
2614 : Check what type of C compiler we use
2615 cat <<EOS >trygcc
2616 $startsh
2617 EOS
2618 cat <<'EOSC' >>trygcc
2619 case "$cc" in
2620 '') ;;
2621 *)  $rm -f try try.*
2622     $cat >try.c <<EOM
2623 int main(int argc, char *argv[]) {
2624   return 0;
2625 }
2626 EOM
2627     if $cc -o try $ccflags $ldflags try.c; then
2628        :
2629     else
2630         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2631         despair=yes
2632         trygcc=yes
2633         case "$cc" in
2634         *gcc*) trygcc=no ;;
2635         esac
2636         # Skip this test because it gives a false match on output like:
2637         #    ./trygcc: line 23: cc: command not found
2638         # case "`$cc -v -c try.c 2>&1`" in
2639         # *gcc*) trygcc=no ;;
2640         # esac
2641         if $test X"$trygcc" = Xyes; then
2642             if gcc -o try -c try.c; then
2643                 echo " "
2644                 echo "You seem to have a working gcc, though." >&4
2645                 # Switching compilers may undo the work of hints files.
2646                 # The most common problem is -D_REENTRANT for threads.
2647                 # This heuristic catches that case, but gets false positives
2648                 # if -Dusethreads was not actually specified.  Better to
2649                 # bail out here with a useful message than fail 
2650                 # mysteriously later. Should we perhaps just try to
2651                 # re-invoke Configure -Dcc=gcc config_args ?
2652                 if $test -f usethreads.cbu; then
2653                         $cat >&4 <<EOM 
2654
2655 *** However, any setting of the C compiler flags (e.g. for thread support)
2656 *** will be lost.  It may be necessary for you to restart Configure and
2657 *** add -Dcc=gcc to your Configure command line.
2658
2659 EOM
2660                         rp="Would you like to go ahead and try gcc anyway?"
2661                         dflt=n
2662                 else
2663                         rp="Would you like to use it?"
2664                         dflt=y
2665                 fi
2666                 if $test -f myread; then
2667                     . ./myread
2668                 else
2669                     if $test -f UU/myread; then
2670                         . ./UU/myread
2671                     else
2672                         echo "Cannot find myread, sorry.  Aborting." >&2
2673                         exit 1
2674                     fi
2675                 fi  
2676                 case "$ans" in
2677                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2678                 esac
2679             fi
2680         fi
2681     fi
2682     $rm -f try try.*
2683     ;;
2684 esac
2685 EOSC
2686
2687 cat <<EOS >checkcc
2688 $startsh
2689 EOS
2690 cat <<'EOSC' >>checkcc
2691 case "$cc" in        
2692 '') ;;
2693 *)  $rm -f try try.*              
2694     $cat >try.c <<EOM
2695 int main(int argc, char *argv[]) {
2696   return 0;
2697 }
2698 EOM
2699     if $cc -o try $ccflags $ldflags try.c; then
2700        :
2701     else
2702         if $test X"$despair" = Xyes; then
2703            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2704         fi
2705         $cat >&4 <<EOM         
2706 You need to find a working C compiler.
2707 Either (purchase and) install the C compiler supplied by your OS vendor,
2708 or for a free C compiler try http://gcc.gnu.org/
2709 I cannot continue any further, aborting.
2710 EOM
2711         exit 1
2712     fi
2713     $rm -f try try.*
2714     ;;
2715 esac
2716 EOSC
2717
2718 : determine whether symbolic links are supported
2719 echo " "
2720 $touch blurfl
2721 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2722         echo "Symbolic links are supported." >&4
2723         lns="$ln -s"
2724 else
2725         echo "Symbolic links are NOT supported." >&4
2726         lns="$ln"
2727 fi
2728 $rm -f blurfl sym
2729
2730 : determine whether symbolic links are supported
2731 echo " "
2732 case "$lns" in
2733 *"ln"*" -s")
2734         echo "Checking how to test for symbolic links..." >&4
2735         $lns blurfl sym
2736         if $test "X$issymlink" = X; then
2737                 case "$newsh" in
2738                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2739                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2740                 esac
2741                 if test $? = 0; then
2742                         issymlink="test -h"
2743                 else
2744                         echo "Your builtin 'test -h' may be broken." >&4
2745                         case "$test" in
2746                         /*)     ;;
2747                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2748                                 for p in $pth
2749                                 do
2750                                         if test -f "$p/$test"; then
2751                                                 test="$p/$test"
2752                                                 break
2753                                         fi
2754                                 done
2755                                 ;;
2756                         esac
2757                         case "$test" in
2758                         /*)
2759                                 echo "Trying external '$test -h'." >&4
2760                                 issymlink="$test -h"
2761                                 if $test ! -h sym >/dev/null 2>&1; then
2762                                         echo "External '$test -h' is broken, too." >&4
2763                                         issymlink=''
2764                                 fi
2765                                 ;;
2766                         *)      issymlink='' ;;
2767                         esac
2768                 fi
2769         fi
2770         if $test "X$issymlink" = X; then
2771                 if $test -L sym 2>/dev/null; then
2772                         issymlink="$test -L"
2773                         echo "The builtin '$test -L' worked." >&4
2774                 fi
2775         fi
2776         if $test "X$issymlink" != X; then
2777                 echo "You can test for symbolic links with '$issymlink'." >&4
2778         else
2779                 echo "I do not know how you can test for symbolic links." >&4
2780         fi
2781         $rm -f blurfl sym
2782         ;;
2783 *)      echo "No symbolic links, so not testing for their testing..." >&4
2784         ;;
2785 esac
2786 echo " "
2787
2788 : Make symlinks util
2789 case "$mksymlinks" in
2790 $define|true|[yY]*)
2791         case "$src" in
2792         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2793                 exit 1
2794                 ;;
2795         *)      case "$lns:$issymlink" in
2796                 *"ln"*" -s:"*"test -"?)
2797                         echo "Creating the symbolic links..." >&4
2798                         echo "(First creating the subdirectories...)" >&4
2799                         cd ..
2800                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2801                                 read directory
2802                                 test -z "$directory" && break
2803                                 mkdir -p $directory
2804                         done
2805                         # Sanity check 1.
2806                         if test ! -d t/base; then
2807                                 echo "Failed to create the subdirectories.  Aborting." >&4
2808                                 exit 1
2809                         fi
2810                         echo "(Then creating the symlinks...)" >&4
2811                         awk '{print $1}' $src/MANIFEST | while true; do
2812                                 read filename
2813                                 test -z "$filename" && break
2814                                 if test -f $filename; then
2815                                         if $issymlink $filename; then
2816                                                 rm -f $filename
2817                                         fi
2818                                 fi
2819                                 if test -f $filename; then
2820                                         echo "$filename already exists, not symlinking."
2821                                 else
2822                                         ln -s $src/$filename $filename
2823                                 fi
2824                         done
2825                         # Sanity check 2.
2826                         if test ! -f t/base/lex.t; then
2827                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2828                                 exit 1
2829                         fi
2830                         cd UU
2831                         ;;
2832                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2833                         ;;
2834                 esac
2835                 ;;
2836         esac
2837         ;;
2838 esac
2839
2840 : Check for Cross-Compilation
2841 if $test "X$targethost" = "X"; then
2842     targethost=""
2843 fi
2844 if $test "X$targetenv" = "X"; then
2845     targetenv=""
2846 fi
2847 case "$usecrosscompile" in
2848 $define|true|[yY]*)
2849         $echo "Cross-compiling..."
2850         croak=''
2851         case "$cc" in
2852         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2853             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2854             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2855             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2856             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2857             # leave out ld, choosing it is more complex
2858             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2859             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2860             # We are in a weird spot. Just before us, some values
2861             # were 'saved', to be restored after the hints are
2862             # run.  This means that the changes we made to ar,
2863             # nm and ranlib will get reverted.
2864             # To avoid that, we hijack the saving mechanism and
2865             # have it save our new values.
2866             for file in ar nm ranlib; do
2867                 eval xxx=\$$file
2868                 eval $file=$xxx$_exe
2869                 eval _$file=$xxx
2870             done
2871         ;;
2872         esac
2873         case "$targetarch" in
2874         '') echo "Targetarch not defined." >&4; croak=y ;;
2875         *)  echo "Using targetarch $targetarch." >&4 ;;
2876         esac
2877         case "$targethost" in
2878         '') echo "Targethost not defined." >&4; croak=y ;;
2879         *)  echo "Using targethost $targethost." >&4
2880         esac
2881         locincpth=' '
2882         loclibpth=' '
2883         case "$croak" in
2884         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2885         esac
2886     : compile a host miniperl and generate_uudmap, unless we got passed them
2887     if $test "X$hostperl" = X; then
2888       echo "Building host miniperl and generate_uudmap binaries" >&4
2889       before_host=`pwd`
2890       cd ..
2891       cd $src
2892       src=`pwd`
2893       rm -rf $src/host
2894       mkdir $src/host
2895       cd $src/host
2896       $src/Configure -des -Dusedevel -Dmksymlinks
2897       $make miniperl
2898       case "$hostgenerate" in
2899       '') $make generate_uudmap
2900           hostgenerate=$src/host/generate_uudmap
2901           ;;
2902        "$undef") hostgenerate=''
2903           ;;
2904       esac
2905       hostperl=$src/host/miniperl
2906       cd $before_host
2907     fi
2908     hostosname=`$hostperl -le 'print $^O'`
2909     ;;
2910 *)
2911     usecrosscompile="$undef"
2912     ;;
2913 esac
2914
2915 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2916 case "$targethost" in
2917     '') echo "Checking for cross-compile" >&4
2918     case "$usecrosscompile$multiarch" in
2919        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2920          if [ -f Makefile ]; then
2921            echo " "
2922            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2923          else
2924            echo "Configure done."
2925          fi
2926        exit 0
2927        ;;
2928      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2929         run=''
2930         to=:
2931         from=:
2932         ;;
2933     esac
2934     ;;
2935     *) echo "Using targethost $targethost." >&4
2936         case "$src" in
2937         /*) run=$src/Cross/run
2938             targetmkdir=$src/Cross/mkdir
2939             to=$src/Cross/to
2940             from=$src/Cross/from
2941             ;;
2942         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2943             run=$pwd/Cross/run
2944             targetmkdir=$pwd/Cross/mkdir
2945             to=$pwd/Cross/to
2946             from=$pwd/Cross/from
2947             ;;
2948         esac
2949         case "$targetrun" in
2950         '') targetrun=ssh ;;
2951         esac
2952         case "$targetto" in
2953         '') targetto=scp ;;
2954         esac
2955         case "$targetfrom" in
2956         '') targetfrom=scp ;;
2957         esac
2958         run=$run-$targetrun
2959         to=$to-$targetto
2960         from=$from-$targetfrom
2961         case "$targetdir" in
2962         '')  targetdir=/tmp
2963              echo "Guessing targetdir $targetdir." >&4
2964              ;;
2965         esac
2966         case "$targetuser" in
2967         '')  targetuser=root
2968              echo "Guessing targetuser $targetuser." >&4
2969              ;;
2970         esac
2971         case "$targetport" in
2972         '')  targetport=22
2973              echo "Guessing targetport $targetport." >&4
2974              ;;
2975         esac
2976         case "$targetfrom" in
2977         scp)    q=-q ;;
2978         *)      q='' ;;
2979         esac
2980         case "$targetrun" in
2981         ssh|rsh)
2982             cat >$run <<EOF
2983 #!/bin/sh
2984 env=''
2985 case "\$1" in
2986 -cwd)
2987   shift
2988   cwd=\$1
2989   shift
2990   ;;
2991 esac
2992 case "\$1" in
2993 -env)
2994   shift
2995   env=\$1
2996   shift
2997   ;;
2998 esac
2999 case "\$cwd" in
3000 '') cwd=$targetdir ;;
3001 esac
3002 exe=\$1
3003 shift
3004 $to \$exe
3005 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3006 EOF
3007             ;;
3008         adb)
3009             $touch $run
3010             ;;
3011         *)  echo "Unknown targetrun '$targetrun'" >&4
3012             exit 1
3013             ;;
3014         esac
3015         case "$targetmkdir" in
3016         */Cross/mkdir)
3017             cat >$targetmkdir <<EOF
3018 #!/bin/sh
3019 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3020 EOF
3021             $chmod a+rx $targetmkdir
3022             ;;
3023         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3024             exit 1
3025             ;;
3026         esac
3027         case "$targetto" in
3028         scp|rcp)
3029             cat >$to <<EOF
3030 #!/bin/sh
3031 for f in \$@
3032 do
3033   case "\$f" in
3034   /*)
3035     $targetmkdir \`dirname \$f\`
3036     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3037     ;;
3038   *)
3039     $targetmkdir $targetdir/\`dirname \$f\`
3040     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3041     ;;
3042   esac
3043 done
3044 exit 0
3045 EOF
3046             ;;
3047         cp) cat >$to <<EOF
3048 #!/bin/sh
3049 for f in \$@
3050 do
3051   case "\$f" in
3052   /*)
3053     $mkdir -p $targetdir/\`dirname \$f\`
3054     $cp \$f $targetdir/\$f || exit 1
3055     ;;
3056   *)
3057     $targetmkdir $targetdir/\`dirname \$f\`
3058     $cp \$f $targetdir/\$f || exit 1
3059     ;;
3060   esac
3061 done
3062 exit 0
3063 EOF
3064             ;;
3065         *)  echo "Unknown targetto '$targetto'" >&4
3066             exit 1
3067             ;;
3068         esac
3069         case "$targetfrom" in
3070         scp|rcp)
3071           cat >$from <<EOF
3072 #!/bin/sh
3073 for f in \$@
3074 do
3075   $rm -f \$f
3076   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3077 done
3078 exit 0
3079 EOF
3080             ;;
3081         cp) cat >$from <<EOF
3082 #!/bin/sh
3083 for f in \$@
3084 do
3085   $rm -f \$f
3086   cp $targetdir/\$f . || exit 1
3087 done
3088 exit 0
3089 EOF
3090             ;;
3091         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3092             exit 1
3093             ;;
3094         esac
3095         if $test ! -f $run; then
3096             echo "Target 'run' script '$run' not found." >&4
3097         else
3098             $chmod a+rx $run
3099         fi
3100         if $test ! -f $to; then
3101             echo "Target 'to' script '$to' not found." >&4
3102         else
3103             $chmod a+rx $to
3104         fi
3105         if $test ! -f $from; then
3106             echo "Target 'from' script '$from' not found." >&4
3107         else
3108             $chmod a+rx $from
3109         fi
3110         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3111             exit 1
3112         fi
3113         cat >&4 <<EOF
3114 Using '$run' for remote execution,
3115 and '$from' and '$to'
3116 for remote file transfer.
3117 EOF
3118         ;;
3119 *)      run=''
3120         to=:
3121         from=:
3122         usecrosscompile="$undef"
3123         targetarch=''
3124         ;;
3125 esac
3126
3127 : see whether [:lower:] and [:upper:] are supported character classes
3128 echo " "
3129 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3130 ABYZ)
3131         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3132         up='[:upper:]'
3133         low='[:lower:]'
3134         ;;
3135 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3136         # (0xd9 and 0xe2), therefore that is a nice testing point.
3137         if test "X$up" = X -o "X$low" = X; then
3138             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3139             rs) up='[A-Z]'
3140                 low='[a-z]'
3141                 ;;
3142             esac
3143         fi
3144         if test "X$up" = X -o "X$low" = X; then
3145             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3146             rs) up='A-Z'
3147                 low='a-z'
3148                 ;;
3149             esac
3150         fi
3151         if test "X$up" = X -o "X$low" = X; then
3152             case "`echo RS | od -x 2>/dev/null`" in
3153             *D9E2*|*d9e2*)
3154                 echo "Hey, this might be EBCDIC." >&4
3155                 if test "X$up" = X -o "X$low" = X; then
3156                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3157                     rs) up='[A-IJ-RS-Z]'
3158                         low='[a-ij-rs-z]'
3159                         ;;
3160                     esac
3161                 fi
3162                 if test "X$up" = X -o "X$low" = X; then
3163                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3164                     rs) up='A-IJ-RS-Z'
3165                         low='a-ij-rs-z'
3166                         ;;
3167                     esac
3168                 fi
3169                 ;;
3170             esac
3171         fi
3172 esac
3173 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3174 rs)
3175     echo "Using $up and $low to convert case." >&4
3176     ;;
3177 *)
3178     echo "I don't know how to translate letters from upper to lower case." >&4
3179     echo "Your tr is not acting any way I know of." >&4
3180     exit 1
3181     ;;
3182 esac
3183 : set up the translation script tr, must be called with ./tr of course
3184 cat >tr <<EOSC
3185 $startsh
3186 case "\$1\$2" in
3187 '[A-Z][a-z]') exec $tr '$up' '$low';;
3188 '[a-z][A-Z]') exec $tr '$low' '$up';;
3189 esac
3190 exec $tr "\$@"
3191 EOSC
3192 chmod +x tr
3193 $eunicefix tr
3194
3195 : Try to determine whether config.sh was made on this system
3196 case "$config_sh" in
3197 '')
3198 myuname=`$uname -a 2>/dev/null`
3199 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3200 # Downcase everything to avoid ambiguity.
3201 # Remove slashes and single quotes so we can use parts of this in
3202 # directory and file names.
3203 # Remove newlines so myuname is sane to use elsewhere.
3204 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3205 # because the A-Z/a-z are not consecutive.
3206 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3207         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3208 newmyuname="$myuname"
3209 dflt=n
3210 case "$knowitall" in
3211 '')
3212         if test -f ../config.sh; then
3213                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3214                         eval "`grep myuname= ../config.sh`"
3215                 fi
3216                 if test "X$myuname" = "X$newmyuname"; then
3217                         dflt=y
3218                 fi
3219         fi
3220         ;;
3221 *) dflt=y;;
3222 esac
3223
3224 : Get old answers from old config file if Configure was run on the
3225 : same system, otherwise use the hints.
3226 hint=default
3227 cd ..
3228 if test -f config.sh; then
3229         echo " "
3230         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3231         . UU/myread
3232         case "$ans" in
3233         n*|N*) echo "OK, I'll ignore it."
3234                 mv config.sh config.sh.old
3235                 myuname="$newmyuname"
3236                 ;;
3237         *)  echo "Fetching default answers from your old config.sh file..." >&4
3238                 tmp_n="$n"
3239                 tmp_c="$c"
3240                 tmp_sh="$sh"
3241                 . ./config.sh
3242                 cp config.sh UU
3243                 n="$tmp_n"
3244                 c="$tmp_c"
3245                 : Older versions did not always set $sh.  Catch re-use of such
3246                 : an old config.sh.
3247                 case "$sh" in
3248                 '') sh="$tmp_sh" ;;
3249                 esac
3250                 hint=previous
3251                 ;;
3252         esac
3253 fi
3254 . ./UU/checkcc
3255 if test ! -f config.sh; then
3256         $cat <<EOM
3257
3258 First time through, eh?  I have some defaults handy for some systems
3259 that need some extra help getting the Configure answers right:
3260
3261 EOM
3262         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3263         dflt=''
3264         : Half the following guesses are probably wrong... If you have better
3265         : tests or hints, please send them to perlbug@perl.org
3266         : The metaconfig authors would also appreciate a copy...
3267         $test -f /irix && osname=irix
3268         $test -f /xenix && osname=sco_xenix
3269         $test -f /dynix && osname=dynix
3270         $test -f /dnix && osname=dnix
3271         $test -f /lynx.os && osname=lynxos
3272         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3273         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3274         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3275         $test -f /bin/mips && /bin/mips && osname=mips
3276         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3277                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3278         $test -d /usr/apollo/bin && osname=apollo
3279         $test -f /etc/saf/_sactab && osname=svr4
3280         $test -d /usr/include/minix && osname=minix
3281         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3282         if $test -d /MachTen -o -d /MachTen_Folder; then
3283                 osname=machten
3284                 if $test -x /sbin/version; then
3285                         osvers=`/sbin/version | $awk '{print $2}' |
3286                         $sed -e 's/[A-Za-z]$//'`
3287                 elif $test -x /usr/etc/version; then
3288                         osvers=`/usr/etc/version | $awk '{print $2}' |
3289                         $sed -e 's/[A-Za-z]$//'`
3290                 else
3291                         osvers="$2.$3"
3292                 fi
3293         fi
3294
3295         $test -f /sys/posix.dll &&
3296                 $test -f /usr/bin/what &&
3297                 set X `/usr/bin/what /sys/posix.dll` &&
3298                 $test "$3" = UWIN &&
3299                 osname=uwin &&
3300                 osvers="$5"
3301
3302         if $test -f $uname; then
3303                 set X $myuname
3304                 shift
3305
3306                 case "$5" in
3307                 fps*) osname=fps ;;
3308                 mips*)
3309                         case "$4" in
3310                         umips) osname=umips ;;
3311                         *) osname=mips ;;
3312                         esac;;
3313                 [23]100) osname=mips ;;
3314                 next*) osname=next ;;
3315                 i386*)
3316                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3317                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3318                                 osname='sco'
3319                                 osvers=$tmp
3320                         elif $test -f /etc/kconfig; then
3321                                 osname=isc
3322                                 if test "$lns" = "$ln -s"; then
3323                                         osvers=4
3324                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3325                                         osvers=3
3326                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3327                                         osvers=2
3328                                 fi
3329                         fi
3330                         tmp=''
3331                         ;;
3332                 pc*)
3333                         if test -n "$DJGPP"; then
3334                                 osname=dos
3335                                 osvers=djgpp
3336                         fi
3337                         ;;
3338                 esac
3339
3340                 case "$1" in
3341                 aix) osname=aix
3342                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3343                         case "$tmp" in
3344                         # oslevel can fail with:
3345                         # oslevel: Unable to acquire lock.
3346                         *not\ found) osvers="$4"."$3" ;;
3347                         '<3240'|'<>3240') osvers=3.2.0 ;;
3348                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3349                         '=3250'|'>3250') osvers=3.2.5 ;;
3350                         *) osvers=$tmp;;
3351                         esac
3352                         ;;
3353                 bitrig) osname=bitrig
3354                         osvers="$3"
3355                         ;;
3356                 bsd386) osname=bsd386
3357                         osvers=`$uname -r`
3358                         ;;
3359                 cygwin*) osname=cygwin
3360                         osvers="$3"
3361                         ;;
3362                 *dc.osx) osname=dcosx
3363                         osvers="$3"
3364                         ;;
3365                 dnix) osname=dnix
3366                         osvers="$3"
3367                         ;;
3368                 domainos) osname=apollo
3369                         osvers="$3"
3370                         ;;
3371                 dgux)   osname=dgux
3372                         osvers="$3"
3373                         ;;
3374                 dragonfly) osname=dragonfly
3375                         osvers="$3"
3376                         ;;
3377                 dynixptx*) osname=dynixptx
3378                         osvers=`echo "$4"|sed 's/^v//'`
3379                         ;;
3380                 freebsd) osname=freebsd
3381                         osvers="$3" ;;
3382                 genix)  osname=genix ;;
3383                 gnu)    osname=gnu
3384                         osvers="$3" ;;
3385                 hp*)    osname=hpux
3386                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3387                         ;;
3388                 irix*)  osname=irix
3389                         case "$3" in
3390                         4*) osvers=4 ;;
3391                         5*) osvers=5 ;;
3392                         *)      osvers="$3" ;;
3393                         esac
3394                         ;;
3395                 linux)  osname=linux
3396                         case "$3" in
3397                         *)      osvers="$3" ;;
3398                         esac
3399                         $test -f /system/lib/libandroid.so && osname=linux-android
3400                         ;;
3401                 MiNT)   osname=mint
3402                         ;;
3403                 netbsd*) osname=netbsd
3404                         osvers="$3"
3405                         ;;
3406                 news-os) osvers="$3"
3407                         case "$3" in
3408                         4*) osname=newsos4 ;;
3409                         *) osname=newsos ;;
3410                         esac
3411                         ;;
3412                 next*) osname=next ;;
3413                 nonstop-ux) osname=nonstopux ;;
3414                 openbsd) osname=openbsd
3415                         osvers="$3"
3416                         ;;
3417                 os2)    osname=os2
3418                         osvers="$4"
3419                         ;;
3420                 POSIX-BC | posix-bc ) osname=posix-bc
3421                         osvers="$3"
3422                         ;;
3423                 powerux | power_ux | powermax_os | powermaxos | \
3424                 powerunix | power_unix) osname=powerux
3425                         osvers="$3"
3426                         ;;
3427                 qnx) osname=qnx
3428                         osvers="$4"
3429                         ;;
3430                 solaris) osname=solaris
3431                         case "$3" in
3432                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3433                         *)      osvers="$3" ;;
3434                         esac
3435                         ;;
3436                 sunos) osname=sunos
3437                         case "$3" in
3438                         5*) osname=solaris
3439                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3440                         *)      osvers="$3" ;;
3441                         esac
3442                         ;;
3443                 titanos) osname=titanos
3444                         case "$3" in
3445                         1*) osvers=1 ;;
3446                         2*) osvers=2 ;;
3447                         3*) osvers=3 ;;
3448                         4*) osvers=4 ;;
3449                         *)      osvers="$3" ;;
3450                         esac
3451                         ;;
3452                 ultrix) osname=ultrix
3453                         osvers="$3"
3454                         ;;
3455                 osf1|mls+)      case "$5" in
3456                                 alpha)
3457                                         osname=dec_osf
3458                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3459                                         case "$osvers" in
3460                                         [1-9].[0-9]*) ;;
3461                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3462                                         esac
3463                                         ;;
3464                         hp*)    osname=hp_osf1  ;;
3465                         mips)   osname=mips_osf1 ;;
3466                         esac
3467                         ;;
3468                 # UnixWare 7.1.2 is known as Open UNIX 8
3469                 openunix|unixware) osname=svr5
3470                         osvers="$4"
3471                         ;;
3472                 uts)    osname=uts
3473                         osvers="$3"
3474                         ;;
3475                 vos) osvers="$3"
3476                         ;;
3477                 $2) case "$osname" in
3478                         *isc*) ;;
3479                         *freebsd*) ;;
3480                         svr*)
3481                                 : svr4.x or possibly later
3482                                 case "svr$3" in
3483                                 ${osname}*)
3484                                         osname=svr$3
3485                                         osvers=$4
3486                                         ;;
3487                                 esac
3488                                 case "$osname" in
3489                                 svr4.0)
3490                                         : Check for ESIX
3491                                         if test -f /stand/boot ; then
3492                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3493                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3494                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3495                                                         if test -n "$isesix"; then
3496                                                                 osname=esix4
3497                                                         fi
3498                                                 fi
3499                                         fi
3500                                         ;;
3501                                 esac
3502                                 ;;
3503                         *)      if test -f /etc/systemid; then
3504                                         osname=sco
3505                                         set `echo $3 | $sed 's/\./ /g'` $4
3506                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3507                                                 osvers=$1.$2.$3
3508                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3509                                                 osvers=$1.$2
3510                                         elif $test -f $src/hints/sco_$1.sh; then
3511                                                 osvers=$1
3512                                         fi
3513                                 else
3514                                         case "$osname" in
3515                                         '') : Still unknown.  Probably a generic Sys V.
3516                                                 osname="sysv"
3517                                                 osvers="$3"
3518                                                 ;;
3519                                         esac
3520                                 fi
3521                                 ;;
3522                         esac
3523                         ;;
3524                 *)      case "$osname" in
3525                         '') : Still unknown.  Probably a generic BSD.
3526                                 osname="$1"
3527                                 osvers="$3"
3528                                 ;;
3529                         esac
3530                         ;;
3531                 esac
3532         else
3533                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3534                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3535                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3536                                 osname=news_os
3537                         fi
3538                         $rm -f UU/kernel.what
3539                 elif test -d c:/. -o -n "$is_os2" ; then
3540                         set X $myuname
3541                         osname=os2
3542                         osvers="$5"
3543                 fi
3544         fi
3545
3546         case "$targetarch" in
3547         '') ;;
3548         *)  hostarch=$osname
3549             case "$targetarch" in
3550                 nto*|*-nto-*)
3551                     # Will load qnx.sh, which should change osname to nto
3552                     osname=qnx
3553                     osvers=''
3554                     ;;
3555                 *linux-android*)
3556                     # Catch arm-linux-androideabi, mipsel-linux-android,
3557                     # and i686-linux-android
3558                     osname=linux-android
3559                     osvers=''
3560                     ;;
3561                 *linux*)
3562                     # Something like arm-linux-gnueabihf is really just
3563                     # plain linux.
3564                     osname=linux
3565                     osvers=''
3566                     ;;
3567                 *solaris*|*sunos*)
3568                     osname=solaris
3569                     # XXX perhaps we should just assume
3570                     # osvers to be 2, or maybe take the value
3571                     # from targetarch. Using $run before the
3572                     # hints are run is somewhat icky.
3573                     set X `$run $uname -a 2>/dev/null`
3574                     shift
3575                     case "$3" in
3576                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3577                         *)  osvers="$3" ;;
3578                     esac
3579                     ;;
3580                 *)
3581                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3582                     osvers=''
3583                 ;;
3584             esac
3585             ;;
3586         esac
3587
3588         : Now look for a hint file osname_osvers, unless one has been
3589         : specified already.
3590         case "$hintfile" in
3591         ''|' ')
3592                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3593                 : Also try without trailing minor version numbers.
3594                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3595                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3596                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3597                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3598                 case "$file" in
3599                 '') dflt=none ;;
3600                 *)  case "$osvers" in
3601                         '') dflt=$file
3602                                 ;;
3603                         *)  if $test -f $src/hints/$file.sh ; then
3604                                         dflt=$file
3605                                 elif $test -f $src/hints/$xfile.sh ; then
3606                                         dflt=$xfile
3607                                 elif $test -f $src/hints/$xxfile.sh ; then
3608                                         dflt=$xxfile
3609                                 elif $test -f $src/hints/$xxxfile.sh ; then
3610                                         dflt=$xxxfile
3611                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3612                                         dflt=$xxxxfile
3613                                 elif $test -f "$src/hints/${osname}.sh" ; then
3614                                         dflt="${osname}"
3615                                 else
3616                                         dflt=none
3617                                 fi
3618                                 ;;
3619                         esac
3620                         ;;
3621                 esac
3622                 if $test -f Policy.sh ; then
3623                         case "$dflt" in
3624                         *Policy*) ;;
3625                         none) dflt="Policy" ;;
3626                         *) dflt="Policy $dflt" ;;
3627                         esac
3628                 fi
3629                 ;;
3630         *)
3631                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3632                 ;;
3633         esac
3634
3635         if $test -f Policy.sh ; then
3636                 $cat <<EOM
3637
3638 There's also a Policy hint file available, which should make the
3639 site-specific (policy) questions easier to answer.
3640 EOM
3641
3642         fi
3643
3644         $cat <<EOM
3645
3646 You may give one or more space-separated answers, or "none" if appropriate.
3647 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3648 previous run of Configure, you may specify it as well as or instead of
3649 OS-specific hints.  If hints are provided for your OS, you should use them:
3650 although Perl can probably be built without hints on many platforms, using
3651 hints often improve performance and may enable features that Configure can't
3652 set up on its own. If there are no hints that match your OS, specify "none";
3653 DO NOT give a wrong version or a wrong OS.
3654
3655 EOM
3656
3657         rp="Which of these apply, if any?"
3658         . UU/myread
3659         tans=$ans
3660         for file in $tans; do
3661                 if $test X$file = XPolicy -a -f Policy.sh; then
3662                         . Policy.sh
3663                         $cat Policy.sh >> UU/config.sh
3664                 elif $test -f $src/hints/$file.sh; then
3665                         . $src/hints/$file.sh
3666                         $cat $src/hints/$file.sh >> UU/config.sh
3667                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3668                         : nothing
3669                 else
3670                         : Give one chance to correct a possible typo.
3671                         echo "$file.sh does not exist"
3672                         dflt=$file
3673                         rp="hint to use instead?"
3674                         . UU/myread
3675                         for file in $ans; do
3676                                 if $test -f "$src/hints/$file.sh"; then
3677                                         . $src/hints/$file.sh
3678                                         $cat $src/hints/$file.sh >> UU/config.sh
3679                                 elif $test X$ans = X -o X$ans = Xnone ; then
3680                                         : nothing
3681                                 else
3682                                         echo "$file.sh does not exist -- ignored."
3683                                 fi
3684                         done
3685                 fi
3686         done
3687
3688         hint=recommended
3689         : Remember our hint file for later.
3690         if $test -f "$src/hints/$file.sh" ; then
3691                 hintfile="$file"
3692         else
3693                 hintfile=''
3694         fi
3695 fi
3696 cd UU
3697 ;;
3698 *)
3699         echo " "
3700         echo "Fetching default answers from $config_sh..." >&4
3701         tmp_n="$n"
3702         tmp_c="$c"
3703         cd ..
3704         cp $config_sh config.sh 2>/dev/null
3705         chmod +w config.sh
3706         . ./config.sh
3707         cd UU
3708         cp ../config.sh .
3709         n="$tmp_n"
3710         c="$tmp_c"
3711         hint=previous
3712         ;;
3713 esac
3714 test "$override" && . ./optdef.sh
3715
3716 : Restore computed paths
3717 for file in $loclist $trylist; do
3718         eval $file="\$_$file"
3719 done
3720
3721 cat << EOM
3722
3723 Configure uses the operating system name and version to set some defaults.
3724 The default value is probably right if the name rings a bell. Otherwise,
3725 since spelling matters for me, either accept the default or answer "none"
3726 to leave it blank.
3727
3728 EOM
3729 case "$osname" in
3730         ''|' ')
3731                 case "$hintfile" in
3732                 ''|' '|none) dflt=none ;;
3733                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3734                 esac
3735                 ;;
3736         *) dflt="$osname" ;;
3737 esac
3738 rp="Operating system name?"
3739 . ./myread
3740 case "$ans" in
3741 none)  osname='' ;;
3742 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3743 esac
3744 echo " "
3745 case "$osvers" in
3746         ''|' ')
3747                 case "$hintfile" in
3748                 ''|' '|none) dflt=none ;;
3749                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3750                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3751                         case "$dflt" in
3752                         ''|' ') dflt=none ;;
3753                         esac
3754                         ;;
3755                 esac
3756                 ;;
3757         *) dflt="$osvers" ;;
3758 esac
3759 rp="Operating system version?"
3760 . ./myread
3761 case "$ans" in
3762 none)  osvers='' ;;
3763 *) osvers="$ans" ;;
3764 esac
3765
3766
3767 . ./posthint.sh
3768
3769 : who configured the system
3770 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3771 case "$cf_by" in
3772 "")
3773         cf_by=`(logname) 2>/dev/null`
3774         case "$cf_by" in
3775         "")
3776                 cf_by=`(whoami) 2>/dev/null`
3777                 case "$cf_by" in
3778                 "") cf_by=unknown ;;
3779                 esac ;;
3780         esac ;;
3781 esac
3782
3783 : decide how portable to be.  Allow command line overrides.
3784 case "$d_portable" in
3785 "$undef") ;;
3786 *)      d_portable="$define" ;;
3787 esac
3788
3789 : set up shell script to do ~ expansion
3790 cat >filexp <<EOSS
3791 $startsh
3792 : expand filename
3793 case "\$1" in
3794  \~/*|\~)
3795         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3796         ;;
3797  \~*)
3798         if $test -f /bin/csh; then
3799                 /bin/csh -f -c "glob \$1"
3800                 failed=\$?
3801                 echo ""
3802                 exit \$failed
3803         else
3804                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3805                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3806                 if $test ! -d "\$dir"; then
3807                         me=\`basename \$0\`
3808                         echo "\$me: can't locate home directory for: \$name" >&2
3809                         exit 1
3810                 fi
3811                 case "\$1" in
3812                 */*)
3813                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3814                         ;;
3815                 *)
3816                         echo \$dir
3817                         ;;
3818                 esac
3819         fi
3820         ;;
3821 *)
3822         echo \$1
3823         ;;
3824 esac
3825 EOSS
3826 chmod +x filexp
3827 $eunicefix filexp
3828
3829 : now set up to get a file name
3830 cat <<EOS >getfile
3831 $startsh
3832 EOS
3833 cat <<'EOSC' >>getfile
3834 tilde=''
3835 fullpath=''
3836 already=''
3837 skip=''
3838 none_ok=''
3839 exp_file=''
3840 nopath_ok=''
3841 orig_rp="$rp"
3842 orig_dflt="$dflt"
3843 case "$gfpth" in
3844 '') gfpth='.' ;;
3845 esac
3846
3847 case "$fn" in
3848 *\(*)
3849         : getfile will accept an answer from the comma-separated list
3850         : enclosed in parentheses even if it does not meet other criteria.
3851         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3852         fn=`echo $fn | sed 's/(.*)//'`
3853         ;;
3854 esac
3855
3856 case "$fn" in
3857 *:*)
3858         loc_file=`expr $fn : '.*:\(.*\)'`
3859         fn=`expr $fn : '\(.*\):.*'`
3860         ;;
3861 esac
3862
3863 case "$fn" in
3864 *~*) tilde=true;;
3865 esac
3866 case "$fn" in
3867 */*) fullpath=true;;
3868 esac
3869 case "$fn" in
3870 *+*) skip=true;;
3871 esac
3872 case "$fn" in
3873 *n*) none_ok=true;;
3874 esac
3875 case "$fn" in
3876 *e*) exp_file=true;;
3877 esac
3878 case "$fn" in
3879 *p*) nopath_ok=true;;
3880 esac
3881
3882 case "$fn" in
3883 *f*) type='File';;
3884 *d*) type='Directory';;
3885 *l*) type='Locate';;
3886 esac
3887
3888 what="$type"
3889 case "$what" in
3890 Locate) what='File';;
3891 esac
3892
3893 case "$exp_file" in
3894 '')
3895         case "$d_portable" in
3896         "$define") ;;
3897         *) exp_file=true;;
3898         esac
3899         ;;
3900 esac
3901
3902 cd ..
3903 while test "$type"; do
3904         redo=''
3905         rp="$orig_rp"
3906         dflt="$orig_dflt"
3907         case "$tilde" in
3908         true) rp="$rp (~name ok)";;
3909         esac
3910         . UU/myread
3911         if test -f UU/getfile.ok && \
3912                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3913         then
3914                 value="$ans"
3915                 ansexp="$ans"
3916                 break
3917         fi
3918         case "$ans" in
3919         none)
3920                 value=''
3921                 ansexp=''
3922                 case "$none_ok" in
3923                 true) type='';;
3924                 esac
3925                 ;;
3926         *)
3927                 case "$tilde" in
3928                 '') value="$ans"
3929                         ansexp="$ans";;
3930                 *)
3931                         value=`UU/filexp $ans`
3932                         case $? in
3933                         0)
3934                                 if test "$ans" != "$value"; then
3935                                         echo "(That expands to $value on this system.)"
3936                                 fi
3937                                 ;;
3938                         *) value="$ans";;
3939                         esac
3940                         ansexp="$value"
3941                         case "$exp_file" in
3942                         '') value="$ans";;
3943                         esac
3944                         ;;
3945                 esac
3946                 case "$fullpath" in
3947                 true)
3948                         case "$ansexp" in
3949                         /*) value="$ansexp" ;;
3950                         [a-zA-Z]:/*) value="$ansexp" ;;
3951                         *)
3952                                 redo=true
3953                                 case "$already" in
3954                                 true)
3955                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3956                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3957                                         ;;
3958                                 *)
3959                                 echo "Please give a full path name, starting with slash." >&4
3960                                         case "$tilde" in
3961                                         true)
3962                                 echo "Note that using ~name is ok provided it expands well." >&4
3963                                                 already=true
3964                                                 ;;
3965                                         esac
3966                                 esac
3967                                 ;;
3968                         esac
3969                         ;;
3970                 esac
3971                 case "$redo" in
3972                 '')
3973                         case "$type" in
3974                         File)
3975                                 for fp in $gfpth; do
3976                                         if test "X$fp" = X.; then
3977                                             pf="$ansexp"
3978                                         else    
3979                                             pf="$fp/$ansexp"
3980                                         fi
3981                                         if test -f "$pf"; then
3982                                                 type=''
3983                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3984                                         then
3985                                                 echo "($value is not a plain file, but that's ok.)"
3986                                                 type=''
3987                                         fi
3988                                         if test X"$type" = X; then
3989                                             value="$pf"
3990                                             break
3991                                         fi
3992                                 done
3993                                 ;;
3994                         Directory)
3995                                 for fp in $gfpth; do
3996                                         if test "X$fp" = X.; then
3997                                             dir="$ans"
3998                                             direxp="$ansexp"
3999                                         else    
4000                                             dir="$fp/$ansexp"
4001                                             direxp="$fp/$ansexp"
4002                                         fi
4003                                         if test -d "$direxp"; then
4004                                                 type=''
4005                                                 value="$dir"
4006                                                 break
4007                                         fi
4008                                 done
4009                                 ;;
4010                         Locate)
4011                                 if test -d "$ansexp"; then
4012                                         echo "(Looking for $loc_file in directory $value.)"
4013                                         value="$value/$loc_file"
4014                                         ansexp="$ansexp/$loc_file"
4015                                 fi
4016                                 if test -f "$ansexp"; then
4017                                         type=''
4018                                 fi
4019                                 case "$nopath_ok" in
4020                                 true)   case "$value" in
4021                                         */*) ;;
4022                                         *)      echo "Assuming $value will be in people's path."
4023                                                 type=''
4024                                                 ;;
4025                                         esac
4026                                         ;;
4027                                 esac
4028                                 ;;
4029                         esac
4030
4031                         case "$skip" in
4032                         true) type='';
4033                         esac
4034
4035                         case "$type" in
4036                         '') ;;
4037                         *)
4038                                 if test "$fastread" = yes; then
4039                                         dflt=y
4040                                 else
4041                                         dflt=n
4042                                 fi
4043                                 rp="$what $value doesn't exist.  Use that name anyway?"
4044                                 . UU/myread
4045                                 dflt=''
4046                                 case "$ans" in
4047                                 y*) type='';;
4048                                 *) echo " ";;
4049                                 esac
4050                                 ;;
4051                         esac
4052                         ;;
4053                 esac
4054                 ;;
4055         esac
4056 done
4057 cd UU
4058 ans="$value"
4059 rp="$orig_rp"
4060 dflt="$orig_dflt"
4061 rm -f getfile.ok
4062 test "X$gfpthkeep" != Xy && gfpth=""
4063 EOSC
4064
4065 : determine root of directory hierarchy where package will be installed.
4066 case "$prefix" in
4067 '')
4068         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4069         ;;
4070 *?/)
4071         dflt=`echo "$prefix" | sed 's/.$//'`
4072         ;;
4073 *)
4074         dflt="$prefix"
4075         ;;
4076 esac
4077 $cat <<EOM
4078
4079 By default, $package will be installed in $dflt/bin, manual pages
4080 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4081 installation directories. Typically this is something like /usr/local.
4082 If you wish to have binaries under /usr/bin but other parts of the
4083 installation under /usr/local, that's ok: you will be prompted
4084 separately for each of the installation directories, the prefix being
4085 only used to set the defaults.
4086
4087 EOM
4088 fn=d~
4089 rp='Installation prefix to use?'
4090 . ./getfile
4091 oldprefix=''
4092 case "$prefix" in
4093 '') ;;
4094 *)
4095         case "$ans" in
4096         "$prefix") ;;
4097         *) oldprefix="$prefix";;
4098         esac
4099         ;;
4100 esac
4101 prefix="$ans"
4102 prefixexp="$ansexp"
4103
4104 : allow them to override the AFS root
4105 case "$afsroot" in
4106 '')     afsroot=/afs ;;
4107 *)      afsroot=$afsroot ;;
4108 esac
4109
4110 : is AFS running?
4111 echo " "
4112 case "$afs" in
4113 $define|true)   afs=true ;;
4114 $undef|false)   afs=false ;;
4115 *)      if $test -d $afsroot; then
4116                 afs=true
4117         else
4118                 afs=false
4119         fi
4120         ;;
4121 esac
4122 if $afs; then
4123         echo "AFS may be running... I'll be extra cautious then..." >&4
4124 else
4125         echo "AFS does not seem to be running..." >&4
4126 fi
4127
4128 : determine installation prefix for where package is to be installed.
4129 if $afs; then
4130 $cat <<EOM
4131
4132 Since you are running AFS, I need to distinguish the directory in which
4133 files will reside from the directory in which they are installed (and from
4134 which they are presumably copied to the former directory by occult means).
4135
4136 EOM
4137         case "$installprefix" in
4138         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4139         *) dflt="$installprefix";;
4140         esac
4141 else
4142 $cat <<EOM
4143
4144 In some special cases, particularly when building $package for distribution,
4145 it is convenient to distinguish the directory in which files should be
4146 installed from the directory ($prefix) in which they will
4147 eventually reside.  For most users, these two directories are the same.
4148
4149 EOM
4150         case "$installprefix" in
4151         '') dflt=$prefix ;;
4152         *) dflt=$installprefix;;
4153         esac
4154 fi
4155 fn=d~
4156 rp='What installation prefix should I use for installing files?'
4157 . ./getfile
4158 installprefix="$ans"
4159 installprefixexp="$ansexp"
4160
4161 : Perform the prefixexp/installprefixexp correction if necessary
4162 cat <<EOS >installprefix
4163 $startsh
4164 EOS
4165 cat <<'EOSC' >>installprefix
4166 : Change installation prefix, if necessary.
4167 if $test X"$prefix" != X"$installprefix"; then
4168     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4169 else
4170     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4171 fi
4172 EOSC
4173 chmod +x installprefix
4174 $eunicefix installprefix
4175
4176 : Set variables such as privlib and privlibexp from the output of ./getfile
4177 : performing the prefixexp/installprefixexp correction if necessary.
4178 cat <<EOS >setprefixvar
4179 $startsh
4180 EOS
4181 cat <<'EOSC' >>setprefixvar
4182 eval "${prefixvar}=\"\$ans\""
4183 eval "${prefixvar}exp=\"\$ansexp\""
4184 . ./installprefix
4185 EOSC
4186 chmod +x setprefixvar
4187 $eunicefix setprefixvar
4188
4189 : set up the script used to warn in case of inconsistency
4190 cat <<EOS >whoa
4191 $startsh
4192 EOS
4193 cat <<'EOSC' >>whoa
4194 dflt=y
4195 case "$hint" in
4196     recommended)
4197         case "$hintfile" in
4198         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4199                 ;;
4200         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4201                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4202                 ;;
4203         esac
4204         ;;
4205     *)  echo " "
4206         echo "*** WHOA THERE!!! ***" >&4
4207         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4208         ;;
4209 esac
4210 rp="    Keep the $hint value?"
4211 . ./myread
4212 case "$ans" in
4213 y) td=$was; tu=$was;;
4214 esac
4215 EOSC
4216
4217 : function used to set '$1' to '$val'
4218 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4219 case "$val$was" in
4220 $define$undef) . ./whoa; eval "$var=\$td";;
4221 $undef$define) . ./whoa; eval "$var=\$tu";;
4222 *) eval "$var=$val";;
4223 esac'
4224
4225 : get the patchlevel
4226 echo " "
4227 echo "Getting the current patchlevel..." >&4
4228 if $test -r $rsrc/patchlevel.h;then
4229         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4230         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4231         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4232         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4233         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4234         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4235         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4236 else
4237         revision=0
4238         patchlevel=0
4239         subversion=0
4240         api_revision=0
4241         api_version=0
4242         api_subversion=0
4243         perl_patchlevel=0
4244         $echo "(You do not have patchlevel.h.  Eek.)"
4245 fi
4246 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4247 version_patchlevel_string="version $patchlevel subversion $subversion"
4248 case "$perl_patchlevel" in
4249 0|'') ;;
4250 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4251     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4252     ;;
4253 esac
4254
4255 $echo "(You have $package $version_patchlevel_string.)"
4256
4257 case "$osname" in
4258 dos|vms)
4259         : XXX Should be a Configure test for double-dots in filenames.
4260         version=`echo $revision $patchlevel $subversion | \
4261                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4262         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4263                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4264         ;;
4265 *)
4266         version=`echo $revision $patchlevel $subversion | \
4267                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4268         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4269                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4270         ;;
4271 esac
4272 : Special case the 5.005_xx maintenance series, which used 5.005
4273 : without any subversion label as a subdirectory in $sitelib
4274 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4275         api_versionstring='5.005'
4276 fi
4277
4278 : Do we want threads support and if so, what type
4279 case "$usethreads" in
4280 $define|true|[yY]*)     dflt='y';;
4281 *)     # Catch case where user specified ithreads or 5005threads but
4282        # forgot -Dusethreads (A.D. 4/2002)
4283        case "$useithreads$use5005threads" in
4284        *$define*)       dflt='y';;
4285        *)               dflt='n';;
4286        esac
4287        ;;
4288 esac
4289 cat <<EOM
4290
4291 Perl can be built to offer a form of threading support on some systems
4292 To do so, Configure can be run with -Dusethreads.
4293
4294 Note that Perl built with threading support runs slightly slower
4295 and uses slightly more memory than plain Perl.
4296
4297 If this doesn't make any sense to you, just accept the default '$dflt'.
4298 EOM
4299 rp='Build a threading Perl?'
4300 . ./myread
4301 case "$ans" in
4302 y|Y)    val="$define" ;;
4303 *)      val="$undef" ;;
4304 esac
4305 set usethreads
4306 eval $setvar
4307
4308 if $test $patchlevel -lt 9; then
4309     case "$usethreads" in
4310     $define)
4311         : Default to ithreads unless overridden on command line or with
4312         : old config.sh
4313         dflt='y'
4314         case "$use5005threads" in
4315                 $define|true|[yY]*)
4316                         echo "5.005 threads are no longer supported"
4317                         exit 1
4318                 ;;
4319         esac
4320         case "$useithreads" in
4321                 $undef|false|[nN]*) dflt='n';;
4322         esac
4323         rp='Use the newer interpreter-based ithreads?'
4324         . ./myread
4325         case "$ans" in
4326         y|Y)    val="$define" ;;
4327         *)      val="$undef" ;;
4328         esac
4329         set useithreads
4330         eval $setvar
4331         : Now set use5005threads to the opposite value.
4332         case "$useithreads" in
4333         $define) val="$undef" ;;
4334         *) val="$define" ;;
4335         esac
4336         set use5005threads
4337         eval $setvar
4338         ;;
4339     *)
4340         useithreads="$undef"
4341         use5005threads="$undef"
4342         ;;
4343     esac
4344
4345     case "$useithreads$use5005threads" in
4346     "$define$define")
4347         $cat >&4 <<EOM
4348
4349 You cannot have both the ithreads and the 5.005 threads enabled
4350 at the same time.  Disabling the 5.005 threads since they are
4351 much less stable than the ithreads.
4352
4353 EOM
4354         use5005threads="$undef"
4355         ;;
4356     esac
4357
4358 else
4359 : perl-5.9.x and later
4360
4361     if test X"$usethreads" = "X$define"; then
4362         case "$use5005threads" in
4363             $define|true|[yY]*)
4364                 $cat >&4 <<EOM
4365
4366 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4367
4368 EOM
4369             ;;
4370         esac
4371     fi
4372
4373     use5005threads="$undef"
4374     useithreads="$usethreads"
4375 fi
4376
4377 case "$d_oldpthreads" in
4378 '')     : Configure tests would be welcome here.  For now, assume undef.
4379         val="$undef" ;;
4380 *)      val="$d_oldpthreads" ;;
4381 esac
4382 set d_oldpthreads
4383 eval $setvar
4384
4385
4386 : Look for a hint-file generated 'call-back-unit'.  If the
4387 : user has specified that a threading perl is to be built,
4388 : we may need to set or change some other defaults.
4389 if $test -f usethreads.cbu; then
4390     echo "Your platform has some specific hints regarding threaded builds, using them..."
4391     . ./usethreads.cbu
4392 else
4393     case "$usethreads" in
4394         "$define"|true|[yY]*)
4395                 $cat <<EOM
4396 (Your platform does not have any specific hints for threaded builds.
4397  Assuming POSIX threads, then.)
4398 EOM
4399         ;;
4400     esac
4401 fi
4402
4403 : Check if multiplicity is required
4404 cat <<EOM
4405
4406 Perl can be built so that multiple Perl interpreters can coexist
4407 within the same Perl executable.
4408 EOM
4409
4410 case "$useithreads" in
4411 $define)
4412         cat <<EOM
4413 This multiple interpreter support is required for interpreter-based threads.
4414 EOM
4415         val="$define"
4416         ;;
4417 *)      case "$usemultiplicity" in
4418         $define|true|[yY]*)     dflt='y';;
4419         *) dflt='n';;
4420         esac
4421         echo " "
4422         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4423         rp='Build Perl for multiplicity?'
4424         . ./myread
4425         case "$ans" in
4426         y|Y)    val="$define" ;;
4427         *)      val="$undef" ;;
4428         esac
4429         ;;
4430 esac
4431 set usemultiplicity
4432 eval $setvar
4433
4434 : Check if morebits is requested
4435 case "$usemorebits" in
4436 "$define"|true|[yY]*)
4437         use64bitint="$define"
4438         uselongdouble="$define"
4439         usemorebits="$define"
4440         ;;
4441 *)      usemorebits="$undef"
4442         ;;
4443 esac
4444
4445 : Determine the C compiler to be used
4446 echo " "
4447 case "$cc" in
4448 '') dflt=cc;;
4449 *) dflt="$cc";;
4450 esac
4451 rp="Use which C compiler?"
4452 . ./myread
4453 cc="$ans"
4454
4455 : See whether they have no cc but they do have gcc
4456 . ./trygcc
4457 if $test -f cc.cbu; then
4458     . ./cc.cbu
4459 fi
4460 . ./checkcc
4461
4462 : make some quick guesses about what we are up against
4463 echo " "
4464 $echo $n "Hmm...  $c"
4465 echo exit 1 >bsd
4466 echo exit 1 >usg
4467 echo exit 1 >v7
4468 echo exit 1 >osf1
4469 echo exit 1 >eunice
4470 echo exit 1 >xenix
4471 echo exit 1 >venix
4472 echo exit 1 >os2
4473 d_bsd="$undef"
4474 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4475 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4476 then
4477         echo "Looks kind of like an OSF/1 system, but we'll see..."
4478         echo exit 0 >osf1
4479 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4480         xxx=`./loc addbib blurfl $pth`
4481         if $test -f $xxx; then
4482         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4483                 echo exit 0 >bsd
4484                 echo exit 0 >usg
4485         else
4486                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4487                         echo "Looks kind of like an extended USG system, but we'll see..."
4488                 else
4489                         echo "Looks kind of like a USG system, but we'll see..."
4490                 fi
4491                 echo exit 0 >usg
4492         fi
4493 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4494         echo "Looks kind of like a BSD system, but we'll see..."
4495         d_bsd="$define"
4496         echo exit 0 >bsd
4497 else
4498         echo "Looks kind of like a Version 7 system, but we'll see..."
4499         echo exit 0 >v7
4500 fi
4501 case "$eunicefix" in
4502 *unixtovms*)
4503         $cat <<'EOI'
4504 There is, however, a strange, musty smell in the air that reminds me of
4505 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4506 EOI
4507         echo exit 0 >eunice
4508         d_eunice="$define"
4509 : it so happens the Eunice I know will not run shell scripts in Unix format
4510         ;;
4511 *)
4512         echo " "
4513         echo "Congratulations.  You aren't running Eunice."
4514         d_eunice="$undef"
4515         ;;
4516 esac
4517 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4518 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4519 : semicolon as a patch separator
4520 case "$p_" in
4521 :) ;;
4522 *)
4523         $cat <<'EOI'
4524 I have the feeling something is not exactly right, however...don't tell me...
4525 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4526 (Or you may be running DOS with DJGPP.)
4527 EOI
4528         echo exit 0 >os2
4529         ;;
4530 esac
4531 if test -f /xenix; then
4532         echo "Actually, this looks more like a XENIX system..."
4533         echo exit 0 >xenix
4534         d_xenix="$define"
4535 else
4536         echo " "
4537         echo "It's not Xenix..."
4538         d_xenix="$undef"
4539 fi
4540 chmod +x xenix
4541 $eunicefix xenix
4542 if test -f /venix; then
4543         echo "Actually, this looks more like a VENIX system..."
4544         echo exit 0 >venix
4545 else
4546         echo " "
4547         if ./xenix; then
4548                 : null
4549         else
4550                 echo "Nor is it Venix..."
4551         fi
4552 fi
4553 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4554 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4555 $rm -f foo
4556
4557 : Check if we are using GNU gcc and what its version is
4558 echo " "
4559 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4560 $cat >try.c <<EOM
4561 #include <stdio.h>
4562 int main() {
4563 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4564 #ifdef __VERSION__
4565         printf("%s\n", __VERSION__);
4566 #else
4567         printf("%s\n", "1");
4568 #endif
4569 #endif
4570         return(0);
4571 }
4572 EOM
4573 if $cc -o try $ccflags $ldflags try.c; then
4574         gccversion=`$run ./try`
4575         case "$gccversion" in
4576         '') echo "You are not using GNU cc." ;;
4577         *)  echo "You are using GNU cc $gccversion."
4578             ccname=gcc
4579             ;;
4580         esac
4581 else
4582         echo " "
4583         echo "*** WHOA THERE!!! ***" >&4
4584         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4585         case "$knowitall" in
4586         '')
4587         echo "    You'd better start hunting for one and let me know about it." >&4
4588                 exit 1
4589                 ;;
4590         esac
4591 fi
4592 $rm -f try try.*
4593 case "$gccversion" in
4594 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4595 esac
4596 case "$gccversion" in
4597 '') gccosandvers='' ;;
4598 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4599    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4600    gccshortvers=''
4601    case "$gccosandvers" in
4602    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4603    $osname$osvers) ;; # looking good
4604    $osname*) cat <<EOM >&4
4605
4606 *** WHOA THERE!!! ***
4607
4608     Your gcc has not been compiled for the exact release of
4609     your operating system ($gccosandvers versus $osname$osvers).
4610
4611     In general it is a good idea to keep gcc synchronized with
4612     the operating system because otherwise serious problems
4613     may ensue when trying to compile software, like Perl.
4614
4615     I'm trying to be optimistic here, though, and will continue.
4616     If later during the configuration and build icky compilation
4617     problems appear (headerfile conflicts being the most common
4618     manifestation), I suggest reinstalling the gcc to match
4619     your operating system release.
4620
4621 EOM
4622       ;;
4623    *) gccosandvers='' ;; # failed to parse, better be silent
4624    esac
4625    ;;
4626 esac
4627 case "$ccname" in
4628 '') ccname="$cc" ;;
4629 esac
4630
4631 # gcc 3.* complain about adding -Idirectories that they already know about,
4632 # so we will take those off from locincpth.
4633 case "$gccversion" in
4634 3*)
4635     echo "main(){}">try.c
4636     for incdir in $locincpth; do
4637        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4638              grep '^c[cp]p*[01]: warning: changing search order '`
4639        if test "X$warn" != X; then
4640            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4641        fi
4642     done
4643     $rm -f try try.*
4644 esac
4645
4646 # 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 libsfound=''
5155 libsfiles=''
5156 libsdirs=''
5157 libspath=''
5158 for thisdir in $libpth $xlibpth; do
5159   test -d $thisdir && libspath="$libspath $thisdir"
5160 done
5161 for thislib in $libswanted; do
5162         for thisdir in $libspath; do
5163             xxx=''
5164             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5165                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5166                 $test -f "$xxx" && eval $libscheck
5167                 $test -f "$xxx" && libstyle=shared
5168             fi
5169             if test ! -f "$xxx"; then
5170                 xxx=$thisdir/lib$thislib.$so
5171                 $test -f "$xxx" && eval $libscheck
5172                 $test -f "$xxx" && libstyle=shared
5173             fi
5174             if test ! -f "$xxx"; then
5175                 xxx=$thisdir/lib$thislib$_a
5176                 $test -f "$xxx" && eval $libscheck
5177                 $test -f "$xxx" && libstyle=static
5178             fi
5179             if test ! -f "$xxx"; then
5180                 xxx=$thisdir/$thislib$_a
5181                 $test -f "$xxx" && eval $libscheck
5182                 $test -f "$xxx" && libstyle=static
5183             fi
5184             if test ! -f "$xxx"; then
5185                 xxx=$thisdir/lib${thislib}_s$_a
5186                 $test -f "$xxx" && eval $libscheck
5187                 $test -f "$xxx" && libstyle=static
5188                 $test -f "$xxx" && thislib=${thislib}_s
5189             fi
5190             if test ! -f "$xxx"; then
5191                 xxx=$thisdir/Slib$thislib$_a
5192                 $test -f "$xxx" && eval $libscheck
5193                 $test -f "$xxx" && libstyle=static
5194             fi
5195             if $test -f "$xxx"; then
5196                 case "$libstyle" in
5197                 shared) echo "Found -l$thislib (shared)." ;;
5198                 static) echo "Found -l$thislib." ;;
5199                 *)      echo "Found -l$thislib ($libstyle)." ;;
5200                 esac
5201                 case " $dflt " in
5202                 *"-l$thislib "*);;
5203                 *) dflt="$dflt -l$thislib"
5204                    libsfound="$libsfound $xxx"
5205                    yyy=`basename $xxx`
5206                    libsfiles="$libsfiles $yyy"
5207                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5208                    case " $libsdirs " in
5209                    *" $yyy "*) ;;
5210                    *) libsdirs="$libsdirs $yyy" ;;
5211                    esac
5212                    ;;
5213                 esac
5214                 break
5215             fi
5216         done
5217         if $test ! -f "$xxx"; then
5218             echo "No -l$thislib."
5219         fi
5220 done
5221 set X $dflt
5222 shift
5223 dflt="$*"
5224 case "$libs" in
5225 '') dflt="$dflt";;
5226 *) dflt="$libs";;
5227 esac
5228 case "$dflt" in
5229 ' '|'') dflt='none';;
5230 esac
5231
5232 $cat <<EOM
5233
5234 In order to compile $package on your machine, a number of libraries
5235 are usually needed.  Include any other special libraries here as well.
5236 Say "none" for none.  The default list is almost always right.
5237 EOM
5238
5239 echo " "
5240 rp="What libraries to use?"
5241 . ./myread
5242 case "$ans" in
5243 none) libs=' ';;
5244 *) libs="$ans";;
5245 esac
5246
5247 : determine optimization, if desired, or use for debug flag also
5248 case "$optimize" in
5249 ' '|$undef) dflt='none';;
5250 '') dflt='-O';;
5251 *) dflt="$optimize";;
5252 esac
5253 $cat <<EOH
5254
5255 By default, $package compiles with the -O flag to use the optimizer.
5256 Alternately, you might want to use the symbolic debugger, which uses
5257 the -g flag (on traditional Unix systems).  Either flag can be
5258 specified here.  To use neither flag, specify the word "none".
5259
5260 EOH
5261 rp="What optimizer/debugger flag should be used?"
5262 . ./myread
5263 optimize="$ans"
5264 case "$optimize" in
5265 'none') optimize=" ";;
5266 esac
5267
5268 : Check what DEBUGGING is required from the command line
5269 : -DEBUGGING      or -DDEBUGGING or
5270 : -DEBUGGING=both                       = -g + -DDEBUGGING
5271 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5272 : -DEBUGGING=none or -UDEBUGGING        =
5273 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5274 case "$EBUGGING" in
5275 '')     ;;
5276 *)      DEBUGGING=$EBUGGING ;;
5277 esac
5278
5279 case "$DEBUGGING" in
5280 -g|both|$define)
5281     case "$optimize" in
5282         *-g*) ;;
5283         *)    optimize="$optimize -g" ;;
5284     esac ;;
5285 none|$undef)
5286     case "$optimize" in
5287         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5288                 shift
5289                 optimize="$*"
5290                 ;;
5291     esac ;;
5292 esac
5293
5294 dflt=''
5295 case "$DEBUGGING" in
5296 both|$define) dflt='-DDEBUGGING'
5297 esac
5298
5299 : argument order is deliberate, as the flag will start with - which set could
5300 : think is an option
5301 checkccflag='check=$1; flag=$2; callback=$3;
5302 echo " ";
5303 echo "Checking if your compiler accepts $flag" 2>&1;
5304 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5305 echo "int main(void) { return 0; }" > gcctest.c;
5306 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5307     echo "Yes, it does." 2>&1;
5308     if $test -s gcctest.out ; then
5309         echo "But your platform does not like it:";
5310         cat gcctest.out;
5311     else
5312         case "$ccflags" in
5313         *$check*)
5314             echo "Leaving current flags $ccflags alone." 2>&1
5315             ;;
5316         *) dflt="$dflt $flag";
5317             eval $callback
5318             ;;
5319         esac
5320     fi
5321 else
5322     echo "Nope, it does not, but that is ok." 2>&1;
5323 fi
5324 '
5325
5326 : We will not override a previous value, but we might want to
5327 : augment a hint file
5328 case "$hint" in
5329 default|recommended)
5330         case "$gccversion" in
5331         1*) dflt="$dflt -fpcc-struct-return" ;;
5332         esac
5333         case "$optimize:$DEBUGGING" in
5334         *-g*:old) dflt="$dflt -DDEBUGGING";;
5335         esac
5336         case "$gccversion" in
5337         2*) if $test -d /etc/conf/kconfig.d &&
5338                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5339                 then
5340                         # Interactive Systems (ISC) POSIX mode.
5341                         dflt="$dflt -posix"
5342                 fi
5343                 ;;
5344         esac
5345         case "$gccversion" in
5346         1*) ;;
5347         2.[0-8]*) ;;
5348         ?*)     set strict-aliasing -fno-strict-aliasing
5349                 eval $checkccflag
5350                 ;;
5351         esac
5352         # For gcc, adding -pipe speeds up compilations for some, but apparently
5353         # some assemblers can't read from stdin.  (It also slows down compilations
5354         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5355         case "$gccversion" in
5356         ?*)     set pipe -pipe
5357                 eval $checkccflag
5358                 ;;
5359         esac
5360
5361         # on x86_64 (at least) we require an extra library (libssp) in the
5362         # link command line. This library is not named, so I infer that it is
5363         # an implementation detail that may change. Hence the safest approach
5364         # is to add the flag to the flags passed to the compiler at link time,
5365         # as that way the compiler can do the right implementation dependant
5366         # thing. (NWC)
5367         case "$gccversion" in
5368         ?*)     set stack-protector -fstack-protector
5369                 eval $checkccflag
5370                 ;;
5371         esac
5372         ;;
5373 esac
5374
5375 case "$mips_type" in
5376 *BSD*|'') inclwanted="$locincpth $usrinc";;
5377 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5378 esac
5379 for thisincl in $inclwanted; do
5380         if $test -d $thisincl; then
5381                 if $test x$thisincl != x$usrinc; then
5382                         case "$dflt" in
5383                         *" -I$thisincl "*);;
5384                         *) dflt="$dflt -I$thisincl ";;
5385                         esac
5386                 fi
5387         fi
5388 done
5389
5390 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5391         xxx=true;
5392 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5393         xxx=true;
5394 else
5395         xxx=false;
5396 fi;
5397 if $xxx; then
5398         case "$dflt" in
5399         *$2*);;
5400         *) dflt="$dflt -D$2";;
5401         esac;
5402 fi'
5403
5404 set signal.h LANGUAGE_C; eval $inctest
5405
5406 case "$usesocks" in
5407 $define)
5408         ccflags="$ccflags -DSOCKS"
5409         ;;
5410 esac
5411
5412 case "$hint" in
5413 default|recommended) dflt="$ccflags $dflt" ;;
5414 *) dflt="$ccflags";;
5415 esac
5416
5417 case "$dflt" in
5418 ''|' ') dflt=none;;
5419 esac
5420
5421 $cat <<EOH
5422
5423 Your C compiler may want other flags.  For this question you should include
5424 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5425 but you should NOT include libraries or ld flags like -lwhatever.  If you
5426 want $package to honor its debug switch, you should include -DDEBUGGING here.
5427 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5428
5429 To use no flags, specify the word "none".
5430
5431 EOH
5432 set X $dflt
5433 shift
5434 dflt=${1+"$@"}
5435 rp="Any additional cc flags?"
5436 . ./myread
5437 case "$ans" in
5438 none) ccflags='';;
5439 *) ccflags="$ans";;
5440 esac
5441
5442 : the following weeds options from ccflags that are of no interest to cpp
5443 case "$cppflags" in
5444 '') cppflags="$ccflags" ;;
5445 *)  cppflags="$cppflags $ccflags" ;;
5446 esac
5447 case "$gccversion" in
5448 1*) cppflags="$cppflags -D__GNUC__"
5449 esac
5450 case "$mips_type" in
5451 '');;
5452 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5453 esac
5454 case "$cppflags" in
5455 '');;
5456 *)
5457         echo " "
5458         echo "Let me guess what the preprocessor flags are..." >&4
5459         set X $cppflags
5460         shift
5461         cppflags=''
5462         $cat >cpp.c <<'EOM'
5463 #define BLURFL foo
5464
5465 BLURFL xx LFRULB
5466 EOM
5467         previous=''
5468         for flag in $*
5469         do
5470                 case "$flag" in
5471                 -*) ftry="$flag";;
5472                 *) ftry="$previous $flag";;
5473                 esac
5474                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5475                         >cpp1.out 2>/dev/null && \
5476                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5477                         >cpp2.out 2>/dev/null && \
5478                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5479                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5480                 then
5481                         cppflags="$cppflags $ftry"
5482                         previous=''
5483                 else
5484                         previous="$flag"
5485                 fi
5486         done
5487         set X $cppflags
5488         shift
5489         cppflags=${1+"$@"}
5490         case "$cppflags" in
5491         *-*)  echo "They appear to be: $cppflags";;
5492         esac
5493         $rm -f cpp.c cpp?.out
5494         ;;
5495 esac
5496
5497 : flags used in final linking phase
5498 case "$ldflags" in
5499 '') if ./venix; then
5500                 dflt='-i -z'
5501         else
5502                 dflt=''
5503         fi
5504         case "$ccflags" in
5505         *-posix*) dflt="$dflt -posix" ;;
5506         esac
5507         ;;
5508 *) dflt="$ldflags";;
5509 esac
5510 # See note above about -fstack-protector
5511 case "$ccflags" in
5512 *-fstack-protector*)
5513         case "$dflt" in
5514         *-fstack-protector*) ;; # Don't add it again
5515         *) dflt="$dflt -fstack-protector" ;;
5516         esac
5517         ;;
5518 esac
5519
5520 : Try to guess additional flags to pick up local libraries.
5521 for thislibdir in $libpth; do
5522         case " $loclibpth " in
5523         *" $thislibdir "*)
5524                 case "$dflt " in
5525                 *"-L$thislibdir "*) ;;
5526                 *)  dflt="$dflt -L$thislibdir" ;;
5527                 esac
5528                 ;;
5529         esac
5530 done
5531
5532 case "$dflt" in
5533 '') dflt='none' ;;
5534 esac
5535
5536 $cat <<EOH
5537
5538 Your C linker may need flags.  For this question you should
5539 include -L/whatever and any other flags used by the C linker, but you
5540 should NOT include libraries like -lwhatever.
5541
5542 Make sure you include the appropriate -L/path flags if your C linker
5543 does not normally search all of the directories you specified above,
5544 namely
5545         $libpth
5546 To use no flags, specify the word "none".
5547
5548 EOH
5549
5550 rp="Any additional ld flags (NOT including libraries)?"
5551 . ./myread
5552 case "$ans" in
5553 none) ldflags='';;
5554 *) ldflags="$ans";;
5555 esac
5556 rmlist="$rmlist pdp11"
5557
5558 : coherency check
5559 echo " "
5560 echo "Checking your choice of C compiler and flags for coherency..." >&4
5561 $cat > try.c <<'EOF'
5562 #include <stdio.h>
5563 int main() { printf("Ok\n"); return(0); }
5564 EOF
5565 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5566 shift
5567 $cat >try.msg <<'EOM'
5568 I've tried to compile and run the following simple program:
5569
5570 EOM
5571 $cat try.c >> try.msg
5572
5573 $cat >> try.msg <<EOM
5574
5575 I used the command:
5576
5577         $*
5578         $run ./try
5579
5580 and I got the following output:
5581
5582 EOM
5583 dflt=y
5584 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5585         if $sh -c "$run ./try " >>try.msg 2>&1; then
5586                 xxx=`$run ./try`
5587                 case "$xxx" in
5588                 "Ok") dflt=n ;;
5589                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5590                 esac
5591         else
5592                 echo "The program compiled OK, but exited with status $?." >>try.msg
5593                 rp="You have a problem.  Shall I abort Configure"
5594                 dflt=y
5595         fi
5596 else
5597         echo "I can't compile the test program." >>try.msg
5598         rp="You have a BIG problem.  Shall I abort Configure"
5599         dflt=y
5600 fi
5601 case "$dflt" in
5602 y)
5603         $cat try.msg >&4
5604         case "$knowitall" in
5605         '')
5606                 echo "(The supplied flags or libraries might be incorrect.)"
5607                 ;;
5608         *) dflt=n;;
5609         esac
5610         echo " "
5611         . ./myread
5612         case "$ans" in
5613         n*|N*) ;;
5614         *)      echo "Ok.  Stopping Configure." >&4
5615                 exit 1
5616                 ;;
5617         esac
5618         ;;
5619 n) echo "OK, that should do.";;
5620 esac
5621 $rm_try gcctest gcctest.out
5622
5623 : define a shorthand compile call
5624 compile='
5625 mc_file=$1;
5626 shift;
5627 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5628 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5629 exit 1;
5630 fi;
5631 esac;
5632 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5633 : define a shorthand compile call for compilations that should be ok.
5634 compile_ok='
5635 mc_file=$1;
5636 shift;
5637 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5638
5639 : determine filename position in cpp output
5640 echo " "
5641 echo "Computing filename position in cpp output for #include directives..." >&4
5642 case "$osname" in
5643 vos) testaccess=-e ;;
5644 *)   testaccess=-r ;;
5645 esac
5646 echo '#include <stdio.h>' > foo.c
5647 $cat >fieldn <<EOF
5648 $startsh
5649 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5650 $grep '^[       ]*#.*stdio\.h' | \
5651 while read cline; do
5652         pos=1
5653         set \$cline
5654         while $test \$# -gt 0; do
5655                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5656                         echo "\$pos"
5657                         exit 0
5658                 fi
5659                 shift
5660                 pos=\`expr \$pos + 1\`
5661         done
5662 done
5663 EOF
5664 chmod +x fieldn
5665 fieldn=`./fieldn`
5666 $rm -f foo.c fieldn
5667 case $fieldn in
5668 '') pos='???';;
5669 1) pos=first;;
5670 2) pos=second;;
5671 3) pos=third;;
5672 *) pos="${fieldn}th";;
5673 esac
5674 echo "Your cpp writes the filename in the $pos field of the line."
5675
5676 : locate header file
5677 $cat >findhdr <<EOF
5678 $startsh
5679 wanted=\$1
5680 name=''
5681 for usrincdir in $incpth
5682 do
5683         if test -f \$usrincdir/\$wanted; then
5684                 echo "\$usrincdir/\$wanted"
5685                 exit 0
5686         fi
5687 done
5688 awkprg='{ print \$$fieldn }'
5689 echo "#include <\$wanted>" > foo\$\$.c
5690 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5691 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5692 while read cline; do
5693         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5694         case "\$name" in
5695         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5696         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5697         *) exit 2;;
5698         esac;
5699 done;
5700 #
5701 # status = 0: grep returned 0 lines, case statement not executed
5702 # status = 1: headerfile found
5703 # status = 2: while loop executed, no headerfile found
5704 #
5705 status=\$?
5706 $rm -f foo\$\$.c;
5707 if test \$status -eq 1; then
5708         exit 0;
5709 fi
5710 exit 1
5711 EOF
5712 chmod +x findhdr
5713
5714 : define an alternate in-header-list? function
5715 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5716 cont=true; xxf="echo \"<\$1> found.\" >&4";
5717 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5718 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5719 esac;
5720 case $# in 4) instead=instead;; *) instead="at last";; esac;
5721 while $test "$cont"; do
5722         xxx=`./findhdr $1`
5723         var=$2; eval "was=\$$2";
5724         if $test "$xxx" && $test -r "$xxx";
5725         then eval $xxf;
5726         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5727                 cont="";
5728         else eval $xxnf;
5729         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5730         set $yyy; shift; shift; yyy=$@;
5731         case $# in 0) cont="";;
5732         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5733                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5734         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5735                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5736         esac;
5737 done;
5738 while $test "$yyy";
5739 do set $yyy; var=$2; eval "was=\$$2";
5740         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5741         set $yyy; shift; shift; yyy=$@;
5742 done'
5743
5744 : see if stdlib is available
5745 set stdlib.h i_stdlib
5746 eval $inhdr
5747
5748 : check for lengths of integral types
5749 echo " "
5750 case "$intsize" in
5751 '')
5752         echo "Checking to see how big your integers are..." >&4
5753         $cat >try.c <<EOCP
5754 #include <stdio.h>
5755 #$i_stdlib I_STDLIB
5756 #ifdef I_STDLIB
5757 #include <stdlib.h>
5758 #endif
5759 int main()
5760 {
5761         printf("intsize=%d;\n", (int)sizeof(int));
5762         printf("longsize=%d;\n", (int)sizeof(long));
5763         printf("shortsize=%d;\n", (int)sizeof(short));
5764         exit(0);
5765 }
5766 EOCP
5767         set try
5768         if eval $compile_ok && $run ./try > /dev/null; then
5769                 eval `$run ./try`
5770                 echo "Your integers are $intsize bytes long."
5771                 echo "Your long integers are $longsize bytes long."
5772                 echo "Your short integers are $shortsize bytes long."
5773         else
5774                 $cat >&4 <<EOM
5775 !
5776 Help! I can't compile and run the intsize test program: please enlighten me!
5777 (This is probably a misconfiguration in your system or libraries, and
5778 you really ought to fix it.  Still, I'll try anyway.)
5779 !
5780 EOM
5781                 dflt=4
5782                 rp="What is the size of an integer (in bytes)?"
5783                 . ./myread
5784                 intsize="$ans"
5785                 dflt=$intsize
5786                 rp="What is the size of a long integer (in bytes)?"
5787                 . ./myread
5788                 longsize="$ans"
5789                 dflt=2
5790                 rp="What is the size of a short integer (in bytes)?"
5791                 . ./myread
5792                 shortsize="$ans"
5793         fi
5794         ;;
5795 esac
5796 $rm_try
5797
5798 : check for long long
5799 echo " "
5800 echo "Checking to see if you have long long..." >&4
5801 echo 'int main() { long long x = 7; return 0; }' > try.c
5802 set try
5803 if eval $compile; then
5804         val="$define"
5805         echo "You have long long."
5806 else
5807         val="$undef"
5808         echo "You do not have long long."
5809 fi
5810 $rm_try
5811 set d_longlong
5812 eval $setvar
5813
5814 : check for length of long long
5815 case "${d_longlong}${longlongsize}" in
5816 $define)
5817         echo " "
5818         echo "Checking to see how big your long longs are..." >&4
5819         $cat >try.c <<'EOCP'
5820 #include <stdio.h>
5821 int main()
5822 {
5823     printf("%d\n", (int)sizeof(long long));
5824     return(0);
5825 }
5826 EOCP
5827         set try
5828         if eval $compile_ok; then
5829                 longlongsize=`$run ./try`
5830                 echo "Your long longs are $longlongsize bytes long."
5831         else
5832                 dflt='8'
5833                 echo " "
5834                 echo "(I can't seem to compile the test program.  Guessing...)"
5835                 rp="What is the size of a long long (in bytes)?"
5836                 . ./myread
5837                 longlongsize="$ans"
5838         fi
5839         if $test "X$longsize" = "X$longlongsize"; then
5840                 echo "(That isn't any different from an ordinary long.)"
5841         fi
5842         ;;
5843 esac
5844 $rm_try
5845
5846 : see if inttypes.h is available
5847 : we want a real compile instead of Inhdr because some systems
5848 : have an inttypes.h which includes non-existent headers
5849 echo " "
5850 $cat >try.c <<EOCP
5851 #include <inttypes.h>
5852 int main() {
5853         static int32_t foo32 = 0x12345678;
5854 }
5855 EOCP
5856 set try
5857 if eval $compile; then
5858         echo "<inttypes.h> found." >&4
5859         val="$define"
5860 else
5861         echo "<inttypes.h> NOT found." >&4
5862         val="$undef"
5863 fi
5864 $rm_try
5865 set i_inttypes
5866 eval $setvar
5867
5868 : check for int64_t
5869 echo " "
5870 echo "Checking to see if you have int64_t..." >&4
5871 $cat >try.c <<EOCP
5872 #include <sys/types.h>
5873 #$i_inttypes I_INTTYPES
5874 #ifdef I_INTTYPES
5875 #include <inttypes.h>
5876 #endif
5877 int main() { int64_t x = 7; }
5878 EOCP
5879 set try
5880 if eval $compile; then
5881         val="$define"
5882         echo "You have int64_t."
5883 else
5884         val="$undef"
5885         echo "You do not have int64_t."
5886 fi
5887 $rm_try
5888 set d_int64_t
5889 eval $setvar
5890
5891 : Check if 64bit ints have a quad type
5892 echo " "
5893 echo "Checking which 64-bit integer type we could use..." >&4
5894
5895 case "$intsize" in
5896 8) val=int
5897    set quadtype
5898    eval $setvar
5899    val='"unsigned int"'
5900    set uquadtype
5901    eval $setvar
5902    quadkind=1
5903    ;;
5904 *) case "$longsize" in
5905    8) val=long
5906       set quadtype
5907       eval $setvar
5908       val='"unsigned long"'
5909       set uquadtype
5910       eval $setvar
5911       quadkind=2
5912       ;;
5913    *) case "$d_longlong:$longlongsize" in
5914       define:8)
5915         val='"long long"'
5916         set quadtype
5917         eval $setvar
5918         val='"unsigned long long"'
5919         set uquadtype
5920         eval $setvar
5921         quadkind=3
5922         ;;
5923       *) case "$d_int64_t" in
5924          define)
5925            val=int64_t
5926            set quadtype
5927            eval $setvar
5928            val=uint64_t
5929            set uquadtype
5930            eval $setvar
5931            quadkind=4
5932            ;;
5933          esac
5934          ;;
5935       esac
5936       ;;
5937    esac
5938    ;;
5939 esac
5940
5941 case "$quadtype" in
5942 '')     echo "Alas, no 64-bit integer types in sight." >&4
5943         d_quad="$undef"
5944         ;;
5945 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5946         d_quad="$define"
5947         ;;
5948 esac
5949
5950 : Do we want 64bit support
5951 case "$uselonglong" in
5952 "$define"|true|[yY]*)
5953         cat <<EOM >&4
5954
5955 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5956 EOM
5957         use64bitint="$define"
5958         ;;
5959 esac
5960 case "$use64bits" in
5961 "$define"|true|[yY]*)
5962         cat <<EOM >&4
5963
5964 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5965 EOM
5966         use64bitint="$define"
5967         ;;
5968 esac
5969 case "$use64bitints" in
5970 "$define"|true|[yY]*)
5971         cat <<EOM >&4
5972
5973 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5974 EOM
5975         use64bitint="$define"
5976         ;;
5977 esac
5978 case "$use64bitsint" in
5979 "$define"|true|[yY]*)
5980         cat <<EOM >&4
5981
5982 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5983 EOM
5984         use64bitint="$define"
5985         ;;
5986 esac
5987 case "$uselonglongs" in
5988 "$define"|true|[yY]*)
5989         cat <<EOM >&4
5990
5991 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5992 EOM
5993         use64bitint="$define"
5994         ;;
5995 esac
5996 case "$use64bitsall" in
5997 "$define"|true|[yY]*)
5998         cat <<EOM >&4
5999
6000 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6001 EOM
6002         use64bitall="$define"
6003         ;;
6004 esac
6005
6006 case "$ccflags" in
6007 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6008 esac
6009 case "$use64bitall" in
6010 "$define"|true|[yY]*) use64bitint="$define" ;;
6011 esac
6012
6013 case "$longsize" in
6014 8) cat <<EOM
6015
6016 You have natively 64-bit long integers.
6017 EOM
6018    val="$define"
6019    ;;
6020 *) case "$use64bitint" in
6021    "$define"|true|[yY]*) dflt='y';;
6022    *) dflt='n';;
6023    esac
6024    case "$d_quad" in
6025    "$define") ;;
6026    *) dflt='n' ;;
6027    esac
6028    cat <<EOM
6029
6030 Perl can be built to take advantage of 64-bit integer types
6031 on some systems.  To do so, Configure can be run with -Duse64bitint.
6032 Choosing this option will most probably introduce binary incompatibilities.
6033
6034 If this doesn't make any sense to you, just accept the default '$dflt'.
6035 (The default has been chosen based on your configuration.)
6036 EOM
6037    rp='Try to use 64-bit integers, if available?'
6038    . ./myread
6039    case "$ans" in
6040    [yY]*) val="$define" ;;
6041    *)     val="$undef"  ;;
6042    esac
6043    ;;
6044 esac
6045 set use64bitint
6046 eval $setvar
6047
6048 case "$use64bitall" in
6049 "$define"|true|[yY]*) dflt='y' ;;
6050 *) case "$longsize" in
6051    8) dflt='y' ;;
6052    *) dflt='n' ;;
6053    esac
6054    ;;
6055 esac
6056 cat <<EOM
6057
6058 You may also choose to try maximal 64-bitness.  It means using as much
6059 64-bitness as possible on the platform.  This in turn means even more
6060 binary incompatibilities.  On the other hand, your platform may not
6061 have any more 64-bitness available than what you already have chosen.
6062
6063 If this doesn't make any sense to you, just accept the default '$dflt'.
6064 (The default has been chosen based on your configuration.)
6065 EOM
6066 rp='Try to use maximal 64-bit support, if available?'
6067 . ./myread
6068 case "$ans" in
6069 [yY]*) val="$define" ;;
6070 *)     val="$undef"  ;;
6071 esac
6072 set use64bitall
6073 eval $setvar
6074 case "$use64bitall" in
6075 "$define")
6076         case "$use64bitint" in
6077         "$undef")
6078                 cat <<EOM
6079
6080 Since you have chosen a maximally 64-bit build, I'm also turning on
6081 the use of 64-bit integers.
6082 EOM
6083                 use64bitint="$define" ;;
6084         esac
6085         ;;
6086 esac
6087
6088 : Look for a hint-file generated 'call-back-unit'.  If the
6089 : user has specified that a 64-bit perl is to be built,
6090 : we may need to set or change some other defaults.
6091 if $test -f use64bitint.cbu; then
6092         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6093         . ./use64bitint.cbu
6094 fi
6095 case "$use64bitint" in
6096 "$define"|true|[yY]*)
6097         : This test was common to all the OpenBSD forks, and seems harmless for
6098         : other platforms:
6099         echo " "
6100         echo "Checking if your C library has broken 64-bit functions..." >&4
6101         cat >try.c <<EOCP
6102 #include <stdio.h>
6103 typedef $uquadtype myULL;
6104 int main (void)
6105 {
6106     struct {
6107         double d;
6108         myULL  u;
6109     } *p, test[] = {
6110         {4294967303.15, 4294967303ULL},
6111         {4294967294.2,  4294967294ULL},
6112         {4294967295.7,  4294967295ULL},
6113         {0.0, 0ULL}
6114     };
6115     for (p = test; p->u; p++) {
6116         myULL x = (myULL)p->d;
6117         if (x != p->u) {
6118             printf("buggy\n");
6119             return 0;
6120         }
6121     }
6122     printf("ok\n");
6123     return 0;
6124 }
6125 EOCP
6126         set try
6127         if eval $compile_ok; then
6128             libcquad=`$run ./try`
6129             echo "Your C library's 64-bit functions are $libcquad."
6130         else
6131             echo "(I can't seem to compile the test program.)"
6132             echo "Assuming that your C library's 64-bit functions are ok."
6133             libcquad="ok"
6134         fi
6135         $rm_try
6136
6137         case "$libcquad" in
6138             buggy*)
6139                 cat >&4 <<EOM
6140
6141 *** You have a C library with broken 64-bit functions.
6142 *** 64-bit support does not work reliably in this configuration.
6143 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6144 *** Cannot continue, aborting.
6145
6146 EOM
6147                 exit 1
6148                 ;;
6149         esac
6150         case "$longsize" in
6151         4) case "$archname64" in
6152            '') archname64=64int ;;
6153            esac
6154            ;;
6155         esac
6156         ;;
6157 esac
6158
6159 : Look for a hint-file generated 'call-back-unit'.  If the
6160 : user has specified that a maximally 64-bit perl is to be built,
6161 : we may need to set or change some other defaults.
6162 if $test -f use64bitall.cbu; then
6163         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6164         . ./use64bitall.cbu
6165 fi
6166 case "$use64bitall" in
6167 "$define"|true|[yY]*)
6168         case "$longsize" in
6169         4) case "$archname64" in
6170            ''|64int) archname64=64all ;;
6171            esac
6172            ;;
6173         esac
6174         ;;
6175 esac
6176
6177 case "$d_quad:$use64bitint" in
6178 $undef:$define)
6179         cat >&4 <<EOF
6180
6181 *** You have chosen to use 64-bit integers,
6182 *** but none can be found.
6183 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6184 *** Cannot continue, aborting.
6185
6186 EOF
6187         exit 1
6188         ;;
6189 esac
6190
6191 : check for length of double
6192 echo " "
6193 case "$doublesize" in
6194 '')
6195         echo "Checking to see how big your double precision numbers are..." >&4
6196         $cat >try.c <<EOCP
6197 #include <stdio.h>
6198 #$i_stdlib I_STDLIB
6199 #ifdef I_STDLIB
6200 #include <stdlib.h>
6201 #endif
6202 int main()
6203 {
6204     printf("%d\n", (int)sizeof(double));
6205     exit(0);
6206 }
6207 EOCP
6208         set try
6209         if eval $compile_ok; then
6210                 doublesize=`$run ./try`
6211                 echo "Your double is $doublesize bytes long."
6212         else
6213                 dflt='8'
6214                 echo "(I can't seem to compile the test program.  Guessing...)"
6215                 rp="What is the size of a double precision number (in bytes)?"
6216                 . ./myread
6217                 doublesize="$ans"
6218         fi
6219         ;;
6220 esac
6221 $rm_try
6222
6223 : check for long doubles
6224 echo " "
6225 echo "Checking to see if you have long double..." >&4
6226 echo 'int main() { long double x = 7.0; }' > try.c
6227 set try
6228 if eval $compile; then
6229         val="$define"
6230         echo "You have long double."
6231 else
6232         val="$undef"
6233         echo "You do not have long double."
6234 fi
6235 $rm_try
6236 set d_longdbl
6237 eval $setvar
6238
6239 : check for length of long double
6240 case "${d_longdbl}${longdblsize}" in
6241 $define)
6242         echo " "
6243         echo "Checking to see how big your long doubles are..." >&4
6244         $cat >try.c <<'EOCP'
6245 #include <stdio.h>
6246 int main()
6247 {
6248         printf("%d\n", sizeof(long double));
6249 }
6250 EOCP
6251         set try
6252         set try
6253         if eval $compile; then
6254                 longdblsize=`$run ./try`
6255                 echo "Your long doubles are $longdblsize bytes long."
6256         else
6257                 dflt='8'
6258                 echo " "
6259                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6260                 rp="What is the size of a long double (in bytes)?"
6261                 . ./myread
6262                 longdblsize="$ans"
6263         fi
6264         if $test "X$doublesize" = "X$longdblsize"; then
6265                 echo "That isn't any different from an ordinary double."
6266                 echo "I'll keep your setting anyway, but you may see some"
6267                 echo "harmless compilation warnings."
6268         fi
6269         ;;
6270 esac
6271 $rm_try
6272
6273 : determine the architecture name
6274 echo " "
6275 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6276         tarch=`arch`"-$osname"
6277 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6278         if uname -m > tmparch 2>&1 ; then
6279                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6280                         -e 's/$/'"-$osname/" tmparch`
6281         else
6282                 tarch="$osname"
6283         fi
6284         $rm -f tmparch
6285 else
6286         tarch="$osname"
6287 fi
6288 case "$myarchname" in
6289 ''|"$tarch") ;;
6290 *)
6291         echo "(Your architecture name used to be $myarchname.)"
6292         archname=''
6293         ;;
6294 esac
6295 case "$targetarch" in
6296 '') ;;
6297 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6298 esac
6299 myarchname="$tarch"
6300 case "$archname" in
6301 '') dflt="$tarch";;
6302 *) dflt="$archname";;
6303 esac
6304 rp='What is your architecture name'
6305 . ./myread
6306 archname="$ans"
6307
6308 : optionally add API version to the architecture for versioned archlibs
6309 case "$useversionedarchname" in
6310 $define|true|[yY]*) dflt='y';;
6311 *)                  dflt='n';;
6312 esac
6313 rp='Add the Perl API version to your archname?'
6314 . ./myread
6315 case "$ans" in
6316 y|Y)    useversionedarchname="$define" ;;
6317 *)      useversionedarchname="$undef" ;;
6318 esac
6319 case "$useversionedarchname" in
6320 $define)
6321         case "$archname" in
6322         *-$api_versionstring)
6323                 echo "...and architecture name already has -$api_versionstring" >&4
6324                 ;;
6325         *)
6326                 archname="$archname-$api_versionstring"
6327                 echo "...setting architecture name to $archname." >&4
6328                 ;;
6329         esac
6330         ;;
6331 esac
6332
6333 case "$usethreads" in
6334 $define)
6335         echo "Threads selected." >&4
6336         case "$archname" in
6337         *-thread*) echo "...and architecture name already has -thread." >&4
6338                 ;;
6339         *)      archname="$archname-thread"
6340                 echo "...setting architecture name to $archname." >&4
6341                 ;;
6342         esac
6343         ;;
6344 esac
6345 case "$usemultiplicity" in
6346 $define)
6347         echo "Multiplicity selected." >&4
6348         case "$archname" in
6349         *-multi*) echo "...and architecture name already has -multi." >&4
6350                 ;;
6351         *)      archname="$archname-multi"
6352                 echo "...setting architecture name to $archname." >&4
6353                 ;;
6354         esac
6355         ;;
6356 esac
6357 case "$use64bitint$use64bitall" in
6358 *"$define"*)
6359         case "$archname64" in
6360         '')
6361                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6362                 ;;
6363         *)
6364                 case "$use64bitint" in
6365                 "$define") echo "64 bit integers selected." >&4 ;;
6366                 esac
6367                 case "$use64bitall" in
6368                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6369                 esac
6370                 case "$archname" in
6371                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6372                         ;;
6373                 *)      archname="$archname-$archname64"
6374                         echo "...setting architecture name to $archname." >&4
6375                         ;;
6376                 esac
6377                 ;;
6378         esac
6379 esac
6380 case "$uselongdouble" in
6381 $define)
6382         echo "Long doubles selected." >&4
6383         case "$longdblsize" in
6384         $doublesize)
6385                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6386                 ;;
6387         *)
6388                 case "$archname" in
6389                 *-ld*) echo "...and architecture name already has -ld." >&4
6390                         ;;
6391                 *)      archname="$archname-ld"
6392                         echo "...setting architecture name to $archname." >&4
6393                         ;;
6394                 esac
6395                 ;;
6396         esac
6397         ;;
6398 esac
6399 if $test -f archname.cbu; then
6400         echo "Your platform has some specific hints for architecture name, using them..."
6401         . ./archname.cbu
6402 fi
6403
6404 : set the prefixit variable, to compute a suitable default value
6405 prefixit='case "$3" in
6406 ""|none)
6407         case "$oldprefix" in
6408         "") eval "$1=\"\$$2\"";;
6409         *)
6410                 case "$3" in
6411                 "") eval "$1=";;
6412                 none)
6413                         eval "tp=\"\$$2\"";
6414                         case "$tp" in
6415                         ""|" ") eval "$1=\"\$$2\"";;
6416                         *) eval "$1=";;
6417                         esac;;
6418                 esac;;
6419         esac;;
6420 *)
6421         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6422         case "$tp" in
6423         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6424         /*-$oldprefix/*|\~*-$oldprefix/*)
6425                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6426         *) eval "$1=\"\$$2\"";;
6427         esac;;
6428 esac'
6429
6430 : determine installation style
6431 : For now, try to deduce it from prefix unless it is already set.
6432 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6433 case "$installstyle" in
6434 '')     case "$prefix" in
6435                 *perl*) dflt='lib';;
6436                 *) dflt='lib/perl5' ;;
6437         esac
6438         ;;
6439 *)      dflt="$installstyle" ;;
6440 esac
6441 : Probably not worth prompting for this since we prompt for all
6442 : the directories individually, and the prompt would be too long and
6443 : confusing anyway.
6444 installstyle=$dflt
6445
6446 : determine where public executables go
6447 echo " "
6448 set dflt bin bin
6449 eval $prefixit
6450 fn=d~
6451 rp='Pathname where the public executables will reside?'
6452 . ./getfile
6453 if $test "X$ansexp" != "X$binexp"; then
6454         installbin=''
6455 fi
6456 prefixvar=bin
6457 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6458 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6459 :     this via initialinstalllocation
6460 . ./setprefixvar
6461
6462 case "$userelocatableinc" in
6463 $define|true|[yY]*)     dflt='y' ;;
6464 *)                      dflt='n' ;;
6465 esac
6466 cat <<EOM
6467
6468 Would you like to build Perl so that the installation is relocatable, so that
6469 library paths in @INC are determined relative to the path of the perl binary?
6470 This is not advised for system Perl installs, or if you need to run setid
6471 scripts or scripts under taint mode.
6472
6473 If this doesn't make any sense to you, just accept the default '$dflt'.
6474 EOM
6475 rp='Use relocatable @INC?'
6476 . ./myread
6477 case "$ans" in
6478 y|Y)    val="$define" ;;
6479 *)      val="$undef"  ;;
6480 esac
6481 set userelocatableinc
6482 eval $setvar
6483
6484 initialinstalllocation="$binexp"
6485 : Default prefix is now "up one level from where the binaries are"
6486 case "$userelocatableinc" in
6487 $define|true|[yY]*)
6488     bin=".../"
6489     binexp=".../"
6490     prefix=".../.."
6491     prefixexp=".../.."
6492     installprefixexp=".../.."
6493     ;;
6494 esac
6495
6496 : determine where private library files go
6497 : Usual default is /usr/local/lib/perl5/$version.
6498 : Also allow things like /opt/perl/lib/$version, since
6499 : /opt/perl/lib/perl5... would be redundant.
6500 : The default "style" setting is made in installstyle.U
6501 case "$installstyle" in
6502 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6503 *)       set dflt privlib lib/$version ;;
6504 esac
6505 eval $prefixit
6506 $cat <<EOM
6507
6508 There are some auxiliary files for $package that need to be put into a
6509 private library directory that is accessible by everyone.
6510
6511 EOM
6512 fn=$binexp
6513 fn=d~+
6514 rp='Pathname where the private library files will reside?'
6515 . ./getfile
6516 prefixvar=privlib
6517 . ./setprefixvar
6518
6519 : set the prefixup variable, to restore leading tilda escape
6520 prefixup='case "$prefixexp" in
6521 "$prefix") ;;
6522 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6523 esac'
6524
6525 : determine where public architecture dependent libraries go
6526 set archlib archlib
6527 eval $prefixit
6528 : privlib default is /usr/local/lib/$package/$version
6529 : archlib default is /usr/local/lib/$package/$version/$archname
6530 : privlib may have an optional trailing /share.
6531 tdflt=`echo $privlib | $sed 's,/share$,,'`
6532 tdflt=$tdflt/$archname
6533 case "$archlib" in
6534 '')     dflt=$tdflt
6535         ;;
6536 *)      dflt="$archlib"
6537     ;;
6538 esac
6539 $cat <<EOM
6540
6541 $spackage contains architecture-dependent library files.  If you are
6542 sharing libraries in a heterogeneous environment, you might store
6543 these files in a separate location.  Otherwise, you can just include
6544 them with the rest of the public library files.
6545
6546 EOM
6547 fn=$binexp
6548 fn=d+~
6549 rp='Where do you want to put the public architecture-dependent libraries?'
6550 . ./getfile
6551 prefixvar=archlib
6552 . ./setprefixvar
6553 if $test X"$archlib" = X"$privlib"; then
6554         d_archlib="$undef"
6555 else
6556         d_archlib="$define"
6557 fi
6558
6559 : see if setuid scripts can be secure
6560 $cat <<EOM
6561
6562 Some kernels have a bug that prevents setuid #! scripts from being
6563 secure.  Some sites have disabled setuid #! scripts because of this.
6564
6565 First let's decide if your kernel supports secure setuid #! scripts.
6566 (If setuid #! scripts would be secure but have been disabled anyway,
6567 don't say that they are secure if asked.)
6568
6569 EOM
6570
6571 val="$undef"
6572 if $test -d /dev/fd; then
6573         echo "#!$ls" >reflect
6574         chmod +x,u+s reflect
6575         ./reflect >flect 2>&1
6576         if $contains "/dev/fd" flect >/dev/null; then
6577                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6578                 val="$define"
6579         else
6580                 $cat <<EOM
6581 If you are not sure if they are secure, I can check but I'll need a
6582 username and password different from the one you are using right now.
6583 If you don't have such a username or don't want me to test, simply
6584 enter 'none'.
6585
6586 EOM
6587                 rp='Other username to test security of setuid scripts with?'
6588                 dflt='none'
6589                 . ./myread
6590                 case "$ans" in
6591                 n|none)
6592                         case "$d_suidsafe" in
6593                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6594                                 dflt=n;;
6595                         "$undef")
6596                                 echo "Well, the $hint value is *not* secure." >&4
6597                                 dflt=n;;
6598                         *)      echo "Well, the $hint value *is* secure." >&4
6599                                 dflt=y;;
6600                         esac
6601                         ;;
6602                 *)
6603                         $rm -f reflect flect
6604                         echo "#!$ls" >reflect
6605                         chmod +x,u+s reflect
6606                         echo >flect
6607                         chmod a+w flect
6608                         echo '"su" will (probably) prompt you for '"$ans's password."
6609                         su $ans -c './reflect >flect'
6610                         if $contains "/dev/fd" flect >/dev/null; then
6611                                 echo "Okay, it looks like setuid scripts are secure." >&4
6612                                 dflt=y
6613                         else
6614                                 echo "I don't think setuid scripts are secure." >&4
6615                                 dflt=n
6616                         fi
6617                         ;;
6618                 esac
6619                 rp='Does your kernel have *secure* setuid scripts?'
6620                 . ./myread
6621                 case "$ans" in
6622                 [yY]*)  val="$define";;
6623                 *)      val="$undef";;
6624                 esac
6625         fi
6626 else
6627         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6628         echo "(That's for file descriptors, not floppy disks.)"
6629         val="$undef"
6630 fi
6631 set d_suidsafe
6632 eval $setvar
6633
6634 $rm -f reflect flect
6635
6636 : now see if they want to do setuid emulation
6637 if $test $patchlevel -lt 11; then
6638 echo " "
6639 val="$undef"
6640 case "$d_suidsafe" in
6641 "$define")
6642         val="$undef"
6643         echo "No need to emulate SUID scripts since they are secure here." >&4
6644         ;;
6645 *)
6646         $cat <<EOM
6647 Some systems have disabled setuid scripts, especially systems where
6648 setuid scripts cannot be secure.  On systems where setuid scripts have
6649 been disabled, the setuid/setgid bits on scripts are currently
6650 useless.  It is possible for $package to detect those bits and emulate
6651 setuid/setgid in a secure fashion.  This emulation will only work if
6652 setuid scripts have been disabled in your kernel.
6653
6654 EOM
6655         case "$d_dosuid" in
6656         "$define") dflt=y ;;
6657         *) dflt=n ;;
6658         esac
6659         rp="Do you want to do setuid/setgid emulation?"
6660         . ./myread
6661         case "$ans" in
6662         [yY]*)  val="$define";;
6663         *)      val="$undef";;
6664         esac
6665         ;;
6666 esac
6667 set d_dosuid
6668 eval $setvar
6669 else
6670     case "$d_dosuid" in
6671         "$define")
6672         cat >&4 <<EOH
6673
6674 SUID emulation has been removed for 5.12
6675 Please re-run Configure without -Dd_dosuid
6676
6677 EOH
6678         exit 1;
6679         ;;
6680     esac
6681     d_dosuid=undef
6682 fi
6683
6684 : Find perl5.005 or later.
6685 echo "Looking for a previously installed perl5.005 or later... "
6686 case "$perl5" in
6687 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6688                 : Check if this perl is recent and can load a simple module
6689                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6690                         perl5=$tdir/perl
6691                         break;
6692                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6693                         perl5=$tdir/perl5
6694                         break;
6695                 fi
6696         done
6697         ;;
6698 *)      perl5="$perl5"
6699         ;;
6700 esac
6701 case "$perl5" in
6702 '')     echo "None found.  That's ok.";;
6703 *)      echo "Using $perl5." ;;
6704 esac
6705
6706 : Set the siteprefix variables
6707 $cat <<EOM
6708
6709 After $package is installed, you may wish to install various
6710 add-on modules and utilities.  Typically, these add-ons will
6711 be installed under $prefix with the rest
6712 of this package.  However, you may wish to install such add-ons
6713 elsewhere under a different prefix.
6714
6715 If you do not wish to put everything under a single prefix, that's
6716 ok.  You will be prompted for the individual locations; this siteprefix
6717 is only used to suggest the defaults.
6718
6719 The default should be fine for most people.
6720
6721 EOM
6722 fn=d~+
6723 rp='Installation prefix to use for add-on modules and utilities?'
6724 : XXX Here might be another good place for an installstyle setting.
6725 case "$siteprefix" in
6726 '') dflt=$prefix ;;
6727 *)  dflt=$siteprefix ;;
6728 esac
6729 . ./getfile
6730 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6731 oldsiteprefix=''
6732 case "$siteprefix" in
6733 '') ;;
6734 *)      case "$ans" in
6735         "$prefix") ;;
6736         *) oldsiteprefix="$prefix";;
6737         esac
6738         ;;
6739 esac
6740 siteprefix="$ans"
6741 siteprefixexp="$ansexp"
6742
6743 : determine where site specific libraries go.
6744 : Usual default is /usr/local/lib/perl5/site_perl/$version
6745 : The default "style" setting is made in installstyle.U
6746 : XXX No longer works with Prefixit stuff.
6747 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6748 case "$sitelib" in
6749 '') case "$installstyle" in
6750         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6751         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6752         esac
6753         ;;
6754 *)      dflt="$sitelib"
6755         ;;
6756 esac
6757 $cat <<EOM
6758
6759 The installation process will create a directory for
6760 site-specific extensions and modules.  Most users find it convenient
6761 to place all site-specific files in this directory rather than in the
6762 main distribution directory.
6763
6764 EOM
6765 fn=d~+
6766 rp='Pathname for the site-specific library files?'
6767 . ./getfile
6768 prefixvar=sitelib
6769 . ./setprefixvar
6770 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6771
6772 : Determine list of previous versions to include in @INC
6773 $cat > getverlist <<EOPL
6774 #!$perl5 -w
6775 use File::Basename;
6776 \$api_versionstring = "$api_versionstring";
6777 \$version = "$version";
6778 \$stem = "$sitelib_stem";
6779 \$archname = "$archname";
6780 EOPL
6781         $cat >> getverlist <<'EOPL'
6782 # The list found is store twice for each entry: the original name, and
6783 # the binary broken down version as pack "sss", so sorting is easy and
6784 # unambiguous. This will work for all versions that have a maximum of
6785 # three digit groups, separate by '.'s or '_'s. Names are extended with
6786 # ".0.0" to ensure at least three elements for the pack.
6787 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6788
6789 # Can't have leading @ because metaconfig interprets it as a command!
6790 ;@inc_version_list=();
6791 # XXX Redo to do opendir/readdir?
6792 if (-d $stem) {
6793     chdir($stem);
6794     ;@candidates = map {
6795         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6796     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6797 }
6798 else {
6799     ;@candidates = ();
6800 }
6801
6802 ($pversion, $aversion, $vsn5005) = map {
6803     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6804 foreach $d (@candidates) {
6805     if ($d->[1] lt $pversion) {
6806         if ($d->[1] ge $aversion) {
6807             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6808         }
6809         elsif ($d->[1] ge $vsn5005) {
6810             unshift(@inc_version_list, grep { -d } $d->[0]);
6811         }
6812     }
6813     else {
6814         # Skip newer version.  I.e. don't look in
6815         # 5.7.0 if we're installing 5.6.1.
6816     }
6817 }
6818
6819 if (@inc_version_list) {
6820     print join(' ', @inc_version_list);
6821 }
6822 else {
6823     # Blank space to preserve value for next Configure run.
6824     print " ";
6825 }
6826 EOPL
6827 chmod +x getverlist
6828 case "$inc_version_list" in
6829 '')     if test -x "$perl5$exe_ext"; then
6830                 dflt=`$perl5 getverlist`
6831         else
6832                 dflt='none'
6833         fi
6834         ;;
6835 $undef) dflt='none' ;;
6836 *)  eval dflt=\"$inc_version_list\" ;;
6837 esac
6838 case "$dflt" in
6839 ''|' ') dflt=none ;;
6840 esac
6841 case "$dflt" in
6842 5.005) dflt=none ;;
6843 esac
6844 $cat <<EOM
6845
6846 In order to ease the process of upgrading, this version of perl
6847 can be configured to use modules built and installed with earlier
6848 versions of perl that were installed under $prefix.  Specify here
6849 the list of earlier versions that this version of perl should check.
6850 If Configure detected no earlier versions of perl installed under
6851 $prefix, then the list will be empty.  Answer 'none' to tell perl
6852 to not search earlier versions.
6853
6854 The default should almost always be sensible, so if you're not sure,
6855 just accept the default.
6856 EOM
6857
6858 rp='List of earlier versions to include in @INC?'
6859 . ./myread
6860 case "$ans" in
6861 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6862 *) inc_version_list="$ans" ;;
6863 esac
6864 case "$inc_version_list" in
6865 ''|' ')
6866         inc_version_list_init='0'
6867         d_inc_version_list="$undef"
6868         ;;
6869 *)      inc_version_list_init=`echo $inc_version_list |
6870                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6871         d_inc_version_list="$define"
6872         ;;
6873 esac
6874 $rm -f getverlist
6875
6876 : see if malloc/malloc.h has to be included
6877 set malloc/malloc.h i_mallocmalloc
6878 eval $inhdr
6879
6880 : see if this is a malloc.h system
6881 : we want a real compile instead of Inhdr because some systems have a
6882 : malloc.h that just gives a compile error saying to use stdlib.h instead
6883 echo " "
6884 $cat >try.c <<EOCP
6885 #include <stdlib.h>
6886 #include <malloc.h>
6887 #$i_mallocmalloc I_MALLOCMALLOC
6888 #ifdef I_MALLOCMALLOC
6889 # include <malloc/malloc.h>
6890 #endif
6891
6892 int main () { return 0; }
6893 EOCP
6894 set try
6895 if eval $compile; then
6896     echo "<malloc.h> found." >&4
6897     val="$define"
6898 else
6899     echo "<malloc.h> NOT found." >&4
6900     val="$undef"
6901 fi
6902 $rm_try
6903 set i_malloc
6904 eval $setvar
6905
6906 : check for length of pointer
6907 echo " "
6908 case "$ptrsize" in
6909 '')
6910         echo "Checking to see how big your pointers are..." >&4
6911         $cat >>try.c <<EOCP
6912 #include <stdio.h>
6913 #$i_stdlib I_STDLIB
6914 #ifdef I_STDLIB
6915 #include <stdlib.h>
6916 #endif
6917 int main()
6918 {
6919     printf("%d\n", (int)sizeof(void *));
6920     exit(0);
6921 }
6922 EOCP
6923         set try
6924         if eval $compile_ok; then
6925                 ptrsize=`$run ./try`
6926                 echo "Your pointers are $ptrsize bytes long."
6927         else
6928                 dflt='4'
6929                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6930                 rp="What is the size of a pointer (in bytes)?"
6931                 . ./myread
6932                 ptrsize="$ans"
6933         fi
6934         ;;
6935 esac
6936 $rm_try
6937 case "$use64bitall" in
6938 "$define"|true|[yY]*)
6939         case "$ptrsize" in
6940         4)      cat <<EOM >&4
6941
6942 *** You have chosen a maximally 64-bit build,
6943 *** but your pointers are only 4 bytes wide.
6944 *** Please rerun Configure without -Duse64bitall.
6945 EOM
6946                 case "$d_quad" in
6947                 define)
6948                         cat <<EOM >&4
6949 *** Since you have quads, you could possibly try with -Duse64bitint.
6950 EOM
6951                         ;;
6952                 esac
6953                 cat <<EOM >&4
6954 *** Cannot continue, aborting.
6955
6956 EOM
6957
6958                 exit 1
6959                 ;;
6960         esac
6961         ;;
6962 esac
6963
6964
6965 : determine whether to use malloc wrapping
6966 echo " "
6967 case "$usemallocwrap" in
6968 [yY]*|true|$define)     dflt='y' ;;
6969 [nN]*|false|$undef)     dflt='n' ;;
6970 *)      case "$usedevel" in
6971         [yY]*|true|$define)     dflt='y' ;;
6972         *) dflt='n' ;;
6973         esac
6974         ;;
6975 esac
6976 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6977 . ./myread
6978 usemallocwrap="$ans"
6979 case "$ans" in
6980 y*|true)
6981         usemallocwrap="$define" ;;
6982 *)
6983         usemallocwrap="$undef" ;;
6984 esac
6985
6986 : determine which malloc to compile in
6987 echo " "
6988 case "$usemymalloc" in
6989 [yY]*|true|$define)     dflt='y' ;;
6990 [nN]*|false|$undef)     dflt='n' ;;
6991 *)      case "$ptrsize" in
6992         4) dflt='y' ;;
6993         *) dflt='n' ;;
6994         esac
6995         if test "$useithreads" = "$define"; then dflt='n'; fi
6996         ;;
6997 esac
6998 rp="Do you wish to attempt to use the malloc that comes with $package?"
6999 . ./myread
7000 usemymalloc="$ans"
7001 case "$ans" in
7002 y*|true)
7003         usemymalloc='y'
7004         mallocsrc='malloc.c'
7005         mallocobj="malloc$_o"
7006         d_mymalloc="$define"
7007         case "$libs" in
7008         *-lmalloc*)
7009                 : Remove malloc from list of libraries to use
7010                 echo "Removing unneeded -lmalloc from library list" >&4
7011                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7012                 shift
7013                 libs="$*"
7014                 echo "libs = $libs" >&4
7015                 ;;
7016         esac
7017         ;;
7018 *)
7019         usemymalloc='n'
7020         mallocsrc=''
7021         mallocobj=''
7022         d_mymalloc="$undef"
7023         ;;
7024 esac
7025
7026 : compute the return types of malloc and free
7027 echo " "
7028 $cat >malloc.c <<END
7029 #$i_malloc I_MALLOC
7030 #$i_stdlib I_STDLIB
7031 #include <stdio.h>
7032 #include <sys/types.h>
7033 #ifdef I_MALLOC
7034 #include <malloc.h>
7035 #endif
7036 #ifdef I_STDLIB
7037 #include <stdlib.h>
7038 #endif
7039 #ifdef TRY_MALLOC
7040 void *malloc();
7041 #endif
7042 #ifdef TRY_FREE
7043 void free();
7044 #endif
7045 END
7046 case "$malloctype" in
7047 '')
7048         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7049                 malloctype='void *'
7050         else
7051                 malloctype='char *'
7052         fi
7053         ;;
7054 esac
7055 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7056
7057 case "$freetype" in
7058 '')
7059         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7060                 freetype='void'
7061         else
7062                 freetype='int'
7063         fi
7064         ;;
7065 esac
7066 echo "Your system uses $freetype free(), it would seem." >&4
7067 $rm -f malloc.[co]
7068 : determine where site specific architecture-dependent libraries go.
7069 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7070 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7071 : sitelib may have an optional trailing /share.
7072 case "$sitearch" in
7073 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7074         dflt="$dflt/$archname"
7075         ;;
7076 *)      dflt="$sitearch"
7077         ;;
7078 esac
7079 set sitearch sitearch none
7080 eval $prefixit
7081 $cat <<EOM
7082
7083 The installation process will also create a directory for
7084 architecture-dependent site-specific extensions and modules.
7085
7086 EOM
7087 fn=d~+
7088 rp='Pathname for the site-specific architecture-dependent library files?'
7089 . ./getfile
7090 prefixvar=sitearch
7091 . ./setprefixvar
7092 if $test X"$sitearch" = X"$sitelib"; then
7093         d_sitearch="$undef"
7094 else
7095         d_sitearch="$define"
7096 fi
7097
7098 : Set the vendorprefix variables
7099 $cat <<EOM
7100
7101 The installation process will also create a directory for
7102 vendor-supplied add-ons.  Vendors who supply perl with their system
7103 may find it convenient to place all vendor-supplied files in this
7104 directory rather than in the main distribution directory.  This will
7105 ease upgrades between binary-compatible maintenance versions of perl.
7106
7107 Of course you may also use these directories in whatever way you see
7108 fit.  For example, you might use them to access modules shared over a
7109 company-wide network.
7110
7111 The default answer should be fine for most people.
7112 This causes further questions about vendor add-ons to be skipped
7113 and no vendor-specific directories will be configured for perl.
7114
7115 EOM
7116 rp='Do you want to configure vendor-specific add-on directories?'
7117 case "$usevendorprefix" in
7118 define|true|[yY]*) dflt=y ;;
7119 *)      : User may have set vendorprefix directly on Configure command line.
7120         case "$vendorprefix" in
7121         ''|' ') dflt=n ;;
7122         *)      dflt=y ;;
7123         esac
7124         ;;
7125 esac
7126 . ./myread
7127 case "$ans" in
7128 [yY]*)  fn=d~+
7129         rp='Installation prefix to use for vendor-supplied add-ons?'
7130         case "$vendorprefix" in
7131         '') dflt="$prefix" ;;
7132         *)  dflt=$vendorprefix ;;
7133         esac
7134         . ./getfile
7135         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7136         oldvendorprefix=''
7137         case "$vendorprefix" in
7138         '') ;;
7139         *)      case "$ans" in
7140                 "$prefix") ;;
7141                 *) oldvendorprefix="$prefix";;
7142                 esac
7143                 ;;
7144         esac
7145         usevendorprefix="$define"
7146         vendorprefix="$ans"
7147         vendorprefixexp="$ansexp"
7148         ;;
7149 *)      usevendorprefix="$undef"
7150         vendorprefix=''
7151         vendorprefixexp=''
7152         ;;
7153 esac
7154
7155 : Set the vendorlib variables
7156 case "$vendorprefix" in
7157 '')     d_vendorlib="$undef"
7158         vendorlib=''
7159         vendorlibexp=''
7160         ;;
7161 *)      d_vendorlib="$define"
7162         : determine where vendor-supplied modules go.
7163         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7164         case "$vendorlib" in
7165         '')
7166                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7167                 case "$installstyle" in
7168                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7169                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7170                 esac
7171                 ;;
7172         *)      dflt="$vendorlib"
7173                 ;;
7174         esac
7175         fn=d~+
7176         rp='Pathname for the vendor-supplied library files?'
7177         . ./getfile
7178         vendorlib="$ans"
7179         vendorlibexp="$ansexp"
7180         ;;
7181 esac
7182 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7183 prefixvar=vendorlib
7184 . ./installprefix
7185
7186 : Set the vendorarch variables
7187 case "$vendorprefix" in
7188 '')     d_vendorarch="$undef"
7189         vendorarch=''
7190         vendorarchexp=''
7191         ;;
7192 *)      d_vendorarch="$define"
7193         : determine where vendor-supplied architecture-dependent libraries go.
7194         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7195         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7196         : vendorlib may have an optional trailing /share.
7197         case "$vendorarch" in
7198         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7199                 dflt="$dflt/$archname"
7200                 ;;
7201         *)      dflt="$vendorarch" ;;
7202         esac
7203         fn=d~+
7204         rp='Pathname for vendor-supplied architecture-dependent files?'
7205         . ./getfile
7206         vendorarch="$ans"
7207         vendorarchexp="$ansexp"
7208         ;;
7209 esac
7210 prefixvar=vendorarch
7211 . ./installprefix
7212 if $test X"$vendorarch" = X"$vendorlib"; then
7213         d_vendorarch="$undef"
7214 else
7215         d_vendorarch="$define"
7216 fi
7217
7218 : Final catch-all directories to search
7219 $cat <<EOM
7220
7221 Lastly, you can have perl look in other directories for extensions and
7222 modules in addition to those already specified.
7223 These directories will be searched after
7224         $sitearch
7225         $sitelib
7226 EOM
7227 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7228 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7229 echo ' '
7230 case "$otherlibdirs" in
7231 ''|' ') dflt='none' ;;
7232 *)      dflt="$otherlibdirs" ;;
7233 esac
7234 $cat <<EOM
7235 Enter a colon-separated set of extra paths to include in perl's @INC
7236 search path, or enter 'none' for no extra paths.
7237
7238 EOM
7239
7240 rp='Colon-separated list of additional directories for perl to search?'
7241 . ./myread
7242 case "$ans" in
7243 ' '|''|none)    otherlibdirs=' ' ;;
7244 *)      otherlibdirs="$ans" ;;
7245 esac
7246 case "$otherlibdirs" in
7247 ' ') val=$undef ;;
7248 *)      val=$define ;;
7249 esac
7250 set d_perl_otherlibdirs
7251 eval $setvar
7252
7253 : Cruising for prototypes
7254 echo " "
7255 echo "Checking out function prototypes..." >&4
7256 $cat >prototype.c <<EOCP
7257 #$i_stdlib I_STDLIB
7258 #ifdef I_STDLIB
7259 #include <stdlib.h>
7260 #endif
7261 int main(int argc, char *argv[]) {
7262         exit(0);}
7263 EOCP
7264 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7265         echo "Your C compiler appears to support function prototypes."
7266         val="$define"
7267 else
7268         echo "Your C compiler doesn't seem to understand function prototypes."
7269         val="$undef"
7270 fi
7271 set prototype
7272 eval $setvar
7273 $rm -f prototype*
7274
7275 : Check if ansi2knr is required
7276 case "$prototype" in
7277 "$define") ;;
7278 *)      ansi2knr='ansi2knr'
7279         echo " "
7280         cat <<EOM >&4
7281
7282 $me:  FATAL ERROR:
7283 This version of $package can only be compiled by a compiler that 
7284 understands function prototypes.  Unfortunately, your C compiler 
7285         $cc $ccflags
7286 doesn't seem to understand them.  Sorry about that.
7287
7288 If GNU cc is available for your system, perhaps you could try that instead.  
7289
7290 Eventually, we hope to support building Perl with pre-ANSI compilers.
7291 If you would like to help in that effort, please contact <perlbug@perl.org>.
7292
7293 Aborting Configure now.
7294 EOM
7295         exit 2
7296         ;;
7297 esac
7298
7299 : DTrace support
7300 dflt_dtrace='/usr/sbin/dtrace'
7301 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7302
7303 cat <<EOM
7304
7305 Perl can be built to support DTrace on platforms that support it.
7306 DTrace is a diagnosis and performance analysis tool from Sun.
7307
7308 If this doesn't make any sense to you, just accept the default '$dflt'.
7309 EOM
7310
7311 while $test 1 ; do
7312         case "$usedtrace" in
7313         $define|true|[yY]*)
7314                 dflt='y'
7315                 ;;
7316         ?*)
7317                 dflt='y'
7318                 dflt_dtrace=$usedtrace
7319                 ;;
7320         *)
7321                 dflt='n'
7322                 ;;
7323         esac
7324
7325         rp='Support DTrace if available?'
7326         . ./myread
7327         case "$ans" in
7328         y|Y)    val="$define" ;;
7329         *)      val="$undef" ;;
7330         esac
7331         set usedtrace
7332         eval $setvar
7333
7334         test "X$usedtrace" != "X$define" && break
7335
7336         echo " "
7337         rp='Where is the dtrace executable?'
7338         dflt=$dflt_dtrace
7339         . ./getfile
7340         val="$ans"
7341         set dtrace
7342         eval $setvar
7343
7344         if $test -f $dtrace
7345         then
7346                 if $dtrace -h -s ../perldtrace.d \
7347                         -o perldtrace.tmp >/dev/null 2>&1 \
7348                         && rm -f perldtrace.tmp
7349                 then
7350                         echo " "
7351                         echo "Good: your $dtrace knows about the -h flag."
7352                 else
7353                         cat >&2 <<EOM
7354
7355 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7356 ***
7357 *** Your installed dtrace doesn't support the -h switch to compile a D
7358 *** program into a C header. Can't continue.
7359
7360 EOM
7361                         exit 1
7362                 fi
7363                 break;
7364         fi
7365
7366         case "$fastread" in
7367         yes)
7368                 cat >&2 <<EOM
7369
7370 *** $me:  Fatal Error:  $dtrace not found.
7371 *** Can't continue.
7372
7373 EOM
7374                 exit 1
7375                 ;;
7376         *)
7377                 echo "*** $dtrace was not found."
7378                 echo " "
7379                 ;;
7380         esac
7381 done
7382
7383 : See if we want extra modules installed
7384 echo " "
7385 case "$extras" in
7386 '') dflt='n';;
7387 *) dflt='y';;
7388 esac
7389 cat <<EOM
7390 Perl can be built with extra modules or bundles of modules which
7391 will be fetched from the CPAN and installed alongside Perl.
7392
7393 Notice that you will need access to the CPAN; either via the Internet,
7394 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7395 be asked later to configure the CPAN.pm module which will in turn do
7396 the installation of the rest of the extra modules or bundles.)
7397
7398 Notice also that if the modules require any external software such as
7399 libraries and headers (the libz library and the zlib.h header for the
7400 Compress::Zlib module, for example) you MUST have any such software
7401 already installed, this configuration process will NOT install such
7402 things for you.
7403
7404 If this doesn't make any sense to you, just accept the default '$dflt'.
7405 EOM
7406 rp='Install any extra modules (y or n)?'
7407 . ./myread
7408 case "$ans" in
7409 y|Y)
7410         cat <<EOM
7411
7412 Please list any extra modules or bundles to be installed from CPAN,
7413 with spaces between the names.  The names can be in any format the
7414 'install' command of CPAN.pm will understand.  (Answer 'none',
7415 without the quotes, to install no extra modules or bundles.)
7416 EOM
7417         rp='Extras?'
7418         dflt="$extras"
7419         . ./myread
7420         extras="$ans"
7421 esac
7422 case "$extras" in
7423 ''|'none')
7424         val=''
7425         $rm -f ../extras.lst
7426         ;;
7427 *)      echo "(Saving the list of extras for later...)"
7428         echo "$extras" > ../extras.lst
7429         val="'$extras'"
7430         ;;
7431 esac
7432 set extras
7433 eval $setvar
7434 echo " "
7435
7436 : determine where html pages for programs go
7437 set html1dir html1dir none
7438 eval $prefixit
7439 $cat <<EOM
7440
7441 If you wish to install html files for programs in $spackage, indicate
7442 the appropriate directory here.  To skip installing html files,
7443 answer "none".
7444 EOM
7445 case "$html1dir" in
7446 ''|none|$undef|' ') dflt=none ;;
7447 *) dflt=$html1dir ;;
7448 esac
7449 fn=dn+~
7450 rp="Directory for the main $spackage html pages?"
7451 . ./getfile
7452 prefixvar=html1dir
7453 . ./setprefixvar
7454 : Use ' ' for none so value is preserved next time through Configure
7455 $test X"$html1dir" = "X" && html1dir=' '
7456
7457 : determine where html pages for libraries and modules go
7458 set html3dir html3dir none
7459 eval $prefixit
7460 $cat <<EOM
7461
7462 If you wish to install html files for modules associated with $spackage,
7463 indicate the appropriate directory here.  To skip installing html files,
7464 answer "none".
7465 EOM
7466 : There is no obvious default.  If they have specified html1dir, then
7467 : try to key off that, possibly changing .../html1 into .../html3.
7468 case "$html3dir" in
7469 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7470 *) dflt=$html3dir ;;
7471 esac
7472 fn=dn+~
7473 rp="Directory for the $spackage module html pages?"
7474 . ./getfile
7475 prefixvar=html3dir
7476 . ./setprefixvar
7477 : Use ' ' for none so value is preserved next time through Configure
7478 $test X"$html3dir" = "X" && html3dir=' '
7479
7480 : determine whether to install perl also as /usr/bin/perl
7481
7482 echo " "
7483 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7484         $cat <<EOM
7485 Many scripts expect perl to be installed as /usr/bin/perl.
7486
7487 If you want to, I can install the perl you are about to compile
7488 as /usr/bin/perl (in addition to $bin/perl).
7489 EOM
7490         if test -f /usr/bin/perl; then
7491             $cat <<EOM
7492
7493 However, please note that because you already have a /usr/bin/perl,
7494 overwriting that with a new Perl would very probably cause problems.
7495 Therefore I'm assuming you don't want to do that (unless you insist).
7496
7497 EOM
7498             case "$installusrbinperl" in
7499             "$define"|[yY]*)    dflt='y';;
7500             *)                  dflt='n';;
7501             esac
7502         else
7503             $cat <<EOM
7504
7505 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7506
7507 EOM
7508             case "$installusrbinperl" in
7509             "$undef"|[nN]*)     dflt='n';;
7510             *)                  dflt='y';;
7511             esac
7512         fi
7513         rp="Do you want to install perl as /usr/bin/perl?"
7514         . ./myread
7515         case "$ans" in
7516         [yY]*)  val="$define";;
7517         *)      val="$undef" ;;
7518         esac
7519 else
7520         val="$undef"
7521 fi
7522 set installusrbinperl
7523 eval $setvar
7524
7525 : Check if we are using the GNU C library
7526 echo " "
7527 echo "Checking for GNU C Library..." >&4
7528 cat >try.c <<'EOCP'
7529 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7530    alone are insufficient to distinguish different versions, such as
7531    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7532    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7533 */
7534 #include <stdio.h>
7535 int main(void)
7536 {
7537 #ifdef __GLIBC__
7538 #   ifdef __GLIBC_MINOR__
7539 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7540 #           include <gnu/libc-version.h>
7541             printf("%s\n",  gnu_get_libc_version());
7542 #       else
7543             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7544 #       endif
7545 #   else
7546         printf("%d\n",  __GLIBC__);
7547 #   endif
7548     return 0;
7549 #else
7550     return 1;
7551 #endif
7552 }
7553 EOCP
7554 set try
7555 if eval $compile_ok && $run ./try > glibc.ver; then
7556         val="$define"
7557         gnulibc_version=`$cat glibc.ver`
7558         echo "You are using the GNU C Library version $gnulibc_version"
7559 else
7560         val="$undef"
7561         gnulibc_version=''
7562         echo "You are not using the GNU C Library"
7563 fi
7564 $rm_try glibc.ver
7565 set d_gnulibc
7566 eval $setvar
7567
7568 : see if nm is to be used to determine whether a symbol is defined or not
7569 case "$usenm" in
7570 '')
7571         dflt=''
7572         case "$d_gnulibc" in
7573         "$define")
7574                 echo " "
7575                 echo "nm probably won't work on the GNU C Library." >&4
7576                 dflt=n
7577                 ;;
7578         esac
7579         case "$dflt" in
7580         '')
7581                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7582                         echo " "
7583                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7584                         echo "'nm' won't be sufficient on this system." >&4
7585                         dflt=n
7586                 fi
7587                 ;;
7588         esac
7589         case "$dflt" in
7590         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7591                 if $test $dflt -gt 20; then
7592                         dflt=y
7593                 else
7594                         dflt=n
7595                 fi
7596                 ;;
7597         esac
7598         ;;
7599 *)
7600         case "$usenm" in
7601         true|$define) dflt=y;;
7602         *) dflt=n;;
7603         esac
7604         ;;
7605 esac
7606 $cat <<EOM
7607
7608 I can use $nm to extract the symbols from your C libraries. This
7609 is a time consuming task which may generate huge output on the disk (up
7610 to 3 megabytes) but that should make the symbols extraction faster. The
7611 alternative is to skip the 'nm' extraction part and to compile a small
7612 test program instead to determine whether each symbol is present. If
7613 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7614 this may be the best solution.
7615
7616 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7617
7618 EOM
7619 rp="Shall I use $nm to extract C symbols from the libraries?"
7620 . ./myread
7621 case "$ans" in
7622 [Nn]*) usenm=false;;
7623 *) usenm=true;;
7624 esac
7625
7626 runnm=$usenm
7627 case "$reuseval" in
7628 true) runnm=false;;
7629 esac
7630
7631 : nm options which may be necessary
7632 case "$nm_opt" in
7633 '') if $test -f /mach_boot; then
7634                 nm_opt=''       # Mach
7635         elif $test -d /usr/ccs/lib; then
7636                 nm_opt='-p'     # Solaris (and SunOS?)
7637         elif $test -f /dgux; then
7638                 nm_opt='-p'     # DG-UX
7639         elif $test -f /lib64/rld; then
7640                 nm_opt='-p'     # 64-bit Irix
7641         else
7642                 nm_opt=''
7643         fi;;
7644 esac
7645
7646 : nm options which may be necessary for shared libraries but illegal
7647 : for archive libraries.  Thank you, Linux.
7648 case "$nm_so_opt" in
7649 '')     case "$myuname" in
7650         *linux*|gnu*)
7651                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7652                         nm_so_opt='--dynamic'
7653                 fi
7654                 ;;
7655         esac
7656         ;;
7657 esac
7658
7659 : Figure out where the libc is located
7660 case "$runnm" in
7661 true)
7662 : get list of predefined functions in a handy place
7663 echo " "
7664 case "$libc" in
7665 '') libc=unknown
7666         case "$libs" in
7667         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7668         esac
7669         ;;
7670 esac
7671 case "$libs" in
7672 '') ;;
7673 *)  for thislib in $libs; do
7674         case "$thislib" in
7675         -lc|-lc_s)
7676                 : Handle C library specially below.
7677                 ;;
7678         -l*)
7679                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7680                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7681                         :
7682                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7683                         :
7684                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7685                         :
7686                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7687                         :
7688                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7689                         :
7690                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7691                         :
7692                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7693                         :
7694                 else
7695                         try=''
7696                 fi
7697                 libnames="$libnames $try"
7698                 ;;
7699         *) libnames="$libnames $thislib" ;;
7700         esac
7701         done
7702         ;;
7703 esac
7704 xxx=normal
7705 case "$libc" in
7706 unknown)
7707         set /lib/libc.$so
7708         for xxx in $libpth; do
7709                 $test -r $1 || set $xxx/libc.$so
7710                 : The messy sed command sorts on library version numbers.
7711                 $test -r $1 || \
7712                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7713                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7714                                 h
7715                                 s/[0-9][0-9]*/0000&/g
7716                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7717                                 G
7718                                 s/\n/ /' | \
7719                          $sort | $sed -e 's/^.* //'`
7720                 eval set \$$#
7721         done
7722         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
7723         $test -r $1 || set $sysroot/lib/libsys_s$_a
7724         ;;
7725 *)
7726         set blurfl
7727         ;;
7728 esac
7729 if $test -r "$1"; then
7730         echo "Your (shared) C library seems to be in $1."
7731         libc="$1"
7732 elif $test -r /lib/libc && $test -r /lib/clib; then
7733         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7734         xxx=apollo
7735         libc='/lib/clib /lib/libc'
7736         if $test -r /lib/syslib; then
7737                 echo "(Your math library is in /lib/syslib.)"
7738                 libc="$libc /lib/syslib"
7739         fi
7740 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7741         echo "Your C library seems to be in $libc, as you said before."
7742 elif $test -r $incpath/usr/lib/libc$_a; then
7743         libc=$incpath/usr/lib/libc$_a;
7744         echo "Your C library seems to be in $libc.  That's fine."
7745 elif $test -r /lib/libc$_a; then
7746         libc=/lib/libc$_a;
7747         echo "Your C library seems to be in $libc.  You're normal."
7748 else
7749         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7750                 :
7751         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7752                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7753         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7754                 :
7755         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7756                 :
7757         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7758                 :
7759         else
7760                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7761         fi
7762         if $test -r "$tans"; then
7763                 echo "Your C library seems to be in $tans, of all places."
7764                 libc=$tans
7765         else
7766                 libc='blurfl'
7767         fi
7768 fi
7769 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7770         dflt="$libc"
7771         cat <<EOM
7772
7773 If the guess above is wrong (which it might be if you're using a strange
7774 compiler, or your machine supports multiple models), you can override it here.
7775
7776 EOM
7777 else
7778         dflt=''
7779         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7780         cat >&4 <<EOM
7781 I can't seem to find your C library.  I've looked in the following places:
7782
7783 EOM
7784         $sed 's/^/      /' libpath
7785         cat <<EOM
7786
7787 None of these seems to contain your C library. I need to get its name...
7788
7789 EOM
7790 fi
7791 fn=f
7792 rp='Where is your C library?'
7793 . ./getfile
7794 libc="$ans"
7795
7796 echo " "
7797 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7798 set X `cat libnames`
7799 shift
7800 xxx=files
7801 case $# in 1) xxx=file; esac
7802 echo "Extracting names from the following $xxx for later perusal:" >&4
7803 echo " "
7804 $sed 's/^/      /' libnames >&4
7805 echo " "
7806 $echo $n "This may take a while...$c" >&4
7807
7808 for file in $*; do
7809         case $file in
7810         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7811         *) $nm $nm_opt $file 2>/dev/null;;
7812         esac
7813 done >libc.tmp
7814
7815 $echo $n ".$c"
7816 $grep fprintf libc.tmp > libc.ptf
7817 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7818 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7819 xxx='[ADTSIWi]'
7820 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7821         eval $xscan;\
7822         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7823                 eval $xrun
7824 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7825         eval $xscan;\
7826         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7827                 eval $xrun
7828 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7829         eval $xscan;\
7830         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7831                 eval $xrun
7832 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7833         eval $xscan;\
7834         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7835                 eval $xrun
7836 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7837         eval $xscan;\
7838         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7839                 eval $xrun
7840 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7841         eval $xscan;\
7842         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7843                 eval $xrun
7844 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7845                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7846         eval $xscan;\
7847         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7848                 eval $xrun
7849 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7850         eval $xscan;\
7851         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7852                 eval $xrun
7853 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7854         eval $xscan;\
7855         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7856                 eval $xrun
7857 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7858         eval $xscan;\
7859         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7860                 eval $xrun
7861 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7862         eval $xscan;\
7863         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7864                 eval $xrun
7865 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7866         eval $xscan;\
7867         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7868                 eval $xrun
7869 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7870         eval $xscan;\
7871         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7872                 eval $xrun
7873 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7874         eval $xscan;\
7875         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7876                 eval $xrun
7877 else
7878         $nm -p $* 2>/dev/null >libc.tmp
7879         $grep fprintf libc.tmp > libc.ptf
7880         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7881                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7882         then
7883                 nm_opt='-p'
7884                 eval $xrun
7885         else
7886                 echo " "
7887                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7888                 com=''
7889                 if $ar t $libc > libc.tmp && \
7890                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7891                 then
7892                         for thisname in $libnames $libc; do
7893                                 $ar t $thisname >>libc.tmp
7894                         done
7895                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7896                         echo "Ok." >&4
7897                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7898                         for thisname in $libnames $libc; do
7899                                 $ar tv $thisname >>libc.tmp
7900                                 emximp -o tmp.imp $thisname \
7901                                     2>/dev/null && \
7902                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7903                                     < tmp.imp >>libc.tmp
7904                                 $rm -f tmp.imp
7905                         done
7906                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7907                         echo "Ok." >&4
7908                 else
7909                         echo "$ar didn't seem to work right." >&4
7910                         echo "Maybe this is a Cray...trying bld instead..." >&4
7911                         if  bld t $libc | \
7912                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7913                                 $test -s libc.list
7914                         then
7915                                 for thisname in $libnames; do
7916                                         bld t $libnames | \
7917                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7918                                         $ar t $thisname >>libc.tmp
7919                                 done
7920                                 echo "Ok." >&4
7921                         else
7922                                 echo "That didn't work either.  Giving up." >&4
7923                                 exit 1
7924                         fi
7925                 fi
7926         fi
7927 fi
7928 nm_extract="$com"
7929 case "$PASE" in
7930 define)
7931     echo " "
7932     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7933     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7934     ;;
7935 *)  if $test -f /lib/syscalls.exp; then
7936         echo " "
7937         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7938         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7939                 /lib/syscalls.exp >>libc.list
7940     fi
7941     ;;
7942 esac
7943 ;;
7944 esac
7945 $rm -f libnames libpath
7946
7947 : Check if we are using C++
7948 echo " "
7949 echo "Checking for C++..." >&4
7950 $cat >try.c <<'EOCP'
7951 #include <stdio.h>
7952 int main(void)
7953 {
7954 #ifdef __cplusplus
7955     return 0;
7956 #else
7957     return 1;
7958 #endif
7959 }
7960 EOCP
7961 set try
7962 if eval $compile_ok && $run ./try; then
7963         val="$define"
7964         echo "You are using a C++ compiler."
7965 else
7966         val="$undef"
7967         echo "You are not using a C++ compiler."
7968 fi
7969 $rm_try cplusplus$$
7970 set d_cplusplus
7971 eval $setvar
7972
7973 : is a C symbol defined?
7974 csym='tlook=$1;
7975 case "$3" in
7976 -v) tf=libc.tmp; tdc="";;
7977 -a) tf=libc.tmp; tdc="[]";;
7978 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7979 esac;
7980 case "$d_cplusplus" in
7981     $define)    extern_C="extern \"C\"" ;;
7982     *)          extern_C="extern"       ;;
7983 esac;
7984 tx=yes;
7985 case "$reuseval-$4" in
7986 true-) ;;
7987 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7988 esac;
7989 case "$tx" in
7990 yes)
7991         tval=false;
7992         if $test "$runnm" = true; then
7993                 if $contains $tlook $tf >/dev/null 2>&1; then
7994                         tval=true;
7995                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7996                         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;
7997                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7998                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7999                         $rm_try;
8000                 fi;
8001         else
8002                 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;
8003                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
8004                 $rm_try;
8005         fi;
8006         ;;
8007 *)
8008         case "$tval" in
8009         $define) tval=true;;
8010         *) tval=false;;
8011         esac;
8012         ;;
8013 esac;
8014 eval "$2=$tval"'
8015
8016 : define an is-in-libc? function
8017 inlibc='echo " "; td=$define; tu=$undef;
8018 sym=$1; var=$2; eval "was=\$$2";
8019 tx=yes;
8020 case "$reuseval$was" in
8021 true) ;;
8022 true*) tx=no;;
8023 esac;
8024 case "$tx" in
8025 yes)
8026         set $sym tres -f;
8027         eval $csym;
8028         case "$tres" in
8029         true)
8030                 echo "$sym() found." >&4;
8031                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
8032         *)
8033                 echo "$sym() NOT found." >&4;
8034                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
8035         esac;;
8036 *)
8037         case "$was" in
8038         $define) echo "$sym() found." >&4;;
8039         *) echo "$sym() NOT found." >&4;;
8040         esac;;
8041 esac'
8042
8043 : see if dlopen exists
8044 xxx_runnm="$runnm"
8045 xxx_ccflags="$ccflags"
8046 runnm=false
8047 : with g++ one needs -shared to get is-in-libc to work for dlopen
8048 case "$gccversion" in
8049 '')     ;;
8050 *)      case "$d_cplusplus" in
8051         "$define") ccflags="$ccflags -shared" ;;
8052         esac
8053         ;;
8054 esac
8055 set dlopen d_dlopen
8056 eval $inlibc
8057 runnm="$xxx_runnm"
8058 ccflags="$xxx_ccflags"
8059
8060 : see if this is a unistd.h system
8061 set unistd.h i_unistd
8062 eval $inhdr
8063
8064 : determine which dynamic loading, if any, to compile in
8065 echo " "
8066 dldir="ext/DynaLoader"
8067 case "$usedl" in
8068     $define|y|true)
8069         dflt='y'
8070         usedl="$define"
8071         ;;
8072     $undef|n|false)
8073         dflt='n'
8074         usedl="$undef"
8075         ;;
8076     *)
8077         dflt='n'
8078         case "$d_dlopen" in
8079             $define) dflt='y' ;;
8080         esac
8081         : Does a dl_xxx.xs file exist for this operating system
8082         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8083         ;;
8084 esac
8085 rp="Do you wish to use dynamic loading?"
8086 . ./myread
8087 usedl="$ans"
8088 bin_ELF="$undef"
8089 case "$ans" in
8090     y*) usedl="$define"
8091         case "$dlsrc" in
8092             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8093                     dflt="$dldir/dl_${osname}.xs"
8094                 elif $test "$d_dlopen" = "$define" ; then
8095                     dflt="$dldir/dl_dlopen.xs"
8096                 else
8097                     dflt=''
8098                 fi
8099                 ;;
8100             *)  dflt="$dldir/$dlsrc"
8101                 ;;
8102         esac
8103         echo "The following dynamic loading files are available:"
8104         : Can not go over to $dldir because getfile has path hard-coded in.
8105         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8106         rp="Source file to use for dynamic loading"
8107         fn="fne"
8108         gfpth="$src"
8109         . ./getfile
8110         usedl="$define"
8111         : emulate basename
8112         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8113
8114         $cat << EOM
8115
8116 Some systems may require passing special flags to $cc -c to
8117 compile modules that will be used to create a shared library.
8118 To use no flags, say "none".
8119
8120 EOM
8121         case "$cccdlflags" in
8122             '') case "$gccversion" in
8123                 '') case "$osname" in
8124                         hpux)   dflt='+z' ;;
8125                         next)   dflt='none' ;;
8126                         irix*)  dflt='-KPIC' ;;
8127                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8128                         sunos)  dflt='-pic' ;;
8129                         *)      dflt='none' ;;
8130                     esac
8131                     ;;
8132                 *)  case "$osname" in
8133                         darwin) dflt='none' ;;
8134                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8135                         *)      dflt='-fpic' ;;
8136                     esac ;;
8137                 esac ;;
8138             ' ') dflt='none' ;;
8139             *)   dflt="$cccdlflags" ;;
8140         esac
8141
8142         case "$dflt" in
8143             none) dflt='' ;;
8144         esac
8145
8146         # If -Dsysroot was specified, now's the time to add it
8147         # to cccdlflags
8148         if test "X$sysroot" != X; then
8149             case "$gccversion" in
8150                 '') ;;
8151                 *)  case "$dflt" in
8152                         *sysroot*) ;;
8153                         'undef'|*)
8154                             dflt="$dflt --sysroot=$sysroot" ;;
8155                     esac
8156                     ;;
8157             esac
8158         fi
8159
8160         case "$dflt" in
8161             '') dflt='none';;
8162         esac
8163
8164         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8165         . ./myread
8166         case "$ans" in
8167             none) cccdlflags=' ' ;;
8168             *)    cccdlflags="$ans" ;;
8169         esac
8170
8171         cat << EOM
8172
8173 Some systems use ld to create libraries that can be dynamically loaded,
8174 while other systems (such as those using ELF) use $cc.
8175
8176 EOM
8177
8178 : Determine if this is ELF
8179         $cat >try.c <<EOM
8180 /* Test for whether ELF binaries are produced */
8181 #include <fcntl.h>
8182 #$i_stdlib I_STDLIB
8183 #ifdef I_STDLIB
8184 #include <stdlib.h>
8185 #endif
8186 #$i_unistd I_UNISTD
8187 #ifdef I_UNISTD
8188 #include <unistd.h>
8189 #endif
8190 int main() {
8191     char b[4];
8192     int i = open("a.out",O_RDONLY);
8193     if(i == -1)
8194         exit(1); /* fail */
8195     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8196         exit(0); /* succeed (yes, it is ELF) */
8197     exit(1); /* fail */
8198 }
8199 EOM
8200         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8201             bin_ELF="$define"
8202         fi
8203         $rm_try
8204
8205         case "$ld" in
8206             '') if $test $bin_ELF = "$define"; then
8207                     cat <<EOM
8208 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8209 EOM
8210                     dflt="$cc"
8211                 else
8212                     echo "I'll use ld to build dynamic libraries."
8213                     dflt='ld'
8214                 fi
8215                 ;;
8216             *)  dflt="$ld"
8217                 ;;
8218         esac
8219
8220         rp="What command should be used to create dynamic libraries?"
8221         . ./myread
8222         ld="$ans"
8223
8224         cat << EOM
8225
8226 Some systems may require passing special flags to $ld to create a
8227 library that can be dynamically loaded.  If your ld flags include
8228 -L/other/path options to locate libraries outside your loader's normal
8229 search path, you may need to specify those -L options here as well.  To
8230 use no flags, say "none".
8231
8232 EOM
8233         case "$lddlflags" in
8234             '') case "$osname" in
8235                     haiku) dflt='-shared' ;;
8236                     hpux) dflt='-b';
8237                           case "$gccversion" in
8238                               '') dflt="$dflt +vnocompatwarnings" ;;
8239                           esac
8240                           ;;
8241                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8242                     next)  dflt='none' ;;
8243                     solaris) # See [perl #66604].
8244                             # On Solaris 11, gcc -m64 on amd64
8245                             # appears not to understand -G.  gcc versions at
8246                             # least as old as 3.4.3 support -shared, so just
8247                             # use that with Solaris 11 and later, but keep
8248                             # the old behavior for older Solaris versions.
8249                             case "$gccversion" in
8250                                 '') dflt='-G' ;;
8251                                 *)  case "$osvers" in
8252                                         2.?|2.10) dflt='-G' ;;
8253                                         *) dflt='-shared' ;;
8254                                     esac
8255                                     ;;
8256                             esac
8257                             ;;
8258                     sunos) dflt='-assert nodefinitions' ;;
8259                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8260                     *)     dflt='none' ;;
8261                 esac
8262                 ;;
8263             *) dflt="$lddlflags" ;;
8264         esac
8265
8266         : Only do this for gcc, since, for example, qcc has no concept
8267         : of --sysroot.
8268         if $test "X$sysroot" != X; then
8269             case "$gccversion" in
8270                 '') ;;
8271                 *)  dflt="$dflt --sysroot $sysroot" ;;
8272             esac
8273         fi
8274
8275         : Try to guess additional flags to pick up local libraries.
8276         : Be careful not to append to a plain 'none'
8277         case "$dflt" in
8278             none) dflt='' ;;
8279         esac
8280         for thisflag in $ldflags; do
8281             case "$thisflag" in
8282                 -L*|-R*|-Wl,-R*)
8283                     case " $dflt " in
8284                         *" $thisflag "*) ;;
8285                         *) dflt="$dflt $thisflag" ;;
8286                     esac
8287                     ;;
8288             esac
8289         done
8290
8291         case "$dflt" in
8292             ''|' ') dflt='none' ;;
8293         esac
8294
8295         case "$ldflags" in
8296             *-fstack-protector*)
8297                 case "$dflt" in
8298                     *-fstack-protector*) ;; # Don't add it again
8299                     *) dflt="$dflt -fstack-protector" ;;
8300                 esac
8301                 ;;
8302         esac
8303
8304         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8305         . ./myread
8306         case "$ans" in
8307             none) lddlflags=' ' ;;
8308             *) lddlflags="$ans" ;;
8309         esac
8310
8311         cat <<EOM
8312
8313 Some systems may require passing special flags to $cc to indicate that
8314 the resulting executable will use dynamic linking.  To use no flags,
8315 say "none".
8316
8317 EOM
8318         case "$ccdlflags" in
8319             '') case "$osname" in
8320                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8321                     next|sunos)      dflt='none'   ;;
8322                     *)               dflt='none'   ;;
8323                 esac ;;
8324             ' ') dflt='none' ;;
8325             *)   dflt="$ccdlflags" ;;
8326         esac
8327         rp="Any special flags to pass to $cc to use dynamic linking?"
8328         . ./myread
8329         case "$ans" in
8330             none) ccdlflags=' ' ;;
8331             *)    ccdlflags="$ans" ;;
8332         esac
8333         ;;
8334
8335     *)  usedl="$undef"
8336         ld='ld'
8337         dlsrc='dl_none.xs'
8338         lddlflags=''
8339         ccdlflags=''
8340         ;;
8341 esac
8342
8343 ld_can_script="$undef"
8344 case "$bin_ELF$usedl" in
8345     $define$define)
8346         # Abuse try.h and a.out names for neat cleanup
8347         $cat >try.c <<EOM
8348 void foo() {}
8349 void bar() {}
8350 EOM
8351         $cat >try.h <<EOM
8352 LIBTEST_42 {
8353  global:
8354   foo;
8355  local: *;
8356  };
8357 EOM
8358         if $cc $cccdlflags $ccdlflags $ccflags \
8359                $ldflags $lddlflags -o a.out try.c \
8360                -Wl,--version-script=try.h >/dev/null 2>&1 \
8361            &&  $test -s a.out ; then
8362             echo "ld supports scripting" >&4
8363             ld_can_script="$define"
8364         else
8365             echo "ld does not support scripting" >&4
8366         fi
8367         $rm_try
8368         ;;
8369 esac
8370
8371 : Do we want a shared libperl?
8372 also=''
8373 case "$usedl" in
8374 $undef)
8375         # No dynamic loading being used, so don't bother even to prompt.
8376         useshrplib='false'
8377         ;;
8378 *)      case "$useshrplib" in
8379         '')     case "$osname" in
8380                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8381                         dflt=y
8382                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8383                         ;;
8384                 next*)
8385                         case "$osvers" in
8386                         4*)     dflt=y
8387                                 also='Building a shared libperl is needed for MAB support.'
8388                                 ;;
8389                         *)      dflt=n
8390                                 ;;
8391                         esac
8392                         ;;
8393                 *)      dflt=n
8394                         ;;
8395                 esac
8396                 ;;
8397         $define|true|[Yy]*)
8398                 dflt=y
8399                 ;;
8400         *)      dflt=n
8401                 ;;
8402         esac
8403         $cat << EOM
8404
8405 The perl executable is normally obtained by linking perlmain.c with
8406 libperl${_a}, any static extensions (usually just DynaLoader), and
8407 any other libraries needed on this system (such as -lm, etc.).  Since
8408 your system supports dynamic loading, it is probably possible to build
8409 a shared libperl.$so.  If you will have more than one executable linked
8410 to libperl.$so, this will significantly reduce the size of each
8411 executable, but it may have a noticeable effect on performance.  The
8412 default is probably sensible for your system.
8413 $also
8414
8415 EOM
8416         rp="Build a shared libperl.$so (y/n)"
8417         . ./myread
8418         case "$ans" in
8419         true|$define|[Yy]*)
8420                 useshrplib='true'  ;;
8421         *)      useshrplib='false' ;;
8422         esac
8423         ;;
8424 esac
8425
8426 case "$useshrplib" in
8427 true)
8428         case "$userelocatableinc" in
8429         true|define)
8430                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8431                 echo "See INSTALL for an explanation why that won't work." >&4
8432                 exit 4
8433                 ;;
8434         esac
8435         case "$libperl" in
8436         '')
8437                 # Figure out a good name for libperl.so.  Since it gets stored in
8438                 # a version-specific architecture-dependent library, the version
8439                 # number isn't really that important, except for making cc/ld happy.
8440                 #
8441                 # A name such as libperl.so.10.1
8442                 majmin="libperl.$so.$patchlevel.$subversion"
8443                 # A name such as libperl.so.100
8444                 majonly=`echo $patchlevel $subversion |
8445                         $awk '{printf "%d%02d", $1, $2}'`
8446                 majonly=libperl.$so.$majonly
8447                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8448                 # rely on figuring it out from the naming of libc.
8449                 case "${osname}${osvers}" in
8450                 next4*)
8451                         dflt=libperl.5.$so
8452                         # XXX How handle the --version stuff for MAB?
8453                         ;;
8454                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8455                         dflt=libperl.$so
8456                         ;;
8457                 cygwin*) # ld links now against the dll directly
8458                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8459                         majonly=`echo $patchlevel $subversion |
8460                                 $awk '{printf "%03d%03d", $1, $2}'`
8461                         majonly=cygperl5.$majonly.$so
8462                         dflt=$majmin
8463                         ;;
8464                 *)      # Try to guess based on whether libc has major.minor.
8465                         case "$libc" in
8466                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8467                         *libc.$so.[0-9]*) dflt=$majonly ;;
8468                         *)      dflt=libperl.$so ;;
8469                         esac
8470                         ;;
8471                 esac
8472                 ;;
8473         *)      dflt=$libperl
8474                 ;;
8475         esac
8476         cat << EOM
8477
8478 I need to select a good name for the shared libperl.  If your system uses
8479 library names with major and minor numbers, then you might want something
8480 like $majmin.  Alternatively, if your system uses a single version
8481 number for shared libraries, then you might want to use $majonly.
8482 Or, your system might be quite happy with a simple libperl.$so.
8483
8484 Since the shared libperl will get installed into a version-specific
8485 architecture-dependent directory, the version number of the shared perl
8486 library probably isn't important, so the default should be o.k.
8487
8488 EOM
8489         rp='What name do you want to give to the shared libperl?'
8490         . ./myread
8491         libperl=$ans
8492         echo "Ok, I'll use $libperl"
8493         ;;
8494 *)
8495         libperl="libperl${_a}"
8496         ;;
8497 esac
8498
8499 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8500 case "$shrpdir" in
8501 '') ;;
8502 *)      $cat >&4 <<EOM
8503 WARNING:  Use of the shrpdir variable for the installation location of
8504 the shared $libperl is not supported.  It was never documented and
8505 will not work in this version.  Let me (perlbug@perl.org)
8506 know of any problems this may cause.
8507
8508 EOM
8509         case "$shrpdir" in
8510         "$archlibexp/CORE")
8511                 $cat >&4 <<EOM
8512 But your current setting of $shrpdir is
8513 the default anyway, so it's harmless.
8514 EOM
8515                 ;;
8516         *)
8517                 $cat >&4 <<EOM
8518 Further, your current attempted setting of $shrpdir
8519 conflicts with the value of $archlibexp/CORE
8520 that installperl will use.
8521 EOM
8522                 ;;
8523         esac
8524         ;;
8525 esac
8526
8527 # How will the perl executable find the installed shared $libperl?
8528 # Add $xxx to ccdlflags.
8529 # If we can't figure out a command-line option, use $shrpenv to
8530 # set env LD_RUN_PATH.  The main perl makefile uses this.
8531 shrpdir=$archlibexp/CORE
8532 xxx=''
8533 tmp_shrpenv=''
8534 if "$useshrplib"; then
8535     case "$osname" in
8536         aix)
8537                 # We'll set it in Makefile.SH...
8538                 ;;
8539         solaris)
8540                 xxx="-R $shrpdir"
8541                 ;;
8542         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8543                 xxx="-Wl,-R$shrpdir"
8544                 ;;
8545         bsdos|linux|irix*|dec_osf|gnu*)
8546                 xxx="-Wl,-rpath,$shrpdir"
8547                 ;;
8548         next)
8549                 # next doesn't like the default...
8550                 ;;
8551         haiku)
8552                 # Haiku doesn't like the default, either.
8553                 ;;
8554         hpux*)
8555                 # hpux doesn't like the default, either.
8556                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8557                 ;;
8558         cygwin)
8559                 # cygwin needs only ldlibpth
8560                 ;;
8561         *)
8562                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8563                 ;;
8564         esac
8565         case "$xxx" in
8566         '') ;;
8567         *)
8568                 # Only add $xxx if it isn't already in ccdlflags.
8569                 case " $ccdlflags " in
8570                 *" $xxx "*)     ;;
8571                 *)      ccdlflags="$ccdlflags $xxx"
8572                         cat <<EOM >&4
8573
8574 Adding $xxx to the flags
8575 passed to $ld so that the perl executable will find the
8576 installed shared $libperl.
8577
8578 EOM
8579                         ;;
8580                 esac
8581                 ;;
8582         esac
8583 fi
8584 # Fix ccdlflags in AIX for building external extensions.
8585 # (For building Perl itself bare -bE:perl.exp is needed,
8586 #  Makefile.SH takes care of this.)
8587 case "$osname" in
8588 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8589 esac
8590 # Respect a hint or command-line value.
8591 case "$shrpenv" in
8592 '') shrpenv="$tmp_shrpenv" ;;
8593 esac
8594 case "$ldlibpthname" in
8595 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8596 none)   ldlibpthname='' ;;
8597 esac
8598
8599 : determine where manual pages are on this system
8600 echo " "
8601 case "$sysman" in
8602 '')
8603         syspath='/usr/share/man/man1 /usr/man/man1'
8604         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8605         syspath="$syspath /usr/man/u_man/man1"
8606         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8607         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8608         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8609         sysman=`./loc . /usr/man/man1 $syspath`
8610         ;;
8611 esac
8612 if $test -d "$sysman"; then
8613         echo "System manual is in $sysman." >&4
8614 else
8615         echo "Could not find manual pages in source form." >&4
8616 fi
8617
8618 : determine where manual pages go
8619 set man1dir man1dir none
8620 eval $prefixit
8621 $cat <<EOM
8622
8623 $spackage has manual pages available in source form.
8624 EOM
8625 case "$nroff" in
8626 nroff)
8627         echo "However, you don't have nroff, so they're probably useless to you."
8628         case "$man1dir" in
8629         '') man1dir="none";;
8630         esac;;
8631 esac
8632 echo "If you don't want the manual sources installed, answer 'none'."
8633 case "$man1dir" in
8634 ' ') dflt=none
8635         ;;
8636 '')
8637         lookpath="$prefixexp/share/man/man1"
8638         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8639         lookpath="$lookpath $prefixexp/man/p_man/man1"
8640         lookpath="$lookpath $prefixexp/man/u_man/man1"
8641         lookpath="$lookpath $prefixexp/man/man.1"
8642         case "$sysman" in
8643         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8644         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8645         esac
8646         set dflt
8647         eval $prefixup
8648         ;;
8649 *)  dflt="$man1dir"
8650         ;;
8651 esac
8652 echo " "
8653 fn=dn+~
8654 rp="Where do the main $spackage manual pages (source) go?"
8655 . ./getfile
8656 if $test "X$man1direxp" != "X$ansexp"; then
8657         installman1dir=''
8658 fi
8659 prefixvar=man1dir
8660 . ./setprefixvar
8661
8662 case "$man1dir" in
8663 '')     man1dir=' '
8664         installman1dir='';;
8665 esac
8666
8667 : What suffix to use on installed man pages
8668
8669 case "$man1dir" in
8670 ' ')
8671         man1ext='0'
8672         ;;
8673 *)
8674         rp="What suffix should be used for the main $spackage man pages?"
8675         case "$man1ext" in
8676         '')     case "$man1dir" in
8677                 *1)  dflt=1 ;;
8678                 *1p) dflt=1p ;;
8679                 *1pm) dflt=1pm ;;
8680                 *l) dflt=l;;
8681                 *n) dflt=n;;
8682                 *o) dflt=o;;
8683                 *p) dflt=p;;
8684                 *C) dflt=C;;
8685                 *L) dflt=L;;
8686                 *L1) dflt=L1;;
8687                 *) dflt=1;;
8688                 esac
8689                 ;;
8690         *)      dflt="$man1ext";;
8691         esac
8692         . ./myread
8693         man1ext="$ans"
8694         ;;
8695 esac
8696
8697 : see if we can have long filenames
8698 echo " "
8699 first=123456789abcdef
8700 $rm -f $first
8701 if (echo hi >$first) 2>/dev/null; then
8702         if $test -f 123456789abcde; then
8703                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8704                 val="$undef"
8705         else
8706                 echo 'You can have filenames longer than 14 characters.'>&4
8707                 val="$define"
8708         fi
8709 else
8710         $cat <<'EOM'
8711 You can't have filenames longer than 14 chars.
8712 You can't even think about them!
8713 EOM
8714         val="$undef"
8715 fi
8716 set d_flexfnam
8717 eval $setvar
8718 $rm -rf 123456789abcde*
8719
8720 : determine where library module manual pages go
8721 set man3dir man3dir none
8722 eval $prefixit
8723 $cat <<EOM
8724
8725 $spackage has manual pages for many of the library modules.
8726 EOM
8727
8728 case "$nroff" in
8729 nroff)
8730         $cat <<'EOM'
8731 However, you don't have nroff, so they're probably useless to you.
8732 EOM
8733         case "$man3dir" in
8734         '') man3dir="none";;
8735         esac;;
8736 esac
8737
8738 case "$d_flexfnam" in
8739 undef)
8740         $cat <<'EOM'
8741 However, your system can't handle the long file names like File::Basename.3.
8742 EOM
8743         case "$man3dir" in
8744         '') man3dir="none";;
8745         esac;;
8746 esac
8747
8748 echo "If you don't want the manual sources installed, answer 'none'."
8749 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8750 case "$man3dir" in
8751 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8752         if $test -d "$privlib/man/man3"; then
8753                 cat <<EOM >&4
8754
8755 WARNING:  Previous versions of perl installed man3 pages into
8756 $privlib/man/man3.  This version will suggest a
8757 new default of $dflt.
8758 EOM
8759                 tdflt=$dflt
8760                 dflt='n'
8761                 rp='Do you wish to preserve the old behavior?(y/n)'
8762                 . ./myread
8763                 case "$ans" in
8764                 y*) dflt="$privlib/man/man3" ;;
8765                 *)  dflt=$tdflt ;;
8766                 esac
8767     fi
8768         ;;
8769 *)      dflt="$man3dir" ;;
8770 esac
8771 case "$dflt" in
8772 ' ') dflt=none ;;
8773 esac
8774 echo " "
8775 fn=dn+~
8776 rp="Where do the $package library man pages (source) go?"
8777 . ./getfile
8778 prefixvar=man3dir
8779 . ./setprefixvar
8780
8781 case "$man3dir" in
8782 '')     man3dir=' '
8783         installman3dir='';;
8784 esac
8785
8786 : What suffix to use on installed man pages
8787 case "$man3dir" in
8788 ' ')
8789         man3ext='0'
8790         ;;
8791 *)
8792         rp="What suffix should be used for the $package library man pages?"
8793         case "$man3ext" in
8794         '')     case "$man3dir" in
8795                 *3)  dflt=3 ;;
8796                 *3p) dflt=3p ;;
8797                 *3pm) dflt=3pm ;;
8798                 *l) dflt=l;;
8799                 *n) dflt=n;;
8800                 *o) dflt=o;;
8801                 *p) dflt=p;;
8802                 *C) dflt=C;;
8803                 *L) dflt=L;;
8804                 *L3) dflt=L3;;
8805                 *) dflt=3;;
8806                 esac
8807                 ;;
8808         *)      dflt="$man3ext";;
8809         esac
8810         . ./myread
8811         man3ext="$ans"
8812         ;;
8813 esac
8814
8815 : see if we have to deal with yellow pages, now NIS.
8816 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8817         if $test -f /usr/etc/nibindd; then
8818                 echo " "
8819                 echo "I'm fairly confident you're on a NeXT."
8820                 echo " "
8821                 rp='Do you get the hosts file via NetInfo?'
8822                 dflt=y
8823                 case "$hostcat" in
8824                 nidump*) ;;
8825                 '') ;;
8826                 *) dflt=n;;
8827                 esac
8828                 . ./myread
8829                 case "$ans" in
8830                 y*) hostcat='nidump hosts .';;
8831                 *)      case "$hostcat" in
8832                         nidump*) hostcat='';;
8833                         esac
8834                         ;;
8835                 esac
8836         fi
8837         case "$hostcat" in
8838         nidump*) ;;
8839         *)
8840                 case "$hostcat" in
8841                 *ypcat*) dflt=y;;
8842                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8843                                 dflt=y
8844                         else
8845                                 dflt=n
8846                         fi;;
8847                 *) dflt=n;;
8848                 esac
8849                 echo " "
8850                 rp='Are you getting the hosts file via yellow pages?'
8851                 . ./myread
8852                 case "$ans" in
8853                 y*) hostcat='ypcat hosts';;
8854                 *) hostcat='cat /etc/hosts';;
8855                 esac
8856                 ;;
8857         esac
8858 fi
8859 case "$hostcat" in
8860 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8861 esac
8862 case "$groupcat" in
8863 '') test -f /etc/group && groupcat='cat /etc/group';;
8864 esac
8865 case "$passcat" in
8866 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8867 esac
8868
8869 : now get the host name
8870 echo " "
8871 echo "Figuring out host name..." >&4
8872 case "$myhostname" in
8873 '') cont=true
8874         echo 'Maybe "hostname" will work...'
8875         if tans=`sh -c hostname 2>&1` ; then
8876                 myhostname=$tans
8877                 phostname=hostname
8878                 cont=''
8879         fi
8880         ;;
8881 *) cont='';;
8882 esac
8883 if $test "$cont"; then
8884         if ./xenix; then
8885                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8886                 if tans=`cat /etc/systemid 2>&1` ; then
8887                         myhostname=$tans
8888                         phostname='cat /etc/systemid'
8889                         echo "Whadyaknow.  Xenix always was a bit strange..."
8890                         cont=''
8891                 fi
8892         elif $test -r /etc/systemid; then
8893                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8894         fi
8895 fi
8896 if $test "$cont"; then
8897         echo 'No, maybe "uuname -l" will work...'
8898         if tans=`sh -c 'uuname -l' 2>&1` ; then
8899                 myhostname=$tans
8900                 phostname='uuname -l'
8901         else
8902                 echo 'Strange.  Maybe "uname -n" will work...'
8903                 if tans=`sh -c 'uname -n' 2>&1` ; then
8904                         myhostname=$tans
8905                         phostname='uname -n'
8906                 else
8907                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8908                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8909                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8910                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8911                         else
8912                                 case "$myhostname" in
8913                                 '') echo "Does this machine have an identity crisis or something?"
8914                                         phostname='';;
8915                                 *)
8916                                         echo "Well, you said $myhostname before..."
8917                                         phostname='echo $myhostname';;
8918                                 esac
8919                         fi
8920                 fi
8921         fi
8922 fi
8923 case "$myhostname" in
8924 '') myhostname=noname ;;
8925 esac
8926 : you do not want to know about this
8927 set $myhostname
8928 myhostname=$1
8929
8930 : verify guess
8931 if $test "$myhostname" ; then
8932         dflt=y
8933         rp='Your host name appears to be "'$myhostname'".'" Right?"
8934         . ./myread
8935         case "$ans" in
8936         y*) ;;
8937         *) myhostname='';;
8938         esac
8939 fi
8940
8941 : bad guess or no guess
8942 while $test "X$myhostname" = X ; do
8943         dflt=''
8944         rp="Please type the (one word) name of your host:"
8945         . ./myread
8946         myhostname="$ans"
8947 done
8948
8949 : translate upper to lower if necessary
8950 case "$myhostname" in
8951 *[A-Z]*)
8952         echo "(Normalizing case in your host name)"
8953         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8954         ;;
8955 esac
8956
8957 case "$myhostname" in
8958 *.*)
8959         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8960         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8961         echo "(Trimming domain name from host name--host name is now $myhostname)"
8962         ;;
8963 *) case "$mydomain" in
8964         '')
8965                 {
8966                         test "X$hostcat" = "Xypcat hosts" &&
8967                         ypmatch "$myhostname" hosts 2>/dev/null |\
8968                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8969                         $test -s hosts
8970                 } || {
8971                         test "X$hostcat" != "X" &&
8972                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8973                                         /[       ]$myhostname[  . ]/p" > hosts
8974                 }
8975                 tmp_re="[       . ]"
8976                 if $test -f hosts; then
8977                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8978                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8979                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8980                                 hosts | $sort | $uniq | \
8981                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8982                         case `$echo X$dflt` in
8983                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8984                                 dflt=.
8985                                 ;;
8986                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8987                                 ;;
8988                         esac
8989                 else
8990                         echo "(I cannot locate a hosts database anywhere)"
8991                         dflt=.
8992                 fi
8993                 case "$dflt" in
8994                 .)
8995                         tans=`./loc resolv.conf X /etc /usr/etc`
8996                         if $test -f "$tans"; then
8997                                 echo "(Attempting domain name extraction from $tans)"
8998                                 dflt=.`$sed -n -e 's/   / /g' \
8999                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9000                                   -e 1q 2>/dev/null`
9001                                 case "$dflt" in
9002                                 .) dflt=.`$sed -n -e 's/        / /g' \
9003                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9004                                      -e 1q 2>/dev/null`
9005                                         ;;
9006                                 esac
9007                         fi
9008                         ;;
9009                 esac
9010                 case "$dflt" in
9011                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9012                         dflt=.`sh -c domainname 2>/dev/null`
9013                         case "$dflt" in
9014                         '') dflt='.';;
9015                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9016                         esac
9017                         ;;
9018                 esac
9019                 case "$dflt$osname" in
9020                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9021                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9022                         ;;
9023                 esac
9024                 case "$dflt" in
9025                 .) echo "(Lost all hope -- silly guess then)"
9026                         dflt='.nonet'
9027                         ;;
9028                 esac
9029                 $rm -f hosts
9030                 ;;
9031         *) dflt="$mydomain";;
9032         esac;;
9033 esac
9034 echo " "
9035 rp="What is your domain name?"
9036 . ./myread
9037 tans="$ans"
9038 case "$ans" in
9039 '') ;;
9040 .*) ;;
9041 *) tans=".$tans";;
9042 esac
9043 mydomain="$tans"
9044
9045 : translate upper to lower if necessary
9046 case "$mydomain" in
9047 *[A-Z]*)
9048         echo "(Normalizing case in your domain name)"
9049         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9050         ;;
9051 esac
9052
9053 : a little sanity check here
9054 case "$phostname" in
9055 '') ;;
9056 *)
9057         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9058         $myhostname$mydomain|$myhostname) ;;
9059         *)
9060                 case "$phostname" in
9061                 sed*)
9062                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9063                         ;;
9064                 *)
9065                         echo "(That doesn't agree with your $phostname command, by the way.)"
9066                         ;;
9067                 esac
9068         ;;
9069         esac
9070         ;;
9071 esac
9072
9073 : determine the e-mail address of the user who is running us
9074 $cat <<EOM
9075
9076 I need to get your e-mail address in Internet format if possible, i.e.
9077 something like user@host.domain. Please answer accurately since I have
9078 no easy means to double check it. The default value provided below
9079 is most probably close to reality but may not be valid from outside
9080 your organization...
9081
9082 EOM
9083 cont=x
9084 while test "$cont"; do
9085         case "$MAILDOMAIN" in
9086         '')
9087                 if $test -s /etc/mailname; then
9088                         maildomain=`$cat /etc/mailname`
9089                 else
9090                         maildomain="$myhostname$mydomain"
9091                 fi
9092                 ;;
9093         *)  maildomain="$MAILDOMAIN";;
9094         esac
9095         case "$cf_email" in
9096         '') dflt="$cf_by@$maildomain";;
9097         *)  dflt="$cf_email";;
9098         esac
9099         rp='What is your e-mail address?'
9100         . ./myread
9101         cf_email="$ans"
9102         case "$cf_email" in
9103         *@*.*) cont='' ;;
9104         *)
9105                 rp='Address does not look like an Internet one.  Use it anyway?'
9106                 case "$fastread" in
9107                 yes) dflt=y ;;
9108                 *) dflt=n ;;
9109                 esac
9110                 . ./myread
9111                 case "$ans" in
9112                 y*) cont='' ;;
9113                 *) echo " " ;;
9114                 esac
9115                 ;;
9116         esac
9117 done
9118
9119 : Ask e-mail of administrator
9120 $cat <<EOM
9121
9122 If you or somebody else will be maintaining perl at your site, please
9123 fill in the correct e-mail address here so that they may be contacted
9124 if necessary. Currently, the "perlbug" program included with perl
9125 will send mail to this address in addition to perlbug@perl.org. You may
9126 enter "none" for no administrator.
9127
9128 EOM
9129 case "$perladmin" in
9130 '') dflt="$cf_email";;
9131 *) dflt="$perladmin";;
9132 esac
9133 rp='Perl administrator e-mail address'
9134 . ./myread
9135 perladmin="$ans"
9136
9137 : determine whether to only install version-specific parts.
9138 echo " "
9139 $cat <<EOM
9140 Do you want to install only the version-specific parts of the perl
9141 distribution?  Usually you do *not* want to do this.
9142 EOM
9143 case "$versiononly" in
9144 "$define"|[Yy]*|true) dflt='y' ;;
9145 *) dflt='n';
9146 esac
9147 rp="Do you want to install only the version-specific parts of perl?"
9148 . ./myread
9149 case "$ans" in
9150 [yY]*)  val="$define";;
9151 *)      val="$undef" ;;
9152 esac
9153 set versiononly
9154 eval $setvar
9155
9156 case "$versiononly" in
9157 "$define") inc_version_list=''
9158            inc_version_list_init=0
9159            ;;
9160 esac
9161
9162 : figure out how to guarantee perl startup
9163 : XXX Note that this currently takes advantage of the bug that binexp ignores
9164 :     the Configure -Dinstallprefix setting, which in turn means that under
9165 :     relocatable @INC, initialinstalllocation is what binexp started as.
9166 case "$startperl" in
9167 '')
9168         case "$sharpbang" in
9169         *!)
9170                 $cat <<EOH
9171
9172 I can use the #! construct to start perl on your system. This will
9173 make startup of perl scripts faster, but may cause problems if you
9174 want to share those scripts and perl is not in a standard place
9175 ($initialinstalllocation/perl) on all your platforms. The alternative
9176 is to force a shell by starting the script with a single ':' character.
9177
9178 EOH
9179                 case "$versiononly" in
9180                 "$define")      dflt="$initialinstalllocation/perl$version";;
9181                 *)              dflt="$initialinstalllocation/perl";;
9182                 esac
9183                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9184                 . ./myread
9185                 case "$ans" in
9186                 none)   startperl=": # use perl";;
9187                 *)      startperl="#!$ans"
9188                         if $test 30 -lt `echo "$ans" | wc -c`; then
9189                                 $cat >&4 <<EOM
9190
9191 WARNING:  Some systems limit the #! command to 32 characters.
9192 If you experience difficulty running Perl scripts with #!, try
9193 installing Perl in a directory with a shorter pathname.
9194
9195 EOM
9196                         fi ;;
9197                 esac
9198                 ;;
9199         *) startperl=": # use perl"
9200                 ;;
9201         esac
9202         ;;
9203 esac
9204 echo "I'll use $startperl to start perl scripts."
9205
9206 : figure best path for perl in scripts
9207 case "$perlpath" in
9208 '')
9209         case "$versiononly" in
9210         "$define")      perlpath="$initialinstalllocation/perl$version";;
9211         *)              perlpath="$initialinstalllocation/perl";;
9212         esac
9213         case "$startperl" in
9214         *!*) ;;
9215         *)
9216                 $cat <<EOH
9217
9218 I will use the "eval 'exec'" idiom to start Perl on your system.
9219 I can use the full path of your Perl binary for this purpose, but
9220 doing so may cause problems if you want to share those scripts and
9221 Perl is not always in a standard place ($initialinstalllocation/perl).
9222
9223 EOH
9224                 dflt="$initialinstalllocation/perl"
9225                 rp="What path shall I use in \"eval 'exec'\"?"
9226                 . ./myread
9227                 perlpath="$ans"
9228                 ;;
9229         esac
9230         ;;
9231 esac
9232 case "$startperl" in
9233 *!*)    ;;
9234 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9235 esac
9236
9237 : determine where public executable scripts go
9238 set scriptdir scriptdir
9239 eval $prefixit
9240 case "$scriptdir" in
9241 '')
9242         dflt="$bin"
9243         : guess some guesses
9244         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9245         $test -d /usr/share/bin     && dflt=/usr/share/bin
9246         $test -d /usr/local/script  && dflt=/usr/local/script
9247         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9248         $test -d $prefixexp/script  && dflt=$prefixexp/script
9249         set dflt
9250         eval $prefixup
9251         ;;
9252 *)  dflt="$scriptdir"
9253         ;;
9254 esac
9255 $cat <<EOM
9256
9257 Some installations have a separate directory just for executable scripts so
9258 that they can mount it across multiple architectures but keep the scripts in
9259 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9260 Or you might just lump your scripts in with all your other executables.
9261
9262 EOM
9263 fn=d~
9264 rp='Where do you keep publicly executable scripts?'
9265 . ./getfile
9266 if $test "X$ansexp" != "X$scriptdirexp"; then
9267         installscript=''
9268 fi
9269 installscriptdir=''
9270 prefixvar=scriptdir
9271 . ./setprefixvar
9272 : A little fix up for an irregularly named variable.
9273 installscript="$installscriptdir"
9274
9275 : determine where add-on public executables go
9276 case "$sitebin" in
9277 '')     dflt=$siteprefix/bin ;;
9278 *)      dflt=$sitebin ;;
9279 esac
9280 fn=d~
9281 rp='Pathname where the add-on public executables should be installed?'
9282 . ./getfile
9283 prefixvar=sitebin
9284 . ./setprefixvar
9285
9286 : determine where add-on html pages go
9287 : There is no standard location, so try to copy the previously-selected
9288 : directory structure for the core html pages.
9289 case "$sitehtml1dir" in
9290 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9291 *)     dflt=$sitehtml1dir ;;
9292 esac
9293 case "$dflt" in
9294 ''|' ') dflt=none ;;
9295 esac
9296 fn=dn+~
9297 rp='Pathname where the site-specific html pages should be installed?'
9298 . ./getfile
9299 prefixvar=sitehtml1dir
9300 . ./setprefixvar
9301
9302 : determine where add-on library html pages go
9303 : There is no standard location, so try to copy the previously-selected
9304 : directory structure for the core html pages.
9305 case "$sitehtml3dir" in
9306 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9307 *)     dflt=$sitehtml3dir ;;
9308 esac
9309 case "$dflt" in
9310 ''|' ') dflt=none ;;
9311 esac
9312 fn=dn+~
9313 rp='Pathname where the site-specific library html pages should be installed?'
9314 . ./getfile
9315 prefixvar=sitehtml3dir
9316 . ./setprefixvar
9317
9318 : determine where add-on manual pages go
9319 case "$siteman1dir" in
9320 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9321 *)      dflt=$siteman1dir ;;
9322 esac
9323 case "$dflt" in
9324 ''|' ') dflt=none ;;
9325 esac
9326 fn=dn+~
9327 rp='Pathname where the site-specific manual pages should be installed?'
9328 . ./getfile
9329 prefixvar=siteman1dir
9330 . ./setprefixvar
9331
9332 : determine where add-on library man pages go
9333 case "$siteman3dir" in
9334 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9335 *)      dflt=$siteman3dir ;;
9336 esac
9337 case "$dflt" in
9338 ''|' ') dflt=none ;;
9339 esac
9340 fn=dn+~
9341 rp='Pathname where the site-specific library manual pages should be installed?'
9342 . ./getfile
9343 prefixvar=siteman3dir
9344 . ./setprefixvar
9345
9346 : determine where add-on public executable scripts go
9347 case "$sitescript" in
9348 '')     dflt=$siteprefix/script
9349         $test -d $dflt || dflt=$sitebin ;;
9350 *)  dflt="$sitescript" ;;
9351 esac
9352 fn=d~+
9353 rp='Pathname where add-on public executable scripts should be installed?'
9354 . ./getfile
9355 prefixvar=sitescript
9356 . ./setprefixvar
9357
9358 : Check if faststdio is requested and available
9359 case "$usefaststdio" in
9360 $define|true|[yY]*|'')
9361         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9362         case "$xversion" in
9363         [68])   dflt='y' ;;
9364         *)      dflt='n' ;;
9365         esac
9366         ;;
9367 *) dflt='n';;
9368 esac
9369 cat <<EOM
9370
9371 Perl can be built to use 'fast stdio', which means using the stdio
9372 library but also directly manipulating the stdio buffers to enable
9373 faster I/O.  Using stdio is better for backward compatibility (especially
9374 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9375 interface has been preferred instead of stdio.
9376
9377 If this doesn't make any sense to you, just accept the default '$dflt'.
9378 EOM
9379 rp='Use the "fast stdio" if available?'
9380 . ./myread
9381 case "$ans" in
9382 y|Y)    val="$define" ;;
9383 *)      val="$undef" ;;
9384 esac
9385 set usefaststdio
9386 eval $setvar
9387
9388
9389 : define an is-a-typedef? function
9390 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9391 case "$inclist" in
9392 "") inclist="sys/types.h";;
9393 esac;
9394 eval "varval=\$$var";
9395 case "$varval" in
9396 "")
9397         $rm -f temp.c;
9398         for inc in $inclist; do
9399                 echo "#include <$inc>" >>temp.c;
9400         done;
9401         echo "#ifdef $type" >> temp.c;
9402         echo "printf(\"We have $type\");" >> temp.c;
9403         echo "#endif" >> temp.c;
9404         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9405         if $contains $type temp.E >/dev/null 2>&1; then
9406                 eval "$var=\$type";
9407         else
9408                 eval "$var=\$def";
9409         fi;
9410         $rm -f temp.?;;
9411 *) eval "$var=\$varval";;
9412 esac'
9413
9414 : define an is-a-typedef? function that prompts if the type is not available.
9415 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9416 case "$inclist" in
9417 "") inclist="sys/types.h";;
9418 esac;
9419 eval "varval=\$$var";
9420 case "$varval" in
9421 "")
9422         $rm -f temp.c;
9423         for inc in $inclist; do
9424                 echo "#include <$inc>" >>temp.c;
9425         done;
9426         echo "#ifdef $type" >> temp.c;
9427         echo "printf(\"We have $type\");" >> temp.c;
9428         echo "#endif" >> temp.c;
9429         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9430         echo " " ;
9431         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9432         if $contains $type temp.E >/dev/null 2>&1; then
9433                 echo "$type found." >&4;
9434                 eval "$var=\$type";
9435         else
9436                 echo "$type NOT found." >&4;
9437                 dflt="$def";
9438                 . ./myread ;
9439                 eval "$var=\$ans";
9440         fi;
9441         $rm -f temp.?;;
9442 *) eval "$var=\$varval";;
9443 esac'
9444
9445 : see what type lseek is declared as in the kernel
9446 rp="What is the type used for lseek's offset on this system?"
9447 set off_t lseektype long stdio.h sys/types.h
9448 eval $typedef_ask
9449
9450 echo " "
9451 echo "Checking to see how big your file offsets are..." >&4
9452 $cat >try.c <<EOCP
9453 #include <sys/types.h>
9454 #include <stdio.h>
9455 int main()
9456 {
9457     printf("%d\n", (int)sizeof($lseektype));
9458     return(0);
9459 }
9460 EOCP
9461 set try
9462 if eval $compile_ok; then
9463         lseeksize=`$run ./try`
9464         echo "Your file offsets are $lseeksize bytes long."
9465 else
9466         dflt=$longsize
9467         echo " "
9468         echo "(I can't seem to compile the test program.  Guessing...)"
9469         rp="What is the size of your file offsets (in bytes)?"
9470         . ./myread
9471         lseeksize="$ans"
9472 fi
9473 $rm_try
9474
9475 : see what type file positions are declared as in the library
9476 rp="What is the type for file position used by fsetpos()?"
9477 set fpos_t fpostype long stdio.h sys/types.h
9478 eval $typedef_ask
9479
9480 : Check size for Fpos_t
9481 echo " "
9482 case "$fpostype" in
9483 *_t) zzz="$fpostype"    ;;
9484 *)   zzz="fpos_t"       ;;
9485 esac
9486 echo "Checking the size of $zzz..." >&4
9487 cat > try.c <<EOCP
9488 #include <sys/types.h>
9489 #include <stdio.h>
9490 #$i_stdlib I_STDLIB
9491 #ifdef I_STDLIB
9492 #include <stdlib.h>
9493 #endif
9494 int main() {
9495     printf("%d\n", (int)sizeof($fpostype));
9496     exit(0);
9497 }
9498 EOCP
9499 set try
9500 if eval $compile_ok; then
9501         yyy=`$run ./try`
9502         case "$yyy" in
9503         '')     fpossize=4
9504                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9505                 ;;
9506         *)      fpossize=$yyy
9507                 echo "Your $zzz is $fpossize bytes long."
9508                 ;;
9509         esac
9510 else
9511         dflt="$longsize"
9512         echo " " >&4
9513         echo "(I can't compile the test program.  Guessing...)" >&4
9514         rp="What is the size of your file positions (in bytes)?"
9515         . ./myread
9516         fpossize="$ans"
9517 fi
9518
9519 : Check for large file support
9520 # Backward compatibility (uselfs is deprecated).
9521 case "$uselfs" in
9522 "$define"|true|[yY]*)
9523         cat <<EOM >&4
9524
9525 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9526 EOM
9527         uselargefiles="$define"
9528         ;;
9529 esac
9530
9531 case "$lseeksize:$fpossize" in
9532 8:8) cat <<EOM
9533
9534 You can have files larger than 2 gigabytes.
9535 EOM
9536    val="$define" ;;
9537 *)    case "$uselargefiles" in
9538    "$undef"|false|[nN]*) dflt='n' ;;
9539    *)   dflt='y' ;;
9540    esac
9541    cat <<EOM
9542
9543 Perl can be built to understand large files (files larger than 2 gigabytes)
9544 on some systems.  To do so, Configure can be run with -Duselargefiles.
9545
9546 If this doesn't make any sense to you, just accept the default '$dflt'.
9547 EOM
9548    rp='Try to understand large files, if available?'
9549    . ./myread
9550    case "$ans" in
9551    y|Y)         val="$define" ;;
9552    *)           val="$undef"  ;;
9553    esac
9554    ;;
9555 esac
9556 set uselargefiles
9557 eval $setvar
9558 : Look for a hint-file generated 'call-back-unit'.  If the
9559 : user has specified that a large files perl is to be built,
9560 : we may need to set or change some other defaults.
9561 if $test -f uselargefiles.cbu; then
9562         echo "Your platform has some specific hints regarding large file builds, using them..."
9563         . ./uselargefiles.cbu
9564 fi
9565 case "$uselargefiles" in
9566 "$define")
9567         if $test -f uselargefiles.cbu; then
9568                 echo " "
9569                 echo "Rechecking to see how big your file offsets are..." >&4
9570                 $cat >try.c <<EOCP
9571 #include <sys/types.h>
9572 #include <stdio.h>
9573 int main()
9574 {
9575     printf("%d\n", (int)sizeof($lseektype));
9576     return(0);
9577 }
9578 EOCP
9579                 set try
9580                 if eval $compile_ok; then
9581                         lseeksize=`$run ./try`
9582                         $echo "Your file offsets are now $lseeksize bytes long."
9583                 else
9584                         dflt="$lseeksize"
9585                         echo " "
9586                         echo "(I can't seem to compile the test program.  Guessing...)"
9587                         rp="What is the size of your file offsets (in bytes)?"
9588                         . ./myread
9589                         lseeksize="$ans"
9590                 fi
9591                 case "$fpostype" in
9592                 *_t) zzz="$fpostype"    ;;
9593                 *)   zzz="fpos_t"       ;;
9594                 esac
9595                 $echo $n "Rechecking the size of $zzz...$c" >&4
9596                 $cat > try.c <<EOCP
9597 #include <sys/types.h>
9598 #include <stdio.h>
9599 #$i_stdlib I_STDLIB
9600 #ifdef I_STDLIB
9601 #include <stdlib.h>
9602 #endif
9603 int main() {
9604     printf("%d\n", (int)sizeof($fpostype));
9605     return(0);
9606 }
9607 EOCP
9608                 set try
9609                 if eval $compile_ok; then
9610                         yyy=`$run ./try`
9611                         dflt="$lseeksize"
9612                         case "$yyy" in
9613                         '')     echo " "
9614                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9615                                 ;;
9616                         *)      fpossize=$yyy
9617                                 echo " $fpossize bytes." >&4
9618                                 ;;
9619                         esac
9620                 else
9621                         dflt="$fpossize"
9622                         echo " "
9623                         echo "(I can't compile the test program.  Guessing...)" >&4
9624                         rp="What is the size of your file positions (in bytes)?"
9625                         . ./myread
9626                         fpossize="$ans"
9627                 fi
9628                 $rm_try
9629         fi
9630         ;;
9631 esac
9632
9633 : Check if we want perlio
9634 useperlio="$define"
9635
9636 : Set the vendorbin variables
9637 case "$vendorprefix" in
9638 '')     d_vendorbin="$undef"
9639         vendorbin=''
9640         vendorbinexp=''
9641         ;;
9642 *)      d_vendorbin="$define"
9643         : determine where vendor-supplied executables go.
9644         case "$vendorbin" in
9645         '') dflt=$vendorprefix/bin ;;
9646         *)      dflt="$vendorbin" ;;
9647         esac
9648         fn=d~+
9649         rp='Pathname for the vendor-supplied executables directory?'
9650         . ./getfile
9651         vendorbin="$ans"
9652         vendorbinexp="$ansexp"
9653         ;;
9654 esac
9655 prefixvar=vendorbin
9656 . ./installprefix
9657
9658 : Set the vendorhtml1dir variables
9659 case "$vendorprefix" in
9660 '')     vendorhtml1dir=''
9661         vendorhtml1direxp=''
9662         ;;
9663 *)      : determine where vendor-supplied html pages go.
9664         : There is no standard location, so try to copy the previously-selected
9665         : directory structure for the core html pages.
9666         : XXX Better default suggestions would be welcome.
9667         case "$vendorhtml1dir" in
9668         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9669         *)      dflt=$vendorhtml1dir ;;
9670         esac
9671         case "$dflt" in
9672         ''|' ') dflt=none ;;
9673         esac
9674         fn=dn+~
9675         rp='Pathname for the vendor-supplied html pages?'
9676         . ./getfile
9677         vendorhtml1dir="$ans"
9678         vendorhtml1direxp="$ansexp"
9679         ;;
9680 esac
9681 : Use ' ' for none so value is preserved next time through Configure
9682 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9683 prefixvar=vendorhtml1dir
9684 . ./installprefix
9685
9686 : Set the vendorhtml3dir variables
9687 case "$vendorprefix" in
9688 '')     vendorhtml3dir=''
9689         vendorhtml3direxp=''
9690         ;;
9691 *)      : determine where vendor-supplied module html pages go.
9692         : There is no standard location, so try to copy the previously-selected
9693         : directory structure for the core html pages.
9694         : XXX Better default suggestions would be welcome.
9695         case "$vendorhtml3dir" in
9696         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9697         *)      dflt=$vendorhtml3dir ;;
9698         esac
9699         case "$dflt" in
9700         ''|' ') dflt=none ;;
9701         esac
9702         fn=dn+~
9703         rp='Pathname for the vendor-supplied html pages?'
9704         . ./getfile
9705         vendorhtml3dir="$ans"
9706         vendorhtml3direxp="$ansexp"
9707         ;;
9708 esac
9709 : Use ' ' for none so value is preserved next time through Configure
9710 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9711 prefixvar=vendorhtml3dir
9712 . ./installprefix
9713
9714 : Set the vendorman1dir variables
9715 case "$vendorprefix" in
9716 '')     vendorman1dir=''
9717         vendorman1direxp=''
9718         ;;
9719 *)      : determine where vendor-supplied manual pages go.
9720         case "$vendorman1dir" in
9721         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9722         *)      dflt=$vendorman1dir ;;
9723         esac
9724         case "$dflt" in
9725         ''|' ') dflt=none ;;
9726         esac
9727         fn=nd~+
9728         rp='Pathname for the vendor-supplied manual section 1 pages?'
9729         . ./getfile
9730         vendorman1dir="$ans"
9731         vendorman1direxp="$ansexp"
9732         ;;
9733 esac
9734 : Use ' ' for none so value is preserved next time through Configure
9735 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9736 prefixvar=vendorman1dir
9737 . ./installprefix
9738
9739 : Set the vendorman3dir variables
9740 case "$vendorprefix" in
9741 '')     vendorman3dir=''
9742         vendorman3direxp=''
9743         ;;
9744 *)      : determine where vendor-supplied module manual pages go.
9745         case "$vendorman3dir" in
9746         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9747         *)      dflt=$vendorman3dir ;;
9748         esac
9749         case "$dflt" in
9750         ''|' ') dflt=none ;;
9751         esac
9752         fn=nd~+
9753         rp='Pathname for the vendor-supplied manual section 3 pages?'
9754         . ./getfile
9755         vendorman3dir="$ans"
9756         vendorman3direxp="$ansexp"
9757         ;;
9758 esac
9759 : Use ' ' for none so value is preserved next time through Configure
9760 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9761 prefixvar=vendorman3dir
9762 . ./installprefix
9763
9764 : Set the vendorscript variables
9765 case "$vendorprefix" in
9766 '')     d_vendorscript="$undef"
9767         vendorscript=''
9768         vendorscriptexp=''
9769         ;;
9770 *)      d_vendorscript="$define"
9771         : determine where vendor-supplied scripts go.
9772         case "$vendorscript" in
9773         '')     dflt=$vendorprefix/script
9774                 $test -d $dflt || dflt=$vendorbin ;;
9775         *)  dflt="$vendorscript" ;;
9776         esac
9777         $cat <<EOM
9778
9779 The installation process will create a directory for
9780 vendor-supplied scripts.
9781
9782 EOM
9783         fn=d~+
9784         rp='Pathname for the vendor-supplied scripts directory?'
9785         . ./getfile
9786         vendorscript="$ans"
9787         vendorscriptexp="$ansexp"
9788         ;;
9789 esac
9790 prefixvar=vendorscript
9791 . ./installprefix
9792
9793 : script used to emit important warnings
9794 cat >warn <<EOS
9795 $startsh
9796 if test \$# -gt 0; then
9797         echo "\$@" >msg
9798 else
9799         cat >msg
9800 fi
9801 echo "*** WARNING:" >&4
9802 sed -e 's/^/*** /' <msg >&4
9803 echo "*** " >&4
9804 cat msg >>config.msg
9805 echo " " >>config.msg
9806 rm -f msg
9807 EOS
9808 chmod +x warn
9809 $eunicefix warn
9810
9811 : see which of string.h or strings.h is needed
9812 echo " "
9813 strings=`./findhdr string.h`
9814 if $test "$strings" && $test -r "$strings"; then
9815         echo "Using <string.h> instead of <strings.h>." >&4
9816         val="$define"
9817 else
9818         val="$undef"
9819         strings=`./findhdr strings.h`
9820         if $test "$strings" && $test -r "$strings"; then
9821                 echo "Using <strings.h> instead of <string.h>." >&4
9822         else
9823                 ./warn "No string header found -- You'll surely have problems."
9824         fi
9825 fi
9826 set i_string
9827 eval $setvar
9828 case "$i_string" in
9829 "$undef") strings=`./findhdr strings.h`;;
9830 *)        strings=`./findhdr string.h`;;
9831 esac
9832
9833 : see if qgcvt exists
9834 set qgcvt d_qgcvt
9835 eval $inlibc
9836
9837 : Check print/scan long double stuff
9838 echo " "
9839
9840 if $test X"$d_longdbl" = X"$define"; then
9841
9842 echo "Checking how to print long doubles..." >&4
9843
9844 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9845         $cat >try.c <<'EOCP'
9846 #include <sys/types.h>
9847 #include <stdio.h>
9848 int main() {
9849   double d = 123.456;
9850   printf("%.3f\n", d);
9851 }
9852 EOCP
9853         set try
9854         if eval $compile; then
9855                 yyy=`$run ./try`
9856                 case "$yyy" in
9857                 123.456)
9858                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9859                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9860                         echo "We will use %f."
9861                         ;;
9862                 esac
9863         fi
9864 fi
9865
9866 if $test X"$sPRIfldbl" = X; then
9867         $cat >try.c <<'EOCP'
9868 #include <sys/types.h>
9869 #include <stdio.h>
9870 int main() {
9871   long double d = 123.456;
9872   printf("%.3Lf\n", d);
9873 }
9874 EOCP
9875         set try
9876         if eval $compile; then
9877                 yyy=`$run ./try`
9878                 case "$yyy" in
9879                 123.456)
9880                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9881                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9882                         echo "We will use %Lf."
9883                         ;;
9884                 esac
9885         fi
9886 fi
9887
9888 if $test X"$sPRIfldbl" = X; then
9889         $cat >try.c <<'EOCP'
9890 #include <sys/types.h>
9891 #include <stdio.h>
9892 int main() {
9893   long double d = 123.456;
9894   printf("%.3llf\n", d);
9895 }
9896 EOCP
9897         set try
9898         if eval $compile; then
9899                 yyy=`$run ./try`
9900                 case "$yyy" in
9901                 123.456)
9902                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9903                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9904                         echo "We will use %llf."
9905                         ;;
9906                 esac
9907         fi
9908 fi
9909
9910 if $test X"$sPRIfldbl" = X; then
9911         $cat >try.c <<'EOCP'
9912 #include <sys/types.h>
9913 #include <stdio.h>
9914 int main() {
9915   long double d = 123.456;
9916   printf("%.3lf\n", d);
9917 }
9918 EOCP
9919         set try
9920         if eval $compile; then
9921                 yyy=`$run ./try`
9922                 case "$yyy" in
9923                 123.456)
9924                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9925                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9926                         echo "We will use %lf."
9927                         ;;
9928                 esac
9929         fi
9930 fi
9931
9932 if $test X"$sPRIfldbl" = X; then
9933         echo "Cannot figure out how to print long doubles." >&4
9934 else
9935         sSCNfldbl=$sPRIfldbl    # expect consistency
9936 fi
9937
9938 $rm_try
9939
9940 fi # d_longdbl
9941
9942 case "$sPRIfldbl" in
9943 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9944         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9945         d_SCNfldbl="$undef";
9946         ;;
9947 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9948         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9949         d_SCNfldbl="$define";
9950         ;;
9951 esac
9952
9953 : Check how to convert floats to strings.
9954
9955 if test "X$d_Gconvert" = X; then
9956
9957 echo " "
9958 echo "Checking for an efficient way to convert floats to strings."
9959 echo " " > try.c
9960 case "$uselongdouble" in
9961 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9962 esac
9963 case "$d_longdbl" in
9964 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9965 esac
9966 case "$d_PRIgldbl" in
9967 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9968 esac
9969 $cat >>try.c <<EOP
9970 #ifdef TRY_gconvert
9971 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9972 char *myname = "gconvert";
9973 #endif
9974 #ifdef TRY_gcvt
9975 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9976 char *myname = "gcvt";
9977 #endif
9978 #ifdef TRY_qgcvt
9979 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9980 char *myname = "qgcvt";
9981 #define DOUBLETYPE long double
9982 #endif
9983 #ifdef TRY_sprintf
9984 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9985 #ifdef HAS_PRIgldbl
9986 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9987 #else
9988 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9989 #endif
9990 #else
9991 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9992 #endif
9993 char *myname = "sprintf";
9994 #endif
9995
9996 #ifndef DOUBLETYPE
9997 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9998 #define DOUBLETYPE long double
9999 #else
10000 #define DOUBLETYPE double
10001 #endif
10002 #endif
10003
10004 #include <stdio.h>
10005
10006 #$i_stdlib I_STDLIB
10007 #ifdef I_STDLIB
10008 #include <stdlib.h>
10009 #endif
10010 #$i_string I_STRING
10011 #ifdef I_STRING
10012 #  include <string.h>
10013 #else
10014 #  include <strings.h>
10015 #endif
10016
10017 int checkit(char *expect, char *got)
10018 {
10019     if (strcmp(expect, got)) {
10020                 printf("%s oddity:  Expected %s, got %s\n",
10021                         myname, expect, got);
10022                 exit(1);
10023         }
10024 }
10025
10026 int main()
10027 {
10028         char buf[64];
10029         buf[63] = '\0';
10030
10031         /* This must be 1st test on (which?) platform */
10032         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10033         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10034         checkit("0.1", buf);
10035
10036         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10037         checkit("0.01", buf);
10038
10039         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10040         checkit("0.001", buf);
10041
10042         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10043         checkit("0.0001", buf);
10044
10045         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10046         if (strlen(buf) > 5)
10047             checkit("9e-005", buf); /* for Microsoft ?? */
10048         else
10049             checkit("9e-05", buf);
10050
10051         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10052         checkit("1", buf);
10053
10054         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10055         checkit("1.1", buf);
10056
10057         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10058         checkit("1.01", buf);
10059
10060         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10061         checkit("1.001", buf);
10062
10063         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10064         checkit("1.0001", buf);
10065
10066         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10067         checkit("1.00001", buf);
10068
10069         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10070         checkit("1.000001", buf);
10071
10072         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10073         checkit("0", buf);
10074
10075         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10076         checkit("-1", buf);
10077
10078         /* Some Linux gcvt's give 1.e+5 here. */
10079         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10080         checkit("100000", buf);
10081
10082         /* Some Linux gcvt's give -1.e+5 here. */
10083         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10084         checkit("-100000", buf);
10085
10086         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10087         checkit("123.456", buf);
10088
10089         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10090         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10091         /* 34 should be enough to scare even long double
10092          * places into using the e notation. */
10093         if (strlen(buf) > 5)
10094             checkit("1e+034", buf); /* for Microsoft */
10095         else
10096             checkit("1e+34", buf);
10097
10098         /* For Perl, if you add additional tests here, also add them to
10099          * t/base/num.t for benefit of platforms not using Configure or
10100          * overriding d_Gconvert */
10101
10102         exit(0);
10103 }
10104 EOP
10105 : first add preferred functions to our list
10106 xxx_list=""
10107 for xxx_convert in $gconvert_preference; do
10108     case $xxx_convert in
10109     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10110     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10111     esac
10112 done
10113 : then add any others
10114 for xxx_convert in gconvert gcvt sprintf; do
10115     case "$xxx_list" in
10116     *$xxx_convert*) ;;
10117     *) xxx_list="$xxx_list $xxx_convert" ;;
10118     esac
10119 done
10120
10121 case "$d_longdbl$uselongdouble" in
10122 "$define$define")
10123     : again, add preferred functions to our list first
10124     xxx_ld_list=""
10125     for xxx_convert in $gconvert_ld_preference; do
10126         case $xxx_convert in
10127         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10128         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10129         esac
10130     done
10131     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10132     for xxx_convert in qgcvt sprintf $xxx_list; do
10133         case "$xxx_ld_list" in
10134         $xxx_convert*|*" $xxx_convert"*) ;;
10135         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10136         esac
10137     done
10138     : if sprintf cannot do long doubles, move it to the end
10139     if test "$d_PRIgldbl" != "$define"; then
10140         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10141     fi
10142     : if no qgcvt, remove it
10143     if test "$d_qgcvt" != "$define"; then
10144         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10145     fi
10146     : use the ld_list
10147     xxx_list="$xxx_ld_list"
10148     ;;
10149 esac
10150
10151 for xxx_convert in $xxx_list; do
10152         echo "Trying $xxx_convert..."
10153         $rm -f try try$_o core
10154         set try -DTRY_$xxx_convert
10155         if eval $compile; then
10156                 echo "$xxx_convert() found." >&4
10157                 if $run ./try; then
10158                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10159                         break;
10160                 else
10161                         echo "...But $xxx_convert didn't work as I expected."
10162                         xxx_convert=''
10163                 fi
10164         else
10165                 echo "$xxx_convert NOT found." >&4
10166         fi
10167 done
10168
10169 if test X$xxx_convert = X; then
10170     echo "*** WHOA THERE!!! ***" >&4
10171     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10172     xxx_convert=sprintf
10173 fi
10174
10175 case "$xxx_convert" in
10176 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10177 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10178 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10179 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10180    "$define$define$define")
10181       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10182    "$define$define$undef")
10183       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10184    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10185    esac
10186    ;;
10187 esac
10188
10189 fi
10190 $rm_try
10191
10192 : see if _fwalk exists
10193 set fwalk d__fwalk
10194 eval $inlibc
10195
10196 : Initialize h_fcntl
10197 h_fcntl=false
10198
10199 : Initialize h_sysfile
10200 h_sysfile=false
10201
10202 : access call always available on UNIX
10203 set access d_access
10204 eval $inlibc
10205
10206 : locate the flags for 'access()'
10207 case "$d_access" in
10208 "$define")
10209         echo " "
10210         $cat >access.c <<EOCP
10211 #include <sys/types.h>
10212 #ifdef I_FCNTL
10213 #include <fcntl.h>
10214 #endif
10215 #ifdef I_SYS_FILE
10216 #include <sys/file.h>
10217 #endif
10218 #ifdef I_UNISTD
10219 #include <unistd.h>
10220 #endif
10221 #$i_stdlib I_STDLIB
10222 #ifdef I_STDLIB
10223 #include <stdlib.h>
10224 #endif
10225 int main() {
10226         exit(R_OK);
10227 }
10228 EOCP
10229         : check sys/file.h first, no particular reason here
10230         if $test `./findhdr sys/file.h` && \
10231                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10232                 h_sysfile=true;
10233                 echo "<sys/file.h> defines the *_OK access constants." >&4
10234         elif $test `./findhdr fcntl.h` && \
10235                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10236                 h_fcntl=true;
10237                 echo "<fcntl.h> defines the *_OK access constants." >&4
10238         elif $test `./findhdr unistd.h` && \
10239                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10240                 echo "<unistd.h> defines the *_OK access constants." >&4
10241         else
10242                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10243         fi
10244         ;;
10245 esac
10246 $rm -f access*
10247
10248 : see if accessx exists
10249 set accessx d_accessx
10250 eval $inlibc
10251
10252 : see if aintl exists
10253 set aintl d_aintl
10254 eval $inlibc
10255
10256 : see if alarm exists
10257 set alarm d_alarm
10258 eval $inlibc
10259
10260 : see if 64bit time functions exists
10261
10262 set ctime64 d_ctime64
10263 eval $inlibc
10264
10265 set localtime64 d_localtime64
10266 eval $inlibc
10267
10268 set gmtime64 d_gmtime64
10269 eval $inlibc
10270
10271 set mktime64 d_mktime64
10272 eval $inlibc
10273
10274 set difftime64 d_difftime64
10275 eval $inlibc
10276
10277 set asctime64 d_asctime64
10278 eval $inlibc
10279
10280 : see if POSIX threads are available
10281 set pthread.h i_pthread
10282 eval $inhdr
10283
10284 : define a function to check prototypes
10285 $cat > protochk <<EOSH
10286 $startsh
10287 cc="$cc"
10288 optimize="$optimize"
10289 ccflags="$ccflags"
10290 prototype="$prototype"
10291 define="$define"
10292 rm_try="$rm_try"
10293 usethreads=$usethreads
10294 i_pthread=$i_pthread
10295 pthread_h_first=$pthread_h_first
10296 EOSH
10297
10298 $cat >> protochk <<'EOSH'
10299
10300 $rm_try
10301 foo="$1"
10302 shift
10303 while test $# -ge 2; do
10304         case "$1" in
10305                 $define) echo "#include <$2>" >> try.c ;;
10306                 literal) echo "$2" >> try.c ;;
10307         esac
10308     # Extra magic for the benefit of systems that need pthread.h
10309     # to be included early to correctly detect threadsafe functions.
10310     # Such functions must guarantee themselves, though, that the usethreads
10311     # and i_pthread have been defined, before calling protochk.
10312     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10313         echo "#include <pthread.h>" >> try.c
10314         pthread_h_done=yes
10315     fi
10316     shift 2
10317 done
10318 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10319 cat >> try.c <<'EOCP'
10320 #ifdef CAN_PROTOTYPE
10321 #define _(args) args
10322 #else
10323 #define _(args) ()
10324 #endif
10325 EOCP
10326 echo "$foo" >> try.c
10327 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10328 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10329 status=$?
10330 $rm_try
10331 exit $status
10332 EOSH
10333 chmod +x protochk
10334 $eunicefix protochk
10335
10336 : Define hasproto macro for Configure internal use
10337 hasproto='varname=$1; func=$2; shift; shift;
10338 while $test $# -ge 2; do
10339         case "$1" in
10340         $define) echo "#include <$2>";;
10341         esac ;
10342     shift 2;
10343 done > try.c;
10344 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10345 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10346         echo "$func() prototype found.";
10347         val="$define";
10348 else
10349         echo "$func() prototype NOT found.";
10350         val="$undef";
10351 fi;
10352 set $varname;
10353 eval $setvar;
10354 $rm_try tryout.c'
10355
10356 : see if sys/types.h has to be included
10357 set sys/types.h i_systypes
10358 eval $inhdr
10359
10360 : see if sys/select.h has to be included
10361 set sys/select.h i_sysselct
10362 eval $inhdr
10363
10364 : Define hasfield macro for Configure internal use
10365 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10366 while $test $# -ge 2; do
10367         case "$1" in
10368         $define) echo "#include <$2>";;
10369         esac ;
10370     shift 2;
10371 done > try.c;
10372 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10373 set try;
10374 if eval $compile; then
10375         val="$define";
10376 else
10377         val="$undef";
10378 fi;
10379 set $varname;
10380 eval $setvar;
10381 $rm_try'
10382
10383 : see if we should include time.h, sys/time.h, or both
10384 echo " "
10385 if test "X$timeincl" = X; then
10386         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10387         $echo $n "I'm now running the test program...$c"
10388         $cat >try.c <<EOCP
10389 #include <sys/types.h>
10390 #ifdef I_TIME
10391 #include <time.h>
10392 #endif
10393 #ifdef I_SYSTIME
10394 #ifdef SYSTIMEKERNEL
10395 #define KERNEL
10396 #endif
10397 #include <sys/time.h>
10398 #endif
10399 #ifdef I_SYSSELECT
10400 #include <sys/select.h>
10401 #endif
10402 #$i_stdlib I_STDLIB
10403 #ifdef I_STDLIB
10404 #include <stdlib.h>
10405 #endif
10406 int main()
10407 {
10408         struct tm foo;
10409 #ifdef S_TIMEVAL
10410         struct timeval bar;
10411 #endif
10412 #ifdef S_TIMEZONE
10413         struct timezone tzp;
10414 #endif
10415         if (foo.tm_sec == foo.tm_sec)
10416                 exit(0);
10417 #ifdef S_TIMEVAL
10418         if (bar.tv_sec == bar.tv_sec)
10419                 exit(0);
10420 #endif
10421         exit(1);
10422 }
10423 EOCP
10424         flags=''
10425         for s_timezone in '-DS_TIMEZONE' ''; do
10426         sysselect=''
10427         for s_timeval in '-DS_TIMEVAL' ''; do
10428         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10429         for i_time in '' '-DI_TIME'; do
10430         for i_systime in '-DI_SYSTIME' ''; do
10431                 case "$flags" in
10432                 '') $echo $n ".$c"
10433                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10434                         if eval $compile; then
10435                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10436                                 shift
10437                                 flags="$*"
10438                                 echo " "
10439                                 $echo $n "Succeeded with $flags$c"
10440                         fi
10441                         ;;
10442                 esac
10443         done
10444         done
10445         done
10446         done
10447         done
10448         timeincl=''
10449         echo " "
10450         case "$flags" in
10451         *SYSTIMEKERNEL*) i_systimek="$define"
10452                 timeincl=`./findhdr sys/time.h`
10453                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10454         *) i_systimek="$undef";;
10455         esac
10456         case "$flags" in
10457         *I_TIME*) i_time="$define"
10458                 timeincl=`./findhdr time.h`" $timeincl"
10459                 echo "We'll include <time.h>." >&4;;
10460         *) i_time="$undef";;
10461         esac
10462         case "$flags" in
10463         *I_SYSTIME*) i_systime="$define"
10464                 timeincl=`./findhdr sys/time.h`" $timeincl"
10465                 echo "We'll include <sys/time.h>." >&4;;
10466         *) i_systime="$undef";;
10467         esac
10468         $rm_try
10469 fi
10470 : see if struct tm knows about tm_zone
10471 case "$i_systime$i_time" in
10472 *$define*)
10473         echo " "
10474         echo "Checking to see if your struct tm has tm_zone field..." >&4
10475         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10476         eval $hasfield
10477         ;;
10478 *)      val="$undef"
10479         set d_tm_tm_zone
10480         eval $setvar
10481         ;;
10482 esac
10483 case "$d_tm_tm_zone" in
10484 "$define")      echo "Yes, it does."   ;;
10485 *)              echo "No, it doesn't." ;;
10486 esac
10487 : see if struct tm knows about tm_gmtoff
10488 case "$i_systime$i_time" in
10489 *$define*)
10490         echo " "
10491         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10492         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10493         eval $hasfield
10494         ;;
10495 *)      val="$undef"
10496         set d_tm_tm_gmtoff
10497         eval $setvar
10498         ;;
10499 esac
10500 case "$d_tm_tm_gmtoff" in
10501 "$define")      echo "Yes, it does."   ;;
10502 *)              echo "No, it doesn't." ;;
10503 esac
10504
10505 : see if asctime_r exists
10506 set asctime_r d_asctime_r
10507 eval $inlibc
10508 case "$d_asctime_r" in
10509 "$define")
10510         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10511         case "$d_asctime_r_proto:$usethreads" in
10512         ":define")      d_asctime_r_proto=define
10513                 set d_asctime_r_proto asctime_r $hdrs
10514                 eval $hasproto ;;
10515         *)      ;;
10516         esac
10517         case "$d_asctime_r_proto" in
10518         define)
10519         case "$asctime_r_proto" in
10520         ''|0) try='char* asctime_r(const struct tm*, char*);'
10521         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10522         esac
10523         case "$asctime_r_proto" in
10524         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10525         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10526         esac
10527         case "$asctime_r_proto" in
10528         ''|0) try='int asctime_r(const struct tm*, char*);'
10529         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10530         esac
10531         case "$asctime_r_proto" in
10532         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10533         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10534         esac
10535         case "$asctime_r_proto" in
10536         ''|0)   d_asctime_r=undef
10537                 asctime_r_proto=0
10538                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10539         * )     case "$asctime_r_proto" in
10540                 REENTRANT_PROTO*) ;;
10541                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10542                 esac
10543                 echo "Prototype: $try" ;;
10544         esac
10545         ;;
10546         *)      case "$usethreads" in
10547                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10548                 esac
10549                 d_asctime_r=undef
10550                 asctime_r_proto=0
10551                 ;;
10552         esac
10553         ;;
10554 *)      asctime_r_proto=0
10555         ;;
10556 esac
10557
10558 : see if atolf exists
10559 set atolf d_atolf
10560 eval $inlibc
10561
10562 : see if atoll exists
10563 set atoll d_atoll
10564 eval $inlibc
10565
10566 : Look for GCC-style attribute format
10567 case "$d_attribute_format" in
10568 '')
10569 echo " "
10570 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10571 $cat >attrib.c <<'EOCP'
10572 #include <stdio.h>
10573 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10574 EOCP
10575 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10576         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10577                 echo "Your C compiler doesn't support __attribute__((format))."
10578                 val="$undef"
10579         else
10580                 echo "Your C compiler supports __attribute__((format))."
10581                 val="$define"
10582         fi
10583 else
10584         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10585         val="$undef"
10586 fi
10587 ;;
10588 *) val="$d_attribute_format" ;;
10589 esac
10590 set d_attribute_format
10591 eval $setvar
10592 $rm -f attrib*
10593
10594 : Look for GCC-style attribute format with null format allowed
10595 case "$d_printf_format_null" in
10596 '') case "$d_attribute_format" in
10597     $define)
10598         echo " "
10599         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10600 $cat >attrib.c <<EOCP
10601 #include <stdio.h>
10602 #$i_stdlib I_STDLIB
10603 #ifdef I_STDLIB
10604 #include <stdlib.h>
10605 #endif
10606 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10607 int null_printf (char* pat,...) { return (int)pat; }
10608 int main () { exit(null_printf(NULL)); }
10609 EOCP
10610         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10611             : run the executable in case it produces a run-time warning
10612             if $run ./attrib >>attrib.out 2>&1; then
10613                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10614                     echo "Your C compiler doesn't allow __printf__ format to be null."
10615                     val="$undef"
10616                 else
10617                     echo "Your C compiler allows __printf__ format to be null."
10618                     val="$define"
10619                 fi
10620             else
10621             echo "Your C compiler executable failed with __printf__ format null."
10622             val="$undef"
10623         fi
10624     else
10625         echo "Your C compiler fails with __printf__ format null."
10626         val="$undef"
10627     fi
10628     ;;
10629     *)  val="$undef" ;;
10630     esac
10631 ;;
10632 *)  val="$d_printf_format_null" ;;
10633 esac
10634 set d_printf_format_null
10635 eval $setvar
10636 $rm -f attrib*
10637
10638 : Look for GCC-style attribute malloc
10639 case "$d_attribute_malloc" in
10640 '')
10641 echo " "
10642 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10643 $cat >attrib.c <<'EOCP'
10644 #include <stdio.h>
10645 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10646 EOCP
10647 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10648         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10649                 echo "Your C compiler doesn't support __attribute__((malloc))."
10650                 val="$undef"
10651         else
10652                 echo "Your C compiler supports __attribute__((malloc))."
10653                 val="$define"
10654         fi
10655 else
10656         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10657         val="$undef"
10658 fi
10659 ;;
10660 *) val="$d_attribute_malloc" ;;
10661 esac
10662 set d_attribute_malloc
10663 eval $setvar
10664 $rm -f attrib*
10665
10666 : Look for GCC-style attribute nonnull
10667 case "$d_attribute_nonnull" in
10668 '')
10669 echo " "
10670 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10671 $cat >attrib.c <<'EOCP'
10672 #include <stdio.h>
10673 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10674 EOCP
10675 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10676         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10677                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10678                 val="$undef"
10679         else
10680                 echo "Your C compiler supports __attribute__((nonnull))."
10681                 val="$define"
10682         fi
10683 else
10684         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10685         val="$undef"
10686 fi
10687 ;;
10688 *) val="$d_attribute_nonnull" ;;
10689 esac
10690 set d_attribute_nonnull
10691 eval $setvar
10692 $rm -f attrib*
10693
10694 : Look for GCC-style attribute noreturn
10695 case "$d_attribute_noreturn" in
10696 '')
10697 echo " "
10698 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10699 $cat >attrib.c <<'EOCP'
10700 #include <stdio.h>
10701 void fall_over_dead( void ) __attribute__((noreturn));
10702 EOCP
10703 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10704         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10705                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10706                 val="$undef"
10707         else
10708                 echo "Your C compiler supports __attribute__((noreturn))."
10709                 val="$define"
10710         fi
10711 else
10712         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10713         val="$undef"
10714 fi
10715 ;;
10716 *) val="$d_attribute_noreturn" ;;
10717 esac
10718 set d_attribute_noreturn
10719 eval $setvar
10720 $rm -f attrib*
10721
10722 : Look for GCC-style attribute pure
10723 case "$d_attribute_pure" in
10724 '')
10725 echo " "
10726 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10727 $cat >attrib.c <<'EOCP'
10728 #include <stdio.h>
10729 int square( int n ) __attribute__((pure));
10730 EOCP
10731 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10732         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10733                 echo "Your C compiler doesn't support __attribute__((pure))."
10734                 val="$undef"
10735         else
10736                 echo "Your C compiler supports __attribute__((pure))."
10737                 val="$define"
10738         fi
10739 else
10740         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10741         val="$undef"
10742 fi
10743 ;;
10744 *) val="$d_attribute_pure" ;;
10745 esac
10746 set d_attribute_pure
10747 eval $setvar
10748 $rm -f attrib*
10749
10750 : Look for GCC-style attribute unused
10751 case "$d_attribute_unused" in
10752 '')
10753 echo " "
10754 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10755 $cat >attrib.c <<'EOCP'
10756 #include <stdio.h>
10757 int do_something( int dummy __attribute__((unused)), int n );
10758 EOCP
10759 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10760         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10761                 echo "Your C compiler doesn't support __attribute__((unused))."
10762                 val="$undef"
10763         else
10764                 echo "Your C compiler supports __attribute__((unused))."
10765                 val="$define"
10766         fi
10767 else
10768         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10769         val="$undef"
10770 fi
10771 ;;
10772 *) val="$d_attribute_unused" ;;
10773 esac
10774 set d_attribute_unused
10775 eval $setvar
10776 $rm -f attrib*
10777
10778 : Look for GCC-style attribute deprecated
10779 case "$d_attribute_deprecated" in
10780 '')
10781 echo " "
10782 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10783 $cat >attrib.c <<'EOCP'
10784 #include <stdio.h>
10785 int I_am_deprecated(void) __attribute__((deprecated));
10786 EOCP
10787 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10788         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10789                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10790                 val="$undef"
10791         else
10792                 echo "Your C compiler supports __attribute__((deprecated))."
10793                 val="$define"
10794         fi
10795 else
10796         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10797         val="$undef"
10798 fi
10799 ;;
10800 *) val="$d_attribute_deprecated" ;;
10801 esac
10802 set d_attribute_deprecated
10803 eval $setvar
10804 $rm -f attrib*
10805
10806 : Look for GCC-style attribute warn_unused_result
10807 case "$d_attribute_warn_unused_result" in
10808 '')
10809 echo " "
10810 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10811 $cat >attrib.c <<'EOCP'
10812 #include <stdio.h>
10813 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10814 EOCP
10815 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10816         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10817                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10818                 val="$undef"
10819         else
10820                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10821                 val="$define"
10822         fi
10823 else
10824         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10825         val="$undef"
10826 fi
10827 ;;
10828 *) val="$d_attribute_warn_unused_result" ;;
10829 esac
10830 set d_attribute_warn_unused_result
10831 eval $setvar
10832 $rm -f attrib*
10833
10834 : see if bcmp exists
10835 set bcmp d_bcmp
10836 eval $inlibc
10837
10838 : see if bcopy exists
10839 set bcopy d_bcopy
10840 eval $inlibc
10841
10842 : see if getpgrp exists
10843 set getpgrp d_getpgrp
10844 eval $inlibc
10845
10846 case "$d_getpgrp" in
10847 "$define")
10848         echo " "
10849         echo "Checking to see which flavor of getpgrp is in use..."
10850         $cat >try.c <<EOP
10851 #$i_unistd I_UNISTD
10852 #include <sys/types.h>
10853 #ifdef I_UNISTD
10854 #  include <unistd.h>
10855 #endif
10856 #$i_stdlib I_STDLIB
10857 #ifdef I_STDLIB
10858 #include <stdlib.h>
10859 #endif
10860 int main()
10861 {
10862         if (getuid() == 0) {
10863                 printf("(I see you are running Configure as super-user...)\n");
10864                 setuid(1);
10865         }
10866 #ifdef TRY_BSD_PGRP
10867         if (getpgrp(1) == 0)
10868                 exit(0);
10869 #else
10870         if (getpgrp() > 0)
10871                 exit(0);
10872 #endif
10873         exit(1);
10874 }
10875 EOP
10876         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10877                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10878                 val="$define"
10879         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10880                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10881                 val="$undef"
10882         else
10883                 echo "I can't seem to compile and run the test program."
10884                 if ./usg; then
10885                         xxx="a USG one, i.e. you use getpgrp()."
10886                 else
10887                         # SVR4 systems can appear rather BSD-ish.
10888                         case "$i_unistd" in
10889                         $undef)
10890                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10891                                 val="$define"
10892                                 ;;
10893                         $define)
10894                                 xxx="probably a USG one, i.e. you use getpgrp()."
10895                                 val="$undef"
10896                                 ;;
10897                         esac
10898                 fi
10899                 echo "Assuming your getpgrp is $xxx" >&4
10900         fi
10901         ;;
10902 *) val="$undef";;
10903 esac
10904 set d_bsdgetpgrp
10905 eval $setvar
10906 $rm_try
10907
10908 : see if setpgrp exists
10909 set setpgrp d_setpgrp
10910 eval $inlibc
10911
10912 case "$d_setpgrp" in
10913 "$define")
10914         echo " "
10915         echo "Checking to see which flavor of setpgrp is in use..."
10916         $cat >try.c <<EOP
10917 #$i_unistd I_UNISTD
10918 #include <sys/types.h>
10919 #ifdef I_UNISTD
10920 #  include <unistd.h>
10921 #endif
10922 #$i_stdlib I_STDLIB
10923 #ifdef I_STDLIB
10924 #include <stdlib.h>
10925 #endif
10926 int main()
10927 {
10928         if (getuid() == 0) {
10929                 printf("(I see you are running Configure as super-user...)\n");
10930                 setuid(1);
10931         }
10932 #ifdef TRY_BSD_PGRP
10933         if (-1 == setpgrp(1, 1))
10934                 exit(0);
10935 #else
10936         if (setpgrp() != -1)
10937                 exit(0);
10938 #endif
10939         exit(1);
10940 }
10941 EOP
10942         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10943                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10944                 val="$define"
10945         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10946                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10947                 val="$undef"
10948         else
10949                 echo "(I can't seem to compile and run the test program.)"
10950                 if ./usg; then
10951                         xxx="a USG one, i.e. you use setpgrp()."
10952                 else
10953                         # SVR4 systems can appear rather BSD-ish.
10954                         case "$i_unistd" in
10955                         $undef)
10956                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10957                                 val="$define"
10958                                 ;;
10959                         $define)
10960                                 xxx="probably a USG one, i.e. you use setpgrp()."
10961                                 val="$undef"
10962                                 ;;
10963                         esac
10964                 fi
10965                 echo "Assuming your setpgrp is $xxx" >&4
10966         fi
10967         ;;
10968 *) val="$undef";;
10969 esac
10970 set d_bsdsetpgrp
10971 eval $setvar
10972 $rm_try
10973
10974 : Look for GCC-style __builtin_choose_expr
10975 case "$d_builtin_choose_expr" in
10976 '')
10977     echo " "
10978     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10979     $cat >try.c <<'EOCP'
10980 #include <assert.h>
10981 #include <stdlib.h>
10982 #include <stdio.h>
10983
10984 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10985
10986 int main(void) {
10987     assert( SYRINX(1) == 2112 );
10988     assert( SYRINX(1) != 5150 );
10989     assert( SYRINX(0) == 5150 );
10990     assert( SYRINX(0) != 2112 );
10991     puts( "All good!" );
10992     exit(0);
10993 }
10994
10995 EOCP
10996     set try
10997     if eval $compile && $run ./try; then
10998         echo "Your C compiler supports __builtin_choose_expr."
10999         val="$define"
11000     else
11001         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11002         val="$undef"
11003     fi
11004 ;;
11005 *) val="$d_builtin_choose_expr" ;;
11006 esac
11007
11008 set d_builtin_choose_expr
11009 eval $setvar
11010 $rm_try
11011
11012 : Look for GCC-style __builtin_expect
11013 case "$d_builtin_expect" in
11014 '')
11015     echo " "
11016     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11017     $cat >try.c <<'EOCP'
11018 int main(void) {
11019     int n = 50;
11020     if ( __builtin_expect(n, 0) ) n = 1;
11021     /* Remember shell exit code truth is 0, C truth is non-zero */
11022     return !(n == 1);
11023 }
11024 EOCP
11025     set try
11026     if eval $compile && $run ./try; then
11027         echo "Your C compiler supports __builtin_expect."
11028         val="$define"
11029     else
11030         echo "Your C compiler doesn't seem to understand __builtin_expect."
11031         val="$undef"
11032     fi
11033     ;;
11034 *) val="$d_builtin_expect" ;;
11035 esac
11036
11037 set d_builtin_expect
11038 eval $setvar
11039 $rm_try
11040
11041 : see if bzero exists
11042 set bzero d_bzero
11043 eval $inlibc
11044
11045 : see if stdarg is available
11046 echo " "
11047 if $test `./findhdr stdarg.h`; then
11048         echo "<stdarg.h> found." >&4
11049         valstd="$define"
11050 else
11051         echo "<stdarg.h> NOT found." >&4
11052         valstd="$undef"
11053 fi
11054
11055 : see if varargs is available
11056 echo " "
11057 if $test `./findhdr varargs.h`; then
11058         echo "<varargs.h> found." >&4
11059 else
11060         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11061 fi
11062
11063 : set up the varargs testing programs
11064 $cat > varargs.c <<EOP
11065 #ifdef I_STDARG
11066 #include <stdarg.h>
11067 #endif
11068 #ifdef I_VARARGS
11069 #include <varargs.h>
11070 #endif
11071
11072 #ifdef I_STDARG
11073 int f(char *p, ...)
11074 #else
11075 int f(va_alist)
11076 va_dcl
11077 #endif
11078 {
11079         va_list ap;
11080 #ifndef I_STDARG
11081         char *p;
11082 #endif
11083 #ifdef I_STDARG
11084         va_start(ap,p);
11085 #else
11086         va_start(ap);
11087         p = va_arg(ap, char *);
11088 #endif
11089         va_end(ap);
11090         return 0;
11091 }
11092 EOP
11093 $cat > varargs <<EOP
11094 $startsh
11095 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11096         echo "true"
11097 else
11098         echo "false"
11099 fi
11100 $rm -f varargs$_o
11101 EOP
11102 chmod +x varargs
11103
11104 : now check which varargs header should be included
11105 echo " "
11106 i_varhdr=''
11107 val=''
11108 case "$valstd" in
11109 "$define")
11110         if `./varargs I_STDARG`; then
11111                 val='stdarg.h'
11112         elif `./varargs I_VARARGS`; then
11113                 val='varargs.h'
11114         fi
11115         ;;
11116 *)
11117         if `./varargs I_VARARGS`; then
11118                 val='varargs.h'
11119         fi
11120         ;;
11121 esac
11122 case "$val" in
11123 '')
11124         echo " "
11125         echo "*** WHOA THERE!!! ***" >&4
11126         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11127         case "$knowitall" in
11128         '')
11129         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11130                 exit 1
11131                 ;;
11132         esac
11133 echo "I could not find the definition for va_dcl... You have problems..." >&4
11134         val="$undef"; set i_stdarg; eval $setvar
11135         val="$undef"; set i_varargs; eval $setvar
11136         ;;
11137 *)
11138         set i_varhdr
11139         eval $setvar
11140         case "$i_varhdr" in
11141         stdarg.h)
11142                 val="$define"; set i_stdarg; eval $setvar
11143                 val="$undef"; set i_varargs; eval $setvar
11144                 ;;
11145         varargs.h)
11146                 val="$undef"; set i_stdarg; eval $setvar
11147                 val="$define"; set i_varargs; eval $setvar
11148                 ;;
11149         esac
11150         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11151 esac
11152 $rm -f varargs*
11153
11154 : see if the Compiler supports C99 variadic macros
11155 case "$i_stdarg$i_stdlib" in
11156     "$define$define")
11157     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11158     $cat >try.c <<EOCP
11159 #include <stdio.h>
11160 #include <stdarg.h>
11161
11162 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11163
11164 int main() {
11165   char buf[20];
11166   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11167   puts(buf);
11168   return 0;
11169 }
11170 EOCP
11171     set try
11172     if eval $compile && $run ./try 2>&1 >/dev/null; then
11173         case "`$run ./try`" in
11174             "123 456 789")
11175             echo "You have C99 variadic macros." >&4
11176             d_c99_variadic_macros="$define"
11177             ;;
11178             *)
11179             echo "You don't have functional C99 variadic macros." >&4
11180             d_c99_variadic_macros="$undef"
11181             ;;
11182         esac
11183     else
11184         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11185         d_c99_variadic_macros="$undef"
11186     fi
11187     $rm_try
11188     ;;
11189     *)
11190     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11191     d_c99_variadic_macros="$undef"
11192     ;;
11193 esac
11194
11195 : see if signal is declared as pointer to function returning int or void
11196 echo " "
11197 xxx=`./findhdr signal.h`
11198 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11199 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11200         echo "You have int (*signal())() instead of void." >&4
11201         val="$undef"
11202 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11203         echo "You have void (*signal())()." >&4
11204         val="$define"
11205 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11206         echo "You have int (*signal())() instead of void." >&4
11207         val="$undef"
11208 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11209         echo "You have void (*signal())()." >&4
11210         val="$define"
11211 else
11212         case "$d_voidsig" in
11213         '')
11214         echo "I can't determine whether signal handler returns void or int..." >&4
11215                 dflt=void
11216                 rp="What type does your signal handler return?"
11217                 . ./myread
11218                 case "$ans" in
11219                 v*) val="$define";;
11220                 *) val="$undef";;
11221                 esac;;
11222         "$define")
11223                 echo "As you already told me, signal handler returns void." >&4
11224                 val="$define"
11225                 ;;
11226         *)      echo "As you already told me, signal handler returns int." >&4
11227                 val="$undef"
11228                 ;;
11229         esac
11230 fi
11231 set d_voidsig
11232 eval $setvar
11233 case "$d_voidsig" in
11234 "$define") signal_t="void";;
11235 *) signal_t="int";;
11236 esac
11237 $rm -f $$.tmp
11238
11239 : check for ability to cast large floats to 32-bit ints.
11240 echo " "
11241 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11242 if $test "$intsize" -ge 4; then
11243         xxx=int
11244 else
11245         xxx=long
11246 fi
11247 $cat >try.c <<EOCP
11248 #include <stdio.h>
11249 #$i_stdlib I_STDLIB
11250 #ifdef I_STDLIB
11251 #include <stdlib.h>
11252 #endif
11253 #include <sys/types.h>
11254 #include <signal.h>
11255 $signal_t blech(int s) { exit(3); }
11256 int main()
11257 {
11258         $xxx i32;
11259         double f, g;
11260         int result = 0;
11261         char str[16];
11262         signal(SIGFPE, blech);
11263
11264         /* Don't let compiler optimize the test away.  Store the number
11265            in a writable string for gcc to pass to sscanf under HP-UX.
11266         */
11267         sprintf(str, "2147483647");
11268         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11269         g = 10 * f;
11270         i32  = ($xxx) g;
11271
11272         /* x86 processors will probably give 0x8000 0000, which is a
11273            sign change.  We don't want that.  We want to mimic SPARC
11274            behavior here, which is to preserve the sign and give
11275            back 0x7fff ffff.
11276         */
11277         if (i32 != ($xxx) f)
11278                 result |= 1;
11279         exit(result);
11280 }
11281 EOCP
11282 set try
11283 if eval $compile_ok; then
11284         $run ./try
11285         yyy=$?
11286 else
11287         echo "(I can't seem to compile the test program--assuming it can't)"
11288         yyy=1
11289 fi
11290 case "$yyy" in
11291 0)      val="$define"
11292         echo "Yup, it can."
11293         ;;
11294 *)      val="$undef"
11295         echo "Nope, it can't."
11296         ;;
11297 esac
11298 set d_casti32
11299 eval $setvar
11300 $rm_try
11301
11302 : check for ability to cast negative floats to unsigned
11303 echo " "
11304 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11305 $cat >try.c <<EOCP
11306 #include <stdio.h>
11307 #$i_stdlib I_STDLIB
11308 #ifdef I_STDLIB
11309 #include <stdlib.h>
11310 #endif
11311 #include <sys/types.h>
11312 #include <signal.h>
11313 $signal_t blech(int s) { exit(7); }
11314 $signal_t blech_in_list(int s) { exit(4); }
11315 unsigned long dummy_long(unsigned long p) { return p; }
11316 unsigned int dummy_int(unsigned int p) { return p; }
11317 unsigned short dummy_short(unsigned short p) { return p; }
11318 int main()
11319 {
11320         double f;
11321         unsigned long along;
11322         unsigned int aint;
11323         unsigned short ashort;
11324         int result = 0;
11325         char str[16];
11326
11327         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11328            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11329            optimized the whole file away
11330         */
11331         /* Store the number in a writable string for gcc to pass to
11332            sscanf under HP-UX.
11333         */
11334         sprintf(str, "-123");
11335         sscanf(str, "%lf", &f);  /* f = -123.; */
11336
11337         signal(SIGFPE, blech);
11338         along = (unsigned long)f;
11339         aint = (unsigned int)f;
11340         ashort = (unsigned short)f;
11341         if (along != (unsigned long)-123)
11342                 result |= 1;
11343         if (aint != (unsigned int)-123)
11344                 result |= 1;
11345         if (ashort != (unsigned short)-123)
11346                 result |= 1;
11347         sprintf(str, "1073741824.");
11348         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11349         f = f + f;
11350         along = 0;
11351         along = (unsigned long)f;
11352         if (along != 0x80000000)
11353                 result |= 2;
11354         f -= 1.;
11355         along = 0;
11356         along = (unsigned long)f;
11357         if (along != 0x7fffffff)
11358                 result |= 1;
11359         f += 2.;
11360         along = 0;
11361         along = (unsigned long)f;
11362         if (along != 0x80000001)
11363                 result |= 2;
11364         if (result)
11365                 exit(result);
11366         signal(SIGFPE, blech_in_list);
11367         sprintf(str, "123.");
11368         sscanf(str, "%lf", &f);  /* f = 123.; */
11369         along = dummy_long((unsigned long)f);
11370         aint = dummy_int((unsigned int)f);
11371         ashort = dummy_short((unsigned short)f);
11372         if (along != (unsigned long)123)
11373                 result |= 4;
11374         if (aint != (unsigned int)123)
11375                 result |= 4;
11376         if (ashort != (unsigned short)123)
11377                 result |= 4;
11378         exit(result);
11379
11380 }
11381 EOCP
11382 set try
11383 if eval $compile_ok; then
11384         $run ./try
11385         castflags=$?
11386 else
11387         echo "(I can't seem to compile the test program--assuming it can't)"
11388         castflags=7
11389 fi
11390 case "$castflags" in
11391 0)      val="$define"
11392         echo "Yup, it can."
11393         ;;
11394 *)      val="$undef"
11395         echo "Nope, it can't."
11396         ;;
11397 esac
11398 set d_castneg
11399 eval $setvar
11400 $rm_try
11401
11402 : see if vprintf exists
11403 echo " "
11404 if set vprintf val -f d_vprintf; eval $csym; $val; then
11405         echo 'vprintf() found.' >&4
11406         val="$define"
11407         $cat >try.c <<EOF
11408 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11409 #$i_varargs I_VARARGS
11410
11411 #$i_stdlib I_STDLIB
11412 #$i_unistd I_UNISTD
11413
11414 #ifdef I_STDARG
11415 #  include <stdarg.h>
11416 #else /* I_VARARGS */
11417 #  include <varargs.h>
11418 #endif
11419
11420 #ifdef I_UNISTD
11421 #  include <unistd.h>
11422 #endif
11423
11424 #ifdef I_STDLIB
11425 #  include <stdlib.h>
11426 #endif
11427
11428 #include <stdio.h> /* vsprintf prototype */
11429
11430 #ifdef I_STDARG
11431 void xxx(int n, ...)
11432 {
11433     va_list args;
11434     char buf[10];
11435     va_start(args, n);
11436     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11437 }
11438 int main() { xxx(1, "foo"); }
11439
11440 #else /* I_VARARGS */
11441
11442 xxx(va_alist)
11443 va_dcl
11444 {
11445     va_list args;
11446     char buf[10];
11447     va_start(args);
11448     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11449 }
11450 int main() { xxx("foo"); }
11451
11452 #endif
11453
11454 EOF
11455         set try
11456         if eval $compile_ok; then
11457                 if $run ./try; then
11458                         echo "Your vsprintf() returns (int)." >&4
11459                         val2="$undef"
11460                 else
11461                         echo "Your vsprintf() returns (char*)." >&4
11462                         val2="$define"
11463                 fi
11464         else
11465                 echo 'I am unable to compile the vsprintf() test program.' >&4
11466                 # We shouldn't get here.  If we do, assume the standard signature,
11467                 # not the old BSD one.
11468                 echo 'Guessing that vsprintf() returns (int).' >&4
11469                 val2="$undef"
11470         fi
11471 else
11472         echo 'vprintf() NOT found.' >&4
11473         val="$undef"
11474         val2="$undef"
11475 fi
11476 $rm_try
11477 set d_vprintf
11478 eval $setvar
11479 val=$val2
11480 set d_charvspr
11481 eval $setvar
11482
11483 : see if chown exists
11484 set chown d_chown
11485 eval $inlibc
11486
11487 : see if chroot exists
11488 set chroot d_chroot
11489 eval $inlibc
11490
11491 : see if chsize exists
11492 set chsize d_chsize
11493 eval $inlibc
11494
11495 : see if class exists
11496 set class d_class
11497 eval $inlibc
11498
11499 : see if clearenv exists
11500 set clearenv d_clearenv
11501 eval $inlibc
11502
11503 : Define hasstruct macro for Configure internal use
11504 hasstruct='varname=$1; struct=$2; shift; shift;
11505 while $test $# -ge 2; do
11506         case "$1" in
11507         $define) echo "#include <$2>";;
11508         esac ;
11509     shift 2;
11510 done > try.c;
11511 echo "int main () { struct $struct foo; }" >> try.c;
11512 set try;
11513 if eval $compile; then
11514         val="$define";
11515 else
11516         val="$undef";
11517 fi;
11518 set $varname;
11519 eval $setvar;
11520 $rm_try'
11521
11522 : see whether socket exists
11523 socketlib=''
11524 sockethdr=''
11525 echo " "
11526 $echo $n "Hmm... $c" >&4
11527 if set socket val -f d_socket; eval $csym; $val; then
11528     echo "Looks like you have Berkeley networking support." >&4
11529     d_socket="$define"
11530     if set setsockopt val -f; eval $csym; $val; then
11531         d_oldsock="$undef"
11532     else
11533         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11534         d_oldsock="$define"
11535     fi
11536 else
11537     if $contains socklib libc.list >/dev/null 2>&1; then
11538         echo "Looks like you have Berkeley networking support." >&4
11539         d_socket="$define"
11540         : we will have to assume that it supports the 4.2 BSD interface
11541         d_oldsock="$undef"
11542     else
11543         echo "You don't have Berkeley networking in libc$_a..." >&4
11544         if test "X$d_socket" = "X$define"; then
11545             echo "...but you seem to believe that you have sockets." >&4
11546         else
11547             for net in net socket
11548             do
11549                 if test -f $sysroot/usr/lib/lib$net$_a; then
11550                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11551                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11552                     if $contains socket libc.list >/dev/null 2>&1; then
11553                         d_socket="$define"
11554                         socketlib="-l$net"
11555                         case "$net" in
11556                         net)
11557                             echo "...but the Wollongong group seems to have hacked it in." >&4
11558                             sockethdr="-I$sysroot/usr/netinclude"
11559                             ;;
11560                         esac
11561                         echo "Found Berkeley sockets interface in lib$net." >&4
11562                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11563                             d_oldsock="$undef"
11564                         else
11565                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11566                             d_oldsock="$define"
11567                         fi
11568                         break
11569                     fi
11570                 fi
11571             done
11572             if test "X$d_socket" != "X$define"; then
11573                echo "or anywhere else I see." >&4
11574                d_socket="$undef"
11575                d_oldsock="$undef"
11576             fi
11577         fi
11578     fi
11579 fi
11580
11581 : see if socketpair exists
11582 set socketpair d_sockpair
11583 eval $inlibc
11584
11585
11586 echo " "
11587 echo "Checking the availability sa_len in the sock struct ..." >&4
11588 $cat >try.c <<EOF
11589 #include <sys/types.h>
11590 #include <sys/socket.h>
11591 int main() {
11592 struct sockaddr sa;
11593 return (sa.sa_len);
11594 }
11595 EOF
11596 val="$undef"
11597 set try; if eval $compile; then
11598     val="$define"
11599 fi
11600 set d_sockaddr_sa_len; eval $setvar
11601 $rm_try
11602
11603 echo " "
11604 echo "Checking the availability struct sockaddr_in6 ..." >&4
11605 $cat >try.c <<EOF
11606 #include <sys/types.h>
11607 #include <sys/socket.h>
11608 #include <netinet/in.h>
11609 int main() {
11610 struct sockaddr_in6 sin6;
11611 return (sin6.sin6_family);
11612 }
11613 EOF
11614 val="$undef"
11615 set try; if eval $compile; then
11616     val="$define"
11617 fi
11618 set d_sockaddr_in6; eval $setvar
11619 $rm_try
11620
11621 echo " "
11622 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11623 $cat >try.c <<EOF
11624 #include <sys/types.h>
11625 #include <sys/socket.h>
11626 #include <netinet/in.h>
11627 int main() {
11628 struct sockaddr_in6 sin6;
11629 return (sin6.sin6_scope_id);
11630 }
11631 EOF
11632 val="$undef"
11633 set try; if eval $compile; then
11634     val="$define"
11635 fi
11636 set d_sin6_scope_id; eval $setvar
11637 $rm_try
11638
11639 echo " "
11640 echo "Checking the availability struct ip_mreq ..." >&4
11641 $cat >try.c <<EOF
11642 #include <sys/types.h>
11643 #include <sys/socket.h>
11644 #include <netinet/in.h>
11645 int main() {
11646 struct ip_mreq mreq;
11647 return (mreq.imr_multiaddr.s_addr);
11648 }
11649 EOF
11650 val="$undef"
11651 set try; if eval $compile; then
11652        val="$define"
11653 fi
11654 set d_ip_mreq; eval $setvar
11655 $rm_try
11656
11657 echo " "
11658 echo "Checking the availability struct ip_mreq_source ..." >&4
11659 $cat >try.c <<EOF
11660 #include <sys/types.h>
11661 #include <sys/socket.h>
11662 #include <netinet/in.h>
11663 int main() {
11664 struct ip_mreq_source mreq;
11665 return (mreq.imr_multiaddr.s_addr);
11666 }
11667 EOF
11668 val="$undef"
11669 set try; if eval $compile; then
11670        val="$define"
11671 fi
11672 set d_ip_mreq_source; eval $setvar
11673 $rm_try
11674
11675 echo " "
11676 echo "Checking the availability struct ipv6_mreq ..." >&4
11677 $cat >try.c <<EOF
11678 #include <sys/types.h>
11679 #include <sys/socket.h>
11680 #include <netinet/in.h>
11681 int main() {
11682 struct ipv6_mreq mreq;
11683 return (mreq.ipv6mr_interface);
11684 }
11685 EOF
11686 val="$undef"
11687 set try; if eval $compile; then
11688     val="$define"
11689 fi
11690 set d_ipv6_mreq; eval $setvar
11691 $rm_try
11692
11693 echo " "
11694 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11695 $cat >try.c <<EOF
11696 #include <sys/types.h>
11697 #include <sys/socket.h>
11698 #include <netinet/in.h>
11699 int main() {
11700 struct ipv6_mreq_source mreq;
11701 return (mreq.imr_multiaddr.s_addr);
11702 }
11703 EOF
11704 val="$undef"
11705 set try; if eval $compile; then
11706        val="$define"
11707 fi
11708 set d_ipv6_mreq_source; eval $setvar
11709 $rm_try
11710
11711 echo " "
11712 echo "Checking the availability of certain socket constants..." >&4
11713 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11714     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11715     $cat >try.c <<EOF
11716 #include <sys/types.h>
11717 #include <sys/socket.h>
11718 int main() {
11719     int i = $ENUM;
11720 }
11721 EOF
11722     val="$undef"
11723     set try; if eval $compile; then
11724         val="$define"
11725     fi
11726     set d_${enum}; eval $setvar
11727     $rm_try
11728 done
11729
11730 : see if this is a sys/uio.h system
11731 set sys/uio.h i_sysuio
11732 eval $inhdr
11733
11734 : Check for cmsghdr support
11735 echo " "
11736 echo "Checking to see if your system supports struct cmsghdr..." >&4
11737 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11738 eval $hasstruct
11739 case "$d_cmsghdr_s" in
11740 "$define")      echo "Yes, it does."   ;;
11741 *)              echo "No, it doesn't." ;;
11742 esac
11743
11744
11745 : check for const keyword
11746 echo " "
11747 echo 'Checking to see if your C compiler knows about "const"...' >&4
11748 $cat >const.c <<'EOCP'
11749 typedef struct spug { int drokk; } spug;
11750 int main()
11751 {
11752         const char *foo;
11753         const spug y = { 0 };
11754 }
11755 EOCP
11756 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11757         val="$define"
11758         echo "Yup, it does."
11759 else
11760         val="$undef"
11761         echo "Nope, it doesn't."
11762 fi
11763 set d_const
11764 eval $setvar
11765
11766 : see if copysignl exists
11767 set copysignl d_copysignl
11768 eval $inlibc
11769
11770 : see if crypt exists
11771 echo " "
11772 set crypt d_crypt
11773 eval $inlibc
11774 case "$d_crypt" in
11775 $define) cryptlib='' ;;
11776 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11777                 echo 'crypt() found.' >&4
11778                 val="$define"
11779                 cryptlib=''
11780         else
11781                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11782                 if $test -z "$cryptlib"; then
11783                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11784                 else
11785                         cryptlib=-lcrypt
11786                 fi
11787                 if $test -z "$cryptlib"; then
11788                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11789                 else
11790                         cryptlib=-lcrypt
11791                 fi
11792                 if $test -z "$cryptlib"; then
11793                         cryptlib=`./loc libcrypt$_a "" $libpth`
11794                 else
11795                         cryptlib=-lcrypt
11796                 fi
11797                 if $test -z "$cryptlib"; then
11798                         echo 'crypt() NOT found.' >&4
11799                         val="$undef"
11800                 else
11801                         val="$define"
11802                 fi
11803         fi
11804         set d_crypt
11805         eval $setvar
11806         ;;
11807 esac
11808
11809 : see if this is a crypt.h system
11810 set crypt.h i_crypt
11811 eval $inhdr
11812
11813 : see if crypt_r exists
11814 set crypt_r d_crypt_r
11815 eval $inlibc
11816 case "$d_crypt_r" in
11817 "$define")
11818         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11819         case "$d_crypt_r_proto:$usethreads" in
11820         ":define")      d_crypt_r_proto=define
11821                 set d_crypt_r_proto crypt_r $hdrs
11822                 eval $hasproto ;;
11823         *)      ;;
11824         esac
11825         case "$d_crypt_r_proto" in
11826         define)
11827         case "$crypt_r_proto" in
11828         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11829         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11830         esac
11831         case "$crypt_r_proto" in
11832         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11833         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11834         esac
11835         case "$crypt_r_proto" in
11836         ''|0)   d_crypt_r=undef
11837                 crypt_r_proto=0
11838                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11839         * )     case "$crypt_r_proto" in
11840                 REENTRANT_PROTO*) ;;
11841                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11842                 esac
11843                 echo "Prototype: $try" ;;
11844         esac
11845         ;;
11846         *)      case "$usethreads" in
11847                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11848                 esac
11849                 d_crypt_r=undef
11850                 crypt_r_proto=0
11851                 ;;
11852         esac
11853         ;;
11854 *)      crypt_r_proto=0
11855         ;;
11856 esac
11857
11858 : get csh whereabouts
11859 case "$csh" in
11860 'csh') val="$undef" ;;
11861 *) val="$define" ;;
11862 esac
11863 set d_csh
11864 eval $setvar
11865 : Respect a hint or command line value for full_csh.
11866 case "$full_csh" in
11867 '') full_csh=$csh ;;
11868 esac
11869
11870 : see if ctermid exists
11871 set ctermid d_ctermid
11872 eval $inlibc
11873
11874 : see if ctermid_r exists
11875 set ctermid_r d_ctermid_r
11876 eval $inlibc
11877 case "$d_ctermid_r" in
11878 "$define")
11879         hdrs="$i_systypes sys/types.h define stdio.h "
11880         case "$d_ctermid_r_proto:$usethreads" in
11881         ":define")      d_ctermid_r_proto=define
11882                 set d_ctermid_r_proto ctermid_r $hdrs
11883                 eval $hasproto ;;
11884         *)      ;;
11885         esac
11886         case "$d_ctermid_r_proto" in
11887         define)
11888         case "$ctermid_r_proto" in
11889         ''|0) try='char* ctermid_r(char*);'
11890         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11891         esac
11892         case "$ctermid_r_proto" in
11893         ''|0)   d_ctermid_r=undef
11894                 ctermid_r_proto=0
11895                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11896         * )     case "$ctermid_r_proto" in
11897                 REENTRANT_PROTO*) ;;
11898                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11899                 esac
11900                 echo "Prototype: $try" ;;
11901         esac
11902         ;;
11903         *)      case "$usethreads" in
11904                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11905                 esac
11906                 d_ctermid_r=undef
11907                 ctermid_r_proto=0
11908                 ;;
11909         esac
11910         ;;
11911 *)      ctermid_r_proto=0
11912         ;;
11913 esac
11914
11915 : see if ctime_r exists
11916 set ctime_r d_ctime_r
11917 eval $inlibc
11918 case "$d_ctime_r" in
11919 "$define")
11920         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11921         case "$d_ctime_r_proto:$usethreads" in
11922         ":define")      d_ctime_r_proto=define
11923                 set d_ctime_r_proto ctime_r $hdrs
11924                 eval $hasproto ;;
11925         *)      ;;
11926         esac
11927         case "$d_ctime_r_proto" in
11928         define)
11929         case "$ctime_r_proto" in
11930         ''|0) try='char* ctime_r(const time_t*, char*);'
11931         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11932         esac
11933         case "$ctime_r_proto" in
11934         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11935         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11936         esac
11937         case "$ctime_r_proto" in
11938         ''|0) try='int ctime_r(const time_t*, char*);'
11939         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11940         esac
11941         case "$ctime_r_proto" in
11942         ''|0) try='int ctime_r(const time_t*, char*, int);'
11943         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11944         esac
11945         case "$ctime_r_proto" in
11946         ''|0)   d_ctime_r=undef
11947                 ctime_r_proto=0
11948                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11949         * )     case "$ctime_r_proto" in
11950                 REENTRANT_PROTO*) ;;
11951                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11952                 esac
11953                 echo "Prototype: $try" ;;
11954         esac
11955         ;;
11956         *)      case "$usethreads" in
11957                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11958                 esac
11959                 d_ctime_r=undef
11960                 ctime_r_proto=0
11961                 ;;
11962         esac
11963         ;;
11964 *)      ctime_r_proto=0
11965         ;;
11966 esac
11967
11968 : see if cuserid exists
11969 set cuserid d_cuserid
11970 eval $inlibc
11971
11972 : see if this is a limits.h system
11973 set limits.h i_limits
11974 eval $inhdr
11975
11976 : see if this is a float.h system
11977 set float.h i_float
11978 eval $inhdr
11979
11980 : See if number of significant digits in a double precision number is known
11981 echo " "
11982 $cat >dbl_dig.c <<EOM
11983 #$i_limits I_LIMITS
11984 #$i_float I_FLOAT
11985 #ifdef I_LIMITS
11986 #include <limits.h>
11987 #endif
11988 #ifdef I_FLOAT
11989 #include <float.h>
11990 #endif
11991 #ifdef DBL_DIG
11992 printf("Contains DBL_DIG");
11993 #endif
11994 EOM
11995 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11996 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11997         echo "DBL_DIG found." >&4
11998         val="$define"
11999 else
12000         echo "DBL_DIG NOT found." >&4
12001         val="$undef"
12002 fi
12003 $rm -f dbl_dig.?
12004 set d_dbl_dig
12005 eval $setvar
12006
12007 : see if dbm.h is available
12008 : see if dbmclose exists
12009 set dbmclose d_dbmclose
12010 eval $inlibc
12011
12012 case "$d_dbmclose" in
12013 $define)
12014         set dbm.h i_dbm
12015         eval $inhdr
12016         case "$i_dbm" in
12017         $define)
12018                 val="$undef"
12019                 set i_rpcsvcdbm
12020                 eval $setvar
12021                 ;;
12022         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12023                 eval $inhdr
12024                 ;;
12025         esac
12026         ;;
12027 *)      echo "We won't be including <dbm.h>"
12028         val="$undef"
12029         set i_dbm
12030         eval $setvar
12031         val="$undef"
12032         set i_rpcsvcdbm
12033         eval $setvar
12034         ;;
12035 esac
12036
12037 : see if prototype for dbminit is available
12038 echo " "
12039 set d_dbminitproto dbminit $i_dbm dbm.h
12040 eval $hasproto
12041
12042 : see if difftime exists
12043 set difftime d_difftime
12044 eval $inlibc
12045
12046 : see if this is a dirent system
12047 echo " "
12048 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12049         val="$define"
12050         echo "<dirent.h> found." >&4
12051 else
12052         val="$undef"
12053         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12054                 echo "<sys/dir.h> found." >&4
12055                 echo " "
12056         else
12057                 xinc=`./findhdr sys/ndir.h`
12058         fi
12059         echo "<dirent.h> NOT found." >&4
12060 fi
12061 set i_dirent
12062 eval $setvar
12063
12064 : Look for type of directory structure.
12065 echo " "
12066 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12067
12068 case "$direntrytype" in
12069 ''|' ')
12070         case "$i_dirent" in
12071         $define) guess1='struct dirent' ;;
12072         *) guess1='struct direct'  ;;
12073         esac
12074         ;;
12075 *)      guess1="$direntrytype"
12076         ;;
12077 esac
12078
12079 case "$guess1" in
12080 'struct dirent') guess2='struct direct' ;;
12081 *) guess2='struct dirent' ;;
12082 esac
12083
12084 if $contains "$guess1" try.c >/dev/null 2>&1; then
12085         direntrytype="$guess1"
12086         echo "Your directory entries are $direntrytype." >&4
12087 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12088         direntrytype="$guess2"
12089         echo "Your directory entries seem to be $direntrytype." >&4
12090 else
12091         echo "I don't recognize your system's directory entries." >&4
12092         rp="What type is used for directory entries on this system?"
12093         dflt="$guess1"
12094         . ./myread
12095         direntrytype="$ans"
12096 fi
12097 $rm_try
12098
12099 : see if the directory entry stores field length
12100 echo " "
12101 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12102 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12103         echo "Good, your directory entry keeps length information in d_namlen." >&4
12104         val="$define"
12105 else
12106         echo "Your directory entry does not know about the d_namlen field." >&4
12107         val="$undef"
12108 fi
12109 set d_dirnamlen
12110 eval $setvar
12111 $rm_try
12112
12113 : Look for DIR.dd_fd
12114 case "$i_dirent" in
12115 "$define")
12116     echo "Checking to see if DIR has a dd_fd member variable" >&4
12117     $cat >try.c <<EOCP
12118 #$i_stdlib I_STDLIB
12119 #ifdef I_STDLIB
12120 #include <stdlib.h>
12121 #endif
12122 #include <dirent.h>
12123
12124 int main() {
12125     DIR dir;
12126     dir.dd_fd = 1;
12127     return 0;
12128 }
12129 EOCP
12130     val=$undef
12131     set try
12132     if eval $compile; then
12133         echo "Yes, it does."
12134         val="$define"
12135     else
12136         echo "No, it does not."
12137         val="$undef"
12138     fi
12139     ;;
12140 *)
12141     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12142     val="$undef"
12143     ;;
12144 esac
12145 set d_dir_dd_fd
12146 eval $setvar
12147 $rm_try
12148
12149 : see if this is an sysdir system
12150 set sys/dir.h i_sysdir
12151 eval $inhdr
12152
12153 : see if this is an sysndir system
12154 set sys/ndir.h i_sysndir
12155 eval $inhdr
12156
12157 : Look for dirfd
12158 echo " "
12159 $cat >dirfd.c <<EOM
12160 #include <stdio.h>
12161 #$i_stdlib I_STDLIB
12162 #ifdef I_STDLIB
12163 #include <stdlib.h>
12164 #endif
12165 #$i_dirent I_DIRENT             /**/
12166 #$i_sysdir I_SYS_DIR            /**/
12167 #$i_sysndir I_SYS_NDIR          /**/
12168 #$i_systypes I_SYS_TYPES        /**/
12169 #if defined(I_SYS_TYPES)
12170 #include <sys/types.h>
12171 #endif
12172 #if defined(I_DIRENT)
12173 #include <dirent.h>
12174 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
12175 #include <sys/dir.h>
12176 #endif
12177 #else
12178 #ifdef I_SYS_NDIR
12179 #include <sys/ndir.h>
12180 #else
12181 #ifdef I_SYS_DIR
12182 #ifdef hp9000s500
12183 #include <ndir.h>       /* may be wrong in the future */
12184 #else
12185 #include <sys/dir.h>
12186 #endif
12187 #endif
12188 #endif
12189 #endif
12190 int main() {
12191         DIR *dirp = opendir(".");
12192         if (dirfd(dirp) >= 0)
12193                 exit(0);
12194         else
12195                 exit(1);
12196 }
12197 EOM
12198 val=$undef
12199 set dirfd
12200 if eval $compile; then
12201         val="$define"
12202 fi
12203 case "$val" in
12204 $define)        echo "dirfd() found." >&4       ;;
12205 *)              echo "dirfd() NOT found." >&4   ;;
12206 esac
12207 set d_dirfd
12208 eval $setvar
12209 $rm -f dirfd*
12210
12211 : see if dlerror exists
12212 xxx_runnm="$runnm"
12213 runnm=false
12214 set dlerror d_dlerror
12215 eval $inlibc
12216 runnm="$xxx_runnm"
12217
12218 : see if dlfcn is available
12219 set dlfcn.h i_dlfcn
12220 eval $inhdr
12221
12222 : Check what extension to use for shared libs
12223 case "$usedl" in
12224 $define|y|true)
12225         $cat << EOM
12226
12227 On a few systems, the dynamically loaded modules that perl generates and uses
12228 will need a different extension than shared libs. The default will probably
12229 be appropriate.
12230
12231 EOM
12232         case "$dlext" in
12233         '')     dflt="$so" ;;
12234         *)      dflt="$dlext" ;;
12235         esac
12236         rp='What is the extension of dynamically loaded modules'
12237         . ./myread
12238         dlext="$ans"
12239         ;;
12240 *)
12241         dlext="none"
12242         ;;
12243 esac
12244
12245 : Check if dlsym need a leading underscore
12246 echo " "
12247 val="$undef"
12248
12249 case "$dlsrc" in
12250 dl_dlopen.xs)
12251         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12252         $cat >dyna.c <<'EOM'
12253 fred () { }
12254 EOM
12255
12256 $cat >fred.c<<EOM
12257
12258 #include <stdio.h>
12259 #$i_stdlib I_STDLIB
12260 #ifdef I_STDLIB
12261 #include <stdlib.h>
12262 #endif
12263 #$i_dlfcn I_DLFCN
12264 #ifdef I_DLFCN
12265 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12266 #else
12267 #include <sys/types.h>
12268 #include <nlist.h>
12269 #include <link.h>
12270 #endif
12271
12272 extern int fred() ;
12273
12274 int main()
12275 {
12276     void * handle ;
12277     void * symbol ;
12278 #ifndef RTLD_LAZY
12279     int mode = 1 ;
12280 #else
12281     int mode = RTLD_LAZY ;
12282 #endif
12283     handle = dlopen("./dyna.$dlext", mode) ;
12284     if (handle == NULL) {
12285         printf ("1\n") ;
12286         fflush (stdout) ;
12287         exit(0);
12288     }
12289     symbol = dlsym(handle, "fred") ;
12290     if (symbol == NULL) {
12291         /* try putting a leading underscore */
12292         symbol = dlsym(handle, "_fred") ;
12293         if (symbol == NULL) {
12294             printf ("2\n") ;
12295             fflush (stdout) ;
12296             exit(0);
12297         }
12298         printf ("3\n") ;
12299     }
12300     else
12301         printf ("4\n") ;
12302     fflush (stdout) ;
12303     exit(0);
12304 }
12305 EOM
12306         : Call the object file tmp-dyna.o in case dlext=o.
12307         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12308                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12309                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12310                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12311                 xxx=`$run ./fred`
12312                 case $xxx in
12313                 1)      echo "Test program failed using dlopen." >&4
12314                         echo "Perhaps you should not use dynamic loading." >&4;;
12315                 2)      echo "Test program failed using dlsym." >&4
12316                         echo "Perhaps you should not use dynamic loading." >&4;;
12317                 3)      echo "dlsym needs a leading underscore" >&4
12318                         val="$define" ;;
12319                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12320                 esac
12321         else
12322                 echo "I can't compile and run the test program." >&4
12323                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12324         fi
12325         ;;
12326 esac
12327
12328 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12329
12330 set d_dlsymun
12331 eval $setvar
12332
12333 : see if drand48_r exists
12334 set drand48_r d_drand48_r
12335 eval $inlibc
12336 case "$d_drand48_r" in
12337 "$define")
12338         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12339         case "$d_drand48_r_proto:$usethreads" in
12340         ":define")      d_drand48_r_proto=define
12341                 set d_drand48_r_proto drand48_r $hdrs
12342                 eval $hasproto ;;
12343         *)      ;;
12344         esac
12345         case "$d_drand48_r_proto" in
12346         define)
12347         case "$drand48_r_proto" in
12348         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12349         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12350         esac
12351         case "$drand48_r_proto" in
12352         ''|0)   d_drand48_r=undef
12353                 drand48_r_proto=0
12354                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12355         * )     case "$drand48_r_proto" in
12356                 REENTRANT_PROTO*) ;;
12357                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12358                 esac
12359                 echo "Prototype: $try" ;;
12360         esac
12361         ;;
12362         *)      case "$usethreads" in
12363                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12364                 esac
12365                 d_drand48_r=undef
12366                 drand48_r_proto=0
12367                 ;;
12368         esac
12369         ;;
12370 *)      drand48_r_proto=0
12371         ;;
12372 esac
12373
12374 : see if prototype for drand48 is available
12375 echo " "
12376 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12377 eval $hasproto
12378
12379 : see if dup2 exists
12380 set dup2 d_dup2
12381 eval $inlibc
12382
12383 : see if eaccess exists
12384 set eaccess d_eaccess
12385 eval $inlibc
12386
12387 : see if endgrent exists
12388 set endgrent d_endgrent
12389 eval $inlibc
12390
12391 : see if this is an grp system
12392 set grp.h i_grp
12393 eval $inhdr
12394
12395 case "$i_grp" in
12396 $define)
12397         xxx=`./findhdr grp.h`
12398         $cppstdin $cppflags $cppminus < $xxx >$$.h
12399
12400         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12401                 val="$define"
12402         else
12403                 val="$undef"
12404         fi
12405         set d_grpasswd
12406         eval $setvar
12407
12408         $rm -f $$.h
12409         ;;
12410 *)
12411         val="$undef";
12412         set d_grpasswd; eval $setvar
12413         ;;
12414 esac
12415
12416 : see if endgrent_r exists
12417 set endgrent_r d_endgrent_r
12418 eval $inlibc
12419 case "$d_endgrent_r" in
12420 "$define")
12421         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12422         case "$d_endgrent_r_proto:$usethreads" in
12423         ":define")      d_endgrent_r_proto=define
12424                 set d_endgrent_r_proto endgrent_r $hdrs
12425                 eval $hasproto ;;
12426         *)      ;;
12427         esac
12428         case "$d_endgrent_r_proto" in
12429         define)
12430         case "$endgrent_r_proto" in
12431         ''|0) try='int endgrent_r(FILE**);'
12432         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12433         esac
12434         case "$endgrent_r_proto" in
12435         ''|0) try='void endgrent_r(FILE**);'
12436         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12437         esac
12438         case "$endgrent_r_proto" in
12439         ''|0)   d_endgrent_r=undef
12440                 endgrent_r_proto=0
12441                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12442         * )     case "$endgrent_r_proto" in
12443                 REENTRANT_PROTO*) ;;
12444                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12445                 esac
12446                 echo "Prototype: $try" ;;
12447         esac
12448         ;;
12449         *)      case "$usethreads" in
12450                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12451                 esac
12452                 d_endgrent_r=undef
12453                 endgrent_r_proto=0
12454                 ;;
12455         esac
12456         ;;
12457 *)      endgrent_r_proto=0
12458         ;;
12459 esac
12460
12461 : see if endhostent exists
12462 set endhostent d_endhent
12463 eval $inlibc
12464
12465 : see if this is a netdb.h system
12466 set netdb.h i_netdb
12467 eval $inhdr
12468
12469 : see if endhostent_r exists
12470 set endhostent_r d_endhostent_r
12471 eval $inlibc
12472 case "$d_endhostent_r" in
12473 "$define")
12474         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12475         case "$d_endhostent_r_proto:$usethreads" in
12476         ":define")      d_endhostent_r_proto=define
12477                 set d_endhostent_r_proto endhostent_r $hdrs
12478                 eval $hasproto ;;
12479         *)      ;;
12480         esac
12481         case "$d_endhostent_r_proto" in
12482         define)
12483         case "$endhostent_r_proto" in
12484         ''|0) try='int endhostent_r(struct hostent_data*);'
12485         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12486         esac
12487         case "$endhostent_r_proto" in
12488         ''|0) try='void endhostent_r(struct hostent_data*);'
12489         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12490         esac
12491         case "$endhostent_r_proto" in
12492         ''|0)   d_endhostent_r=undef
12493                 endhostent_r_proto=0
12494                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12495         * )     case "$endhostent_r_proto" in
12496                 REENTRANT_PROTO*) ;;
12497                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12498                 esac
12499                 echo "Prototype: $try" ;;
12500         esac
12501         ;;
12502         *)      case "$usethreads" in
12503                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12504                 esac
12505                 d_endhostent_r=undef
12506                 endhostent_r_proto=0
12507                 ;;
12508         esac
12509         ;;
12510 *)      endhostent_r_proto=0
12511         ;;
12512 esac
12513
12514 : see if endnetent exists
12515 set endnetent d_endnent
12516 eval $inlibc
12517
12518 : see if endnetent_r exists
12519 set endnetent_r d_endnetent_r
12520 eval $inlibc
12521 case "$d_endnetent_r" in
12522 "$define")
12523         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12524         case "$d_endnetent_r_proto:$usethreads" in
12525         ":define")      d_endnetent_r_proto=define
12526                 set d_endnetent_r_proto endnetent_r $hdrs
12527                 eval $hasproto ;;
12528         *)      ;;
12529         esac
12530         case "$d_endnetent_r_proto" in
12531         define)
12532         case "$endnetent_r_proto" in
12533         ''|0) try='int endnetent_r(struct netent_data*);'
12534         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12535         esac
12536         case "$endnetent_r_proto" in
12537         ''|0) try='void endnetent_r(struct netent_data*);'
12538         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12539         esac
12540         case "$endnetent_r_proto" in
12541         ''|0)   d_endnetent_r=undef
12542                 endnetent_r_proto=0
12543                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12544         * )     case "$endnetent_r_proto" in
12545                 REENTRANT_PROTO*) ;;
12546                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12547                 esac
12548                 echo "Prototype: $try" ;;
12549         esac
12550         ;;
12551         *)      case "$usethreads" in
12552                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12553                 esac
12554                 d_endnetent_r=undef
12555                 endnetent_r_proto=0
12556                 ;;
12557         esac
12558         ;;
12559 *)      endnetent_r_proto=0
12560         ;;
12561 esac
12562
12563 : see if endprotoent exists
12564 set endprotoent d_endpent
12565 eval $inlibc
12566
12567 : see if endprotoent_r exists
12568 set endprotoent_r d_endprotoent_r
12569 eval $inlibc
12570 case "$d_endprotoent_r" in
12571 "$define")
12572         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12573         case "$d_endprotoent_r_proto:$usethreads" in
12574         ":define")      d_endprotoent_r_proto=define
12575                 set d_endprotoent_r_proto endprotoent_r $hdrs
12576                 eval $hasproto ;;
12577         *)      ;;
12578         esac
12579         case "$d_endprotoent_r_proto" in
12580         define)
12581         case "$endprotoent_r_proto" in
12582         ''|0) try='int endprotoent_r(struct protoent_data*);'
12583         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12584         esac
12585         case "$endprotoent_r_proto" in
12586         ''|0) try='void endprotoent_r(struct protoent_data*);'
12587         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12588         esac
12589         case "$endprotoent_r_proto" in
12590         ''|0)   d_endprotoent_r=undef
12591                 endprotoent_r_proto=0
12592                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12593         * )     case "$endprotoent_r_proto" in
12594                 REENTRANT_PROTO*) ;;
12595                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12596                 esac
12597                 echo "Prototype: $try" ;;
12598         esac
12599         ;;
12600         *)      case "$usethreads" in
12601                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12602                 esac
12603                 d_endprotoent_r=undef
12604                 endprotoent_r_proto=0
12605                 ;;
12606         esac
12607         ;;
12608 *)      endprotoent_r_proto=0
12609         ;;
12610 esac
12611
12612 : see if endpwent exists
12613 set endpwent d_endpwent
12614 eval $inlibc
12615
12616 : see if this is a pwd.h system
12617 set pwd.h i_pwd
12618 eval $inhdr
12619
12620 case "$i_pwd" in
12621 $define)
12622         xxx=`./findhdr pwd.h`
12623         $cppstdin $cppflags $cppminus < $xxx >$$.h
12624
12625         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12626                 val="$define"
12627         else
12628                 val="$undef"
12629         fi
12630         set d_pwquota
12631         eval $setvar
12632
12633         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12634                 val="$define"
12635         else
12636                 val="$undef"
12637         fi
12638         set d_pwage
12639         eval $setvar
12640
12641         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12642                 val="$define"
12643         else
12644                 val="$undef"
12645         fi
12646         set d_pwchange
12647         eval $setvar
12648
12649         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12650                 val="$define"
12651         else
12652                 val="$undef"
12653         fi
12654         set d_pwclass
12655         eval $setvar
12656
12657         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12658                 val="$define"
12659         else
12660                 val="$undef"
12661         fi
12662         set d_pwexpire
12663         eval $setvar
12664
12665         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12666                 val="$define"
12667         else
12668                 val="$undef"
12669         fi
12670         set d_pwcomment
12671         eval $setvar
12672
12673         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12674                 val="$define"
12675         else
12676                 val="$undef"
12677         fi
12678         set d_pwgecos
12679         eval $setvar
12680
12681         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12682                 val="$define"
12683         else
12684                 val="$undef"
12685         fi
12686         set d_pwpasswd
12687         eval $setvar
12688
12689         $rm -f $$.h
12690         ;;
12691 *)
12692         val="$undef";
12693         set d_pwquota; eval $setvar
12694         set d_pwage; eval $setvar
12695         set d_pwchange; eval $setvar
12696         set d_pwclass; eval $setvar
12697         set d_pwexpire; eval $setvar
12698         set d_pwcomment; eval $setvar
12699         set d_pwgecos; eval $setvar
12700         set d_pwpasswd; eval $setvar
12701         ;;
12702 esac
12703
12704 : see if endpwent_r exists
12705 set endpwent_r d_endpwent_r
12706 eval $inlibc
12707 case "$d_endpwent_r" in
12708 "$define")
12709         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12710         case "$d_endpwent_r_proto:$usethreads" in
12711         ":define")      d_endpwent_r_proto=define
12712                 set d_endpwent_r_proto endpwent_r $hdrs
12713                 eval $hasproto ;;
12714         *)      ;;
12715         esac
12716         case "$d_endpwent_r_proto" in
12717         define)
12718         case "$endpwent_r_proto" in
12719         ''|0) try='int endpwent_r(FILE**);'
12720         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12721         esac
12722         case "$endpwent_r_proto" in
12723         ''|0) try='void endpwent_r(FILE**);'
12724         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12725         esac
12726         case "$endpwent_r_proto" in
12727         ''|0)   d_endpwent_r=undef
12728                 endpwent_r_proto=0
12729                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12730         * )     case "$endpwent_r_proto" in
12731                 REENTRANT_PROTO*) ;;
12732                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12733                 esac
12734                 echo "Prototype: $try" ;;
12735         esac
12736         ;;
12737         *)      case "$usethreads" in
12738                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12739                 esac
12740                 d_endpwent_r=undef
12741                 endpwent_r_proto=0
12742                 ;;
12743         esac
12744         ;;
12745 *)      endpwent_r_proto=0
12746         ;;
12747 esac
12748
12749 : see if endservent exists
12750 set endservent d_endsent
12751 eval $inlibc
12752
12753 : see if endservent_r exists
12754 set endservent_r d_endservent_r
12755 eval $inlibc
12756 case "$d_endservent_r" in
12757 "$define")
12758         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12759         case "$d_endservent_r_proto:$usethreads" in
12760         ":define")      d_endservent_r_proto=define
12761                 set d_endservent_r_proto endservent_r $hdrs
12762                 eval $hasproto ;;
12763         *)      ;;
12764         esac
12765         case "$d_endservent_r_proto" in
12766         define)
12767         case "$endservent_r_proto" in
12768         ''|0) try='int endservent_r(struct servent_data*);'
12769         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12770         esac
12771         case "$endservent_r_proto" in
12772         ''|0) try='void endservent_r(struct servent_data*);'
12773         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12774         esac
12775         case "$endservent_r_proto" in
12776         ''|0)   d_endservent_r=undef
12777                 endservent_r_proto=0
12778                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12779         * )     case "$endservent_r_proto" in
12780                 REENTRANT_PROTO*) ;;
12781                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12782                 esac
12783                 echo "Prototype: $try" ;;
12784         esac
12785         ;;
12786         *)      case "$usethreads" in
12787                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12788                 esac
12789                 d_endservent_r=undef
12790                 endservent_r_proto=0
12791                 ;;
12792         esac
12793         ;;
12794 *)      endservent_r_proto=0
12795         ;;
12796 esac
12797
12798 : Locate the flags for 'open()'
12799 echo " "
12800 $cat >try.c <<EOCP
12801 #include <sys/types.h>
12802 #ifdef I_FCNTL
12803 #include <fcntl.h>
12804 #endif
12805 #ifdef I_SYS_FILE
12806 #include <sys/file.h>
12807 #endif
12808 #$i_stdlib I_STDLIB
12809 #ifdef I_STDLIB
12810 #include <stdlib.h>
12811 #endif
12812 int main() {
12813         if(O_RDONLY);
12814 #ifdef O_TRUNC
12815         exit(0);
12816 #else
12817         exit(1);
12818 #endif
12819 }
12820 EOCP
12821 : check sys/file.h first to get FREAD on Sun
12822 if $test `./findhdr sys/file.h` && \
12823                 set try -DI_SYS_FILE && eval $compile; then
12824         h_sysfile=true;
12825         echo "<sys/file.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 elif $test `./findhdr fcntl.h` && \
12834                 set try -DI_FCNTL && eval $compile; then
12835         h_fcntl=true;
12836         echo "<fcntl.h> defines the O_* constants..." >&4
12837         if $run ./try; then
12838                 echo "and you have the 3 argument form of open()." >&4
12839                 val="$define"
12840         else
12841                 echo "but not the 3 argument form of open().  Oh, well." >&4
12842                 val="$undef"
12843         fi
12844 else
12845         val="$undef"
12846         echo "I can't find the O_* constant definitions!  You got problems." >&4
12847 fi
12848 set d_open3
12849 eval $setvar
12850 $rm_try
12851
12852 : see if this is a sys/file.h system
12853 val=''
12854 set sys/file.h val
12855 eval $inhdr
12856
12857 : do we need to include sys/file.h ?
12858 case "$val" in
12859 "$define")
12860         echo " "
12861         if $h_sysfile; then
12862                 val="$define"
12863                 echo "We'll be including <sys/file.h>." >&4
12864         else
12865                 val="$undef"
12866                 echo "We won't be including <sys/file.h>." >&4
12867         fi
12868         ;;
12869 *)
12870         h_sysfile=false
12871         ;;
12872 esac
12873 set i_sysfile
12874 eval $setvar
12875
12876 : see if fcntl.h is there
12877 val=''
12878 set fcntl.h val
12879 eval $inhdr
12880
12881 : see if we can include fcntl.h
12882 case "$val" in
12883 "$define")
12884         echo " "
12885         if $h_fcntl; then
12886                 val="$define"
12887                 echo "We'll be including <fcntl.h>." >&4
12888         else
12889                 val="$undef"
12890                 if $h_sysfile; then
12891         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12892                 else
12893                         echo "We won't be including <fcntl.h>." >&4
12894                 fi
12895         fi
12896         ;;
12897 *)
12898         h_fcntl=false
12899         val="$undef"
12900         ;;
12901 esac
12902 set i_fcntl
12903 eval $setvar
12904
12905 : see if fork exists
12906 set fork d_fork
12907 eval $inlibc
12908
12909 : see if pipe exists
12910 set pipe d_pipe
12911 eval $inlibc
12912
12913 : check for non-blocking I/O stuff
12914 case "$h_sysfile" in
12915 true) echo "#include <sys/file.h>" > head.c;;
12916 *)
12917        case "$h_fcntl" in
12918        true) echo "#include <fcntl.h>" > head.c;;
12919        *) echo "#include <sys/fcntl.h>" > head.c;;
12920        esac
12921        ;;
12922 esac
12923 echo " "
12924 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12925 case "$o_nonblock" in
12926 '')
12927         $cat head.c > try.c
12928         $cat >>try.c <<EOCP
12929 #include <stdio.h>
12930 #$i_stdlib I_STDLIB
12931 #ifdef I_STDLIB
12932 #include <stdlib.h>
12933 #endif
12934 #$i_fcntl I_FCNTL
12935 #ifdef I_FCNTL
12936 #include <fcntl.h>
12937 #endif
12938 int main() {
12939 #ifdef O_NONBLOCK
12940         printf("O_NONBLOCK\n");
12941         exit(0);
12942 #endif
12943 #ifdef O_NDELAY
12944         printf("O_NDELAY\n");
12945         exit(0);
12946 #endif
12947 #ifdef FNDELAY
12948         printf("FNDELAY\n");
12949         exit(0);
12950 #endif
12951         exit(0);
12952 }
12953 EOCP
12954         set try
12955         if eval $compile_ok; then
12956                 o_nonblock=`$run ./try`
12957                 case "$o_nonblock" in
12958                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12959                 *) echo "Seems like we can use $o_nonblock.";;
12960                 esac
12961         else
12962                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12963         fi
12964         ;;
12965 *) echo "Using $hint value $o_nonblock.";;
12966 esac
12967 $rm_try
12968
12969 echo " "
12970 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12971 case "$eagain" in
12972 '')
12973         case "$d_fork:$d_pipe" in
12974         define:define)
12975         $cat head.c > try.c
12976         $cat >>try.c <<EOCP
12977 #include <errno.h>
12978 #include <sys/types.h>
12979 #include <signal.h>
12980 #include <stdio.h>
12981 #$i_stdlib I_STDLIB
12982 #ifdef I_STDLIB
12983 #include <stdlib.h>
12984 #endif
12985 #$i_fcntl I_FCNTL
12986 #ifdef I_FCNTL
12987 #include <fcntl.h>
12988 #endif
12989 #define MY_O_NONBLOCK $o_nonblock
12990 #ifndef errno  /* XXX need better Configure test */
12991 extern int errno;
12992 #endif
12993 #$i_unistd I_UNISTD
12994 #ifdef I_UNISTD
12995 #include <unistd.h>
12996 #endif
12997 #$i_string I_STRING
12998 #ifdef I_STRING
12999 #include <string.h>
13000 #else
13001 #include <strings.h>
13002 #endif
13003 $signal_t blech(int x) { exit(3); }
13004 EOCP
13005         $cat >> try.c <<'EOCP'
13006 int main()
13007 {
13008         int pd[2];
13009         int pu[2];
13010         char buf[1];
13011         char string[100];
13012
13013         pipe(pd);       /* Down: child -> parent */
13014         pipe(pu);       /* Up: parent -> child */
13015         if (0 != fork()) {
13016                 int ret;
13017                 close(pd[1]);   /* Parent reads from pd[0] */
13018                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13019 #ifdef F_SETFL
13020                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13021                         exit(1);
13022 #else
13023                 exit(4);
13024 #endif
13025                 signal(SIGALRM, blech);
13026                 alarm(5);
13027                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13028                         exit(2);
13029                 sprintf(string, "%d\n", ret);
13030                 write(2, string, strlen(string));
13031                 alarm(0);
13032 #ifdef EAGAIN
13033                 if (errno == EAGAIN) {
13034                         printf("EAGAIN\n");
13035                         goto ok;
13036                 }
13037 #endif
13038 #ifdef EWOULDBLOCK
13039                 if (errno == EWOULDBLOCK)
13040                         printf("EWOULDBLOCK\n");
13041 #endif
13042         ok:
13043                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
13044                 sleep(2);                               /* Give it time to close our pipe */
13045                 alarm(5);
13046                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13047                 alarm(0);
13048                 sprintf(string, "%d\n", ret);
13049                 write(4, string, strlen(string));
13050                 exit(0);
13051         }
13052
13053         close(pd[0]);                   /* We write to pd[1] */
13054         close(pu[1]);                   /* We read from pu[0] */
13055         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
13056         close(pd[1]);                   /* Pipe pd is now fully closed! */
13057         exit(0);                                /* Bye bye, thank you for playing! */
13058 }
13059 EOCP
13060         set try
13061         if eval $compile_ok; then
13062                 echo "$startsh" >mtry
13063                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13064                 chmod +x mtry
13065                 $run ./mtry >/dev/null 2>&1
13066                 case $? in
13067                 0) eagain=`$cat try.out`;;
13068                 1) echo "Could not perform non-blocking setting!";;
13069                 2) echo "I did a successful read() for something that was not there!";;
13070                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13071                 4) echo "Could not find F_SETFL!";;
13072                 *) echo "Something terribly wrong happened during testing.";;
13073                 esac
13074                 rd_nodata=`$cat try.ret`
13075                 echo "A read() system call with no data present returns $rd_nodata."
13076                 case "$rd_nodata" in
13077                 0|-1) ;;
13078                 *)
13079                         echo "(That's peculiar, fixing that to be -1.)"
13080                         rd_nodata=-1
13081                         ;;
13082                 esac
13083                 case "$eagain" in
13084                 '')
13085                         echo "Forcing errno EAGAIN on read() with no data available."
13086                         eagain=EAGAIN
13087                         ;;
13088                 *)
13089                         echo "Your read() sets errno to $eagain when no data is available."
13090                         ;;
13091                 esac
13092                 status=`$cat try.err`
13093                 case "$status" in
13094                 0) echo "And it correctly returns 0 to signal EOF.";;
13095                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13096                 *) echo "However, your read() returns '$status' on EOF??";;
13097                 esac
13098                 val="$define"
13099                 if test "$status" = "$rd_nodata"; then
13100                         echo "WARNING: you can't distinguish between EOF and no data!"
13101                         val="$undef"
13102                 fi
13103         else
13104                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13105                 eagain=EAGAIN
13106         fi
13107         ;;
13108         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13109                 eagain=EAGAIN
13110                 val="$define"
13111                 ;;
13112         esac
13113         set d_eofnblk
13114         eval $setvar
13115         ;;
13116 *)
13117         echo "Using $hint value $eagain."
13118         echo "Your read() returns $rd_nodata when no data is present."
13119         case "$d_eofnblk" in
13120         "$define") echo "And you can see EOF because read() returns 0.";;
13121         "$undef") echo "But you can't see EOF status from read() returned value.";;
13122         *)
13123                 echo "(Assuming you can't see EOF status from read anyway.)"
13124                 d_eofnblk=$undef
13125                 ;;
13126         esac
13127         ;;
13128 esac
13129 $rm_try head.c mtry
13130
13131 : see if _ptr and _cnt from stdio act std
13132 echo " "
13133
13134 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13135         echo "(Looks like you have stdio.h from BSD.)"
13136         case "$stdio_ptr" in
13137         '') stdio_ptr='((fp)->_p)'
13138                 ptr_lval=$define
13139                 ;;
13140         *)      ptr_lval=$d_stdio_ptr_lval;;
13141         esac
13142         case "$stdio_cnt" in
13143         '') stdio_cnt='((fp)->_r)'
13144                 cnt_lval=$define
13145                 ;;
13146         *)      cnt_lval=$d_stdio_cnt_lval;;
13147         esac
13148         case "$stdio_base" in
13149         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13150         esac
13151         case "$stdio_bufsiz" in
13152         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13153         esac
13154 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13155         echo "(Looks like you have stdio.h from Linux.)"
13156         case "$stdio_ptr" in
13157         '') stdio_ptr='((fp)->_IO_read_ptr)'
13158                 ptr_lval=$define
13159                 ;;
13160         *)      ptr_lval=$d_stdio_ptr_lval;;
13161         esac
13162         case "$stdio_cnt" in
13163         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13164                 cnt_lval=$undef
13165                 ;;
13166         *)      cnt_lval=$d_stdio_cnt_lval;;
13167         esac
13168         case "$stdio_base" in
13169         '') stdio_base='((fp)->_IO_read_base)';;
13170         esac
13171         case "$stdio_bufsiz" in
13172         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13173         esac
13174 else
13175         case "$stdio_ptr" in
13176         '') stdio_ptr='((fp)->_ptr)'
13177                 ptr_lval=$define
13178                 ;;
13179         *)      ptr_lval=$d_stdio_ptr_lval;;
13180         esac
13181         case "$stdio_cnt" in
13182         '') stdio_cnt='((fp)->_cnt)'
13183                 cnt_lval=$define
13184                 ;;
13185         *)      cnt_lval=$d_stdio_cnt_lval;;
13186         esac
13187         case "$stdio_base" in
13188         '') stdio_base='((fp)->_base)';;
13189         esac
13190         case "$stdio_bufsiz" in
13191         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13192         esac
13193 fi
13194
13195 : test whether _ptr and _cnt really work
13196 echo "Checking how std your stdio is..." >&4
13197 $cat >try.c <<EOP
13198 #include <stdio.h>
13199 #$i_stdlib I_STDLIB
13200 #ifdef I_STDLIB
13201 #include <stdlib.h>
13202 #endif
13203 #define FILE_ptr(fp)    $stdio_ptr
13204 #define FILE_cnt(fp)    $stdio_cnt
13205 int main() {
13206         FILE *fp = fopen("try.c", "r");
13207         char c = getc(fp);
13208         if (
13209                 18 <= FILE_cnt(fp) &&
13210                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13211         )
13212                 exit(0);
13213         exit(1);
13214 }
13215 EOP
13216 val="$undef"
13217 set try
13218 if eval $compile && $to try.c; then
13219         if $run ./try; then
13220                 echo "Your stdio acts pretty std."
13221                 val="$define"
13222         else
13223                 echo "Your stdio isn't very std."
13224         fi
13225 else
13226         echo "Your stdio doesn't appear very std."
13227 fi
13228 $rm_try
13229
13230 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13231 # direct buffer manipulation no longer works.  The Configure tests
13232 # should be changed to correctly detect this, but until then,
13233 # the following check should at least let perl compile and run.
13234 # (This quick fix should be updated before 5.8.1.)
13235 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13236 # A. Dougherty, June 3, 2002.
13237 case "$d_gnulibc" in
13238 $define)
13239         case "$gnulibc_version" in
13240         2.[01]*)  ;;
13241         2.2) ;;
13242         2.2.[0-9]) ;;
13243         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13244                 val="$undef"
13245                 ;;
13246         esac
13247         ;;
13248 esac
13249 set d_stdstdio
13250 eval $setvar
13251
13252 : Can _ptr be used as an lvalue?
13253 case "$d_stdstdio$ptr_lval" in
13254 $define$define) val=$define ;;
13255 *) val=$undef ;;
13256 esac
13257 set d_stdio_ptr_lval
13258 eval $setvar
13259
13260 : Can _cnt be used as an lvalue?
13261 case "$d_stdstdio$cnt_lval" in
13262 $define$define) val=$define ;;
13263 *) val=$undef ;;
13264 esac
13265 set d_stdio_cnt_lval
13266 eval $setvar
13267
13268
13269 : test whether setting _ptr sets _cnt as a side effect
13270 d_stdio_ptr_lval_sets_cnt="$undef"
13271 d_stdio_ptr_lval_nochange_cnt="$undef"
13272 case "$d_stdio_ptr_lval$d_stdstdio" in
13273 $define$define)
13274         echo "Checking to see what happens if we set the stdio ptr..." >&4
13275 $cat >try.c <<EOP
13276 #include <stdio.h>
13277 /* Can we scream? */
13278 /* Eat dust sed :-) */
13279 /* In the buffer space, no one can hear you scream. */
13280 #$i_stdlib I_STDLIB
13281 #ifdef I_STDLIB
13282 #include <stdlib.h>
13283 #endif
13284 #define FILE_ptr(fp)    $stdio_ptr
13285 #define FILE_cnt(fp)    $stdio_cnt
13286 #include <sys/types.h>
13287 int main() {
13288         FILE *fp = fopen("try.c", "r");
13289         int c;
13290         char *ptr;
13291         size_t cnt;
13292         if (!fp) {
13293             puts("Fail even to read");
13294             exit(1);
13295         }
13296         c = getc(fp); /* Read away the first # */
13297         if (c == EOF) {
13298             puts("Fail even to read");
13299             exit(1);
13300         }
13301         if (!(
13302                 18 <= FILE_cnt(fp) &&
13303                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13304         )) {
13305                 puts("Fail even to read");
13306                 exit (1);
13307         }
13308         ptr = (char*) FILE_ptr(fp);
13309         cnt = (size_t)FILE_cnt(fp);
13310
13311         FILE_ptr(fp) += 42;
13312
13313         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13314                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13315                 exit (1);
13316         }
13317         if (FILE_cnt(fp) <= 20) {
13318                 printf ("Fail (<20 chars to test)");
13319                 exit (1);
13320         }
13321         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13322                 puts("Fail compare");
13323                 exit (1);
13324         }
13325         if (cnt == FILE_cnt(fp)) {
13326                 puts("Pass_unchanged");
13327                 exit (0);
13328         }
13329         if (FILE_cnt(fp) == (cnt - 42)) {
13330                 puts("Pass_changed");
13331                 exit (0);
13332         }
13333         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13334         return 1;
13335
13336 }
13337 EOP
13338         set try
13339         if eval $compile && $to try.c; then
13340                 case `$run ./try` in
13341                 Pass_changed)
13342                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13343                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13344                 Pass_unchanged)
13345                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13346                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13347                 Fail*)
13348                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13349                 *)
13350                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13351         esac
13352         else
13353                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13354         fi
13355         $rm_try
13356         ;;
13357 esac
13358
13359 : see if _base is also standard
13360 val="$undef"
13361 case "$d_stdstdio" in
13362 $define)
13363         $cat >try.c <<EOP
13364 #include <stdio.h>
13365 #$i_stdlib I_STDLIB
13366 #ifdef I_STDLIB
13367 #include <stdlib.h>
13368 #endif
13369 #define FILE_base(fp)   $stdio_base
13370 #define FILE_bufsiz(fp) $stdio_bufsiz
13371 int main() {
13372         FILE *fp = fopen("try.c", "r");
13373         char c = getc(fp);
13374         if (
13375                 19 <= FILE_bufsiz(fp) &&
13376                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13377         )
13378                 exit(0);
13379         exit(1);
13380 }
13381 EOP
13382         set try
13383         if eval $compile && $to try.c; then
13384                 if $run ./try; then
13385                         echo "And its _base field acts std."
13386                         val="$define"
13387                 else
13388                         echo "But its _base field isn't std."
13389                 fi
13390         else
13391                 echo "However, it seems to be lacking the _base field."
13392         fi
13393         $rm_try
13394         ;;
13395 esac
13396 set d_stdiobase
13397 eval $setvar
13398
13399 : see if fast_stdio exists
13400 val="$undef"
13401 case "$d_stdstdio:$d_stdio_ptr_lval" in
13402 "$define:$define")
13403         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13404         *$define*)
13405                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13406                 val="$define"
13407                 ;;
13408         esac
13409         ;;
13410 esac
13411 set d_faststdio
13412 eval $setvar
13413
13414
13415
13416 : see if fchdir exists
13417 set fchdir d_fchdir
13418 eval $inlibc
13419
13420 : see if fchmod exists
13421 set fchmod d_fchmod
13422 eval $inlibc
13423
13424 : see if fchown exists
13425 set fchown d_fchown
13426 eval $inlibc
13427
13428 : see if this is an fcntl system
13429 set fcntl d_fcntl
13430 eval $inlibc
13431
13432 : See if fcntl-based locking works.
13433 echo " "
13434 $cat >try.c <<EOCP
13435 #$i_stdlib I_STDLIB
13436 #ifdef I_STDLIB
13437 #include <stdlib.h>
13438 #endif
13439 #include <unistd.h>
13440 #include <fcntl.h>
13441 #include <signal.h>
13442 $signal_t blech(int x) { exit(3); }
13443 int main() {
13444 #if defined(F_SETLK) && defined(F_SETLKW)
13445      struct flock flock;
13446      int retval, fd;
13447      fd = open("try.c", O_RDONLY);
13448      flock.l_type = F_RDLCK;
13449      flock.l_whence = SEEK_SET;
13450      flock.l_start = flock.l_len = 0;
13451      signal(SIGALRM, blech);
13452      alarm(10);
13453      retval = fcntl(fd, F_SETLK, &flock);
13454      close(fd);
13455      (retval < 0 ? exit(2) : exit(0));
13456 #else
13457      exit(2);
13458 #endif
13459 }
13460 EOCP
13461 echo "Checking if fcntl-based file locking works... "
13462 case "$d_fcntl" in
13463 "$define")
13464         set try
13465         if eval $compile_ok; then
13466                 if $run ./try; then
13467                         echo "Yes, it seems to work."
13468                         val="$define"
13469                 else
13470                         echo "Nope, it didn't work."
13471                         val="$undef"
13472                         case "$?" in
13473                         3) $cat >&4 <<EOM
13474 ***
13475 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13476 *** This is (almost) impossible.
13477 *** If your NFS lock daemons are not feeling well, something like
13478 *** this may happen, please investigate.  Cannot continue, aborting.
13479 ***
13480 EOM
13481                                 exit 1
13482                                 ;;
13483                         esac
13484                 fi
13485         else
13486                 echo "I'm unable to compile the test program, so I'll assume not."
13487                 val="$undef"
13488         fi
13489         ;;
13490 *) val="$undef";
13491         echo "Nope, since you don't even have fcntl()."
13492         ;;
13493 esac
13494 set d_fcntl_can_lock
13495 eval $setvar
13496 $rm_try
13497
13498 : check for fd_set items
13499 $cat <<EOM
13500
13501 Checking to see how well your C compiler handles fd_set and friends ...
13502 EOM
13503 $cat >try.c <<EOCP
13504 #$i_stdlib I_STDLIB
13505 #ifdef I_STDLIB
13506 #include <stdlib.h>
13507 #endif
13508 #$i_systime I_SYS_TIME
13509 #$i_sysselct I_SYS_SELECT
13510 #$d_socket HAS_SOCKET
13511 #include <sys/types.h>
13512 #ifdef HAS_SOCKET
13513 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13514 #endif
13515 #ifdef I_SYS_TIME
13516 #include <sys/time.h>
13517 #endif
13518 #ifdef I_SYS_SELECT
13519 #include <sys/select.h>
13520 #endif
13521 int main() {
13522         fd_set fds;
13523
13524 #ifdef TRYBITS
13525         if(fds.fds_bits);
13526 #endif
13527
13528 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13529         exit(0);
13530 #else
13531         exit(1);
13532 #endif
13533 }
13534 EOCP
13535 set try -DTRYBITS
13536 if eval $compile; then
13537         d_fds_bits="$define"
13538         d_fd_set="$define"
13539         echo "Well, your system knows about the normal fd_set typedef..." >&4
13540         if $run ./try; then
13541                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13542                 d_fd_macros="$define"
13543         else
13544                 $cat >&4 <<'EOM'
13545 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13546 EOM
13547                 d_fd_macros="$undef"
13548         fi
13549 else
13550         $cat <<'EOM'
13551 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13552 EOM
13553         set try
13554         if eval $compile; then
13555                 d_fds_bits="$undef"
13556                 d_fd_set="$define"
13557                 echo "Well, your system has some sort of fd_set available..." >&4
13558                 if $run ./try; then
13559                         echo "and you have the normal fd_set macros." >&4
13560                         d_fd_macros="$define"
13561                 else
13562                         $cat <<'EOM'
13563 but not the normal fd_set macros!  Gross!  More work for me...
13564 EOM
13565                         d_fd_macros="$undef"
13566                 fi
13567         else
13568         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13569                 d_fd_set="$undef"
13570                 d_fds_bits="$undef"
13571                 d_fd_macros="$undef"
13572         fi
13573 fi
13574 $rm_try
13575
13576 : see if fgetpos exists
13577 set fgetpos d_fgetpos
13578 eval $inlibc
13579
13580 : see if finite exists
13581 set finite d_finite
13582 eval $inlibc
13583
13584 : see if finitel exists
13585 set finitel d_finitel
13586 eval $inlibc
13587
13588 : see if flock exists
13589 set flock d_flock
13590 eval $inlibc
13591
13592 : see if prototype for flock is available
13593 echo " "
13594 set d_flockproto flock $i_sysfile sys/file.h
13595 eval $hasproto
13596
13597 : see if fp_class exists
13598 set fp_class d_fp_class
13599 eval $inlibc
13600
13601 : see if pathconf exists
13602 set pathconf d_pathconf
13603 eval $inlibc
13604
13605 : see if fpathconf exists
13606 set fpathconf d_fpathconf
13607 eval $inlibc
13608
13609 : see if fpclass exists
13610 set fpclass d_fpclass
13611 eval $inlibc
13612
13613 : see if fpclassify exists
13614 set fpclassify d_fpclassify
13615 eval $inlibc
13616
13617 : see if fpclassl exists
13618 set fpclassl d_fpclassl
13619 eval $inlibc
13620
13621 : check for fpos64_t
13622 echo " "
13623 echo "Checking to see if you have fpos64_t..." >&4
13624 $cat >try.c <<EOCP
13625 #include <stdio.h>
13626 int main() { fpos64_t x = 7; }
13627 EOCP
13628 set try
13629 if eval $compile; then
13630         val="$define"
13631         echo "You have fpos64_t."
13632 else
13633         val="$undef"
13634         echo "You do not have fpos64_t."
13635         case "$fpossize" in
13636         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13637         esac
13638 fi
13639 $rm_try
13640 set d_fpos64_t
13641 eval $setvar
13642
13643 : see if frexpl exists
13644 set frexpl d_frexpl
13645 eval $inlibc
13646
13647 : see if this is a sys/param system
13648 set sys/param.h i_sysparam
13649 eval $inhdr
13650
13651 : see if this is a sys/mount.h system
13652 set sys/mount.h i_sysmount
13653 eval $inhdr
13654
13655 : Check for fs_data_s
13656 echo " "
13657 echo "Checking to see if your system supports struct fs_data..." >&4
13658 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13659 eval $hasstruct
13660 case "$d_fs_data_s" in
13661 "$define")      echo "Yes, it does."   ;;
13662 *)              echo "No, it doesn't." ;;
13663 esac
13664
13665 : see if fseeko exists
13666 set fseeko d_fseeko
13667 eval $inlibc
13668 case "$longsize" in
13669 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13670 esac
13671
13672 : see if fsetpos exists
13673 set fsetpos d_fsetpos
13674 eval $inlibc
13675
13676 : see if fstatfs exists
13677 set fstatfs d_fstatfs
13678 eval $inlibc
13679
13680 : see if statvfs exists
13681 set statvfs d_statvfs
13682 eval $inlibc
13683
13684 : see if fstatvfs exists
13685 set fstatvfs d_fstatvfs
13686 eval $inlibc
13687
13688
13689 : see if fsync exists
13690 set fsync d_fsync
13691 eval $inlibc
13692
13693 : see if ftello exists
13694 set ftello d_ftello
13695 eval $inlibc
13696 case "$longsize" in
13697 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13698 esac
13699
13700 : check for a working futimes
13701 d_futimes="$undef"
13702 echo " "
13703 echo "Checking if you have a working futimes()" >&4
13704 $cat >try.c <<EOCP
13705 #include <stdio.h>
13706 #include <sys/time.h>
13707 #include <errno.h>
13708 #include <fcntl.h>
13709
13710 int main ()
13711 {
13712     int fd, rv;
13713     fd = open ("try.c", O_RDWR);
13714     if (-1 == fd) exit (1);
13715     rv = futimes (fd, NULL);
13716     exit (rv == -1 ? errno : 0);
13717 }
13718 EOCP
13719 set try
13720 if eval $compile; then
13721     `$run ./try`
13722     rc=$?
13723     case "$rc" in
13724         0)  echo "Yes, you have" >&4
13725             d_futimes="$define"
13726             ;;
13727         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13728             ;;
13729     esac
13730 else
13731     echo "No, it does not (probably harmless)" >&4
13732 fi
13733 $rm_try
13734
13735 : see if ndbm.h is available
13736 set ndbm.h i_ndbm
13737 eval $inhdr
13738 : Compatibility location for RedHat 7.1
13739 set gdbm/ndbm.h i_gdbmndbm
13740 eval $inhdr
13741 : Compatibility location for Debian 4.0
13742 set gdbm-ndbm.h i_gdbm_ndbm
13743 eval $inhdr
13744
13745 val="$undef"
13746 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13747         : see if dbm_open exists
13748         set dbm_open d_dbm_open
13749         eval $inlibc
13750         case "$d_dbm_open" in
13751         $undef)
13752                 i_ndbm="$undef"
13753                 i_gdbmndbm="$undef"
13754                 i_gdbm_ndbm="$undef"
13755                 echo "We won't be including <ndbm.h>"
13756                 val="$undef"
13757                 ;;
13758         *) val="$define"
13759            ;;
13760         esac
13761 fi
13762 set d_ndbm
13763 eval $setvar
13764
13765 ndbm_hdr_protochk='name=$1; hdr=$2;
13766 eval "ihdr=\$""i_$name";
13767 val="$undef";
13768 if $test "$ihdr" = "$define"; then
13769         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13770         case "$d_cplusplus" in
13771         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13772         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13773         esac;
13774         case "$val" in
13775         $define) $echo "Your <$hdr> seems to have prototypes";;
13776         *) $echo "Your <$hdr> does not seem to have prototypes";;
13777         esac;
13778 fi;
13779 set "d_${name}_h_uses_prototypes";
13780 eval $setvar'
13781
13782 set ndbm ndbm.h
13783 eval $ndbm_hdr_protochk
13784 set gdbmndbm gdbm/ndbm.h
13785 eval $ndbm_hdr_protochk
13786 set gdbm_ndbm gdbm-ndbm.h
13787 eval $ndbm_hdr_protochk
13788
13789 : see if getaddrinfo exists
13790 set getaddrinfo d_getaddrinfo
13791 eval $inlibc
13792
13793 : see if getcwd exists
13794 set getcwd d_getcwd
13795 eval $inlibc
13796
13797 : see if getespwnam exists
13798 set getespwnam d_getespwnam
13799 eval $inlibc
13800
13801 : see if getfsstat exists
13802 set getfsstat d_getfsstat
13803 eval $inlibc
13804
13805 : see if getgrent exists
13806 set getgrent d_getgrent
13807 eval $inlibc
13808
13809 : see if getgrent_r exists
13810 set getgrent_r d_getgrent_r
13811 eval $inlibc
13812 case "$d_getgrent_r" in
13813 "$define")
13814         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13815         case "$d_getgrent_r_proto:$usethreads" in
13816         ":define")      d_getgrent_r_proto=define
13817                 set d_getgrent_r_proto getgrent_r $hdrs
13818                 eval $hasproto ;;
13819         *)      ;;
13820         esac
13821         case "$d_getgrent_r_proto" in
13822         define)
13823         case "$getgrent_r_proto" in
13824         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13825         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13826         esac
13827         case "$getgrent_r_proto" in
13828         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13829         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13830         esac
13831         case "$getgrent_r_proto" in
13832         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13833         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13834         esac
13835         case "$getgrent_r_proto" in
13836         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13837         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13838         esac
13839         case "$getgrent_r_proto" in
13840         ''|0) try='int getgrent_r(struct group*, char*, int);'
13841         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13842         esac
13843         case "$getgrent_r_proto" in
13844         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13845         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13846         esac
13847         case "$getgrent_r_proto" in
13848         ''|0)   d_getgrent_r=undef
13849                 getgrent_r_proto=0
13850                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13851         * )     case "$getgrent_r_proto" in
13852                 REENTRANT_PROTO*) ;;
13853                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13854                 esac
13855                 echo "Prototype: $try" ;;
13856         esac
13857         ;;
13858         *)      case "$usethreads" in
13859                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13860                 esac
13861                 d_getgrent_r=undef
13862                 getgrent_r_proto=0
13863                 ;;
13864         esac
13865         ;;
13866 *)      getgrent_r_proto=0
13867         ;;
13868 esac
13869
13870 : see if getgrgid_r exists
13871 set getgrgid_r d_getgrgid_r
13872 eval $inlibc
13873 case "$d_getgrgid_r" in
13874 "$define")
13875         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13876         case "$d_getgrgid_r_proto:$usethreads" in
13877         ":define")      d_getgrgid_r_proto=define
13878                 set d_getgrgid_r_proto getgrgid_r $hdrs
13879                 eval $hasproto ;;
13880         *)      ;;
13881         esac
13882         case "$d_getgrgid_r_proto" in
13883         define)
13884         case "$getgrgid_r_proto" in
13885         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13886         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13887         esac
13888         case "$getgrgid_r_proto" in
13889         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13890         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13891         esac
13892         case "$getgrgid_r_proto" in
13893         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13894         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13895         esac
13896         case "$getgrgid_r_proto" in
13897         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13898         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13899         esac
13900         case "$getgrgid_r_proto" in
13901         ''|0)   d_getgrgid_r=undef
13902                 getgrgid_r_proto=0
13903                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13904         * )     case "$getgrgid_r_proto" in
13905                 REENTRANT_PROTO*) ;;
13906                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13907                 esac
13908                 echo "Prototype: $try" ;;
13909         esac
13910         ;;
13911         *)      case "$usethreads" in
13912                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13913                 esac
13914                 d_getgrgid_r=undef
13915                 getgrgid_r_proto=0
13916                 ;;
13917         esac
13918         ;;
13919 *)      getgrgid_r_proto=0
13920         ;;
13921 esac
13922
13923 : see if getgrnam_r exists
13924 set getgrnam_r d_getgrnam_r
13925 eval $inlibc
13926 case "$d_getgrnam_r" in
13927 "$define")
13928         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13929         case "$d_getgrnam_r_proto:$usethreads" in
13930         ":define")      d_getgrnam_r_proto=define
13931                 set d_getgrnam_r_proto getgrnam_r $hdrs
13932                 eval $hasproto ;;
13933         *)      ;;
13934         esac
13935         case "$d_getgrnam_r_proto" in
13936         define)
13937         case "$getgrnam_r_proto" in
13938         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13939         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13940         esac
13941         case "$getgrnam_r_proto" in
13942         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13943         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13944         esac
13945         case "$getgrnam_r_proto" in
13946         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13947         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13948         esac
13949         case "$getgrnam_r_proto" in
13950         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13951         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13952         esac
13953         case "$getgrnam_r_proto" in
13954         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13955         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13956         esac
13957         case "$getgrnam_r_proto" in
13958         ''|0)   d_getgrnam_r=undef
13959                 getgrnam_r_proto=0
13960                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13961         * )     case "$getgrnam_r_proto" in
13962                 REENTRANT_PROTO*) ;;
13963                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13964                 esac
13965                 echo "Prototype: $try" ;;
13966         esac
13967         ;;
13968         *)      case "$usethreads" in
13969                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13970                 esac
13971                 d_getgrnam_r=undef
13972                 getgrnam_r_proto=0
13973                 ;;
13974         esac
13975         ;;
13976 *)      getgrnam_r_proto=0
13977         ;;
13978 esac
13979
13980 : see if gethostbyaddr exists
13981 set gethostbyaddr d_gethbyaddr
13982 eval $inlibc
13983
13984 : see if gethostbyname exists
13985 set gethostbyname d_gethbyname
13986 eval $inlibc
13987
13988 : see if gethostent exists
13989 set gethostent d_gethent
13990 eval $inlibc
13991
13992 : see how we will look up host name
13993 echo " "
13994 call=''
13995 if set gethostname val -f d_gethname; eval $csym; $val; then
13996         echo 'gethostname() found.' >&4
13997         d_gethname="$define"
13998         call=gethostname
13999 fi
14000 if set uname val -f d_uname; eval $csym; $val; then
14001         if ./xenix; then
14002                 $cat <<'EOM'
14003 uname() was found, but you're running xenix, and older versions of xenix
14004 have a broken uname(). If you don't really know whether your xenix is old
14005 enough to have a broken system call, use the default answer.
14006
14007 EOM
14008                 dflt=y
14009                 case "$d_uname" in
14010                 "$define") dflt=n;;
14011                 esac
14012                 rp='Is your uname() broken?'
14013                 . ./myread
14014                 case "$ans" in
14015                 n*) d_uname="$define"; call=uname;;
14016                 esac
14017         else
14018                 echo 'uname() found.' >&4
14019                 d_uname="$define"
14020                 case "$call" in
14021                 '') call=uname ;;
14022                 esac
14023         fi
14024 fi
14025 case "$d_gethname" in
14026 '') d_gethname="$undef";;
14027 esac
14028 case "$d_uname" in
14029 '') d_uname="$undef";;
14030 esac
14031 case "$d_uname$d_gethname" in
14032 *define*)
14033         dflt=n
14034         cat <<EOM
14035
14036 Every now and then someone has a $call() that lies about the hostname
14037 but can't be fixed for political or economic reasons.  If you wish, I can
14038 pretend $call() isn't there and maybe compute hostname at run-time
14039 thanks to the '$phostname' command.
14040
14041 EOM
14042         rp="Shall I ignore $call() from now on?"
14043         . ./myread
14044         case "$ans" in
14045         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14046         esac;;
14047 esac
14048 case "$phostname" in
14049 '') aphostname='';;
14050 *) case "$aphostname" in
14051         /*) ;;
14052         *) set X $phostname
14053                 shift
14054                 file=$1
14055                 shift
14056                 file=`./loc $file $file $pth`
14057                 aphostname=`echo $file $*`
14058                 ;;
14059         esac
14060         ;;
14061 esac
14062 case "$d_uname$d_gethname" in
14063 *define*) ;;
14064 *)
14065         case "$phostname" in
14066         '')
14067                 echo "There will be no way for $package to get your hostname." >&4;;
14068         *)
14069         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14070                 ;;
14071         esac;;
14072 esac
14073 case "$d_phostname" in
14074 '') d_phostname="$undef";;
14075 esac
14076
14077 : see if gethostbyaddr_r exists
14078 set gethostbyaddr_r d_gethostbyaddr_r
14079 eval $inlibc
14080 case "$d_gethostbyaddr_r" in
14081 "$define")
14082         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14083         case "$d_gethostbyaddr_r_proto:$usethreads" in
14084         ":define")      d_gethostbyaddr_r_proto=define
14085                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14086                 eval $hasproto ;;
14087         *)      ;;
14088         esac
14089         case "$d_gethostbyaddr_r_proto" in
14090         define)
14091         case "$gethostbyaddr_r_proto" in
14092         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14093         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14094         esac
14095         case "$gethostbyaddr_r_proto" in
14096         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14097         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14098         esac
14099         case "$gethostbyaddr_r_proto" in
14100         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14101         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14102         esac
14103         case "$gethostbyaddr_r_proto" in
14104         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14105         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14106         esac
14107         case "$gethostbyaddr_r_proto" in
14108         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14109         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14110         esac
14111         case "$gethostbyaddr_r_proto" in
14112         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14113         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14114         esac
14115         case "$gethostbyaddr_r_proto" in
14116         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14117         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14118         esac
14119         case "$gethostbyaddr_r_proto" in
14120         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14121         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14122         esac
14123         case "$gethostbyaddr_r_proto" in
14124         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14125         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14126         esac
14127         case "$gethostbyaddr_r_proto" in
14128         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14129         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14130         esac
14131         case "$gethostbyaddr_r_proto" in
14132         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14133         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14134         esac
14135         case "$gethostbyaddr_r_proto" in
14136         ''|0)   d_gethostbyaddr_r=undef
14137                 gethostbyaddr_r_proto=0
14138                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14139         * )     case "$gethostbyaddr_r_proto" in
14140                 REENTRANT_PROTO*) ;;
14141                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14142                 esac
14143                 echo "Prototype: $try" ;;
14144         esac
14145         ;;
14146         *)      case "$usethreads" in
14147                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14148                 esac
14149                 d_gethostbyaddr_r=undef
14150                 gethostbyaddr_r_proto=0
14151                 ;;
14152         esac
14153         ;;
14154 *)      gethostbyaddr_r_proto=0
14155         ;;
14156 esac
14157
14158 : see if gethostbyname_r exists
14159 set gethostbyname_r d_gethostbyname_r
14160 eval $inlibc
14161 case "$d_gethostbyname_r" in
14162 "$define")
14163         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14164         case "$d_gethostbyname_r_proto:$usethreads" in
14165         ":define")      d_gethostbyname_r_proto=define
14166                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14167                 eval $hasproto ;;
14168         *)      ;;
14169         esac
14170         case "$d_gethostbyname_r_proto" in
14171         define)
14172         case "$gethostbyname_r_proto" in
14173         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14174         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14175         esac
14176         case "$gethostbyname_r_proto" in
14177         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14178         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14179         esac
14180         case "$gethostbyname_r_proto" in
14181         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14182         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14183         esac
14184         case "$gethostbyname_r_proto" in
14185         ''|0)   d_gethostbyname_r=undef
14186                 gethostbyname_r_proto=0
14187                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14188         * )     case "$gethostbyname_r_proto" in
14189                 REENTRANT_PROTO*) ;;
14190                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14191                 esac
14192                 echo "Prototype: $try" ;;
14193         esac
14194         ;;
14195         *)      case "$usethreads" in
14196                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14197                 esac
14198                 d_gethostbyname_r=undef
14199                 gethostbyname_r_proto=0
14200                 ;;
14201         esac
14202         ;;
14203 *)      gethostbyname_r_proto=0
14204         ;;
14205 esac
14206
14207 : see if gethostent_r exists
14208 set gethostent_r d_gethostent_r
14209 eval $inlibc
14210 case "$d_gethostent_r" in
14211 "$define")
14212         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14213         case "$d_gethostent_r_proto:$usethreads" in
14214         ":define")      d_gethostent_r_proto=define
14215                 set d_gethostent_r_proto gethostent_r $hdrs
14216                 eval $hasproto ;;
14217         *)      ;;
14218         esac
14219         case "$d_gethostent_r_proto" in
14220         define)
14221         case "$gethostent_r_proto" in
14222         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14223         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14224         esac
14225         case "$gethostent_r_proto" in
14226         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14227         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14228         esac
14229         case "$gethostent_r_proto" in
14230         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14231         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14232         esac
14233         case "$gethostent_r_proto" in
14234         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14235         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14236         esac
14237         case "$gethostent_r_proto" in
14238         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14239         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14240         esac
14241         case "$gethostent_r_proto" in
14242         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14243         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14244         esac
14245         case "$gethostent_r_proto" in
14246         ''|0)   d_gethostent_r=undef
14247                 gethostent_r_proto=0
14248                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14249         * )     case "$gethostent_r_proto" in
14250                 REENTRANT_PROTO*) ;;
14251                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14252                 esac
14253                 echo "Prototype: $try" ;;
14254         esac
14255         ;;
14256         *)      case "$usethreads" in
14257                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14258                 esac
14259                 d_gethostent_r=undef
14260                 gethostent_r_proto=0
14261                 ;;
14262         esac
14263         ;;
14264 *)      gethostent_r_proto=0
14265         ;;
14266 esac
14267
14268 : see if prototypes for various gethostxxx netdb.h functions are available
14269 echo " "
14270 set d_gethostprotos gethostent $i_netdb netdb.h
14271 eval $hasproto
14272
14273 : see if getitimer exists
14274 set getitimer d_getitimer
14275 eval $inlibc
14276
14277 : see if getlogin exists
14278 set getlogin d_getlogin
14279 eval $inlibc
14280
14281 : see if getlogin_r exists
14282 set getlogin_r d_getlogin_r
14283 eval $inlibc
14284 case "$d_getlogin_r" in
14285 "$define")
14286         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14287         case "$d_getlogin_r_proto:$usethreads" in
14288         ":define")      d_getlogin_r_proto=define
14289                 set d_getlogin_r_proto getlogin_r $hdrs
14290                 eval $hasproto ;;
14291         *)      ;;
14292         esac
14293         case "$d_getlogin_r_proto" in
14294         define)
14295         case "$getlogin_r_proto" in
14296         ''|0) try='int getlogin_r(char*, size_t);'
14297         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14298         esac
14299         case "$getlogin_r_proto" in
14300         ''|0) try='int getlogin_r(char*, int);'
14301         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14302         esac
14303         case "$getlogin_r_proto" in
14304         ''|0) try='char* getlogin_r(char*, size_t);'
14305         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14306         esac
14307         case "$getlogin_r_proto" in
14308         ''|0) try='char* getlogin_r(char*, int);'
14309         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14310         esac
14311         case "$getlogin_r_proto" in
14312         ''|0)   d_getlogin_r=undef
14313                 getlogin_r_proto=0
14314                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14315         * )     case "$getlogin_r_proto" in
14316                 REENTRANT_PROTO*) ;;
14317                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14318                 esac
14319                 echo "Prototype: $try" ;;
14320         esac
14321         ;;
14322         *)      case "$usethreads" in
14323                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14324                 esac
14325                 d_getlogin_r=undef
14326                 getlogin_r_proto=0
14327                 ;;
14328         esac
14329         ;;
14330 *)      getlogin_r_proto=0
14331         ;;
14332 esac
14333
14334 : see if getmnt exists
14335 set getmnt d_getmnt
14336 eval $inlibc
14337
14338 : see if getmntent exists
14339 set getmntent d_getmntent
14340 eval $inlibc
14341
14342 : see if getnameinfo exists
14343 set getnameinfo d_getnameinfo
14344 eval $inlibc
14345
14346 : see if getnetbyaddr exists
14347 set getnetbyaddr d_getnbyaddr
14348 eval $inlibc
14349
14350 : see if getnetbyname exists
14351 set getnetbyname d_getnbyname
14352 eval $inlibc
14353
14354 : see if getnetent exists
14355 set getnetent d_getnent
14356 eval $inlibc
14357
14358 : see if getnetbyaddr_r exists
14359 set getnetbyaddr_r d_getnetbyaddr_r
14360 eval $inlibc
14361 case "$d_getnetbyaddr_r" in
14362 "$define")
14363         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14364         case "$d_getnetbyaddr_r_proto:$usethreads" in
14365         ":define")      d_getnetbyaddr_r_proto=define
14366                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14367                 eval $hasproto ;;
14368         *)      ;;
14369         esac
14370         case "$d_getnetbyaddr_r_proto" in
14371         define)
14372         case "$getnetbyaddr_r_proto" in
14373         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14374         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14375         esac
14376         case "$getnetbyaddr_r_proto" in
14377         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14378         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14379         esac
14380         case "$getnetbyaddr_r_proto" in
14381         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14382         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14383         esac
14384         case "$getnetbyaddr_r_proto" in
14385         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14386         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14387         esac
14388         case "$getnetbyaddr_r_proto" in
14389         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14390         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14391         esac
14392         case "$getnetbyaddr_r_proto" in
14393         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14394         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14395         esac
14396         case "$getnetbyaddr_r_proto" in
14397         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14398         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14399         esac
14400         case "$getnetbyaddr_r_proto" in
14401         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14402         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14403         esac
14404         case "$getnetbyaddr_r_proto" in
14405         ''|0)   d_getnetbyaddr_r=undef
14406                 getnetbyaddr_r_proto=0
14407                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14408         * )     case "$getnetbyaddr_r_proto" in
14409                 REENTRANT_PROTO*) ;;
14410                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14411                 esac
14412                 echo "Prototype: $try" ;;
14413         esac
14414         ;;
14415         *)      case "$usethreads" in
14416                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14417                 esac
14418                 d_getnetbyaddr_r=undef
14419                 getnetbyaddr_r_proto=0
14420                 ;;
14421         esac
14422         ;;
14423 *)      getnetbyaddr_r_proto=0
14424         ;;
14425 esac
14426
14427 : see if getnetbyname_r exists
14428 set getnetbyname_r d_getnetbyname_r
14429 eval $inlibc
14430 case "$d_getnetbyname_r" in
14431 "$define")
14432         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14433         case "$d_getnetbyname_r_proto:$usethreads" in
14434         ":define")      d_getnetbyname_r_proto=define
14435                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14436                 eval $hasproto ;;
14437         *)      ;;
14438         esac
14439         case "$d_getnetbyname_r_proto" in
14440         define)
14441         case "$getnetbyname_r_proto" in
14442         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14443         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14444         esac
14445         case "$getnetbyname_r_proto" in
14446         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14447         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14448         esac
14449         case "$getnetbyname_r_proto" in
14450         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14451         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14452         esac
14453         case "$getnetbyname_r_proto" in
14454         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14455         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14456         esac
14457         case "$getnetbyname_r_proto" in
14458         ''|0)   d_getnetbyname_r=undef
14459                 getnetbyname_r_proto=0
14460                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14461         * )     case "$getnetbyname_r_proto" in
14462                 REENTRANT_PROTO*) ;;
14463                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14464                 esac
14465                 echo "Prototype: $try" ;;
14466         esac
14467         ;;
14468         *)      case "$usethreads" in
14469                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14470                 esac
14471                 d_getnetbyname_r=undef
14472                 getnetbyname_r_proto=0
14473                 ;;
14474         esac
14475         ;;
14476 *)      getnetbyname_r_proto=0
14477         ;;
14478 esac
14479
14480 : see if getnetent_r exists
14481 set getnetent_r d_getnetent_r
14482 eval $inlibc
14483 case "$d_getnetent_r" in
14484 "$define")
14485         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14486         case "$d_getnetent_r_proto:$usethreads" in
14487         ":define")      d_getnetent_r_proto=define
14488                 set d_getnetent_r_proto getnetent_r $hdrs
14489                 eval $hasproto ;;
14490         *)      ;;
14491         esac
14492         case "$d_getnetent_r_proto" in
14493         define)
14494         case "$getnetent_r_proto" in
14495         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14496         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14497         esac
14498         case "$getnetent_r_proto" in
14499         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14500         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14501         esac
14502         case "$getnetent_r_proto" in
14503         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14504         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14505         esac
14506         case "$getnetent_r_proto" in
14507         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14508         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14509         esac
14510         case "$getnetent_r_proto" in
14511         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14512         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14513         esac
14514         case "$getnetent_r_proto" in
14515         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14516         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14517         esac
14518         case "$getnetent_r_proto" in
14519         ''|0)   d_getnetent_r=undef
14520                 getnetent_r_proto=0
14521                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14522         * )     case "$getnetent_r_proto" in
14523                 REENTRANT_PROTO*) ;;
14524                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14525                 esac
14526                 echo "Prototype: $try" ;;
14527         esac
14528         ;;
14529         *)      case "$usethreads" in
14530                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14531                 esac
14532                 d_getnetent_r=undef
14533                 getnetent_r_proto=0
14534                 ;;
14535         esac
14536         ;;
14537 *)      getnetent_r_proto=0
14538         ;;
14539 esac
14540
14541 : see if prototypes for various getnetxxx netdb.h functions are available
14542 echo " "
14543 set d_getnetprotos getnetent $i_netdb netdb.h
14544 eval $hasproto
14545
14546 : see if getpagesize exists
14547 set getpagesize d_getpagsz
14548 eval $inlibc
14549
14550 : Optional checks for getprotobyname and getprotobynumber
14551
14552 : see if getprotobyname exists
14553 set getprotobyname d_getpbyname
14554 eval $inlibc
14555
14556 : see if getprotobynumber exists
14557 set getprotobynumber d_getpbynumber
14558 eval $inlibc
14559
14560 : see if getprotoent exists
14561 set getprotoent d_getpent
14562 eval $inlibc
14563
14564 : see if getpgid exists
14565 set getpgid d_getpgid
14566 eval $inlibc
14567
14568 : see if getpgrp2 exists
14569 set getpgrp2 d_getpgrp2
14570 eval $inlibc
14571
14572 : see if getppid exists
14573 set getppid d_getppid
14574 eval $inlibc
14575
14576 : see if getpriority exists
14577 set getpriority d_getprior
14578 eval $inlibc
14579
14580 : see if getprotobyname_r exists
14581 set getprotobyname_r d_getprotobyname_r
14582 eval $inlibc
14583 case "$d_getprotobyname_r" in
14584 "$define")
14585         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14586         case "$d_getprotobyname_r_proto:$usethreads" in
14587         ":define")      d_getprotobyname_r_proto=define
14588                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14589                 eval $hasproto ;;
14590         *)      ;;
14591         esac
14592         case "$d_getprotobyname_r_proto" in
14593         define)
14594         case "$getprotobyname_r_proto" in
14595         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14596         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14597         esac
14598         case "$getprotobyname_r_proto" in
14599         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14600         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14601         esac
14602         case "$getprotobyname_r_proto" in
14603         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14604         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14605         esac
14606         case "$getprotobyname_r_proto" in
14607         ''|0)   d_getprotobyname_r=undef
14608                 getprotobyname_r_proto=0
14609                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14610         * )     case "$getprotobyname_r_proto" in
14611                 REENTRANT_PROTO*) ;;
14612                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14613                 esac
14614                 echo "Prototype: $try" ;;
14615         esac
14616         ;;
14617         *)      case "$usethreads" in
14618                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14619                 esac
14620                 d_getprotobyname_r=undef
14621                 getprotobyname_r_proto=0
14622                 ;;
14623         esac
14624         ;;
14625 *)      getprotobyname_r_proto=0
14626         ;;
14627 esac
14628
14629 : see if getprotobynumber_r exists
14630 set getprotobynumber_r d_getprotobynumber_r
14631 eval $inlibc
14632 case "$d_getprotobynumber_r" in
14633 "$define")
14634         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14635         case "$d_getprotobynumber_r_proto:$usethreads" in
14636         ":define")      d_getprotobynumber_r_proto=define
14637                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14638                 eval $hasproto ;;
14639         *)      ;;
14640         esac
14641         case "$d_getprotobynumber_r_proto" in
14642         define)
14643         case "$getprotobynumber_r_proto" in
14644         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14645         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14646         esac
14647         case "$getprotobynumber_r_proto" in
14648         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14649         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14650         esac
14651         case "$getprotobynumber_r_proto" in
14652         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14653         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14654         esac
14655         case "$getprotobynumber_r_proto" in
14656         ''|0)   d_getprotobynumber_r=undef
14657                 getprotobynumber_r_proto=0
14658                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14659         * )     case "$getprotobynumber_r_proto" in
14660                 REENTRANT_PROTO*) ;;
14661                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14662                 esac
14663                 echo "Prototype: $try" ;;
14664         esac
14665         ;;
14666         *)      case "$usethreads" in
14667                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14668                 esac
14669                 d_getprotobynumber_r=undef
14670                 getprotobynumber_r_proto=0
14671                 ;;
14672         esac
14673         ;;
14674 *)      getprotobynumber_r_proto=0
14675         ;;
14676 esac
14677
14678 : see if getprotoent_r exists
14679 set getprotoent_r d_getprotoent_r
14680 eval $inlibc
14681 case "$d_getprotoent_r" in
14682 "$define")
14683         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14684         case "$d_getprotoent_r_proto:$usethreads" in
14685         ":define")      d_getprotoent_r_proto=define
14686                 set d_getprotoent_r_proto getprotoent_r $hdrs
14687                 eval $hasproto ;;
14688         *)      ;;
14689         esac
14690         case "$d_getprotoent_r_proto" in
14691         define)
14692         case "$getprotoent_r_proto" in
14693         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14694         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14695         esac
14696         case "$getprotoent_r_proto" in
14697         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14698         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14699         esac
14700         case "$getprotoent_r_proto" in
14701         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14702         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14703         esac
14704         case "$getprotoent_r_proto" in
14705         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14706         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14707         esac
14708         case "$getprotoent_r_proto" in
14709         ''|0)   d_getprotoent_r=undef
14710                 getprotoent_r_proto=0
14711                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14712         * )     case "$getprotoent_r_proto" in
14713                 REENTRANT_PROTO*) ;;
14714                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14715                 esac
14716                 echo "Prototype: $try" ;;
14717         esac
14718         ;;
14719         *)      case "$usethreads" in
14720                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14721                 esac
14722                 d_getprotoent_r=undef
14723                 getprotoent_r_proto=0
14724                 ;;
14725         esac
14726         ;;
14727 *)      getprotoent_r_proto=0
14728         ;;
14729 esac
14730
14731 : see if prototypes for various getprotoxxx netdb.h functions are available
14732 echo " "
14733 set d_getprotoprotos getprotoent $i_netdb netdb.h
14734 eval $hasproto
14735
14736 : see if getprpwnam exists
14737 set getprpwnam d_getprpwnam
14738 eval $inlibc
14739
14740 : see if getpwent exists
14741 set getpwent d_getpwent
14742 eval $inlibc
14743
14744 : see if getpwent_r exists
14745 set getpwent_r d_getpwent_r
14746 eval $inlibc
14747 case "$d_getpwent_r" in
14748 "$define")
14749         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14750         case "$d_getpwent_r_proto:$usethreads" in
14751         ":define")      d_getpwent_r_proto=define
14752                 set d_getpwent_r_proto getpwent_r $hdrs
14753                 eval $hasproto ;;
14754         *)      ;;
14755         esac
14756         case "$d_getpwent_r_proto" in
14757         define)
14758         case "$getpwent_r_proto" in
14759         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14760         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14761         esac
14762         case "$getpwent_r_proto" in
14763         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14764         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14765         esac
14766         case "$getpwent_r_proto" in
14767         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14768         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14769         esac
14770         case "$getpwent_r_proto" in
14771         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14772         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14773         esac
14774         case "$getpwent_r_proto" in
14775         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14776         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14777         esac
14778         case "$getpwent_r_proto" in
14779         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14780         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14781         esac
14782         case "$getpwent_r_proto" in
14783         ''|0)   d_getpwent_r=undef
14784                 getpwent_r_proto=0
14785                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14786         * )     case "$getpwent_r_proto" in
14787                 REENTRANT_PROTO*) ;;
14788                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14789                 esac
14790                 echo "Prototype: $try" ;;
14791         esac
14792         ;;
14793         *)      case "$usethreads" in
14794                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14795                 esac
14796                 d_getpwent_r=undef
14797                 getpwent_r_proto=0
14798                 ;;
14799         esac
14800         ;;
14801 *)      getpwent_r_proto=0
14802         ;;
14803 esac
14804
14805 : see if getpwnam_r exists
14806 set getpwnam_r d_getpwnam_r
14807 eval $inlibc
14808 case "$d_getpwnam_r" in
14809 "$define")
14810         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14811         case "$d_getpwnam_r_proto:$usethreads" in
14812         ":define")      d_getpwnam_r_proto=define
14813                 set d_getpwnam_r_proto getpwnam_r $hdrs
14814                 eval $hasproto ;;
14815         *)      ;;
14816         esac
14817         case "$d_getpwnam_r_proto" in
14818         define)
14819         case "$getpwnam_r_proto" in
14820         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14821         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14822         esac
14823         case "$getpwnam_r_proto" in
14824         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14825         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14826         esac
14827         case "$getpwnam_r_proto" in
14828         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14829         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14830         esac
14831         case "$getpwnam_r_proto" in
14832         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14833         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14834         esac
14835         case "$getpwnam_r_proto" in
14836         ''|0)   d_getpwnam_r=undef
14837                 getpwnam_r_proto=0
14838                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14839         * )     case "$getpwnam_r_proto" in
14840                 REENTRANT_PROTO*) ;;
14841                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14842                 esac
14843                 echo "Prototype: $try" ;;
14844         esac
14845         ;;
14846         *)      case "$usethreads" in
14847                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14848                 esac
14849                 d_getpwnam_r=undef
14850                 getpwnam_r_proto=0
14851                 ;;
14852         esac
14853         ;;
14854 *)      getpwnam_r_proto=0
14855         ;;
14856 esac
14857
14858 : see if getpwuid_r exists
14859 set getpwuid_r d_getpwuid_r
14860 eval $inlibc
14861 case "$d_getpwuid_r" in
14862 "$define")
14863         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14864         case "$d_getpwuid_r_proto:$usethreads" in
14865         ":define")      d_getpwuid_r_proto=define
14866                 set d_getpwuid_r_proto getpwuid_r $hdrs
14867                 eval $hasproto ;;
14868         *)      ;;
14869         esac
14870         case "$d_getpwuid_r_proto" in
14871         define)
14872         case "$getpwuid_r_proto" in
14873         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14874         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14875         esac
14876         case "$getpwuid_r_proto" in
14877         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14878         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14879         esac
14880         case "$getpwuid_r_proto" in
14881         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14882         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14883         esac
14884         case "$getpwuid_r_proto" in
14885         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14886         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14887         esac
14888         case "$getpwuid_r_proto" in
14889         ''|0)   d_getpwuid_r=undef
14890                 getpwuid_r_proto=0
14891                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14892         * )     case "$getpwuid_r_proto" in
14893                 REENTRANT_PROTO*) ;;
14894                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14895                 esac
14896                 echo "Prototype: $try" ;;
14897         esac
14898         ;;
14899         *)      case "$usethreads" in
14900                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14901                 esac
14902                 d_getpwuid_r=undef
14903                 getpwuid_r_proto=0
14904                 ;;
14905         esac
14906         ;;
14907 *)      getpwuid_r_proto=0
14908         ;;
14909 esac
14910
14911 : Optional checks for getsbyname and getsbyport
14912
14913 : see if getservbyname exists
14914 set getservbyname d_getsbyname
14915 eval $inlibc
14916
14917 : see if getservbyport exists
14918 set getservbyport d_getsbyport
14919 eval $inlibc
14920
14921 : see if getservent exists
14922 set getservent d_getsent
14923 eval $inlibc
14924
14925 : see if getservbyname_r exists
14926 set getservbyname_r d_getservbyname_r
14927 eval $inlibc
14928 case "$d_getservbyname_r" in
14929 "$define")
14930         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14931         case "$d_getservbyname_r_proto:$usethreads" in
14932         ":define")      d_getservbyname_r_proto=define
14933                 set d_getservbyname_r_proto getservbyname_r $hdrs
14934                 eval $hasproto ;;
14935         *)      ;;
14936         esac
14937         case "$d_getservbyname_r_proto" in
14938         define)
14939         case "$getservbyname_r_proto" in
14940         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14941         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14942         esac
14943         case "$getservbyname_r_proto" in
14944         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14945         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14946         esac
14947         case "$getservbyname_r_proto" in
14948         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14949         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14950         esac
14951         case "$getservbyname_r_proto" in
14952         ''|0)   d_getservbyname_r=undef
14953                 getservbyname_r_proto=0
14954                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14955         * )     case "$getservbyname_r_proto" in
14956                 REENTRANT_PROTO*) ;;
14957                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14958                 esac
14959                 echo "Prototype: $try" ;;
14960         esac
14961         ;;
14962         *)      case "$usethreads" in
14963                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14964                 esac
14965                 d_getservbyname_r=undef
14966                 getservbyname_r_proto=0
14967                 ;;
14968         esac
14969         ;;
14970 *)      getservbyname_r_proto=0
14971         ;;
14972 esac
14973
14974 : see if getservbyport_r exists
14975 set getservbyport_r d_getservbyport_r
14976 eval $inlibc
14977 case "$d_getservbyport_r" in
14978 "$define")
14979         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14980         case "$d_getservbyport_r_proto:$usethreads" in
14981         ":define")      d_getservbyport_r_proto=define
14982                 set d_getservbyport_r_proto getservbyport_r $hdrs
14983                 eval $hasproto ;;
14984         *)      ;;
14985         esac
14986         case "$d_getservbyport_r_proto" in
14987         define)
14988         case "$getservbyport_r_proto" in
14989         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14990         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14991         esac
14992         case "$getservbyport_r_proto" in
14993         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14994         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14995         esac
14996         case "$getservbyport_r_proto" in
14997         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14998         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14999         esac
15000         case "$getservbyport_r_proto" in
15001         ''|0)   d_getservbyport_r=undef
15002                 getservbyport_r_proto=0
15003                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15004         * )     case "$getservbyport_r_proto" in
15005                 REENTRANT_PROTO*) ;;
15006                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15007                 esac
15008                 echo "Prototype: $try" ;;
15009         esac
15010         ;;
15011         *)      case "$usethreads" in
15012                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15013                 esac
15014                 d_getservbyport_r=undef
15015                 getservbyport_r_proto=0
15016                 ;;
15017         esac
15018         ;;
15019 *)      getservbyport_r_proto=0
15020         ;;
15021 esac
15022
15023 : see if getservent_r exists
15024 set getservent_r d_getservent_r
15025 eval $inlibc
15026 case "$d_getservent_r" in
15027 "$define")
15028         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15029         case "$d_getservent_r_proto:$usethreads" in
15030         ":define")      d_getservent_r_proto=define
15031                 set d_getservent_r_proto getservent_r $hdrs
15032                 eval $hasproto ;;
15033         *)      ;;
15034         esac
15035         case "$d_getservent_r_proto" in
15036         define)
15037         case "$getservent_r_proto" in
15038         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15039         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15040         esac
15041         case "$getservent_r_proto" in
15042         ''|0) try='int getservent_r(struct servent*, char*, int);'
15043         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15044         esac
15045         case "$getservent_r_proto" in
15046         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15047         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15048         esac
15049         case "$getservent_r_proto" in
15050         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15051         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15052         esac
15053         case "$getservent_r_proto" in
15054         ''|0)   d_getservent_r=undef
15055                 getservent_r_proto=0
15056                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15057         * )     case "$getservent_r_proto" in
15058                 REENTRANT_PROTO*) ;;
15059                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15060                 esac
15061                 echo "Prototype: $try" ;;
15062         esac
15063         ;;
15064         *)      case "$usethreads" in
15065                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15066                 esac
15067                 d_getservent_r=undef
15068                 getservent_r_proto=0
15069                 ;;
15070         esac
15071         ;;
15072 *)      getservent_r_proto=0
15073         ;;
15074 esac
15075
15076 : see if prototypes for various getservxxx netdb.h functions are available
15077 echo " "
15078 set d_getservprotos getservent $i_netdb netdb.h
15079 eval $hasproto
15080
15081 : see if getspnam exists
15082 set getspnam d_getspnam
15083 eval $inlibc
15084
15085 : see if this is a shadow.h system
15086 set shadow.h i_shadow
15087 eval $inhdr
15088
15089 : see if getspnam_r exists
15090 set getspnam_r d_getspnam_r
15091 eval $inlibc
15092 case "$d_getspnam_r" in
15093 "$define")
15094         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15095         case "$d_getspnam_r_proto:$usethreads" in
15096         ":define")      d_getspnam_r_proto=define
15097                 set d_getspnam_r_proto getspnam_r $hdrs
15098                 eval $hasproto ;;
15099         *)      ;;
15100         esac
15101         case "$d_getspnam_r_proto" in
15102         define)
15103         case "$getspnam_r_proto" in
15104         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15105         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15106         esac
15107         case "$getspnam_r_proto" in
15108         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15109         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15110         esac
15111         case "$getspnam_r_proto" in
15112         ''|0)   d_getspnam_r=undef
15113                 getspnam_r_proto=0
15114                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15115         * )     case "$getspnam_r_proto" in
15116                 REENTRANT_PROTO*) ;;
15117                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15118                 esac
15119                 echo "Prototype: $try" ;;
15120         esac
15121         ;;
15122         *)      case "$usethreads" in
15123                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15124                 esac
15125                 d_getspnam_r=undef
15126                 getspnam_r_proto=0
15127                 ;;
15128         esac
15129         ;;
15130 *)      getspnam_r_proto=0
15131         ;;
15132 esac
15133
15134 : see if gettimeofday or ftime exists
15135 set gettimeofday d_gettimeod
15136 eval $inlibc
15137 case "$d_gettimeod" in
15138 "$undef")
15139         set ftime d_ftime 
15140         eval $inlibc
15141         ;;
15142 *)
15143         val="$undef"; set d_ftime; eval $setvar
15144         ;;
15145 esac
15146 case "$d_gettimeod$d_ftime" in
15147 "$undef$undef")
15148         echo " "
15149         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15150         ;;
15151 esac
15152
15153 : see if gmtime_r exists
15154 set gmtime_r d_gmtime_r
15155 eval $inlibc
15156 case "$d_gmtime_r" in
15157 "$define")
15158         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15159         case "$d_gmtime_r_proto:$usethreads" in
15160         ":define")      d_gmtime_r_proto=define
15161                 set d_gmtime_r_proto gmtime_r $hdrs
15162                 eval $hasproto ;;
15163         *)      ;;
15164         esac
15165         case "$d_gmtime_r_proto" in
15166         define)
15167         case "$gmtime_r_proto" in
15168         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15169         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15170         esac
15171         case "$gmtime_r_proto" in
15172         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15173         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15174         esac
15175         case "$gmtime_r_proto" in
15176         ''|0)   d_gmtime_r=undef
15177                 gmtime_r_proto=0
15178                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15179         * )     case "$gmtime_r_proto" in
15180                 REENTRANT_PROTO*) ;;
15181                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15182                 esac
15183                 echo "Prototype: $try" ;;
15184         esac
15185         ;;
15186         *)      case "$usethreads" in
15187                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15188                 esac
15189                 d_gmtime_r=undef
15190                 gmtime_r_proto=0
15191                 ;;
15192         esac
15193         ;;
15194 *)      gmtime_r_proto=0
15195         ;;
15196 esac
15197
15198 : see if hasmntopt exists
15199 set hasmntopt d_hasmntopt
15200 eval $inlibc
15201
15202 : see if this is a netinet/in.h or sys/in.h system
15203 set netinet/in.h i_niin sys/in.h i_sysin
15204 eval $inhdr
15205
15206 : see if arpa/inet.h has to be included
15207 set arpa/inet.h i_arpainet
15208 eval $inhdr
15209
15210 : see if htonl --and friends-- exists
15211 val=''
15212 set htonl val
15213 eval $inlibc
15214
15215 : Maybe they are macros.
15216 case "$val" in
15217 $undef)
15218         $cat >htonl.c <<EOM
15219 #include <stdio.h>
15220 #include <sys/types.h>
15221 #$i_niin I_NETINET_IN
15222 #$i_sysin I_SYS_IN
15223 #$i_arpainet I_ARPA_INET
15224 #ifdef I_NETINET_IN
15225 #include <netinet/in.h>
15226 #endif
15227 #ifdef I_SYS_IN
15228 #include <sys/in.h>
15229 #endif
15230 #ifdef I_ARPA_INET
15231 #include <arpa/inet.h>
15232 #endif
15233 #ifdef htonl
15234 printf("Defined as a macro.");
15235 #endif
15236 EOM
15237         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15238         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15239                 val="$define"
15240                 echo "But it seems to be defined as a macro." >&4
15241         fi
15242         $rm -f htonl.?
15243         ;;
15244 esac
15245 set d_htonl
15246 eval $setvar
15247
15248 : see if ilogbl exists
15249 set ilogbl d_ilogbl
15250 eval $inlibc
15251
15252 : index or strchr
15253 echo " "
15254 if set index val -f; eval $csym; $val; then
15255         if set strchr val -f d_strchr; eval $csym; $val; then
15256                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15257                         val="$define"
15258                         vali="$undef"
15259                         echo "strchr() found." >&4
15260                 else
15261                         val="$undef"
15262                         vali="$define"
15263                         echo "index() found." >&4
15264                 fi
15265         else
15266                 val="$undef"
15267                 vali="$define"
15268                 echo "index() found." >&4
15269         fi
15270 else
15271         if set strchr val -f d_strchr; eval $csym; $val; then
15272                 val="$define"
15273                 vali="$undef"
15274                 echo "strchr() found." >&4
15275         else
15276                 echo "No index() or strchr() found!" >&4
15277                 val="$undef"
15278                 vali="$undef"
15279         fi
15280 fi
15281 set d_strchr; eval $setvar
15282 val="$vali"
15283 set d_index; eval $setvar
15284
15285 : check whether inet_aton exists
15286 set inet_aton d_inetaton
15287 eval $inlibc
15288
15289 : see if inet_ntop exists
15290 set inet_ntop d_inetntop
15291 eval $inlibc
15292
15293 : see if inet_pton exists
15294 set inet_pton d_inetpton
15295 eval $inlibc
15296
15297 : Look for isascii
15298 echo " "
15299 $cat >isascii.c <<EOCP
15300 #include <stdio.h>
15301 #include <ctype.h>
15302 #$i_stdlib I_STDLIB
15303 #ifdef I_STDLIB
15304 #include <stdlib.h>
15305 #endif
15306 int main() {
15307         int c = 'A';
15308         if (isascii(c))
15309                 exit(0);
15310         else
15311                 exit(1);
15312 }
15313 EOCP
15314 set isascii
15315 if eval $compile; then
15316         echo "isascii() found." >&4
15317         val="$define"
15318 else
15319         echo "isascii() NOT found." >&4
15320         val="$undef"
15321 fi
15322 set d_isascii
15323 eval $setvar
15324 $rm -f isascii*
15325
15326 : Look for isblank
15327 echo " "
15328 $cat >isblank.c <<'EOCP'
15329 #include <stdio.h>
15330 #include <ctype.h>
15331 int main() {
15332         int c = ' ';
15333         if (isblank(c))
15334                 return 0 ;
15335         else
15336                 return 1 ;
15337 }
15338 EOCP
15339 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15340         echo "isblank() found." >&4
15341         val="$define"
15342 else
15343         echo "isblank() NOT found." >&4
15344         val="$undef"
15345 fi
15346 set d_isblank
15347 eval $setvar
15348 $rm -f isblank*
15349
15350 : see if isfinite exists
15351 set isfinite d_isfinite
15352 eval $inlibc
15353
15354 : see if isinf exists
15355 set isinf d_isinf
15356 eval $inlibc
15357
15358 : see if isnan exists
15359 set isnan d_isnan
15360 eval $inlibc
15361
15362 : see if isnanl exists
15363 set isnanl d_isnanl
15364 eval $inlibc
15365
15366 : see if killpg exists
15367 set killpg d_killpg
15368 eval $inlibc
15369
15370 : see if lchown exists
15371 echo " "
15372 $cat > try.c <<'EOCP'
15373 /* System header to define __stub macros and hopefully few prototypes,
15374     which can conflict with char lchown(); below.  */
15375 #include <assert.h>
15376 /* Override any gcc2 internal prototype to avoid an error.  */
15377 /* We use char because int might match the return type of a gcc2
15378    builtin and then its argument prototype would still apply.  */
15379 char lchown();
15380 int main() {
15381     /*  The GNU C library defines this for functions which it implements
15382         to always fail with ENOSYS.  Some functions are actually named
15383         something starting with __ and the normal name is an alias.  */
15384 #if defined (__stub_lchown) || defined (__stub___lchown)
15385 choke me
15386 #else
15387 lchown();
15388 #endif
15389 ; return 0; }
15390 EOCP
15391 set try
15392 if eval $compile; then
15393     $echo "lchown() found." >&4
15394     val="$define"
15395 else
15396     $echo "lchown() NOT found." >&4
15397     val="$undef"
15398 fi
15399 set d_lchown
15400 eval $setvar
15401
15402 : See if number of significant digits in a double precision number is known
15403 echo " "
15404 $cat >ldbl_dig.c <<EOM
15405 #$i_limits I_LIMITS
15406 #$i_float I_FLOAT
15407 #ifdef I_LIMITS
15408 #include <limits.h>
15409 #endif
15410 #ifdef I_FLOAT
15411 #include <float.h>
15412 #endif
15413 #ifdef LDBL_DIG
15414 printf("Contains LDBL_DIG");
15415 #endif
15416 EOM
15417 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15418 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15419         echo "LDBL_DIG found." >&4
15420         val="$define"
15421 else
15422         echo "LDBL_DIG NOT found." >&4
15423         val="$undef"
15424 fi
15425 $rm -f ldbl_dig.?
15426 set d_ldbl_dig
15427 eval $setvar
15428
15429 : see if this is a math.h system
15430 set math.h i_math
15431 eval $inhdr
15432
15433 : check to see if math.h defines _LIB_VERSION
15434 d_libm_lib_version="$undef"
15435 case $i_math in
15436     $define)
15437         echo " "
15438         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15439         $cat >try.c <<EOCP
15440 #include <unistd.h>
15441 #include <math.h>
15442 int main (int argc, char *argv[])
15443 {
15444     printf ("%d\n", _LIB_VERSION);
15445     return (0);
15446     } /* main */
15447 EOCP
15448         set try
15449         if eval $compile; then
15450             foo=`$run ./try`
15451             echo "Yes, it does ($foo)" >&4
15452             d_libm_lib_version="$define"
15453         else
15454             echo "No, it does not (probably harmless)" >&4
15455             fi
15456         $rm_try
15457         ;;
15458
15459     esac
15460
15461 : see if link exists
15462 set link d_link
15463 eval $inlibc
15464
15465 : see if localtime_r exists
15466 set localtime_r d_localtime_r
15467 eval $inlibc
15468 case "$d_localtime_r" in
15469 "$define")
15470         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15471         case "$d_localtime_r_proto:$usethreads" in
15472         ":define")      d_localtime_r_proto=define
15473                 set d_localtime_r_proto localtime_r $hdrs
15474                 eval $hasproto ;;
15475         *)      ;;
15476         esac
15477         case "$d_localtime_r_proto" in
15478         define)
15479         case "$localtime_r_proto" in
15480         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15481         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15482         esac
15483         case "$localtime_r_proto" in
15484         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15485         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15486         esac
15487         case "$localtime_r_proto" in
15488         ''|0)   d_localtime_r=undef
15489                 localtime_r_proto=0
15490                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15491         * )     case "$localtime_r_proto" in
15492                 REENTRANT_PROTO*) ;;
15493                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15494                 esac
15495                 echo "Prototype: $try" ;;
15496         esac
15497         ;;
15498         *)      case "$usethreads" in
15499                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15500                 esac
15501                 d_localtime_r=undef
15502                 localtime_r_proto=0
15503                 ;;
15504         esac
15505         ;;
15506 *)      localtime_r_proto=0
15507         ;;
15508 esac
15509
15510 : see if localtime_r calls tzset
15511 case "$localtime_r_proto" in
15512 REENTRANT_PROTO*)
15513         $cat >try.c <<EOCP
15514 /*  Does our libc's localtime_r call tzset ?
15515  *  return 0 if so, 1 otherwise.
15516  */
15517 #$i_systypes    I_SYS_TYPES
15518 #$i_unistd      I_UNISTD
15519 #$i_time        I_TIME
15520 #$i_stdlib      I_STDLIB
15521 #$i_string      I_STRING
15522 #$i_malloc      I_MALLOC
15523 #ifdef I_SYS_TYPES
15524 #  include <sys/types.h>
15525 #endif
15526 #ifdef I_UNISTD
15527 #  include <unistd.h>
15528 #endif
15529 #ifdef I_TIME
15530 #  include <time.h>
15531 #endif
15532 #ifdef I_STDLIB
15533 #include <stdlib.h>
15534 #endif
15535 #ifdef I_STRING
15536 #  include <string.h>
15537 #else
15538 #  include <strings.h>
15539 #endif
15540 #ifdef I_MALLOC
15541 #  include <malloc.h>
15542 #endif
15543 int main()
15544 {
15545     time_t t = time(0L);
15546     char w_tz[]="TZ" "=GMT+5",
15547          e_tz[]="TZ" "=GMT-5",
15548         *tz_e = (char*)malloc(16),
15549         *tz_w = (char*)malloc(16);
15550     struct tm tm_e, tm_w;
15551     memset(&tm_e,'\0',sizeof(struct tm));
15552     memset(&tm_w,'\0',sizeof(struct tm));
15553     strcpy(tz_e,e_tz);
15554     strcpy(tz_w,w_tz);
15555
15556     putenv(tz_e);
15557     localtime_r(&t, &tm_e);
15558
15559     putenv(tz_w);
15560     localtime_r(&t, &tm_w);
15561
15562     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15563         return 1;
15564     return 0;
15565 }
15566 EOCP
15567         set try
15568         if eval $compile; then
15569             if $run ./try; then
15570                 d_localtime_r_needs_tzset=undef;
15571             else
15572                 d_localtime_r_needs_tzset=define;
15573             fi;
15574         else
15575             d_localtime_r_needs_tzset=undef;
15576         fi;
15577      ;;
15578   *)
15579      d_localtime_r_needs_tzset=undef;
15580      ;;
15581 esac
15582 $rm_try
15583
15584 : see if localeconv exists
15585 set localeconv d_locconv
15586 eval $inlibc
15587
15588 : see if lockf exists
15589 set lockf d_lockf
15590 eval $inlibc
15591
15592 : see if prototype for lseek is available
15593 echo " "
15594 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15595 eval $hasproto
15596
15597 : see if lstat exists
15598 set lstat d_lstat
15599 eval $inlibc
15600
15601 : see if madvise exists
15602 set madvise d_madvise
15603 eval $inlibc
15604
15605 : see if malloc_size exists
15606 set malloc_size d_malloc_size
15607 eval $inlibc
15608
15609 : see if malloc_size_good exists
15610 set malloc_good_size d_malloc_good_size
15611 eval $inlibc
15612
15613 : see if mblen exists
15614 set mblen d_mblen
15615 eval $inlibc
15616
15617 : see if mbstowcs exists
15618 set mbstowcs d_mbstowcs
15619 eval $inlibc
15620
15621 : see if mbtowc exists
15622 set mbtowc d_mbtowc
15623 eval $inlibc
15624
15625 : see if memchr exists
15626 set memchr d_memchr
15627 eval $inlibc
15628
15629 : see if memcmp exists
15630 set memcmp d_memcmp
15631 eval $inlibc
15632
15633 : see if memcpy exists
15634 set memcpy d_memcpy
15635 eval $inlibc
15636
15637 : see if memmove exists
15638 set memmove d_memmove
15639 eval $inlibc
15640
15641 : see if memset exists
15642 set memset d_memset
15643 eval $inlibc
15644
15645 : see if mkdir exists
15646 set mkdir d_mkdir
15647 eval $inlibc
15648
15649 : see if mkdtemp exists
15650 set mkdtemp d_mkdtemp
15651 eval $inlibc
15652
15653 : see if mkfifo exists
15654 set mkfifo d_mkfifo
15655 eval $inlibc
15656
15657 : see if mkstemp exists
15658 set mkstemp d_mkstemp
15659 eval $inlibc
15660
15661 : see if mkstemps exists
15662 set mkstemps d_mkstemps
15663 eval $inlibc
15664
15665 : see if mktime exists
15666 set mktime d_mktime
15667 eval $inlibc
15668
15669 : see if this is a sys/mman.h system
15670 set sys/mman.h i_sysmman
15671 eval $inhdr
15672
15673 : see if mmap exists
15674 set mmap d_mmap
15675 eval $inlibc
15676 : see what shmat returns
15677 : default to something harmless
15678 mmaptype='void *'
15679 case "$i_sysmman$d_mmap" in
15680 "$define$define")
15681         $cat >mmap.c <<'END'
15682 #include <sys/mman.h>
15683 void *mmap();
15684 END
15685         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15686                 mmaptype='void *'
15687         else
15688                 mmaptype='caddr_t'
15689         fi
15690         echo "and it returns ($mmaptype)." >&4
15691         ;;
15692 esac
15693
15694
15695
15696 : see if sqrtl exists
15697 set sqrtl d_sqrtl
15698 eval $inlibc
15699
15700 : see if scalbnl exists
15701 set scalbnl d_scalbnl
15702 eval $inlibc
15703
15704 : see if modfl exists
15705 set modfl d_modfl
15706 eval $inlibc
15707
15708 : see if prototype for modfl is available
15709 echo " "
15710 set d_modflproto modfl $i_math math.h
15711 eval $hasproto
15712
15713 d_modfl_pow32_bug="$undef"
15714
15715 case "$d_longdbl$d_modfl" in
15716 $define$define)
15717         $cat <<EOM
15718 Checking to see whether your modfl() is okay for large values...
15719 EOM
15720 $cat >try.c <<EOCP
15721 #include <math.h>
15722 #include <stdio.h>
15723 EOCP
15724 if $test "X$d_modflproto" != "X$define"; then
15725         $cat >>try.c <<EOCP
15726 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15727 long double modfl (long double, long double *);
15728 EOCP
15729 fi
15730 $cat >>try.c <<EOCP
15731 int main() {
15732     long double nv = 4294967303.15;
15733     long double v, w;
15734     v = modfl(nv, &w);
15735 #ifdef __GLIBC__
15736     printf("glibc");
15737 #endif
15738     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15739     return 0;
15740 }
15741 EOCP
15742         case "$osname:$gccversion" in
15743         aix:)   saveccflags="$ccflags"
15744                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15745         esac
15746         set try
15747         if eval $compile; then
15748                 foo=`$run ./try`
15749                 case "$foo" in
15750                 *" 4294967303.150000 1.150000 4294967302.000000")
15751                         echo >&4 "Your modfl() is broken for large values."
15752                         d_modfl_pow32_bug="$define"
15753                         case "$foo" in
15754                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15755                         ;;
15756                         esac
15757                         ;;
15758                 *" 4294967303.150000 0.150000 4294967303.000000")
15759                         echo >&4 "Your modfl() seems okay for large values."
15760                         ;;
15761                 *)      echo >&4 "I don't understand your modfl() at all."
15762                         d_modfl="$undef"
15763                         ;;
15764                 esac
15765                 $rm_try
15766         else
15767                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15768                 d_modfl="$undef"
15769         fi
15770         case "$osname:$gccversion" in
15771         aix:)   ccflags="$saveccflags" ;; # restore
15772         esac
15773         ;;
15774 esac
15775
15776 if $test "$uselongdouble" = "$define"; then
15777     message=""
15778     if $test "$d_sqrtl" != "$define"; then
15779         message="$message sqrtl"
15780     fi
15781     if $test "$d_modfl" != "$define"; then
15782         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15783             echo "You have both aintl and copysignl, so I can emulate modfl."
15784         else
15785             message="$message modfl"
15786         fi
15787     fi
15788     if $test "$d_frexpl" != "$define"; then
15789         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15790             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15791         else
15792             message="$message frexpl"
15793         fi
15794     fi
15795
15796     if $test "$message" != ""; then
15797         $cat <<EOM >&4
15798
15799 *** You requested the use of long doubles but you do not seem to have
15800 *** the following mathematical functions needed for long double support:
15801 ***    $message
15802 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15803 *** Cannot continue, aborting.
15804
15805 EOM
15806
15807         exit 1
15808     fi
15809 fi
15810
15811 : see if mprotect exists
15812 set mprotect d_mprotect
15813 eval $inlibc
15814
15815 : see if msgctl exists
15816 set msgctl d_msgctl
15817 eval $inlibc
15818
15819 : see if msgget exists
15820 set msgget d_msgget
15821 eval $inlibc
15822
15823 : see if msgsnd exists
15824 set msgsnd d_msgsnd
15825 eval $inlibc
15826
15827 : see if msgrcv exists
15828 set msgrcv d_msgrcv
15829 eval $inlibc
15830
15831 : see how much of the 'msg*(2)' library is present.
15832 h_msg=true
15833 echo " "
15834 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15835 *"$undef"*) h_msg=false;;
15836 esac
15837 case "$osname" in
15838 freebsd)
15839     case "`ipcs 2>&1`" in
15840     "SVID messages"*"not configured"*)
15841         echo "Your $osname does not have the msg*(2) configured." >&4
15842         h_msg=false
15843         val="$undef"
15844         set msgctl d_msgctl
15845         eval $setvar
15846         set msgget d_msgget
15847         eval $setvar
15848         set msgsnd d_msgsnd
15849         eval $setvar
15850         set msgrcv d_msgrcv
15851         eval $setvar
15852         ;;
15853     esac
15854     ;;
15855 esac
15856 : we could also check for sys/ipc.h ...
15857 if $h_msg && $test `./findhdr sys/msg.h`; then
15858         echo "You have the full msg*(2) library." >&4
15859         val="$define"
15860 else
15861         echo "You don't have the full msg*(2) library." >&4
15862         val="$undef"
15863 fi
15864 set d_msg
15865 eval $setvar
15866
15867 : Check for msghdr_s
15868 echo " "
15869 echo "Checking to see if your system supports struct msghdr..." >&4
15870 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15871 eval $hasstruct
15872 case "$d_msghdr_s" in
15873 "$define")      echo "Yes, it does."   ;;
15874 *)              echo "No, it doesn't." ;;
15875 esac
15876
15877
15878 : see if msync exists
15879 set msync d_msync
15880 eval $inlibc
15881
15882 : see if munmap exists
15883 set munmap d_munmap
15884 eval $inlibc
15885
15886 : see if nice exists
15887 set nice d_nice
15888 eval $inlibc
15889
15890 : see if this is a langinfo.h system
15891 set langinfo.h i_langinfo
15892 eval $inhdr
15893
15894 : see if nl_langinfo exists
15895 set nl_langinfo d_nl_langinfo
15896 eval $inlibc
15897
15898 : check for volatile keyword
15899 echo " "
15900 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15901 $cat >try.c <<'EOCP'
15902 int main()
15903 {
15904         typedef struct _goo_struct goo_struct;
15905         goo_struct * volatile goo = ((goo_struct *)0);
15906         struct _goo_struct {
15907                 long long_int;
15908                 int reg_int;
15909                 char char_var;
15910         };
15911         typedef unsigned short foo_t;
15912         char *volatile foo;
15913         volatile int bar;
15914         volatile foo_t blech;
15915         foo = foo;
15916 }
15917 EOCP
15918 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15919         val="$define"
15920         echo "Yup, it does."
15921 else
15922         val="$undef"
15923         echo "Nope, it doesn't."
15924 fi
15925 set d_volatile
15926 eval $setvar
15927 $rm_try
15928
15929 : Check basic sizes
15930 echo " "
15931 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15932
15933 case "$use64bitint:$d_quad:$quadtype" in
15934 define:define:?*)
15935         ivtype="$quadtype"
15936         uvtype="$uquadtype"
15937         ivsize=8
15938         uvsize=8
15939         ;;
15940 *)      ivtype="long"
15941         uvtype="unsigned long"
15942         ivsize=$longsize
15943         uvsize=$longsize
15944         ;;
15945 esac
15946
15947 case "$uselongdouble:$d_longdbl" in
15948 define:define)
15949         nvtype="long double"
15950         nvsize=$longdblsize
15951         ;;
15952 *)      nvtype=double
15953         nvsize=$doublesize
15954         ;;
15955 esac
15956
15957 $echo "(IV will be "$ivtype", $ivsize bytes)"
15958 $echo "(UV will be "$uvtype", $uvsize bytes)"
15959 $echo "(NV will be "$nvtype", $nvsize bytes)"
15960
15961 $cat >try.c <<EOCP
15962 #$i_inttypes I_INTTYPES
15963 #ifdef I_INTTYPES
15964 #include <inttypes.h>
15965 #endif
15966 #include <stdio.h>
15967 int main() {
15968 #ifdef INT8
15969    int8_t i =  INT8_MAX;
15970   uint8_t u = UINT8_MAX;
15971   printf("int8_t\n");
15972 #endif
15973 #ifdef INT16
15974    int16_t i =  INT16_MAX;
15975   uint16_t u = UINT16_MAX;
15976   printf("int16_t\n");
15977 #endif
15978 #ifdef INT32
15979    int32_t i =  INT32_MAX;
15980   uint32_t u = UINT32_MAX;
15981   printf("int32_t\n");
15982 #endif
15983 }
15984 EOCP
15985
15986 i8type="signed char"
15987 u8type="unsigned char"
15988 i8size=1
15989 u8size=1
15990
15991 case "$i16type" in
15992 '')     case "$shortsize" in
15993         2)      i16type=short
15994                 u16type="unsigned short"
15995                 i16size=$shortsize
15996                 u16size=$shortsize
15997                 ;;
15998         esac
15999         ;;
16000 esac
16001 case "$i16type" in
16002 '')     set try -DINT16
16003         if eval $compile; then
16004                 case "`$run ./try`" in
16005                 int16_t)
16006                         i16type=int16_t
16007                         u16type=uint16_t
16008                         i16size=2
16009                         u16size=2
16010                         ;;
16011                 esac
16012         fi
16013         ;;
16014 esac
16015 case "$i16type" in
16016 '')     if $test $shortsize -ge 2; then
16017                 i16type=short
16018                 u16type="unsigned short"
16019                 i16size=$shortsize
16020                 u16size=$shortsize
16021         fi
16022         ;;
16023 esac
16024
16025 case "$i32type" in
16026 '')     case "$longsize" in
16027         4)      i32type=long
16028                 u32type="unsigned long"
16029                 i32size=$longsize
16030                 u32size=$longsize
16031                 ;;
16032         *)      case "$intsize" in
16033                 4)      i32type=int
16034                         u32type="unsigned int"
16035                         i32size=$intsize
16036                         u32size=$intsize
16037                         ;;
16038                 esac
16039                 ;;
16040         esac
16041         ;;
16042 esac
16043 case "$i32type" in
16044 '')     set try -DINT32
16045         if eval $compile; then
16046                 case "`$run ./try`" in
16047                 int32_t)
16048                         i32type=int32_t
16049                         u32type=uint32_t
16050                         i32size=4
16051                         u32size=4
16052                         ;;
16053                 esac
16054         fi
16055         ;;
16056 esac
16057 case "$i32type" in
16058 '')     if $test $intsize -ge 4; then
16059                 i32type=int
16060                 u32type="unsigned int"
16061                 i32size=$intsize
16062                 u32size=$intsize
16063         fi
16064         ;;
16065 esac
16066
16067 case "$i64type" in
16068 '')     case "$d_quad:$quadtype" in
16069         define:?*)
16070                 i64type="$quadtype"
16071                 u64type="$uquadtype"
16072                 i64size=8
16073                 u64size=8
16074                 ;;
16075         esac
16076         ;;
16077 esac
16078
16079 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16080 : volatile so that the compiler has to store it out to memory.
16081 if test X"$d_volatile" = X"$define"; then
16082         volatile=volatile
16083 fi
16084 $cat <<EOP >try.c
16085 #include <stdio.h>
16086 #$i_stdlib I_STDLIB
16087 #ifdef I_STDLIB
16088 #include <stdlib.h>
16089 #endif
16090 #include <sys/types.h>
16091 #include <signal.h>
16092 #ifdef SIGFPE
16093 $volatile int bletched = 0;
16094 $signal_t blech(int s) { bletched = 1; }
16095 #endif
16096 int main() {
16097     $uvtype u = 0;
16098     $nvtype d;
16099     int     n = 8 * $uvsize;
16100     int     i;
16101 #ifdef SIGFPE
16102     signal(SIGFPE, blech);
16103 #endif
16104
16105     for (i = 0; i < n; i++) {
16106       u = u << 1 | ($uvtype)1;
16107       d = ($nvtype)u;
16108       if (($uvtype)d != u)
16109         break;
16110       if (d <= 0)
16111         break;
16112       d = ($nvtype)(u - 1);
16113       if (($uvtype)d != (u - 1))
16114         break;
16115 #ifdef SIGFPE
16116       if (bletched)
16117         break;
16118 #endif
16119     }
16120     printf("%d\n", ((i == n) ? -n : i));
16121     exit(0);
16122 }
16123 EOP
16124 set try
16125
16126 d_nv_preserves_uv="$undef"
16127 if eval $compile; then
16128         nv_preserves_uv_bits="`$run ./try`"
16129 fi
16130 case "$nv_preserves_uv_bits" in
16131 \-[1-9]*)
16132         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16133         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16134         d_nv_preserves_uv="$define"
16135         ;;
16136 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16137         d_nv_preserves_uv="$undef" ;;
16138 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16139         nv_preserves_uv_bits="0" ;;
16140 esac
16141 $rm_try
16142
16143 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16144 : volatile so that the compiler has to store it out to memory.
16145 if test X"$d_volatile" = X"$define"; then
16146         volatile=volatile
16147 fi
16148 $cat <<EOP >try.c
16149 #include <stdio.h>
16150
16151 typedef $nvtype NV;
16152
16153 int
16154 main() {
16155   NV value = 2;
16156   int count = 1;
16157
16158   while(count < 256) {
16159     $volatile NV up = value + 1.0;
16160     $volatile NV negated = -value;
16161     $volatile NV down = negated - 1.0;
16162     $volatile NV got_up = up - value;
16163     int up_good = got_up == 1.0;
16164     int got_down = down - negated;
16165     int down_good = got_down == -1.0;
16166
16167     if (down_good != up_good) {
16168       fprintf(stderr,
16169               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16170               up_good, (double) got_up, down_good, (double) got_down,
16171               count, (double) value);
16172       return 1;
16173     }
16174     if (!up_good) {
16175       while (1) {
16176         if (count > 8) {
16177           count -= 8;
16178           fputs("256.0", stdout);
16179         } else {
16180           count--;
16181           fputs("2.0", stdout);
16182         }
16183         if (!count) {
16184           puts("");
16185           return 0;
16186         }
16187         fputs("*", stdout);
16188       }
16189     }
16190     value *= 2;
16191     ++count;
16192   }
16193   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16194           count, (double) value);
16195   return 1;
16196 }
16197 EOP
16198 set try
16199
16200 nv_overflows_integers_at='0'
16201 if eval $compile; then
16202     xxx="`$run ./try`"
16203     case "$?" in
16204         0)
16205             case "$xxx" in
16206                 2*)  cat >&4 <<EOM
16207 The largest integer your NVs can preserve is equal to $xxx
16208 EOM
16209                     nv_overflows_integers_at="$xxx"
16210                     ;;
16211                 *)  cat >&4 <<EOM
16212 Cannot determine the largest integer value your NVs can hold, unexpected output
16213 '$xxx'
16214 EOM
16215                     ;;
16216             esac
16217             ;;
16218         *)  cat >&4 <<EOM
16219 Cannot determine the largest integer value your NVs can hold
16220 EOM
16221             ;;
16222     esac
16223 fi
16224 $rm_try
16225
16226 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16227 : volatile so that the compiler has to store it out to memory.
16228 if test X"$d_volatile" = X"$define"; then
16229         volatile=volatile
16230 fi
16231 $cat <<EOP >try.c
16232 #include <stdio.h>
16233 #$i_stdlib I_STDLIB
16234 #ifdef I_STDLIB
16235 #include <stdlib.h>
16236 #endif
16237 #$i_string I_STRING
16238 #ifdef I_STRING
16239 #  include <string.h>
16240 #else
16241 #  include <strings.h>
16242 #endif
16243 #include <sys/types.h>
16244 #include <signal.h>
16245 #ifdef SIGFPE
16246 $volatile int bletched = 0;
16247 $signal_t blech(int s) { bletched = 1; }
16248 #endif
16249
16250 int checkit($nvtype d, char *where) {
16251     unsigned char *p = (char *)&d;
16252     unsigned char *end = p + sizeof(d);
16253     int fail = 0;
16254
16255     while (p < end)
16256         fail += *p++;
16257
16258     if (!fail)
16259         return 0;
16260
16261     p = (char *)&d;
16262     printf("No - %s: 0x", where);
16263     while (p < end)
16264         printf ("%02X", *p++);
16265     printf("\n");
16266     return 1;
16267 }
16268
16269 int main(int argc, char **argv) {
16270     $nvtype d = 0.0;
16271     int fail = 0;
16272     fail += checkit(d, "0.0");
16273
16274     /* The compiler shouldn't be assuming that bletched is 0  */
16275     d = bletched;
16276
16277     fail += checkit(d, "bleched");
16278
16279 #ifdef SIGFPE
16280     signal(SIGFPE, blech);
16281 #endif
16282
16283     /* Paranoia - the compiler should have no way of knowing that ANSI says
16284        that argv[argc] will always be NULL.  Actually, if it did assume this it
16285        would be buggy, as this is C and main() can be called from elsewhere in
16286        the program.  */
16287     d = argv[argc] ? 1 : 0;
16288
16289     if (d) {
16290         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16291     }
16292
16293     fail += checkit(d, "ternary");
16294
16295     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16296
16297     if (d != 0.0) {
16298         printf("No - memset doesn't give 0.0\n");
16299         /* This might just blow up:  */
16300         printf("(gives %g)\n", d);
16301         return 1;
16302     }
16303
16304 #ifdef SIGFPE
16305     if (bletched) {
16306         printf("No - something bleched\n");
16307         return 1;
16308     }
16309 #endif
16310     if (fail) {
16311       printf("No - %d fail(s)\n", fail);
16312       return 1;
16313     }
16314     printf("Yes\n");
16315     return 0;
16316 }
16317 EOP
16318 set try
16319
16320 d_nv_zero_is_allbits_zero="$undef"
16321 if eval $compile; then
16322     xxx="`$run ./try`"
16323     case "$?" in
16324         0)
16325             case "$xxx" in
16326                 Yes)  cat >&4 <<EOM
16327 0.0 is represented as all bits zero in memory
16328 EOM
16329                     d_nv_zero_is_allbits_zero="$define"
16330                     ;;
16331                 *)  cat >&4 <<EOM
16332 0.0 is not represented as all bits zero in memory
16333 EOM
16334                     d_nv_zero_is_allbits_zero="$undef"
16335                     ;;
16336             esac
16337             ;;
16338         *)  cat >&4 <<EOM
16339 0.0 is not represented as all bits zero in memory
16340 EOM
16341             d_nv_zero_is_allbits_zero="$undef"
16342             ;;
16343     esac
16344 fi
16345 $rm_try
16346
16347 : check for off64_t
16348 echo " "
16349 echo "Checking to see if you have off64_t..." >&4
16350 $cat >try.c <<EOCP
16351 #include <sys/types.h>
16352 #include <unistd.h>
16353 int main() { off64_t x = 7; }
16354 EOCP
16355 set try
16356 if eval $compile; then
16357         val="$define"
16358         echo "You have off64_t."
16359 else
16360         val="$undef"
16361         echo "You do not have off64_t."
16362         case "$lseeksize" in
16363         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16364         esac
16365 fi
16366 $rm_try
16367 set d_off64_t
16368 eval $setvar
16369
16370 : how to create joinable pthreads
16371 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16372         echo " "
16373         echo "Checking what constant to use for creating joinable pthreads..." >&4
16374         $cat >try.c <<'EOCP'
16375 #include <pthread.h>
16376 int main() {
16377     int detachstate = JOINABLE;
16378 }
16379 EOCP
16380         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16381         if eval $compile; then
16382                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16383                 val="$undef" # Yes, undef.
16384                 set d_old_pthread_create_joinable
16385                 eval $setvar
16386                 val=""
16387                 set old_pthread_create_joinable
16388                 eval $setvar
16389         else
16390                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16391                 if eval $compile; then
16392                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16393                         val="$define"
16394                         set d_old_pthread_create_joinable
16395                         eval $setvar
16396                         val=PTHREAD_CREATE_UNDETACHED
16397                         set old_pthread_create_joinable
16398                         eval $setvar
16399                 else
16400                         set try -DJOINABLE=__UNDETACHED
16401                         if eval $compile; then
16402                                 echo "You seem to use __UNDETACHED." >&4
16403                                 val="$define"
16404                                 set d_old_pthread_create_joinable
16405                                 eval $setvar
16406                                 val=__UNDETACHED
16407                                 set old_pthread_create_joinable
16408                                 eval $setvar
16409                         else
16410                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16411                                 val="$define"
16412                                 set d_old_pthread_create_joinable
16413                                 eval $setvar
16414                                 val=0
16415                                 set old_pthread_create_joinable
16416                                 eval $setvar
16417                         fi
16418                 fi
16419         fi
16420         $rm_try
16421 else
16422     d_old_pthread_create_joinable="$undef"
16423     old_pthread_create_joinable=""
16424 fi
16425
16426 : see if pause exists
16427 set pause d_pause
16428 eval $inlibc
16429
16430 : see if poll exists
16431 set poll d_poll
16432 eval $inlibc
16433
16434 : see if prctl exists
16435 set prctl d_prctl
16436 eval $inlibc
16437
16438 : see if prctl supports PR_SET_NAME
16439 d_prctl_set_name=$undef
16440 case $d_prctl in
16441     $define)
16442         $cat >try.c <<EOM
16443 #include <sys/prctl.h>
16444
16445 int main (int argc, char *argv[])
16446 {
16447     return (prctl (PR_SET_NAME, "Test"));
16448     } /* main */
16449 EOM
16450         set try
16451         if eval $compile_ok && $run ./try; then
16452             echo "Your prctl (PR_SET_NAME, ...) works"
16453             d_prctl_set_name=$define
16454             fi
16455         $rm_try
16456         ;;
16457     esac
16458
16459 : see if readlink exists
16460 set readlink d_readlink
16461 eval $inlibc
16462
16463 : Check if exe is symlink to abs path of executing program
16464 echo " "
16465 procselfexe=''
16466 val="$undef"
16467 case "$d_readlink" in
16468     "$define")
16469         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16470         : more tidy to avoid an extra level of symlink
16471         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16472         while test $# -gt 0; do
16473             type=$1; try=$2
16474             shift; shift
16475             if $issymlink $try; then
16476                 $ls -l $try > reflect
16477                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16478                     echo "You have $type-like $try."
16479                     procselfexe='"'$try'"'
16480                     val="$define"
16481                     : This will break out of the loop
16482                     set X; shift
16483                 fi
16484             fi
16485         done
16486         ;;
16487 esac
16488 $rm -f reflect
16489 set d_procselfexe
16490 eval $setvar
16491
16492 : backward compatibility for d_hvfork
16493 if test X$d_hvfork != X; then
16494         d_vfork="$d_hvfork"
16495         d_hvfork=''
16496 fi
16497 : see if there is a vfork
16498 val=''
16499 set vfork val
16500 eval $inlibc
16501
16502 d_pseudofork=$undef
16503
16504 : Ok, but do we want to use it. vfork is reportedly unreliable in
16505 : perl on Solaris 2.x, and probably elsewhere.
16506 case "$val" in
16507 $define)
16508         echo " "
16509         case "$usevfork" in
16510         false) dflt='n';;
16511         *) dflt='y';;
16512         esac
16513         cat <<'EOM'
16514
16515 Perl can only use a vfork() that doesn't suffer from strict
16516 restrictions on calling functions or modifying global data in
16517 the child.  For example, glibc-2.1 contains such a vfork()
16518 that is unsuitable.  If your system provides a proper fork()
16519 call, chances are that you do NOT want perl to use vfork().
16520
16521 EOM
16522         rp="Do you still want to use vfork()?"
16523         . ./myread
16524         case "$ans" in
16525         y|Y) ;;
16526         *)
16527                 echo "Ok, we won't use vfork()."
16528                 val="$undef"
16529                 ;;
16530         esac
16531         ;;
16532 esac
16533 set d_vfork
16534 eval $setvar
16535 case "$d_vfork" in
16536 $define) usevfork='true';;
16537 *) usevfork='false';;
16538 esac
16539
16540 : see whether the pthread_atfork exists
16541 $cat >try.c <<EOP
16542 #include <pthread.h>
16543 #include <stdio.h>
16544 int main() {
16545 #ifdef  PTHREAD_ATFORK
16546         pthread_atfork(NULL,NULL,NULL);
16547 #endif
16548 }
16549 EOP
16550
16551 : see if pthread_atfork exists
16552 set try -DPTHREAD_ATFORK
16553 if eval $compile; then
16554     val="$define"
16555 else
16556     val="$undef"
16557 fi
16558 case "$usethreads" in
16559 $define)
16560         case "$val" in
16561         $define) echo 'pthread_atfork found.' >&4        ;;
16562         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16563         esac
16564 esac
16565 set d_pthread_atfork
16566 eval $setvar
16567
16568 : see if pthread_attr_setscope exists
16569 set pthread_attr_setscope d_pthread_attr_setscope
16570 eval $inlibc
16571
16572 : see whether the various POSIXish _yields exist
16573 $cat >try.c <<EOP
16574 #include <pthread.h>
16575 #include <stdio.h>
16576 int main() {
16577 #ifdef SCHED_YIELD
16578         sched_yield();
16579 #else
16580 #ifdef PTHREAD_YIELD
16581         pthread_yield();
16582 #else
16583 #ifdef PTHREAD_YIELD_NULL
16584         pthread_yield(NULL);
16585 #endif
16586 #endif
16587 #endif
16588 }
16589 EOP
16590 : see if sched_yield exists
16591 set try -DSCHED_YIELD
16592 if eval $compile; then
16593     val="$define"
16594     sched_yield='sched_yield()'
16595 else
16596     val="$undef"
16597 fi
16598 case "$usethreads" in
16599 $define)
16600         case "$val" in
16601         $define) echo 'sched_yield() found.' >&4        ;;
16602         *)       echo 'sched_yield() NOT found.' >&4    ;;
16603         esac
16604 esac
16605 set d_sched_yield
16606 eval $setvar
16607
16608 : see if pthread_yield exists
16609 set try -DPTHREAD_YIELD
16610 if eval $compile; then
16611     val="$define"
16612     case "$sched_yield" in
16613     '') sched_yield='pthread_yield()' ;;
16614     esac
16615 else
16616     set try -DPTHREAD_YIELD_NULL
16617     if eval $compile; then
16618         val="$define"
16619         case "$sched_yield" in
16620         '') sched_yield='pthread_yield(NULL)' ;;
16621         esac
16622     else
16623         val="$undef"
16624     fi
16625 fi
16626 case "$usethreads" in
16627 $define)
16628         case "$val" in
16629         $define) echo 'pthread_yield() found.' >&4      ;;
16630         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16631         esac
16632         ;;
16633 esac
16634 set d_pthread_yield
16635 eval $setvar
16636 case "$sched_yield" in
16637 '') sched_yield=undef ;;
16638 esac
16639 $rm_try
16640
16641 : see if random_r exists
16642 set random_r d_random_r
16643 eval $inlibc
16644 case "$d_random_r" in
16645 "$define")
16646         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16647         case "$d_random_r_proto:$usethreads" in
16648         ":define")      d_random_r_proto=define
16649                 set d_random_r_proto random_r $hdrs
16650                 eval $hasproto ;;
16651         *)      ;;
16652         esac
16653         case "$d_random_r_proto" in
16654         define)
16655         case "$random_r_proto" in
16656         ''|0) try='int random_r(int*, struct random_data*);'
16657         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16658         esac
16659         case "$random_r_proto" in
16660         ''|0) try='int random_r(long*, struct random_data*);'
16661         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16662         esac
16663         case "$random_r_proto" in
16664         ''|0) try='int random_r(struct random_data*, int32_t*);'
16665         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16666         esac
16667         case "$random_r_proto" in
16668         ''|0)   d_random_r=undef
16669                 random_r_proto=0
16670                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16671         * )     case "$random_r_proto" in
16672                 REENTRANT_PROTO*) ;;
16673                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16674                 esac
16675                 echo "Prototype: $try" ;;
16676         esac
16677         ;;
16678         *)      case "$usethreads" in
16679                 define) echo "random_r has no prototype, not using it." >&4 ;;
16680                 esac
16681                 d_random_r=undef
16682                 random_r_proto=0
16683                 ;;
16684         esac
16685         ;;
16686 *)      random_r_proto=0
16687         ;;
16688 esac
16689
16690 : see if readdir and friends exist
16691 set readdir d_readdir
16692 eval $inlibc
16693 set seekdir d_seekdir
16694 eval $inlibc
16695 set telldir d_telldir
16696 eval $inlibc
16697 set rewinddir d_rewinddir
16698 eval $inlibc
16699
16700 : see if readdir64_r exists
16701 set readdir64_r d_readdir64_r
16702 eval $inlibc
16703 case "$d_readdir64_r" in
16704 "$define")
16705         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16706         case "$d_readdir64_r_proto:$usethreads" in
16707         ":define")      d_readdir64_r_proto=define
16708                 set d_readdir64_r_proto readdir64_r $hdrs
16709                 eval $hasproto ;;
16710         *)      ;;
16711         esac
16712         case "$d_readdir64_r_proto" in
16713         define)
16714         case "$readdir64_r_proto" in
16715         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16716         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16717         esac
16718         case "$readdir64_r_proto" in
16719         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16720         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16721         esac
16722         case "$readdir64_r_proto" in
16723         ''|0)   d_readdir64_r=undef
16724                 readdir64_r_proto=0
16725                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16726         * )     case "$readdir64_r_proto" in
16727                 REENTRANT_PROTO*) ;;
16728                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16729                 esac
16730                 echo "Prototype: $try" ;;
16731         esac
16732         ;;
16733         *)      case "$usethreads" in
16734                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16735                 esac
16736                 d_readdir64_r=undef
16737                 readdir64_r_proto=0
16738                 ;;
16739         esac
16740         ;;
16741 *)      readdir64_r_proto=0
16742         ;;
16743 esac
16744
16745 : see if readdir_r exists
16746 set readdir_r d_readdir_r
16747 eval $inlibc
16748 case "$d_readdir_r" in
16749 "$define")
16750         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16751         case "$d_readdir_r_proto:$usethreads" in
16752         ":define")      d_readdir_r_proto=define
16753                 set d_readdir_r_proto readdir_r $hdrs
16754                 eval $hasproto ;;
16755         *)      ;;
16756         esac
16757         case "$d_readdir_r_proto" in
16758         define)
16759         case "$readdir_r_proto" in
16760         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16761         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16762         esac
16763         case "$readdir_r_proto" in
16764         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16765         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16766         esac
16767         case "$readdir_r_proto" in
16768         ''|0)   d_readdir_r=undef
16769                 readdir_r_proto=0
16770                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16771         * )     case "$readdir_r_proto" in
16772                 REENTRANT_PROTO*) ;;
16773                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16774                 esac
16775                 echo "Prototype: $try" ;;
16776         esac
16777         ;;
16778         *)      case "$usethreads" in
16779                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16780                 esac
16781                 d_readdir_r=undef
16782                 readdir_r_proto=0
16783                 ;;
16784         esac
16785         ;;
16786 *)      readdir_r_proto=0
16787         ;;
16788 esac
16789
16790 : see if readv exists
16791 set readv d_readv
16792 eval $inlibc
16793
16794 : see if recvmsg exists
16795 set recvmsg d_recvmsg
16796 eval $inlibc
16797
16798 : see if rename exists
16799 set rename d_rename
16800 eval $inlibc
16801
16802 : see if rmdir exists
16803 set rmdir d_rmdir
16804 eval $inlibc
16805
16806 : see if memory.h is available.
16807 val=''
16808 set memory.h val
16809 eval $inhdr
16810
16811 : See if it conflicts with string.h
16812 case "$val" in
16813 $define)
16814         case "$strings" in
16815         '') ;;
16816         *)
16817                 $cppstdin $cppflags $cppminus < $strings > mem.h
16818                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16819                         echo " "
16820                         echo "We won't be including <memory.h>."
16821                         val="$undef"
16822                 fi
16823                 $rm -f mem.h
16824                 ;;
16825         esac
16826 esac
16827 set i_memory
16828 eval $setvar
16829
16830 : can bcopy handle overlapping blocks?
16831 echo " "
16832 val="$undef"
16833 case "$d_memmove" in
16834 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16835 *)      case "$d_bcopy" in
16836         "$define")
16837                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16838                 $cat >try.c <<EOCP
16839 #$i_memory I_MEMORY
16840 #$i_stdlib I_STDLIB
16841 #$i_string I_STRING
16842 #$i_unistd I_UNISTD
16843 EOCP
16844         $cat >>try.c <<'EOCP'
16845 #include <stdio.h>
16846 #ifdef I_MEMORY
16847 #  include <memory.h>
16848 #endif
16849 #ifdef I_STDLIB
16850 #  include <stdlib.h>
16851 #endif
16852 #ifdef I_STRING
16853 #  include <string.h>
16854 #else
16855 #  include <strings.h>
16856 #endif
16857 #ifdef I_UNISTD
16858 #  include <unistd.h>  /* Needed for NetBSD */
16859 #endif
16860 int main()
16861 {
16862 char buf[128], abc[128];
16863 char *b;
16864 int len;
16865 int off;
16866 int align;
16867
16868 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16869    try to store the string in read-only memory. */
16870 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16871
16872 for (align = 7; align >= 0; align--) {
16873         for (len = 36; len; len--) {
16874                 b = buf+align;
16875                 bcopy(abc, b, len);
16876                 for (off = 1; off <= len; off++) {
16877                         bcopy(b, b+off, len);
16878                         bcopy(b+off, b, len);
16879                         if (bcmp(b, abc, len))
16880                                 exit(1);
16881                 }
16882         }
16883 }
16884 exit(0);
16885 }
16886 EOCP
16887                 set try
16888                 if eval $compile_ok; then
16889                         if $run ./try 2>/dev/null; then
16890                                 echo "Yes, it can."
16891                                 val="$define"
16892                         else
16893                                 echo "It can't, sorry."
16894                         fi
16895                 else
16896                         echo "(I can't compile the test program, so we'll assume not...)"
16897                 fi
16898                 ;;
16899         esac
16900         $rm_try
16901         ;;
16902 esac
16903 set d_safebcpy
16904 eval $setvar
16905
16906 : can memcpy handle overlapping blocks?
16907 echo " "
16908 val="$undef"
16909 case "$d_memmove" in
16910 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16911 *)      case "$d_memcpy" in
16912         "$define")
16913                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16914                 $cat >try.c <<EOCP
16915 #$i_memory I_MEMORY
16916 #$i_stdlib I_STDLIB
16917 #$i_string I_STRING
16918 #$i_unistd I_UNISTD
16919 EOCP
16920         $cat >>try.c <<'EOCP'
16921 #include <stdio.h>
16922 #ifdef I_MEMORY
16923 #  include <memory.h>
16924 #endif
16925 #ifdef I_STDLIB
16926 #  include <stdlib.h>
16927 #endif
16928 #ifdef I_STRING
16929 #  include <string.h>
16930 #else
16931 #  include <strings.h>
16932 #endif
16933 #ifdef I_UNISTD
16934 #  include <unistd.h>  /* Needed for NetBSD */
16935 #endif
16936 int main()
16937 {
16938 char buf[128], abc[128];
16939 char *b;
16940 int len;
16941 int off;
16942 int align;
16943
16944 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16945    try to store the string in read-only memory. */
16946 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16947
16948 for (align = 7; align >= 0; align--) {
16949         for (len = 36; len; len--) {
16950                 b = buf+align;
16951                 memcpy(b, abc, len);
16952                 for (off = 1; off <= len; off++) {
16953                         memcpy(b+off, b, len);
16954                         memcpy(b, b+off, len);
16955                         if (memcmp(b, abc, len))
16956                                 exit(1);
16957                 }
16958         }
16959 }
16960 exit(0);
16961 }
16962 EOCP
16963                 set try
16964                 if eval $compile_ok; then
16965                         if $run ./try 2>/dev/null; then
16966                                 echo "Yes, it can."
16967                                 val="$define"
16968                         else
16969                                 echo "It can't, sorry."
16970                         fi
16971                 else
16972                         echo "(I can't compile the test program, so we'll assume not...)"
16973                 fi
16974                 ;;
16975         esac
16976         $rm_try
16977         ;;
16978 esac
16979 set d_safemcpy
16980 eval $setvar
16981
16982 : can memcmp be trusted to compare relative magnitude?
16983 val="$undef"
16984 case "$d_memcmp" in
16985 "$define")
16986         echo " "
16987         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16988         $cat >try.c <<EOCP
16989 #$i_memory I_MEMORY
16990 #$i_stdlib I_STDLIB
16991 #$i_string I_STRING
16992 #$i_unistd I_UNISTD
16993 EOCP
16994         $cat >>try.c <<'EOCP'
16995 #include <stdio.h>
16996 #ifdef I_MEMORY
16997 #  include <memory.h>
16998 #endif
16999 #ifdef I_STDLIB
17000 #  include <stdlib.h>
17001 #endif
17002 #ifdef I_STRING
17003 #  include <string.h>
17004 #else
17005 #  include <strings.h>
17006 #endif
17007 #ifdef I_UNISTD
17008 #  include <unistd.h>  /* Needed for NetBSD */
17009 #endif
17010 int main()
17011 {
17012 char a = -1;
17013 char b = 0;
17014 if ((a < b) && memcmp(&a, &b, 1) < 0)
17015         exit(1);
17016 exit(0);
17017 }
17018 EOCP
17019         set try
17020         if eval $compile_ok; then
17021                 if $run ./try 2>/dev/null; then
17022                         echo "Yes, it can."
17023                         val="$define"
17024                 else
17025                         echo "No, it can't (it uses signed chars)."
17026                 fi
17027         else
17028                 echo "(I can't compile the test program, so we'll assume not...)"
17029         fi
17030         ;;
17031 esac
17032 $rm_try
17033 set d_sanemcmp
17034 eval $setvar
17035
17036 : see if prototype for sbrk is available
17037 echo " "
17038 set d_sbrkproto sbrk $i_unistd unistd.h
17039 eval $hasproto
17040
17041 : see if select exists
17042 set select d_select
17043 eval $inlibc
17044
17045 : see if semctl exists
17046 set semctl d_semctl
17047 eval $inlibc
17048
17049 : see if semget exists
17050 set semget d_semget
17051 eval $inlibc
17052
17053 : see if semop exists
17054 set semop d_semop
17055 eval $inlibc
17056
17057 : see how much of the 'sem*(2)' library is present.
17058 h_sem=true
17059 echo " "
17060 case "$d_semctl$d_semget$d_semop" in
17061 *"$undef"*) h_sem=false;;
17062 esac
17063 case "$osname" in
17064 freebsd)
17065     case "`ipcs 2>&1`" in
17066     "SVID messages"*"not configured"*)
17067         echo "Your $osname does not have the sem*(2) configured." >&4
17068         h_sem=false
17069         val="$undef"
17070         set semctl d_semctl
17071         eval $setvar
17072         set semget d_semget
17073         eval $setvar
17074         set semop d_semop
17075         eval $setvar
17076         ;;
17077     esac
17078     ;;
17079 esac
17080 : we could also check for sys/ipc.h ...
17081 if $h_sem && $test `./findhdr sys/sem.h`; then
17082         echo "You have the full sem*(2) library." >&4
17083         val="$define"
17084 else
17085         echo "You don't have the full sem*(2) library." >&4
17086         val="$undef"
17087 fi
17088 set d_sem
17089 eval $setvar
17090
17091 : see whether sys/sem.h defines union semun
17092 echo " "
17093 $cat > try.c <<'END'
17094 #include <sys/types.h>
17095 #include <sys/ipc.h>
17096 #include <sys/sem.h>
17097 int main () { union semun semun; semun.buf = 0; }
17098 END
17099 set try
17100 if eval $compile; then
17101     echo "You have union semun in <sys/sem.h>." >&4
17102     val="$define"
17103 else
17104     echo "You do not have union semun in <sys/sem.h>." >&4
17105     val="$undef"
17106 fi
17107 $rm_try
17108 set d_union_semun
17109 eval $setvar
17110
17111 : see how to do semctl IPC_STAT
17112 case "$d_sem" in
17113 $define)
17114     echo " "
17115     $cat > tryh.h <<END
17116 #ifndef S_IRUSR
17117 #   ifdef S_IREAD
17118 #       define S_IRUSR S_IREAD
17119 #       define S_IWUSR S_IWRITE
17120 #       define S_IXUSR S_IEXEC
17121 #   else
17122 #       define S_IRUSR 0400
17123 #       define S_IWUSR 0200
17124 #       define S_IXUSR 0100
17125 #   endif
17126 #   define S_IRGRP (S_IRUSR>>3)
17127 #   define S_IWGRP (S_IWUSR>>3)
17128 #   define S_IXGRP (S_IXUSR>>3)
17129 #   define S_IROTH (S_IRUSR>>6)
17130 #   define S_IWOTH (S_IWUSR>>6)
17131 #   define S_IXOTH (S_IXUSR>>6)
17132 #endif
17133 #ifndef S_IRWXU
17134 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17135 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17136 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17137 #endif
17138 END
17139     : see whether semctl IPC_STAT can use union semun
17140     case "$d_semctl_semun" in
17141     '')
17142       val="$undef"
17143       $cat > try.c <<END
17144 #include <sys/types.h>
17145 #include <sys/ipc.h>
17146 #include <sys/sem.h>
17147 #include <sys/stat.h>
17148 #include <stdio.h>
17149 #include <errno.h>
17150 #include "tryh.h"
17151 #ifndef errno
17152 extern int errno;
17153 #endif
17154 #$d_union_semun HAS_UNION_SEMUN
17155 int main() {
17156     union semun
17157 #ifndef HAS_UNION_SEMUN
17158     {
17159         int val;
17160         struct semid_ds *buf;
17161         unsigned short *array;
17162     }
17163 #endif
17164     arg;
17165     int sem, st;
17166
17167 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17168     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17169     if (sem > -1) {
17170         struct semid_ds argbuf;
17171         arg.buf = &argbuf;
17172 #       ifdef IPC_STAT
17173         st = semctl(sem, 0, IPC_STAT, arg);
17174         if (st == 0)
17175             printf("semun\n");
17176         else
17177 #       endif /* IPC_STAT */
17178             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17179 #       ifdef IPC_RMID
17180         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17181 #       endif /* IPC_RMID */
17182             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17183     } else
17184 #endif /* IPC_PRIVATE && ... */
17185         printf("semget failed: errno = %d\n", errno);
17186   return 0;
17187 }
17188 END
17189       set try
17190       if eval $compile; then
17191           xxx=`$run ./try`
17192           case "$xxx" in
17193           semun) val="$define" ;;
17194           esac
17195       fi
17196       $rm_try
17197       set d_semctl_semun
17198       eval $setvar
17199       ;;
17200     esac
17201     case "$d_semctl_semun" in
17202     $define)
17203         echo "You can use union semun for semctl IPC_STAT." >&4
17204         also='also'
17205         ;;
17206     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17207         also=''
17208         ;;
17209     esac
17210
17211     : see whether semctl IPC_STAT can use struct semid_ds pointer
17212     case "$d_semctl_semid_ds" in
17213     '')
17214       val="$undef"
17215       $cat > try.c <<'END'
17216 #include <sys/types.h>
17217 #include <sys/ipc.h>
17218 #include <sys/sem.h>
17219 #include <sys/stat.h>
17220 #include "tryh.h"
17221 #include <stdio.h>
17222 #include <errno.h>
17223 #ifndef errno
17224 extern int errno;
17225 #endif
17226 int main() {
17227     struct semid_ds arg;
17228     int sem, st;
17229
17230 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17231     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17232     if (sem > -1) {
17233 #       ifdef IPC_STAT
17234         st = semctl(sem, 0, IPC_STAT, &arg);
17235         if (st == 0)
17236             printf("semid_ds\n");
17237         else
17238 #       endif /* IPC_STAT */
17239             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17240 #       ifdef IPC_RMID
17241         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17242 #       endif /* IPC_RMID */
17243             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17244     } else
17245 #endif /* IPC_PRIVATE && ... */
17246         printf("semget failed: errno = %d\n", errno);
17247
17248     return 0;
17249 }
17250 END
17251       set try
17252       if eval $compile; then
17253           xxx=`$run ./try`
17254           case "$xxx" in
17255           semid_ds) val="$define" ;;
17256           esac
17257       fi
17258       $rm_try
17259       set d_semctl_semid_ds
17260       eval $setvar
17261       ;;
17262     esac
17263     case "$d_semctl_semid_ds" in
17264     $define)
17265         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17266         ;;
17267     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17268         ;;
17269     esac
17270     ;;
17271 *)  val="$undef"
17272
17273     # We do not have the full sem*(2) library, so assume we can not
17274     # use either.
17275
17276     set d_semctl_semun
17277     eval $setvar
17278
17279     set d_semctl_semid_ds
17280     eval $setvar
17281     ;;
17282 esac
17283 $rm_try tryh.h
17284
17285 : see if sendmsg exists
17286 set sendmsg d_sendmsg
17287 eval $inlibc
17288
17289 : see if setegid exists
17290 set setegid d_setegid
17291 eval $inlibc
17292
17293 : see if seteuid exists
17294 set seteuid d_seteuid
17295 eval $inlibc
17296
17297 : see if setgrent exists
17298 set setgrent d_setgrent
17299 eval $inlibc
17300
17301 : see if setgrent_r exists
17302 set setgrent_r d_setgrent_r
17303 eval $inlibc
17304 case "$d_setgrent_r" in
17305 "$define")
17306         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17307         case "$d_setgrent_r_proto:$usethreads" in
17308         ":define")      d_setgrent_r_proto=define
17309                 set d_setgrent_r_proto setgrent_r $hdrs
17310                 eval $hasproto ;;
17311         *)      ;;
17312         esac
17313         case "$d_setgrent_r_proto" in
17314         define)
17315         case "$setgrent_r_proto" in
17316         ''|0) try='int setgrent_r(FILE**);'
17317         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17318         esac
17319         case "$setgrent_r_proto" in
17320         ''|0) try='void setgrent_r(FILE**);'
17321         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17322         esac
17323         case "$setgrent_r_proto" in
17324         ''|0)   d_setgrent_r=undef
17325                 setgrent_r_proto=0
17326                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17327         * )     case "$setgrent_r_proto" in
17328                 REENTRANT_PROTO*) ;;
17329                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17330                 esac
17331                 echo "Prototype: $try" ;;
17332         esac
17333         ;;
17334         *)      case "$usethreads" in
17335                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17336                 esac
17337                 d_setgrent_r=undef
17338                 setgrent_r_proto=0
17339                 ;;
17340         esac
17341         ;;
17342 *)      setgrent_r_proto=0
17343         ;;
17344 esac
17345
17346 : see if sethostent exists
17347 set sethostent d_sethent
17348 eval $inlibc
17349
17350 : see if sethostent_r exists
17351 set sethostent_r d_sethostent_r
17352 eval $inlibc
17353 case "$d_sethostent_r" in
17354 "$define")
17355         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17356         case "$d_sethostent_r_proto:$usethreads" in
17357         ":define")      d_sethostent_r_proto=define
17358                 set d_sethostent_r_proto sethostent_r $hdrs
17359                 eval $hasproto ;;
17360         *)      ;;
17361         esac
17362         case "$d_sethostent_r_proto" in
17363         define)
17364         case "$sethostent_r_proto" in
17365         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17366         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17367         esac
17368         case "$sethostent_r_proto" in
17369         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17370         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17371         esac
17372         case "$sethostent_r_proto" in
17373         ''|0)   d_sethostent_r=undef
17374                 sethostent_r_proto=0
17375                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17376         * )     case "$sethostent_r_proto" in
17377                 REENTRANT_PROTO*) ;;
17378                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17379                 esac
17380                 echo "Prototype: $try" ;;
17381         esac
17382         ;;
17383         *)      case "$usethreads" in
17384                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17385                 esac
17386                 d_sethostent_r=undef
17387                 sethostent_r_proto=0
17388                 ;;
17389         esac
17390         ;;
17391 *)      sethostent_r_proto=0
17392         ;;
17393 esac
17394
17395 : see if setitimer exists
17396 set setitimer d_setitimer
17397 eval $inlibc
17398
17399 : see if setlinebuf exists
17400 set setlinebuf d_setlinebuf
17401 eval $inlibc
17402
17403 : see if setlocale exists
17404 set setlocale d_setlocale
17405 eval $inlibc
17406
17407 : see if locale.h is available
17408 set locale.h i_locale
17409 eval $inhdr
17410
17411 : see if setlocale_r exists
17412 set setlocale_r d_setlocale_r
17413 eval $inlibc
17414 case "$d_setlocale_r" in
17415 "$define")
17416         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17417         case "$d_setlocale_r_proto:$usethreads" in
17418         ":define")      d_setlocale_r_proto=define
17419                 set d_setlocale_r_proto setlocale_r $hdrs
17420                 eval $hasproto ;;
17421         *)      ;;
17422         esac
17423         case "$d_setlocale_r_proto" in
17424         define)
17425         case "$setlocale_r_proto" in
17426         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17427         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17428         esac
17429         case "$setlocale_r_proto" in
17430         ''|0)   d_setlocale_r=undef
17431                 setlocale_r_proto=0
17432                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17433         * )     case "$setlocale_r_proto" in
17434                 REENTRANT_PROTO*) ;;
17435                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17436                 esac
17437                 echo "Prototype: $try" ;;
17438         esac
17439         ;;
17440         *)      case "$usethreads" in
17441                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17442                 esac
17443                 d_setlocale_r=undef
17444                 setlocale_r_proto=0
17445                 ;;
17446         esac
17447         ;;
17448 *)      setlocale_r_proto=0
17449         ;;
17450 esac
17451
17452 : see if setnetent exists
17453 set setnetent d_setnent
17454 eval $inlibc
17455
17456 : see if setnetent_r exists
17457 set setnetent_r d_setnetent_r
17458 eval $inlibc
17459 case "$d_setnetent_r" in
17460 "$define")
17461         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17462         case "$d_setnetent_r_proto:$usethreads" in
17463         ":define")      d_setnetent_r_proto=define
17464                 set d_setnetent_r_proto setnetent_r $hdrs
17465                 eval $hasproto ;;
17466         *)      ;;
17467         esac
17468         case "$d_setnetent_r_proto" in
17469         define)
17470         case "$setnetent_r_proto" in
17471         ''|0) try='int setnetent_r(int, struct netent_data*);'
17472         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17473         esac
17474         case "$setnetent_r_proto" in
17475         ''|0) try='void setnetent_r(int, struct netent_data*);'
17476         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17477         esac
17478         case "$setnetent_r_proto" in
17479         ''|0)   d_setnetent_r=undef
17480                 setnetent_r_proto=0
17481                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17482         * )     case "$setnetent_r_proto" in
17483                 REENTRANT_PROTO*) ;;
17484                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17485                 esac
17486                 echo "Prototype: $try" ;;
17487         esac
17488         ;;
17489         *)      case "$usethreads" in
17490                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17491                 esac
17492                 d_setnetent_r=undef
17493                 setnetent_r_proto=0
17494                 ;;
17495         esac
17496         ;;
17497 *)      setnetent_r_proto=0
17498         ;;
17499 esac
17500
17501 : see if setprotoent exists
17502 set setprotoent d_setpent
17503 eval $inlibc
17504
17505 : see if setpgid exists
17506 set setpgid d_setpgid
17507 eval $inlibc
17508
17509 : see if setpgrp2 exists
17510 set setpgrp2 d_setpgrp2
17511 eval $inlibc
17512
17513 : see if setpriority exists
17514 set setpriority d_setprior
17515 eval $inlibc
17516
17517 : see if setproctitle exists
17518 set setproctitle d_setproctitle
17519 eval $inlibc
17520
17521 : see if setprotoent_r exists
17522 set setprotoent_r d_setprotoent_r
17523 eval $inlibc
17524 case "$d_setprotoent_r" in
17525 "$define")
17526         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17527         case "$d_setprotoent_r_proto:$usethreads" in
17528         ":define")      d_setprotoent_r_proto=define
17529                 set d_setprotoent_r_proto setprotoent_r $hdrs
17530                 eval $hasproto ;;
17531         *)      ;;
17532         esac
17533         case "$d_setprotoent_r_proto" in
17534         define)
17535         case "$setprotoent_r_proto" in
17536         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17537         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17538         esac
17539         case "$setprotoent_r_proto" in
17540         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17541         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17542         esac
17543         case "$setprotoent_r_proto" in
17544         ''|0)   d_setprotoent_r=undef
17545                 setprotoent_r_proto=0
17546                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17547         * )     case "$setprotoent_r_proto" in
17548                 REENTRANT_PROTO*) ;;
17549                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17550                 esac
17551                 echo "Prototype: $try" ;;
17552         esac
17553         ;;
17554         *)      case "$usethreads" in
17555                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17556                 esac
17557                 d_setprotoent_r=undef
17558                 setprotoent_r_proto=0
17559                 ;;
17560         esac
17561         ;;
17562 *)      setprotoent_r_proto=0
17563         ;;
17564 esac
17565
17566 : see if setpwent exists
17567 set setpwent d_setpwent
17568 eval $inlibc
17569
17570 : see if setpwent_r exists
17571 set setpwent_r d_setpwent_r
17572 eval $inlibc
17573 case "$d_setpwent_r" in
17574 "$define")
17575         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17576         case "$d_setpwent_r_proto:$usethreads" in
17577         ":define")      d_setpwent_r_proto=define
17578                 set d_setpwent_r_proto setpwent_r $hdrs
17579                 eval $hasproto ;;
17580         *)      ;;
17581         esac
17582         case "$d_setpwent_r_proto" in
17583         define)
17584         case "$setpwent_r_proto" in
17585         ''|0) try='int setpwent_r(FILE**);'
17586         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17587         esac
17588         case "$setpwent_r_proto" in
17589         ''|0) try='void setpwent_r(FILE**);'
17590         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17591         esac
17592         case "$setpwent_r_proto" in
17593         ''|0)   d_setpwent_r=undef
17594                 setpwent_r_proto=0
17595                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17596         * )     case "$setpwent_r_proto" in
17597                 REENTRANT_PROTO*) ;;
17598                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17599                 esac
17600                 echo "Prototype: $try" ;;
17601         esac
17602         ;;
17603         *)      case "$usethreads" in
17604                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17605                 esac
17606                 d_setpwent_r=undef
17607                 setpwent_r_proto=0
17608                 ;;
17609         esac
17610         ;;
17611 *)      setpwent_r_proto=0
17612         ;;
17613 esac
17614
17615 : see if setregid exists
17616 set setregid d_setregid
17617 eval $inlibc
17618 set setresgid d_setresgid
17619 eval $inlibc
17620
17621 : see if setreuid exists
17622 set setreuid d_setreuid
17623 eval $inlibc
17624 set setresuid d_setresuid
17625 eval $inlibc
17626
17627 : see if setrgid exists
17628 set setrgid d_setrgid
17629 eval $inlibc
17630
17631 : see if setruid exists
17632 set setruid d_setruid
17633 eval $inlibc
17634
17635 : see if setservent exists
17636 set setservent d_setsent
17637 eval $inlibc
17638
17639 : see if setservent_r exists
17640 set setservent_r d_setservent_r
17641 eval $inlibc
17642 case "$d_setservent_r" in
17643 "$define")
17644         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17645         case "$d_setservent_r_proto:$usethreads" in
17646         ":define")      d_setservent_r_proto=define
17647                 set d_setservent_r_proto setservent_r $hdrs
17648                 eval $hasproto ;;
17649         *)      ;;
17650         esac
17651         case "$d_setservent_r_proto" in
17652         define)
17653         case "$setservent_r_proto" in
17654         ''|0) try='int setservent_r(int, struct servent_data*);'
17655         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17656         esac
17657         case "$setservent_r_proto" in
17658         ''|0) try='void setservent_r(int, struct servent_data*);'
17659         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17660         esac
17661         case "$setservent_r_proto" in
17662         ''|0)   d_setservent_r=undef
17663                 setservent_r_proto=0
17664                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17665         * )     case "$setservent_r_proto" in
17666                 REENTRANT_PROTO*) ;;
17667                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17668                 esac
17669                 echo "Prototype: $try" ;;
17670         esac
17671         ;;
17672         *)      case "$usethreads" in
17673                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17674                 esac
17675                 d_setservent_r=undef
17676                 setservent_r_proto=0
17677                 ;;
17678         esac
17679         ;;
17680 *)      setservent_r_proto=0
17681         ;;
17682 esac
17683
17684 : see if setsid exists
17685 set setsid d_setsid
17686 eval $inlibc
17687
17688 : see if setvbuf exists
17689 set setvbuf d_setvbuf
17690 eval $inlibc
17691
17692 : see if shmctl exists
17693 set shmctl d_shmctl
17694 eval $inlibc
17695
17696 : see if shmget exists
17697 set shmget d_shmget
17698 eval $inlibc
17699
17700 : see if shmat exists
17701 set shmat d_shmat
17702 eval $inlibc
17703 : see what shmat returns
17704 case "$d_shmat" in
17705 "$define")
17706         $cat >shmat.c <<'END'
17707 #include <sys/shm.h>
17708 void *shmat();
17709 END
17710         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17711                 shmattype='void *'
17712         else
17713                 shmattype='char *'
17714         fi
17715         echo "and it returns ($shmattype)." >&4
17716         : see if a prototype for shmat is available
17717         xxx=`./findhdr sys/shm.h`
17718         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17719         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17720                 val="$define"
17721         else
17722                 val="$undef"
17723         fi
17724         $rm -f shmat.[co]
17725         ;;
17726 *)
17727         val="$undef"
17728         ;;
17729 esac
17730 set d_shmatprototype
17731 eval $setvar
17732
17733 : see if shmdt exists
17734 set shmdt d_shmdt
17735 eval $inlibc
17736
17737 : see how much of the 'shm*(2)' library is present.
17738 h_shm=true
17739 echo " "
17740 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17741 *"$undef"*) h_shm=false;;
17742 esac
17743 case "$osname" in
17744 freebsd)
17745     case "`ipcs 2>&1`" in
17746     "SVID shared memory"*"not configured"*)
17747         echo "Your $osname does not have the shm*(2) configured." >&4
17748         h_shm=false
17749         val="$undef"
17750         set shmctl d_shmctl
17751         evat $setvar
17752         set shmget d_shmget
17753         evat $setvar
17754         set shmat d_shmat
17755         evat $setvar
17756         set shmdt d_shmdt
17757         evat $setvar
17758         ;;
17759     esac
17760     ;;
17761 esac
17762 : we could also check for sys/ipc.h ...
17763 if $h_shm && $test `./findhdr sys/shm.h`; then
17764         echo "You have the full shm*(2) library." >&4
17765         val="$define"
17766 else
17767         echo "You don't have the full shm*(2) library." >&4
17768         val="$undef"
17769 fi
17770 set d_shm
17771 eval $setvar
17772
17773 : see if we have sigaction
17774 echo " "
17775 if set sigaction val -f d_sigaction; eval $csym; $val; then
17776         echo 'sigaction() found.' >&4
17777         $cat > try.c <<EOP
17778 #include <stdio.h>
17779 #include <sys/types.h>
17780 #include <signal.h>
17781 #$i_stdlib I_STDLIB
17782 #ifdef I_STDLIB
17783 #include <stdlib.h>
17784 #endif
17785 int main()
17786 {
17787     struct sigaction act, oact;
17788     act.sa_flags = 0;
17789     oact.sa_handler = 0;
17790     /* so that act and oact are used */
17791     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17792 }
17793 EOP
17794         set try
17795         if eval $compile_ok; then
17796                 val="$define"
17797         else
17798                 echo "But you don't seem to have a usable struct sigaction." >&4
17799                 val="$undef"
17800         fi
17801 else
17802         echo 'sigaction NOT found.' >&4
17803         val="$undef"
17804 fi
17805 set d_sigaction; eval $setvar
17806 $rm_try
17807
17808 : see if this is a sunmath.h system
17809 set sunmath.h i_sunmath
17810 eval $inhdr
17811
17812 : see if signbit exists
17813 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17814 $cat >try.c <<EOCP
17815 #$i_math I_MATH
17816 #$i_sunmath I_SUNMATH
17817 #ifdef I_MATH
17818 #  include <math.h>
17819 #endif
17820 #ifdef I_SUNMATH  /* Solaris special math library */
17821 #  include <sunmath.h>
17822 #endif
17823 #define NV $nvtype
17824 int main(int argc, char **argv)
17825 {
17826     NV x = 0.0;
17827     NV y = -0.0;
17828     if ((signbit(x) == 0) && (signbit(y) != 0))
17829         return 0;
17830     else
17831         return 1;
17832 }
17833 EOCP
17834 val="$undef"
17835 set try
17836 if eval $compile; then
17837     if $run ./try; then
17838         $echo "Yes." >&4
17839         val="$define"
17840     else
17841         $echo "Signbit seems to be available, but doesn't work as I expected."
17842         $echo "I won't use it." >&4
17843         val="$undef"
17844     fi
17845 else
17846     $echo "Nope." >&4
17847     dflt="$undef"
17848 fi
17849 set d_signbit
17850 eval $setvar
17851 $rm_try
17852
17853 : see if sigprocmask exists
17854 set sigprocmask d_sigprocmask
17855 eval $inlibc
17856
17857 : see if sigsetjmp exists
17858 echo " "
17859 case "$d_sigsetjmp" in
17860 '')
17861         $cat >try.c <<EOP
17862 #include <setjmp.h>
17863 #$i_stdlib I_STDLIB
17864 #ifdef I_STDLIB
17865 #include <stdlib.h>
17866 #endif
17867 sigjmp_buf env;
17868 int set = 1;
17869 int main()
17870 {
17871         if (sigsetjmp(env,1))
17872                 exit(set);
17873         set = 0;
17874         siglongjmp(env, 1);
17875         exit(1);
17876 }
17877 EOP
17878         set try
17879         if eval $compile; then
17880                 if $run ./try >/dev/null 2>&1; then
17881                         echo "POSIX sigsetjmp found." >&4
17882                         val="$define"
17883                 else
17884                         $cat >&4 <<EOM
17885 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17886 I'll ignore them.
17887 EOM
17888                         val="$undef"
17889                 fi
17890         else
17891                 echo "sigsetjmp not found." >&4
17892                 val="$undef"
17893         fi
17894         ;;
17895 *) val="$d_sigsetjmp"
17896         case "$d_sigsetjmp" in
17897         $define) echo "POSIX sigsetjmp found." >&4;;
17898         $undef) echo "sigsetjmp not found." >&4;;
17899         esac
17900         ;;
17901 esac
17902 set d_sigsetjmp
17903 eval $setvar
17904 $rm_try
17905
17906 : see if snprintf exists
17907 set snprintf d_snprintf
17908 eval $inlibc
17909
17910 : see if vsnprintf exists
17911 set vsnprintf d_vsnprintf
17912 eval $inlibc
17913
17914 case "$d_snprintf-$d_vsnprintf" in
17915 "$define-$define")
17916     $cat <<EOM
17917 Checking whether your snprintf() and vsnprintf() work okay...
17918 EOM
17919     $cat >try.c <<'EOCP'
17920 /* v?snprintf testing logic courtesy of Russ Allbery.
17921  * According to C99:
17922  * - if the buffer is too short it still must be \0-terminated
17923  * - if the buffer is too short the potentially required length
17924  *   must be returned and not -1
17925  * - if the buffer is NULL the potentially required length
17926  *   must be returned and not -1 or core dump
17927  */
17928 #include <stdio.h>
17929 #include <stdarg.h>
17930
17931 char buf[2];
17932
17933 int test (char *format, ...)
17934 {
17935     va_list args;
17936     int count;
17937
17938     va_start (args, format);
17939     count = vsnprintf (buf, sizeof buf, format, args);
17940     va_end (args);
17941     return count;
17942 }
17943
17944 int main ()
17945 {
17946     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17947              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17948 }
17949 EOCP
17950     set try
17951     if eval $compile; then
17952         `$run ./try`
17953         case "$?" in
17954         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17955         *) cat <<EOM >&4
17956 Your snprintf() and snprintf() don't seem to be working okay.
17957 EOM
17958            d_snprintf="$undef"
17959            d_vsnprintf="$undef"
17960            ;;
17961         esac
17962     else
17963         echo "(I can't seem to compile the test program--assuming they don't)"
17964         d_snprintf="$undef"
17965         d_vsnprintf="$undef"
17966     fi
17967     $rm_try
17968     ;;
17969 esac
17970
17971 : see if sockatmark exists
17972 set sockatmark d_sockatmark
17973 eval $inlibc
17974
17975 : see if prototype for sockatmark is available
17976 echo " "
17977 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17978 eval $hasproto
17979
17980 : see if socks5_init exists
17981 set socks5_init d_socks5_init
17982 eval $inlibc
17983
17984 : see if sprintf returns the length of the string in the buffer as per ANSI
17985 $echo "Checking whether sprintf returns the length of the string..." >&4
17986 $cat <<EOP >try.c
17987 #include <stdio.h>
17988 #$i_stdlib I_STDLIB
17989 #ifdef I_STDLIB
17990 #include <stdlib.h>
17991 #endif
17992 #$i_string I_STRING
17993 #ifdef I_STRING
17994 #  include <string.h>
17995 #else
17996 #  include <strings.h>
17997 #endif
17998 #$i_math I_MATH
17999 #ifdef I_MATH
18000 #include <math.h>
18001 #endif
18002
18003 char buffer[256];
18004
18005 int check (size_t expect, int test) {
18006   size_t got = strlen(buffer);
18007   if (expect == got)
18008     return 0;
18009
18010   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18011        test, buffer);
18012   exit (test);
18013 }
18014
18015 int main(int argc, char **argv) {
18016   int test = 0;
18017
18018   check(sprintf(buffer, ""), ++test);
18019   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18020   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18021
18022   return 0;
18023 }
18024 EOP
18025 set try
18026
18027 if eval $compile; then
18028     xxx="`$run ./try`"
18029     case "$?" in
18030         0) cat >&4 <<EOM
18031 sprintf returns the length of the string (as ANSI says it should)
18032 EOM
18033         d_sprintf_returns_strlen="$define"
18034         ;;
18035         *) cat >&4 <<EOM
18036 sprintf does not return the length of the string (how old is this system?)
18037 EOM
18038         d_sprintf_returns_strlen="$undef"
18039         ;;
18040     esac
18041 else
18042     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18043     d_sprintf_returns_strlen="$undef"
18044 fi
18045 $rm_try
18046
18047 : see if srand48_r exists
18048 set srand48_r d_srand48_r
18049 eval $inlibc
18050 case "$d_srand48_r" in
18051 "$define")
18052         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18053         case "$d_srand48_r_proto:$usethreads" in
18054         ":define")      d_srand48_r_proto=define
18055                 set d_srand48_r_proto srand48_r $hdrs
18056                 eval $hasproto ;;
18057         *)      ;;
18058         esac
18059         case "$d_srand48_r_proto" in
18060         define)
18061         case "$srand48_r_proto" in
18062         ''|0) try='int srand48_r(long, struct drand48_data*);'
18063         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18064         esac
18065         case "$srand48_r_proto" in
18066         ''|0)   d_srand48_r=undef
18067                 srand48_r_proto=0
18068                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18069         * )     case "$srand48_r_proto" in
18070                 REENTRANT_PROTO*) ;;
18071                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18072                 esac
18073                 echo "Prototype: $try" ;;
18074         esac
18075         ;;
18076         *)      case "$usethreads" in
18077                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18078                 esac
18079                 d_srand48_r=undef
18080                 srand48_r_proto=0
18081                 ;;
18082         esac
18083         ;;
18084 *)      srand48_r_proto=0
18085         ;;
18086 esac
18087
18088 : see if srandom_r exists
18089 set srandom_r d_srandom_r
18090 eval $inlibc
18091 case "$d_srandom_r" in
18092 "$define")
18093         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18094         case "$d_srandom_r_proto:$usethreads" in
18095         ":define")      d_srandom_r_proto=define
18096                 set d_srandom_r_proto srandom_r $hdrs
18097                 eval $hasproto ;;
18098         *)      ;;
18099         esac
18100         case "$d_srandom_r_proto" in
18101         define)
18102         case "$srandom_r_proto" in
18103         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18104         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18105         esac
18106         case "$srandom_r_proto" in
18107         ''|0)   d_srandom_r=undef
18108                 srandom_r_proto=0
18109                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18110         * )     case "$srandom_r_proto" in
18111                 REENTRANT_PROTO*) ;;
18112                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18113                 esac
18114                 echo "Prototype: $try" ;;
18115         esac
18116         ;;
18117         *)      case "$usethreads" in
18118                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18119                 esac
18120                 d_srandom_r=undef
18121                 srandom_r_proto=0
18122                 ;;
18123         esac
18124         ;;
18125 *)      srandom_r_proto=0
18126         ;;
18127 esac
18128
18129 : see if prototype for setresgid is available
18130 echo " "
18131 set d_sresgproto setresgid $i_unistd unistd.h
18132 eval $hasproto
18133
18134 : see if prototype for setresuid is available
18135 echo " "
18136 set d_sresuproto setresuid $i_unistd unistd.h
18137 eval $hasproto
18138
18139 : see if sys/stat.h is available
18140 set sys/stat.h i_sysstat
18141 eval $inhdr
18142
18143 : see if stat knows about block sizes
18144 echo " "
18145 echo "Checking to see if your struct stat has st_blocks field..." >&4
18146 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18147 eval $hasfield
18148
18149 : see if this is a sys/vfs.h system
18150 set sys/vfs.h i_sysvfs
18151 eval $inhdr
18152
18153 : see if this is a sys/statfs.h system
18154 set sys/statfs.h i_sysstatfs
18155 eval $inhdr
18156
18157 : Check for statfs_s
18158 echo " "
18159 echo "Checking to see if your system supports struct statfs..." >&4
18160 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
18161 eval $hasstruct
18162 case "$d_statfs_s" in
18163 "$define")      echo "Yes, it does."   ;;
18164 *)              echo "No, it doesn't." ;;
18165 esac
18166
18167
18168 : see if struct statfs knows about f_flags
18169 case "$d_statfs_s" in
18170 define)
18171         echo " "
18172         echo "Checking to see if your struct statfs has f_flags field..." >&4
18173         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
18174         eval $hasfield
18175         ;;
18176 *)      val="$undef"
18177         set d_statfs_f_flags
18178         eval $setvar
18179         ;;
18180 esac
18181 case "$d_statfs_f_flags" in
18182 "$define")      echo "Yes, it does."   ;;
18183 *)              echo "No, it doesn't." ;;
18184 esac
18185
18186 : see what flavor, if any, of static inline is supported
18187 echo " "
18188 echo "Checking to see if your system supports static inline..."
18189 $cat > try.c <<'EOCP'
18190 #include <stdlib.h>
18191 extern int f_via_a(int x);
18192 extern int f_via_b(int x);
18193 int main(int argc, char **argv)
18194 {
18195     int y;
18196
18197     y = f_via_a(0);
18198 #ifdef USE_B
18199     y = f_via_b(0);
18200 #endif
18201     if (y == 42) {
18202         return EXIT_SUCCESS;
18203     }
18204     else {
18205         return EXIT_FAILURE;
18206     }
18207 }
18208 EOCP
18209 $cat > a.c <<'EOCP'
18210 static INLINE int f(int x) {
18211     int y;
18212     y = x + 42;
18213     return y;
18214 }
18215
18216 int f_via_a(int x)
18217 {
18218     return f(x);
18219 }
18220 EOCP
18221 $cat > b.c <<'EOCP'
18222 extern int f(int x);
18223
18224 int f_via_b(int x)
18225 {
18226     return f(x);
18227 }
18228 EOCP
18229
18230 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18231 case "$perl_static_inline" in
18232 '')     # Check the various possibilities, and break out on success.
18233         # For gcc, prefer __inline__, which will still permit
18234         # cflags.SH to add in -ansi.
18235         case "$gccversion" in
18236                 '') xxx="inline __inline__ __inline _inline";;
18237                 *)  xxx="__inline__ inline __inline _inline";;
18238         esac
18239         for inline in $xxx; do
18240                 set try -DINLINE=$inline a.c
18241                 if eval $compile && $run ./try; then
18242                         # Now make sure there is no external linkage of static
18243                         # functions
18244                         set try -DINLINE=$inline -DUSE_B a.c b.c
18245                         if eval $compile && $run ./try; then
18246                                 $echo "Your compiler supports static $inline, " >&4
18247                                 $echo "but it also creates an external definition," >&4
18248                                 $echo "so I won't use it." >&4
18249                                 val=$undef
18250                         else
18251                                 $echo "Your compiler supports static $inline." >&4
18252                                 val=$define
18253                                 perl_static_inline="static $inline";
18254                                 break;
18255                         fi
18256                 else
18257                         $echo "Your compiler does NOT support static $inline." >&4
18258                         val="$undef"
18259                 fi
18260         done
18261         ;;
18262 *inline*) # Some variant of inline exists.
18263         echo "Keeping your $hint value of $perl_static_inline."
18264         val=$define
18265         ;;
18266 static)  # No inline capabilities
18267         echo "Keeping your $hint value of $perl_static_inline."
18268         val=$undef
18269         ;;
18270 *)  # Unrecognized previous value -- blindly trust the supplied
18271         # value and hope it makes sense.  Use old value for
18272         # d_static_inline, if there is one.
18273         echo "Keeping your $hint value of $perl_static_inline."
18274         case "$d_static_inline" in
18275                 '') val=$define ;;
18276                 *)  val=$d_static_inline ;;
18277         esac
18278         ;;
18279 esac
18280 # Fallback to plain 'static' if nothing worked.
18281 case "$perl_static_inline" in
18282 '')
18283         perl_static_inline="static"
18284         val=$undef
18285         ;;
18286 esac
18287 set d_static_inline
18288 eval $setvar
18289 $rm -f a.[co] b.[co]
18290 $rm_try
18291
18292 : Check stream access
18293 $cat >&4 <<EOM
18294 Checking how to access stdio streams by file descriptor number...
18295 EOM
18296 case "$stdio_stream_array" in
18297 '')     $cat >try.c <<EOCP
18298 #include <stdio.h>
18299 int main() {
18300   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18301     printf("yes\n");
18302 }
18303 EOCP
18304         for s in _iob __iob __sF
18305         do
18306                 set try -DSTDIO_STREAM_ARRAY=$s
18307                 if eval $compile; then
18308                         case "`$run ./try`" in
18309                         yes)    stdio_stream_array=$s; break ;;
18310                         esac
18311                 fi
18312         done
18313         $rm_try
18314 esac
18315 case "$stdio_stream_array" in
18316 '')     $cat >&4 <<EOM
18317 I can't figure out how to access stdio streams by file descriptor number.
18318 EOM
18319         d_stdio_stream_array="$undef"
18320         ;;
18321 *)      $cat >&4 <<EOM
18322 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18323 EOM
18324         d_stdio_stream_array="$define"
18325         ;;
18326 esac
18327
18328 : see if strcoll exists
18329 set strcoll d_strcoll
18330 eval $inlibc
18331
18332 : check for structure copying
18333 echo " "
18334 echo "Checking to see if your C compiler can copy structs..." >&4
18335 $cat >try.c <<'EOCP'
18336 int main()
18337 {
18338         struct blurfl {
18339                 int dyick;
18340         } foo, bar;
18341
18342         foo = bar;
18343 }
18344 EOCP
18345 if $cc -c try.c >/dev/null 2>&1 ; then
18346         val="$define"
18347         echo "Yup, it can."
18348 else
18349         val="$undef"
18350         echo "Nope, it can't."
18351 fi
18352 set d_strctcpy
18353 eval $setvar
18354 $rm_try
18355
18356 : see if strerror and/or sys_errlist[] exist
18357 echo " "
18358 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18359     if set strerror val -f d_strerror; eval $csym; $val; then
18360                 echo 'strerror() found.' >&4
18361                 d_strerror="$define"
18362                 d_strerrm='strerror(e)'
18363                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18364                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18365                         d_syserrlst="$define"
18366                 else
18367                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18368                         d_syserrlst="$undef"
18369                 fi
18370     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18371                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18372                 echo 'strerror() found in string header.' >&4
18373                 d_strerror="$define"
18374                 d_strerrm='strerror(e)'
18375                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18376                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18377                                 d_syserrlst="$define"
18378                 else
18379                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18380                         d_syserrlst="$undef"
18381                 fi
18382     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18383                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18384                 d_strerror="$undef"
18385                 d_syserrlst="$define"
18386                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18387     else
18388                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18389                 d_strerror="$undef"
18390                 d_syserrlst="$undef"
18391                 d_strerrm='"unknown"'
18392     fi
18393 fi
18394
18395 : see if strerror_r exists
18396 set strerror_r d_strerror_r
18397 eval $inlibc
18398 case "$d_strerror_r" in
18399 "$define")
18400         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18401         case "$d_strerror_r_proto:$usethreads" in
18402         ":define")      d_strerror_r_proto=define
18403                 set d_strerror_r_proto strerror_r $hdrs
18404                 eval $hasproto ;;
18405         *)      ;;
18406         esac
18407         case "$d_strerror_r_proto" in
18408         define)
18409         case "$strerror_r_proto" in
18410         ''|0) try='int strerror_r(int, char*, size_t);'
18411         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18412         esac
18413         case "$strerror_r_proto" in
18414         ''|0) try='int strerror_r(int, char*, int);'
18415         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18416         esac
18417         case "$strerror_r_proto" in
18418         ''|0) try='char* strerror_r(int, char*, size_t);'
18419         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18420         esac
18421         case "$strerror_r_proto" in
18422         ''|0)   d_strerror_r=undef
18423                 strerror_r_proto=0
18424                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18425         * )     case "$strerror_r_proto" in
18426                 REENTRANT_PROTO*) ;;
18427                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18428                 esac
18429                 echo "Prototype: $try" ;;
18430         esac
18431         ;;
18432         *)      case "$usethreads" in
18433                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18434                 esac
18435                 d_strerror_r=undef
18436                 strerror_r_proto=0
18437                 ;;
18438         esac
18439         ;;
18440 *)      strerror_r_proto=0
18441         ;;
18442 esac
18443
18444 : see if strftime exists
18445 set strftime d_strftime
18446 eval $inlibc
18447
18448 : see if strlcat exists
18449 set strlcat d_strlcat
18450 eval $inlibc
18451
18452 : see if strlcpy exists
18453 set strlcpy d_strlcpy
18454 eval $inlibc
18455
18456 : see if strtod exists
18457 set strtod d_strtod
18458 eval $inlibc
18459
18460 : see if strtol exists
18461 set strtol d_strtol
18462 eval $inlibc
18463
18464 : see if strtold exists
18465 set strtold d_strtold
18466 eval $inlibc
18467
18468 : see if strtoll exists
18469 set strtoll d_strtoll
18470 eval $inlibc
18471
18472 case "$d_longlong-$d_strtoll" in
18473 "$define-$define")
18474         $cat <<EOM
18475 Checking whether your strtoll() works okay...
18476 EOM
18477         $cat >try.c <<'EOCP'
18478 #include <errno.h>
18479 #ifdef __hpux
18480 #define strtoll __strtoll
18481 #endif
18482 #ifdef __EMX__
18483 #define strtoll _strtoll
18484 #endif
18485 #include <stdio.h>
18486 extern long long int strtoll(char *s, char **, int);
18487 static int bad = 0;
18488 int check(char *s, long long ell, int een) {
18489         long long gll;
18490         errno = 0;
18491         gll = strtoll(s, 0, 10);
18492         if (!((gll == ell) && (errno == een)))
18493                 bad++;
18494 }
18495 int main() {
18496         check(" 1",                                      1LL, 0);
18497         check(" 0",                                      0LL, 0);
18498         check("-1",                                     -1LL, 0);
18499         check("-9223372036854775808", -9223372036854775808LL, 0);
18500         check("-9223372036854775808", -9223372036854775808LL, 0);
18501         check(" 9223372036854775807",  9223372036854775807LL, 0);
18502         check("-9223372036854775808", -9223372036854775808LL, 0);
18503         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18504         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18505         if (!bad)
18506                 printf("ok\n");
18507 }
18508 EOCP
18509         set try
18510         if eval $compile; then
18511                 yyy=`$run ./try`
18512                 case "$yyy" in
18513                 ok) echo "Your strtoll() seems to be working okay." ;;
18514                 *) cat <<EOM >&4
18515 Your strtoll() doesn't seem to be working okay.
18516 EOM
18517                    d_strtoll="$undef"
18518                    ;;
18519                 esac
18520         else
18521                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18522                 d_strtoll="$undef"
18523         fi
18524         ;;
18525 esac
18526
18527 : see if strtoq exists
18528 set strtoq d_strtoq
18529 eval $inlibc
18530
18531 : see if strtoul exists
18532 set strtoul d_strtoul
18533 eval $inlibc
18534
18535 case "$d_strtoul" in
18536 "$define")
18537         $cat <<EOM
18538 Checking whether your strtoul() works okay...
18539 EOM
18540         $cat >try.c <<'EOCP'
18541 #include <errno.h>
18542 #include <stdio.h>
18543 extern unsigned long int strtoul(char *s, char **, int);
18544 static int bad = 0;
18545 void check(char *s, unsigned long eul, int een) {
18546         unsigned long gul;
18547         errno = 0;
18548         gul = strtoul(s, 0, 10);
18549         if (!((gul == eul) && (errno == een)))
18550                 bad++;
18551 }
18552 int main() {
18553         check(" 1", 1L, 0);
18554         check(" 0", 0L, 0);
18555 EOCP
18556         case "$longsize" in
18557         8)
18558             $cat >>try.c <<'EOCP'
18559         check("18446744073709551615", 18446744073709551615UL, 0);
18560         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18561 #if 0 /* strtoul() for /^-/ strings is undefined. */
18562         check("-1", 18446744073709551615UL, 0);
18563         check("-18446744073709551614", 2, 0);
18564         check("-18446744073709551615", 1, 0);
18565         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18566         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18567 #endif
18568 EOCP
18569                 ;;
18570         4)
18571                     $cat >>try.c <<'EOCP'
18572         check("4294967295", 4294967295UL, 0);
18573         check("4294967296", 4294967295UL, ERANGE);
18574 #if 0 /* strtoul() for /^-/ strings is undefined. */
18575         check("-1", 4294967295UL, 0);
18576         check("-4294967294", 2, 0);
18577         check("-4294967295", 1, 0);
18578         check("-4294967296", 4294967295UL, ERANGE);
18579         check("-4294967297", 4294967295UL, ERANGE);
18580 #endif
18581 EOCP
18582                 ;;
18583         *)
18584 : Should we write these tests to be more portable by sprintf-ing
18585 : ~0 and then manipulating that char string as input for strtol?
18586                 ;;
18587         esac
18588         $cat >>try.c <<'EOCP'
18589         if (!bad)
18590                 printf("ok\n");
18591         return 0;
18592 }
18593 EOCP
18594         set try
18595         if eval $compile; then
18596                 case "`$run ./try`" in
18597                 ok) echo "Your strtoul() seems to be working okay." ;;
18598                 *) cat <<EOM >&4
18599 Your strtoul() doesn't seem to be working okay.
18600 EOM
18601                    d_strtoul="$undef"
18602                    ;;
18603                 esac
18604         else
18605                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18606                 d_strtoul="$undef"
18607         fi
18608         ;;
18609 esac
18610
18611 : see if strtoull exists
18612 set strtoull d_strtoull
18613 eval $inlibc
18614
18615 case "$d_longlong-$d_strtoull" in
18616 "$define-$define")
18617         $cat <<EOM
18618 Checking whether your strtoull() works okay...
18619 EOM
18620         $cat >try.c <<'EOCP'
18621 #include <errno.h>
18622 #ifdef __hpux
18623 #define strtoull __strtoull
18624 #endif
18625 #include <stdio.h>
18626 extern unsigned long long int strtoull(char *s, char **, int);
18627 static int bad = 0;
18628 int check(char *s, long long eull, int een) {
18629         long long gull;
18630         errno = 0;
18631         gull = strtoull(s, 0, 10);
18632         if (!((gull == eull) && (errno == een)))
18633                 bad++;
18634 }
18635 int main() {
18636         check(" 1",                                        1LL, 0);
18637         check(" 0",                                        0LL, 0);
18638         check("18446744073709551615",  18446744073709551615ULL, 0);
18639         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18640 #if 0 /* strtoull() for /^-/ strings is undefined. */
18641         check("-1",                    18446744073709551615ULL, 0);
18642         check("-18446744073709551614",                     2LL, 0);
18643         check("-18446744073709551615",                     1LL, 0);
18644         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18645         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18646 #endif
18647         if (!bad)
18648                 printf("ok\n");
18649 }
18650 EOCP
18651         set try
18652         if eval $compile; then
18653                 case "`$run ./try`" in
18654                 ok) echo "Your strtoull() seems to be working okay." ;;
18655                 *) cat <<EOM >&4
18656 Your strtoull() doesn't seem to be working okay.
18657 EOM
18658                    d_strtoull="$undef"
18659                    ;;
18660                 esac
18661         else
18662                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18663                 d_strtoull="$undef"
18664         fi
18665         ;;
18666 esac
18667
18668 : see if strtouq exists
18669 set strtouq d_strtouq
18670 eval $inlibc
18671
18672 case "$d_strtouq" in
18673 "$define")
18674         $cat <<EOM
18675 Checking whether your strtouq() works okay...
18676 EOM
18677         $cat >try.c <<'EOCP'
18678 #include <errno.h>
18679 #include <stdio.h>
18680 extern unsigned long long int strtouq(char *s, char **, int);
18681 static int bad = 0;
18682 void check(char *s, unsigned long long eull, int een) {
18683         unsigned long long gull;
18684         errno = 0;
18685         gull = strtouq(s, 0, 10);
18686         if (!((gull == eull) && (errno == een)))
18687                 bad++;
18688 }
18689 int main() {
18690         check(" 1",                                        1LL, 0);
18691         check(" 0",                                        0LL, 0);
18692         check("18446744073709551615",  18446744073709551615ULL, 0);
18693         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18694 #if 0 /* strtouq() for /^-/ strings is undefined. */
18695         check("-1",                    18446744073709551615ULL, 0);
18696         check("-18446744073709551614",                     2LL, 0);
18697         check("-18446744073709551615",                     1LL, 0);
18698         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18699         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18700 #endif
18701         if (!bad)
18702                 printf("ok\n");
18703         return 0;
18704 }
18705 EOCP
18706         set try
18707         if eval $compile; then
18708                 case "`$run ./try`" in
18709                 ok) echo "Your strtouq() seems to be working okay." ;;
18710                 *) cat <<EOM >&4
18711 Your strtouq() doesn't seem to be working okay.
18712 EOM
18713                    d_strtouq="$undef"
18714                    ;;
18715                 esac
18716         else
18717                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18718                 d_strtouq="$undef"
18719         fi
18720         ;;
18721 esac
18722
18723 : see if strxfrm exists
18724 set strxfrm d_strxfrm
18725 eval $inlibc
18726
18727 : see if symlink exists
18728 set symlink d_symlink
18729 eval $inlibc
18730
18731 : see if syscall exists
18732 set syscall d_syscall
18733 eval $inlibc
18734
18735 : see if prototype for syscall is available
18736 echo " "
18737 set d_syscallproto syscall $i_unistd unistd.h
18738 eval $hasproto
18739
18740 : see if sysconf exists
18741 set sysconf d_sysconf
18742 eval $inlibc
18743
18744 : see if system exists
18745 set system d_system
18746 eval $inlibc
18747
18748 : see if tcgetpgrp exists
18749 set tcgetpgrp d_tcgetpgrp
18750 eval $inlibc
18751
18752 : see if tcsetpgrp exists
18753 set tcsetpgrp d_tcsetpgrp
18754 eval $inlibc
18755
18756 : see if prototype for telldir is available
18757 echo " "
18758 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18759 eval $hasproto
18760
18761 : see if time exists
18762 echo " "
18763 if test "X$d_time" = X -o X"$timetype" = X; then
18764     if set time val -f d_time; eval $csym; $val; then
18765                 echo 'time() found.' >&4
18766                 val="$define"
18767                 rp="What is the type returned by time() on this system?"
18768                 set time_t timetype long stdio.h sys/types.h
18769                 eval $typedef_ask
18770     else
18771                 echo 'time() not found, hope that will do.' >&4
18772                 val="$undef"
18773                 timetype='int';
18774     fi
18775     set d_time
18776     eval $setvar
18777 fi
18778
18779 : see if timegm exists
18780 set timegm d_timegm
18781 eval $inlibc
18782
18783 : see if this is a sys/times.h system
18784 set sys/times.h i_systimes
18785 eval $inhdr
18786
18787 : see if times exists
18788 echo " "
18789 if set times val -f d_times; eval $csym; $val; then
18790         echo 'times() found.' >&4
18791         d_times="$define"
18792         inc=''
18793         case "$i_systimes" in
18794         "$define") inc='sys/times.h';;
18795         esac
18796         rp="What is the type returned by times() on this system?"
18797         set clock_t clocktype long stdio.h sys/types.h $inc
18798         eval $typedef_ask
18799 else
18800         echo 'times() NOT found, hope that will do.' >&4
18801         d_times="$undef"
18802         clocktype='int'
18803 fi
18804
18805 : see if tmpnam_r exists
18806 set tmpnam_r d_tmpnam_r
18807 eval $inlibc
18808 case "$d_tmpnam_r" in
18809 "$define")
18810         hdrs="$i_systypes sys/types.h define stdio.h "
18811         case "$d_tmpnam_r_proto:$usethreads" in
18812         ":define")      d_tmpnam_r_proto=define
18813                 set d_tmpnam_r_proto tmpnam_r $hdrs
18814                 eval $hasproto ;;
18815         *)      ;;
18816         esac
18817         case "$d_tmpnam_r_proto" in
18818         define)
18819         case "$tmpnam_r_proto" in
18820         ''|0) try='char* tmpnam_r(char*);'
18821         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18822         esac
18823         case "$tmpnam_r_proto" in
18824         ''|0)   d_tmpnam_r=undef
18825                 tmpnam_r_proto=0
18826                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18827         * )     case "$tmpnam_r_proto" in
18828                 REENTRANT_PROTO*) ;;
18829                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18830                 esac
18831                 echo "Prototype: $try" ;;
18832         esac
18833         ;;
18834         *)      case "$usethreads" in
18835                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18836                 esac
18837                 d_tmpnam_r=undef
18838                 tmpnam_r_proto=0
18839                 ;;
18840         esac
18841         ;;
18842 *)      tmpnam_r_proto=0
18843         ;;
18844 esac
18845
18846 : see if truncate exists
18847 set truncate d_truncate
18848 eval $inlibc
18849
18850 : see if ttyname_r exists
18851 set ttyname_r d_ttyname_r
18852 eval $inlibc
18853 case "$d_ttyname_r" in
18854 "$define")
18855         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18856         case "$d_ttyname_r_proto:$usethreads" in
18857         ":define")      d_ttyname_r_proto=define
18858                 set d_ttyname_r_proto ttyname_r $hdrs
18859                 eval $hasproto ;;
18860         *)      ;;
18861         esac
18862         case "$d_ttyname_r_proto" in
18863         define)
18864         case "$ttyname_r_proto" in
18865         ''|0) try='int ttyname_r(int, char*, size_t);'
18866         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18867         esac
18868         case "$ttyname_r_proto" in
18869         ''|0) try='int ttyname_r(int, char*, int);'
18870         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18871         esac
18872         case "$ttyname_r_proto" in
18873         ''|0) try='char* ttyname_r(int, char*, int);'
18874         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18875         esac
18876         case "$ttyname_r_proto" in
18877         ''|0)   d_ttyname_r=undef
18878                 ttyname_r_proto=0
18879                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18880         * )     case "$ttyname_r_proto" in
18881                 REENTRANT_PROTO*) ;;
18882                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18883                 esac
18884                 echo "Prototype: $try" ;;
18885         esac
18886         ;;
18887         *)      case "$usethreads" in
18888                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18889                 esac
18890                 d_ttyname_r=undef
18891                 ttyname_r_proto=0
18892                 ;;
18893         esac
18894         ;;
18895 *)      ttyname_r_proto=0
18896         ;;
18897 esac
18898
18899 : see if tzname[] exists
18900 echo " "
18901 if set tzname val -a d_tzname; eval $csym; $val; then
18902         val="$define"
18903         echo 'tzname[] found.' >&4
18904 else
18905         val="$undef"
18906         echo 'tzname[] NOT found.' >&4
18907 fi
18908 set d_tzname
18909 eval $setvar
18910
18911 : Check if is a multiplatform env
18912 case "$osname" in
18913 next|darwin) multiarch="$define" ;;
18914 esac
18915 case "$multiarch" in
18916 ''|[nN]*) multiarch="$undef" ;;
18917 esac
18918
18919 : check for ordering of bytes in a UV
18920 echo " "
18921 case "$multiarch" in
18922 *$define*)
18923         $cat <<EOM
18924 You seem to be doing a multiarchitecture build,
18925 skipping the byteorder check.
18926
18927 EOM
18928         byteorder='ffff'
18929         ;;
18930 *)
18931         case "$byteorder" in
18932         '')
18933                 $cat <<'EOM'
18934 In the following, larger digits indicate more significance.  A big-endian
18935 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18936 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18937 machines may have weird orders like 3412.  A Cray will report 87654321,
18938 an Alpha will report 12345678. If the test program works the default is
18939 probably right.
18940 I'm now running the test program...
18941 EOM
18942                 $cat >try.c <<EOCP
18943 #include <stdio.h>
18944 #$i_stdlib I_STDLIB
18945 #ifdef I_STDLIB
18946 #include <stdlib.h>
18947 #endif
18948 #include <sys/types.h>
18949 typedef $uvtype UV;
18950 int main()
18951 {
18952         int i;
18953         union {
18954                 UV l;
18955                 char c[$uvsize];
18956         } u;
18957
18958         if ($uvsize > 4)
18959                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18960         else
18961                 u.l = (UV)0x04030201;
18962         for (i = 0; i < $uvsize; i++)
18963                 printf("%c", u.c[i]+'0');
18964         printf("\n");
18965         exit(0);
18966 }
18967 EOCP
18968                 xxx_prompt=y
18969                 set try
18970                 if eval $compile && $run ./try > /dev/null; then
18971                         dflt=`$run ./try`
18972                         case "$dflt" in
18973                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18974                                 echo "(The test program ran ok.)"
18975                                 echo "byteorder=$dflt"
18976                                 xxx_prompt=n
18977                         ;;
18978                         ????|????????) echo "(The test program ran ok.)" ;;
18979                         *) echo "(The test program didn't run right for some reason.)" ;;
18980                         esac
18981                 else
18982                         dflt='4321'
18983                         cat <<'EOM'
18984 (I can't seem to compile the test program.  Guessing big-endian...)
18985 EOM
18986                 fi
18987                 case "$xxx_prompt" in
18988                 y)
18989                         rp="What is the order of bytes in $uvtype?"
18990                         . ./myread
18991                         byteorder="$ans"
18992                         ;;
18993                 *)      byteorder=$dflt
18994                         ;;
18995                 esac
18996                 ;;
18997         esac
18998         $rm_try
18999         ;;
19000 esac
19001
19002 : Checking 32bit alignedness
19003 $cat <<EOM
19004
19005 Checking to see whether you can access character data unalignedly...
19006 EOM
19007 case "$d_u32align" in
19008 '')   $cat >try.c <<EOCP
19009 #include <stdio.h>
19010 #$i_stdlib I_STDLIB
19011 #ifdef I_STDLIB
19012 #include <stdlib.h>
19013 #endif
19014 #define U32 $u32type
19015 #define BYTEORDER 0x$byteorder
19016 #define U8 $u8type
19017 #include <signal.h>
19018 #ifdef SIGBUS
19019 $signal_t bletch(int s) { exit(4); }
19020 #endif
19021 int main() {
19022 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19023     volatile U8 buf[8];
19024     volatile U32 *up;
19025     int i;
19026
19027     if (sizeof(U32) != 4) {
19028         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19029         exit(1);
19030     }
19031
19032     fflush(stdout);
19033
19034 #ifdef SIGBUS
19035     signal(SIGBUS, bletch);
19036 #endif
19037
19038     buf[0] = 0;
19039     buf[1] = 0;
19040     buf[2] = 0;
19041     buf[3] = 1;
19042     buf[4] = 0;
19043     buf[5] = 0;
19044     buf[6] = 0;
19045     buf[7] = 1;
19046
19047     for (i = 0; i < 4; i++) {
19048         up = (U32*)(buf + i);
19049         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19050                (*up == 1 << (8*(3-i)))  /* little-endian */
19051               )
19052            )
19053         {
19054             printf("read failed (%x)\n", *up);
19055             exit(2);
19056         }
19057     }
19058
19059     /* write test */
19060     for (i = 0; i < 4; i++) {
19061         up = (U32*)(buf + i);
19062         *up = 0xBeef;
19063         if (*up != 0xBeef) {
19064             printf("write failed (%x)\n", *up);
19065             exit(3);
19066         }
19067     }
19068
19069     exit(0);
19070 #else
19071     printf("1\n");
19072     exit(1);
19073 #endif
19074     return 0;
19075 }
19076 EOCP
19077 set try
19078 if eval $compile_ok; then
19079         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19080         $run ./try 2>&1 >/dev/null
19081         case "$?" in
19082         0)      cat >&4 <<EOM
19083 You can access character data pretty unalignedly.
19084 EOM
19085                 d_u32align="$undef"
19086                 ;;
19087         *)      cat >&4 <<EOM
19088 It seems that you must access character data in an aligned manner.
19089 EOM
19090                 d_u32align="$define"
19091                 ;;
19092         esac
19093 else
19094         rp='Can you access character data at unaligned addresses?'
19095         dflt='n'
19096         . ./myread
19097         case "$ans" in
19098         [yY]*)  d_u32align="$undef"  ;;
19099         *)      d_u32align="$define" ;;
19100         esac
19101 fi
19102 $rm_try
19103 ;;
19104 esac
19105
19106 : see if ualarm exists
19107 set ualarm d_ualarm
19108 eval $inlibc
19109
19110 : see if umask exists
19111 set umask d_umask
19112 eval $inlibc
19113
19114 : see if unordered exists
19115 set unordered d_unordered
19116 eval $inlibc
19117
19118 : see if unsetenv exists
19119 set unsetenv d_unsetenv
19120 eval $inlibc
19121
19122 : see if usleep exists
19123 set usleep d_usleep
19124 eval $inlibc
19125
19126 : see if prototype for usleep is available
19127 echo " "
19128 set d_usleepproto usleep $i_unistd unistd.h
19129 eval $hasproto
19130
19131 : see if ustat exists
19132 set ustat d_ustat
19133 eval $inlibc
19134
19135 : see if closedir exists
19136 set closedir d_closedir
19137 eval $inlibc
19138
19139 case "$d_closedir" in
19140 "$define")
19141         echo " "
19142         echo "Checking whether closedir() returns a status..." >&4
19143         cat > try.c <<EOM
19144 #$i_dirent I_DIRENT             /**/
19145 #$i_sysdir I_SYS_DIR            /**/
19146 #$i_sysndir I_SYS_NDIR          /**/
19147 #$i_systypes I_SYS_TYPES        /**/
19148
19149 #if defined(I_SYS_TYPES)
19150 #include <sys/types.h>
19151 #endif
19152 #if defined(I_DIRENT)
19153 #include <dirent.h>
19154 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
19155 #include <sys/dir.h>
19156 #endif
19157 #else
19158 #ifdef I_SYS_NDIR
19159 #include <sys/ndir.h>
19160 #else
19161 #ifdef I_SYS_DIR
19162 #ifdef hp9000s500
19163 #include <ndir.h>       /* may be wrong in the future */
19164 #else
19165 #include <sys/dir.h>
19166 #endif
19167 #endif
19168 #endif
19169 #endif
19170 int main() { return closedir(opendir(".")); }
19171 EOM
19172         set try
19173         if eval $compile_ok; then
19174                 if $run ./try > /dev/null 2>&1 ; then
19175                         echo "Yes, it does."
19176                         val="$undef"
19177                 else
19178                         echo "No, it doesn't."
19179                         val="$define"
19180                 fi
19181         else
19182                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19183                 val="$define"
19184         fi
19185         ;;
19186 *)
19187         val="$undef";
19188         ;;
19189 esac
19190 set d_void_closedir
19191 eval $setvar
19192 $rm_try
19193
19194 : see if there is a wait4
19195 set wait4 d_wait4
19196 eval $inlibc
19197
19198 : see if waitpid exists
19199 set waitpid d_waitpid
19200 eval $inlibc
19201
19202 : see if wcstombs exists
19203 set wcstombs d_wcstombs
19204 eval $inlibc
19205
19206 : see if wctomb exists
19207 set wctomb d_wctomb
19208 eval $inlibc
19209
19210 : see if writev exists
19211 set writev d_writev
19212 eval $inlibc
19213
19214 : preserve RCS keywords in files with variable substitution, grrr
19215 Date='$Date'
19216 Id='$Id'
19217 Log='$Log'
19218 RCSfile='$RCSfile'
19219 Revision='$Revision'
19220
19221 : check for alignment requirements
19222 echo " "
19223 case "$alignbytes" in
19224     '') echo "Checking alignment constraints..." >&4
19225         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19226             $cat >try.c <<'EOCP'
19227 typedef long double NV;
19228 EOCP
19229         else
19230             $cat >try.c <<'EOCP'
19231 typedef double NV;
19232 EOCP
19233         fi
19234         $cat >>try.c <<'EOCP'
19235 #include <stdio.h>
19236 struct foobar {
19237     char foo;
19238     NV bar;
19239 } try_algn;
19240 int main()
19241 {
19242     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19243     return(0);
19244 }
19245 EOCP
19246         set try
19247         if eval $compile_ok; then
19248             dflt=`$run ./try`
19249         else
19250             dflt='8'
19251             echo "(I can't seem to compile the test program...)"
19252         fi
19253         case "$multiarch" in
19254             *$define*)
19255                 : The usual safe value is 8, but Darwin with -Duselongdouble
19256                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19257                 : Configure to pick a larger value if needed.
19258                 if $test "$dflt" -lt 8; then
19259                     dflt='8'
19260                     echo "Setting alignment to 8 for multiarch support.">&4
19261                 fi
19262                 ;;
19263         esac
19264         ;;
19265     *) dflt="$alignbytes"
19266         ;;
19267 esac
19268 rp="Doubles must be aligned on a how-many-byte boundary?"
19269 . ./myread
19270 alignbytes="$ans"
19271 $rm_try
19272
19273 : set the base revision
19274 baserev=5.0
19275
19276 : Determine if this is an EBCDIC system
19277 echo " "
19278 echo "Determining whether or not we are on an EBCDIC system..." >&4
19279 $cat >try.c <<'EOM'
19280 int main()
19281 {
19282   if ('M'==0xd4) return 0;
19283   return 1;
19284 }
19285 EOM
19286
19287 case "$BOOTSTRAP_CHARSET" in
19288     Y|y|define) bootstrap_charset=$define       ;;
19289     *)          bootstrap_charset=$undef        ;;
19290 esac
19291
19292 val=$undef
19293 set try
19294 if eval $compile_ok; then
19295         if $run ./try; then
19296                 echo "You seem to speak EBCDIC." >&4
19297                 val="$define"
19298         else
19299                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19300         fi
19301 else
19302         echo "I'm unable to compile the test program." >&4
19303         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19304 fi
19305 $rm_try
19306 set ebcdic
19307 eval $setvar
19308
19309 : length of character in bytes. Is always 1, otherwise it is not C
19310 : This used to be a test using sizeof
19311 charsize=1
19312
19313 : Check for the number of bits in a character
19314 case "$charbits" in
19315 '')     echo "Checking how long a character is (in bits)..." >&4
19316         $cat >try.c <<EOCP
19317 #include <stdio.h>
19318 int main ()
19319 {
19320     int n;
19321     unsigned char c;
19322     for (c = 1, n = 0; c; c <<= 1, n++) ;
19323     printf ("%d\n", n);
19324     return (0);
19325     }
19326 EOCP
19327         set try
19328         if eval $compile_ok; then
19329                 dflt=`$run ./try`
19330         else
19331                 dflt='8'
19332                 echo "(I can't seem to compile the test program.  Guessing...)"
19333         fi
19334         ;;
19335 *)
19336         dflt="$charbits"
19337         ;;
19338 esac
19339 rp="What is the length of a character (in bits)?"
19340 . ./myread
19341 charbits="$ans"
19342 $rm_try
19343 case "$charbits" in
19344 8)      ;;
19345 *)      cat >&4 << EOM
19346 Your system has an unsigned character size of $charbits bits, which
19347 is rather unusual (normally it is 8 bits).  Perl likely will not work
19348 correctly on your system, with subtle bugs in various places.
19349 EOM
19350         rp='Do you really want to continue?'
19351         dflt='n'
19352         . ./myread
19353         case "$ans" in
19354                 [yY])   echo >&4 "Okay, continuing."    ;;
19355                 *)      exit 1                          ;;
19356         esac
19357 esac
19358
19359 : how do we concatenate cpp tokens here?
19360 echo " "
19361 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19362 $cat >cpp_stuff.c <<'EOCP'
19363 #define RCAT(a,b)a/**/b
19364 #define ACAT(a,b)a ## b
19365 RCAT(Rei,ser)
19366 ACAT(Cir,cus)
19367 EOCP
19368 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19369 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19370         echo "Oh!  Smells like ANSI's been here." >&4
19371         echo "We can catify or stringify, separately or together!"
19372         cpp_stuff=42
19373 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19374         echo "Ah, yes!  The good old days!" >&4
19375         echo "However, in the good old days we don't know how to stringify and"
19376         echo "catify at the same time."
19377         cpp_stuff=1
19378 else
19379         $cat >&4 <<EOM
19380 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19381 You're going to have to edit the values of CAT[2-5] in config.h...
19382 EOM
19383         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19384 fi
19385 $rm -f cpp_stuff.*
19386
19387 : see if this is a db.h system
19388 set db.h i_db
19389 eval $inhdr
19390
19391 case "$i_db" in
19392 $define)
19393         : Check db version.
19394         echo " "
19395         echo "Checking Berkeley DB version ..." >&4
19396         $cat >try.c <<EOCP
19397 #$d_const HASCONST
19398 #ifndef HASCONST
19399 #define const
19400 #endif
19401 #include <sys/types.h>
19402 #include <stdio.h>
19403 #$i_stdlib I_STDLIB
19404 #ifdef I_STDLIB
19405 #include <stdlib.h>
19406 #endif
19407 #include <db.h>
19408 int main(int argc, char *argv[])
19409 {
19410 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19411     int Major, Minor, Patch ;
19412     unsigned long Version ;
19413     (void)db_version(&Major, &Minor, &Patch) ;
19414     if (argc == 2) {
19415         printf("%d %d %d %d %d %d\n",
19416                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19417                Major, Minor, Patch);
19418         exit(0);
19419     }
19420     printf("You have Berkeley DB Version 2 or greater.\n");
19421
19422     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19423                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19424     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19425                 Major, Minor, Patch) ;
19426
19427     /* check that db.h & libdb are compatible */
19428     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19429         printf("db.h and libdb are incompatible.\n") ;
19430         exit(3);
19431     }
19432
19433     printf("db.h and libdb are compatible.\n") ;
19434
19435     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19436                 + DB_VERSION_PATCH ;
19437
19438     /* needs to be >= 2.3.4 */
19439     if (Version < 2003004) {
19440     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19441         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19442         exit(2);
19443     }
19444
19445     exit(0);
19446 #else
19447 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19448     if (argc == 2) {
19449         printf("1 0 0\n");
19450         exit(0);
19451     }
19452     printf("You have Berkeley DB Version 1.\n");
19453     exit(0);    /* DB version < 2: the coast is clear. */
19454 #else
19455     exit(1);    /* <db.h> not Berkeley DB? */
19456 #endif
19457 #endif
19458 }
19459 EOCP
19460         set try
19461         if eval $compile_ok && $run ./try; then
19462                 echo 'Looks OK.' >&4
19463                 set `$run ./try 1`
19464                 db_version_major=$1
19465                 db_version_minor=$2
19466                 db_version_patch=$3
19467         else
19468                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19469                 i_db=$undef
19470                 case " $libs " in
19471                 *"-ldb "*)
19472                         : Remove db from list of libraries to use
19473                         echo "Removing unusable -ldb from library list" >&4
19474                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19475                         shift
19476                         libs="$*"
19477                         echo "libs = $libs" >&4
19478                         ;;
19479                 esac
19480         fi
19481         $rm_try
19482         ;;
19483 esac
19484
19485 case "$i_db" in
19486 define)
19487         : Check the return type needed for hash
19488         echo " "
19489         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19490         $cat >try.c <<EOCP
19491 #$d_const HASCONST
19492 #ifndef HASCONST
19493 #define const
19494 #endif
19495 #include <sys/types.h>
19496 #include <db.h>
19497
19498 #ifndef DB_VERSION_MAJOR
19499 u_int32_t hash_cb (ptr, size)
19500 const void *ptr;
19501 size_t size;
19502 {
19503 }
19504 HASHINFO info;
19505 int main()
19506 {
19507         info.hash = hash_cb;
19508 }
19509 #endif
19510 EOCP
19511         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19512                 if $contains warning try.out >>/dev/null 2>&1 ; then
19513                         db_hashtype='int'
19514                 else
19515                         db_hashtype='u_int32_t'
19516                 fi
19517         else
19518                 : XXX Maybe we should just give up here.
19519                 db_hashtype=u_int32_t
19520                 $cat try.out >&4
19521                 echo "Help:  I can't seem to compile the db test program." >&4
19522                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19523         fi
19524         $rm_try
19525         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19526         ;;
19527 *)      db_hashtype=u_int32_t
19528         ;;
19529 esac
19530 case "$i_db" in
19531 define)
19532         : Check the return type needed for prefix
19533         echo " "
19534         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19535         cat >try.c <<EOCP
19536 #$d_const HASCONST
19537 #ifndef HASCONST
19538 #define const
19539 #endif
19540 #include <sys/types.h>
19541 #include <db.h>
19542
19543 #ifndef DB_VERSION_MAJOR
19544 size_t prefix_cb (key1, key2)
19545 const DBT *key1;
19546 const DBT *key2;
19547 {
19548 }
19549 BTREEINFO info;
19550 int main()
19551 {
19552         info.prefix = prefix_cb;
19553 }
19554 #endif
19555 EOCP
19556         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19557                 if $contains warning try.out >>/dev/null 2>&1 ; then
19558                         db_prefixtype='int'
19559                 else
19560                         db_prefixtype='size_t'
19561                 fi
19562         else
19563                 db_prefixtype='size_t'
19564                 : XXX Maybe we should just give up here.
19565                 $cat try.out >&4
19566                 echo "Help:  I can't seem to compile the db test program." >&4
19567                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19568         fi
19569         $rm_try
19570         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19571         ;;
19572 *)      db_prefixtype='size_t'
19573         ;;
19574 esac
19575
19576 : How can we generate normalized random numbers ?
19577 echo " "
19578 echo "Using our internal random number implementation..." >&4
19579
19580 case "$ccflags" in
19581 *-Dmy_rand=*|*-Dmy_srand=*)
19582         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19583         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19584         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19585         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19586         ;;
19587 esac
19588
19589 randfunc=Perl_drand48
19590 drand01="Perl_drand48()"
19591 seedfunc="Perl_drand48_init"
19592 randbits=48
19593 randseedtype=U32
19594
19595 : Check how to flush
19596 echo " "
19597 $cat >&4 <<EOM
19598 Checking how to flush all pending stdio output...
19599 EOM
19600 # I only know how to find the first 32 possibly open files on SunOS.
19601 # See also hints/sunos_4_1.sh and util.c  --AD
19602 case "$osname" in
19603 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19604 esac
19605 $cat >>try.c <<EOCP
19606 #include <stdio.h>
19607 #$i_stdlib I_STDLIB
19608 #ifdef I_STDLIB
19609 #include <stdlib.h>
19610 #endif
19611 #$i_unistd I_UNISTD
19612 #ifdef I_UNISTD
19613 # include <unistd.h>
19614 #endif
19615 #$d_sysconf HAS_SYSCONF
19616 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19617 #ifdef HAS_STDIO_STREAM_ARRAY
19618 # define STDIO_STREAM_ARRAY $stdio_stream_array
19619 #endif
19620 int main() {
19621   FILE* p;
19622   unlink("try.out");
19623   p = fopen("try.out", "w");
19624 #ifdef TRY_FPUTC
19625   fputc('x', p);
19626 #else
19627 # ifdef TRY_FPRINTF
19628   fprintf(p, "x");
19629 # endif
19630 #endif
19631 #ifdef TRY_FFLUSH_NULL
19632   fflush(NULL);
19633 #endif
19634 #ifdef TRY_FFLUSH_ALL
19635   {
19636     long open_max = -1;
19637 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19638     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19639 # else
19640 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19641     open_max = sysconf(_SC_OPEN_MAX);
19642 #  else
19643 #   ifdef FOPEN_MAX
19644     open_max = FOPEN_MAX;
19645 #   else
19646 #    ifdef OPEN_MAX
19647     open_max = OPEN_MAX;
19648 #    else
19649 #     ifdef _NFILE
19650     open_max = _NFILE;
19651 #     endif
19652 #    endif
19653 #   endif
19654 #  endif
19655 # endif
19656 # ifdef HAS_STDIO_STREAM_ARRAY
19657     if (open_max > 0) {
19658       long i;
19659       for (i = 0; i < open_max; i++)
19660             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19661                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19662                 STDIO_STREAM_ARRAY[i]._flag)
19663                 fflush(&STDIO_STREAM_ARRAY[i]);
19664     }
19665   }
19666 # endif
19667 #endif
19668   _exit(42);
19669 }
19670 EOCP
19671 : first we have to find out how _not_ to flush
19672 $to try.c
19673 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19674     output=''
19675     set try -DTRY_FPUTC
19676     if eval $compile; then
19677             $run ./try 2>/dev/null
19678             code="$?"
19679             $from try.out
19680             if $test ! -s try.out -a "X$code" = X42; then
19681                 output=-DTRY_FPUTC
19682             fi
19683     fi
19684     case "$output" in
19685     '')
19686             set try -DTRY_FPRINTF
19687             if eval $compile; then
19688                     $run ./try 2>/dev/null
19689                     code="$?"
19690                     $from try.out
19691                     if $test ! -s try.out -a "X$code" = X42; then
19692                         output=-DTRY_FPRINTF
19693                     fi
19694             fi
19695         ;;
19696     esac
19697 fi
19698 : check for fflush NULL behavior
19699 case "$fflushNULL" in
19700 '')     set try -DTRY_FFLUSH_NULL $output
19701         if eval $compile; then
19702                 $run ./try 2>/dev/null
19703                 code="$?"
19704                 $from try.out
19705                 if $test -s try.out -a "X$code" = X42; then
19706                         fflushNULL="`$cat try.out`"
19707                 else
19708                         if $test "X$code" != X42; then
19709                                 $cat >&4 <<EOM
19710 (If this test failed, don't worry, we'll try another method shortly.)
19711 EOM
19712                         fi
19713                 fi
19714         fi
19715         $rm -f core try.core core.try.*
19716         case "$fflushNULL" in
19717         x)      $cat >&4 <<EOM
19718 Your fflush(NULL) works okay for output streams.
19719 Let's see if it clobbers input pipes...
19720 EOM
19721 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19722 # bug that improperly flushes the input end of pipes.  So we avoid the
19723 # autoflush on fork/system/exec support for now. :-(
19724 $cat >tryp.c <<EOCP
19725 #include <stdio.h>
19726 int
19727 main(int argc, char **argv)
19728 {
19729     char buf[1024];
19730     int i;
19731     char *bp = buf;
19732     while (1) {
19733         while ((i = getc(stdin)) != -1
19734                && (*bp++ = i) != '\n'
19735                && bp < &buf[1024])
19736         /* DO NOTHING */ ;
19737         *bp = '\0';
19738         fprintf(stdout, "%s", buf);
19739         fflush(NULL);
19740         if (i == -1)
19741             return 0;
19742         bp = buf;
19743     }
19744 }
19745 EOCP
19746                 fflushNULL="$define"
19747                 set tryp
19748                 if eval $compile; then
19749                     $rm -f tryp.out
19750                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
19751                     if $test "X$targethost" != X; then
19752                         $to tryp.c
19753                         $to tryp
19754                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19755                     else
19756                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19757                     fi
19758                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19759                        $cat >&4 <<EOM
19760 fflush(NULL) seems to behave okay with input streams.
19761 EOM
19762                         fflushNULL="$define"
19763                     else
19764                         $cat >&4 <<EOM
19765 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19766 EOM
19767                         fflushNULL="$undef"
19768                     fi
19769                 fi
19770                 $rm -f core tryp.c tryp.core core.tryp.*
19771                 ;;
19772         '')     $cat >&4 <<EOM
19773 Your fflush(NULL) isn't working (contrary to ANSI C).
19774 EOM
19775                 fflushNULL="$undef"
19776                 ;;
19777         *)      $cat >&4 <<EOM
19778 Cannot figure out whether your fflush(NULL) works or not.
19779 I'm assuming it doesn't (contrary to ANSI C).
19780 EOM
19781                 fflushNULL="$undef"
19782                 ;;
19783         esac
19784         ;;
19785 $define|true|[yY]*)
19786         fflushNULL="$define"
19787         ;;
19788 *)
19789         fflushNULL="$undef"
19790         ;;
19791 esac
19792 : check explicit looping only if NULL did not work, and if the pipe
19793 : bug does not show up on an explicit flush too
19794 case "$fflushNULL" in
19795 "$undef")
19796         $cat >tryp.c <<EOCP
19797 #include <stdio.h>
19798 int
19799 main(int argc, char **argv)
19800 {
19801     char buf[1024];
19802     int i;
19803     char *bp = buf;
19804     while (1) {
19805         while ((i = getc(stdin)) != -1
19806                && (*bp++ = i) != '\n'
19807                && bp < &buf[1024])
19808         /* DO NOTHING */ ;
19809         *bp = '\0';
19810         fprintf(stdout, "%s", buf);
19811         fflush(stdin);
19812         if (i == -1)
19813             return 0;
19814         bp = buf;
19815     }
19816 }
19817 EOCP
19818         set tryp
19819         if eval $compile; then
19820             $rm -f tryp.out
19821             if $test "X$targethost" != X; then
19822                 $to tryp.c
19823                 $to tryp
19824                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
19825             else
19826                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
19827             fi
19828             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19829                $cat >&4 <<EOM
19830 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19831 EOM
19832                 : now check for fflushall behaviour
19833                 case "$fflushall" in
19834                 '')     set try -DTRY_FFLUSH_ALL $output
19835                         if eval $compile; then
19836                                 $cat >&4 <<EOM
19837 (Now testing the other method--but note that this also may fail.)
19838 EOM
19839                                 $run ./try 2>/dev/null
19840                                 code=$?
19841                                 $from try.out
19842                                 if $test -s try.out -a "X$code" = X42; then
19843                                         fflushall="`$cat try.out`"
19844                                 fi
19845                         fi
19846                         $rm_try
19847                         case "$fflushall" in
19848                         x)      $cat >&4 <<EOM
19849 Whew. Flushing explicitly all the stdio streams works.
19850 EOM
19851                                 fflushall="$define"
19852                                 ;;
19853                         '')     $cat >&4 <<EOM
19854 Sigh. Flushing explicitly all the stdio streams doesn't work.
19855 EOM
19856                                 fflushall="$undef"
19857                                 ;;
19858                         *)      $cat >&4 <<EOM
19859 Cannot figure out whether flushing stdio streams explicitly works or not.
19860 I'm assuming it doesn't.
19861 EOM
19862                                 fflushall="$undef"
19863                                 ;;
19864                         esac
19865                         ;;
19866                 "$define"|true|[yY]*)
19867                         fflushall="$define"
19868                         ;;
19869                 *)
19870                         fflushall="$undef"
19871                         ;;
19872                 esac
19873             else
19874                 $cat >&4 <<EOM
19875 All is futile.  Even fflush(stdin) clobbers input pipes!
19876 EOM
19877                 fflushall="$undef"
19878             fi
19879         else
19880             fflushall="$undef"
19881         fi
19882         $rm -f core tryp.c tryp.core core.tryp.*
19883         ;;
19884 *)      fflushall="$undef"
19885         ;;
19886 esac
19887
19888 case "$fflushNULL$fflushall" in
19889 undefundef)
19890         $cat <<EOM
19891 OK, I give up.  I cannot figure out how to flush pending stdio output.
19892 We won't be flushing handles at all before fork/exec/popen.
19893 EOM
19894         ;;
19895 esac
19896 $rm_try tryp
19897
19898 : Store the full pathname to the ar program for use in the C program
19899 : Respect a hint or command line value for full_ar.
19900 case "$full_ar" in
19901 '') full_ar=$ar ;;
19902 esac
19903
19904 : Store the full pathname to the sed program for use in the C program
19905 full_sed=$sed
19906
19907 : see what type gids are declared as in the kernel
19908 echo " "
19909 echo "Looking for the type for group ids returned by getgid()."
19910 set gid_t gidtype xxx stdio.h sys/types.h
19911 eval $typedef
19912 case "$gidtype" in
19913 xxx)
19914         xxx=`./findhdr sys/user.h`
19915         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19916         case $1 in
19917         unsigned) dflt="$1 $2" ;;
19918         *) dflt="$1" ;;
19919         esac
19920         ;;
19921 *) dflt="$gidtype";;
19922 esac
19923 case "$gidtype" in
19924 gid_t) echo "gid_t found." ;;
19925 *)      rp="What is the type for group ids returned by getgid()?"
19926         . ./myread
19927         gidtype="$ans"
19928         ;;
19929 esac
19930
19931 : Check the size of GID
19932 echo " "
19933 case "$gidtype" in
19934 *_t) zzz="$gidtype"     ;;
19935 *)   zzz="gid"          ;;
19936 esac
19937 echo "Checking the size of $zzz..." >&4
19938 cat > try.c <<EOCP
19939 #include <sys/types.h>
19940 #include <stdio.h>
19941 #$i_stdlib I_STDLIB
19942 #ifdef I_STDLIB
19943 #include <stdlib.h>
19944 #endif
19945 int main() {
19946     printf("%d\n", (int)sizeof($gidtype));
19947     exit(0);
19948 }
19949 EOCP
19950 set try
19951 if eval $compile_ok; then
19952         yyy=`$run ./try`
19953         case "$yyy" in
19954         '')     gidsize=4
19955                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19956                 ;;
19957         *)      gidsize=$yyy
19958                 echo "Your $zzz is $gidsize bytes long."
19959                 ;;
19960         esac
19961 else
19962         gidsize=4
19963         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19964 fi
19965
19966
19967 : Check if GID is signed
19968 echo " "
19969 case "$gidtype" in
19970 *_t) zzz="$gidtype"     ;;
19971 *)   zzz="gid"          ;;
19972 esac
19973 echo "Checking the sign of $zzz..." >&4
19974 cat > try.c <<EOCP
19975 #include <sys/types.h>
19976 #include <stdio.h>
19977 int main() {
19978         $gidtype foo = -1;
19979         if (foo < 0)
19980                 printf("-1\n");
19981         else
19982                 printf("1\n");
19983 }
19984 EOCP
19985 set try
19986 if eval $compile; then
19987         yyy=`$run ./try`
19988         case "$yyy" in
19989         '')     gidsign=1
19990                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19991                 ;;
19992         *)      gidsign=$yyy
19993                 case "$gidsign" in
19994                  1) echo "Your $zzz is unsigned." ;;
19995                 -1) echo "Your $zzz is signed."   ;;
19996                 esac
19997                 ;;
19998         esac
19999 else
20000         gidsign=1
20001         echo "(I can't compile the test program--guessing unsigned.)" >&4
20002 fi
20003
20004
20005 : Check 64bit sizes
20006 echo " "
20007
20008 if $test X"$quadtype" != X; then
20009
20010 echo "Checking how to print 64-bit integers..." >&4
20011
20012 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20013         $cat >try.c <<'EOCP'
20014 #include <sys/types.h>
20015 #include <stdio.h>
20016 int main() {
20017   int q = 12345678901;
20018   printf("%ld\n", q);
20019 }
20020 EOCP
20021         set try
20022         if eval $compile; then
20023                 yyy=`$run ./try`
20024                 case "$yyy" in
20025                 12345678901)
20026                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20027                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20028                         echo "We will use %d."
20029                         ;;
20030                 esac
20031         fi
20032 fi
20033
20034 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20035         $cat >try.c <<'EOCP'
20036 #include <sys/types.h>
20037 #include <stdio.h>
20038 int main() {
20039   long q = 12345678901;
20040   printf("%ld\n", q);
20041 }
20042 EOCP
20043         set try
20044         if eval $compile; then
20045                 yyy=`$run ./try`
20046                 case "$yyy" in
20047                 12345678901)
20048                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20049                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20050                         echo "We will use %ld."
20051                         ;;
20052                 esac
20053         fi
20054 fi
20055
20056 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20057         $cat >try.c <<'EOCP'
20058 #include <sys/types.h>
20059 #include <inttypes.h>
20060 #include <stdio.h>
20061 int main() {
20062   int64_t q = 12345678901;
20063   printf("%" PRId64 "\n", q);
20064 }
20065 EOCP
20066         set try
20067         if eval $compile; then
20068                 yyy=`$run ./try`
20069                 case "$yyy" in
20070                 12345678901)
20071                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20072                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20073                         echo "We will use the C9X style."
20074                         ;;
20075                 esac
20076         fi
20077 fi
20078
20079 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20080         $cat >try.c <<EOCP
20081 #include <sys/types.h>
20082 #include <stdio.h>
20083 int main() {
20084   $quadtype q = 12345678901;
20085   printf("%Ld\n", q);
20086 }
20087 EOCP
20088         set try
20089         if eval $compile; then
20090                 yyy=`$run ./try`
20091                 case "$yyy" in
20092                 12345678901)
20093                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20094                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20095                         echo "We will use %Ld."
20096                         ;;
20097                 esac
20098         fi
20099 fi
20100
20101 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20102         $cat >try.c <<'EOCP'
20103 #include <sys/types.h>
20104 #include <stdio.h>
20105 int main() {
20106   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20107   printf("%lld\n", q);
20108 }
20109 EOCP
20110         set try
20111         if eval $compile; then
20112                 yyy=`$run ./try`
20113                 case "$yyy" in
20114                 12345678901)
20115                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20116                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20117                         echo "We will use the %lld style."
20118                         ;;
20119                 esac
20120         fi
20121 fi
20122
20123 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20124         $cat >try.c <<EOCP
20125 #include <sys/types.h>
20126 #include <stdio.h>
20127 int main() {
20128   $quadtype q = 12345678901;
20129   printf("%qd\n", q);
20130 }
20131 EOCP
20132         set try
20133         if eval $compile; then
20134                 yyy=`$run ./try`
20135                 case "$yyy" in
20136                 12345678901)
20137                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20138                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20139                         echo "We will use %qd."
20140                         ;;
20141                 esac
20142         fi
20143 fi
20144
20145 if $test X"$sPRId64" = X; then
20146         echo "Cannot figure out how to print 64-bit integers." >&4
20147 fi
20148 $rm_try
20149
20150 fi
20151
20152 case "$sPRId64" in
20153 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20154         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20155         ;;
20156 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20157         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20158         ;;
20159 esac
20160
20161 : Check format strings for internal types
20162 echo " "
20163 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20164
20165 if $test X"$ivsize" = X8; then
20166         ivdformat="$sPRId64"
20167         uvuformat="$sPRIu64"
20168         uvoformat="$sPRIo64"
20169         uvxformat="$sPRIx64"
20170         uvXUformat="$sPRIXU64"
20171 else
20172         if $test X"$ivsize" = X"$longsize"; then
20173                 ivdformat='"ld"'
20174                 uvuformat='"lu"'
20175                 uvoformat='"lo"'
20176                 uvxformat='"lx"'
20177                 uvXUformat='"lX"'
20178         else
20179                 if $test X"$ivsize" = X"$intsize"; then
20180                         ivdformat='"d"'
20181                         uvuformat='"u"'
20182                         uvoformat='"o"'
20183                         uvxformat='"x"'
20184                         uvXUformat='"X"'
20185                 else
20186                         : far out
20187                         if $test X"$ivsize" = X"$shortsize"; then
20188                                 ivdformat='"hd"'
20189                                 uvuformat='"hu"'
20190                                 uvoformat='"ho"'
20191                                 uvxformat='"hx"'
20192                                 uvXUformat='"hX"'
20193                         fi
20194                 fi
20195         fi
20196 fi
20197
20198 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20199         nveformat="$sPRIeldbl"
20200         nvfformat="$sPRIfldbl"
20201         nvgformat="$sPRIgldbl"
20202         nvEUformat="$sPRIEUldbl"
20203         nvFUformat="$sPRIFUldbl"
20204         nvGUformat="$sPRIGUldbl"
20205 else
20206         nveformat='"e"'
20207         nvfformat='"f"'
20208         nvgformat='"g"'
20209         nvEUformat='"E"'
20210         nvFUformat='"F"'
20211         nvGUformat='"G"'
20212 fi
20213
20214 case "$ivdformat" in
20215 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20216     exit 1
20217     ;;
20218 esac
20219
20220 : Check format string for GID
20221
20222 echo " "
20223 $echo "Checking the format string to be used for gids..." >&4
20224
20225 case "$gidsign" in
20226 -1)     if $test X"$gidsize" = X"$ivsize"; then
20227                 gidformat="$ivdformat"
20228         else
20229                 if $test X"$gidsize" = X"$longsize"; then
20230                         gidformat='"ld"'
20231                 else
20232                         if $test X"$gidsize" = X"$intsize"; then
20233                                 gidformat='"d"'
20234                         else
20235                                 if $test X"$gidsize" = X"$shortsize"; then
20236                                         gidformat='"hd"'
20237                                 fi
20238                         fi
20239                 fi
20240         fi
20241         ;;
20242 *)      if $test X"$gidsize" = X"$uvsize"; then
20243                 gidformat="$uvuformat"
20244         else
20245                 if $test X"$gidsize" = X"$longsize"; then
20246                         gidformat='"lu"'
20247                 else
20248                         if $test X"$gidsize" = X"$intsize"; then
20249                                 gidformat='"u"'
20250                         else
20251                                 if $test X"$gidsize" = X"$shortsize"; then
20252                                         gidformat='"hu"'
20253                                 fi
20254                         fi
20255                 fi
20256         fi
20257         ;;
20258 esac
20259
20260 : see if getgroups exists
20261 set getgroups d_getgrps
20262 eval $inlibc
20263
20264 : see if setgroups exists
20265 set setgroups d_setgrps
20266 eval $inlibc
20267
20268 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20269 echo " "
20270 case "$d_getgrps$d_setgrps" in
20271 *define*)
20272         case "$groupstype" in
20273         '') dflt="$gidtype" ;;
20274         *)  dflt="$groupstype" ;;
20275         esac
20276         $cat <<EOM
20277 What type of pointer is the second argument to getgroups() and setgroups()?
20278 Usually this is the same as group ids, $gidtype, but not always.
20279
20280 EOM
20281         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20282         . ./myread
20283         groupstype="$ans"
20284         ;;
20285 *)  groupstype="$gidtype";;
20286 esac
20287
20288 : MAD = Misc Attribute Definition
20289
20290 if $test $patchlevel -lt 9; then
20291 : MAD is not available in 5.8.x or earlier.
20292     ans=n;
20293 else
20294     case "$mad" in
20295     $define|true|[yY]*) dflt='y' ;;
20296     *)                  dflt='n' ;;
20297     esac
20298     cat <<EOM
20299
20300 Would you like to build with Misc Attribute Decoration? This is development
20301 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20302 overhead on the interpreter.
20303
20304 If this doesn't make any sense to you, just accept the default '$dflt'.
20305 EOM
20306     rp='Build Perl with MAD?'
20307     . ./myread
20308 fi
20309 case "$ans" in
20310 y|Y)    val="$define"
20311         madlyh='madly.h madly.act madly.tab'
20312         madlysrc='madly.c'
20313         madlyobj="madly$_o" ;;
20314 *)      val="$undef"
20315         madlyh=''
20316         madlysrc=''
20317         madlyobj='' ;;
20318 esac
20319 set mad
20320 eval $setvar
20321
20322 : check whether make sets MAKE
20323 echo " "
20324 echo "Checking if your $make program sets \$(MAKE)..." >&4
20325 case "$make_set_make" in
20326 '')
20327         $sed 's/^X //' > testmake.mak << 'EOF'
20328 Xall:
20329 X       @echo 'maketemp="$(MAKE)"'
20330 EOF
20331         case "`$make -f testmake.mak 2>/dev/null`" in
20332         *maketemp=*) make_set_make='#' ;;
20333         *)      make_set_make="MAKE=$make" ;;
20334         esac
20335         $rm -f testmake.mak
20336         ;;
20337 esac
20338 case "$make_set_make" in
20339 '#') echo "Yup, it does.";;
20340 *) echo "Nope, it doesn't.";;
20341 esac
20342
20343 : see what type is used for mode_t
20344 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20345 set mode_t modetype int stdio.h sys/types.h
20346 eval $typedef_ask
20347
20348 : see if we need va_copy
20349 echo " "
20350 case "$i_stdarg" in
20351 "$define")
20352         $cat >try.c <<EOCP
20353 #include <stdarg.h>
20354 #include <stdio.h>
20355 #$i_stdlib I_STDLIB
20356 #ifdef I_STDLIB
20357 #include <stdlib.h>
20358 #endif
20359 #include <signal.h>
20360
20361 int
20362 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20363 {
20364   return vfprintf(f, fmt, *valp);
20365 }
20366
20367 int
20368 myvfprintf(FILE *f, const  char *fmt, va_list val)
20369 {
20370   return ivfprintf(f, fmt, &val);
20371 }
20372
20373 int
20374 myprintf(char *fmt, ...)
20375 {
20376   va_list val;
20377   va_start(val, fmt);
20378   return myvfprintf(stdout, fmt, val);
20379 }
20380
20381 int
20382 main(int ac, char **av)
20383 {
20384   signal(SIGSEGV, exit);
20385
20386   myprintf("%s%cs all right, then\n", "that", '\'');
20387   exit(0);
20388 }
20389 EOCP
20390         set try
20391         if eval $compile && $run ./try 2>&1 >/dev/null; then
20392                 case "`$run ./try`" in
20393                 "that's all right, then")
20394                         okay=yes
20395                         ;;
20396                 esac
20397         fi
20398         case "$okay" in
20399         yes)    echo "It seems that you don't need va_copy()." >&4
20400                 need_va_copy="$undef"
20401                 ;;
20402         *)      echo "It seems that va_copy() or similar will be needed." >&4
20403                 need_va_copy="$define"
20404                 ;;
20405         esac
20406         $rm_try
20407         ;;
20408 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20409         need_va_copy="$undef"
20410         ;;
20411 esac
20412
20413 : see what type is used for size_t
20414 rp="What is the type used for the length parameter for string functions?"
20415 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20416 eval $typedef_ask
20417
20418 : check for type of arguments to gethostbyaddr. 
20419 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20420         case "$d_gethbyaddr" in
20421         $define)
20422                 $cat <<EOM
20423
20424 Checking to see what type of arguments are accepted by gethostbyaddr().
20425 EOM
20426                 hdrs="$define sys/types.h
20427                         $d_socket sys/socket.h 
20428                         $i_niin netinet/in.h 
20429                         $i_netdb netdb.h
20430                         $i_unistd unistd.h"
20431                 : The first arg can 'char *' or 'void *'
20432                 : The second arg is some of integral type
20433                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20434                         for yyy in size_t long int; do
20435                                 case "$netdb_host_type" in
20436                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20437                                         if ./protochk "$try" $hdrs; then
20438                                                 echo "Your system accepts $xxx for the first arg."
20439                                                 echo "...and $yyy for the second arg."
20440                                                 netdb_host_type="$xxx"
20441                                                 netdb_hlen_type="$yyy"
20442                                         fi
20443                                         ;;
20444                                 esac
20445                         done
20446                 done
20447                 : In case none of those worked, prompt the user.
20448                 case "$netdb_host_type" in
20449                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20450                         dflt='char *'
20451                         . ./myread
20452                         netdb_host_type=$ans
20453                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20454                         dflt="$sizetype"
20455                         . ./myread
20456                         netdb_hlen_type=$ans
20457                         ;;
20458                 esac
20459                 ;;
20460         *)      : no gethostbyaddr, so pick harmless defaults
20461                 netdb_host_type='char *'
20462                 netdb_hlen_type="$sizetype"
20463                 ;;
20464         esac
20465         # Remove the "const" if needed. -- but then we'll have a 
20466         # prototype clash!
20467         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20468 fi
20469
20470 : check for type of argument to gethostbyname. 
20471 if test "X$netdb_name_type" = X ; then
20472         case "$d_gethbyname" in
20473         $define)
20474                 $cat <<EOM
20475
20476 Checking to see what type of argument is accepted by gethostbyname().
20477 EOM
20478                 hdrs="$define sys/types.h
20479                         $d_socket sys/socket.h 
20480                         $i_niin netinet/in.h 
20481                         $i_netdb netdb.h
20482                         $i_unistd unistd.h"
20483                 for xxx in "const char *" "char *"; do
20484                         case "$netdb_name_type" in
20485                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20486                                 if ./protochk "$try" $hdrs; then
20487                                         echo "Your system accepts $xxx."
20488                                         netdb_name_type="$xxx"
20489                                 fi
20490                                 ;;
20491                         esac
20492                 done
20493                 : In case none of those worked, prompt the user.
20494                 case "$netdb_name_type" in
20495                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20496                         dflt='char *'
20497                         . ./myread
20498                         netdb_name_type=$ans
20499                         ;;
20500                 esac
20501                 ;;
20502         *)      : no gethostbyname, so pick harmless default
20503                 netdb_name_type='char *'
20504                 ;;
20505         esac
20506 fi
20507
20508 : check for type of 1st argument to getnetbyaddr. 
20509 if test "X$netdb_net_type" = X ; then
20510         case "$d_getnbyaddr" in
20511         $define)
20512                 $cat <<EOM
20513
20514 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20515 EOM
20516                 hdrs="$define sys/types.h
20517                         $d_socket sys/socket.h 
20518                         $i_niin netinet/in.h 
20519                         $i_netdb netdb.h
20520                         $i_unistd unistd.h"
20521                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20522                         case "$netdb_net_type" in
20523                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20524                                 if ./protochk "$try" $hdrs; then
20525                                         echo "Your system accepts $xxx."
20526                                         netdb_net_type="$xxx"
20527                                 fi
20528                                 ;;
20529                         esac
20530                 done
20531                 : In case none of those worked, prompt the user.
20532                 case "$netdb_net_type" in
20533                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20534                         dflt='long'
20535                         . ./myread
20536                         netdb_net_type=$ans
20537                         ;;
20538                 esac
20539                 ;;
20540         *)      : no getnetbyaddr, so pick harmless default
20541                 netdb_net_type='long'
20542                 ;;
20543         esac
20544 fi
20545 : locate the preferred pager for this system
20546 fn=f/
20547 case "$pager" in
20548 '')
20549         dflt=''
20550         case "$pg" in
20551         /*) dflt=$pg;;
20552         [a-zA-Z]:/*) dflt=$pg;;
20553         esac
20554         case "$more" in
20555         /*) dflt=$more;;
20556         [a-zA-Z]:/*) dflt=$more;;
20557         esac
20558         case "$less" in
20559         /*) dflt=$less;;
20560         [a-zA-Z]:/*) dflt=$less;;
20561         esac
20562         case "$dflt" in
20563         '') dflt=/usr/ucb/more;;
20564         esac
20565         ;;
20566 *)      dflt="$pager"
20567         ;;
20568 esac
20569 fn="f/($dflt)"
20570 echo " "
20571 rp='What pager is used on your system?'
20572 . ./getfile
20573 pager="$ans"
20574
20575 : see what type pids are declared as in the kernel
20576 rp="What is the type of process ids on this system?"
20577 set pid_t pidtype int stdio.h sys/types.h
20578 eval $typedef_ask
20579
20580 : see if ar generates random libraries by itself
20581 echo " "
20582 echo "Checking how to generate random libraries on your machine..." >&4
20583 echo 'int bar1() { return bar2(); }' > bar1.c
20584 echo 'int bar2() { return 2; }' > bar2.c
20585 $cat > foo.c <<EOP
20586 #$i_stdlib I_STDLIB
20587 #ifdef I_STDLIB
20588 #include <stdlib.h>
20589 #endif
20590 int main() { printf("%d\n", bar1()); exit(0); }
20591 EOP
20592 $cc $ccflags -c bar1.c >/dev/null 2>&1
20593 $cc $ccflags -c bar2.c >/dev/null 2>&1
20594 $cc $ccflags -c foo.c >/dev/null 2>&1
20595 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20596 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20597         $run ./foobar >/dev/null 2>&1; then
20598         echo "$ar appears to generate random libraries itself."
20599         orderlib=false
20600         if [ "X$ranlib" = "X" ]; then
20601             ranlib=":"
20602         fi
20603 elif $ar s bar$_a >/dev/null 2>&1 &&
20604         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20605         $run ./foobar >/dev/null 2>&1; then
20606                 echo "a table of contents needs to be added with '$ar s'."
20607                 orderlib=false
20608                 ranlib="$ar s"
20609 elif $ar ts bar$_a >/dev/null 2>&1 &&
20610         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20611         $run ./foobar >/dev/null 2>&1; then
20612                 echo "a table of contents needs to be added with '$ar ts'."
20613                 orderlib=false
20614                 ranlib="$ar ts"
20615 else
20616         case "$ranlib" in
20617         :) ranlib='';;
20618         '')
20619                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20620                 $test -f $ranlib || ranlib=''
20621                 ;;
20622         esac
20623         if $test -n "$ranlib"; then
20624                 echo "your system has '$ranlib'; we'll use that."
20625                 orderlib=false
20626         else
20627                 echo "your system doesn't seem to support random libraries"
20628                 echo "so we'll use lorder and tsort to order the libraries."
20629                 orderlib=true
20630                 ranlib=":"
20631         fi
20632 fi
20633 $rm -f foo* bar*
20634
20635 : see if this is a values.h system
20636 set values.h i_values
20637 eval $inhdr
20638
20639 : Check the max offset that gmtime and localtime accept
20640 echo "Checking max offsets that gmtime () accepts"
20641
20642 case $i_values in
20643     define) yyy="#include <values.h>" ;;
20644     *)      yyy="" ;;
20645     esac
20646
20647 case "$sGMTIME_min/$sGMTIME_max" in
20648     0/0|/)
20649         $cat >try.c <<EOCP
20650 #include <sys/types.h>
20651 #include <stdio.h>
20652 #include <time.h>
20653 $yyy
20654
20655 int i;
20656 struct tm *tmp;
20657 time_t pt;
20658
20659 void gm_check (time_t t, int min_year, int max_year)
20660 {
20661     tmp = gmtime (&t);
20662     if ( tmp == NULL ||
20663         /* Check tm_year overflow */
20664          tmp->tm_year < min_year || tmp->tm_year > max_year)
20665         tmp = NULL;
20666     else
20667         pt = t;
20668     } /* gm_check */
20669
20670 int check_max ()
20671 {
20672     tmp = NULL;
20673     pt  = 0;
20674 #ifdef MAXLONG
20675     gm_check (MAXLONG, 69, 0x7fffffff);
20676 #endif
20677     if (tmp == NULL || tmp->tm_year < 0) {
20678         for (i = 63; i >= 0; i--) {
20679             time_t x = pt | ((time_t)1 << i);
20680             if (x < 0 || x < pt) continue;
20681             gm_check (x, 69, 0x7fffffff);
20682             }
20683         }
20684     printf ("sGMTIME_max=%ld\n", pt);
20685     return (0);
20686     } /* check_max */
20687
20688 int check_min ()
20689 {
20690     tmp = NULL;
20691     pt  = 0;
20692 #ifdef MINLONG
20693     gm_check (MINLONG, -1900, 70);
20694 #endif
20695     if (tmp == NULL) {
20696         for (i = 36; i >= 0; i--) {
20697             time_t x = pt - ((time_t)1 << i);
20698             if (x > 0) continue;
20699             gm_check (x, -1900, 70);
20700             }
20701         }
20702     printf ("sGMTIME_min=%ld\n", pt);
20703     return (0);
20704     } /* check_min */
20705
20706 int main (int argc, char *argv[])
20707 {
20708     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20709     check_max ();
20710     check_min ();
20711     return (0);
20712     } /* main */
20713 EOCP
20714         set try
20715         if eval $compile; then
20716             eval `$run ./try`
20717         else
20718             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20719             fi
20720         $rm_try
20721         ;;
20722     esac
20723
20724 echo "Checking max offsets that localtime () accepts"
20725
20726 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20727     0/0|/)
20728         $cat >try.c <<EOCP
20729 #include <sys/types.h>
20730 #include <stdio.h>
20731 #include <time.h>
20732 $yyy
20733
20734 int i;
20735 struct tm *tmp;
20736 time_t pt;
20737
20738 void local_check (time_t t, int min_year, int max_year)
20739 {
20740     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20741         tmp = NULL;
20742     else
20743         tmp = localtime (&t);
20744     if ( tmp == NULL ||
20745         /* Check tm_year overflow */
20746          tmp->tm_year < min_year || tmp->tm_year > max_year)
20747         tmp = NULL;
20748     else
20749         pt = t;
20750     } /* local_check */
20751
20752 int check_max ()
20753 {
20754     tmp = NULL;
20755     pt  = 0;
20756 #ifdef MAXLONG
20757     local_check (MAXLONG, 69, 0x7fffffff);
20758 #endif
20759     if (tmp == NULL || tmp->tm_year < 0) {
20760         for (i = 63; i >= 0; i--) {
20761             time_t x = pt | ((time_t)1 << i);
20762             if (x < 0 || x < pt) continue;
20763             local_check (x, 69, 0x7fffffff);
20764             }
20765         }
20766     printf ("sLOCALTIME_max=%ld\n", pt);
20767     return (0);
20768    } /* check_max */
20769
20770 int check_min ()
20771 {
20772     tmp = NULL;
20773     pt  = 0;
20774 #ifdef MINLONG
20775     local_check (MINLONG, -1900, 70);
20776 #endif
20777     if (tmp == NULL) {
20778         for (i = 36; i >= 0; i--) {
20779             time_t x = pt - ((time_t)1 << i);
20780             if (x > 0) continue;
20781             local_check (x, -1900, 70);
20782             }
20783         }
20784     printf ("sLOCALTIME_min=%ld\n", pt);
20785     return (0);
20786     } /* check_min */
20787
20788 int main (int argc, char *argv[])
20789 {
20790     check_max ();
20791     check_min ();
20792     return (0);
20793     } /* main */
20794 EOCP
20795         set try
20796         if eval $compile; then
20797             eval `$run ./try`
20798         else
20799             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20800             fi
20801         $rm_try
20802         ;;
20803     esac
20804
20805 : check for type of arguments to select.
20806 case "$selecttype" in
20807 '') case "$d_select" in
20808         $define)
20809                 echo " "
20810                 $cat <<EOM
20811 Checking to see what type of arguments are accepted by select().
20812 EOM
20813                 hdrs="$define sys/types.h
20814                         $i_systime sys/time.h
20815                         $i_sysselct sys/select.h
20816                         $d_socket sys/socket.h"
20817                 : The first arg can be int, unsigned, or size_t
20818                 : The last arg may or may not be 'const'
20819                 val=''
20820                 : void pointer has been seen but using that
20821                 : breaks the selectminbits test
20822                 for xxx in 'fd_set *' 'int *'; do
20823                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20824                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20825                                         case "$val" in
20826                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20827                                                 if ./protochk "$try" $hdrs; then
20828                                                         echo "Your system accepts $xxx."
20829                                                         val="$xxx"
20830                                                 fi
20831                                                 ;;
20832                                         esac
20833                                 done
20834                         done
20835                 done
20836                 case "$val" in
20837                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20838                         case "$d_fd_set" in
20839                                 $define) dflt="fd_set *" ;;
20840                                 *)              dflt="int *" ;;
20841                         esac
20842                         . ./myread
20843                         val=$ans
20844                         ;;
20845                 esac
20846                 selecttype="$val"
20847                 ;;
20848         *)      : no select, so pick a harmless default
20849                 selecttype='int *'
20850                 ;;
20851         esac
20852         ;;
20853 esac
20854
20855 : check for the select 'width'
20856 case "$selectminbits" in
20857 '') safebits=`expr $ptrsize \* 8`
20858     case "$d_select" in
20859         $define)
20860                 $cat <<EOM
20861
20862 Checking to see on how many bits at a time your select() operates...
20863 EOM
20864                 $cat >try.c <<EOCP
20865 #include <sys/types.h>
20866 #$i_time I_TIME
20867 #$i_systime I_SYS_TIME
20868 #$i_systimek I_SYS_TIME_KERNEL
20869 #ifdef I_TIME
20870 #   include <time.h>
20871 #endif
20872 #ifdef I_SYS_TIME
20873 #   ifdef I_SYS_TIME_KERNEL
20874 #       define KERNEL
20875 #   endif
20876 #   include <sys/time.h>
20877 #   ifdef I_SYS_TIME_KERNEL
20878 #       undef KERNEL
20879 #   endif
20880 #endif
20881 #$i_sysselct I_SYS_SELECT
20882 #ifdef I_SYS_SELECT
20883 #include <sys/select.h>
20884 #endif
20885 #$d_socket HAS_SOCKET
20886 #ifdef HAS_SOCKET
20887 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20888 #endif
20889 #include <stdio.h>
20890 #$i_stdlib I_STDLIB
20891 #ifdef I_STDLIB
20892 #include <stdlib.h>
20893 #endif
20894 $selecttype b;
20895 #define S sizeof(*(b))
20896 #define MINBITS 64
20897 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20898 #define NBITS  (NBYTES * 8)
20899 int main() {
20900     char *s = (char *)malloc(NBYTES);
20901     struct timeval t;
20902     int i;
20903     FILE* fp;
20904     int fd;
20905
20906     if (!s)
20907         exit(1);
20908     fclose(stdin);
20909     fp = fopen("try.c", "r");
20910     if (fp == 0)
20911       exit(2);
20912     fd = fileno(fp);
20913     if (fd < 0)
20914       exit(3);
20915     b = ($selecttype)s;
20916     for (i = 0; i < NBITS; i++)
20917         FD_SET(i, b);
20918     t.tv_sec  = 0;
20919     t.tv_usec = 0;
20920     select(fd + 1, b, 0, 0, &t);
20921     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20922     free(s);
20923     printf("%d\n", i + 1);
20924     return 0;
20925 }
20926 EOCP
20927                 set try
20928                 if eval $compile_ok; then
20929                         selectminbits=`$run ./try`
20930                         case "$selectminbits" in
20931                         '')     cat >&4 <<EOM
20932 Cannot figure out on how many bits at a time your select() operates.
20933 I'll play safe and guess it is $safebits bits.
20934 EOM
20935                                 selectminbits=$safebits
20936                                 bits="$safebits bits"
20937                                 ;;
20938                         1)      bits="1 bit" ;;
20939                         *)      bits="$selectminbits bits" ;;
20940                         esac
20941                         echo "Your select() operates on $bits at a time." >&4
20942                 else
20943                         rp='What is the minimum number of bits your select() operates on?'
20944                         case "$byteorder" in
20945                         12345678)       dflt=64 ;;
20946                         1234)           dflt=32 ;;
20947                         *)              dflt=1  ;;
20948                         esac
20949                         . ./myread
20950                         val=$ans
20951                         selectminbits="$val"
20952                 fi
20953                 $rm_try
20954                 ;;
20955         *)      : no select, so pick a harmless default
20956                 selectminbits=$safebits
20957                 ;;
20958         esac
20959         ;;
20960 esac
20961
20962 : Trace out the files included by signal.h, then look for SIGxxx names.
20963 if [ "X$fieldn" = X ]; then
20964         : Just make some guesses.  We check them later.
20965         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
20966 else
20967         xxx=`echo '#include <signal.h>' |
20968         $cppstdin $cppminus $cppflags 2>/dev/null |
20969         $grep '^[       ]*#.*include' |
20970         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20971                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20972 fi
20973 xxxfiles=''
20974 for xx in $xxx /dev/null ; do
20975         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20976 done
20977 case "$xxxfiles" in
20978 '')     xxxfiles=`./findhdr signal.h` ;;
20979 esac
20980 xxx=`awk '
20981 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20982         print substr($2, 4, 20)
20983 }
20984 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20985         print substr($3, 4, 20)
20986 }' $xxxfiles`
20987 : Append some common names just in case the awk scan failed.
20988 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20989 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20990 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20991 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20992 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20993
20994 : generate a few handy files for later
20995 $cat > signal.c <<EOCP
20996 #include <sys/types.h>
20997 #include <signal.h>
20998 #$i_stdlib I_STDLIB
20999 #ifdef I_STDLIB
21000 #include <stdlib.h>
21001 #endif
21002 #include <stdio.h>
21003 int main() {
21004
21005 /* Strange style to avoid deeply-nested #if/#else/#endif */
21006 #ifndef NSIG
21007 #  ifdef _NSIG
21008 #    define NSIG (_NSIG)
21009 #  endif
21010 #endif
21011
21012 #ifndef NSIG
21013 #  ifdef SIGMAX
21014 #    define NSIG (SIGMAX+1)
21015 #  endif
21016 #endif
21017
21018 #ifndef NSIG
21019 #  ifdef SIG_MAX
21020 #    define NSIG (SIG_MAX+1)
21021 #  endif
21022 #endif
21023
21024 #ifndef NSIG
21025 #  ifdef _SIG_MAX
21026 #    define NSIG (_SIG_MAX+1)
21027 #  endif
21028 #endif
21029
21030 #ifndef NSIG
21031 #  ifdef MAXSIG
21032 #    define NSIG (MAXSIG+1)
21033 #  endif
21034 #endif
21035
21036 #ifndef NSIG
21037 #  ifdef MAX_SIG
21038 #    define NSIG (MAX_SIG+1)
21039 #  endif
21040 #endif
21041
21042 #ifndef NSIG
21043 #  ifdef SIGARRAYSIZE
21044 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21045 #  endif
21046 #endif
21047
21048 #ifndef NSIG
21049 #  ifdef _sys_nsig
21050 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21051 #  endif
21052 #endif
21053
21054 /* Default to some arbitrary number that's big enough to get most
21055    of the common signals.
21056 */
21057 #ifndef NSIG
21058 #    define NSIG 50
21059 #endif
21060
21061 printf("NSIG %d\n", NSIG);
21062
21063 #ifndef JUST_NSIG
21064
21065 EOCP
21066
21067 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21068 {
21069         printf "#ifdef SIG"; printf $1; printf "\n"
21070         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21071         printf $1; printf ");\n"
21072         printf "#endif\n"
21073 }
21074 END {
21075         printf "#endif /* JUST_NSIG */\n";
21076         printf "exit(0);\n}\n";
21077 }
21078 ' >>signal.c
21079 $cat >signal.awk <<'EOP'
21080 BEGIN { ndups = 0 }
21081 $1 ~ /^NSIG$/ { nsig = $2 }
21082 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21083     if ($2 > maxsig) { maxsig = $2 }
21084     if (sig_name[$2]) {
21085         dup_name[ndups] = $1
21086         dup_num[ndups] = $2
21087         ndups++
21088     }
21089     else {
21090         sig_name[$2] = $1
21091         sig_num[$2] = $2
21092     }
21093 }
21094 END {
21095     if (nsig == 0) {
21096         nsig = maxsig + 1
21097     }
21098     printf("NSIG %d\n", nsig);
21099     for (n = 1; n < nsig; n++) {
21100         if (sig_name[n]) {
21101             printf("%s %d\n", sig_name[n], sig_num[n])
21102         }
21103         else {
21104             printf("NUM%d %d\n", n, n)
21105         }
21106     }
21107     for (n = 0; n < ndups; n++) {
21108         printf("%s %d\n", dup_name[n], dup_num[n])
21109     }
21110 }
21111 EOP
21112 $cat >signal_cmd <<EOS
21113 $startsh
21114 if $test -s signal.lst; then
21115     echo "Using your existing signal.lst file"
21116         exit 0
21117 fi
21118 xxx="$xxx"
21119 EOS
21120 $cat >>signal_cmd <<'EOS'
21121
21122 set signal
21123 if eval $compile_ok; then
21124         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21125                 $uniq | $awk -f signal.awk >signal.lst
21126 else
21127         echo "(I can't seem be able to compile the whole test program)" >&4
21128         echo "(I'll try it in little pieces.)" >&4
21129         set signal -DJUST_NSIG
21130         if eval $compile_ok; then
21131                 $run ./signal$_exe > signal.nsg
21132                 $cat signal.nsg
21133         else
21134                 echo "I can't seem to figure out how many signals you have." >&4
21135                 echo "Guessing 50." >&4
21136                 echo 'NSIG 50' > signal.nsg
21137         fi
21138         : Now look at all the signal names, one at a time.
21139         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21140                 $cat > signal.c <<EOCP
21141 #include <sys/types.h>
21142 #include <signal.h>
21143 #include <stdio.h>
21144 int main() {
21145 printf("$xx %d\n", SIG${xx});
21146 return 0;
21147 }
21148 EOCP
21149                 set signal
21150                 if eval $compile; then
21151                         echo "SIG${xx} found."
21152                         $run ./signal$_exe  >> signal.ls1
21153                 else
21154                         echo "SIG${xx} NOT found."
21155                 fi
21156         done
21157         if $test -s signal.ls1; then
21158                 $cat signal.nsg signal.ls1 |
21159                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21160         fi
21161
21162 fi
21163 if $test -s signal.lst; then
21164         :
21165 else
21166         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21167         echo 'kill -l' >signal
21168         set X `csh -f <signal`
21169         $rm -f signal
21170         shift
21171         case $# in
21172         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21173         esac
21174         echo $@ | $tr ' ' $trnl | \
21175             $awk '{ printf "%s %d\n", $1, ++s; }
21176                   END { printf "NSIG %d\n", ++s }' >signal.lst
21177 fi
21178 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21179 EOS
21180 chmod a+x signal_cmd
21181 $eunicefix signal_cmd
21182
21183 : generate list of signal names
21184 echo " "
21185 case "$sig_name_init" in
21186 '') doinit=yes ;;
21187 *)  case "$sig_num_init" in
21188     ''|*,*) doinit=yes ;;
21189     esac ;;
21190 esac
21191 case "$doinit" in
21192 yes)
21193         echo "Generating a list of signal names and numbers..." >&4
21194         . ./signal_cmd
21195         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21196         sig_name=`$awk 'BEGIN { printf "ZERO " }
21197                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21198         sig_num=`$awk  'BEGIN { printf "0 " }
21199                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21200         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21201                              !/^NSIG/   { printf "\"%s\", ", $1 }
21202                              END        { printf "0\n" }' signal.lst`
21203         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21204                              !/^NSIG/   { printf "%d, ", $2}
21205                              END        { printf "0\n"}' signal.lst`
21206         ;;
21207 esac
21208 echo "The following $sig_count signals are available:"
21209 echo " "
21210 echo $sig_name | $awk \
21211 'BEGIN { linelen = 0 }
21212 {
21213         for (i = 1; i <= NF; i++) {
21214                 name = "SIG" $i " "
21215                 linelen = linelen + length(name)
21216                 if (linelen > 70) {
21217                         printf "\n"
21218                         linelen = length(name)
21219                 }
21220                 printf "%s", name
21221         }
21222         printf "\n"
21223 }'
21224 sig_size=`echo $sig_name | awk '{print NF}'`
21225 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21226
21227 : Check size of size
21228 echo " "
21229 case "$sizetype" in
21230 *_t) zzz="$sizetype"    ;;
21231 *)   zzz="filesize"     ;;
21232 esac
21233 echo "Checking the size of $zzz..." >&4
21234 cat > try.c <<EOCP
21235 #include <sys/types.h>
21236 #include <stdio.h>
21237 #$i_stdlib I_STDLIB
21238 #ifdef I_STDLIB
21239 #include <stdlib.h>
21240 #endif
21241 int main() {
21242     printf("%d\n", (int)sizeof($sizetype));
21243     exit(0);
21244 }
21245 EOCP
21246 set try
21247 if eval $compile_ok; then
21248         yyy=`$run ./try`
21249         case "$yyy" in
21250         '')     sizesize=4
21251                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21252                 ;;
21253         *)      sizesize=$yyy
21254                 echo "Your $zzz size is $sizesize bytes."
21255                 ;;
21256         esac
21257 else
21258         sizesize=4
21259         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21260 fi
21261
21262
21263 : check for socklen_t
21264 echo " "
21265 echo "Checking to see if you have socklen_t..." >&4
21266 $cat >try.c <<EOCP
21267 #include <sys/types.h>
21268 #$d_socket HAS_SOCKET
21269 #ifdef HAS_SOCKET
21270 #include <sys/socket.h>
21271 #endif
21272 int main() { socklen_t x = 16; }
21273 EOCP
21274 set try
21275 if eval $compile; then
21276         val="$define"
21277         echo "You have socklen_t."
21278 else
21279         val="$undef"
21280         echo "You do not have socklen_t."
21281         case "$sizetype" in
21282         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21283         esac
21284 fi
21285 $rm_try
21286 set d_socklen_t
21287 eval $setvar
21288
21289 : see if this is a socks.h system
21290 set socks.h i_socks
21291 eval $inhdr
21292
21293 : check for type of the size argument to socket calls
21294 case "$d_socket" in
21295 "$define")
21296         $cat <<EOM
21297
21298 Checking to see what type is the last argument of accept().
21299 EOM
21300         yyy=''
21301         case "$d_socklen_t" in
21302         "$define") yyy="$yyy socklen_t"
21303         esac
21304         yyy="$yyy $sizetype int long unsigned"
21305         for xxx in $yyy; do
21306                 case "$socksizetype" in
21307                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21308                         case "$usesocks" in
21309                         "$define")
21310                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21311                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21312                                         socksizetype="$xxx"
21313                                 fi
21314                                 ;;
21315                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21316                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21317                                         socksizetype="$xxx"
21318                                 fi
21319                                 ;;
21320                         esac
21321                         ;;
21322                 esac
21323         done
21324 : In case none of those worked, prompt the user.
21325         case "$socksizetype" in
21326         '')     rp='What is the type for socket address structure sizes?'
21327                 dflt='int'
21328                 . ./myread
21329                 socksizetype=$ans
21330                 ;;
21331         esac
21332         ;;
21333 *)      : no sockets, so pick relatively harmless default
21334         socksizetype='int'
21335         ;;
21336 esac
21337
21338 : see what type is used for signed size_t
21339 set ssize_t ssizetype int stdio.h sys/types.h
21340 eval $typedef
21341 dflt="$ssizetype"
21342 $cat > try.c <<EOM
21343 #include <stdio.h>
21344 #$i_stdlib I_STDLIB
21345 #ifdef I_STDLIB
21346 #include <stdlib.h>
21347 #endif
21348 #include <sys/types.h>
21349 #define Size_t $sizetype
21350 #define SSize_t $dflt
21351 int main()
21352 {
21353         if (sizeof(Size_t) == sizeof(SSize_t))
21354                 printf("$dflt\n");
21355         else if (sizeof(Size_t) == sizeof(int))
21356                 printf("int\n");
21357         else
21358                 printf("long\n");
21359         exit(0);
21360 }
21361 EOM
21362 echo " "
21363 set try
21364 if eval $compile_ok && $run ./try > /dev/null; then
21365         ssizetype=`$run ./try`
21366         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21367 else
21368         $cat >&4 <<EOM
21369 Help! I can't compile and run the ssize_t test program: please enlighten me!
21370 (This is probably a misconfiguration in your system or libraries, and
21371 you really ought to fix it.  Still, I'll try anyway.)
21372
21373 I need a type that is the same size as $sizetype, but is guaranteed to
21374 be signed.  Common values are ssize_t, int and long.
21375
21376 EOM
21377         rp="What signed type is the same size as $sizetype?"
21378         . ./myread
21379         ssizetype="$ans"
21380 fi
21381 $rm_try
21382
21383 : Check the size of st_ino
21384 $echo " "
21385 $echo "Checking the size of st_ino..." >&4
21386 $cat > try.c <<EOCP
21387 #include <sys/stat.h>
21388 #include <stdio.h>
21389 #$i_stdlib I_STDLIB
21390 #ifdef I_STDLIB
21391 #include <stdlib.h>
21392 #endif
21393 int main() {
21394     struct stat st;
21395     printf("%d\n", (int)sizeof(st.st_ino));
21396     exit(0);
21397 }
21398 EOCP
21399 set try
21400 if eval $compile_ok; then
21401         val=`$run ./try`
21402         case "$val" in
21403         '')     st_ino_size=4
21404                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21405                 ;;
21406         *)      st_ino_size=$val
21407                 $echo "Your st_ino is $st_ino_size bytes long."
21408                 ;;
21409         esac
21410 else
21411         st_ino_size=4
21412         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21413 fi
21414 $rm_try
21415
21416 : Check if st_ino is signed
21417 $echo " "
21418 $echo "Checking the sign of st_ino..." >&4
21419 $cat > try.c <<EOCP
21420 #include <sys/stat.h>
21421 #include <stdio.h>
21422 int main() {
21423         struct stat foo;
21424         foo.st_ino = -1;
21425         if (foo.st_ino < 0)
21426                 printf("-1\n");
21427         else
21428                 printf("1\n");
21429 }
21430 EOCP
21431 set try
21432 if eval $compile; then
21433         val=`$run ./try`
21434         case "$val" in
21435         '')     st_ino_sign=1
21436                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21437                 ;;
21438         *)      st_ino_sign=$val
21439                 case "$st_ino_sign" in
21440                  1) $echo "Your st_ino is unsigned." ;;
21441                 -1) $echo "Your st_ino is signed."   ;;
21442                 esac
21443                 ;;
21444         esac
21445 else
21446         st_ino_sign=1
21447         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21448 fi
21449 $rm_try
21450
21451 : see what type of char stdio uses.
21452 echo " "
21453 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21454 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21455         echo "Your stdio uses unsigned chars." >&4
21456         stdchar="unsigned char"
21457 else
21458         echo "Your stdio uses signed chars." >&4
21459         stdchar="char"
21460 fi
21461 $rm -f stdioh
21462
21463 : see what type uids are declared as in the kernel
21464 echo " "
21465 echo "Looking for the type for user ids returned by getuid()."
21466 set uid_t uidtype xxx stdio.h sys/types.h
21467 eval $typedef
21468 case "$uidtype" in
21469 xxx)
21470         xxx=`./findhdr sys/user.h`
21471         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21472         case $1 in
21473         unsigned) dflt="$1 $2" ;;
21474         *) dflt="$1" ;;
21475         esac
21476         ;;
21477 *) dflt="$uidtype";;
21478 esac
21479 case "$uidtype" in
21480 uid_t)  echo "uid_t found." ;;
21481 *)      rp="What is the type for user ids returned by getuid()?"
21482         . ./myread
21483         uidtype="$ans"
21484         ;;
21485 esac
21486
21487 : Check size of UID
21488 echo " "
21489 case "$uidtype" in
21490 *_t) zzz="$uidtype"     ;;
21491 *)   zzz="uid"          ;;
21492 esac
21493 echo "Checking the size of $zzz..." >&4
21494 cat > try.c <<EOCP
21495 #include <sys/types.h>
21496 #include <stdio.h>
21497 #$i_stdlib I_STDLIB
21498 #ifdef I_STDLIB
21499 #include <stdlib.h>
21500 #endif
21501 int main() {
21502     printf("%d\n", (int)sizeof($uidtype));
21503     exit(0);
21504 }
21505 EOCP
21506 set try
21507 if eval $compile_ok; then
21508         yyy=`$run ./try`
21509         case "$yyy" in
21510         '')     uidsize=4
21511                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21512                 ;;
21513         *)      uidsize=$yyy
21514                 echo "Your $zzz is $uidsize bytes long."
21515                 ;;
21516         esac
21517 else
21518         uidsize=4
21519         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21520 fi
21521
21522 : Check if UID is signed
21523 echo " "
21524 case "$uidtype" in
21525 *_t) zzz="$uidtype"     ;;
21526 *)   zzz="uid"          ;;
21527 esac
21528 echo "Checking the sign of $zzz..." >&4
21529 cat > try.c <<EOCP
21530 #include <sys/types.h>
21531 #include <stdio.h>
21532 int main() {
21533         $uidtype foo = -1;
21534         if (foo < 0)
21535                 printf("-1\n");
21536         else
21537                 printf("1\n");
21538 }
21539 EOCP
21540 set try
21541 if eval $compile; then
21542         yyy=`$run ./try`
21543         case "$yyy" in
21544         '')     uidsign=1
21545                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21546                 ;;
21547         *)      uidsign=$yyy
21548                 case "$uidsign" in
21549                  1) echo "Your $zzz is unsigned." ;;
21550                 -1) echo "Your $zzz is signed."   ;;
21551                 esac
21552                 ;;
21553         esac
21554 else
21555         uidsign=1
21556         echo "(I can't compile the test program--guessing unsigned.)" >&4
21557 fi
21558
21559
21560 : Check format string for UID
21561 echo " "
21562 $echo "Checking the format string to be used for uids..." >&4
21563
21564 case "$uidsign" in
21565 -1)     if $test X"$uidsize" = X"$ivsize"; then
21566                 uidformat="$ivdformat"
21567         else
21568                 if $test X"$uidsize" = X"$longsize"; then
21569                         uidformat='"ld"'
21570                 else
21571                         if $test X"$uidsize" = X"$intsize"; then
21572                                 uidformat='"d"'
21573                         else
21574                                 if $test X"$uidsize" = X"$shortsize"; then
21575                                         uidformat='"hd"'
21576                                 fi
21577                         fi
21578                 fi
21579         fi
21580         ;;
21581 *)      if $test X"$uidsize" = X"$uvsize"; then
21582                 uidformat="$uvuformat"
21583         else
21584                 if $test X"$uidsize" = X"$longsize"; then
21585                         uidformat='"lu"'
21586                 else
21587                         if $test X"$uidsize" = X"$intsize"; then
21588                                 uidformat='"u"'
21589                         else
21590                                 if $test X"$uidsize" = X"$shortsize"; then
21591                                         uidformat='"hu"'
21592                                 fi
21593                         fi
21594                 fi
21595         fi
21596         ;;
21597 esac
21598
21599 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21600 echo " "
21601 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21602 $cat >try.c <<'EOM'
21603 /* Intentionally a long probe as I'd like to sanity check that the exact
21604    approach is going to work, as thinking it will work, but only having it
21605    part working at runtime is worse than not having it.  */
21606
21607 #include <sys/types.h>
21608 #include <sys/sysctl.h>
21609 #include <sys/param.h>
21610 #include <stdio.h>
21611 #include <string.h>
21612 #include <stdlib.h>
21613 #include <unistd.h>
21614
21615 int
21616 main(int argc, char **argv) {
21617     char *buffer;
21618     char *argv_leaf = strrchr(argv[0], '/');
21619     char *buffer_leaf;
21620     size_t size = 0;
21621     int mib[4];
21622
21623     mib[0] = CTL_KERN;
21624     mib[1] = KERN_PROC;
21625     mib[2] = KERN_PROC_PATHNAME;
21626     mib[3] = -1;
21627
21628     if (!argv_leaf) {
21629         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21630         return 1;
21631     }
21632
21633     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21634         perror("sysctl");
21635         return 2;
21636     }
21637
21638     if (size < strlen(argv_leaf) + 1) {
21639         fprintf(stderr, "size %lu is too short for a path\n",
21640                 (unsigned long) size);
21641         return 3;
21642     }
21643
21644     if (size > MAXPATHLEN * MAXPATHLEN) {
21645         fprintf(stderr, "size %lu is too long for a path\n",
21646                 (unsigned long) size);
21647         return 4;
21648     }
21649
21650     buffer = malloc(size);
21651     if (!buffer) {
21652         perror("malloc");
21653         return 5;
21654     }
21655
21656     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21657         perror("sysctl");
21658         return 6;
21659     }
21660
21661     if (strlen(buffer) + 1 != size) {
21662         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21663                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21664         return 7;
21665     }
21666
21667
21668     if (*buffer != '/') {
21669         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21670         return 8;
21671     }
21672
21673     if (strstr(buffer, "/./")) {
21674         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21675         return 9;
21676     }
21677
21678     if (strstr(buffer, "/../")) {
21679         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21680         return 10;
21681     }
21682
21683     buffer_leaf = strrchr(buffer, '/');
21684     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21685         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21686         return 11;
21687     }
21688
21689     free(buffer);
21690
21691     return 0;
21692 }
21693 EOM
21694
21695 val=$undef
21696 set try
21697 if eval $compile; then
21698         if $run ./try; then
21699                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21700                 val="$define"
21701         else
21702                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21703                 val="$undef"
21704         fi
21705 else
21706         echo "I'm unable to compile the test program." >&4
21707         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21708         val="$undef"
21709 fi
21710 $rm_try
21711 set usekernprocpathname
21712 eval $setvar
21713
21714 : Determine if we can use _NSGetExecutablePath to find executing program
21715 echo " "
21716 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21717 $cat >try.c <<'EOM'
21718 /* Intentionally a long probe as I'd like to sanity check that the exact
21719    approach is going to work, as thinking it will work, but only having it
21720    part working at runtime is worse than not having it.  */
21721 #include <mach-o/dyld.h>
21722 #include <stdio.h>
21723 #include <stdlib.h>
21724 #include <sys/param.h>
21725 #include <string.h>
21726
21727 int
21728 main(int argc, char **argv) {
21729     char buf[1];
21730     uint32_t size = sizeof(buf);
21731     int result;
21732     char *buffer;
21733     char *tidied;
21734     char *argv_leaf = strrchr(argv[0], '/');
21735     char *tidied_leaf;
21736
21737     if (!argv_leaf) {
21738         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21739         return 1;
21740     }
21741
21742     _NSGetExecutablePath(buf, &size);
21743     if (size > MAXPATHLEN * MAXPATHLEN) {
21744         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21745                 (unsigned int) size);
21746         return 2;
21747     }
21748
21749     buffer = malloc(size);
21750     if (!buffer) {
21751         perror("malloc");
21752         return 3;
21753     }
21754
21755     result = _NSGetExecutablePath(buffer, &size);
21756     if (result != 0) {
21757         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21758                 result, (unsigned int) size);
21759         return 4;
21760     }
21761
21762     tidied = realpath(buffer, NULL);
21763     if (!tidied) {
21764         perror("realpath");
21765         return 5;
21766     }
21767
21768     free(buffer);
21769
21770     if (*tidied != '/') {
21771         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21772         return 6;
21773     }
21774
21775     if (strstr(tidied, "/./")) {
21776         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21777         return 7;
21778     }
21779
21780     if (strstr(tidied, "/../")) {
21781         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21782         return 8;
21783     }
21784
21785     tidied_leaf = strrchr(tidied, '/');
21786     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21787         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21788         return 9;
21789     }
21790
21791     free(tidied);
21792
21793     return 0;
21794 }
21795 EOM
21796
21797 val=$undef
21798 set try
21799 if eval $compile; then
21800         if $run ./try; then
21801                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21802                 val="$define"
21803         else
21804                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21805         fi
21806 else
21807         echo "I'm unable to compile the test program." >&4
21808         echo "I'll assume no _NSGetExecutablePath here." >&4
21809 fi
21810 $rm_try
21811 set usensgetexecutablepath
21812 eval $setvar
21813
21814 : Check if site customization support was requested
21815 case "$usesitecustomize" in
21816     $define|true|[Yy]*)
21817         usesitecustomize="$define"
21818         ;;
21819     *)
21820         usesitecustomize="$undef"
21821         ;;
21822     esac
21823
21824 : see if prototypes support variable argument declarations
21825 echo " "
21826 case "$prototype$i_stdarg" in
21827 $define$define)
21828         echo "It appears we'll be able to prototype varargs functions." >&4
21829         val="$define"
21830         ;;
21831 *)
21832         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21833         val="$undef"
21834         ;;
21835 esac
21836 set vaproto
21837 eval $setvar
21838
21839 : determine compiler compiler
21840 case "$yacc" in
21841 '')
21842         dflt=yacc;;
21843 *)
21844         dflt="$yacc";;
21845 esac
21846 echo " "
21847 comp='yacc'
21848 if $test -f "$byacc$_exe"; then
21849         dflt="$byacc"
21850         comp="byacc or $comp"
21851 fi
21852 if $test -f "$bison$_exe"; then
21853         comp="$comp or bison -y"
21854 fi
21855 rp="Which compiler compiler ($comp) shall I use?"
21856 . ./myread
21857 yacc="$ans"
21858 case "$yacc" in
21859 *bis*)
21860         case "$yacc" in
21861         *-y*) ;;
21862         *)
21863                 yacc="$yacc -y"
21864                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21865                 ;;
21866         esac
21867         ;;
21868 esac
21869
21870 : see if this is a assert.h system
21871 set assert.h i_assert
21872 eval $inhdr
21873
21874 : see if this is a fp.h system
21875 set fp.h i_fp
21876 eval $inhdr
21877
21878 : see if this is a fp_class.h system
21879 set fp_class.h i_fp_class
21880 eval $inhdr
21881
21882 : see if gdbm.h is available
21883 set gdbm.h t_gdbm
21884 eval $inhdr
21885 case "$t_gdbm" in
21886 $define)
21887         : see if gdbm_open exists
21888         set gdbm_open d_gdbm_open
21889         eval $inlibc
21890         case "$d_gdbm_open" in
21891         $undef)
21892                 t_gdbm="$undef"
21893                 echo "We won't be including <gdbm.h>"
21894                 ;;
21895         esac
21896         ;;
21897 esac
21898 val="$t_gdbm"
21899 set i_gdbm
21900 eval $setvar
21901
21902 : see if this is a ieeefp.h system
21903 case "$i_ieeefp" in
21904 '' ) set ieeefp.h i_ieeefp
21905      eval $inhdr
21906      ;;
21907 esac
21908
21909 : see if this is a libutil.h system
21910 set libutil.h i_libutil
21911 eval $inhdr
21912
21913 : see if mach cthreads are available
21914 if test "X$usethreads" = "X$define"; then
21915         set mach/cthreads.h i_machcthr
21916         eval $inhdr
21917 else
21918         i_machcthr="$undef"
21919 fi
21920
21921 : see if this is a mntent.h system
21922 set mntent.h i_mntent
21923 eval $inhdr
21924
21925 : see if net/errno.h is available
21926 val=''
21927 set net/errno.h val
21928 eval $inhdr
21929
21930 : Unfortunately, it causes problems on some systems.  Arrgh.
21931 case "$val" in
21932 $define)
21933         cat > try.c <<'EOM'
21934 #include <stdio.h>
21935 #include <errno.h>
21936 #include <net/errno.h>
21937 int func()
21938 {
21939         return ENOTSOCK;
21940 }
21941 EOM
21942         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21943                 echo "We'll be including <net/errno.h>." >&4
21944         else
21945                 echo "We won't be including <net/errno.h>." >&4
21946                 val="$undef"
21947         fi
21948         $rm_try
21949         ;;
21950 esac
21951 set i_neterrno
21952 eval $setvar
21953
21954 : see if netinet/tcp.h is available
21955 set netinet/tcp.h i_netinettcp
21956 eval $inhdr
21957
21958 : see if this is a poll.h system
21959 set poll.h i_poll
21960 eval $inhdr
21961
21962 : see if this is a prot.h system
21963 set prot.h i_prot
21964 eval $inhdr
21965
21966 : Preprocessor symbols
21967 echo " "
21968 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21969 $cat <<'EOSH' > Cppsym.know
21970 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21971 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21972 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21973 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21974 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21975 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21976 bull c cadmus clipper CMU COFF COMPILER_VERSION
21977 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21978 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21979 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21980 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21981 GLIBC GLIBC_MINOR
21982 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21983 H3050R H3050RX hbullx20 hcx host_mips
21984 hp200 hp300 hp700 HP700 hp800 hp9000
21985 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21986 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21987 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21988 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21989 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21990 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21991 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21992 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21993 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21994 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21995 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21996 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21997 MATH_HAS_NO_SIDE_EFFECTS
21998 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21999 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
22000 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
22001 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
22002 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
22003 NetBSD news1500 news1700 news1800 news1900 news3700
22004 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
22005 ns32016 ns32332 ns32k nsc32000
22006 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22007 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
22008 pc532 pdp11 PGC PIC plexus PORTAR posix
22009 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22010 POSIX_C_SOURCE POSIX_SOURCE POWER
22011 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
22012 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
22013 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
22014 sony sony_news sonyrisc sparc sparclite spectrum
22015 stardent stdc STDC_EXT stratos sun sun3 sun386
22016 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
22017 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
22018 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
22019 sysV68 sysV88 Tek4132 Tek4300 titan
22020 TM3200 TM5400 TM5600
22021 tower tower32 tower32_200 tower32_600 tower32_700
22022 tower32_800 tower32_850 tss
22023 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
22024 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
22025 unix UNIX95 UNIX99 unixpc unos
22026 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
22027 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
22028 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
22029 USGr4 USGr4_2
22030 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
22031 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
22032 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22033 z8000
22034 EOSH
22035 # Maybe put other stuff here too.
22036 cat <<EOSH >>Cppsym.know
22037 $osname
22038 EOSH
22039 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22040 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22041 $cat Cppsym.know > Cppsym.c
22042 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22043 $rm -f Cppsym.a Cppsym.b Cppsym.c
22044 cat <<EOSH > Cppsym
22045 $startsh
22046 if $test \$# -gt 0; then
22047     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22048     if $test -s Cppsym.got; then
22049         $rm -f Cppsym.got
22050         exit 0
22051     fi
22052     $rm -f Cppsym.got
22053     exit 1
22054 else
22055     $tr " " "$trnl" | ./Cppsym.try
22056     exit 0
22057 fi
22058 EOSH
22059 chmod +x Cppsym
22060 $eunicefix Cppsym
22061 cat <<EOSH > Cppsym.try
22062 $startsh
22063 cat <<'EOCP' > try.c
22064 #include <stdio.h>
22065 #if cpp_stuff == 1
22066 #define STRINGIFY(a)    "a"
22067 #endif
22068 #if cpp_stuff == 42
22069 #define StGiFy(a)  #a
22070 #define STRINGIFY(a)    StGiFy(a)
22071 #endif
22072 #if $cpp_stuff != 1 && $cpp_stuff != 42
22073 #   include "Bletch: How does this C preprocessor stringify macros?"
22074 #endif
22075 int main() {
22076 EOCP
22077 $awk \\
22078 EOSH
22079 cat <<'EOSH' >> Cppsym.try
22080 'length($1) > 0 {
22081     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22082     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22083     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22084     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22085 }'       >> try.c
22086 echo 'return 0;}' >> try.c
22087 EOSH
22088 cat <<EOSH >> Cppsym.try
22089 ccflags="$ccflags"
22090 case "$osname-$gccversion" in
22091 irix-) ccflags="\$ccflags -woff 1178" ;;
22092 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22093 esac
22094 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22095 EOSH
22096 chmod +x Cppsym.try
22097 $eunicefix Cppsym.try
22098 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22099 : Add in any Linux cpp "predefined macros":
22100 case "$osname::$gccversion" in
22101   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22102     tHdrH=_tmpHdr
22103     rm -f $tHdrH'.h' $tHdrH
22104     touch $tHdrH'.h'
22105     # Filter out macro arguments, such as Linux's __INT8_C(c)
22106     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22107        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22108        if [ -s $tHdrH'_cppsym.real' ]; then
22109           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22110        fi
22111     fi
22112     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22113   ;;
22114 esac
22115 : now check the C compiler for additional symbols
22116 postprocess_cc_v=''
22117 case "$osname" in
22118 aix) postprocess_cc_v="|$tr , ' '" ;;
22119 esac
22120 $cat >ccsym <<EOS
22121 $startsh
22122 $cat >tmp.c <<EOF
22123 extern int foo;
22124 EOF
22125 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22126 do
22127         case "\$i" in
22128         -D*) echo "\$i" | $sed 's/^-D//';;
22129         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22130         esac
22131 done
22132 $rm_try
22133 EOS
22134 postprocess_cc_v=''
22135 chmod +x ccsym
22136 $eunicefix ccsym
22137 ./ccsym > ccsym1.raw
22138 if $test -s ccsym1.raw; then
22139        $sort ccsym1.raw | $uniq >ccsym.raw
22140 else
22141        mv ccsym1.raw ccsym.raw
22142 fi
22143
22144 $awk '/\=/ { print $0; next }
22145         { print $0"=1" }' ccsym.raw >ccsym.list
22146 $comm -13 Cppsym.true ccsym.list >ccsym.own
22147 $comm -12 Cppsym.true ccsym.list >ccsym.com
22148 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22149 also=''
22150 if $test -z ccsym.raw; then
22151         echo "Your C compiler doesn't seem to define any symbols!" >&4
22152         echo " "
22153         echo "However, your C preprocessor defines the following symbols:"
22154         $cat Cppsym.true
22155         ccsymbols=''
22156         cppsymbols=`$cat Cppsym.true`
22157         cppsymbols=`echo $cppsymbols`
22158         cppccsymbols="$cppsymbols"
22159 else
22160         if $test -s ccsym.com; then
22161                 echo "Your C compiler and pre-processor define these symbols:"
22162                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22163                 also='also '
22164                 symbols='ones'
22165                 cppccsymbols=`$cat ccsym.com`
22166                 cppccsymbols=`echo $cppccsymbols`
22167                 $test "$silent" || sleep 1
22168         fi
22169         if $test -s ccsym.cpp; then
22170                 $test "$also" && echo " "
22171                 echo "Your C pre-processor ${also}defines the following symbols:"
22172                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22173                 also='further '
22174                 cppsymbols=`$cat ccsym.cpp`
22175                 cppsymbols=`echo $cppsymbols`
22176                 $test "$silent" || sleep 1
22177         fi
22178         if $test -s ccsym.own; then
22179                 $test "$also" && echo " "
22180                 echo "Your C compiler ${also}defines the following cpp symbols:"
22181                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22182                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22183                 ccsymbols=`$cat ccsym.own`
22184                 ccsymbols=`echo $ccsymbols`
22185                 $test "$silent" || sleep 1
22186         fi
22187 fi
22188
22189 : see if this is a termio system
22190 val="$undef"
22191 val2="$undef"
22192 val3="$undef"
22193 if $test `./findhdr termios.h`; then
22194     set tcsetattr i_termios
22195     eval $inlibc
22196     val3="$i_termios"
22197 fi
22198 echo " "
22199 case "$val3" in
22200     "$define") echo "You have POSIX termios.h... good!" >&4;;
22201     *)  if ./Cppsym pyr; then
22202             case "`$run /bin/universe`" in
22203                 ucb) if $test `./findhdr sgtty.h`; then
22204                         val2="$define"
22205                         echo "<sgtty.h> found." >&4
22206                     else
22207                         echo "System is pyramid with BSD universe."
22208                         ./warn "<sgtty.h> not found--you could have problems."
22209                     fi;;
22210                 *)  if $test `./findhdr termio.h`; then
22211                         val="$define"
22212                         echo "<termio.h> found." >&4
22213                     else
22214                         echo "System is pyramid with USG universe."
22215                         ./warn "<termio.h> not found--you could have problems."
22216                     fi;;
22217             esac
22218         elif ./usg; then
22219             if $test `./findhdr termio.h`; then
22220                 echo "<termio.h> found." >&4
22221                 val="$define"
22222             elif $test `./findhdr sgtty.h`; then
22223                 echo "<sgtty.h> found." >&4
22224                 val2="$define"
22225             else
22226                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22227             fi
22228         else
22229             if $test `./findhdr sgtty.h`; then
22230                 echo "<sgtty.h> found." >&4
22231                 val2="$define"
22232             elif $test `./findhdr termio.h`; then
22233                 echo "<termio.h> found." >&4
22234                 val="$define"
22235             else
22236                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22237             fi
22238         fi;;
22239 esac
22240 set i_termio; eval $setvar
22241 val=$val2; set i_sgtty; eval $setvar
22242 val=$val3; set i_termios; eval $setvar
22243
22244 : see if stdbool is available
22245 : we want a real compile instead of Inhdr because some Solaris systems
22246 : have stdbool.h, but it can only be used if the compiler indicates it
22247 : is sufficiently c99-compliant.
22248 echo " "
22249 $cat >try.c <<EOCP
22250 #include <stdio.h>
22251 #include <stdbool.h>
22252 int func(bool x)
22253 {
22254     return x ? 1 : 0;
22255 }
22256 int main(int argc, char **argv)
22257 {
22258     return func(0);
22259 }
22260 EOCP
22261 set try
22262 if eval $compile; then
22263         echo "<stdbool.h> found." >&4
22264         val="$define"
22265 else
22266         echo "<stdbool.h> NOT found." >&4
22267         val="$undef"
22268 fi
22269 $rm_try
22270 set i_stdbool
22271 eval $setvar
22272
22273 : see if stddef is available
22274 set stddef.h i_stddef
22275 eval $inhdr
22276
22277 : see if sys/access.h is available
22278 set sys/access.h i_sysaccess
22279 eval $inhdr
22280
22281 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22282 set sys/filio.h i_sysfilio
22283 eval $inhdr
22284 echo " "
22285 if $test `./findhdr sys/ioctl.h`; then
22286         val="$define"
22287         echo '<sys/ioctl.h> found.' >&4
22288 else
22289         val="$undef"
22290         if $test $i_sysfilio = "$define"; then
22291             echo '<sys/ioctl.h> NOT found.' >&4
22292         else
22293                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22294                 $test $i_termio = "$define" && xxx="termio.h"
22295                 $test $i_termios = "$define" && xxx="termios.h"
22296 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22297         fi
22298 fi
22299 set i_sysioctl
22300 eval $setvar
22301
22302 : see if socket ioctl defs are in sys/sockio.h
22303 echo " "
22304 xxx=`./findhdr sys/sockio.h`
22305 if $test "$xxx"; then
22306         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22307                 val="$define"
22308                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22309         else
22310                 val="$undef"
22311                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22312         fi
22313 else
22314         val="$undef"
22315         $cat <<EOM
22316 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22317 EOM
22318 fi
22319 set i_syssockio
22320 eval $setvar
22321
22322 : see if this is a syslog.h system
22323 set syslog.h i_syslog
22324 eval $inhdr
22325
22326 : see if this is a sys/mode.h system
22327 set sys/mode.h i_sysmode
22328 eval $inhdr
22329
22330 : see if there is a sys/poll.h file
22331 set sys/poll.h i_syspoll
22332 eval $inhdr
22333
22334 : see if sys/resource.h has to be included
22335 set sys/resource.h i_sysresrc
22336 eval $inhdr
22337
22338 : see if sys/security.h is available
22339 set sys/security.h i_syssecrt
22340 eval $inhdr
22341
22342 : see if this is a sys/statvfs.h system
22343 set sys/statvfs.h i_sysstatvfs
22344 eval $inhdr
22345
22346 : see if this is a sys/un.h system
22347 set sys/un.h i_sysun
22348 eval $inhdr
22349
22350 : see if this is a sys/utsname.h system
22351 set sys/utsname.h i_sysutsname
22352 eval $inhdr
22353
22354 : see if this is a syswait system
22355 set sys/wait.h i_syswait
22356 eval $inhdr
22357
22358 : see if this is a ustat.h system
22359 set ustat.h i_ustat
22360 eval $inhdr
22361
22362 : see if this is an utime system
22363 set utime.h i_utime
22364 eval $inhdr
22365
22366 : see if this is a vfork system
22367 case "$d_vfork" in
22368 "$define")
22369         set vfork.h i_vfork
22370         eval $inhdr
22371         ;;
22372 *)
22373         i_vfork="$undef"
22374         ;;
22375 esac
22376
22377 : Check extensions
22378 echo " "
22379 echo "Looking for extensions..." >&4
22380 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22381 : contain old or inaccurate or duplicate values.
22382 nonxs_extensions=''
22383 xs_extensions=''
22384 : We do not use find because it might not be available.
22385 : We do not just use MANIFEST because the user may have dropped
22386 : some additional extensions into the source tree and expect them
22387 : to be built.
22388
22389 : Function to recursively find available extensions, ignoring DynaLoader
22390 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22391 : In 5.10.1 and later, extensions are stored in directories
22392 : like File-Glob instead of the older File/Glob/.
22393 find_extensions='
22394     for xxx in *; do
22395         case "$xxx" in
22396             DynaLoader|dynaload) ;;
22397             *)
22398             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22399             case "$this_ext" in
22400                 Scalar/List/Utils) this_ext="List/Util" ;;
22401                 PathTools)         this_ext="Cwd"       ;;
22402             esac;
22403             echo " $xs_extensions $nonxs_extensions" > $$.tmp;
22404             if $contains " $this_ext " $$.tmp; then
22405                 echo >&4;
22406                 echo "Duplicate directories detected for extension $xxx" >&4;
22407                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22408                 case "$knowitall" in
22409                 "") dflt=y;;
22410                 *) dflt=n;;
22411                 esac;
22412                 . ../UU/myread;
22413                 case "$ans" in
22414                 n*|N*) ;;
22415                 *) echo >&4;
22416                     echo "Ok.  Stopping Configure." >&4;
22417                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22418                     exit 1;;
22419                 esac;
22420                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22421             fi;
22422             $ls -1 $xxx > $$.tmp;
22423             if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22424                 xs_extensions="$xs_extensions $this_ext";
22425             elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22426                 xs_extensions="$xs_extensions $this_ext";
22427             elif $test -d $xxx; then
22428                 nonxs_extensions="$nonxs_extensions $this_ext";
22429             fi;
22430             $rm -f $$.tmp;
22431             ;;
22432         esac;
22433     done'
22434 tdir=`pwd`
22435 cd "$rsrc/cpan"
22436 set X
22437 shift
22438 eval $find_extensions
22439 cd "$rsrc/dist"
22440 set X
22441 shift
22442 eval $find_extensions
22443 cd "$rsrc/ext"
22444 set X
22445 shift
22446 eval $find_extensions
22447 set X $xs_extensions
22448 shift
22449 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22450 set X $nonxs_extensions
22451 shift
22452 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22453 cd "$tdir"
22454 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22455
22456 : Now see which are supported on this system.
22457 avail_ext=''
22458 for xxx in $xs_extensions ; do
22459         case "$xxx" in
22460         DB_File|db_file)
22461                 case "$i_db" in
22462                 $define) avail_ext="$avail_ext $xxx" ;;
22463                 esac
22464                 ;;
22465         GDBM_File|gdbm_fil)
22466                 case "$i_gdbm" in
22467                 $define) avail_ext="$avail_ext $xxx" ;;
22468                 esac
22469                 ;;
22470         I18N/Langinfo|i18n_lan)
22471                 case "$i_langinfo$d_nl_langinfo" in
22472                 $define$define) avail_ext="$avail_ext $xxx" ;;
22473                 esac
22474                 ;;
22475         IPC/SysV|ipc/sysv)
22476                 : XXX Do we need a useipcsysv variable here
22477                 case "${d_msg}${d_sem}${d_shm}" in
22478                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22479                 esac
22480                 ;;
22481         NDBM_File|ndbm_fil)
22482                 case "$d_ndbm" in
22483                 $define)
22484                     case "$osname-$use64bitint" in
22485                     hpux-define)
22486                         case "$libs" in
22487                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22488                         esac
22489                         ;;
22490                     *) avail_ext="$avail_ext $xxx" ;;
22491                     esac
22492                     ;;
22493                 esac
22494                 ;;
22495         ODBM_File|odbm_fil)
22496                 case "${i_dbm}${i_rpcsvcdbm}" in
22497                 *"${define}"*)
22498                     case "$d_cplusplus" in
22499                     define) ;; # delete as a function name will not work
22500                     *)  case "$osname-$use64bitint" in
22501                         hpux-define)
22502                             case "$libs" in
22503                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22504                             esac
22505                             ;;
22506                         *) avail_ext="$avail_ext $xxx" ;;
22507                         esac
22508                         ;;
22509                     esac
22510                     ;;
22511                 esac
22512                 ;;
22513         Opcode|opcode)
22514                 case "$useopcode" in
22515                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22516                 esac
22517                 ;;
22518         POSIX|posix)
22519                 case "$useposix" in
22520                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22521                 esac
22522                 ;;
22523         Socket|socket)
22524                 case "$d_socket" in
22525                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22526                 esac
22527                 ;;
22528         Sys/Syslog|sys/syslog)
22529                 : XXX syslog requires socket
22530                 case "$d_socket" in
22531                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22532                 esac
22533                 ;;
22534         Thread|thread)
22535                 case "$usethreads" in
22536                 true|$define|y)
22537                         case "$use5005threads" in
22538                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22539                         esac
22540                 esac
22541                 ;;
22542         threads|threads/shared)
22543                 # threads and threads::shared are special cases.
22544                 # To stop people from asking "Perl 5.8.0 was supposed
22545                 # to have this new fancy threads implementation but my
22546                 # perl doesn't have it" and from people trying to
22547                 # (re)install the threads module using CPAN.pm and
22548                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22549                 # the threads.pm and threads/shared.pm will always be
22550                 # there, croaking informatively ("you need to rebuild
22551                 # all of Perl with threads, sorry") when threads haven't
22552                 # been compiled in.
22553                 # --jhi
22554                 avail_ext="$avail_ext $xxx"
22555                 ;;
22556         VMS*)
22557                 ;;
22558         Win32*)
22559                 case "$osname" in
22560                 cygwin) avail_ext="$avail_ext $xxx" ;;
22561                 esac
22562                 ;;
22563         XS/APItest|xs/apitest)
22564                 # This is just for testing.  Skip it unless we have dynamic loading.
22565
22566                 case "$usedl" in
22567                 $define) avail_ext="$avail_ext $xxx" ;;
22568                 esac
22569                 ;;
22570         XS/Typemap|xs/typemap)
22571                 # This is just for testing.  Skip it unless we have dynamic loading.
22572                 case "$usedl" in
22573                 $define) avail_ext="$avail_ext $xxx" ;;
22574                 esac
22575                 ;;
22576         *)      avail_ext="$avail_ext $xxx"
22577                 ;;
22578         esac
22579 done
22580
22581 set X $avail_ext
22582 shift
22583 avail_ext="$*"
22584
22585 case "$onlyextensions" in
22586 '') ;;
22587 *)  keepextensions=''
22588     echo "You have requested that only certain extensions be included..." >&4
22589     for i in $onlyextensions; do
22590         case " $avail_ext " in
22591         *" $i "*)
22592             echo "Keeping extension $i."
22593             keepextensions="$keepextensions $i"
22594             ;;
22595         *) echo "Ignoring extension $i." ;;
22596         esac
22597     done
22598     avail_ext="$keepextensions"
22599     ;;
22600 esac
22601
22602 case "$noextensions" in
22603 '') ;;
22604 *)  keepextensions=''
22605     echo "You have requested that certain extensions be ignored..." >&4
22606     for i in $avail_ext; do
22607         case " $noextensions " in
22608         *" $i "*) echo "Ignoring extension $i." ;;
22609         *) echo "Keeping extension $i.";
22610            keepextensions="$keepextensions $i"
22611            ;;
22612         esac
22613     done
22614     avail_ext="$keepextensions"
22615     ;;
22616 esac
22617
22618 : Now see which nonxs extensions are supported on this system.
22619 : For now assume all are.
22620 nonxs_ext=''
22621 for xxx in $nonxs_extensions ; do
22622         case "$xxx" in
22623         VMS*)
22624                 ;;
22625         *)      nonxs_ext="$nonxs_ext $xxx"
22626                 ;;
22627         esac
22628 done
22629
22630 set X $nonxs_ext
22631 shift
22632 nonxs_ext="$*"
22633
22634 case $usedl in
22635 $define)
22636         $cat <<EOM
22637 A number of extensions are supplied with $package.  You may choose to
22638 compile these extensions for dynamic loading (the default), compile
22639 them into the $package executable (static loading), or not include
22640 them at all.  Answer "none" to include no extensions.
22641 Note that DynaLoader is always built and need not be mentioned here.
22642
22643 EOM
22644         case "$dynamic_ext" in
22645         '')
22646                 : Exclude those listed in static_ext
22647                 dflt=''
22648                 for xxx in $avail_ext; do
22649                         case " $static_ext " in
22650                         *" $xxx "*) ;;
22651                         *) dflt="$dflt $xxx" ;;
22652                         esac
22653                 done
22654                 set X $dflt
22655                 shift
22656                 dflt="$*"
22657                 ;;
22658         *)      dflt="$dynamic_ext"
22659                 # Perhaps we are reusing an old out-of-date config.sh.
22660                 case "$hint" in
22661                 previous)
22662                         if test X"$dynamic_ext" != X"$avail_ext"; then
22663                                 $cat <<EOM
22664 NOTICE:  Your previous config.sh list may be incorrect.
22665 The extensions now available to you are
22666         ${avail_ext}
22667 but the default list from your previous config.sh is
22668         ${dynamic_ext}
22669
22670 EOM
22671                         fi
22672                         ;;
22673                 esac
22674                 ;;
22675         esac
22676         case "$dflt" in
22677         '')     dflt=none;;
22678         esac
22679         rp="What extensions do you wish to load dynamically?"
22680         . ./myread
22681         case "$ans" in
22682         none) dynamic_ext=' ' ;;
22683         *) dynamic_ext="$ans" ;;
22684         esac
22685
22686         case "$static_ext" in
22687         '')
22688                 : Exclude those already listed in dynamic linking
22689                 dflt=''
22690                 for xxx in $avail_ext; do
22691                         case " $dynamic_ext " in
22692                         *" $xxx "*) ;;
22693                         *) dflt="$dflt $xxx" ;;
22694                         esac
22695                 done
22696                 set X $dflt
22697                 shift
22698                 dflt="$*"
22699                 ;;
22700         *)  dflt="$static_ext"
22701                 ;;
22702         esac
22703
22704         case "$dflt" in
22705         '')     dflt=none;;
22706         esac
22707         rp="What extensions do you wish to load statically?"
22708         . ./myread
22709         case "$ans" in
22710         none) static_ext=' ' ;;
22711         *) static_ext="$ans" ;;
22712         esac
22713         ;;
22714 *)
22715         $cat <<EOM
22716 A number of extensions are supplied with $package.  Answer "none"
22717 to include no extensions.
22718 Note that DynaLoader is always built and need not be mentioned here.
22719
22720 EOM
22721         case "$static_ext" in
22722         '') dflt="$avail_ext" ;;
22723         *)      dflt="$static_ext"
22724                 # Perhaps we are reusing an old out-of-date config.sh.
22725                 case "$hint" in
22726                 previous)
22727                         if test X"$static_ext" != X"$avail_ext"; then
22728                                 $cat <<EOM
22729 NOTICE:  Your previous config.sh list may be incorrect.
22730 The extensions now available to you are
22731         ${avail_ext}
22732 but the default list from your previous config.sh is
22733         ${static_ext}
22734
22735 EOM
22736                         fi
22737                         ;;
22738                 esac
22739                 ;;
22740         esac
22741         : Exclude those that are not xs extensions
22742         case "$dflt" in
22743         '')     dflt=none;;
22744         esac
22745         rp="What extensions do you wish to include?"
22746         . ./myread
22747         case "$ans" in
22748         none) static_ext=' ' ;;
22749         *) static_ext="$ans" ;;
22750         esac
22751         ;;
22752 esac
22753 #
22754 # Encode is a special case.  If we are building Encode as a static
22755 # extension, we need to explicitly list its subextensions as well.
22756 # For other nested extensions, this is handled automatically by
22757 # the appropriate Makefile.PL.
22758 case " $static_ext " in
22759         *" Encode "*) # Add the subextensions of Encode
22760         cd "$rsrc/cpan"
22761         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22762                 static_ext="$static_ext Encode/$xxx"
22763                 known_extensions="$known_extensions Encode/$xxx"
22764         done
22765         cd "$tdir"
22766         ;;
22767 esac
22768
22769 set X $dynamic_ext $static_ext $nonxs_ext
22770 shift
22771 extensions="$*"
22772
22773 # Sanity check:  We require an extension suitable for use with
22774 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22775 # should show up as failures in the test suite, but it's helpful to
22776 # catch them now.) The 'extensions' list is normally sorted
22777 # alphabetically, so we need to accept either
22778 #    DB_File ... Fcntl ... IO  ....
22779 # or something like
22780 #    Fcntl ... NDBM_File ... IO  ....
22781 case " $extensions"  in
22782 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22783 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22784 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22785 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22786    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22787    ;;
22788 esac
22789
22790 : Remove libraries needed only for extensions
22791 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22792 : The exception is SunOS 4.x, which needs them.
22793 case "${osname}X${osvers}" in
22794 sunos*X4*)
22795     perllibs="$libs"
22796     ;;
22797 *) case "$usedl" in
22798     $define|true|[yY]*)
22799             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22800             shift
22801             perllibs="$*"
22802             ;;
22803     *)  perllibs="$libs"
22804             ;;
22805     esac
22806     ;;
22807 esac
22808
22809 : Remove build directory name from cppstdin so it can be used from
22810 : either the present location or the final installed location.
22811 echo " "
22812 : Get out of the UU directory to get correct path name.
22813 cd ..
22814 case "$cppstdin" in
22815 `pwd`/cppstdin)
22816         echo "Stripping down cppstdin path name"
22817         cppstdin=cppstdin
22818         ;;
22819 esac
22820 cd UU
22821
22822 : end of configuration questions
22823 echo " "
22824 echo "End of configuration questions."
22825 echo " "
22826
22827 : back to where it started
22828 if test -d ../UU; then
22829         cd ..
22830 fi
22831
22832 : configuration may be unconditionally patched via a 'config.arch' file
22833 if $test -f config.arch; then
22834         echo "I see a config.arch file, loading it." >&4
22835         . ./config.arch
22836 fi
22837
22838 : configuration may be patched via a 'config.over' file
22839 if $test -f config.over; then
22840         echo " "
22841         dflt=y
22842         rp='I see a config.over file.  Do you wish to load it?'
22843         . UU/myread
22844         case "$ans" in
22845         n*) echo "OK, I'll ignore it.";;
22846         *)      . ./config.over
22847                 echo "Configuration override changes have been loaded."
22848                 ;;
22849         esac
22850 fi
22851
22852 : in case they want portability, strip down executable paths
22853 case "$d_portable" in
22854 "$define")
22855         echo " "
22856         echo "Stripping down executable paths..." >&4
22857         for file in $loclist $trylist; do
22858                 eval temp=\$$file
22859                 eval $file=`basename $temp`
22860         done
22861         ;;
22862 esac
22863
22864 : create config.sh file
22865 echo " "
22866 echo "Creating config.sh..." >&4
22867 $spitshell <<EOT >config.sh
22868 $startsh
22869 #
22870 # This file was produced by running the Configure script. It holds all the
22871 # definitions figured out by Configure. Should you modify one of these values,
22872 # do not forget to propagate your changes by running "Configure -der". You may
22873 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22874 #
22875
22876 # Package name      : $package
22877 # Source directory  : $src
22878 # Configuration time: $cf_time
22879 # Configured by     : $cf_by
22880 # Target system     : $myuname
22881
22882 EOT
22883 : Add in command line options if available
22884 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22885
22886 $spitshell <<EOT >>config.sh
22887
22888 Author='$Author'
22889 Date='$Date'
22890 Header='$Header'
22891 Id='$Id'
22892 Locker='$Locker'
22893 Log='$Log'
22894 RCSfile='$RCSfile'
22895 Revision='$Revision'
22896 Source='$Source'
22897 State='$State'
22898 _a='$_a'
22899 _exe='$_exe'
22900 _o='$_o'
22901 afs='$afs'
22902 afsroot='$afsroot'
22903 alignbytes='$alignbytes'
22904 ansi2knr='$ansi2knr'
22905 aphostname='$aphostname'
22906 api_revision='$api_revision'
22907 api_subversion='$api_subversion'
22908 api_version='$api_version'
22909 api_versionstring='$api_versionstring'
22910 ar='$ar'
22911 archlib='$archlib'
22912 archlibexp='$archlibexp'
22913 archname64='$archname64'
22914 archname='$archname'
22915 archobjs='$archobjs'
22916 asctime_r_proto='$asctime_r_proto'
22917 awk='$awk'
22918 baserev='$baserev'
22919 bash='$bash'
22920 bin='$bin'
22921 bin_ELF='$bin_ELF'
22922 binexp='$binexp'
22923 bison='$bison'
22924 bootstrap_charset='$bootstrap_charset'
22925 byacc='$byacc'
22926 byteorder='$byteorder'
22927 c='$c'
22928 castflags='$castflags'
22929 cat='$cat'
22930 cc='$cc'
22931 cccdlflags='$cccdlflags'
22932 ccdlflags='$ccdlflags'
22933 ccflags='$ccflags'
22934 ccflags_uselargefiles='$ccflags_uselargefiles'
22935 ccname='$ccname'
22936 ccsymbols='$ccsymbols'
22937 ccversion='$ccversion'
22938 cf_by='$cf_by'
22939 cf_email='$cf_email'
22940 cf_time='$cf_time'
22941 charbits='$charbits'
22942 charsize='$charsize'
22943 chgrp='$chgrp'
22944 chmod='$chmod'
22945 chown='$chown'
22946 clocktype='$clocktype'
22947 comm='$comm'
22948 compress='$compress'
22949 contains='$contains'
22950 cp='$cp'
22951 cpio='$cpio'
22952 cpp='$cpp'
22953 cpp_stuff='$cpp_stuff'
22954 cppccsymbols='$cppccsymbols'
22955 cppflags='$cppflags'
22956 cpplast='$cpplast'
22957 cppminus='$cppminus'
22958 cpprun='$cpprun'
22959 cppstdin='$cppstdin'
22960 cppsymbols='$cppsymbols'
22961 crypt_r_proto='$crypt_r_proto'
22962 cryptlib='$cryptlib'
22963 csh='$csh'
22964 ctermid_r_proto='$ctermid_r_proto'
22965 ctime_r_proto='$ctime_r_proto'
22966 d_Gconvert='$d_Gconvert'
22967 d_PRIEUldbl='$d_PRIEUldbl'
22968 d_PRIFUldbl='$d_PRIFUldbl'
22969 d_PRIGUldbl='$d_PRIGUldbl'
22970 d_PRIXU64='$d_PRIXU64'
22971 d_PRId64='$d_PRId64'
22972 d_PRIeldbl='$d_PRIeldbl'
22973 d_PRIfldbl='$d_PRIfldbl'
22974 d_PRIgldbl='$d_PRIgldbl'
22975 d_PRIi64='$d_PRIi64'
22976 d_PRIo64='$d_PRIo64'
22977 d_PRIu64='$d_PRIu64'
22978 d_PRIx64='$d_PRIx64'
22979 d_SCNfldbl='$d_SCNfldbl'
22980 d__fwalk='$d__fwalk'
22981 d_access='$d_access'
22982 d_accessx='$d_accessx'
22983 d_aintl='$d_aintl'
22984 d_alarm='$d_alarm'
22985 d_archlib='$d_archlib'
22986 d_asctime64='$d_asctime64'
22987 d_asctime_r='$d_asctime_r'
22988 d_atolf='$d_atolf'
22989 d_atoll='$d_atoll'
22990 d_attribute_deprecated='$d_attribute_deprecated'
22991 d_attribute_format='$d_attribute_format'
22992 d_attribute_malloc='$d_attribute_malloc'
22993 d_attribute_nonnull='$d_attribute_nonnull'
22994 d_attribute_noreturn='$d_attribute_noreturn'
22995 d_attribute_pure='$d_attribute_pure'
22996 d_attribute_unused='$d_attribute_unused'
22997 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22998 d_bcmp='$d_bcmp'
22999 d_bcopy='$d_bcopy'
23000 d_bsd='$d_bsd'
23001 d_bsdgetpgrp='$d_bsdgetpgrp'
23002 d_bsdsetpgrp='$d_bsdsetpgrp'
23003 d_builtin_choose_expr='$d_builtin_choose_expr'
23004 d_builtin_expect='$d_builtin_expect'
23005 d_bzero='$d_bzero'
23006 d_c99_variadic_macros='$d_c99_variadic_macros'
23007 d_casti32='$d_casti32'
23008 d_castneg='$d_castneg'
23009 d_charvspr='$d_charvspr'
23010 d_chown='$d_chown'
23011 d_chroot='$d_chroot'
23012 d_chsize='$d_chsize'
23013 d_class='$d_class'
23014 d_clearenv='$d_clearenv'
23015 d_closedir='$d_closedir'
23016 d_cmsghdr_s='$d_cmsghdr_s'
23017 d_const='$d_const'
23018 d_copysignl='$d_copysignl'
23019 d_cplusplus='$d_cplusplus'
23020 d_crypt='$d_crypt'
23021 d_crypt_r='$d_crypt_r'
23022 d_csh='$d_csh'
23023 d_ctermid='$d_ctermid'
23024 d_ctermid_r='$d_ctermid_r'
23025 d_ctime64='$d_ctime64'
23026 d_ctime_r='$d_ctime_r'
23027 d_cuserid='$d_cuserid'
23028 d_dbl_dig='$d_dbl_dig'
23029 d_dbminitproto='$d_dbminitproto'
23030 d_difftime64='$d_difftime64'
23031 d_difftime='$d_difftime'
23032 d_dir_dd_fd='$d_dir_dd_fd'
23033 d_dirfd='$d_dirfd'
23034 d_dirnamlen='$d_dirnamlen'
23035 d_dlerror='$d_dlerror'
23036 d_dlopen='$d_dlopen'
23037 d_dlsymun='$d_dlsymun'
23038 d_dosuid='$d_dosuid'
23039 d_drand48_r='$d_drand48_r'
23040 d_drand48proto='$d_drand48proto'
23041 d_dup2='$d_dup2'
23042 d_eaccess='$d_eaccess'
23043 d_endgrent='$d_endgrent'
23044 d_endgrent_r='$d_endgrent_r'
23045 d_endhent='$d_endhent'
23046 d_endhostent_r='$d_endhostent_r'
23047 d_endnent='$d_endnent'
23048 d_endnetent_r='$d_endnetent_r'
23049 d_endpent='$d_endpent'
23050 d_endprotoent_r='$d_endprotoent_r'
23051 d_endpwent='$d_endpwent'
23052 d_endpwent_r='$d_endpwent_r'
23053 d_endsent='$d_endsent'
23054 d_endservent_r='$d_endservent_r'
23055 d_eofnblk='$d_eofnblk'
23056 d_eunice='$d_eunice'
23057 d_faststdio='$d_faststdio'
23058 d_fchdir='$d_fchdir'
23059 d_fchmod='$d_fchmod'
23060 d_fchown='$d_fchown'
23061 d_fcntl='$d_fcntl'
23062 d_fcntl_can_lock='$d_fcntl_can_lock'
23063 d_fd_macros='$d_fd_macros'
23064 d_fd_set='$d_fd_set'
23065 d_fds_bits='$d_fds_bits'
23066 d_fgetpos='$d_fgetpos'
23067 d_finite='$d_finite'
23068 d_finitel='$d_finitel'
23069 d_flexfnam='$d_flexfnam'
23070 d_flock='$d_flock'
23071 d_flockproto='$d_flockproto'
23072 d_fork='$d_fork'
23073 d_fp_class='$d_fp_class'
23074 d_fpathconf='$d_fpathconf'
23075 d_fpclass='$d_fpclass'
23076 d_fpclassify='$d_fpclassify'
23077 d_fpclassl='$d_fpclassl'
23078 d_fpos64_t='$d_fpos64_t'
23079 d_frexpl='$d_frexpl'
23080 d_fs_data_s='$d_fs_data_s'
23081 d_fseeko='$d_fseeko'
23082 d_fsetpos='$d_fsetpos'
23083 d_fstatfs='$d_fstatfs'
23084 d_fstatvfs='$d_fstatvfs'
23085 d_fsync='$d_fsync'
23086 d_ftello='$d_ftello'
23087 d_ftime='$d_ftime'
23088 d_futimes='$d_futimes'
23089 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23090 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23091 d_getaddrinfo='$d_getaddrinfo'
23092 d_getcwd='$d_getcwd'
23093 d_getespwnam='$d_getespwnam'
23094 d_getfsstat='$d_getfsstat'
23095 d_getgrent='$d_getgrent'
23096 d_getgrent_r='$d_getgrent_r'
23097 d_getgrgid_r='$d_getgrgid_r'
23098 d_getgrnam_r='$d_getgrnam_r'
23099 d_getgrps='$d_getgrps'
23100 d_gethbyaddr='$d_gethbyaddr'
23101 d_gethbyname='$d_gethbyname'
23102 d_gethent='$d_gethent'
23103 d_gethname='$d_gethname'
23104 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23105 d_gethostbyname_r='$d_gethostbyname_r'
23106 d_gethostent_r='$d_gethostent_r'
23107 d_gethostprotos='$d_gethostprotos'
23108 d_getitimer='$d_getitimer'
23109 d_getlogin='$d_getlogin'
23110 d_getlogin_r='$d_getlogin_r'
23111 d_getmnt='$d_getmnt'
23112 d_getmntent='$d_getmntent'
23113 d_getnameinfo='$d_getnameinfo'
23114 d_getnbyaddr='$d_getnbyaddr'
23115 d_getnbyname='$d_getnbyname'
23116 d_getnent='$d_getnent'
23117 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23118 d_getnetbyname_r='$d_getnetbyname_r'
23119 d_getnetent_r='$d_getnetent_r'
23120 d_getnetprotos='$d_getnetprotos'
23121 d_getpagsz='$d_getpagsz'
23122 d_getpbyname='$d_getpbyname'
23123 d_getpbynumber='$d_getpbynumber'
23124 d_getpent='$d_getpent'
23125 d_getpgid='$d_getpgid'
23126 d_getpgrp2='$d_getpgrp2'
23127 d_getpgrp='$d_getpgrp'
23128 d_getppid='$d_getppid'
23129 d_getprior='$d_getprior'
23130 d_getprotobyname_r='$d_getprotobyname_r'
23131 d_getprotobynumber_r='$d_getprotobynumber_r'
23132 d_getprotoent_r='$d_getprotoent_r'
23133 d_getprotoprotos='$d_getprotoprotos'
23134 d_getprpwnam='$d_getprpwnam'
23135 d_getpwent='$d_getpwent'
23136 d_getpwent_r='$d_getpwent_r'
23137 d_getpwnam_r='$d_getpwnam_r'
23138 d_getpwuid_r='$d_getpwuid_r'
23139 d_getsbyname='$d_getsbyname'
23140 d_getsbyport='$d_getsbyport'
23141 d_getsent='$d_getsent'
23142 d_getservbyname_r='$d_getservbyname_r'
23143 d_getservbyport_r='$d_getservbyport_r'
23144 d_getservent_r='$d_getservent_r'
23145 d_getservprotos='$d_getservprotos'
23146 d_getspnam='$d_getspnam'
23147 d_getspnam_r='$d_getspnam_r'
23148 d_gettimeod='$d_gettimeod'
23149 d_gmtime64='$d_gmtime64'
23150 d_gmtime_r='$d_gmtime_r'
23151 d_gnulibc='$d_gnulibc'
23152 d_grpasswd='$d_grpasswd'
23153 d_hasmntopt='$d_hasmntopt'
23154 d_htonl='$d_htonl'
23155 d_ilogbl='$d_ilogbl'
23156 d_inc_version_list='$d_inc_version_list'
23157 d_index='$d_index'
23158 d_inetaton='$d_inetaton'
23159 d_inetntop='$d_inetntop'
23160 d_inetpton='$d_inetpton'
23161 d_int64_t='$d_int64_t'
23162 d_ip_mreq='$d_ip_mreq'
23163 d_ip_mreq_source='$d_ip_mreq_source'
23164 d_ipv6_mreq='$d_ipv6_mreq'
23165 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23166 d_isascii='$d_isascii'
23167 d_isblank='$d_isblank'
23168 d_isfinite='$d_isfinite'
23169 d_isinf='$d_isinf'
23170 d_isnan='$d_isnan'
23171 d_isnanl='$d_isnanl'
23172 d_killpg='$d_killpg'
23173 d_lchown='$d_lchown'
23174 d_ldbl_dig='$d_ldbl_dig'
23175 d_libm_lib_version='$d_libm_lib_version'
23176 d_libname_unique='$d_libname_unique'
23177 d_link='$d_link'
23178 d_localtime64='$d_localtime64'
23179 d_localtime_r='$d_localtime_r'
23180 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23181 d_locconv='$d_locconv'
23182 d_lockf='$d_lockf'
23183 d_longdbl='$d_longdbl'
23184 d_longlong='$d_longlong'
23185 d_lseekproto='$d_lseekproto'
23186 d_lstat='$d_lstat'
23187 d_madvise='$d_madvise'
23188 d_malloc_good_size='$d_malloc_good_size'
23189 d_malloc_size='$d_malloc_size'
23190 d_mblen='$d_mblen'
23191 d_mbstowcs='$d_mbstowcs'
23192 d_mbtowc='$d_mbtowc'
23193 d_memchr='$d_memchr'
23194 d_memcmp='$d_memcmp'
23195 d_memcpy='$d_memcpy'
23196 d_memmove='$d_memmove'
23197 d_memset='$d_memset'
23198 d_mkdir='$d_mkdir'
23199 d_mkdtemp='$d_mkdtemp'
23200 d_mkfifo='$d_mkfifo'
23201 d_mkstemp='$d_mkstemp'
23202 d_mkstemps='$d_mkstemps'
23203 d_mktime64='$d_mktime64'
23204 d_mktime='$d_mktime'
23205 d_mmap='$d_mmap'
23206 d_modfl='$d_modfl'
23207 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23208 d_modflproto='$d_modflproto'
23209 d_mprotect='$d_mprotect'
23210 d_msg='$d_msg'
23211 d_msg_ctrunc='$d_msg_ctrunc'
23212 d_msg_dontroute='$d_msg_dontroute'
23213 d_msg_oob='$d_msg_oob'
23214 d_msg_peek='$d_msg_peek'
23215 d_msg_proxy='$d_msg_proxy'
23216 d_msgctl='$d_msgctl'
23217 d_msgget='$d_msgget'
23218 d_msghdr_s='$d_msghdr_s'
23219 d_msgrcv='$d_msgrcv'
23220 d_msgsnd='$d_msgsnd'
23221 d_msync='$d_msync'
23222 d_munmap='$d_munmap'
23223 d_mymalloc='$d_mymalloc'
23224 d_ndbm='$d_ndbm'
23225 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23226 d_nice='$d_nice'
23227 d_nl_langinfo='$d_nl_langinfo'
23228 d_nv_preserves_uv='$d_nv_preserves_uv'
23229 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23230 d_off64_t='$d_off64_t'
23231 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23232 d_oldpthreads='$d_oldpthreads'
23233 d_oldsock='$d_oldsock'
23234 d_open3='$d_open3'
23235 d_pathconf='$d_pathconf'
23236 d_pause='$d_pause'
23237 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23238 d_phostname='$d_phostname'
23239 d_pipe='$d_pipe'
23240 d_poll='$d_poll'
23241 d_portable='$d_portable'
23242 d_prctl='$d_prctl'
23243 d_prctl_set_name='$d_prctl_set_name'
23244 d_printf_format_null='$d_printf_format_null'
23245 d_procselfexe='$d_procselfexe'
23246 d_pseudofork='$d_pseudofork'
23247 d_pthread_atfork='$d_pthread_atfork'
23248 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23249 d_pthread_yield='$d_pthread_yield'
23250 d_pwage='$d_pwage'
23251 d_pwchange='$d_pwchange'
23252 d_pwclass='$d_pwclass'
23253 d_pwcomment='$d_pwcomment'
23254 d_pwexpire='$d_pwexpire'
23255 d_pwgecos='$d_pwgecos'
23256 d_pwpasswd='$d_pwpasswd'
23257 d_pwquota='$d_pwquota'
23258 d_qgcvt='$d_qgcvt'
23259 d_quad='$d_quad'
23260 d_random_r='$d_random_r'
23261 d_readdir64_r='$d_readdir64_r'
23262 d_readdir='$d_readdir'
23263 d_readdir_r='$d_readdir_r'
23264 d_readlink='$d_readlink'
23265 d_readv='$d_readv'
23266 d_recvmsg='$d_recvmsg'
23267 d_rename='$d_rename'
23268 d_rewinddir='$d_rewinddir'
23269 d_rmdir='$d_rmdir'
23270 d_safebcpy='$d_safebcpy'
23271 d_safemcpy='$d_safemcpy'
23272 d_sanemcmp='$d_sanemcmp'
23273 d_sbrkproto='$d_sbrkproto'
23274 d_scalbnl='$d_scalbnl'
23275 d_sched_yield='$d_sched_yield'
23276 d_scm_rights='$d_scm_rights'
23277 d_seekdir='$d_seekdir'
23278 d_select='$d_select'
23279 d_sem='$d_sem'
23280 d_semctl='$d_semctl'
23281 d_semctl_semid_ds='$d_semctl_semid_ds'
23282 d_semctl_semun='$d_semctl_semun'
23283 d_semget='$d_semget'
23284 d_semop='$d_semop'
23285 d_sendmsg='$d_sendmsg'
23286 d_setegid='$d_setegid'
23287 d_seteuid='$d_seteuid'
23288 d_setgrent='$d_setgrent'
23289 d_setgrent_r='$d_setgrent_r'
23290 d_setgrps='$d_setgrps'
23291 d_sethent='$d_sethent'
23292 d_sethostent_r='$d_sethostent_r'
23293 d_setitimer='$d_setitimer'
23294 d_setlinebuf='$d_setlinebuf'
23295 d_setlocale='$d_setlocale'
23296 d_setlocale_r='$d_setlocale_r'
23297 d_setnent='$d_setnent'
23298 d_setnetent_r='$d_setnetent_r'
23299 d_setpent='$d_setpent'
23300 d_setpgid='$d_setpgid'
23301 d_setpgrp2='$d_setpgrp2'
23302 d_setpgrp='$d_setpgrp'
23303 d_setprior='$d_setprior'
23304 d_setproctitle='$d_setproctitle'
23305 d_setprotoent_r='$d_setprotoent_r'
23306 d_setpwent='$d_setpwent'
23307 d_setpwent_r='$d_setpwent_r'
23308 d_setregid='$d_setregid'
23309 d_setresgid='$d_setresgid'
23310 d_setresuid='$d_setresuid'
23311 d_setreuid='$d_setreuid'
23312 d_setrgid='$d_setrgid'
23313 d_setruid='$d_setruid'
23314 d_setsent='$d_setsent'
23315 d_setservent_r='$d_setservent_r'
23316 d_setsid='$d_setsid'
23317 d_setvbuf='$d_setvbuf'
23318 d_shm='$d_shm'
23319 d_shmat='$d_shmat'
23320 d_shmatprototype='$d_shmatprototype'
23321 d_shmctl='$d_shmctl'
23322 d_shmdt='$d_shmdt'
23323 d_shmget='$d_shmget'
23324 d_sigaction='$d_sigaction'
23325 d_signbit='$d_signbit'
23326 d_sigprocmask='$d_sigprocmask'
23327 d_sigsetjmp='$d_sigsetjmp'
23328 d_sin6_scope_id='$d_sin6_scope_id'
23329 d_sitearch='$d_sitearch'
23330 d_snprintf='$d_snprintf'
23331 d_sockaddr_in6='$d_sockaddr_in6'
23332 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23333 d_sockatmark='$d_sockatmark'
23334 d_sockatmarkproto='$d_sockatmarkproto'
23335 d_socket='$d_socket'
23336 d_socklen_t='$d_socklen_t'
23337 d_sockpair='$d_sockpair'
23338 d_socks5_init='$d_socks5_init'
23339 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23340 d_sqrtl='$d_sqrtl'
23341 d_srand48_r='$d_srand48_r'
23342 d_srandom_r='$d_srandom_r'
23343 d_sresgproto='$d_sresgproto'
23344 d_sresuproto='$d_sresuproto'
23345 d_statblks='$d_statblks'
23346 d_statfs_f_flags='$d_statfs_f_flags'
23347 d_statfs_s='$d_statfs_s'
23348 d_static_inline='$d_static_inline'
23349 d_statvfs='$d_statvfs'
23350 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23351 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23352 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23353 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23354 d_stdio_stream_array='$d_stdio_stream_array'
23355 d_stdiobase='$d_stdiobase'
23356 d_stdstdio='$d_stdstdio'
23357 d_strchr='$d_strchr'
23358 d_strcoll='$d_strcoll'
23359 d_strctcpy='$d_strctcpy'
23360 d_strerrm='$d_strerrm'
23361 d_strerror='$d_strerror'
23362 d_strerror_r='$d_strerror_r'
23363 d_strftime='$d_strftime'
23364 d_strlcat='$d_strlcat'
23365 d_strlcpy='$d_strlcpy'
23366 d_strtod='$d_strtod'
23367 d_strtol='$d_strtol'
23368 d_strtold='$d_strtold'
23369 d_strtoll='$d_strtoll'
23370 d_strtoq='$d_strtoq'
23371 d_strtoul='$d_strtoul'
23372 d_strtoull='$d_strtoull'
23373 d_strtouq='$d_strtouq'
23374 d_strxfrm='$d_strxfrm'
23375 d_suidsafe='$d_suidsafe'
23376 d_symlink='$d_symlink'
23377 d_syscall='$d_syscall'
23378 d_syscallproto='$d_syscallproto'
23379 d_sysconf='$d_sysconf'
23380 d_sysernlst='$d_sysernlst'
23381 d_syserrlst='$d_syserrlst'
23382 d_system='$d_system'
23383 d_tcgetpgrp='$d_tcgetpgrp'
23384 d_tcsetpgrp='$d_tcsetpgrp'
23385 d_telldir='$d_telldir'
23386 d_telldirproto='$d_telldirproto'
23387 d_time='$d_time'
23388 d_timegm='$d_timegm'
23389 d_times='$d_times'
23390 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23391 d_tm_tm_zone='$d_tm_tm_zone'
23392 d_tmpnam_r='$d_tmpnam_r'
23393 d_truncate='$d_truncate'
23394 d_ttyname_r='$d_ttyname_r'
23395 d_tzname='$d_tzname'
23396 d_u32align='$d_u32align'
23397 d_ualarm='$d_ualarm'
23398 d_umask='$d_umask'
23399 d_uname='$d_uname'
23400 d_union_semun='$d_union_semun'
23401 d_unordered='$d_unordered'
23402 d_unsetenv='$d_unsetenv'
23403 d_usleep='$d_usleep'
23404 d_usleepproto='$d_usleepproto'
23405 d_ustat='$d_ustat'
23406 d_vendorarch='$d_vendorarch'
23407 d_vendorbin='$d_vendorbin'
23408 d_vendorlib='$d_vendorlib'
23409 d_vendorscript='$d_vendorscript'
23410 d_vfork='$d_vfork'
23411 d_void_closedir='$d_void_closedir'
23412 d_voidsig='$d_voidsig'
23413 d_voidtty='$d_voidtty'
23414 d_volatile='$d_volatile'
23415 d_vprintf='$d_vprintf'
23416 d_vsnprintf='$d_vsnprintf'
23417 d_wait4='$d_wait4'
23418 d_waitpid='$d_waitpid'
23419 d_wcstombs='$d_wcstombs'
23420 d_wctomb='$d_wctomb'
23421 d_writev='$d_writev'
23422 d_xenix='$d_xenix'
23423 date='$date'
23424 db_hashtype='$db_hashtype'
23425 db_prefixtype='$db_prefixtype'
23426 db_version_major='$db_version_major'
23427 db_version_minor='$db_version_minor'
23428 db_version_patch='$db_version_patch'
23429 direntrytype='$direntrytype'
23430 dlext='$dlext'
23431 dlsrc='$dlsrc'
23432 doublesize='$doublesize'
23433 drand01='$drand01'
23434 drand48_r_proto='$drand48_r_proto'
23435 dtrace='$dtrace'
23436 dynamic_ext='$dynamic_ext'
23437 eagain='$eagain'
23438 ebcdic='$ebcdic'
23439 echo='$echo'
23440 egrep='$egrep'
23441 emacs='$emacs'
23442 endgrent_r_proto='$endgrent_r_proto'
23443 endhostent_r_proto='$endhostent_r_proto'
23444 endnetent_r_proto='$endnetent_r_proto'
23445 endprotoent_r_proto='$endprotoent_r_proto'
23446 endpwent_r_proto='$endpwent_r_proto'
23447 endservent_r_proto='$endservent_r_proto'
23448 eunicefix='$eunicefix'
23449 exe_ext='$exe_ext'
23450 expr='$expr'
23451 extensions='$extensions'
23452 extern_C='$extern_C'
23453 extras='$extras'
23454 fflushNULL='$fflushNULL'
23455 fflushall='$fflushall'
23456 find='$find'
23457 firstmakefile='$firstmakefile'
23458 flex='$flex'
23459 fpossize='$fpossize'
23460 fpostype='$fpostype'
23461 freetype='$freetype'
23462 from='$from'
23463 full_ar='$full_ar'
23464 full_csh='$full_csh'
23465 full_sed='$full_sed'
23466 gccansipedantic='$gccansipedantic'
23467 gccosandvers='$gccosandvers'
23468 gccversion='$gccversion'
23469 getgrent_r_proto='$getgrent_r_proto'
23470 getgrgid_r_proto='$getgrgid_r_proto'
23471 getgrnam_r_proto='$getgrnam_r_proto'
23472 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23473 gethostbyname_r_proto='$gethostbyname_r_proto'
23474 gethostent_r_proto='$gethostent_r_proto'
23475 getlogin_r_proto='$getlogin_r_proto'
23476 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23477 getnetbyname_r_proto='$getnetbyname_r_proto'
23478 getnetent_r_proto='$getnetent_r_proto'
23479 getprotobyname_r_proto='$getprotobyname_r_proto'
23480 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23481 getprotoent_r_proto='$getprotoent_r_proto'
23482 getpwent_r_proto='$getpwent_r_proto'
23483 getpwnam_r_proto='$getpwnam_r_proto'
23484 getpwuid_r_proto='$getpwuid_r_proto'
23485 getservbyname_r_proto='$getservbyname_r_proto'
23486 getservbyport_r_proto='$getservbyport_r_proto'
23487 getservent_r_proto='$getservent_r_proto'
23488 getspnam_r_proto='$getspnam_r_proto'
23489 gidformat='$gidformat'
23490 gidsign='$gidsign'
23491 gidsize='$gidsize'
23492 gidtype='$gidtype'
23493 glibpth='$glibpth'
23494 gmake='$gmake'
23495 gmtime_r_proto='$gmtime_r_proto'
23496 gnulibc_version='$gnulibc_version'
23497 grep='$grep'
23498 groupcat='$groupcat'
23499 groupstype='$groupstype'
23500 gzip='$gzip'
23501 h_fcntl='$h_fcntl'
23502 h_sysfile='$h_sysfile'
23503 hint='$hint'
23504 hostcat='$hostcat'
23505 hostgenerate='$hostgenerate'
23506 hostosname='$hostosname'
23507 hostperl='$hostperl'
23508 html1dir='$html1dir'
23509 html1direxp='$html1direxp'
23510 html3dir='$html3dir'
23511 html3direxp='$html3direxp'
23512 i16size='$i16size'
23513 i16type='$i16type'
23514 i32size='$i32size'
23515 i32type='$i32type'
23516 i64size='$i64size'
23517 i64type='$i64type'
23518 i8size='$i8size'
23519 i8type='$i8type'
23520 i_arpainet='$i_arpainet'
23521 i_assert='$i_assert'
23522 i_bsdioctl='$i_bsdioctl'
23523 i_crypt='$i_crypt'
23524 i_db='$i_db'
23525 i_dbm='$i_dbm'
23526 i_dirent='$i_dirent'
23527 i_dlfcn='$i_dlfcn'
23528 i_fcntl='$i_fcntl'
23529 i_float='$i_float'
23530 i_fp='$i_fp'
23531 i_fp_class='$i_fp_class'
23532 i_gdbm='$i_gdbm'
23533 i_gdbm_ndbm='$i_gdbm_ndbm'
23534 i_gdbmndbm='$i_gdbmndbm'
23535 i_grp='$i_grp'
23536 i_ieeefp='$i_ieeefp'
23537 i_inttypes='$i_inttypes'
23538 i_langinfo='$i_langinfo'
23539 i_libutil='$i_libutil'
23540 i_limits='$i_limits'
23541 i_locale='$i_locale'
23542 i_machcthr='$i_machcthr'
23543 i_malloc='$i_malloc'
23544 i_mallocmalloc='$i_mallocmalloc'
23545 i_math='$i_math'
23546 i_memory='$i_memory'
23547 i_mntent='$i_mntent'
23548 i_ndbm='$i_ndbm'
23549 i_netdb='$i_netdb'
23550 i_neterrno='$i_neterrno'
23551 i_netinettcp='$i_netinettcp'
23552 i_niin='$i_niin'
23553 i_poll='$i_poll'
23554 i_prot='$i_prot'
23555 i_pthread='$i_pthread'
23556 i_pwd='$i_pwd'
23557 i_rpcsvcdbm='$i_rpcsvcdbm'
23558 i_sgtty='$i_sgtty'
23559 i_shadow='$i_shadow'
23560 i_socks='$i_socks'
23561 i_stdarg='$i_stdarg'
23562 i_stdbool='$i_stdbool'
23563 i_stddef='$i_stddef'
23564 i_stdlib='$i_stdlib'
23565 i_string='$i_string'
23566 i_sunmath='$i_sunmath'
23567 i_sysaccess='$i_sysaccess'
23568 i_sysdir='$i_sysdir'
23569 i_sysfile='$i_sysfile'
23570 i_sysfilio='$i_sysfilio'
23571 i_sysin='$i_sysin'
23572 i_sysioctl='$i_sysioctl'
23573 i_syslog='$i_syslog'
23574 i_sysmman='$i_sysmman'
23575 i_sysmode='$i_sysmode'
23576 i_sysmount='$i_sysmount'
23577 i_sysndir='$i_sysndir'
23578 i_sysparam='$i_sysparam'
23579 i_syspoll='$i_syspoll'
23580 i_sysresrc='$i_sysresrc'
23581 i_syssecrt='$i_syssecrt'
23582 i_sysselct='$i_sysselct'
23583 i_syssockio='$i_syssockio'
23584 i_sysstat='$i_sysstat'
23585 i_sysstatfs='$i_sysstatfs'
23586 i_sysstatvfs='$i_sysstatvfs'
23587 i_systime='$i_systime'
23588 i_systimek='$i_systimek'
23589 i_systimes='$i_systimes'
23590 i_systypes='$i_systypes'
23591 i_sysuio='$i_sysuio'
23592 i_sysun='$i_sysun'
23593 i_sysutsname='$i_sysutsname'
23594 i_sysvfs='$i_sysvfs'
23595 i_syswait='$i_syswait'
23596 i_termio='$i_termio'
23597 i_termios='$i_termios'
23598 i_time='$i_time'
23599 i_unistd='$i_unistd'
23600 i_ustat='$i_ustat'
23601 i_utime='$i_utime'
23602 i_values='$i_values'
23603 i_varargs='$i_varargs'
23604 i_varhdr='$i_varhdr'
23605 i_vfork='$i_vfork'
23606 ignore_versioned_solibs='$ignore_versioned_solibs'
23607 inc_version_list='$inc_version_list'
23608 inc_version_list_init='$inc_version_list_init'
23609 incpath='$incpath'
23610 incpth='$incpth'
23611 inews='$inews'
23612 initialinstalllocation='$initialinstalllocation'
23613 installarchlib='$installarchlib'
23614 installbin='$installbin'
23615 installhtml1dir='$installhtml1dir'
23616 installhtml3dir='$installhtml3dir'
23617 installman1dir='$installman1dir'
23618 installman3dir='$installman3dir'
23619 installprefix='$installprefix'
23620 installprefixexp='$installprefixexp'
23621 installprivlib='$installprivlib'
23622 installscript='$installscript'
23623 installsitearch='$installsitearch'
23624 installsitebin='$installsitebin'
23625 installsitehtml1dir='$installsitehtml1dir'
23626 installsitehtml3dir='$installsitehtml3dir'
23627 installsitelib='$installsitelib'
23628 installsiteman1dir='$installsiteman1dir'
23629 installsiteman3dir='$installsiteman3dir'
23630 installsitescript='$installsitescript'
23631 installstyle='$installstyle'
23632 installusrbinperl='$installusrbinperl'
23633 installvendorarch='$installvendorarch'
23634 installvendorbin='$installvendorbin'
23635 installvendorhtml1dir='$installvendorhtml1dir'
23636 installvendorhtml3dir='$installvendorhtml3dir'
23637 installvendorlib='$installvendorlib'
23638 installvendorman1dir='$installvendorman1dir'
23639 installvendorman3dir='$installvendorman3dir'
23640 installvendorscript='$installvendorscript'
23641 intsize='$intsize'
23642 issymlink='$issymlink'
23643 ivdformat='$ivdformat'
23644 ivsize='$ivsize'
23645 ivtype='$ivtype'
23646 known_extensions='$known_extensions'
23647 ksh='$ksh'
23648 ld='$ld'
23649 ld_can_script='$ld_can_script'
23650 lddlflags='$lddlflags'
23651 ldflags='$ldflags'
23652 ldflags_uselargefiles='$ldflags_uselargefiles'
23653 ldlibpthname='$ldlibpthname'
23654 less='$less'
23655 lib_ext='$lib_ext'
23656 libc='$libc'
23657 libperl='$libperl'
23658 libpth='$libpth'
23659 libs='$libs'
23660 libsdirs='$libsdirs'
23661 libsfiles='$libsfiles'
23662 libsfound='$libsfound'
23663 libspath='$libspath'
23664 libswanted='$libswanted'
23665 libswanted_uselargefiles='$libswanted_uselargefiles'
23666 line='$line'
23667 lint='$lint'
23668 lkflags='$lkflags'
23669 ln='$ln'
23670 lns='$lns'
23671 localtime_r_proto='$localtime_r_proto'
23672 locincpth='$locincpth'
23673 loclibpth='$loclibpth'
23674 longdblsize='$longdblsize'
23675 longlongsize='$longlongsize'
23676 longsize='$longsize'
23677 lp='$lp'
23678 lpr='$lpr'
23679 ls='$ls'
23680 lseeksize='$lseeksize'
23681 lseektype='$lseektype'
23682 mad='$mad'
23683 madlyh='$madlyh'
23684 madlyobj='$madlyobj'
23685 madlysrc='$madlysrc'
23686 mail='$mail'
23687 mailx='$mailx'
23688 make='$make'
23689 make_set_make='$make_set_make'
23690 mallocobj='$mallocobj'
23691 mallocsrc='$mallocsrc'
23692 malloctype='$malloctype'
23693 man1dir='$man1dir'
23694 man1direxp='$man1direxp'
23695 man1ext='$man1ext'
23696 man3dir='$man3dir'
23697 man3direxp='$man3direxp'
23698 man3ext='$man3ext'
23699 mips_type='$mips_type'
23700 mistrustnm='$mistrustnm'
23701 mkdir='$mkdir'
23702 mmaptype='$mmaptype'
23703 modetype='$modetype'
23704 more='$more'
23705 multiarch='$multiarch'
23706 mv='$mv'
23707 myarchname='$myarchname'
23708 mydomain='$mydomain'
23709 myhostname='$myhostname'
23710 myuname='$myuname'
23711 n='$n'
23712 need_va_copy='$need_va_copy'
23713 netdb_hlen_type='$netdb_hlen_type'
23714 netdb_host_type='$netdb_host_type'
23715 netdb_name_type='$netdb_name_type'
23716 netdb_net_type='$netdb_net_type'
23717 nm='$nm'
23718 nm_opt='$nm_opt'
23719 nm_so_opt='$nm_so_opt'
23720 nonxs_ext='$nonxs_ext'
23721 nroff='$nroff'
23722 nvEUformat='$nvEUformat'
23723 nvFUformat='$nvFUformat'
23724 nvGUformat='$nvGUformat'
23725 nv_overflows_integers_at='$nv_overflows_integers_at'
23726 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23727 nveformat='$nveformat'
23728 nvfformat='$nvfformat'
23729 nvgformat='$nvgformat'
23730 nvsize='$nvsize'
23731 nvtype='$nvtype'
23732 o_nonblock='$o_nonblock'
23733 obj_ext='$obj_ext'
23734 old_pthread_create_joinable='$old_pthread_create_joinable'
23735 optimize='$optimize'
23736 orderlib='$orderlib'
23737 osname='$osname'
23738 osvers='$osvers'
23739 otherlibdirs='$otherlibdirs'
23740 package='$package'
23741 pager='$pager'
23742 passcat='$passcat'
23743 patchlevel='$patchlevel'
23744 path_sep='$path_sep'
23745 perl5='$perl5'
23746 perl='$perl'
23747 perl_patchlevel='$perl_patchlevel'
23748 perl_static_inline='$perl_static_inline'
23749 perladmin='$perladmin'
23750 perllibs='$perllibs'
23751 perlpath='$perlpath'
23752 pg='$pg'
23753 phostname='$phostname'
23754 pidtype='$pidtype'
23755 plibpth='$plibpth'
23756 pmake='$pmake'
23757 pr='$pr'
23758 prefix='$prefix'
23759 prefixexp='$prefixexp'
23760 privlib='$privlib'
23761 privlibexp='$privlibexp'
23762 procselfexe='$procselfexe'
23763 prototype='$prototype'
23764 ptrsize='$ptrsize'
23765 quadkind='$quadkind'
23766 quadtype='$quadtype'
23767 randbits='$randbits'
23768 randfunc='$randfunc'
23769 random_r_proto='$random_r_proto'
23770 randseedtype='$randseedtype'
23771 ranlib='$ranlib'
23772 rd_nodata='$rd_nodata'
23773 readdir64_r_proto='$readdir64_r_proto'
23774 readdir_r_proto='$readdir_r_proto'
23775 revision='$revision'
23776 rm='$rm'
23777 rm_try='$rm_try'
23778 rmail='$rmail'
23779 run='$run'
23780 runnm='$runnm'
23781 sGMTIME_max='$sGMTIME_max'
23782 sGMTIME_min='$sGMTIME_min'
23783 sLOCALTIME_max='$sLOCALTIME_max'
23784 sLOCALTIME_min='$sLOCALTIME_min'
23785 sPRIEUldbl='$sPRIEUldbl'
23786 sPRIFUldbl='$sPRIFUldbl'
23787 sPRIGUldbl='$sPRIGUldbl'
23788 sPRIXU64='$sPRIXU64'
23789 sPRId64='$sPRId64'
23790 sPRIeldbl='$sPRIeldbl'
23791 sPRIfldbl='$sPRIfldbl'
23792 sPRIgldbl='$sPRIgldbl'
23793 sPRIi64='$sPRIi64'
23794 sPRIo64='$sPRIo64'
23795 sPRIu64='$sPRIu64'
23796 sPRIx64='$sPRIx64'
23797 sSCNfldbl='$sSCNfldbl'
23798 sched_yield='$sched_yield'
23799 scriptdir='$scriptdir'
23800 scriptdirexp='$scriptdirexp'
23801 sed='$sed'
23802 seedfunc='$seedfunc'
23803 selectminbits='$selectminbits'
23804 selecttype='$selecttype'
23805 sendmail='$sendmail'
23806 setgrent_r_proto='$setgrent_r_proto'
23807 sethostent_r_proto='$sethostent_r_proto'
23808 setlocale_r_proto='$setlocale_r_proto'
23809 setnetent_r_proto='$setnetent_r_proto'
23810 setprotoent_r_proto='$setprotoent_r_proto'
23811 setpwent_r_proto='$setpwent_r_proto'
23812 setservent_r_proto='$setservent_r_proto'
23813 sh='$sh'
23814 shar='$shar'
23815 sharpbang='$sharpbang'
23816 shmattype='$shmattype'
23817 shortsize='$shortsize'
23818 shrpenv='$shrpenv'
23819 shsharp='$shsharp'
23820 sig_count='$sig_count'
23821 sig_name='$sig_name'
23822 sig_name_init='$sig_name_init'
23823 sig_num='$sig_num'
23824 sig_num_init='$sig_num_init'
23825 sig_size='$sig_size'
23826 signal_t='$signal_t'
23827 sitearch='$sitearch'
23828 sitearchexp='$sitearchexp'
23829 sitebin='$sitebin'
23830 sitebinexp='$sitebinexp'
23831 sitehtml1dir='$sitehtml1dir'
23832 sitehtml1direxp='$sitehtml1direxp'
23833 sitehtml3dir='$sitehtml3dir'
23834 sitehtml3direxp='$sitehtml3direxp'
23835 sitelib='$sitelib'
23836 sitelib_stem='$sitelib_stem'
23837 sitelibexp='$sitelibexp'
23838 siteman1dir='$siteman1dir'
23839 siteman1direxp='$siteman1direxp'
23840 siteman3dir='$siteman3dir'
23841 siteman3direxp='$siteman3direxp'
23842 siteprefix='$siteprefix'
23843 siteprefixexp='$siteprefixexp'
23844 sitescript='$sitescript'
23845 sitescriptexp='$sitescriptexp'
23846 sizesize='$sizesize'
23847 sizetype='$sizetype'
23848 sleep='$sleep'
23849 smail='$smail'
23850 so='$so'
23851 sockethdr='$sockethdr'
23852 socketlib='$socketlib'
23853 socksizetype='$socksizetype'
23854 sort='$sort'
23855 spackage='$spackage'
23856 spitshell='$spitshell'
23857 srand48_r_proto='$srand48_r_proto'
23858 srandom_r_proto='$srandom_r_proto'
23859 src='$src'
23860 ssizetype='$ssizetype'
23861 st_ino_sign='$st_ino_sign'
23862 st_ino_size='$st_ino_size'
23863 startperl='$startperl'
23864 startsh='$startsh'
23865 static_ext='$static_ext'
23866 stdchar='$stdchar'
23867 stdio_base='$stdio_base'
23868 stdio_bufsiz='$stdio_bufsiz'
23869 stdio_cnt='$stdio_cnt'
23870 stdio_filbuf='$stdio_filbuf'
23871 stdio_ptr='$stdio_ptr'
23872 stdio_stream_array='$stdio_stream_array'
23873 strerror_r_proto='$strerror_r_proto'
23874 strings='$strings'
23875 submit='$submit'
23876 subversion='$subversion'
23877 sysman='$sysman'
23878 sysroot='$sysroot'
23879 tail='$tail'
23880 tar='$tar'
23881 targetarch='$targetarch'
23882 targetdir='$targetdir'
23883 targetenv='$targetenv'
23884 targethost='$targethost'
23885 targetmkdir='$targetmkdir'
23886 targetport='$targetport'
23887 targetsh='$targetsh'
23888 tbl='$tbl'
23889 tee='$tee'
23890 test='$test'
23891 timeincl='$timeincl'
23892 timetype='$timetype'
23893 tmpnam_r_proto='$tmpnam_r_proto'
23894 to='$to'
23895 touch='$touch'
23896 tr='$tr'
23897 trnl='$trnl'
23898 troff='$troff'
23899 ttyname_r_proto='$ttyname_r_proto'
23900 u16size='$u16size'
23901 u16type='$u16type'
23902 u32size='$u32size'
23903 u32type='$u32type'
23904 u64size='$u64size'
23905 u64type='$u64type'
23906 u8size='$u8size'
23907 u8type='$u8type'
23908 uidformat='$uidformat'
23909 uidsign='$uidsign'
23910 uidsize='$uidsize'
23911 uidtype='$uidtype'
23912 uname='$uname'
23913 uniq='$uniq'
23914 uquadtype='$uquadtype'
23915 use5005threads='$use5005threads'
23916 use64bitall='$use64bitall'
23917 use64bitint='$use64bitint'
23918 usecrosscompile='$usecrosscompile'
23919 usedevel='$usedevel'
23920 usedl='$usedl'
23921 usedtrace='$usedtrace'
23922 usefaststdio='$usefaststdio'
23923 useithreads='$useithreads'
23924 usekernprocpathname='$usekernprocpathname'
23925 uselargefiles='$uselargefiles'
23926 uselongdouble='$uselongdouble'
23927 usemallocwrap='$usemallocwrap'
23928 usemorebits='$usemorebits'
23929 usemultiplicity='$usemultiplicity'
23930 usemymalloc='$usemymalloc'
23931 usenm='$usenm'
23932 usensgetexecutablepath='$usensgetexecutablepath'
23933 useopcode='$useopcode'
23934 useperlio='$useperlio'
23935 useposix='$useposix'
23936 usereentrant='$usereentrant'
23937 userelocatableinc='$userelocatableinc'
23938 useshrplib='$useshrplib'
23939 usesitecustomize='$usesitecustomize'
23940 usesocks='$usesocks'
23941 usethreads='$usethreads'
23942 usevendorprefix='$usevendorprefix'
23943 useversionedarchname='$useversionedarchname'
23944 usevfork='$usevfork'
23945 usrinc='$usrinc'
23946 uuname='$uuname'
23947 uvXUformat='$uvXUformat'
23948 uvoformat='$uvoformat'
23949 uvsize='$uvsize'
23950 uvtype='$uvtype'
23951 uvuformat='$uvuformat'
23952 uvxformat='$uvxformat'
23953 vaproto='$vaproto'
23954 vendorarch='$vendorarch'
23955 vendorarchexp='$vendorarchexp'
23956 vendorbin='$vendorbin'
23957 vendorbinexp='$vendorbinexp'
23958 vendorhtml1dir='$vendorhtml1dir'
23959 vendorhtml1direxp='$vendorhtml1direxp'
23960 vendorhtml3dir='$vendorhtml3dir'
23961 vendorhtml3direxp='$vendorhtml3direxp'
23962 vendorlib='$vendorlib'
23963 vendorlib_stem='$vendorlib_stem'
23964 vendorlibexp='$vendorlibexp'
23965 vendorman1dir='$vendorman1dir'
23966 vendorman1direxp='$vendorman1direxp'
23967 vendorman3dir='$vendorman3dir'
23968 vendorman3direxp='$vendorman3direxp'
23969 vendorprefix='$vendorprefix'
23970 vendorprefixexp='$vendorprefixexp'
23971 vendorscript='$vendorscript'
23972 vendorscriptexp='$vendorscriptexp'
23973 version='$version'
23974 version_patchlevel_string='$version_patchlevel_string'
23975 versiononly='$versiononly'
23976 vi='$vi'
23977 xlibpth='$xlibpth'
23978 yacc='$yacc'
23979 yaccflags='$yaccflags'
23980 zcat='$zcat'
23981 zip='$zip'
23982 EOT
23983
23984 : add special variables
23985 $test -f $src/patchlevel.h && \
23986 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23987 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23988 echo "PERL_CONFIG_SH=true" >>config.sh
23989
23990 : propagate old symbols
23991 if $test -f UU/config.sh; then
23992         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23993         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23994                 config.sh config.sh UU/oldconfig.sh |\
23995                 $sort | $uniq -u >UU/oldsyms
23996         set X `$cat UU/oldsyms`
23997         shift
23998         case $# in
23999         0) ;;
24000         *)
24001                 $cat <<EOM
24002 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24003 EOM
24004                 echo ": Variables propagated from previous config.sh file." >>config.sh
24005                 for sym in `$cat UU/oldsyms`; do
24006                         echo "    Propagating $hint variable "'$'"$sym..."
24007                         eval 'tmp="$'"${sym}"'"'
24008                         echo "$tmp" | \
24009                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24010                 done
24011                 ;;
24012         esac
24013 fi
24014
24015 : Finish up by extracting the .SH files
24016 case "$alldone" in
24017 exit)
24018         $rm -rf UU
24019         echo "Extraction done."
24020         exit 0
24021         ;;
24022 cont)
24023         ;;
24024 '')
24025         dflt=''
24026         nostick=true
24027         $cat <<EOM
24028
24029 If you'd like to make any changes to the config.sh file before I begin
24030 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24031
24032 EOM
24033         rp="Press return or use a shell escape to edit config.sh:"
24034         . UU/myread
24035         nostick=''
24036         case "$ans" in
24037         '') ;;
24038         *) : in case they cannot read
24039                 sh 1>&4 -c "$ans";;
24040         esac
24041         ;;
24042 esac
24043
24044 : if this fails, just run all the .SH files by hand
24045 . ./config.sh
24046
24047 echo " "
24048 exec 1>&4
24049 pwd=`pwd`
24050 . ./UU/extract
24051 cd "$pwd"
24052
24053 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24054         dflt=y
24055         case "$silent" in
24056         true) ;;
24057         *)
24058                 $cat <<EOM
24059
24060 Now you need to generate make dependencies by running "$make depend".
24061 You might prefer to run it in background: "$make depend > makedepend.out &"
24062 It can take a while, so you might not want to run it right now.
24063
24064 EOM
24065                 ;;
24066         esac
24067         rp="Run $make depend now?"
24068         . UU/myread
24069         case "$ans" in
24070         y*)
24071                 $make depend && echo "Now you must run '$make'."
24072                 ;;
24073         *)
24074                 echo "You must run '$make depend' then '$make'."
24075                 ;;
24076         esac
24077 elif test -f [Mm]akefile; then
24078         echo " "
24079         echo "Now you must run a $make."
24080 else
24081         echo "Configure done."
24082 fi
24083
24084 if $test -f Policy.sh; then
24085     $cat <<EOM
24086
24087 If you compile $package on a different machine or from a different object
24088 directory, copy the Policy.sh file from this object directory to the
24089 new one before you run Configure -- this will help you with most of
24090 the policy defaults.
24091
24092 EOM
24093 fi
24094 if $test -f config.msg; then
24095     echo "Hmm.  I also noted the following information while running:"
24096     echo " "
24097     $cat config.msg >&4
24098     $rm -f config.msg
24099 fi
24100 $rm -f kit*isdone ark*isdone
24101 $rm -rf UU
24102
24103 : End of Configure
24104