This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix typo in regen/opcode.pl
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.code.sf.net/p/dist/code/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated using [metaconfig 3.5 PL0]
32 # (with additional metaconfig patches by perlbug@perl.org)
33
34 cat >c1$$ <<EOF
35 ARGGGHHHH!!!!!
36
37 SCO csh still thinks true is false.  Write to SCO today and tell them that next
38 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
39
40 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
41 we'd have to do is go in and swap the && and || tokens, wherever they are.)
42
43 [End of diatribe. We now return you to your regularly scheduled programming...]
44 EOF
45 cat >c2$$ <<EOF
46
47 OOPS!  You naughty creature!  You didn't run Configure with sh!
48 I will attempt to remedy the situation by running sh for you...
49 EOF
50
51 true || cat c1$$ c2$$
52 true || exec sh $0 $argv:q
53
54 (exit $?0) || cat c2$$
55 (exit $?0) || exec sh $0 $argv:q
56 rm -f c1$$ c2$$
57
58 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
59         cat <<EOF
60 ***
61 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
62 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
63 *** Please read the README.plan9 for further instructions.
64 *** Cannot continue, aborting.
65 ***
66 EOF
67         exit 1
68 fi
69
70 if test ! -c /dev/null ; then
71         cat <<EOF
72 ***
73 *** I'm sorry, but /dev/null appears to be a file rather than a device.
74 *** Please consult your operating sytem's notes for making a device
75 *** in /dev.
76 *** Cannot continue, aborting.
77 ***
78 EOF
79         exit 1
80 fi
81
82 : compute my invocation name
83 me=$0
84 case "$0" in
85 */*)
86         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
87         test "$me" || me=$0
88         ;;
89 esac
90
91 : Proper separator for the PATH environment variable
92 p_=:
93 : On OS/2 this directory should exist if this is not floppy only system ":-]"
94 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; then
95         if test -n "$OS2_SHELL"; then
96                 p_=\;
97                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
98                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
99                 is_os2=yes
100         elif test -n "$DJGPP"; then
101                 case "X${MACHTYPE:-nonesuchmach}" in
102                 *cygwin|*msys) ;;
103                 *) p_=\; ;;
104                 esac
105         fi
106 fi
107
108 : Proper PATH setting
109 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
110 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
111 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
112 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
113 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
114 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
115 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
116 paths="$paths /sbin /usr/sbin /usr/libexec"
117 paths="$paths /system/gnu_library/bin"
118
119 for p in $paths
120 do
121         case "$p_$PATH$p_" in
122         *$p_$p$p_*) ;;
123         *) test -d $p && PATH=$PATH$p_$p ;;
124         esac
125 done
126
127 PATH=.$p_$PATH
128 export PATH
129
130 : shall we be using ksh?
131 inksh=''
132 needksh=''
133 avoidksh=''
134 newsh=/bin/ksh
135 changesh=''
136 if (PATH=.; alias -x) >/dev/null 2>&1; then
137                 inksh=true
138 fi
139 if test -f /hp-ux -a -f /bin/ksh; then
140         needksh='to avoid sh bug in "here document" expansion'
141 fi
142 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
143         if test X`/usr/bin/uname -v` = X4; then
144                 avoidksh="to avoid AIX 4's /bin/sh"
145                 newsh=/usr/bin/bsh
146         fi
147 fi
148 if test -f /osf_boot -a -f /usr/sbin/setld; then
149         if test X`/usr/bin/uname -s` = XOSF1; then
150                 avoidksh="to avoid Digital UNIX' ksh"
151                 newsh=/bin/sh
152                 unset BIN_SH
153         fi
154 fi
155 case "$inksh/$needksh" in
156 /[a-z]*)
157                 ENV=''
158                 changesh=true
159                 reason="$needksh"
160         ;;
161 esac
162 case "$inksh/$avoidksh" in
163 true/[a-z]*)
164         changesh=true
165         reason="$avoidksh"
166         ;;
167 esac
168 case "$inksh/$needksh-$avoidksh-" in
169 true/--)
170                 cat <<EOM
171 (I see you are using the Korn shell.  Some ksh's blow up on $me,
172 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
173 EOM
174         ;;
175 esac
176 case "$changesh" in
177 true)
178         export newsh
179         echo "(Feeding myself to $newsh $reason.)"
180         case "$0" in
181         Configure|*/Configure) exec $newsh $0 "$@";;
182         *) exec $newsh Configure "$@";;
183         esac
184         ;;
185 esac
186 test -x "${newsh}" || unset newsh
187
188 : if needed, set CDPATH to a harmless value that is not chatty
189 : avoid bash 2.02 problems with empty CDPATH.
190 case "$CDPATH" in
191 '')     ;;
192 *)      case "$SHELL" in
193         *bash*) CDPATH='.' ;;
194         *) CDPATH='' ;;
195         esac
196         ;;
197 esac
198
199 : Configure runs within the UU subdirectory
200 test -d UU || mkdir UU
201 cd UU && rm -f ./*
202
203 ccname=''
204 ccversion=''
205 ccsymbols=''
206 cppccsymbols=''
207 cppsymbols=''
208 from=''
209 hostgenerate=''
210 hostosname=''
211 hostperl=''
212 run=''
213 targetarch=''
214 targetdir=''
215 targetenv=''
216 targethost=''
217 targetmkdir=''
218 targetport=''
219 to=''
220 usecrosscompile=''
221 extern_C=''
222 mistrustnm=''
223 usedevel=''
224 perllibs=''
225 dynamic_ext=''
226 extensions=''
227 known_extensions=''
228 nonxs_ext=''
229 static_ext=''
230 useopcode=''
231 useposix=''
232 extras=''
233 d_bsd=''
234 d_eunice=''
235 d_xenix=''
236 eunicefix=''
237 ar=''
238 awk=''
239 bash=''
240 bison=''
241 byacc=''
242 cat=''
243 chgrp=''
244 chmod=''
245 chown=''
246 comm=''
247 compress=''
248 cp=''
249 cpio=''
250 cpp=''
251 csh=''
252 date=''
253 echo=''
254 egrep=''
255 emacs=''
256 expr=''
257 find=''
258 flex=''
259 gmake=''
260 grep=''
261 gzip=''
262 inews=''
263 ksh=''
264 less=''
265 line=''
266 lint=''
267 ln=''
268 lp=''
269 lpr=''
270 ls=''
271 mail=''
272 mailx=''
273 make=''
274 mkdir=''
275 more=''
276 mv=''
277 nm=''
278 nroff=''
279 perl=''
280 pg=''
281 pmake=''
282 pr=''
283 rm=''
284 rmail=''
285 sed=''
286 sendmail=''
287 shar=''
288 sleep=''
289 smail=''
290 sort=''
291 submit=''
292 tail=''
293 tar=''
294 tbl=''
295 tee=''
296 test=''
297 touch=''
298 tr=''
299 troff=''
300 uname=''
301 uniq=''
302 uuname=''
303 vi=''
304 zcat=''
305 zip=''
306 full_ar=''
307 full_sed=''
308 libswanted=''
309 hint=''
310 myuname=''
311 osname=''
312 osvers=''
313 Author=''
314 Date=''
315 Header=''
316 Id=''
317 Locker=''
318 Log=''
319 RCSfile=''
320 Revision=''
321 Source=''
322 State=''
323 sysroot=''
324 _a=''
325 _exe=''
326 _o=''
327 archobjs=''
328 exe_ext=''
329 firstmakefile=''
330 lib_ext=''
331 obj_ext=''
332 path_sep=''
333 rm_try=''
334 afs=''
335 afsroot=''
336 alignbytes=''
337 ansi2knr=''
338 archlib=''
339 archlibexp=''
340 d_archlib=''
341 installarchlib=''
342 archname=''
343 myarchname=''
344 useversionedarchname=''
345 d_atolf=''
346 d_atoll=''
347 baserev=''
348 bin=''
349 binexp=''
350 initialinstalllocation=''
351 installbin=''
352 userelocatableinc=''
353 byteorder=''
354 cc=''
355 ccflags=''
356 cppflags=''
357 ldflags=''
358 lkflags=''
359 locincpth=''
360 optimize=''
361 cf_email=''
362 cf_by=''
363 cf_time=''
364 charbits=''
365 charsize=''
366 contains=''
367 cpp_stuff=''
368 cpplast=''
369 cppminus=''
370 cpprun=''
371 cppstdin=''
372 d__fwalk=''
373 d_access=''
374 d_accessx=''
375 d_acosh=''
376 d_aintl=''
377 d_alarm=''
378 asctime_r_proto=''
379 d_asctime_r=''
380 d_attribute_deprecated=''
381 d_attribute_format=''
382 d_attribute_malloc=''
383 d_attribute_nonnull=''
384 d_attribute_noreturn=''
385 d_attribute_pure=''
386 d_attribute_unused=''
387 d_attribute_warn_unused_result=''
388 d_printf_format_null=''
389 d_backtrace=''
390 d_bcmp=''
391 d_bcopy=''
392 d_builtin_choose_expr=''
393 d_builtin_expect=''
394 d_bzero=''
395 d_c99_variadic_macros=''
396 d_casti32=''
397 castflags=''
398 d_castneg=''
399 d_chown=''
400 d_chroot=''
401 d_chsize=''
402 d_class=''
403 d_clearenv=''
404 d_closedir=''
405 d_void_closedir=''
406 d_cmsghdr_s=''
407 d_const=''
408 d_copysignl=''
409 d_cplusplus=''
410 cryptlib=''
411 d_crypt=''
412 crypt_r_proto=''
413 d_crypt_r=''
414 d_csh=''
415 full_csh=''
416 d_ctermid=''
417 ctermid_r_proto=''
418 d_ctermid_r=''
419 ctime_r_proto=''
420 d_ctime_r=''
421 d_cuserid=''
422 d_dbl_dig=''
423 d_dbminitproto=''
424 d_difftime=''
425 d_dir_dd_fd=''
426 d_dirfd=''
427 d_dladdr=''
428 d_dlerror=''
429 d_dlopen=''
430 d_dlsymun=''
431 d_dosuid=''
432 d_suidsafe=''
433 d_drand48_r=''
434 drand48_r_proto=''
435 d_drand48proto=''
436 d_dup2=''
437 d_eaccess=''
438 d_endgrent=''
439 d_endgrent_r=''
440 endgrent_r_proto=''
441 d_endhent=''
442 d_endhostent_r=''
443 endhostent_r_proto=''
444 d_endnent=''
445 d_endnetent_r=''
446 endnetent_r_proto=''
447 d_endpent=''
448 d_endprotoent_r=''
449 endprotoent_r_proto=''
450 d_endpwent=''
451 d_endpwent_r=''
452 endpwent_r_proto=''
453 d_endsent=''
454 d_endservent_r=''
455 endservent_r_proto=''
456 d_faststdio=''
457 d_fchdir=''
458 d_fchmod=''
459 d_fchown=''
460 d_fcntl=''
461 d_fcntl_can_lock=''
462 d_fd_macros=''
463 d_fd_set=''
464 d_fds_bits=''
465 d_fegetround=''
466 d_fgetpos=''
467 d_finite=''
468 d_finitel=''
469 d_flexfnam=''
470 d_flock=''
471 d_flockproto=''
472 d_fork=''
473 d_fp_class=''
474 d_fp_classl=''
475 d_fpclass=''
476 d_fp_classify=''
477 d_fpclassify=''
478 d_fpclassl=''
479 d_fpgetround=''
480 d_fpos64_t=''
481 d_frexpl=''
482 d_fs_data_s=''
483 d_fseeko=''
484 d_fsetpos=''
485 d_fstatfs=''
486 d_fsync=''
487 d_ftello=''
488 d_ftime=''
489 d_gettimeod=''
490 d_futimes=''
491 d_Gconvert=''
492 d_getaddrinfo=''
493 d_getcwd=''
494 d_getespwnam=''
495 d_getfsstat=''
496 d_getgrent=''
497 d_getgrent_r=''
498 getgrent_r_proto=''
499 d_getgrgid_r=''
500 getgrgid_r_proto=''
501 d_getgrnam_r=''
502 getgrnam_r_proto=''
503 d_getgrps=''
504 d_gethbyaddr=''
505 d_gethbyname=''
506 d_gethent=''
507 aphostname=''
508 d_gethname=''
509 d_phostname=''
510 d_uname=''
511 d_gethostbyaddr_r=''
512 gethostbyaddr_r_proto=''
513 d_gethostbyname_r=''
514 gethostbyname_r_proto=''
515 d_gethostent_r=''
516 gethostent_r_proto=''
517 d_gethostprotos=''
518 d_getitimer=''
519 d_getlogin=''
520 d_getlogin_r=''
521 getlogin_r_proto=''
522 d_getmnt=''
523 d_getmntent=''
524 d_getnameinfo=''
525 d_getnbyaddr=''
526 d_getnbyname=''
527 d_getnent=''
528 d_getnetbyaddr_r=''
529 getnetbyaddr_r_proto=''
530 d_getnetbyname_r=''
531 getnetbyname_r_proto=''
532 d_getnetent_r=''
533 getnetent_r_proto=''
534 d_getnetprotos=''
535 d_getpagsz=''
536 d_getpent=''
537 d_getpgid=''
538 d_getpgrp2=''
539 d_bsdgetpgrp=''
540 d_getpgrp=''
541 d_getppid=''
542 d_getprior=''
543 d_getpbyname=''
544 d_getpbynumber=''
545 d_getprotobyname_r=''
546 getprotobyname_r_proto=''
547 d_getprotobynumber_r=''
548 getprotobynumber_r_proto=''
549 d_getprotoent_r=''
550 getprotoent_r_proto=''
551 d_getprotoprotos=''
552 d_getprpwnam=''
553 d_getpwent=''
554 d_getpwent_r=''
555 getpwent_r_proto=''
556 d_getpwnam_r=''
557 getpwnam_r_proto=''
558 d_getpwuid_r=''
559 getpwuid_r_proto=''
560 d_getsent=''
561 d_getservbyname_r=''
562 getservbyname_r_proto=''
563 d_getservbyport_r=''
564 getservbyport_r_proto=''
565 d_getservent_r=''
566 getservent_r_proto=''
567 d_getservprotos=''
568 d_getspnam=''
569 d_getspnam_r=''
570 getspnam_r_proto=''
571 d_getsbyname=''
572 d_getsbyport=''
573 d_gmtime_r=''
574 gmtime_r_proto=''
575 d_gnulibc=''
576 gnulibc_version=''
577 d_hasmntopt=''
578 d_htonl=''
579 d_ilogbl=''
580 d_inetaton=''
581 d_inetntop=''
582 d_inetpton=''
583 d_int64_t=''
584 d_isascii=''
585 d_isblank=''
586 d_isfinite=''
587 d_isfinitel=''
588 d_isinf=''
589 d_isinfl=''
590 d_isnan=''
591 d_isnanl=''
592 d_j0=''
593 d_j0l=''
594 d_killpg=''
595 d_lchown=''
596 d_ldbl_dig=''
597 d_libm_lib_version=''
598 d_link=''
599 d_localtime_r=''
600 d_localtime_r_needs_tzset=''
601 localtime_r_proto=''
602 d_locconv=''
603 d_lc_monetary_2008=''
604 d_lockf=''
605 d_ldexpl=''
606 d_longdbl=''
607 longdblkind=''
608 longdblsize=''
609 d_longlong=''
610 longlongsize=''
611 d_lseekproto=''
612 d_lstat=''
613 d_madvise=''
614 d_malloc_good_size=''
615 d_malloc_size=''
616 d_mblen=''
617 d_mbstowcs=''
618 d_mbtowc=''
619 d_memchr=''
620 d_memcmp=''
621 d_memcpy=''
622 d_memmove=''
623 d_memset=''
624 d_mkdir=''
625 d_mkdtemp=''
626 d_mkfifo=''
627 d_mkstemp=''
628 d_mkstemps=''
629 d_mktime=''
630 d_mmap=''
631 mmaptype=''
632 d_modfl=''
633 d_modfl_pow32_bug=''
634 d_modflproto=''
635 d_mprotect=''
636 d_msg=''
637 d_msgctl=''
638 d_msgget=''
639 d_msghdr_s=''
640 d_msgrcv=''
641 d_msgsnd=''
642 d_msync=''
643 d_munmap=''
644 d_nice=''
645 d_nl_langinfo=''
646 d_off64_t=''
647 d_open3=''
648 d_fpathconf=''
649 d_pathconf=''
650 d_pause=''
651 d_pipe=''
652 d_poll=''
653 d_portable=''
654 d_prctl=''
655 d_prctl_set_name=''
656 d_procselfexe=''
657 procselfexe=''
658 d_old_pthread_create_joinable=''
659 old_pthread_create_joinable=''
660 d_pthread_atfork=''
661 d_pthread_attr_setscope=''
662 d_pthread_yield=''
663 d_sched_yield=''
664 sched_yield=''
665 d_ptrdiff_t=''
666 d_qgcvt=''
667 d_random_r=''
668 random_r_proto=''
669 d_readdir64_r=''
670 readdir64_r_proto=''
671 d_readdir=''
672 d_rewinddir=''
673 d_seekdir=''
674 d_telldir=''
675 d_readdir_r=''
676 readdir_r_proto=''
677 d_readlink=''
678 d_readv=''
679 d_recvmsg=''
680 d_rename=''
681 d_rmdir=''
682 d_safebcpy=''
683 d_safemcpy=''
684 d_sanemcmp=''
685 d_sbrkproto=''
686 d_scalbnl=''
687 d_select=''
688 d_sem=''
689 d_semctl=''
690 d_semget=''
691 d_semop=''
692 d_sendmsg=''
693 d_setegid=''
694 d_seteuid=''
695 d_setgrent=''
696 d_setgrent_r=''
697 setgrent_r_proto=''
698 d_setgrps=''
699 d_sethent=''
700 d_sethostent_r=''
701 sethostent_r_proto=''
702 d_setitimer=''
703 d_setlinebuf=''
704 d_setlocale=''
705 d_setlocale_r=''
706 setlocale_r_proto=''
707 d_setnent=''
708 d_setnetent_r=''
709 setnetent_r_proto=''
710 d_setpent=''
711 d_setpgid=''
712 d_setpgrp2=''
713 d_bsdsetpgrp=''
714 d_setpgrp=''
715 d_setprior=''
716 d_setproctitle=''
717 d_setprotoent_r=''
718 setprotoent_r_proto=''
719 d_setpwent=''
720 d_setpwent_r=''
721 setpwent_r_proto=''
722 d_setregid=''
723 d_setresgid=''
724 d_setresuid=''
725 d_setreuid=''
726 d_setrgid=''
727 d_setruid=''
728 d_setsent=''
729 d_setservent_r=''
730 setservent_r_proto=''
731 d_setsid=''
732 d_setvbuf=''
733 d_shm=''
734 d_shmat=''
735 d_shmatprototype=''
736 shmattype=''
737 d_shmctl=''
738 d_shmdt=''
739 d_shmget=''
740 d_sigaction=''
741 d_signbit=''
742 d_sigprocmask=''
743 d_sigsetjmp=''
744 usesitecustomize=''
745 d_snprintf=''
746 d_vsnprintf=''
747 d_sockatmark=''
748 d_sockatmarkproto=''
749 d_ip_mreq=''
750 d_ip_mreq_source=''
751 d_ipv6_mreq=''
752 d_ipv6_mreq_source=''
753 d_msg_ctrunc=''
754 d_msg_dontroute=''
755 d_msg_oob=''
756 d_msg_peek=''
757 d_msg_proxy=''
758 d_oldsock=''
759 d_scm_rights=''
760 d_sin6_scope_id=''
761 d_sockaddr_in6=''
762 d_sockaddr_sa_len=''
763 d_socket=''
764 d_sockpair=''
765 sockethdr=''
766 socketlib=''
767 d_socklen_t=''
768 d_socks5_init=''
769 d_sprintf_returns_strlen=''
770 d_sqrtl=''
771 d_srand48_r=''
772 srand48_r_proto=''
773 d_srandom_r=''
774 srandom_r_proto=''
775 d_sresgproto=''
776 d_sresuproto=''
777 d_statblks=''
778 d_statfs_f_flags=''
779 d_statfs_s=''
780 d_static_inline=''
781 perl_static_inline=''
782 d_fstatvfs=''
783 d_statvfs=''
784 d_stdio_cnt_lval=''
785 d_stdio_ptr_lval=''
786 d_stdio_ptr_lval_nochange_cnt=''
787 d_stdio_ptr_lval_sets_cnt=''
788 d_stdiobase=''
789 d_stdstdio=''
790 stdio_base=''
791 stdio_bufsiz=''
792 stdio_cnt=''
793 stdio_filbuf=''
794 stdio_ptr=''
795 d_index=''
796 d_strchr=''
797 d_strcoll=''
798 d_strctcpy=''
799 d_strerrm=''
800 d_strerror=''
801 d_sysernlst=''
802 d_syserrlst=''
803 d_strerror_r=''
804 strerror_r_proto=''
805 d_strftime=''
806 d_strlcat=''
807 d_strlcpy=''
808 d_strtod=''
809 d_strtol=''
810 d_strtold=''
811 d_strtoll=''
812 d_strtoq=''
813 d_strtoul=''
814 d_strtoull=''
815 d_strtouq=''
816 d_strxfrm=''
817 d_symlink=''
818 d_syscall=''
819 d_syscallproto=''
820 d_sysconf=''
821 d_system=''
822 d_tcgetpgrp=''
823 d_tcsetpgrp=''
824 d_telldirproto=''
825 d_time=''
826 timetype=''
827 d_asctime64=''
828 d_ctime64=''
829 d_difftime64=''
830 d_gmtime64=''
831 d_localtime64=''
832 d_mktime64=''
833 d_timegm=''
834 clocktype=''
835 d_times=''
836 d_tmpnam_r=''
837 tmpnam_r_proto=''
838 d_truncate=''
839 d_truncl=''
840 d_ttyname_r=''
841 ttyname_r_proto=''
842 d_tzname=''
843 d_u32align=''
844 d_ualarm=''
845 d_umask=''
846 d_semctl_semid_ds=''
847 d_semctl_semun=''
848 d_union_semun=''
849 d_unordered=''
850 d_unsetenv=''
851 d_usleep=''
852 d_usleepproto=''
853 d_ustat=''
854 d_pseudofork=''
855 d_vfork=''
856 usevfork=''
857 d_voidsig=''
858 signal_t=''
859 d_volatile=''
860 d_charvspr=''
861 d_vprintf=''
862 d_wait4=''
863 d_waitpid=''
864 d_wcscmp=''
865 d_wcstombs=''
866 d_wcsxfrm=''
867 d_wctomb=''
868 d_writev=''
869 dlext=''
870 bin_ELF=''
871 cccdlflags=''
872 ccdlflags=''
873 dlsrc=''
874 ld=''
875 ld_can_script=''
876 lddlflags=''
877 usedl=''
878 doublesize=''
879 ebcdic=''
880 fflushNULL=''
881 fflushall=''
882 fpossize=''
883 fpostype=''
884 gccansipedantic=''
885 gccosandvers=''
886 gccversion=''
887 gidformat=''
888 gidsign=''
889 gidsize=''
890 gidtype=''
891 groupstype=''
892 h_fcntl=''
893 h_sysfile=''
894 html1dir=''
895 html1direxp=''
896 installhtml1dir=''
897 html3dir=''
898 html3direxp=''
899 installhtml3dir=''
900 i_arpainet=''
901 i_assert=''
902 i_bfd=''
903 i_crypt=''
904 db_hashtype=''
905 db_prefixtype=''
906 db_version_major=''
907 db_version_minor=''
908 db_version_patch=''
909 i_db=''
910 i_dbm=''
911 i_rpcsvcdbm=''
912 d_dirnamlen=''
913 direntrytype=''
914 i_dirent=''
915 i_dlfcn=''
916 i_execinfo=''
917 i_fcntl=''
918 i_fenv=''
919 i_float=''
920 i_fp=''
921 i_fp_class=''
922 i_gdbm=''
923 d_grpasswd=''
924 i_grp=''
925 i_ieeefp=''
926 i_inttypes=''
927 i_langinfo=''
928 i_libutil=''
929 i_limits=''
930 i_locale=''
931 i_machcthr=''
932 i_malloc=''
933 i_mallocmalloc=''
934 i_math=''
935 i_memory=''
936 i_mntent=''
937 d_gdbm_ndbm_h_uses_prototypes=''
938 d_gdbmndbm_h_uses_prototypes=''
939 d_ndbm=''
940 d_ndbm_h_uses_prototypes=''
941 i_gdbm_ndbm=''
942 i_gdbmndbm=''
943 i_ndbm=''
944 i_netdb=''
945 i_neterrno=''
946 i_netinettcp=''
947 i_niin=''
948 i_sysin=''
949 i_poll=''
950 i_prot=''
951 i_pthread=''
952 d_pwage=''
953 d_pwchange=''
954 d_pwclass=''
955 d_pwcomment=''
956 d_pwexpire=''
957 d_pwgecos=''
958 d_pwpasswd=''
959 d_pwquota=''
960 i_pwd=''
961 i_quadmath=''
962 i_shadow=''
963 i_socks=''
964 i_stdbool=''
965 i_stddef=''
966 i_stdint=''
967 i_stdlib=''
968 i_string=''
969 strings=''
970 i_sunmath=''
971 i_sysaccess=''
972 i_sysdir=''
973 i_sysfile=''
974 d_voidtty=''
975 i_bsdioctl=''
976 i_sysfilio=''
977 i_sysioctl=''
978 i_syssockio=''
979 i_syslog=''
980 i_sysmman=''
981 i_sysmode=''
982 i_sysmount=''
983 i_sysndir=''
984 i_sysparam=''
985 i_syspoll=''
986 i_sysresrc=''
987 i_syssecrt=''
988 i_sysselct=''
989 i_sysstat=''
990 i_sysstatfs=''
991 i_sysstatvfs=''
992 i_systimes=''
993 i_systypes=''
994 i_sysuio=''
995 i_sysun=''
996 i_sysutsname=''
997 i_sysvfs=''
998 i_syswait=''
999 i_sgtty=''
1000 i_termio=''
1001 i_termios=''
1002 d_tm_tm_gmtoff=''
1003 d_tm_tm_zone=''
1004 i_systime=''
1005 i_systimek=''
1006 i_time=''
1007 timeincl=''
1008 i_unistd=''
1009 i_ustat=''
1010 i_utime=''
1011 i_values=''
1012 i_stdarg=''
1013 i_varargs=''
1014 i_varhdr=''
1015 i_vfork=''
1016 d_inc_version_list=''
1017 inc_version_list=''
1018 inc_version_list_init=''
1019 installprefix=''
1020 installprefixexp=''
1021 installstyle=''
1022 installusrbinperl=''
1023 intsize=''
1024 longsize=''
1025 shortsize=''
1026 issymlink=''
1027 libc=''
1028 ldlibpthname=''
1029 libperl=''
1030 shrpenv=''
1031 useshrplib=''
1032 glibpth=''
1033 incpth=''
1034 libpth=''
1035 loclibpth=''
1036 plibpth=''
1037 xlibpth=''
1038 ignore_versioned_solibs=''
1039 libs=''
1040 libsdirs=''
1041 libsfiles=''
1042 libsfound=''
1043 libspath=''
1044 lns=''
1045 d_PRIEUldbl=''
1046 d_PRIFUldbl=''
1047 d_PRIGUldbl=''
1048 d_PRIeldbl=''
1049 d_PRIfldbl=''
1050 d_PRIgldbl=''
1051 d_SCNfldbl=''
1052 sPRIEUldbl=''
1053 sPRIFUldbl=''
1054 sPRIGUldbl=''
1055 sPRIeldbl=''
1056 sPRIfldbl=''
1057 sPRIgldbl=''
1058 sSCNfldbl=''
1059 lseeksize=''
1060 lseektype=''
1061 make_set_make=''
1062 d_mymalloc=''
1063 freetype=''
1064 mallocobj=''
1065 mallocsrc=''
1066 malloctype=''
1067 usemallocwrap=''
1068 usemymalloc=''
1069 installman1dir=''
1070 man1dir=''
1071 man1direxp=''
1072 man1ext=''
1073 installman3dir=''
1074 man3dir=''
1075 man3direxp=''
1076 man3ext=''
1077 modetype=''
1078 multiarch=''
1079 mydomain=''
1080 myhostname=''
1081 phostname=''
1082 c=''
1083 n=''
1084 d_eofnblk=''
1085 eagain=''
1086 o_nonblock=''
1087 rd_nodata=''
1088 need_va_copy=''
1089 netdb_hlen_type=''
1090 netdb_host_type=''
1091 netdb_name_type=''
1092 netdb_net_type=''
1093 groupcat=''
1094 hostcat=''
1095 passcat=''
1096 orderlib=''
1097 ranlib=''
1098 d_perl_otherlibdirs=''
1099 otherlibdirs=''
1100 package=''
1101 spackage=''
1102 pager=''
1103 api_revision=''
1104 api_subversion=''
1105 api_version=''
1106 api_versionstring=''
1107 patchlevel=''
1108 perl_patchlevel=''
1109 revision=''
1110 subversion=''
1111 version=''
1112 version_patchlevel_string=''
1113 perl5=''
1114 perladmin=''
1115 perlpath=''
1116 d_nv_preserves_uv=''
1117 d_nv_zero_is_allbits_zero=''
1118 i16size=''
1119 i16type=''
1120 i32size=''
1121 i32type=''
1122 i64size=''
1123 i64type=''
1124 i8size=''
1125 i8type=''
1126 ivsize=''
1127 ivtype=''
1128 nv_overflows_integers_at=''
1129 nv_preserves_uv_bits=''
1130 nvsize=''
1131 nvtype=''
1132 u16size=''
1133 u16type=''
1134 u32size=''
1135 u32type=''
1136 u64size=''
1137 u64type=''
1138 u8size=''
1139 u8type=''
1140 uvsize=''
1141 uvtype=''
1142 ivdformat=''
1143 nvEUformat=''
1144 nvFUformat=''
1145 nvGUformat=''
1146 nveformat=''
1147 nvfformat=''
1148 nvgformat=''
1149 uvXUformat=''
1150 uvoformat=''
1151 uvuformat=''
1152 uvxformat=''
1153 pidtype=''
1154 prefix=''
1155 prefixexp=''
1156 installprivlib=''
1157 privlib=''
1158 privlibexp=''
1159 prototype=''
1160 ptrsize=''
1161 d_PRIXU64=''
1162 d_PRId64=''
1163 d_PRIi64=''
1164 d_PRIo64=''
1165 d_PRIu64=''
1166 d_PRIx64=''
1167 sPRIXU64=''
1168 sPRId64=''
1169 sPRIi64=''
1170 sPRIo64=''
1171 sPRIu64=''
1172 sPRIx64=''
1173 d_quad=''
1174 quadkind=''
1175 quadtype=''
1176 uquadtype=''
1177 drand01=''
1178 randbits=''
1179 randfunc=''
1180 randseedtype=''
1181 seedfunc=''
1182 installscript=''
1183 scriptdir=''
1184 scriptdirexp=''
1185 selectminbits=''
1186 selecttype=''
1187 sh=''
1188 targetsh=''
1189 sig_count=''
1190 sig_name=''
1191 sig_name_init=''
1192 sig_num=''
1193 sig_num_init=''
1194 sig_size=''
1195 d_sitearch=''
1196 installsitearch=''
1197 sitearch=''
1198 sitearchexp=''
1199 installsitebin=''
1200 sitebin=''
1201 sitebinexp=''
1202 installsitehtml1dir=''
1203 sitehtml1dir=''
1204 sitehtml1direxp=''
1205 installsitehtml3dir=''
1206 sitehtml3dir=''
1207 sitehtml3direxp=''
1208 installsitelib=''
1209 sitelib=''
1210 sitelib_stem=''
1211 sitelibexp=''
1212 installsiteman1dir=''
1213 siteman1dir=''
1214 siteman1direxp=''
1215 installsiteman3dir=''
1216 siteman3dir=''
1217 siteman3direxp=''
1218 siteprefix=''
1219 siteprefixexp=''
1220 installsitescript=''
1221 sitescript=''
1222 sitescriptexp=''
1223 sizesize=''
1224 sizetype=''
1225 d_libname_unique=''
1226 so=''
1227 socksizetype=''
1228 sharpbang=''
1229 shsharp=''
1230 spitshell=''
1231 src=''
1232 ssizetype=''
1233 st_ino_sign=''
1234 st_ino_size=''
1235 startperl=''
1236 startsh=''
1237 stdchar=''
1238 d_stdio_stream_array=''
1239 stdio_stream_array=''
1240 sysman=''
1241 sGMTIME_max=''
1242 sGMTIME_min=''
1243 sLOCALTIME_max=''
1244 sLOCALTIME_min=''
1245 trnl=''
1246 uidformat=''
1247 uidsign=''
1248 uidsize=''
1249 uidtype=''
1250 archname64=''
1251 use64bitall=''
1252 use64bitint=''
1253 usecbacktrace=''
1254 dtrace=''
1255 usedtrace=''
1256 usefaststdio=''
1257 usekernprocpathname=''
1258 ccflags_uselargefiles=''
1259 ldflags_uselargefiles=''
1260 libswanted_uselargefiles=''
1261 uselargefiles=''
1262 uselongdouble=''
1263 usemorebits=''
1264 usequadmath=''
1265 usemultiplicity=''
1266 nm_opt=''
1267 nm_so_opt=''
1268 runnm=''
1269 usenm=''
1270 usensgetexecutablepath=''
1271 useperlio=''
1272 usesocks=''
1273 d_oldpthreads=''
1274 use5005threads=''
1275 useithreads=''
1276 usereentrant=''
1277 usethreads=''
1278 incpath=''
1279 mips_type=''
1280 usrinc=''
1281 vaproto=''
1282 d_vendorarch=''
1283 installvendorarch=''
1284 vendorarch=''
1285 vendorarchexp=''
1286 d_vendorbin=''
1287 installvendorbin=''
1288 vendorbin=''
1289 vendorbinexp=''
1290 installvendorhtml1dir=''
1291 vendorhtml1dir=''
1292 vendorhtml1direxp=''
1293 installvendorhtml3dir=''
1294 vendorhtml3dir=''
1295 vendorhtml3direxp=''
1296 d_vendorlib=''
1297 installvendorlib=''
1298 vendorlib=''
1299 vendorlib_stem=''
1300 vendorlibexp=''
1301 installvendorman1dir=''
1302 vendorman1dir=''
1303 vendorman1direxp=''
1304 installvendorman3dir=''
1305 vendorman3dir=''
1306 vendorman3direxp=''
1307 usevendorprefix=''
1308 vendorprefix=''
1309 vendorprefixexp=''
1310 d_vendorscript=''
1311 installvendorscript=''
1312 vendorscript=''
1313 vendorscriptexp=''
1314 versiononly=''
1315 yacc=''
1316 yaccflags=''
1317 CONFIG=''
1318
1319 : Detect odd OSs
1320 define='define'
1321 undef='undef'
1322 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1323 rmlist=''
1324
1325 : We must find out about Eunice early
1326 eunicefix=':'
1327 if test -f /etc/unixtovms; then
1328         eunicefix=/etc/unixtovms
1329 fi
1330 if test -f /etc/unixtovms.exe; then
1331         eunicefix=/etc/unixtovms.exe
1332 fi
1333
1334 : Set executable suffix now -- needed before hints available
1335 if test -f "/libs/version.library"; then
1336 : Amiga OS
1337     _exe=""
1338 elif test -f "/system/gnu_library/bin/ar.pm"; then
1339 : Stratus VOS
1340     _exe=".pm"
1341 elif test -n "$DJGPP"; then
1342 : DOS DJGPP
1343     _exe=".exe"
1344 elif test -f /kern/cookiejar; then
1345 : MiNT
1346     _exe=""
1347 elif test -d c:/. -o -n "$is_os2" ; then
1348 : OS/2 or cygwin
1349     _exe=".exe"
1350 fi
1351
1352 groupstype=''
1353 i_whoami=''
1354 : Trailing extension.  Override this in a hint file, if needed.
1355 : Extra object files, if any, needed on this platform.
1356 archobjs=''
1357 archname=''
1358 : Possible local include directories to search.
1359 : Set locincpth to "" in a hint file to defeat local include searches.
1360 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1361 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1362 :
1363 : no include file wanted by default
1364 inclwanted=''
1365
1366 : Enable -DEBUGGING and -DDEBUGGING from the command line
1367 EBUGGING=''
1368 DEBUGGING=''
1369
1370 libnames=''
1371 : change the next line if compiling for Xenix/286 on Xenix/386
1372 xlibpth='/usr/lib/386 /lib/386'
1373 : Possible local library directories to search.
1374 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1375 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1376
1377 : general looking path for locating libraries
1378 glibpth="/lib /usr/lib $xlibpth"
1379 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1380 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1381 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1382 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1383
1384 : Private path used by Configure to find libraries.  Its value
1385 : is prepended to libpth. This variable takes care of special
1386 : machines, like the mips.  Usually, it should be empty.
1387 plibpth=''
1388
1389 : default library list
1390 libswanted=''
1391 : some systems want to use only the non-versioned libso:s
1392 ignore_versioned_solibs=''
1393 : set usethreads on the Configure command line to enable threads.
1394 usereentrant='undef'
1395 ccname=''
1396 ccversion=''
1397 perllibs=''
1398 : set useposix=false in your hint file to disable the POSIX extension.
1399 useposix=true
1400 : set useopcode=false in your hint file to disable the Opcode extension.
1401 useopcode=true
1402 archname64=''
1403 ccflags_uselargefiles=''
1404 ldflags_uselargefiles=''
1405 libswanted_uselargefiles=''
1406 : set usemultiplicity on the Configure command line to enable multiplicity.
1407 : set usesocks on the Configure command line to enable socks.
1408 : List of libraries we want.
1409 : If anyone needs extra -lxxx, put those in a hint file.
1410 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1411 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1412 : We probably want to search /usr/shlib before most other libraries.
1413 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1414 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1415 glibpth="/usr/shlib $glibpth"
1416 : Do not use vfork unless overridden by a hint file.
1417 usevfork=false
1418
1419 : Find the basic shell for Bourne shell scripts
1420 case "$sh" in
1421 '')
1422         case "$SYSTYPE" in
1423         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1424         *) xxx='/bin/sh';;
1425         esac
1426         if test -f "$xxx"; then
1427                 sh="$xxx"
1428         else
1429                 : Build up a list and do a single loop so we can 'break' out.
1430                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1431                 for xxx in sh bash ksh pdksh ash; do
1432                         for p in $pth; do
1433                                 try="$try ${p}/${xxx}"
1434                         done
1435                 done
1436                 for xxx in $try; do
1437                         if test -f "$xxx"; then
1438                                 sh="$xxx";
1439                                 break
1440                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1441                                 sh="$xxx";
1442                                 break
1443                         elif test -f "$xxx.exe"; then
1444                                 sh="$xxx";
1445                                 break
1446                         fi
1447                 done
1448         fi
1449         ;;
1450 esac
1451
1452 case "$sh" in
1453 '')     cat >&2 <<EOM
1454 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1455
1456 Usually it's in /bin/sh.  How did you even get this far?
1457 Please contact me (Perl Maintainers) at perlbug@perl.org and
1458 we'll try to straighten this all out.
1459 EOM
1460         exit 1
1461         ;;
1462 esac
1463
1464 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1465 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1466 targetsh=$sh
1467
1468 : see if sh knows # comments
1469 if `$sh -c '#' >/dev/null 2>&1`; then
1470         shsharp=true
1471         spitshell=cat
1472         xcat=/bin/cat
1473         test -f $xcat$_exe || xcat=/usr/bin/cat
1474         if test ! -f $xcat$_exe; then
1475                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1476                         if test -f $p/cat$_exe; then
1477                                 xcat=$p/cat
1478                                 break
1479                         fi
1480                 done
1481                 if test ! -f $xcat$_exe; then
1482                         echo "Can't find cat anywhere!"
1483                         exit 1
1484                 fi
1485         fi
1486         echo "#!$xcat" >sharp
1487         $eunicefix sharp
1488         chmod +x sharp
1489         ./sharp > today 2>/dev/null
1490         if test -s today; then
1491                 sharpbang='#!'
1492         else
1493                 echo "#! $xcat" > sharp
1494                 $eunicefix sharp
1495                 chmod +x sharp
1496                 ./sharp > today 2>/dev/null
1497                 if test -s today; then
1498                         sharpbang='#! '
1499                 else
1500                         sharpbang=': use '
1501                 fi
1502         fi
1503 else
1504         echo " "
1505         echo "Your $sh doesn't grok # comments--I will strip them later on."
1506         shsharp=false
1507         cd ..
1508         echo "exec grep -v '^[  ]*#'" >spitshell
1509         chmod +x spitshell
1510         $eunicefix spitshell
1511         spitshell=`pwd`/spitshell
1512         cd UU
1513         echo "I presume that if # doesn't work, #! won't work either!"
1514         sharpbang=': use '
1515 fi
1516 rm -f sharp today
1517
1518 : figure out how to guarantee sh startup
1519 case "$startsh" in
1520 '') startsh=${sharpbang}${sh} ;;
1521 *)
1522 esac
1523 cat >sharp <<EOSS
1524 $startsh
1525 set abc
1526 test "$?abc" != 1
1527 EOSS
1528
1529 chmod +x sharp
1530 $eunicefix sharp
1531 if ./sharp; then
1532         : echo "Yup, it does."
1533 else
1534         echo "Hmm... '$startsh' does not guarantee sh startup..."
1535         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1536 fi
1537 rm -f sharp
1538
1539 : Save command line options in file UU/cmdline.opt for later use in
1540 : generating config.sh.
1541 cat > cmdline.opt <<EOSH
1542 : Configure command line arguments.
1543 config_arg0='$0'
1544 config_args='$*'
1545 config_argc=$#
1546 EOSH
1547 argn=1
1548 args_exp=''
1549 args_sep=''
1550 for arg in "$@"; do
1551         cat >>cmdline.opt <<EOSH
1552 config_arg$argn='$arg'
1553 EOSH
1554         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1555 $arg
1556 EOC
1557         arg_exp=`cat cmdl.opt`
1558         args_exp="$args_exp$args_sep'$arg_exp'"
1559         argn=`expr $argn + 1`
1560         args_sep=' '
1561 done
1562 rm -f cmdl.opt
1563
1564 : produce awk script to parse command line options
1565 cat >options.awk <<'EOF'
1566 BEGIN {
1567         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1568
1569         len = length(optstr);
1570         for (i = 1; i <= len; i++) {
1571                 c = substr(optstr, i, 1);
1572                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1573                 if (a == ":") {
1574                         arg[c] = 1;
1575                         i++;
1576                 }
1577                 opt[c] = 1;
1578         }
1579 }
1580 {
1581         expect = 0;
1582         str = $0;
1583         if (substr(str, 1, 1) != "-") {
1584                 printf("'%s'\n", str);
1585                 next;
1586         }
1587         len = length($0);
1588         for (i = 2; i <= len; i++) {
1589                 c = substr(str, i, 1);
1590                 if (!opt[c]) {
1591                         printf("-%s\n", substr(str, i));
1592                         next;
1593                 }
1594                 printf("-%s\n", c);
1595                 if (arg[c]) {
1596                         if (i < len)
1597                                 printf("'%s'\n", substr(str, i + 1));
1598                         else
1599                                 expect = 1;
1600                         next;
1601                 }
1602         }
1603 }
1604 END {
1605         if (expect)
1606                 print "?";
1607 }
1608 EOF
1609
1610 : process the command line options
1611 set X `for arg in "$@"; do echo "X$arg"; done |
1612         sed -e s/X// | awk -f options.awk`
1613 eval "set $*"
1614 shift
1615 rm -f options.awk
1616
1617 : set up default values
1618 fastread=''
1619 reuseval=false
1620 config_sh=''
1621 alldone=''
1622 error=''
1623 silent=''
1624 extractsh=''
1625 override=''
1626 knowitall=''
1627 rm -f optdef.sh posthint.sh
1628 cat >optdef.sh <<EOS
1629 $startsh
1630 EOS
1631
1632
1633 : option parsing
1634 while test $# -gt 0; do
1635         case "$1" in
1636         -d) shift; fastread=yes;;
1637         -e) shift; alldone=cont;;
1638         -f)
1639                 shift
1640                 cd ..
1641                 if test -r "$1"; then
1642                         config_sh="$1"
1643                 else
1644                         echo "$me: cannot read config file $1." >&2
1645                         error=true
1646                 fi
1647                 cd UU
1648                 shift;;
1649         --help|\
1650         -h) shift; error=true;;
1651         -r) shift; reuseval=true;;
1652         -s) shift; silent=true; realsilent=true;;
1653         -E) shift; alldone=exit;;
1654         -K) shift; knowitall=true;;
1655         -O) shift; override=true;;
1656         -S) shift; silent=true; extractsh=true;;
1657         -D)
1658                 shift
1659                 case "$1" in
1660                 *=)
1661                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1662                         echo "$me: ignoring -D $1" >&2
1663                         ;;
1664                 *=*) echo "$1" | \
1665                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1666                 *) echo "$1='define'" >> optdef.sh;;
1667                 esac
1668                 shift
1669                 ;;
1670         -U)
1671                 shift
1672                 case "$1" in
1673                 *=) echo "$1" >> optdef.sh;;
1674                 *=*)
1675                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1676                         echo "$me: ignoring -U $1" >&2
1677                         ;;
1678                 *) echo "$1='undef'" >> optdef.sh;;
1679                 esac
1680                 shift
1681                 ;;
1682         -A)
1683             shift
1684             xxx=''
1685             yyy="$1"
1686             zzz=''
1687             uuu=undef
1688             case "$yyy" in
1689             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1690                  case "$zzz" in
1691                  *:*) zzz='' ;;
1692                  *)   xxx=append
1693                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1694                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1695                  esac
1696                  ;;
1697             esac
1698             case "$xxx" in
1699             '')  case "$yyy" in
1700                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1701                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1702                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1703                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1704                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1705                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1706                  esac
1707                  ;;
1708             esac
1709             case "$xxx" in
1710             append)
1711                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1712             clear)
1713                 echo "$yyy=''"                  >> posthint.sh ;;
1714             define)
1715                 case "$zzz" in
1716                 '') zzz=define ;;
1717                 esac
1718                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1719             eval)
1720                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1721             prepend)
1722                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1723             undef)
1724                 case "$zzz" in
1725                 '') zzz="$uuu" ;;
1726                 esac
1727                 echo "$yyy=$zzz"                >> posthint.sh ;;
1728             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1729             esac
1730             shift
1731             ;;
1732         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1733             exit 0;;
1734         --) break;;
1735         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1736         *) break;;
1737         esac
1738 done
1739
1740 case "$error" in
1741 true)
1742         cat >&2 <<EOM
1743 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1744                  [-U symbol] [-U symbol=] [-A command:symbol...]
1745   -d : use defaults for all answers.
1746   -e : go on without questioning past the production of config.sh.
1747   -f : specify an alternate default configuration file.
1748   -h : print this help message and exit (with an error status).
1749   -r : reuse C symbols value if possible (skips costly nm extraction).
1750   -s : silent mode, only echoes questions and essential information.
1751   -D : define symbol to have some value:
1752          -D symbol         symbol gets the value 'define'
1753          -D symbol=value   symbol gets the value 'value'
1754        common used examples (see INSTALL for more info):
1755          -Duse64bitint            use 64bit integers
1756          -Duse64bitall            use 64bit integers and pointers
1757          -Dusethreads             use thread support
1758          -Dinc_version_list=none  do not include older perl trees in @INC
1759          -DEBUGGING=none          DEBUGGING options
1760          -Dcc=gcc                 choose your compiler
1761          -Dprefix=/opt/perl5      choose your destination
1762   -E : stop at the end of questions, after having produced config.sh.
1763   -K : do not use unless you know what you are doing.
1764   -O : let -D and -U override definitions from loaded configuration file.
1765   -S : perform variable substitutions on all .SH files (can mix with -f)
1766   -U : undefine symbol:
1767          -U symbol    symbol gets the value 'undef'
1768          -U symbol=   symbol gets completely empty
1769        e.g.:  -Uversiononly
1770   -A : manipulate symbol after the platform specific hints have been applied:
1771          -A append:symbol=value   append value to symbol
1772          -A symbol=value          like append:, but with a separating space
1773          -A define:symbol=value   define symbol to have value
1774          -A clear:symbol          define symbol to be ''
1775          -A define:symbol         define symbol to be 'define'
1776          -A eval:symbol=value     define symbol to be eval of value
1777          -A prepend:symbol=value  prepend value to symbol
1778          -A undef:symbol          define symbol to be 'undef'
1779          -A undef:symbol=         define symbol to be ''
1780        e.g.:  -A prepend:libswanted='cl pthread '
1781               -A ccflags=-DSOME_MACRO
1782   -V : print version number and exit (with a zero status).
1783 EOM
1784         exit 1
1785         ;;
1786 esac
1787
1788 : Sanity checks
1789 case "$fastread$alldone" in
1790 yescont|yesexit) ;;
1791 *)
1792         case "$extractsh" in
1793         true) ;;
1794         *)
1795                 if test ! -t 0; then
1796                         echo "Say 'sh Configure', not 'sh <Configure'"
1797                         exit 1
1798                 fi
1799                 ;;
1800         esac
1801         ;;
1802 esac
1803
1804 exec 4>&1
1805 case "$silent" in
1806 true) exec 1>/dev/null;;
1807 esac
1808
1809 : run the defines and the undefines, if any, but leave the file out there...
1810 touch optdef.sh
1811 . ./optdef.sh
1812 : create the posthint manipulation script and leave the file out there...
1813 touch posthint.sh
1814
1815 : set package name
1816 package='perl5'
1817 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1818 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1819 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1820 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1821 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1822 esac
1823
1824 : Some greps do not return status, grrr.
1825 echo "grimblepritz" >grimble
1826 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1827         contains=contains
1828 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1829         contains=grep
1830 else
1831         contains=contains
1832 fi
1833 rm -f grimble
1834 : the following should work in any shell
1835 case "$contains" in
1836 contains*)
1837         echo " "
1838         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1839         cat >contains <<'EOSS'
1840 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1841 EOSS
1842 chmod +x contains
1843 esac
1844
1845 : Find the path to the source tree
1846 case "$src" in
1847 '') case "$0" in
1848     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1849          case "$src" in
1850          /*)    ;;
1851          .)     ;;
1852          *)     src=`cd ../$src && pwd` ;;
1853          esac
1854          ;;
1855     *)   src='.';;
1856     esac;;
1857 esac
1858 case "$src" in
1859 '')     src=/
1860         rsrc=/
1861         ;;
1862 /*)     rsrc="$src";;
1863 *)      rsrc="../$src";;
1864 esac
1865 if test -f $rsrc/Configure && \
1866         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1867 then
1868    : found it, so we are ok.
1869 else
1870         rsrc=''
1871         for src in . .. ../.. ../../.. ../../../..; do
1872                 if test -f ../$src/Configure && \
1873                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1874                 then
1875                         rsrc=../$src
1876                         break
1877                 fi
1878         done
1879 fi
1880 case "$rsrc" in
1881 '')
1882         cat <<EOM >&4
1883
1884 Sorry, I can't seem to locate the source dir for $package.  Please start
1885 Configure with an explicit path -- i.e. /some/path/Configure.
1886
1887 EOM
1888         exit 1
1889         ;;
1890 ../.)   rsrc='..';;
1891 *)
1892         echo " "
1893         echo "Sources for $package found in \"$src\"." >&4
1894         ;;
1895 esac
1896
1897 : script used to extract .SH files with variable substitutions
1898 cat >extract <<'EOS'
1899 PERL_CONFIG_SH=true
1900 echo "Doing variable substitutions on .SH files..."
1901 if test -f MANIFEST; then
1902         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1903 else
1904         echo "(Looking for .SH files under the source directory.)"
1905         set x `(cd "$src"; find . -name "*.SH" -print)`
1906 fi
1907 shift
1908 case $# in
1909 0) set x `(cd "$src"; echo *.SH)`; shift;;
1910 esac
1911 if test ! -f "$src/$1"; then
1912         shift
1913 fi
1914 mkdir_p='
1915 name=$1;
1916 create="";
1917 while test $name; do
1918         if test ! -d "$name"; then
1919                 create="$name $create";
1920                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1921                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1922         else
1923                 name="";
1924         fi;
1925 done;
1926 for file in $create; do
1927         mkdir $file;
1928 done
1929 '
1930 for file in $*; do
1931         case "$src" in
1932         ".")
1933                 case "$file" in
1934                 */*)
1935                         dir=`expr X$file : 'X\(.*\)/'`
1936                         file=`expr X$file : 'X.*/\(.*\)'`
1937                         (cd "$dir" && . ./$file)
1938                         ;;
1939                 *)
1940                         . ./$file
1941                         ;;
1942                 esac
1943                 ;;
1944         *)
1945                 case "$file" in
1946                 */*)
1947                         dir=`expr X$file : 'X\(.*\)/'`
1948                         file=`expr X$file : 'X.*/\(.*\)'`
1949                         (set x $dir; shift; eval $mkdir_p)
1950                         sh <"$src/$dir/$file"
1951                         ;;
1952                 *)
1953                         sh <"$src/$file"
1954                         ;;
1955                 esac
1956                 ;;
1957         esac
1958 done
1959 if test -f "$src/config_h.SH"; then
1960         if test ! -f config.h; then
1961         : oops, they left it out of MANIFEST, probably, so do it anyway.
1962         . "$src/config_h.SH"
1963         fi
1964 fi
1965 EOS
1966
1967 : extract files and exit if asked to do so
1968 case "$extractsh" in
1969 true)
1970         case "$realsilent" in
1971         true) ;;
1972         *) exec 1>&4;;
1973         esac
1974         case "$config_sh" in
1975         '') config_sh='config.sh';;
1976         esac
1977         echo " "
1978         echo "Fetching answers from $config_sh..."
1979         cd ..
1980         . $config_sh
1981         test "$override" && . ./optdef.sh
1982         echo " "
1983         . UU/extract
1984         rm -rf UU
1985         echo "Extraction done."
1986         exit 0
1987         ;;
1988 esac
1989
1990 : Eunice requires " " instead of "", can you believe it
1991 echo " "
1992 : Here we go...
1993 echo "Beginning of configuration questions for $package."
1994
1995 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1996
1997 : first determine how to suppress newline on echo command
1998 echo " "
1999 echo "Checking echo to see how to suppress newlines..."
2000 (echo "hi there\c" ; echo " ") >.echotmp
2001 if $contains c .echotmp >/dev/null 2>&1 ; then
2002         echo "...using -n."
2003         n='-n'
2004         c=''
2005 else
2006         cat <<'EOM'
2007 ...using \c
2008 EOM
2009         n=''
2010         c='\c'
2011 fi
2012 echo $n "The star should be here-->$c"
2013 echo '*'
2014 rm -f .echotmp
2015
2016 : Now test for existence of everything in MANIFEST
2017 echo " "
2018 if test -f "$rsrc/MANIFEST"; then
2019         echo "First let's make sure your kit is complete.  Checking..." >&4
2020         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2021                 (split -l 50 2>/dev/null || split -50)
2022         rm -f missing
2023         tmppwd=`pwd`
2024         for filelist in x??; do
2025                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2026                         >/dev/null 2>>"$tmppwd/missing")
2027         done
2028         if test -s missing; then
2029                 cat missing >&4
2030                 cat >&4 <<'EOM'
2031
2032 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2033
2034 You have the option of continuing the configuration process, despite the
2035 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2036 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2037 and contact the author (perlbug@perl.org).
2038
2039 EOM
2040                 echo $n "Continue? [n] $c" >&4
2041                 read ans
2042                 case "$ans" in
2043                 y*)
2044                         echo "Continuing..." >&4
2045                         rm -f missing
2046                         ;;
2047                 *)
2048                         echo "ABORTING..." >&4
2049                         kill $$
2050                         ;;
2051                 esac
2052         else
2053                 echo "Looks good..."
2054         fi
2055 else
2056         echo "There is no MANIFEST file.  I hope your kit is complete !"
2057 fi
2058 rm -f missing x??
2059
2060 : Find the appropriate value for a newline for tr
2061 echo " "
2062 if test -n "$DJGPP"; then
2063        trnl='\012'
2064 fi
2065 if test X"$trnl" = X; then
2066         case "`echo foo|tr '\n' x 2>/dev/null`" in
2067         foox) trnl='\n' ;;
2068         esac
2069 fi
2070 if test X"$trnl" = X; then
2071         case "`echo foo|tr '\012' x 2>/dev/null`" in
2072         foox) trnl='\012' ;;
2073         esac
2074 fi
2075 if test X"$trnl" = X; then
2076        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2077        fooxy) trnl='\n\r' ;;
2078        esac
2079 fi
2080 if test X"$trnl" = X; then
2081         cat <<EOM >&2
2082
2083 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2084
2085 EOM
2086         exit 1
2087 fi
2088
2089 : compute the number of columns on the terminal for proper question formatting
2090 case "$COLUMNS" in
2091 '') COLUMNS='80';;
2092 esac
2093
2094 : set up the echo used in my read
2095 myecho="case \"\$xxxm\" in
2096 '') echo $n \"\$rp $c\" >&4;;
2097 *) case \"\$rp\" in
2098         '') echo $n \"[\$xxxm] $c\";;
2099         *)
2100                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2101                         echo \"\$rp\" >&4
2102                         echo $n \"[\$xxxm] $c\" >&4
2103                 else
2104                         echo $n \"\$rp [\$xxxm] $c\" >&4
2105                 fi
2106                 ;;
2107         esac;;
2108 esac"
2109
2110 : now set up to do reads with possible shell escape and default assignment
2111 cat <<EOSC >myread
2112 $startsh
2113 xxxm=\$dflt
2114 $myecho
2115 ans='!'
2116 case "\$fastread" in
2117 yes) case "\$dflt" in
2118         '') ;;
2119         *) ans='';
2120                 case "\$silent-\$rp" in
2121                 true-) ;;
2122                 *) echo " " >&4;;
2123                 esac;;
2124         esac;;
2125 *) case "\$silent" in
2126         true) case "\$rp" in
2127                 '') ans='';;
2128                 esac;;
2129         esac;;
2130 esac
2131 while expr "X\$ans" : "X!" >/dev/null; do
2132         read answ
2133         set x \$xxxm
2134         shift
2135         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2136         case  "\$answ" in
2137         "!")
2138                 sh 1>&4
2139                 echo " "
2140                 $myecho
2141                 ;;
2142         !*)
2143                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2144                 shift
2145                 sh 1>&4 -c "\$*"
2146                 echo " "
2147                 $myecho
2148                 ;;
2149         "\$ans")
2150                 case "\$ans" in
2151                 \\&*)
2152                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2153                         shift
2154                         case "\$1" in
2155                         -d)
2156                                 fastread=yes
2157                                 echo "(OK, I'll run with -d after this question.)" >&4
2158                                 ;;
2159                         -*)
2160                                 echo "*** Sorry, \$1 not supported yet." >&4
2161                                 ;;
2162                         esac
2163                         $myecho
2164                         ans=!
2165                         ;;
2166                 esac;;
2167         *)
2168                 case "\$aok" in
2169                 y)
2170                         echo "*** Substitution done -- please confirm."
2171                         xxxm="\$ans"
2172                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2173                         xxxm="\$ans"
2174                         ans=!
2175                         ;;
2176                 *)
2177                         echo "*** Error -- try again."
2178                         ans=!
2179                         ;;
2180                 esac
2181                 $myecho
2182                 ;;
2183         esac
2184         case "\$ans\$xxxm\$nostick" in
2185         '')
2186                 ans=!
2187                 $myecho
2188                 ;;
2189         esac
2190 done
2191 case "\$ans" in
2192 '') ans="\$xxxm";;
2193 esac
2194 EOSC
2195
2196 : create .config dir to save info across Configure sessions
2197 test -d ../.config || mkdir ../.config
2198 cat >../.config/README <<EOF
2199 This directory created by Configure to save information that should
2200 persist across sessions for $package.
2201
2202 You may safely delete it if you wish.
2203 EOF
2204
2205 : See if we are using a devel version and want that
2206 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2207 case "$usedevel" in
2208 $define|true|[yY]*)
2209     usedevel="$define" ;;
2210 *) case "$xversion" in
2211    *[13579])
2212         cat >&4 <<EOH
2213 *** WHOA THERE!!! ***
2214
2215     This is an UNSTABLE DEVELOPMENT release.
2216     The version of this $package distribution is $xversion, that is, odd,
2217     (as opposed to even) and that signifies a development release.
2218     If you want a maintenance release, you want an even-numbered version.
2219
2220     Do ***NOT*** install this into production use.
2221     Data corruption and crashes are possible.
2222
2223     It is most seriously suggested that you do not continue any further
2224     unless you want to help in developing and debugging Perl.
2225
2226     If you *still* want to build perl, you can answer 'y' now,
2227     or pass -Dusedevel to Configure.
2228
2229 EOH
2230         rp='Do you really want to continue?'
2231         dflt='n'
2232         . ./myread
2233         case "$ans" in
2234         [yY]) echo >&4 "Okay, continuing."
2235               usedevel="$define" ;;
2236         *) echo >&4 "Okay, bye."
2237            exit 1
2238            ;;
2239         esac
2240         ;;
2241     esac
2242     usedevel="$undef"
2243     ;;
2244 esac
2245 case "$usedevel" in
2246 $define|true|[yY]*)
2247         case "$versiononly" in
2248         '') versiononly="$define" ;;
2249         esac
2250         case "$installusrbinperl" in
2251         '') installusrbinperl="$undef" ;;
2252         esac
2253         ;;
2254 esac
2255
2256 : general instructions
2257 needman=true
2258 firsttime=true
2259 user=`(logname) 2>/dev/null`
2260 case "$user" in
2261 '') user=`whoami 2>&1`;;
2262 esac
2263 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2264         firsttime=false
2265         echo " "
2266         rp='Would you like to see the instructions?'
2267         dflt=n
2268         . ./myread
2269         case "$ans" in
2270         [yY]*) ;;
2271         *) needman=false;;
2272         esac
2273 fi
2274 if $needman; then
2275         cat <<EOH
2276
2277 This installation shell script will examine your system and ask you questions
2278 to determine how the perl5 package should be installed. If you get
2279 stuck on a question, you may use a ! shell escape to start a subshell or
2280 execute a command.  Many of the questions will have default answers in square
2281 brackets; typing carriage return will give you the default.
2282
2283 On some of the questions which ask for file or directory names you are allowed
2284 to use the ~name construct to specify the login directory belonging to "name",
2285 even if you don't have a shell which knows about that.  Questions where this is
2286 allowed will be marked "(~name ok)".
2287
2288 EOH
2289         rp=''
2290         dflt='Type carriage return to continue'
2291         . ./myread
2292         cat <<'EOH'
2293
2294 The prompter used in this script allows you to use shell variables and
2295 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2296 in the default answer, as if the default line was a set of arguments given to a
2297 script shell.  This means you may also use $* to repeat the whole default line,
2298 so you do not have to re-type everything to add something to the default.
2299
2300 Every time there is a substitution, you will have to confirm.  If there is an
2301 error (e.g. an unmatched backtick), the default answer will remain unchanged
2302 and you will be prompted again.
2303
2304 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2305 the questions and use the computed defaults (or the previous answers if there
2306 was already a config.sh file). Type 'Configure -h' for a list of options.
2307 You may also start interactively and then answer '& -d' at any prompt to turn
2308 on the non-interactive behaviour for the remainder of the execution.
2309
2310 EOH
2311         . ./myread
2312         cat <<EOH
2313
2314 Much effort has been expended to ensure that this shell script will run on any
2315 Unix system.  If despite that it blows up on yours, your best bet is to edit
2316 Configure and run it again.  If you can't run Configure for some reason,
2317 you'll have to generate a config.sh file by hand.  Whatever problems you
2318 have, let me (perlbug@perl.org) know how I blew it.
2319
2320 This installation script affects things in two ways:
2321
2322 1) it may do direct variable substitutions on some of the files included
2323    in this kit.
2324 2) it builds a config.h file for inclusion in C programs.  You may edit
2325    any of these files as the need arises after running this script.
2326
2327 If you make a mistake on a question, there is no easy way to back up to it
2328 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2329 files.  Configure will offer to let you do this before it runs the SH files.
2330
2331 EOH
2332         dflt='Type carriage return to continue'
2333         . ./myread
2334         case "$firsttime" in
2335         true) echo $user >>../.config/instruct;;
2336         esac
2337 fi
2338
2339 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2340 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2341 if test "X$sysroot" = X; then
2342     sysroot=""
2343 else
2344     case "$cc" in
2345         *gcc*|*g++*)
2346             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2347             # _sysroot is used in places where we need --sysroot=foo
2348             # but using the rest of the flags could cause issues.
2349             _sysroot="--sysroot=$sysroot";
2350             case "$ccflags" in
2351                 *sysroot*) ;;
2352                 'undef'|*)
2353                 ccflags="$ccflags $_sysroot"
2354             esac
2355             case "$ldflags" in
2356                 *sysroot*) ;;
2357                 'undef'|*)
2358                 ldflags="$ldflags $_sysroot"
2359             esac
2360             case "$cppflags" in
2361                 *sysroot*) ;;
2362                 'undef'|*)
2363                 cppflags="$cppflags $_sysroot"
2364             esac
2365             # lddlflags updated below in lddlflags section;
2366             # same with cccdlflags
2367             ;;
2368     esac
2369
2370     # Adjust some defaults to also use $sysroot
2371     for var in xlibpth loclibpth locincpth glibpth; do
2372         eval xxx=\$$var
2373         eval $var=''
2374         for path in $xxx; do
2375             eval $var=\"\$$var $sysroot$path\"
2376         done
2377     done
2378
2379 fi
2380
2381 : find out where common programs are
2382 echo " "
2383 echo "Locating common programs..." >&4
2384 cat <<EOSC >loc
2385 $startsh
2386 case \$# in
2387 0) exit 1;;
2388 esac
2389 thing=\$1
2390 shift
2391 dflt=\$1
2392 shift
2393 for dir in \$*; do
2394         case "\$thing" in
2395         .)
2396         if test -d \$dir/\$thing; then
2397                 echo \$dir
2398                 exit 0
2399         fi
2400         ;;
2401         *)
2402         for thisthing in \$dir/\$thing; do
2403                 : just loop through to pick last item
2404         done
2405         if test -f \$thisthing; then
2406                 echo \$thisthing
2407                 exit 0
2408         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2409                 echo \$thisthing
2410                 exit 0
2411         elif test -f \$dir/\$thing.exe; then
2412                 if test -n "$DJGPP"; then
2413                         echo \$dir/\$thing.exe
2414                 elif test "$eunicefix" != ":"; then
2415                         : on Eunice apparently
2416                         echo \$dir/\$thing
2417                 fi
2418                 exit 0
2419         fi
2420         ;;
2421         esac
2422 done
2423 echo \$dflt
2424 exit 1
2425 EOSC
2426 chmod +x loc
2427 $eunicefix loc
2428 loclist="
2429 awk
2430 cat
2431 chmod
2432 comm
2433 cp
2434 echo
2435 expr
2436 grep
2437 ls
2438 mkdir
2439 rm
2440 sed
2441 sort
2442 touch
2443 tr
2444 uniq
2445 "
2446 trylist="
2447 ar
2448 bison
2449 byacc
2450 cpp
2451 csh
2452 date
2453 egrep
2454 gmake
2455 gzip
2456 less
2457 ln
2458 make
2459 more
2460 nm
2461 nroff
2462 perl
2463 pg
2464 test
2465 uname
2466 zip
2467 "
2468 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2469 pth="$pth $sysroot/lib $sysroot/usr/lib"
2470 for file in $loclist; do
2471         eval xxx=\$$file
2472         case "$xxx" in
2473         /*|?:[\\/]*)
2474                 if test -f "$xxx"; then
2475                         : ok
2476                 else
2477                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2478                         xxx=`./loc $file $file $pth`
2479                 fi
2480                 ;;
2481         '') xxx=`./loc $file $file $pth`;;
2482         *) xxx=`./loc $xxx $xxx $pth`;;
2483         esac
2484         eval $file=$xxx$_exe
2485         eval _$file=$xxx
2486         case "$xxx" in
2487         /*)
2488                 echo $file is in $xxx.
2489                 ;;
2490         ?:[\\/]*)
2491                 echo $file is in $xxx.
2492                 ;;
2493         *)
2494                 echo "I don't know where '$file' is, and my life depends on it." >&4
2495                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2496                 exit 1
2497                 ;;
2498         esac
2499 done
2500 echo " "
2501 echo "Don't worry if any of the following aren't found..."
2502 say=offhand
2503 for file in $trylist; do
2504         eval xxx=\$$file
2505         case "$xxx" in
2506         /*|?:[\\/]*)
2507                 if test -f "$xxx"; then
2508                         : ok
2509                 else
2510                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2511                         xxx=`./loc $file $file $pth`
2512                 fi
2513                 ;;
2514         '') xxx=`./loc $file $file $pth`;;
2515         *) xxx=`./loc $xxx $xxx $pth`;;
2516         esac
2517         eval $file=$xxx$_exe
2518         eval _$file=$xxx
2519         case "$xxx" in
2520         /*)
2521                 echo $file is in $xxx.
2522                 ;;
2523         ?:[\\/]*)
2524                 echo $file is in $xxx.
2525                 ;;
2526         *)
2527                 echo "I don't see $file out there, $say."
2528                 say=either
2529                 ;;
2530         esac
2531 done
2532 case "$egrep" in
2533 egrep)
2534         echo "Substituting grep for egrep."
2535         egrep=$grep
2536         _egrep=$grep
2537         ;;
2538 esac
2539 case "$less" in
2540 '')     ;;
2541 *)      if $less -R </dev/null >/dev/null 2>&1; then
2542                echo "Substituting less -R for less."
2543                less="$less -R"
2544                _less=$less
2545         fi
2546         ;;
2547 esac
2548 case "$ln" in
2549 ln)
2550         echo "Substituting cp for ln."
2551         ln=$cp
2552         _ln=$cp
2553         ;;
2554 esac
2555 case "$make" in
2556 make)
2557         case "$gmake" in
2558         gmake)
2559         echo "I can't find make or gmake, and my life depends on it." >&4
2560         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2561         exit 1
2562         ;;
2563         esac
2564         ;;
2565 esac
2566 case "$gmake" in
2567 gmake)  ;;
2568 *)      # We can't have osname yet.
2569         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2570                 # Assume that gmake, if found, is definitely GNU make
2571                 # and prefer it over the system make.
2572                 echo "Substituting gmake for make."
2573                 make=$gmake
2574                 _make=$gmake
2575         fi
2576         ;;
2577 esac
2578 case "$test" in
2579 test)
2580         echo "Hopefully test is built into your sh."
2581         ;;
2582 *)
2583         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2584                 echo "Using the test built into your sh."
2585                 test=test
2586                 _test=test
2587         fi
2588         ;;
2589 esac
2590 case "$echo" in
2591 echo)
2592         echo "Hopefully echo is built into your sh."
2593         ;;
2594 '') ;;
2595 *)
2596         echo " "
2597 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2598         $echo $n "hi there$c" >foo1
2599         echo $n "hi there$c" >foo2
2600         if cmp foo1 foo2 >/dev/null 2>&1; then
2601                 echo "They are compatible.  In fact, they may be identical."
2602         else
2603                 case "$n" in
2604                 '-n') n='' c='\c';;
2605                 *) n='-n' c='';;
2606                 esac
2607                 cat <<FOO
2608 They are not compatible!  You are probably running ksh on a non-USG system.
2609 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2610 have echo built in and we may have to run some Bourne shell scripts.  That
2611 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2612
2613 FOO
2614                 $echo $n "The star should be here-->$c"
2615                 $echo "*"
2616         fi
2617         $rm -f foo1 foo2
2618         ;;
2619 esac
2620
2621 # This question was auctioned at YAPC::Europe-2007 in Vienna
2622 # I never promised you could answer it. I only auctioned the question.
2623 cat <<FOO
2624 The following message is sponsored by
2625
2626   Dresden.pm<--The stars should be here.
2627
2628 Dear Perl user, system administrator or package
2629 maintainer, the Perl community sends greetings to
2630 you. Do you (emblematical) greet back [Y/n]? n
2631
2632 FOO
2633
2634 : Check what type of C compiler we use
2635 cat <<EOS >trygcc
2636 $startsh
2637 EOS
2638 cat <<'EOSC' >>trygcc
2639 case "$cc" in
2640 '') ;;
2641 *)  $rm -f try try.*
2642     $cat >try.c <<EOM
2643 int main(int argc, char *argv[]) {
2644   return 0;
2645 }
2646 EOM
2647     if $cc -o try $ccflags $ldflags try.c; then
2648        :
2649     else
2650         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2651         despair=yes
2652         trygcc=yes
2653         case "$cc" in
2654         *gcc*) trygcc=no ;;
2655         esac
2656         # Skip this test because it gives a false match on output like:
2657         #    ./trygcc: line 23: cc: command not found
2658         # case "`$cc -v -c try.c 2>&1`" in
2659         # *gcc*) trygcc=no ;;
2660         # esac
2661         if $test X"$trygcc" = Xyes; then
2662             if gcc -o try -c try.c; then
2663                 echo " "
2664                 echo "You seem to have a working gcc, though." >&4
2665                 # Switching compilers may undo the work of hints files.
2666                 # The most common problem is -D_REENTRANT for threads.
2667                 # This heuristic catches that case, but gets false positives
2668                 # if -Dusethreads was not actually specified.  Better to
2669                 # bail out here with a useful message than fail
2670                 # mysteriously later. Should we perhaps just try to
2671                 # re-invoke Configure -Dcc=gcc config_args ?
2672                 if $test -f usethreads.cbu; then
2673                         $cat >&4 <<EOM
2674
2675 *** However, any setting of the C compiler flags (e.g. for thread support)
2676 *** will be lost.  It may be necessary for you to restart Configure and
2677 *** add -Dcc=gcc to your Configure command line.
2678
2679 EOM
2680                         rp="Would you like to go ahead and try gcc anyway?"
2681                         dflt=n
2682                 else
2683                         rp="Would you like to use it?"
2684                         dflt=y
2685                 fi
2686                 if $test -f myread; then
2687                     . ./myread
2688                 else
2689                     if $test -f UU/myread; then
2690                         . ./UU/myread
2691                     else
2692                         echo "Cannot find myread, sorry.  Aborting." >&2
2693                         exit 1
2694                     fi
2695                 fi
2696                 case "$ans" in
2697                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2698                 esac
2699             fi
2700         fi
2701     fi
2702     $rm -f try try.*
2703     ;;
2704 esac
2705 EOSC
2706
2707 cat <<EOS >checkcc
2708 $startsh
2709 EOS
2710 cat <<'EOSC' >>checkcc
2711 case "$cc" in
2712 '') ;;
2713 *)  $rm -f try try.*
2714     $cat >try.c <<EOM
2715 int main(int argc, char *argv[]) {
2716   return 0;
2717 }
2718 EOM
2719     if $cc -o try $ccflags $ldflags try.c; then
2720        :
2721     else
2722         if $test X"$despair" = Xyes; then
2723            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2724         fi
2725         $cat >&4 <<EOM
2726 You need to find a working C compiler.
2727 Either (purchase and) install the C compiler supplied by your OS vendor,
2728 or for a free C compiler try http://gcc.gnu.org/
2729 I cannot continue any further, aborting.
2730 EOM
2731         exit 1
2732     fi
2733     $rm -f try try.*
2734     ;;
2735 esac
2736 EOSC
2737
2738 : determine whether symbolic links are supported
2739 echo " "
2740 $touch blurfl
2741 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2742         echo "Symbolic links are supported." >&4
2743         lns="$ln -s"
2744 else
2745         echo "Symbolic links are NOT supported." >&4
2746         lns="$ln"
2747 fi
2748 $rm -f blurfl sym
2749
2750 : determine whether symbolic links are supported
2751 echo " "
2752 case "$lns" in
2753 *"ln"*" -s")
2754         echo "Checking how to test for symbolic links..." >&4
2755         $lns blurfl sym
2756         if $test "X$issymlink" = X; then
2757                 case "$newsh" in
2758                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2759                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2760                 esac
2761                 if test $? = 0; then
2762                         issymlink="test -h"
2763                 else
2764                         echo "Your builtin 'test -h' may be broken." >&4
2765                         case "$test" in
2766                         /*)     ;;
2767                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2768                                 for p in $pth
2769                                 do
2770                                         if test -f "$p/$test"; then
2771                                                 test="$p/$test"
2772                                                 break
2773                                         fi
2774                                 done
2775                                 ;;
2776                         esac
2777                         case "$test" in
2778                         /*)
2779                                 echo "Trying external '$test -h'." >&4
2780                                 issymlink="$test -h"
2781                                 if $test ! -h sym >/dev/null 2>&1; then
2782                                         echo "External '$test -h' is broken, too." >&4
2783                                         issymlink=''
2784                                 fi
2785                                 ;;
2786                         *)      issymlink='' ;;
2787                         esac
2788                 fi
2789         fi
2790         if $test "X$issymlink" = X; then
2791                 if $test -L sym 2>/dev/null; then
2792                         issymlink="$test -L"
2793                         echo "The builtin '$test -L' worked." >&4
2794                 fi
2795         fi
2796         if $test "X$issymlink" != X; then
2797                 echo "You can test for symbolic links with '$issymlink'." >&4
2798         else
2799                 echo "I do not know how you can test for symbolic links." >&4
2800         fi
2801         $rm -f blurfl sym
2802         ;;
2803 *)      echo "No symbolic links, so not testing for their testing..." >&4
2804         ;;
2805 esac
2806 echo " "
2807
2808 : Make symlinks util
2809 case "$mksymlinks" in
2810 $define|true|[yY]*)
2811         case "$src" in
2812         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2813                 exit 1
2814                 ;;
2815         *)      case "$lns:$issymlink" in
2816                 *"ln"*" -s:"*"test -"?)
2817                         echo "Creating the symbolic links..." >&4
2818                         echo "(First creating the subdirectories...)" >&4
2819                         cd ..
2820                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2821                                 read directory
2822                                 test -z "$directory" && break
2823                                 mkdir -p $directory
2824                         done
2825                         # Sanity check 1.
2826                         if test ! -d t/base; then
2827                                 echo "Failed to create the subdirectories.  Aborting." >&4
2828                                 exit 1
2829                         fi
2830                         echo "(Then creating the symlinks...)" >&4
2831                         awk '{print $1}' $src/MANIFEST | while true; do
2832                                 read filename
2833                                 test -z "$filename" && break
2834                                 if test -f $filename; then
2835                                         if $issymlink $filename; then
2836                                                 rm -f $filename
2837                                         fi
2838                                 fi
2839                                 if test -f $filename; then
2840                                         echo "$filename already exists, not symlinking."
2841                                 else
2842                                         ln -s $src/$filename $filename
2843                                 fi
2844                         done
2845                         # Sanity check 2.
2846                         if test ! -f t/base/lex.t; then
2847                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2848                                 exit 1
2849                         fi
2850                         cd UU
2851                         ;;
2852                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2853                         ;;
2854                 esac
2855                 ;;
2856         esac
2857         ;;
2858 esac
2859
2860 : Check for Cross-Compilation
2861 if $test "X$targethost" = "X"; then
2862     targethost=""
2863 fi
2864 if $test "X$targetenv" = "X"; then
2865     targetenv=""
2866 fi
2867 case "$usecrosscompile" in
2868 $define|true|[yY]*)
2869         $echo "Cross-compiling..."
2870         croak=''
2871         case "$cc" in
2872         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2873             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2874             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2875             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2876             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2877             # leave out ld, choosing it is more complex
2878             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2879             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2880             # We are in a weird spot. Just before us, some values
2881             # were 'saved', to be restored after the hints are
2882             # run.  This means that the changes we made to ar,
2883             # nm and ranlib will get reverted.
2884             # To avoid that, we hijack the saving mechanism and
2885             # have it save our new values.
2886             for file in ar nm ranlib; do
2887                 eval xxx=\$$file
2888                 eval $file=$xxx$_exe
2889                 eval _$file=$xxx
2890             done
2891         ;;
2892         esac
2893         case "$targetarch" in
2894         '') echo "Targetarch not defined." >&4; croak=y ;;
2895         *)  echo "Using targetarch $targetarch." >&4 ;;
2896         esac
2897         case "$targethost" in
2898         '') echo "Targethost not defined." >&4; croak=y ;;
2899         *)  echo "Using targethost $targethost." >&4
2900         esac
2901         locincpth=' '
2902         loclibpth=' '
2903         case "$croak" in
2904         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2905         esac
2906     : compile a host miniperl and generate_uudmap, unless we got passed them
2907     if $test "X$hostperl" = X; then
2908       echo "Building host miniperl and generate_uudmap binaries" >&4
2909       before_host=`pwd`
2910       cd ..
2911       cd $src
2912       src=`pwd`
2913       rm -rf $src/host
2914       mkdir $src/host
2915       cd $src/host
2916       $src/Configure -des -Dusedevel -Dmksymlinks
2917       $make miniperl
2918       case "$hostgenerate" in
2919       '') $make generate_uudmap
2920           hostgenerate=$src/host/generate_uudmap
2921           ;;
2922        "$undef") hostgenerate=''
2923           ;;
2924       esac
2925       hostperl=$src/host/miniperl
2926       cd $before_host
2927     fi
2928     hostosname=`$hostperl -le 'print $^O'`
2929     ;;
2930 *)
2931     usecrosscompile="$undef"
2932     ;;
2933 esac
2934
2935 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2936 case "$targethost" in
2937     '') echo "Checking for cross-compile" >&4
2938     case "$usecrosscompile$multiarch" in
2939        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2940          if [ -f Makefile ]; then
2941            echo " "
2942            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2943          else
2944            echo "Configure done."
2945          fi
2946        exit 0
2947        ;;
2948      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2949         run=''
2950         to=:
2951         from=:
2952         ;;
2953     esac
2954     ;;
2955     *) echo "Using targethost $targethost." >&4
2956         case "$src" in
2957         /*) run=$src/Cross/run
2958             targetmkdir=$src/Cross/mkdir
2959             to=$src/Cross/to
2960             from=$src/Cross/from
2961             ;;
2962         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2963             run=$pwd/Cross/run
2964             targetmkdir=$pwd/Cross/mkdir
2965             to=$pwd/Cross/to
2966             from=$pwd/Cross/from
2967             ;;
2968         esac
2969         case "$targetrun" in
2970         '') targetrun=ssh ;;
2971         esac
2972         case "$targetto" in
2973         '') targetto=scp ;;
2974         esac
2975         case "$targetfrom" in
2976         '') targetfrom=scp ;;
2977         esac
2978         run=$run-$targetrun
2979         to=$to-$targetto
2980         from=$from-$targetfrom
2981         case "$targetdir" in
2982         '')  targetdir=/tmp
2983              echo "Guessing targetdir $targetdir." >&4
2984              ;;
2985         esac
2986         case "$targetuser" in
2987         '')  targetuser=root
2988              echo "Guessing targetuser $targetuser." >&4
2989              ;;
2990         esac
2991         case "$targetport" in
2992         '')  targetport=22
2993              echo "Guessing targetport $targetport." >&4
2994              ;;
2995         esac
2996         case "$targetfrom" in
2997         scp)    q=-q ;;
2998         *)      q='' ;;
2999         esac
3000         case "$targetrun" in
3001         ssh|rsh)
3002             cat >$run <<EOF
3003 #!/bin/sh
3004 env=''
3005 case "\$1" in
3006 -cwd)
3007   shift
3008   cwd=\$1
3009   shift
3010   ;;
3011 esac
3012 case "\$1" in
3013 -env)
3014   shift
3015   env=\$1
3016   shift
3017   ;;
3018 esac
3019 case "\$cwd" in
3020 '') cwd=$targetdir ;;
3021 esac
3022 exe=\$1
3023 shift
3024 $to \$exe
3025 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3026 EOF
3027             ;;
3028         adb)
3029             $touch $run
3030             ;;
3031         *)  echo "Unknown targetrun '$targetrun'" >&4
3032             exit 1
3033             ;;
3034         esac
3035         case "$targetmkdir" in
3036         */Cross/mkdir)
3037             cat >$targetmkdir <<EOF
3038 #!/bin/sh
3039 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3040 EOF
3041             $chmod a+rx $targetmkdir
3042             ;;
3043         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3044             exit 1
3045             ;;
3046         esac
3047         case "$targetto" in
3048         scp|rcp)
3049             cat >$to <<EOF
3050 #!/bin/sh
3051 for f in \$@
3052 do
3053   case "\$f" in
3054   /*)
3055     $targetmkdir \`dirname \$f\`
3056     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3057     ;;
3058   *)
3059     $targetmkdir $targetdir/\`dirname \$f\`
3060     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3061     ;;
3062   esac
3063 done
3064 exit 0
3065 EOF
3066             ;;
3067         cp) cat >$to <<EOF
3068 #!/bin/sh
3069 for f in \$@
3070 do
3071   case "\$f" in
3072   /*)
3073     $mkdir -p $targetdir/\`dirname \$f\`
3074     $cp \$f $targetdir/\$f || exit 1
3075     ;;
3076   *)
3077     $targetmkdir $targetdir/\`dirname \$f\`
3078     $cp \$f $targetdir/\$f || exit 1
3079     ;;
3080   esac
3081 done
3082 exit 0
3083 EOF
3084             ;;
3085         *)  echo "Unknown targetto '$targetto'" >&4
3086             exit 1
3087             ;;
3088         esac
3089         case "$targetfrom" in
3090         scp|rcp)
3091           cat >$from <<EOF
3092 #!/bin/sh
3093 for f in \$@
3094 do
3095   $rm -f \$f
3096   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3097 done
3098 exit 0
3099 EOF
3100             ;;
3101         cp) cat >$from <<EOF
3102 #!/bin/sh
3103 for f in \$@
3104 do
3105   $rm -f \$f
3106   cp $targetdir/\$f . || exit 1
3107 done
3108 exit 0
3109 EOF
3110             ;;
3111         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3112             exit 1
3113             ;;
3114         esac
3115         if $test ! -f $run; then
3116             echo "Target 'run' script '$run' not found." >&4
3117         else
3118             $chmod a+rx $run
3119         fi
3120         if $test ! -f $to; then
3121             echo "Target 'to' script '$to' not found." >&4
3122         else
3123             $chmod a+rx $to
3124         fi
3125         if $test ! -f $from; then
3126             echo "Target 'from' script '$from' not found." >&4
3127         else
3128             $chmod a+rx $from
3129         fi
3130         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3131             exit 1
3132         fi
3133         cat >&4 <<EOF
3134 Using '$run' for remote execution,
3135 and '$from' and '$to'
3136 for remote file transfer.
3137 EOF
3138         ;;
3139 *)      run=''
3140         to=:
3141         from=:
3142         usecrosscompile="$undef"
3143         targetarch=''
3144         ;;
3145 esac
3146
3147 : see whether [:lower:] and [:upper:] are supported character classes
3148 echo " "
3149 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3150 ABYZ)
3151         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3152         up='[:upper:]'
3153         low='[:lower:]'
3154         ;;
3155 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3156         # (0xd9 and 0xe2), therefore that is a nice testing point.
3157         if test "X$up" = X -o "X$low" = X; then
3158             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3159             rs) up='[A-Z]'
3160                 low='[a-z]'
3161                 ;;
3162             esac
3163         fi
3164         if test "X$up" = X -o "X$low" = X; then
3165             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3166             rs) up='A-Z'
3167                 low='a-z'
3168                 ;;
3169             esac
3170         fi
3171         if test "X$up" = X -o "X$low" = X; then
3172             case "`echo RS | od -x 2>/dev/null`" in
3173             *D9E2*|*d9e2*)
3174                 echo "Hey, this might be EBCDIC." >&4
3175                 if test "X$up" = X -o "X$low" = X; then
3176                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3177                     rs) up='[A-IJ-RS-Z]'
3178                         low='[a-ij-rs-z]'
3179                         ;;
3180                     esac
3181                 fi
3182                 if test "X$up" = X -o "X$low" = X; then
3183                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3184                     rs) up='A-IJ-RS-Z'
3185                         low='a-ij-rs-z'
3186                         ;;
3187                     esac
3188                 fi
3189                 ;;
3190             esac
3191         fi
3192 esac
3193 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3194 rs)
3195     echo "Using $up and $low to convert case." >&4
3196     ;;
3197 *)
3198     echo "I don't know how to translate letters from upper to lower case." >&4
3199     echo "Your tr is not acting any way I know of." >&4
3200     exit 1
3201     ;;
3202 esac
3203 : set up the translation script tr, must be called with ./tr of course
3204 cat >tr <<EOSC
3205 $startsh
3206 case "\$1\$2" in
3207 '[A-Z][a-z]') exec $tr '$up' '$low';;
3208 '[a-z][A-Z]') exec $tr '$low' '$up';;
3209 esac
3210 exec $tr "\$@"
3211 EOSC
3212 chmod +x tr
3213 $eunicefix tr
3214
3215 : Try to determine whether config.sh was made on this system
3216 case "$config_sh" in
3217 '')
3218 myuname=`$uname -a 2>/dev/null`
3219 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3220 # Downcase everything to avoid ambiguity.
3221 # Remove slashes and single quotes so we can use parts of this in
3222 # directory and file names.
3223 # Remove newlines so myuname is sane to use elsewhere.
3224 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3225 # because the A-Z/a-z are not consecutive.
3226 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3227         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3228 newmyuname="$myuname"
3229 dflt=n
3230 case "$knowitall" in
3231 '')
3232         if test -f ../config.sh; then
3233                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3234                         eval "`grep myuname= ../config.sh`"
3235                 fi
3236                 if test "X$myuname" = "X$newmyuname"; then
3237                         dflt=y
3238                 fi
3239         fi
3240         ;;
3241 *) dflt=y;;
3242 esac
3243
3244 : Get old answers from old config file if Configure was run on the
3245 : same system, otherwise use the hints.
3246 hint=default
3247 cd ..
3248 if test -f config.sh; then
3249         echo " "
3250         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3251         . UU/myread
3252         case "$ans" in
3253         n*|N*) echo "OK, I'll ignore it."
3254                 mv config.sh config.sh.old
3255                 myuname="$newmyuname"
3256                 ;;
3257         *)  echo "Fetching default answers from your old config.sh file..." >&4
3258                 tmp_n="$n"
3259                 tmp_c="$c"
3260                 tmp_sh="$sh"
3261                 . ./config.sh
3262                 cp config.sh UU
3263                 n="$tmp_n"
3264                 c="$tmp_c"
3265                 : Older versions did not always set $sh.  Catch re-use of such
3266                 : an old config.sh.
3267                 case "$sh" in
3268                 '') sh="$tmp_sh" ;;
3269                 esac
3270                 hint=previous
3271                 ;;
3272         esac
3273 fi
3274 . ./UU/checkcc
3275 if test ! -f config.sh; then
3276         $cat <<EOM
3277
3278 First time through, eh?  I have some defaults handy for some systems
3279 that need some extra help getting the Configure answers right:
3280
3281 EOM
3282         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3283         dflt=''
3284         : Half the following guesses are probably wrong... If you have better
3285         : tests or hints, please send them to perlbug@perl.org
3286         : The metaconfig authors would also appreciate a copy...
3287         $test -f /irix && osname=irix
3288         $test -f /xenix && osname=sco_xenix
3289         $test -f /dynix && osname=dynix
3290         $test -f /dnix && osname=dnix
3291         $test -f /lynx.os && osname=lynxos
3292         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3293         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3294         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3295         $test -f /bin/mips && /bin/mips && osname=mips
3296         $test -d /usr/apollo/bin && osname=apollo
3297         $test -f /etc/saf/_sactab && osname=svr4
3298         $test -d /usr/include/minix && osname=minix
3299         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3300         if $test -d /MachTen -o -d /MachTen_Folder; then
3301                 osname=machten
3302                 if $test -x /sbin/version; then
3303                         osvers=`/sbin/version | $awk '{print $2}' |
3304                         $sed -e 's/[A-Za-z]$//'`
3305                 elif $test -x /usr/etc/version; then
3306                         osvers=`/usr/etc/version | $awk '{print $2}' |
3307                         $sed -e 's/[A-Za-z]$//'`
3308                 else
3309                         osvers="$2.$3"
3310                 fi
3311         fi
3312
3313         $test -f /sys/posix.dll &&
3314                 $test -f /usr/bin/what &&
3315                 set X `/usr/bin/what /sys/posix.dll` &&
3316                 $test "$3" = UWIN &&
3317                 osname=uwin &&
3318                 osvers="$5"
3319
3320         if $test -f $uname; then
3321                 set X $myuname
3322                 shift
3323
3324                 case "$5" in
3325                 fps*) osname=fps ;;
3326                 mips*)
3327                         case "$4" in
3328                         umips) osname=umips ;;
3329                         *) osname=mips ;;
3330                         esac;;
3331                 [23]100) osname=mips ;;
3332                 i386*)
3333                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3334                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3335                                 osname='sco'
3336                                 osvers=$tmp
3337                         elif $test -f /etc/kconfig; then
3338                                 osname=isc
3339                                 if test "$lns" = "$ln -s"; then
3340                                         osvers=4
3341                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3342                                         osvers=3
3343                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3344                                         osvers=2
3345                                 fi
3346                         fi
3347                         tmp=''
3348                         ;;
3349                 pc*)
3350                         if test -n "$DJGPP"; then
3351                                 osname=dos
3352                                 osvers=djgpp
3353                         fi
3354                         ;;
3355                 esac
3356
3357                 case "$1" in
3358                 aix) osname=aix
3359                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3360                         case "$tmp" in
3361                         # oslevel can fail with:
3362                         # oslevel: Unable to acquire lock.
3363                         *not\ found) osvers="$4"."$3" ;;
3364                         '<3240'|'<>3240') osvers=3.2.0 ;;
3365                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3366                         '=3250'|'>3250') osvers=3.2.5 ;;
3367                         *) osvers=$tmp;;
3368                         esac
3369                         ;;
3370                 bitrig) osname=bitrig
3371                         osvers="$3"
3372                         ;;
3373                 bsd386) osname=bsd386
3374                         osvers=`$uname -r`
3375                         ;;
3376                 cygwin*) osname=cygwin
3377                         osvers="$3"
3378                         ;;
3379                 *dc.osx) osname=dcosx
3380                         osvers="$3"
3381                         ;;
3382                 dnix) osname=dnix
3383                         osvers="$3"
3384                         ;;
3385                 domainos) osname=apollo
3386                         osvers="$3"
3387                         ;;
3388                 dgux)   osname=dgux
3389                         osvers="$3"
3390                         ;;
3391                 dragonfly) osname=dragonfly
3392                         osvers="$3"
3393                         ;;
3394                 dynixptx*) osname=dynixptx
3395                         osvers=`echo "$4"|sed 's/^v//'`
3396                         ;;
3397                 freebsd) osname=freebsd
3398                         osvers="$3" ;;
3399                 genix)  osname=genix ;;
3400                 gnu)    osname=gnu
3401                         osvers="$3" ;;
3402                 hp*)    osname=hpux
3403                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3404                         ;;
3405                 irix*)  osname=irix
3406                         case "$3" in
3407                         4*) osvers=4 ;;
3408                         5*) osvers=5 ;;
3409                         *)      osvers="$3" ;;
3410                         esac
3411                         ;;
3412                 linux)  osname=linux
3413                         case "$3" in
3414                         *)      osvers="$3" ;;
3415                         esac
3416                         $test -f /system/lib/libandroid.so && osname=linux-android
3417                         ;;
3418                 MiNT)   osname=mint
3419                         ;;
3420                 netbsd*) osname=netbsd
3421                         osvers="$3"
3422                         ;;
3423                 news-os) osvers="$3"
3424                         case "$3" in
3425                         4*) osname=newsos4 ;;
3426                         *) osname=newsos ;;
3427                         esac
3428                         ;;
3429                 nonstop-ux) osname=nonstopux ;;
3430                 openbsd) osname=openbsd
3431                         osvers="$3"
3432                         ;;
3433                 os2)    osname=os2
3434                         osvers="$4"
3435                         ;;
3436                 POSIX-BC | posix-bc ) osname=posix-bc
3437                         osvers="$3"
3438                         ;;
3439                 powerux | power_ux | powermax_os | powermaxos | \
3440                 powerunix | power_unix) osname=powerux
3441                         osvers="$3"
3442                         ;;
3443                 qnx) osname=qnx
3444                         osvers="$4"
3445                         ;;
3446                 solaris) osname=solaris
3447                         case "$3" in
3448                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3449                         *)      osvers="$3" ;;
3450                         esac
3451                         ;;
3452                 sunos) osname=sunos
3453                         case "$3" in
3454                         5*) osname=solaris
3455                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3456                         *)      osvers="$3" ;;
3457                         esac
3458                         ;;
3459                 titanos) osname=titanos
3460                         case "$3" in
3461                         1*) osvers=1 ;;
3462                         2*) osvers=2 ;;
3463                         3*) osvers=3 ;;
3464                         4*) osvers=4 ;;
3465                         *)      osvers="$3" ;;
3466                         esac
3467                         ;;
3468                 ultrix) osname=ultrix
3469                         osvers="$3"
3470                         ;;
3471                 osf1|mls+)      case "$5" in
3472                                 alpha)
3473                                         osname=dec_osf
3474                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3475                                         case "$osvers" in
3476                                         [1-9].[0-9]*) ;;
3477                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3478                                         esac
3479                                         ;;
3480                         hp*)    osname=hp_osf1  ;;
3481                         mips)   osname=mips_osf1 ;;
3482                         esac
3483                         ;;
3484                 # UnixWare 7.1.2 is known as Open UNIX 8
3485                 openunix|unixware) osname=svr5
3486                         osvers="$4"
3487                         ;;
3488                 uts)    osname=uts
3489                         osvers="$3"
3490                         ;;
3491                 vos) osvers="$3"
3492                         ;;
3493                 $2) case "$osname" in
3494                         *isc*) ;;
3495                         *freebsd*) ;;
3496                         svr*)
3497                                 : svr4.x or possibly later
3498                                 case "svr$3" in
3499                                 ${osname}*)
3500                                         osname=svr$3
3501                                         osvers=$4
3502                                         ;;
3503                                 esac
3504                                 case "$osname" in
3505                                 svr4.0)
3506                                         : Check for ESIX
3507                                         if test -f /stand/boot ; then
3508                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3509                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3510                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3511                                                         if test -n "$isesix"; then
3512                                                                 osname=esix4
3513                                                         fi
3514                                                 fi
3515                                         fi
3516                                         ;;
3517                                 esac
3518                                 ;;
3519                         *)      if test -f /etc/systemid; then
3520                                         osname=sco
3521                                         set `echo $3 | $sed 's/\./ /g'` $4
3522                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3523                                                 osvers=$1.$2.$3
3524                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3525                                                 osvers=$1.$2
3526                                         elif $test -f $src/hints/sco_$1.sh; then
3527                                                 osvers=$1
3528                                         fi
3529                                 else
3530                                         case "$osname" in
3531                                         '') : Still unknown.  Probably a generic Sys V.
3532                                                 osname="sysv"
3533                                                 osvers="$3"
3534                                                 ;;
3535                                         esac
3536                                 fi
3537                                 ;;
3538                         esac
3539                         ;;
3540                 *)      case "$osname" in
3541                         '') : Still unknown.  Probably a generic BSD.
3542                                 osname="$1"
3543                                 osvers="$3"
3544                                 ;;
3545                         esac
3546                         ;;
3547                 esac
3548         else
3549                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3550                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3551                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3552                                 osname=news_os
3553                         fi
3554                         $rm -f UU/kernel.what
3555                 elif test -d c:/. -o -n "$is_os2" ; then
3556                         set X $myuname
3557                         osname=os2
3558                         osvers="$5"
3559                 fi
3560         fi
3561
3562         case "$targetarch" in
3563         '') ;;
3564         *)  hostarch=$osname
3565             case "$targetarch" in
3566                 nto*|*-nto-*)
3567                     # Will load qnx.sh, which should change osname to nto
3568                     osname=qnx
3569                     osvers=''
3570                     ;;
3571                 *linux-android*)
3572                     # Catch arm-linux-androideabi, mipsel-linux-android,
3573                     # and i686-linux-android
3574                     osname=linux-android
3575                     osvers=''
3576                     ;;
3577                 *linux*)
3578                     # Something like arm-linux-gnueabihf is really just
3579                     # plain linux.
3580                     osname=linux
3581                     osvers=''
3582                     ;;
3583                 *solaris*|*sunos*)
3584                     osname=solaris
3585                     # XXX perhaps we should just assume
3586                     # osvers to be 2, or maybe take the value
3587                     # from targetarch. Using $run before the
3588                     # hints are run is somewhat icky.
3589                     set X `$run $uname -a 2>/dev/null`
3590                     shift
3591                     case "$3" in
3592                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3593                         *)  osvers="$3" ;;
3594                     esac
3595                     ;;
3596                 *)
3597                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3598                     osvers=''
3599                 ;;
3600             esac
3601             ;;
3602         esac
3603
3604         : Now look for a hint file osname_osvers, unless one has been
3605         : specified already.
3606         case "$hintfile" in
3607         ''|' ')
3608                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3609                 : Also try without trailing minor version numbers.
3610                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3611                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3612                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3613                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3614                 case "$file" in
3615                 '') dflt=none ;;
3616                 *)  case "$osvers" in
3617                         '') dflt=$file
3618                                 ;;
3619                         *)  if $test -f $src/hints/$file.sh ; then
3620                                         dflt=$file
3621                                 elif $test -f $src/hints/$xfile.sh ; then
3622                                         dflt=$xfile
3623                                 elif $test -f $src/hints/$xxfile.sh ; then
3624                                         dflt=$xxfile
3625                                 elif $test -f $src/hints/$xxxfile.sh ; then
3626                                         dflt=$xxxfile
3627                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3628                                         dflt=$xxxxfile
3629                                 elif $test -f "$src/hints/${osname}.sh" ; then
3630                                         dflt="${osname}"
3631                                 else
3632                                         dflt=none
3633                                 fi
3634                                 ;;
3635                         esac
3636                         ;;
3637                 esac
3638                 if $test -f Policy.sh ; then
3639                         case "$dflt" in
3640                         *Policy*) ;;
3641                         none) dflt="Policy" ;;
3642                         *) dflt="Policy $dflt" ;;
3643                         esac
3644                 fi
3645                 ;;
3646         *)
3647                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3648                 ;;
3649         esac
3650
3651         if $test -f Policy.sh ; then
3652                 $cat <<EOM
3653
3654 There's also a Policy hint file available, which should make the
3655 site-specific (policy) questions easier to answer.
3656 EOM
3657
3658         fi
3659
3660         $cat <<EOM
3661
3662 You may give one or more space-separated answers, or "none" if appropriate.
3663 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3664 previous run of Configure, you may specify it as well as or instead of
3665 OS-specific hints.  If hints are provided for your OS, you should use them:
3666 although Perl can probably be built without hints on many platforms, using
3667 hints often improve performance and may enable features that Configure can't
3668 set up on its own. If there are no hints that match your OS, specify "none";
3669 DO NOT give a wrong version or a wrong OS.
3670
3671 EOM
3672
3673         rp="Which of these apply, if any?"
3674         . UU/myread
3675         tans=$ans
3676         for file in $tans; do
3677                 if $test X$file = XPolicy -a -f Policy.sh; then
3678                         . Policy.sh
3679                         $cat Policy.sh >> UU/config.sh
3680                 elif $test -f $src/hints/$file.sh; then
3681                         . $src/hints/$file.sh
3682                         $cat $src/hints/$file.sh >> UU/config.sh
3683                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3684                         : nothing
3685                 else
3686                         : Give one chance to correct a possible typo.
3687                         echo "$file.sh does not exist"
3688                         dflt=$file
3689                         rp="hint to use instead?"
3690                         . UU/myread
3691                         for file in $ans; do
3692                                 if $test -f "$src/hints/$file.sh"; then
3693                                         . $src/hints/$file.sh
3694                                         $cat $src/hints/$file.sh >> UU/config.sh
3695                                 elif $test X$ans = X -o X$ans = Xnone ; then
3696                                         : nothing
3697                                 else
3698                                         echo "$file.sh does not exist -- ignored."
3699                                 fi
3700                         done
3701                 fi
3702         done
3703
3704         hint=recommended
3705         : Remember our hint file for later.
3706         if $test -f "$src/hints/$file.sh" ; then
3707                 hintfile="$file"
3708         else
3709                 hintfile=''
3710         fi
3711 fi
3712 cd UU
3713 ;;
3714 *)
3715         echo " "
3716         echo "Fetching default answers from $config_sh..." >&4
3717         tmp_n="$n"
3718         tmp_c="$c"
3719         cd ..
3720         cp $config_sh config.sh 2>/dev/null
3721         chmod +w config.sh
3722         . ./config.sh
3723         cd UU
3724         cp ../config.sh .
3725         n="$tmp_n"
3726         c="$tmp_c"
3727         hint=previous
3728         ;;
3729 esac
3730 test "$override" && . ./optdef.sh
3731
3732 : Restore computed paths
3733 for file in $loclist $trylist; do
3734         eval $file="\$_$file"
3735 done
3736
3737 cat << EOM
3738
3739 Configure uses the operating system name and version to set some defaults.
3740 The default value is probably right if the name rings a bell. Otherwise,
3741 since spelling matters for me, either accept the default or answer "none"
3742 to leave it blank.
3743
3744 EOM
3745 case "$osname" in
3746         ''|' ')
3747                 case "$hintfile" in
3748                 ''|' '|none) dflt=none ;;
3749                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3750                 esac
3751                 ;;
3752         *) dflt="$osname" ;;
3753 esac
3754 rp="Operating system name?"
3755 . ./myread
3756 case "$ans" in
3757 none)  osname='' ;;
3758 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3759 esac
3760 echo " "
3761 case "$osvers" in
3762         ''|' ')
3763                 case "$hintfile" in
3764                 ''|' '|none) dflt=none ;;
3765                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3766                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3767                         case "$dflt" in
3768                         ''|' ') dflt=none ;;
3769                         esac
3770                         ;;
3771                 esac
3772                 ;;
3773         *) dflt="$osvers" ;;
3774 esac
3775 rp="Operating system version?"
3776 . ./myread
3777 case "$ans" in
3778 none)  osvers='' ;;
3779 *) osvers="$ans" ;;
3780 esac
3781
3782
3783 . ./posthint.sh
3784
3785 : who configured the system
3786 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3787 case "$cf_by" in
3788 "")
3789         cf_by=`(logname) 2>/dev/null`
3790         case "$cf_by" in
3791         "")
3792                 cf_by=`(whoami) 2>/dev/null`
3793                 case "$cf_by" in
3794                 "") cf_by=unknown ;;
3795                 esac ;;
3796         esac ;;
3797 esac
3798
3799 : decide how portable to be.  Allow command line overrides.
3800 case "$d_portable" in
3801 "$undef") ;;
3802 *)      d_portable="$define" ;;
3803 esac
3804
3805 : set up shell script to do ~ expansion
3806 cat >filexp <<EOSS
3807 $startsh
3808 : expand filename
3809 case "\$1" in
3810  \~/*|\~)
3811         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3812         ;;
3813  \~*)
3814         if $test -f /bin/csh; then
3815                 /bin/csh -f -c "glob \$1"
3816                 failed=\$?
3817                 echo ""
3818                 exit \$failed
3819         else
3820                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3821                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3822                 if $test ! -d "\$dir"; then
3823                         me=\`basename \$0\`
3824                         echo "\$me: can't locate home directory for: \$name" >&2
3825                         exit 1
3826                 fi
3827                 case "\$1" in
3828                 */*)
3829                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3830                         ;;
3831                 *)
3832                         echo \$dir
3833                         ;;
3834                 esac
3835         fi
3836         ;;
3837 *)
3838         echo \$1
3839         ;;
3840 esac
3841 EOSS
3842 chmod +x filexp
3843 $eunicefix filexp
3844
3845 : now set up to get a file name
3846 cat <<EOS >getfile
3847 $startsh
3848 EOS
3849 cat <<'EOSC' >>getfile
3850 tilde=''
3851 fullpath=''
3852 already=''
3853 skip=''
3854 none_ok=''
3855 exp_file=''
3856 nopath_ok=''
3857 orig_rp="$rp"
3858 orig_dflt="$dflt"
3859 case "$gfpth" in
3860 '') gfpth='.' ;;
3861 esac
3862
3863 case "$fn" in
3864 *\(*)
3865         : getfile will accept an answer from the comma-separated list
3866         : enclosed in parentheses even if it does not meet other criteria.
3867         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3868         fn=`echo $fn | sed 's/(.*)//'`
3869         ;;
3870 esac
3871
3872 case "$fn" in
3873 *:*)
3874         loc_file=`expr $fn : '.*:\(.*\)'`
3875         fn=`expr $fn : '\(.*\):.*'`
3876         ;;
3877 esac
3878
3879 case "$fn" in
3880 *~*) tilde=true;;
3881 esac
3882 case "$fn" in
3883 */*) fullpath=true;;
3884 esac
3885 case "$fn" in
3886 *+*) skip=true;;
3887 esac
3888 case "$fn" in
3889 *n*) none_ok=true;;
3890 esac
3891 case "$fn" in
3892 *e*) exp_file=true;;
3893 esac
3894 case "$fn" in
3895 *p*) nopath_ok=true;;
3896 esac
3897
3898 case "$fn" in
3899 *f*) type='File';;
3900 *d*) type='Directory';;
3901 *l*) type='Locate';;
3902 esac
3903
3904 what="$type"
3905 case "$what" in
3906 Locate) what='File';;
3907 esac
3908
3909 case "$exp_file" in
3910 '')
3911         case "$d_portable" in
3912         "$define") ;;
3913         *) exp_file=true;;
3914         esac
3915         ;;
3916 esac
3917
3918 cd ..
3919 while test "$type"; do
3920         redo=''
3921         rp="$orig_rp"
3922         dflt="$orig_dflt"
3923         case "$tilde" in
3924         true) rp="$rp (~name ok)";;
3925         esac
3926         . UU/myread
3927         if test -f UU/getfile.ok && \
3928                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3929         then
3930                 value="$ans"
3931                 ansexp="$ans"
3932                 break
3933         fi
3934         case "$ans" in
3935         none)
3936                 value=''
3937                 ansexp=''
3938                 case "$none_ok" in
3939                 true) type='';;
3940                 esac
3941                 ;;
3942         *)
3943                 case "$tilde" in
3944                 '') value="$ans"
3945                         ansexp="$ans";;
3946                 *)
3947                         value=`UU/filexp $ans`
3948                         case $? in
3949                         0)
3950                                 if test "$ans" != "$value"; then
3951                                         echo "(That expands to $value on this system.)"
3952                                 fi
3953                                 ;;
3954                         *) value="$ans";;
3955                         esac
3956                         ansexp="$value"
3957                         case "$exp_file" in
3958                         '') value="$ans";;
3959                         esac
3960                         ;;
3961                 esac
3962                 case "$fullpath" in
3963                 true)
3964                         case "$ansexp" in
3965                         /*) value="$ansexp" ;;
3966                         [a-zA-Z]:/*) value="$ansexp" ;;
3967                         *)
3968                                 redo=true
3969                                 case "$already" in
3970                                 true)
3971                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3972                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3973                                         ;;
3974                                 *)
3975                                 echo "Please give a full path name, starting with slash." >&4
3976                                         case "$tilde" in
3977                                         true)
3978                                 echo "Note that using ~name is ok provided it expands well." >&4
3979                                                 already=true
3980                                                 ;;
3981                                         esac
3982                                 esac
3983                                 ;;
3984                         esac
3985                         ;;
3986                 esac
3987                 case "$redo" in
3988                 '')
3989                         case "$type" in
3990                         File)
3991                                 for fp in $gfpth; do
3992                                         if test "X$fp" = X.; then
3993                                             pf="$ansexp"
3994                                         else    
3995                                             pf="$fp/$ansexp"
3996                                         fi
3997                                         if test -f "$pf"; then
3998                                                 type=''
3999                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4000                                         then
4001                                                 echo "($value is not a plain file, but that's ok.)"
4002                                                 type=''
4003                                         fi
4004                                         if test X"$type" = X; then
4005                                             value="$pf"
4006                                             break
4007                                         fi
4008                                 done
4009                                 ;;
4010                         Directory)
4011                                 for fp in $gfpth; do
4012                                         if test "X$fp" = X.; then
4013                                             dir="$ans"
4014                                             direxp="$ansexp"
4015                                         else    
4016                                             dir="$fp/$ansexp"
4017                                             direxp="$fp/$ansexp"
4018                                         fi
4019                                         if test -d "$direxp"; then
4020                                                 type=''
4021                                                 value="$dir"
4022                                                 break
4023                                         fi
4024                                 done
4025                                 ;;
4026                         Locate)
4027                                 if test -d "$ansexp"; then
4028                                         echo "(Looking for $loc_file in directory $value.)"
4029                                         value="$value/$loc_file"
4030                                         ansexp="$ansexp/$loc_file"
4031                                 fi
4032                                 if test -f "$ansexp"; then
4033                                         type=''
4034                                 fi
4035                                 case "$nopath_ok" in
4036                                 true)   case "$value" in
4037                                         */*) ;;
4038                                         *)      echo "Assuming $value will be in people's path."
4039                                                 type=''
4040                                                 ;;
4041                                         esac
4042                                         ;;
4043                                 esac
4044                                 ;;
4045                         esac
4046
4047                         case "$skip" in
4048                         true) type='';
4049                         esac
4050
4051                         case "$type" in
4052                         '') ;;
4053                         *)
4054                                 if test "$fastread" = yes; then
4055                                         dflt=y
4056                                 else
4057                                         dflt=n
4058                                 fi
4059                                 rp="$what $value doesn't exist.  Use that name anyway?"
4060                                 . UU/myread
4061                                 dflt=''
4062                                 case "$ans" in
4063                                 y*) type='';;
4064                                 *) echo " ";;
4065                                 esac
4066                                 ;;
4067                         esac
4068                         ;;
4069                 esac
4070                 ;;
4071         esac
4072 done
4073 cd UU
4074 ans="$value"
4075 rp="$orig_rp"
4076 dflt="$orig_dflt"
4077 rm -f getfile.ok
4078 test "X$gfpthkeep" != Xy && gfpth=""
4079 EOSC
4080
4081 : determine root of directory hierarchy where package will be installed.
4082 case "$prefix" in
4083 '')
4084         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4085         ;;
4086 *?/)
4087         dflt=`echo "$prefix" | sed 's/.$//'`
4088         ;;
4089 *)
4090         dflt="$prefix"
4091         ;;
4092 esac
4093 $cat <<EOM
4094
4095 By default, $package will be installed in $dflt/bin, manual pages
4096 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4097 installation directories. Typically this is something like /usr/local.
4098 If you wish to have binaries under /usr/bin but other parts of the
4099 installation under /usr/local, that's ok: you will be prompted
4100 separately for each of the installation directories, the prefix being
4101 only used to set the defaults.
4102
4103 EOM
4104 fn=d~
4105 rp='Installation prefix to use?'
4106 . ./getfile
4107 oldprefix=''
4108 case "$prefix" in
4109 '') ;;
4110 *)
4111         case "$ans" in
4112         "$prefix") ;;
4113         *) oldprefix="$prefix";;
4114         esac
4115         ;;
4116 esac
4117 prefix="$ans"
4118 prefixexp="$ansexp"
4119
4120 : allow them to override the AFS root
4121 case "$afsroot" in
4122 '')     afsroot=/afs ;;
4123 *)      afsroot=$afsroot ;;
4124 esac
4125
4126 : is AFS running?
4127 echo " "
4128 case "$afs" in
4129 $define|true)   afs=true ;;
4130 $undef|false)   afs=false ;;
4131 *)      if $test -d $afsroot; then
4132                 afs=true
4133         else
4134                 afs=false
4135         fi
4136         ;;
4137 esac
4138 if $afs; then
4139         echo "AFS may be running... I'll be extra cautious then..." >&4
4140 else
4141         echo "AFS does not seem to be running..." >&4
4142 fi
4143
4144 : determine installation prefix for where package is to be installed.
4145 if $afs; then
4146 $cat <<EOM
4147
4148 Since you are running AFS, I need to distinguish the directory in which
4149 files will reside from the directory in which they are installed (and from
4150 which they are presumably copied to the former directory by occult means).
4151
4152 EOM
4153         case "$installprefix" in
4154         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4155         *) dflt="$installprefix";;
4156         esac
4157 else
4158 $cat <<EOM
4159
4160 In some special cases, particularly when building $package for distribution,
4161 it is convenient to distinguish the directory in which files should be
4162 installed from the directory ($prefix) in which they will
4163 eventually reside.  For most users, these two directories are the same.
4164
4165 EOM
4166         case "$installprefix" in
4167         '') dflt=$prefix ;;
4168         *) dflt=$installprefix;;
4169         esac
4170 fi
4171 fn=d~
4172 rp='What installation prefix should I use for installing files?'
4173 . ./getfile
4174 installprefix="$ans"
4175 installprefixexp="$ansexp"
4176
4177 : Perform the prefixexp/installprefixexp correction if necessary
4178 cat <<EOS >installprefix
4179 $startsh
4180 EOS
4181 cat <<'EOSC' >>installprefix
4182 : Change installation prefix, if necessary.
4183 if $test X"$prefix" != X"$installprefix"; then
4184     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4185 else
4186     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4187 fi
4188 EOSC
4189 chmod +x installprefix
4190 $eunicefix installprefix
4191
4192 : Set variables such as privlib and privlibexp from the output of ./getfile
4193 : performing the prefixexp/installprefixexp correction if necessary.
4194 cat <<EOS >setprefixvar
4195 $startsh
4196 EOS
4197 cat <<'EOSC' >>setprefixvar
4198 eval "${prefixvar}=\"\$ans\""
4199 eval "${prefixvar}exp=\"\$ansexp\""
4200 . ./installprefix
4201 EOSC
4202 chmod +x setprefixvar
4203 $eunicefix setprefixvar
4204
4205 : set up the script used to warn in case of inconsistency
4206 cat <<EOS >whoa
4207 $startsh
4208 EOS
4209 cat <<'EOSC' >>whoa
4210 dflt=y
4211 case "$hint" in
4212     recommended)
4213         case "$hintfile" in
4214         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4215                 ;;
4216         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4217                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4218                 ;;
4219         esac
4220         ;;
4221     *)  echo " "
4222         echo "*** WHOA THERE!!! ***" >&4
4223         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4224         ;;
4225 esac
4226 rp="    Keep the $hint value?"
4227 . ./myread
4228 case "$ans" in
4229 y) td=$was; tu=$was;;
4230 esac
4231 EOSC
4232
4233 : function used to set '$1' to '$val'
4234 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4235 case "$val$was" in
4236 $define$undef) . ./whoa; eval "$var=\$td";;
4237 $undef$define) . ./whoa; eval "$var=\$tu";;
4238 *) eval "$var=$val";;
4239 esac'
4240
4241 : get the patchlevel
4242 echo " "
4243 echo "Getting the current patchlevel..." >&4
4244 if $test -r $rsrc/patchlevel.h;then
4245         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4246         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4247         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4248         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4249         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4250         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4251         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4252 else
4253         revision=0
4254         patchlevel=0
4255         subversion=0
4256         api_revision=0
4257         api_version=0
4258         api_subversion=0
4259         perl_patchlevel=0
4260         $echo "(You do not have patchlevel.h.  Eek.)"
4261 fi
4262 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4263 version_patchlevel_string="version $patchlevel subversion $subversion"
4264 case "$perl_patchlevel" in
4265 0|'') ;;
4266 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4267     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4268     ;;
4269 esac
4270
4271 $echo "(You have $package $version_patchlevel_string.)"
4272
4273 case "$osname" in
4274 dos|vms)
4275         : XXX Should be a Configure test for double-dots in filenames.
4276         version=`echo $revision $patchlevel $subversion | \
4277                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4278         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4279                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4280         ;;
4281 *)
4282         version=`echo $revision $patchlevel $subversion | \
4283                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4284         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4285                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4286         ;;
4287 esac
4288 : Special case the 5.005_xx maintenance series, which used 5.005
4289 : without any subversion label as a subdirectory in $sitelib
4290 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4291         api_versionstring='5.005'
4292 fi
4293
4294 : Do we want threads support and if so, what type
4295 case "$usethreads" in
4296 $define|true|[yY]*)     dflt='y';;
4297 *)     # Catch case where user specified ithreads or 5005threads but
4298        # forgot -Dusethreads (A.D. 4/2002)
4299        case "$useithreads$use5005threads" in
4300        *$define*)       dflt='y';;
4301        *)               dflt='n';;
4302        esac
4303        ;;
4304 esac
4305 cat <<EOM
4306
4307 Perl can be built to offer a form of threading support on some systems
4308 To do so, Configure can be run with -Dusethreads.
4309
4310 Note that Perl built with threading support runs slightly slower
4311 and uses slightly more memory than plain Perl.
4312
4313 If this doesn't make any sense to you, just accept the default '$dflt'.
4314 EOM
4315 rp='Build a threading Perl?'
4316 . ./myread
4317 case "$ans" in
4318 y|Y)    val="$define" ;;
4319 *)      val="$undef" ;;
4320 esac
4321 set usethreads
4322 eval $setvar
4323
4324 if $test $patchlevel -lt 9; then
4325     case "$usethreads" in
4326     $define)
4327         : Default to ithreads unless overridden on command line or with
4328         : old config.sh
4329         dflt='y'
4330         case "$use5005threads" in
4331                 $define|true|[yY]*)
4332                         echo "5.005 threads are no longer supported"
4333                         exit 1
4334                 ;;
4335         esac
4336         case "$useithreads" in
4337                 $undef|false|[nN]*) dflt='n';;
4338         esac
4339         rp='Use the newer interpreter-based ithreads?'
4340         . ./myread
4341         case "$ans" in
4342         y|Y)    val="$define" ;;
4343         *)      val="$undef" ;;
4344         esac
4345         set useithreads
4346         eval $setvar
4347         : Now set use5005threads to the opposite value.
4348         case "$useithreads" in
4349         $define) val="$undef" ;;
4350         *) val="$define" ;;
4351         esac
4352         set use5005threads
4353         eval $setvar
4354         ;;
4355     *)
4356         useithreads="$undef"
4357         use5005threads="$undef"
4358         ;;
4359     esac
4360
4361     case "$useithreads$use5005threads" in
4362     "$define$define")
4363         $cat >&4 <<EOM
4364
4365 You cannot have both the ithreads and the 5.005 threads enabled
4366 at the same time.  Disabling the 5.005 threads since they are
4367 much less stable than the ithreads.
4368
4369 EOM
4370         use5005threads="$undef"
4371         ;;
4372     esac
4373
4374 else
4375 : perl-5.9.x and later
4376
4377     if test X"$usethreads" = "X$define"; then
4378         case "$use5005threads" in
4379             $define|true|[yY]*)
4380                 $cat >&4 <<EOM
4381
4382 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4383
4384 EOM
4385             ;;
4386         esac
4387     fi
4388
4389     use5005threads="$undef"
4390     useithreads="$usethreads"
4391 fi
4392
4393 case "$d_oldpthreads" in
4394 '')     : Configure tests would be welcome here.  For now, assume undef.
4395         val="$undef" ;;
4396 *)      val="$d_oldpthreads" ;;
4397 esac
4398 set d_oldpthreads
4399 eval $setvar
4400
4401
4402 : Look for a hint-file generated 'call-back-unit'.  If the
4403 : user has specified that a threading perl is to be built,
4404 : we may need to set or change some other defaults.
4405 if $test -f usethreads.cbu; then
4406     echo "Your platform has some specific hints regarding threaded builds, using them..."
4407     . ./usethreads.cbu
4408 else
4409     case "$usethreads" in
4410         "$define"|true|[yY]*)
4411                 $cat <<EOM
4412 (Your platform does not have any specific hints for threaded builds.
4413  Assuming POSIX threads, then.)
4414 EOM
4415         ;;
4416     esac
4417 fi
4418
4419 : Check if multiplicity is required
4420 cat <<EOM
4421
4422 Perl can be built so that multiple Perl interpreters can coexist
4423 within the same Perl executable.
4424 EOM
4425
4426 case "$useithreads" in
4427 $define)
4428         cat <<EOM
4429 This multiple interpreter support is required for interpreter-based threads.
4430 EOM
4431         val="$define"
4432         ;;
4433 *)      case "$usemultiplicity" in
4434         $define|true|[yY]*)     dflt='y';;
4435         *) dflt='n';;
4436         esac
4437         echo " "
4438         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4439         rp='Build Perl for multiplicity?'
4440         . ./myread
4441         case "$ans" in
4442         y|Y)    val="$define" ;;
4443         *)      val="$undef" ;;
4444         esac
4445         ;;
4446 esac
4447 set usemultiplicity
4448 eval $setvar
4449
4450 : Check if usequadmath is requested
4451 case "$usequadmath" in
4452 "$define"|true|[yY]*)
4453         usequadmath="$define"
4454         # if usequadmath enabled also enable uselongdouble
4455         uselongdouble="$define"
4456         ;;
4457 *)      usequadmath="$undef" ;;
4458 esac
4459
4460 : Check if morebits is requested
4461 case "$usemorebits" in
4462 "$define"|true|[yY]*)
4463         use64bitint="$define"
4464         uselongdouble="$define"
4465         usemorebits="$define"
4466         ;;
4467 *)      usemorebits="$undef"
4468         ;;
4469 esac
4470
4471 : Determine the C compiler to be used
4472 echo " "
4473 case "$cc" in
4474 '') dflt=cc;;
4475 *) dflt="$cc";;
4476 esac
4477 rp="Use which C compiler?"
4478 . ./myread
4479 cc="$ans"
4480
4481 : See whether they have no cc but they do have gcc
4482 . ./trygcc
4483 if $test -f cc.cbu; then
4484     . ./cc.cbu
4485 fi
4486 . ./checkcc
4487
4488 : make some quick guesses about what we are up against
4489 echo " "
4490 $echo $n "Hmm...  $c"
4491 echo exit 1 >bsd
4492 echo exit 1 >usg
4493 echo exit 1 >v7
4494 echo exit 1 >osf1
4495 echo exit 1 >eunice
4496 echo exit 1 >xenix
4497 echo exit 1 >venix
4498 echo exit 1 >os2
4499 d_bsd="$undef"
4500 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4501 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4502 then
4503         echo "Looks kind of like an OSF/1 system, but we'll see..."
4504         echo exit 0 >osf1
4505 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4506         xxx=`./loc addbib blurfl $pth`
4507         if $test -f $xxx; then
4508         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4509                 echo exit 0 >bsd
4510                 echo exit 0 >usg
4511         else
4512                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4513                         echo "Looks kind of like an extended USG system, but we'll see..."
4514                 else
4515                         echo "Looks kind of like a USG system, but we'll see..."
4516                 fi
4517                 echo exit 0 >usg
4518         fi
4519 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4520         echo "Looks kind of like a BSD system, but we'll see..."
4521         d_bsd="$define"
4522         echo exit 0 >bsd
4523 else
4524         echo "Looks kind of like a Version 7 system, but we'll see..."
4525         echo exit 0 >v7
4526 fi
4527 case "$eunicefix" in
4528 *unixtovms*)
4529         $cat <<'EOI'
4530 There is, however, a strange, musty smell in the air that reminds me of
4531 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4532 EOI
4533         echo exit 0 >eunice
4534         d_eunice="$define"
4535 : it so happens the Eunice I know will not run shell scripts in Unix format
4536         ;;
4537 *)
4538         echo " "
4539         echo "Congratulations.  You aren't running Eunice."
4540         d_eunice="$undef"
4541         ;;
4542 esac
4543 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4544 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4545 : semicolon as a patch separator
4546 case "$p_" in
4547 :) ;;
4548 *)
4549         $cat <<'EOI'
4550 I have the feeling something is not exactly right, however...don't tell me...
4551 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4552 (Or you may be running DOS with DJGPP.)
4553 EOI
4554         echo exit 0 >os2
4555         ;;
4556 esac
4557 if test -f /xenix; then
4558         echo "Actually, this looks more like a XENIX system..."
4559         echo exit 0 >xenix
4560         d_xenix="$define"
4561 else
4562         echo " "
4563         echo "It's not Xenix..."
4564         d_xenix="$undef"
4565 fi
4566 chmod +x xenix
4567 $eunicefix xenix
4568 if test -f /venix; then
4569         echo "Actually, this looks more like a VENIX system..."
4570         echo exit 0 >venix
4571 else
4572         echo " "
4573         if ./xenix; then
4574                 : null
4575         else
4576                 echo "Nor is it Venix..."
4577         fi
4578 fi
4579 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4580 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4581 $rm -f foo
4582
4583 : Check if we are using GNU gcc and what its version is
4584 echo " "
4585 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4586 $cat >try.c <<EOM
4587 #include <stdio.h>
4588 int main() {
4589 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4590 #ifdef __VERSION__
4591         printf("%s\n", __VERSION__);
4592 #else
4593         printf("%s\n", "1");
4594 #endif
4595 #endif
4596         return(0);
4597 }
4598 EOM
4599 if $cc -o try $ccflags $ldflags try.c; then
4600         gccversion=`$run ./try`
4601         case "$gccversion" in
4602         '') echo "You are not using GNU cc." ;;
4603         *)  echo "You are using GNU cc $gccversion."
4604             ccname=gcc
4605             ;;
4606         esac
4607 else
4608         echo " "
4609         echo "*** WHOA THERE!!! ***" >&4
4610         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4611         case "$knowitall" in
4612         '')
4613         echo "    You'd better start hunting for one and let me know about it." >&4
4614                 exit 1
4615                 ;;
4616         esac
4617 fi
4618 $rm -f try try.*
4619 case "$gccversion" in
4620 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4621 esac
4622 case "$gccversion" in
4623 '') gccosandvers='' ;;
4624 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4625    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4626    gccshortvers=''
4627    case "$gccosandvers" in
4628    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4629    $osname$osvers) ;; # looking good
4630    $osname*) cat <<EOM >&4
4631
4632 *** WHOA THERE!!! ***
4633
4634     Your gcc has not been compiled for the exact release of
4635     your operating system ($gccosandvers versus $osname$osvers).
4636
4637     In general it is a good idea to keep gcc synchronized with
4638     the operating system because otherwise serious problems
4639     may ensue when trying to compile software, like Perl.
4640
4641     I'm trying to be optimistic here, though, and will continue.
4642     If later during the configuration and build icky compilation
4643     problems appear (headerfile conflicts being the most common
4644     manifestation), I suggest reinstalling the gcc to match
4645     your operating system release.
4646
4647 EOM
4648       ;;
4649    *) gccosandvers='' ;; # failed to parse, better be silent
4650    esac
4651    ;;
4652 esac
4653 case "$ccname" in
4654 '') ccname="$cc" ;;
4655 esac
4656
4657 # gcc 3.* complain about adding -Idirectories that they already know about,
4658 # so we will take those off from locincpth.
4659 case "$gccversion" in
4660 3*)
4661     echo "main(){}">try.c
4662     for incdir in $locincpth; do
4663        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4664              grep '^c[cp]p*[01]: warning: changing search order '`
4665        if test "X$warn" != X; then
4666            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4667        fi
4668     done
4669     $rm -f try try.*
4670 esac
4671
4672 # gcc 4.9 by default does some optimizations that break perl.
4673 # see ticket 121505.
4674 #
4675 # The -fwrapv disables those optimizations (and probably others,) so
4676 # for gcc 4.9 (and later, since the optimizations probably won't go
4677 # away), add -fwrapv unless the user requests -fno-wrapv, which
4678 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4679 # which turns the overflows -fwrapv ignores into runtime errors.
4680 case "$gccversion" in
4681 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4682     case "$ccflags" in
4683     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4684     *) ccflags="$ccflags -fwrapv" ;;
4685     esac
4686 esac
4687
4688 : What should the include directory be ?
4689 : Use sysroot if set, so findhdr looks in the right place.
4690 echo " "
4691 $echo $n "Hmm...  $c"
4692 dflt="$sysroot/usr/include"
4693 incpath=''
4694 mips_type=''
4695 if $test -f /bin/mips && /bin/mips; then
4696         echo "Looks like a MIPS system..."
4697         $cat >usr.c <<'EOCP'
4698 #ifdef SYSTYPE_BSD43
4699 /bsd43
4700 #endif
4701 EOCP
4702         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4703                 dflt='/bsd43/usr/include'
4704                 incpath='/bsd43'
4705                 mips_type='BSD 4.3'
4706         else
4707                 mips_type='System V'
4708         fi
4709         $rm -f usr.c usr.out
4710         echo "and you're compiling with the $mips_type compiler and libraries."
4711         xxx_prompt=y
4712         echo "exit 0" >mips
4713 else
4714         echo "Doesn't look like a MIPS system."
4715         xxx_prompt=n
4716         echo "exit 1" >mips
4717 fi
4718 chmod +x mips
4719 $eunicefix mips
4720 case "$usrinc" in
4721 '') ;;
4722 *) dflt="$usrinc";;
4723 esac
4724 case "$xxx_prompt" in
4725 y)      fn=d/
4726         echo " "
4727         rp='Where are the include files you want to use?'
4728         . ./getfile
4729         usrinc="$ans"
4730         ;;
4731 *)      usrinc="$dflt"
4732         ;;
4733 esac
4734
4735 : see how we invoke the C preprocessor
4736 echo " "
4737 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4738 cat <<'EOT' >testcpp.c
4739 #define ABC abc
4740 #define XYZ xyz
4741 ABC.XYZ
4742 EOT
4743 cd ..
4744 if test ! -f cppstdin; then
4745         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4746                 # AIX cc -E doesn't show the absolute headerfile
4747                 # locations but we'll cheat by using the -M flag.
4748                 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
4749         else
4750                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4751         fi
4752 else
4753         echo "Keeping your $hint cppstdin wrapper."
4754 fi
4755 chmod 755 cppstdin
4756 wrapper=`pwd`/cppstdin
4757 ok='false'
4758 cd UU
4759
4760 if $test "X$cppstdin" != "X" && \
4761         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4762         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4763 then
4764         echo "You used to use $cppstdin $cppminus so we'll use that again."
4765         case "$cpprun" in
4766         '') echo "But let's see if we can live without a wrapper..." ;;
4767         *)
4768                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4769                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4770                 then
4771                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4772                         ok='true'
4773                 else
4774                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4775                 fi
4776                 ;;
4777         esac
4778 else
4779         case "$cppstdin" in
4780         '') ;;
4781         *)
4782                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4783                 ;;
4784         esac
4785 fi
4786
4787 if $ok; then
4788         : nothing
4789 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4790         $cc -E <testcpp.c >testcpp.out 2>&1; \
4791         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4792         echo "Yup, it does."
4793         x_cpp="$cc $cppflags -E"
4794         x_minus='';
4795 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4796         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4797         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4798         echo "Yup, it does."
4799         x_cpp="$cc $cppflags -E"
4800         x_minus='-';
4801 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4802         $cc -P <testcpp.c >testcpp.out 2>&1; \
4803         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4804         echo "Yipee, that works!"
4805         x_cpp="$cc $cppflags -P"
4806         x_minus='';
4807 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4808         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4809         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4810         echo "At long last!"
4811         x_cpp="$cc $cppflags -P"
4812         x_minus='-';
4813 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4814         $cpp <testcpp.c >testcpp.out 2>&1; \
4815         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4816         echo "It works!"
4817         x_cpp="$cpp $cppflags"
4818         x_minus='';
4819 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4820         $cpp - <testcpp.c >testcpp.out 2>&1; \
4821         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4822         echo "Hooray, it works!  I was beginning to wonder."
4823         x_cpp="$cpp $cppflags"
4824         x_minus='-';
4825 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4826         $wrapper <testcpp.c >testcpp.out 2>&1; \
4827         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4828         x_cpp="$wrapper"
4829         x_minus=''
4830         echo "Eureka!"
4831 else
4832         dflt=''
4833         rp="No dice.  I can't find a C preprocessor.  Name one:"
4834         . ./myread
4835         x_cpp="$ans"
4836         x_minus=''
4837         $x_cpp <testcpp.c >testcpp.out 2>&1
4838         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4839                 echo "OK, that will do." >&4
4840         else
4841 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4842                 exit 1
4843         fi
4844 fi
4845
4846 case "$ok" in
4847 false)
4848         cppstdin="$x_cpp"
4849         cppminus="$x_minus"
4850         cpprun="$x_cpp"
4851         cpplast="$x_minus"
4852         set X $x_cpp
4853         shift
4854         case "$1" in
4855         "$cpp")
4856                 echo "Perhaps can we force $cc -E using a wrapper..."
4857                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4858                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4859                 then
4860                         echo "Yup, we can."
4861                         cppstdin="$wrapper"
4862                         cppminus='';
4863                 else
4864                         echo "Nope, we'll have to live without it..."
4865                 fi
4866                 ;;
4867         esac
4868         case "$cpprun" in
4869         "$wrapper")
4870                 cpprun=''
4871                 cpplast=''
4872                 ;;
4873         esac
4874         ;;
4875 esac
4876
4877 case "$cppstdin" in
4878 "$wrapper"|'cppstdin') ;;
4879 *) $rm -f $wrapper;;
4880 esac
4881 $rm -f testcpp.c testcpp.out
4882
4883 : Adjust cppfilter for path component separator
4884 case "$osname" in
4885 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4886 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4887 *)   cppfilter='' ;;
4888 esac
4889
4890 : Use gcc to determine libpth and incpth
4891 # If using gcc or clang, we can get better values for libpth, incpth
4892 # and usrinc directly from the compiler.
4893 # Note that ccname for clang is also gcc.
4894 case "$ccname" in
4895     gcc)
4896         $echo 'extern int foo;' > try.c
4897         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4898         shift
4899         if $test $# -gt 0; then
4900             incpth="$incpth $*"
4901             incpth="`$echo $incpth|$sed 's/^ //'`"
4902             for i in $*; do
4903                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4904                 if $test -d $j; then
4905                     libpth="$libpth $j"
4906                 fi
4907             done
4908             libpth="`$echo $libpth|$sed 's/^ //'`"
4909             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4910                 if $test -d $xxx; then
4911                     case " $libpth " in
4912                     *" $xxx "*) ;;
4913                     *) libpth="$libpth $xxx";;
4914                     esac
4915                 fi
4916             done
4917         fi
4918         $rm -f try.c
4919         case "$usrinc" in
4920         '') for i in $incpth; do
4921                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4922                     usrinc="$i"
4923                     break
4924                 fi
4925             done
4926             ;;
4927         esac
4928
4929         case "$usecrosscompile" in
4930         $define|true|[yY]*)
4931             case "$incpth" in
4932                 '') echo "Incpth not defined." >&4; croak=y ;;
4933                 *)  echo "Using incpth '$incpth'." >&4 ;;
4934             esac
4935             case "$libpth" in
4936                 '') echo "Libpth not defined." >&4; croak=y ;;
4937                 *)  echo "Using libpth '$libpth'." >&4 ;;
4938             esac
4939             case "$usrinc" in
4940                 '') echo "Usrinc not defined." >&4; croak=y ;;
4941                 *)  echo "Using usrinc $usrinc." >&4 ;;
4942             esac
4943             case "$croak" in
4944                 y)
4945                 if test "X$sysroot" = X; then
4946                     echo "Cannot continue, aborting." >&4; exit 1
4947                 else
4948                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4949                 fi
4950                 ;;
4951             esac
4952             ;;
4953         esac
4954     ;;
4955 esac
4956
4957 : Default value for incpth is just usrinc
4958 case "$incpth" in
4959 '') incpth="$usrinc";;
4960 esac
4961
4962 : Set private lib path
4963 case "$plibpth" in
4964 '') if ./mips; then
4965         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4966     fi;;
4967 esac
4968 case "$libpth" in
4969 ' ') dlist='';;
4970 '') dlist="$loclibpth $plibpth $glibpth";;
4971 *) dlist="$libpth";;
4972 esac
4973
4974 : Now check and see which directories actually exist, avoiding duplicates
4975 for xxx in $dlist
4976 do
4977     if $test -d $xxx; then
4978                 case " $libpth " in
4979                 *" $xxx "*) ;;
4980                 *) libpth="$libpth $xxx";;
4981                 esac
4982     fi
4983 done
4984 $cat <<'EOM'
4985
4986 Some systems have incompatible or broken versions of libraries.  Among
4987 the directories listed in the question below, please remove any you
4988 know not to be holding relevant libraries, and add any that are needed.
4989 Say "none" for none.
4990
4991 EOM
4992
4993 if test "X$sysroot" != X; then
4994     $cat <<EOM
4995 You have set sysroot to $sysroot, please supply the directories excluding sysroot
4996
4997 EOM
4998 fi
4999
5000 case "$libpth" in
5001 '') dflt='none';;
5002 *)
5003         set X $libpth
5004         shift
5005         dflt=${1+"$@"}
5006         ;;
5007 esac
5008 rp="Directories to use for library searches?"
5009 . ./myread
5010 case "$ans" in
5011 none) libpth=' ';;
5012 *) libpth="$ans";;
5013 esac
5014
5015 : compute shared library extension
5016 case "$so" in
5017 '')
5018         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5019                 dflt='sl'
5020         else
5021                 dflt='so'
5022         fi
5023         ;;
5024 *) dflt="$so";;
5025 esac
5026 $cat <<EOM
5027
5028 On some systems, shared libraries may be available.  Answer 'none' if
5029 you want to suppress searching of shared libraries for the remainder
5030 of this configuration.
5031
5032 EOM
5033 rp='What is the file extension used for shared libraries?'
5034 . ./myread
5035 so="$ans"
5036
5037 : Does target system insist that shared library basenames are unique
5038 $cat << EOM
5039
5040 Some dynamic loaders assume that the *basename* of shared library filenames
5041 are globally unique.  We'll default this to undef as we assume your system
5042 is not this weird. Set to defined if you're on one of them.
5043
5044 EOM
5045
5046 dflt='n'
5047 rp='Make shared library basenames unique?'
5048 . ./myread
5049 case "$ans" in
5050 y|Y) val="$define" ;;
5051 *)   val="$undef"  ;;
5052 esac
5053 set d_libname_unique
5054 eval $setvar
5055
5056 : Define several unixisms.
5057 : Hints files or command line option can be used to override them.
5058 : The convoluted testing is in case hints files set either the old
5059 : or the new name.
5060 case "$_exe" in
5061 '')     case "$exe_ext" in
5062         '')     ;;
5063         *)      _exe="$exe_ext" ;;
5064         esac
5065         ;;
5066 esac
5067 case "$_a" in
5068 '')     case "$lib_ext" in
5069     '') _a='.a';;
5070         *)      _a="$lib_ext" ;;
5071         esac
5072         ;;
5073 esac
5074 case "$_o" in
5075 '') case "$obj_ext" in
5076         '')     _o='.o';;
5077         *)      _o="$obj_ext";;
5078         esac
5079         ;;
5080 esac
5081 case "$p_" in
5082 '') case "$path_sep" in
5083         '')     p_=':';;
5084         *)      p_="$path_sep";;
5085         esac
5086         ;;
5087 esac
5088 exe_ext=$_exe
5089 lib_ext=$_a
5090 obj_ext=$_o
5091 path_sep=$p_
5092
5093 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5094
5095 : Which makefile gets called first.  This is used by make depend.
5096 case "$firstmakefile" in
5097 '') firstmakefile='makefile';;
5098 esac
5099
5100 : Check is we will use socks
5101 case "$usesocks" in
5102 $define|true|[yY]*)     dflt='y';;
5103 *) dflt='n';;
5104 esac
5105 cat <<EOM
5106
5107 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5108 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5109 to use the PerlIO abstraction layer, this will be implicitly selected.
5110
5111 If this doesn't make any sense to you, just accept the default '$dflt'.
5112 EOM
5113 rp='Build Perl for SOCKS?'
5114 . ./myread
5115 case "$ans" in
5116 y|Y)    val="$define" ;;
5117 *)      val="$undef" ;;
5118 esac
5119 set usesocks
5120 eval $setvar
5121
5122 : Check for uselongdouble support
5123 case "$ccflags" in
5124 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5125 esac
5126
5127 case "$uselongdouble" in
5128 $define|true|[yY]*)     dflt='y';;
5129 *) dflt='n';;
5130 esac
5131 cat <<EOM
5132
5133 Perl can be built to take advantage of long doubles which
5134 (if available) may give more accuracy and range for floating point numbers.
5135
5136 If this doesn't make any sense to you, just accept the default '$dflt'.
5137 EOM
5138 rp='Try to use long doubles if available?'
5139 . ./myread
5140 case "$ans" in
5141 y|Y)    val="$define"   ;;
5142 *)      val="$undef"    ;;
5143 esac
5144 set uselongdouble
5145 eval $setvar
5146
5147 case "$uselongdouble" in
5148 true|[yY]*) uselongdouble="$define" ;;
5149 esac
5150
5151 : Look for a hint-file generated 'call-back-unit'.  If the
5152 : user has specified that long doubles should be used,
5153 : we may need to set or change some other defaults.
5154 if $test -f uselongdouble.cbu; then
5155     echo "Your platform has some specific hints regarding long doubles, using them..."
5156     . ./uselongdouble.cbu
5157 else
5158     case "$uselongdouble" in
5159         $define)
5160                 $cat <<EOM
5161 (Your platform does not have any specific hints for long doubles.)
5162 EOM
5163         ;;
5164     esac
5165 fi
5166
5167 : Looking for optional libraries
5168 echo " "
5169 echo "Checking for optional libraries..." >&4
5170 case "$libs" in
5171 ' '|'') dflt='';;
5172 *) dflt="$libs";;
5173 esac
5174 case "$libswanted" in
5175 '') libswanted='c_s';;
5176 esac
5177 case "$usesocks" in
5178 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5179 esac
5180 case "$usecbacktrace" in
5181 "$define") libswanted="$libswanted bfd" ;;
5182 esac
5183 case "$usequadmath" in
5184 "$define") libswanted="$libswanted quadmath" ;;
5185 esac
5186 libsfound=''
5187 libsfiles=''
5188 libsdirs=''
5189 libspath=''
5190 for thisdir in $libpth $xlibpth; do
5191   test -d $thisdir && libspath="$libspath $thisdir"
5192 done
5193 for thislib in $libswanted; do
5194         for thisdir in $libspath; do
5195             xxx=''
5196             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5197                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5198                 $test -f "$xxx" && eval $libscheck
5199                 $test -f "$xxx" && libstyle=shared
5200                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5201                 $test -f "$xxx" && eval $libscheck
5202                 $test -f "$xxx" && libstyle=shared
5203             fi
5204             if test ! -f "$xxx"; then
5205                 xxx=$thisdir/lib$thislib.$so
5206                 $test -f "$xxx" && eval $libscheck
5207                 $test -f "$xxx" && libstyle=shared
5208             fi
5209             if test ! -f "$xxx"; then
5210                 xxx=$thisdir/lib$thislib$_a
5211                 $test -f "$xxx" && eval $libscheck
5212                 $test -f "$xxx" && libstyle=static
5213             fi
5214             if test ! -f "$xxx"; then
5215                 xxx=$thisdir/$thislib$_a
5216                 $test -f "$xxx" && eval $libscheck
5217                 $test -f "$xxx" && libstyle=static
5218             fi
5219             if test ! -f "$xxx"; then
5220                 xxx=$thisdir/lib${thislib}_s$_a
5221                 $test -f "$xxx" && eval $libscheck
5222                 $test -f "$xxx" && libstyle=static
5223                 $test -f "$xxx" && thislib=${thislib}_s
5224             fi
5225             if test ! -f "$xxx"; then
5226                 xxx=$thisdir/Slib$thislib$_a
5227                 $test -f "$xxx" && eval $libscheck
5228                 $test -f "$xxx" && libstyle=static
5229             fi
5230             if $test -f "$xxx"; then
5231                 case "$libstyle" in
5232                 shared) echo "Found -l$thislib (shared)." ;;
5233                 static) echo "Found -l$thislib." ;;
5234                 *)      echo "Found -l$thislib ($libstyle)." ;;
5235                 esac
5236                 case " $dflt " in
5237                 *"-l$thislib "*);;
5238                 *) dflt="$dflt -l$thislib"
5239                    libsfound="$libsfound $xxx"
5240                    yyy=`basename $xxx`
5241                    libsfiles="$libsfiles $yyy"
5242                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5243                    case " $libsdirs " in
5244                    *" $yyy "*) ;;
5245                    *) libsdirs="$libsdirs $yyy" ;;
5246                    esac
5247                    ;;
5248                 esac
5249                 break
5250             fi
5251         done
5252         if $test ! -f "$xxx"; then
5253             echo "No -l$thislib."
5254         fi
5255 done
5256 set X $dflt
5257 shift
5258 dflt="$*"
5259 case "$libs" in
5260 '') dflt="$dflt";;
5261 *) dflt="$libs";;
5262 esac
5263 case "$dflt" in
5264 ' '|'') dflt='none';;
5265 esac
5266
5267 $cat <<EOM
5268
5269 In order to compile $package on your machine, a number of libraries
5270 are usually needed.  Include any other special libraries here as well.
5271 Say "none" for none.  The default list is almost always right.
5272 EOM
5273
5274 echo " "
5275 rp="What libraries to use?"
5276 . ./myread
5277 case "$ans" in
5278 none) libs=' ';;
5279 *) libs="$ans";;
5280 esac
5281
5282 : determine optimization, if desired, or use for debug flag also
5283 case "$optimize" in
5284 ' '|$undef) dflt='none';;
5285 '') dflt='-O';;
5286 *) dflt="$optimize";;
5287 esac
5288 $cat <<EOH
5289
5290 By default, $package compiles with the -O flag to use the optimizer.
5291 Alternately, you might want to use the symbolic debugger, which uses
5292 the -g flag (on traditional Unix systems).  Either flag can be
5293 specified here.  To use neither flag, specify the word "none".
5294
5295 EOH
5296 rp="What optimizer/debugger flag should be used?"
5297 . ./myread
5298 optimize="$ans"
5299 case "$optimize" in
5300 'none') optimize=" ";;
5301 esac
5302
5303 : Check what DEBUGGING is required from the command line
5304 : -DEBUGGING      or -DDEBUGGING or
5305 : -DEBUGGING=both                       = -g + -DDEBUGGING
5306 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5307 : -DEBUGGING=none or -UDEBUGGING        =
5308 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5309 case "$EBUGGING" in
5310 '')     ;;
5311 *)      DEBUGGING=$EBUGGING ;;
5312 esac
5313
5314 case "$DEBUGGING" in
5315 -g|both|$define)
5316     case "$optimize" in
5317         *-g*) ;;
5318         *)    optimize="$optimize -g" ;;
5319     esac ;;
5320 none|$undef)
5321     case "$optimize" in
5322         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5323                 shift
5324                 optimize="$*"
5325                 ;;
5326     esac ;;
5327 esac
5328
5329 dflt=''
5330 case "$DEBUGGING" in
5331 both|$define) dflt='-DDEBUGGING'
5332 esac
5333
5334 : argument order is deliberate, as the flag will start with - which set could
5335 : think is an option
5336 checkccflag='check=$1; flag=$2; callback=$3;
5337 echo " ";
5338 echo "Checking if your compiler accepts $flag" 2>&1;
5339 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5340 echo "int main(void) { return 0; }" > gcctest.c;
5341 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5342     echo "Yes, it does." 2>&1;
5343     if $test -s gcctest.out ; then
5344         echo "But your platform does not like it:";
5345         cat gcctest.out;
5346     else
5347         case "$ccflags" in
5348         *$check*)
5349             echo "Leaving current flags $ccflags alone." 2>&1
5350             ;;
5351         *) dflt="$dflt $flag";
5352             eval $callback
5353             ;;
5354         esac
5355     fi
5356 else
5357     echo "Nope, it does not, but that is ok." 2>&1;
5358 fi
5359 '
5360
5361 : We will not override a previous value, but we might want to
5362 : augment a hint file
5363 case "$hint" in
5364 default|recommended)
5365         case "$gccversion" in
5366         1*) dflt="$dflt -fpcc-struct-return" ;;
5367         esac
5368         case "$optimize:$DEBUGGING" in
5369         *-g*:old) dflt="$dflt -DDEBUGGING";;
5370         esac
5371         case "$gccversion" in
5372         2*) if $test -d /etc/conf/kconfig.d &&
5373                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5374                 then
5375                         # Interactive Systems (ISC) POSIX mode.
5376                         dflt="$dflt -posix"
5377                 fi
5378                 ;;
5379         esac
5380         case "$gccversion" in
5381         1*) ;;
5382         2.[0-8]*) ;;
5383         ?*)     set strict-aliasing -fno-strict-aliasing
5384                 eval $checkccflag
5385                 ;;
5386         esac
5387         # For gcc, adding -pipe speeds up compilations for some, but apparently
5388         # some assemblers can't read from stdin.  (It also slows down compilations
5389         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5390         case "$gccversion" in
5391         ?*)     set pipe -pipe
5392                 eval $checkccflag
5393                 ;;
5394         esac
5395
5396         # on x86_64 (at least) we require an extra library (libssp) in the
5397         # link command line. This library is not named, so I infer that it is
5398         # an implementation detail that may change. Hence the safest approach
5399         # is to add the flag to the flags passed to the compiler at link time,
5400         # as that way the compiler can do the right implementation dependant
5401         # thing. (NWC)
5402         case "$gccversion" in
5403         ?*)     set stack-protector-strong -fstack-protector-strong
5404                 eval $checkccflag
5405                 case "$dflt" in
5406                 *-fstack-protector-strong*) ;; # It got added.
5407                 *) # Try the plain/older -fstack-protector.
5408                    set stack-protector -fstack-protector
5409                    eval $checkccflag
5410                    ;;
5411                 esac
5412                 ;;
5413         esac
5414         ;;
5415 esac
5416
5417 case "$mips_type" in
5418 *BSD*|'') inclwanted="$locincpth $usrinc";;
5419 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5420 esac
5421 for thisincl in $inclwanted; do
5422         if $test -d $thisincl; then
5423                 if $test x$thisincl != x$usrinc; then
5424                         case "$dflt" in
5425                         *" -I$thisincl "*);;
5426                         *) dflt="$dflt -I$thisincl ";;
5427                         esac
5428                 fi
5429         fi
5430 done
5431
5432 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5433         xxx=true;
5434 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5435         xxx=true;
5436 else
5437         xxx=false;
5438 fi;
5439 if $xxx; then
5440         case "$dflt" in
5441         *$2*);;
5442         *) dflt="$dflt -D$2";;
5443         esac;
5444 fi'
5445
5446 set signal.h LANGUAGE_C; eval $inctest
5447
5448 case "$usesocks" in
5449 $define)
5450         ccflags="$ccflags -DSOCKS"
5451         ;;
5452 esac
5453
5454 case "$hint" in
5455 default|recommended) dflt="$ccflags $dflt" ;;
5456 *) dflt="$ccflags";;
5457 esac
5458
5459 case "$dflt" in
5460 ''|' ') dflt=none;;
5461 esac
5462
5463 $cat <<EOH
5464
5465 Your C compiler may want other flags.  For this question you should include
5466 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5467 but you should NOT include libraries or ld flags like -lwhatever.  If you
5468 want $package to honor its debug switch, you should include -DDEBUGGING here.
5469 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5470
5471 To use no flags, specify the word "none".
5472
5473 EOH
5474 set X $dflt
5475 shift
5476 dflt=${1+"$@"}
5477 rp="Any additional cc flags?"
5478 . ./myread
5479 case "$ans" in
5480 none) ccflags='';;
5481 *) ccflags="$ans";;
5482 esac
5483
5484 : the following weeds options from ccflags that are of no interest to cpp
5485 case "$cppflags" in
5486 '') cppflags="$ccflags" ;;
5487 *)  cppflags="$cppflags $ccflags" ;;
5488 esac
5489 case "$gccversion" in
5490 1*) cppflags="$cppflags -D__GNUC__"
5491 esac
5492 case "$mips_type" in
5493 '');;
5494 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5495 esac
5496 case "$cppflags" in
5497 '');;
5498 *)
5499         echo " "
5500         echo "Let me guess what the preprocessor flags are..." >&4
5501         set X $cppflags
5502         shift
5503         cppflags=''
5504         $cat >cpp.c <<'EOM'
5505 #define BLURFL foo
5506
5507 BLURFL xx LFRULB
5508 EOM
5509         previous=''
5510         for flag in $*
5511         do
5512                 case "$flag" in
5513                 -*) ftry="$flag";;
5514                 *) ftry="$previous $flag";;
5515                 esac
5516                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5517                         >cpp1.out 2>/dev/null && \
5518                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5519                         >cpp2.out 2>/dev/null && \
5520                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5521                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5522                 then
5523                         cppflags="$cppflags $ftry"
5524                         previous=''
5525                 else
5526                         previous="$flag"
5527                 fi
5528         done
5529         set X $cppflags
5530         shift
5531         cppflags=${1+"$@"}
5532         case "$cppflags" in
5533         *-*)  echo "They appear to be: $cppflags";;
5534         esac
5535         $rm -f cpp.c cpp?.out
5536         ;;
5537 esac
5538
5539 : flags used in final linking phase
5540 case "$ldflags" in
5541 '') if ./venix; then
5542                 dflt='-i -z'
5543         else
5544                 dflt=''
5545         fi
5546         case "$ccflags" in
5547         *-posix*) dflt="$dflt -posix" ;;
5548         esac
5549         ;;
5550 *) dflt="$ldflags";;
5551 esac
5552 # See note above about -fstack-protector
5553 case "$ccflags" in
5554 *-fstack-protector-strong*)
5555         case "$dflt" in
5556         *-fstack-protector-strong*) ;; # Don't add it again
5557         *) dflt="$dflt -fstack-protector-strong" ;;
5558         esac
5559         ;;
5560 *-fstack-protector*)
5561         case "$dflt" in
5562         *-fstack-protector*) ;; # Don't add it again
5563         *) dflt="$dflt -fstack-protector" ;;
5564         esac
5565         ;;
5566 esac
5567
5568 : Try to guess additional flags to pick up local libraries.
5569 for thislibdir in $libpth; do
5570         case " $loclibpth " in
5571         *" $thislibdir "*)
5572                 case "$dflt " in
5573                 *"-L$thislibdir "*) ;;
5574                 *)  dflt="$dflt -L$thislibdir" ;;
5575                 esac
5576                 ;;
5577         esac
5578 done
5579
5580 case "$dflt" in
5581 '') dflt='none' ;;
5582 esac
5583
5584 $cat <<EOH
5585
5586 Your C linker may need flags.  For this question you should
5587 include -L/whatever and any other flags used by the C linker, but you
5588 should NOT include libraries like -lwhatever.
5589
5590 Make sure you include the appropriate -L/path flags if your C linker
5591 does not normally search all of the directories you specified above,
5592 namely
5593         $libpth
5594 To use no flags, specify the word "none".
5595
5596 EOH
5597
5598 rp="Any additional ld flags (NOT including libraries)?"
5599 . ./myread
5600 case "$ans" in
5601 none) ldflags='';;
5602 *) ldflags="$ans";;
5603 esac
5604 rmlist="$rmlist pdp11"
5605
5606 : coherency check
5607 echo " "
5608 echo "Checking your choice of C compiler and flags for coherency..." >&4
5609 $cat > try.c <<'EOF'
5610 #include <stdio.h>
5611 int main() { printf("Ok\n"); return(0); }
5612 EOF
5613 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5614 shift
5615 $cat >try.msg <<'EOM'
5616 I've tried to compile and run the following simple program:
5617
5618 EOM
5619 $cat try.c >> try.msg
5620
5621 $cat >> try.msg <<EOM
5622
5623 I used the command:
5624
5625         $*
5626         $run ./try
5627
5628 and I got the following output:
5629
5630 EOM
5631 dflt=y
5632 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5633         if $sh -c "$run ./try " >>try.msg 2>&1; then
5634                 xxx=`$run ./try`
5635                 case "$xxx" in
5636                 "Ok") dflt=n ;;
5637                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5638                 esac
5639         else
5640                 echo "The program compiled OK, but exited with status $?." >>try.msg
5641                 rp="You have a problem.  Shall I abort Configure"
5642                 dflt=y
5643         fi
5644 else
5645         echo "I can't compile the test program." >>try.msg
5646         rp="You have a BIG problem.  Shall I abort Configure"
5647         dflt=y
5648 fi
5649 case "$dflt" in
5650 y)
5651         $cat try.msg >&4
5652         case "$knowitall" in
5653         '')
5654                 echo "(The supplied flags or libraries might be incorrect.)"
5655                 ;;
5656         *) dflt=n;;
5657         esac
5658         echo " "
5659         . ./myread
5660         case "$ans" in
5661         n*|N*) ;;
5662         *)      echo "Ok.  Stopping Configure." >&4
5663                 exit 1
5664                 ;;
5665         esac
5666         ;;
5667 n) echo "OK, that should do.";;
5668 esac
5669 $rm_try gcctest gcctest.out
5670
5671 : define a shorthand compile call
5672 compile='
5673 mc_file=$1;
5674 shift;
5675 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5676 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5677 exit 1;
5678 fi;
5679 esac;
5680 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5681 : define a shorthand compile call for compilations that should be ok.
5682 compile_ok='
5683 mc_file=$1;
5684 shift;
5685 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5686
5687 : determine filename position in cpp output
5688 echo " "
5689 echo "Computing filename position in cpp output for #include directives..." >&4
5690 case "$osname" in
5691 vos) testaccess=-e ;;
5692 *)   testaccess=-r ;;
5693 esac
5694 echo '#include <stdio.h>' > foo.c
5695 $cat >fieldn <<EOF
5696 $startsh
5697 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5698 $grep '^[       ]*#.*stdio\.h' | \
5699 while read cline; do
5700         pos=1
5701         set \$cline
5702         while $test \$# -gt 0; do
5703                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5704                         echo "\$pos"
5705                         exit 0
5706                 fi
5707                 shift
5708                 pos=\`expr \$pos + 1\`
5709         done
5710 done
5711 EOF
5712 chmod +x fieldn
5713 fieldn=`./fieldn`
5714 $rm -f foo.c fieldn
5715 case $fieldn in
5716 '') pos='???';;
5717 1) pos=first;;
5718 2) pos=second;;
5719 3) pos=third;;
5720 *) pos="${fieldn}th";;
5721 esac
5722 echo "Your cpp writes the filename in the $pos field of the line."
5723
5724 : locate header file
5725 $cat >findhdr <<EOF
5726 $startsh
5727 wanted=\$1
5728 name=''
5729 for usrincdir in $incpth
5730 do
5731         if test -f \$usrincdir/\$wanted; then
5732                 echo "\$usrincdir/\$wanted"
5733                 exit 0
5734         fi
5735 done
5736 awkprg='{ print \$$fieldn }'
5737 echo "#include <\$wanted>" > foo\$\$.c
5738 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5739 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5740 while read cline; do
5741         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5742         case "\$name" in
5743         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5744         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5745         *) exit 2;;
5746         esac;
5747 done;
5748 #
5749 # status = 0: grep returned 0 lines, case statement not executed
5750 # status = 1: headerfile found
5751 # status = 2: while loop executed, no headerfile found
5752 #
5753 status=\$?
5754 $rm -f foo\$\$.c;
5755 if test \$status -eq 1; then
5756         exit 0;
5757 fi
5758 exit 1
5759 EOF
5760 chmod +x findhdr
5761
5762 : define an alternate in-header-list? function
5763 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5764 cont=true; xxf="echo \"<\$1> found.\" >&4";
5765 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5766 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5767 esac;
5768 case $# in 4) instead=instead;; *) instead="at last";; esac;
5769 while $test "$cont"; do
5770         xxx=`./findhdr $1`
5771         var=$2; eval "was=\$$2";
5772         if $test "$xxx" && $test -r "$xxx";
5773         then eval $xxf;
5774         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5775                 cont="";
5776         else eval $xxnf;
5777         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5778         set $yyy; shift; shift; yyy=$@;
5779         case $# in 0) cont="";;
5780         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5781                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5782         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5783                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5784         esac;
5785 done;
5786 while $test "$yyy";
5787 do set $yyy; var=$2; eval "was=\$$2";
5788         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5789         set $yyy; shift; shift; yyy=$@;
5790 done'
5791
5792 : see if stdlib is available
5793 set stdlib.h i_stdlib
5794 eval $inhdr
5795
5796 : check for lengths of integral types
5797 echo " "
5798 case "$intsize" in
5799 '')
5800         echo "Checking to see how big your integers are..." >&4
5801         $cat >try.c <<EOCP
5802 #include <stdio.h>
5803 #$i_stdlib I_STDLIB
5804 #ifdef I_STDLIB
5805 #include <stdlib.h>
5806 #endif
5807 int main()
5808 {
5809         printf("intsize=%d;\n", (int)sizeof(int));
5810         printf("longsize=%d;\n", (int)sizeof(long));
5811         printf("shortsize=%d;\n", (int)sizeof(short));
5812         exit(0);
5813 }
5814 EOCP
5815         set try
5816         if eval $compile_ok && $run ./try > /dev/null; then
5817                 eval `$run ./try`
5818                 echo "Your integers are $intsize bytes long."
5819                 echo "Your long integers are $longsize bytes long."
5820                 echo "Your short integers are $shortsize bytes long."
5821         else
5822                 $cat >&4 <<EOM
5823 !
5824 Help! I can't compile and run the intsize test program: please enlighten me!
5825 (This is probably a misconfiguration in your system or libraries, and
5826 you really ought to fix it.  Still, I'll try anyway.)
5827 !
5828 EOM
5829                 dflt=4
5830                 rp="What is the size of an integer (in bytes)?"
5831                 . ./myread
5832                 intsize="$ans"
5833                 dflt=$intsize
5834                 rp="What is the size of a long integer (in bytes)?"
5835                 . ./myread
5836                 longsize="$ans"
5837                 dflt=2
5838                 rp="What is the size of a short integer (in bytes)?"
5839                 . ./myread
5840                 shortsize="$ans"
5841         fi
5842         ;;
5843 esac
5844 $rm_try
5845
5846 : check for long long
5847 echo " "
5848 echo "Checking to see if you have long long..." >&4
5849 echo 'int main() { long long x = 7; return 0; }' > try.c
5850 set try
5851 if eval $compile; then
5852         val="$define"
5853         echo "You have long long."
5854 else
5855         val="$undef"
5856         echo "You do not have long long."
5857 fi
5858 $rm_try
5859 set d_longlong
5860 eval $setvar
5861
5862 : check for length of long long
5863 case "${d_longlong}${longlongsize}" in
5864 $define)
5865         echo " "
5866         echo "Checking to see how big your long longs are..." >&4
5867         $cat >try.c <<'EOCP'
5868 #include <stdio.h>
5869 int main()
5870 {
5871     printf("%d\n", (int)sizeof(long long));
5872     return(0);
5873 }
5874 EOCP
5875         set try
5876         if eval $compile_ok; then
5877                 longlongsize=`$run ./try`
5878                 echo "Your long longs are $longlongsize bytes long."
5879         else
5880                 dflt='8'
5881                 echo " "
5882                 echo "(I can't seem to compile the test program.  Guessing...)"
5883                 rp="What is the size of a long long (in bytes)?"
5884                 . ./myread
5885                 longlongsize="$ans"
5886         fi
5887         if $test "X$longsize" = "X$longlongsize"; then
5888                 echo "(That isn't any different from an ordinary long.)"
5889         fi
5890         ;;
5891 esac
5892 $rm_try
5893
5894 : see if inttypes.h is available
5895 : we want a real compile instead of Inhdr because some systems
5896 : have an inttypes.h which includes non-existent headers
5897 echo " "
5898 $cat >try.c <<EOCP
5899 #include <inttypes.h>
5900 int main() {
5901         static int32_t foo32 = 0x12345678;
5902 }
5903 EOCP
5904 set try
5905 if eval $compile; then
5906         echo "<inttypes.h> found." >&4
5907         val="$define"
5908 else
5909         echo "<inttypes.h> NOT found." >&4
5910         val="$undef"
5911 fi
5912 $rm_try
5913 set i_inttypes
5914 eval $setvar
5915
5916 : check for int64_t
5917 echo " "
5918 echo "Checking to see if you have int64_t..." >&4
5919 $cat >try.c <<EOCP
5920 #include <sys/types.h>
5921 #$i_inttypes I_INTTYPES
5922 #ifdef I_INTTYPES
5923 #include <inttypes.h>
5924 #endif
5925 int main() { int64_t x = 7; }
5926 EOCP
5927 set try
5928 if eval $compile; then
5929         val="$define"
5930         echo "You have int64_t."
5931 else
5932         val="$undef"
5933         echo "You do not have int64_t."
5934 fi
5935 $rm_try
5936 set d_int64_t
5937 eval $setvar
5938
5939 : Check if 64bit ints have a quad type
5940 echo " "
5941 echo "Checking which 64-bit integer type we could use..." >&4
5942
5943 case "$intsize" in
5944 8) val=int
5945    set quadtype
5946    eval $setvar
5947    val='"unsigned int"'
5948    set uquadtype
5949    eval $setvar
5950    quadkind=1
5951    ;;
5952 *) case "$longsize" in
5953    8) val=long
5954       set quadtype
5955       eval $setvar
5956       val='"unsigned long"'
5957       set uquadtype
5958       eval $setvar
5959       quadkind=2
5960       ;;
5961    *) case "$d_longlong:$longlongsize" in
5962       define:8)
5963         val='"long long"'
5964         set quadtype
5965         eval $setvar
5966         val='"unsigned long long"'
5967         set uquadtype
5968         eval $setvar
5969         quadkind=3
5970         ;;
5971       *) case "$d_int64_t" in
5972          define)
5973            val=int64_t
5974            set quadtype
5975            eval $setvar
5976            val=uint64_t
5977            set uquadtype
5978            eval $setvar
5979            quadkind=4
5980            ;;
5981          esac
5982          ;;
5983       esac
5984       ;;
5985    esac
5986    ;;
5987 esac
5988
5989 case "$quadtype" in
5990 '')     echo "Alas, no 64-bit integer types in sight." >&4
5991         d_quad="$undef"
5992         ;;
5993 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5994         d_quad="$define"
5995         ;;
5996 esac
5997
5998 : Do we want 64bit support
5999 case "$uselonglong" in
6000 "$define"|true|[yY]*)
6001         cat <<EOM >&4
6002
6003 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6004 EOM
6005         use64bitint="$define"
6006         ;;
6007 esac
6008 case "$use64bits" in
6009 "$define"|true|[yY]*)
6010         cat <<EOM >&4
6011
6012 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6013 EOM
6014         use64bitint="$define"
6015         ;;
6016 esac
6017 case "$use64bitints" in
6018 "$define"|true|[yY]*)
6019         cat <<EOM >&4
6020
6021 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6022 EOM
6023         use64bitint="$define"
6024         ;;
6025 esac
6026 case "$use64bitsint" in
6027 "$define"|true|[yY]*)
6028         cat <<EOM >&4
6029
6030 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6031 EOM
6032         use64bitint="$define"
6033         ;;
6034 esac
6035 case "$uselonglongs" in
6036 "$define"|true|[yY]*)
6037         cat <<EOM >&4
6038
6039 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6040 EOM
6041         use64bitint="$define"
6042         ;;
6043 esac
6044 case "$use64bitsall" in
6045 "$define"|true|[yY]*)
6046         cat <<EOM >&4
6047
6048 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6049 EOM
6050         use64bitall="$define"
6051         ;;
6052 esac
6053
6054 case "$ccflags" in
6055 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6056 esac
6057 case "$use64bitall" in
6058 "$define"|true|[yY]*) use64bitint="$define" ;;
6059 esac
6060
6061 case "$longsize" in
6062 8) cat <<EOM
6063
6064 You have natively 64-bit long integers.
6065 EOM
6066    val="$define"
6067    ;;
6068 *) case "$use64bitint" in
6069    "$define"|true|[yY]*) dflt='y';;
6070    *) dflt='n';;
6071    esac
6072    case "$d_quad" in
6073    "$define") ;;
6074    *) dflt='n' ;;
6075    esac
6076    cat <<EOM
6077
6078 Perl can be built to take advantage of 64-bit integer types
6079 on some systems.  To do so, Configure can be run with -Duse64bitint.
6080 Choosing this option will most probably introduce binary incompatibilities.
6081
6082 If this doesn't make any sense to you, just accept the default '$dflt'.
6083 (The default has been chosen based on your configuration.)
6084 EOM
6085    rp='Try to use 64-bit integers, if available?'
6086    . ./myread
6087    case "$ans" in
6088    [yY]*) val="$define" ;;
6089    *)     val="$undef"  ;;
6090    esac
6091    ;;
6092 esac
6093 set use64bitint
6094 eval $setvar
6095
6096 case "$use64bitall" in
6097 "$define"|true|[yY]*) dflt='y' ;;
6098 *) case "$longsize" in
6099    8) dflt='y' ;;
6100    *) dflt='n' ;;
6101    esac
6102    ;;
6103 esac
6104 cat <<EOM
6105
6106 You may also choose to try maximal 64-bitness.  It means using as much
6107 64-bitness as possible on the platform.  This in turn means even more
6108 binary incompatibilities.  On the other hand, your platform may not
6109 have any more 64-bitness available than what you already have chosen.
6110
6111 If this doesn't make any sense to you, just accept the default '$dflt'.
6112 (The default has been chosen based on your configuration.)
6113 EOM
6114 rp='Try to use maximal 64-bit support, if available?'
6115 . ./myread
6116 case "$ans" in
6117 [yY]*) val="$define" ;;
6118 *)     val="$undef"  ;;
6119 esac
6120 set use64bitall
6121 eval $setvar
6122 case "$use64bitall" in
6123 "$define")
6124         case "$use64bitint" in
6125         "$undef")
6126                 cat <<EOM
6127
6128 Since you have chosen a maximally 64-bit build, I'm also turning on
6129 the use of 64-bit integers.
6130 EOM
6131                 use64bitint="$define" ;;
6132         esac
6133         ;;
6134 esac
6135
6136 : Look for a hint-file generated 'call-back-unit'.  If the
6137 : user has specified that a 64-bit perl is to be built,
6138 : we may need to set or change some other defaults.
6139 if $test -f use64bitint.cbu; then
6140         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6141         . ./use64bitint.cbu
6142 fi
6143 case "$use64bitint" in
6144 "$define"|true|[yY]*)
6145         : This test was common to all the OpenBSD forks, and seems harmless for
6146         : other platforms:
6147         echo " "
6148         echo "Checking if your C library has broken 64-bit functions..." >&4
6149         cat >try.c <<EOCP
6150 #include <stdio.h>
6151 typedef $uquadtype myULL;
6152 int main (void)
6153 {
6154     struct {
6155         double d;
6156         myULL  u;
6157     } *p, test[] = {
6158         {4294967303.15, 4294967303ULL},
6159         {4294967294.2,  4294967294ULL},
6160         {4294967295.7,  4294967295ULL},
6161         {0.0, 0ULL}
6162     };
6163     for (p = test; p->u; p++) {
6164         myULL x = (myULL)p->d;
6165         if (x != p->u) {
6166             printf("buggy\n");
6167             return 0;
6168         }
6169     }
6170     printf("ok\n");
6171     return 0;
6172 }
6173 EOCP
6174         set try
6175         if eval $compile_ok; then
6176             libcquad=`$run ./try`
6177             echo "Your C library's 64-bit functions are $libcquad."
6178         else
6179             echo "(I can't seem to compile the test program.)"
6180             echo "Assuming that your C library's 64-bit functions are ok."
6181             libcquad="ok"
6182         fi
6183         $rm_try
6184
6185         case "$libcquad" in
6186             buggy*)
6187                 cat >&4 <<EOM
6188
6189 *** You have a C library with broken 64-bit functions.
6190 *** 64-bit support does not work reliably in this configuration.
6191 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6192 *** Cannot continue, aborting.
6193
6194 EOM
6195                 exit 1
6196                 ;;
6197         esac
6198         case "$longsize" in
6199         4) case "$archname64" in
6200            '') archname64=64int ;;
6201            esac
6202            ;;
6203         esac
6204         ;;
6205 esac
6206
6207 : Look for a hint-file generated 'call-back-unit'.  If the
6208 : user has specified that a maximally 64-bit perl is to be built,
6209 : we may need to set or change some other defaults.
6210 if $test -f use64bitall.cbu; then
6211         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6212         . ./use64bitall.cbu
6213 fi
6214 case "$use64bitall" in
6215 "$define"|true|[yY]*)
6216         case "$longsize" in
6217         4) case "$archname64" in
6218            ''|64int) archname64=64all ;;
6219            esac
6220            ;;
6221         esac
6222         ;;
6223 esac
6224
6225 case "$d_quad:$use64bitint" in
6226 $undef:$define)
6227         cat >&4 <<EOF
6228
6229 *** You have chosen to use 64-bit integers,
6230 *** but none can be found.
6231 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6232 *** Cannot continue, aborting.
6233
6234 EOF
6235         exit 1
6236         ;;
6237 esac
6238
6239 : Check if we are using the GNU C library
6240 echo " "
6241 echo "Checking for GNU C Library..." >&4
6242 cat >try.c <<'EOCP'
6243 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6244    alone are insufficient to distinguish different versions, such as
6245    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6246    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6247 */
6248 #include <stdio.h>
6249 int main(void)
6250 {
6251 #ifdef __GLIBC__
6252 #   ifdef __GLIBC_MINOR__
6253 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6254 #           include <gnu/libc-version.h>
6255             printf("%s\n",  gnu_get_libc_version());
6256 #       else
6257             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6258 #       endif
6259 #   else
6260         printf("%d\n",  __GLIBC__);
6261 #   endif
6262     return 0;
6263 #else
6264     return 1;
6265 #endif
6266 }
6267 EOCP
6268 set try
6269 if eval $compile_ok && $run ./try > glibc.ver; then
6270         val="$define"
6271         gnulibc_version=`$cat glibc.ver`
6272         echo "You are using the GNU C Library version $gnulibc_version"
6273 else
6274         val="$undef"
6275         gnulibc_version=''
6276         echo "You are not using the GNU C Library"
6277 fi
6278 $rm_try glibc.ver
6279 set d_gnulibc
6280 eval $setvar
6281
6282 : see if nm is to be used to determine whether a symbol is defined or not
6283 case "$usenm" in
6284 '')
6285         dflt=''
6286         case "$d_gnulibc" in
6287         "$define")
6288                 echo " "
6289                 echo "nm probably won't work on the GNU C Library." >&4
6290                 dflt=n
6291                 ;;
6292         esac
6293         case "$dflt" in
6294         '')
6295                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6296                         echo " "
6297                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6298                         echo "'nm' won't be sufficient on this system." >&4
6299                         dflt=n
6300                 fi
6301                 ;;
6302         esac
6303         case "$dflt" in
6304         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6305                 if $test $dflt -gt 20; then
6306                         dflt=y
6307                 else
6308                         dflt=n
6309                 fi
6310                 ;;
6311         esac
6312         ;;
6313 *)
6314         case "$usenm" in
6315         true|$define) dflt=y;;
6316         *) dflt=n;;
6317         esac
6318         ;;
6319 esac
6320 $cat <<EOM
6321
6322 I can use $nm to extract the symbols from your C libraries. This
6323 is a time consuming task which may generate huge output on the disk (up
6324 to 3 megabytes) but that should make the symbols extraction faster. The
6325 alternative is to skip the 'nm' extraction part and to compile a small
6326 test program instead to determine whether each symbol is present. If
6327 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6328 this may be the best solution.
6329
6330 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6331
6332 EOM
6333 rp="Shall I use $nm to extract C symbols from the libraries?"
6334 . ./myread
6335 case "$ans" in
6336 [Nn]*) usenm=false;;
6337 *) usenm=true;;
6338 esac
6339
6340 runnm=$usenm
6341 case "$reuseval" in
6342 true) runnm=false;;
6343 esac
6344
6345 : nm options which may be necessary
6346 case "$nm_opt" in
6347 '') if $test -f /mach_boot; then
6348                 nm_opt=''       # Mach
6349         elif $test -d /usr/ccs/lib; then
6350                 nm_opt='-p'     # Solaris (and SunOS?)
6351         elif $test -f /dgux; then
6352                 nm_opt='-p'     # DG-UX
6353         elif $test -f /lib64/rld; then
6354                 nm_opt='-p'     # 64-bit Irix
6355         else
6356                 nm_opt=''
6357         fi;;
6358 esac
6359
6360 : nm options which may be necessary for shared libraries but illegal
6361 : for archive libraries.  Thank you, Linux.
6362 case "$nm_so_opt" in
6363 '')     case "$myuname" in
6364         *linux*|gnu*)
6365                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6366                         nm_so_opt='--dynamic'
6367                 fi
6368                 ;;
6369         esac
6370         ;;
6371 esac
6372
6373 : Figure out where the libc is located
6374 case "$runnm" in
6375 true)
6376 : get list of predefined functions in a handy place
6377 echo " "
6378 case "$libc" in
6379 '') libc=unknown
6380         case "$libs" in
6381         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6382         esac
6383         ;;
6384 esac
6385 case "$libs" in
6386 '') ;;
6387 *)  for thislib in $libs; do
6388         case "$thislib" in
6389         -lc|-lc_s)
6390                 : Handle C library specially below.
6391                 ;;
6392         -l*)
6393                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6394                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6395                         :
6396                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6397                         :
6398                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6399                         :
6400                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6401                         :
6402                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6403                         :
6404                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6405                         :
6406                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6407                         :
6408                 else
6409                         try=''
6410                 fi
6411                 libnames="$libnames $try"
6412                 ;;
6413         *) libnames="$libnames $thislib" ;;
6414         esac
6415         done
6416         ;;
6417 esac
6418 xxx=normal
6419 case "$libc" in
6420 unknown)
6421         set /lib/libc.$so
6422         for xxx in $libpth; do
6423                 $test -r $1 || set $xxx/libc.$so
6424                 : The messy sed command sorts on library version numbers.
6425                 $test -r $1 || \
6426                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6427                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6428                                 h
6429                                 s/[0-9][0-9]*/0000&/g
6430                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6431                                 G
6432                                 s/\n/ /' | \
6433                          $sort | $sed -e 's/^.* //'`
6434                 eval set \$$#
6435         done
6436         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6437         $test -r $1 || set $sysroot/lib/libsys_s$_a
6438         ;;
6439 *)
6440         set blurfl
6441         ;;
6442 esac
6443 if $test -r "$1"; then
6444         echo "Your (shared) C library seems to be in $1."
6445         libc="$1"
6446 elif $test -r /lib/libc && $test -r /lib/clib; then
6447         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6448         xxx=apollo
6449         libc='/lib/clib /lib/libc'
6450         if $test -r /lib/syslib; then
6451                 echo "(Your math library is in /lib/syslib.)"
6452                 libc="$libc /lib/syslib"
6453         fi
6454 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6455         echo "Your C library seems to be in $libc, as you said before."
6456 elif $test -r $incpath/usr/lib/libc$_a; then
6457         libc=$incpath/usr/lib/libc$_a;
6458         echo "Your C library seems to be in $libc.  That's fine."
6459 elif $test -r /lib/libc$_a; then
6460         libc=/lib/libc$_a;
6461         echo "Your C library seems to be in $libc.  You're normal."
6462 else
6463         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6464                 :
6465         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6466                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6467         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6468                 :
6469         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6470                 :
6471         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6472                 :
6473         else
6474                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6475         fi
6476         if $test -r "$tans"; then
6477                 echo "Your C library seems to be in $tans, of all places."
6478                 libc=$tans
6479         else
6480                 libc='blurfl'
6481         fi
6482 fi
6483 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6484         dflt="$libc"
6485         cat <<EOM
6486
6487 If the guess above is wrong (which it might be if you're using a strange
6488 compiler, or your machine supports multiple models), you can override it here.
6489
6490 EOM
6491 else
6492         dflt=''
6493         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6494         cat >&4 <<EOM
6495 I can't seem to find your C library.  I've looked in the following places:
6496
6497 EOM
6498         $sed 's/^/      /' libpath
6499         cat <<EOM
6500
6501 None of these seems to contain your C library. I need to get its name...
6502
6503 EOM
6504 fi
6505 fn=f
6506 rp='Where is your C library?'
6507 . ./getfile
6508 libc="$ans"
6509
6510 echo " "
6511 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6512 set X `cat libnames`
6513 shift
6514 xxx=files
6515 case $# in 1) xxx=file; esac
6516 echo "Extracting names from the following $xxx for later perusal:" >&4
6517 echo " "
6518 $sed 's/^/      /' libnames >&4
6519 echo " "
6520 $echo $n "This may take a while...$c" >&4
6521
6522 for file in $*; do
6523         case $file in
6524         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6525         *) $nm $nm_opt $file 2>/dev/null;;
6526         esac
6527 done >libc.tmp
6528
6529 $echo $n ".$c"
6530 $grep fprintf libc.tmp > libc.ptf
6531 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6532 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6533 xxx='[ADTSIWi]'
6534 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6535         eval $xscan;\
6536         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6537                 eval $xrun
6538 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6539         eval $xscan;\
6540         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6541                 eval $xrun
6542 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6543         eval $xscan;\
6544         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6545                 eval $xrun
6546 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6547         eval $xscan;\
6548         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6549                 eval $xrun
6550 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6551         eval $xscan;\
6552         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6553                 eval $xrun
6554 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6555         eval $xscan;\
6556         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6557                 eval $xrun
6558 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6559                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6560         eval $xscan;\
6561         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6562                 eval $xrun
6563 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6564         eval $xscan;\
6565         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6566                 eval $xrun
6567 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6568         eval $xscan;\
6569         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6570                 eval $xrun
6571 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6572         eval $xscan;\
6573         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6574                 eval $xrun
6575 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6576         eval $xscan;\
6577         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6578                 eval $xrun
6579 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6580         eval $xscan;\
6581         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6582                 eval $xrun
6583 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6584         eval $xscan;\
6585         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6586                 eval $xrun
6587 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6588         eval $xscan;\
6589         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6590                 eval $xrun
6591 else
6592         $nm -p $* 2>/dev/null >libc.tmp
6593         $grep fprintf libc.tmp > libc.ptf
6594         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6595                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6596         then
6597                 nm_opt='-p'
6598                 eval $xrun
6599         else
6600                 echo " "
6601                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6602                 com=''
6603                 if $ar t $libc > libc.tmp && \
6604                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6605                 then
6606                         for thisname in $libnames $libc; do
6607                                 $ar t $thisname >>libc.tmp
6608                         done
6609                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6610                         echo "Ok." >&4
6611                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6612                         for thisname in $libnames $libc; do
6613                                 $ar tv $thisname >>libc.tmp
6614                                 emximp -o tmp.imp $thisname \
6615                                     2>/dev/null && \
6616                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6617                                     < tmp.imp >>libc.tmp
6618                                 $rm -f tmp.imp
6619                         done
6620                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6621                         echo "Ok." >&4
6622                 else
6623                         echo "$ar didn't seem to work right." >&4
6624                         echo "Maybe this is a Cray...trying bld instead..." >&4
6625                         if  bld t $libc | \
6626                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6627                                 $test -s libc.list
6628                         then
6629                                 for thisname in $libnames; do
6630                                         bld t $libnames | \
6631                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6632                                         $ar t $thisname >>libc.tmp
6633                                 done
6634                                 echo "Ok." >&4
6635                         else
6636                                 echo "That didn't work either.  Giving up." >&4
6637                                 exit 1
6638                         fi
6639                 fi
6640         fi
6641 fi
6642 nm_extract="$com"
6643 case "$PASE" in
6644 define)
6645     echo " "
6646     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6647     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6648     ;;
6649 *)  if $test -f /lib/syscalls.exp; then
6650         echo " "
6651         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6652         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6653                 /lib/syscalls.exp >>libc.list
6654     fi
6655     ;;
6656 esac
6657 ;;
6658 esac
6659 $rm -f libnames libpath
6660
6661 : Check if we are using C++
6662 echo " "
6663 echo "Checking for C++..." >&4
6664 $cat >try.c <<'EOCP'
6665 #include <stdio.h>
6666 int main(void)
6667 {
6668 #ifdef __cplusplus
6669     return 0;
6670 #else
6671     return 1;
6672 #endif
6673 }
6674 EOCP
6675 set try
6676 if eval $compile_ok && $run ./try; then
6677         val="$define"
6678         echo "You are using a C++ compiler."
6679 else
6680         val="$undef"
6681         echo "You are not using a C++ compiler."
6682 fi
6683 $rm_try cplusplus$$
6684 set d_cplusplus
6685 eval $setvar
6686
6687 : is a C symbol defined?
6688 csym='tlook=$1;
6689 case "$3" in
6690 -v) tf=libc.tmp; tdc="";;
6691 -a) tf=libc.tmp; tdc="[]";;
6692 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6693 esac;
6694 case "$d_cplusplus" in
6695     $define)    extern_C="extern \"C\"" ;;
6696     *)          extern_C="extern"       ;;
6697 esac;
6698 tx=yes;
6699 case "$reuseval-$4" in
6700 true-) ;;
6701 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6702 esac;
6703 case "$tx" in
6704 yes)
6705         tval=false;
6706         if $test "$runnm" = true; then
6707                 if $contains $tlook $tf >/dev/null 2>&1; then
6708                         tval=true;
6709                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6710                         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;
6711                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6712                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6713                         $rm_try;
6714                 fi;
6715         else
6716                 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;
6717                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6718                 $rm_try;
6719         fi;
6720         ;;
6721 *)
6722         case "$tval" in
6723         $define) tval=true;;
6724         *) tval=false;;
6725         esac;
6726         ;;
6727 esac;
6728 eval "$2=$tval"'
6729
6730 : define an is-in-libc? function
6731 inlibc='echo " "; td=$define; tu=$undef;
6732 sym=$1; var=$2; eval "was=\$$2";
6733 tx=yes;
6734 case "$reuseval$was" in
6735 true) ;;
6736 true*) tx=no;;
6737 esac;
6738 case "$tx" in
6739 yes)
6740         set $sym tres -f;
6741         eval $csym;
6742         case "$tres" in
6743         true)
6744                 echo "$sym() found." >&4;
6745                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6746         *)
6747                 echo "$sym() NOT found." >&4;
6748                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6749         esac;;
6750 *)
6751         case "$was" in
6752         $define) echo "$sym() found." >&4;;
6753         *) echo "$sym() NOT found." >&4;;
6754         esac;;
6755 esac'
6756
6757 : check for length of double
6758 echo " "
6759 case "$doublesize" in
6760 '')
6761         echo "Checking to see how big your double precision numbers are..." >&4
6762         $cat >try.c <<EOCP
6763 #include <stdio.h>
6764 #$i_stdlib I_STDLIB
6765 #ifdef I_STDLIB
6766 #include <stdlib.h>
6767 #endif
6768 int main()
6769 {
6770     printf("%d\n", (int)sizeof(double));
6771     exit(0);
6772 }
6773 EOCP
6774         set try
6775         if eval $compile_ok; then
6776                 doublesize=`$run ./try`
6777                 echo "Your double is $doublesize bytes long."
6778         else
6779                 dflt='8'
6780                 echo "(I can't seem to compile the test program.  Guessing...)"
6781                 rp="What is the size of a double precision number (in bytes)?"
6782                 . ./myread
6783                 doublesize="$ans"
6784         fi
6785         ;;
6786 esac
6787 $rm_try
6788
6789 : see if this is a float.h system
6790 set float.h i_float
6791 eval $inhdr
6792
6793 : check for long doubles
6794 echo " "
6795 echo "Checking to see if you have long double..." >&4
6796 echo 'int main() { long double x = 7.0; }' > try.c
6797 set try
6798 if eval $compile; then
6799         val="$define"
6800         echo "You have long double."
6801 else
6802         val="$undef"
6803         echo "You do not have long double."
6804 fi
6805 $rm_try
6806 set d_longdbl
6807 eval $setvar
6808
6809 : see if ldexpl exists
6810 set ldexpl d_ldexpl
6811 eval $inlibc
6812
6813 : see if this is a quadmath.h system
6814 set quadmath.h i_quadmath
6815 eval $inhdr
6816
6817 : check for length of long double
6818 case "${d_longdbl}${longdblsize}" in
6819 $define)
6820         echo " "
6821         echo "Checking to see how big your long doubles are..." >&4
6822         $cat >try.c <<'EOCP'
6823 #include <stdio.h>
6824 int main()
6825 {
6826         printf("%d\n", sizeof(long double));
6827 }
6828 EOCP
6829         set try
6830         set try
6831         if eval $compile; then
6832                 longdblsize=`$run ./try`
6833                 echo "Your long doubles are $longdblsize bytes long."
6834         else
6835                 dflt='8'
6836                 echo " "
6837                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6838                 rp="What is the size of a long double (in bytes)?"
6839                 . ./myread
6840                 longdblsize="$ans"
6841         fi
6842         if $test "X$doublesize" = "X$longdblsize"; then
6843                 echo "That isn't any different from an ordinary double."
6844                 echo "I'll keep your setting anyway, but you may see some"
6845                 echo "harmless compilation warnings."
6846         fi
6847         ;;
6848 esac
6849 $rm_try
6850
6851 $echo "Checking the kind of long doubles you have..." >&4
6852 case "$d_longdbl" in
6853 define)
6854 $cat <<EOP >try.c
6855 #$i_float I_FLOAT
6856 #$i_stdlib I_STDLIB
6857 #define LONGDBLSIZE $longdblsize
6858 #ifdef I_FLOAT
6859 #include <float.h>
6860 #endif
6861 #ifdef I_STDLIB
6862 #include <stdlib.h>
6863 #endif
6864 #$usequadmath USE_QUADMATH
6865 #$i_quadmath I_QUADMATH
6866 #if defined(USE_QUADMATH) && defined(I_QUADMATH)
6867 #include <quadmath.h>
6868 static const __float128 d = -0.1Q;
6869 #else
6870 static const long double d = -0.1L;
6871 #endif
6872 #include <stdio.h>
6873 int main() {
6874   unsigned const char* b = (unsigned const char*)(&d);
6875 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6876   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6877     /* IEEE 754 128-bit little-endian */
6878     printf("1\n");
6879     exit(0);
6880   }
6881   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6882     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6883     printf("2\n");
6884     exit(0);
6885   }
6886 #endif
6887 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6888  * while 64-bits platforms have it in 16 bytes. */
6889 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6890   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6891     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6892      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6893      * Also known as "extended precision". */
6894     printf("3\n");
6895     exit(0);
6896   }
6897   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6898     /* is there ever big-endian 80-bit, really? */
6899     printf("4\n");
6900     exit(0);
6901   }
6902 #endif
6903 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6904   /* software "double double", the 106 is 53+53.
6905    * but irix thinks it is 107. */
6906   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6907     /* double double 128-bit little-endian,
6908      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6909     printf("5\n");
6910     exit(0);
6911   }
6912   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
6913     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
6914      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
6915     printf("6\n");
6916     exit(0);
6917   }
6918 #endif
6919   printf("-1\n"); /* unknown */
6920   exit(0);
6921 }
6922 EOP
6923 set try
6924 if eval $compile; then
6925     longdblkind=`$run ./try`
6926 else
6927     longdblkind=-1
6928 fi
6929 ;;
6930 *) longdblkind=0 ;;
6931 esac
6932 case "$longdblkind" in
6933 0) echo "Your long doubles are doubles." >&4 ;;
6934 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
6935 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
6936 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
6937 *) echo "Cannot figure out your long double." >&4 ;;
6938 esac
6939 $rm_try
6940
6941
6942 : determine the architecture name
6943 echo " "
6944 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6945         tarch=`arch`"-$osname"
6946 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6947         if uname -m > tmparch 2>&1 ; then
6948                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6949                         -e 's/$/'"-$osname/" tmparch`
6950         else
6951                 tarch="$osname"
6952         fi
6953         $rm -f tmparch
6954 else
6955         tarch="$osname"
6956 fi
6957 case "$myarchname" in
6958 ''|"$tarch") ;;
6959 *)
6960         echo "(Your architecture name used to be $myarchname.)"
6961         archname=''
6962         ;;
6963 esac
6964 case "$targetarch" in
6965 '') ;;
6966 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6967 esac
6968 myarchname="$tarch"
6969 case "$archname" in
6970 '') dflt="$tarch";;
6971 *) dflt="$archname";;
6972 esac
6973 rp='What is your architecture name'
6974 . ./myread
6975 archname="$ans"
6976
6977 : optionally add API version to the architecture for versioned archlibs
6978 case "$useversionedarchname" in
6979 $define|true|[yY]*) dflt='y';;
6980 *)                  dflt='n';;
6981 esac
6982 rp='Add the Perl API version to your archname?'
6983 . ./myread
6984 case "$ans" in
6985 y|Y)    useversionedarchname="$define" ;;
6986 *)      useversionedarchname="$undef" ;;
6987 esac
6988 case "$useversionedarchname" in
6989 $define)
6990         case "$archname" in
6991         *-$api_versionstring)
6992                 echo "...and architecture name already has -$api_versionstring" >&4
6993                 ;;
6994         *)
6995                 archname="$archname-$api_versionstring"
6996                 echo "...setting architecture name to $archname." >&4
6997                 ;;
6998         esac
6999         ;;
7000 esac
7001
7002 case "$usethreads" in
7003 $define)
7004         echo "Threads selected." >&4
7005         case "$archname" in
7006         *-thread*) echo "...and architecture name already has -thread." >&4
7007                 ;;
7008         *)      archname="$archname-thread"
7009                 echo "...setting architecture name to $archname." >&4
7010                 ;;
7011         esac
7012         ;;
7013 esac
7014 case "$usemultiplicity" in
7015 $define)
7016         echo "Multiplicity selected." >&4
7017         case "$archname" in
7018         *-multi*) echo "...and architecture name already has -multi." >&4
7019                 ;;
7020         *)      archname="$archname-multi"
7021                 echo "...setting architecture name to $archname." >&4
7022                 ;;
7023         esac
7024         ;;
7025 esac
7026 case "$use64bitint$use64bitall" in
7027 *"$define"*)
7028         case "$archname64" in
7029         '')
7030                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7031                 ;;
7032         *)
7033                 case "$use64bitint" in
7034                 "$define") echo "64 bit integers selected." >&4 ;;
7035                 esac
7036                 case "$use64bitall" in
7037                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7038                 esac
7039                 case "$archname" in
7040                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7041                         ;;
7042                 *)      archname="$archname-$archname64"
7043                         echo "...setting architecture name to $archname." >&4
7044                         ;;
7045                 esac
7046                 ;;
7047         esac
7048 esac
7049 case "$uselongdouble" in
7050 $define)
7051         echo "Long doubles selected." >&4
7052         case "$longdblsize" in
7053         $doublesize)
7054                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7055                 ;;
7056         *)
7057                 case "$archname" in
7058                 *-ld*) echo "...and architecture name already has -ld." >&4
7059                         ;;
7060                 *)      archname="$archname-ld"
7061                         echo "...setting architecture name to $archname." >&4
7062                         ;;
7063                 esac
7064                 ;;
7065         esac
7066         ;;
7067 esac
7068 if $test -f archname.cbu; then
7069         echo "Your platform has some specific hints for architecture name, using them..."
7070         . ./archname.cbu
7071 fi
7072
7073 : set the prefixit variable, to compute a suitable default value
7074 prefixit='case "$3" in
7075 ""|none)
7076         case "$oldprefix" in
7077         "") eval "$1=\"\$$2\"";;
7078         *)
7079                 case "$3" in
7080                 "") eval "$1=";;
7081                 none)
7082                         eval "tp=\"\$$2\"";
7083                         case "$tp" in
7084                         ""|" ") eval "$1=\"\$$2\"";;
7085                         *) eval "$1=";;
7086                         esac;;
7087                 esac;;
7088         esac;;
7089 *)
7090         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7091         case "$tp" in
7092         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7093         /*-$oldprefix/*|\~*-$oldprefix/*)
7094                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7095         *) eval "$1=\"\$$2\"";;
7096         esac;;
7097 esac'
7098
7099 : determine installation style
7100 : For now, try to deduce it from prefix unless it is already set.
7101 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7102 case "$installstyle" in
7103 '')     case "$prefix" in
7104                 *perl*) dflt='lib';;
7105                 *) dflt='lib/perl5' ;;
7106         esac
7107         ;;
7108 *)      dflt="$installstyle" ;;
7109 esac
7110 : Probably not worth prompting for this since we prompt for all
7111 : the directories individually, and the prompt would be too long and
7112 : confusing anyway.
7113 installstyle=$dflt
7114
7115 : determine where public executables go
7116 echo " "
7117 set dflt bin bin
7118 eval $prefixit
7119 fn=d~
7120 rp='Pathname where the public executables will reside?'
7121 . ./getfile
7122 if $test "X$ansexp" != "X$binexp"; then
7123         installbin=''
7124 fi
7125 prefixvar=bin
7126 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7127 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7128 :     this via initialinstalllocation
7129 . ./setprefixvar
7130
7131 case "$userelocatableinc" in
7132 $define|true|[yY]*)     dflt='y' ;;
7133 *)                      dflt='n' ;;
7134 esac
7135 cat <<EOM
7136
7137 Would you like to build Perl so that the installation is relocatable, so that
7138 library paths in @INC are determined relative to the path of the perl binary?
7139 This is not advised for system Perl installs, or if you need to run setid
7140 scripts or scripts under taint mode.
7141
7142 If this doesn't make any sense to you, just accept the default '$dflt'.
7143 EOM
7144 rp='Use relocatable @INC?'
7145 . ./myread
7146 case "$ans" in
7147 y|Y)    val="$define" ;;
7148 *)      val="$undef"  ;;
7149 esac
7150 set userelocatableinc
7151 eval $setvar
7152
7153 initialinstalllocation="$binexp"
7154 : Default prefix is now "up one level from where the binaries are"
7155 case "$userelocatableinc" in
7156 $define|true|[yY]*)
7157     bin=".../"
7158     binexp=".../"
7159     prefix=".../.."
7160     prefixexp=".../.."
7161     installprefixexp=".../.."
7162     ;;
7163 esac
7164
7165 : determine where private library files go
7166 : Usual default is /usr/local/lib/perl5/$version.
7167 : Also allow things like /opt/perl/lib/$version, since
7168 : /opt/perl/lib/perl5... would be redundant.
7169 : The default "style" setting is made in installstyle.U
7170 case "$installstyle" in
7171 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7172 *)       set dflt privlib lib/$version ;;
7173 esac
7174 eval $prefixit
7175 $cat <<EOM
7176
7177 There are some auxiliary files for $package that need to be put into a
7178 private library directory that is accessible by everyone.
7179
7180 EOM
7181 fn=$binexp
7182 fn=d~+
7183 rp='Pathname where the private library files will reside?'
7184 . ./getfile
7185 prefixvar=privlib
7186 . ./setprefixvar
7187
7188 : set the prefixup variable, to restore leading tilda escape
7189 prefixup='case "$prefixexp" in
7190 "$prefix") ;;
7191 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7192 esac'
7193
7194 : determine where public architecture dependent libraries go
7195 set archlib archlib
7196 eval $prefixit
7197 : privlib default is /usr/local/lib/$package/$version
7198 : archlib default is /usr/local/lib/$package/$version/$archname
7199 : privlib may have an optional trailing /share.
7200 tdflt=`echo $privlib | $sed 's,/share$,,'`
7201 tdflt=$tdflt/$archname
7202 case "$archlib" in
7203 '')     dflt=$tdflt
7204         ;;
7205 *)      dflt="$archlib"
7206     ;;
7207 esac
7208 $cat <<EOM
7209
7210 $spackage contains architecture-dependent library files.  If you are
7211 sharing libraries in a heterogeneous environment, you might store
7212 these files in a separate location.  Otherwise, you can just include
7213 them with the rest of the public library files.
7214
7215 EOM
7216 fn=$binexp
7217 fn=d+~
7218 rp='Where do you want to put the public architecture-dependent libraries?'
7219 . ./getfile
7220 prefixvar=archlib
7221 . ./setprefixvar
7222 if $test X"$archlib" = X"$privlib"; then
7223         d_archlib="$undef"
7224 else
7225         d_archlib="$define"
7226 fi
7227
7228 : see if setuid scripts can be secure
7229 $cat <<EOM
7230
7231 Some kernels have a bug that prevents setuid #! scripts from being
7232 secure.  Some sites have disabled setuid #! scripts because of this.
7233
7234 First let's decide if your kernel supports secure setuid #! scripts.
7235 (If setuid #! scripts would be secure but have been disabled anyway,
7236 don't say that they are secure if asked.)
7237
7238 EOM
7239
7240 val="$undef"
7241 if $test -d /dev/fd; then
7242         echo "#!$ls" >reflect
7243         chmod +x,u+s reflect
7244         ./reflect >flect 2>&1
7245         if $contains "/dev/fd" flect >/dev/null; then
7246                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7247                 val="$define"
7248         else
7249                 $cat <<EOM
7250 If you are not sure if they are secure, I can check but I'll need a
7251 username and password different from the one you are using right now.
7252 If you don't have such a username or don't want me to test, simply
7253 enter 'none'.
7254
7255 EOM
7256                 rp='Other username to test security of setuid scripts with?'
7257                 dflt='none'
7258                 . ./myread
7259                 case "$ans" in
7260                 n|none)
7261                         case "$d_suidsafe" in
7262                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7263                                 dflt=n;;
7264                         "$undef")
7265                                 echo "Well, the $hint value is *not* secure." >&4
7266                                 dflt=n;;
7267                         *)      echo "Well, the $hint value *is* secure." >&4
7268                                 dflt=y;;
7269                         esac
7270                         ;;
7271                 *)
7272                         $rm -f reflect flect
7273                         echo "#!$ls" >reflect
7274                         chmod +x,u+s reflect
7275                         echo >flect
7276                         chmod a+w flect
7277                         echo '"su" will (probably) prompt you for '"$ans's password."
7278                         su $ans -c './reflect >flect'
7279                         if $contains "/dev/fd" flect >/dev/null; then
7280                                 echo "Okay, it looks like setuid scripts are secure." >&4
7281                                 dflt=y
7282                         else
7283                                 echo "I don't think setuid scripts are secure." >&4
7284                                 dflt=n
7285                         fi
7286                         ;;
7287                 esac
7288                 rp='Does your kernel have *secure* setuid scripts?'
7289                 . ./myread
7290                 case "$ans" in
7291                 [yY]*)  val="$define";;
7292                 *)      val="$undef";;
7293                 esac
7294         fi
7295 else
7296         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7297         echo "(That's for file descriptors, not floppy disks.)"
7298         val="$undef"
7299 fi
7300 set d_suidsafe
7301 eval $setvar
7302
7303 $rm -f reflect flect
7304
7305 : now see if they want to do setuid emulation
7306 if $test $patchlevel -lt 11; then
7307 echo " "
7308 val="$undef"
7309 case "$d_suidsafe" in
7310 "$define")
7311         val="$undef"
7312         echo "No need to emulate SUID scripts since they are secure here." >&4
7313         ;;
7314 *)
7315         $cat <<EOM
7316 Some systems have disabled setuid scripts, especially systems where
7317 setuid scripts cannot be secure.  On systems where setuid scripts have
7318 been disabled, the setuid/setgid bits on scripts are currently
7319 useless.  It is possible for $package to detect those bits and emulate
7320 setuid/setgid in a secure fashion.  This emulation will only work if
7321 setuid scripts have been disabled in your kernel.
7322
7323 EOM
7324         case "$d_dosuid" in
7325         "$define") dflt=y ;;
7326         *) dflt=n ;;
7327         esac
7328         rp="Do you want to do setuid/setgid emulation?"
7329         . ./myread
7330         case "$ans" in
7331         [yY]*)  val="$define";;
7332         *)      val="$undef";;
7333         esac
7334         ;;
7335 esac
7336 set d_dosuid
7337 eval $setvar
7338 else
7339     case "$d_dosuid" in
7340         "$define")
7341         cat >&4 <<EOH
7342
7343 SUID emulation has been removed for 5.12
7344 Please re-run Configure without -Dd_dosuid
7345
7346 EOH
7347         exit 1;
7348         ;;
7349     esac
7350     d_dosuid=undef
7351 fi
7352
7353 : Find perl5.005 or later.
7354 echo "Looking for a previously installed perl5.005 or later... "
7355 case "$perl5" in
7356 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7357                 : Check if this perl is recent and can load a simple module
7358                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7359                         perl5=$tdir/perl
7360                         break;
7361                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7362                         perl5=$tdir/perl5
7363                         break;
7364                 fi
7365         done
7366         ;;
7367 *)      perl5="$perl5"
7368         ;;
7369 esac
7370 case "$perl5" in
7371 '')     echo "None found.  That's ok.";;
7372 *)      echo "Using $perl5." ;;
7373 esac
7374
7375 : Set the siteprefix variables
7376 $cat <<EOM
7377
7378 After $package is installed, you may wish to install various
7379 add-on modules and utilities.  Typically, these add-ons will
7380 be installed under $prefix with the rest
7381 of this package.  However, you may wish to install such add-ons
7382 elsewhere under a different prefix.
7383
7384 If you do not wish to put everything under a single prefix, that's
7385 ok.  You will be prompted for the individual locations; this siteprefix
7386 is only used to suggest the defaults.
7387
7388 The default should be fine for most people.
7389
7390 EOM
7391 fn=d~+
7392 rp='Installation prefix to use for add-on modules and utilities?'
7393 : XXX Here might be another good place for an installstyle setting.
7394 case "$siteprefix" in
7395 '') dflt=$prefix ;;
7396 *)  dflt=$siteprefix ;;
7397 esac
7398 . ./getfile
7399 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7400 oldsiteprefix=''
7401 case "$siteprefix" in
7402 '') ;;
7403 *)      case "$ans" in
7404         "$prefix") ;;
7405         *) oldsiteprefix="$prefix";;
7406         esac
7407         ;;
7408 esac
7409 siteprefix="$ans"
7410 siteprefixexp="$ansexp"
7411
7412 : determine where site specific libraries go.
7413 : Usual default is /usr/local/lib/perl5/site_perl/$version
7414 : The default "style" setting is made in installstyle.U
7415 : XXX No longer works with Prefixit stuff.
7416 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7417 case "$sitelib" in
7418 '') case "$installstyle" in
7419         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7420         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7421         esac
7422         ;;
7423 *)      dflt="$sitelib"
7424         ;;
7425 esac
7426 $cat <<EOM
7427
7428 The installation process will create a directory for
7429 site-specific extensions and modules.  Most users find it convenient
7430 to place all site-specific files in this directory rather than in the
7431 main distribution directory.
7432
7433 EOM
7434 fn=d~+
7435 rp='Pathname for the site-specific library files?'
7436 . ./getfile
7437 prefixvar=sitelib
7438 . ./setprefixvar
7439 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7440
7441 : Determine list of previous versions to include in @INC
7442 $cat > getverlist <<EOPL
7443 #!$perl5 -w
7444 use File::Basename;
7445 \$api_versionstring = "$api_versionstring";
7446 \$version = "$version";
7447 \$stem = "$sitelib_stem";
7448 \$archname = "$archname";
7449 EOPL
7450         $cat >> getverlist <<'EOPL'
7451 # The list found is store twice for each entry: the original name, and
7452 # the binary broken down version as pack "sss", so sorting is easy and
7453 # unambiguous. This will work for all versions that have a maximum of
7454 # three digit groups, separate by '.'s or '_'s. Names are extended with
7455 # ".0.0" to ensure at least three elements for the pack.
7456 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7457
7458 # Can't have leading @ because metaconfig interprets it as a command!
7459 ;@inc_version_list=();
7460 # XXX Redo to do opendir/readdir?
7461 if (-d $stem) {
7462     chdir($stem);
7463     ;@candidates = map {
7464         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7465     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7466 }
7467 else {
7468     ;@candidates = ();
7469 }
7470
7471 ($pversion, $aversion, $vsn5005) = map {
7472     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7473 foreach $d (@candidates) {
7474     if ($d->[1] lt $pversion) {
7475         if ($d->[1] ge $aversion) {
7476             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7477         }
7478         elsif ($d->[1] ge $vsn5005) {
7479             unshift(@inc_version_list, grep { -d } $d->[0]);
7480         }
7481     }
7482     else {
7483         # Skip newer version.  I.e. don't look in
7484         # 5.7.0 if we're installing 5.6.1.
7485     }
7486 }
7487
7488 if (@inc_version_list) {
7489     print join(' ', @inc_version_list);
7490 }
7491 else {
7492     # Blank space to preserve value for next Configure run.
7493     print " ";
7494 }
7495 EOPL
7496 chmod +x getverlist
7497 case "$inc_version_list" in
7498 '')     if test -x "$perl5$exe_ext"; then
7499                 dflt=`$perl5 getverlist`
7500         else
7501                 dflt='none'
7502         fi
7503         ;;
7504 $undef) dflt='none' ;;
7505 *)  eval dflt=\"$inc_version_list\" ;;
7506 esac
7507 case "$dflt" in
7508 ''|' ') dflt=none ;;
7509 esac
7510 case "$dflt" in
7511 5.005) dflt=none ;;
7512 esac
7513 $cat <<EOM
7514
7515 In order to ease the process of upgrading, this version of perl
7516 can be configured to use modules built and installed with earlier
7517 versions of perl that were installed under $prefix.  Specify here
7518 the list of earlier versions that this version of perl should check.
7519 If Configure detected no earlier versions of perl installed under
7520 $prefix, then the list will be empty.  Answer 'none' to tell perl
7521 to not search earlier versions.
7522
7523 The default should almost always be sensible, so if you're not sure,
7524 just accept the default.
7525 EOM
7526
7527 rp='List of earlier versions to include in @INC?'
7528 . ./myread
7529 case "$ans" in
7530 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7531 *) inc_version_list="$ans" ;;
7532 esac
7533 case "$inc_version_list" in
7534 ''|' ')
7535         inc_version_list_init='0'
7536         d_inc_version_list="$undef"
7537         ;;
7538 *)      inc_version_list_init=`echo $inc_version_list |
7539                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7540         d_inc_version_list="$define"
7541         ;;
7542 esac
7543 $rm -f getverlist
7544
7545 : see if malloc/malloc.h has to be included
7546 set malloc/malloc.h i_mallocmalloc
7547 eval $inhdr
7548
7549 : see if this is a malloc.h system
7550 : we want a real compile instead of Inhdr because some systems have a
7551 : malloc.h that just gives a compile error saying to use stdlib.h instead
7552 echo " "
7553 $cat >try.c <<EOCP
7554 #include <stdlib.h>
7555 #include <malloc.h>
7556 #$i_mallocmalloc I_MALLOCMALLOC
7557 #ifdef I_MALLOCMALLOC
7558 # include <malloc/malloc.h>
7559 #endif
7560
7561 int main () { return 0; }
7562 EOCP
7563 set try
7564 if eval $compile; then
7565     echo "<malloc.h> found." >&4
7566     val="$define"
7567 else
7568     echo "<malloc.h> NOT found." >&4
7569     val="$undef"
7570 fi
7571 $rm_try
7572 set i_malloc
7573 eval $setvar
7574
7575 : check for length of pointer
7576 echo " "
7577 case "$ptrsize" in
7578 '')
7579         echo "Checking to see how big your pointers are..." >&4
7580         $cat >>try.c <<EOCP
7581 #include <stdio.h>
7582 #$i_stdlib I_STDLIB
7583 #ifdef I_STDLIB
7584 #include <stdlib.h>
7585 #endif
7586 int main()
7587 {
7588     printf("%d\n", (int)sizeof(void *));
7589     exit(0);
7590 }
7591 EOCP
7592         set try
7593         if eval $compile_ok; then
7594                 ptrsize=`$run ./try`
7595                 echo "Your pointers are $ptrsize bytes long."
7596         else
7597                 dflt='4'
7598                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7599                 rp="What is the size of a pointer (in bytes)?"
7600                 . ./myread
7601                 ptrsize="$ans"
7602         fi
7603         ;;
7604 esac
7605 $rm_try
7606 case "$use64bitall" in
7607 "$define"|true|[yY]*)
7608         case "$ptrsize" in
7609         4)      cat <<EOM >&4
7610
7611 *** You have chosen a maximally 64-bit build,
7612 *** but your pointers are only 4 bytes wide.
7613 *** Please rerun Configure without -Duse64bitall.
7614 EOM
7615                 case "$d_quad" in
7616                 define)
7617                         cat <<EOM >&4
7618 *** Since you have quads, you could possibly try with -Duse64bitint.
7619 EOM
7620                         ;;
7621                 esac
7622                 cat <<EOM >&4
7623 *** Cannot continue, aborting.
7624
7625 EOM
7626
7627                 exit 1
7628                 ;;
7629         esac
7630         ;;
7631 esac
7632
7633
7634 : determine whether to use malloc wrapping
7635 echo " "
7636 case "$usemallocwrap" in
7637 [yY]*|true|$define)     dflt='y' ;;
7638 [nN]*|false|$undef)     dflt='n' ;;
7639 *)      case "$usedevel" in
7640         [yY]*|true|$define)     dflt='y' ;;
7641         *) dflt='n' ;;
7642         esac
7643         ;;
7644 esac
7645 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7646 . ./myread
7647 usemallocwrap="$ans"
7648 case "$ans" in
7649 y*|true)
7650         usemallocwrap="$define" ;;
7651 *)
7652         usemallocwrap="$undef" ;;
7653 esac
7654
7655 : determine which malloc to compile in
7656 echo " "
7657 case "$usemymalloc" in
7658 [yY]*|true|$define)     dflt='y' ;;
7659 [nN]*|false|$undef)     dflt='n' ;;
7660 *)      case "$ptrsize" in
7661         4) dflt='y' ;;
7662         *) dflt='n' ;;
7663         esac
7664         if test "$useithreads" = "$define"; then dflt='n'; fi
7665         ;;
7666 esac
7667 rp="Do you wish to attempt to use the malloc that comes with $package?"
7668 . ./myread
7669 usemymalloc="$ans"
7670 case "$ans" in
7671 y*|true)
7672         usemymalloc='y'
7673         mallocsrc='malloc.c'
7674         mallocobj="malloc$_o"
7675         d_mymalloc="$define"
7676         case "$libs" in
7677         *-lmalloc*)
7678                 : Remove malloc from list of libraries to use
7679                 echo "Removing unneeded -lmalloc from library list" >&4
7680                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7681                 shift
7682                 libs="$*"
7683                 echo "libs = $libs" >&4
7684                 ;;
7685         esac
7686         ;;
7687 *)
7688         usemymalloc='n'
7689         mallocsrc=''
7690         mallocobj=''
7691         d_mymalloc="$undef"
7692         ;;
7693 esac
7694
7695 : compute the return types of malloc and free
7696 echo " "
7697 $cat >malloc.c <<END
7698 #$i_malloc I_MALLOC
7699 #$i_stdlib I_STDLIB
7700 #include <stdio.h>
7701 #include <sys/types.h>
7702 #ifdef I_MALLOC
7703 #include <malloc.h>
7704 #endif
7705 #ifdef I_STDLIB
7706 #include <stdlib.h>
7707 #endif
7708 #ifdef TRY_MALLOC
7709 void *malloc();
7710 #endif
7711 #ifdef TRY_FREE
7712 void free();
7713 #endif
7714 END
7715 case "$malloctype" in
7716 '')
7717         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7718                 malloctype='void *'
7719         else
7720                 malloctype='char *'
7721         fi
7722         ;;
7723 esac
7724 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7725
7726 case "$freetype" in
7727 '')
7728         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7729                 freetype='void'
7730         else
7731                 freetype='int'
7732         fi
7733         ;;
7734 esac
7735 echo "Your system uses $freetype free(), it would seem." >&4
7736 $rm -f malloc.[co]
7737 : determine where site specific architecture-dependent libraries go.
7738 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7739 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7740 : sitelib may have an optional trailing /share.
7741 case "$sitearch" in
7742 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7743         dflt="$dflt/$archname"
7744         ;;
7745 *)      dflt="$sitearch"
7746         ;;
7747 esac
7748 set sitearch sitearch none
7749 eval $prefixit
7750 $cat <<EOM
7751
7752 The installation process will also create a directory for
7753 architecture-dependent site-specific extensions and modules.
7754
7755 EOM
7756 fn=d~+
7757 rp='Pathname for the site-specific architecture-dependent library files?'
7758 . ./getfile
7759 prefixvar=sitearch
7760 . ./setprefixvar
7761 if $test X"$sitearch" = X"$sitelib"; then
7762         d_sitearch="$undef"
7763 else
7764         d_sitearch="$define"
7765 fi
7766
7767 : Set the vendorprefix variables
7768 $cat <<EOM
7769
7770 The installation process will also create a directory for
7771 vendor-supplied add-ons.  Vendors who supply perl with their system
7772 may find it convenient to place all vendor-supplied files in this
7773 directory rather than in the main distribution directory.  This will
7774 ease upgrades between binary-compatible maintenance versions of perl.
7775
7776 Of course you may also use these directories in whatever way you see
7777 fit.  For example, you might use them to access modules shared over a
7778 company-wide network.
7779
7780 The default answer should be fine for most people.
7781 This causes further questions about vendor add-ons to be skipped
7782 and no vendor-specific directories will be configured for perl.
7783
7784 EOM
7785 rp='Do you want to configure vendor-specific add-on directories?'
7786 case "$usevendorprefix" in
7787 define|true|[yY]*) dflt=y ;;
7788 *)      : User may have set vendorprefix directly on Configure command line.
7789         case "$vendorprefix" in
7790         ''|' ') dflt=n ;;
7791         *)      dflt=y ;;
7792         esac
7793         ;;
7794 esac
7795 . ./myread
7796 case "$ans" in
7797 [yY]*)  fn=d~+
7798         rp='Installation prefix to use for vendor-supplied add-ons?'
7799         case "$vendorprefix" in
7800         '') dflt="$prefix" ;;
7801         *)  dflt=$vendorprefix ;;
7802         esac
7803         . ./getfile
7804         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7805         oldvendorprefix=''
7806         case "$vendorprefix" in
7807         '') ;;
7808         *)      case "$ans" in
7809                 "$prefix") ;;
7810                 *) oldvendorprefix="$prefix";;
7811                 esac
7812                 ;;
7813         esac
7814         usevendorprefix="$define"
7815         vendorprefix="$ans"
7816         vendorprefixexp="$ansexp"
7817         ;;
7818 *)      usevendorprefix="$undef"
7819         vendorprefix=''
7820         vendorprefixexp=''
7821         ;;
7822 esac
7823
7824 : Set the vendorlib variables
7825 case "$vendorprefix" in
7826 '')     d_vendorlib="$undef"
7827         vendorlib=''
7828         vendorlibexp=''
7829         ;;
7830 *)      d_vendorlib="$define"
7831         : determine where vendor-supplied modules go.
7832         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7833         case "$vendorlib" in
7834         '')
7835                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7836                 case "$installstyle" in
7837                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7838                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7839                 esac
7840                 ;;
7841         *)      dflt="$vendorlib"
7842                 ;;
7843         esac
7844         fn=d~+
7845         rp='Pathname for the vendor-supplied library files?'
7846         . ./getfile
7847         vendorlib="$ans"
7848         vendorlibexp="$ansexp"
7849         ;;
7850 esac
7851 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7852 prefixvar=vendorlib
7853 . ./installprefix
7854
7855 : Set the vendorarch variables
7856 case "$vendorprefix" in
7857 '')     d_vendorarch="$undef"
7858         vendorarch=''
7859         vendorarchexp=''
7860         ;;
7861 *)      d_vendorarch="$define"
7862         : determine where vendor-supplied architecture-dependent libraries go.
7863         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7864         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7865         : vendorlib may have an optional trailing /share.
7866         case "$vendorarch" in
7867         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7868                 dflt="$dflt/$archname"
7869                 ;;
7870         *)      dflt="$vendorarch" ;;
7871         esac
7872         fn=d~+
7873         rp='Pathname for vendor-supplied architecture-dependent files?'
7874         . ./getfile
7875         vendorarch="$ans"
7876         vendorarchexp="$ansexp"
7877         ;;
7878 esac
7879 prefixvar=vendorarch
7880 . ./installprefix
7881 if $test X"$vendorarch" = X"$vendorlib"; then
7882         d_vendorarch="$undef"
7883 else
7884         d_vendorarch="$define"
7885 fi
7886
7887 : Final catch-all directories to search
7888 $cat <<EOM
7889
7890 Lastly, you can have perl look in other directories for extensions and
7891 modules in addition to those already specified.
7892 These directories will be searched after
7893         $sitearch
7894         $sitelib
7895 EOM
7896 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7897 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7898 echo ' '
7899 case "$otherlibdirs" in
7900 ''|' ') dflt='none' ;;
7901 *)      dflt="$otherlibdirs" ;;
7902 esac
7903 $cat <<EOM
7904 Enter a colon-separated set of extra paths to include in perl's @INC
7905 search path, or enter 'none' for no extra paths.
7906
7907 EOM
7908
7909 rp='Colon-separated list of additional directories for perl to search?'
7910 . ./myread
7911 case "$ans" in
7912 ' '|''|none)    otherlibdirs=' ' ;;
7913 *)      otherlibdirs="$ans" ;;
7914 esac
7915 case "$otherlibdirs" in
7916 ' ') val=$undef ;;
7917 *)      val=$define ;;
7918 esac
7919 set d_perl_otherlibdirs
7920 eval $setvar
7921
7922 : Cruising for prototypes
7923 echo " "
7924 echo "Checking out function prototypes..." >&4
7925 $cat >prototype.c <<EOCP
7926 #$i_stdlib I_STDLIB
7927 #ifdef I_STDLIB
7928 #include <stdlib.h>
7929 #endif
7930 int main(int argc, char *argv[]) {
7931         exit(0);}
7932 EOCP
7933 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7934         echo "Your C compiler appears to support function prototypes."
7935         val="$define"
7936 else
7937         echo "Your C compiler doesn't seem to understand function prototypes."
7938         val="$undef"
7939 fi
7940 set prototype
7941 eval $setvar
7942 $rm -f prototype*
7943
7944 : Check if ansi2knr is required
7945 case "$prototype" in
7946 "$define") ;;
7947 *)      ansi2knr='ansi2knr'
7948         echo " "
7949         cat <<EOM >&4
7950
7951 $me:  FATAL ERROR:
7952 This version of $package can only be compiled by a compiler that
7953 understands function prototypes.  Unfortunately, your C compiler
7954         $cc $ccflags
7955 doesn't seem to understand them.  Sorry about that.
7956
7957 If GNU cc is available for your system, perhaps you could try that instead.
7958
7959 Eventually, we hope to support building Perl with pre-ANSI compilers.
7960 If you would like to help in that effort, please contact <perlbug@perl.org>.
7961
7962 Aborting Configure now.
7963 EOM
7964         exit 2
7965         ;;
7966 esac
7967
7968 : DTrace support
7969 dflt_dtrace='/usr/sbin/dtrace'
7970 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7971
7972 cat <<EOM
7973
7974 Perl can be built to support DTrace on platforms that support it.
7975 DTrace is a diagnosis and performance analysis tool from Sun.
7976
7977 If this doesn't make any sense to you, just accept the default '$dflt'.
7978 EOM
7979
7980 while $test 1 ; do
7981         case "$usedtrace" in
7982         $define|true|[yY]*)
7983                 dflt='y'
7984                 ;;
7985         ?*)
7986                 dflt='y'
7987                 dflt_dtrace=$usedtrace
7988                 ;;
7989         *)
7990                 dflt='n'
7991                 ;;
7992         esac
7993
7994         rp='Support DTrace if available?'
7995         . ./myread
7996         case "$ans" in
7997         y|Y)    val="$define" ;;
7998         *)      val="$undef" ;;
7999         esac
8000         set usedtrace
8001         eval $setvar
8002
8003         test "X$usedtrace" != "X$define" && break
8004
8005         echo " "
8006         rp='Where is the dtrace executable?'
8007         dflt=$dflt_dtrace
8008         . ./getfile
8009         val="$ans"
8010         set dtrace
8011         eval $setvar
8012
8013         if $test -f $dtrace
8014         then
8015                 if $dtrace -h -s ../perldtrace.d \
8016                         -o perldtrace.tmp >/dev/null 2>&1 \
8017                         && rm -f perldtrace.tmp
8018                 then
8019                         echo " "
8020                         echo "Good: your $dtrace knows about the -h flag."
8021                 else
8022                         cat >&2 <<EOM
8023
8024 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8025 ***
8026 *** Your installed dtrace doesn't support the -h switch to compile a D
8027 *** program into a C header. Can't continue.
8028
8029 EOM
8030                         exit 1
8031                 fi
8032                 break;
8033         fi
8034
8035         case "$fastread" in
8036         yes)
8037                 cat >&2 <<EOM
8038
8039 *** $me:  Fatal Error:  $dtrace not found.
8040 *** Can't continue.
8041
8042 EOM
8043                 exit 1
8044                 ;;
8045         *)
8046                 echo "*** $dtrace was not found."
8047                 echo " "
8048                 ;;
8049         esac
8050 done
8051
8052 : See if we want extra modules installed
8053 echo " "
8054 case "$extras" in
8055 '') dflt='n';;
8056 *) dflt='y';;
8057 esac
8058 cat <<EOM
8059 Perl can be built with extra modules or bundles of modules which
8060 will be fetched from the CPAN and installed alongside Perl.
8061
8062 Notice that you will need access to the CPAN; either via the Internet,
8063 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8064 be asked later to configure the CPAN.pm module which will in turn do
8065 the installation of the rest of the extra modules or bundles.)
8066
8067 Notice also that if the modules require any external software such as
8068 libraries and headers (the libz library and the zlib.h header for the
8069 Compress::Zlib module, for example) you MUST have any such software
8070 already installed, this configuration process will NOT install such
8071 things for you.
8072
8073 If this doesn't make any sense to you, just accept the default '$dflt'.
8074 EOM
8075 rp='Install any extra modules (y or n)?'
8076 . ./myread
8077 case "$ans" in
8078 y|Y)
8079         cat <<EOM
8080
8081 Please list any extra modules or bundles to be installed from CPAN,
8082 with spaces between the names.  The names can be in any format the
8083 'install' command of CPAN.pm will understand.  (Answer 'none',
8084 without the quotes, to install no extra modules or bundles.)
8085 EOM
8086         rp='Extras?'
8087         dflt="$extras"
8088         . ./myread
8089         extras="$ans"
8090 esac
8091 case "$extras" in
8092 ''|'none')
8093         val=''
8094         $rm -f ../extras.lst
8095         ;;
8096 *)      echo "(Saving the list of extras for later...)"
8097         echo "$extras" > ../extras.lst
8098         val="'$extras'"
8099         ;;
8100 esac
8101 set extras
8102 eval $setvar
8103 echo " "
8104
8105 : determine where html pages for programs go
8106 set html1dir html1dir none
8107 eval $prefixit
8108 $cat <<EOM
8109
8110 If you wish to install html files for programs in $spackage, indicate
8111 the appropriate directory here.  To skip installing html files,
8112 answer "none".
8113 EOM
8114 case "$html1dir" in
8115 ''|none|$undef|' ') dflt=none ;;
8116 *) dflt=$html1dir ;;
8117 esac
8118 fn=dn+~
8119 rp="Directory for the main $spackage html pages?"
8120 . ./getfile
8121 prefixvar=html1dir
8122 . ./setprefixvar
8123 : Use ' ' for none so value is preserved next time through Configure
8124 $test X"$html1dir" = "X" && html1dir=' '
8125
8126 : determine where html pages for libraries and modules go
8127 set html3dir html3dir none
8128 eval $prefixit
8129 $cat <<EOM
8130
8131 If you wish to install html files for modules associated with $spackage,
8132 indicate the appropriate directory here.  To skip installing html files,
8133 answer "none".
8134 EOM
8135 : There is no obvious default.  If they have specified html1dir, then
8136 : try to key off that, possibly changing .../html1 into .../html3.
8137 case "$html3dir" in
8138 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8139 *) dflt=$html3dir ;;
8140 esac
8141 fn=dn+~
8142 rp="Directory for the $spackage module html pages?"
8143 . ./getfile
8144 prefixvar=html3dir
8145 . ./setprefixvar
8146 : Use ' ' for none so value is preserved next time through Configure
8147 $test X"$html3dir" = "X" && html3dir=' '
8148
8149 : determine whether to install perl also as /usr/bin/perl
8150
8151 echo " "
8152 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8153         $cat <<EOM
8154 Many scripts expect perl to be installed as /usr/bin/perl.
8155
8156 If you want to, I can install the perl you are about to compile
8157 as /usr/bin/perl (in addition to $bin/perl).
8158 EOM
8159         if test -f /usr/bin/perl; then
8160             $cat <<EOM
8161
8162 However, please note that because you already have a /usr/bin/perl,
8163 overwriting that with a new Perl would very probably cause problems.
8164 Therefore I'm assuming you don't want to do that (unless you insist).
8165
8166 EOM
8167             case "$installusrbinperl" in
8168             "$define"|[yY]*)    dflt='y';;
8169             *)                  dflt='n';;
8170             esac
8171         else
8172             $cat <<EOM
8173
8174 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8175
8176 EOM
8177             case "$installusrbinperl" in
8178             "$undef"|[nN]*)     dflt='n';;
8179             *)                  dflt='y';;
8180             esac
8181         fi
8182         rp="Do you want to install perl as /usr/bin/perl?"
8183         . ./myread
8184         case "$ans" in
8185         [yY]*)  val="$define";;
8186         *)      val="$undef" ;;
8187         esac
8188 else
8189         val="$undef"
8190 fi
8191 set installusrbinperl
8192 eval $setvar
8193
8194 : see if dlopen exists
8195 xxx_runnm="$runnm"
8196 xxx_ccflags="$ccflags"
8197 runnm=false
8198 : with g++ one needs -shared to get is-in-libc to work for dlopen
8199 case "$gccversion" in
8200 '')     ;;
8201 *)      case "$d_cplusplus" in
8202         "$define") ccflags="$ccflags -shared" ;;
8203         esac
8204         ;;
8205 esac
8206 set dlopen d_dlopen
8207 eval $inlibc
8208 runnm="$xxx_runnm"
8209 ccflags="$xxx_ccflags"
8210
8211 : see if this is a unistd.h system
8212 set unistd.h i_unistd
8213 eval $inhdr
8214
8215 : determine which dynamic loading, if any, to compile in
8216 echo " "
8217 dldir="ext/DynaLoader"
8218 case "$usedl" in
8219     $define|y|true)
8220         dflt='y'
8221         usedl="$define"
8222         ;;
8223     $undef|n|false)
8224         dflt='n'
8225         usedl="$undef"
8226         ;;
8227     *)
8228         dflt='n'
8229         case "$d_dlopen" in
8230             $define) dflt='y' ;;
8231         esac
8232         : Does a dl_xxx.xs file exist for this operating system
8233         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8234         ;;
8235 esac
8236 rp="Do you wish to use dynamic loading?"
8237 . ./myread
8238 usedl="$ans"
8239 bin_ELF="$undef"
8240 case "$ans" in
8241     y*) usedl="$define"
8242         case "$dlsrc" in
8243             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8244                     dflt="$dldir/dl_${osname}.xs"
8245                 elif $test "$d_dlopen" = "$define" ; then
8246                     dflt="$dldir/dl_dlopen.xs"
8247                 else
8248                     dflt=''
8249                 fi
8250                 ;;
8251             *)  dflt="$dldir/$dlsrc"
8252                 ;;
8253         esac
8254         echo "The following dynamic loading files are available:"
8255         : Can not go over to $dldir because getfile has path hard-coded in.
8256         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8257         rp="Source file to use for dynamic loading"
8258         fn="fne"
8259         gfpth="$src"
8260         . ./getfile
8261         usedl="$define"
8262         : emulate basename
8263         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8264
8265         $cat << EOM
8266
8267 Some systems may require passing special flags to $cc -c to
8268 compile modules that will be used to create a shared library.
8269 To use no flags, say "none".
8270
8271 EOM
8272         case "$cccdlflags" in
8273             '') case "$gccversion" in
8274                 '') case "$osname" in
8275                         hpux)   dflt='+z' ;;
8276                         irix*)  dflt='-KPIC' ;;
8277                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8278                         sunos)  dflt='-pic' ;;
8279                         *)      dflt='none' ;;
8280                     esac
8281                     ;;
8282                 *)  case "$osname" in
8283                         darwin) dflt='none' ;;
8284                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8285                         *)      dflt='-fpic' ;;
8286                     esac ;;
8287                 esac ;;
8288             ' ') dflt='none' ;;
8289             *)   dflt="$cccdlflags" ;;
8290         esac
8291
8292         case "$dflt" in
8293             none) dflt='' ;;
8294         esac
8295
8296         # If -Dsysroot was specified, now's the time to add it
8297         # to cccdlflags
8298         if test "X$sysroot" != X; then
8299             case "$gccversion" in
8300                 '') ;;
8301                 *)  case "$dflt" in
8302                         *sysroot*) ;;
8303                         'undef'|*)
8304                             dflt="$dflt --sysroot=$sysroot" ;;
8305                     esac
8306                     ;;
8307             esac
8308         fi
8309
8310         case "$dflt" in
8311             '') dflt='none';;
8312         esac
8313
8314         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8315         . ./myread
8316         case "$ans" in
8317             none) cccdlflags=' ' ;;
8318             *)    cccdlflags="$ans" ;;
8319         esac
8320
8321         cat << EOM
8322
8323 Some systems use ld to create libraries that can be dynamically loaded,
8324 while other systems (such as those using ELF) use $cc.
8325
8326 EOM
8327
8328 : Determine if this is ELF
8329         $cat >try.c <<EOM
8330 /* Test for whether ELF binaries are produced */
8331 #include <fcntl.h>
8332 #$i_stdlib I_STDLIB
8333 #ifdef I_STDLIB
8334 #include <stdlib.h>
8335 #endif
8336 #$i_unistd I_UNISTD
8337 #ifdef I_UNISTD
8338 #include <unistd.h>
8339 #endif
8340 int main() {
8341     char b[4];
8342     int i = open("a.out",O_RDONLY);
8343     if(i == -1)
8344         exit(1); /* fail */
8345     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8346         exit(0); /* succeed (yes, it is ELF) */
8347     exit(1); /* fail */
8348 }
8349 EOM
8350         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8351             bin_ELF="$define"
8352         fi
8353         $rm_try
8354
8355         case "$ld" in
8356             '') if $test $bin_ELF = "$define"; then
8357                     cat <<EOM
8358 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8359 EOM
8360                     dflt="$cc"
8361                 else
8362                     echo "I'll use ld to build dynamic libraries."
8363                     dflt='ld'
8364                 fi
8365                 ;;
8366             *)  dflt="$ld"
8367                 ;;
8368         esac
8369
8370         rp="What command should be used to create dynamic libraries?"
8371         . ./myread
8372         ld="$ans"
8373
8374         cat << EOM
8375
8376 Some systems may require passing special flags to $ld to create a
8377 library that can be dynamically loaded.  If your ld flags include
8378 -L/other/path options to locate libraries outside your loader's normal
8379 search path, you may need to specify those -L options here as well.  To
8380 use no flags, say "none".
8381
8382 EOM
8383         case "$lddlflags" in
8384             '') case "$osname" in
8385                     haiku) dflt='-shared' ;;
8386                     hpux) dflt='-b';
8387                           case "$gccversion" in
8388                               '') dflt="$dflt +vnocompatwarnings" ;;
8389                           esac
8390                           ;;
8391                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8392                     solaris) # See [perl #66604].
8393                             # On Solaris 11, gcc -m64 on amd64
8394                             # appears not to understand -G.  gcc versions at
8395                             # least as old as 3.4.3 support -shared, so just
8396                             # use that with Solaris 11 and later, but keep
8397                             # the old behavior for older Solaris versions.
8398                             case "$gccversion" in
8399                                 '') dflt='-G' ;;
8400                                 *)  case "$osvers" in
8401                                         2.?|2.10) dflt='-G' ;;
8402                                         *) dflt='-shared' ;;
8403                                     esac
8404                                     ;;
8405                             esac
8406                             ;;
8407                     sunos) dflt='-assert nodefinitions' ;;
8408                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8409                     *)     dflt='none' ;;
8410                 esac
8411                 ;;
8412             *) dflt="$lddlflags" ;;
8413         esac
8414
8415         : Only do this for gcc, since, for example, qcc has no concept
8416         : of --sysroot.
8417         if $test "X$sysroot" != X; then
8418             case "$gccversion" in
8419                 '') ;;
8420                 *)  dflt="$dflt --sysroot $sysroot" ;;
8421             esac
8422         fi
8423
8424         : Try to guess additional flags to pick up local libraries.
8425         : Be careful not to append to a plain 'none'
8426         case "$dflt" in
8427             none) dflt='' ;;
8428         esac
8429         for thisflag in $ldflags; do
8430             case "$thisflag" in
8431                 -L*|-R*|-Wl,-R*)
8432                     case " $dflt " in
8433                         *" $thisflag "*) ;;
8434                         *) dflt="$dflt $thisflag" ;;
8435                     esac
8436                     ;;
8437             esac
8438         done
8439
8440         case "$dflt" in
8441             ''|' ') dflt='none' ;;
8442         esac
8443
8444         case "$ldflags" in
8445             *-fstack-protector-strong*)
8446                 case "$dflt" in
8447                     *-fstack-protector-strong*) ;; # Don't add it again
8448                     *) dflt="$dflt -fstack-protector-strong" ;;
8449                 esac
8450                 ;;
8451             *-fstack-protector*)
8452                 case "$dflt" in
8453                     *-fstack-protector*) ;; # Don't add it again
8454                     *) dflt="$dflt -fstack-protector" ;;
8455                 esac
8456                 ;;
8457         esac
8458
8459         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8460         . ./myread
8461         case "$ans" in
8462             none) lddlflags=' ' ;;
8463             *) lddlflags="$ans" ;;
8464         esac
8465
8466         cat <<EOM
8467
8468 Some systems may require passing special flags to $cc to indicate that
8469 the resulting executable will use dynamic linking.  To use no flags,
8470 say "none".
8471
8472 EOM
8473         case "$ccdlflags" in
8474             '') case "$osname" in
8475                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8476                     sunos)             dflt='none'   ;;
8477                     *)                 dflt='none'   ;;
8478                 esac ;;
8479             ' ') dflt='none' ;;
8480             *)   dflt="$ccdlflags" ;;
8481         esac
8482         rp="Any special flags to pass to $cc to use dynamic linking?"
8483         . ./myread
8484         case "$ans" in
8485             none) ccdlflags=' ' ;;
8486             *)    ccdlflags="$ans" ;;
8487         esac
8488         ;;
8489
8490     *)  usedl="$undef"
8491         ld='ld'
8492         dlsrc='dl_none.xs'
8493         lddlflags=''
8494         ccdlflags=''
8495         ;;
8496 esac
8497
8498 ld_can_script="$undef"
8499 case "$bin_ELF$usedl" in
8500     $define$define)
8501         # Abuse try.h and a.out names for neat cleanup
8502         $cat >try.c <<EOM
8503 void foo() {}
8504 void bar() {}
8505 EOM
8506         $cat >try.h <<EOM
8507 LIBTEST_42 {
8508  global:
8509   foo;
8510  local: *;
8511  };
8512 EOM
8513         if $cc $cccdlflags $ccdlflags $ccflags \
8514                $ldflags $lddlflags -o a.out try.c \
8515                -Wl,--version-script=try.h >/dev/null 2>&1 \
8516            &&  $test -s a.out ; then
8517             echo "ld supports scripting" >&4
8518             ld_can_script="$define"
8519         else
8520             echo "ld does not support scripting" >&4
8521         fi
8522         $rm_try
8523         ;;
8524 esac
8525
8526 : Do we want a shared libperl?
8527 also=''
8528 case "$usedl" in
8529 $undef)
8530         # No dynamic loading being used, so don't bother even to prompt.
8531         useshrplib='false'
8532         ;;
8533 *)      case "$useshrplib" in
8534         '')     case "$osname" in
8535                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8536                         dflt=y
8537                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8538                         ;;
8539                 *)      dflt=n
8540                         ;;
8541                 esac
8542                 ;;
8543         $define|true|[Yy]*)
8544                 dflt=y
8545                 ;;
8546         *)      dflt=n
8547                 ;;
8548         esac
8549         $cat << EOM
8550
8551 The perl executable is normally obtained by linking perlmain.c with
8552 libperl${_a}, any static extensions (usually just DynaLoader), and
8553 any other libraries needed on this system (such as -lm, etc.).  Since
8554 your system supports dynamic loading, it is probably possible to build
8555 a shared libperl.$so.  If you will have more than one executable linked
8556 to libperl.$so, this will significantly reduce the size of each
8557 executable, but it may have a noticeable effect on performance.  The
8558 default is probably sensible for your system.
8559 $also
8560
8561 EOM
8562         rp="Build a shared libperl.$so (y/n)"
8563         . ./myread
8564         case "$ans" in
8565         true|$define|[Yy]*)
8566                 useshrplib='true'  ;;
8567         *)      useshrplib='false' ;;
8568         esac
8569         ;;
8570 esac
8571
8572 case "$useshrplib" in
8573 true)
8574         case "$userelocatableinc" in
8575         true|define)
8576                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8577                 echo "See INSTALL for an explanation why that won't work." >&4
8578                 exit 4
8579                 ;;
8580         esac
8581         case "$libperl" in
8582         '')
8583                 # Figure out a good name for libperl.so.  Since it gets stored in
8584                 # a version-specific architecture-dependent library, the version
8585                 # number isn't really that important, except for making cc/ld happy.
8586                 #
8587                 # A name such as libperl.so.10.1
8588                 majmin="libperl.$so.$patchlevel.$subversion"
8589                 # A name such as libperl.so.100
8590                 majonly=`echo $patchlevel $subversion |
8591                         $awk '{printf "%d%02d", $1, $2}'`
8592                 majonly=libperl.$so.$majonly
8593                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8594                 # rely on figuring it out from the naming of libc.
8595                 case "${osname}${osvers}" in
8596                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8597                         dflt=libperl.$so
8598                         ;;
8599                 cygwin*) # ld links now against the dll directly
8600                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8601                         majonly=`echo $patchlevel $subversion |
8602                                 $awk '{printf "%03d%03d", $1, $2}'`
8603                         majonly=cygperl5.$majonly.$so
8604                         dflt=$majmin
8605                         ;;
8606                 *)      # Try to guess based on whether libc has major.minor.
8607                         case "$libc" in
8608                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8609                         *libc.$so.[0-9]*) dflt=$majonly ;;
8610                         *)      dflt=libperl.$so ;;
8611                         esac
8612                         ;;
8613                 esac
8614                 ;;
8615         *)      dflt=$libperl
8616                 ;;
8617         esac
8618         cat << EOM
8619
8620 I need to select a good name for the shared libperl.  If your system uses
8621 library names with major and minor numbers, then you might want something
8622 like $majmin.  Alternatively, if your system uses a single version
8623 number for shared libraries, then you might want to use $majonly.
8624 Or, your system might be quite happy with a simple libperl.$so.
8625
8626 Since the shared libperl will get installed into a version-specific
8627 architecture-dependent directory, the version number of the shared perl
8628 library probably isn't important, so the default should be o.k.
8629
8630 EOM
8631         rp='What name do you want to give to the shared libperl?'
8632         . ./myread
8633         libperl=$ans
8634         echo "Ok, I'll use $libperl"
8635         ;;
8636 *)
8637         libperl="libperl${_a}"
8638         ;;
8639 esac
8640
8641 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8642 case "$shrpdir" in
8643 '') ;;
8644 *)      $cat >&4 <<EOM
8645 WARNING:  Use of the shrpdir variable for the installation location of
8646 the shared $libperl is not supported.  It was never documented and
8647 will not work in this version.  Let me (perlbug@perl.org)
8648 know of any problems this may cause.
8649
8650 EOM
8651         case "$shrpdir" in
8652         "$archlibexp/CORE")
8653                 $cat >&4 <<EOM
8654 But your current setting of $shrpdir is
8655 the default anyway, so it's harmless.
8656 EOM
8657                 ;;
8658         *)
8659                 $cat >&4 <<EOM
8660 Further, your current attempted setting of $shrpdir
8661 conflicts with the value of $archlibexp/CORE
8662 that installperl will use.
8663 EOM
8664                 ;;
8665         esac
8666         ;;
8667 esac
8668
8669 # How will the perl executable find the installed shared $libperl?
8670 # Add $xxx to ccdlflags.
8671 # If we can't figure out a command-line option, use $shrpenv to
8672 # set env LD_RUN_PATH.  The main perl makefile uses this.
8673 shrpdir=$archlibexp/CORE
8674 xxx=''
8675 tmp_shrpenv=''
8676 if "$useshrplib"; then
8677     case "$osname" in
8678         aix)
8679                 # We'll set it in Makefile.SH...
8680                 ;;
8681         solaris)
8682                 xxx="-R $shrpdir"
8683                 ;;
8684         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8685                 xxx="-Wl,-R$shrpdir"
8686                 ;;
8687         bsdos|linux|irix*|dec_osf|gnu*)
8688                 xxx="-Wl,-rpath,$shrpdir"
8689                 ;;
8690         haiku)
8691                 # Haiku doesn't like the default, either.
8692                 ;;
8693         hpux*)
8694                 # hpux doesn't like the default, either.
8695                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8696                 ;;
8697         cygwin)
8698                 # cygwin needs only ldlibpth
8699                 ;;
8700         *)
8701                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8702                 ;;
8703         esac
8704         case "$xxx" in
8705         '') ;;
8706         *)
8707                 # Only add $xxx if it isn't already in ccdlflags.
8708                 case " $ccdlflags " in
8709                 *" $xxx "*)     ;;
8710                 *)      ccdlflags="$ccdlflags $xxx"
8711                         cat <<EOM >&4
8712
8713 Adding $xxx to the flags
8714 passed to $ld so that the perl executable will find the
8715 installed shared $libperl.
8716
8717 EOM
8718                         ;;
8719                 esac
8720                 ;;
8721         esac
8722 fi
8723 # Fix ccdlflags in AIX for building external extensions.
8724 # (For building Perl itself bare -bE:perl.exp is needed,
8725 #  Makefile.SH takes care of this.)
8726 case "$osname" in
8727 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8728 esac
8729 # Respect a hint or command-line value.
8730 case "$shrpenv" in
8731 '') shrpenv="$tmp_shrpenv" ;;
8732 esac
8733 case "$ldlibpthname" in
8734 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8735 none)   ldlibpthname='' ;;
8736 esac
8737
8738 : determine where manual pages are on this system
8739 echo " "
8740 case "$sysman" in
8741 '')
8742         syspath='/usr/share/man/man1 /usr/man/man1'
8743         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8744         syspath="$syspath /usr/man/u_man/man1"
8745         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8746         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8747         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8748         sysman=`./loc . /usr/man/man1 $syspath`
8749         ;;
8750 esac
8751 if $test -d "$sysman"; then
8752         echo "System manual is in $sysman." >&4
8753 else
8754         echo "Could not find manual pages in source form." >&4
8755 fi
8756
8757 : determine where manual pages go
8758 set man1dir man1dir none
8759 eval $prefixit
8760 $cat <<EOM
8761
8762 $spackage has manual pages available in source form.
8763 EOM
8764 case "$nroff" in
8765 nroff)
8766         echo "However, you don't have nroff, so they're probably useless to you."
8767         case "$man1dir" in
8768         '') man1dir="none";;
8769         esac;;
8770 esac
8771 echo "If you don't want the manual sources installed, answer 'none'."
8772 case "$man1dir" in
8773 ' ') dflt=none
8774         ;;
8775 '')
8776         lookpath="$prefixexp/share/man/man1"
8777         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8778         lookpath="$lookpath $prefixexp/man/p_man/man1"
8779         lookpath="$lookpath $prefixexp/man/u_man/man1"
8780         lookpath="$lookpath $prefixexp/man/man.1"
8781         case "$sysman" in
8782         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8783         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8784         esac
8785         set dflt
8786         eval $prefixup
8787         ;;
8788 *)  dflt="$man1dir"
8789         ;;
8790 esac
8791 echo " "
8792 fn=dn+~
8793 rp="Where do the main $spackage manual pages (source) go?"
8794 . ./getfile
8795 if $test "X$man1direxp" != "X$ansexp"; then
8796         installman1dir=''
8797 fi
8798 prefixvar=man1dir
8799 . ./setprefixvar
8800
8801 case "$man1dir" in
8802 '')     man1dir=' '
8803         installman1dir='';;
8804 esac
8805
8806 : What suffix to use on installed man pages
8807
8808 case "$man1dir" in
8809 ' ')
8810         man1ext='0'
8811         ;;
8812 *)
8813         rp="What suffix should be used for the main $spackage man pages?"
8814         case "$man1ext" in
8815         '')     case "$man1dir" in
8816                 *1)  dflt=1 ;;
8817                 *1p) dflt=1p ;;
8818                 *1pm) dflt=1pm ;;
8819                 *l) dflt=l;;
8820                 *n) dflt=n;;
8821                 *o) dflt=o;;
8822                 *p) dflt=p;;
8823                 *C) dflt=C;;
8824                 *L) dflt=L;;
8825                 *L1) dflt=L1;;
8826                 *) dflt=1;;
8827                 esac
8828                 ;;
8829         *)      dflt="$man1ext";;
8830         esac
8831         . ./myread
8832         man1ext="$ans"
8833         ;;
8834 esac
8835
8836 : see if we can have long filenames
8837 echo " "
8838 first=123456789abcdef
8839 $rm -f $first
8840 if (echo hi >$first) 2>/dev/null; then
8841         if $test -f 123456789abcde; then
8842                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8843                 val="$undef"
8844         else
8845                 echo 'You can have filenames longer than 14 characters.'>&4
8846                 val="$define"
8847         fi
8848 else
8849         $cat <<'EOM'
8850 You can't have filenames longer than 14 chars.
8851 You can't even think about them!
8852 EOM
8853         val="$undef"
8854 fi
8855 set d_flexfnam
8856 eval $setvar
8857 $rm -rf 123456789abcde*
8858
8859 : determine where library module manual pages go
8860 set man3dir man3dir none
8861 eval $prefixit
8862 $cat <<EOM
8863
8864 $spackage has manual pages for many of the library modules.
8865 EOM
8866
8867 case "$nroff" in
8868 nroff)
8869         $cat <<'EOM'
8870 However, you don't have nroff, so they're probably useless to you.
8871 EOM
8872         case "$man3dir" in
8873         '') man3dir="none";;
8874         esac;;
8875 esac
8876
8877 case "$d_flexfnam" in
8878 undef)
8879         $cat <<'EOM'
8880 However, your system can't handle the long file names like File::Basename.3.
8881 EOM
8882         case "$man3dir" in
8883         '') man3dir="none";;
8884         esac;;
8885 esac
8886
8887 echo "If you don't want the manual sources installed, answer 'none'."
8888 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8889 case "$man3dir" in
8890 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8891         if $test -d "$privlib/man/man3"; then
8892                 cat <<EOM >&4
8893
8894 WARNING:  Previous versions of perl installed man3 pages into
8895 $privlib/man/man3.  This version will suggest a
8896 new default of $dflt.
8897 EOM
8898                 tdflt=$dflt
8899                 dflt='n'
8900                 rp='Do you wish to preserve the old behavior?(y/n)'
8901                 . ./myread
8902                 case "$ans" in
8903                 y*) dflt="$privlib/man/man3" ;;
8904                 *)  dflt=$tdflt ;;
8905                 esac
8906     fi
8907         ;;
8908 *)      dflt="$man3dir" ;;
8909 esac
8910 case "$dflt" in
8911 ' ') dflt=none ;;
8912 esac
8913 echo " "
8914 fn=dn+~
8915 rp="Where do the $package library man pages (source) go?"
8916 . ./getfile
8917 prefixvar=man3dir
8918 . ./setprefixvar
8919
8920 case "$man3dir" in
8921 '')     man3dir=' '
8922         installman3dir='';;
8923 esac
8924
8925 : What suffix to use on installed man pages
8926 case "$man3dir" in
8927 ' ')
8928         man3ext='0'
8929         ;;
8930 *)
8931         rp="What suffix should be used for the $package library man pages?"
8932         case "$man3ext" in
8933         '')     case "$man3dir" in
8934                 *3)  dflt=3 ;;
8935                 *3p) dflt=3p ;;
8936                 *3pm) dflt=3pm ;;
8937                 *l) dflt=l;;
8938                 *n) dflt=n;;
8939                 *o) dflt=o;;
8940                 *p) dflt=p;;
8941                 *C) dflt=C;;
8942                 *L) dflt=L;;
8943                 *L3) dflt=L3;;
8944                 *) dflt=3;;
8945                 esac
8946                 ;;
8947         *)      dflt="$man3ext";;
8948         esac
8949         . ./myread
8950         man3ext="$ans"
8951         ;;
8952 esac
8953
8954 : see if we have to deal with yellow pages, now NIS.
8955 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8956         case "$hostcat" in
8957         nidump*) ;;
8958         *)
8959                 case "$hostcat" in
8960                 *ypcat*) dflt=y;;
8961                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8962                                 dflt=y
8963                         else
8964                                 dflt=n
8965                         fi;;
8966                 *) dflt=n;;
8967                 esac
8968                 echo " "
8969                 rp='Are you getting the hosts file via yellow pages?'
8970                 . ./myread
8971                 case "$ans" in
8972                 y*) hostcat='ypcat hosts';;
8973                 *) hostcat='cat /etc/hosts';;
8974                 esac
8975                 ;;
8976         esac
8977 fi
8978 case "$hostcat" in
8979 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8980 esac
8981 case "$groupcat" in
8982 '') test -f /etc/group && groupcat='cat /etc/group';;
8983 esac
8984 case "$passcat" in
8985 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8986 esac
8987
8988 : now get the host name
8989 echo " "
8990 echo "Figuring out host name..." >&4
8991 case "$myhostname" in
8992 '') cont=true
8993         echo 'Maybe "hostname" will work...'
8994         if tans=`sh -c hostname 2>&1` ; then
8995                 myhostname=$tans
8996                 phostname=hostname
8997                 cont=''
8998         fi
8999         ;;
9000 *) cont='';;
9001 esac
9002 if $test "$cont"; then
9003         if ./xenix; then
9004                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9005                 if tans=`cat /etc/systemid 2>&1` ; then
9006                         myhostname=$tans
9007                         phostname='cat /etc/systemid'
9008                         echo "Whadyaknow.  Xenix always was a bit strange..."
9009                         cont=''
9010                 fi
9011         elif $test -r /etc/systemid; then
9012                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9013         fi
9014 fi
9015 if $test "$cont"; then
9016         echo 'No, maybe "uuname -l" will work...'
9017         if tans=`sh -c 'uuname -l' 2>&1` ; then
9018                 myhostname=$tans
9019                 phostname='uuname -l'
9020         else
9021                 echo 'Strange.  Maybe "uname -n" will work...'
9022                 if tans=`sh -c 'uname -n' 2>&1` ; then
9023                         myhostname=$tans
9024                         phostname='uname -n'
9025                 else
9026                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9027                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9028                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9029                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9030                         else
9031                                 case "$myhostname" in
9032                                 '') echo "Does this machine have an identity crisis or something?"
9033                                         phostname='';;
9034                                 *)
9035                                         echo "Well, you said $myhostname before..."
9036                                         phostname='echo $myhostname';;
9037                                 esac
9038                         fi
9039                 fi
9040         fi
9041 fi
9042 case "$myhostname" in
9043 '') myhostname=noname ;;
9044 esac
9045 : you do not want to know about this
9046 set $myhostname
9047 myhostname=$1
9048
9049 : verify guess
9050 if $test "$myhostname" ; then
9051         dflt=y
9052         rp='Your host name appears to be "'$myhostname'".'" Right?"
9053         . ./myread
9054         case "$ans" in
9055         y*) ;;
9056         *) myhostname='';;
9057         esac
9058 fi
9059
9060 : bad guess or no guess
9061 while $test "X$myhostname" = X ; do
9062         dflt=''
9063         rp="Please type the (one word) name of your host:"
9064         . ./myread
9065         myhostname="$ans"
9066 done
9067
9068 : translate upper to lower if necessary
9069 case "$myhostname" in
9070 *[A-Z]*)
9071         echo "(Normalizing case in your host name)"
9072         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9073         ;;
9074 esac
9075
9076 case "$myhostname" in
9077 *.*)
9078         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9079         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9080         echo "(Trimming domain name from host name--host name is now $myhostname)"
9081         ;;
9082 *) case "$mydomain" in
9083         '')
9084                 {
9085                         test "X$hostcat" = "Xypcat hosts" &&
9086                         ypmatch "$myhostname" hosts 2>/dev/null |\
9087                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9088                         $test -s hosts
9089                 } || {
9090                         test "X$hostcat" != "X" &&
9091                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9092                                         /[       ]$myhostname[  . ]/p" > hosts
9093                 }
9094                 tmp_re="[       . ]"
9095                 if $test -f hosts; then
9096                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9097                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9098                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9099                                 hosts | $sort | $uniq | \
9100                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9101                         case `$echo X$dflt` in
9102                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9103                                 dflt=.
9104                                 ;;
9105                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9106                                 ;;
9107                         esac
9108                 else
9109                         echo "(I cannot locate a hosts database anywhere)"
9110                         dflt=.
9111                 fi
9112                 case "$dflt" in
9113                 .)
9114                         tans=`./loc resolv.conf X /etc /usr/etc`
9115                         if $test -f "$tans"; then
9116                                 echo "(Attempting domain name extraction from $tans)"
9117                                 dflt=.`$sed -n -e 's/   / /g' \
9118                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9119                                   -e 1q 2>/dev/null`
9120                                 case "$dflt" in
9121                                 .) dflt=.`$sed -n -e 's/        / /g' \
9122                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9123                                      -e 1q 2>/dev/null`
9124                                         ;;
9125                                 esac
9126                         fi
9127                         ;;
9128                 esac
9129                 case "$dflt" in
9130                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9131                         dflt=.`sh -c domainname 2>/dev/null`
9132                         case "$dflt" in
9133                         '') dflt='.';;
9134                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9135                         esac
9136                         ;;
9137                 esac
9138                 case "$dflt$osname" in
9139                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9140                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9141                         ;;
9142                 esac
9143                 case "$dflt" in
9144                 .) echo "(Lost all hope -- silly guess then)"
9145                         dflt='.nonet'
9146                         ;;
9147                 esac
9148                 $rm -f hosts
9149                 ;;
9150         *) dflt="$mydomain";;
9151         esac;;
9152 esac
9153 echo " "
9154 rp="What is your domain name?"
9155 . ./myread
9156 tans="$ans"
9157 case "$ans" in
9158 '') ;;
9159 .*) ;;
9160 *) tans=".$tans";;
9161 esac
9162 mydomain="$tans"
9163
9164 : translate upper to lower if necessary
9165 case "$mydomain" in
9166 *[A-Z]*)
9167         echo "(Normalizing case in your domain name)"
9168         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9169         ;;
9170 esac
9171
9172 : a little sanity check here
9173 case "$phostname" in
9174 '') ;;
9175 *)
9176         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9177         $myhostname$mydomain|$myhostname) ;;
9178         *)
9179                 case "$phostname" in
9180                 sed*)
9181                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9182                         ;;
9183                 *)
9184                         echo "(That doesn't agree with your $phostname command, by the way.)"
9185                         ;;
9186                 esac
9187         ;;
9188         esac
9189         ;;
9190 esac
9191
9192 : determine the e-mail address of the user who is running us
9193 $cat <<EOM
9194
9195 I need to get your e-mail address in Internet format if possible, i.e.
9196 something like user@host.domain. Please answer accurately since I have
9197 no easy means to double check it. The default value provided below
9198 is most probably close to reality but may not be valid from outside
9199 your organization...
9200
9201 EOM
9202 cont=x
9203 while test "$cont"; do
9204         case "$MAILDOMAIN" in
9205         '')
9206                 if $test -s /etc/mailname; then
9207                         maildomain=`$cat /etc/mailname`
9208                 else
9209                         maildomain="$myhostname$mydomain"
9210                 fi
9211                 ;;
9212         *)  maildomain="$MAILDOMAIN";;
9213         esac
9214         case "$cf_email" in
9215         '') dflt="$cf_by@$maildomain";;
9216         *)  dflt="$cf_email";;
9217         esac
9218         rp='What is your e-mail address?'
9219         . ./myread
9220         cf_email="$ans"
9221         case "$cf_email" in
9222         *@*.*) cont='' ;;
9223         *)
9224                 rp='Address does not look like an Internet one.  Use it anyway?'
9225                 case "$fastread" in
9226                 yes) dflt=y ;;
9227                 *) dflt=n ;;
9228                 esac
9229                 . ./myread
9230                 case "$ans" in
9231                 y*) cont='' ;;
9232                 *) echo " " ;;
9233                 esac
9234                 ;;
9235         esac
9236 done
9237
9238 : Ask e-mail of administrator
9239 $cat <<EOM
9240
9241 If you or somebody else will be maintaining perl at your site, please
9242 fill in the correct e-mail address here so that they may be contacted
9243 if necessary. Currently, the "perlbug" program included with perl
9244 will send mail to this address in addition to perlbug@perl.org. You may
9245 enter "none" for no administrator.
9246
9247 EOM
9248 case "$perladmin" in
9249 '') dflt="$cf_email";;
9250 *) dflt="$perladmin";;
9251 esac
9252 rp='Perl administrator e-mail address'
9253 . ./myread
9254 perladmin="$ans"
9255
9256 : determine whether to only install version-specific parts.
9257 echo " "
9258 $cat <<EOM
9259 Do you want to install only the version-specific parts of the perl
9260 distribution?  Usually you do *not* want to do this.
9261 EOM
9262 case "$versiononly" in
9263 "$define"|[Yy]*|true) dflt='y' ;;
9264 *) dflt='n';
9265 esac
9266 rp="Do you want to install only the version-specific parts of perl?"
9267 . ./myread
9268 case "$ans" in
9269 [yY]*)  val="$define";;
9270 *)      val="$undef" ;;
9271 esac
9272 set versiononly
9273 eval $setvar
9274
9275 case "$versiononly" in
9276 "$define") inc_version_list=''
9277            inc_version_list_init=0
9278            ;;
9279 esac
9280
9281 : figure out how to guarantee perl startup
9282 : XXX Note that this currently takes advantage of the bug that binexp ignores
9283 :     the Configure -Dinstallprefix setting, which in turn means that under
9284 :     relocatable @INC, initialinstalllocation is what binexp started as.
9285 case "$startperl" in
9286 '')
9287         case "$sharpbang" in
9288         *!)
9289                 $cat <<EOH
9290
9291 I can use the #! construct to start perl on your system. This will
9292 make startup of perl scripts faster, but may cause problems if you
9293 want to share those scripts and perl is not in a standard place
9294 ($initialinstalllocation/perl) on all your platforms. The alternative
9295 is to force a shell by starting the script with a single ':' character.
9296
9297 EOH
9298                 case "$versiononly" in
9299                 "$define")      dflt="$initialinstalllocation/perl$version";;
9300                 *)              dflt="$initialinstalllocation/perl";;
9301                 esac
9302                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9303                 . ./myread
9304                 case "$ans" in
9305                 none)   startperl=": # use perl";;
9306                 *)      startperl="#!$ans"
9307                         if $test 30 -lt `echo "$ans" | wc -c`; then
9308                                 $cat >&4 <<EOM
9309
9310 WARNING:  Some systems limit the #! command to 32 characters.
9311 If you experience difficulty running Perl scripts with #!, try
9312 installing Perl in a directory with a shorter pathname.
9313
9314 EOM
9315                         fi ;;
9316                 esac
9317                 ;;
9318         *) startperl=": # use perl"
9319                 ;;
9320         esac
9321         ;;
9322 esac
9323 echo "I'll use $startperl to start perl scripts."
9324
9325 : figure best path for perl in scripts
9326 case "$perlpath" in
9327 '')
9328         case "$versiononly" in
9329         "$define")      perlpath="$initialinstalllocation/perl$version";;
9330         *)              perlpath="$initialinstalllocation/perl";;
9331         esac
9332         case "$startperl" in
9333         *!*) ;;
9334         *)
9335                 $cat <<EOH
9336
9337 I will use the "eval 'exec'" idiom to start Perl on your system.
9338 I can use the full path of your Perl binary for this purpose, but
9339 doing so may cause problems if you want to share those scripts and
9340 Perl is not always in a standard place ($initialinstalllocation/perl).
9341
9342 EOH
9343                 dflt="$initialinstalllocation/perl"
9344                 rp="What path shall I use in \"eval 'exec'\"?"
9345                 . ./myread
9346                 perlpath="$ans"
9347                 ;;
9348         esac
9349         ;;
9350 esac
9351 case "$startperl" in
9352 *!*)    ;;
9353 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9354 esac
9355
9356 : determine where public executable scripts go
9357 set scriptdir scriptdir
9358 eval $prefixit
9359 case "$scriptdir" in
9360 '')
9361         dflt="$bin"
9362         : guess some guesses
9363         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9364         $test -d /usr/share/bin     && dflt=/usr/share/bin
9365         $test -d /usr/local/script  && dflt=/usr/local/script
9366         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9367         $test -d $prefixexp/script  && dflt=$prefixexp/script
9368         set dflt
9369         eval $prefixup
9370         ;;
9371 *)  dflt="$scriptdir"
9372         ;;
9373 esac
9374 $cat <<EOM
9375
9376 Some installations have a separate directory just for executable scripts so
9377 that they can mount it across multiple architectures but keep the scripts in
9378 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9379 Or you might just lump your scripts in with all your other executables.
9380
9381 EOM
9382 fn=d~
9383 rp='Where do you keep publicly executable scripts?'
9384 . ./getfile
9385 if $test "X$ansexp" != "X$scriptdirexp"; then
9386         installscript=''
9387 fi
9388 installscriptdir=''
9389 prefixvar=scriptdir
9390 . ./setprefixvar
9391 : A little fix up for an irregularly named variable.
9392 installscript="$installscriptdir"
9393
9394 : determine where add-on public executables go
9395 case "$sitebin" in
9396 '')     dflt=$siteprefix/bin ;;
9397 *)      dflt=$sitebin ;;
9398 esac
9399 fn=d~
9400 rp='Pathname where the add-on public executables should be installed?'
9401 . ./getfile
9402 prefixvar=sitebin
9403 . ./setprefixvar
9404
9405 : determine where add-on html pages go
9406 : There is no standard location, so try to copy the previously-selected
9407 : directory structure for the core html pages.
9408 case "$sitehtml1dir" in
9409 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9410 *)     dflt=$sitehtml1dir ;;
9411 esac
9412 case "$dflt" in
9413 ''|' ') dflt=none ;;
9414 esac
9415 fn=dn+~
9416 rp='Pathname where the site-specific html pages should be installed?'
9417 . ./getfile
9418 prefixvar=sitehtml1dir
9419 . ./setprefixvar
9420
9421 : determine where add-on library html pages go
9422 : There is no standard location, so try to copy the previously-selected
9423 : directory structure for the core html pages.
9424 case "$sitehtml3dir" in
9425 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9426 *)     dflt=$sitehtml3dir ;;
9427 esac
9428 case "$dflt" in
9429 ''|' ') dflt=none ;;
9430 esac
9431 fn=dn+~
9432 rp='Pathname where the site-specific library html pages should be installed?'
9433 . ./getfile
9434 prefixvar=sitehtml3dir
9435 . ./setprefixvar
9436
9437 : determine where add-on manual pages go
9438 case "$siteman1dir" in
9439 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9440 *)      dflt=$siteman1dir ;;
9441 esac
9442 case "$dflt" in
9443 ''|' ') dflt=none ;;
9444 esac
9445 fn=dn+~
9446 rp='Pathname where the site-specific manual pages should be installed?'
9447 . ./getfile
9448 prefixvar=siteman1dir
9449 . ./setprefixvar
9450
9451 : determine where add-on library man pages go
9452 case "$siteman3dir" in
9453 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9454 *)      dflt=$siteman3dir ;;
9455 esac
9456 case "$dflt" in
9457 ''|' ') dflt=none ;;
9458 esac
9459 fn=dn+~
9460 rp='Pathname where the site-specific library manual pages should be installed?'
9461 . ./getfile
9462 prefixvar=siteman3dir
9463 . ./setprefixvar
9464
9465 : determine where add-on public executable scripts go
9466 case "$sitescript" in
9467 '')     dflt=$siteprefix/script
9468         $test -d $dflt || dflt=$sitebin ;;
9469 *)  dflt="$sitescript" ;;
9470 esac
9471 fn=d~+
9472 rp='Pathname where add-on public executable scripts should be installed?'
9473 . ./getfile
9474 prefixvar=sitescript
9475 . ./setprefixvar
9476
9477 : see if backtrace exists
9478 set backtrace d_backtrace
9479 eval $inlibc
9480
9481 : add flags if using c backtrace
9482 case "$usecbacktrace" in
9483   "") usecbacktrace=$undef ;;
9484   [yY]*|true|$define)
9485     case "$d_backtrace" in
9486       [yY]*|true|$define)
9487         case " $ccflags " in
9488           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9489           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9490           esac
9491         ;;
9492       *)
9493         echo "This system does not support backtrace" >&4
9494         usecbacktrace=$undef
9495         ;;
9496       esac
9497     ;;
9498   esac
9499
9500 : Check if faststdio is requested and available
9501 case "$usefaststdio" in
9502 $define|true|[yY]*|'')
9503         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9504         case "$xversion" in
9505         [68])   dflt='y' ;;
9506         *)      dflt='n' ;;
9507         esac
9508         ;;
9509 *) dflt='n';;
9510 esac
9511 cat <<EOM
9512
9513 Perl can be built to use 'fast stdio', which means using the stdio
9514 library but also directly manipulating the stdio buffers to enable
9515 faster I/O.  Using stdio is better for backward compatibility (especially
9516 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9517 interface has been preferred instead of stdio.
9518
9519 If this doesn't make any sense to you, just accept the default '$dflt'.
9520 EOM
9521 rp='Use the "fast stdio" if available?'
9522 . ./myread
9523 case "$ans" in
9524 y|Y)    val="$define" ;;
9525 *)      val="$undef" ;;
9526 esac
9527 set usefaststdio
9528 eval $setvar
9529
9530
9531 : define an is-a-typedef? function
9532 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9533 case "$inclist" in
9534 "") inclist="sys/types.h";;
9535 esac;
9536 eval "varval=\$$var";
9537 case "$varval" in
9538 "")
9539         $rm -f temp.c;
9540         for inc in $inclist; do
9541                 echo "#include <$inc>" >>temp.c;
9542         done;
9543         echo "#ifdef $type" >> temp.c;
9544         echo "printf(\"We have $type\");" >> temp.c;
9545         echo "#endif" >> temp.c;
9546         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9547         if $contains $type temp.E >/dev/null 2>&1; then
9548                 eval "$var=\$type";
9549         else
9550                 eval "$var=\$def";
9551         fi;
9552         $rm -f temp.?;;
9553 *) eval "$var=\$varval";;
9554 esac'
9555
9556 : define an is-a-typedef? function that prompts if the type is not available.
9557 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9558 case "$inclist" in
9559 "") inclist="sys/types.h";;
9560 esac;
9561 eval "varval=\$$var";
9562 case "$varval" in
9563 "")
9564         $rm -f temp.c;
9565         for inc in $inclist; do
9566                 echo "#include <$inc>" >>temp.c;
9567         done;
9568         echo "#ifdef $type" >> temp.c;
9569         echo "printf(\"We have $type\");" >> temp.c;
9570         echo "#endif" >> temp.c;
9571         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9572         echo " " ;
9573         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9574         if $contains $type temp.E >/dev/null 2>&1; then
9575                 echo "$type found." >&4;
9576                 eval "$var=\$type";
9577         else
9578                 echo "$type NOT found." >&4;
9579                 dflt="$def";
9580                 . ./myread ;
9581                 eval "$var=\$ans";
9582         fi;
9583         $rm -f temp.?;;
9584 *) eval "$var=\$varval";;
9585 esac'
9586
9587 : see what type lseek is declared as in the kernel
9588 rp="What is the type used for lseek's offset on this system?"
9589 set off_t lseektype long stdio.h sys/types.h
9590 eval $typedef_ask
9591
9592 echo " "
9593 echo "Checking to see how big your file offsets are..." >&4
9594 $cat >try.c <<EOCP
9595 #include <sys/types.h>
9596 #include <stdio.h>
9597 int main()
9598 {
9599     printf("%d\n", (int)sizeof($lseektype));
9600     return(0);
9601 }
9602 EOCP
9603 set try
9604 if eval $compile_ok; then
9605         lseeksize=`$run ./try`
9606         echo "Your file offsets are $lseeksize bytes long."
9607 else
9608         dflt=$longsize
9609         echo " "
9610         echo "(I can't seem to compile the test program.  Guessing...)"
9611         rp="What is the size of your file offsets (in bytes)?"
9612         . ./myread
9613         lseeksize="$ans"
9614 fi
9615 $rm_try
9616
9617 : see what type file positions are declared as in the library
9618 rp="What is the type for file position used by fsetpos()?"
9619 set fpos_t fpostype long stdio.h sys/types.h
9620 eval $typedef_ask
9621
9622 : Check size for Fpos_t
9623 echo " "
9624 case "$fpostype" in
9625 *_t) zzz="$fpostype"    ;;
9626 *)   zzz="fpos_t"       ;;
9627 esac
9628 echo "Checking the size of $zzz..." >&4
9629 cat > try.c <<EOCP
9630 #include <sys/types.h>
9631 #include <stdio.h>
9632 #$i_stdlib I_STDLIB
9633 #ifdef I_STDLIB
9634 #include <stdlib.h>
9635 #endif
9636 int main() {
9637     printf("%d\n", (int)sizeof($fpostype));
9638     exit(0);
9639 }
9640 EOCP
9641 set try
9642 if eval $compile_ok; then
9643         yyy=`$run ./try`
9644         case "$yyy" in
9645         '')     fpossize=4
9646                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9647                 ;;
9648         *)      fpossize=$yyy
9649                 echo "Your $zzz is $fpossize bytes long."
9650                 ;;
9651         esac
9652 else
9653         dflt="$longsize"
9654         echo " " >&4
9655         echo "(I can't compile the test program.  Guessing...)" >&4
9656         rp="What is the size of your file positions (in bytes)?"
9657         . ./myread
9658         fpossize="$ans"
9659 fi
9660
9661 : Check for large file support
9662 # Backward compatibility (uselfs is deprecated).
9663 case "$uselfs" in
9664 "$define"|true|[yY]*)
9665         cat <<EOM >&4
9666
9667 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9668 EOM
9669         uselargefiles="$define"
9670         ;;
9671 esac
9672
9673 case "$lseeksize:$fpossize" in
9674 8:8) cat <<EOM
9675
9676 You can have files larger than 2 gigabytes.
9677 EOM
9678    val="$define" ;;
9679 *)    case "$uselargefiles" in
9680    "$undef"|false|[nN]*) dflt='n' ;;
9681    *)   dflt='y' ;;
9682    esac
9683    cat <<EOM
9684
9685 Perl can be built to understand large files (files larger than 2 gigabytes)
9686 on some systems.  To do so, Configure can be run with -Duselargefiles.
9687
9688 If this doesn't make any sense to you, just accept the default '$dflt'.
9689 EOM
9690    rp='Try to understand large files, if available?'
9691    . ./myread
9692    case "$ans" in
9693    y|Y)         val="$define" ;;
9694    *)           val="$undef"  ;;
9695    esac
9696    ;;
9697 esac
9698 set uselargefiles
9699 eval $setvar
9700 : Look for a hint-file generated 'call-back-unit'.  If the
9701 : user has specified that a large files perl is to be built,
9702 : we may need to set or change some other defaults.
9703 if $test -f uselargefiles.cbu; then
9704         echo "Your platform has some specific hints regarding large file builds, using them..."
9705         . ./uselargefiles.cbu
9706 fi
9707 case "$uselargefiles" in
9708 "$define")
9709         if $test -f uselargefiles.cbu; then
9710                 echo " "
9711                 echo "Rechecking to see how big your file offsets are..." >&4
9712                 $cat >try.c <<EOCP
9713 #include <sys/types.h>
9714 #include <stdio.h>
9715 int main()
9716 {
9717     printf("%d\n", (int)sizeof($lseektype));
9718     return(0);
9719 }
9720 EOCP
9721                 set try
9722                 if eval $compile_ok; then
9723                         lseeksize=`$run ./try`
9724                         $echo "Your file offsets are now $lseeksize bytes long."
9725                 else
9726                         dflt="$lseeksize"
9727                         echo " "
9728                         echo "(I can't seem to compile the test program.  Guessing...)"
9729                         rp="What is the size of your file offsets (in bytes)?"
9730                         . ./myread
9731                         lseeksize="$ans"
9732                 fi
9733                 case "$fpostype" in
9734                 *_t) zzz="$fpostype"    ;;
9735                 *)   zzz="fpos_t"       ;;
9736                 esac
9737                 $echo $n "Rechecking the size of $zzz...$c" >&4
9738                 $cat > try.c <<EOCP
9739 #include <sys/types.h>
9740 #include <stdio.h>
9741 #$i_stdlib I_STDLIB
9742 #ifdef I_STDLIB
9743 #include <stdlib.h>
9744 #endif
9745 int main() {
9746     printf("%d\n", (int)sizeof($fpostype));
9747     return(0);
9748 }
9749 EOCP
9750                 set try
9751                 if eval $compile_ok; then
9752                         yyy=`$run ./try`
9753                         dflt="$lseeksize"
9754                         case "$yyy" in
9755                         '')     echo " "
9756                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9757                                 ;;
9758                         *)      fpossize=$yyy
9759                                 echo " $fpossize bytes." >&4
9760                                 ;;
9761                         esac
9762                 else
9763                         dflt="$fpossize"
9764                         echo " "
9765                         echo "(I can't compile the test program.  Guessing...)" >&4
9766                         rp="What is the size of your file positions (in bytes)?"
9767                         . ./myread
9768                         fpossize="$ans"
9769                 fi
9770                 $rm_try
9771         fi
9772         ;;
9773 esac
9774
9775 : Check if we want perlio
9776 useperlio="$define"
9777
9778 : Set the vendorbin variables
9779 case "$vendorprefix" in
9780 '')     d_vendorbin="$undef"
9781         vendorbin=''
9782         vendorbinexp=''
9783         ;;
9784 *)      d_vendorbin="$define"
9785         : determine where vendor-supplied executables go.
9786         case "$vendorbin" in
9787         '') dflt=$vendorprefix/bin ;;
9788         *)      dflt="$vendorbin" ;;
9789         esac
9790         fn=d~+
9791         rp='Pathname for the vendor-supplied executables directory?'
9792         . ./getfile
9793         vendorbin="$ans"
9794         vendorbinexp="$ansexp"
9795         ;;
9796 esac
9797 prefixvar=vendorbin
9798 . ./installprefix
9799
9800 : Set the vendorhtml1dir variables
9801 case "$vendorprefix" in
9802 '')     vendorhtml1dir=''
9803         vendorhtml1direxp=''
9804         ;;
9805 *)      : determine where vendor-supplied html pages go.
9806         : There is no standard location, so try to copy the previously-selected
9807         : directory structure for the core html pages.
9808         : XXX Better default suggestions would be welcome.
9809         case "$vendorhtml1dir" in
9810         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9811         *)      dflt=$vendorhtml1dir ;;
9812         esac
9813         case "$dflt" in
9814         ''|' ') dflt=none ;;
9815         esac
9816         fn=dn+~
9817         rp='Pathname for the vendor-supplied html pages?'
9818         . ./getfile
9819         vendorhtml1dir="$ans"
9820         vendorhtml1direxp="$ansexp"
9821         ;;
9822 esac
9823 : Use ' ' for none so value is preserved next time through Configure
9824 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9825 prefixvar=vendorhtml1dir
9826 . ./installprefix
9827
9828 : Set the vendorhtml3dir variables
9829 case "$vendorprefix" in
9830 '')     vendorhtml3dir=''
9831         vendorhtml3direxp=''
9832         ;;
9833 *)      : determine where vendor-supplied module html pages go.
9834         : There is no standard location, so try to copy the previously-selected
9835         : directory structure for the core html pages.
9836         : XXX Better default suggestions would be welcome.
9837         case "$vendorhtml3dir" in
9838         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9839         *)      dflt=$vendorhtml3dir ;;
9840         esac
9841         case "$dflt" in
9842         ''|' ') dflt=none ;;
9843         esac
9844         fn=dn+~
9845         rp='Pathname for the vendor-supplied html pages?'
9846         . ./getfile
9847         vendorhtml3dir="$ans"
9848         vendorhtml3direxp="$ansexp"
9849         ;;
9850 esac
9851 : Use ' ' for none so value is preserved next time through Configure
9852 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9853 prefixvar=vendorhtml3dir
9854 . ./installprefix
9855
9856 : Set the vendorman1dir variables
9857 case "$vendorprefix" in
9858 '')     vendorman1dir=''
9859         vendorman1direxp=''
9860         ;;
9861 *)      : determine where vendor-supplied manual pages go.
9862         case "$vendorman1dir" in
9863         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9864         *)      dflt=$vendorman1dir ;;
9865         esac
9866         case "$dflt" in
9867         ''|' ') dflt=none ;;
9868         esac
9869         fn=nd~+
9870         rp='Pathname for the vendor-supplied manual section 1 pages?'
9871         . ./getfile
9872         vendorman1dir="$ans"
9873         vendorman1direxp="$ansexp"
9874         ;;
9875 esac
9876 : Use ' ' for none so value is preserved next time through Configure
9877 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9878 prefixvar=vendorman1dir
9879 . ./installprefix
9880
9881 : Set the vendorman3dir variables
9882 case "$vendorprefix" in
9883 '')     vendorman3dir=''
9884         vendorman3direxp=''
9885         ;;
9886 *)      : determine where vendor-supplied module manual pages go.
9887         case "$vendorman3dir" in
9888         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9889         *)      dflt=$vendorman3dir ;;
9890         esac
9891         case "$dflt" in
9892         ''|' ') dflt=none ;;
9893         esac
9894         fn=nd~+
9895         rp='Pathname for the vendor-supplied manual section 3 pages?'
9896         . ./getfile
9897         vendorman3dir="$ans"
9898         vendorman3direxp="$ansexp"
9899         ;;
9900 esac
9901 : Use ' ' for none so value is preserved next time through Configure
9902 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9903 prefixvar=vendorman3dir
9904 . ./installprefix
9905
9906 : Set the vendorscript variables
9907 case "$vendorprefix" in
9908 '')     d_vendorscript="$undef"
9909         vendorscript=''
9910         vendorscriptexp=''
9911         ;;
9912 *)      d_vendorscript="$define"
9913         : determine where vendor-supplied scripts go.
9914         case "$vendorscript" in
9915         '')     dflt=$vendorprefix/script
9916                 $test -d $dflt || dflt=$vendorbin ;;
9917         *)  dflt="$vendorscript" ;;
9918         esac
9919         $cat <<EOM
9920
9921 The installation process will create a directory for
9922 vendor-supplied scripts.
9923
9924 EOM
9925         fn=d~+
9926         rp='Pathname for the vendor-supplied scripts directory?'
9927         . ./getfile
9928         vendorscript="$ans"
9929         vendorscriptexp="$ansexp"
9930         ;;
9931 esac
9932 prefixvar=vendorscript
9933 . ./installprefix
9934
9935 : script used to emit important warnings
9936 cat >warn <<EOS
9937 $startsh
9938 if test \$# -gt 0; then
9939         echo "\$@" >msg
9940 else
9941         cat >msg
9942 fi
9943 echo "*** WARNING:" >&4
9944 sed -e 's/^/*** /' <msg >&4
9945 echo "*** " >&4
9946 cat msg >>config.msg
9947 echo " " >>config.msg
9948 rm -f msg
9949 EOS
9950 chmod +x warn
9951 $eunicefix warn
9952
9953 : see which of string.h or strings.h is needed
9954 echo " "
9955 strings=`./findhdr string.h`
9956 if $test "$strings" && $test -r "$strings"; then
9957         echo "Using <string.h> instead of <strings.h>." >&4
9958         val="$define"
9959 else
9960         val="$undef"
9961         strings=`./findhdr strings.h`
9962         if $test "$strings" && $test -r "$strings"; then
9963                 echo "Using <strings.h> instead of <string.h>." >&4
9964         else
9965                 ./warn "No string header found -- You'll surely have problems."
9966         fi
9967 fi
9968 set i_string
9969 eval $setvar
9970 case "$i_string" in
9971 "$undef") strings=`./findhdr strings.h`;;
9972 *)        strings=`./findhdr string.h`;;
9973 esac
9974
9975 : see if qgcvt exists
9976 set qgcvt d_qgcvt
9977 eval $inlibc
9978
9979 : Check print/scan long double stuff
9980 echo " "
9981
9982 if $test X"$d_longdbl" = X"$define"; then
9983
9984 echo "Checking how to print long doubles..." >&4
9985
9986 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9987         $cat >try.c <<'EOCP'
9988 #include <sys/types.h>
9989 #include <stdio.h>
9990 int main() {
9991   double d = 123.456;
9992   printf("%.3f\n", d);
9993 }
9994 EOCP
9995         set try
9996         if eval $compile; then
9997                 yyy=`$run ./try`
9998                 case "$yyy" in
9999                 123.456)
10000                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10001                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10002                         echo "We will use %f."
10003                         ;;
10004                 esac
10005         fi
10006 fi
10007
10008 if $test X"$sPRIfldbl" = X; then
10009         $cat >try.c <<'EOCP'
10010 #include <sys/types.h>
10011 #include <stdio.h>
10012 int main() {
10013   long double d = 123.456;
10014   printf("%.3Lf\n", d);
10015 }
10016 EOCP
10017         set try
10018         if eval $compile; then
10019                 yyy=`$run ./try`
10020                 case "$yyy" in
10021                 123.456)
10022                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10023                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10024                         echo "We will use %Lf."
10025                         ;;
10026                 esac
10027         fi
10028 fi
10029
10030 if $test X"$sPRIfldbl" = X; then
10031         $cat >try.c <<'EOCP'
10032 #include <sys/types.h>
10033 #include <stdio.h>
10034 int main() {
10035   long double d = 123.456;
10036   printf("%.3llf\n", d);
10037 }
10038 EOCP
10039         set try
10040         if eval $compile; then
10041                 yyy=`$run ./try`
10042                 case "$yyy" in
10043                 123.456)
10044                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10045                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10046                         echo "We will use %llf."
10047                         ;;
10048                 esac
10049         fi
10050 fi
10051
10052 if $test X"$sPRIfldbl" = X; then
10053         $cat >try.c <<'EOCP'
10054 #include <sys/types.h>
10055 #include <stdio.h>
10056 int main() {
10057   long double d = 123.456;
10058   printf("%.3lf\n", d);
10059 }
10060 EOCP
10061         set try
10062         if eval $compile; then
10063                 yyy=`$run ./try`
10064                 case "$yyy" in
10065                 123.456)
10066                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10067                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10068                         echo "We will use %lf."
10069                         ;;
10070                 esac
10071         fi
10072 fi
10073
10074 if $test X"$sPRIfldbl" = X; then
10075         echo "Cannot figure out how to print long doubles." >&4
10076 else
10077         sSCNfldbl=$sPRIfldbl    # expect consistency
10078 fi
10079
10080 $rm_try
10081
10082 fi # d_longdbl
10083
10084 case "$sPRIfldbl" in
10085 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10086         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10087         d_SCNfldbl="$undef";
10088         ;;
10089 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10090         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10091         d_SCNfldbl="$define";
10092         ;;
10093 esac
10094
10095 : Check how to convert floats to strings.
10096
10097 if test "X$d_Gconvert" = X; then
10098
10099 echo " "
10100 echo "Checking for an efficient way to convert floats to strings."
10101 echo " " > try.c
10102 case "$uselongdouble" in
10103 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10104 esac
10105 case "$d_longdbl" in
10106 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10107 esac
10108 case "$d_PRIgldbl" in
10109 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10110 esac
10111 $cat >>try.c <<EOP
10112 #ifdef TRY_gconvert
10113 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10114 char *myname = "gconvert";
10115 #endif
10116 #ifdef TRY_gcvt
10117 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10118 char *myname = "gcvt";
10119 #endif
10120 #ifdef TRY_qgcvt
10121 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10122 char *myname = "qgcvt";
10123 #define DOUBLETYPE long double
10124 #endif
10125 #ifdef TRY_sprintf
10126 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10127 #ifdef HAS_PRIgldbl
10128 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10129 #else
10130 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10131 #endif
10132 #else
10133 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10134 #endif
10135 char *myname = "sprintf";
10136 #endif
10137
10138 #ifndef DOUBLETYPE
10139 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10140 #define DOUBLETYPE long double
10141 #else
10142 #define DOUBLETYPE double
10143 #endif
10144 #endif
10145
10146 #include <stdio.h>
10147
10148 #$i_stdlib I_STDLIB
10149 #ifdef I_STDLIB
10150 #include <stdlib.h>
10151 #endif
10152 #$i_string I_STRING
10153 #ifdef I_STRING
10154 #  include <string.h>
10155 #else
10156 #  include <strings.h>
10157 #endif
10158
10159 int checkit(char *expect, char *got)
10160 {
10161     if (strcmp(expect, got)) {
10162                 printf("%s oddity:  Expected %s, got %s\n",
10163                         myname, expect, got);
10164                 exit(1);
10165         }
10166 }
10167
10168 int main()
10169 {
10170         char buf[64];
10171         buf[63] = '\0';
10172
10173         /* This must be 1st test on (which?) platform */
10174         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10175         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10176         checkit("0.1", buf);
10177
10178         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10179         checkit("0.01", buf);
10180
10181         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10182         checkit("0.001", buf);
10183
10184         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10185         checkit("0.0001", buf);
10186
10187         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10188         if (strlen(buf) > 5)
10189             checkit("9e-005", buf); /* for Microsoft ?? */
10190         else
10191             checkit("9e-05", buf);
10192
10193         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10194         checkit("1", buf);
10195
10196         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10197         checkit("1.1", buf);
10198
10199         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10200         checkit("1.01", buf);
10201
10202         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10203         checkit("1.001", buf);
10204
10205         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10206         checkit("1.0001", buf);
10207
10208         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10209         checkit("1.00001", buf);
10210
10211         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10212         checkit("1.000001", buf);
10213
10214         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10215         checkit("0", buf);
10216
10217         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10218         checkit("-1", buf);
10219
10220         /* Some Linux gcvt's give 1.e+5 here. */
10221         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10222         checkit("100000", buf);
10223
10224         /* Some Linux gcvt's give -1.e+5 here. */
10225         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10226         checkit("-100000", buf);
10227
10228         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10229         checkit("123.456", buf);
10230
10231         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10232         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10233         /* 34 should be enough to scare even long double
10234          * places into using the e notation. */
10235         if (strlen(buf) > 5)
10236             checkit("1e+034", buf); /* for Microsoft */
10237         else
10238             checkit("1e+34", buf);
10239
10240         /* For Perl, if you add additional tests here, also add them to
10241          * t/base/num.t for benefit of platforms not using Configure or
10242          * overriding d_Gconvert */
10243
10244         exit(0);
10245 }
10246 EOP
10247 : first add preferred functions to our list
10248 xxx_list=""
10249 for xxx_convert in $gconvert_preference; do
10250     case $xxx_convert in
10251     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10252     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10253     esac
10254 done
10255 : then add any others
10256 for xxx_convert in gconvert gcvt sprintf; do
10257     case "$xxx_list" in
10258     *$xxx_convert*) ;;
10259     *) xxx_list="$xxx_list $xxx_convert" ;;
10260     esac
10261 done
10262
10263 case "$d_longdbl$uselongdouble" in
10264 "$define$define")
10265     : again, add preferred functions to our list first
10266     xxx_ld_list=""
10267     for xxx_convert in $gconvert_ld_preference; do
10268         case $xxx_convert in
10269         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10270         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10271         esac
10272     done
10273     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10274     for xxx_convert in qgcvt sprintf $xxx_list; do
10275         case "$xxx_ld_list" in
10276         $xxx_convert*|*" $xxx_convert"*) ;;
10277         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10278         esac
10279     done
10280     : if sprintf cannot do long doubles, move it to the end
10281     if test "$d_PRIgldbl" != "$define"; then
10282         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10283     fi
10284     : if no qgcvt, remove it
10285     if test "$d_qgcvt" != "$define"; then
10286         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10287     fi
10288     : use the ld_list
10289     xxx_list="$xxx_ld_list"
10290     ;;
10291 esac
10292
10293 for xxx_convert in $xxx_list; do
10294         echo "Trying $xxx_convert..."
10295         $rm -f try try$_o core
10296         set try -DTRY_$xxx_convert
10297         if eval $compile; then
10298                 echo "$xxx_convert() found." >&4
10299                 if $run ./try; then
10300                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10301                         break;
10302                 else
10303                         echo "...But $xxx_convert didn't work as I expected."
10304                         xxx_convert=''
10305                 fi
10306         else
10307                 echo "$xxx_convert NOT found." >&4
10308         fi
10309 done
10310
10311 if test X$xxx_convert = X; then
10312     echo "*** WHOA THERE!!! ***" >&4
10313     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10314     xxx_convert=sprintf
10315 fi
10316
10317 case "$xxx_convert" in
10318 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10319 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10320 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10321 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10322    "$define$define$define")
10323       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10324    "$define$define$undef")
10325       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10326    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10327    esac
10328    ;;
10329 esac
10330
10331 fi
10332 $rm_try
10333
10334 : see if _fwalk exists
10335 set fwalk d__fwalk
10336 eval $inlibc
10337
10338 : Initialize h_fcntl
10339 h_fcntl=false
10340
10341 : Initialize h_sysfile
10342 h_sysfile=false
10343
10344 : access call always available on UNIX
10345 set access d_access
10346 eval $inlibc
10347
10348 : locate the flags for 'access()'
10349 case "$d_access" in
10350 "$define")
10351         echo " "
10352         $cat >access.c <<EOCP
10353 #include <sys/types.h>
10354 #ifdef I_FCNTL
10355 #include <fcntl.h>
10356 #endif
10357 #ifdef I_SYS_FILE
10358 #include <sys/file.h>
10359 #endif
10360 #ifdef I_UNISTD
10361 #include <unistd.h>
10362 #endif
10363 #$i_stdlib I_STDLIB
10364 #ifdef I_STDLIB
10365 #include <stdlib.h>
10366 #endif
10367 int main() {
10368         exit(R_OK);
10369 }
10370 EOCP
10371         : check sys/file.h first, no particular reason here
10372         if $test `./findhdr sys/file.h` && \
10373                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10374                 h_sysfile=true;
10375                 echo "<sys/file.h> defines the *_OK access constants." >&4
10376         elif $test `./findhdr fcntl.h` && \
10377                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10378                 h_fcntl=true;
10379                 echo "<fcntl.h> defines the *_OK access constants." >&4
10380         elif $test `./findhdr unistd.h` && \
10381                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10382                 echo "<unistd.h> defines the *_OK access constants." >&4
10383         else
10384                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10385         fi
10386         ;;
10387 esac
10388 $rm -f access*
10389
10390 : see if accessx exists
10391 set accessx d_accessx
10392 eval $inlibc
10393
10394 : see if acosh exists
10395 set acosh d_acosh
10396 eval $inlibc
10397
10398 : see if aintl exists
10399 set aintl d_aintl
10400 eval $inlibc
10401
10402 : see if alarm exists
10403 set alarm d_alarm
10404 eval $inlibc
10405
10406 : see if 64bit time functions exists
10407
10408 set ctime64 d_ctime64
10409 eval $inlibc
10410
10411 set localtime64 d_localtime64
10412 eval $inlibc
10413
10414 set gmtime64 d_gmtime64
10415 eval $inlibc
10416
10417 set mktime64 d_mktime64
10418 eval $inlibc
10419
10420 set difftime64 d_difftime64
10421 eval $inlibc
10422
10423 set asctime64 d_asctime64
10424 eval $inlibc
10425
10426 : see if POSIX threads are available
10427 set pthread.h i_pthread
10428 eval $inhdr
10429
10430 : define a function to check prototypes
10431 $cat > protochk <<EOSH
10432 $startsh
10433 cc="$cc"
10434 optimize="$optimize"
10435 ccflags="$ccflags"
10436 prototype="$prototype"
10437 define="$define"
10438 rm_try="$rm_try"
10439 usethreads=$usethreads
10440 i_pthread=$i_pthread
10441 pthread_h_first=$pthread_h_first
10442 EOSH
10443
10444 $cat >> protochk <<'EOSH'
10445
10446 $rm_try
10447 foo="$1"
10448 shift
10449 while test $# -ge 2; do
10450         case "$1" in
10451                 $define) echo "#include <$2>" >> try.c ;;
10452                 literal) echo "$2" >> try.c ;;
10453         esac
10454     # Extra magic for the benefit of systems that need pthread.h
10455     # to be included early to correctly detect threadsafe functions.
10456     # Such functions must guarantee themselves, though, that the usethreads
10457     # and i_pthread have been defined, before calling protochk.
10458     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10459         echo "#include <pthread.h>" >> try.c
10460         pthread_h_done=yes
10461     fi
10462     shift 2
10463 done
10464 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10465 cat >> try.c <<'EOCP'
10466 #ifdef CAN_PROTOTYPE
10467 #define _(args) args
10468 #else
10469 #define _(args) ()
10470 #endif
10471 EOCP
10472 echo "$foo" >> try.c
10473 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10474 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10475 status=$?
10476 $rm_try
10477 exit $status
10478 EOSH
10479 chmod +x protochk
10480 $eunicefix protochk
10481
10482 : Define hasproto macro for Configure internal use
10483 hasproto='varname=$1; func=$2; shift; shift;
10484 while $test $# -ge 2; do
10485         case "$1" in
10486         $define) echo "#include <$2>";;
10487         esac ;
10488     shift 2;
10489 done > try.c;
10490 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10491 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10492         echo "$func() prototype found.";
10493         val="$define";
10494 else
10495         echo "$func() prototype NOT found.";
10496         val="$undef";
10497 fi;
10498 set $varname;
10499 eval $setvar;
10500 $rm_try tryout.c'
10501
10502 : see if sys/types.h has to be included
10503 set sys/types.h i_systypes
10504 eval $inhdr
10505
10506 : see if sys/select.h has to be included
10507 set sys/select.h i_sysselct
10508 eval $inhdr
10509
10510 : Define hasfield macro for Configure internal use
10511 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10512 while $test $# -ge 2; do
10513         case "$1" in
10514         $define) echo "#include <$2>";;
10515         esac ;
10516     shift 2;
10517 done > try.c;
10518 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10519 set try;
10520 if eval $compile; then
10521         val="$define";
10522 else
10523         val="$undef";
10524 fi;
10525 set $varname;
10526 eval $setvar;
10527 $rm_try'
10528
10529 : see if we should include time.h, sys/time.h, or both
10530 echo " "
10531 if test "X$timeincl" = X; then
10532         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10533         $echo $n "I'm now running the test program...$c"
10534         $cat >try.c <<EOCP
10535 #include <sys/types.h>
10536 #ifdef I_TIME
10537 #include <time.h>
10538 #endif
10539 #ifdef I_SYSTIME
10540 #ifdef SYSTIMEKERNEL
10541 #define KERNEL
10542 #endif
10543 #include <sys/time.h>
10544 #endif
10545 #ifdef I_SYSSELECT
10546 #include <sys/select.h>
10547 #endif
10548 #$i_stdlib I_STDLIB
10549 #ifdef I_STDLIB
10550 #include <stdlib.h>
10551 #endif
10552 int main()
10553 {
10554         struct tm foo;
10555 #ifdef S_TIMEVAL
10556         struct timeval bar;
10557 #endif
10558 #ifdef S_TIMEZONE
10559         struct timezone tzp;
10560 #endif
10561         if (foo.tm_sec == foo.tm_sec)
10562                 exit(0);
10563 #ifdef S_TIMEVAL
10564         if (bar.tv_sec == bar.tv_sec)
10565                 exit(0);
10566 #endif
10567         exit(1);
10568 }
10569 EOCP
10570         flags=''
10571         for s_timezone in '-DS_TIMEZONE' ''; do
10572         sysselect=''
10573         for s_timeval in '-DS_TIMEVAL' ''; do
10574         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10575         for i_time in '' '-DI_TIME'; do
10576         for i_systime in '-DI_SYSTIME' ''; do
10577                 case "$flags" in
10578                 '') $echo $n ".$c"
10579                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10580                         if eval $compile; then
10581                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10582                                 shift
10583                                 flags="$*"
10584                                 echo " "
10585                                 $echo $n "Succeeded with $flags$c"
10586                         fi
10587                         ;;
10588                 esac
10589         done
10590         done
10591         done
10592         done
10593         done
10594         timeincl=''
10595         echo " "
10596         case "$flags" in
10597         *SYSTIMEKERNEL*) i_systimek="$define"
10598                 timeincl=`./findhdr sys/time.h`
10599                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10600         *) i_systimek="$undef";;
10601         esac
10602         case "$flags" in
10603         *I_TIME*) i_time="$define"
10604                 timeincl=`./findhdr time.h`" $timeincl"
10605                 echo "We'll include <time.h>." >&4;;
10606         *) i_time="$undef";;
10607         esac
10608         case "$flags" in
10609         *I_SYSTIME*) i_systime="$define"
10610                 timeincl=`./findhdr sys/time.h`" $timeincl"
10611                 echo "We'll include <sys/time.h>." >&4;;
10612         *) i_systime="$undef";;
10613         esac
10614         $rm_try
10615 fi
10616 : see if struct tm knows about tm_zone
10617 case "$i_systime$i_time" in
10618 *$define*)
10619         echo " "
10620         echo "Checking to see if your struct tm has tm_zone field..." >&4
10621         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10622         eval $hasfield
10623         ;;
10624 *)      val="$undef"
10625         set d_tm_tm_zone
10626         eval $setvar
10627         ;;
10628 esac
10629 case "$d_tm_tm_zone" in
10630 "$define")      echo "Yes, it does."   ;;
10631 *)              echo "No, it doesn't." ;;
10632 esac
10633 : see if struct tm knows about tm_gmtoff
10634 case "$i_systime$i_time" in
10635 *$define*)
10636         echo " "
10637         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10638         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10639         eval $hasfield
10640         ;;
10641 *)      val="$undef"
10642         set d_tm_tm_gmtoff
10643         eval $setvar
10644         ;;
10645 esac
10646 case "$d_tm_tm_gmtoff" in
10647 "$define")      echo "Yes, it does."   ;;
10648 *)              echo "No, it doesn't." ;;
10649 esac
10650
10651 : see if asctime_r exists
10652 set asctime_r d_asctime_r
10653 eval $inlibc
10654 case "$d_asctime_r" in
10655 "$define")
10656         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10657         case "$d_asctime_r_proto:$usethreads" in
10658         ":define")      d_asctime_r_proto=define
10659                 set d_asctime_r_proto asctime_r $hdrs
10660                 eval $hasproto ;;
10661         *)      ;;
10662         esac
10663         case "$d_asctime_r_proto" in
10664         define)
10665         case "$asctime_r_proto" in
10666         ''|0) try='char* asctime_r(const struct tm*, char*);'
10667         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10668         esac
10669         case "$asctime_r_proto" in
10670         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10671         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10672         esac
10673         case "$asctime_r_proto" in
10674         ''|0) try='int asctime_r(const struct tm*, char*);'
10675         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10676         esac
10677         case "$asctime_r_proto" in
10678         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10679         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10680         esac
10681         case "$asctime_r_proto" in
10682         ''|0)   d_asctime_r=undef
10683                 asctime_r_proto=0
10684                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10685         * )     case "$asctime_r_proto" in
10686                 REENTRANT_PROTO*) ;;
10687                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10688                 esac
10689                 echo "Prototype: $try" ;;
10690         esac
10691         ;;
10692         *)      case "$usethreads" in
10693                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10694                 esac
10695                 d_asctime_r=undef
10696                 asctime_r_proto=0
10697                 ;;
10698         esac
10699         ;;
10700 *)      asctime_r_proto=0
10701         ;;
10702 esac
10703
10704 : see if atolf exists
10705 set atolf d_atolf
10706 eval $inlibc
10707
10708 : see if atoll exists
10709 set atoll d_atoll
10710 eval $inlibc
10711
10712 : Look for GCC-style attribute format
10713 case "$d_attribute_format" in
10714 '')
10715 echo " "
10716 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10717 $cat >attrib.c <<'EOCP'
10718 #include <stdio.h>
10719 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10720 EOCP
10721 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10722         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10723                 echo "Your C compiler doesn't support __attribute__((format))."
10724                 val="$undef"
10725         else
10726                 echo "Your C compiler supports __attribute__((format))."
10727                 val="$define"
10728         fi
10729 else
10730         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10731         val="$undef"
10732 fi
10733 ;;
10734 *) val="$d_attribute_format" ;;
10735 esac
10736 set d_attribute_format
10737 eval $setvar
10738 $rm -f attrib*
10739
10740 : Look for GCC-style attribute format with null format allowed
10741 case "$d_printf_format_null" in
10742 '') case "$d_attribute_format" in
10743     $define)
10744         echo " "
10745         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10746 $cat >attrib.c <<EOCP
10747 #include <stdio.h>
10748 #$i_stdlib I_STDLIB
10749 #ifdef I_STDLIB
10750 #include <stdlib.h>
10751 #endif
10752 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10753 int null_printf (char* pat,...) { return (int)pat; }
10754 int main () { exit(null_printf(NULL)); }
10755 EOCP
10756         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10757             : run the executable in case it produces a run-time warning
10758             if $run ./attrib >>attrib.out 2>&1; then
10759                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10760                     echo "Your C compiler doesn't allow __printf__ format to be null."
10761                     val="$undef"
10762                 else
10763                     echo "Your C compiler allows __printf__ format to be null."
10764                     val="$define"
10765                 fi
10766             else
10767             echo "Your C compiler executable failed with __printf__ format null."
10768             val="$undef"
10769         fi
10770     else
10771         echo "Your C compiler fails with __printf__ format null."
10772         val="$undef"
10773     fi
10774     ;;
10775     *)  val="$undef" ;;
10776     esac
10777 ;;
10778 *)  val="$d_printf_format_null" ;;
10779 esac
10780 set d_printf_format_null
10781 eval $setvar
10782 $rm -f attrib*
10783
10784 : Look for GCC-style attribute malloc
10785 case "$d_attribute_malloc" in
10786 '')
10787 echo " "
10788 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10789 $cat >attrib.c <<'EOCP'
10790 #include <stdio.h>
10791 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10792 EOCP
10793 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10794         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10795                 echo "Your C compiler doesn't support __attribute__((malloc))."
10796                 val="$undef"
10797         else
10798                 echo "Your C compiler supports __attribute__((malloc))."
10799                 val="$define"
10800         fi
10801 else
10802         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10803         val="$undef"
10804 fi
10805 ;;
10806 *) val="$d_attribute_malloc" ;;
10807 esac
10808 set d_attribute_malloc
10809 eval $setvar
10810 $rm -f attrib*
10811
10812 : Look for GCC-style attribute nonnull
10813 case "$d_attribute_nonnull" in
10814 '')
10815 echo " "
10816 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10817 $cat >attrib.c <<'EOCP'
10818 #include <stdio.h>
10819 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10820 EOCP
10821 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10822         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10823                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10824                 val="$undef"
10825         else
10826                 echo "Your C compiler supports __attribute__((nonnull))."
10827                 val="$define"
10828         fi
10829 else
10830         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10831         val="$undef"
10832 fi
10833 ;;
10834 *) val="$d_attribute_nonnull" ;;
10835 esac
10836 set d_attribute_nonnull
10837 eval $setvar
10838 $rm -f attrib*
10839
10840 : Look for GCC-style attribute noreturn
10841 case "$d_attribute_noreturn" in
10842 '')
10843 echo " "
10844 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10845 $cat >attrib.c <<'EOCP'
10846 #include <stdio.h>
10847 void fall_over_dead( void ) __attribute__((noreturn));
10848 EOCP
10849 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10850         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10851                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10852                 val="$undef"
10853         else
10854                 echo "Your C compiler supports __attribute__((noreturn))."
10855                 val="$define"
10856         fi
10857 else
10858         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10859         val="$undef"
10860 fi
10861 ;;
10862 *) val="$d_attribute_noreturn" ;;
10863 esac
10864 set d_attribute_noreturn
10865 eval $setvar
10866 $rm -f attrib*
10867
10868 : Look for GCC-style attribute pure
10869 case "$d_attribute_pure" in
10870 '')
10871 echo " "
10872 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10873 $cat >attrib.c <<'EOCP'
10874 #include <stdio.h>
10875 int square( int n ) __attribute__((pure));
10876 EOCP
10877 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10878         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10879                 echo "Your C compiler doesn't support __attribute__((pure))."
10880                 val="$undef"
10881         else
10882                 echo "Your C compiler supports __attribute__((pure))."
10883                 val="$define"
10884         fi
10885 else
10886         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10887         val="$undef"
10888 fi
10889 ;;
10890 *) val="$d_attribute_pure" ;;
10891 esac
10892 set d_attribute_pure
10893 eval $setvar
10894 $rm -f attrib*
10895
10896 : Look for GCC-style attribute unused
10897 case "$d_attribute_unused" in
10898 '')
10899 echo " "
10900 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10901 $cat >attrib.c <<'EOCP'
10902 #include <stdio.h>
10903 int do_something( int dummy __attribute__((unused)), int n );
10904 EOCP
10905 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10906         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10907                 echo "Your C compiler doesn't support __attribute__((unused))."
10908                 val="$undef"
10909         else
10910                 echo "Your C compiler supports __attribute__((unused))."
10911                 val="$define"
10912         fi
10913 else
10914         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10915         val="$undef"
10916 fi
10917 ;;
10918 *) val="$d_attribute_unused" ;;
10919 esac
10920 set d_attribute_unused
10921 eval $setvar
10922 $rm -f attrib*
10923
10924 : Look for GCC-style attribute deprecated
10925 case "$d_attribute_deprecated" in
10926 '')
10927 echo " "
10928 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10929 $cat >attrib.c <<'EOCP'
10930 #include <stdio.h>
10931 int I_am_deprecated(void) __attribute__((deprecated));
10932 EOCP
10933 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10934         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10935                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10936                 val="$undef"
10937         else
10938                 echo "Your C compiler supports __attribute__((deprecated))."
10939                 val="$define"
10940         fi
10941 else
10942         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10943         val="$undef"
10944 fi
10945 ;;
10946 *) val="$d_attribute_deprecated" ;;
10947 esac
10948 set d_attribute_deprecated
10949 eval $setvar
10950 $rm -f attrib*
10951
10952 : Look for GCC-style attribute warn_unused_result
10953 case "$d_attribute_warn_unused_result" in
10954 '')
10955 echo " "
10956 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10957 $cat >attrib.c <<'EOCP'
10958 #include <stdio.h>
10959 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10960 EOCP
10961 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10962         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10963                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10964                 val="$undef"
10965         else
10966                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10967                 val="$define"
10968         fi
10969 else
10970         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10971         val="$undef"
10972 fi
10973 ;;
10974 *) val="$d_attribute_warn_unused_result" ;;
10975 esac
10976 set d_attribute_warn_unused_result
10977 eval $setvar
10978 $rm -f attrib*
10979
10980 : see if bcmp exists
10981 set bcmp d_bcmp
10982 eval $inlibc
10983
10984 : see if bcopy exists
10985 set bcopy d_bcopy
10986 eval $inlibc
10987
10988 : see if getpgrp exists
10989 set getpgrp d_getpgrp
10990 eval $inlibc
10991
10992 case "$d_getpgrp" in
10993 "$define")
10994         echo " "
10995         echo "Checking to see which flavor of getpgrp is in use..."
10996         $cat >try.c <<EOP
10997 #$i_unistd I_UNISTD
10998 #include <sys/types.h>
10999 #ifdef I_UNISTD
11000 #  include <unistd.h>
11001 #endif
11002 #$i_stdlib I_STDLIB
11003 #ifdef I_STDLIB
11004 #include <stdlib.h>
11005 #endif
11006 int main()
11007 {
11008         if (getuid() == 0) {
11009                 printf("(I see you are running Configure as super-user...)\n");
11010                 setuid(1);
11011         }
11012 #ifdef TRY_BSD_PGRP
11013         if (getpgrp(1) == 0)
11014                 exit(0);
11015 #else
11016         if (getpgrp() > 0)
11017                 exit(0);
11018 #endif
11019         exit(1);
11020 }
11021 EOP
11022         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11023                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11024                 val="$define"
11025         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11026                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11027                 val="$undef"
11028         else
11029                 echo "I can't seem to compile and run the test program."
11030                 if ./usg; then
11031                         xxx="a USG one, i.e. you use getpgrp()."
11032                 else
11033                         # SVR4 systems can appear rather BSD-ish.
11034                         case "$i_unistd" in
11035                         $undef)
11036                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11037                                 val="$define"
11038                                 ;;
11039                         $define)
11040                                 xxx="probably a USG one, i.e. you use getpgrp()."
11041                                 val="$undef"
11042                                 ;;
11043                         esac
11044                 fi
11045                 echo "Assuming your getpgrp is $xxx" >&4
11046         fi
11047         ;;
11048 *) val="$undef";;
11049 esac
11050 set d_bsdgetpgrp
11051 eval $setvar
11052 $rm_try
11053
11054 : see if setpgrp exists
11055 set setpgrp d_setpgrp
11056 eval $inlibc
11057
11058 case "$d_setpgrp" in
11059 "$define")
11060         echo " "
11061         echo "Checking to see which flavor of setpgrp is in use..."
11062         $cat >try.c <<EOP
11063 #$i_unistd I_UNISTD
11064 #include <sys/types.h>
11065 #ifdef I_UNISTD
11066 #  include <unistd.h>
11067 #endif
11068 #$i_stdlib I_STDLIB
11069 #ifdef I_STDLIB
11070 #include <stdlib.h>
11071 #endif
11072 int main()
11073 {
11074         if (getuid() == 0) {
11075                 printf("(I see you are running Configure as super-user...)\n");
11076                 setuid(1);
11077         }
11078 #ifdef TRY_BSD_PGRP
11079         if (-1 == setpgrp(1, 1))
11080                 exit(0);
11081 #else
11082         if (setpgrp() != -1)
11083                 exit(0);
11084 #endif
11085         exit(1);
11086 }
11087 EOP
11088         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11089                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11090                 val="$define"
11091         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11092                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11093                 val="$undef"
11094         else
11095                 echo "(I can't seem to compile and run the test program.)"
11096                 if ./usg; then
11097                         xxx="a USG one, i.e. you use setpgrp()."
11098                 else
11099                         # SVR4 systems can appear rather BSD-ish.
11100                         case "$i_unistd" in
11101                         $undef)
11102                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11103                                 val="$define"
11104                                 ;;
11105                         $define)
11106                                 xxx="probably a USG one, i.e. you use setpgrp()."
11107                                 val="$undef"
11108                                 ;;
11109                         esac
11110                 fi
11111                 echo "Assuming your setpgrp is $xxx" >&4
11112         fi
11113         ;;
11114 *) val="$undef";;
11115 esac
11116 set d_bsdsetpgrp
11117 eval $setvar
11118 $rm_try
11119
11120 : Look for GCC-style __builtin_choose_expr
11121 case "$d_builtin_choose_expr" in
11122 '')
11123     echo " "
11124     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11125     $cat >try.c <<'EOCP'
11126 #include <assert.h>
11127 #include <stdlib.h>
11128 #include <stdio.h>
11129
11130 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11131
11132 int main(void) {
11133     assert( SYRINX(1) == 2112 );
11134     assert( SYRINX(1) != 5150 );
11135     assert( SYRINX(0) == 5150 );
11136     assert( SYRINX(0) != 2112 );
11137     puts( "All good!" );
11138     exit(0);
11139 }
11140
11141 EOCP
11142     set try
11143     if eval $compile && $run ./try; then
11144         echo "Your C compiler supports __builtin_choose_expr."
11145         val="$define"
11146     else
11147         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11148         val="$undef"
11149     fi
11150 ;;
11151 *) val="$d_builtin_choose_expr" ;;
11152 esac
11153
11154 set d_builtin_choose_expr
11155 eval $setvar
11156 $rm_try
11157
11158 : Look for GCC-style __builtin_expect
11159 case "$d_builtin_expect" in
11160 '')
11161     echo " "
11162     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11163     $cat >try.c <<'EOCP'
11164 int main(void) {
11165     int n = 50;
11166     if ( __builtin_expect(n, 0) ) n = 1;
11167     /* Remember shell exit code truth is 0, C truth is non-zero */
11168     return !(n == 1);
11169 }
11170 EOCP
11171     set try
11172     if eval $compile && $run ./try; then
11173         echo "Your C compiler supports __builtin_expect."
11174         val="$define"
11175     else
11176         echo "Your C compiler doesn't seem to understand __builtin_expect."
11177         val="$undef"
11178     fi
11179     ;;
11180 *) val="$d_builtin_expect" ;;
11181 esac
11182
11183 set d_builtin_expect
11184 eval $setvar
11185 $rm_try
11186
11187 : see if bzero exists
11188 set bzero d_bzero
11189 eval $inlibc
11190
11191 : see if stdarg is available
11192 echo " "
11193 if $test `./findhdr stdarg.h`; then
11194         echo "<stdarg.h> found." >&4
11195         valstd="$define"
11196 else
11197         echo "<stdarg.h> NOT found." >&4
11198         valstd="$undef"
11199 fi
11200
11201 : see if varargs is available
11202 echo " "
11203 if $test `./findhdr varargs.h`; then
11204         echo "<varargs.h> found." >&4
11205 else
11206         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11207 fi
11208
11209 : set up the varargs testing programs
11210 $cat > varargs.c <<EOP
11211 #ifdef I_STDARG
11212 #include <stdarg.h>
11213 #endif
11214 #ifdef I_VARARGS
11215 #include <varargs.h>
11216 #endif
11217
11218 #ifdef I_STDARG
11219 int f(char *p, ...)
11220 #else
11221 int f(va_alist)
11222 va_dcl
11223 #endif
11224 {
11225         va_list ap;
11226 #ifndef I_STDARG
11227         char *p;
11228 #endif
11229 #ifdef I_STDARG
11230         va_start(ap,p);
11231 #else
11232         va_start(ap);
11233         p = va_arg(ap, char *);
11234 #endif
11235         va_end(ap);
11236         return 0;
11237 }
11238 EOP
11239 $cat > varargs <<EOP
11240 $startsh
11241 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11242         echo "true"
11243 else
11244         echo "false"
11245 fi
11246 $rm -f varargs$_o
11247 EOP
11248 chmod +x varargs
11249
11250 : now check which varargs header should be included
11251 echo " "
11252 i_varhdr=''
11253 val=''
11254 case "$valstd" in
11255 "$define")
11256         if `./varargs I_STDARG`; then
11257                 val='stdarg.h'
11258         elif `./varargs I_VARARGS`; then
11259                 val='varargs.h'
11260         fi
11261         ;;
11262 *)
11263         if `./varargs I_VARARGS`; then
11264                 val='varargs.h'
11265         fi
11266         ;;
11267 esac
11268 case "$val" in
11269 '')
11270         echo " "
11271         echo "*** WHOA THERE!!! ***" >&4
11272         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11273         case "$knowitall" in
11274         '')
11275         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11276                 exit 1
11277                 ;;
11278         esac
11279 echo "I could not find the definition for va_dcl... You have problems..." >&4
11280         val="$undef"; set i_stdarg; eval $setvar
11281         val="$undef"; set i_varargs; eval $setvar
11282         ;;
11283 *)
11284         set i_varhdr
11285         eval $setvar
11286         case "$i_varhdr" in
11287         stdarg.h)
11288                 val="$define"; set i_stdarg; eval $setvar
11289                 val="$undef"; set i_varargs; eval $setvar
11290                 ;;
11291         varargs.h)
11292                 val="$undef"; set i_stdarg; eval $setvar
11293                 val="$define"; set i_varargs; eval $setvar
11294                 ;;
11295         esac
11296         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11297 esac
11298 $rm -f varargs*
11299
11300 : see if the Compiler supports C99 variadic macros
11301 case "$i_stdarg$i_stdlib" in
11302     "$define$define")
11303     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11304     $cat >try.c <<EOCP
11305 #include <stdio.h>
11306 #include <stdarg.h>
11307
11308 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11309
11310 int main() {
11311   char buf[20];
11312   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11313   puts(buf);
11314   return 0;
11315 }
11316 EOCP
11317     set try
11318     if eval $compile && $run ./try 2>&1 >/dev/null; then
11319         case "`$run ./try`" in
11320             "123 456 789")
11321             echo "You have C99 variadic macros." >&4
11322             d_c99_variadic_macros="$define"
11323             ;;
11324             *)
11325             echo "You don't have functional C99 variadic macros." >&4
11326             d_c99_variadic_macros="$undef"
11327             ;;
11328         esac
11329     else
11330         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11331         d_c99_variadic_macros="$undef"
11332     fi
11333     $rm_try
11334     ;;
11335     *)
11336     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11337     d_c99_variadic_macros="$undef"
11338     ;;
11339 esac
11340
11341 : see if signal is declared as pointer to function returning int or void
11342 echo " "
11343 xxx=`./findhdr signal.h`
11344 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11345 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11346         echo "You have int (*signal())() instead of void." >&4
11347         val="$undef"
11348 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11349         echo "You have void (*signal())()." >&4
11350         val="$define"
11351 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11352         echo "You have int (*signal())() instead of void." >&4
11353         val="$undef"
11354 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11355         echo "You have void (*signal())()." >&4
11356         val="$define"
11357 else
11358         case "$d_voidsig" in
11359         '')
11360         echo "I can't determine whether signal handler returns void or int..." >&4
11361                 dflt=void
11362                 rp="What type does your signal handler return?"
11363                 . ./myread
11364                 case "$ans" in
11365                 v*) val="$define";;
11366                 *) val="$undef";;
11367                 esac;;
11368         "$define")
11369                 echo "As you already told me, signal handler returns void." >&4
11370                 val="$define"
11371                 ;;
11372         *)      echo "As you already told me, signal handler returns int." >&4
11373                 val="$undef"
11374                 ;;
11375         esac
11376 fi
11377 set d_voidsig
11378 eval $setvar
11379 case "$d_voidsig" in
11380 "$define") signal_t="void";;
11381 *) signal_t="int";;
11382 esac
11383 $rm -f $$.tmp
11384
11385 : check for ability to cast large floats to 32-bit ints.
11386 echo " "
11387 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11388 if $test "$intsize" -ge 4; then
11389         xxx=int
11390 else
11391         xxx=long
11392 fi
11393 $cat >try.c <<EOCP
11394 #include <stdio.h>
11395 #$i_stdlib I_STDLIB
11396 #ifdef I_STDLIB
11397 #include <stdlib.h>
11398 #endif
11399 #include <sys/types.h>
11400 #include <signal.h>
11401 $signal_t blech(int s) { exit(3); }
11402 int main()
11403 {
11404         $xxx i32;
11405         double f, g;
11406         int result = 0;
11407         char str[16];
11408         signal(SIGFPE, blech);
11409
11410         /* Don't let compiler optimize the test away.  Store the number
11411            in a writable string for gcc to pass to sscanf under HP-UX.
11412         */
11413         sprintf(str, "2147483647");
11414         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11415         g = 10 * f;
11416         i32  = ($xxx) g;
11417
11418         /* x86 processors will probably give 0x8000 0000, which is a
11419            sign change.  We don't want that.  We want to mimic SPARC
11420            behavior here, which is to preserve the sign and give
11421            back 0x7fff ffff.
11422         */
11423         if (i32 != ($xxx) f)
11424                 result |= 1;
11425         exit(result);
11426 }
11427 EOCP
11428 set try
11429 if eval $compile_ok; then
11430         $run ./try
11431         yyy=$?
11432 else
11433         echo "(I can't seem to compile the test program--assuming it can't)"
11434         yyy=1
11435 fi
11436 case "$yyy" in
11437 0)      val="$define"
11438         echo "Yup, it can."
11439         ;;
11440 *)      val="$undef"
11441         echo "Nope, it can't."
11442         ;;
11443 esac
11444 set d_casti32
11445 eval $setvar
11446 $rm_try
11447
11448 : check for ability to cast negative floats to unsigned
11449 echo " "
11450 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11451 $cat >try.c <<EOCP
11452 #include <stdio.h>
11453 #$i_stdlib I_STDLIB
11454 #ifdef I_STDLIB
11455 #include <stdlib.h>
11456 #endif
11457 #include <sys/types.h>
11458 #include <signal.h>
11459 $signal_t blech(int s) { exit(7); }
11460 $signal_t blech_in_list(int s) { exit(4); }
11461 unsigned long dummy_long(unsigned long p) { return p; }
11462 unsigned int dummy_int(unsigned int p) { return p; }
11463 unsigned short dummy_short(unsigned short p) { return p; }
11464 int main()
11465 {
11466         double f;
11467         unsigned long along;
11468         unsigned int aint;
11469         unsigned short ashort;
11470         int result = 0;
11471         char str[16];
11472
11473         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11474            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11475            optimized the whole file away
11476         */
11477         /* Store the number in a writable string for gcc to pass to
11478            sscanf under HP-UX.
11479         */
11480         sprintf(str, "-123");
11481         sscanf(str, "%lf", &f);  /* f = -123.; */
11482
11483         signal(SIGFPE, blech);
11484         along = (unsigned long)f;
11485         aint = (unsigned int)f;
11486         ashort = (unsigned short)f;
11487         if (along != (unsigned long)-123)
11488                 result |= 1;
11489         if (aint != (unsigned int)-123)
11490                 result |= 1;
11491         if (ashort != (unsigned short)-123)
11492                 result |= 1;
11493         sprintf(str, "1073741824.");
11494         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11495         f = f + f;
11496         along = 0;
11497         along = (unsigned long)f;
11498         if (along != 0x80000000)
11499                 result |= 2;
11500         f -= 1.;
11501         along = 0;
11502         along = (unsigned long)f;
11503         if (along != 0x7fffffff)
11504                 result |= 1;
11505         f += 2.;
11506         along = 0;
11507         along = (unsigned long)f;
11508         if (along != 0x80000001)
11509                 result |= 2;
11510         if (result)
11511                 exit(result);
11512         signal(SIGFPE, blech_in_list);
11513         sprintf(str, "123.");
11514         sscanf(str, "%lf", &f);  /* f = 123.; */
11515         along = dummy_long((unsigned long)f);
11516         aint = dummy_int((unsigned int)f);
11517         ashort = dummy_short((unsigned short)f);
11518         if (along != (unsigned long)123)
11519                 result |= 4;
11520         if (aint != (unsigned int)123)
11521                 result |= 4;
11522         if (ashort != (unsigned short)123)
11523                 result |= 4;
11524         exit(result);
11525
11526 }
11527 EOCP
11528 set try
11529 if eval $compile_ok; then
11530         $run ./try
11531         castflags=$?
11532 else
11533         echo "(I can't seem to compile the test program--assuming it can't)"
11534         castflags=7
11535 fi
11536 case "$castflags" in
11537 0)      val="$define"
11538         echo "Yup, it can."
11539         ;;
11540 *)      val="$undef"
11541         echo "Nope, it can't."
11542         ;;
11543 esac
11544 set d_castneg
11545 eval $setvar
11546 $rm_try
11547
11548 : see if vprintf exists
11549 echo " "
11550 if set vprintf val -f d_vprintf; eval $csym; $val; then
11551         echo 'vprintf() found.' >&4
11552         val="$define"
11553         $cat >try.c <<EOF
11554 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11555 #$i_varargs I_VARARGS
11556
11557 #$i_stdlib I_STDLIB
11558 #$i_unistd I_UNISTD
11559
11560 #ifdef I_STDARG
11561 #  include <stdarg.h>
11562 #else /* I_VARARGS */
11563 #  include <varargs.h>
11564 #endif
11565
11566 #ifdef I_UNISTD
11567 #  include <unistd.h>
11568 #endif
11569
11570 #ifdef I_STDLIB
11571 #  include <stdlib.h>
11572 #endif
11573
11574 #include <stdio.h> /* vsprintf prototype */
11575
11576 #ifdef I_STDARG
11577 void xxx(int n, ...)
11578 {
11579     va_list args;
11580     char buf[10];
11581     va_start(args, n);
11582     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11583 }
11584 int main() { xxx(1, "foo"); }
11585
11586 #else /* I_VARARGS */
11587
11588 xxx(va_alist)
11589 va_dcl
11590 {
11591     va_list args;
11592     char buf[10];
11593     va_start(args);
11594     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11595 }
11596 int main() { xxx("foo"); }
11597
11598 #endif
11599
11600 EOF
11601         set try
11602         if eval $compile_ok; then
11603                 if $run ./try; then
11604                         echo "Your vsprintf() returns (int)." >&4
11605                         val2="$undef"
11606                 else
11607                         echo "Your vsprintf() returns (char*)." >&4
11608                         val2="$define"
11609                 fi
11610         else
11611                 echo 'I am unable to compile the vsprintf() test program.' >&4
11612                 # We shouldn't get here.  If we do, assume the standard signature,
11613                 # not the old BSD one.
11614                 echo 'Guessing that vsprintf() returns (int).' >&4
11615                 val2="$undef"
11616         fi
11617 else
11618         echo 'vprintf() NOT found.' >&4
11619         val="$undef"
11620         val2="$undef"
11621 fi
11622 $rm_try
11623 set d_vprintf
11624 eval $setvar
11625 val=$val2
11626 set d_charvspr
11627 eval $setvar
11628
11629 : see if chown exists
11630 set chown d_chown
11631 eval $inlibc
11632
11633 : see if chroot exists
11634 set chroot d_chroot
11635 eval $inlibc
11636
11637 : see if chsize exists
11638 set chsize d_chsize
11639 eval $inlibc
11640
11641 : see if class exists
11642 set class d_class
11643 eval $inlibc
11644
11645 : see if clearenv exists
11646 set clearenv d_clearenv
11647 eval $inlibc
11648
11649 : Define hasstruct macro for Configure internal use
11650 hasstruct='varname=$1; struct=$2; shift; shift;
11651 while $test $# -ge 2; do
11652         case "$1" in
11653         $define) echo "#include <$2>";;
11654         esac ;
11655     shift 2;
11656 done > try.c;
11657 echo "int main () { struct $struct foo; }" >> try.c;
11658 set try;
11659 if eval $compile; then
11660         val="$define";
11661 else
11662         val="$undef";
11663 fi;
11664 set $varname;
11665 eval $setvar;
11666 $rm_try'
11667
11668 : see whether socket exists
11669 socketlib=''
11670 sockethdr=''
11671 echo " "
11672 $echo $n "Hmm... $c" >&4
11673 if set socket val -f d_socket; eval $csym; $val; then
11674     echo "Looks like you have Berkeley networking support." >&4
11675     d_socket="$define"
11676     if set setsockopt val -f; eval $csym; $val; then
11677         d_oldsock="$undef"
11678     else
11679         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11680         d_oldsock="$define"
11681     fi
11682 else
11683     if $contains socklib libc.list >/dev/null 2>&1; then
11684         echo "Looks like you have Berkeley networking support." >&4
11685         d_socket="$define"
11686         : we will have to assume that it supports the 4.2 BSD interface
11687         d_oldsock="$undef"
11688     else
11689         echo "You don't have Berkeley networking in libc$_a..." >&4
11690         if test "X$d_socket" = "X$define"; then
11691             echo "...but you seem to believe that you have sockets." >&4
11692         else
11693             for net in net socket
11694             do
11695                 if test -f $sysroot/usr/lib/lib$net$_a; then
11696                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11697                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11698                     if $contains socket libc.list >/dev/null 2>&1; then
11699                         d_socket="$define"
11700                         socketlib="-l$net"
11701                         case "$net" in
11702                         net)
11703                             echo "...but the Wollongong group seems to have hacked it in." >&4
11704                             sockethdr="-I$sysroot/usr/netinclude"
11705                             ;;
11706                         esac
11707                         echo "Found Berkeley sockets interface in lib$net." >&4
11708                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11709                             d_oldsock="$undef"
11710                         else
11711                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11712                             d_oldsock="$define"
11713                         fi
11714                         break
11715                     fi
11716                 fi
11717             done
11718             if test "X$d_socket" != "X$define"; then
11719                echo "or anywhere else I see." >&4
11720                d_socket="$undef"
11721                d_oldsock="$undef"
11722             fi
11723         fi
11724     fi
11725 fi
11726
11727 : see if socketpair exists
11728 set socketpair d_sockpair
11729 eval $inlibc
11730
11731
11732 echo " "
11733 echo "Checking the availability sa_len in the sock struct ..." >&4
11734 $cat >try.c <<EOF
11735 #include <sys/types.h>
11736 #include <sys/socket.h>
11737 int main() {
11738 struct sockaddr sa;
11739 return (sa.sa_len);
11740 }
11741 EOF
11742 val="$undef"
11743 set try; if eval $compile; then
11744     val="$define"
11745 fi
11746 set d_sockaddr_sa_len; eval $setvar
11747 $rm_try
11748
11749 echo " "
11750 echo "Checking the availability struct sockaddr_in6 ..." >&4
11751 $cat >try.c <<EOF
11752 #include <sys/types.h>
11753 #include <sys/socket.h>
11754 #include <netinet/in.h>
11755 int main() {
11756 struct sockaddr_in6 sin6;
11757 return (sin6.sin6_family);
11758 }
11759 EOF
11760 val="$undef"
11761 set try; if eval $compile; then
11762     val="$define"
11763 fi
11764 set d_sockaddr_in6; eval $setvar
11765 $rm_try
11766
11767 echo " "
11768 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11769 $cat >try.c <<EOF
11770 #include <sys/types.h>
11771 #include <sys/socket.h>
11772 #include <netinet/in.h>
11773 int main() {
11774 struct sockaddr_in6 sin6;
11775 return (sin6.sin6_scope_id);
11776 }
11777 EOF
11778 val="$undef"
11779 set try; if eval $compile; then
11780     val="$define"
11781 fi
11782 set d_sin6_scope_id; eval $setvar
11783 $rm_try
11784
11785 echo " "
11786 echo "Checking the availability struct ip_mreq ..." >&4
11787 $cat >try.c <<EOF
11788 #include <sys/types.h>
11789 #include <sys/socket.h>
11790 #include <netinet/in.h>
11791 int main() {
11792 struct ip_mreq mreq;
11793 return (mreq.imr_multiaddr.s_addr);
11794 }
11795 EOF
11796 val="$undef"
11797 set try; if eval $compile; then
11798        val="$define"
11799 fi
11800 set d_ip_mreq; eval $setvar
11801 $rm_try
11802
11803 echo " "
11804 echo "Checking the availability struct ip_mreq_source ..." >&4
11805 $cat >try.c <<EOF
11806 #include <sys/types.h>
11807 #include <sys/socket.h>
11808 #include <netinet/in.h>
11809 int main() {
11810 struct ip_mreq_source mreq;
11811 return (mreq.imr_multiaddr.s_addr);
11812 }
11813 EOF
11814 val="$undef"
11815 set try; if eval $compile; then
11816        val="$define"
11817 fi
11818 set d_ip_mreq_source; eval $setvar
11819 $rm_try
11820
11821 echo " "
11822 echo "Checking the availability struct ipv6_mreq ..." >&4
11823 $cat >try.c <<EOF
11824 #include <sys/types.h>
11825 #include <sys/socket.h>
11826 #include <netinet/in.h>
11827 int main() {
11828 struct ipv6_mreq mreq;
11829 return (mreq.ipv6mr_interface);
11830 }
11831 EOF
11832 val="$undef"
11833 set try; if eval $compile; then
11834     val="$define"
11835 fi
11836 set d_ipv6_mreq; eval $setvar
11837 $rm_try
11838
11839 echo " "
11840 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11841 $cat >try.c <<EOF
11842 #include <sys/types.h>
11843 #include <sys/socket.h>
11844 #include <netinet/in.h>
11845 int main() {
11846 struct ipv6_mreq_source mreq;
11847 return (mreq.imr_multiaddr.s_addr);
11848 }
11849 EOF
11850 val="$undef"
11851 set try; if eval $compile; then
11852        val="$define"
11853 fi
11854 set d_ipv6_mreq_source; eval $setvar
11855 $rm_try
11856
11857 echo " "
11858 echo "Checking the availability of certain socket constants..." >&4
11859 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11860     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11861     $cat >try.c <<EOF
11862 #include <sys/types.h>
11863 #include <sys/socket.h>
11864 int main() {
11865     int i = $ENUM;
11866 }
11867 EOF
11868     val="$undef"
11869     set try; if eval $compile; then
11870         val="$define"
11871     fi
11872     set d_${enum}; eval $setvar
11873     $rm_try
11874 done
11875
11876 : see if this is a sys/uio.h system
11877 set sys/uio.h i_sysuio
11878 eval $inhdr
11879
11880 : Check for cmsghdr support
11881 echo " "
11882 echo "Checking to see if your system supports struct cmsghdr..." >&4
11883 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11884 eval $hasstruct
11885 case "$d_cmsghdr_s" in
11886 "$define")      echo "Yes, it does."   ;;
11887 *)              echo "No, it doesn't." ;;
11888 esac
11889
11890
11891 : check for const keyword
11892 echo " "
11893 echo 'Checking to see if your C compiler knows about "const"...' >&4
11894 $cat >const.c <<'EOCP'
11895 typedef struct spug { int drokk; } spug;
11896 int main()
11897 {
11898         const char *foo;
11899         const spug y = { 0 };
11900 }
11901 EOCP
11902 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11903         val="$define"
11904         echo "Yup, it does."
11905 else
11906         val="$undef"
11907         echo "Nope, it doesn't."
11908 fi
11909 set d_const
11910 eval $setvar
11911
11912 : see if copysignl exists
11913 set copysignl d_copysignl
11914 eval $inlibc
11915
11916 : see if crypt exists
11917 echo " "
11918 set crypt d_crypt
11919 eval $inlibc
11920 case "$d_crypt" in
11921 $define) cryptlib='' ;;
11922 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11923                 echo 'crypt() found.' >&4
11924                 val="$define"
11925                 cryptlib=''
11926         else
11927                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11928                 if $test -z "$cryptlib"; then
11929                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11930                 else
11931                         cryptlib=-lcrypt
11932                 fi
11933                 if $test -z "$cryptlib"; then
11934                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11935                 else
11936                         cryptlib=-lcrypt
11937                 fi
11938                 if $test -z "$cryptlib"; then
11939                         cryptlib=`./loc libcrypt$_a "" $libpth`
11940                 else
11941                         cryptlib=-lcrypt
11942                 fi
11943                 if $test -z "$cryptlib"; then
11944                         echo 'crypt() NOT found.' >&4
11945                         val="$undef"
11946                 else
11947                         val="$define"
11948                 fi
11949         fi
11950         set d_crypt
11951         eval $setvar
11952         ;;
11953 esac
11954
11955 : see if this is a crypt.h system
11956 set crypt.h i_crypt
11957 eval $inhdr
11958
11959 : see if crypt_r exists
11960 set crypt_r d_crypt_r
11961 eval $inlibc
11962 case "$d_crypt_r" in
11963 "$define")
11964         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11965         case "$d_crypt_r_proto:$usethreads" in
11966         ":define")      d_crypt_r_proto=define
11967                 set d_crypt_r_proto crypt_r $hdrs
11968                 eval $hasproto ;;
11969         *)      ;;
11970         esac
11971         case "$d_crypt_r_proto" in
11972         define)
11973         case "$crypt_r_proto" in
11974         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11975         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11976         esac
11977         case "$crypt_r_proto" in
11978         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11979         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11980         esac
11981         case "$crypt_r_proto" in
11982         ''|0)   d_crypt_r=undef
11983                 crypt_r_proto=0
11984                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11985         * )     case "$crypt_r_proto" in
11986                 REENTRANT_PROTO*) ;;
11987                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11988                 esac
11989                 echo "Prototype: $try" ;;
11990         esac
11991         ;;
11992         *)      case "$usethreads" in
11993                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11994                 esac
11995                 d_crypt_r=undef
11996                 crypt_r_proto=0
11997                 ;;
11998         esac
11999         ;;
12000 *)      crypt_r_proto=0
12001         ;;
12002 esac
12003
12004 : get csh whereabouts
12005 case "$csh" in
12006 'csh') val="$undef" ;;
12007 *) val="$define" ;;
12008 esac
12009 set d_csh
12010 eval $setvar
12011 : Respect a hint or command line value for full_csh.
12012 case "$full_csh" in
12013 '') full_csh=$csh ;;
12014 esac
12015
12016 : see if ctermid exists
12017 set ctermid d_ctermid
12018 eval $inlibc
12019
12020 : see if ctermid_r exists
12021 set ctermid_r d_ctermid_r
12022 eval $inlibc
12023 case "$d_ctermid_r" in
12024 "$define")
12025         hdrs="$i_systypes sys/types.h define stdio.h "
12026         case "$d_ctermid_r_proto:$usethreads" in
12027         ":define")      d_ctermid_r_proto=define
12028                 set d_ctermid_r_proto ctermid_r $hdrs
12029                 eval $hasproto ;;
12030         *)      ;;
12031         esac
12032         case "$d_ctermid_r_proto" in
12033         define)
12034         case "$ctermid_r_proto" in
12035         ''|0) try='char* ctermid_r(char*);'
12036         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12037         esac
12038         case "$ctermid_r_proto" in
12039         ''|0)   d_ctermid_r=undef
12040                 ctermid_r_proto=0
12041                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12042         * )     case "$ctermid_r_proto" in
12043                 REENTRANT_PROTO*) ;;
12044                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12045                 esac
12046                 echo "Prototype: $try" ;;
12047         esac
12048         ;;
12049         *)      case "$usethreads" in
12050                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12051                 esac
12052                 d_ctermid_r=undef
12053                 ctermid_r_proto=0
12054                 ;;
12055         esac
12056         ;;
12057 *)      ctermid_r_proto=0
12058         ;;
12059 esac
12060
12061 : see if ctime_r exists
12062 set ctime_r d_ctime_r
12063 eval $inlibc
12064 case "$d_ctime_r" in
12065 "$define")
12066         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12067         case "$d_ctime_r_proto:$usethreads" in
12068         ":define")      d_ctime_r_proto=define
12069                 set d_ctime_r_proto ctime_r $hdrs
12070                 eval $hasproto ;;
12071         *)      ;;
12072         esac
12073         case "$d_ctime_r_proto" in
12074         define)
12075         case "$ctime_r_proto" in
12076         ''|0) try='char* ctime_r(const time_t*, char*);'
12077         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12078         esac
12079         case "$ctime_r_proto" in
12080         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12081         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12082         esac
12083         case "$ctime_r_proto" in
12084         ''|0) try='int ctime_r(const time_t*, char*);'
12085         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12086         esac
12087         case "$ctime_r_proto" in
12088         ''|0) try='int ctime_r(const time_t*, char*, int);'
12089         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12090         esac
12091         case "$ctime_r_proto" in
12092         ''|0)   d_ctime_r=undef
12093                 ctime_r_proto=0
12094                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12095         * )     case "$ctime_r_proto" in
12096                 REENTRANT_PROTO*) ;;
12097                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12098                 esac
12099                 echo "Prototype: $try" ;;
12100         esac
12101         ;;
12102         *)      case "$usethreads" in
12103                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12104                 esac
12105                 d_ctime_r=undef
12106                 ctime_r_proto=0
12107                 ;;
12108         esac
12109         ;;
12110 *)      ctime_r_proto=0
12111         ;;
12112 esac
12113
12114 : see if cuserid exists
12115 set cuserid d_cuserid
12116 eval $inlibc
12117
12118 : see if this is a limits.h system
12119 set limits.h i_limits
12120 eval $inhdr
12121
12122 : See if number of significant digits in a double precision number is known
12123 echo " "
12124 $cat >dbl_dig.c <<EOM
12125 #$i_limits I_LIMITS
12126 #$i_float I_FLOAT
12127 #ifdef I_LIMITS
12128 #include <limits.h>
12129 #endif
12130 #ifdef I_FLOAT
12131 #include <float.h>
12132 #endif
12133 #ifdef DBL_DIG
12134 printf("Contains DBL_DIG");
12135 #endif
12136 EOM
12137 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12138 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12139         echo "DBL_DIG found." >&4
12140         val="$define"
12141 else
12142         echo "DBL_DIG NOT found." >&4
12143         val="$undef"
12144 fi
12145 $rm -f dbl_dig.?
12146 set d_dbl_dig
12147 eval $setvar
12148
12149 : see if dbm.h is available
12150 : see if dbmclose exists
12151 set dbmclose d_dbmclose
12152 eval $inlibc
12153
12154 case "$d_dbmclose" in
12155 $define)
12156         set dbm.h i_dbm
12157         eval $inhdr
12158         case "$i_dbm" in
12159         $define)
12160                 val="$undef"
12161                 set i_rpcsvcdbm
12162                 eval $setvar
12163                 ;;
12164         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12165                 eval $inhdr
12166                 ;;
12167         esac
12168         ;;
12169 *)      echo "We won't be including <dbm.h>"
12170         val="$undef"
12171         set i_dbm
12172         eval $setvar
12173         val="$undef"
12174         set i_rpcsvcdbm
12175         eval $setvar
12176         ;;
12177 esac
12178
12179 : see if prototype for dbminit is available
12180 echo " "
12181 set d_dbminitproto dbminit $i_dbm dbm.h
12182 eval $hasproto
12183
12184 : see if difftime exists
12185 set difftime d_difftime
12186 eval $inlibc
12187
12188 : see if this is a dirent system
12189 echo " "
12190 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12191         val="$define"
12192         echo "<dirent.h> found." >&4
12193 else
12194         val="$undef"
12195         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12196                 echo "<sys/dir.h> found." >&4
12197                 echo " "
12198         else
12199                 xinc=`./findhdr sys/ndir.h`
12200         fi
12201         echo "<dirent.h> NOT found." >&4
12202 fi
12203 set i_dirent
12204 eval $setvar
12205
12206 : Look for type of directory structure.
12207 echo " "
12208 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12209
12210 case "$direntrytype" in
12211 ''|' ')
12212         case "$i_dirent" in
12213         $define) guess1='struct dirent' ;;
12214         *) guess1='struct direct'  ;;
12215         esac
12216         ;;
12217 *)      guess1="$direntrytype"
12218         ;;
12219 esac
12220
12221 case "$guess1" in
12222 'struct dirent') guess2='struct direct' ;;
12223 *) guess2='struct dirent' ;;
12224 esac
12225
12226 if $contains "$guess1" try.c >/dev/null 2>&1; then
12227         direntrytype="$guess1"
12228         echo "Your directory entries are $direntrytype." >&4
12229 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12230         direntrytype="$guess2"
12231         echo "Your directory entries seem to be $direntrytype." >&4
12232 else
12233         echo "I don't recognize your system's directory entries." >&4
12234         rp="What type is used for directory entries on this system?"
12235         dflt="$guess1"
12236         . ./myread
12237         direntrytype="$ans"
12238 fi
12239 $rm_try
12240
12241 : see if the directory entry stores field length
12242 echo " "
12243 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12244 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12245         echo "Good, your directory entry keeps length information in d_namlen." >&4
12246         val="$define"
12247 else
12248         echo "Your directory entry does not know about the d_namlen field." >&4
12249         val="$undef"
12250 fi
12251 set d_dirnamlen
12252 eval $setvar
12253 $rm_try
12254
12255 : Look for DIR.dd_fd
12256 case "$i_dirent" in
12257 "$define")
12258     echo "Checking to see if DIR has a dd_fd member variable" >&4
12259     $cat >try.c <<EOCP
12260 #$i_stdlib I_STDLIB
12261 #ifdef I_STDLIB
12262 #include <stdlib.h>
12263 #endif
12264 #include <dirent.h>
12265
12266 int main() {
12267     DIR dir;
12268     dir.dd_fd = 1;
12269     return 0;
12270 }
12271 EOCP
12272     val=$undef
12273     set try
12274     if eval $compile; then
12275         echo "Yes, it does."
12276         val="$define"
12277     else
12278         echo "No, it does not."
12279         val="$undef"
12280     fi
12281     ;;
12282 *)
12283     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12284     val="$undef"
12285     ;;
12286 esac
12287 set d_dir_dd_fd
12288 eval $setvar
12289 $rm_try
12290
12291 : see if this is an sysdir system
12292 set sys/dir.h i_sysdir
12293 eval $inhdr
12294
12295 : see if this is an sysndir system
12296 set sys/ndir.h i_sysndir
12297 eval $inhdr
12298
12299 : Look for dirfd
12300 echo " "
12301 $cat >dirfd.c <<EOM
12302 #include <stdio.h>
12303 #$i_stdlib I_STDLIB
12304 #ifdef I_STDLIB
12305 #include <stdlib.h>
12306 #endif
12307 #$i_dirent I_DIRENT             /**/
12308 #$i_sysdir I_SYS_DIR            /**/
12309 #$i_sysndir I_SYS_NDIR          /**/
12310 #$i_systypes I_SYS_TYPES        /**/
12311 #if defined(I_SYS_TYPES)
12312 #include <sys/types.h>
12313 #endif
12314 #if defined(I_DIRENT)
12315 #include <dirent.h>
12316 #else
12317 #ifdef I_SYS_NDIR
12318 #include <sys/ndir.h>
12319 #else
12320 #ifdef I_SYS_DIR
12321 #ifdef hp9000s500
12322 #include <ndir.h>       /* may be wrong in the future */
12323 #else
12324 #include <sys/dir.h>
12325 #endif
12326 #endif
12327 #endif
12328 #endif
12329 int main() {
12330         DIR *dirp = opendir(".");
12331         if (dirfd(dirp) >= 0)
12332                 exit(0);
12333         else
12334                 exit(1);
12335 }
12336 EOM
12337 val=$undef
12338 set dirfd
12339 if eval $compile; then
12340         val="$define"
12341 fi
12342 case "$val" in
12343 $define)        echo "dirfd() found." >&4       ;;
12344 *)              echo "dirfd() NOT found." >&4   ;;
12345 esac
12346 set d_dirfd
12347 eval $setvar
12348 $rm -f dirfd*
12349
12350 : see if dladdr exists
12351 set dladdr d_dladdr
12352 eval $inlibc
12353
12354 : see if dlerror exists
12355 xxx_runnm="$runnm"
12356 runnm=false
12357 set dlerror d_dlerror
12358 eval $inlibc
12359 runnm="$xxx_runnm"
12360
12361 : see if dlfcn is available
12362 set dlfcn.h i_dlfcn
12363 eval $inhdr
12364
12365 : Check what extension to use for shared libs
12366 case "$usedl" in
12367 $define|y|true)
12368         $cat << EOM
12369
12370 On a few systems, the dynamically loaded modules that perl generates and uses
12371 will need a different extension than shared libs. The default will probably
12372 be appropriate.
12373
12374 EOM
12375         case "$dlext" in
12376         '')     dflt="$so" ;;
12377         *)      dflt="$dlext" ;;
12378         esac
12379         rp='What is the extension of dynamically loaded modules'
12380         . ./myread
12381         dlext="$ans"
12382         ;;
12383 *)
12384         dlext="none"
12385         ;;
12386 esac
12387
12388 : Check if dlsym need a leading underscore
12389 echo " "
12390 val="$undef"
12391
12392 case "$dlsrc" in
12393 dl_dlopen.xs)
12394         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12395         $cat >dyna.c <<'EOM'
12396 fred () { }
12397 EOM
12398
12399 $cat >fred.c<<EOM
12400
12401 #include <stdio.h>
12402 #$i_stdlib I_STDLIB
12403 #ifdef I_STDLIB
12404 #include <stdlib.h>
12405 #endif
12406 #$i_dlfcn I_DLFCN
12407 #ifdef I_DLFCN
12408 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12409 #else
12410 #include <sys/types.h>
12411 #include <nlist.h>
12412 #include <link.h>
12413 #endif
12414
12415 extern int fred() ;
12416
12417 int main()
12418 {
12419     void * handle ;
12420     void * symbol ;
12421 #ifndef RTLD_LAZY
12422     int mode = 1 ;
12423 #else
12424     int mode = RTLD_LAZY ;
12425 #endif
12426     handle = dlopen("./dyna.$dlext", mode) ;
12427     if (handle == NULL) {
12428         printf ("1\n") ;
12429         fflush (stdout) ;
12430         exit(0);
12431     }
12432     symbol = dlsym(handle, "fred") ;
12433     if (symbol == NULL) {
12434         /* try putting a leading underscore */
12435         symbol = dlsym(handle, "_fred") ;
12436         if (symbol == NULL) {
12437             printf ("2\n") ;
12438             fflush (stdout) ;
12439             exit(0);
12440         }
12441         printf ("3\n") ;
12442     }
12443     else
12444         printf ("4\n") ;
12445     fflush (stdout) ;
12446     exit(0);
12447 }
12448 EOM
12449         : Call the object file tmp-dyna.o in case dlext=o.
12450         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12451                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12452                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12453                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12454                 xxx=`$run ./fred`
12455                 case $xxx in
12456                 1)      echo "Test program failed using dlopen." >&4
12457                         echo "Perhaps you should not use dynamic loading." >&4;;
12458                 2)      echo "Test program failed using dlsym." >&4
12459                         echo "Perhaps you should not use dynamic loading." >&4;;
12460                 3)      echo "dlsym needs a leading underscore" >&4
12461                         val="$define" ;;
12462                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12463                 esac
12464         else
12465                 echo "I can't compile and run the test program." >&4
12466                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12467         fi
12468         ;;
12469 esac
12470
12471 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12472
12473 set d_dlsymun
12474 eval $setvar
12475
12476 : see if drand48_r exists
12477 set drand48_r d_drand48_r
12478 eval $inlibc
12479 case "$d_drand48_r" in
12480 "$define")
12481         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12482         case "$d_drand48_r_proto:$usethreads" in
12483         ":define")      d_drand48_r_proto=define
12484                 set d_drand48_r_proto drand48_r $hdrs
12485                 eval $hasproto ;;
12486         *)      ;;
12487         esac
12488         case "$d_drand48_r_proto" in
12489         define)
12490         case "$drand48_r_proto" in
12491         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12492         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12493         esac
12494         case "$drand48_r_proto" in
12495         ''|0)   d_drand48_r=undef
12496                 drand48_r_proto=0
12497                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12498         * )     case "$drand48_r_proto" in
12499                 REENTRANT_PROTO*) ;;
12500                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12501                 esac
12502                 echo "Prototype: $try" ;;
12503         esac
12504         ;;
12505         *)      case "$usethreads" in
12506                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12507                 esac
12508                 d_drand48_r=undef
12509                 drand48_r_proto=0
12510                 ;;
12511         esac
12512         ;;
12513 *)      drand48_r_proto=0
12514         ;;
12515 esac
12516
12517 : see if prototype for drand48 is available
12518 echo " "
12519 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12520 eval $hasproto
12521
12522 : see if dup2 exists
12523 set dup2 d_dup2
12524 eval $inlibc
12525
12526 : see if eaccess exists
12527 set eaccess d_eaccess
12528 eval $inlibc
12529
12530 : see if endgrent exists
12531 set endgrent d_endgrent
12532 eval $inlibc
12533
12534 : see if this is an grp system
12535 set grp.h i_grp
12536 eval $inhdr
12537
12538 case "$i_grp" in
12539 $define)
12540         xxx=`./findhdr grp.h`
12541         $cppstdin $cppflags $cppminus < $xxx >$$.h
12542
12543         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12544                 val="$define"
12545         else
12546                 val="$undef"
12547         fi
12548         set d_grpasswd
12549         eval $setvar
12550
12551         $rm -f $$.h
12552         ;;
12553 *)
12554         val="$undef";
12555         set d_grpasswd; eval $setvar
12556         ;;
12557 esac
12558
12559 : see if endgrent_r exists
12560 set endgrent_r d_endgrent_r
12561 eval $inlibc
12562 case "$d_endgrent_r" in
12563 "$define")
12564         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12565         case "$d_endgrent_r_proto:$usethreads" in
12566         ":define")      d_endgrent_r_proto=define
12567                 set d_endgrent_r_proto endgrent_r $hdrs
12568                 eval $hasproto ;;
12569         *)      ;;
12570         esac
12571         case "$d_endgrent_r_proto" in
12572         define)
12573         case "$endgrent_r_proto" in
12574         ''|0) try='int endgrent_r(FILE**);'
12575         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12576         esac
12577         case "$endgrent_r_proto" in
12578         ''|0) try='void endgrent_r(FILE**);'
12579         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12580         esac
12581         case "$endgrent_r_proto" in
12582         ''|0)   d_endgrent_r=undef
12583                 endgrent_r_proto=0
12584                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12585         * )     case "$endgrent_r_proto" in
12586                 REENTRANT_PROTO*) ;;
12587                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12588                 esac
12589                 echo "Prototype: $try" ;;
12590         esac
12591         ;;
12592         *)      case "$usethreads" in
12593                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12594                 esac
12595                 d_endgrent_r=undef
12596                 endgrent_r_proto=0
12597                 ;;
12598         esac
12599         ;;
12600 *)      endgrent_r_proto=0
12601         ;;
12602 esac
12603
12604 : see if endhostent exists
12605 set endhostent d_endhent
12606 eval $inlibc
12607
12608 : see if this is a netdb.h system
12609 set netdb.h i_netdb
12610 eval $inhdr
12611
12612 : see if endhostent_r exists
12613 set endhostent_r d_endhostent_r
12614 eval $inlibc
12615 case "$d_endhostent_r" in
12616 "$define")
12617         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12618         case "$d_endhostent_r_proto:$usethreads" in
12619         ":define")      d_endhostent_r_proto=define
12620                 set d_endhostent_r_proto endhostent_r $hdrs
12621                 eval $hasproto ;;
12622         *)      ;;
12623         esac
12624         case "$d_endhostent_r_proto" in
12625         define)
12626         case "$endhostent_r_proto" in
12627         ''|0) try='int endhostent_r(struct hostent_data*);'
12628         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12629         esac
12630         case "$endhostent_r_proto" in
12631         ''|0) try='void endhostent_r(struct hostent_data*);'
12632         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12633         esac
12634         case "$endhostent_r_proto" in
12635         ''|0)   d_endhostent_r=undef
12636                 endhostent_r_proto=0
12637                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12638         * )     case "$endhostent_r_proto" in
12639                 REENTRANT_PROTO*) ;;
12640                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12641                 esac
12642                 echo "Prototype: $try" ;;
12643         esac
12644         ;;
12645         *)      case "$usethreads" in
12646                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12647                 esac
12648                 d_endhostent_r=undef
12649                 endhostent_r_proto=0
12650                 ;;
12651         esac
12652         ;;
12653 *)      endhostent_r_proto=0
12654         ;;
12655 esac
12656
12657 : see if endnetent exists
12658 set endnetent d_endnent
12659 eval $inlibc
12660
12661 : see if endnetent_r exists
12662 set endnetent_r d_endnetent_r
12663 eval $inlibc
12664 case "$d_endnetent_r" in
12665 "$define")
12666         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12667         case "$d_endnetent_r_proto:$usethreads" in
12668         ":define")      d_endnetent_r_proto=define
12669                 set d_endnetent_r_proto endnetent_r $hdrs
12670                 eval $hasproto ;;
12671         *)      ;;
12672         esac
12673         case "$d_endnetent_r_proto" in
12674         define)
12675         case "$endnetent_r_proto" in
12676         ''|0) try='int endnetent_r(struct netent_data*);'
12677         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12678         esac
12679         case "$endnetent_r_proto" in
12680         ''|0) try='void endnetent_r(struct netent_data*);'
12681         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12682         esac
12683         case "$endnetent_r_proto" in
12684         ''|0)   d_endnetent_r=undef
12685                 endnetent_r_proto=0
12686                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12687         * )     case "$endnetent_r_proto" in
12688                 REENTRANT_PROTO*) ;;
12689                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12690                 esac
12691                 echo "Prototype: $try" ;;
12692         esac
12693         ;;
12694         *)      case "$usethreads" in
12695                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12696                 esac
12697                 d_endnetent_r=undef
12698                 endnetent_r_proto=0
12699                 ;;
12700         esac
12701         ;;
12702 *)      endnetent_r_proto=0
12703         ;;
12704 esac
12705
12706 : see if endprotoent exists
12707 set endprotoent d_endpent
12708 eval $inlibc
12709
12710 : see if endprotoent_r exists
12711 set endprotoent_r d_endprotoent_r
12712 eval $inlibc
12713 case "$d_endprotoent_r" in
12714 "$define")
12715         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12716         case "$d_endprotoent_r_proto:$usethreads" in
12717         ":define")      d_endprotoent_r_proto=define
12718                 set d_endprotoent_r_proto endprotoent_r $hdrs
12719                 eval $hasproto ;;
12720         *)      ;;
12721         esac
12722         case "$d_endprotoent_r_proto" in
12723         define)
12724         case "$endprotoent_r_proto" in
12725         ''|0) try='int endprotoent_r(struct protoent_data*);'
12726         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12727         esac
12728         case "$endprotoent_r_proto" in
12729         ''|0) try='void endprotoent_r(struct protoent_data*);'
12730         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12731         esac
12732         case "$endprotoent_r_proto" in
12733         ''|0)   d_endprotoent_r=undef
12734                 endprotoent_r_proto=0
12735                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12736         * )     case "$endprotoent_r_proto" in
12737                 REENTRANT_PROTO*) ;;
12738                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12739                 esac
12740                 echo "Prototype: $try" ;;
12741         esac
12742         ;;
12743         *)      case "$usethreads" in
12744                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12745                 esac
12746                 d_endprotoent_r=undef
12747                 endprotoent_r_proto=0
12748                 ;;
12749         esac
12750         ;;
12751 *)      endprotoent_r_proto=0
12752         ;;
12753 esac
12754
12755 : see if endpwent exists
12756 set endpwent d_endpwent
12757 eval $inlibc
12758
12759 : see if this is a pwd.h system
12760 set pwd.h i_pwd
12761 eval $inhdr
12762
12763 case "$i_pwd" in
12764 $define)
12765         xxx=`./findhdr pwd.h`
12766         $cppstdin $cppflags $cppminus < $xxx >$$.h
12767
12768         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12769                 val="$define"
12770         else
12771                 val="$undef"
12772         fi
12773         set d_pwquota
12774         eval $setvar
12775
12776         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12777                 val="$define"
12778         else
12779                 val="$undef"
12780         fi
12781         set d_pwage
12782         eval $setvar
12783
12784         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12785                 val="$define"
12786         else
12787                 val="$undef"
12788         fi
12789         set d_pwchange
12790         eval $setvar
12791
12792         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12793                 val="$define"
12794         else
12795                 val="$undef"
12796         fi
12797         set d_pwclass
12798         eval $setvar
12799
12800         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12801                 val="$define"
12802         else
12803                 val="$undef"
12804         fi
12805         set d_pwexpire
12806         eval $setvar
12807
12808         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12809                 val="$define"
12810         else
12811                 val="$undef"
12812         fi
12813         set d_pwcomment
12814         eval $setvar
12815
12816         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12817                 val="$define"
12818         else
12819                 val="$undef"
12820         fi
12821         set d_pwgecos
12822         eval $setvar
12823
12824         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12825                 val="$define"
12826         else
12827                 val="$undef"
12828         fi
12829         set d_pwpasswd
12830         eval $setvar
12831
12832         $rm -f $$.h
12833         ;;
12834 *)
12835         val="$undef";
12836         set d_pwquota; eval $setvar
12837         set d_pwage; eval $setvar
12838         set d_pwchange; eval $setvar
12839         set d_pwclass; eval $setvar
12840         set d_pwexpire; eval $setvar
12841         set d_pwcomment; eval $setvar
12842         set d_pwgecos; eval $setvar
12843         set d_pwpasswd; eval $setvar
12844         ;;
12845 esac
12846
12847 : see if endpwent_r exists
12848 set endpwent_r d_endpwent_r
12849 eval $inlibc
12850 case "$d_endpwent_r" in
12851 "$define")
12852         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12853         case "$d_endpwent_r_proto:$usethreads" in
12854         ":define")      d_endpwent_r_proto=define
12855                 set d_endpwent_r_proto endpwent_r $hdrs
12856                 eval $hasproto ;;
12857         *)      ;;
12858         esac
12859         case "$d_endpwent_r_proto" in
12860         define)
12861         case "$endpwent_r_proto" in
12862         ''|0) try='int endpwent_r(FILE**);'
12863         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12864         esac
12865         case "$endpwent_r_proto" in
12866         ''|0) try='void endpwent_r(FILE**);'
12867         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12868         esac
12869         case "$endpwent_r_proto" in
12870         ''|0)   d_endpwent_r=undef
12871                 endpwent_r_proto=0
12872                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12873         * )     case "$endpwent_r_proto" in
12874                 REENTRANT_PROTO*) ;;
12875                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12876                 esac
12877                 echo "Prototype: $try" ;;
12878         esac
12879         ;;
12880         *)      case "$usethreads" in
12881                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12882                 esac
12883                 d_endpwent_r=undef
12884                 endpwent_r_proto=0
12885                 ;;
12886         esac
12887         ;;
12888 *)      endpwent_r_proto=0
12889         ;;
12890 esac
12891
12892 : see if endservent exists
12893 set endservent d_endsent
12894 eval $inlibc
12895
12896 : see if endservent_r exists
12897 set endservent_r d_endservent_r
12898 eval $inlibc
12899 case "$d_endservent_r" in
12900 "$define")
12901         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12902         case "$d_endservent_r_proto:$usethreads" in
12903         ":define")      d_endservent_r_proto=define
12904                 set d_endservent_r_proto endservent_r $hdrs
12905                 eval $hasproto ;;
12906         *)      ;;
12907         esac
12908         case "$d_endservent_r_proto" in
12909         define)
12910         case "$endservent_r_proto" in
12911         ''|0) try='int endservent_r(struct servent_data*);'
12912         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12913         esac
12914         case "$endservent_r_proto" in
12915         ''|0) try='void endservent_r(struct servent_data*);'
12916         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12917         esac
12918         case "$endservent_r_proto" in
12919         ''|0)   d_endservent_r=undef
12920                 endservent_r_proto=0
12921                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12922         * )     case "$endservent_r_proto" in
12923                 REENTRANT_PROTO*) ;;
12924                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12925                 esac
12926                 echo "Prototype: $try" ;;
12927         esac
12928         ;;
12929         *)      case "$usethreads" in
12930                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12931                 esac
12932                 d_endservent_r=undef
12933                 endservent_r_proto=0
12934                 ;;
12935         esac
12936         ;;
12937 *)      endservent_r_proto=0
12938         ;;
12939 esac
12940
12941 : Locate the flags for 'open()'
12942 echo " "
12943 $cat >try.c <<EOCP
12944 #include <sys/types.h>
12945 #ifdef I_FCNTL
12946 #include <fcntl.h>
12947 #endif
12948 #ifdef I_SYS_FILE
12949 #include <sys/file.h>
12950 #endif
12951 #$i_stdlib I_STDLIB
12952 #ifdef I_STDLIB
12953 #include <stdlib.h>
12954 #endif
12955 int main() {
12956         if(O_RDONLY);
12957 #ifdef O_TRUNC
12958         exit(0);
12959 #else
12960         exit(1);
12961 #endif
12962 }
12963 EOCP
12964 : check sys/file.h first to get FREAD on Sun
12965 if $test `./findhdr sys/file.h` && \
12966                 set try -DI_SYS_FILE && eval $compile; then
12967         h_sysfile=true;
12968         echo "<sys/file.h> defines the O_* constants..." >&4
12969         if $run ./try; then
12970                 echo "and you have the 3 argument form of open()." >&4
12971                 val="$define"
12972         else
12973                 echo "but not the 3 argument form of open().  Oh, well." >&4
12974                 val="$undef"
12975         fi
12976 elif $test `./findhdr fcntl.h` && \
12977                 set try -DI_FCNTL && eval $compile; then
12978         h_fcntl=true;
12979         echo "<fcntl.h> defines the O_* constants..." >&4
12980         if $run ./try; then
12981                 echo "and you have the 3 argument form of open()." >&4
12982                 val="$define"
12983         else
12984                 echo "but not the 3 argument form of open().  Oh, well." >&4
12985                 val="$undef"
12986         fi
12987 else
12988         val="$undef"
12989         echo "I can't find the O_* constant definitions!  You got problems." >&4
12990 fi
12991 set d_open3
12992 eval $setvar
12993 $rm_try
12994
12995 : see if this is a sys/file.h system
12996 val=''
12997 set sys/file.h val
12998 eval $inhdr
12999
13000 : do we need to include sys/file.h ?
13001 case "$val" in
13002 "$define")
13003         echo " "
13004         if $h_sysfile; then
13005                 val="$define"
13006                 echo "We'll be including <sys/file.h>." >&4
13007         else
13008                 val="$undef"
13009                 echo "We won't be including <sys/file.h>." >&4
13010         fi
13011         ;;
13012 *)
13013         h_sysfile=false
13014         ;;
13015 esac
13016 set i_sysfile
13017 eval $setvar
13018
13019 : see if fcntl.h is there
13020 val=''
13021 set fcntl.h val
13022 eval $inhdr
13023
13024 : see if we can include fcntl.h
13025 case "$val" in
13026 "$define")
13027         echo " "
13028         if $h_fcntl; then
13029                 val="$define"
13030                 echo "We'll be including <fcntl.h>." >&4
13031         else
13032                 val="$undef"
13033                 if $h_sysfile; then
13034         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13035                 else
13036                         echo "We won't be including <fcntl.h>." >&4
13037                 fi
13038         fi
13039         ;;
13040 *)
13041         h_fcntl=false
13042         val="$undef"
13043         ;;
13044 esac
13045 set i_fcntl
13046 eval $setvar
13047
13048 : see if fork exists
13049 set fork d_fork
13050 eval $inlibc
13051
13052 : see if pipe exists
13053 set pipe d_pipe
13054 eval $inlibc
13055
13056 : check for non-blocking I/O stuff
13057 case "$h_sysfile" in
13058 true) echo "#include <sys/file.h>" > head.c;;
13059 *)
13060        case "$h_fcntl" in
13061        true) echo "#include <fcntl.h>" > head.c;;
13062        *) echo "#include <sys/fcntl.h>" > head.c;;
13063        esac
13064        ;;
13065 esac
13066 echo " "
13067 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13068 case "$o_nonblock" in
13069 '')
13070         $cat head.c > try.c
13071         $cat >>try.c <<EOCP
13072 #include <stdio.h>
13073 #$i_stdlib I_STDLIB
13074 #ifdef I_STDLIB
13075 #include <stdlib.h>
13076 #endif
13077 #$i_fcntl I_FCNTL
13078 #ifdef I_FCNTL
13079 #include <fcntl.h>
13080 #endif
13081 int main() {
13082 #ifdef O_NONBLOCK
13083         printf("O_NONBLOCK\n");
13084         exit(0);
13085 #endif
13086 #ifdef O_NDELAY
13087         printf("O_NDELAY\n");
13088         exit(0);
13089 #endif
13090 #ifdef FNDELAY
13091         printf("FNDELAY\n");
13092         exit(0);
13093 #endif
13094         exit(0);
13095 }
13096 EOCP
13097         set try
13098         if eval $compile_ok; then
13099                 o_nonblock=`$run ./try`
13100                 case "$o_nonblock" in
13101                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13102                 *) echo "Seems like we can use $o_nonblock.";;
13103                 esac
13104         else
13105                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13106         fi
13107         ;;
13108 *) echo "Using $hint value $o_nonblock.";;
13109 esac
13110 $rm_try
13111
13112 echo " "
13113 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13114 case "$eagain" in
13115 '')
13116         case "$d_fork:$d_pipe" in
13117         define:define)
13118         $cat head.c > try.c
13119         $cat >>try.c <<EOCP
13120 #include <errno.h>
13121 #include <sys/types.h>
13122 #include <signal.h>
13123 #include <stdio.h>
13124 #$i_stdlib I_STDLIB
13125 #ifdef I_STDLIB
13126 #include <stdlib.h>
13127 #endif
13128 #$i_fcntl I_FCNTL
13129 #ifdef I_FCNTL
13130 #include <fcntl.h>
13131 #endif
13132 #define MY_O_NONBLOCK $o_nonblock
13133 #ifndef errno  /* XXX need better Configure test */
13134 extern int errno;
13135 #endif
13136 #$i_unistd I_UNISTD
13137 #ifdef I_UNISTD
13138 #include <unistd.h>
13139 #endif
13140 #$i_string I_STRING
13141 #ifdef I_STRING
13142 #include <string.h>
13143 #else
13144 #include <strings.h>
13145 #endif
13146 $signal_t blech(int x) { exit(3); }
13147 EOCP
13148         $cat >> try.c <<'EOCP'
13149 int main()
13150 {
13151         int pd[2];
13152         int pu[2];
13153         char buf[1];
13154         char string[100];
13155         int ret;
13156
13157         ret = pipe(pd); /* Down: child -> parent */
13158         if (ret != 0)
13159                 exit(3);
13160         ret = pipe(pu); /* Up: parent -> child */
13161         if (ret != 0)
13162                 exit(3);
13163         if (0 != fork()) {
13164                 close(pd[1]);   /* Parent reads from pd[0] */
13165                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13166 #ifdef F_SETFL
13167                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13168                         exit(1);
13169 #else
13170                 exit(4);
13171 #endif
13172                 signal(SIGALRM, blech);
13173                 alarm(5);
13174                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13175                         exit(2);
13176                 sprintf(string, "%d\n", ret);
13177                 ret = write(2, string, strlen(string));
13178                 if (ret != strlen(string))
13179                         exit(3);
13180                 alarm(0);
13181 #ifdef EAGAIN
13182                 if (errno == EAGAIN) {
13183                         printf("EAGAIN\n");
13184                         goto ok;
13185                 }
13186 #endif
13187 #ifdef EWOULDBLOCK
13188                 if (errno == EWOULDBLOCK)
13189                         printf("EWOULDBLOCK\n");
13190 #endif
13191         ok:
13192                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13193                 if (ret != 1)
13194                         exit(3);
13195                 sleep(2);                               /* Give it time to close our pipe */
13196                 alarm(5);
13197                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13198                 alarm(0);
13199                 sprintf(string, "%d\n", ret);
13200                 ret = write(4, string, strlen(string));
13201                 if (ret != strlen(string))
13202                         exit(3);
13203                 exit(0);
13204         }
13205
13206         close(pd[0]);                   /* We write to pd[1] */
13207         close(pu[1]);                   /* We read from pu[0] */
13208         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13209         if (ret != 1)
13210                 exit(3);
13211         close(pd[1]);                   /* Pipe pd is now fully closed! */
13212         exit(0);                                /* Bye bye, thank you for playing! */
13213 }
13214 EOCP
13215         set try
13216         if eval $compile_ok; then
13217                 echo "$startsh" >mtry
13218                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13219                 chmod +x mtry
13220                 $run ./mtry >/dev/null 2>&1
13221                 case $? in
13222                 0) eagain=`$cat try.out`;;
13223                 1) echo "Could not perform non-blocking setting!";;
13224                 2) echo "I did a successful read() for something that was not there!";;
13225                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13226                 4) echo "Could not find F_SETFL!";;
13227                 *) echo "Something terribly wrong happened during testing.";;
13228                 esac
13229                 rd_nodata=`$cat try.ret`
13230                 echo "A read() system call with no data present returns $rd_nodata."
13231                 case "$rd_nodata" in
13232                 0|-1) ;;
13233                 *)
13234                         echo "(That's peculiar, fixing that to be -1.)"
13235                         rd_nodata=-1
13236                         ;;
13237                 esac
13238                 case "$eagain" in
13239                 '')
13240                         echo "Forcing errno EAGAIN on read() with no data available."
13241                         eagain=EAGAIN
13242                         ;;
13243                 *)
13244                         echo "Your read() sets errno to $eagain when no data is available."
13245                         ;;
13246                 esac
13247                 status=`$cat try.err`
13248                 case "$status" in
13249                 0) echo "And it correctly returns 0 to signal EOF.";;
13250                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13251                 *) echo "However, your read() returns '$status' on EOF??";;
13252                 esac
13253                 val="$define"
13254                 if test "$status" = "$rd_nodata"; then
13255                         echo "WARNING: you can't distinguish between EOF and no data!"
13256                         val="$undef"
13257                 fi
13258         else
13259                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13260                 eagain=EAGAIN
13261         fi
13262         ;;
13263         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13264                 eagain=EAGAIN
13265                 val="$define"
13266                 ;;
13267         esac
13268         set d_eofnblk
13269         eval $setvar
13270         ;;
13271 *)
13272         echo "Using $hint value $eagain."
13273         echo "Your read() returns $rd_nodata when no data is present."
13274         case "$d_eofnblk" in
13275         "$define") echo "And you can see EOF because read() returns 0.";;
13276         "$undef") echo "But you can't see EOF status from read() returned value.";;
13277         *)
13278                 echo "(Assuming you can't see EOF status from read anyway.)"
13279                 d_eofnblk=$undef
13280                 ;;
13281         esac
13282         ;;
13283 esac
13284 $rm_try head.c mtry
13285
13286 : see if _ptr and _cnt from stdio act std
13287 echo " "
13288
13289 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13290         echo "(Looks like you have stdio.h from BSD.)"
13291         case "$stdio_ptr" in
13292         '') stdio_ptr='((fp)->_p)'
13293                 ptr_lval=$define
13294                 ;;
13295         *)      ptr_lval=$d_stdio_ptr_lval;;
13296         esac
13297         case "$stdio_cnt" in
13298         '') stdio_cnt='((fp)->_r)'
13299                 cnt_lval=$define
13300                 ;;
13301         *)      cnt_lval=$d_stdio_cnt_lval;;
13302         esac
13303         case "$stdio_base" in
13304         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13305         esac
13306         case "$stdio_bufsiz" in
13307         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13308         esac
13309 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13310         echo "(Looks like you have stdio.h from Linux.)"
13311         case "$stdio_ptr" in
13312         '') stdio_ptr='((fp)->_IO_read_ptr)'
13313                 ptr_lval=$define
13314                 ;;
13315         *)      ptr_lval=$d_stdio_ptr_lval;;
13316         esac
13317         case "$stdio_cnt" in
13318         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13319                 cnt_lval=$undef
13320                 ;;
13321         *)      cnt_lval=$d_stdio_cnt_lval;;
13322         esac
13323         case "$stdio_base" in
13324         '') stdio_base='((fp)->_IO_read_base)';;
13325         esac
13326         case "$stdio_bufsiz" in
13327         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13328         esac
13329 else
13330         case "$stdio_ptr" in
13331         '') stdio_ptr='((fp)->_ptr)'
13332                 ptr_lval=$define
13333                 ;;
13334         *)      ptr_lval=$d_stdio_ptr_lval;;
13335         esac
13336         case "$stdio_cnt" in
13337         '') stdio_cnt='((fp)->_cnt)'
13338                 cnt_lval=$define
13339                 ;;
13340         *)      cnt_lval=$d_stdio_cnt_lval;;
13341         esac
13342         case "$stdio_base" in
13343         '') stdio_base='((fp)->_base)';;
13344         esac
13345         case "$stdio_bufsiz" in
13346         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13347         esac
13348 fi
13349
13350 : test whether _ptr and _cnt really work
13351 echo "Checking how std your stdio is..." >&4
13352 $cat >try.c <<EOP
13353 #include <stdio.h>
13354 #$i_stdlib I_STDLIB
13355 #ifdef I_STDLIB
13356 #include <stdlib.h>
13357 #endif
13358 #define FILE_ptr(fp)    $stdio_ptr
13359 #define FILE_cnt(fp)    $stdio_cnt
13360 int main() {
13361         FILE *fp = fopen("try.c", "r");
13362         char c = getc(fp);
13363         if (
13364                 18 <= FILE_cnt(fp) &&
13365                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13366         )
13367                 exit(0);
13368         exit(1);
13369 }
13370 EOP
13371 val="$undef"
13372 set try
13373 if eval $compile && $to try.c; then
13374         if $run ./try; then
13375                 echo "Your stdio acts pretty std."
13376                 val="$define"
13377         else
13378                 echo "Your stdio isn't very std."
13379         fi
13380 else
13381         echo "Your stdio doesn't appear very std."
13382 fi
13383 $rm_try
13384
13385 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13386 # direct buffer manipulation no longer works.  The Configure tests
13387 # should be changed to correctly detect this, but until then,
13388 # the following check should at least let perl compile and run.
13389 # (This quick fix should be updated before 5.8.1.)
13390 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13391 # A. Dougherty, June 3, 2002.
13392 case "$d_gnulibc" in
13393 $define)
13394         case "$gnulibc_version" in
13395         2.[01]*)  ;;
13396         2.2) ;;
13397         2.2.[0-9]) ;;
13398         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13399                 val="$undef"
13400                 ;;
13401         esac
13402         ;;
13403 esac
13404 set d_stdstdio
13405 eval $setvar
13406
13407 : Can _ptr be used as an lvalue?
13408 case "$d_stdstdio$ptr_lval" in
13409 $define$define) val=$define ;;
13410 *) val=$undef ;;
13411 esac
13412 set d_stdio_ptr_lval
13413 eval $setvar
13414
13415 : Can _cnt be used as an lvalue?
13416 case "$d_stdstdio$cnt_lval" in
13417 $define$define) val=$define ;;
13418 *) val=$undef ;;
13419 esac
13420 set d_stdio_cnt_lval
13421 eval $setvar
13422
13423
13424 : test whether setting _ptr sets _cnt as a side effect
13425 d_stdio_ptr_lval_sets_cnt="$undef"
13426 d_stdio_ptr_lval_nochange_cnt="$undef"
13427 case "$d_stdio_ptr_lval$d_stdstdio" in
13428 $define$define)
13429         echo "Checking to see what happens if we set the stdio ptr..." >&4
13430 $cat >try.c <<EOP
13431 #include <stdio.h>
13432 /* Can we scream? */
13433 /* Eat dust sed :-) */
13434 /* In the buffer space, no one can hear you scream. */
13435 #$i_stdlib I_STDLIB
13436 #ifdef I_STDLIB
13437 #include <stdlib.h>
13438 #endif
13439 #define FILE_ptr(fp)    $stdio_ptr
13440 #define FILE_cnt(fp)    $stdio_cnt
13441 #include <sys/types.h>
13442 int main() {
13443         FILE *fp = fopen("try.c", "r");
13444         int c;
13445         char *ptr;
13446         size_t cnt;
13447         if (!fp) {
13448             puts("Fail even to read");
13449             exit(1);
13450         }
13451         c = getc(fp); /* Read away the first # */
13452         if (c == EOF) {
13453             puts("Fail even to read");
13454             exit(1);
13455         }
13456         if (!(
13457                 18 <= FILE_cnt(fp) &&
13458                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13459         )) {
13460                 puts("Fail even to read");
13461                 exit (1);
13462         }
13463         ptr = (char*) FILE_ptr(fp);
13464         cnt = (size_t)FILE_cnt(fp);
13465
13466         FILE_ptr(fp) += 42;
13467
13468         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13469                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13470                 exit (1);
13471         }
13472         if (FILE_cnt(fp) <= 20) {
13473                 printf ("Fail (<20 chars to test)");
13474                 exit (1);
13475         }
13476         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13477                 puts("Fail compare");
13478                 exit (1);
13479         }
13480         if (cnt == FILE_cnt(fp)) {
13481                 puts("Pass_unchanged");
13482                 exit (0);
13483         }
13484         if (FILE_cnt(fp) == (cnt - 42)) {
13485                 puts("Pass_changed");
13486                 exit (0);
13487         }
13488         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13489         return 1;
13490
13491 }
13492 EOP
13493         set try
13494         if eval $compile && $to try.c; then
13495                 case `$run ./try` in
13496                 Pass_changed)
13497                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13498                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13499                 Pass_unchanged)
13500                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13501                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13502                 Fail*)
13503                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13504                 *)
13505                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13506         esac
13507         else
13508                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13509         fi
13510         $rm_try
13511         ;;
13512 esac
13513
13514 : see if _base is also standard
13515 val="$undef"
13516 case "$d_stdstdio" in
13517 $define)
13518         $cat >try.c <<EOP
13519 #include <stdio.h>
13520 #$i_stdlib I_STDLIB
13521 #ifdef I_STDLIB
13522 #include <stdlib.h>
13523 #endif
13524 #define FILE_base(fp)   $stdio_base
13525 #define FILE_bufsiz(fp) $stdio_bufsiz
13526 int main() {
13527         FILE *fp = fopen("try.c", "r");
13528         char c = getc(fp);
13529         if (
13530                 19 <= FILE_bufsiz(fp) &&
13531                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13532         )
13533                 exit(0);
13534         exit(1);
13535 }
13536 EOP
13537         set try
13538         if eval $compile && $to try.c; then
13539                 if $run ./try; then
13540                         echo "And its _base field acts std."
13541                         val="$define"
13542                 else
13543                         echo "But its _base field isn't std."
13544                 fi
13545         else
13546                 echo "However, it seems to be lacking the _base field."
13547         fi
13548         $rm_try
13549         ;;
13550 esac
13551 set d_stdiobase
13552 eval $setvar
13553
13554 : see if fast_stdio exists
13555 val="$undef"
13556 case "$d_stdstdio:$d_stdio_ptr_lval" in
13557 "$define:$define")
13558         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13559         *$define*)
13560                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13561                 val="$define"
13562                 ;;
13563         esac
13564         ;;
13565 esac
13566 set d_faststdio
13567 eval $setvar
13568
13569
13570
13571 : see if fchdir exists
13572 set fchdir d_fchdir
13573 eval $inlibc
13574
13575 : see if fchmod exists
13576 set fchmod d_fchmod
13577 eval $inlibc
13578
13579 : see if fchown exists
13580 set fchown d_fchown
13581 eval $inlibc
13582
13583 : see if this is an fcntl system
13584 set fcntl d_fcntl
13585 eval $inlibc
13586
13587 : See if fcntl-based locking works.
13588 echo " "
13589 $cat >try.c <<EOCP
13590 #$i_stdlib I_STDLIB
13591 #ifdef I_STDLIB
13592 #include <stdlib.h>
13593 #endif
13594 #include <unistd.h>
13595 #include <fcntl.h>
13596 #include <signal.h>
13597 $signal_t blech(int x) { exit(3); }
13598 int main() {
13599 #if defined(F_SETLK) && defined(F_SETLKW)
13600      struct flock flock;
13601      int retval, fd;
13602      fd = open("try.c", O_RDONLY);
13603      flock.l_type = F_RDLCK;
13604      flock.l_whence = SEEK_SET;
13605      flock.l_start = flock.l_len = 0;
13606      signal(SIGALRM, blech);
13607      alarm(10);
13608      retval = fcntl(fd, F_SETLK, &flock);
13609      close(fd);
13610      (retval < 0 ? exit(2) : exit(0));
13611 #else
13612      exit(2);
13613 #endif
13614 }
13615 EOCP
13616 echo "Checking if fcntl-based file locking works... "
13617 case "$d_fcntl" in
13618 "$define")
13619         set try
13620         if eval $compile_ok; then
13621                 if $run ./try; then
13622                         echo "Yes, it seems to work."
13623                         val="$define"
13624                 else
13625                         echo "Nope, it didn't work."
13626                         val="$undef"
13627                         case "$?" in
13628                         3) $cat >&4 <<EOM
13629 ***
13630 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13631 *** This is (almost) impossible.
13632 *** If your NFS lock daemons are not feeling well, something like
13633 *** this may happen, please investigate.  Cannot continue, aborting.
13634 ***
13635 EOM
13636                                 exit 1
13637                                 ;;
13638                         esac
13639                 fi
13640         else
13641                 echo "I'm unable to compile the test program, so I'll assume not."
13642                 val="$undef"
13643         fi
13644         ;;
13645 *) val="$undef";
13646         echo "Nope, since you don't even have fcntl()."
13647         ;;
13648 esac
13649 set d_fcntl_can_lock
13650 eval $setvar
13651 $rm_try
13652
13653 : check for fd_set items
13654 $cat <<EOM
13655
13656 Checking to see how well your C compiler handles fd_set and friends ...
13657 EOM
13658 $cat >try.c <<EOCP
13659 #$i_stdlib I_STDLIB
13660 #ifdef I_STDLIB
13661 #include <stdlib.h>
13662 #endif
13663 #$i_systime I_SYS_TIME
13664 #$i_sysselct I_SYS_SELECT
13665 #$d_socket HAS_SOCKET
13666 #include <sys/types.h>
13667 #ifdef HAS_SOCKET
13668 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13669 #endif
13670 #ifdef I_SYS_TIME
13671 #include <sys/time.h>
13672 #endif
13673 #ifdef I_SYS_SELECT
13674 #include <sys/select.h>
13675 #endif
13676 int main() {
13677         fd_set fds;
13678
13679 #ifdef TRYBITS
13680         if(fds.fds_bits);
13681 #endif
13682
13683 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13684         exit(0);
13685 #else
13686         exit(1);
13687 #endif
13688 }
13689 EOCP
13690 set try -DTRYBITS
13691 if eval $compile; then
13692         d_fds_bits="$define"
13693         d_fd_set="$define"
13694         echo "Well, your system knows about the normal fd_set typedef..." >&4
13695         if $run ./try; then
13696                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13697                 d_fd_macros="$define"
13698         else
13699                 $cat >&4 <<'EOM'
13700 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13701 EOM
13702                 d_fd_macros="$undef"
13703         fi
13704 else
13705         $cat <<'EOM'
13706 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13707 EOM
13708         set try
13709         if eval $compile; then
13710                 d_fds_bits="$undef"
13711                 d_fd_set="$define"
13712                 echo "Well, your system has some sort of fd_set available..." >&4
13713                 if $run ./try; then
13714                         echo "and you have the normal fd_set macros." >&4
13715                         d_fd_macros="$define"
13716                 else
13717                         $cat <<'EOM'
13718 but not the normal fd_set macros!  Gross!  More work for me...
13719 EOM
13720                         d_fd_macros="$undef"
13721                 fi
13722         else
13723         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13724                 d_fd_set="$undef"
13725                 d_fds_bits="$undef"
13726                 d_fd_macros="$undef"
13727         fi
13728 fi
13729 $rm_try
13730
13731 : see if fegetround exists
13732 set fegetround d_fegetround
13733 eval $inlibc
13734
13735 : see if fgetpos exists
13736 set fgetpos d_fgetpos
13737 eval $inlibc
13738
13739 : see if finite exists
13740 set finite d_finite
13741 eval $inlibc
13742
13743 : see if finitel exists
13744 set finitel d_finitel
13745 eval $inlibc
13746
13747 : see if flock exists
13748 set flock d_flock
13749 eval $inlibc
13750
13751 : see if prototype for flock is available
13752 echo " "
13753 set d_flockproto flock $i_sysfile sys/file.h
13754 eval $hasproto
13755
13756 : see if fp_class exists
13757 set fp_class d_fp_class
13758 eval $inlibc
13759
13760 : see if this is a math.h system
13761 set math.h i_math
13762 eval $inhdr
13763
13764 : check for fpclassify
13765 echo "Checking to see if you have fpclassify..." >&4
13766 $cat >try.c <<EOCP
13767 #$i_math I_MATH
13768 #ifdef I_MATH
13769 #include <math.h>
13770 #endif
13771 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13772 EOCP
13773 set try
13774 if eval $compile; then
13775         val="$define"
13776         echo "You have fpclassify."
13777 else
13778         val="$undef"
13779         echo "You do not have fpclassify."
13780 fi
13781 $rm_try
13782 set d_fpclassify
13783 eval $setvar
13784
13785 : see if fp_classify exists
13786 set fp_classify d_fp_classify
13787 eval $inlibc
13788
13789 : see if fp_classl exists
13790 set fp_classl d_fp_classl
13791 eval $inlibc
13792
13793 : see if pathconf exists
13794 set pathconf d_pathconf
13795 eval $inlibc
13796
13797 : see if fpathconf exists
13798 set fpathconf d_fpathconf
13799 eval $inlibc
13800
13801 : see if fpclass exists
13802 set fpclass d_fpclass
13803 eval $inlibc
13804
13805 : see if fpclassl exists
13806 set fpclassl d_fpclassl
13807 eval $inlibc
13808
13809 : see if fpgetround exists
13810 set fpgetround d_fpgetround
13811 eval $inlibc
13812
13813 : check for fpos64_t
13814 echo " "
13815 echo "Checking to see if you have fpos64_t..." >&4
13816 $cat >try.c <<EOCP
13817 #include <stdio.h>
13818 int main() { fpos64_t x = 7; }
13819 EOCP
13820 set try
13821 if eval $compile; then
13822         val="$define"
13823         echo "You have fpos64_t."
13824 else
13825         val="$undef"
13826         echo "You do not have fpos64_t."
13827         case "$fpossize" in
13828         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13829         esac
13830 fi
13831 $rm_try
13832 set d_fpos64_t
13833 eval $setvar
13834
13835 : see if frexpl exists
13836 set frexpl d_frexpl
13837 eval $inlibc
13838
13839 : see if this is a sys/param system
13840 set sys/param.h i_sysparam
13841 eval $inhdr
13842
13843 : see if this is a sys/mount.h system
13844 set sys/mount.h i_sysmount
13845 eval $inhdr
13846
13847 : Check for fs_data_s
13848 echo " "
13849 echo "Checking to see if your system supports struct fs_data..." >&4
13850 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13851 eval $hasstruct
13852 case "$d_fs_data_s" in
13853 "$define")      echo "Yes, it does."   ;;
13854 *)              echo "No, it doesn't." ;;
13855 esac
13856
13857 : see if fseeko exists
13858 set fseeko d_fseeko
13859 eval $inlibc
13860 case "$longsize" in
13861 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13862 esac
13863
13864 : see if fsetpos exists
13865 set fsetpos d_fsetpos
13866 eval $inlibc
13867
13868 : see if fstatfs exists
13869 set fstatfs d_fstatfs
13870 eval $inlibc
13871
13872 : see if statvfs exists
13873 set statvfs d_statvfs
13874 eval $inlibc
13875
13876 : see if fstatvfs exists
13877 set fstatvfs d_fstatvfs
13878 eval $inlibc
13879
13880
13881 : see if fsync exists
13882 set fsync d_fsync
13883 eval $inlibc
13884
13885 : see if ftello exists
13886 set ftello d_ftello
13887 eval $inlibc
13888 case "$longsize" in
13889 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13890 esac
13891
13892 : check for a working futimes
13893 d_futimes="$undef"
13894 echo " "
13895 echo "Checking if you have a working futimes()" >&4
13896 $cat >try.c <<EOCP
13897 #include <stdio.h>
13898 #include <sys/time.h>
13899 #include <errno.h>
13900 #include <fcntl.h>
13901
13902 int main ()
13903 {
13904     int fd, rv;
13905     fd = open ("try.c", O_RDWR);
13906     if (-1 == fd) exit (1);
13907     rv = futimes (fd, NULL);
13908     exit (rv == -1 ? errno : 0);
13909 }
13910 EOCP
13911 set try
13912 if eval $compile; then
13913     `$run ./try`
13914     rc=$?
13915     case "$rc" in
13916         0)  echo "Yes, you have" >&4
13917             d_futimes="$define"
13918             ;;
13919         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13920             ;;
13921     esac
13922 else
13923     echo "No, it does not (probably harmless)" >&4
13924 fi
13925 $rm_try
13926
13927 : see if ndbm.h is available
13928 set ndbm.h i_ndbm
13929 eval $inhdr
13930 : Compatibility location for RedHat 7.1
13931 set gdbm/ndbm.h i_gdbmndbm
13932 eval $inhdr
13933 : Compatibility location for Debian 4.0
13934 set gdbm-ndbm.h i_gdbm_ndbm
13935 eval $inhdr
13936
13937 val="$undef"
13938 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13939         : see if dbm_open exists
13940         set dbm_open d_dbm_open
13941         eval $inlibc
13942         case "$d_dbm_open" in
13943         $undef)
13944                 i_ndbm="$undef"
13945                 i_gdbmndbm="$undef"
13946                 i_gdbm_ndbm="$undef"
13947                 echo "We won't be including <ndbm.h>"
13948                 val="$undef"
13949                 ;;
13950         *) val="$define"
13951            ;;
13952         esac
13953 fi
13954 set d_ndbm
13955 eval $setvar
13956
13957 ndbm_hdr_protochk='name=$1; hdr=$2;
13958 eval "ihdr=\$""i_$name";
13959 val="$undef";
13960 if $test "$ihdr" = "$define"; then
13961         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13962         case "$d_cplusplus" in
13963         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13964         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13965         esac;
13966         case "$val" in
13967         $define) $echo "Your <$hdr> seems to have prototypes";;
13968         *) $echo "Your <$hdr> does not seem to have prototypes";;
13969         esac;
13970 fi;
13971 set "d_${name}_h_uses_prototypes";
13972 eval $setvar'
13973
13974 set ndbm ndbm.h
13975 eval $ndbm_hdr_protochk
13976 set gdbmndbm gdbm/ndbm.h
13977 eval $ndbm_hdr_protochk
13978 set gdbm_ndbm gdbm-ndbm.h
13979 eval $ndbm_hdr_protochk
13980
13981 : see if getaddrinfo exists
13982 set getaddrinfo d_getaddrinfo
13983 eval $inlibc
13984
13985 : see if getcwd exists
13986 set getcwd d_getcwd
13987 eval $inlibc
13988
13989 : see if getespwnam exists
13990 set getespwnam d_getespwnam
13991 eval $inlibc
13992
13993 : see if getfsstat exists
13994 set getfsstat d_getfsstat
13995 eval $inlibc
13996
13997 : see if getgrent exists
13998 set getgrent d_getgrent
13999 eval $inlibc
14000
14001 : see if getgrent_r exists
14002 set getgrent_r d_getgrent_r
14003 eval $inlibc
14004 case "$d_getgrent_r" in
14005 "$define")
14006         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14007         case "$d_getgrent_r_proto:$usethreads" in
14008         ":define")      d_getgrent_r_proto=define
14009                 set d_getgrent_r_proto getgrent_r $hdrs
14010                 eval $hasproto ;;
14011         *)      ;;
14012         esac
14013         case "$d_getgrent_r_proto" in
14014         define)
14015         case "$getgrent_r_proto" in
14016         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14017         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14018         esac
14019         case "$getgrent_r_proto" in
14020         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14021         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14022         esac
14023         case "$getgrent_r_proto" in
14024         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14025         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14026         esac
14027         case "$getgrent_r_proto" in
14028         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14029         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14030         esac
14031         case "$getgrent_r_proto" in
14032         ''|0) try='int getgrent_r(struct group*, char*, int);'
14033         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14034         esac
14035         case "$getgrent_r_proto" in
14036         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14037         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14038         esac
14039         case "$getgrent_r_proto" in
14040         ''|0)   d_getgrent_r=undef
14041                 getgrent_r_proto=0
14042                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14043         * )     case "$getgrent_r_proto" in
14044                 REENTRANT_PROTO*) ;;
14045                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14046                 esac
14047                 echo "Prototype: $try" ;;
14048         esac
14049         ;;
14050         *)      case "$usethreads" in
14051                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14052                 esac
14053                 d_getgrent_r=undef
14054                 getgrent_r_proto=0
14055                 ;;
14056         esac
14057         ;;
14058 *)      getgrent_r_proto=0
14059         ;;
14060 esac
14061
14062 : see if getgrgid_r exists
14063 set getgrgid_r d_getgrgid_r
14064 eval $inlibc
14065 case "$d_getgrgid_r" in
14066 "$define")
14067         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14068         case "$d_getgrgid_r_proto:$usethreads" in
14069         ":define")      d_getgrgid_r_proto=define
14070                 set d_getgrgid_r_proto getgrgid_r $hdrs
14071                 eval $hasproto ;;
14072         *)      ;;
14073         esac
14074         case "$d_getgrgid_r_proto" in
14075         define)
14076         case "$getgrgid_r_proto" in
14077         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14078         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14079         esac
14080         case "$getgrgid_r_proto" in
14081         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14082         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14083         esac
14084         case "$getgrgid_r_proto" in
14085         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14086         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14087         esac
14088         case "$getgrgid_r_proto" in
14089         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14090         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14091         esac
14092         case "$getgrgid_r_proto" in
14093         ''|0)   d_getgrgid_r=undef
14094                 getgrgid_r_proto=0
14095                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14096         * )     case "$getgrgid_r_proto" in
14097                 REENTRANT_PROTO*) ;;
14098                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14099                 esac
14100                 echo "Prototype: $try" ;;
14101         esac
14102         ;;
14103         *)      case "$usethreads" in
14104                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14105                 esac
14106                 d_getgrgid_r=undef
14107                 getgrgid_r_proto=0
14108                 ;;
14109         esac
14110         ;;
14111 *)      getgrgid_r_proto=0
14112         ;;
14113 esac
14114
14115 : see if getgrnam_r exists
14116 set getgrnam_r d_getgrnam_r
14117 eval $inlibc
14118 case "$d_getgrnam_r" in
14119 "$define")
14120         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14121         case "$d_getgrnam_r_proto:$usethreads" in
14122         ":define")      d_getgrnam_r_proto=define
14123                 set d_getgrnam_r_proto getgrnam_r $hdrs
14124                 eval $hasproto ;;
14125         *)      ;;
14126         esac
14127         case "$d_getgrnam_r_proto" in
14128         define)
14129         case "$getgrnam_r_proto" in
14130         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14131         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14132         esac
14133         case "$getgrnam_r_proto" in
14134         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14135         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14136         esac
14137         case "$getgrnam_r_proto" in
14138         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14139         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14140         esac
14141         case "$getgrnam_r_proto" in
14142         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14143         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14144         esac
14145         case "$getgrnam_r_proto" in
14146         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14147         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14148         esac
14149         case "$getgrnam_r_proto" in
14150         ''|0)   d_getgrnam_r=undef
14151                 getgrnam_r_proto=0
14152                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14153         * )     case "$getgrnam_r_proto" in
14154                 REENTRANT_PROTO*) ;;
14155                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14156                 esac
14157                 echo "Prototype: $try" ;;
14158         esac
14159         ;;
14160         *)      case "$usethreads" in
14161                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14162                 esac
14163                 d_getgrnam_r=undef
14164                 getgrnam_r_proto=0
14165                 ;;
14166         esac
14167         ;;
14168 *)      getgrnam_r_proto=0
14169         ;;
14170 esac
14171
14172 : see if gethostbyaddr exists
14173 set gethostbyaddr d_gethbyaddr
14174 eval $inlibc
14175
14176 : see if gethostbyname exists
14177 set gethostbyname d_gethbyname
14178 eval $inlibc
14179
14180 : see if gethostent exists
14181 set gethostent d_gethent
14182 eval $inlibc
14183
14184 : see how we will look up host name
14185 echo " "
14186 call=''
14187 if set gethostname val -f d_gethname; eval $csym; $val; then
14188         echo 'gethostname() found.' >&4
14189         d_gethname="$define"
14190         call=gethostname
14191 fi
14192 if set uname val -f d_uname; eval $csym; $val; then
14193         if ./xenix; then
14194                 $cat <<'EOM'
14195 uname() was found, but you're running xenix, and older versions of xenix
14196 have a broken uname(). If you don't really know whether your xenix is old
14197 enough to have a broken system call, use the default answer.
14198
14199 EOM
14200                 dflt=y
14201                 case "$d_uname" in
14202                 "$define") dflt=n;;
14203                 esac
14204                 rp='Is your uname() broken?'
14205                 . ./myread
14206                 case "$ans" in
14207                 n*) d_uname="$define"; call=uname;;
14208                 esac
14209         else
14210                 echo 'uname() found.' >&4
14211                 d_uname="$define"
14212                 case "$call" in
14213                 '') call=uname ;;
14214                 esac
14215         fi
14216 fi
14217 case "$d_gethname" in
14218 '') d_gethname="$undef";;
14219 esac
14220 case "$d_uname" in
14221 '') d_uname="$undef";;
14222 esac
14223 case "$d_uname$d_gethname" in
14224 *define*)
14225         dflt=n
14226         cat <<EOM
14227
14228 Every now and then someone has a $call() that lies about the hostname
14229 but can't be fixed for political or economic reasons.  If you wish, I can
14230 pretend $call() isn't there and maybe compute hostname at run-time
14231 thanks to the '$phostname' command.
14232
14233 EOM
14234         rp="Shall I ignore $call() from now on?"
14235         . ./myread
14236         case "$ans" in
14237         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14238         esac;;
14239 esac
14240 case "$phostname" in
14241 '') aphostname='';;
14242 *) case "$aphostname" in
14243         /*) ;;
14244         *) set X $phostname
14245                 shift
14246                 file=$1
14247                 shift
14248                 file=`./loc $file $file $pth`
14249                 aphostname=`echo $file $*`
14250                 ;;
14251         esac
14252         ;;
14253 esac
14254 case "$d_uname$d_gethname" in
14255 *define*) ;;
14256 *)
14257         case "$phostname" in
14258         '')
14259                 echo "There will be no way for $package to get your hostname." >&4;;
14260         *)
14261         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14262                 ;;
14263         esac;;
14264 esac
14265 case "$d_phostname" in
14266 '') d_phostname="$undef";;
14267 esac
14268
14269 : see if gethostbyaddr_r exists
14270 set gethostbyaddr_r d_gethostbyaddr_r
14271 eval $inlibc
14272 case "$d_gethostbyaddr_r" in
14273 "$define")
14274         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14275         case "$d_gethostbyaddr_r_proto:$usethreads" in
14276         ":define")      d_gethostbyaddr_r_proto=define
14277                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14278                 eval $hasproto ;;
14279         *)      ;;
14280         esac
14281         case "$d_gethostbyaddr_r_proto" in
14282         define)
14283         case "$gethostbyaddr_r_proto" in
14284         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14285         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14286         esac
14287         case "$gethostbyaddr_r_proto" in
14288         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14289         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14290         esac
14291         case "$gethostbyaddr_r_proto" in
14292         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14293         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14294         esac
14295         case "$gethostbyaddr_r_proto" in
14296         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14297         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14298         esac
14299         case "$gethostbyaddr_r_proto" in
14300         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14301         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14302         esac
14303         case "$gethostbyaddr_r_proto" in
14304         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14305         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14306         esac
14307         case "$gethostbyaddr_r_proto" in
14308         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14309         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14310         esac
14311         case "$gethostbyaddr_r_proto" in
14312         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14313         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14314         esac
14315         case "$gethostbyaddr_r_proto" in
14316         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14317         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14318         esac
14319         case "$gethostbyaddr_r_proto" in
14320         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14321         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14322         esac
14323         case "$gethostbyaddr_r_proto" in
14324         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14325         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14326         esac
14327         case "$gethostbyaddr_r_proto" in
14328         ''|0)   d_gethostbyaddr_r=undef
14329                 gethostbyaddr_r_proto=0
14330                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14331         * )     case "$gethostbyaddr_r_proto" in
14332                 REENTRANT_PROTO*) ;;
14333                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14334                 esac
14335                 echo "Prototype: $try" ;;
14336         esac
14337         ;;
14338         *)      case "$usethreads" in
14339                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14340                 esac
14341                 d_gethostbyaddr_r=undef
14342                 gethostbyaddr_r_proto=0
14343                 ;;
14344         esac
14345         ;;
14346 *)      gethostbyaddr_r_proto=0
14347         ;;
14348 esac
14349
14350 : see if gethostbyname_r exists
14351 set gethostbyname_r d_gethostbyname_r
14352 eval $inlibc
14353 case "$d_gethostbyname_r" in
14354 "$define")
14355         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14356         case "$d_gethostbyname_r_proto:$usethreads" in
14357         ":define")      d_gethostbyname_r_proto=define
14358                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14359                 eval $hasproto ;;
14360         *)      ;;
14361         esac
14362         case "$d_gethostbyname_r_proto" in
14363         define)
14364         case "$gethostbyname_r_proto" in
14365         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14366         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14367         esac
14368         case "$gethostbyname_r_proto" in
14369         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14370         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14371         esac
14372         case "$gethostbyname_r_proto" in
14373         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14374         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14375         esac
14376         case "$gethostbyname_r_proto" in
14377         ''|0)   d_gethostbyname_r=undef
14378                 gethostbyname_r_proto=0
14379                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14380         * )     case "$gethostbyname_r_proto" in
14381                 REENTRANT_PROTO*) ;;
14382                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14383                 esac
14384                 echo "Prototype: $try" ;;
14385         esac
14386         ;;
14387         *)      case "$usethreads" in
14388                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14389                 esac
14390                 d_gethostbyname_r=undef
14391                 gethostbyname_r_proto=0
14392                 ;;
14393         esac
14394         ;;
14395 *)      gethostbyname_r_proto=0
14396         ;;
14397 esac
14398
14399 : see if gethostent_r exists
14400 set gethostent_r d_gethostent_r
14401 eval $inlibc
14402 case "$d_gethostent_r" in
14403 "$define")
14404         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14405         case "$d_gethostent_r_proto:$usethreads" in
14406         ":define")      d_gethostent_r_proto=define
14407                 set d_gethostent_r_proto gethostent_r $hdrs
14408                 eval $hasproto ;;
14409         *)      ;;
14410         esac
14411         case "$d_gethostent_r_proto" in
14412         define)
14413         case "$gethostent_r_proto" in
14414         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14415         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14416         esac
14417         case "$gethostent_r_proto" in
14418         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14419         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14420         esac
14421         case "$gethostent_r_proto" in
14422         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14423         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14424         esac
14425         case "$gethostent_r_proto" in
14426         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14427         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14428         esac
14429         case "$gethostent_r_proto" in
14430         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14431         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14432         esac
14433         case "$gethostent_r_proto" in
14434         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14435         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14436         esac
14437         case "$gethostent_r_proto" in
14438         ''|0)   d_gethostent_r=undef
14439                 gethostent_r_proto=0
14440                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14441         * )     case "$gethostent_r_proto" in
14442                 REENTRANT_PROTO*) ;;
14443                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14444                 esac
14445                 echo "Prototype: $try" ;;
14446         esac
14447         ;;
14448         *)      case "$usethreads" in
14449                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14450                 esac
14451                 d_gethostent_r=undef
14452                 gethostent_r_proto=0
14453                 ;;
14454         esac
14455         ;;
14456 *)      gethostent_r_proto=0
14457         ;;
14458 esac
14459
14460 : see if prototypes for various gethostxxx netdb.h functions are available
14461 echo " "
14462 set d_gethostprotos gethostent $i_netdb netdb.h
14463 eval $hasproto
14464
14465 : see if getitimer exists
14466 set getitimer d_getitimer
14467 eval $inlibc
14468
14469 : see if getlogin exists
14470 set getlogin d_getlogin
14471 eval $inlibc
14472
14473 : see if getlogin_r exists
14474 set getlogin_r d_getlogin_r
14475 eval $inlibc
14476 case "$d_getlogin_r" in
14477 "$define")
14478         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14479         case "$d_getlogin_r_proto:$usethreads" in
14480         ":define")      d_getlogin_r_proto=define
14481                 set d_getlogin_r_proto getlogin_r $hdrs
14482                 eval $hasproto ;;
14483         *)      ;;
14484         esac
14485         case "$d_getlogin_r_proto" in
14486         define)
14487         case "$getlogin_r_proto" in
14488         ''|0) try='int getlogin_r(char*, size_t);'
14489         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14490         esac
14491         case "$getlogin_r_proto" in
14492         ''|0) try='int getlogin_r(char*, int);'
14493         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14494         esac
14495         case "$getlogin_r_proto" in
14496         ''|0) try='char* getlogin_r(char*, size_t);'
14497         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14498         esac
14499         case "$getlogin_r_proto" in
14500         ''|0) try='char* getlogin_r(char*, int);'
14501         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14502         esac
14503         case "$getlogin_r_proto" in
14504         ''|0)   d_getlogin_r=undef
14505                 getlogin_r_proto=0
14506                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14507         * )     case "$getlogin_r_proto" in
14508                 REENTRANT_PROTO*) ;;
14509                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14510                 esac
14511                 echo "Prototype: $try" ;;
14512         esac
14513         ;;
14514         *)      case "$usethreads" in
14515                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14516                 esac
14517                 d_getlogin_r=undef
14518                 getlogin_r_proto=0
14519                 ;;
14520         esac
14521         ;;
14522 *)      getlogin_r_proto=0
14523         ;;
14524 esac
14525
14526 : see if getmnt exists
14527 set getmnt d_getmnt
14528 eval $inlibc
14529
14530 : see if getmntent exists
14531 set getmntent d_getmntent
14532 eval $inlibc
14533
14534 : see if getnameinfo exists
14535 set getnameinfo d_getnameinfo
14536 eval $inlibc
14537
14538 : see if getnetbyaddr exists
14539 set getnetbyaddr d_getnbyaddr
14540 eval $inlibc
14541
14542 : see if getnetbyname exists
14543 set getnetbyname d_getnbyname
14544 eval $inlibc
14545
14546 : see if getnetent exists
14547 set getnetent d_getnent
14548 eval $inlibc
14549
14550 : see if getnetbyaddr_r exists
14551 set getnetbyaddr_r d_getnetbyaddr_r
14552 eval $inlibc
14553 case "$d_getnetbyaddr_r" in
14554 "$define")
14555         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14556         case "$d_getnetbyaddr_r_proto:$usethreads" in
14557         ":define")      d_getnetbyaddr_r_proto=define
14558                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14559                 eval $hasproto ;;
14560         *)      ;;
14561         esac
14562         case "$d_getnetbyaddr_r_proto" in
14563         define)
14564         case "$getnetbyaddr_r_proto" in
14565         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14566         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14567         esac
14568         case "$getnetbyaddr_r_proto" in
14569         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14570         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14571         esac
14572         case "$getnetbyaddr_r_proto" in
14573         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14574         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14575         esac
14576         case "$getnetbyaddr_r_proto" in
14577         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14578         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14579         esac
14580         case "$getnetbyaddr_r_proto" in
14581         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14582         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14583         esac
14584         case "$getnetbyaddr_r_proto" in
14585         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14586         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14587         esac
14588         case "$getnetbyaddr_r_proto" in
14589         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14590         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14591         esac
14592         case "$getnetbyaddr_r_proto" in
14593         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14594         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14595         esac
14596         case "$getnetbyaddr_r_proto" in
14597         ''|0)   d_getnetbyaddr_r=undef
14598                 getnetbyaddr_r_proto=0
14599                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14600         * )     case "$getnetbyaddr_r_proto" in
14601                 REENTRANT_PROTO*) ;;
14602                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14603                 esac
14604                 echo "Prototype: $try" ;;
14605         esac
14606         ;;
14607         *)      case "$usethreads" in
14608                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14609                 esac
14610                 d_getnetbyaddr_r=undef
14611                 getnetbyaddr_r_proto=0
14612                 ;;
14613         esac
14614         ;;
14615 *)      getnetbyaddr_r_proto=0
14616         ;;
14617 esac
14618
14619 : see if getnetbyname_r exists
14620 set getnetbyname_r d_getnetbyname_r
14621 eval $inlibc
14622 case "$d_getnetbyname_r" in
14623 "$define")
14624         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14625         case "$d_getnetbyname_r_proto:$usethreads" in
14626         ":define")      d_getnetbyname_r_proto=define
14627                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14628                 eval $hasproto ;;
14629         *)      ;;
14630         esac
14631         case "$d_getnetbyname_r_proto" in
14632         define)
14633         case "$getnetbyname_r_proto" in
14634         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14635         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14636         esac
14637         case "$getnetbyname_r_proto" in
14638         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14639         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14640         esac
14641         case "$getnetbyname_r_proto" in
14642         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14643         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14644         esac
14645         case "$getnetbyname_r_proto" in
14646         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14647         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14648         esac
14649         case "$getnetbyname_r_proto" in
14650         ''|0)   d_getnetbyname_r=undef
14651                 getnetbyname_r_proto=0
14652                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14653         * )     case "$getnetbyname_r_proto" in
14654                 REENTRANT_PROTO*) ;;
14655                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14656                 esac
14657                 echo "Prototype: $try" ;;
14658         esac
14659         ;;
14660         *)      case "$usethreads" in
14661                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14662                 esac
14663                 d_getnetbyname_r=undef
14664                 getnetbyname_r_proto=0
14665                 ;;
14666         esac
14667         ;;
14668 *)      getnetbyname_r_proto=0
14669         ;;
14670 esac
14671
14672 : see if getnetent_r exists
14673 set getnetent_r d_getnetent_r
14674 eval $inlibc
14675 case "$d_getnetent_r" in
14676 "$define")
14677         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14678         case "$d_getnetent_r_proto:$usethreads" in
14679         ":define")      d_getnetent_r_proto=define
14680                 set d_getnetent_r_proto getnetent_r $hdrs
14681                 eval $hasproto ;;
14682         *)      ;;
14683         esac
14684         case "$d_getnetent_r_proto" in
14685         define)
14686         case "$getnetent_r_proto" in
14687         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14688         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14689         esac
14690         case "$getnetent_r_proto" in
14691         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14692         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14693         esac
14694         case "$getnetent_r_proto" in
14695         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14696         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14697         esac
14698         case "$getnetent_r_proto" in
14699         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14700         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14701         esac
14702         case "$getnetent_r_proto" in
14703         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14704         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14705         esac
14706         case "$getnetent_r_proto" in
14707         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14708         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14709         esac
14710         case "$getnetent_r_proto" in
14711         ''|0)   d_getnetent_r=undef
14712                 getnetent_r_proto=0
14713                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14714         * )     case "$getnetent_r_proto" in
14715                 REENTRANT_PROTO*) ;;
14716                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14717                 esac
14718                 echo "Prototype: $try" ;;
14719         esac
14720         ;;
14721         *)      case "$usethreads" in
14722                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14723                 esac
14724                 d_getnetent_r=undef
14725                 getnetent_r_proto=0
14726                 ;;
14727         esac
14728         ;;
14729 *)      getnetent_r_proto=0
14730         ;;
14731 esac
14732
14733 : see if prototypes for various getnetxxx netdb.h functions are available
14734 echo " "
14735 set d_getnetprotos getnetent $i_netdb netdb.h
14736 eval $hasproto
14737
14738 : see if getpagesize exists
14739 set getpagesize d_getpagsz
14740 eval $inlibc
14741
14742 : Optional checks for getprotobyname and getprotobynumber
14743
14744 : see if getprotobyname exists
14745 set getprotobyname d_getpbyname
14746 eval $inlibc
14747
14748 : see if getprotobynumber exists
14749 set getprotobynumber d_getpbynumber
14750 eval $inlibc
14751
14752 : see if getprotoent exists
14753 set getprotoent d_getpent
14754 eval $inlibc
14755
14756 : see if getpgid exists
14757 set getpgid d_getpgid
14758 eval $inlibc
14759
14760 : see if getpgrp2 exists
14761 set getpgrp2 d_getpgrp2
14762 eval $inlibc
14763
14764 : see if getppid exists
14765 set getppid d_getppid
14766 eval $inlibc
14767
14768 : see if getpriority exists
14769 set getpriority d_getprior
14770 eval $inlibc
14771
14772 : see if getprotobyname_r exists
14773 set getprotobyname_r d_getprotobyname_r
14774 eval $inlibc
14775 case "$d_getprotobyname_r" in
14776 "$define")
14777         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14778         case "$d_getprotobyname_r_proto:$usethreads" in
14779         ":define")      d_getprotobyname_r_proto=define
14780                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14781                 eval $hasproto ;;
14782         *)      ;;
14783         esac
14784         case "$d_getprotobyname_r_proto" in
14785         define)
14786         case "$getprotobyname_r_proto" in
14787         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14788         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14789         esac
14790         case "$getprotobyname_r_proto" in
14791         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14792         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14793         esac
14794         case "$getprotobyname_r_proto" in
14795         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14796         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14797         esac
14798         case "$getprotobyname_r_proto" in
14799         ''|0)   d_getprotobyname_r=undef
14800                 getprotobyname_r_proto=0
14801                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14802         * )     case "$getprotobyname_r_proto" in
14803                 REENTRANT_PROTO*) ;;
14804                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14805                 esac
14806                 echo "Prototype: $try" ;;
14807         esac
14808         ;;
14809         *)      case "$usethreads" in
14810                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14811                 esac
14812                 d_getprotobyname_r=undef
14813                 getprotobyname_r_proto=0
14814                 ;;
14815         esac
14816         ;;
14817 *)      getprotobyname_r_proto=0
14818         ;;
14819 esac
14820
14821 : see if getprotobynumber_r exists
14822 set getprotobynumber_r d_getprotobynumber_r
14823 eval $inlibc
14824 case "$d_getprotobynumber_r" in
14825 "$define")
14826         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14827         case "$d_getprotobynumber_r_proto:$usethreads" in
14828         ":define")      d_getprotobynumber_r_proto=define
14829                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14830                 eval $hasproto ;;
14831         *)      ;;
14832         esac
14833         case "$d_getprotobynumber_r_proto" in
14834         define)
14835         case "$getprotobynumber_r_proto" in
14836         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14837         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14838         esac
14839         case "$getprotobynumber_r_proto" in
14840         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14841         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14842         esac
14843         case "$getprotobynumber_r_proto" in
14844         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14845         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14846         esac
14847         case "$getprotobynumber_r_proto" in
14848         ''|0)   d_getprotobynumber_r=undef
14849                 getprotobynumber_r_proto=0
14850                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14851         * )     case "$getprotobynumber_r_proto" in
14852                 REENTRANT_PROTO*) ;;
14853                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14854                 esac
14855                 echo "Prototype: $try" ;;
14856         esac
14857         ;;
14858         *)      case "$usethreads" in
14859                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14860                 esac
14861                 d_getprotobynumber_r=undef
14862                 getprotobynumber_r_proto=0
14863                 ;;
14864         esac
14865         ;;
14866 *)      getprotobynumber_r_proto=0
14867         ;;
14868 esac
14869
14870 : see if getprotoent_r exists
14871 set getprotoent_r d_getprotoent_r
14872 eval $inlibc
14873 case "$d_getprotoent_r" in
14874 "$define")
14875         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14876         case "$d_getprotoent_r_proto:$usethreads" in
14877         ":define")      d_getprotoent_r_proto=define
14878                 set d_getprotoent_r_proto getprotoent_r $hdrs
14879                 eval $hasproto ;;
14880         *)      ;;
14881         esac
14882         case "$d_getprotoent_r_proto" in
14883         define)
14884         case "$getprotoent_r_proto" in
14885         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14886         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14887         esac
14888         case "$getprotoent_r_proto" in
14889         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14890         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14891         esac
14892         case "$getprotoent_r_proto" in
14893         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14894         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14895         esac
14896         case "$getprotoent_r_proto" in
14897         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14898         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14899         esac
14900         case "$getprotoent_r_proto" in
14901         ''|0)   d_getprotoent_r=undef
14902                 getprotoent_r_proto=0
14903                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14904         * )     case "$getprotoent_r_proto" in
14905                 REENTRANT_PROTO*) ;;
14906                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14907                 esac
14908                 echo "Prototype: $try" ;;
14909         esac
14910         ;;
14911         *)      case "$usethreads" in
14912                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14913                 esac
14914                 d_getprotoent_r=undef
14915                 getprotoent_r_proto=0
14916                 ;;
14917         esac
14918         ;;
14919 *)      getprotoent_r_proto=0
14920         ;;
14921 esac
14922
14923 : see if prototypes for various getprotoxxx netdb.h functions are available
14924 echo " "
14925 set d_getprotoprotos getprotoent $i_netdb netdb.h
14926 eval $hasproto
14927
14928 : see if getprpwnam exists
14929 set getprpwnam d_getprpwnam
14930 eval $inlibc
14931
14932 : see if getpwent exists
14933 set getpwent d_getpwent
14934 eval $inlibc
14935
14936 : see if getpwent_r exists
14937 set getpwent_r d_getpwent_r
14938 eval $inlibc
14939 case "$d_getpwent_r" in
14940 "$define")
14941         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14942         case "$d_getpwent_r_proto:$usethreads" in
14943         ":define")      d_getpwent_r_proto=define
14944                 set d_getpwent_r_proto getpwent_r $hdrs
14945                 eval $hasproto ;;
14946         *)      ;;
14947         esac
14948         case "$d_getpwent_r_proto" in
14949         define)
14950         case "$getpwent_r_proto" in
14951         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14952         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14953         esac
14954         case "$getpwent_r_proto" in
14955         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14956         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14957         esac
14958         case "$getpwent_r_proto" in
14959         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14960         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14961         esac
14962         case "$getpwent_r_proto" in
14963         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14964         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14965         esac
14966         case "$getpwent_r_proto" in
14967         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14968         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14969         esac
14970         case "$getpwent_r_proto" in
14971         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14972         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14973         esac
14974         case "$getpwent_r_proto" in
14975         ''|0)   d_getpwent_r=undef
14976                 getpwent_r_proto=0
14977                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14978         * )     case "$getpwent_r_proto" in
14979                 REENTRANT_PROTO*) ;;
14980                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14981                 esac
14982                 echo "Prototype: $try" ;;
14983         esac
14984         ;;
14985         *)      case "$usethreads" in
14986                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14987                 esac
14988                 d_getpwent_r=undef
14989                 getpwent_r_proto=0
14990                 ;;
14991         esac
14992         ;;
14993 *)      getpwent_r_proto=0
14994         ;;
14995 esac
14996
14997 : see if getpwnam_r exists
14998 set getpwnam_r d_getpwnam_r
14999 eval $inlibc
15000 case "$d_getpwnam_r" in
15001 "$define")
15002         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15003         case "$d_getpwnam_r_proto:$usethreads" in
15004         ":define")      d_getpwnam_r_proto=define
15005                 set d_getpwnam_r_proto getpwnam_r $hdrs
15006                 eval $hasproto ;;
15007         *)      ;;
15008         esac
15009         case "$d_getpwnam_r_proto" in
15010         define)
15011         case "$getpwnam_r_proto" in
15012         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15013         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15014         esac
15015         case "$getpwnam_r_proto" in
15016         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15017         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15018         esac
15019         case "$getpwnam_r_proto" in
15020         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15021         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15022         esac
15023         case "$getpwnam_r_proto" in
15024         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15025         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15026         esac
15027         case "$getpwnam_r_proto" in
15028         ''|0)   d_getpwnam_r=undef
15029                 getpwnam_r_proto=0
15030                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15031         * )     case "$getpwnam_r_proto" in
15032                 REENTRANT_PROTO*) ;;
15033                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15034                 esac
15035                 echo "Prototype: $try" ;;
15036         esac
15037         ;;
15038         *)      case "$usethreads" in
15039                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15040                 esac
15041                 d_getpwnam_r=undef
15042                 getpwnam_r_proto=0
15043                 ;;
15044         esac
15045         ;;
15046 *)      getpwnam_r_proto=0
15047         ;;
15048 esac
15049
15050 : see if getpwuid_r exists
15051 set getpwuid_r d_getpwuid_r
15052 eval $inlibc
15053 case "$d_getpwuid_r" in
15054 "$define")
15055         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15056         case "$d_getpwuid_r_proto:$usethreads" in
15057         ":define")      d_getpwuid_r_proto=define
15058                 set d_getpwuid_r_proto getpwuid_r $hdrs
15059                 eval $hasproto ;;
15060         *)      ;;
15061         esac
15062         case "$d_getpwuid_r_proto" in
15063         define)
15064         case "$getpwuid_r_proto" in
15065         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15066         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15067         esac
15068         case "$getpwuid_r_proto" in
15069         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15070         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15071         esac
15072         case "$getpwuid_r_proto" in
15073         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15074         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15075         esac
15076         case "$getpwuid_r_proto" in
15077         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15078         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15079         esac
15080         case "$getpwuid_r_proto" in
15081         ''|0)   d_getpwuid_r=undef
15082                 getpwuid_r_proto=0
15083                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15084         * )     case "$getpwuid_r_proto" in
15085                 REENTRANT_PROTO*) ;;
15086                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15087                 esac
15088                 echo "Prototype: $try" ;;
15089         esac
15090         ;;
15091         *)      case "$usethreads" in
15092                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15093                 esac
15094                 d_getpwuid_r=undef
15095                 getpwuid_r_proto=0
15096                 ;;
15097         esac
15098         ;;
15099 *)      getpwuid_r_proto=0
15100         ;;
15101 esac
15102
15103 : Optional checks for getsbyname and getsbyport
15104
15105 : see if getservbyname exists
15106 set getservbyname d_getsbyname
15107 eval $inlibc
15108
15109 : see if getservbyport exists
15110 set getservbyport d_getsbyport
15111 eval $inlibc
15112
15113 : see if getservent exists
15114 set getservent d_getsent
15115 eval $inlibc
15116
15117 : see if getservbyname_r exists
15118 set getservbyname_r d_getservbyname_r
15119 eval $inlibc
15120 case "$d_getservbyname_r" in
15121 "$define")
15122         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15123         case "$d_getservbyname_r_proto:$usethreads" in
15124         ":define")      d_getservbyname_r_proto=define
15125                 set d_getservbyname_r_proto getservbyname_r $hdrs
15126                 eval $hasproto ;;
15127         *)      ;;
15128         esac
15129         case "$d_getservbyname_r_proto" in
15130         define)
15131         case "$getservbyname_r_proto" in
15132         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15133         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15134         esac
15135         case "$getservbyname_r_proto" in
15136         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15137         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15138         esac
15139         case "$getservbyname_r_proto" in
15140         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15141         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15142         esac
15143         case "$getservbyname_r_proto" in
15144         ''|0)   d_getservbyname_r=undef
15145                 getservbyname_r_proto=0
15146                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15147         * )     case "$getservbyname_r_proto" in
15148                 REENTRANT_PROTO*) ;;
15149                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15150                 esac
15151                 echo "Prototype: $try" ;;
15152         esac
15153         ;;
15154         *)      case "$usethreads" in
15155                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15156                 esac
15157                 d_getservbyname_r=undef
15158                 getservbyname_r_proto=0
15159                 ;;
15160         esac
15161         ;;
15162 *)      getservbyname_r_proto=0
15163         ;;
15164 esac
15165
15166 : see if getservbyport_r exists
15167 set getservbyport_r d_getservbyport_r
15168 eval $inlibc
15169 case "$d_getservbyport_r" in
15170 "$define")
15171         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15172         case "$d_getservbyport_r_proto:$usethreads" in
15173         ":define")      d_getservbyport_r_proto=define
15174                 set d_getservbyport_r_proto getservbyport_r $hdrs
15175                 eval $hasproto ;;
15176         *)      ;;
15177         esac
15178         case "$d_getservbyport_r_proto" in
15179         define)
15180         case "$getservbyport_r_proto" in
15181         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15182         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15183         esac
15184         case "$getservbyport_r_proto" in
15185         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15186         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15187         esac
15188         case "$getservbyport_r_proto" in
15189         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15190         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15191         esac
15192         case "$getservbyport_r_proto" in
15193         ''|0)   d_getservbyport_r=undef
15194                 getservbyport_r_proto=0
15195                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15196         * )     case "$getservbyport_r_proto" in
15197                 REENTRANT_PROTO*) ;;
15198                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15199                 esac
15200                 echo "Prototype: $try" ;;
15201         esac
15202         ;;
15203         *)      case "$usethreads" in
15204                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15205                 esac
15206                 d_getservbyport_r=undef
15207                 getservbyport_r_proto=0
15208                 ;;
15209         esac
15210         ;;
15211 *)      getservbyport_r_proto=0
15212         ;;
15213 esac
15214
15215 : see if getservent_r exists
15216 set getservent_r d_getservent_r
15217 eval $inlibc
15218 case "$d_getservent_r" in
15219 "$define")
15220         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15221         case "$d_getservent_r_proto:$usethreads" in
15222         ":define")      d_getservent_r_proto=define
15223                 set d_getservent_r_proto getservent_r $hdrs
15224                 eval $hasproto ;;
15225         *)      ;;
15226         esac
15227         case "$d_getservent_r_proto" in
15228         define)
15229         case "$getservent_r_proto" in
15230         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15231         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15232         esac
15233         case "$getservent_r_proto" in
15234         ''|0) try='int getservent_r(struct servent*, char*, int);'
15235         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15236         esac
15237         case "$getservent_r_proto" in
15238         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15239         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15240         esac
15241         case "$getservent_r_proto" in
15242         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15243         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15244         esac
15245         case "$getservent_r_proto" in
15246         ''|0)   d_getservent_r=undef
15247                 getservent_r_proto=0
15248                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15249         * )     case "$getservent_r_proto" in
15250                 REENTRANT_PROTO*) ;;
15251                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15252                 esac
15253                 echo "Prototype: $try" ;;
15254         esac
15255         ;;
15256         *)      case "$usethreads" in
15257                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15258                 esac
15259                 d_getservent_r=undef
15260                 getservent_r_proto=0
15261                 ;;
15262         esac
15263         ;;
15264 *)      getservent_r_proto=0
15265         ;;
15266 esac
15267
15268 : see if prototypes for various getservxxx netdb.h functions are available
15269 echo " "
15270 set d_getservprotos getservent $i_netdb netdb.h
15271 eval $hasproto
15272
15273 : see if getspnam exists
15274 set getspnam d_getspnam
15275 eval $inlibc
15276
15277 : see if this is a shadow.h system
15278 set shadow.h i_shadow
15279 eval $inhdr
15280
15281 : see if getspnam_r exists
15282 set getspnam_r d_getspnam_r
15283 eval $inlibc
15284 case "$d_getspnam_r" in
15285 "$define")
15286         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15287         case "$d_getspnam_r_proto:$usethreads" in
15288         ":define")      d_getspnam_r_proto=define
15289                 set d_getspnam_r_proto getspnam_r $hdrs
15290                 eval $hasproto ;;
15291         *)      ;;
15292         esac
15293         case "$d_getspnam_r_proto" in
15294         define)
15295         case "$getspnam_r_proto" in
15296         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15297         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15298         esac
15299         case "$getspnam_r_proto" in
15300         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15301         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15302         esac
15303         case "$getspnam_r_proto" in
15304         ''|0)   d_getspnam_r=undef
15305                 getspnam_r_proto=0
15306                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15307         * )     case "$getspnam_r_proto" in
15308                 REENTRANT_PROTO*) ;;
15309                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15310                 esac
15311                 echo "Prototype: $try" ;;
15312         esac
15313         ;;
15314         *)      case "$usethreads" in
15315                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15316                 esac
15317                 d_getspnam_r=undef
15318                 getspnam_r_proto=0
15319                 ;;
15320         esac
15321         ;;
15322 *)      getspnam_r_proto=0
15323         ;;
15324 esac
15325
15326 : see if gettimeofday or ftime exists
15327 set gettimeofday d_gettimeod
15328 eval $inlibc
15329 case "$d_gettimeod" in
15330 "$undef")
15331         set ftime d_ftime 
15332         eval $inlibc
15333         ;;
15334 *)
15335         val="$undef"; set d_ftime; eval $setvar
15336         ;;
15337 esac
15338 case "$d_gettimeod$d_ftime" in
15339 "$undef$undef")
15340         echo " "
15341         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15342         ;;
15343 esac
15344
15345 : see if gmtime_r exists
15346 set gmtime_r d_gmtime_r
15347 eval $inlibc
15348 case "$d_gmtime_r" in
15349 "$define")
15350         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15351         case "$d_gmtime_r_proto:$usethreads" in
15352         ":define")      d_gmtime_r_proto=define
15353                 set d_gmtime_r_proto gmtime_r $hdrs
15354                 eval $hasproto ;;
15355         *)      ;;
15356         esac
15357         case "$d_gmtime_r_proto" in
15358         define)
15359         case "$gmtime_r_proto" in
15360         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15361         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15362         esac
15363         case "$gmtime_r_proto" in
15364         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15365         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15366         esac
15367         case "$gmtime_r_proto" in
15368         ''|0)   d_gmtime_r=undef
15369                 gmtime_r_proto=0
15370                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15371         * )     case "$gmtime_r_proto" in
15372                 REENTRANT_PROTO*) ;;
15373                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15374                 esac
15375                 echo "Prototype: $try" ;;
15376         esac
15377         ;;
15378         *)      case "$usethreads" in
15379                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15380                 esac
15381                 d_gmtime_r=undef
15382                 gmtime_r_proto=0
15383                 ;;
15384         esac
15385         ;;
15386 *)      gmtime_r_proto=0
15387         ;;
15388 esac
15389
15390 : see if hasmntopt exists
15391 set hasmntopt d_hasmntopt
15392 eval $inlibc
15393
15394 : see if this is a netinet/in.h or sys/in.h system
15395 set netinet/in.h i_niin sys/in.h i_sysin
15396 eval $inhdr
15397
15398 : see if arpa/inet.h has to be included
15399 set arpa/inet.h i_arpainet
15400 eval $inhdr
15401
15402 : see if htonl --and friends-- exists
15403 val=''
15404 set htonl val
15405 eval $inlibc
15406
15407 : Maybe they are macros.
15408 case "$val" in
15409 $undef)
15410         $cat >htonl.c <<EOM
15411 #include <stdio.h>
15412 #include <sys/types.h>
15413 #$i_niin I_NETINET_IN
15414 #$i_sysin I_SYS_IN
15415 #$i_arpainet I_ARPA_INET
15416 #ifdef I_NETINET_IN
15417 #include <netinet/in.h>
15418 #endif
15419 #ifdef I_SYS_IN
15420 #include <sys/in.h>
15421 #endif
15422 #ifdef I_ARPA_INET
15423 #include <arpa/inet.h>
15424 #endif
15425 #ifdef htonl
15426 printf("Defined as a macro.");
15427 #endif
15428 EOM
15429         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15430         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15431                 val="$define"
15432                 echo "But it seems to be defined as a macro." >&4
15433         fi
15434         $rm -f htonl.?
15435         ;;
15436 esac
15437 set d_htonl
15438 eval $setvar
15439
15440 : see if ilogbl exists
15441 set ilogbl d_ilogbl
15442 eval $inlibc
15443
15444 : index or strchr
15445 echo " "
15446 if set index val -f; eval $csym; $val; then
15447         if set strchr val -f d_strchr; eval $csym; $val; then
15448                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15449                         val="$define"
15450                         vali="$undef"
15451                         echo "strchr() found." >&4
15452                 else
15453                         val="$undef"
15454                         vali="$define"
15455                         echo "index() found." >&4
15456                 fi
15457         else
15458                 val="$undef"
15459                 vali="$define"
15460                 echo "index() found." >&4
15461         fi
15462 else
15463         if set strchr val -f d_strchr; eval $csym; $val; then
15464                 val="$define"
15465                 vali="$undef"
15466                 echo "strchr() found." >&4
15467         else
15468                 echo "No index() or strchr() found!" >&4
15469                 val="$undef"
15470                 vali="$undef"
15471         fi
15472 fi
15473 set d_strchr; eval $setvar
15474 val="$vali"
15475 set d_index; eval $setvar
15476
15477 : check whether inet_aton exists
15478 set inet_aton d_inetaton
15479 eval $inlibc
15480
15481 : see if inet_ntop exists
15482 set inet_ntop d_inetntop
15483 eval $inlibc
15484
15485 : see if inet_pton exists
15486 set inet_pton d_inetpton
15487 eval $inlibc
15488
15489 : Look for isascii
15490 echo " "
15491 $cat >isascii.c <<EOCP
15492 #include <stdio.h>
15493 #include <ctype.h>
15494 #$i_stdlib I_STDLIB
15495 #ifdef I_STDLIB
15496 #include <stdlib.h>
15497 #endif
15498 int main() {
15499         int c = 'A';
15500         if (isascii(c))
15501                 exit(0);
15502         else
15503                 exit(1);
15504 }
15505 EOCP
15506 set isascii
15507 if eval $compile; then
15508         echo "isascii() found." >&4
15509         val="$define"
15510 else
15511         echo "isascii() NOT found." >&4
15512         val="$undef"
15513 fi
15514 set d_isascii
15515 eval $setvar
15516 $rm -f isascii*
15517
15518 : Look for isblank
15519 echo " "
15520 $cat >isblank.c <<'EOCP'
15521 #include <stdio.h>
15522 #include <ctype.h>
15523 int main() {
15524         int c = ' ';
15525         if (isblank(c))
15526                 return 0 ;
15527         else
15528                 return 1 ;
15529 }
15530 EOCP
15531 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15532         echo "isblank() found." >&4
15533         val="$define"
15534 else
15535         echo "isblank() NOT found." >&4
15536         val="$undef"
15537 fi
15538 set d_isblank
15539 eval $setvar
15540 $rm -f isblank*
15541
15542 : check for isfinite
15543 echo "Checking to see if you have isfinite..." >&4
15544 $cat >try.c <<EOCP
15545 #$i_math I_MATH
15546 #ifdef I_MATH
15547 #include <math.h>
15548 #endif
15549 int main() { return isfinite(0.0); }
15550 EOCP
15551 set try
15552 if eval $compile; then
15553         val="$define"
15554         echo "You have isfinite."
15555 else
15556         val="$undef"
15557         echo "You do not have isfinite."
15558 fi
15559 $rm_try
15560 set d_isfinite
15561 eval $setvar
15562
15563 : see if isfinitel exists
15564 set isfinitel d_isfinitel
15565 eval $inlibc
15566
15567 : check for isinf
15568 echo "Checking to see if you have isinf..." >&4
15569 $cat >try.c <<EOCP
15570 #$i_math I_MATH
15571 #ifdef I_MATH
15572 #include <math.h>
15573 #endif
15574 int main() { return isinf(0.0); }
15575 EOCP
15576 set try
15577 if eval $compile; then
15578         val="$define"
15579         echo "You have isinf."
15580 else
15581         val="$undef"
15582         echo "You do not have isinf."
15583 fi
15584 $rm_try
15585 set d_isinf
15586 eval $setvar
15587
15588 : see if isinfl exists
15589 set isinfl d_isinfl
15590 eval $inlibc
15591
15592 : check for isnan
15593 echo "Checking to see if you have isnan..." >&4
15594 $cat >try.c <<EOCP
15595 #$i_math I_MATH
15596 #ifdef I_MATH
15597 #include <math.h>
15598 #endif
15599 int main() { return isnan(0.0); }
15600 EOCP
15601 set try
15602 if eval $compile; then
15603         val="$define"
15604         echo "You have isnan."
15605 else
15606         val="$undef"
15607         echo "You do not have isnan."
15608 fi
15609 $rm_try
15610 set d_isnan
15611 eval $setvar
15612
15613 : see if isnanl exists
15614 set isnanl d_isnanl
15615 eval $inlibc
15616
15617 : see if j0 exists
15618 set j0 d_j0
15619 eval $inlibc
15620
15621 : see if j0l exists
15622 set j0l d_j0l
15623 eval $inlibc
15624
15625 : see if killpg exists
15626 set killpg d_killpg
15627 eval $inlibc
15628
15629 : see if lchown exists
15630 echo " "
15631 $cat > try.c <<'EOCP'
15632 /* System header to define __stub macros and hopefully few prototypes,
15633     which can conflict with char lchown(); below.  */
15634 #include <assert.h>
15635 /* Override any gcc2 internal prototype to avoid an error.  */
15636 /* We use char because int might match the return type of a gcc2
15637    builtin and then its argument prototype would still apply.  */
15638 char lchown();
15639 int main() {
15640     /*  The GNU C library defines this for functions which it implements
15641         to always fail with ENOSYS.  Some functions are actually named
15642         something starting with __ and the normal name is an alias.  */
15643 #if defined (__stub_lchown) || defined (__stub___lchown)
15644 choke me
15645 #else
15646 lchown();
15647 #endif
15648 ; return 0; }
15649 EOCP
15650 set try
15651 if eval $compile; then
15652     $echo "lchown() found." >&4
15653     val="$define"
15654 else
15655     $echo "lchown() NOT found." >&4
15656     val="$undef"
15657 fi
15658 set d_lchown
15659 eval $setvar
15660
15661 : See if number of significant digits in a double precision number is known
15662 echo " "
15663 $cat >ldbl_dig.c <<EOM
15664 #$i_limits I_LIMITS
15665 #$i_float I_FLOAT
15666 #ifdef I_LIMITS
15667 #include <limits.h>
15668 #endif
15669 #ifdef I_FLOAT
15670 #include <float.h>
15671 #endif
15672 #ifdef LDBL_DIG
15673 printf("Contains LDBL_DIG");
15674 #endif
15675 EOM
15676 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15677 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15678         echo "LDBL_DIG found." >&4
15679         val="$define"
15680 else
15681         echo "LDBL_DIG NOT found." >&4
15682         val="$undef"
15683 fi
15684 $rm -f ldbl_dig.?
15685 set d_ldbl_dig
15686 eval $setvar
15687
15688 : check to see if math.h defines _LIB_VERSION
15689 d_libm_lib_version="$undef"
15690 case $i_math in
15691     $define)
15692         echo " "
15693         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15694         $cat >try.c <<EOCP
15695 #include <unistd.h>
15696 #include <math.h>
15697 int main (int argc, char *argv[])
15698 {
15699     printf ("%d\n", _LIB_VERSION);
15700     return (0);
15701     } /* main */
15702 EOCP
15703         set try
15704         if eval $compile; then
15705             foo=`$run ./try`
15706             echo "Yes, it does ($foo)" >&4
15707             d_libm_lib_version="$define"
15708         else
15709             echo "No, it does not (probably harmless)" >&4
15710             fi
15711         $rm_try
15712         ;;
15713
15714     esac
15715
15716 : check for fpclassify
15717 echo " "
15718 echo "Checking to see if you have fpclassify..." >&4
15719 $cat >try.c <<EOCP
15720 #$i_math I_MATH
15721 #ifdef I_MATH
15722 #include <math.h>
15723 #endif
15724 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
15725 EOCP
15726 set try
15727 if eval $compile; then
15728         val="$define"
15729         echo "You have fpclassify."
15730 else
15731         val="$undef"
15732         echo "You do not have fpclassify."
15733 fi
15734 $rm_try
15735 set d_fpclassify
15736 eval $setvar
15737
15738 : check for isfinite
15739 echo " "
15740 echo "Checking to see if you have isfinite..." >&4
15741 $cat >try.c <<EOCP
15742 #$i_math I_MATH
15743 #ifdef I_MATH
15744 #include <math.h>
15745 #endif
15746 int main() { return isfinite(0.0); }
15747 EOCP
15748 set try
15749 if eval $compile; then
15750         val="$define"
15751         echo "You have isfinite."
15752 else
15753         val="$undef"
15754         echo "You do not have isfinite."
15755 fi
15756 $rm_try
15757 set d_isfinite
15758 eval $setvar
15759
15760 : check for isinf
15761 echo " "
15762 echo "Checking to see if you have isinf..." >&4
15763 $cat >try.c <<EOCP
15764 #$i_math I_MATH
15765 #ifdef I_MATH
15766 #include <math.h>
15767 #endif
15768 int main() { return isinf(0.0); }
15769 EOCP
15770 set try
15771 if eval $compile; then
15772         val="$define"
15773         echo "You have isinf."
15774 else
15775         val="$undef"
15776         echo "You do not have isinf."
15777 fi
15778 $rm_try
15779 set d_isinf
15780 eval $setvar
15781
15782 : check for isnan
15783 echo " "
15784 echo "Checking to see if you have isnan..." >&4
15785 $cat >try.c <<EOCP
15786 #$i_math I_MATH
15787 #ifdef I_MATH
15788 #include <math.h>
15789 #endif
15790 int main() { return isnan(0.0); }
15791 EOCP
15792 set try
15793 if eval $compile; then
15794         val="$define"
15795         echo "You have isnan."
15796 else
15797         val="$undef"
15798         echo "You do not have isnan."
15799 fi
15800 $rm_try
15801 set d_isnan
15802 eval $setvar
15803
15804 : see if this is a quadmath.h system
15805 set quadmath.h i_quadmath
15806 eval $inhdr
15807
15808 : see if link exists
15809 set link d_link
15810 eval $inlibc
15811
15812 : see if localtime_r exists
15813 set localtime_r d_localtime_r
15814 eval $inlibc
15815 case "$d_localtime_r" in
15816 "$define")
15817         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15818         case "$d_localtime_r_proto:$usethreads" in
15819         ":define")      d_localtime_r_proto=define
15820                 set d_localtime_r_proto localtime_r $hdrs
15821                 eval $hasproto ;;
15822         *)      ;;
15823         esac
15824         case "$d_localtime_r_proto" in
15825         define)
15826         case "$localtime_r_proto" in
15827         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15828         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15829         esac
15830         case "$localtime_r_proto" in
15831         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15832         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15833         esac
15834         case "$localtime_r_proto" in
15835         ''|0)   d_localtime_r=undef
15836                 localtime_r_proto=0
15837                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15838         * )     case "$localtime_r_proto" in
15839                 REENTRANT_PROTO*) ;;
15840                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15841                 esac
15842                 echo "Prototype: $try" ;;
15843         esac
15844         ;;
15845         *)      case "$usethreads" in
15846                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15847                 esac
15848                 d_localtime_r=undef
15849                 localtime_r_proto=0
15850                 ;;
15851         esac
15852         ;;
15853 *)      localtime_r_proto=0
15854         ;;
15855 esac
15856
15857 : see if localtime_r calls tzset
15858 case "$localtime_r_proto" in
15859 REENTRANT_PROTO*)
15860         $cat >try.c <<EOCP
15861 /*  Does our libc's localtime_r call tzset ?
15862  *  return 0 if so, 1 otherwise.
15863  */
15864 #$i_systypes    I_SYS_TYPES
15865 #$i_unistd      I_UNISTD
15866 #$i_time        I_TIME
15867 #$i_stdlib      I_STDLIB
15868 #$i_string      I_STRING
15869 #$i_malloc      I_MALLOC
15870 #ifdef I_SYS_TYPES
15871 #  include <sys/types.h>
15872 #endif
15873 #ifdef I_UNISTD
15874 #  include <unistd.h>
15875 #endif
15876 #ifdef I_TIME
15877 #  include <time.h>
15878 #endif
15879 #ifdef I_STDLIB
15880 #include <stdlib.h>
15881 #endif
15882 #ifdef I_STRING
15883 #  include <string.h>
15884 #else
15885 #  include <strings.h>
15886 #endif
15887 #ifdef I_MALLOC
15888 #  include <malloc.h>
15889 #endif
15890 int main()
15891 {
15892     time_t t = time(0L);
15893     char w_tz[]="TZ" "=GMT+5",
15894          e_tz[]="TZ" "=GMT-5",
15895         *tz_e = (char*)malloc(16),
15896         *tz_w = (char*)malloc(16);
15897     struct tm tm_e, tm_w;
15898     memset(&tm_e,'\0',sizeof(struct tm));
15899     memset(&tm_w,'\0',sizeof(struct tm));
15900     strcpy(tz_e,e_tz);
15901     strcpy(tz_w,w_tz);
15902
15903     putenv(tz_e);
15904     localtime_r(&t, &tm_e);
15905
15906     putenv(tz_w);
15907     localtime_r(&t, &tm_w);
15908
15909     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15910         return 1;
15911     return 0;
15912 }
15913 EOCP
15914         set try
15915         if eval $compile; then
15916             if $run ./try; then
15917                 d_localtime_r_needs_tzset=undef;
15918             else
15919                 d_localtime_r_needs_tzset=define;
15920             fi;
15921         else
15922             d_localtime_r_needs_tzset=undef;
15923         fi;
15924      ;;
15925   *)
15926      d_localtime_r_needs_tzset=undef;
15927      ;;
15928 esac
15929 $rm_try
15930
15931 : see if localeconv exists
15932 set localeconv d_locconv
15933 eval $inlibc
15934
15935 : see if libc has the POSIX.1-2008 currency locale rules
15936 case "$d_locconv:$d_lc_monetary_2008" in
15937   $define:)
15938         $cat >try.c <<EOCP
15939 #include <locale.h>
15940 int main() {
15941         struct lconv *lc = localeconv();
15942         char int_p_cs_precedes = lc->int_p_cs_precedes;
15943         return 0;
15944 }
15945 EOCP
15946         set try
15947         if eval $compile; then
15948                 d_lc_monetary_2008="$define"
15949         else
15950                 d_lc_monetary_2008="$undef"
15951         fi;
15952         $rm_try
15953         ;;
15954 esac
15955
15956 : see if lockf exists
15957 set lockf d_lockf
15958 eval $inlibc
15959
15960 : see if prototype for lseek is available
15961 echo " "
15962 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15963 eval $hasproto
15964
15965 : see if lstat exists
15966 set lstat d_lstat
15967 eval $inlibc
15968
15969 : see if madvise exists
15970 set madvise d_madvise
15971 eval $inlibc
15972
15973 : see if malloc_size exists
15974 set malloc_size d_malloc_size
15975 eval $inlibc
15976
15977 : see if malloc_size_good exists
15978 set malloc_good_size d_malloc_good_size
15979 eval $inlibc
15980
15981 : see if mblen exists
15982 set mblen d_mblen
15983 eval $inlibc
15984
15985 : see if mbstowcs exists
15986 set mbstowcs d_mbstowcs
15987 eval $inlibc
15988
15989 : see if mbtowc exists
15990 set mbtowc d_mbtowc
15991 eval $inlibc
15992
15993 : see if memchr exists
15994 set memchr d_memchr
15995 eval $inlibc
15996
15997 : see if memcmp exists
15998 set memcmp d_memcmp
15999 eval $inlibc
16000
16001 : see if memcpy exists
16002 set memcpy d_memcpy
16003 eval $inlibc
16004
16005 : see if memmove exists
16006 set memmove d_memmove
16007 eval $inlibc
16008
16009 : see if memset exists
16010 set memset d_memset
16011 eval $inlibc
16012
16013 : see if mkdir exists
16014 set mkdir d_mkdir
16015 eval $inlibc
16016
16017 : see if mkdtemp exists
16018 set mkdtemp d_mkdtemp
16019 eval $inlibc
16020
16021 : see if mkfifo exists
16022 set mkfifo d_mkfifo
16023 eval $inlibc
16024
16025 : see if mkstemp exists
16026 set mkstemp d_mkstemp
16027 eval $inlibc
16028
16029 : see if mkstemps exists
16030 set mkstemps d_mkstemps
16031 eval $inlibc
16032
16033 : see if mktime exists
16034 set mktime d_mktime
16035 eval $inlibc
16036
16037 : see if this is a sys/mman.h system
16038 set sys/mman.h i_sysmman
16039 eval $inhdr
16040
16041 : see if mmap exists
16042 set mmap d_mmap
16043 eval $inlibc
16044 : see what shmat returns
16045 : default to something harmless
16046 mmaptype='void *'
16047 case "$i_sysmman$d_mmap" in
16048 "$define$define")
16049         $cat >mmap.c <<'END'
16050 #include <sys/mman.h>
16051 void *mmap();
16052 END
16053         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16054                 mmaptype='void *'
16055         else
16056                 mmaptype='caddr_t'
16057         fi
16058         echo "and it returns ($mmaptype)." >&4
16059         ;;
16060 esac
16061
16062
16063
16064 : see if sqrtl exists
16065 set sqrtl d_sqrtl
16066 eval $inlibc
16067
16068 : see if scalbnl exists
16069 set scalbnl d_scalbnl
16070 eval $inlibc
16071
16072 : see if truncl exists
16073 set truncl d_truncl
16074 eval $inlibc
16075
16076 : see if modfl exists
16077 set modfl d_modfl
16078 eval $inlibc
16079
16080 : see if prototype for modfl is available
16081 echo " "
16082 set d_modflproto modfl $i_math math.h
16083 eval $hasproto
16084
16085 d_modfl_pow32_bug="$undef"
16086
16087 case "$d_longdbl$d_modfl" in
16088 $define$define)
16089         $cat <<EOM
16090 Checking to see whether your modfl() is okay for large values...
16091 EOM
16092 $cat >try.c <<EOCP
16093 #include <math.h>
16094 #include <stdio.h>
16095 EOCP
16096 if $test "X$d_modflproto" != "X$define"; then
16097         $cat >>try.c <<EOCP
16098 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16099 long double modfl (long double, long double *);
16100 EOCP
16101 fi
16102 $cat >>try.c <<EOCP
16103 int main() {
16104     long double nv = 4294967303.15;
16105     long double v, w;
16106     v = modfl(nv, &w);
16107 #ifdef __GLIBC__
16108     printf("glibc");
16109 #endif
16110     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16111     return 0;
16112 }
16113 EOCP
16114         case "$osname:$gccversion" in
16115         aix:)   saveccflags="$ccflags"
16116                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16117         esac
16118         set try
16119         if eval $compile; then
16120                 foo=`$run ./try`
16121                 case "$foo" in
16122                 *" 4294967303.150000 1.150000 4294967302.000000")
16123                         echo >&4 "Your modfl() is broken for large values."
16124                         d_modfl_pow32_bug="$define"
16125                         case "$foo" in
16126                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16127                         ;;
16128                         esac
16129                         ;;
16130                 *" 4294967303.150000 0.150000 4294967303.000000")
16131                         echo >&4 "Your modfl() seems okay for large values."
16132                         ;;
16133                 *)      echo >&4 "I don't understand your modfl() at all."
16134                         d_modfl="$undef"
16135                         ;;
16136                 esac
16137                 $rm_try
16138         else
16139                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16140                 d_modfl="$undef"
16141         fi
16142         case "$osname:$gccversion" in
16143         aix:)   ccflags="$saveccflags" ;; # restore
16144         esac
16145         ;;
16146 esac
16147
16148 if $test "$uselongdouble" = "$define"; then
16149     message=""
16150     if $test "$d_sqrtl" != "$define"; then
16151         message="$message sqrtl"
16152     fi
16153     if $test "$d_modfl" != "$define"; then
16154         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16155             echo "You have both truncl and copysignl, so I can emulate modfl."
16156         else
16157             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16158                 echo "You have both aintl and copysignl, so I can emulate modfl."
16159             else
16160                 message="$message modfl"
16161             fi
16162         fi
16163     fi
16164     if $test "$d_frexpl" != "$define"; then
16165         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16166             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16167         else
16168             message="$message frexpl"
16169         fi
16170     fi
16171     if $test "$d_ldexpl" != "$define"; then
16172         message="$message ldexpl"
16173     fi
16174
16175     if $test "$message" != ""; then
16176         $cat <<EOM >&4
16177
16178 *** You requested the use of long doubles but you do not seem to have
16179 *** the following mathematical functions needed for long double support:
16180 ***    $message
16181 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16182 *** Cannot continue, aborting.
16183
16184 EOM
16185
16186         exit 1
16187     fi
16188 fi
16189
16190 : see if mprotect exists
16191 set mprotect d_mprotect
16192 eval $inlibc
16193
16194 : see if msgctl exists
16195 set msgctl d_msgctl
16196 eval $inlibc
16197
16198 : see if msgget exists
16199 set msgget d_msgget
16200 eval $inlibc
16201
16202 : see if msgsnd exists
16203 set msgsnd d_msgsnd
16204 eval $inlibc
16205
16206 : see if msgrcv exists
16207 set msgrcv d_msgrcv
16208 eval $inlibc
16209
16210 : see how much of the 'msg*(2)' library is present.
16211 h_msg=true
16212 echo " "
16213 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16214 *"$undef"*) h_msg=false;;
16215 esac
16216 case "$osname" in
16217 freebsd)
16218     case "`ipcs 2>&1`" in
16219     "SVID messages"*"not configured"*)
16220         echo "Your $osname does not have the msg*(2) configured." >&4
16221         h_msg=false
16222         val="$undef"
16223         set msgctl d_msgctl
16224         eval $setvar
16225         set msgget d_msgget
16226         eval $setvar
16227         set msgsnd d_msgsnd
16228         eval $setvar
16229         set msgrcv d_msgrcv
16230         eval $setvar
16231         ;;
16232     esac
16233     ;;
16234 esac
16235 : we could also check for sys/ipc.h ...
16236 if $h_msg && $test `./findhdr sys/msg.h`; then
16237         echo "You have the full msg*(2) library." >&4
16238         val="$define"
16239 else
16240         echo "You don't have the full msg*(2) library." >&4
16241         val="$undef"
16242 fi
16243 set d_msg
16244 eval $setvar
16245
16246 : Check for msghdr_s
16247 echo " "
16248 echo "Checking to see if your system supports struct msghdr..." >&4
16249 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16250 eval $hasstruct
16251 case "$d_msghdr_s" in
16252 "$define")      echo "Yes, it does."   ;;
16253 *)              echo "No, it doesn't." ;;
16254 esac
16255
16256
16257 : see if msync exists
16258 set msync d_msync
16259 eval $inlibc
16260
16261 : see if munmap exists
16262 set munmap d_munmap
16263 eval $inlibc
16264
16265 : see if nice exists
16266 set nice d_nice
16267 eval $inlibc
16268
16269 : see if this is a langinfo.h system
16270 set langinfo.h i_langinfo
16271 eval $inhdr
16272
16273 : see if nl_langinfo exists
16274 set nl_langinfo d_nl_langinfo
16275 eval $inlibc
16276
16277 : check for volatile keyword
16278 echo " "
16279 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16280 $cat >try.c <<'EOCP'
16281 int main()
16282 {
16283         typedef struct _goo_struct goo_struct;
16284         goo_struct * volatile goo = ((goo_struct *)0);
16285         struct _goo_struct {
16286                 long long_int;
16287                 int reg_int;
16288                 char char_var;
16289         };
16290         typedef unsigned short foo_t;
16291         char *volatile foo;
16292         volatile int bar;
16293         volatile foo_t blech;
16294         foo = foo;
16295 }
16296 EOCP
16297 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16298         val="$define"
16299         echo "Yup, it does."
16300 else
16301         val="$undef"
16302         echo "Nope, it doesn't."
16303 fi
16304 set d_volatile
16305 eval $setvar
16306 $rm_try
16307
16308 : Check basic sizes
16309 echo " "
16310 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16311
16312 case "$use64bitint:$d_quad:$quadtype" in
16313 define:define:?*)
16314         ivtype="$quadtype"
16315         uvtype="$uquadtype"
16316         ivsize=8
16317         uvsize=8
16318         ;;
16319 *)      ivtype="long"
16320         uvtype="unsigned long"
16321         ivsize=$longsize
16322         uvsize=$longsize
16323         ;;
16324 esac
16325
16326 case "$uselongdouble:$d_longdbl" in
16327 define:define)
16328         nvtype="long double"
16329         nvsize=$longdblsize
16330         ;;
16331 *)      nvtype=double
16332         nvsize=$doublesize
16333         ;;
16334 esac
16335
16336 case "$usequadmath:$i_quadmath" in
16337 define:define)
16338   nvtype="__float128"
16339   nvsize=16
16340   case "$libs" in
16341   *quadmath*) ;;
16342   *) $cat <<EOM >&4
16343
16344 *** You requested the use of the quadmath library, but you
16345 *** do not seem to have the quadmath library installed.
16346 *** Cannot continue, aborting.
16347 EOM
16348     exit 1
16349     ;;
16350   esac
16351   ;;
16352 define:*) $cat <<EOM >&4
16353
16354 *** You requested the use of the quadmath library, but you
16355 *** do not seem to have the required header, <quadmath.h>.
16356 EOM
16357   case "$gccversion" in
16358   [23].*|4.[0-5]*)
16359    $cat <<EOM >&4
16360 *** Your gcc looks a bit old:
16361 *** $gccversion
16362 EOM
16363     ;;
16364   '')
16365    $cat <<EOM >&4
16366 *** You are not running a gcc.
16367 EOM
16368     ;;
16369   esac
16370   $cat <<EOM >&4
16371 *** For the quadmath library you need at least gcc 4.6.
16372 *** Cannot continue, aborting.
16373 EOM
16374   exit 1
16375   ;;
16376 esac
16377
16378 $echo "(IV will be "$ivtype", $ivsize bytes)"
16379 $echo "(UV will be "$uvtype", $uvsize bytes)"
16380 $echo "(NV will be "$nvtype", $nvsize bytes)"
16381
16382 $cat >try.c <<EOCP
16383 #$i_inttypes I_INTTYPES
16384 #ifdef I_INTTYPES
16385 #include <inttypes.h>
16386 #endif
16387 #include <stdio.h>
16388 int main() {
16389 #ifdef INT8
16390    int8_t i =  INT8_MAX;
16391   uint8_t u = UINT8_MAX;
16392   printf("int8_t\n");
16393 #endif
16394 #ifdef INT16
16395    int16_t i =  INT16_MAX;
16396   uint16_t u = UINT16_MAX;
16397   printf("int16_t\n");
16398 #endif
16399 #ifdef INT32
16400    int32_t i =  INT32_MAX;
16401   uint32_t u = UINT32_MAX;
16402   printf("int32_t\n");
16403 #endif
16404 }
16405 EOCP
16406
16407 i8type="signed char"
16408 u8type="unsigned char"
16409 i8size=1
16410 u8size=1
16411
16412 case "$i16type" in
16413 '')     case "$shortsize" in
16414         2)      i16type=short
16415                 u16type="unsigned short"
16416                 i16size=$shortsize
16417                 u16size=$shortsize
16418                 ;;
16419         esac
16420         ;;
16421 esac
16422 case "$i16type" in
16423 '')     set try -DINT16
16424         if eval $compile; then
16425                 case "`$run ./try`" in
16426                 int16_t)
16427                         i16type=int16_t
16428                         u16type=uint16_t
16429                         i16size=2
16430                         u16size=2
16431                         ;;
16432                 esac
16433         fi
16434         ;;
16435 esac
16436 case "$i16type" in
16437 '')     if $test $shortsize -ge 2; then
16438                 i16type=short
16439                 u16type="unsigned short"
16440                 i16size=$shortsize
16441                 u16size=$shortsize
16442         fi
16443         ;;
16444 esac
16445
16446 case "$i32type" in
16447 '')     case "$longsize" in
16448         4)      i32type=long
16449                 u32type="unsigned long"
16450                 i32size=$longsize
16451                 u32size=$longsize
16452                 ;;
16453         *)      case "$intsize" in
16454                 4)      i32type=int
16455                         u32type="unsigned int"
16456                         i32size=$intsize
16457                         u32size=$intsize
16458                         ;;
16459                 esac
16460                 ;;
16461         esac
16462         ;;
16463 esac
16464 case "$i32type" in
16465 '')     set try -DINT32
16466         if eval $compile; then
16467                 case "`$run ./try`" in
16468                 int32_t)
16469                         i32type=int32_t
16470                         u32type=uint32_t
16471                         i32size=4
16472                         u32size=4
16473                         ;;
16474                 esac
16475         fi
16476         ;;
16477 esac
16478 case "$i32type" in
16479 '')     if $test $intsize -ge 4; then
16480                 i32type=int
16481                 u32type="unsigned int"
16482                 i32size=$intsize
16483                 u32size=$intsize
16484         fi
16485         ;;
16486 esac
16487
16488 case "$i64type" in
16489 '')     case "$d_quad:$quadtype" in
16490         define:?*)
16491                 i64type="$quadtype"
16492                 u64type="$uquadtype"
16493                 i64size=8
16494                 u64size=8
16495                 ;;
16496         esac
16497         ;;
16498 esac
16499
16500 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16501 : volatile so that the compiler has to store it out to memory.
16502 if test X"$d_volatile" = X"$define"; then
16503         volatile=volatile
16504 fi
16505 $cat <<EOP >try.c
16506 #include <stdio.h>
16507 #$i_stdlib I_STDLIB
16508 #ifdef I_STDLIB
16509 #include <stdlib.h>
16510 #endif
16511 #include <sys/types.h>
16512 #include <signal.h>
16513 #ifdef SIGFPE
16514 $volatile int bletched = 0;
16515 $signal_t blech(int s) { bletched = 1; }
16516 #endif
16517 int main() {
16518     $uvtype u = 0;
16519     $nvtype d;
16520     int     n = 8 * $uvsize;
16521     int     i;
16522 #ifdef SIGFPE
16523     signal(SIGFPE, blech);
16524 #endif
16525
16526     for (i = 0; i < n; i++) {
16527       u = u << 1 | ($uvtype)1;
16528       d = ($nvtype)u;
16529       if (($uvtype)d != u)
16530         break;
16531       if (d <= 0)
16532         break;
16533       d = ($nvtype)(u - 1);
16534       if (($uvtype)d != (u - 1))
16535         break;
16536 #ifdef SIGFPE
16537       if (bletched)
16538         break;
16539 #endif
16540     }
16541     printf("%d\n", ((i == n) ? -n : i));
16542     exit(0);
16543 }
16544 EOP
16545 set try
16546
16547 d_nv_preserves_uv="$undef"
16548 if eval $compile; then
16549         nv_preserves_uv_bits="`$run ./try`"
16550 fi
16551 case "$nv_preserves_uv_bits" in
16552 \-[1-9]*)
16553         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16554         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16555         d_nv_preserves_uv="$define"
16556         ;;
16557 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16558         d_nv_preserves_uv="$undef" ;;
16559 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16560         nv_preserves_uv_bits="0" ;;
16561 esac
16562 $rm_try
16563
16564 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16565 : volatile so that the compiler has to store it out to memory.
16566 if test X"$d_volatile" = X"$define"; then
16567         volatile=volatile
16568 fi
16569 $cat <<EOP >try.c
16570 #include <stdio.h>
16571
16572 typedef $nvtype NV;
16573
16574 int
16575 main() {
16576   NV value = 2;
16577   int count = 1;
16578
16579   while(count < 256) {
16580     $volatile NV up = value + 1.0;
16581     $volatile NV negated = -value;
16582     $volatile NV down = negated - 1.0;
16583     $volatile NV got_up = up - value;
16584     int up_good = got_up == 1.0;
16585     int got_down = down - negated;
16586     int down_good = got_down == -1.0;
16587
16588     if (down_good != up_good) {
16589       fprintf(stderr,
16590               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16591               up_good, (double) got_up, down_good, (double) got_down,
16592               count, (double) value);
16593       return 1;
16594     }
16595     if (!up_good) {
16596       while (1) {
16597         if (count > 8) {
16598           count -= 8;
16599           fputs("256.0", stdout);
16600         } else {
16601           count--;
16602           fputs("2.0", stdout);
16603         }
16604         if (!count) {
16605           puts("");
16606           return 0;
16607         }
16608         fputs("*", stdout);
16609       }
16610     }
16611     value *= 2;
16612     ++count;
16613   }
16614   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16615           count, (double) value);
16616   return 1;
16617 }
16618 EOP
16619 set try
16620
16621 nv_overflows_integers_at='0'
16622 if eval $compile; then
16623     xxx="`$run ./try`"
16624     case "$?" in
16625         0)
16626             case "$xxx" in
16627                 2*)  cat >&4 <<EOM
16628 The largest integer your NVs can preserve is equal to $xxx
16629 EOM
16630                     nv_overflows_integers_at="$xxx"
16631                     ;;
16632                 *)  cat >&4 <<EOM
16633 Cannot determine the largest integer value your NVs can hold, unexpected output
16634 '$xxx'
16635 EOM
16636                     ;;
16637             esac
16638             ;;
16639         *)  cat >&4 <<EOM
16640 Cannot determine the largest integer value your NVs can hold
16641 EOM
16642             ;;
16643     esac
16644 fi
16645 $rm_try
16646
16647 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16648 : volatile so that the compiler has to store it out to memory.
16649 if test X"$d_volatile" = X"$define"; then
16650         volatile=volatile
16651 fi
16652 $cat <<EOP >try.c
16653 #include <stdio.h>
16654 #$i_stdlib I_STDLIB
16655 #ifdef I_STDLIB
16656 #include <stdlib.h>
16657 #endif
16658 #$i_string I_STRING
16659 #ifdef I_STRING
16660 #  include <string.h>
16661 #else
16662 #  include <strings.h>
16663 #endif
16664 #include <sys/types.h>
16665 #include <signal.h>
16666 #ifdef SIGFPE
16667 $volatile int bletched = 0;
16668 $signal_t blech(int s) { bletched = 1; }
16669 #endif
16670
16671 int checkit($nvtype d, char *where) {
16672     unsigned char *p = (char *)&d;
16673     unsigned char *end = p + sizeof(d);
16674     int fail = 0;
16675
16676     while (p < end)
16677         fail += *p++;
16678
16679     if (!fail)
16680         return 0;
16681
16682     p = (char *)&d;
16683     printf("No - %s: 0x", where);
16684     while (p < end)
16685         printf ("%02X", *p++);
16686     printf("\n");
16687     return 1;
16688 }
16689
16690 int main(int argc, char **argv) {
16691     $nvtype d = 0.0;
16692     int fail = 0;
16693     fail += checkit(d, "0.0");
16694
16695     /* The compiler shouldn't be assuming that bletched is 0  */
16696     d = bletched;
16697
16698     fail += checkit(d, "bleched");
16699
16700 #ifdef SIGFPE
16701     signal(SIGFPE, blech);
16702 #endif
16703
16704     /* Paranoia - the compiler should have no way of knowing that ANSI says
16705        that argv[argc] will always be NULL.  Actually, if it did assume this it
16706        would be buggy, as this is C and main() can be called from elsewhere in
16707        the program.  */
16708     d = argv[argc] ? 1 : 0;
16709
16710     if (d) {
16711         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16712     }
16713
16714     fail += checkit(d, "ternary");
16715
16716     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16717
16718     if (d != 0.0) {
16719         printf("No - memset doesn't give 0.0\n");
16720         /* This might just blow up:  */
16721         printf("(gives %g)\n", d);
16722         return 1;
16723     }
16724
16725 #ifdef SIGFPE
16726     if (bletched) {
16727         printf("No - something bleched\n");
16728         return 1;
16729     }
16730 #endif
16731     if (fail) {
16732       printf("No - %d fail(s)\n", fail);
16733       return 1;
16734     }
16735     printf("Yes\n");
16736     return 0;
16737 }
16738 EOP
16739 set try
16740
16741 d_nv_zero_is_allbits_zero="$undef"
16742 if eval $compile; then
16743     xxx="`$run ./try`"
16744     case "$?" in
16745         0)
16746             case "$xxx" in
16747                 Yes)  cat >&4 <<EOM
16748 0.0 is represented as all bits zero in memory
16749 EOM
16750                     d_nv_zero_is_allbits_zero="$define"
16751                     ;;
16752                 *)  cat >&4 <<EOM
16753 0.0 is not represented as all bits zero in memory
16754 EOM
16755                     d_nv_zero_is_allbits_zero="$undef"
16756                     ;;
16757             esac
16758             ;;
16759         *)  cat >&4 <<EOM
16760 0.0 is not represented as all bits zero in memory
16761 EOM
16762             d_nv_zero_is_allbits_zero="$undef"
16763             ;;
16764     esac
16765 fi
16766 $rm_try
16767
16768 : check for off64_t
16769 echo " "
16770 echo "Checking to see if you have off64_t..." >&4
16771 $cat >try.c <<EOCP
16772 #include <sys/types.h>
16773 #include <unistd.h>
16774 int main() { off64_t x = 7; }
16775 EOCP
16776 set try
16777 if eval $compile; then
16778         val="$define"
16779         echo "You have off64_t."
16780 else
16781         val="$undef"
16782         echo "You do not have off64_t."
16783         case "$lseeksize" in
16784         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16785         esac
16786 fi
16787 $rm_try
16788 set d_off64_t
16789 eval $setvar
16790
16791 : how to create joinable pthreads
16792 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16793         echo " "
16794         echo "Checking what constant to use for creating joinable pthreads..." >&4
16795         $cat >try.c <<'EOCP'
16796 #include <pthread.h>
16797 int main() {
16798     int detachstate = JOINABLE;
16799 }
16800 EOCP
16801         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16802         if eval $compile; then
16803                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16804                 val="$undef" # Yes, undef.
16805                 set d_old_pthread_create_joinable
16806                 eval $setvar
16807                 val=""
16808                 set old_pthread_create_joinable
16809                 eval $setvar
16810         else
16811                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16812                 if eval $compile; then
16813                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16814                         val="$define"
16815                         set d_old_pthread_create_joinable
16816                         eval $setvar
16817                         val=PTHREAD_CREATE_UNDETACHED
16818                         set old_pthread_create_joinable
16819                         eval $setvar
16820                 else
16821                         set try -DJOINABLE=__UNDETACHED
16822                         if eval $compile; then
16823                                 echo "You seem to use __UNDETACHED." >&4
16824                                 val="$define"
16825                                 set d_old_pthread_create_joinable
16826                                 eval $setvar
16827                                 val=__UNDETACHED
16828                                 set old_pthread_create_joinable
16829                                 eval $setvar
16830                         else
16831                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16832                                 val="$define"
16833                                 set d_old_pthread_create_joinable
16834                                 eval $setvar
16835                                 val=0
16836                                 set old_pthread_create_joinable
16837                                 eval $setvar
16838                         fi
16839                 fi
16840         fi
16841         $rm_try
16842 else
16843     d_old_pthread_create_joinable="$undef"
16844     old_pthread_create_joinable=""
16845 fi
16846
16847 : see if pause exists
16848 set pause d_pause
16849 eval $inlibc
16850
16851 : see if poll exists
16852 set poll d_poll
16853 eval $inlibc
16854
16855 : see if prctl exists
16856 set prctl d_prctl
16857 eval $inlibc
16858
16859 : see if prctl supports PR_SET_NAME
16860 d_prctl_set_name=$undef
16861 case $d_prctl in
16862     $define)
16863         $cat >try.c <<EOM
16864 #ifdef __ANDROID__
16865 #include <unistd.h>
16866 #endif
16867 #include <sys/prctl.h>
16868
16869 int main (int argc, char *argv[])
16870 {
16871     return (prctl (PR_SET_NAME, "Test"));
16872     } /* main */
16873 EOM
16874         set try
16875         if eval $compile_ok && $run ./try; then
16876             echo "Your prctl (PR_SET_NAME, ...) works"
16877             d_prctl_set_name=$define
16878             fi
16879         $rm_try
16880         ;;
16881     esac
16882
16883 : see if readlink exists
16884 set readlink d_readlink
16885 eval $inlibc
16886
16887 : Check if exe is symlink to abs path of executing program
16888 echo " "
16889 procselfexe=''
16890 val="$undef"
16891 case "$d_readlink" in
16892     "$define")
16893         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16894         : more tidy to avoid an extra level of symlink
16895         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16896         while test $# -gt 0; do
16897             type=$1; try=$2
16898             shift; shift
16899             if $issymlink $try; then
16900                 $ls -l $try > reflect
16901                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16902                     echo "You have $type-like $try."
16903                     procselfexe='"'$try'"'
16904                     val="$define"
16905                     : This will break out of the loop
16906                     set X; shift
16907                 fi
16908             fi
16909         done
16910         ;;
16911 esac
16912 $rm -f reflect
16913 set d_procselfexe
16914 eval $setvar
16915
16916 : backward compatibility for d_hvfork
16917 if test X$d_hvfork != X; then
16918         d_vfork="$d_hvfork"
16919         d_hvfork=''
16920 fi
16921 : see if there is a vfork
16922 val=''
16923 set vfork val
16924 eval $inlibc
16925
16926 d_pseudofork=$undef
16927
16928 : Ok, but do we want to use it. vfork is reportedly unreliable in
16929 : perl on Solaris 2.x, and probably elsewhere.
16930 case "$val" in
16931 $define)
16932         echo " "
16933         case "$usevfork" in
16934         false) dflt='n';;
16935         *) dflt='y';;
16936         esac
16937         cat <<'EOM'
16938
16939 Perl can only use a vfork() that doesn't suffer from strict
16940 restrictions on calling functions or modifying global data in
16941 the child.  For example, glibc-2.1 contains such a vfork()
16942 that is unsuitable.  If your system provides a proper fork()
16943 call, chances are that you do NOT want perl to use vfork().
16944
16945 EOM
16946         rp="Do you still want to use vfork()?"
16947         . ./myread
16948         case "$ans" in
16949         y|Y) ;;
16950         *)
16951                 echo "Ok, we won't use vfork()."
16952                 val="$undef"
16953                 ;;
16954         esac
16955         ;;
16956 esac
16957 set d_vfork
16958 eval $setvar
16959 case "$d_vfork" in
16960 $define) usevfork='true';;
16961 *) usevfork='false';;
16962 esac
16963
16964 : see whether the pthread_atfork exists
16965 $cat >try.c <<EOP
16966 #include <pthread.h>
16967 #include <stdio.h>
16968 int main() {
16969 #ifdef  PTHREAD_ATFORK
16970         pthread_atfork(NULL,NULL,NULL);
16971 #endif
16972 }
16973 EOP
16974
16975 : see if pthread_atfork exists
16976 set try -DPTHREAD_ATFORK
16977 if eval $compile; then
16978     val="$define"
16979 else
16980     val="$undef"
16981 fi
16982 case "$usethreads" in
16983 $define)
16984         case "$val" in
16985         $define) echo 'pthread_atfork found.' >&4        ;;
16986         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16987         esac
16988 esac
16989 set d_pthread_atfork
16990 eval $setvar
16991
16992 : see if pthread_attr_setscope exists
16993 set pthread_attr_setscope d_pthread_attr_setscope
16994 eval $inlibc
16995
16996 : see whether the various POSIXish _yields exist
16997 $cat >try.c <<EOP
16998 #include <pthread.h>
16999 #include <stdio.h>
17000 int main() {
17001 #ifdef SCHED_YIELD
17002         sched_yield();
17003 #else
17004 #ifdef PTHREAD_YIELD
17005         pthread_yield();
17006 #else
17007 #ifdef PTHREAD_YIELD_NULL
17008         pthread_yield(NULL);
17009 #endif
17010 #endif
17011 #endif
17012 }
17013 EOP
17014 : see if sched_yield exists
17015 set try -DSCHED_YIELD
17016 if eval $compile; then
17017     val="$define"
17018     sched_yield='sched_yield()'
17019 else
17020     val="$undef"
17021 fi
17022 case "$usethreads" in
17023 $define)
17024         case "$val" in
17025         $define) echo 'sched_yield() found.' >&4        ;;
17026         *)       echo 'sched_yield() NOT found.' >&4    ;;
17027         esac
17028 esac
17029 set d_sched_yield
17030 eval $setvar
17031
17032 : see if pthread_yield exists
17033 set try -DPTHREAD_YIELD
17034 if eval $compile; then
17035     val="$define"
17036     case "$sched_yield" in
17037     '') sched_yield='pthread_yield()' ;;
17038     esac
17039 else
17040     set try -DPTHREAD_YIELD_NULL
17041     if eval $compile; then
17042         val="$define"
17043         case "$sched_yield" in
17044         '') sched_yield='pthread_yield(NULL)' ;;
17045         esac
17046     else
17047         val="$undef"
17048     fi
17049 fi
17050 case "$usethreads" in
17051 $define)
17052         case "$val" in
17053         $define) echo 'pthread_yield() found.' >&4      ;;
17054         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17055         esac
17056         ;;
17057 esac
17058 set d_pthread_yield
17059 eval $setvar
17060 case "$sched_yield" in
17061 '') sched_yield=undef ;;
17062 esac
17063 $rm_try
17064
17065 : check for ptrdiff_t
17066 echo " "
17067 echo "Checking to see if you have ptrdiff_t..." >&4
17068 $cat >try.c <<EOCP
17069 #include <stddef.h>
17070 int main() { ptrdiff_t x = 7; }
17071 EOCP
17072 set try
17073 if eval $compile; then
17074         val="$define"
17075         echo "You have ptrdiff_t."
17076 else
17077         val="$undef"
17078         echo "You do not have ptrdiff_t."
17079 fi
17080 $rm_try
17081 set d_ptrdiff_t
17082 eval $setvar
17083
17084 : see if random_r exists
17085 set random_r d_random_r
17086 eval $inlibc
17087 case "$d_random_r" in
17088 "$define")
17089         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17090         case "$d_random_r_proto:$usethreads" in
17091         ":define")      d_random_r_proto=define
17092                 set d_random_r_proto random_r $hdrs
17093                 eval $hasproto ;;
17094         *)      ;;
17095         esac
17096         case "$d_random_r_proto" in
17097         define)
17098         case "$random_r_proto" in
17099         ''|0) try='int random_r(int*, struct random_data*);'
17100         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17101         esac
17102         case "$random_r_proto" in
17103         ''|0) try='int random_r(long*, struct random_data*);'
17104         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17105         esac
17106         case "$random_r_proto" in
17107         ''|0) try='int random_r(struct random_data*, int32_t*);'
17108         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17109         esac
17110         case "$random_r_proto" in
17111         ''|0)   d_random_r=undef
17112                 random_r_proto=0
17113                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17114         * )     case "$random_r_proto" in
17115                 REENTRANT_PROTO*) ;;
17116                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17117                 esac
17118                 echo "Prototype: $try" ;;
17119         esac
17120         ;;
17121         *)      case "$usethreads" in
17122                 define) echo "random_r has no prototype, not using it." >&4 ;;
17123                 esac
17124                 d_random_r=undef
17125                 random_r_proto=0
17126                 ;;
17127         esac
17128         ;;
17129 *)      random_r_proto=0
17130         ;;
17131 esac
17132
17133 : see if readdir and friends exist
17134 set readdir d_readdir
17135 eval $inlibc
17136 set seekdir d_seekdir
17137 eval $inlibc
17138 set telldir d_telldir
17139 eval $inlibc
17140 set rewinddir d_rewinddir
17141 eval $inlibc
17142
17143 : see if readdir64_r exists
17144 set readdir64_r d_readdir64_r
17145 eval $inlibc
17146 case "$d_readdir64_r" in
17147 "$define")
17148         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17149         case "$d_readdir64_r_proto:$usethreads" in
17150         ":define")      d_readdir64_r_proto=define
17151                 set d_readdir64_r_proto readdir64_r $hdrs
17152                 eval $hasproto ;;
17153         *)      ;;
17154         esac
17155         case "$d_readdir64_r_proto" in
17156         define)
17157         case "$readdir64_r_proto" in
17158         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17159         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17160         esac
17161         case "$readdir64_r_proto" in
17162         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17163         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17164         esac
17165         case "$readdir64_r_proto" in
17166         ''|0)   d_readdir64_r=undef
17167                 readdir64_r_proto=0
17168                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17169         * )     case "$readdir64_r_proto" in
17170                 REENTRANT_PROTO*) ;;
17171                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17172                 esac
17173                 echo "Prototype: $try" ;;
17174         esac
17175         ;;
17176         *)      case "$usethreads" in
17177                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17178                 esac
17179                 d_readdir64_r=undef
17180                 readdir64_r_proto=0
17181                 ;;
17182         esac
17183         ;;
17184 *)      readdir64_r_proto=0
17185         ;;
17186 esac
17187
17188 : see if readdir_r exists
17189 set readdir_r d_readdir_r
17190 eval $inlibc
17191 case "$d_readdir_r" in
17192 "$define")
17193         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17194         case "$d_readdir_r_proto:$usethreads" in
17195         ":define")      d_readdir_r_proto=define
17196                 set d_readdir_r_proto readdir_r $hdrs
17197                 eval $hasproto ;;
17198         *)      ;;
17199         esac
17200         case "$d_readdir_r_proto" in
17201         define)
17202         case "$readdir_r_proto" in
17203         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17204         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17205         esac
17206         case "$readdir_r_proto" in
17207         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17208         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17209         esac
17210         case "$readdir_r_proto" in
17211         ''|0)   d_readdir_r=undef
17212                 readdir_r_proto=0
17213                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17214         * )     case "$readdir_r_proto" in
17215                 REENTRANT_PROTO*) ;;
17216                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17217                 esac
17218                 echo "Prototype: $try" ;;
17219         esac
17220         ;;
17221         *)      case "$usethreads" in
17222                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17223                 esac
17224                 d_readdir_r=undef
17225                 readdir_r_proto=0
17226                 ;;
17227         esac
17228         ;;
17229 *)      readdir_r_proto=0
17230         ;;
17231 esac
17232
17233 : see if readv exists
17234 set readv d_readv
17235 eval $inlibc
17236
17237 : see if recvmsg exists
17238 set recvmsg d_recvmsg
17239 eval $inlibc
17240
17241 : see if rename exists
17242 set rename d_rename
17243 eval $inlibc
17244
17245 : see if rmdir exists
17246 set rmdir d_rmdir
17247 eval $inlibc
17248
17249 : see if memory.h is available.
17250 val=''
17251 set memory.h val
17252 eval $inhdr
17253
17254 : See if it conflicts with string.h
17255 case "$val" in
17256 $define)
17257         case "$strings" in
17258         '') ;;
17259         *)
17260                 $cppstdin $cppflags $cppminus < $strings > mem.h
17261                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17262                         echo " "
17263                         echo "We won't be including <memory.h>."
17264                         val="$undef"
17265                 fi
17266                 $rm -f mem.h
17267                 ;;
17268         esac
17269 esac
17270 set i_memory
17271 eval $setvar
17272
17273 : can bcopy handle overlapping blocks?
17274 echo " "
17275 val="$undef"
17276 case "$d_memmove" in
17277 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17278 *)      case "$d_bcopy" in
17279         "$define")
17280                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17281                 $cat >try.c <<EOCP
17282 #$i_memory I_MEMORY
17283 #$i_stdlib I_STDLIB
17284 #$i_string I_STRING
17285 #$i_unistd I_UNISTD
17286 EOCP
17287         $cat >>try.c <<'EOCP'
17288 #include <stdio.h>
17289 #ifdef I_MEMORY
17290 #  include <memory.h>
17291 #endif
17292 #ifdef I_STDLIB
17293 #  include <stdlib.h>
17294 #endif
17295 #ifdef I_STRING
17296 #  include <string.h>
17297 #else
17298 #  include <strings.h>
17299 #endif
17300 #ifdef I_UNISTD
17301 #  include <unistd.h>  /* Needed for NetBSD */
17302 #endif
17303 int main()
17304 {
17305 char buf[128], abc[128];
17306 char *b;
17307 int len;
17308 int off;
17309 int align;
17310
17311 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17312    try to store the string in read-only memory. */
17313 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17314
17315 for (align = 7; align >= 0; align--) {
17316         for (len = 36; len; len--) {
17317                 b = buf+align;
17318                 bcopy(abc, b, len);
17319                 for (off = 1; off <= len; off++) {
17320                         bcopy(b, b+off, len);
17321                         bcopy(b+off, b, len);
17322                         if (bcmp(b, abc, len))
17323                                 exit(1);
17324                 }
17325         }
17326 }
17327 exit(0);
17328 }
17329 EOCP
17330                 set try
17331                 if eval $compile_ok; then
17332                         if $run ./try 2>/dev/null; then
17333                                 echo "Yes, it can."
17334                                 val="$define"
17335                         else
17336                                 echo "It can't, sorry."
17337                         fi
17338                 else
17339                         echo "(I can't compile the test program, so we'll assume not...)"
17340                 fi
17341                 ;;
17342         esac
17343         $rm_try
17344         ;;
17345 esac
17346 set d_safebcpy
17347 eval $setvar
17348
17349 : can memcpy handle overlapping blocks?
17350 echo " "
17351 val="$undef"
17352 case "$d_memmove" in
17353 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17354 *)      case "$d_memcpy" in
17355         "$define")
17356                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17357                 $cat >try.c <<EOCP
17358 #$i_memory I_MEMORY
17359 #$i_stdlib I_STDLIB
17360 #$i_string I_STRING
17361 #$i_unistd I_UNISTD
17362 EOCP
17363         $cat >>try.c <<'EOCP'
17364 #include <stdio.h>
17365 #ifdef I_MEMORY
17366 #  include <memory.h>
17367 #endif
17368 #ifdef I_STDLIB
17369 #  include <stdlib.h>
17370 #endif
17371 #ifdef I_STRING
17372 #  include <string.h>
17373 #else
17374 #  include <strings.h>
17375 #endif
17376 #ifdef I_UNISTD
17377 #  include <unistd.h>  /* Needed for NetBSD */
17378 #endif
17379 int main()
17380 {
17381 char buf[128], abc[128];
17382 char *b;
17383 int len;
17384 int off;
17385 int align;
17386
17387 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17388    try to store the string in read-only memory. */
17389 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17390
17391 for (align = 7; align >= 0; align--) {
17392         for (len = 36; len; len--) {
17393                 b = buf+align;
17394                 memcpy(b, abc, len);
17395                 for (off = 1; off <= len; off++) {
17396                         memcpy(b+off, b, len);
17397                         memcpy(b, b+off, len);
17398                         if (memcmp(b, abc, len))
17399                                 exit(1);
17400                 }
17401         }
17402 }
17403 exit(0);
17404 }
17405 EOCP
17406                 set try
17407                 if eval $compile_ok; then
17408                         if $run ./try 2>/dev/null; then
17409                                 echo "Yes, it can."
17410                                 val="$define"
17411                         else
17412                                 echo "It can't, sorry."
17413                         fi
17414                 else
17415                         echo "(I can't compile the test program, so we'll assume not...)"
17416                 fi
17417                 ;;
17418         esac
17419         $rm_try
17420         ;;
17421 esac
17422 set d_safemcpy
17423 eval $setvar
17424
17425 : can memcmp be trusted to compare relative magnitude?
17426 val="$undef"
17427 case "$d_memcmp" in
17428 "$define")
17429         echo " "
17430         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17431         $cat >try.c <<EOCP
17432 #$i_memory I_MEMORY
17433 #$i_stdlib I_STDLIB
17434 #$i_string I_STRING
17435 #$i_unistd I_UNISTD
17436 EOCP
17437         $cat >>try.c <<'EOCP'
17438 #include <stdio.h>
17439 #ifdef I_MEMORY
17440 #  include <memory.h>
17441 #endif
17442 #ifdef I_STDLIB
17443 #  include <stdlib.h>
17444 #endif
17445 #ifdef I_STRING
17446 #  include <string.h>
17447 #else
17448 #  include <strings.h>
17449 #endif
17450 #ifdef I_UNISTD
17451 #  include <unistd.h>  /* Needed for NetBSD */
17452 #endif
17453 int main()
17454 {
17455 char a = -1;
17456 char b = 0;
17457 if ((a < b) && memcmp(&a, &b, 1) < 0)
17458         exit(1);
17459 exit(0);
17460 }
17461 EOCP
17462         set try
17463         if eval $compile_ok; then
17464                 if $run ./try 2>/dev/null; then
17465                         echo "Yes, it can."
17466                         val="$define"
17467                 else
17468                         echo "No, it can't (it uses signed chars)."
17469                 fi
17470         else
17471                 echo "(I can't compile the test program, so we'll assume not...)"
17472         fi
17473         ;;
17474 esac
17475 $rm_try
17476 set d_sanemcmp
17477 eval $setvar
17478
17479 : see if prototype for sbrk is available
17480 echo " "
17481 set d_sbrkproto sbrk $i_unistd unistd.h
17482 eval $hasproto
17483
17484 : see if select exists
17485 set select d_select
17486 eval $inlibc
17487
17488 : see if semctl exists
17489 set semctl d_semctl
17490 eval $inlibc
17491
17492 : see if semget exists
17493 set semget d_semget
17494 eval $inlibc
17495
17496 : see if semop exists
17497 set semop d_semop
17498 eval $inlibc
17499
17500 : see how much of the 'sem*(2)' library is present.
17501 h_sem=true
17502 echo " "
17503 case "$d_semctl$d_semget$d_semop" in
17504 *"$undef"*) h_sem=false;;
17505 esac
17506 case "$osname" in
17507 freebsd)
17508     case "`ipcs 2>&1`" in
17509     "SVID messages"*"not configured"*)
17510         echo "Your $osname does not have the sem*(2) configured." >&4
17511         h_sem=false
17512         val="$undef"
17513         set semctl d_semctl
17514         eval $setvar
17515         set semget d_semget
17516         eval $setvar
17517         set semop d_semop
17518         eval $setvar
17519         ;;
17520     esac
17521     ;;
17522 esac
17523 : we could also check for sys/ipc.h ...
17524 if $h_sem && $test `./findhdr sys/sem.h`; then
17525         echo "You have the full sem*(2) library." >&4
17526         val="$define"
17527 else
17528         echo "You don't have the full sem*(2) library." >&4
17529         val="$undef"
17530 fi
17531 set d_sem
17532 eval $setvar
17533
17534 : see whether sys/sem.h defines union semun
17535 echo " "
17536 $cat > try.c <<'END'
17537 #include <sys/types.h>
17538 #include <sys/ipc.h>
17539 #include <sys/sem.h>
17540 int main () { union semun semun; semun.buf = 0; }
17541 END
17542 set try
17543 if eval $compile; then
17544     echo "You have union semun in <sys/sem.h>." >&4
17545     val="$define"
17546 else
17547     echo "You do not have union semun in <sys/sem.h>." >&4
17548     val="$undef"
17549 fi
17550 $rm_try
17551 set d_union_semun
17552 eval $setvar
17553
17554 : see how to do semctl IPC_STAT
17555 case "$d_sem" in
17556 $define)
17557     echo " "
17558     $cat > tryh.h <<END
17559 #ifndef S_IRUSR
17560 #   ifdef S_IREAD
17561 #       define S_IRUSR S_IREAD
17562 #       define S_IWUSR S_IWRITE
17563 #       define S_IXUSR S_IEXEC
17564 #   else
17565 #       define S_IRUSR 0400
17566 #       define S_IWUSR 0200
17567 #       define S_IXUSR 0100
17568 #   endif
17569 #   define S_IRGRP (S_IRUSR>>3)
17570 #   define S_IWGRP (S_IWUSR>>3)
17571 #   define S_IXGRP (S_IXUSR>>3)
17572 #   define S_IROTH (S_IRUSR>>6)
17573 #   define S_IWOTH (S_IWUSR>>6)
17574 #   define S_IXOTH (S_IXUSR>>6)
17575 #endif
17576 #ifndef S_IRWXU
17577 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17578 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17579 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17580 #endif
17581 END
17582     : see whether semctl IPC_STAT can use union semun
17583     case "$d_semctl_semun" in
17584     '')
17585       val="$undef"
17586       $cat > try.c <<END
17587 #include <sys/types.h>
17588 #include <sys/ipc.h>
17589 #include <sys/sem.h>
17590 #include <sys/stat.h>
17591 #include <stdio.h>
17592 #include <errno.h>
17593 #include "tryh.h"
17594 #ifndef errno
17595 extern int errno;
17596 #endif
17597 #$d_union_semun HAS_UNION_SEMUN
17598 int main() {
17599     union semun
17600 #ifndef HAS_UNION_SEMUN
17601     {
17602         int val;
17603         struct semid_ds *buf;
17604         unsigned short *array;
17605     }
17606 #endif
17607     arg;
17608     int sem, st;
17609
17610 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17611     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17612     if (sem > -1) {
17613         struct semid_ds argbuf;
17614         arg.buf = &argbuf;
17615 #       ifdef IPC_STAT
17616         st = semctl(sem, 0, IPC_STAT, arg);
17617         if (st == 0)
17618             printf("semun\n");
17619         else
17620 #       endif /* IPC_STAT */
17621             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17622 #       ifdef IPC_RMID
17623         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17624 #       endif /* IPC_RMID */
17625             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17626     } else
17627 #endif /* IPC_PRIVATE && ... */
17628         printf("semget failed: errno = %d\n", errno);
17629   return 0;
17630 }
17631 END
17632       set try
17633       if eval $compile; then
17634           xxx=`$run ./try`
17635           case "$xxx" in
17636           semun) val="$define" ;;
17637           esac
17638       fi
17639       $rm_try
17640       set d_semctl_semun
17641       eval $setvar
17642       ;;
17643     esac
17644     case "$d_semctl_semun" in
17645     $define)
17646         echo "You can use union semun for semctl IPC_STAT." >&4
17647         also='also'
17648         ;;
17649     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17650         also=''
17651         ;;
17652     esac
17653
17654     : see whether semctl IPC_STAT can use struct semid_ds pointer
17655     case "$d_semctl_semid_ds" in
17656     '')
17657       val="$undef"
17658       $cat > try.c <<'END'
17659 #include <sys/types.h>
17660 #include <sys/ipc.h>
17661 #include <sys/sem.h>
17662 #include <sys/stat.h>
17663 #include "tryh.h"
17664 #include <stdio.h>
17665 #include <errno.h>
17666 #ifndef errno
17667 extern int errno;
17668 #endif
17669 int main() {
17670     struct semid_ds arg;
17671     int sem, st;
17672
17673 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17674     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17675     if (sem > -1) {
17676 #       ifdef IPC_STAT
17677         st = semctl(sem, 0, IPC_STAT, &arg);
17678         if (st == 0)
17679             printf("semid_ds\n");
17680         else
17681 #       endif /* IPC_STAT */
17682             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17683 #       ifdef IPC_RMID
17684         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17685 #       endif /* IPC_RMID */
17686             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17687     } else
17688 #endif /* IPC_PRIVATE && ... */
17689         printf("semget failed: errno = %d\n", errno);
17690
17691     return 0;
17692 }
17693 END
17694       set try
17695       if eval $compile; then
17696           xxx=`$run ./try`
17697           case "$xxx" in
17698           semid_ds) val="$define" ;;
17699           esac
17700       fi
17701       $rm_try
17702       set d_semctl_semid_ds
17703       eval $setvar
17704       ;;
17705     esac
17706     case "$d_semctl_semid_ds" in
17707     $define)
17708         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17709         ;;
17710     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17711         ;;
17712     esac
17713     ;;
17714 *)  val="$undef"
17715
17716     # We do not have the full sem*(2) library, so assume we can not
17717     # use either.
17718
17719     set d_semctl_semun
17720     eval $setvar
17721
17722     set d_semctl_semid_ds
17723     eval $setvar
17724     ;;
17725 esac
17726 $rm_try tryh.h
17727
17728 : see if sendmsg exists
17729 set sendmsg d_sendmsg
17730 eval $inlibc
17731
17732 : see if setegid exists
17733 set setegid d_setegid
17734 eval $inlibc
17735
17736 : see if seteuid exists
17737 set seteuid d_seteuid
17738 eval $inlibc
17739
17740 : see if setgrent exists
17741 set setgrent d_setgrent
17742 eval $inlibc
17743
17744 : see if setgrent_r exists
17745 set setgrent_r d_setgrent_r
17746 eval $inlibc
17747 case "$d_setgrent_r" in
17748 "$define")
17749         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17750         case "$d_setgrent_r_proto:$usethreads" in
17751         ":define")      d_setgrent_r_proto=define
17752                 set d_setgrent_r_proto setgrent_r $hdrs
17753                 eval $hasproto ;;
17754         *)      ;;
17755         esac
17756         case "$d_setgrent_r_proto" in
17757         define)
17758         case "$setgrent_r_proto" in
17759         ''|0) try='int setgrent_r(FILE**);'
17760         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17761         esac
17762         case "$setgrent_r_proto" in
17763         ''|0) try='void setgrent_r(FILE**);'
17764         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17765         esac
17766         case "$setgrent_r_proto" in
17767         ''|0)   d_setgrent_r=undef
17768                 setgrent_r_proto=0
17769                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17770         * )     case "$setgrent_r_proto" in
17771                 REENTRANT_PROTO*) ;;
17772                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17773                 esac
17774                 echo "Prototype: $try" ;;
17775         esac
17776         ;;
17777         *)      case "$usethreads" in
17778                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17779                 esac
17780                 d_setgrent_r=undef
17781                 setgrent_r_proto=0
17782                 ;;
17783         esac
17784         ;;
17785 *)      setgrent_r_proto=0
17786         ;;
17787 esac
17788
17789 : see if sethostent exists
17790 set sethostent d_sethent
17791 eval $inlibc
17792
17793 : see if sethostent_r exists
17794 set sethostent_r d_sethostent_r
17795 eval $inlibc
17796 case "$d_sethostent_r" in
17797 "$define")
17798         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17799         case "$d_sethostent_r_proto:$usethreads" in
17800         ":define")      d_sethostent_r_proto=define
17801                 set d_sethostent_r_proto sethostent_r $hdrs
17802                 eval $hasproto ;;
17803         *)      ;;
17804         esac
17805         case "$d_sethostent_r_proto" in
17806         define)
17807         case "$sethostent_r_proto" in
17808         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17809         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17810         esac
17811         case "$sethostent_r_proto" in
17812         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17813         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17814         esac
17815         case "$sethostent_r_proto" in
17816         ''|0)   d_sethostent_r=undef
17817                 sethostent_r_proto=0
17818                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17819         * )     case "$sethostent_r_proto" in
17820                 REENTRANT_PROTO*) ;;
17821                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17822                 esac
17823                 echo "Prototype: $try" ;;
17824         esac
17825         ;;
17826         *)      case "$usethreads" in
17827                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17828                 esac
17829                 d_sethostent_r=undef
17830                 sethostent_r_proto=0
17831                 ;;
17832         esac
17833         ;;
17834 *)      sethostent_r_proto=0
17835         ;;
17836 esac
17837
17838 : see if setitimer exists
17839 set setitimer d_setitimer
17840 eval $inlibc
17841
17842 : see if setlinebuf exists
17843 set setlinebuf d_setlinebuf
17844 eval $inlibc
17845
17846 : see if setlocale exists
17847 set setlocale d_setlocale
17848 eval $inlibc
17849
17850 : see if locale.h is available
17851 set locale.h i_locale
17852 eval $inhdr
17853
17854 : see if setlocale_r exists
17855 set setlocale_r d_setlocale_r
17856 eval $inlibc
17857 case "$d_setlocale_r" in
17858 "$define")
17859         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17860         case "$d_setlocale_r_proto:$usethreads" in
17861         ":define")      d_setlocale_r_proto=define
17862                 set d_setlocale_r_proto setlocale_r $hdrs
17863                 eval $hasproto ;;
17864         *)      ;;
17865         esac
17866         case "$d_setlocale_r_proto" in
17867         define)
17868         case "$setlocale_r_proto" in
17869         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17870         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17871         esac
17872         case "$setlocale_r_proto" in
17873         ''|0)   d_setlocale_r=undef
17874                 setlocale_r_proto=0
17875                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17876         * )     case "$setlocale_r_proto" in
17877                 REENTRANT_PROTO*) ;;
17878                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17879                 esac
17880                 echo "Prototype: $try" ;;
17881         esac
17882         ;;
17883         *)      case "$usethreads" in
17884                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17885                 esac
17886                 d_setlocale_r=undef
17887                 setlocale_r_proto=0
17888                 ;;
17889         esac
17890         ;;
17891 *)      setlocale_r_proto=0
17892         ;;
17893 esac
17894
17895 : see if setnetent exists
17896 set setnetent d_setnent
17897 eval $inlibc
17898
17899 : see if setnetent_r exists
17900 set setnetent_r d_setnetent_r
17901 eval $inlibc
17902 case "$d_setnetent_r" in
17903 "$define")
17904         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17905         case "$d_setnetent_r_proto:$usethreads" in
17906         ":define")      d_setnetent_r_proto=define
17907                 set d_setnetent_r_proto setnetent_r $hdrs
17908                 eval $hasproto ;;
17909         *)      ;;
17910         esac
17911         case "$d_setnetent_r_proto" in
17912         define)
17913         case "$setnetent_r_proto" in
17914         ''|0) try='int setnetent_r(int, struct netent_data*);'
17915         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17916         esac
17917         case "$setnetent_r_proto" in
17918         ''|0) try='void setnetent_r(int, struct netent_data*);'
17919         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17920         esac
17921         case "$setnetent_r_proto" in
17922         ''|0)   d_setnetent_r=undef
17923                 setnetent_r_proto=0
17924                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17925         * )     case "$setnetent_r_proto" in
17926                 REENTRANT_PROTO*) ;;
17927                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17928                 esac
17929                 echo "Prototype: $try" ;;
17930         esac
17931         ;;
17932         *)      case "$usethreads" in
17933                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17934                 esac
17935                 d_setnetent_r=undef
17936                 setnetent_r_proto=0
17937                 ;;
17938         esac
17939         ;;
17940 *)      setnetent_r_proto=0
17941         ;;
17942 esac
17943
17944 : see if setprotoent exists
17945 set setprotoent d_setpent
17946 eval $inlibc
17947
17948 : see if setpgid exists
17949 set setpgid d_setpgid
17950 eval $inlibc
17951
17952 : see if setpgrp2 exists
17953 set setpgrp2 d_setpgrp2
17954 eval $inlibc
17955
17956 : see if setpriority exists
17957 set setpriority d_setprior
17958 eval $inlibc
17959
17960 : see if setproctitle exists
17961 set setproctitle d_setproctitle
17962 eval $inlibc
17963
17964 : see if setprotoent_r exists
17965 set setprotoent_r d_setprotoent_r
17966 eval $inlibc
17967 case "$d_setprotoent_r" in
17968 "$define")
17969         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17970         case "$d_setprotoent_r_proto:$usethreads" in
17971         ":define")      d_setprotoent_r_proto=define
17972                 set d_setprotoent_r_proto setprotoent_r $hdrs
17973                 eval $hasproto ;;
17974         *)      ;;
17975         esac
17976         case "$d_setprotoent_r_proto" in
17977         define)
17978         case "$setprotoent_r_proto" in
17979         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17980         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17981         esac
17982         case "$setprotoent_r_proto" in
17983         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17984         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17985         esac
17986         case "$setprotoent_r_proto" in
17987         ''|0)   d_setprotoent_r=undef
17988                 setprotoent_r_proto=0
17989                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17990         * )     case "$setprotoent_r_proto" in
17991                 REENTRANT_PROTO*) ;;
17992                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17993                 esac
17994                 echo "Prototype: $try" ;;
17995         esac
17996         ;;
17997         *)      case "$usethreads" in
17998                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17999                 esac
18000                 d_setprotoent_r=undef
18001                 setprotoent_r_proto=0
18002                 ;;
18003         esac
18004         ;;
18005 *)      setprotoent_r_proto=0
18006         ;;
18007 esac
18008
18009 : see if setpwent exists
18010 set setpwent d_setpwent
18011 eval $inlibc
18012
18013 : see if setpwent_r exists
18014 set setpwent_r d_setpwent_r
18015 eval $inlibc
18016 case "$d_setpwent_r" in
18017 "$define")
18018         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18019         case "$d_setpwent_r_proto:$usethreads" in
18020         ":define")      d_setpwent_r_proto=define
18021                 set d_setpwent_r_proto setpwent_r $hdrs
18022                 eval $hasproto ;;
18023         *)      ;;
18024         esac
18025         case "$d_setpwent_r_proto" in
18026         define)
18027         case "$setpwent_r_proto" in
18028         ''|0) try='int setpwent_r(FILE**);'
18029         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18030         esac
18031         case "$setpwent_r_proto" in
18032         ''|0) try='void setpwent_r(FILE**);'
18033         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18034         esac
18035         case "$setpwent_r_proto" in
18036         ''|0)   d_setpwent_r=undef
18037                 setpwent_r_proto=0
18038                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18039         * )     case "$setpwent_r_proto" in
18040                 REENTRANT_PROTO*) ;;
18041                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18042                 esac
18043                 echo "Prototype: $try" ;;
18044         esac
18045         ;;
18046         *)      case "$usethreads" in
18047                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18048                 esac
18049                 d_setpwent_r=undef
18050                 setpwent_r_proto=0
18051                 ;;
18052         esac
18053         ;;
18054 *)      setpwent_r_proto=0
18055         ;;
18056 esac
18057
18058 : see if setregid exists
18059 set setregid d_setregid
18060 eval $inlibc
18061 set setresgid d_setresgid
18062 eval $inlibc
18063
18064 : see if setreuid exists
18065 set setreuid d_setreuid
18066 eval $inlibc
18067 set setresuid d_setresuid
18068 eval $inlibc
18069
18070 : see if setrgid exists
18071 set setrgid d_setrgid
18072 eval $inlibc
18073
18074 : see if setruid exists
18075 set setruid d_setruid
18076 eval $inlibc
18077
18078 : see if setservent exists
18079 set setservent d_setsent
18080 eval $inlibc
18081
18082 : see if setservent_r exists
18083 set setservent_r d_setservent_r
18084 eval $inlibc
18085 case "$d_setservent_r" in
18086 "$define")
18087         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18088         case "$d_setservent_r_proto:$usethreads" in
18089         ":define")      d_setservent_r_proto=define
18090                 set d_setservent_r_proto setservent_r $hdrs
18091                 eval $hasproto ;;
18092         *)      ;;
18093         esac
18094         case "$d_setservent_r_proto" in
18095         define)
18096         case "$setservent_r_proto" in
18097         ''|0) try='int setservent_r(int, struct servent_data*);'
18098         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18099         esac
18100         case "$setservent_r_proto" in
18101         ''|0) try='void setservent_r(int, struct servent_data*);'
18102         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18103         esac
18104         case "$setservent_r_proto" in
18105         ''|0)   d_setservent_r=undef
18106                 setservent_r_proto=0
18107                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18108         * )     case "$setservent_r_proto" in
18109                 REENTRANT_PROTO*) ;;
18110                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18111                 esac
18112                 echo "Prototype: $try" ;;
18113         esac
18114         ;;
18115         *)      case "$usethreads" in
18116                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18117                 esac
18118                 d_setservent_r=undef
18119                 setservent_r_proto=0
18120                 ;;
18121         esac
18122         ;;
18123 *)      setservent_r_proto=0
18124         ;;
18125 esac
18126
18127 : see if setsid exists
18128 set setsid d_setsid
18129 eval $inlibc
18130
18131 : see if setvbuf exists
18132 set setvbuf d_setvbuf
18133 eval $inlibc
18134
18135 : see if shmctl exists
18136 set shmctl d_shmctl
18137 eval $inlibc
18138
18139 : see if shmget exists
18140 set shmget d_shmget
18141 eval $inlibc
18142
18143 : see if shmat exists
18144 set shmat d_shmat
18145 eval $inlibc
18146 : see what shmat returns
18147 case "$d_shmat" in
18148 "$define")
18149         $cat >shmat.c <<'END'
18150 #include <sys/shm.h>
18151 void *shmat();
18152 END
18153         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18154                 shmattype='void *'
18155         else
18156                 shmattype='char *'
18157         fi
18158         echo "and it returns ($shmattype)." >&4
18159         : see if a prototype for shmat is available
18160         xxx=`./findhdr sys/shm.h`
18161         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18162         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18163                 val="$define"
18164         else
18165                 val="$undef"
18166         fi
18167         $rm -f shmat.[co]
18168         ;;
18169 *)
18170         val="$undef"
18171         ;;
18172 esac
18173 set d_shmatprototype
18174 eval $setvar
18175
18176 : see if shmdt exists
18177 set shmdt d_shmdt
18178 eval $inlibc
18179
18180 : see how much of the 'shm*(2)' library is present.
18181 h_shm=true
18182 echo " "
18183 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18184 *"$undef"*) h_shm=false;;
18185 esac
18186 case "$osname" in
18187 freebsd)
18188     case "`ipcs 2>&1`" in
18189     "SVID shared memory"*"not configured"*)
18190         echo "Your $osname does not have the shm*(2) configured." >&4
18191         h_shm=false
18192         val="$undef"
18193         set shmctl d_shmctl
18194         eval $setvar
18195         set shmget d_shmget
18196         eval $setvar
18197         set shmat d_shmat
18198         eval $setvar
18199         set shmdt d_shmdt
18200         eval $setvar
18201         ;;
18202     esac
18203     ;;
18204 esac
18205 : we could also check for sys/ipc.h ...
18206 if $h_shm && $test `./findhdr sys/shm.h`; then
18207         echo "You have the full shm*(2) library." >&4
18208         val="$define"
18209 else
18210         echo "You don't have the full shm*(2) library." >&4
18211         val="$undef"
18212 fi
18213 set d_shm
18214 eval $setvar
18215
18216 : see if we have sigaction
18217 echo " "
18218 if set sigaction val -f d_sigaction; eval $csym; $val; then
18219         echo 'sigaction() found.' >&4
18220         $cat > try.c <<EOP
18221 #include <stdio.h>
18222 #include <sys/types.h>
18223 #include <signal.h>
18224 #$i_stdlib I_STDLIB
18225 #ifdef I_STDLIB
18226 #include <stdlib.h>
18227 #endif
18228 int main()
18229 {
18230     struct sigaction act, oact;
18231     act.sa_flags = 0;
18232     oact.sa_handler = 0;
18233     /* so that act and oact are used */
18234     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18235 }
18236 EOP
18237         set try
18238         if eval $compile_ok; then
18239                 val="$define"
18240         else
18241                 echo "But you don't seem to have a usable struct sigaction." >&4
18242                 val="$undef"
18243         fi
18244 else
18245         echo 'sigaction NOT found.' >&4
18246         val="$undef"
18247 fi
18248 set d_sigaction; eval $setvar
18249 $rm_try
18250
18251 : see if this is a sunmath.h system
18252 set sunmath.h i_sunmath
18253 eval $inhdr
18254
18255 : see if signbit exists
18256 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18257 $cat >try.c <<EOCP
18258 #$i_math I_MATH
18259 #$i_sunmath I_SUNMATH
18260 #ifdef I_MATH
18261 #  include <math.h>
18262 #endif
18263 #ifdef I_SUNMATH  /* Solaris special math library */
18264 #  include <sunmath.h>
18265 #endif
18266 #define NV $nvtype
18267 int main(int argc, char **argv)
18268 {
18269     NV x = 0.0;
18270     NV y = -0.0;
18271     if ((signbit(x) == 0) && (signbit(y) != 0))
18272         return 0;
18273     else
18274         return 1;
18275 }
18276 EOCP
18277 val="$undef"
18278 set try
18279 if eval $compile; then
18280     if $run ./try; then
18281         $echo "Yes." >&4
18282         val="$define"
18283     else
18284         $echo "Signbit seems to be available, but doesn't work as I expected."
18285         $echo "I won't use it." >&4
18286         val="$undef"
18287     fi
18288 else
18289     $echo "Nope." >&4
18290     dflt="$undef"
18291 fi
18292 set d_signbit
18293 eval $setvar
18294 $rm_try
18295
18296 : see if sigprocmask exists
18297 set sigprocmask d_sigprocmask
18298 eval $inlibc
18299
18300 : see if sigsetjmp exists
18301 echo " "
18302 case "$d_sigsetjmp" in
18303 '')
18304         $cat >try.c <<EOP
18305 #include <setjmp.h>
18306 #$i_stdlib I_STDLIB
18307 #ifdef I_STDLIB
18308 #include <stdlib.h>
18309 #endif
18310 sigjmp_buf env;
18311 int set = 1;
18312 int main()
18313 {
18314         if (sigsetjmp(env,1))
18315                 exit(set);
18316         set = 0;
18317         siglongjmp(env, 1);
18318         exit(1);
18319 }
18320 EOP
18321         set try
18322         if eval $compile; then
18323                 if $run ./try >/dev/null 2>&1; then
18324                         echo "POSIX sigsetjmp found." >&4
18325                         val="$define"
18326                 else
18327                         $cat >&4 <<EOM
18328 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18329 I'll ignore them.
18330 EOM
18331                         val="$undef"
18332                 fi
18333         else
18334                 echo "sigsetjmp not found." >&4
18335                 val="$undef"
18336         fi
18337         ;;
18338 *) val="$d_sigsetjmp"
18339         case "$d_sigsetjmp" in
18340         $define) echo "POSIX sigsetjmp found." >&4;;
18341         $undef) echo "sigsetjmp not found." >&4;;
18342         esac
18343         ;;
18344 esac
18345 set d_sigsetjmp
18346 eval $setvar
18347 $rm_try
18348
18349 : see if snprintf exists
18350 set snprintf d_snprintf
18351 eval $inlibc
18352
18353 : see if vsnprintf exists
18354 set vsnprintf d_vsnprintf
18355 eval $inlibc
18356
18357 case "$d_snprintf-$d_vsnprintf" in
18358 "$define-$define")
18359     $cat <<EOM
18360 Checking whether your snprintf() and vsnprintf() work okay...
18361 EOM
18362     $cat >try.c <<'EOCP'
18363 /* v?snprintf testing logic courtesy of Russ Allbery.
18364  * According to C99:
18365  * - if the buffer is too short it still must be \0-terminated
18366  * - if the buffer is too short the potentially required length
18367  *   must be returned and not -1
18368  * - if the buffer is NULL the potentially required length
18369  *   must be returned and not -1 or core dump
18370  */
18371 #include <stdio.h>
18372 #include <stdarg.h>
18373
18374 char buf[2];
18375
18376 int test (char *format, ...)
18377 {
18378     va_list args;
18379     int count;
18380
18381     va_start (args, format);
18382     count = vsnprintf (buf, sizeof buf, format, args);
18383     va_end (args);
18384     return count;
18385 }
18386
18387 int main ()
18388 {
18389     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18390              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18391 }
18392 EOCP
18393     set try
18394     if eval $compile; then
18395         `$run ./try`
18396         case "$?" in
18397         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18398         *) cat <<EOM >&4
18399 Your snprintf() and snprintf() don't seem to be working okay.
18400 EOM
18401            d_snprintf="$undef"
18402            d_vsnprintf="$undef"
18403            ;;
18404         esac
18405     else
18406         echo "(I can't seem to compile the test program--assuming they don't)"
18407         d_snprintf="$undef"
18408         d_vsnprintf="$undef"
18409     fi
18410     $rm_try
18411     ;;
18412 esac
18413
18414 : see if sockatmark exists
18415 set sockatmark d_sockatmark
18416 eval $inlibc
18417
18418 : see if prototype for sockatmark is available
18419 echo " "
18420 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18421 eval $hasproto
18422
18423 : see if socks5_init exists
18424 set socks5_init d_socks5_init
18425 eval $inlibc
18426
18427 : see if sprintf returns the length of the string in the buffer as per ANSI
18428 $echo "Checking whether sprintf returns the length of the string..." >&4
18429 $cat <<EOP >try.c
18430 #include <stdio.h>
18431 #$i_stdlib I_STDLIB
18432 #ifdef I_STDLIB
18433 #include <stdlib.h>
18434 #endif
18435 #$i_string I_STRING
18436 #ifdef I_STRING
18437 #  include <string.h>
18438 #else
18439 #  include <strings.h>
18440 #endif
18441 #$i_math I_MATH
18442 #ifdef I_MATH
18443 #include <math.h>
18444 #endif
18445
18446 char buffer[256];
18447
18448 int check (size_t expect, int test) {
18449   size_t got = strlen(buffer);
18450   if (expect == got)
18451     return 0;
18452
18453   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18454        test, buffer);
18455   exit (test);
18456 }
18457
18458 int main(int argc, char **argv) {
18459   int test = 0;
18460
18461   check(sprintf(buffer, ""), ++test);
18462   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18463   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18464
18465   return 0;
18466 }
18467 EOP
18468 set try
18469
18470 if eval $compile; then
18471     xxx="`$run ./try`"
18472     case "$?" in
18473         0) cat >&4 <<EOM
18474 sprintf returns the length of the string (as ANSI says it should)
18475 EOM
18476         d_sprintf_returns_strlen="$define"
18477         ;;
18478         *) cat >&4 <<EOM
18479 sprintf does not return the length of the string (how old is this system?)
18480 EOM
18481         d_sprintf_returns_strlen="$undef"
18482         ;;
18483     esac
18484 else
18485     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18486     d_sprintf_returns_strlen="$undef"
18487 fi
18488 $rm_try
18489
18490 : see if srand48_r exists
18491 set srand48_r d_srand48_r
18492 eval $inlibc
18493 case "$d_srand48_r" in
18494 "$define")
18495         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18496         case "$d_srand48_r_proto:$usethreads" in
18497         ":define")      d_srand48_r_proto=define
18498                 set d_srand48_r_proto srand48_r $hdrs
18499                 eval $hasproto ;;
18500         *)      ;;
18501         esac
18502         case "$d_srand48_r_proto" in
18503         define)
18504         case "$srand48_r_proto" in
18505         ''|0) try='int srand48_r(long, struct drand48_data*);'
18506         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18507         esac
18508         case "$srand48_r_proto" in
18509         ''|0)   d_srand48_r=undef
18510                 srand48_r_proto=0
18511                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18512         * )     case "$srand48_r_proto" in
18513                 REENTRANT_PROTO*) ;;
18514                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18515                 esac
18516                 echo "Prototype: $try" ;;
18517         esac
18518         ;;
18519         *)      case "$usethreads" in
18520                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18521                 esac
18522                 d_srand48_r=undef
18523                 srand48_r_proto=0
18524                 ;;
18525         esac
18526         ;;
18527 *)      srand48_r_proto=0
18528         ;;
18529 esac
18530
18531 : see if srandom_r exists
18532 set srandom_r d_srandom_r
18533 eval $inlibc
18534 case "$d_srandom_r" in
18535 "$define")
18536         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18537         case "$d_srandom_r_proto:$usethreads" in
18538         ":define")      d_srandom_r_proto=define
18539                 set d_srandom_r_proto srandom_r $hdrs
18540                 eval $hasproto ;;
18541         *)      ;;
18542         esac
18543         case "$d_srandom_r_proto" in
18544         define)
18545         case "$srandom_r_proto" in
18546         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18547         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18548         esac
18549         case "$srandom_r_proto" in
18550         ''|0)   d_srandom_r=undef
18551                 srandom_r_proto=0
18552                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18553         * )     case "$srandom_r_proto" in
18554                 REENTRANT_PROTO*) ;;
18555                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18556                 esac
18557                 echo "Prototype: $try" ;;
18558         esac
18559         ;;
18560         *)      case "$usethreads" in
18561                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18562                 esac
18563                 d_srandom_r=undef
18564                 srandom_r_proto=0
18565                 ;;
18566         esac
18567         ;;
18568 *)      srandom_r_proto=0
18569         ;;
18570 esac
18571
18572 : see if prototype for setresgid is available
18573 echo " "
18574 set d_sresgproto setresgid $i_unistd unistd.h
18575 eval $hasproto
18576
18577 : see if prototype for setresuid is available
18578 echo " "
18579 set d_sresuproto setresuid $i_unistd unistd.h
18580 eval $hasproto
18581
18582 : see if sys/stat.h is available
18583 set sys/stat.h i_sysstat
18584 eval $inhdr
18585
18586 : see if stat knows about block sizes
18587 echo " "
18588 echo "Checking to see if your struct stat has st_blocks field..." >&4
18589 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18590 eval $hasfield
18591
18592 : see if this is a sys/vfs.h system
18593 set sys/vfs.h i_sysvfs
18594 eval $inhdr
18595
18596 : see if this is a sys/statfs.h system
18597 set sys/statfs.h i_sysstatfs
18598 eval $inhdr
18599
18600 : Check for statfs_s
18601 echo " "
18602 echo "Checking to see if your system supports struct statfs..." >&4
18603 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
18604 eval $hasstruct
18605 case "$d_statfs_s" in
18606 "$define")      echo "Yes, it does."   ;;
18607 *)              echo "No, it doesn't." ;;
18608 esac
18609
18610
18611 : see if struct statfs knows about f_flags
18612 case "$d_statfs_s" in
18613 define)
18614         echo " "
18615         echo "Checking to see if your struct statfs has f_flags field..." >&4
18616         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
18617         eval $hasfield
18618         ;;
18619 *)      val="$undef"
18620         set d_statfs_f_flags
18621         eval $setvar
18622         ;;
18623 esac
18624 case "$d_statfs_f_flags" in
18625 "$define")      echo "Yes, it does."   ;;
18626 *)              echo "No, it doesn't." ;;
18627 esac
18628
18629 : see what flavor, if any, of static inline is supported
18630 echo " "
18631 echo "Checking to see if your system supports static inline..."
18632 $cat > try.c <<'EOCP'
18633 #include <stdlib.h>
18634 extern int f_via_a(int x);
18635 extern int f_via_b(int x);
18636 int main(int argc, char **argv)
18637 {
18638     int y;
18639
18640     y = f_via_a(0);
18641 #ifdef USE_B
18642     y = f_via_b(0);
18643 #endif
18644     if (y == 42) {
18645         return EXIT_SUCCESS;
18646     }
18647     else {
18648         return EXIT_FAILURE;
18649     }
18650 }
18651 EOCP
18652 $cat > a.c <<'EOCP'
18653 static INLINE int f(int x) {
18654     int y;
18655     y = x + 42;
18656     return y;
18657 }
18658
18659 int f_via_a(int x)
18660 {
18661     return f(x);
18662 }
18663 EOCP
18664 $cat > b.c <<'EOCP'
18665 extern int f(int x);
18666
18667 int f_via_b(int x)
18668 {
18669     return f(x);
18670 }
18671 EOCP
18672
18673 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18674 case "$perl_static_inline" in
18675 '')     # Check the various possibilities, and break out on success.
18676         # For gcc, prefer __inline__, which will still permit
18677         # cflags.SH to add in -ansi.
18678         case "$gccversion" in
18679                 '') xxx="inline __inline__ __inline _inline";;
18680                 *)  xxx="__inline__ inline __inline _inline";;
18681         esac
18682         for inline in $xxx; do
18683                 set try -DINLINE=$inline a.c
18684                 if eval $compile && $run ./try; then
18685                         # Now make sure there is no external linkage of static
18686                         # functions
18687                         set try -DINLINE=$inline -DUSE_B a.c b.c
18688                         if eval $compile && $run ./try; then
18689                                 $echo "Your compiler supports static $inline, " >&4
18690                                 $echo "but it also creates an external definition," >&4
18691                                 $echo "so I won't use it." >&4
18692                                 val=$undef
18693                         else
18694                                 $echo "Your compiler supports static $inline." >&4
18695                                 val=$define
18696                                 perl_static_inline="static $inline";
18697                                 break;
18698                         fi
18699                 else
18700                         $echo "Your compiler does NOT support static $inline." >&4
18701                         val="$undef"
18702                 fi
18703         done
18704         ;;
18705 *inline*) # Some variant of inline exists.
18706         echo "Keeping your $hint value of $perl_static_inline."
18707         val=$define
18708         ;;
18709 static)  # No inline capabilities
18710         echo "Keeping your $hint value of $perl_static_inline."
18711         val=$undef
18712         ;;
18713 *)  # Unrecognized previous value -- blindly trust the supplied
18714         # value and hope it makes sense.  Use old value for
18715         # d_static_inline, if there is one.
18716         echo "Keeping your $hint value of $perl_static_inline."
18717         case "$d_static_inline" in
18718                 '') val=$define ;;
18719                 *)  val=$d_static_inline ;;
18720         esac
18721         ;;
18722 esac
18723 # Fallback to plain 'static' if nothing worked.
18724 case "$perl_static_inline" in
18725 '')
18726         perl_static_inline="static"
18727         val=$undef
18728         ;;
18729 esac
18730 set d_static_inline
18731 eval $setvar
18732 $rm -f a.[co] b.[co]
18733 $rm_try
18734
18735 : Check stream access
18736 $cat >&4 <<EOM
18737 Checking how to access stdio streams by file descriptor number...
18738 EOM
18739 case "$stdio_stream_array" in
18740 '')     $cat >try.c <<EOCP
18741 #include <stdio.h>
18742 int main() {
18743   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18744     printf("yes\n");
18745 }
18746 EOCP
18747         for s in _iob __iob __sF
18748         do
18749                 set try -DSTDIO_STREAM_ARRAY=$s
18750                 if eval $compile; then
18751                         case "`$run ./try`" in
18752                         yes)    stdio_stream_array=$s; break ;;
18753                         esac
18754                 fi
18755         done
18756         $rm_try
18757 esac
18758 case "$stdio_stream_array" in
18759 '')     $cat >&4 <<EOM
18760 I can't figure out how to access stdio streams by file descriptor number.
18761 EOM
18762         d_stdio_stream_array="$undef"
18763         ;;
18764 *)      $cat >&4 <<EOM
18765 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18766 EOM
18767         d_stdio_stream_array="$define"
18768         ;;
18769 esac
18770
18771 : see if strcoll exists
18772 set strcoll d_strcoll
18773 eval $inlibc
18774
18775 : check for structure copying
18776 echo " "
18777 echo "Checking to see if your C compiler can copy structs..." >&4
18778 $cat >try.c <<'EOCP'
18779 int main()
18780 {
18781         struct blurfl {
18782                 int dyick;
18783         } foo, bar;
18784
18785         foo = bar;
18786 }
18787 EOCP
18788 if $cc -c try.c >/dev/null 2>&1 ; then
18789         val="$define"
18790         echo "Yup, it can."
18791 else
18792         val="$undef"
18793         echo "Nope, it can't."
18794 fi
18795 set d_strctcpy
18796 eval $setvar
18797 $rm_try
18798
18799 : see if strerror and/or sys_errlist[] exist
18800 echo " "
18801 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18802     if set strerror val -f d_strerror; eval $csym; $val; then
18803                 echo 'strerror() found.' >&4
18804                 d_strerror="$define"
18805                 d_strerrm='strerror(e)'
18806                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18807                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18808                         d_syserrlst="$define"
18809                 else
18810                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18811                         d_syserrlst="$undef"
18812                 fi
18813     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18814                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18815                 echo 'strerror() found in string header.' >&4
18816                 d_strerror="$define"
18817                 d_strerrm='strerror(e)'
18818                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18819                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18820                                 d_syserrlst="$define"
18821                 else
18822                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18823                         d_syserrlst="$undef"
18824                 fi
18825     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18826                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18827                 d_strerror="$undef"
18828                 d_syserrlst="$define"
18829                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18830     else
18831                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18832                 d_strerror="$undef"
18833                 d_syserrlst="$undef"
18834                 d_strerrm='"unknown"'
18835     fi
18836 fi
18837
18838 : see if strerror_r exists
18839 set strerror_r d_strerror_r
18840 eval $inlibc
18841 case "$d_strerror_r" in
18842 "$define")
18843         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18844         case "$d_strerror_r_proto:$usethreads" in
18845         ":define")      d_strerror_r_proto=define
18846                 set d_strerror_r_proto strerror_r $hdrs
18847                 eval $hasproto ;;
18848         *)      ;;
18849         esac
18850         case "$d_strerror_r_proto" in
18851         define)
18852         case "$strerror_r_proto" in
18853         ''|0) try='int strerror_r(int, char*, size_t);'
18854         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18855         esac
18856         case "$strerror_r_proto" in
18857         ''|0) try='int strerror_r(int, char*, int);'
18858         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18859         esac
18860         case "$strerror_r_proto" in
18861         ''|0) try='char* strerror_r(int, char*, size_t);'
18862         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18863         esac
18864         case "$strerror_r_proto" in
18865         ''|0)   d_strerror_r=undef
18866                 strerror_r_proto=0
18867                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18868         * )     case "$strerror_r_proto" in
18869                 REENTRANT_PROTO*) ;;
18870                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18871                 esac
18872                 echo "Prototype: $try" ;;
18873         esac
18874         ;;
18875         *)      case "$usethreads" in
18876                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18877                 esac
18878                 d_strerror_r=undef
18879                 strerror_r_proto=0
18880                 ;;
18881         esac
18882         ;;
18883 *)      strerror_r_proto=0
18884         ;;
18885 esac
18886
18887 : see if strftime exists
18888 set strftime d_strftime
18889 eval $inlibc
18890
18891 : see if strlcat exists
18892 set strlcat d_strlcat
18893 eval $inlibc
18894
18895 : see if strlcpy exists
18896 set strlcpy d_strlcpy
18897 eval $inlibc
18898
18899 : see if strtod exists
18900 set strtod d_strtod
18901 eval $inlibc
18902
18903 : see if strtol exists
18904 set strtol d_strtol
18905 eval $inlibc
18906
18907 : see if strtold exists
18908 set strtold d_strtold
18909 eval $inlibc
18910
18911 : see if strtoll exists
18912 set strtoll d_strtoll
18913 eval $inlibc
18914
18915 case "$d_longlong-$d_strtoll" in
18916 "$define-$define")
18917         $cat <<EOM
18918 Checking whether your strtoll() works okay...
18919 EOM
18920         $cat >try.c <<'EOCP'
18921 #include <errno.h>
18922 #ifdef __hpux
18923 #define strtoll __strtoll
18924 #endif
18925 #ifdef __EMX__
18926 #define strtoll _strtoll
18927 #endif
18928 #include <stdio.h>
18929 extern long long int strtoll(char *s, char **, int);
18930 static int bad = 0;
18931 int check(char *s, long long ell, int een) {
18932         long long gll;
18933         errno = 0;
18934         gll = strtoll(s, 0, 10);
18935         if (!((gll == ell) && (errno == een)))
18936                 bad++;
18937 }
18938 int main() {
18939         check(" 1",                                      1LL, 0);
18940         check(" 0",                                      0LL, 0);
18941         check("-1",                                     -1LL, 0);
18942         check("-9223372036854775808", -9223372036854775808LL, 0);
18943         check("-9223372036854775808", -9223372036854775808LL, 0);
18944         check(" 9223372036854775807",  9223372036854775807LL, 0);
18945         check("-9223372036854775808", -9223372036854775808LL, 0);
18946         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18947         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18948         if (!bad)
18949                 printf("ok\n");
18950 }
18951 EOCP
18952         set try
18953         if eval $compile; then
18954                 yyy=`$run ./try`
18955                 case "$yyy" in
18956                 ok) echo "Your strtoll() seems to be working okay." ;;
18957                 *) cat <<EOM >&4
18958 Your strtoll() doesn't seem to be working okay.
18959 EOM
18960                    d_strtoll="$undef"
18961                    ;;
18962                 esac
18963         else
18964                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18965                 d_strtoll="$undef"
18966         fi
18967         ;;
18968 esac
18969
18970 : see if strtoq exists
18971 set strtoq d_strtoq
18972 eval $inlibc
18973
18974 : see if strtoul exists
18975 set strtoul d_strtoul
18976 eval $inlibc
18977
18978 case "$d_strtoul" in
18979 "$define")
18980         $cat <<EOM
18981 Checking whether your strtoul() works okay...
18982 EOM
18983         $cat >try.c <<'EOCP'
18984 #include <errno.h>
18985 #include <stdio.h>
18986 extern unsigned long int strtoul(char *s, char **, int);
18987 static int bad = 0;
18988 void check(char *s, unsigned long eul, int een) {
18989         unsigned long gul;
18990         errno = 0;
18991         gul = strtoul(s, 0, 10);
18992         if (!((gul == eul) && (errno == een)))
18993                 bad++;
18994 }
18995 int main() {
18996         check(" 1", 1L, 0);
18997         check(" 0", 0L, 0);
18998 EOCP
18999         case "$longsize" in
19000         8)
19001             $cat >>try.c <<'EOCP'
19002         check("18446744073709551615", 18446744073709551615UL, 0);
19003         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19004 #if 0 /* strtoul() for /^-/ strings is undefined. */
19005         check("-1", 18446744073709551615UL, 0);
19006         check("-18446744073709551614", 2, 0);
19007         check("-18446744073709551615", 1, 0);
19008         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19009         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19010 #endif
19011 EOCP
19012                 ;;
19013         4)
19014                     $cat >>try.c <<'EOCP'
19015         check("4294967295", 4294967295UL, 0);
19016         check("4294967296", 4294967295UL, ERANGE);
19017 #if 0 /* strtoul() for /^-/ strings is undefined. */
19018         check("-1", 4294967295UL, 0);
19019         check("-4294967294", 2, 0);
19020         check("-4294967295", 1, 0);
19021         check("-4294967296", 4294967295UL, ERANGE);
19022         check("-4294967297", 4294967295UL, ERANGE);
19023 #endif
19024 EOCP
19025                 ;;
19026         *)
19027 : Should we write these tests to be more portable by sprintf-ing
19028 : ~0 and then manipulating that char string as input for strtol?
19029                 ;;
19030         esac
19031         $cat >>try.c <<'EOCP'
19032         if (!bad)
19033                 printf("ok\n");
19034         return 0;
19035 }
19036 EOCP
19037         set try
19038         if eval $compile; then
19039                 case "`$run ./try`" in
19040                 ok) echo "Your strtoul() seems to be working okay." ;;
19041                 *) cat <<EOM >&4
19042 Your strtoul() doesn't seem to be working okay.
19043 EOM
19044                    d_strtoul="$undef"
19045                    ;;
19046                 esac
19047         else
19048                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19049                 d_strtoul="$undef"
19050         fi
19051         ;;
19052 esac
19053
19054 : see if strtoull exists
19055 set strtoull d_strtoull
19056 eval $inlibc
19057
19058 case "$d_longlong-$d_strtoull" in
19059 "$define-$define")
19060         $cat <<EOM
19061 Checking whether your strtoull() works okay...
19062 EOM
19063         $cat >try.c <<'EOCP'
19064 #include <errno.h>
19065 #ifdef __hpux
19066 #define strtoull __strtoull
19067 #endif
19068 #include <stdio.h>
19069 extern unsigned long long int strtoull(char *s, char **, int);
19070 static int bad = 0;
19071 int check(char *s, long long eull, int een) {
19072         long long gull;
19073         errno = 0;
19074         gull = strtoull(s, 0, 10);
19075         if (!((gull == eull) && (errno == een)))
19076                 bad++;
19077 }
19078 int main() {
19079         check(" 1",                                        1LL, 0);
19080         check(" 0",                                        0LL, 0);
19081         check("18446744073709551615",  18446744073709551615ULL, 0);
19082         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19083 #if 0 /* strtoull() for /^-/ strings is undefined. */
19084         check("-1",                    18446744073709551615ULL, 0);
19085         check("-18446744073709551614",                     2LL, 0);
19086         check("-18446744073709551615",                     1LL, 0);
19087         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19088         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19089 #endif
19090         if (!bad)
19091                 printf("ok\n");
19092 }
19093 EOCP
19094         set try
19095         if eval $compile; then
19096                 case "`$run ./try`" in
19097                 ok) echo "Your strtoull() seems to be working okay." ;;
19098                 *) cat <<EOM >&4
19099 Your strtoull() doesn't seem to be working okay.
19100 EOM
19101                    d_strtoull="$undef"
19102                    ;;
19103                 esac
19104         else
19105                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19106                 d_strtoull="$undef"
19107         fi
19108         ;;
19109 esac
19110
19111 : see if strtouq exists
19112 set strtouq d_strtouq
19113 eval $inlibc
19114
19115 case "$d_strtouq" in
19116 "$define")
19117         $cat <<EOM
19118 Checking whether your strtouq() works okay...
19119 EOM
19120         $cat >try.c <<'EOCP'
19121 #include <errno.h>
19122 #include <stdio.h>
19123 extern unsigned long long int strtouq(char *s, char **, int);
19124 static int bad = 0;
19125 void check(char *s, unsigned long long eull, int een) {
19126         unsigned long long gull;
19127         errno = 0;
19128         gull = strtouq(s, 0, 10);
19129         if (!((gull == eull) && (errno == een)))
19130                 bad++;
19131 }
19132 int main() {
19133         check(" 1",                                        1LL, 0);
19134         check(" 0",                                        0LL, 0);
19135         check("18446744073709551615",  18446744073709551615ULL, 0);
19136         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19137 #if 0 /* strtouq() for /^-/ strings is undefined. */
19138         check("-1",                    18446744073709551615ULL, 0);
19139         check("-18446744073709551614",                     2LL, 0);
19140         check("-18446744073709551615",                     1LL, 0);
19141         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19142         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19143 #endif
19144         if (!bad)
19145                 printf("ok\n");
19146         return 0;
19147 }
19148 EOCP
19149         set try
19150         if eval $compile; then
19151                 case "`$run ./try`" in
19152                 ok) echo "Your strtouq() seems to be working okay." ;;
19153                 *) cat <<EOM >&4
19154 Your strtouq() doesn't seem to be working okay.
19155 EOM
19156                    d_strtouq="$undef"
19157                    ;;
19158                 esac
19159         else
19160                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19161                 d_strtouq="$undef"
19162         fi
19163         ;;
19164 esac
19165
19166 : see if strxfrm exists
19167 set strxfrm d_strxfrm
19168 eval $inlibc
19169
19170 : see if symlink exists
19171 set symlink d_symlink
19172 eval $inlibc
19173
19174 : see if syscall exists
19175 set syscall d_syscall
19176 eval $inlibc
19177
19178 : see if prototype for syscall is available
19179 echo " "
19180 set d_syscallproto syscall $i_unistd unistd.h
19181 eval $hasproto
19182
19183 : see if sysconf exists
19184 set sysconf d_sysconf
19185 eval $inlibc
19186
19187 : see if system exists
19188 set system d_system
19189 eval $inlibc
19190
19191 : see if tcgetpgrp exists
19192 set tcgetpgrp d_tcgetpgrp
19193 eval $inlibc
19194
19195 : see if tcsetpgrp exists
19196 set tcsetpgrp d_tcsetpgrp
19197 eval $inlibc
19198
19199 : see if prototype for telldir is available
19200 echo " "
19201 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19202 eval $hasproto
19203
19204 : see if time exists
19205 echo " "
19206 if test "X$d_time" = X -o X"$timetype" = X; then
19207     if set time val -f d_time; eval $csym; $val; then
19208                 echo 'time() found.' >&4
19209                 val="$define"
19210                 rp="What is the type returned by time() on this system?"
19211                 set time_t timetype long stdio.h sys/types.h
19212                 eval $typedef_ask
19213     else
19214                 echo 'time() not found, hope that will do.' >&4
19215                 val="$undef"
19216                 timetype='int';
19217     fi
19218     set d_time
19219     eval $setvar
19220 fi
19221
19222 : see if timegm exists
19223 set timegm d_timegm
19224 eval $inlibc
19225
19226 : see if this is a sys/times.h system
19227 set sys/times.h i_systimes
19228 eval $inhdr
19229
19230 : see if times exists
19231 echo " "
19232 if set times val -f d_times; eval $csym; $val; then
19233         echo 'times() found.' >&4
19234         d_times="$define"
19235         inc=''
19236         case "$i_systimes" in
19237         "$define") inc='sys/times.h';;
19238         esac
19239         rp="What is the type returned by times() on this system?"
19240         set clock_t clocktype long stdio.h sys/types.h $inc
19241         eval $typedef_ask
19242 else
19243         echo 'times() NOT found, hope that will do.' >&4
19244         d_times="$undef"
19245         clocktype='int'
19246 fi
19247
19248 : see if tmpnam_r exists
19249 set tmpnam_r d_tmpnam_r
19250 eval $inlibc
19251 case "$d_tmpnam_r" in
19252 "$define")
19253         hdrs="$i_systypes sys/types.h define stdio.h "
19254         case "$d_tmpnam_r_proto:$usethreads" in
19255         ":define")      d_tmpnam_r_proto=define
19256                 set d_tmpnam_r_proto tmpnam_r $hdrs
19257                 eval $hasproto ;;
19258         *)      ;;
19259         esac
19260         case "$d_tmpnam_r_proto" in
19261         define)
19262         case "$tmpnam_r_proto" in
19263         ''|0) try='char* tmpnam_r(char*);'
19264         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19265         esac
19266         case "$tmpnam_r_proto" in
19267         ''|0)   d_tmpnam_r=undef
19268                 tmpnam_r_proto=0
19269                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19270         * )     case "$tmpnam_r_proto" in
19271                 REENTRANT_PROTO*) ;;
19272                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19273                 esac
19274                 echo "Prototype: $try" ;;
19275         esac
19276         ;;
19277         *)      case "$usethreads" in
19278                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19279                 esac
19280                 d_tmpnam_r=undef
19281                 tmpnam_r_proto=0
19282                 ;;
19283         esac
19284         ;;
19285 *)      tmpnam_r_proto=0
19286         ;;
19287 esac
19288
19289 : see if truncate exists
19290 set truncate d_truncate
19291 eval $inlibc
19292
19293 : see if ttyname_r exists
19294 set ttyname_r d_ttyname_r
19295 eval $inlibc
19296 case "$d_ttyname_r" in
19297 "$define")
19298         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19299         case "$d_ttyname_r_proto:$usethreads" in
19300         ":define")      d_ttyname_r_proto=define
19301                 set d_ttyname_r_proto ttyname_r $hdrs
19302                 eval $hasproto ;;
19303         *)      ;;
19304         esac
19305         case "$d_ttyname_r_proto" in
19306         define)
19307         case "$ttyname_r_proto" in
19308         ''|0) try='int ttyname_r(int, char*, size_t);'
19309         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19310         esac
19311         case "$ttyname_r_proto" in
19312         ''|0) try='int ttyname_r(int, char*, int);'
19313         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19314         esac
19315         case "$ttyname_r_proto" in
19316         ''|0) try='char* ttyname_r(int, char*, int);'
19317         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19318         esac
19319         case "$ttyname_r_proto" in
19320         ''|0)   d_ttyname_r=undef
19321                 ttyname_r_proto=0
19322                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19323         * )     case "$ttyname_r_proto" in
19324                 REENTRANT_PROTO*) ;;
19325                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19326                 esac
19327                 echo "Prototype: $try" ;;
19328         esac
19329         ;;
19330         *)      case "$usethreads" in
19331                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19332                 esac
19333                 d_ttyname_r=undef
19334                 ttyname_r_proto=0
19335                 ;;
19336         esac
19337         ;;
19338 *)      ttyname_r_proto=0
19339         ;;
19340 esac
19341
19342 : see if tzname[] exists
19343 echo " "
19344 if set tzname val -a d_tzname; eval $csym; $val; then
19345         val="$define"
19346         echo 'tzname[] found.' >&4
19347 else
19348         val="$undef"
19349         echo 'tzname[] NOT found.' >&4
19350 fi
19351 set d_tzname
19352 eval $setvar
19353
19354 : Check if is a multiplatform env
19355 case "$osname" in
19356 darwin) multiarch="$define" ;;
19357 esac
19358 case "$multiarch" in
19359 ''|[nN]*) multiarch="$undef" ;;
19360 esac
19361
19362 : check for ordering of bytes in a UV
19363 echo " "
19364 case "$multiarch" in
19365 *$define*)
19366         $cat <<EOM
19367 You seem to be doing a multiarchitecture build,
19368 skipping the byteorder check.
19369
19370 EOM
19371         byteorder='ffff'
19372         ;;
19373 *)
19374         case "$byteorder" in
19375         '')
19376                 $cat <<'EOM'
19377 In the following, larger digits indicate more significance.  A big-endian
19378 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19379 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19380 machines may have weird orders like 3412.  A Cray will report 87654321,
19381 an Alpha will report 12345678. If the test program works the default is
19382 probably right.
19383 I'm now running the test program...
19384 EOM
19385                 $cat >try.c <<EOCP
19386 #include <stdio.h>
19387 #$i_stdlib I_STDLIB
19388 #ifdef I_STDLIB
19389 #include <stdlib.h>
19390 #endif
19391 #include <sys/types.h>
19392 typedef $uvtype UV;
19393 int main()
19394 {
19395         int i;
19396         union {
19397                 UV l;
19398                 char c[$uvsize];
19399         } u;
19400
19401         if ($uvsize > 4)
19402                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19403         else
19404                 u.l = (UV)0x04030201;
19405         for (i = 0; i < $uvsize; i++)
19406                 printf("%c", u.c[i]+'0');
19407         printf("\n");
19408         exit(0);
19409 }
19410 EOCP
19411                 xxx_prompt=y
19412                 set try
19413                 if eval $compile && $run ./try > /dev/null; then
19414                         dflt=`$run ./try`
19415                         case "$dflt" in
19416                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19417                                 echo "(The test program ran ok.)"
19418                                 echo "byteorder=$dflt"
19419                                 xxx_prompt=n
19420                         ;;
19421                         ????|????????) echo "(The test program ran ok.)" ;;
19422                         *) echo "(The test program didn't run right for some reason.)" ;;
19423                         esac
19424                 else
19425                         dflt='4321'
19426                         cat <<'EOM'
19427 (I can't seem to compile the test program.  Guessing big-endian...)
19428 EOM
19429                 fi
19430                 case "$xxx_prompt" in
19431                 y)
19432                         rp="What is the order of bytes in $uvtype?"
19433                         . ./myread
19434                         byteorder="$ans"
19435                         ;;
19436                 *)      byteorder=$dflt
19437                         ;;
19438                 esac
19439                 ;;
19440         esac
19441         $rm_try
19442         ;;
19443 esac
19444
19445 : Checking 32bit alignedness
19446 $cat <<EOM
19447
19448 Checking to see whether you can access character data unalignedly...
19449 EOM
19450 case "$d_u32align" in
19451 '')   $cat >try.c <<EOCP
19452 #include <stdio.h>
19453 #$i_stdlib I_STDLIB
19454 #ifdef I_STDLIB
19455 #include <stdlib.h>
19456 #endif
19457 #define U32 $u32type
19458 #define BYTEORDER 0x$byteorder
19459 #define U8 $u8type
19460 #include <signal.h>
19461 #ifdef SIGBUS
19462 $signal_t bletch(int s) { exit(4); }
19463 #endif
19464 int main() {
19465 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19466     volatile U8 buf[8];
19467     volatile U32 *up;
19468     int i;
19469
19470     if (sizeof(U32) != 4) {
19471         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19472         exit(1);
19473     }
19474
19475     fflush(stdout);
19476
19477 #ifdef SIGBUS
19478     signal(SIGBUS, bletch);
19479 #endif
19480
19481     buf[0] = 0;
19482     buf[1] = 0;
19483     buf[2] = 0;
19484     buf[3] = 1;
19485     buf[4] = 0;
19486     buf[5] = 0;
19487     buf[6] = 0;
19488     buf[7] = 1;
19489
19490     for (i = 0; i < 4; i++) {
19491         up = (U32*)(buf + i);
19492         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19493                (*up == 1 << (8*(3-i)))  /* little-endian */
19494               )
19495            )
19496         {
19497             printf("read failed (%x)\n", *up);
19498             exit(2);
19499         }
19500     }
19501
19502     /* write test */
19503     for (i = 0; i < 4; i++) {
19504         up = (U32*)(buf + i);
19505         *up = 0xBeef;
19506         if (*up != 0xBeef) {
19507             printf("write failed (%x)\n", *up);
19508             exit(3);
19509         }
19510     }
19511
19512     exit(0);
19513 #else
19514     printf("1\n");
19515     exit(1);
19516 #endif
19517     return 0;
19518 }
19519 EOCP
19520 set try
19521 if eval $compile_ok; then
19522         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19523         $run ./try 2>&1 >/dev/null
19524         case "$?" in
19525         0)      cat >&4 <<EOM
19526 You can access character data pretty unalignedly.
19527 EOM
19528                 d_u32align="$undef"
19529                 ;;
19530         *)      cat >&4 <<EOM
19531 It seems that you must access character data in an aligned manner.
19532 EOM
19533                 d_u32align="$define"
19534                 ;;
19535         esac
19536 else
19537         rp='Can you access character data at unaligned addresses?'
19538         dflt='n'
19539         . ./myread
19540         case "$ans" in
19541         [yY]*)  d_u32align="$undef"  ;;
19542         *)      d_u32align="$define" ;;
19543         esac
19544 fi
19545 $rm_try
19546 ;;
19547 esac
19548
19549 : see if ualarm exists
19550 set ualarm d_ualarm
19551 eval $inlibc
19552
19553 : see if umask exists
19554 set umask d_umask
19555 eval $inlibc
19556
19557 : see if unordered exists
19558 set unordered d_unordered
19559 eval $inlibc
19560
19561 : see if unsetenv exists
19562 set unsetenv d_unsetenv
19563 eval $inlibc
19564
19565 : see if usleep exists
19566 set usleep d_usleep
19567 eval $inlibc
19568
19569 : see if prototype for usleep is available
19570 echo " "
19571 set d_usleepproto usleep $i_unistd unistd.h
19572 eval $hasproto
19573
19574 : see if ustat exists
19575 set ustat d_ustat
19576 eval $inlibc
19577
19578 : see if closedir exists
19579 set closedir d_closedir
19580 eval $inlibc
19581
19582 case "$d_closedir" in
19583 "$define")
19584         echo " "
19585         echo "Checking whether closedir() returns a status..." >&4
19586         cat > try.c <<EOM
19587 #$i_dirent I_DIRENT             /**/
19588 #$i_sysdir I_SYS_DIR            /**/
19589 #$i_sysndir I_SYS_NDIR          /**/
19590 #$i_systypes I_SYS_TYPES        /**/
19591
19592 #if defined(I_SYS_TYPES)
19593 #include <sys/types.h>
19594 #endif
19595 #if defined(I_DIRENT)
19596 #include <dirent.h>
19597 #else
19598 #ifdef I_SYS_NDIR
19599 #include <sys/ndir.h>
19600 #else
19601 #ifdef I_SYS_DIR
19602 #ifdef hp9000s500
19603 #include <ndir.h>       /* may be wrong in the future */
19604 #else
19605 #include <sys/dir.h>
19606 #endif
19607 #endif
19608 #endif
19609 #endif
19610 int main() { return closedir(opendir(".")); }
19611 EOM
19612         set try
19613         if eval $compile_ok; then
19614                 if $run ./try > /dev/null 2>&1 ; then
19615                         echo "Yes, it does."
19616                         val="$undef"
19617                 else
19618                         echo "No, it doesn't."
19619                         val="$define"
19620                 fi
19621         else
19622                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19623                 val="$define"
19624         fi
19625         ;;
19626 *)
19627         val="$undef";
19628         ;;
19629 esac
19630 set d_void_closedir
19631 eval $setvar
19632 $rm_try
19633
19634 : see if there is a wait4
19635 set wait4 d_wait4
19636 eval $inlibc
19637
19638 : see if waitpid exists
19639 set waitpid d_waitpid
19640 eval $inlibc
19641
19642 : look for wcscmp
19643 echo " "
19644 $cat >try.c <<'EOCP'
19645 #include <stdio.h>
19646 #include <wchar.h>
19647 int main ()
19648 {
19649     wchar_t *s = L" ";
19650     return (wcscmp (s, s) ? 1 : 0);
19651     }
19652 EOCP
19653 set try
19654 val="$undef"
19655 if eval $compile; then
19656     `$run ./try`
19657     case "$?" in
19658         0)  echo "A working wcscmp() found." >&4
19659             val="$define" ;;
19660         *)  echo "wcscmp() found, but it doesn't work" >&4
19661             ;;
19662         esac
19663 else
19664     echo "wcscmp() NOT found." >&4
19665     fi
19666 set d_wcscmp
19667 eval $setvar
19668 $rm_try
19669
19670 : see if wcstombs exists
19671 set wcstombs d_wcstombs
19672 eval $inlibc
19673
19674 : look for wcsxfrm
19675 echo " "
19676 $cat >try.c <<'EOCP'
19677 #include <errno.h>
19678 #include <wchar.h>
19679 int main ()
19680 {
19681     wchar_t dst[4], *src = L" ";
19682     errno = 0;
19683     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19684     }
19685 EOCP
19686 set try
19687 val="$undef"
19688 if eval $compile; then
19689     `$run ./try`
19690     case "$?" in
19691         0)  echo "A working wcsxfrm() found." >&4
19692             val="$define" ;;
19693         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19694             ;;
19695         esac
19696 else
19697     echo "wcsxfrm() NOT found." >&4
19698     fi
19699 set d_wcsxfrm
19700 eval $setvar
19701 $rm_try
19702
19703 : see if wctomb exists
19704 set wctomb d_wctomb
19705 eval $inlibc
19706
19707 : see if writev exists
19708 set writev d_writev
19709 eval $inlibc
19710
19711 : check for alignment requirements
19712 echo " "
19713 case "$alignbytes" in
19714     '') echo "Checking alignment constraints..." >&4
19715         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19716             $cat >try.c <<'EOCP'
19717 typedef long double NV;
19718 EOCP
19719         else
19720             $cat >try.c <<'EOCP'
19721 typedef double NV;
19722 EOCP
19723         fi
19724         $cat >>try.c <<'EOCP'
19725 #include <stdio.h>
19726 struct foobar {
19727     char foo;
19728     NV bar;
19729 } try_algn;
19730 int main()
19731 {
19732     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19733     return(0);
19734 }
19735 EOCP
19736         set try
19737         if eval $compile_ok; then
19738             dflt=`$run ./try`
19739         else
19740             dflt='8'
19741             echo "(I can't seem to compile the test program...)"
19742         fi
19743         case "$multiarch" in
19744             *$define*)
19745                 : The usual safe value is 8, but Darwin with -Duselongdouble
19746                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19747                 : Configure to pick a larger value if needed.
19748                 if $test "$dflt" -lt 8; then
19749                     dflt='8'
19750                     echo "Setting alignment to 8 for multiarch support.">&4
19751                 fi
19752                 ;;
19753         esac
19754         ;;
19755     *) dflt="$alignbytes"
19756         ;;
19757 esac
19758 rp="Doubles must be aligned on a how-many-byte boundary?"
19759 . ./myread
19760 alignbytes="$ans"
19761 $rm_try
19762
19763 : set the base revision
19764 baserev=5.0
19765
19766 : length of character in bytes. Is always 1, otherwise it is not C
19767 : This used to be a test using sizeof
19768 charsize=1
19769
19770 : Check for the number of bits in a character
19771 case "$charbits" in
19772 '')     echo "Checking how long a character is (in bits)..." >&4
19773         $cat >try.c <<EOCP
19774 #include <stdio.h>
19775 int main ()
19776 {
19777     int n;
19778     unsigned char c;
19779     for (c = 1, n = 0; c; c <<= 1, n++) ;
19780     printf ("%d\n", n);
19781     return (0);
19782     }
19783 EOCP
19784         set try
19785         if eval $compile_ok; then
19786                 dflt=`$run ./try`
19787         else
19788                 dflt='8'
19789                 echo "(I can't seem to compile the test program.  Guessing...)"
19790         fi
19791         ;;
19792 *)
19793         dflt="$charbits"
19794         ;;
19795 esac
19796 rp="What is the length of a character (in bits)?"
19797 . ./myread
19798 charbits="$ans"
19799 $rm_try
19800 case "$charbits" in
19801 8)      ;;
19802 *)      cat >&4 << EOM
19803 Your system has an unsigned character size of $charbits bits, which
19804 is rather unusual (normally it is 8 bits).  Perl likely will not work
19805 correctly on your system, with subtle bugs in various places.
19806 EOM
19807         rp='Do you really want to continue?'
19808         dflt='n'
19809         . ./myread
19810         case "$ans" in
19811                 [yY])   echo >&4 "Okay, continuing."    ;;
19812                 *)      exit 1                          ;;
19813         esac
19814 esac
19815
19816 : how do we concatenate cpp tokens here?
19817 echo " "
19818 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19819 $cat >cpp_stuff.c <<'EOCP'
19820 #define RCAT(a,b)a/**/b
19821 #define ACAT(a,b)a ## b
19822 RCAT(Rei,ser)
19823 ACAT(Cir,cus)
19824 EOCP
19825 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19826 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19827         echo "Oh!  Smells like ANSI's been here." >&4
19828         echo "We can catify or stringify, separately or together!"
19829         cpp_stuff=42
19830 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19831         echo "Ah, yes!  The good old days!" >&4
19832         echo "However, in the good old days we don't know how to stringify and"
19833         echo "catify at the same time."
19834         cpp_stuff=1
19835 else
19836         $cat >&4 <<EOM
19837 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19838 You're going to have to edit the values of CAT[2-5] in config.h...
19839 EOM
19840         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19841 fi
19842 $rm -f cpp_stuff.*
19843
19844 : see if this is a db.h system
19845 set db.h i_db
19846 eval $inhdr
19847
19848 case "$i_db" in
19849 $define)
19850         : Check db version.
19851         echo " "
19852         echo "Checking Berkeley DB version ..." >&4
19853         $cat >try.c <<EOCP
19854 #$d_const HASCONST
19855 #ifndef HASCONST
19856 #define const
19857 #endif
19858 #include <sys/types.h>
19859 #include <stdio.h>
19860 #$i_stdlib I_STDLIB
19861 #ifdef I_STDLIB
19862 #include <stdlib.h>
19863 #endif
19864 #include <db.h>
19865 int main(int argc, char *argv[])
19866 {
19867 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19868     int Major, Minor, Patch ;
19869     unsigned long Version ;
19870     (void)db_version(&Major, &Minor, &Patch) ;
19871     if (argc == 2) {
19872         printf("%d %d %d %d %d %d\n",
19873                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19874                Major, Minor, Patch);
19875         exit(0);
19876     }
19877     printf("You have Berkeley DB Version 2 or greater.\n");
19878
19879     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19880                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19881     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19882                 Major, Minor, Patch) ;
19883
19884     /* check that db.h & libdb are compatible */
19885     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19886         printf("db.h and libdb are incompatible.\n") ;
19887         exit(3);
19888     }
19889
19890     printf("db.h and libdb are compatible.\n") ;
19891
19892     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19893                 + DB_VERSION_PATCH ;
19894
19895     /* needs to be >= 2.3.4 */
19896     if (Version < 2003004) {
19897     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19898         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19899         exit(2);
19900     }
19901
19902     exit(0);
19903 #else
19904 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19905     if (argc == 2) {
19906         printf("1 0 0\n");
19907         exit(0);
19908     }
19909     printf("You have Berkeley DB Version 1.\n");
19910     exit(0);    /* DB version < 2: the coast is clear. */
19911 #else
19912     exit(1);    /* <db.h> not Berkeley DB? */
19913 #endif
19914 #endif
19915 }
19916 EOCP
19917         set try
19918         if eval $compile_ok && $run ./try; then
19919                 echo 'Looks OK.' >&4
19920                 set `$run ./try 1`
19921                 db_version_major=$1
19922                 db_version_minor=$2
19923                 db_version_patch=$3
19924         else
19925                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19926                 i_db=$undef
19927                 case " $libs " in
19928                 *"-ldb "*)
19929                         : Remove db from list of libraries to use
19930                         echo "Removing unusable -ldb from library list" >&4
19931                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19932                         shift
19933                         libs="$*"
19934                         echo "libs = $libs" >&4
19935                         ;;
19936                 esac
19937         fi
19938         $rm_try
19939         ;;
19940 esac
19941
19942 case "$i_db" in
19943 define)
19944         : Check the return type needed for hash
19945         echo " "
19946         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19947         $cat >try.c <<EOCP
19948 #$d_const HASCONST
19949 #ifndef HASCONST
19950 #define const
19951 #endif
19952 #include <sys/types.h>
19953 #include <db.h>
19954
19955 #ifndef DB_VERSION_MAJOR
19956 u_int32_t hash_cb (const void* ptr, size_t size)
19957 {
19958 }
19959 HASHINFO info;
19960 int main()
19961 {
19962         info.hash = hash_cb;
19963 }
19964 #endif
19965 EOCP
19966         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19967                 if $contains warning try.out >>/dev/null 2>&1 ; then
19968                         db_hashtype='int'
19969                 else
19970                         db_hashtype='u_int32_t'
19971                 fi
19972         else
19973                 : XXX Maybe we should just give up here.
19974                 db_hashtype=u_int32_t
19975                 $cat try.out >&4
19976                 echo "Help:  I can't seem to compile the db test program." >&4
19977                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19978         fi
19979         $rm_try
19980         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19981         ;;
19982 *)      db_hashtype=u_int32_t
19983         ;;
19984 esac
19985 case "$i_db" in
19986 define)
19987         : Check the return type needed for prefix
19988         echo " "
19989         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19990         cat >try.c <<EOCP
19991 #$d_const HASCONST
19992 #ifndef HASCONST
19993 #define const
19994 #endif
19995 #include <sys/types.h>
19996 #include <db.h>
19997
19998 #ifndef DB_VERSION_MAJOR
19999 size_t prefix_cb (const DBT *key1, const DBT *key2)
20000 {
20001 }
20002 BTREEINFO info;
20003 int main()
20004 {
20005         info.prefix = prefix_cb;
20006 }
20007 #endif
20008 EOCP
20009         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20010                 if $contains warning try.out >>/dev/null 2>&1 ; then
20011                         db_prefixtype='int'
20012                 else
20013                         db_prefixtype='size_t'
20014                 fi
20015         else
20016                 db_prefixtype='size_t'
20017                 : XXX Maybe we should just give up here.
20018                 $cat try.out >&4
20019                 echo "Help:  I can't seem to compile the db test program." >&4
20020                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20021         fi
20022         $rm_try
20023         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20024         ;;
20025 *)      db_prefixtype='size_t'
20026         ;;
20027 esac
20028
20029 : How can we generate normalized random numbers ?
20030 echo " "
20031 echo "Using our internal random number implementation..." >&4
20032
20033 case "$ccflags" in
20034 *-Dmy_rand=*|*-Dmy_srand=*)
20035         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20036         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20037         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20038         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20039         ;;
20040 esac
20041
20042 randfunc=Perl_drand48
20043 drand01="Perl_drand48()"
20044 seedfunc="Perl_drand48_init"
20045 randbits=48
20046 randseedtype=U32
20047
20048 : Determine if this is an EBCDIC system
20049 echo " "
20050 echo "Determining whether or not we are on an EBCDIC system..." >&4
20051 $cat >try.c <<'EOM'
20052 int main()
20053 {
20054   if ('M'==0xd4) return 0;
20055   return 1;
20056 }
20057 EOM
20058
20059 val=$undef
20060 set try
20061 if eval $compile_ok; then
20062         if $run ./try; then
20063                 echo "You seem to speak EBCDIC." >&4
20064                 val="$define"
20065         else
20066                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20067         fi
20068 else
20069         echo "I'm unable to compile the test program." >&4
20070         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20071 fi
20072 $rm_try
20073 set ebcdic
20074 eval $setvar
20075
20076 : Check how to flush
20077 echo " "
20078 $cat >&4 <<EOM
20079 Checking how to flush all pending stdio output...
20080 EOM
20081 # I only know how to find the first 32 possibly open files on SunOS.
20082 # See also hints/sunos_4_1.sh and util.c  --AD
20083 case "$osname" in
20084 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20085 esac
20086 $cat >>try.c <<EOCP
20087 #include <stdio.h>
20088 #$i_stdlib I_STDLIB
20089 #ifdef I_STDLIB
20090 #include <stdlib.h>
20091 #endif
20092 #$i_unistd I_UNISTD
20093 #ifdef I_UNISTD
20094 # include <unistd.h>
20095 #endif
20096 #$d_sysconf HAS_SYSCONF
20097 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20098 #ifdef HAS_STDIO_STREAM_ARRAY
20099 # define STDIO_STREAM_ARRAY $stdio_stream_array
20100 #endif
20101 int main() {
20102   FILE* p;
20103   unlink("try.out");
20104   p = fopen("try.out", "w");
20105 #ifdef TRY_FPUTC
20106   fputc('x', p);
20107 #else
20108 # ifdef TRY_FPRINTF
20109   fprintf(p, "x");
20110 # endif
20111 #endif
20112 #ifdef TRY_FFLUSH_NULL
20113   fflush(NULL);
20114 #endif
20115 #ifdef TRY_FFLUSH_ALL
20116   {
20117     long open_max = -1;
20118 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20119     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20120 # else
20121 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20122     open_max = sysconf(_SC_OPEN_MAX);
20123 #  else
20124 #   ifdef FOPEN_MAX
20125     open_max = FOPEN_MAX;
20126 #   else
20127 #    ifdef OPEN_MAX
20128     open_max = OPEN_MAX;
20129 #    else
20130 #     ifdef _NFILE
20131     open_max = _NFILE;
20132 #     endif
20133 #    endif
20134 #   endif
20135 #  endif
20136 # endif
20137 # ifdef HAS_STDIO_STREAM_ARRAY
20138     if (open_max > 0) {
20139       long i;
20140       for (i = 0; i < open_max; i++)
20141             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20142                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20143                 STDIO_STREAM_ARRAY[i]._flag)
20144                 fflush(&STDIO_STREAM_ARRAY[i]);
20145     }
20146   }
20147 # endif
20148 #endif
20149   _exit(42);
20150 }
20151 EOCP
20152 : first we have to find out how _not_ to flush
20153 $to try.c
20154 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20155     output=''
20156     set try -DTRY_FPUTC
20157     if eval $compile; then
20158             $run ./try 2>/dev/null
20159             code="$?"
20160             $from try.out
20161             if $test ! -s try.out -a "X$code" = X42; then
20162                 output=-DTRY_FPUTC
20163             fi
20164     fi
20165     case "$output" in
20166     '')
20167             set try -DTRY_FPRINTF
20168             if eval $compile; then
20169                     $run ./try 2>/dev/null
20170                     code="$?"
20171                     $from try.out
20172                     if $test ! -s try.out -a "X$code" = X42; then
20173                         output=-DTRY_FPRINTF
20174                     fi
20175             fi
20176         ;;
20177     esac
20178 fi
20179 : check for fflush NULL behavior
20180 case "$fflushNULL" in
20181 '')     set try -DTRY_FFLUSH_NULL $output
20182         if eval $compile; then
20183                 $run ./try 2>/dev/null
20184                 code="$?"
20185                 $from try.out
20186                 if $test -s try.out -a "X$code" = X42; then
20187                         fflushNULL="`$cat try.out`"
20188                 else
20189                         if $test "X$code" != X42; then
20190                                 $cat >&4 <<EOM
20191 (If this test failed, don't worry, we'll try another method shortly.)
20192 EOM
20193                         fi
20194                 fi
20195         fi
20196         $rm -f core try.core core.try.*
20197         case "$fflushNULL" in
20198         x)      $cat >&4 <<EOM
20199 Your fflush(NULL) works okay for output streams.
20200 Let's see if it clobbers input pipes...
20201 EOM
20202 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20203 # bug that improperly flushes the input end of pipes.  So we avoid the
20204 # autoflush on fork/system/exec support for now. :-(
20205 $cat >tryp.c <<EOCP
20206 #include <stdio.h>
20207 int
20208 main(int argc, char **argv)
20209 {
20210     char buf[1024];
20211     int i;
20212     char *bp = buf;
20213     while (1) {
20214         while ((i = getc(stdin)) != -1
20215                && (*bp++ = i) != '\n'
20216                && bp < &buf[1024])
20217         /* DO NOTHING */ ;
20218         *bp = '\0';
20219         fprintf(stdout, "%s", buf);
20220         fflush(NULL);
20221         if (i == -1)
20222             return 0;
20223         bp = buf;
20224     }
20225 }
20226 EOCP
20227                 fflushNULL="$define"
20228                 set tryp
20229                 if eval $compile; then
20230                     $rm -f tryp.out
20231                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20232                     if $test "X$targethost" != X; then
20233                         $to tryp.c
20234                         $to tryp
20235                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20236                     else
20237                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20238                     fi
20239                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20240                        $cat >&4 <<EOM
20241 fflush(NULL) seems to behave okay with input streams.
20242 EOM
20243                         fflushNULL="$define"
20244                     else
20245                         $cat >&4 <<EOM
20246 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20247 EOM
20248                         fflushNULL="$undef"
20249                     fi
20250                 fi
20251                 $rm -f core tryp.c tryp.core core.tryp.*
20252                 ;;
20253         '')     $cat >&4 <<EOM
20254 Your fflush(NULL) isn't working (contrary to ANSI C).
20255 EOM
20256                 fflushNULL="$undef"
20257                 ;;
20258         *)      $cat >&4 <<EOM
20259 Cannot figure out whether your fflush(NULL) works or not.
20260 I'm assuming it doesn't (contrary to ANSI C).
20261 EOM
20262                 fflushNULL="$undef"
20263                 ;;
20264         esac
20265         ;;
20266 $define|true|[yY]*)
20267         fflushNULL="$define"
20268         ;;
20269 *)
20270         fflushNULL="$undef"
20271         ;;
20272 esac
20273 : check explicit looping only if NULL did not work, and if the pipe
20274 : bug does not show up on an explicit flush too
20275 case "$fflushNULL" in
20276 "$undef")
20277         $cat >tryp.c <<EOCP
20278 #include <stdio.h>
20279 int
20280 main(int argc, char **argv)
20281 {
20282     char buf[1024];
20283     int i;
20284     char *bp = buf;
20285     while (1) {
20286         while ((i = getc(stdin)) != -1
20287                && (*bp++ = i) != '\n'
20288                && bp < &buf[1024])
20289         /* DO NOTHING */ ;
20290         *bp = '\0';
20291         fprintf(stdout, "%s", buf);
20292         fflush(stdin);
20293         if (i == -1)
20294             return 0;
20295         bp = buf;
20296     }
20297 }
20298 EOCP
20299         set tryp
20300         if eval $compile; then
20301             $rm -f tryp.out
20302             if $test "X$targethost" != X; then
20303                 $to tryp.c
20304                 $to tryp
20305                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20306             else
20307                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20308             fi
20309             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20310                $cat >&4 <<EOM
20311 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20312 EOM
20313                 : now check for fflushall behaviour
20314                 case "$fflushall" in
20315                 '')     set try -DTRY_FFLUSH_ALL $output
20316                         if eval $compile; then
20317                                 $cat >&4 <<EOM
20318 (Now testing the other method--but note that this also may fail.)
20319 EOM
20320                                 $run ./try 2>/dev/null
20321                                 code=$?
20322                                 $from try.out
20323                                 if $test -s try.out -a "X$code" = X42; then
20324                                         fflushall="`$cat try.out`"
20325                                 fi
20326                         fi
20327                         $rm_try
20328                         case "$fflushall" in
20329                         x)      $cat >&4 <<EOM
20330 Whew. Flushing explicitly all the stdio streams works.
20331 EOM
20332                                 fflushall="$define"
20333                                 ;;
20334                         '')     $cat >&4 <<EOM
20335 Sigh. Flushing explicitly all the stdio streams doesn't work.
20336 EOM
20337                                 fflushall="$undef"
20338                                 ;;
20339                         *)      $cat >&4 <<EOM
20340 Cannot figure out whether flushing stdio streams explicitly works or not.
20341 I'm assuming it doesn't.
20342 EOM
20343                                 fflushall="$undef"
20344                                 ;;
20345                         esac
20346                         ;;
20347                 "$define"|true|[yY]*)
20348                         fflushall="$define"
20349                         ;;
20350                 *)
20351                         fflushall="$undef"
20352                         ;;
20353                 esac
20354             else
20355                 $cat >&4 <<EOM
20356 All is futile.  Even fflush(stdin) clobbers input pipes!
20357 EOM
20358                 fflushall="$undef"
20359             fi
20360         else
20361             fflushall="$undef"
20362         fi
20363         $rm -f core tryp.c tryp.core core.tryp.*
20364         ;;
20365 *)      fflushall="$undef"
20366         ;;
20367 esac
20368
20369 case "$fflushNULL$fflushall" in
20370 undefundef)
20371         $cat <<EOM
20372 OK, I give up.  I cannot figure out how to flush pending stdio output.
20373 We won't be flushing handles at all before fork/exec/popen.
20374 EOM
20375         ;;
20376 esac
20377 $rm_try tryp
20378
20379 : Store the full pathname to the ar program for use in the C program
20380 : Respect a hint or command line value for full_ar.
20381 case "$full_ar" in
20382 '') full_ar=$ar ;;
20383 esac
20384
20385 : Store the full pathname to the sed program for use in the C program
20386 full_sed=$sed
20387
20388 : see what type gids are declared as in the kernel
20389 echo " "
20390 echo "Looking for the type for group ids returned by getgid()."
20391 set gid_t gidtype xxx stdio.h sys/types.h
20392 eval $typedef
20393 case "$gidtype" in
20394 xxx)
20395         xxx=`./findhdr sys/user.h`
20396         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20397         case $1 in
20398         unsigned) dflt="$1 $2" ;;
20399         *) dflt="$1" ;;
20400         esac
20401         ;;
20402 *) dflt="$gidtype";;
20403 esac
20404 case "$gidtype" in
20405 gid_t) echo "gid_t found." ;;
20406 *)      rp="What is the type for group ids returned by getgid()?"
20407         . ./myread
20408         gidtype="$ans"
20409         ;;
20410 esac
20411
20412 : Check the size of GID
20413 echo " "
20414 case "$gidtype" in
20415 *_t) zzz="$gidtype"     ;;
20416 *)   zzz="gid"          ;;
20417 esac
20418 echo "Checking the size of $zzz..." >&4
20419 cat > try.c <<EOCP
20420 #include <sys/types.h>
20421 #include <stdio.h>
20422 #$i_stdlib I_STDLIB
20423 #ifdef I_STDLIB
20424 #include <stdlib.h>
20425 #endif
20426 int main() {
20427     printf("%d\n", (int)sizeof($gidtype));
20428     exit(0);
20429 }
20430 EOCP
20431 set try
20432 if eval $compile_ok; then
20433         yyy=`$run ./try`
20434         case "$yyy" in
20435         '')     gidsize=4
20436                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20437                 ;;
20438         *)      gidsize=$yyy
20439                 echo "Your $zzz is $gidsize bytes long."
20440                 ;;
20441         esac
20442 else
20443         gidsize=4
20444         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20445 fi
20446
20447
20448 : Check if GID is signed
20449 echo " "
20450 case "$gidtype" in
20451 *_t) zzz="$gidtype"     ;;
20452 *)   zzz="gid"          ;;
20453 esac
20454 echo "Checking the sign of $zzz..." >&4
20455 cat > try.c <<EOCP
20456 #include <sys/types.h>
20457 #include <stdio.h>
20458 int main() {
20459         $gidtype foo = -1;
20460         if (foo < 0)
20461                 printf("-1\n");
20462         else
20463                 printf("1\n");
20464 }
20465 EOCP
20466 set try
20467 if eval $compile; then
20468         yyy=`$run ./try`
20469         case "$yyy" in
20470         '')     gidsign=1
20471                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20472                 ;;
20473         *)      gidsign=$yyy
20474                 case "$gidsign" in
20475                  1) echo "Your $zzz is unsigned." ;;
20476                 -1) echo "Your $zzz is signed."   ;;
20477                 esac
20478                 ;;
20479         esac
20480 else
20481         gidsign=1
20482         echo "(I can't compile the test program--guessing unsigned.)" >&4
20483 fi
20484
20485
20486 : Check 64bit sizes
20487 echo " "
20488
20489 if $test X"$quadtype" != X; then
20490
20491 echo "Checking how to print 64-bit integers..." >&4
20492
20493 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20494         $cat >try.c <<'EOCP'
20495 #include <sys/types.h>
20496 #include <stdio.h>
20497 int main() {
20498   int q = 12345678901;
20499   printf("%ld\n", q);
20500 }
20501 EOCP
20502         set try
20503         if eval $compile; then
20504                 yyy=`$run ./try`
20505                 case "$yyy" in
20506                 12345678901)
20507                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20508                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20509                         echo "We will use %d."
20510                         ;;
20511                 esac
20512         fi
20513 fi
20514
20515 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20516         $cat >try.c <<'EOCP'
20517 #include <sys/types.h>
20518 #include <stdio.h>
20519 int main() {
20520   long q = 12345678901;
20521   printf("%ld\n", q);
20522 }
20523 EOCP
20524         set try
20525         if eval $compile; then
20526                 yyy=`$run ./try`
20527                 case "$yyy" in
20528                 12345678901)
20529                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20530                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20531                         echo "We will use %ld."
20532                         ;;
20533                 esac
20534         fi
20535 fi
20536
20537 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20538         $cat >try.c <<'EOCP'
20539 #include <sys/types.h>
20540 #include <inttypes.h>
20541 #include <stdio.h>
20542 int main() {
20543   int64_t q = 12345678901;
20544   printf("%" PRId64 "\n", q);
20545 }
20546 EOCP
20547         set try
20548         if eval $compile; then
20549                 yyy=`$run ./try`
20550                 case "$yyy" in
20551                 12345678901)
20552                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20553                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20554                         echo "We will use the C9X style."
20555                         ;;
20556                 esac
20557         fi
20558 fi
20559
20560 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20561         $cat >try.c <<EOCP
20562 #include <sys/types.h>
20563 #include <stdio.h>
20564 int main() {
20565   $quadtype q = 12345678901;
20566   printf("%Ld\n", q);
20567 }
20568 EOCP
20569         set try
20570         if eval $compile; then
20571                 yyy=`$run ./try`
20572                 case "$yyy" in
20573                 12345678901)
20574                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20575                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20576                         echo "We will use %Ld."
20577                         ;;
20578                 esac
20579         fi
20580 fi
20581
20582 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20583         $cat >try.c <<'EOCP'
20584 #include <sys/types.h>
20585 #include <stdio.h>
20586 int main() {
20587   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20588   printf("%lld\n", q);
20589 }
20590 EOCP
20591         set try
20592         if eval $compile; then
20593                 yyy=`$run ./try`
20594                 case "$yyy" in
20595                 12345678901)
20596                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20597                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20598                         echo "We will use the %lld style."
20599                         ;;
20600                 esac
20601         fi
20602 fi
20603
20604 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20605         $cat >try.c <<EOCP
20606 #include <sys/types.h>
20607 #include <stdio.h>
20608 int main() {
20609   $quadtype q = 12345678901;
20610   printf("%qd\n", q);
20611 }
20612 EOCP
20613         set try
20614         if eval $compile; then
20615                 yyy=`$run ./try`
20616                 case "$yyy" in
20617                 12345678901)
20618                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20619                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20620                         echo "We will use %qd."
20621                         ;;
20622                 esac
20623         fi
20624 fi
20625
20626 if $test X"$sPRId64" = X; then
20627         echo "Cannot figure out how to print 64-bit integers." >&4
20628 fi
20629 $rm_try
20630
20631 fi
20632
20633 case "$sPRId64" in
20634 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20635         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20636         ;;
20637 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20638         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20639         ;;
20640 esac
20641
20642 : Check format strings for internal types
20643 echo " "
20644 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20645
20646 if $test X"$ivsize" = X8; then
20647         ivdformat="$sPRId64"
20648         uvuformat="$sPRIu64"
20649         uvoformat="$sPRIo64"
20650         uvxformat="$sPRIx64"
20651         uvXUformat="$sPRIXU64"
20652 else
20653         if $test X"$ivsize" = X"$longsize"; then
20654                 ivdformat='"ld"'
20655                 uvuformat='"lu"'
20656                 uvoformat='"lo"'
20657                 uvxformat='"lx"'
20658                 uvXUformat='"lX"'
20659         else
20660                 if $test X"$ivsize" = X"$intsize"; then
20661                         ivdformat='"d"'
20662                         uvuformat='"u"'
20663                         uvoformat='"o"'
20664                         uvxformat='"x"'
20665                         uvXUformat='"X"'
20666                 else
20667                         : far out
20668                         if $test X"$ivsize" = X"$shortsize"; then
20669                                 ivdformat='"hd"'
20670                                 uvuformat='"hu"'
20671                                 uvoformat='"ho"'
20672                                 uvxformat='"hx"'
20673                                 uvXUformat='"hX"'
20674                         fi
20675                 fi
20676         fi
20677 fi
20678
20679 if $test X"$usequadmath" = X"$define"; then
20680     nveformat='"Qe"'
20681     nvfformat='"Qf"'
20682     nvgformat='"Qg"'
20683     nvEUformat='"QE"'
20684     nvFUformat='"QF"'
20685     nvGUformat='"QG"'
20686 else
20687     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20688         nveformat="$sPRIeldbl"
20689         nvfformat="$sPRIfldbl"
20690         nvgformat="$sPRIgldbl"
20691         nvEUformat="$sPRIEUldbl"
20692         nvFUformat="$sPRIFUldbl"
20693         nvGUformat="$sPRIGUldbl"
20694     else
20695         nveformat='"e"'
20696         nvfformat='"f"'
20697         nvgformat='"g"'
20698         nvEUformat='"E"'
20699         nvFUformat='"F"'
20700         nvGUformat='"G"'
20701     fi
20702 fi
20703
20704 case "$ivdformat" in
20705 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20706     exit 1
20707     ;;
20708 esac
20709
20710 : Check format string for GID
20711
20712 echo " "
20713 $echo "Checking the format string to be used for gids..." >&4
20714
20715 case "$gidsign" in
20716 -1)     if $test X"$gidsize" = X"$ivsize"; then
20717                 gidformat="$ivdformat"
20718         else
20719                 if $test X"$gidsize" = X"$longsize"; then
20720                         gidformat='"ld"'
20721                 else
20722                         if $test X"$gidsize" = X"$intsize"; then
20723                                 gidformat='"d"'
20724                         else
20725                                 if $test X"$gidsize" = X"$shortsize"; then
20726                                         gidformat='"hd"'
20727                                 fi
20728                         fi
20729                 fi
20730         fi
20731         ;;
20732 *)      if $test X"$gidsize" = X"$uvsize"; then
20733                 gidformat="$uvuformat"
20734         else
20735                 if $test X"$gidsize" = X"$longsize"; then
20736                         gidformat='"lu"'
20737                 else
20738                         if $test X"$gidsize" = X"$intsize"; then
20739                                 gidformat='"u"'
20740                         else
20741                                 if $test X"$gidsize" = X"$shortsize"; then
20742                                         gidformat='"hu"'
20743                                 fi
20744                         fi
20745                 fi
20746         fi
20747         ;;
20748 esac
20749
20750 : see if getgroups exists
20751 set getgroups d_getgrps
20752 eval $inlibc
20753
20754 : see if setgroups exists
20755 set setgroups d_setgrps
20756 eval $inlibc
20757
20758 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20759 echo " "
20760 case "$d_getgrps$d_setgrps" in
20761 *define*)
20762         case "$groupstype" in
20763         '') dflt="$gidtype" ;;
20764         *)  dflt="$groupstype" ;;
20765         esac
20766         $cat <<EOM
20767 What type of pointer is the second argument to getgroups() and setgroups()?
20768 Usually this is the same as group ids, $gidtype, but not always.
20769
20770 EOM
20771         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20772         . ./myread
20773         groupstype="$ans"
20774         ;;
20775 *)  groupstype="$gidtype";;
20776 esac
20777
20778 : check whether make sets MAKE
20779 echo " "
20780 echo "Checking if your $make program sets \$(MAKE)..." >&4
20781 case "$make_set_make" in
20782 '')
20783         $sed 's/^X //' > testmake.mak << 'EOF'
20784 Xall:
20785 X       @echo 'maketemp="$(MAKE)"'
20786 EOF
20787         case "`$make -f testmake.mak 2>/dev/null`" in
20788         *maketemp=*) make_set_make='#' ;;
20789         *)      make_set_make="MAKE=$make" ;;
20790         esac
20791         $rm -f testmake.mak
20792         ;;
20793 esac
20794 case "$make_set_make" in
20795 '#') echo "Yup, it does.";;
20796 *) echo "Nope, it doesn't.";;
20797 esac
20798
20799 : see what type is used for mode_t
20800 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20801 set mode_t modetype int stdio.h sys/types.h
20802 eval $typedef_ask
20803
20804 : see if we need va_copy
20805 echo " "
20806 case "$i_stdarg" in
20807 "$define")
20808         $cat >try.c <<EOCP
20809 #include <stdarg.h>
20810 #include <stdio.h>
20811 #$i_stdlib I_STDLIB
20812 #ifdef I_STDLIB
20813 #include <stdlib.h>
20814 #endif
20815 #include <signal.h>
20816
20817 int
20818 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20819 {
20820   return vfprintf(f, fmt, *valp);
20821 }
20822
20823 int
20824 myvfprintf(FILE *f, const  char *fmt, va_list val)
20825 {
20826   return ivfprintf(f, fmt, &val);
20827 }
20828
20829 int
20830 myprintf(char *fmt, ...)
20831 {
20832   va_list val;
20833   va_start(val, fmt);
20834   return myvfprintf(stdout, fmt, val);
20835 }
20836
20837 int
20838 main(int ac, char **av)
20839 {
20840   signal(SIGSEGV, exit);
20841
20842   myprintf("%s%cs all right, then\n", "that", '\'');
20843   exit(0);
20844 }
20845 EOCP
20846         set try
20847         if eval $compile && $run ./try 2>&1 >/dev/null; then
20848                 case "`$run ./try`" in
20849                 "that's all right, then")
20850                         okay=yes
20851                         ;;
20852                 esac
20853         fi
20854         case "$okay" in
20855         yes)    echo "It seems that you don't need va_copy()." >&4
20856                 need_va_copy="$undef"
20857                 ;;
20858         *)      echo "It seems that va_copy() or similar will be needed." >&4
20859                 need_va_copy="$define"
20860                 ;;
20861         esac
20862         $rm_try
20863         ;;
20864 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20865         need_va_copy="$undef"
20866         ;;
20867 esac
20868
20869 : see what type is used for size_t
20870 rp="What is the type used for the length parameter for string functions?"
20871 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20872 eval $typedef_ask
20873
20874 : check for type of arguments to gethostbyaddr.
20875 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20876         case "$d_gethbyaddr" in
20877         $define)
20878                 $cat <<EOM
20879
20880 Checking to see what type of arguments are accepted by gethostbyaddr().
20881 EOM
20882                 hdrs="$define sys/types.h
20883                         $d_socket sys/socket.h
20884                         $i_niin netinet/in.h
20885                         $i_netdb netdb.h
20886                         $i_unistd unistd.h"
20887                 : The first arg can 'char *' or 'void *'
20888                 : The second arg is some of integral type
20889                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20890                         for yyy in size_t long int; do
20891                                 case "$netdb_host_type" in
20892                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20893                                         if ./protochk "$try" $hdrs; then
20894                                                 echo "Your system accepts $xxx for the first arg."
20895                                                 echo "...and $yyy for the second arg."
20896                                                 netdb_host_type="$xxx"
20897                                                 netdb_hlen_type="$yyy"
20898                                         fi
20899                                         ;;
20900                                 esac
20901                         done
20902                 done
20903                 : In case none of those worked, prompt the user.
20904                 case "$netdb_host_type" in
20905                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20906                         dflt='char *'
20907                         . ./myread
20908                         netdb_host_type=$ans
20909                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20910                         dflt="$sizetype"
20911                         . ./myread
20912                         netdb_hlen_type=$ans
20913                         ;;
20914                 esac
20915                 ;;
20916         *)      : no gethostbyaddr, so pick harmless defaults
20917                 netdb_host_type='char *'
20918                 netdb_hlen_type="$sizetype"
20919                 ;;
20920         esac
20921         # Remove the "const" if needed. -- but then we'll have a
20922         # prototype clash!
20923         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20924 fi
20925
20926 : check for type of argument to gethostbyname.
20927 if test "X$netdb_name_type" = X ; then
20928         case "$d_gethbyname" in
20929         $define)
20930                 $cat <<EOM
20931
20932 Checking to see what type of argument is accepted by gethostbyname().
20933 EOM
20934                 hdrs="$define sys/types.h
20935                         $d_socket sys/socket.h
20936                         $i_niin netinet/in.h
20937                         $i_netdb netdb.h
20938                         $i_unistd unistd.h"
20939                 for xxx in "const char *" "char *"; do
20940                         case "$netdb_name_type" in
20941                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20942                                 if ./protochk "$try" $hdrs; then
20943                                         echo "Your system accepts $xxx."
20944                                         netdb_name_type="$xxx"
20945                                 fi
20946                                 ;;
20947                         esac
20948                 done
20949                 : In case none of those worked, prompt the user.
20950                 case "$netdb_name_type" in
20951                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20952                         dflt='char *'
20953                         . ./myread
20954                         netdb_name_type=$ans
20955                         ;;
20956                 esac
20957                 ;;
20958         *)      : no gethostbyname, so pick harmless default
20959                 netdb_name_type='char *'
20960                 ;;
20961         esac
20962 fi
20963
20964 : check for type of 1st argument to getnetbyaddr.
20965 if test "X$netdb_net_type" = X ; then
20966         case "$d_getnbyaddr" in
20967         $define)
20968                 $cat <<EOM
20969
20970 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20971 EOM
20972                 hdrs="$define sys/types.h
20973                         $d_socket sys/socket.h
20974                         $i_niin netinet/in.h
20975                         $i_netdb netdb.h
20976                         $i_unistd unistd.h"
20977                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20978                         case "$netdb_net_type" in
20979                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20980                                 if ./protochk "$try" $hdrs; then
20981                                         echo "Your system accepts $xxx."
20982                                         netdb_net_type="$xxx"
20983                                 fi
20984                                 ;;
20985                         esac
20986                 done
20987                 : In case none of those worked, prompt the user.
20988                 case "$netdb_net_type" in
20989                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20990                         dflt='long'
20991                         . ./myread
20992                         netdb_net_type=$ans
20993                         ;;
20994                 esac
20995                 ;;
20996         *)      : no getnetbyaddr, so pick harmless default
20997                 netdb_net_type='long'
20998                 ;;
20999         esac
21000 fi
21001 : locate the preferred pager for this system
21002 fn=f/
21003 case "$pager" in
21004 '')
21005         dflt=''
21006         case "$pg" in
21007         /*) dflt=$pg;;
21008         [a-zA-Z]:/*) dflt=$pg;;
21009         esac
21010         case "$more" in
21011         /*) dflt=$more;;
21012         [a-zA-Z]:/*) dflt=$more;;
21013         esac
21014         case "$less" in
21015         /*) dflt=$less;;
21016         [a-zA-Z]:/*) dflt=$less;;
21017         esac
21018         case "$dflt" in
21019         '') dflt=/usr/ucb/more;;
21020         esac
21021         ;;
21022 *)      dflt="$pager"
21023         ;;
21024 esac
21025 fn="f/($dflt)"
21026 echo " "
21027 rp='What pager is used on your system?'
21028 . ./getfile
21029 pager="$ans"
21030
21031 : see what type pids are declared as in the kernel
21032 rp="What is the type of process ids on this system?"
21033 set pid_t pidtype int stdio.h sys/types.h
21034 eval $typedef_ask
21035
21036 : see if ar generates random libraries by itself
21037 echo " "
21038 echo "Checking how to generate random libraries on your machine..." >&4
21039 echo 'int bar1() { return bar2(); }' > bar1.c
21040 echo 'int bar2() { return 2; }' > bar2.c
21041 $cat > foo.c <<EOP
21042 #$i_stdlib I_STDLIB
21043 #ifdef I_STDLIB
21044 #include <stdlib.h>
21045 #endif
21046 int main() { printf("%d\n", bar1()); exit(0); }
21047 EOP
21048 $cc $ccflags -c bar1.c >/dev/null 2>&1
21049 $cc $ccflags -c bar2.c >/dev/null 2>&1
21050 $cc $ccflags -c foo.c >/dev/null 2>&1
21051 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21052 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21053         $run ./foobar >/dev/null 2>&1; then
21054         echo "$ar appears to generate random libraries itself."
21055         orderlib=false
21056         if [ "X$ranlib" = "X" ]; then
21057             ranlib=":"
21058         fi
21059 elif $ar s bar$_a >/dev/null 2>&1 &&
21060         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21061         $run ./foobar >/dev/null 2>&1; then
21062                 echo "a table of contents needs to be added with '$ar s'."
21063                 orderlib=false
21064                 ranlib="$ar s"
21065 elif $ar ts bar$_a >/dev/null 2>&1 &&
21066         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21067         $run ./foobar >/dev/null 2>&1; then
21068                 echo "a table of contents needs to be added with '$ar ts'."
21069                 orderlib=false
21070                 ranlib="$ar ts"
21071 else
21072         case "$ranlib" in
21073         :) ranlib='';;
21074         '')
21075                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21076                 $test -f $ranlib || ranlib=''
21077                 ;;
21078         esac
21079         if $test -n "$ranlib"; then
21080                 echo "your system has '$ranlib'; we'll use that."
21081                 orderlib=false
21082         else
21083                 echo "your system doesn't seem to support random libraries"
21084                 echo "so we'll use lorder and tsort to order the libraries."
21085                 orderlib=true
21086                 ranlib=":"
21087         fi
21088 fi
21089 $rm -f foo* bar*
21090
21091 : see if this is a values.h system
21092 set values.h i_values
21093 eval $inhdr
21094
21095 : Check the max offset that gmtime and localtime accept
21096 echo "Checking max offsets that gmtime () accepts"
21097
21098 case $i_values in
21099     define) yyy="#include <values.h>" ;;
21100     *)      yyy="" ;;
21101     esac
21102
21103 case "$sGMTIME_min/$sGMTIME_max" in
21104     0/0|/)
21105         $cat >try.c <<EOCP
21106 #include <sys/types.h>
21107 #include <stdio.h>
21108 #include <time.h>
21109 $yyy
21110
21111 int i;
21112 struct tm *tmp;
21113 time_t pt;
21114
21115 void gm_check (time_t t, int min_year, int max_year)
21116 {
21117     tmp = gmtime (&t);
21118     if ( tmp == NULL ||
21119         /* Check tm_year overflow */
21120          tmp->tm_year < min_year || tmp->tm_year > max_year)
21121         tmp = NULL;
21122     else
21123         pt = t;
21124     } /* gm_check */
21125
21126 int check_max ()
21127 {
21128     tmp = NULL;
21129     pt  = 0;
21130 #ifdef MAXLONG
21131     gm_check (MAXLONG, 69, 0x7fffffff);
21132 #endif
21133     if (tmp == NULL || tmp->tm_year < 0) {
21134         for (i = 63; i >= 0; i--) {
21135             time_t x = pt | ((time_t)1 << i);
21136             if (x < 0 || x < pt) continue;
21137             gm_check (x, 69, 0x7fffffff);
21138             }
21139         }
21140     printf ("sGMTIME_max=%ld\n", pt);
21141     return (0);
21142     } /* check_max */
21143
21144 int check_min ()
21145 {
21146     tmp = NULL;
21147     pt  = 0;
21148 #ifdef MINLONG
21149     gm_check (MINLONG, -1900, 70);
21150 #endif
21151     if (tmp == NULL) {
21152         for (i = 36; i >= 0; i--) {
21153             time_t x = pt - ((time_t)1 << i);
21154             if (x > 0) continue;
21155             gm_check (x, -1900, 70);
21156             }
21157         }
21158     printf ("sGMTIME_min=%ld\n", pt);
21159     return (0);
21160     } /* check_min */
21161
21162 int main (int argc, char *argv[])
21163 {
21164     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
21165     check_max ();
21166     check_min ();
21167     return (0);
21168     } /* main */
21169 EOCP
21170         set try
21171         if eval $compile; then
21172             eval `$run ./try`
21173         else
21174             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21175             fi
21176         $rm_try
21177         ;;
21178     esac
21179
21180 echo "Checking max offsets that localtime () accepts"
21181
21182 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21183     0/0|/)
21184         $cat >try.c <<EOCP
21185 #include <sys/types.h>
21186 #include <stdio.h>
21187 #include <time.h>
21188 $yyy
21189
21190 int i;
21191 struct tm *tmp;
21192 time_t pt;
21193
21194 void local_check (time_t t, int min_year, int max_year)
21195 {
21196     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21197         tmp = NULL;
21198     else
21199         tmp = localtime (&t);
21200     if ( tmp == NULL ||
21201         /* Check tm_year overflow */
21202          tmp->tm_year < min_year || tmp->tm_year > max_year)
21203         tmp = NULL;
21204     else
21205         pt = t;
21206     } /* local_check */
21207
21208 int check_max ()
21209 {
21210     tmp = NULL;
21211     pt  = 0;
21212 #ifdef MAXLONG
21213     local_check (MAXLONG, 69, 0x7fffffff);
21214 #endif
21215     if (tmp == NULL || tmp->tm_year < 0) {
21216         for (i = 63; i >= 0; i--) {
21217             time_t x = pt | ((time_t)1 << i);
21218             if (x < 0 || x < pt) continue;
21219             local_check (x, 69, 0x7fffffff);
21220             }
21221         }
21222     printf ("sLOCALTIME_max=%ld\n", pt);
21223     return (0);
21224    } /* check_max */
21225
21226 int check_min ()
21227 {
21228     tmp = NULL;
21229     pt  = 0;
21230 #ifdef MINLONG
21231     local_check (MINLONG, -1900, 70);
21232 #endif
21233     if (tmp == NULL) {
21234         for (i = 36; i >= 0; i--) {
21235             time_t x = pt - ((time_t)1 << i);
21236             if (x > 0) continue;
21237             local_check (x, -1900, 70);
21238             }
21239         }
21240     printf ("sLOCALTIME_min=%ld\n", pt);
21241     return (0);
21242     } /* check_min */
21243
21244 int main (int argc, char *argv[])
21245 {
21246     check_max ();
21247     check_min ();
21248     return (0);
21249     } /* main */
21250 EOCP
21251         set try
21252         if eval $compile; then
21253             eval `$run ./try`
21254         else
21255             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21256             fi
21257         $rm_try
21258         ;;
21259     esac
21260
21261 : check for type of arguments to select.
21262 case "$selecttype" in
21263 '') case "$d_select" in
21264         $define)
21265                 echo " "
21266                 $cat <<EOM
21267 Checking to see what type of arguments are accepted by select().
21268 EOM
21269                 hdrs="$define sys/types.h
21270                         $i_systime sys/time.h
21271                         $i_sysselct sys/select.h
21272                         $d_socket sys/socket.h"
21273                 : The first arg can be int, unsigned, or size_t
21274                 : The last arg may or may not be 'const'
21275                 val=''
21276                 : void pointer has been seen but using that
21277                 : breaks the selectminbits test
21278                 for xxx in 'fd_set *' 'int *'; do
21279                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21280                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21281                                         case "$val" in
21282                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21283                                                 if ./protochk "$try" $hdrs; then
21284                                                         echo "Your system accepts $xxx."
21285                                                         val="$xxx"
21286                                                 fi
21287                                                 ;;
21288                                         esac
21289                                 done
21290                         done
21291                 done
21292                 case "$val" in
21293                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21294                         case "$d_fd_set" in
21295                                 $define) dflt="fd_set *" ;;
21296                                 *)              dflt="int *" ;;
21297                         esac
21298                         . ./myread
21299                         val=$ans
21300                         ;;
21301                 esac
21302                 selecttype="$val"
21303                 ;;
21304         *)      : no select, so pick a harmless default
21305                 selecttype='int *'
21306                 ;;
21307         esac
21308         ;;
21309 esac
21310
21311 : check for the select 'width'
21312 case "$selectminbits" in
21313 '') safebits=`expr $ptrsize \* 8`
21314     case "$d_select" in
21315         $define)
21316                 $cat <<EOM
21317
21318 Checking to see on how many bits at a time your select() operates...
21319 EOM
21320                 $cat >try.c <<EOCP
21321 #include <sys/types.h>
21322 #$i_time I_TIME
21323 #$i_systime I_SYS_TIME
21324 #$i_systimek I_SYS_TIME_KERNEL
21325 #ifdef I_TIME
21326 #   include <time.h>
21327 #endif
21328 #ifdef I_SYS_TIME
21329 #   ifdef I_SYS_TIME_KERNEL
21330 #       define KERNEL
21331 #   endif
21332 #   include <sys/time.h>
21333 #   ifdef I_SYS_TIME_KERNEL
21334 #       undef KERNEL
21335 #   endif
21336 #endif
21337 #$i_sysselct I_SYS_SELECT
21338 #ifdef I_SYS_SELECT
21339 #include <sys/select.h>
21340 #endif
21341 #$d_socket HAS_SOCKET
21342 #ifdef HAS_SOCKET
21343 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21344 #endif
21345 #include <stdio.h>
21346 #$i_stdlib I_STDLIB
21347 #ifdef I_STDLIB
21348 #include <stdlib.h>
21349 #endif
21350 $selecttype b;
21351 #define S sizeof(*(b))
21352 #define MINBITS 64
21353 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21354 #define NBITS  (NBYTES * 8)
21355 int main() {
21356     char *s = (char *)malloc(NBYTES);
21357     struct timeval t;
21358     int i;
21359     FILE* fp;
21360     int fd;
21361
21362     if (!s)
21363         exit(1);
21364     fclose(stdin);
21365     fp = fopen("try.c", "r");
21366     if (fp == 0)
21367       exit(2);
21368     fd = fileno(fp);
21369     if (fd < 0)
21370       exit(3);
21371     b = ($selecttype)s;
21372     for (i = 0; i < NBITS; i++)
21373         FD_SET(i, b);
21374     t.tv_sec  = 0;
21375     t.tv_usec = 0;
21376     select(fd + 1, b, 0, 0, &t);
21377     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21378     free(s);
21379     printf("%d\n", i + 1);
21380     return 0;
21381 }
21382 EOCP
21383                 set try
21384                 if eval $compile_ok; then
21385                         selectminbits=`$run ./try`
21386                         case "$selectminbits" in
21387                         '')     cat >&4 <<EOM
21388 Cannot figure out on how many bits at a time your select() operates.
21389 I'll play safe and guess it is $safebits bits.
21390 EOM
21391                                 selectminbits=$safebits
21392                                 bits="$safebits bits"
21393                                 ;;
21394                         1)      bits="1 bit" ;;
21395                         *)      bits="$selectminbits bits" ;;
21396                         esac
21397                         echo "Your select() operates on $bits at a time." >&4
21398                 else
21399                         rp='What is the minimum number of bits your select() operates on?'
21400                         case "$byteorder" in
21401                         12345678)       dflt=64 ;;
21402                         1234)           dflt=32 ;;
21403                         *)              dflt=1  ;;
21404                         esac
21405                         . ./myread
21406                         val=$ans
21407                         selectminbits="$val"
21408                 fi
21409                 $rm_try
21410                 ;;
21411         *)      : no select, so pick a harmless default
21412                 selectminbits=$safebits
21413                 ;;
21414         esac
21415         ;;
21416 esac
21417
21418 : Trace out the files included by signal.h, then look for SIGxxx names.
21419 if [ "X$fieldn" = X ]; then
21420         : Just make some guesses.  We check them later.
21421         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21422 else
21423         xxx=`echo '#include <signal.h>' |
21424         $cppstdin $cppminus $cppflags 2>/dev/null |
21425         $grep '^[       ]*#.*include' |
21426         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21427                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21428 fi
21429 xxxfiles=''
21430 for xx in $xxx /dev/null ; do
21431         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21432 done
21433 case "$xxxfiles" in
21434 '')     xxxfiles=`./findhdr signal.h` ;;
21435 esac
21436 xxx=`awk '
21437 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21438         print substr($2, 4, 20)
21439 }
21440 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21441         print substr($3, 4, 20)
21442 }' $xxxfiles`
21443 : Append some common names just in case the awk scan failed.
21444 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21445 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21446 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21447 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21448 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21449
21450 : generate a few handy files for later
21451 $cat > signal.c <<EOCP
21452 #include <sys/types.h>
21453 #include <signal.h>
21454 #$i_stdlib I_STDLIB
21455 #ifdef I_STDLIB
21456 #include <stdlib.h>
21457 #endif
21458 #include <stdio.h>
21459 int main() {
21460
21461 /* Strange style to avoid deeply-nested #if/#else/#endif */
21462 #ifndef NSIG
21463 #  ifdef _NSIG
21464 #    define NSIG (_NSIG)
21465 #  endif
21466 #endif
21467
21468 #ifndef NSIG
21469 #  ifdef SIGMAX
21470 #    define NSIG (SIGMAX+1)
21471 #  endif
21472 #endif
21473
21474 #ifndef NSIG
21475 #  ifdef SIG_MAX
21476 #    define NSIG (SIG_MAX+1)
21477 #  endif
21478 #endif
21479
21480 #ifndef NSIG
21481 #  ifdef _SIG_MAX
21482 #    define NSIG (_SIG_MAX+1)
21483 #  endif
21484 #endif
21485
21486 #ifndef NSIG
21487 #  ifdef MAXSIG
21488 #    define NSIG (MAXSIG+1)
21489 #  endif
21490 #endif
21491
21492 #ifndef NSIG
21493 #  ifdef MAX_SIG
21494 #    define NSIG (MAX_SIG+1)
21495 #  endif
21496 #endif
21497
21498 #ifndef NSIG
21499 #  ifdef SIGARRAYSIZE
21500 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21501 #  endif
21502 #endif
21503
21504 #ifndef NSIG
21505 #  ifdef _sys_nsig
21506 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21507 #  endif
21508 #endif
21509
21510 /* Default to some arbitrary number that's big enough to get most
21511    of the common signals.
21512 */
21513 #ifndef NSIG
21514 #    define NSIG 50
21515 #endif
21516
21517 printf("NSIG %d\n", NSIG);
21518
21519 #ifndef JUST_NSIG
21520
21521 EOCP
21522
21523 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21524 {
21525         printf "#ifdef SIG"; printf $1; printf "\n"
21526         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21527         printf $1; printf ");\n"
21528         printf "#endif\n"
21529 }
21530 END {
21531         printf "#endif /* JUST_NSIG */\n";
21532         printf "exit(0);\n}\n";
21533 }
21534 ' >>signal.c
21535 $cat >signal.awk <<'EOP'
21536 BEGIN { ndups = 0 }
21537 $1 ~ /^NSIG$/ { nsig = $2 }
21538 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21539     if ($2 > maxsig) { maxsig = $2 }
21540     if (sig_name[$2]) {
21541         dup_name[ndups] = $1
21542         dup_num[ndups] = $2
21543         ndups++
21544     }
21545     else {
21546         sig_name[$2] = $1
21547         sig_num[$2] = $2
21548     }
21549 }
21550 END {
21551     if (nsig == 0) {
21552         nsig = maxsig + 1
21553     }
21554     printf("NSIG %d\n", nsig);
21555     for (n = 1; n < nsig; n++) {
21556         if (sig_name[n]) {
21557             printf("%s %d\n", sig_name[n], sig_num[n])
21558         }
21559         else {
21560             printf("NUM%d %d\n", n, n)
21561         }
21562     }
21563     for (n = 0; n < ndups; n++) {
21564         printf("%s %d\n", dup_name[n], dup_num[n])
21565     }
21566 }
21567 EOP
21568 $cat >signal_cmd <<EOS
21569 $startsh
21570 if $test -s signal.lst; then
21571     echo "Using your existing signal.lst file"
21572         exit 0
21573 fi
21574 xxx="$xxx"
21575 EOS
21576 $cat >>signal_cmd <<'EOS'
21577
21578 set signal
21579 if eval $compile_ok; then
21580         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21581                 $uniq | $awk -f signal.awk >signal.lst
21582 else
21583         echo "(I can't seem be able to compile the whole test program)" >&4
21584         echo "(I'll try it in little pieces.)" >&4
21585         set signal -DJUST_NSIG
21586         if eval $compile_ok; then
21587                 $run ./signal$_exe > signal.nsg
21588                 $cat signal.nsg
21589         else
21590                 echo "I can't seem to figure out how many signals you have." >&4
21591                 echo "Guessing 50." >&4
21592                 echo 'NSIG 50' > signal.nsg
21593         fi
21594         : Now look at all the signal names, one at a time.
21595         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21596                 $cat > signal.c <<EOCP
21597 #include <sys/types.h>
21598 #include <signal.h>
21599 #include <stdio.h>
21600 int main() {
21601 printf("$xx %d\n", SIG${xx});
21602 return 0;
21603 }
21604 EOCP
21605                 set signal
21606                 if eval $compile; then
21607                         echo "SIG${xx} found."
21608                         $run ./signal$_exe  >> signal.ls1
21609                 else
21610                         echo "SIG${xx} NOT found."
21611                 fi
21612         done
21613         if $test -s signal.ls1; then
21614                 $cat signal.nsg signal.ls1 |
21615                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21616         fi
21617
21618 fi
21619 if $test -s signal.lst; then
21620         :
21621 else
21622         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21623         echo 'kill -l' >signal
21624         set X `csh -f <signal`
21625         $rm -f signal
21626         shift
21627         case $# in
21628         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21629         esac
21630         echo $@ | $tr ' ' $trnl | \
21631             $awk '{ printf "%s %d\n", $1, ++s; }
21632                   END { printf "NSIG %d\n", ++s }' >signal.lst
21633 fi
21634 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21635 EOS
21636 chmod a+x signal_cmd
21637 $eunicefix signal_cmd
21638
21639 : generate list of signal names
21640 echo " "
21641 case "$sig_name_init" in
21642 '') doinit=yes ;;
21643 *)  case "$sig_num_init" in
21644     ''|*,*) doinit=yes ;;
21645     esac ;;
21646 esac
21647 case "$doinit" in
21648 yes)
21649         echo "Generating a list of signal names and numbers..." >&4
21650         . ./signal_cmd
21651         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21652         sig_name=`$awk 'BEGIN { printf "ZERO " }
21653                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21654         sig_num=`$awk  'BEGIN { printf "0 " }
21655                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21656         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21657                              !/^NSIG/   { printf "\"%s\", ", $1 }
21658                              END        { printf "0\n" }' signal.lst`
21659         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21660                              !/^NSIG/   { printf "%d, ", $2}
21661                              END        { printf "0\n"}' signal.lst`
21662         ;;
21663 esac
21664 echo "The following $sig_count signals are available:"
21665 echo " "
21666 echo $sig_name | $awk \
21667 'BEGIN { linelen = 0 }
21668 {
21669         for (i = 1; i <= NF; i++) {
21670                 name = "SIG" $i " "
21671                 linelen = linelen + length(name)
21672                 if (linelen > 70) {
21673                         printf "\n"
21674                         linelen = length(name)
21675                 }
21676                 printf "%s", name
21677         }
21678         printf "\n"
21679 }'
21680 sig_size=`echo $sig_name | awk '{print NF}'`
21681 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21682
21683 : Check size of size
21684 echo " "
21685 case "$sizetype" in
21686 *_t) zzz="$sizetype"    ;;
21687 *)   zzz="filesize"     ;;
21688 esac
21689 echo "Checking the size of $zzz..." >&4
21690 cat > try.c <<EOCP
21691 #include <sys/types.h>
21692 #include <stdio.h>
21693 #$i_stdlib I_STDLIB
21694 #ifdef I_STDLIB
21695 #include <stdlib.h>
21696 #endif
21697 int main() {
21698     printf("%d\n", (int)sizeof($sizetype));
21699     exit(0);
21700 }
21701 EOCP
21702 set try
21703 if eval $compile_ok; then
21704         yyy=`$run ./try`
21705         case "$yyy" in
21706         '')     sizesize=4
21707                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21708                 ;;
21709         *)      sizesize=$yyy
21710                 echo "Your $zzz size is $sizesize bytes."
21711                 ;;
21712         esac
21713 else
21714         sizesize=4
21715         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21716 fi
21717
21718
21719 : check for socklen_t
21720 echo " "
21721 echo "Checking to see if you have socklen_t..." >&4
21722 $cat >try.c <<EOCP
21723 #include <sys/types.h>
21724 #$d_socket HAS_SOCKET
21725 #ifdef HAS_SOCKET
21726 #include <sys/socket.h>
21727 #endif
21728 int main() { socklen_t x = 16; }
21729 EOCP
21730 set try
21731 if eval $compile; then
21732         val="$define"
21733         echo "You have socklen_t."
21734 else
21735         val="$undef"
21736         echo "You do not have socklen_t."
21737         case "$sizetype" in
21738         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21739         esac
21740 fi
21741 $rm_try
21742 set d_socklen_t
21743 eval $setvar
21744
21745 : see if this is a socks.h system
21746 set socks.h i_socks
21747 eval $inhdr
21748
21749 : check for type of the size argument to socket calls
21750 case "$d_socket" in
21751 "$define")
21752         $cat <<EOM
21753
21754 Checking to see what type is the last argument of accept().
21755 EOM
21756         yyy=''
21757         case "$d_socklen_t" in
21758         "$define") yyy="$yyy socklen_t"
21759         esac
21760         yyy="$yyy $sizetype int long unsigned"
21761         for xxx in $yyy; do
21762                 case "$socksizetype" in
21763                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21764                         case "$usesocks" in
21765                         "$define")
21766                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21767                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21768                                         socksizetype="$xxx"
21769                                 fi
21770                                 ;;
21771                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21772                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21773                                         socksizetype="$xxx"
21774                                 fi
21775                                 ;;
21776                         esac
21777                         ;;
21778                 esac
21779         done
21780 : In case none of those worked, prompt the user.
21781         case "$socksizetype" in
21782         '')     rp='What is the type for socket address structure sizes?'
21783                 dflt='int'
21784                 . ./myread
21785                 socksizetype=$ans
21786                 ;;
21787         esac
21788         ;;
21789 *)      : no sockets, so pick relatively harmless default
21790         socksizetype='int'
21791         ;;
21792 esac
21793
21794 : see what type is used for signed size_t
21795 set ssize_t ssizetype int stdio.h sys/types.h
21796 eval $typedef
21797 dflt="$ssizetype"
21798 $cat > try.c <<EOM
21799 #include <stdio.h>
21800 #$i_stdlib I_STDLIB
21801 #ifdef I_STDLIB
21802 #include <stdlib.h>
21803 #endif
21804 #include <sys/types.h>
21805 #define Size_t $sizetype
21806 #define SSize_t $dflt
21807 int main()
21808 {
21809         if (sizeof(Size_t) == sizeof(SSize_t))
21810                 printf("$dflt\n");
21811         else if (sizeof(Size_t) == sizeof(int))
21812                 printf("int\n");
21813         else
21814                 printf("long\n");
21815         exit(0);
21816 }
21817 EOM
21818 echo " "
21819 set try
21820 if eval $compile_ok && $run ./try > /dev/null; then
21821         ssizetype=`$run ./try`
21822         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21823 else
21824         $cat >&4 <<EOM
21825 Help! I can't compile and run the ssize_t test program: please enlighten me!
21826 (This is probably a misconfiguration in your system or libraries, and
21827 you really ought to fix it.  Still, I'll try anyway.)
21828
21829 I need a type that is the same size as $sizetype, but is guaranteed to
21830 be signed.  Common values are ssize_t, int and long.
21831
21832 EOM
21833         rp="What signed type is the same size as $sizetype?"
21834         . ./myread
21835         ssizetype="$ans"
21836 fi
21837 $rm_try
21838
21839 : Check the size of st_ino
21840 $echo " "
21841 $echo "Checking the size of st_ino..." >&4
21842 $cat > try.c <<EOCP
21843 #include <sys/stat.h>
21844 #include <stdio.h>
21845 #$i_stdlib I_STDLIB
21846 #ifdef I_STDLIB
21847 #include <stdlib.h>
21848 #endif
21849 int main() {
21850     struct stat st;
21851     printf("%d\n", (int)sizeof(st.st_ino));
21852     exit(0);
21853 }
21854 EOCP
21855 set try
21856 if eval $compile_ok; then
21857         val=`$run ./try`
21858         case "$val" in
21859         '')     st_ino_size=4
21860                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21861                 ;;
21862         *)      st_ino_size=$val
21863                 $echo "Your st_ino is $st_ino_size bytes long."
21864                 ;;
21865         esac
21866 else
21867         st_ino_size=4
21868         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21869 fi
21870 $rm_try
21871
21872 : Check if st_ino is signed
21873 $echo " "
21874 $echo "Checking the sign of st_ino..." >&4
21875 $cat > try.c <<EOCP
21876 #include <sys/stat.h>
21877 #include <stdio.h>
21878 int main() {
21879         struct stat foo;
21880         foo.st_ino = -1;
21881         if (foo.st_ino < 0)
21882                 printf("-1\n");
21883         else
21884                 printf("1\n");
21885 }
21886 EOCP
21887 set try
21888 if eval $compile; then
21889         val=`$run ./try`
21890         case "$val" in
21891         '')     st_ino_sign=1
21892                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21893                 ;;
21894         *)      st_ino_sign=$val
21895                 case "$st_ino_sign" in
21896                  1) $echo "Your st_ino is unsigned." ;;
21897                 -1) $echo "Your st_ino is signed."   ;;
21898                 esac
21899                 ;;
21900         esac
21901 else
21902         st_ino_sign=1
21903         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21904 fi
21905 $rm_try
21906
21907 : see what type of char stdio uses.
21908 echo " "
21909 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21910 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21911         echo "Your stdio uses unsigned chars." >&4
21912         stdchar="unsigned char"
21913 else
21914         echo "Your stdio uses signed chars." >&4
21915         stdchar="char"
21916 fi
21917 $rm -f stdioh
21918
21919 : see what type uids are declared as in the kernel
21920 echo " "
21921 echo "Looking for the type for user ids returned by getuid()."
21922 set uid_t uidtype xxx stdio.h sys/types.h
21923 eval $typedef
21924 case "$uidtype" in
21925 xxx)
21926         xxx=`./findhdr sys/user.h`
21927         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21928         case $1 in
21929         unsigned) dflt="$1 $2" ;;
21930         *) dflt="$1" ;;
21931         esac
21932         ;;
21933 *) dflt="$uidtype";;
21934 esac
21935 case "$uidtype" in
21936 uid_t)  echo "uid_t found." ;;
21937 *)      rp="What is the type for user ids returned by getuid()?"
21938         . ./myread
21939         uidtype="$ans"
21940         ;;
21941 esac
21942
21943 : Check size of UID
21944 echo " "
21945 case "$uidtype" in
21946 *_t) zzz="$uidtype"     ;;
21947 *)   zzz="uid"          ;;
21948 esac
21949 echo "Checking the size of $zzz..." >&4
21950 cat > try.c <<EOCP
21951 #include <sys/types.h>
21952 #include <stdio.h>
21953 #$i_stdlib I_STDLIB
21954 #ifdef I_STDLIB
21955 #include <stdlib.h>
21956 #endif
21957 int main() {
21958     printf("%d\n", (int)sizeof($uidtype));
21959     exit(0);
21960 }
21961 EOCP
21962 set try
21963 if eval $compile_ok; then
21964         yyy=`$run ./try`
21965         case "$yyy" in
21966         '')     uidsize=4
21967                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21968                 ;;
21969         *)      uidsize=$yyy
21970                 echo "Your $zzz is $uidsize bytes long."
21971                 ;;
21972         esac
21973 else
21974         uidsize=4
21975         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21976 fi
21977
21978 : Check if UID is signed
21979 echo " "
21980 case "$uidtype" in
21981 *_t) zzz="$uidtype"     ;;
21982 *)   zzz="uid"          ;;
21983 esac
21984 echo "Checking the sign of $zzz..." >&4
21985 cat > try.c <<EOCP
21986 #include <sys/types.h>
21987 #include <stdio.h>
21988 int main() {
21989         $uidtype foo = -1;
21990         if (foo < 0)
21991                 printf("-1\n");
21992         else
21993                 printf("1\n");
21994 }
21995 EOCP
21996 set try
21997 if eval $compile; then
21998         yyy=`$run ./try`
21999         case "$yyy" in
22000         '')     uidsign=1
22001                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22002                 ;;
22003         *)      uidsign=$yyy
22004                 case "$uidsign" in
22005                  1) echo "Your $zzz is unsigned." ;;
22006                 -1) echo "Your $zzz is signed."   ;;
22007                 esac
22008                 ;;
22009         esac
22010 else
22011         uidsign=1
22012         echo "(I can't compile the test program--guessing unsigned.)" >&4
22013 fi
22014
22015
22016 : Check format string for UID
22017 echo " "
22018 $echo "Checking the format string to be used for uids..." >&4
22019
22020 case "$uidsign" in
22021 -1)     if $test X"$uidsize" = X"$ivsize"; then
22022                 uidformat="$ivdformat"
22023         else
22024                 if $test X"$uidsize" = X"$longsize"; then
22025                         uidformat='"ld"'
22026                 else
22027                         if $test X"$uidsize" = X"$intsize"; then
22028                                 uidformat='"d"'
22029                         else
22030                                 if $test X"$uidsize" = X"$shortsize"; then
22031                                         uidformat='"hd"'
22032                                 fi
22033                         fi
22034                 fi
22035         fi
22036         ;;
22037 *)      if $test X"$uidsize" = X"$uvsize"; then
22038                 uidformat="$uvuformat"
22039         else
22040                 if $test X"$uidsize" = X"$longsize"; then
22041                         uidformat='"lu"'
22042                 else
22043                         if $test X"$uidsize" = X"$intsize"; then
22044                                 uidformat='"u"'
22045                         else
22046                                 if $test X"$uidsize" = X"$shortsize"; then
22047                                         uidformat='"hu"'
22048                                 fi
22049                         fi
22050                 fi
22051         fi
22052         ;;
22053 esac
22054
22055 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22056 echo " "
22057 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22058 $cat >try.c <<'EOM'
22059 /* Intentionally a long probe as I'd like to sanity check that the exact
22060    approach is going to work, as thinking it will work, but only having it
22061    part working at runtime is worse than not having it.  */
22062
22063 #include <sys/types.h>
22064 #include <sys/sysctl.h>
22065 #include <sys/param.h>
22066 #include <stdio.h>
22067 #include <string.h>
22068 #include <stdlib.h>
22069 #include <unistd.h>
22070
22071 int
22072 main(int argc, char **argv) {
22073     char *buffer;
22074     char *argv_leaf = strrchr(argv[0], '/');
22075     char *buffer_leaf;
22076     size_t size = 0;
22077     int mib[4];
22078
22079     mib[0] = CTL_KERN;
22080     mib[1] = KERN_PROC;
22081     mib[2] = KERN_PROC_PATHNAME;
22082     mib[3] = -1;
22083
22084     if (!argv_leaf) {
22085         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22086         return 1;
22087     }
22088
22089     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22090         perror("sysctl");
22091         return 2;
22092     }
22093
22094     if (size < strlen(argv_leaf) + 1) {
22095         fprintf(stderr, "size %lu is too short for a path\n",
22096                 (unsigned long) size);
22097         return 3;
22098     }
22099
22100     if (size > MAXPATHLEN * MAXPATHLEN) {
22101         fprintf(stderr, "size %lu is too long for a path\n",
22102                 (unsigned long) size);
22103         return 4;
22104     }
22105
22106     buffer = malloc(size);
22107     if (!buffer) {
22108         perror("malloc");
22109         return 5;
22110     }
22111
22112     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22113         perror("sysctl");
22114         return 6;
22115     }
22116
22117     if (strlen(buffer) + 1 != size) {
22118         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22119                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22120         return 7;
22121     }
22122
22123
22124     if (*buffer != '/') {
22125         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22126         return 8;
22127     }
22128
22129     if (strstr(buffer, "/./")) {
22130         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22131         return 9;
22132     }
22133
22134     if (strstr(buffer, "/../")) {
22135         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22136         return 10;
22137     }
22138
22139     buffer_leaf = strrchr(buffer, '/');
22140     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22141         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22142         return 11;
22143     }
22144
22145     free(buffer);
22146
22147     return 0;
22148 }
22149 EOM
22150
22151 val=$undef
22152 set try
22153 if eval $compile; then
22154         if $run ./try; then
22155                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22156                 val="$define"
22157         else
22158                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22159                 val="$undef"
22160         fi
22161 else
22162         echo "I'm unable to compile the test program." >&4
22163         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22164         val="$undef"
22165 fi
22166 $rm_try
22167 set usekernprocpathname
22168 eval $setvar
22169
22170 : Determine if we can use _NSGetExecutablePath to find executing program
22171 echo " "
22172 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22173 $cat >try.c <<'EOM'
22174 /* Intentionally a long probe as I'd like to sanity check that the exact
22175    approach is going to work, as thinking it will work, but only having it
22176    part working at runtime is worse than not having it.  */
22177 #include <mach-o/dyld.h>
22178 #include <stdio.h>
22179 #include <stdlib.h>
22180 #include <sys/param.h>
22181 #include <string.h>
22182
22183 int
22184 main(int argc, char **argv) {
22185     char buf[1];
22186     uint32_t size = sizeof(buf);
22187     int result;
22188     char *buffer;
22189     char *tidied;
22190     char *argv_leaf = strrchr(argv[0], '/');
22191     char *tidied_leaf;
22192
22193     if (!argv_leaf) {
22194         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22195         return 1;
22196     }
22197
22198     _NSGetExecutablePath(buf, &size);
22199     if (size > MAXPATHLEN * MAXPATHLEN) {
22200         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22201                 (unsigned int) size);
22202         return 2;
22203     }
22204
22205     buffer = malloc(size);
22206     if (!buffer) {
22207         perror("malloc");
22208         return 3;
22209     }
22210
22211     result = _NSGetExecutablePath(buffer, &size);
22212     if (result != 0) {
22213         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22214                 result, (unsigned int) size);
22215         return 4;
22216     }
22217
22218     tidied = realpath(buffer, NULL);
22219     if (!tidied) {
22220         perror("realpath");
22221         return 5;
22222     }
22223
22224     free(buffer);
22225
22226     if (*tidied != '/') {
22227         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22228         return 6;
22229     }
22230
22231     if (strstr(tidied, "/./")) {
22232         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22233         return 7;
22234     }
22235
22236     if (strstr(tidied, "/../")) {
22237         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22238         return 8;
22239     }
22240
22241     tidied_leaf = strrchr(tidied, '/');
22242     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22243         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22244         return 9;
22245     }
22246
22247     free(tidied);
22248
22249     return 0;
22250 }
22251 EOM
22252
22253 val=$undef
22254 set try
22255 if eval $compile; then
22256         if $run ./try; then
22257                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22258                 val="$define"
22259         else
22260                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22261         fi
22262 else
22263         echo "I'm unable to compile the test program." >&4
22264         echo "I'll assume no _NSGetExecutablePath here." >&4
22265 fi
22266 $rm_try
22267 set usensgetexecutablepath
22268 eval $setvar
22269
22270 : Check if site customization support was requested
22271 case "$usesitecustomize" in
22272     $define|true|[Yy]*)
22273         usesitecustomize="$define"
22274         ;;
22275     *)
22276         usesitecustomize="$undef"
22277         ;;
22278     esac
22279
22280 : see if prototypes support variable argument declarations
22281 echo " "
22282 case "$prototype$i_stdarg" in
22283 $define$define)
22284         echo "It appears we'll be able to prototype varargs functions." >&4
22285         val="$define"
22286         ;;
22287 *)
22288         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22289         val="$undef"
22290         ;;
22291 esac
22292 set vaproto
22293 eval $setvar
22294
22295 : determine compiler compiler
22296 case "$yacc" in
22297 '')
22298         dflt=yacc;;
22299 *)
22300         dflt="$yacc";;
22301 esac
22302 echo " "
22303 comp='yacc'
22304 if $test -f "$byacc$_exe"; then
22305         dflt="$byacc"
22306         comp="byacc or $comp"
22307 fi
22308 if $test -f "$bison$_exe"; then
22309         comp="$comp or bison -y"
22310 fi
22311 rp="Which compiler compiler ($comp) shall I use?"
22312 . ./myread
22313 yacc="$ans"
22314 case "$yacc" in
22315 *bis*)
22316         case "$yacc" in
22317         *-y*) ;;
22318         *)
22319                 yacc="$yacc -y"
22320                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22321                 ;;
22322         esac
22323         ;;
22324 esac
22325
22326 : see if this is a assert.h system
22327 set assert.h i_assert
22328 eval $inhdr
22329
22330 : see if this is a bfd.h system
22331 set bfd.h i_bfd
22332 eval $inhdr
22333
22334 : see if this is an execinfo.h system
22335 set execinfo.h i_execinfo
22336 eval $inhdr
22337
22338 : see if this is a fenv.h system
22339 set fenv.h i_fenv
22340 eval $inhdr
22341
22342 : see if this is a fp.h system
22343 set fp.h i_fp
22344 eval $inhdr
22345
22346 : see if this is a fp_class.h system
22347 set fp_class.h i_fp_class
22348 eval $inhdr
22349
22350 : see if gdbm.h is available
22351 set gdbm.h t_gdbm
22352 eval $inhdr
22353 case "$t_gdbm" in
22354 $define)
22355         : see if gdbm_open exists
22356         set gdbm_open d_gdbm_open
22357         eval $inlibc
22358         case "$d_gdbm_open" in
22359         $undef)
22360                 t_gdbm="$undef"
22361                 echo "We won't be including <gdbm.h>"
22362                 ;;
22363         esac
22364         ;;
22365 esac
22366 val="$t_gdbm"
22367 set i_gdbm
22368 eval $setvar
22369
22370 : see if this is a ieeefp.h system
22371 case "$i_ieeefp" in
22372 '' ) set ieeefp.h i_ieeefp
22373      eval $inhdr
22374      ;;
22375 esac
22376
22377 : see if this is a libutil.h system
22378 set libutil.h i_libutil
22379 eval $inhdr
22380
22381 : see if mach cthreads are available
22382 if test "X$usethreads" = "X$define"; then
22383         set mach/cthreads.h i_machcthr
22384         eval $inhdr
22385 else
22386         i_machcthr="$undef"
22387 fi
22388
22389 : see if this is a mntent.h system
22390 set mntent.h i_mntent
22391 eval $inhdr
22392
22393 : see if net/errno.h is available
22394 val=''
22395 set net/errno.h val
22396 eval $inhdr
22397
22398 : Unfortunately, it causes problems on some systems.  Arrgh.
22399 case "$val" in
22400 $define)
22401         cat > try.c <<'EOM'
22402 #include <stdio.h>
22403 #include <errno.h>
22404 #include <net/errno.h>
22405 int func()
22406 {
22407         return ENOTSOCK;
22408 }
22409 EOM
22410         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22411                 echo "We'll be including <net/errno.h>." >&4
22412         else
22413                 echo "We won't be including <net/errno.h>." >&4
22414                 val="$undef"
22415         fi
22416         $rm_try
22417         ;;
22418 esac
22419 set i_neterrno
22420 eval $setvar
22421
22422 : see if netinet/tcp.h is available
22423 set netinet/tcp.h i_netinettcp
22424 eval $inhdr
22425
22426 : see if this is a poll.h system
22427 set poll.h i_poll
22428 eval $inhdr
22429
22430 : see if this is a prot.h system
22431 set prot.h i_prot
22432 eval $inhdr
22433
22434 : Preprocessor symbols
22435 echo " "
22436 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22437 $cat <<'EOSH' > Cppsym.know
22438 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22439 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22440 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22441 arch_pwr ardent ARM ARM32 atarist att386 att3b
22442 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22443 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22444 byteorder byte_order
22445 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22446 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22447 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22448 ELF encore EPI EXTENSIONS
22449 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22450 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22451 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22452 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22453 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22454 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22455 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22456 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22457 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22458 ksr1
22459 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22460 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22461 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22462 luna88k Lynx
22463 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22464 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22465 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22466 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22467 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22468 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22469 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22470 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22471 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22472 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22473 ns32000 ns32016 ns32332 ns32k nsc32000
22474 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22475 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22476 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22477 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22478 QK_USER QNX
22479 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22480 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22481 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22482 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22483 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22484 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22485 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22486 SYSV4 SYSV5 sysV68 sysV88
22487 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22488 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22489 tower32_800 tower32_850 tss
22490 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22491 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22492 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22493 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22494 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22495 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22496 uxpm uxps
22497 vax venix VMESA vms
22498 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22499 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22500 z8000 zarch
22501 EOSH
22502 # Maybe put other stuff here too.
22503 ./tr '-' '_' <<EOSH >>Cppsym.know
22504 $osname
22505 EOSH
22506 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22507 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22508 $cat Cppsym.know > Cppsym.c
22509 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22510 $rm -f Cppsym.a Cppsym.b Cppsym.c
22511 cat <<EOSH > Cppsym
22512 $startsh
22513 if $test \$# -gt 0; then
22514     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22515     if $test -s Cppsym.got; then
22516         $rm -f Cppsym.got
22517         exit 0
22518     fi
22519     $rm -f Cppsym.got
22520     exit 1
22521 else
22522     $tr " " "$trnl" | ./Cppsym.try
22523     exit 0
22524 fi
22525 EOSH
22526 chmod +x Cppsym
22527 $eunicefix Cppsym
22528 cat <<EOSH > Cppsym.try
22529 $startsh
22530 cat <<'EOCP' > try.c
22531 #include <stdio.h>
22532 #if cpp_stuff == 1
22533 #define STRINGIFY(a)    "a"
22534 #endif
22535 #if cpp_stuff == 42
22536 #define StGiFy(a)  #a
22537 #define STRINGIFY(a)    StGiFy(a)
22538 #endif
22539 #if $cpp_stuff != 1 && $cpp_stuff != 42
22540 #   include "Bletch: How does this C preprocessor stringify macros?"
22541 #endif
22542 int main() {
22543 EOCP
22544 $awk \\
22545 EOSH
22546 cat <<'EOSH' >> Cppsym.try
22547 'length($1) > 0 {
22548     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22549     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22550     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22551     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22552 }'       >> try.c
22553 echo 'return 0;}' >> try.c
22554 EOSH
22555 cat <<EOSH >> Cppsym.try
22556 ccflags="$ccflags"
22557 case "$osname-$gccversion" in
22558 irix-) ccflags="\$ccflags -woff 1178" ;;
22559 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22560 esac
22561 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22562 EOSH
22563 chmod +x Cppsym.try
22564 $eunicefix Cppsym.try
22565 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22566 : Add in any Linux cpp "predefined macros":
22567 case "$osname::$gccversion" in
22568   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22569     tHdrH=_tmpHdr
22570     rm -f $tHdrH'.h' $tHdrH
22571     touch $tHdrH'.h'
22572     # Filter out macro arguments, such as Linux's __INT8_C(c)
22573     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22574        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22575        if [ -s $tHdrH'_cppsym.real' ]; then
22576           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22577        fi
22578     fi
22579     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22580   ;;
22581 esac
22582 : now check the C compiler for additional symbols
22583 postprocess_cc_v=''
22584 case "$osname" in
22585 aix) postprocess_cc_v="|$tr , ' '" ;;
22586 esac
22587 $cat >ccsym <<EOS
22588 $startsh
22589 $cat >tmp.c <<EOF
22590 extern int foo;
22591 EOF
22592 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22593 do
22594         case "\$i" in
22595         -D*) echo "\$i" | $sed 's/^-D//';;
22596         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22597         esac
22598 done
22599 $rm_try
22600 EOS
22601 postprocess_cc_v=''
22602 chmod +x ccsym
22603 $eunicefix ccsym
22604 ./ccsym > ccsym1.raw
22605 if $test -s ccsym1.raw; then
22606     $sort ccsym1.raw | $uniq >ccsym.raw
22607 else
22608     mv ccsym1.raw ccsym.raw
22609 fi
22610
22611 $awk '/\=/ { print $0; next }
22612         { print $0"=1" }' ccsym.raw >ccsym.list
22613 $comm -13 Cppsym.true ccsym.list >ccsym.own
22614 $comm -12 Cppsym.true ccsym.list >ccsym.com
22615 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22616 also=''
22617 if $test -z ccsym.raw; then
22618         echo "Your C compiler doesn't seem to define any symbols!" >&4
22619         echo " "
22620         echo "However, your C preprocessor defines the following symbols:"
22621         $cat Cppsym.true
22622         ccsymbols=''
22623         cppsymbols=`$cat Cppsym.true`
22624         cppsymbols=`echo $cppsymbols`
22625         cppccsymbols="$cppsymbols"
22626 else
22627         if $test -s ccsym.com; then
22628                 echo "Your C compiler and pre-processor define these symbols:"
22629                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22630                 also='also '
22631                 symbols='ones'
22632                 cppccsymbols=`$cat ccsym.com`
22633                 cppccsymbols=`echo $cppccsymbols`
22634                 $test "$silent" || sleep 1
22635         fi
22636         if $test -s ccsym.cpp; then
22637                 $test "$also" && echo " "
22638                 echo "Your C pre-processor ${also}defines the following symbols:"
22639                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22640                 also='further '
22641                 cppsymbols=`$cat ccsym.cpp`
22642                 cppsymbols=`echo $cppsymbols`
22643                 $test "$silent" || sleep 1
22644         fi
22645         if $test -s ccsym.own; then
22646                 $test "$also" && echo " "
22647                 echo "Your C compiler ${also}defines the following cpp symbols:"
22648                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22649                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22650                 ccsymbols=`$cat ccsym.own`
22651                 ccsymbols=`echo $ccsymbols`
22652                 $test "$silent" || sleep 1
22653         fi
22654 fi
22655
22656 : add -D_FORTIFY_SOURCE if feasible and not already there
22657 case "$gccversion" in
22658 4.*)    case "$optimize$ccflags" in
22659         *-O*)   case "$ccflags$cppsymbols" in
22660                 *_FORTIFY_SOURCE=*) # Don't add it again.
22661                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22662                         ;;
22663                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22664                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22665                         ;;
22666                 esac
22667                 ;;
22668         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22669                 ;;
22670         esac
22671         ;;
22672 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
22673         ;;
22674 esac
22675
22676 : see if this is a termio system
22677 val="$undef"
22678 val2="$undef"
22679 val3="$undef"
22680 if $test `./findhdr termios.h`; then
22681     set tcsetattr i_termios
22682     eval $inlibc
22683     val3="$i_termios"
22684 fi
22685 echo " "
22686 case "$val3" in
22687     "$define") echo "You have POSIX termios.h... good!" >&4;;
22688     *)  if ./Cppsym pyr; then
22689             case "`$run /bin/universe`" in
22690                 ucb) if $test `./findhdr sgtty.h`; then
22691                         val2="$define"
22692                         echo "<sgtty.h> found." >&4
22693                     else
22694                         echo "System is pyramid with BSD universe."
22695                         ./warn "<sgtty.h> not found--you could have problems."
22696                     fi;;
22697                 *)  if $test `./findhdr termio.h`; then
22698                         val="$define"
22699                         echo "<termio.h> found." >&4
22700                     else
22701                         echo "System is pyramid with USG universe."
22702                         ./warn "<termio.h> not found--you could have problems."
22703                     fi;;
22704             esac
22705         elif ./usg; then
22706             if $test `./findhdr termio.h`; then
22707                 echo "<termio.h> found." >&4
22708                 val="$define"
22709             elif $test `./findhdr sgtty.h`; then
22710                 echo "<sgtty.h> found." >&4
22711                 val2="$define"
22712             else
22713                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22714             fi
22715         else
22716             if $test `./findhdr sgtty.h`; then
22717                 echo "<sgtty.h> found." >&4
22718                 val2="$define"
22719             elif $test `./findhdr termio.h`; then
22720                 echo "<termio.h> found." >&4
22721                 val="$define"
22722             else
22723                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22724             fi
22725         fi;;
22726 esac
22727 set i_termio; eval $setvar
22728 val=$val2; set i_sgtty; eval $setvar
22729 val=$val3; set i_termios; eval $setvar
22730
22731 : see if stdbool is available
22732 : we want a real compile instead of Inhdr because some Solaris systems
22733 : have stdbool.h, but it can only be used if the compiler indicates it
22734 : is sufficiently c99-compliant.
22735 echo " "
22736 $cat >try.c <<EOCP
22737 #include <stdio.h>
22738 #include <stdbool.h>
22739 int func(bool x)
22740 {
22741     return x ? 1 : 0;
22742 }
22743 int main(int argc, char **argv)
22744 {
22745     return func(0);
22746 }
22747 EOCP
22748 set try
22749 if eval $compile; then
22750         echo "<stdbool.h> found." >&4
22751         val="$define"
22752 else
22753         echo "<stdbool.h> NOT found." >&4
22754         val="$undef"
22755 fi
22756 $rm_try
22757 set i_stdbool
22758 eval $setvar
22759
22760 : see if stddef is available
22761 set stddef.h i_stddef
22762 eval $inhdr
22763
22764 : see if stdint is available
22765 set stdint.h i_stdint
22766 eval $inhdr
22767
22768 : see if sys/access.h is available
22769 set sys/access.h i_sysaccess
22770 eval $inhdr
22771
22772 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22773 set sys/filio.h i_sysfilio
22774 eval $inhdr
22775 echo " "
22776 if $test `./findhdr sys/ioctl.h`; then
22777         val="$define"
22778         echo '<sys/ioctl.h> found.' >&4
22779 else
22780         val="$undef"
22781         if $test $i_sysfilio = "$define"; then
22782             echo '<sys/ioctl.h> NOT found.' >&4
22783         else
22784                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22785                 $test $i_termio = "$define" && xxx="termio.h"
22786                 $test $i_termios = "$define" && xxx="termios.h"
22787 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22788         fi
22789 fi
22790 set i_sysioctl
22791 eval $setvar
22792
22793 : see if socket ioctl defs are in sys/sockio.h
22794 echo " "
22795 xxx=`./findhdr sys/sockio.h`
22796 if $test "$xxx"; then
22797         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22798                 val="$define"
22799                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22800         else
22801                 val="$undef"
22802                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22803         fi
22804 else
22805         val="$undef"
22806         $cat <<EOM
22807 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22808 EOM
22809 fi
22810 set i_syssockio
22811 eval $setvar
22812
22813 : see if this is a syslog.h system
22814 set syslog.h i_syslog
22815 eval $inhdr
22816
22817 : see if this is a sys/mode.h system
22818 set sys/mode.h i_sysmode
22819 eval $inhdr
22820
22821 : see if there is a sys/poll.h file
22822 set sys/poll.h i_syspoll
22823 eval $inhdr
22824
22825 : see if sys/resource.h has to be included
22826 set sys/resource.h i_sysresrc
22827 eval $inhdr
22828
22829 : see if sys/security.h is available
22830 set sys/security.h i_syssecrt
22831 eval $inhdr
22832
22833 : see if this is a sys/statvfs.h system
22834 set sys/statvfs.h i_sysstatvfs
22835 eval $inhdr
22836
22837 : see if this is a sys/un.h system
22838 set sys/un.h i_sysun
22839 eval $inhdr
22840
22841 : see if this is a sys/utsname.h system
22842 set sys/utsname.h i_sysutsname
22843 eval $inhdr
22844
22845 : see if this is a syswait system
22846 set sys/wait.h i_syswait
22847 eval $inhdr
22848
22849 : see if this is a ustat.h system
22850 set ustat.h i_ustat
22851 eval $inhdr
22852
22853 : see if this is an utime system
22854 set utime.h i_utime
22855 eval $inhdr
22856
22857 : see if this is a vfork system
22858 case "$d_vfork" in
22859 "$define")
22860         set vfork.h i_vfork
22861         eval $inhdr
22862         ;;
22863 *)
22864         i_vfork="$undef"
22865         ;;
22866 esac
22867
22868 : Check extensions
22869 echo " "
22870 echo "Looking for extensions..." >&4
22871 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22872 : contain old or inaccurate or duplicate values.
22873 nonxs_extensions=''
22874 xs_extensions=''
22875 : We do not use find because it might not be available.
22876 : We do not just use MANIFEST because the user may have dropped
22877 : some additional extensions into the source tree and expect them
22878 : to be built.
22879
22880 : Function to recursively find available extensions, ignoring DynaLoader
22881 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22882 : In 5.10.1 and later, extensions are stored in directories
22883 : like File-Glob instead of the older File/Glob/.
22884 find_extensions='
22885     for xxx in *; do
22886         case "$xxx" in
22887             DynaLoader|dynaload) ;;
22888             *)
22889             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22890             case "$this_ext" in
22891                 Scalar/List/Utils) this_ext="List/Util" ;;
22892                 PathTools)         this_ext="Cwd"       ;;
22893             esac;
22894             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
22895             if $contains " $this_ext " $tdir/$$.tmp; then
22896                 echo >&4;
22897                 echo "Duplicate directories detected for extension $xxx" >&4;
22898                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22899                 case "$knowitall" in
22900                 "") dflt=y;;
22901                 *) dflt=n;;
22902                 esac;
22903                 . ../UU/myread;
22904                 case "$ans" in
22905                 n*|N*) ;;
22906                 *) echo >&4;
22907                     echo "Ok.  Stopping Configure." >&4;
22908                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22909                     exit 1;;
22910                 esac;
22911                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22912             fi;
22913             $ls -1 $xxx > $tdir/$$.tmp;
22914             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
22915                 xs_extensions="$xs_extensions $this_ext";
22916             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
22917                 xs_extensions="$xs_extensions $this_ext";
22918             elif $test -d $xxx; then
22919                 nonxs_extensions="$nonxs_extensions $this_ext";
22920             fi;
22921             $rm -f $tdir/$$.tmp;
22922             ;;
22923         esac;
22924     done'
22925 tdir=`pwd`
22926 cd "$rsrc/cpan"
22927 set X
22928 shift
22929 eval $find_extensions
22930 cd "$rsrc/dist"
22931 set X
22932 shift
22933 eval $find_extensions
22934 cd "$rsrc/ext"
22935 set X
22936 shift
22937 eval $find_extensions
22938 set X $xs_extensions
22939 shift
22940 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22941 set X $nonxs_extensions
22942 shift
22943 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22944 cd "$tdir"
22945 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22946
22947 : Now see which are supported on this system.
22948 avail_ext=''
22949 for xxx in $xs_extensions ; do
22950         case "$xxx" in
22951         DB_File|db_file)
22952                 case "$i_db" in
22953                 $define) avail_ext="$avail_ext $xxx" ;;
22954                 esac
22955                 ;;
22956         GDBM_File|gdbm_fil)
22957                 case "$i_gdbm" in
22958                 $define) avail_ext="$avail_ext $xxx" ;;
22959                 esac
22960                 ;;
22961         I18N/Langinfo|i18n_lan)
22962                 case "$i_langinfo$d_nl_langinfo" in
22963                 $define$define) avail_ext="$avail_ext $xxx" ;;
22964                 esac
22965                 ;;
22966         IPC/SysV|ipc/sysv)
22967                 : XXX Do we need a useipcsysv variable here
22968                 case "${d_msg}${d_sem}${d_shm}" in
22969                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22970                 esac
22971                 ;;
22972         NDBM_File|ndbm_fil)
22973                 case "$d_ndbm" in
22974                 $define)
22975                     case "$osname-$use64bitint" in
22976                     hpux-define)
22977                         case "$libs" in
22978                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22979                         esac
22980                         ;;
22981                     *) avail_ext="$avail_ext $xxx" ;;
22982                     esac
22983                     ;;
22984                 esac
22985                 ;;
22986         ODBM_File|odbm_fil)
22987                 case "${i_dbm}${i_rpcsvcdbm}" in
22988                 *"${define}"*)
22989                     case "$d_cplusplus" in
22990                     define) ;; # delete as a function name will not work
22991                     *)  case "$osname-$use64bitint" in
22992                         hpux-define)
22993                             case "$libs" in
22994                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22995                             esac
22996                             ;;
22997                         *) avail_ext="$avail_ext $xxx" ;;
22998                         esac
22999                         ;;
23000                     esac
23001                     ;;
23002                 esac
23003                 ;;
23004         Opcode|opcode)
23005                 case "$useopcode" in
23006                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23007                 esac
23008                 ;;
23009         POSIX|posix)
23010                 case "$useposix" in
23011                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23012                 esac
23013                 ;;
23014         Socket|socket)
23015                 case "$d_socket" in
23016                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23017                 esac
23018                 ;;
23019         Sys/Syslog|sys/syslog)
23020                 : XXX syslog requires socket
23021                 case "$d_socket" in
23022                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23023                 esac
23024                 ;;
23025         Thread|thread)
23026                 case "$usethreads" in
23027                 true|$define|y)
23028                         case "$use5005threads" in
23029                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23030                         esac
23031                 esac
23032                 ;;
23033         threads|threads/shared)
23034                 # threads and threads::shared are special cases.
23035                 # To stop people from asking "Perl 5.8.0 was supposed
23036                 # to have this new fancy threads implementation but my
23037                 # perl doesn't have it" and from people trying to
23038                 # (re)install the threads module using CPAN.pm and
23039                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23040                 # the threads.pm and threads/shared.pm will always be
23041                 # there, croaking informatively ("you need to rebuild
23042                 # all of Perl with threads, sorry") when threads haven't
23043                 # been compiled in.
23044                 # --jhi
23045                 avail_ext="$avail_ext $xxx"
23046                 ;;
23047         VMS*)
23048                 ;;
23049         Win32*)
23050                 case "$osname" in
23051                 cygwin) avail_ext="$avail_ext $xxx" ;;
23052                 esac
23053                 ;;
23054         XS/APItest|xs/apitest)
23055                 # This is just for testing.  Skip it unless we have dynamic loading.
23056
23057                 case "$usedl" in
23058                 $define) avail_ext="$avail_ext $xxx" ;;
23059                 esac
23060                 ;;
23061         XS/Typemap|xs/typemap)
23062                 # This is just for testing.  Skip it unless we have dynamic loading.
23063                 case "$usedl" in
23064                 $define) avail_ext="$avail_ext $xxx" ;;
23065                 esac
23066                 ;;
23067         *)      avail_ext="$avail_ext $xxx"
23068                 ;;
23069         esac
23070 done
23071
23072 set X $avail_ext
23073 shift
23074 avail_ext="$*"
23075
23076 case "$onlyextensions" in
23077 '') ;;
23078 *)  keepextensions=''
23079     echo "You have requested that only certain extensions be included..." >&4
23080     for i in $onlyextensions; do
23081         case " $avail_ext " in
23082         *" $i "*)
23083             echo "Keeping extension $i."
23084             keepextensions="$keepextensions $i"
23085             ;;
23086         *) echo "Ignoring extension $i." ;;
23087         esac
23088     done
23089     avail_ext="$keepextensions"
23090     ;;
23091 esac
23092
23093 case "$noextensions" in
23094 '') ;;
23095 *)  keepextensions=''
23096     echo "You have requested that certain extensions be ignored..." >&4
23097     for i in $avail_ext; do
23098         case " $noextensions " in
23099         *" $i "*) echo "Ignoring extension $i." ;;
23100         *) echo "Keeping extension $i.";
23101            keepextensions="$keepextensions $i"
23102            ;;
23103         esac
23104     done
23105     avail_ext="$keepextensions"
23106     ;;
23107 esac
23108
23109 : Now see which nonxs extensions are supported on this system.
23110 : For now assume all are.
23111 nonxs_ext=''
23112 for xxx in $nonxs_extensions ; do
23113         case "$xxx" in
23114         VMS*)
23115                 ;;
23116         *)      nonxs_ext="$nonxs_ext $xxx"
23117                 ;;
23118         esac
23119 done
23120
23121 set X $nonxs_ext
23122 shift
23123 nonxs_ext="$*"
23124
23125 case $usedl in
23126 $define)
23127         $cat <<EOM
23128 A number of extensions are supplied with $package.  You may choose to
23129 compile these extensions for dynamic loading (the default), compile
23130 them into the $package executable (static loading), or not include
23131 them at all.  Answer "none" to include no extensions.
23132 Note that DynaLoader is always built and need not be mentioned here.
23133
23134 EOM
23135         case "$dynamic_ext" in
23136         '')
23137                 : Exclude those listed in static_ext
23138                 dflt=''
23139                 for xxx in $avail_ext; do
23140                         case " $static_ext " in
23141                         *" $xxx "*) ;;
23142                         *) dflt="$dflt $xxx" ;;
23143                         esac
23144                 done
23145                 set X $dflt
23146                 shift
23147                 dflt="$*"
23148                 ;;
23149         *)      dflt="$dynamic_ext"
23150                 # Perhaps we are reusing an old out-of-date config.sh.
23151                 case "$hint" in
23152                 previous)
23153                         if test X"$dynamic_ext" != X"$avail_ext"; then
23154                                 $cat <<EOM
23155 NOTICE:  Your previous config.sh list may be incorrect.
23156 The extensions now available to you are
23157         ${avail_ext}
23158 but the default list from your previous config.sh is
23159         ${dynamic_ext}
23160
23161 EOM
23162                         fi
23163                         ;;
23164                 esac
23165                 ;;
23166         esac
23167         case "$dflt" in
23168         '')     dflt=none;;
23169         esac
23170         rp="What extensions do you wish to load dynamically?"
23171         . ./myread
23172         case "$ans" in
23173         none) dynamic_ext=' ' ;;
23174         *) dynamic_ext="$ans" ;;
23175         esac
23176
23177         case "$static_ext" in
23178         '')
23179                 : Exclude those already listed in dynamic linking
23180                 dflt=''
23181                 for xxx in $avail_ext; do
23182                         case " $dynamic_ext " in
23183                         *" $xxx "*) ;;
23184                         *) dflt="$dflt $xxx" ;;
23185                         esac
23186                 done
23187                 set X $dflt
23188                 shift
23189                 dflt="$*"
23190                 ;;
23191         *)  dflt="$static_ext"
23192                 ;;
23193         esac
23194
23195         case "$dflt" in
23196         '')     dflt=none;;
23197         esac
23198         rp="What extensions do you wish to load statically?"
23199         . ./myread
23200         case "$ans" in
23201         none) static_ext=' ' ;;
23202         *) static_ext="$ans" ;;
23203         esac
23204         ;;
23205 *)
23206         $cat <<EOM
23207 A number of extensions are supplied with $package.  Answer "none"
23208 to include no extensions.
23209 Note that DynaLoader is always built and need not be mentioned here.
23210
23211 EOM
23212         case "$static_ext" in
23213         '') dflt="$avail_ext" ;;
23214         *)      dflt="$static_ext"
23215                 # Perhaps we are reusing an old out-of-date config.sh.
23216                 case "$hint" in
23217                 previous)
23218                         if test X"$static_ext" != X"$avail_ext"; then
23219                                 $cat <<EOM
23220 NOTICE:  Your previous config.sh list may be incorrect.
23221 The extensions now available to you are
23222         ${avail_ext}
23223 but the default list from your previous config.sh is
23224         ${static_ext}
23225
23226 EOM
23227                         fi
23228                         ;;
23229                 esac
23230                 ;;
23231         esac
23232         : Exclude those that are not xs extensions
23233         case "$dflt" in
23234         '')     dflt=none;;
23235         esac
23236         rp="What extensions do you wish to include?"
23237         . ./myread
23238         case "$ans" in
23239         none) static_ext=' ' ;;
23240         *) static_ext="$ans" ;;
23241         esac
23242         ;;
23243 esac
23244 #
23245 # Encode is a special case.  If we are building Encode as a static
23246 # extension, we need to explicitly list its subextensions as well.
23247 # For other nested extensions, this is handled automatically by
23248 # the appropriate Makefile.PL.
23249 case " $static_ext " in
23250         *" Encode "*) # Add the subextensions of Encode
23251         cd "$rsrc/cpan"
23252         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23253                 static_ext="$static_ext Encode/$xxx"
23254                 known_extensions="$known_extensions Encode/$xxx"
23255         done
23256         cd "$tdir"
23257         ;;
23258 esac
23259
23260 set X $dynamic_ext $static_ext $nonxs_ext
23261 shift
23262 extensions="$*"
23263
23264 # Sanity check:  We require an extension suitable for use with
23265 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23266 # should show up as failures in the test suite, but it's helpful to
23267 # catch them now.) The 'extensions' list is normally sorted
23268 # alphabetically, so we need to accept either
23269 #    DB_File ... Fcntl ... IO  ....
23270 # or something like
23271 #    Fcntl ... NDBM_File ... IO  ....
23272 case " $extensions"  in
23273 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23274 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23275 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23276 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23277    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23278    ;;
23279 esac
23280
23281 : Remove libraries needed only for extensions
23282 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23283 : The exception is SunOS 4.x, which needs them.
23284 case "${osname}X${osvers}" in
23285 sunos*X4*)
23286     perllibs="$libs"
23287     ;;
23288 *) case "$usedl" in
23289     $define|true|[yY]*)
23290             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23291             shift
23292             perllibs="$*"
23293             ;;
23294     *)  perllibs="$libs"
23295             ;;
23296     esac
23297     ;;
23298 esac
23299
23300 : Remove build directory name from cppstdin so it can be used from
23301 : either the present location or the final installed location.
23302 echo " "
23303 : Get out of the UU directory to get correct path name.
23304 cd ..
23305 case "$cppstdin" in
23306 `pwd`/cppstdin)
23307         echo "Stripping down cppstdin path name"
23308         cppstdin=cppstdin
23309         ;;
23310 esac
23311 cd UU
23312
23313 : end of configuration questions
23314 echo " "
23315 echo "End of configuration questions."
23316 echo " "
23317
23318 : back to where it started
23319 if test -d ../UU; then
23320         cd ..
23321 fi
23322
23323 : configuration may be unconditionally patched via a 'config.arch' file
23324 if $test -f config.arch; then
23325         echo "I see a config.arch file, loading it." >&4
23326         . ./config.arch
23327 fi
23328
23329 : configuration may be patched via a 'config.over' file
23330 if $test -f config.over; then
23331         echo " "
23332         dflt=y
23333         rp='I see a config.over file.  Do you wish to load it?'
23334         . UU/myread
23335         case "$ans" in
23336         n*) echo "OK, I'll ignore it.";;
23337         *)      . ./config.over
23338                 echo "Configuration override changes have been loaded."
23339                 ;;
23340         esac
23341 fi
23342
23343 : in case they want portability, strip down executable paths
23344 case "$d_portable" in
23345 "$define")
23346         echo " "
23347         echo "Stripping down executable paths..." >&4
23348         for file in $loclist $trylist; do
23349                 eval temp=\$$file
23350                 eval $file=`basename $temp`
23351         done
23352         ;;
23353 esac
23354
23355 : create config.sh file
23356 echo " "
23357 echo "Creating config.sh..." >&4
23358 $spitshell <<EOT >config.sh
23359 $startsh
23360 #
23361 # This file was produced by running the Configure script. It holds all the
23362 # definitions figured out by Configure. Should you modify one of these values,
23363 # do not forget to propagate your changes by running "Configure -der". You may
23364 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23365 #
23366
23367 # Package name      : $package
23368 # Source directory  : $src
23369 # Configuration time: $cf_time
23370 # Configured by     : $cf_by
23371 # Target system     : $myuname
23372
23373 EOT
23374 : Add in command line options if available
23375 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23376
23377 $spitshell <<EOT >>config.sh
23378
23379 Author='$Author'
23380 Date='$Date'
23381 Header='$Header'
23382 Id='$Id'
23383 Locker='$Locker'
23384 Log='$Log'
23385 RCSfile='$RCSfile'
23386 Revision='$Revision'
23387 Source='$Source'
23388 State='$State'
23389 _a='$_a'
23390 _exe='$_exe'
23391 _o='$_o'
23392 afs='$afs'
23393 afsroot='$afsroot'
23394 alignbytes='$alignbytes'
23395 ansi2knr='$ansi2knr'
23396 aphostname='$aphostname'
23397 api_revision='$api_revision'
23398 api_subversion='$api_subversion'
23399 api_version='$api_version'
23400 api_versionstring='$api_versionstring'
23401 ar='$ar'
23402 archlib='$archlib'
23403 archlibexp='$archlibexp'
23404 archname64='$archname64'
23405 archname='$archname'
23406 archobjs='$archobjs'
23407 asctime_r_proto='$asctime_r_proto'
23408 awk='$awk'
23409 baserev='$baserev'
23410 bash='$bash'
23411 bin='$bin'
23412 bin_ELF='$bin_ELF'
23413 binexp='$binexp'
23414 bison='$bison'
23415 byacc='$byacc'
23416 byteorder='$byteorder'
23417 c='$c'
23418 castflags='$castflags'
23419 cat='$cat'
23420 cc='$cc'
23421 cccdlflags='$cccdlflags'
23422 ccdlflags='$ccdlflags'
23423 ccflags='$ccflags'
23424 ccflags_uselargefiles='$ccflags_uselargefiles'
23425 ccname='$ccname'
23426 ccsymbols='$ccsymbols'
23427 ccversion='$ccversion'
23428 cf_by='$cf_by'
23429 cf_email='$cf_email'
23430 cf_time='$cf_time'
23431 charbits='$charbits'
23432 charsize='$charsize'
23433 chgrp='$chgrp'
23434 chmod='$chmod'
23435 chown='$chown'
23436 clocktype='$clocktype'
23437 comm='$comm'
23438 compress='$compress'
23439 contains='$contains'
23440 cp='$cp'
23441 cpio='$cpio'
23442 cpp='$cpp'
23443 cpp_stuff='$cpp_stuff'
23444 cppccsymbols='$cppccsymbols'
23445 cppflags='$cppflags'
23446 cpplast='$cpplast'
23447 cppminus='$cppminus'
23448 cpprun='$cpprun'
23449 cppstdin='$cppstdin'
23450 cppsymbols='$cppsymbols'
23451 crypt_r_proto='$crypt_r_proto'
23452 cryptlib='$cryptlib'
23453 csh='$csh'
23454 ctermid_r_proto='$ctermid_r_proto'
23455 ctime_r_proto='$ctime_r_proto'
23456 d_Gconvert='$d_Gconvert'
23457 d_PRIEUldbl='$d_PRIEUldbl'
23458 d_PRIFUldbl='$d_PRIFUldbl'
23459 d_PRIGUldbl='$d_PRIGUldbl'
23460 d_PRIXU64='$d_PRIXU64'
23461 d_PRId64='$d_PRId64'
23462 d_PRIeldbl='$d_PRIeldbl'
23463 d_PRIfldbl='$d_PRIfldbl'
23464 d_PRIgldbl='$d_PRIgldbl'
23465 d_PRIi64='$d_PRIi64'
23466 d_PRIo64='$d_PRIo64'
23467 d_PRIu64='$d_PRIu64'
23468 d_PRIx64='$d_PRIx64'
23469 d_SCNfldbl='$d_SCNfldbl'
23470 d__fwalk='$d__fwalk'
23471 d_access='$d_access'
23472 d_accessx='$d_accessx'
23473 d_acosh='$d_acosh'
23474 d_aintl='$d_aintl'
23475 d_alarm='$d_alarm'
23476 d_archlib='$d_archlib'
23477 d_asctime64='$d_asctime64'
23478 d_asctime_r='$d_asctime_r'
23479 d_atolf='$d_atolf'
23480 d_atoll='$d_atoll'
23481 d_attribute_deprecated='$d_attribute_deprecated'
23482 d_attribute_format='$d_attribute_format'
23483 d_attribute_malloc='$d_attribute_malloc'
23484 d_attribute_nonnull='$d_attribute_nonnull'
23485 d_attribute_noreturn='$d_attribute_noreturn'
23486 d_attribute_pure='$d_attribute_pure'
23487 d_attribute_unused='$d_attribute_unused'
23488 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23489 d_backtrace='$d_backtrace'
23490 d_bcmp='$d_bcmp'
23491 d_bcopy='$d_bcopy'
23492 d_bsd='$d_bsd'
23493 d_bsdgetpgrp='$d_bsdgetpgrp'
23494 d_bsdsetpgrp='$d_bsdsetpgrp'
23495 d_builtin_choose_expr='$d_builtin_choose_expr'
23496 d_builtin_expect='$d_builtin_expect'
23497 d_bzero='$d_bzero'
23498 d_c99_variadic_macros='$d_c99_variadic_macros'
23499 d_casti32='$d_casti32'
23500 d_castneg='$d_castneg'
23501 d_charvspr='$d_charvspr'
23502 d_chown='$d_chown'
23503 d_chroot='$d_chroot'
23504 d_chsize='$d_chsize'
23505 d_class='$d_class'
23506 d_clearenv='$d_clearenv'
23507 d_closedir='$d_closedir'
23508 d_cmsghdr_s='$d_cmsghdr_s'
23509 d_const='$d_const'
23510 d_copysignl='$d_copysignl'
23511 d_cplusplus='$d_cplusplus'
23512 d_crypt='$d_crypt'
23513 d_crypt_r='$d_crypt_r'
23514 d_csh='$d_csh'
23515 d_ctermid='$d_ctermid'
23516 d_ctermid_r='$d_ctermid_r'
23517 d_ctime64='$d_ctime64'
23518 d_ctime_r='$d_ctime_r'
23519 d_cuserid='$d_cuserid'
23520 d_dbl_dig='$d_dbl_dig'
23521 d_dbminitproto='$d_dbminitproto'
23522 d_difftime64='$d_difftime64'
23523 d_difftime='$d_difftime'
23524 d_dir_dd_fd='$d_dir_dd_fd'
23525 d_dirfd='$d_dirfd'
23526 d_dirnamlen='$d_dirnamlen'
23527 d_dladdr='$d_dladdr'
23528 d_dlerror='$d_dlerror'
23529 d_dlopen='$d_dlopen'
23530 d_dlsymun='$d_dlsymun'
23531 d_dosuid='$d_dosuid'
23532 d_drand48_r='$d_drand48_r'
23533 d_drand48proto='$d_drand48proto'
23534 d_dup2='$d_dup2'
23535 d_eaccess='$d_eaccess'
23536 d_endgrent='$d_endgrent'
23537 d_endgrent_r='$d_endgrent_r'
23538 d_endhent='$d_endhent'
23539 d_endhostent_r='$d_endhostent_r'
23540 d_endnent='$d_endnent'
23541 d_endnetent_r='$d_endnetent_r'
23542 d_endpent='$d_endpent'
23543 d_endprotoent_r='$d_endprotoent_r'
23544 d_endpwent='$d_endpwent'
23545 d_endpwent_r='$d_endpwent_r'
23546 d_endsent='$d_endsent'
23547 d_endservent_r='$d_endservent_r'
23548 d_eofnblk='$d_eofnblk'
23549 d_eunice='$d_eunice'
23550 d_faststdio='$d_faststdio'
23551 d_fchdir='$d_fchdir'
23552 d_fchmod='$d_fchmod'
23553 d_fchown='$d_fchown'
23554 d_fcntl='$d_fcntl'
23555 d_fcntl_can_lock='$d_fcntl_can_lock'
23556 d_fd_macros='$d_fd_macros'
23557 d_fd_set='$d_fd_set'
23558 d_fds_bits='$d_fds_bits'
23559 d_fegetround='$d_fegetround'
23560 d_fgetpos='$d_fgetpos'
23561 d_finite='$d_finite'
23562 d_finitel='$d_finitel'
23563 d_flexfnam='$d_flexfnam'
23564 d_flock='$d_flock'
23565 d_flockproto='$d_flockproto'
23566 d_fork='$d_fork'
23567 d_fp_class='$d_fp_class'
23568 d_fp_classify='$d_fp_classify'
23569 d_fp_classl='$d_fp_classl'
23570 d_fpathconf='$d_fpathconf'
23571 d_fpclass='$d_fpclass'
23572 d_fpclassify='$d_fpclassify'
23573 d_fpclassl='$d_fpclassl'
23574 d_fpgetround='$d_fpgetround'
23575 d_fpos64_t='$d_fpos64_t'
23576 d_frexpl='$d_frexpl'
23577 d_fs_data_s='$d_fs_data_s'
23578 d_fseeko='$d_fseeko'
23579 d_fsetpos='$d_fsetpos'
23580 d_fstatfs='$d_fstatfs'
23581 d_fstatvfs='$d_fstatvfs'
23582 d_fsync='$d_fsync'
23583 d_ftello='$d_ftello'
23584 d_ftime='$d_ftime'
23585 d_futimes='$d_futimes'
23586 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23587 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23588 d_getaddrinfo='$d_getaddrinfo'
23589 d_getcwd='$d_getcwd'
23590 d_getespwnam='$d_getespwnam'
23591 d_getfsstat='$d_getfsstat'
23592 d_getgrent='$d_getgrent'
23593 d_getgrent_r='$d_getgrent_r'
23594 d_getgrgid_r='$d_getgrgid_r'
23595 d_getgrnam_r='$d_getgrnam_r'
23596 d_getgrps='$d_getgrps'
23597 d_gethbyaddr='$d_gethbyaddr'
23598 d_gethbyname='$d_gethbyname'
23599 d_gethent='$d_gethent'
23600 d_gethname='$d_gethname'
23601 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23602 d_gethostbyname_r='$d_gethostbyname_r'
23603 d_gethostent_r='$d_gethostent_r'
23604 d_gethostprotos='$d_gethostprotos'
23605 d_getitimer='$d_getitimer'
23606 d_getlogin='$d_getlogin'
23607 d_getlogin_r='$d_getlogin_r'
23608 d_getmnt='$d_getmnt'
23609 d_getmntent='$d_getmntent'
23610 d_getnameinfo='$d_getnameinfo'
23611 d_getnbyaddr='$d_getnbyaddr'
23612 d_getnbyname='$d_getnbyname'
23613 d_getnent='$d_getnent'
23614 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23615 d_getnetbyname_r='$d_getnetbyname_r'
23616 d_getnetent_r='$d_getnetent_r'
23617 d_getnetprotos='$d_getnetprotos'
23618 d_getpagsz='$d_getpagsz'
23619 d_getpbyname='$d_getpbyname'
23620 d_getpbynumber='$d_getpbynumber'
23621 d_getpent='$d_getpent'
23622 d_getpgid='$d_getpgid'
23623 d_getpgrp2='$d_getpgrp2'
23624 d_getpgrp='$d_getpgrp'
23625 d_getppid='$d_getppid'
23626 d_getprior='$d_getprior'
23627 d_getprotobyname_r='$d_getprotobyname_r'
23628 d_getprotobynumber_r='$d_getprotobynumber_r'
23629 d_getprotoent_r='$d_getprotoent_r'
23630 d_getprotoprotos='$d_getprotoprotos'
23631 d_getprpwnam='$d_getprpwnam'
23632 d_getpwent='$d_getpwent'
23633 d_getpwent_r='$d_getpwent_r'
23634 d_getpwnam_r='$d_getpwnam_r'
23635 d_getpwuid_r='$d_getpwuid_r'
23636 d_getsbyname='$d_getsbyname'
23637 d_getsbyport='$d_getsbyport'
23638 d_getsent='$d_getsent'
23639 d_getservbyname_r='$d_getservbyname_r'
23640 d_getservbyport_r='$d_getservbyport_r'
23641 d_getservent_r='$d_getservent_r'
23642 d_getservprotos='$d_getservprotos'
23643 d_getspnam='$d_getspnam'
23644 d_getspnam_r='$d_getspnam_r'
23645 d_gettimeod='$d_gettimeod'
23646 d_gmtime64='$d_gmtime64'
23647 d_gmtime_r='$d_gmtime_r'
23648 d_gnulibc='$d_gnulibc'
23649 d_grpasswd='$d_grpasswd'
23650 d_hasmntopt='$d_hasmntopt'
23651 d_htonl='$d_htonl'
23652 d_ilogbl='$d_ilogbl'
23653 d_inc_version_list='$d_inc_version_list'
23654 d_index='$d_index'
23655 d_inetaton='$d_inetaton'
23656 d_inetntop='$d_inetntop'
23657 d_inetpton='$d_inetpton'
23658 d_int64_t='$d_int64_t'
23659 d_ip_mreq='$d_ip_mreq'
23660 d_ip_mreq_source='$d_ip_mreq_source'
23661 d_ipv6_mreq='$d_ipv6_mreq'
23662 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23663 d_isascii='$d_isascii'
23664 d_isblank='$d_isblank'
23665 d_isfinite='$d_isfinite'
23666 d_isfinitel='$d_isfinitel'
23667 d_isinf='$d_isinf'
23668 d_isinfl='$d_isinfl'
23669 d_isnan='$d_isnan'
23670 d_isnanl='$d_isnanl'
23671 d_j0='$d_j0'
23672 d_j0l='$d_j0l'
23673 d_killpg='$d_killpg'
23674 d_lchown='$d_lchown'
23675 d_ldbl_dig='$d_ldbl_dig'
23676 d_ldexpl='$d_ldexpl'
23677 d_libm_lib_version='$d_libm_lib_version'
23678 d_libname_unique='$d_libname_unique'
23679 d_link='$d_link'
23680 d_localtime64='$d_localtime64'
23681 d_localtime_r='$d_localtime_r'
23682 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23683 d_locconv='$d_locconv'
23684 d_lc_monetary_2008='$d_lc_monetary_2008'
23685 d_lockf='$d_lockf'
23686 d_longdbl='$d_longdbl'
23687 d_longlong='$d_longlong'
23688 d_lseekproto='$d_lseekproto'
23689 d_lstat='$d_lstat'
23690 d_madvise='$d_madvise'
23691 d_malloc_good_size='$d_malloc_good_size'
23692 d_malloc_size='$d_malloc_size'
23693 d_mblen='$d_mblen'
23694 d_mbstowcs='$d_mbstowcs'
23695 d_mbtowc='$d_mbtowc'
23696 d_memchr='$d_memchr'
23697 d_memcmp='$d_memcmp'
23698 d_memcpy='$d_memcpy'
23699 d_memmove='$d_memmove'
23700 d_memset='$d_memset'
23701 d_mkdir='$d_mkdir'
23702 d_mkdtemp='$d_mkdtemp'
23703 d_mkfifo='$d_mkfifo'
23704 d_mkstemp='$d_mkstemp'
23705 d_mkstemps='$d_mkstemps'
23706 d_mktime64='$d_mktime64'
23707 d_mktime='$d_mktime'
23708 d_mmap='$d_mmap'
23709 d_modfl='$d_modfl'
23710 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23711 d_modflproto='$d_modflproto'
23712 d_mprotect='$d_mprotect'
23713 d_msg='$d_msg'
23714 d_msg_ctrunc='$d_msg_ctrunc'
23715 d_msg_dontroute='$d_msg_dontroute'
23716 d_msg_oob='$d_msg_oob'
23717 d_msg_peek='$d_msg_peek'
23718 d_msg_proxy='$d_msg_proxy'
23719 d_msgctl='$d_msgctl'
23720 d_msgget='$d_msgget'
23721 d_msghdr_s='$d_msghdr_s'
23722 d_msgrcv='$d_msgrcv'
23723 d_msgsnd='$d_msgsnd'
23724 d_msync='$d_msync'
23725 d_munmap='$d_munmap'
23726 d_mymalloc='$d_mymalloc'
23727 d_ndbm='$d_ndbm'
23728 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23729 d_nice='$d_nice'
23730 d_nl_langinfo='$d_nl_langinfo'
23731 d_nv_preserves_uv='$d_nv_preserves_uv'
23732 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23733 d_off64_t='$d_off64_t'
23734 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23735 d_oldpthreads='$d_oldpthreads'
23736 d_oldsock='$d_oldsock'
23737 d_open3='$d_open3'
23738 d_pathconf='$d_pathconf'
23739 d_pause='$d_pause'
23740 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23741 d_phostname='$d_phostname'
23742 d_pipe='$d_pipe'
23743 d_poll='$d_poll'
23744 d_portable='$d_portable'
23745 d_prctl='$d_prctl'
23746 d_prctl_set_name='$d_prctl_set_name'
23747 d_printf_format_null='$d_printf_format_null'
23748 d_procselfexe='$d_procselfexe'
23749 d_pseudofork='$d_pseudofork'
23750 d_pthread_atfork='$d_pthread_atfork'
23751 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23752 d_pthread_yield='$d_pthread_yield'
23753 d_ptrdiff_t='$d_ptrdiff_t'
23754 d_pwage='$d_pwage'
23755 d_pwchange='$d_pwchange'
23756 d_pwclass='$d_pwclass'
23757 d_pwcomment='$d_pwcomment'
23758 d_pwexpire='$d_pwexpire'
23759 d_pwgecos='$d_pwgecos'
23760 d_pwpasswd='$d_pwpasswd'
23761 d_pwquota='$d_pwquota'
23762 d_qgcvt='$d_qgcvt'
23763 d_quad='$d_quad'
23764 d_random_r='$d_random_r'
23765 d_readdir64_r='$d_readdir64_r'
23766 d_readdir='$d_readdir'
23767 d_readdir_r='$d_readdir_r'
23768 d_readlink='$d_readlink'
23769 d_readv='$d_readv'
23770 d_recvmsg='$d_recvmsg'
23771 d_rename='$d_rename'
23772 d_rewinddir='$d_rewinddir'
23773 d_rmdir='$d_rmdir'
23774 d_safebcpy='$d_safebcpy'
23775 d_safemcpy='$d_safemcpy'
23776 d_sanemcmp='$d_sanemcmp'
23777 d_sbrkproto='$d_sbrkproto'
23778 d_scalbnl='$d_scalbnl'
23779 d_sched_yield='$d_sched_yield'
23780 d_scm_rights='$d_scm_rights'
23781 d_seekdir='$d_seekdir'
23782 d_select='$d_select'
23783 d_sem='$d_sem'
23784 d_semctl='$d_semctl'
23785 d_semctl_semid_ds='$d_semctl_semid_ds'
23786 d_semctl_semun='$d_semctl_semun'
23787 d_semget='$d_semget'
23788 d_semop='$d_semop'
23789 d_sendmsg='$d_sendmsg'
23790 d_setegid='$d_setegid'
23791 d_seteuid='$d_seteuid'
23792 d_setgrent='$d_setgrent'
23793 d_setgrent_r='$d_setgrent_r'
23794 d_setgrps='$d_setgrps'
23795 d_sethent='$d_sethent'
23796 d_sethostent_r='$d_sethostent_r'
23797 d_setitimer='$d_setitimer'
23798 d_setlinebuf='$d_setlinebuf'
23799 d_setlocale='$d_setlocale'
23800 d_setlocale_r='$d_setlocale_r'
23801 d_setnent='$d_setnent'
23802 d_setnetent_r='$d_setnetent_r'
23803 d_setpent='$d_setpent'
23804 d_setpgid='$d_setpgid'
23805 d_setpgrp2='$d_setpgrp2'
23806 d_setpgrp='$d_setpgrp'
23807 d_setprior='$d_setprior'
23808 d_setproctitle='$d_setproctitle'
23809 d_setprotoent_r='$d_setprotoent_r'
23810 d_setpwent='$d_setpwent'
23811 d_setpwent_r='$d_setpwent_r'
23812 d_setregid='$d_setregid'
23813 d_setresgid='$d_setresgid'
23814 d_setresuid='$d_setresuid'
23815 d_setreuid='$d_setreuid'
23816 d_setrgid='$d_setrgid'
23817 d_setruid='$d_setruid'
23818 d_setsent='$d_setsent'
23819 d_setservent_r='$d_setservent_r'
23820 d_setsid='$d_setsid'
23821 d_setvbuf='$d_setvbuf'
23822 d_shm='$d_shm'
23823 d_shmat='$d_shmat'
23824 d_shmatprototype='$d_shmatprototype'
23825 d_shmctl='$d_shmctl'
23826 d_shmdt='$d_shmdt'
23827 d_shmget='$d_shmget'
23828 d_sigaction='$d_sigaction'
23829 d_signbit='$d_signbit'
23830 d_sigprocmask='$d_sigprocmask'
23831 d_sigsetjmp='$d_sigsetjmp'
23832 d_sin6_scope_id='$d_sin6_scope_id'
23833 d_sitearch='$d_sitearch'
23834 d_snprintf='$d_snprintf'
23835 d_sockaddr_in6='$d_sockaddr_in6'
23836 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23837 d_sockatmark='$d_sockatmark'
23838 d_sockatmarkproto='$d_sockatmarkproto'
23839 d_socket='$d_socket'
23840 d_socklen_t='$d_socklen_t'
23841 d_sockpair='$d_sockpair'
23842 d_socks5_init='$d_socks5_init'
23843 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23844 d_sqrtl='$d_sqrtl'
23845 d_srand48_r='$d_srand48_r'
23846 d_srandom_r='$d_srandom_r'
23847 d_sresgproto='$d_sresgproto'
23848 d_sresuproto='$d_sresuproto'
23849 d_statblks='$d_statblks'
23850 d_statfs_f_flags='$d_statfs_f_flags'
23851 d_statfs_s='$d_statfs_s'
23852 d_static_inline='$d_static_inline'
23853 d_statvfs='$d_statvfs'
23854 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23855 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23856 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23857 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23858 d_stdio_stream_array='$d_stdio_stream_array'
23859 d_stdiobase='$d_stdiobase'
23860 d_stdstdio='$d_stdstdio'
23861 d_strchr='$d_strchr'
23862 d_strcoll='$d_strcoll'
23863 d_strctcpy='$d_strctcpy'
23864 d_strerrm='$d_strerrm'
23865 d_strerror='$d_strerror'
23866 d_strerror_r='$d_strerror_r'
23867 d_strftime='$d_strftime'
23868 d_strlcat='$d_strlcat'
23869 d_strlcpy='$d_strlcpy'
23870 d_strtod='$d_strtod'
23871 d_strtol='$d_strtol'
23872 d_strtold='$d_strtold'
23873 d_strtoll='$d_strtoll'
23874 d_strtoq='$d_strtoq'
23875 d_strtoul='$d_strtoul'
23876 d_strtoull='$d_strtoull'
23877 d_strtouq='$d_strtouq'
23878 d_strxfrm='$d_strxfrm'
23879 d_suidsafe='$d_suidsafe'
23880 d_symlink='$d_symlink'
23881 d_syscall='$d_syscall'
23882 d_syscallproto='$d_syscallproto'
23883 d_sysconf='$d_sysconf'
23884 d_sysernlst='$d_sysernlst'
23885 d_syserrlst='$d_syserrlst'
23886 d_system='$d_system'
23887 d_tcgetpgrp='$d_tcgetpgrp'
23888 d_tcsetpgrp='$d_tcsetpgrp'
23889 d_telldir='$d_telldir'
23890 d_telldirproto='$d_telldirproto'
23891 d_time='$d_time'
23892 d_timegm='$d_timegm'
23893 d_times='$d_times'
23894 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23895 d_tm_tm_zone='$d_tm_tm_zone'
23896 d_tmpnam_r='$d_tmpnam_r'
23897 d_truncate='$d_truncate'
23898 d_truncl='$d_truncl'
23899 d_ttyname_r='$d_ttyname_r'
23900 d_tzname='$d_tzname'
23901 d_u32align='$d_u32align'
23902 d_ualarm='$d_ualarm'
23903 d_umask='$d_umask'
23904 d_uname='$d_uname'
23905 d_union_semun='$d_union_semun'
23906 d_unordered='$d_unordered'
23907 d_unsetenv='$d_unsetenv'
23908 d_usleep='$d_usleep'
23909 d_usleepproto='$d_usleepproto'
23910 d_ustat='$d_ustat'
23911 d_vendorarch='$d_vendorarch'
23912 d_vendorbin='$d_vendorbin'
23913 d_vendorlib='$d_vendorlib'
23914 d_vendorscript='$d_vendorscript'
23915 d_vfork='$d_vfork'
23916 d_void_closedir='$d_void_closedir'
23917 d_voidsig='$d_voidsig'
23918 d_voidtty='$d_voidtty'
23919 d_volatile='$d_volatile'
23920 d_vprintf='$d_vprintf'
23921 d_vsnprintf='$d_vsnprintf'
23922 d_wait4='$d_wait4'
23923 d_waitpid='$d_waitpid'
23924 d_wcscmp='$d_wcscmp'
23925 d_wcstombs='$d_wcstombs'
23926 d_wcsxfrm='$d_wcsxfrm'
23927 d_wctomb='$d_wctomb'
23928 d_writev='$d_writev'
23929 d_xenix='$d_xenix'
23930 date='$date'
23931 db_hashtype='$db_hashtype'
23932 db_prefixtype='$db_prefixtype'
23933 db_version_major='$db_version_major'
23934 db_version_minor='$db_version_minor'
23935 db_version_patch='$db_version_patch'
23936 direntrytype='$direntrytype'
23937 dlext='$dlext'
23938 dlsrc='$dlsrc'
23939 doublesize='$doublesize'
23940 drand01='$drand01'
23941 drand48_r_proto='$drand48_r_proto'
23942 dtrace='$dtrace'
23943 dynamic_ext='$dynamic_ext'
23944 eagain='$eagain'
23945 ebcdic='$ebcdic'
23946 echo='$echo'
23947 egrep='$egrep'
23948 emacs='$emacs'
23949 endgrent_r_proto='$endgrent_r_proto'
23950 endhostent_r_proto='$endhostent_r_proto'
23951 endnetent_r_proto='$endnetent_r_proto'
23952 endprotoent_r_proto='$endprotoent_r_proto'
23953 endpwent_r_proto='$endpwent_r_proto'
23954 endservent_r_proto='$endservent_r_proto'
23955 eunicefix='$eunicefix'
23956 exe_ext='$exe_ext'
23957 expr='$expr'
23958 extensions='$extensions'
23959 extern_C='$extern_C'
23960 extras='$extras'
23961 fflushNULL='$fflushNULL'
23962 fflushall='$fflushall'
23963 find='$find'
23964 firstmakefile='$firstmakefile'
23965 flex='$flex'
23966 fpossize='$fpossize'
23967 fpostype='$fpostype'
23968 freetype='$freetype'
23969 from='$from'
23970 full_ar='$full_ar'
23971 full_csh='$full_csh'
23972 full_sed='$full_sed'
23973 gccansipedantic='$gccansipedantic'
23974 gccosandvers='$gccosandvers'
23975 gccversion='$gccversion'
23976 getgrent_r_proto='$getgrent_r_proto'
23977 getgrgid_r_proto='$getgrgid_r_proto'
23978 getgrnam_r_proto='$getgrnam_r_proto'
23979 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23980 gethostbyname_r_proto='$gethostbyname_r_proto'
23981 gethostent_r_proto='$gethostent_r_proto'
23982 getlogin_r_proto='$getlogin_r_proto'
23983 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23984 getnetbyname_r_proto='$getnetbyname_r_proto'
23985 getnetent_r_proto='$getnetent_r_proto'
23986 getprotobyname_r_proto='$getprotobyname_r_proto'
23987 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23988 getprotoent_r_proto='$getprotoent_r_proto'
23989 getpwent_r_proto='$getpwent_r_proto'
23990 getpwnam_r_proto='$getpwnam_r_proto'
23991 getpwuid_r_proto='$getpwuid_r_proto'
23992 getservbyname_r_proto='$getservbyname_r_proto'
23993 getservbyport_r_proto='$getservbyport_r_proto'
23994 getservent_r_proto='$getservent_r_proto'
23995 getspnam_r_proto='$getspnam_r_proto'
23996 gidformat='$gidformat'
23997 gidsign='$gidsign'
23998 gidsize='$gidsize'
23999 gidtype='$gidtype'
24000 glibpth='$glibpth'
24001 gmake='$gmake'
24002 gmtime_r_proto='$gmtime_r_proto'
24003 gnulibc_version='$gnulibc_version'
24004 grep='$grep'
24005 groupcat='$groupcat'
24006 groupstype='$groupstype'
24007 gzip='$gzip'
24008 h_fcntl='$h_fcntl'
24009 h_sysfile='$h_sysfile'
24010 hint='$hint'
24011 hostcat='$hostcat'
24012 hostgenerate='$hostgenerate'
24013 hostosname='$hostosname'
24014 hostperl='$hostperl'
24015 html1dir='$html1dir'
24016 html1direxp='$html1direxp'
24017 html3dir='$html3dir'
24018 html3direxp='$html3direxp'
24019 i16size='$i16size'
24020 i16type='$i16type'
24021 i32size='$i32size'
24022 i32type='$i32type'
24023 i64size='$i64size'
24024 i64type='$i64type'
24025 i8size='$i8size'
24026 i8type='$i8type'
24027 i_arpainet='$i_arpainet'
24028 i_assert='$i_assert'
24029 i_bfd='$i_bfd'
24030 i_bsdioctl='$i_bsdioctl'
24031 i_crypt='$i_crypt'
24032 i_db='$i_db'
24033 i_dbm='$i_dbm'
24034 i_dirent='$i_dirent'
24035 i_dlfcn='$i_dlfcn'
24036 i_execinfo='$i_execinfo'
24037 i_fcntl='$i_fcntl'
24038 i_fenv='$i_fenv'
24039 i_float='$i_float'
24040 i_fp='$i_fp'
24041 i_fp_class='$i_fp_class'
24042 i_gdbm='$i_gdbm'
24043 i_gdbm_ndbm='$i_gdbm_ndbm'
24044 i_gdbmndbm='$i_gdbmndbm'
24045 i_grp='$i_grp'
24046 i_ieeefp='$i_ieeefp'
24047 i_inttypes='$i_inttypes'
24048 i_langinfo='$i_langinfo'
24049 i_libutil='$i_libutil'
24050 i_limits='$i_limits'
24051 i_locale='$i_locale'
24052 i_machcthr='$i_machcthr'
24053 i_malloc='$i_malloc'
24054 i_mallocmalloc='$i_mallocmalloc'
24055 i_math='$i_math'
24056 i_memory='$i_memory'
24057 i_mntent='$i_mntent'
24058 i_ndbm='$i_ndbm'
24059 i_netdb='$i_netdb'
24060 i_neterrno='$i_neterrno'
24061 i_netinettcp='$i_netinettcp'
24062 i_niin='$i_niin'
24063 i_poll='$i_poll'
24064 i_prot='$i_prot'
24065 i_pthread='$i_pthread'
24066 i_pwd='$i_pwd'
24067 i_quadmath='$i_quadmath'
24068 i_rpcsvcdbm='$i_rpcsvcdbm'
24069 i_sgtty='$i_sgtty'
24070 i_shadow='$i_shadow'
24071 i_socks='$i_socks'
24072 i_stdarg='$i_stdarg'
24073 i_stdbool='$i_stdbool'
24074 i_stddef='$i_stddef'
24075 i_stdint='$i_stdint'
24076 i_stdlib='$i_stdlib'
24077 i_string='$i_string'
24078 i_sunmath='$i_sunmath'
24079 i_sysaccess='$i_sysaccess'
24080 i_sysdir='$i_sysdir'
24081 i_sysfile='$i_sysfile'
24082 i_sysfilio='$i_sysfilio'
24083 i_sysin='$i_sysin'
24084 i_sysioctl='$i_sysioctl'
24085 i_syslog='$i_syslog'
24086 i_sysmman='$i_sysmman'
24087 i_sysmode='$i_sysmode'
24088 i_sysmount='$i_sysmount'
24089 i_sysndir='$i_sysndir'
24090 i_sysparam='$i_sysparam'
24091 i_syspoll='$i_syspoll'
24092 i_sysresrc='$i_sysresrc'
24093 i_syssecrt='$i_syssecrt'
24094 i_sysselct='$i_sysselct'
24095 i_syssockio='$i_syssockio'
24096 i_sysstat='$i_sysstat'
24097 i_sysstatfs='$i_sysstatfs'
24098 i_sysstatvfs='$i_sysstatvfs'
24099 i_systime='$i_systime'
24100 i_systimek='$i_systimek'
24101 i_systimes='$i_systimes'
24102 i_systypes='$i_systypes'
24103 i_sysuio='$i_sysuio'
24104 i_sysun='$i_sysun'
24105 i_sysutsname='$i_sysutsname'
24106 i_sysvfs='$i_sysvfs'
24107 i_syswait='$i_syswait'
24108 i_termio='$i_termio'
24109 i_termios='$i_termios'
24110 i_time='$i_time'
24111 i_unistd='$i_unistd'
24112 i_ustat='$i_ustat'
24113 i_utime='$i_utime'
24114 i_values='$i_values'
24115 i_varargs='$i_varargs'
24116 i_varhdr='$i_varhdr'
24117 i_vfork='$i_vfork'
24118 ignore_versioned_solibs='$ignore_versioned_solibs'
24119 inc_version_list='$inc_version_list'
24120 inc_version_list_init='$inc_version_list_init'
24121 incpath='$incpath'
24122 incpth='$incpth'
24123 inews='$inews'
24124 initialinstalllocation='$initialinstalllocation'
24125 installarchlib='$installarchlib'
24126 installbin='$installbin'
24127 installhtml1dir='$installhtml1dir'
24128 installhtml3dir='$installhtml3dir'
24129 installman1dir='$installman1dir'
24130 installman3dir='$installman3dir'
24131 installprefix='$installprefix'
24132 installprefixexp='$installprefixexp'
24133 installprivlib='$installprivlib'
24134 installscript='$installscript'
24135 installsitearch='$installsitearch'
24136 installsitebin='$installsitebin'
24137 installsitehtml1dir='$installsitehtml1dir'
24138 installsitehtml3dir='$installsitehtml3dir'
24139 installsitelib='$installsitelib'
24140 installsiteman1dir='$installsiteman1dir'
24141 installsiteman3dir='$installsiteman3dir'
24142 installsitescript='$installsitescript'
24143 installstyle='$installstyle'
24144 installusrbinperl='$installusrbinperl'
24145 installvendorarch='$installvendorarch'
24146 installvendorbin='$installvendorbin'
24147 installvendorhtml1dir='$installvendorhtml1dir'
24148 installvendorhtml3dir='$installvendorhtml3dir'
24149 installvendorlib='$installvendorlib'
24150 installvendorman1dir='$installvendorman1dir'
24151 installvendorman3dir='$installvendorman3dir'
24152 installvendorscript='$installvendorscript'
24153 intsize='$intsize'
24154 issymlink='$issymlink'
24155 ivdformat='$ivdformat'
24156 ivsize='$ivsize'
24157 ivtype='$ivtype'
24158 known_extensions='$known_extensions'
24159 ksh='$ksh'
24160 ld='$ld'
24161 ld_can_script='$ld_can_script'
24162 lddlflags='$lddlflags'
24163 ldflags='$ldflags'
24164 ldflags_uselargefiles='$ldflags_uselargefiles'
24165 ldlibpthname='$ldlibpthname'
24166 less='$less'
24167 lib_ext='$lib_ext'
24168 libc='$libc'
24169 libperl='$libperl'
24170 libpth='$libpth'
24171 libs='$libs'
24172 libsdirs='$libsdirs'
24173 libsfiles='$libsfiles'
24174 libsfound='$libsfound'
24175 libspath='$libspath'
24176 libswanted='$libswanted'
24177 libswanted_uselargefiles='$libswanted_uselargefiles'
24178 line='$line'
24179 lint='$lint'
24180 lkflags='$lkflags'
24181 ln='$ln'
24182 lns='$lns'
24183 localtime_r_proto='$localtime_r_proto'
24184 locincpth='$locincpth'
24185 loclibpth='$loclibpth'
24186 longdblkind='$longdblkind'
24187 longdblsize='$longdblsize'
24188 longlongsize='$longlongsize'
24189 longsize='$longsize'
24190 lp='$lp'
24191 lpr='$lpr'
24192 ls='$ls'
24193 lseeksize='$lseeksize'
24194 lseektype='$lseektype'
24195 mail='$mail'
24196 mailx='$mailx'
24197 make='$make'
24198 make_set_make='$make_set_make'
24199 mallocobj='$mallocobj'
24200 mallocsrc='$mallocsrc'
24201 malloctype='$malloctype'
24202 man1dir='$man1dir'
24203 man1direxp='$man1direxp'
24204 man1ext='$man1ext'
24205 man3dir='$man3dir'
24206 man3direxp='$man3direxp'
24207 man3ext='$man3ext'
24208 mips_type='$mips_type'
24209 mistrustnm='$mistrustnm'
24210 mkdir='$mkdir'
24211 mmaptype='$mmaptype'
24212 modetype='$modetype'
24213 more='$more'
24214 multiarch='$multiarch'
24215 mv='$mv'
24216 myarchname='$myarchname'
24217 mydomain='$mydomain'
24218 myhostname='$myhostname'
24219 myuname='$myuname'
24220 n='$n'
24221 need_va_copy='$need_va_copy'
24222 netdb_hlen_type='$netdb_hlen_type'
24223 netdb_host_type='$netdb_host_type'
24224 netdb_name_type='$netdb_name_type'
24225 netdb_net_type='$netdb_net_type'
24226 nm='$nm'
24227 nm_opt='$nm_opt'
24228 nm_so_opt='$nm_so_opt'
24229 nonxs_ext='$nonxs_ext'
24230 nroff='$nroff'
24231 nvEUformat='$nvEUformat'
24232 nvFUformat='$nvFUformat'
24233 nvGUformat='$nvGUformat'
24234 nv_overflows_integers_at='$nv_overflows_integers_at'
24235 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24236 nveformat='$nveformat'
24237 nvfformat='$nvfformat'
24238 nvgformat='$nvgformat'
24239 nvsize='$nvsize'
24240 nvtype='$nvtype'
24241 o_nonblock='$o_nonblock'
24242 obj_ext='$obj_ext'
24243 old_pthread_create_joinable='$old_pthread_create_joinable'
24244 optimize='$optimize'
24245 orderlib='$orderlib'
24246 osname='$osname'
24247 osvers='$osvers'
24248 otherlibdirs='$otherlibdirs'
24249 package='$package'
24250 pager='$pager'
24251 passcat='$passcat'
24252 patchlevel='$patchlevel'
24253 path_sep='$path_sep'
24254 perl5='$perl5'
24255 perl='$perl'
24256 perl_patchlevel='$perl_patchlevel'
24257 perl_static_inline='$perl_static_inline'
24258 perladmin='$perladmin'
24259 perllibs='$perllibs'
24260 perlpath='$perlpath'
24261 pg='$pg'
24262 phostname='$phostname'
24263 pidtype='$pidtype'
24264 plibpth='$plibpth'
24265 pmake='$pmake'
24266 pr='$pr'
24267 prefix='$prefix'
24268 prefixexp='$prefixexp'
24269 privlib='$privlib'
24270 privlibexp='$privlibexp'
24271 procselfexe='$procselfexe'
24272 prototype='$prototype'
24273 ptrsize='$ptrsize'
24274 quadkind='$quadkind'
24275 quadtype='$quadtype'
24276 randbits='$randbits'
24277 randfunc='$randfunc'
24278 random_r_proto='$random_r_proto'
24279 randseedtype='$randseedtype'
24280 ranlib='$ranlib'
24281 rd_nodata='$rd_nodata'
24282 readdir64_r_proto='$readdir64_r_proto'
24283 readdir_r_proto='$readdir_r_proto'
24284 revision='$revision'
24285 rm='$rm'
24286 rm_try='$rm_try'
24287 rmail='$rmail'
24288 run='$run'
24289 runnm='$runnm'
24290 sGMTIME_max='$sGMTIME_max'
24291 sGMTIME_min='$sGMTIME_min'
24292 sLOCALTIME_max='$sLOCALTIME_max'
24293 sLOCALTIME_min='$sLOCALTIME_min'
24294 sPRIEUldbl='$sPRIEUldbl'
24295 sPRIFUldbl='$sPRIFUldbl'
24296 sPRIGUldbl='$sPRIGUldbl'
24297 sPRIXU64='$sPRIXU64'
24298 sPRId64='$sPRId64'
24299 sPRIeldbl='$sPRIeldbl'
24300 sPRIfldbl='$sPRIfldbl'
24301 sPRIgldbl='$sPRIgldbl'
24302 sPRIi64='$sPRIi64'
24303 sPRIo64='$sPRIo64'
24304 sPRIu64='$sPRIu64'
24305 sPRIx64='$sPRIx64'
24306 sSCNfldbl='$sSCNfldbl'
24307 sched_yield='$sched_yield'
24308 scriptdir='$scriptdir'
24309 scriptdirexp='$scriptdirexp'
24310 sed='$sed'
24311 seedfunc='$seedfunc'
24312 selectminbits='$selectminbits'
24313 selecttype='$selecttype'
24314 sendmail='$sendmail'
24315 setgrent_r_proto='$setgrent_r_proto'
24316 sethostent_r_proto='$sethostent_r_proto'
24317 setlocale_r_proto='$setlocale_r_proto'
24318 setnetent_r_proto='$setnetent_r_proto'
24319 setprotoent_r_proto='$setprotoent_r_proto'
24320 setpwent_r_proto='$setpwent_r_proto'
24321 setservent_r_proto='$setservent_r_proto'
24322 sh='$sh'
24323 shar='$shar'
24324 sharpbang='$sharpbang'
24325 shmattype='$shmattype'
24326 shortsize='$shortsize'
24327 shrpenv='$shrpenv'
24328 shsharp='$shsharp'
24329 sig_count='$sig_count'
24330 sig_name='$sig_name'
24331 sig_name_init='$sig_name_init'
24332 sig_num='$sig_num'
24333 sig_num_init='$sig_num_init'
24334 sig_size='$sig_size'
24335 signal_t='$signal_t'
24336 sitearch='$sitearch'
24337 sitearchexp='$sitearchexp'
24338 sitebin='$sitebin'
24339 sitebinexp='$sitebinexp'
24340 sitehtml1dir='$sitehtml1dir'
24341 sitehtml1direxp='$sitehtml1direxp'
24342 sitehtml3dir='$sitehtml3dir'
24343 sitehtml3direxp='$sitehtml3direxp'
24344 sitelib='$sitelib'
24345 sitelib_stem='$sitelib_stem'
24346 sitelibexp='$sitelibexp'
24347 siteman1dir='$siteman1dir'
24348 siteman1direxp='$siteman1direxp'
24349 siteman3dir='$siteman3dir'
24350 siteman3direxp='$siteman3direxp'
24351 siteprefix='$siteprefix'
24352 siteprefixexp='$siteprefixexp'
24353 sitescript='$sitescript'
24354 sitescriptexp='$sitescriptexp'
24355 sizesize='$sizesize'
24356 sizetype='$sizetype'
24357 sleep='$sleep'
24358 smail='$smail'
24359 so='$so'
24360 sockethdr='$sockethdr'
24361 socketlib='$socketlib'
24362 socksizetype='$socksizetype'
24363 sort='$sort'
24364 spackage='$spackage'
24365 spitshell='$spitshell'
24366 srand48_r_proto='$srand48_r_proto'
24367 srandom_r_proto='$srandom_r_proto'
24368 src='$src'
24369 ssizetype='$ssizetype'
24370 st_ino_sign='$st_ino_sign'
24371 st_ino_size='$st_ino_size'
24372 startperl='$startperl'
24373 startsh='$startsh'
24374 static_ext='$static_ext'
24375 stdchar='$stdchar'
24376 stdio_base='$stdio_base'
24377 stdio_bufsiz='$stdio_bufsiz'
24378 stdio_cnt='$stdio_cnt'
24379 stdio_filbuf='$stdio_filbuf'
24380 stdio_ptr='$stdio_ptr'
24381 stdio_stream_array='$stdio_stream_array'
24382 strerror_r_proto='$strerror_r_proto'
24383 strings='$strings'
24384 submit='$submit'
24385 subversion='$subversion'
24386 sysman='$sysman'
24387 sysroot='$sysroot'
24388 tail='$tail'
24389 tar='$tar'
24390 targetarch='$targetarch'
24391 targetdir='$targetdir'
24392 targetenv='$targetenv'
24393 targethost='$targethost'
24394 targetmkdir='$targetmkdir'
24395 targetport='$targetport'
24396 targetsh='$targetsh'
24397 tbl='$tbl'
24398 tee='$tee'
24399 test='$test'
24400 timeincl='$timeincl'
24401 timetype='$timetype'
24402 tmpnam_r_proto='$tmpnam_r_proto'
24403 to='$to'
24404 touch='$touch'
24405 tr='$tr'
24406 trnl='$trnl'
24407 troff='$troff'
24408 ttyname_r_proto='$ttyname_r_proto'
24409 u16size='$u16size'
24410 u16type='$u16type'
24411 u32size='$u32size'
24412 u32type='$u32type'
24413 u64size='$u64size'
24414 u64type='$u64type'
24415 u8size='$u8size'
24416 u8type='$u8type'
24417 uidformat='$uidformat'
24418 uidsign='$uidsign'
24419 uidsize='$uidsize'
24420 uidtype='$uidtype'
24421 uname='$uname'
24422 uniq='$uniq'
24423 uquadtype='$uquadtype'
24424 use5005threads='$use5005threads'
24425 use64bitall='$use64bitall'
24426 use64bitint='$use64bitint'
24427 usecbacktrace='$usecbacktrace'
24428 usecrosscompile='$usecrosscompile'
24429 usedevel='$usedevel'
24430 usedl='$usedl'
24431 usedtrace='$usedtrace'
24432 usefaststdio='$usefaststdio'
24433 useithreads='$useithreads'
24434 usekernprocpathname='$usekernprocpathname'
24435 uselargefiles='$uselargefiles'
24436 uselongdouble='$uselongdouble'
24437 usemallocwrap='$usemallocwrap'
24438 usemorebits='$usemorebits'
24439 usemultiplicity='$usemultiplicity'
24440 usemymalloc='$usemymalloc'
24441 usenm='$usenm'
24442 usensgetexecutablepath='$usensgetexecutablepath'
24443 useopcode='$useopcode'
24444 useperlio='$useperlio'
24445 useposix='$useposix'
24446 usequadmath='$usequadmath'
24447 usereentrant='$usereentrant'
24448 userelocatableinc='$userelocatableinc'
24449 useshrplib='$useshrplib'
24450 usesitecustomize='$usesitecustomize'
24451 usesocks='$usesocks'
24452 usethreads='$usethreads'
24453 usevendorprefix='$usevendorprefix'
24454 useversionedarchname='$useversionedarchname'
24455 usevfork='$usevfork'
24456 usrinc='$usrinc'
24457 uuname='$uuname'
24458 uvXUformat='$uvXUformat'
24459 uvoformat='$uvoformat'
24460 uvsize='$uvsize'
24461 uvtype='$uvtype'
24462 uvuformat='$uvuformat'
24463 uvxformat='$uvxformat'
24464 vaproto='$vaproto'
24465 vendorarch='$vendorarch'
24466 vendorarchexp='$vendorarchexp'
24467 vendorbin='$vendorbin'
24468 vendorbinexp='$vendorbinexp'
24469 vendorhtml1dir='$vendorhtml1dir'
24470 vendorhtml1direxp='$vendorhtml1direxp'
24471 vendorhtml3dir='$vendorhtml3dir'
24472 vendorhtml3direxp='$vendorhtml3direxp'
24473 vendorlib='$vendorlib'
24474 vendorlib_stem='$vendorlib_stem'
24475 vendorlibexp='$vendorlibexp'
24476 vendorman1dir='$vendorman1dir'
24477 vendorman1direxp='$vendorman1direxp'
24478 vendorman3dir='$vendorman3dir'
24479 vendorman3direxp='$vendorman3direxp'
24480 vendorprefix='$vendorprefix'
24481 vendorprefixexp='$vendorprefixexp'
24482 vendorscript='$vendorscript'
24483 vendorscriptexp='$vendorscriptexp'
24484 version='$version'
24485 version_patchlevel_string='$version_patchlevel_string'
24486 versiononly='$versiononly'
24487 vi='$vi'
24488 xlibpth='$xlibpth'
24489 yacc='$yacc'
24490 yaccflags='$yaccflags'
24491 zcat='$zcat'
24492 zip='$zip'
24493 EOT
24494
24495 : add special variables
24496 $test -f $src/patchlevel.h && \
24497 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24498 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24499 echo "PERL_CONFIG_SH=true" >>config.sh
24500
24501 : propagate old symbols
24502 if $test -f UU/config.sh; then
24503         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24504         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24505                 config.sh config.sh UU/oldconfig.sh |\
24506                 $sort | $uniq -u >UU/oldsyms
24507         set X `$cat UU/oldsyms`
24508         shift
24509         case $# in
24510         0) ;;
24511         *)
24512                 $cat <<EOM
24513 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24514 EOM
24515                 echo ": Variables propagated from previous config.sh file." >>config.sh
24516                 for sym in `$cat UU/oldsyms`; do
24517                         echo "    Propagating $hint variable "'$'"$sym..."
24518                         eval 'tmp="$'"${sym}"'"'
24519                         echo "$tmp" | \
24520                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24521                 done
24522                 ;;
24523         esac
24524 fi
24525
24526 : preserve RCS keywords in files with variable substitution, grrr
24527 Id='$Id'
24528
24529 : Finish up by extracting the .SH files
24530 case "$alldone" in
24531 exit)
24532         $rm -rf UU
24533         echo "Extraction done."
24534         exit 0
24535         ;;
24536 cont)
24537         ;;
24538 '')
24539         dflt=''
24540         nostick=true
24541         $cat <<EOM
24542
24543 If you'd like to make any changes to the config.sh file before I begin
24544 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24545
24546 EOM
24547         rp="Press return or use a shell escape to edit config.sh:"
24548         . UU/myread
24549         nostick=''
24550         case "$ans" in
24551         '') ;;
24552         *) : in case they cannot read
24553                 sh 1>&4 -c "$ans";;
24554         esac
24555         ;;
24556 esac
24557
24558 : if this fails, just run all the .SH files by hand
24559 . ./config.sh
24560
24561 echo " "
24562 exec 1>&4
24563 pwd=`pwd`
24564 . ./UU/extract
24565 cd "$pwd"
24566
24567 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24568         dflt=y
24569         case "$silent" in
24570         true) ;;
24571         *)
24572                 $cat <<EOM
24573
24574 Now you need to generate make dependencies by running "$make depend".
24575 You might prefer to run it in background: "$make depend > makedepend.out &"
24576 It can take a while, so you might not want to run it right now.
24577
24578 EOM
24579                 ;;
24580         esac
24581         rp="Run $make depend now?"
24582         . UU/myread
24583         case "$ans" in
24584         y*)
24585                 $make depend && echo "Now you must run '$make'."
24586                 ;;
24587         *)
24588                 echo "You must run '$make depend' then '$make'."
24589                 ;;
24590         esac
24591 elif test -f [Mm]akefile; then
24592         echo " "
24593         echo "Now you must run a $make."
24594 else
24595         echo "Configure done."
24596 fi
24597
24598 if $test -f Policy.sh; then
24599     $cat <<EOM
24600
24601 If you compile $package on a different machine or from a different object
24602 directory, copy the Policy.sh file from this object directory to the
24603 new one before you run Configure -- this will help you with most of
24604 the policy defaults.
24605
24606 EOM
24607 fi
24608 if $test -f config.msg; then
24609     echo "Hmm.  I also noted the following information while running:"
24610     echo " "
24611     $cat config.msg >&4
24612     $rm -f config.msg
24613 fi
24614 $rm -f kit*isdone ark*isdone
24615 $rm -rf UU
24616
24617 : End of Configure
24618