This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add optional GCC-only support for using long doubles on Win32
[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 doublekind=''
879 doublesize=''
880 ebcdic=''
881 fflushNULL=''
882 fflushall=''
883 fpossize=''
884 fpostype=''
885 gccansipedantic=''
886 gccosandvers=''
887 gccversion=''
888 gidformat=''
889 gidsign=''
890 gidsize=''
891 gidtype=''
892 groupstype=''
893 h_fcntl=''
894 h_sysfile=''
895 html1dir=''
896 html1direxp=''
897 installhtml1dir=''
898 html3dir=''
899 html3direxp=''
900 installhtml3dir=''
901 i_arpainet=''
902 i_assert=''
903 i_bfd=''
904 i_crypt=''
905 db_hashtype=''
906 db_prefixtype=''
907 db_version_major=''
908 db_version_minor=''
909 db_version_patch=''
910 i_db=''
911 i_dbm=''
912 i_rpcsvcdbm=''
913 d_dirnamlen=''
914 direntrytype=''
915 i_dirent=''
916 i_dlfcn=''
917 i_execinfo=''
918 i_fcntl=''
919 i_fenv=''
920 i_float=''
921 i_fp=''
922 i_fp_class=''
923 i_gdbm=''
924 d_grpasswd=''
925 i_grp=''
926 i_ieeefp=''
927 i_inttypes=''
928 i_langinfo=''
929 i_libutil=''
930 i_limits=''
931 i_locale=''
932 i_machcthr=''
933 i_malloc=''
934 i_mallocmalloc=''
935 i_math=''
936 i_memory=''
937 i_mntent=''
938 d_gdbm_ndbm_h_uses_prototypes=''
939 d_gdbmndbm_h_uses_prototypes=''
940 d_ndbm=''
941 d_ndbm_h_uses_prototypes=''
942 i_gdbm_ndbm=''
943 i_gdbmndbm=''
944 i_ndbm=''
945 i_netdb=''
946 i_neterrno=''
947 i_netinettcp=''
948 i_niin=''
949 i_sysin=''
950 i_poll=''
951 i_prot=''
952 i_pthread=''
953 d_pwage=''
954 d_pwchange=''
955 d_pwclass=''
956 d_pwcomment=''
957 d_pwexpire=''
958 d_pwgecos=''
959 d_pwpasswd=''
960 d_pwquota=''
961 i_pwd=''
962 i_quadmath=''
963 i_shadow=''
964 i_socks=''
965 i_stdbool=''
966 i_stddef=''
967 i_stdint=''
968 i_stdlib=''
969 i_string=''
970 strings=''
971 i_sunmath=''
972 i_sysaccess=''
973 i_sysdir=''
974 i_sysfile=''
975 d_voidtty=''
976 i_bsdioctl=''
977 i_sysfilio=''
978 i_sysioctl=''
979 i_syssockio=''
980 i_syslog=''
981 i_sysmman=''
982 i_sysmode=''
983 i_sysmount=''
984 i_sysndir=''
985 i_sysparam=''
986 i_syspoll=''
987 i_sysresrc=''
988 i_syssecrt=''
989 i_sysselct=''
990 i_sysstat=''
991 i_sysstatfs=''
992 i_sysstatvfs=''
993 i_systimes=''
994 i_systypes=''
995 i_sysuio=''
996 i_sysun=''
997 i_sysutsname=''
998 i_sysvfs=''
999 i_syswait=''
1000 i_sgtty=''
1001 i_termio=''
1002 i_termios=''
1003 d_tm_tm_gmtoff=''
1004 d_tm_tm_zone=''
1005 i_systime=''
1006 i_systimek=''
1007 i_time=''
1008 timeincl=''
1009 i_unistd=''
1010 i_ustat=''
1011 i_utime=''
1012 i_values=''
1013 i_stdarg=''
1014 i_varargs=''
1015 i_varhdr=''
1016 i_vfork=''
1017 d_inc_version_list=''
1018 inc_version_list=''
1019 inc_version_list_init=''
1020 installprefix=''
1021 installprefixexp=''
1022 installstyle=''
1023 installusrbinperl=''
1024 intsize=''
1025 longsize=''
1026 shortsize=''
1027 issymlink=''
1028 libc=''
1029 ldlibpthname=''
1030 libperl=''
1031 shrpenv=''
1032 useshrplib=''
1033 glibpth=''
1034 incpth=''
1035 libpth=''
1036 loclibpth=''
1037 plibpth=''
1038 xlibpth=''
1039 ignore_versioned_solibs=''
1040 libs=''
1041 libsdirs=''
1042 libsfiles=''
1043 libsfound=''
1044 libspath=''
1045 lns=''
1046 d_PRIEUldbl=''
1047 d_PRIFUldbl=''
1048 d_PRIGUldbl=''
1049 d_PRIeldbl=''
1050 d_PRIfldbl=''
1051 d_PRIgldbl=''
1052 d_SCNfldbl=''
1053 sPRIEUldbl=''
1054 sPRIFUldbl=''
1055 sPRIGUldbl=''
1056 sPRIeldbl=''
1057 sPRIfldbl=''
1058 sPRIgldbl=''
1059 sSCNfldbl=''
1060 lseeksize=''
1061 lseektype=''
1062 make_set_make=''
1063 d_mymalloc=''
1064 freetype=''
1065 mallocobj=''
1066 mallocsrc=''
1067 malloctype=''
1068 usemallocwrap=''
1069 usemymalloc=''
1070 installman1dir=''
1071 man1dir=''
1072 man1direxp=''
1073 man1ext=''
1074 installman3dir=''
1075 man3dir=''
1076 man3direxp=''
1077 man3ext=''
1078 modetype=''
1079 multiarch=''
1080 mydomain=''
1081 myhostname=''
1082 phostname=''
1083 c=''
1084 n=''
1085 d_eofnblk=''
1086 eagain=''
1087 o_nonblock=''
1088 rd_nodata=''
1089 need_va_copy=''
1090 netdb_hlen_type=''
1091 netdb_host_type=''
1092 netdb_name_type=''
1093 netdb_net_type=''
1094 groupcat=''
1095 hostcat=''
1096 passcat=''
1097 orderlib=''
1098 ranlib=''
1099 d_perl_otherlibdirs=''
1100 otherlibdirs=''
1101 package=''
1102 spackage=''
1103 pager=''
1104 api_revision=''
1105 api_subversion=''
1106 api_version=''
1107 api_versionstring=''
1108 patchlevel=''
1109 perl_patchlevel=''
1110 revision=''
1111 subversion=''
1112 version=''
1113 version_patchlevel_string=''
1114 perl5=''
1115 perladmin=''
1116 perlpath=''
1117 d_nv_preserves_uv=''
1118 d_nv_zero_is_allbits_zero=''
1119 i16size=''
1120 i16type=''
1121 i32size=''
1122 i32type=''
1123 i64size=''
1124 i64type=''
1125 i8size=''
1126 i8type=''
1127 ivsize=''
1128 ivtype=''
1129 nv_overflows_integers_at=''
1130 nv_preserves_uv_bits=''
1131 nvsize=''
1132 nvtype=''
1133 u16size=''
1134 u16type=''
1135 u32size=''
1136 u32type=''
1137 u64size=''
1138 u64type=''
1139 u8size=''
1140 u8type=''
1141 uvsize=''
1142 uvtype=''
1143 ivdformat=''
1144 nvEUformat=''
1145 nvFUformat=''
1146 nvGUformat=''
1147 nveformat=''
1148 nvfformat=''
1149 nvgformat=''
1150 uvXUformat=''
1151 uvoformat=''
1152 uvuformat=''
1153 uvxformat=''
1154 pidtype=''
1155 prefix=''
1156 prefixexp=''
1157 installprivlib=''
1158 privlib=''
1159 privlibexp=''
1160 prototype=''
1161 ptrsize=''
1162 d_PRIXU64=''
1163 d_PRId64=''
1164 d_PRIi64=''
1165 d_PRIo64=''
1166 d_PRIu64=''
1167 d_PRIx64=''
1168 sPRIXU64=''
1169 sPRId64=''
1170 sPRIi64=''
1171 sPRIo64=''
1172 sPRIu64=''
1173 sPRIx64=''
1174 d_quad=''
1175 quadkind=''
1176 quadtype=''
1177 uquadtype=''
1178 drand01=''
1179 randbits=''
1180 randfunc=''
1181 randseedtype=''
1182 seedfunc=''
1183 installscript=''
1184 scriptdir=''
1185 scriptdirexp=''
1186 selectminbits=''
1187 selecttype=''
1188 sh=''
1189 targetsh=''
1190 sig_count=''
1191 sig_name=''
1192 sig_name_init=''
1193 sig_num=''
1194 sig_num_init=''
1195 sig_size=''
1196 d_sitearch=''
1197 installsitearch=''
1198 sitearch=''
1199 sitearchexp=''
1200 installsitebin=''
1201 sitebin=''
1202 sitebinexp=''
1203 installsitehtml1dir=''
1204 sitehtml1dir=''
1205 sitehtml1direxp=''
1206 installsitehtml3dir=''
1207 sitehtml3dir=''
1208 sitehtml3direxp=''
1209 installsitelib=''
1210 sitelib=''
1211 sitelib_stem=''
1212 sitelibexp=''
1213 installsiteman1dir=''
1214 siteman1dir=''
1215 siteman1direxp=''
1216 installsiteman3dir=''
1217 siteman3dir=''
1218 siteman3direxp=''
1219 siteprefix=''
1220 siteprefixexp=''
1221 installsitescript=''
1222 sitescript=''
1223 sitescriptexp=''
1224 sizesize=''
1225 sizetype=''
1226 d_libname_unique=''
1227 so=''
1228 socksizetype=''
1229 sharpbang=''
1230 shsharp=''
1231 spitshell=''
1232 src=''
1233 ssizetype=''
1234 st_ino_sign=''
1235 st_ino_size=''
1236 startperl=''
1237 startsh=''
1238 stdchar=''
1239 d_stdio_stream_array=''
1240 stdio_stream_array=''
1241 sysman=''
1242 sGMTIME_max=''
1243 sGMTIME_min=''
1244 sLOCALTIME_max=''
1245 sLOCALTIME_min=''
1246 trnl=''
1247 uidformat=''
1248 uidsign=''
1249 uidsize=''
1250 uidtype=''
1251 archname64=''
1252 use64bitall=''
1253 use64bitint=''
1254 usecbacktrace=''
1255 dtrace=''
1256 usedtrace=''
1257 usefaststdio=''
1258 usekernprocpathname=''
1259 ccflags_uselargefiles=''
1260 ldflags_uselargefiles=''
1261 libswanted_uselargefiles=''
1262 uselargefiles=''
1263 uselongdouble=''
1264 usemorebits=''
1265 usequadmath=''
1266 usemultiplicity=''
1267 nm_opt=''
1268 nm_so_opt=''
1269 runnm=''
1270 usenm=''
1271 usensgetexecutablepath=''
1272 useperlio=''
1273 usesocks=''
1274 d_oldpthreads=''
1275 use5005threads=''
1276 useithreads=''
1277 usereentrant=''
1278 usethreads=''
1279 incpath=''
1280 mips_type=''
1281 usrinc=''
1282 vaproto=''
1283 d_vendorarch=''
1284 installvendorarch=''
1285 vendorarch=''
1286 vendorarchexp=''
1287 d_vendorbin=''
1288 installvendorbin=''
1289 vendorbin=''
1290 vendorbinexp=''
1291 installvendorhtml1dir=''
1292 vendorhtml1dir=''
1293 vendorhtml1direxp=''
1294 installvendorhtml3dir=''
1295 vendorhtml3dir=''
1296 vendorhtml3direxp=''
1297 d_vendorlib=''
1298 installvendorlib=''
1299 vendorlib=''
1300 vendorlib_stem=''
1301 vendorlibexp=''
1302 installvendorman1dir=''
1303 vendorman1dir=''
1304 vendorman1direxp=''
1305 installvendorman3dir=''
1306 vendorman3dir=''
1307 vendorman3direxp=''
1308 usevendorprefix=''
1309 vendorprefix=''
1310 vendorprefixexp=''
1311 d_vendorscript=''
1312 installvendorscript=''
1313 vendorscript=''
1314 vendorscriptexp=''
1315 versiononly=''
1316 yacc=''
1317 yaccflags=''
1318 CONFIG=''
1319
1320 : Detect odd OSs
1321 define='define'
1322 undef='undef'
1323 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1324 rmlist=''
1325
1326 : We must find out about Eunice early
1327 eunicefix=':'
1328 if test -f /etc/unixtovms; then
1329         eunicefix=/etc/unixtovms
1330 fi
1331 if test -f /etc/unixtovms.exe; then
1332         eunicefix=/etc/unixtovms.exe
1333 fi
1334
1335 : Set executable suffix now -- needed before hints available
1336 if test -f "/libs/version.library"; then
1337 : Amiga OS
1338     _exe=""
1339 elif test -f "/system/gnu_library/bin/ar.pm"; then
1340 : Stratus VOS
1341     _exe=".pm"
1342 elif test -n "$DJGPP"; then
1343 : DOS DJGPP
1344     _exe=".exe"
1345 elif test -f /kern/cookiejar; then
1346 : MiNT
1347     _exe=""
1348 elif test -d c:/. -o -n "$is_os2" ; then
1349 : OS/2 or cygwin
1350     _exe=".exe"
1351 fi
1352
1353 groupstype=''
1354 i_whoami=''
1355 : Trailing extension.  Override this in a hint file, if needed.
1356 : Extra object files, if any, needed on this platform.
1357 archobjs=''
1358 archname=''
1359 : Possible local include directories to search.
1360 : Set locincpth to "" in a hint file to defeat local include searches.
1361 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1362 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1363 :
1364 : no include file wanted by default
1365 inclwanted=''
1366
1367 : Enable -DEBUGGING and -DDEBUGGING from the command line
1368 EBUGGING=''
1369 DEBUGGING=''
1370
1371 libnames=''
1372 : change the next line if compiling for Xenix/286 on Xenix/386
1373 xlibpth='/usr/lib/386 /lib/386'
1374 : Possible local library directories to search.
1375 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1376 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1377
1378 : general looking path for locating libraries
1379 glibpth="/lib /usr/lib $xlibpth"
1380 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1381 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1382 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1383 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1384
1385 : Private path used by Configure to find libraries.  Its value
1386 : is prepended to libpth. This variable takes care of special
1387 : machines, like the mips.  Usually, it should be empty.
1388 plibpth=''
1389
1390 : default library list
1391 libswanted=''
1392 : some systems want to use only the non-versioned libso:s
1393 ignore_versioned_solibs=''
1394 : set usethreads on the Configure command line to enable threads.
1395 usereentrant='undef'
1396 ccname=''
1397 ccversion=''
1398 perllibs=''
1399 : set useposix=false in your hint file to disable the POSIX extension.
1400 useposix=true
1401 : set useopcode=false in your hint file to disable the Opcode extension.
1402 useopcode=true
1403 archname64=''
1404 ccflags_uselargefiles=''
1405 ldflags_uselargefiles=''
1406 libswanted_uselargefiles=''
1407 : set usemultiplicity on the Configure command line to enable multiplicity.
1408 : set usesocks on the Configure command line to enable socks.
1409 : List of libraries we want.
1410 : If anyone needs extra -lxxx, put those in a hint file.
1411 libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1412 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1413 : We probably want to search /usr/shlib before most other libraries.
1414 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1415 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1416 glibpth="/usr/shlib $glibpth"
1417 : Do not use vfork unless overridden by a hint file.
1418 usevfork=false
1419
1420 : Find the basic shell for Bourne shell scripts
1421 case "$sh" in
1422 '')
1423         case "$SYSTYPE" in
1424         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1425         *) xxx='/bin/sh';;
1426         esac
1427         if test -f "$xxx"; then
1428                 sh="$xxx"
1429         else
1430                 : Build up a list and do a single loop so we can 'break' out.
1431                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1432                 for xxx in sh bash ksh pdksh ash; do
1433                         for p in $pth; do
1434                                 try="$try ${p}/${xxx}"
1435                         done
1436                 done
1437                 for xxx in $try; do
1438                         if test -f "$xxx"; then
1439                                 sh="$xxx";
1440                                 break
1441                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1442                                 sh="$xxx";
1443                                 break
1444                         elif test -f "$xxx.exe"; then
1445                                 sh="$xxx";
1446                                 break
1447                         fi
1448                 done
1449         fi
1450         ;;
1451 esac
1452
1453 case "$sh" in
1454 '')     cat >&2 <<EOM
1455 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1456
1457 Usually it's in /bin/sh.  How did you even get this far?
1458 Please contact me (Perl Maintainers) at perlbug@perl.org and
1459 we'll try to straighten this all out.
1460 EOM
1461         exit 1
1462         ;;
1463 esac
1464
1465 : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl
1466 : default both to the same thing, cross-compilers can then set targetsh differently if they like
1467 targetsh=$sh
1468
1469 : see if sh knows # comments
1470 if `$sh -c '#' >/dev/null 2>&1`; then
1471         shsharp=true
1472         spitshell=cat
1473         xcat=/bin/cat
1474         test -f $xcat$_exe || xcat=/usr/bin/cat
1475         if test ! -f $xcat$_exe; then
1476                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1477                         if test -f $p/cat$_exe; then
1478                                 xcat=$p/cat
1479                                 break
1480                         fi
1481                 done
1482                 if test ! -f $xcat$_exe; then
1483                         echo "Can't find cat anywhere!"
1484                         exit 1
1485                 fi
1486         fi
1487         echo "#!$xcat" >sharp
1488         $eunicefix sharp
1489         chmod +x sharp
1490         ./sharp > today 2>/dev/null
1491         if test -s today; then
1492                 sharpbang='#!'
1493         else
1494                 echo "#! $xcat" > sharp
1495                 $eunicefix sharp
1496                 chmod +x sharp
1497                 ./sharp > today 2>/dev/null
1498                 if test -s today; then
1499                         sharpbang='#! '
1500                 else
1501                         sharpbang=': use '
1502                 fi
1503         fi
1504 else
1505         echo " "
1506         echo "Your $sh doesn't grok # comments--I will strip them later on."
1507         shsharp=false
1508         cd ..
1509         echo "exec grep -v '^[  ]*#'" >spitshell
1510         chmod +x spitshell
1511         $eunicefix spitshell
1512         spitshell=`pwd`/spitshell
1513         cd UU
1514         echo "I presume that if # doesn't work, #! won't work either!"
1515         sharpbang=': use '
1516 fi
1517 rm -f sharp today
1518
1519 : figure out how to guarantee sh startup
1520 case "$startsh" in
1521 '') startsh=${sharpbang}${sh} ;;
1522 *)
1523 esac
1524 cat >sharp <<EOSS
1525 $startsh
1526 set abc
1527 test "$?abc" != 1
1528 EOSS
1529
1530 chmod +x sharp
1531 $eunicefix sharp
1532 if ./sharp; then
1533         : echo "Yup, it does."
1534 else
1535         echo "Hmm... '$startsh' does not guarantee sh startup..."
1536         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1537 fi
1538 rm -f sharp
1539
1540 : Save command line options in file UU/cmdline.opt for later use in
1541 : generating config.sh.
1542 cat > cmdline.opt <<EOSH
1543 : Configure command line arguments.
1544 config_arg0='$0'
1545 config_args='$*'
1546 config_argc=$#
1547 EOSH
1548 argn=1
1549 args_exp=''
1550 args_sep=''
1551 for arg in "$@"; do
1552         cat >>cmdline.opt <<EOSH
1553 config_arg$argn='$arg'
1554 EOSH
1555         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1556 $arg
1557 EOC
1558         arg_exp=`cat cmdl.opt`
1559         args_exp="$args_exp$args_sep'$arg_exp'"
1560         argn=`expr $argn + 1`
1561         args_sep=' '
1562 done
1563 rm -f cmdl.opt
1564
1565 : produce awk script to parse command line options
1566 cat >options.awk <<'EOF'
1567 BEGIN {
1568         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1569
1570         len = length(optstr);
1571         for (i = 1; i <= len; i++) {
1572                 c = substr(optstr, i, 1);
1573                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1574                 if (a == ":") {
1575                         arg[c] = 1;
1576                         i++;
1577                 }
1578                 opt[c] = 1;
1579         }
1580 }
1581 {
1582         expect = 0;
1583         str = $0;
1584         if (substr(str, 1, 1) != "-") {
1585                 printf("'%s'\n", str);
1586                 next;
1587         }
1588         len = length($0);
1589         for (i = 2; i <= len; i++) {
1590                 c = substr(str, i, 1);
1591                 if (!opt[c]) {
1592                         printf("-%s\n", substr(str, i));
1593                         next;
1594                 }
1595                 printf("-%s\n", c);
1596                 if (arg[c]) {
1597                         if (i < len)
1598                                 printf("'%s'\n", substr(str, i + 1));
1599                         else
1600                                 expect = 1;
1601                         next;
1602                 }
1603         }
1604 }
1605 END {
1606         if (expect)
1607                 print "?";
1608 }
1609 EOF
1610
1611 : process the command line options
1612 set X `for arg in "$@"; do echo "X$arg"; done |
1613         sed -e s/X// | awk -f options.awk`
1614 eval "set $*"
1615 shift
1616 rm -f options.awk
1617
1618 : set up default values
1619 fastread=''
1620 reuseval=false
1621 config_sh=''
1622 alldone=''
1623 error=''
1624 silent=''
1625 extractsh=''
1626 override=''
1627 knowitall=''
1628 rm -f optdef.sh posthint.sh
1629 cat >optdef.sh <<EOS
1630 $startsh
1631 EOS
1632
1633
1634 : option parsing
1635 while test $# -gt 0; do
1636         case "$1" in
1637         -d) shift; fastread=yes;;
1638         -e) shift; alldone=cont;;
1639         -f)
1640                 shift
1641                 cd ..
1642                 if test -r "$1"; then
1643                         config_sh="$1"
1644                 else
1645                         echo "$me: cannot read config file $1." >&2
1646                         error=true
1647                 fi
1648                 cd UU
1649                 shift;;
1650         --help|\
1651         -h) shift; error=true;;
1652         -r) shift; reuseval=true;;
1653         -s) shift; silent=true; realsilent=true;;
1654         -E) shift; alldone=exit;;
1655         -K) shift; knowitall=true;;
1656         -O) shift; override=true;;
1657         -S) shift; silent=true; extractsh=true;;
1658         -D)
1659                 shift
1660                 case "$1" in
1661                 *=)
1662                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1663                         echo "$me: ignoring -D $1" >&2
1664                         ;;
1665                 *=*) echo "$1" | \
1666                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1667                 *) echo "$1='define'" >> optdef.sh;;
1668                 esac
1669                 shift
1670                 ;;
1671         -U)
1672                 shift
1673                 case "$1" in
1674                 *=) echo "$1" >> optdef.sh;;
1675                 *=*)
1676                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1677                         echo "$me: ignoring -U $1" >&2
1678                         ;;
1679                 *) echo "$1='undef'" >> optdef.sh;;
1680                 esac
1681                 shift
1682                 ;;
1683         -A)
1684             shift
1685             xxx=''
1686             yyy="$1"
1687             zzz=''
1688             uuu=undef
1689             case "$yyy" in
1690             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1691                  case "$zzz" in
1692                  *:*) zzz='' ;;
1693                  *)   xxx=append
1694                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1695                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1696                  esac
1697                  ;;
1698             esac
1699             case "$xxx" in
1700             '')  case "$yyy" in
1701                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1702                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1703                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1704                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1705                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1706                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1707                  esac
1708                  ;;
1709             esac
1710             case "$xxx" in
1711             append)
1712                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1713             clear)
1714                 echo "$yyy=''"                  >> posthint.sh ;;
1715             define)
1716                 case "$zzz" in
1717                 '') zzz=define ;;
1718                 esac
1719                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1720             eval)
1721                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1722             prepend)
1723                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1724             undef)
1725                 case "$zzz" in
1726                 '') zzz="$uuu" ;;
1727                 esac
1728                 echo "$yyy=$zzz"                >> posthint.sh ;;
1729             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1730             esac
1731             shift
1732             ;;
1733         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1734             exit 0;;
1735         --) break;;
1736         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1737         *) break;;
1738         esac
1739 done
1740
1741 case "$error" in
1742 true)
1743         cat >&2 <<EOM
1744 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1745                  [-U symbol] [-U symbol=] [-A command:symbol...]
1746   -d : use defaults for all answers.
1747   -e : go on without questioning past the production of config.sh.
1748   -f : specify an alternate default configuration file.
1749   -h : print this help message and exit (with an error status).
1750   -r : reuse C symbols value if possible (skips costly nm extraction).
1751   -s : silent mode, only echoes questions and essential information.
1752   -D : define symbol to have some value:
1753          -D symbol         symbol gets the value 'define'
1754          -D symbol=value   symbol gets the value 'value'
1755        common used examples (see INSTALL for more info):
1756          -Duse64bitint            use 64bit integers
1757          -Duse64bitall            use 64bit integers and pointers
1758          -Dusethreads             use thread support
1759          -Dinc_version_list=none  do not include older perl trees in @INC
1760          -DEBUGGING=none          DEBUGGING options
1761          -Dcc=gcc                 choose your compiler
1762          -Dprefix=/opt/perl5      choose your destination
1763   -E : stop at the end of questions, after having produced config.sh.
1764   -K : do not use unless you know what you are doing.
1765   -O : let -D and -U override definitions from loaded configuration file.
1766   -S : perform variable substitutions on all .SH files (can mix with -f)
1767   -U : undefine symbol:
1768          -U symbol    symbol gets the value 'undef'
1769          -U symbol=   symbol gets completely empty
1770        e.g.:  -Uversiononly
1771   -A : manipulate symbol after the platform specific hints have been applied:
1772          -A append:symbol=value   append value to symbol
1773          -A symbol=value          like append:, but with a separating space
1774          -A define:symbol=value   define symbol to have value
1775          -A clear:symbol          define symbol to be ''
1776          -A define:symbol         define symbol to be 'define'
1777          -A eval:symbol=value     define symbol to be eval of value
1778          -A prepend:symbol=value  prepend value to symbol
1779          -A undef:symbol          define symbol to be 'undef'
1780          -A undef:symbol=         define symbol to be ''
1781        e.g.:  -A prepend:libswanted='cl pthread '
1782               -A ccflags=-DSOME_MACRO
1783   -V : print version number and exit (with a zero status).
1784 EOM
1785         exit 1
1786         ;;
1787 esac
1788
1789 : Sanity checks
1790 case "$fastread$alldone" in
1791 yescont|yesexit) ;;
1792 *)
1793         case "$extractsh" in
1794         true) ;;
1795         *)
1796                 if test ! -t 0; then
1797                         echo "Say 'sh Configure', not 'sh <Configure'"
1798                         exit 1
1799                 fi
1800                 ;;
1801         esac
1802         ;;
1803 esac
1804
1805 exec 4>&1
1806 case "$silent" in
1807 true) exec 1>/dev/null;;
1808 esac
1809
1810 : run the defines and the undefines, if any, but leave the file out there...
1811 touch optdef.sh
1812 . ./optdef.sh
1813 : create the posthint manipulation script and leave the file out there...
1814 touch posthint.sh
1815
1816 : set package name
1817 package='perl5'
1818 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1819 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1820 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1821 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1822 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1823 esac
1824
1825 : Some greps do not return status, grrr.
1826 echo "grimblepritz" >grimble
1827 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1828         contains=contains
1829 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1830         contains=grep
1831 else
1832         contains=contains
1833 fi
1834 rm -f grimble
1835 : the following should work in any shell
1836 case "$contains" in
1837 contains*)
1838         echo " "
1839         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1840         cat >contains <<'EOSS'
1841 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1842 EOSS
1843 chmod +x contains
1844 esac
1845
1846 : Find the path to the source tree
1847 case "$src" in
1848 '') case "$0" in
1849     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1850          case "$src" in
1851          /*)    ;;
1852          .)     ;;
1853          *)     src=`cd ../$src && pwd` ;;
1854          esac
1855          ;;
1856     *)   src='.';;
1857     esac;;
1858 esac
1859 case "$src" in
1860 '')     src=/
1861         rsrc=/
1862         ;;
1863 /*)     rsrc="$src";;
1864 *)      rsrc="../$src";;
1865 esac
1866 if test -f $rsrc/Configure && \
1867         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1868 then
1869    : found it, so we are ok.
1870 else
1871         rsrc=''
1872         for src in . .. ../.. ../../.. ../../../..; do
1873                 if test -f ../$src/Configure && \
1874                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1875                 then
1876                         rsrc=../$src
1877                         break
1878                 fi
1879         done
1880 fi
1881 case "$rsrc" in
1882 '')
1883         cat <<EOM >&4
1884
1885 Sorry, I can't seem to locate the source dir for $package.  Please start
1886 Configure with an explicit path -- i.e. /some/path/Configure.
1887
1888 EOM
1889         exit 1
1890         ;;
1891 ../.)   rsrc='..';;
1892 *)
1893         echo " "
1894         echo "Sources for $package found in \"$src\"." >&4
1895         ;;
1896 esac
1897
1898 : script used to extract .SH files with variable substitutions
1899 cat >extract <<'EOS'
1900 PERL_CONFIG_SH=true
1901 echo "Doing variable substitutions on .SH files..."
1902 if test -f MANIFEST; then
1903         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1904 else
1905         echo "(Looking for .SH files under the source directory.)"
1906         set x `(cd "$src"; find . -name "*.SH" -print)`
1907 fi
1908 shift
1909 case $# in
1910 0) set x `(cd "$src"; echo *.SH)`; shift;;
1911 esac
1912 if test ! -f "$src/$1"; then
1913         shift
1914 fi
1915 mkdir_p='
1916 name=$1;
1917 create="";
1918 while test $name; do
1919         if test ! -d "$name"; then
1920                 create="$name $create";
1921                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1922                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1923         else
1924                 name="";
1925         fi;
1926 done;
1927 for file in $create; do
1928         mkdir $file;
1929 done
1930 '
1931 for file in $*; do
1932         case "$src" in
1933         ".")
1934                 case "$file" in
1935                 */*)
1936                         dir=`expr X$file : 'X\(.*\)/'`
1937                         file=`expr X$file : 'X.*/\(.*\)'`
1938                         (cd "$dir" && . ./$file)
1939                         ;;
1940                 *)
1941                         . ./$file
1942                         ;;
1943                 esac
1944                 ;;
1945         *)
1946                 case "$file" in
1947                 */*)
1948                         dir=`expr X$file : 'X\(.*\)/'`
1949                         file=`expr X$file : 'X.*/\(.*\)'`
1950                         (set x $dir; shift; eval $mkdir_p)
1951                         sh <"$src/$dir/$file"
1952                         ;;
1953                 *)
1954                         sh <"$src/$file"
1955                         ;;
1956                 esac
1957                 ;;
1958         esac
1959 done
1960 if test -f "$src/config_h.SH"; then
1961         if test ! -f config.h; then
1962         : oops, they left it out of MANIFEST, probably, so do it anyway.
1963         . "$src/config_h.SH"
1964         fi
1965 fi
1966 EOS
1967
1968 : extract files and exit if asked to do so
1969 case "$extractsh" in
1970 true)
1971         case "$realsilent" in
1972         true) ;;
1973         *) exec 1>&4;;
1974         esac
1975         case "$config_sh" in
1976         '') config_sh='config.sh';;
1977         esac
1978         echo " "
1979         echo "Fetching answers from $config_sh..."
1980         cd ..
1981         . $config_sh
1982         test "$override" && . ./optdef.sh
1983         echo " "
1984         . UU/extract
1985         rm -rf UU
1986         echo "Extraction done."
1987         exit 0
1988         ;;
1989 esac
1990
1991 : Eunice requires " " instead of "", can you believe it
1992 echo " "
1993 : Here we go...
1994 echo "Beginning of configuration questions for $package."
1995
1996 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1997
1998 : first determine how to suppress newline on echo command
1999 echo " "
2000 echo "Checking echo to see how to suppress newlines..."
2001 (echo "hi there\c" ; echo " ") >.echotmp
2002 if $contains c .echotmp >/dev/null 2>&1 ; then
2003         echo "...using -n."
2004         n='-n'
2005         c=''
2006 else
2007         cat <<'EOM'
2008 ...using \c
2009 EOM
2010         n=''
2011         c='\c'
2012 fi
2013 echo $n "The star should be here-->$c"
2014 echo '*'
2015 rm -f .echotmp
2016
2017 : Now test for existence of everything in MANIFEST
2018 echo " "
2019 if test -f "$rsrc/MANIFEST"; then
2020         echo "First let's make sure your kit is complete.  Checking..." >&4
2021         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
2022                 (split -l 50 2>/dev/null || split -50)
2023         rm -f missing
2024         tmppwd=`pwd`
2025         for filelist in x??; do
2026                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
2027                         >/dev/null 2>>"$tmppwd/missing")
2028         done
2029         if test -s missing; then
2030                 cat missing >&4
2031                 cat >&4 <<'EOM'
2032
2033 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2034
2035 You have the option of continuing the configuration process, despite the
2036 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2037 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2038 and contact the author (perlbug@perl.org).
2039
2040 EOM
2041                 echo $n "Continue? [n] $c" >&4
2042                 read ans
2043                 case "$ans" in
2044                 y*)
2045                         echo "Continuing..." >&4
2046                         rm -f missing
2047                         ;;
2048                 *)
2049                         echo "ABORTING..." >&4
2050                         kill $$
2051                         ;;
2052                 esac
2053         else
2054                 echo "Looks good..."
2055         fi
2056 else
2057         echo "There is no MANIFEST file.  I hope your kit is complete !"
2058 fi
2059 rm -f missing x??
2060
2061 : Find the appropriate value for a newline for tr
2062 echo " "
2063 if test -n "$DJGPP"; then
2064        trnl='\012'
2065 fi
2066 if test X"$trnl" = X; then
2067         case "`echo foo|tr '\n' x 2>/dev/null`" in
2068         foox) trnl='\n' ;;
2069         esac
2070 fi
2071 if test X"$trnl" = X; then
2072         case "`echo foo|tr '\012' x 2>/dev/null`" in
2073         foox) trnl='\012' ;;
2074         esac
2075 fi
2076 if test X"$trnl" = X; then
2077        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2078        fooxy) trnl='\n\r' ;;
2079        esac
2080 fi
2081 if test X"$trnl" = X; then
2082         cat <<EOM >&2
2083
2084 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2085
2086 EOM
2087         exit 1
2088 fi
2089
2090 : compute the number of columns on the terminal for proper question formatting
2091 case "$COLUMNS" in
2092 '') COLUMNS='80';;
2093 esac
2094
2095 : set up the echo used in my read
2096 myecho="case \"\$xxxm\" in
2097 '') echo $n \"\$rp $c\" >&4;;
2098 *) case \"\$rp\" in
2099         '') echo $n \"[\$xxxm] $c\";;
2100         *)
2101                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2102                         echo \"\$rp\" >&4
2103                         echo $n \"[\$xxxm] $c\" >&4
2104                 else
2105                         echo $n \"\$rp [\$xxxm] $c\" >&4
2106                 fi
2107                 ;;
2108         esac;;
2109 esac"
2110
2111 : now set up to do reads with possible shell escape and default assignment
2112 cat <<EOSC >myread
2113 $startsh
2114 xxxm=\$dflt
2115 $myecho
2116 ans='!'
2117 case "\$fastread" in
2118 yes) case "\$dflt" in
2119         '') ;;
2120         *) ans='';
2121                 case "\$silent-\$rp" in
2122                 true-) ;;
2123                 *) echo " " >&4;;
2124                 esac;;
2125         esac;;
2126 *) case "\$silent" in
2127         true) case "\$rp" in
2128                 '') ans='';;
2129                 esac;;
2130         esac;;
2131 esac
2132 while expr "X\$ans" : "X!" >/dev/null; do
2133         read answ
2134         set x \$xxxm
2135         shift
2136         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2137         case  "\$answ" in
2138         "!")
2139                 sh 1>&4
2140                 echo " "
2141                 $myecho
2142                 ;;
2143         !*)
2144                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2145                 shift
2146                 sh 1>&4 -c "\$*"
2147                 echo " "
2148                 $myecho
2149                 ;;
2150         "\$ans")
2151                 case "\$ans" in
2152                 \\&*)
2153                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2154                         shift
2155                         case "\$1" in
2156                         -d)
2157                                 fastread=yes
2158                                 echo "(OK, I'll run with -d after this question.)" >&4
2159                                 ;;
2160                         -*)
2161                                 echo "*** Sorry, \$1 not supported yet." >&4
2162                                 ;;
2163                         esac
2164                         $myecho
2165                         ans=!
2166                         ;;
2167                 esac;;
2168         *)
2169                 case "\$aok" in
2170                 y)
2171                         echo "*** Substitution done -- please confirm."
2172                         xxxm="\$ans"
2173                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2174                         xxxm="\$ans"
2175                         ans=!
2176                         ;;
2177                 *)
2178                         echo "*** Error -- try again."
2179                         ans=!
2180                         ;;
2181                 esac
2182                 $myecho
2183                 ;;
2184         esac
2185         case "\$ans\$xxxm\$nostick" in
2186         '')
2187                 ans=!
2188                 $myecho
2189                 ;;
2190         esac
2191 done
2192 case "\$ans" in
2193 '') ans="\$xxxm";;
2194 esac
2195 EOSC
2196
2197 : create .config dir to save info across Configure sessions
2198 test -d ../.config || mkdir ../.config
2199 cat >../.config/README <<EOF
2200 This directory created by Configure to save information that should
2201 persist across sessions for $package.
2202
2203 You may safely delete it if you wish.
2204 EOF
2205
2206 : See if we are using a devel version and want that
2207 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2208 case "$usedevel" in
2209 $define|true|[yY]*)
2210     usedevel="$define" ;;
2211 *) case "$xversion" in
2212    *[13579])
2213         cat >&4 <<EOH
2214 *** WHOA THERE!!! ***
2215
2216     This is an UNSTABLE DEVELOPMENT release.
2217     The version of this $package distribution is $xversion, that is, odd,
2218     (as opposed to even) and that signifies a development release.
2219     If you want a maintenance release, you want an even-numbered version.
2220
2221     Do ***NOT*** install this into production use.
2222     Data corruption and crashes are possible.
2223
2224     It is most seriously suggested that you do not continue any further
2225     unless you want to help in developing and debugging Perl.
2226
2227     If you *still* want to build perl, you can answer 'y' now,
2228     or pass -Dusedevel to Configure.
2229
2230 EOH
2231         rp='Do you really want to continue?'
2232         dflt='n'
2233         . ./myread
2234         case "$ans" in
2235         [yY]) echo >&4 "Okay, continuing."
2236               usedevel="$define" ;;
2237         *) echo >&4 "Okay, bye."
2238            exit 1
2239            ;;
2240         esac
2241         ;;
2242     esac
2243     usedevel="$undef"
2244     ;;
2245 esac
2246 case "$usedevel" in
2247 $define|true|[yY]*)
2248         case "$versiononly" in
2249         '') versiononly="$define" ;;
2250         esac
2251         case "$installusrbinperl" in
2252         '') installusrbinperl="$undef" ;;
2253         esac
2254         ;;
2255 esac
2256
2257 : general instructions
2258 needman=true
2259 firsttime=true
2260 user=`(logname) 2>/dev/null`
2261 case "$user" in
2262 '') user=`whoami 2>&1`;;
2263 esac
2264 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2265         firsttime=false
2266         echo " "
2267         rp='Would you like to see the instructions?'
2268         dflt=n
2269         . ./myread
2270         case "$ans" in
2271         [yY]*) ;;
2272         *) needman=false;;
2273         esac
2274 fi
2275 if $needman; then
2276         cat <<EOH
2277
2278 This installation shell script will examine your system and ask you questions
2279 to determine how the perl5 package should be installed. If you get
2280 stuck on a question, you may use a ! shell escape to start a subshell or
2281 execute a command.  Many of the questions will have default answers in square
2282 brackets; typing carriage return will give you the default.
2283
2284 On some of the questions which ask for file or directory names you are allowed
2285 to use the ~name construct to specify the login directory belonging to "name",
2286 even if you don't have a shell which knows about that.  Questions where this is
2287 allowed will be marked "(~name ok)".
2288
2289 EOH
2290         rp=''
2291         dflt='Type carriage return to continue'
2292         . ./myread
2293         cat <<'EOH'
2294
2295 The prompter used in this script allows you to use shell variables and
2296 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2297 in the default answer, as if the default line was a set of arguments given to a
2298 script shell.  This means you may also use $* to repeat the whole default line,
2299 so you do not have to re-type everything to add something to the default.
2300
2301 Every time there is a substitution, you will have to confirm.  If there is an
2302 error (e.g. an unmatched backtick), the default answer will remain unchanged
2303 and you will be prompted again.
2304
2305 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2306 the questions and use the computed defaults (or the previous answers if there
2307 was already a config.sh file). Type 'Configure -h' for a list of options.
2308 You may also start interactively and then answer '& -d' at any prompt to turn
2309 on the non-interactive behaviour for the remainder of the execution.
2310
2311 EOH
2312         . ./myread
2313         cat <<EOH
2314
2315 Much effort has been expended to ensure that this shell script will run on any
2316 Unix system.  If despite that it blows up on yours, your best bet is to edit
2317 Configure and run it again.  If you can't run Configure for some reason,
2318 you'll have to generate a config.sh file by hand.  Whatever problems you
2319 have, let me (perlbug@perl.org) know how I blew it.
2320
2321 This installation script affects things in two ways:
2322
2323 1) it may do direct variable substitutions on some of the files included
2324    in this kit.
2325 2) it builds a config.h file for inclusion in C programs.  You may edit
2326    any of these files as the need arises after running this script.
2327
2328 If you make a mistake on a question, there is no easy way to back up to it
2329 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2330 files.  Configure will offer to let you do this before it runs the SH files.
2331
2332 EOH
2333         dflt='Type carriage return to continue'
2334         . ./myread
2335         case "$firsttime" in
2336         true) echo $user >>../.config/instruct;;
2337         esac
2338 fi
2339
2340 : Set 'sysroot' to change the logical root directory to your headers and libraries see man gcc
2341 : This is primarily meant for cross-compile environments, and may fail to be useful in other cases
2342 if test "X$sysroot" = X; then
2343     sysroot=""
2344 else
2345     case "$cc" in
2346         *gcc*|*g++*)
2347             echo "Using $sysroot to find your headers and libraries, adding to ccflags"
2348             # _sysroot is used in places where we need --sysroot=foo
2349             # but using the rest of the flags could cause issues.
2350             _sysroot="--sysroot=$sysroot";
2351             case "$ccflags" in
2352                 *sysroot*) ;;
2353                 'undef'|*)
2354                 ccflags="$ccflags $_sysroot"
2355             esac
2356             case "$ldflags" in
2357                 *sysroot*) ;;
2358                 'undef'|*)
2359                 ldflags="$ldflags $_sysroot"
2360             esac
2361             case "$cppflags" in
2362                 *sysroot*) ;;
2363                 'undef'|*)
2364                 cppflags="$cppflags $_sysroot"
2365             esac
2366             # lddlflags updated below in lddlflags section;
2367             # same with cccdlflags
2368             ;;
2369     esac
2370
2371     # Adjust some defaults to also use $sysroot
2372     for var in xlibpth loclibpth locincpth glibpth; do
2373         eval xxx=\$$var
2374         eval $var=''
2375         for path in $xxx; do
2376             eval $var=\"\$$var $sysroot$path\"
2377         done
2378     done
2379
2380 fi
2381
2382 : find out where common programs are
2383 echo " "
2384 echo "Locating common programs..." >&4
2385 cat <<EOSC >loc
2386 $startsh
2387 case \$# in
2388 0) exit 1;;
2389 esac
2390 thing=\$1
2391 shift
2392 dflt=\$1
2393 shift
2394 for dir in \$*; do
2395         case "\$thing" in
2396         .)
2397         if test -d \$dir/\$thing; then
2398                 echo \$dir
2399                 exit 0
2400         fi
2401         ;;
2402         *)
2403         for thisthing in \$dir/\$thing; do
2404                 : just loop through to pick last item
2405         done
2406         if test -f \$thisthing; then
2407                 echo \$thisthing
2408                 exit 0
2409         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2410                 echo \$thisthing
2411                 exit 0
2412         elif test -f \$dir/\$thing.exe; then
2413                 if test -n "$DJGPP"; then
2414                         echo \$dir/\$thing.exe
2415                 elif test "$eunicefix" != ":"; then
2416                         : on Eunice apparently
2417                         echo \$dir/\$thing
2418                 fi
2419                 exit 0
2420         fi
2421         ;;
2422         esac
2423 done
2424 echo \$dflt
2425 exit 1
2426 EOSC
2427 chmod +x loc
2428 $eunicefix loc
2429 loclist="
2430 awk
2431 cat
2432 chmod
2433 comm
2434 cp
2435 echo
2436 expr
2437 grep
2438 ls
2439 mkdir
2440 rm
2441 sed
2442 sort
2443 touch
2444 tr
2445 uniq
2446 "
2447 trylist="
2448 ar
2449 bison
2450 byacc
2451 cpp
2452 csh
2453 date
2454 egrep
2455 gmake
2456 gzip
2457 less
2458 ln
2459 make
2460 more
2461 nm
2462 nroff
2463 perl
2464 pg
2465 test
2466 uname
2467 zip
2468 "
2469 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2470 pth="$pth $sysroot/lib $sysroot/usr/lib"
2471 for file in $loclist; do
2472         eval xxx=\$$file
2473         case "$xxx" in
2474         /*|?:[\\/]*)
2475                 if test -f "$xxx"; then
2476                         : ok
2477                 else
2478                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2479                         xxx=`./loc $file $file $pth`
2480                 fi
2481                 ;;
2482         '') xxx=`./loc $file $file $pth`;;
2483         *) xxx=`./loc $xxx $xxx $pth`;;
2484         esac
2485         eval $file=$xxx$_exe
2486         eval _$file=$xxx
2487         case "$xxx" in
2488         /*)
2489                 echo $file is in $xxx.
2490                 ;;
2491         ?:[\\/]*)
2492                 echo $file is in $xxx.
2493                 ;;
2494         *)
2495                 echo "I don't know where '$file' is, and my life depends on it." >&4
2496                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2497                 exit 1
2498                 ;;
2499         esac
2500 done
2501 echo " "
2502 echo "Don't worry if any of the following aren't found..."
2503 say=offhand
2504 for file in $trylist; do
2505         eval xxx=\$$file
2506         case "$xxx" in
2507         /*|?:[\\/]*)
2508                 if test -f "$xxx"; then
2509                         : ok
2510                 else
2511                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2512                         xxx=`./loc $file $file $pth`
2513                 fi
2514                 ;;
2515         '') xxx=`./loc $file $file $pth`;;
2516         *) xxx=`./loc $xxx $xxx $pth`;;
2517         esac
2518         eval $file=$xxx$_exe
2519         eval _$file=$xxx
2520         case "$xxx" in
2521         /*)
2522                 echo $file is in $xxx.
2523                 ;;
2524         ?:[\\/]*)
2525                 echo $file is in $xxx.
2526                 ;;
2527         *)
2528                 echo "I don't see $file out there, $say."
2529                 say=either
2530                 ;;
2531         esac
2532 done
2533 case "$egrep" in
2534 egrep)
2535         echo "Substituting grep for egrep."
2536         egrep=$grep
2537         _egrep=$grep
2538         ;;
2539 esac
2540 case "$less" in
2541 '')     ;;
2542 *)      if $less -R </dev/null >/dev/null 2>&1; then
2543                echo "Substituting less -R for less."
2544                less="$less -R"
2545                _less=$less
2546         fi
2547         ;;
2548 esac
2549 case "$ln" in
2550 ln)
2551         echo "Substituting cp for ln."
2552         ln=$cp
2553         _ln=$cp
2554         ;;
2555 esac
2556 case "$make" in
2557 make)
2558         case "$gmake" in
2559         gmake)
2560         echo "I can't find make or gmake, and my life depends on it." >&4
2561         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2562         exit 1
2563         ;;
2564         esac
2565         ;;
2566 esac
2567 case "$gmake" in
2568 gmake)  ;;
2569 *)      # We can't have osname yet.
2570         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2571                 # Assume that gmake, if found, is definitely GNU make
2572                 # and prefer it over the system make.
2573                 echo "Substituting gmake for make."
2574                 make=$gmake
2575                 _make=$gmake
2576         fi
2577         ;;
2578 esac
2579 case "$test" in
2580 test)
2581         echo "Hopefully test is built into your sh."
2582         ;;
2583 *)
2584         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2585                 echo "Using the test built into your sh."
2586                 test=test
2587                 _test=test
2588         fi
2589         ;;
2590 esac
2591 case "$echo" in
2592 echo)
2593         echo "Hopefully echo is built into your sh."
2594         ;;
2595 '') ;;
2596 *)
2597         echo " "
2598 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2599         $echo $n "hi there$c" >foo1
2600         echo $n "hi there$c" >foo2
2601         if cmp foo1 foo2 >/dev/null 2>&1; then
2602                 echo "They are compatible.  In fact, they may be identical."
2603         else
2604                 case "$n" in
2605                 '-n') n='' c='\c';;
2606                 *) n='-n' c='';;
2607                 esac
2608                 cat <<FOO
2609 They are not compatible!  You are probably running ksh on a non-USG system.
2610 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2611 have echo built in and we may have to run some Bourne shell scripts.  That
2612 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2613
2614 FOO
2615                 $echo $n "The star should be here-->$c"
2616                 $echo "*"
2617         fi
2618         $rm -f foo1 foo2
2619         ;;
2620 esac
2621
2622 # This question was auctioned at YAPC::Europe-2007 in Vienna
2623 # I never promised you could answer it. I only auctioned the question.
2624 cat <<FOO
2625 The following message is sponsored by
2626
2627   Dresden.pm<--The stars should be here.
2628
2629 Dear Perl user, system administrator or package
2630 maintainer, the Perl community sends greetings to
2631 you. Do you (emblematical) greet back [Y/n]? n
2632
2633 FOO
2634
2635 : Check what type of C compiler we use
2636 cat <<EOS >trygcc
2637 $startsh
2638 EOS
2639 cat <<'EOSC' >>trygcc
2640 case "$cc" in
2641 '') ;;
2642 *)  $rm -f try try.*
2643     $cat >try.c <<EOM
2644 int main(int argc, char *argv[]) {
2645   return 0;
2646 }
2647 EOM
2648     if $cc -o try $ccflags $ldflags try.c; then
2649        :
2650     else
2651         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2652         despair=yes
2653         trygcc=yes
2654         case "$cc" in
2655         *gcc*) trygcc=no ;;
2656         esac
2657         # Skip this test because it gives a false match on output like:
2658         #    ./trygcc: line 23: cc: command not found
2659         # case "`$cc -v -c try.c 2>&1`" in
2660         # *gcc*) trygcc=no ;;
2661         # esac
2662         if $test X"$trygcc" = Xyes; then
2663             if gcc -o try -c try.c; then
2664                 echo " "
2665                 echo "You seem to have a working gcc, though." >&4
2666                 # Switching compilers may undo the work of hints files.
2667                 # The most common problem is -D_REENTRANT for threads.
2668                 # This heuristic catches that case, but gets false positives
2669                 # if -Dusethreads was not actually specified.  Better to
2670                 # bail out here with a useful message than fail
2671                 # mysteriously later. Should we perhaps just try to
2672                 # re-invoke Configure -Dcc=gcc config_args ?
2673                 if $test -f usethreads.cbu; then
2674                         $cat >&4 <<EOM
2675
2676 *** However, any setting of the C compiler flags (e.g. for thread support)
2677 *** will be lost.  It may be necessary for you to restart Configure and
2678 *** add -Dcc=gcc to your Configure command line.
2679
2680 EOM
2681                         rp="Would you like to go ahead and try gcc anyway?"
2682                         dflt=n
2683                 else
2684                         rp="Would you like to use it?"
2685                         dflt=y
2686                 fi
2687                 if $test -f myread; then
2688                     . ./myread
2689                 else
2690                     if $test -f UU/myread; then
2691                         . ./UU/myread
2692                     else
2693                         echo "Cannot find myread, sorry.  Aborting." >&2
2694                         exit 1
2695                     fi
2696                 fi
2697                 case "$ans" in
2698                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2699                 esac
2700             fi
2701         fi
2702     fi
2703     $rm -f try try.*
2704     ;;
2705 esac
2706 EOSC
2707
2708 cat <<EOS >checkcc
2709 $startsh
2710 EOS
2711 cat <<'EOSC' >>checkcc
2712 case "$cc" in
2713 '') ;;
2714 *)  $rm -f try try.*
2715     $cat >try.c <<EOM
2716 int main(int argc, char *argv[]) {
2717   return 0;
2718 }
2719 EOM
2720     if $cc -o try $ccflags $ldflags try.c; then
2721        :
2722     else
2723         if $test X"$despair" = Xyes; then
2724            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2725         fi
2726         $cat >&4 <<EOM
2727 You need to find a working C compiler.
2728 Either (purchase and) install the C compiler supplied by your OS vendor,
2729 or for a free C compiler try http://gcc.gnu.org/
2730 I cannot continue any further, aborting.
2731 EOM
2732         exit 1
2733     fi
2734     $rm -f try try.*
2735     ;;
2736 esac
2737 EOSC
2738
2739 : determine whether symbolic links are supported
2740 echo " "
2741 $touch blurfl
2742 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2743         echo "Symbolic links are supported." >&4
2744         lns="$ln -s"
2745 else
2746         echo "Symbolic links are NOT supported." >&4
2747         lns="$ln"
2748 fi
2749 $rm -f blurfl sym
2750
2751 : determine whether symbolic links are supported
2752 echo " "
2753 case "$lns" in
2754 *"ln"*" -s")
2755         echo "Checking how to test for symbolic links..." >&4
2756         $lns blurfl sym
2757         if $test "X$issymlink" = X; then
2758                 case "$newsh" in
2759                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2760                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2761                 esac
2762                 if test $? = 0; then
2763                         issymlink="test -h"
2764                 else
2765                         echo "Your builtin 'test -h' may be broken." >&4
2766                         case "$test" in
2767                         /*)     ;;
2768                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2769                                 for p in $pth
2770                                 do
2771                                         if test -f "$p/$test"; then
2772                                                 test="$p/$test"
2773                                                 break
2774                                         fi
2775                                 done
2776                                 ;;
2777                         esac
2778                         case "$test" in
2779                         /*)
2780                                 echo "Trying external '$test -h'." >&4
2781                                 issymlink="$test -h"
2782                                 if $test ! -h sym >/dev/null 2>&1; then
2783                                         echo "External '$test -h' is broken, too." >&4
2784                                         issymlink=''
2785                                 fi
2786                                 ;;
2787                         *)      issymlink='' ;;
2788                         esac
2789                 fi
2790         fi
2791         if $test "X$issymlink" = X; then
2792                 if $test -L sym 2>/dev/null; then
2793                         issymlink="$test -L"
2794                         echo "The builtin '$test -L' worked." >&4
2795                 fi
2796         fi
2797         if $test "X$issymlink" != X; then
2798                 echo "You can test for symbolic links with '$issymlink'." >&4
2799         else
2800                 echo "I do not know how you can test for symbolic links." >&4
2801         fi
2802         $rm -f blurfl sym
2803         ;;
2804 *)      echo "No symbolic links, so not testing for their testing..." >&4
2805         ;;
2806 esac
2807 echo " "
2808
2809 : Make symlinks util
2810 case "$mksymlinks" in
2811 $define|true|[yY]*)
2812         case "$src" in
2813         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2814                 exit 1
2815                 ;;
2816         *)      case "$lns:$issymlink" in
2817                 *"ln"*" -s:"*"test -"?)
2818                         echo "Creating the symbolic links..." >&4
2819                         cd ..
2820                         awk '{print $1}' $src/MANIFEST | sed -e 's:/\([^/]*\)$: \1:' |
2821                         awk 'NF == 1 {
2822                                 dir=".";
2823                                 file=$1 "";
2824                              }
2825                              NF == 2 {
2826                                 dir=$1 "";
2827                                 file=$2 "";
2828                              }
2829                              {
2830                                  print "# dir = ", dir, "file = ", file
2831                                  mf[dir] = mf[dir]" "src"/"dir"/"file;
2832                              } END {
2833                                  for (d in mf) {
2834                                      if (d != ".") { print("mkdir -p "d) }
2835                                      print("ln -sf "mf[d]" "d);
2836                                  }
2837                              }' src="$src" > UU/mksymlinks.$$
2838                         sh UU/mksymlinks.$$
2839                         rm UU/mksymlinks.$$
2840                         # Sanity check 1.
2841                         if test ! -d t/base; then
2842                                 echo "Failed to create the subdirectories.  Aborting." >&4
2843                                 exit 1
2844                         fi
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                         if test ! -f win32/win32.c; then
2851                                 echo "Failed to create the symlinks (win32/win32.c missing).  Aborting." >&4
2852                                 exit 1
2853                         fi
2854                         cd UU
2855                         ;;
2856                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2857                         ;;
2858                 esac
2859                 ;;
2860         esac
2861         ;;
2862 esac
2863
2864 : Check for Cross-Compilation
2865 if $test "X$targethost" = "X"; then
2866     targethost=""
2867 fi
2868 if $test "X$targetenv" = "X"; then
2869     targetenv=""
2870 fi
2871 case "$usecrosscompile" in
2872 $define|true|[yY]*)
2873         $echo "Cross-compiling..."
2874         croak=''
2875         case "$cc" in
2876         *-gcc*|*-g++*) # A cross-compiling gcc, probably.
2877             # arm-linux-androideabi-gcc  -> arm-linux-androideabi
2878             # x86_64-w64-mingw32-gcc.exe -> x86_64-w64-mingw32
2879             targetarch=`$echo $cc|$sed 's/-g[c\+][c\+].*$//'`
2880             ar=`$echo $cc|$sed 's/-g[c\+][c\+]/-ar/'`
2881             # leave out ld, choosing it is more complex
2882             nm=`$echo $cc|$sed 's/-g[c\+][c\+]/-nm/'`
2883             ranlib=`$echo $cc|$sed 's/-g[c\+][c\+]/-ranlib/'`
2884             # We are in a weird spot. Just before us, some values
2885             # were 'saved', to be restored after the hints are
2886             # run.  This means that the changes we made to ar,
2887             # nm and ranlib will get reverted.
2888             # To avoid that, we hijack the saving mechanism and
2889             # have it save our new values.
2890             for file in ar nm ranlib; do
2891                 eval xxx=\$$file
2892                 eval $file=$xxx$_exe
2893                 eval _$file=$xxx
2894             done
2895         ;;
2896         esac
2897         case "$targetarch" in
2898         '') echo "Targetarch not defined." >&4; croak=y ;;
2899         *)  echo "Using targetarch $targetarch." >&4 ;;
2900         esac
2901         case "$targethost" in
2902         '') echo "Targethost not defined." >&4; croak=y ;;
2903         *)  echo "Using targethost $targethost." >&4
2904         esac
2905         locincpth=' '
2906         loclibpth=' '
2907         case "$croak" in
2908         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2909         esac
2910     : compile a host miniperl and generate_uudmap, unless we got passed them
2911     if $test "X$hostperl" = X; then
2912       echo "Building host miniperl and generate_uudmap binaries" >&4
2913       before_host=`pwd`
2914       cd ..
2915       cd $src
2916       src=`pwd`
2917       rm -rf $src/host
2918       mkdir $src/host
2919       cd $src/host
2920       $src/Configure -des -Dusedevel -Dmksymlinks
2921       $make miniperl
2922       case "$hostgenerate" in
2923       '') $make generate_uudmap
2924           hostgenerate=$src/host/generate_uudmap
2925           ;;
2926        "$undef") hostgenerate=''
2927           ;;
2928       esac
2929       hostperl=$src/host/miniperl
2930       cd $before_host
2931     fi
2932     hostosname=`$hostperl -le 'print $^O'`
2933     ;;
2934 *)
2935     usecrosscompile="$undef"
2936     ;;
2937 esac
2938
2939 : Define -Dtargethost=somecomputer to run compiled tests on another machine
2940 case "$targethost" in
2941     '') echo "Checking for cross-compile" >&4
2942     case "$usecrosscompile$multiarch" in
2943        *$define*) echo "Skipping the try tests in the rest of Configure as no targethost was defined when cross-compiling" >&4
2944          if [ -f Makefile ]; then
2945            echo " "
2946            echo "Now you must ensure config.sh, config.h and the generated headers exist and run a $make."
2947          else
2948            echo "Configure done."
2949          fi
2950        exit 0
2951        ;;
2952      *) echo "No targethost for running compiler tests against defined, running locally" >&4
2953         run=''
2954         to=:
2955         from=:
2956         ;;
2957     esac
2958     ;;
2959     *) echo "Using targethost $targethost." >&4
2960         case "$src" in
2961         /*) run=$src/Cross/run
2962             targetmkdir=$src/Cross/mkdir
2963             to=$src/Cross/to
2964             from=$src/Cross/from
2965             ;;
2966         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2967             run=$pwd/Cross/run
2968             targetmkdir=$pwd/Cross/mkdir
2969             to=$pwd/Cross/to
2970             from=$pwd/Cross/from
2971             ;;
2972         esac
2973         case "$targetrun" in
2974         '') targetrun=ssh ;;
2975         esac
2976         case "$targetto" in
2977         '') targetto=scp ;;
2978         esac
2979         case "$targetfrom" in
2980         '') targetfrom=scp ;;
2981         esac
2982         run=$run-$targetrun
2983         to=$to-$targetto
2984         from=$from-$targetfrom
2985         case "$targetdir" in
2986         '')  targetdir=/tmp
2987              echo "Guessing targetdir $targetdir." >&4
2988              ;;
2989         esac
2990         case "$targetuser" in
2991         '')  targetuser=root
2992              echo "Guessing targetuser $targetuser." >&4
2993              ;;
2994         esac
2995         case "$targetport" in
2996         '')  targetport=22
2997              echo "Guessing targetport $targetport." >&4
2998              ;;
2999         esac
3000         case "$targetfrom" in
3001         scp)    q=-q ;;
3002         *)      q='' ;;
3003         esac
3004         case "$targetrun" in
3005         ssh|rsh)
3006             cat >$run <<EOF
3007 #!/bin/sh
3008 env=''
3009 case "\$1" in
3010 -cwd)
3011   shift
3012   cwd=\$1
3013   shift
3014   ;;
3015 esac
3016 case "\$1" in
3017 -env)
3018   shift
3019   env=\$1
3020   shift
3021   ;;
3022 esac
3023 case "\$cwd" in
3024 '') cwd=$targetdir ;;
3025 esac
3026 exe=\$1
3027 shift
3028 $to \$exe
3029 $targetrun -p $targetport -l $targetuser $targethost "cd \$cwd && \$env \$exe \$@"
3030 EOF
3031             ;;
3032         adb)
3033             $touch $run
3034             ;;
3035         *)  echo "Unknown targetrun '$targetrun'" >&4
3036             exit 1
3037             ;;
3038         esac
3039         case "$targetmkdir" in
3040         */Cross/mkdir)
3041             cat >$targetmkdir <<EOF
3042 #!/bin/sh
3043 $targetrun -p $targetport -l $targetuser $targethost "mkdir -p \$@"
3044 EOF
3045             $chmod a+rx $targetmkdir
3046             ;;
3047         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
3048             exit 1
3049             ;;
3050         esac
3051         case "$targetto" in
3052         scp|rcp)
3053             cat >$to <<EOF
3054 #!/bin/sh
3055 for f in \$@
3056 do
3057   case "\$f" in
3058   /*)
3059     $targetmkdir \`dirname \$f\`
3060     $targetto -P $targetport -r $q \$f $targetuser@$targethost:\$f           2>/dev/null  || exit 1
3061     ;;
3062   *)
3063     $targetmkdir $targetdir/\`dirname \$f\`
3064     $targetto -P $targetport -r $q \$f $targetuser@$targethost:$targetdir/\$f 2>/dev/null || exit 1
3065     ;;
3066   esac
3067 done
3068 exit 0
3069 EOF
3070             ;;
3071         cp) cat >$to <<EOF
3072 #!/bin/sh
3073 for f in \$@
3074 do
3075   case "\$f" in
3076   /*)
3077     $mkdir -p $targetdir/\`dirname \$f\`
3078     $cp \$f $targetdir/\$f || exit 1
3079     ;;
3080   *)
3081     $targetmkdir $targetdir/\`dirname \$f\`
3082     $cp \$f $targetdir/\$f || exit 1
3083     ;;
3084   esac
3085 done
3086 exit 0
3087 EOF
3088             ;;
3089         *)  echo "Unknown targetto '$targetto'" >&4
3090             exit 1
3091             ;;
3092         esac
3093         case "$targetfrom" in
3094         scp|rcp)
3095           cat >$from <<EOF
3096 #!/bin/sh
3097 for f in \$@
3098 do
3099   $rm -f \$f
3100   $targetfrom -P $targetport $q $targetuser@$targethost:$targetdir/\$f . || exit 1
3101 done
3102 exit 0
3103 EOF
3104             ;;
3105         cp) cat >$from <<EOF
3106 #!/bin/sh
3107 for f in \$@
3108 do
3109   $rm -f \$f
3110   cp $targetdir/\$f . || exit 1
3111 done
3112 exit 0
3113 EOF
3114             ;;
3115         *)  echo "Unknown targetfrom '$targetfrom'" >&4
3116             exit 1
3117             ;;
3118         esac
3119         if $test ! -f $run; then
3120             echo "Target 'run' script '$run' not found." >&4
3121         else
3122             $chmod a+rx $run
3123         fi
3124         if $test ! -f $to; then
3125             echo "Target 'to' script '$to' not found." >&4
3126         else
3127             $chmod a+rx $to
3128         fi
3129         if $test ! -f $from; then
3130             echo "Target 'from' script '$from' not found." >&4
3131         else
3132             $chmod a+rx $from
3133         fi
3134         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3135             exit 1
3136         fi
3137         cat >&4 <<EOF
3138 Using '$run' for remote execution,
3139 and '$from' and '$to'
3140 for remote file transfer.
3141 EOF
3142         ;;
3143 *)      run=''
3144         to=:
3145         from=:
3146         usecrosscompile="$undef"
3147         targetarch=''
3148         ;;
3149 esac
3150
3151 : see whether [:lower:] and [:upper:] are supported character classes
3152 echo " "
3153 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3154 ABYZ)
3155         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3156         up='[:upper:]'
3157         low='[:lower:]'
3158         ;;
3159 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3160         # (0xd9 and 0xe2), therefore that is a nice testing point.
3161         if test "X$up" = X -o "X$low" = X; then
3162             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3163             rs) up='[A-Z]'
3164                 low='[a-z]'
3165                 ;;
3166             esac
3167         fi
3168         if test "X$up" = X -o "X$low" = X; then
3169             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3170             rs) up='A-Z'
3171                 low='a-z'
3172                 ;;
3173             esac
3174         fi
3175         if test "X$up" = X -o "X$low" = X; then
3176             case "`echo RS | od -x 2>/dev/null`" in
3177             *D9E2*|*d9e2*)
3178                 echo "Hey, this might be EBCDIC." >&4
3179                 if test "X$up" = X -o "X$low" = X; then
3180                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3181                     rs) up='[A-IJ-RS-Z]'
3182                         low='[a-ij-rs-z]'
3183                         ;;
3184                     esac
3185                 fi
3186                 if test "X$up" = X -o "X$low" = X; then
3187                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3188                     rs) up='A-IJ-RS-Z'
3189                         low='a-ij-rs-z'
3190                         ;;
3191                     esac
3192                 fi
3193                 ;;
3194             esac
3195         fi
3196 esac
3197 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3198 rs)
3199     echo "Using $up and $low to convert case." >&4
3200     ;;
3201 *)
3202     echo "I don't know how to translate letters from upper to lower case." >&4
3203     echo "Your tr is not acting any way I know of." >&4
3204     exit 1
3205     ;;
3206 esac
3207 : set up the translation script tr, must be called with ./tr of course
3208 cat >tr <<EOSC
3209 $startsh
3210 case "\$1\$2" in
3211 '[A-Z][a-z]') exec $tr '$up' '$low';;
3212 '[a-z][A-Z]') exec $tr '$low' '$up';;
3213 esac
3214 exec $tr "\$@"
3215 EOSC
3216 chmod +x tr
3217 $eunicefix tr
3218
3219 : Try to determine whether config.sh was made on this system
3220 case "$config_sh" in
3221 '')
3222 myuname=`$uname -a 2>/dev/null`
3223 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3224 # Downcase everything to avoid ambiguity.
3225 # Remove slashes and single quotes so we can use parts of this in
3226 # directory and file names.
3227 # Remove newlines so myuname is sane to use elsewhere.
3228 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3229 # because the A-Z/a-z are not consecutive.
3230 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3231         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3232 newmyuname="$myuname"
3233 dflt=n
3234 case "$knowitall" in
3235 '')
3236         if test -f ../config.sh; then
3237                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3238                         eval "`grep myuname= ../config.sh`"
3239                 fi
3240                 if test "X$myuname" = "X$newmyuname"; then
3241                         dflt=y
3242                 fi
3243         fi
3244         ;;
3245 *) dflt=y;;
3246 esac
3247
3248 : Get old answers from old config file if Configure was run on the
3249 : same system, otherwise use the hints.
3250 hint=default
3251 cd ..
3252 if test -f config.sh; then
3253         echo " "
3254         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3255         . UU/myread
3256         case "$ans" in
3257         n*|N*) echo "OK, I'll ignore it."
3258                 mv config.sh config.sh.old
3259                 myuname="$newmyuname"
3260                 ;;
3261         *)  echo "Fetching default answers from your old config.sh file..." >&4
3262                 tmp_n="$n"
3263                 tmp_c="$c"
3264                 tmp_sh="$sh"
3265                 . ./config.sh
3266                 cp config.sh UU
3267                 n="$tmp_n"
3268                 c="$tmp_c"
3269                 : Older versions did not always set $sh.  Catch re-use of such
3270                 : an old config.sh.
3271                 case "$sh" in
3272                 '') sh="$tmp_sh" ;;
3273                 esac
3274                 hint=previous
3275                 ;;
3276         esac
3277 fi
3278 . ./UU/checkcc
3279 if test ! -f config.sh; then
3280         $cat <<EOM
3281
3282 First time through, eh?  I have some defaults handy for some systems
3283 that need some extra help getting the Configure answers right:
3284
3285 EOM
3286         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3287         dflt=''
3288         : Half the following guesses are probably wrong... If you have better
3289         : tests or hints, please send them to perlbug@perl.org
3290         : The metaconfig authors would also appreciate a copy...
3291         $test -f /irix && osname=irix
3292         $test -f /xenix && osname=sco_xenix
3293         $test -f /dynix && osname=dynix
3294         $test -f /dnix && osname=dnix
3295         $test -f /lynx.os && osname=lynxos
3296         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3297         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3298         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3299         $test -f /bin/mips && /bin/mips && osname=mips
3300         $test -d /usr/apollo/bin && osname=apollo
3301         $test -f /etc/saf/_sactab && osname=svr4
3302         $test -d /usr/include/minix && osname=minix
3303         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3304         if $test -d /MachTen -o -d /MachTen_Folder; then
3305                 osname=machten
3306                 if $test -x /sbin/version; then
3307                         osvers=`/sbin/version | $awk '{print $2}' |
3308                         $sed -e 's/[A-Za-z]$//'`
3309                 elif $test -x /usr/etc/version; then
3310                         osvers=`/usr/etc/version | $awk '{print $2}' |
3311                         $sed -e 's/[A-Za-z]$//'`
3312                 else
3313                         osvers="$2.$3"
3314                 fi
3315         fi
3316
3317         $test -f /sys/posix.dll &&
3318                 $test -f /usr/bin/what &&
3319                 set X `/usr/bin/what /sys/posix.dll` &&
3320                 $test "$3" = UWIN &&
3321                 osname=uwin &&
3322                 osvers="$5"
3323
3324         if $test -f $uname; then
3325                 set X $myuname
3326                 shift
3327
3328                 case "$5" in
3329                 fps*) osname=fps ;;
3330                 mips*)
3331                         case "$4" in
3332                         umips) osname=umips ;;
3333                         *) osname=mips ;;
3334                         esac;;
3335                 [23]100) osname=mips ;;
3336                 i386*)
3337                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3338                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3339                                 osname='sco'
3340                                 osvers=$tmp
3341                         elif $test -f /etc/kconfig; then
3342                                 osname=isc
3343                                 if test "$lns" = "$ln -s"; then
3344                                         osvers=4
3345                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3346                                         osvers=3
3347                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3348                                         osvers=2
3349                                 fi
3350                         fi
3351                         tmp=''
3352                         ;;
3353                 pc*)
3354                         if test -n "$DJGPP"; then
3355                                 osname=dos
3356                                 osvers=djgpp
3357                         fi
3358                         ;;
3359                 esac
3360
3361                 case "$1" in
3362                 aix) osname=aix
3363                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3364                         case "$tmp" in
3365                         # oslevel can fail with:
3366                         # oslevel: Unable to acquire lock.
3367                         *not\ found) osvers="$4"."$3" ;;
3368                         '<3240'|'<>3240') osvers=3.2.0 ;;
3369                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3370                         '=3250'|'>3250') osvers=3.2.5 ;;
3371                         *) osvers=$tmp;;
3372                         esac
3373                         ;;
3374                 bitrig) osname=bitrig
3375                         osvers="$3"
3376                         ;;
3377                 bsd386) osname=bsd386
3378                         osvers=`$uname -r`
3379                         ;;
3380                 cygwin*) osname=cygwin
3381                         osvers="$3"
3382                         ;;
3383                 *dc.osx) osname=dcosx
3384                         osvers="$3"
3385                         ;;
3386                 dnix) osname=dnix
3387                         osvers="$3"
3388                         ;;
3389                 domainos) osname=apollo
3390                         osvers="$3"
3391                         ;;
3392                 dgux)   osname=dgux
3393                         osvers="$3"
3394                         ;;
3395                 dragonfly) osname=dragonfly
3396                         osvers="$3"
3397                         ;;
3398                 dynixptx*) osname=dynixptx
3399                         osvers=`echo "$4"|sed 's/^v//'`
3400                         ;;
3401                 freebsd) osname=freebsd
3402                         osvers="$3" ;;
3403                 genix)  osname=genix ;;
3404                 gnu)    osname=gnu
3405                         osvers="$3" ;;
3406                 hp*)    osname=hpux
3407                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3408                         ;;
3409                 irix*)  osname=irix
3410                         case "$3" in
3411                         4*) osvers=4 ;;
3412                         5*) osvers=5 ;;
3413                         *)      osvers="$3" ;;
3414                         esac
3415                         ;;
3416                 linux)  osname=linux
3417                         case "$3" in
3418                         *)      osvers="$3" ;;
3419                         esac
3420                         $test -f /system/lib/libandroid.so && osname=linux-android
3421                         ;;
3422                 MiNT)   osname=mint
3423                         ;;
3424                 netbsd*) osname=netbsd
3425                         osvers="$3"
3426                         ;;
3427                 news-os) osvers="$3"
3428                         case "$3" in
3429                         4*) osname=newsos4 ;;
3430                         *) osname=newsos ;;
3431                         esac
3432                         ;;
3433                 nonstop-ux) osname=nonstopux ;;
3434                 openbsd) osname=openbsd
3435                         osvers="$3"
3436                         ;;
3437                 os2)    osname=os2
3438                         osvers="$4"
3439                         ;;
3440                 POSIX-BC | posix-bc ) osname=posix-bc
3441                         osvers="$3"
3442                         ;;
3443                 powerux | power_ux | powermax_os | powermaxos | \
3444                 powerunix | power_unix) osname=powerux
3445                         osvers="$3"
3446                         ;;
3447                 qnx) osname=qnx
3448                         osvers="$4"
3449                         ;;
3450                 solaris) osname=solaris
3451                         case "$3" in
3452                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3453                         *)      osvers="$3" ;;
3454                         esac
3455                         ;;
3456                 sunos) osname=sunos
3457                         case "$3" in
3458                         5*) osname=solaris
3459                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3460                         *)      osvers="$3" ;;
3461                         esac
3462                         ;;
3463                 titanos) osname=titanos
3464                         case "$3" in
3465                         1*) osvers=1 ;;
3466                         2*) osvers=2 ;;
3467                         3*) osvers=3 ;;
3468                         4*) osvers=4 ;;
3469                         *)      osvers="$3" ;;
3470                         esac
3471                         ;;
3472                 ultrix) osname=ultrix
3473                         osvers="$3"
3474                         ;;
3475                 osf1|mls+)      case "$5" in
3476                                 alpha)
3477                                         osname=dec_osf
3478                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3479                                         case "$osvers" in
3480                                         [1-9].[0-9]*) ;;
3481                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3482                                         esac
3483                                         ;;
3484                         hp*)    osname=hp_osf1  ;;
3485                         mips)   osname=mips_osf1 ;;
3486                         esac
3487                         ;;
3488                 # UnixWare 7.1.2 is known as Open UNIX 8
3489                 openunix|unixware) osname=svr5
3490                         osvers="$4"
3491                         ;;
3492                 uts)    osname=uts
3493                         osvers="$3"
3494                         ;;
3495                 vos) osvers="$3"
3496                         ;;
3497                 $2) case "$osname" in
3498                         *isc*) ;;
3499                         *freebsd*) ;;
3500                         svr*)
3501                                 : svr4.x or possibly later
3502                                 case "svr$3" in
3503                                 ${osname}*)
3504                                         osname=svr$3
3505                                         osvers=$4
3506                                         ;;
3507                                 esac
3508                                 case "$osname" in
3509                                 svr4.0)
3510                                         : Check for ESIX
3511                                         if test -f /stand/boot ; then
3512                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3513                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3514                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3515                                                         if test -n "$isesix"; then
3516                                                                 osname=esix4
3517                                                         fi
3518                                                 fi
3519                                         fi
3520                                         ;;
3521                                 esac
3522                                 ;;
3523                         *)      if test -f /etc/systemid; then
3524                                         osname=sco
3525                                         set `echo $3 | $sed 's/\./ /g'` $4
3526                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3527                                                 osvers=$1.$2.$3
3528                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3529                                                 osvers=$1.$2
3530                                         elif $test -f $src/hints/sco_$1.sh; then
3531                                                 osvers=$1
3532                                         fi
3533                                 else
3534                                         case "$osname" in
3535                                         '') : Still unknown.  Probably a generic Sys V.
3536                                                 osname="sysv"
3537                                                 osvers="$3"
3538                                                 ;;
3539                                         esac
3540                                 fi
3541                                 ;;
3542                         esac
3543                         ;;
3544                 *)      case "$osname" in
3545                         '') : Still unknown.  Probably a generic BSD.
3546                                 osname="$1"
3547                                 osvers="$3"
3548                                 ;;
3549                         esac
3550                         ;;
3551                 esac
3552         else
3553                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3554                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3555                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3556                                 osname=news_os
3557                         fi
3558                         $rm -f UU/kernel.what
3559                 elif test -d c:/. -o -n "$is_os2" ; then
3560                         set X $myuname
3561                         osname=os2
3562                         osvers="$5"
3563                 fi
3564         fi
3565
3566         case "$targetarch" in
3567         '') ;;
3568         *)  hostarch=$osname
3569             case "$targetarch" in
3570                 nto*|*-nto-*)
3571                     # Will load qnx.sh, which should change osname to nto
3572                     osname=qnx
3573                     osvers=''
3574                     ;;
3575                 *linux-android*)
3576                     # Catch arm-linux-androideabi, mipsel-linux-android,
3577                     # and i686-linux-android
3578                     osname=linux-android
3579                     osvers=''
3580                     ;;
3581                 *linux*)
3582                     # Something like arm-linux-gnueabihf is really just
3583                     # plain linux.
3584                     osname=linux
3585                     osvers=''
3586                     ;;
3587                 *solaris*|*sunos*)
3588                     osname=solaris
3589                     # XXX perhaps we should just assume
3590                     # osvers to be 2, or maybe take the value
3591                     # from targetarch. Using $run before the
3592                     # hints are run is somewhat icky.
3593                     set X `$run $uname -a 2>/dev/null`
3594                     shift
3595                     case "$3" in
3596                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3597                         *)  osvers="$3" ;;
3598                     esac
3599                     ;;
3600                 *)
3601                     osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3602                     osvers=''
3603                 ;;
3604             esac
3605             ;;
3606         esac
3607
3608         : Now look for a hint file osname_osvers, unless one has been
3609         : specified already.
3610         case "$hintfile" in
3611         ''|' ')
3612                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3613                 : Also try without trailing minor version numbers.
3614                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3615                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3616                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3617                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3618                 case "$file" in
3619                 '') dflt=none ;;
3620                 *)  case "$osvers" in
3621                         '') dflt=$file
3622                                 ;;
3623                         *)  if $test -f $src/hints/$file.sh ; then
3624                                         dflt=$file
3625                                 elif $test -f $src/hints/$xfile.sh ; then
3626                                         dflt=$xfile
3627                                 elif $test -f $src/hints/$xxfile.sh ; then
3628                                         dflt=$xxfile
3629                                 elif $test -f $src/hints/$xxxfile.sh ; then
3630                                         dflt=$xxxfile
3631                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3632                                         dflt=$xxxxfile
3633                                 elif $test -f "$src/hints/${osname}.sh" ; then
3634                                         dflt="${osname}"
3635                                 else
3636                                         dflt=none
3637                                 fi
3638                                 ;;
3639                         esac
3640                         ;;
3641                 esac
3642                 if $test -f Policy.sh ; then
3643                         case "$dflt" in
3644                         *Policy*) ;;
3645                         none) dflt="Policy" ;;
3646                         *) dflt="Policy $dflt" ;;
3647                         esac
3648                 fi
3649                 ;;
3650         *)
3651                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3652                 ;;
3653         esac
3654
3655         if $test -f Policy.sh ; then
3656                 $cat <<EOM
3657
3658 There's also a Policy hint file available, which should make the
3659 site-specific (policy) questions easier to answer.
3660 EOM
3661
3662         fi
3663
3664         $cat <<EOM
3665
3666 You may give one or more space-separated answers, or "none" if appropriate.
3667 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3668 previous run of Configure, you may specify it as well as or instead of
3669 OS-specific hints.  If hints are provided for your OS, you should use them:
3670 although Perl can probably be built without hints on many platforms, using
3671 hints often improve performance and may enable features that Configure can't
3672 set up on its own. If there are no hints that match your OS, specify "none";
3673 DO NOT give a wrong version or a wrong OS.
3674
3675 EOM
3676
3677         rp="Which of these apply, if any?"
3678         . UU/myread
3679         tans=$ans
3680         for file in $tans; do
3681                 if $test X$file = XPolicy -a -f Policy.sh; then
3682                         . Policy.sh
3683                         $cat Policy.sh >> UU/config.sh
3684                 elif $test -f $src/hints/$file.sh; then
3685                         . $src/hints/$file.sh
3686                         $cat $src/hints/$file.sh >> UU/config.sh
3687                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3688                         : nothing
3689                 else
3690                         : Give one chance to correct a possible typo.
3691                         echo "$file.sh does not exist"
3692                         dflt=$file
3693                         rp="hint to use instead?"
3694                         . UU/myread
3695                         for file in $ans; do
3696                                 if $test -f "$src/hints/$file.sh"; then
3697                                         . $src/hints/$file.sh
3698                                         $cat $src/hints/$file.sh >> UU/config.sh
3699                                 elif $test X$ans = X -o X$ans = Xnone ; then
3700                                         : nothing
3701                                 else
3702                                         echo "$file.sh does not exist -- ignored."
3703                                 fi
3704                         done
3705                 fi
3706         done
3707
3708         hint=recommended
3709         : Remember our hint file for later.
3710         if $test -f "$src/hints/$file.sh" ; then
3711                 hintfile="$file"
3712         else
3713                 hintfile=''
3714         fi
3715 fi
3716 cd UU
3717 ;;
3718 *)
3719         echo " "
3720         echo "Fetching default answers from $config_sh..." >&4
3721         tmp_n="$n"
3722         tmp_c="$c"
3723         cd ..
3724         cp $config_sh config.sh 2>/dev/null
3725         chmod +w config.sh
3726         . ./config.sh
3727         cd UU
3728         cp ../config.sh .
3729         n="$tmp_n"
3730         c="$tmp_c"
3731         hint=previous
3732         ;;
3733 esac
3734 test "$override" && . ./optdef.sh
3735
3736 : Restore computed paths
3737 for file in $loclist $trylist; do
3738         eval $file="\$_$file"
3739 done
3740
3741 cat << EOM
3742
3743 Configure uses the operating system name and version to set some defaults.
3744 The default value is probably right if the name rings a bell. Otherwise,
3745 since spelling matters for me, either accept the default or answer "none"
3746 to leave it blank.
3747
3748 EOM
3749 case "$osname" in
3750         ''|' ')
3751                 case "$hintfile" in
3752                 ''|' '|none) dflt=none ;;
3753                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3754                 esac
3755                 ;;
3756         *) dflt="$osname" ;;
3757 esac
3758 rp="Operating system name?"
3759 . ./myread
3760 case "$ans" in
3761 none)  osname='' ;;
3762 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3763 esac
3764 echo " "
3765 case "$osvers" in
3766         ''|' ')
3767                 case "$hintfile" in
3768                 ''|' '|none) dflt=none ;;
3769                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3770                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3771                         case "$dflt" in
3772                         ''|' ') dflt=none ;;
3773                         esac
3774                         ;;
3775                 esac
3776                 ;;
3777         *) dflt="$osvers" ;;
3778 esac
3779 rp="Operating system version?"
3780 . ./myread
3781 case "$ans" in
3782 none)  osvers='' ;;
3783 *) osvers="$ans" ;;
3784 esac
3785
3786
3787 . ./posthint.sh
3788
3789 : who configured the system
3790 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3791 case "$cf_by" in
3792 "")
3793         cf_by=`(logname) 2>/dev/null`
3794         case "$cf_by" in
3795         "")
3796                 cf_by=`(whoami) 2>/dev/null`
3797                 case "$cf_by" in
3798                 "") cf_by=unknown ;;
3799                 esac ;;
3800         esac ;;
3801 esac
3802
3803 : decide how portable to be.  Allow command line overrides.
3804 case "$d_portable" in
3805 "$undef") ;;
3806 *)      d_portable="$define" ;;
3807 esac
3808
3809 : set up shell script to do ~ expansion
3810 cat >filexp <<EOSS
3811 $startsh
3812 : expand filename
3813 case "\$1" in
3814  \~/*|\~)
3815         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3816         ;;
3817  \~*)
3818         if $test -f /bin/csh; then
3819                 /bin/csh -f -c "glob \$1"
3820                 failed=\$?
3821                 echo ""
3822                 exit \$failed
3823         else
3824                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3825                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3826                 if $test ! -d "\$dir"; then
3827                         me=\`basename \$0\`
3828                         echo "\$me: can't locate home directory for: \$name" >&2
3829                         exit 1
3830                 fi
3831                 case "\$1" in
3832                 */*)
3833                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3834                         ;;
3835                 *)
3836                         echo \$dir
3837                         ;;
3838                 esac
3839         fi
3840         ;;
3841 *)
3842         echo \$1
3843         ;;
3844 esac
3845 EOSS
3846 chmod +x filexp
3847 $eunicefix filexp
3848
3849 : now set up to get a file name
3850 cat <<EOS >getfile
3851 $startsh
3852 EOS
3853 cat <<'EOSC' >>getfile
3854 tilde=''
3855 fullpath=''
3856 already=''
3857 skip=''
3858 none_ok=''
3859 exp_file=''
3860 nopath_ok=''
3861 orig_rp="$rp"
3862 orig_dflt="$dflt"
3863 case "$gfpth" in
3864 '') gfpth='.' ;;
3865 esac
3866
3867 case "$fn" in
3868 *\(*)
3869         : getfile will accept an answer from the comma-separated list
3870         : enclosed in parentheses even if it does not meet other criteria.
3871         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3872         fn=`echo $fn | sed 's/(.*)//'`
3873         ;;
3874 esac
3875
3876 case "$fn" in
3877 *:*)
3878         loc_file=`expr $fn : '.*:\(.*\)'`
3879         fn=`expr $fn : '\(.*\):.*'`
3880         ;;
3881 esac
3882
3883 case "$fn" in
3884 *~*) tilde=true;;
3885 esac
3886 case "$fn" in
3887 */*) fullpath=true;;
3888 esac
3889 case "$fn" in
3890 *+*) skip=true;;
3891 esac
3892 case "$fn" in
3893 *n*) none_ok=true;;
3894 esac
3895 case "$fn" in
3896 *e*) exp_file=true;;
3897 esac
3898 case "$fn" in
3899 *p*) nopath_ok=true;;
3900 esac
3901
3902 case "$fn" in
3903 *f*) type='File';;
3904 *d*) type='Directory';;
3905 *l*) type='Locate';;
3906 esac
3907
3908 what="$type"
3909 case "$what" in
3910 Locate) what='File';;
3911 esac
3912
3913 case "$exp_file" in
3914 '')
3915         case "$d_portable" in
3916         "$define") ;;
3917         *) exp_file=true;;
3918         esac
3919         ;;
3920 esac
3921
3922 cd ..
3923 while test "$type"; do
3924         redo=''
3925         rp="$orig_rp"
3926         dflt="$orig_dflt"
3927         case "$tilde" in
3928         true) rp="$rp (~name ok)";;
3929         esac
3930         . UU/myread
3931         if test -f UU/getfile.ok && \
3932                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3933         then
3934                 value="$ans"
3935                 ansexp="$ans"
3936                 break
3937         fi
3938         case "$ans" in
3939         none)
3940                 value=''
3941                 ansexp=''
3942                 case "$none_ok" in
3943                 true) type='';;
3944                 esac
3945                 ;;
3946         *)
3947                 case "$tilde" in
3948                 '') value="$ans"
3949                         ansexp="$ans";;
3950                 *)
3951                         value=`UU/filexp $ans`
3952                         case $? in
3953                         0)
3954                                 if test "$ans" != "$value"; then
3955                                         echo "(That expands to $value on this system.)"
3956                                 fi
3957                                 ;;
3958                         *) value="$ans";;
3959                         esac
3960                         ansexp="$value"
3961                         case "$exp_file" in
3962                         '') value="$ans";;
3963                         esac
3964                         ;;
3965                 esac
3966                 case "$fullpath" in
3967                 true)
3968                         case "$ansexp" in
3969                         /*) value="$ansexp" ;;
3970                         [a-zA-Z]:/*) value="$ansexp" ;;
3971                         *)
3972                                 redo=true
3973                                 case "$already" in
3974                                 true)
3975                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3976                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3977                                         ;;
3978                                 *)
3979                                 echo "Please give a full path name, starting with slash." >&4
3980                                         case "$tilde" in
3981                                         true)
3982                                 echo "Note that using ~name is ok provided it expands well." >&4
3983                                                 already=true
3984                                                 ;;
3985                                         esac
3986                                 esac
3987                                 ;;
3988                         esac
3989                         ;;
3990                 esac
3991                 case "$redo" in
3992                 '')
3993                         case "$type" in
3994                         File)
3995                                 for fp in $gfpth; do
3996                                         if test "X$fp" = X.; then
3997                                             pf="$ansexp"
3998                                         else    
3999                                             pf="$fp/$ansexp"
4000                                         fi
4001                                         if test -f "$pf"; then
4002                                                 type=''
4003                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4004                                         then
4005                                                 echo "($value is not a plain file, but that's ok.)"
4006                                                 type=''
4007                                         fi
4008                                         if test X"$type" = X; then
4009                                             value="$pf"
4010                                             break
4011                                         fi
4012                                 done
4013                                 ;;
4014                         Directory)
4015                                 for fp in $gfpth; do
4016                                         if test "X$fp" = X.; then
4017                                             dir="$ans"
4018                                             direxp="$ansexp"
4019                                         else    
4020                                             dir="$fp/$ansexp"
4021                                             direxp="$fp/$ansexp"
4022                                         fi
4023                                         if test -d "$direxp"; then
4024                                                 type=''
4025                                                 value="$dir"
4026                                                 break
4027                                         fi
4028                                 done
4029                                 ;;
4030                         Locate)
4031                                 if test -d "$ansexp"; then
4032                                         echo "(Looking for $loc_file in directory $value.)"
4033                                         value="$value/$loc_file"
4034                                         ansexp="$ansexp/$loc_file"
4035                                 fi
4036                                 if test -f "$ansexp"; then
4037                                         type=''
4038                                 fi
4039                                 case "$nopath_ok" in
4040                                 true)   case "$value" in
4041                                         */*) ;;
4042                                         *)      echo "Assuming $value will be in people's path."
4043                                                 type=''
4044                                                 ;;
4045                                         esac
4046                                         ;;
4047                                 esac
4048                                 ;;
4049                         esac
4050
4051                         case "$skip" in
4052                         true) type='';
4053                         esac
4054
4055                         case "$type" in
4056                         '') ;;
4057                         *)
4058                                 if test "$fastread" = yes; then
4059                                         dflt=y
4060                                 else
4061                                         dflt=n
4062                                 fi
4063                                 rp="$what $value doesn't exist.  Use that name anyway?"
4064                                 . UU/myread
4065                                 dflt=''
4066                                 case "$ans" in
4067                                 y*) type='';;
4068                                 *) echo " ";;
4069                                 esac
4070                                 ;;
4071                         esac
4072                         ;;
4073                 esac
4074                 ;;
4075         esac
4076 done
4077 cd UU
4078 ans="$value"
4079 rp="$orig_rp"
4080 dflt="$orig_dflt"
4081 rm -f getfile.ok
4082 test "X$gfpthkeep" != Xy && gfpth=""
4083 EOSC
4084
4085 : determine root of directory hierarchy where package will be installed.
4086 case "$prefix" in
4087 '')
4088         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
4089         ;;
4090 *?/)
4091         dflt=`echo "$prefix" | sed 's/.$//'`
4092         ;;
4093 *)
4094         dflt="$prefix"
4095         ;;
4096 esac
4097 $cat <<EOM
4098
4099 By default, $package will be installed in $dflt/bin, manual pages
4100 under $dflt/man, etc..., i.e. with $dflt as prefix for all
4101 installation directories. Typically this is something like /usr/local.
4102 If you wish to have binaries under /usr/bin but other parts of the
4103 installation under /usr/local, that's ok: you will be prompted
4104 separately for each of the installation directories, the prefix being
4105 only used to set the defaults.
4106
4107 EOM
4108 fn=d~
4109 rp='Installation prefix to use?'
4110 . ./getfile
4111 oldprefix=''
4112 case "$prefix" in
4113 '') ;;
4114 *)
4115         case "$ans" in
4116         "$prefix") ;;
4117         *) oldprefix="$prefix";;
4118         esac
4119         ;;
4120 esac
4121 prefix="$ans"
4122 prefixexp="$ansexp"
4123
4124 : allow them to override the AFS root
4125 case "$afsroot" in
4126 '')     afsroot=/afs ;;
4127 *)      afsroot=$afsroot ;;
4128 esac
4129
4130 : is AFS running?
4131 echo " "
4132 case "$afs" in
4133 $define|true)   afs=true ;;
4134 $undef|false)   afs=false ;;
4135 *)      if $test -d $afsroot; then
4136                 afs=true
4137         else
4138                 afs=false
4139         fi
4140         ;;
4141 esac
4142 if $afs; then
4143         echo "AFS may be running... I'll be extra cautious then..." >&4
4144 else
4145         echo "AFS does not seem to be running..." >&4
4146 fi
4147
4148 : determine installation prefix for where package is to be installed.
4149 if $afs; then
4150 $cat <<EOM
4151
4152 Since you are running AFS, I need to distinguish the directory in which
4153 files will reside from the directory in which they are installed (and from
4154 which they are presumably copied to the former directory by occult means).
4155
4156 EOM
4157         case "$installprefix" in
4158         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4159         *) dflt="$installprefix";;
4160         esac
4161 else
4162 $cat <<EOM
4163
4164 In some special cases, particularly when building $package for distribution,
4165 it is convenient to distinguish the directory in which files should be
4166 installed from the directory ($prefix) in which they will
4167 eventually reside.  For most users, these two directories are the same.
4168
4169 EOM
4170         case "$installprefix" in
4171         '') dflt=$prefix ;;
4172         *) dflt=$installprefix;;
4173         esac
4174 fi
4175 fn=d~
4176 rp='What installation prefix should I use for installing files?'
4177 . ./getfile
4178 installprefix="$ans"
4179 installprefixexp="$ansexp"
4180
4181 : Perform the prefixexp/installprefixexp correction if necessary
4182 cat <<EOS >installprefix
4183 $startsh
4184 EOS
4185 cat <<'EOSC' >>installprefix
4186 : Change installation prefix, if necessary.
4187 if $test X"$prefix" != X"$installprefix"; then
4188     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4189 else
4190     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4191 fi
4192 EOSC
4193 chmod +x installprefix
4194 $eunicefix installprefix
4195
4196 : Set variables such as privlib and privlibexp from the output of ./getfile
4197 : performing the prefixexp/installprefixexp correction if necessary.
4198 cat <<EOS >setprefixvar
4199 $startsh
4200 EOS
4201 cat <<'EOSC' >>setprefixvar
4202 eval "${prefixvar}=\"\$ans\""
4203 eval "${prefixvar}exp=\"\$ansexp\""
4204 . ./installprefix
4205 EOSC
4206 chmod +x setprefixvar
4207 $eunicefix setprefixvar
4208
4209 : set up the script used to warn in case of inconsistency
4210 cat <<EOS >whoa
4211 $startsh
4212 EOS
4213 cat <<'EOSC' >>whoa
4214 dflt=y
4215 case "$hint" in
4216     recommended)
4217         case "$hintfile" in
4218         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4219                 ;;
4220         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4221                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4222                 ;;
4223         esac
4224         ;;
4225     *)  echo " "
4226         echo "*** WHOA THERE!!! ***" >&4
4227         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4228         ;;
4229 esac
4230 rp="    Keep the $hint value?"
4231 . ./myread
4232 case "$ans" in
4233 y) td=$was; tu=$was;;
4234 esac
4235 EOSC
4236
4237 : function used to set '$1' to '$val'
4238 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4239 case "$val$was" in
4240 $define$undef) . ./whoa; eval "$var=\$td";;
4241 $undef$define) . ./whoa; eval "$var=\$tu";;
4242 *) eval "$var=$val";;
4243 esac'
4244
4245 : get the patchlevel
4246 echo " "
4247 echo "Getting the current patchlevel..." >&4
4248 if $test -r $rsrc/patchlevel.h;then
4249         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4250         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4251         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4252         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4253         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4254         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4255         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4256 else
4257         revision=0
4258         patchlevel=0
4259         subversion=0
4260         api_revision=0
4261         api_version=0
4262         api_subversion=0
4263         perl_patchlevel=0
4264         $echo "(You do not have patchlevel.h.  Eek.)"
4265 fi
4266 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4267 version_patchlevel_string="version $patchlevel subversion $subversion"
4268 case "$perl_patchlevel" in
4269 0|'') ;;
4270 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4271     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4272     ;;
4273 esac
4274
4275 $echo "(You have $package $version_patchlevel_string.)"
4276
4277 case "$osname" in
4278 dos|vms)
4279         : XXX Should be a Configure test for double-dots in filenames.
4280         version=`echo $revision $patchlevel $subversion | \
4281                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4282         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4283                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4284         ;;
4285 *)
4286         version=`echo $revision $patchlevel $subversion | \
4287                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4288         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4289                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4290         ;;
4291 esac
4292 : Special case the 5.005_xx maintenance series, which used 5.005
4293 : without any subversion label as a subdirectory in $sitelib
4294 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4295         api_versionstring='5.005'
4296 fi
4297
4298 : Do we want threads support and if so, what type
4299 case "$usethreads" in
4300 $define|true|[yY]*)     dflt='y';;
4301 *)     # Catch case where user specified ithreads or 5005threads but
4302        # forgot -Dusethreads (A.D. 4/2002)
4303        case "$useithreads$use5005threads" in
4304        *$define*)       dflt='y';;
4305        *)               dflt='n';;
4306        esac
4307        ;;
4308 esac
4309 cat <<EOM
4310
4311 Perl can be built to offer a form of threading support on some systems
4312 To do so, Configure can be run with -Dusethreads.
4313
4314 Note that Perl built with threading support runs slightly slower
4315 and uses slightly more memory than plain Perl.
4316
4317 If this doesn't make any sense to you, just accept the default '$dflt'.
4318 EOM
4319 rp='Build a threading Perl?'
4320 . ./myread
4321 case "$ans" in
4322 y|Y)    val="$define" ;;
4323 *)      val="$undef" ;;
4324 esac
4325 set usethreads
4326 eval $setvar
4327
4328 if $test $patchlevel -lt 9; then
4329     case "$usethreads" in
4330     $define)
4331         : Default to ithreads unless overridden on command line or with
4332         : old config.sh
4333         dflt='y'
4334         case "$use5005threads" in
4335                 $define|true|[yY]*)
4336                         echo "5.005 threads are no longer supported"
4337                         exit 1
4338                 ;;
4339         esac
4340         case "$useithreads" in
4341                 $undef|false|[nN]*) dflt='n';;
4342         esac
4343         rp='Use the newer interpreter-based ithreads?'
4344         . ./myread
4345         case "$ans" in
4346         y|Y)    val="$define" ;;
4347         *)      val="$undef" ;;
4348         esac
4349         set useithreads
4350         eval $setvar
4351         : Now set use5005threads to the opposite value.
4352         case "$useithreads" in
4353         $define) val="$undef" ;;
4354         *) val="$define" ;;
4355         esac
4356         set use5005threads
4357         eval $setvar
4358         ;;
4359     *)
4360         useithreads="$undef"
4361         use5005threads="$undef"
4362         ;;
4363     esac
4364
4365     case "$useithreads$use5005threads" in
4366     "$define$define")
4367         $cat >&4 <<EOM
4368
4369 You cannot have both the ithreads and the 5.005 threads enabled
4370 at the same time.  Disabling the 5.005 threads since they are
4371 much less stable than the ithreads.
4372
4373 EOM
4374         use5005threads="$undef"
4375         ;;
4376     esac
4377
4378 else
4379 : perl-5.9.x and later
4380
4381     if test X"$usethreads" = "X$define"; then
4382         case "$use5005threads" in
4383             $define|true|[yY]*)
4384                 $cat >&4 <<EOM
4385
4386 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4387
4388 EOM
4389             ;;
4390         esac
4391     fi
4392
4393     use5005threads="$undef"
4394     useithreads="$usethreads"
4395 fi
4396
4397 case "$d_oldpthreads" in
4398 '')     : Configure tests would be welcome here.  For now, assume undef.
4399         val="$undef" ;;
4400 *)      val="$d_oldpthreads" ;;
4401 esac
4402 set d_oldpthreads
4403 eval $setvar
4404
4405
4406 : Look for a hint-file generated 'call-back-unit'.  If the
4407 : user has specified that a threading perl is to be built,
4408 : we may need to set or change some other defaults.
4409 if $test -f usethreads.cbu; then
4410     echo "Your platform has some specific hints regarding threaded builds, using them..."
4411     . ./usethreads.cbu
4412 else
4413     case "$usethreads" in
4414         "$define"|true|[yY]*)
4415                 $cat <<EOM
4416 (Your platform does not have any specific hints for threaded builds.
4417  Assuming POSIX threads, then.)
4418 EOM
4419         ;;
4420     esac
4421 fi
4422
4423 : Check if multiplicity is required
4424 cat <<EOM
4425
4426 Perl can be built so that multiple Perl interpreters can coexist
4427 within the same Perl executable.
4428 EOM
4429
4430 case "$useithreads" in
4431 $define)
4432         cat <<EOM
4433 This multiple interpreter support is required for interpreter-based threads.
4434 EOM
4435         val="$define"
4436         ;;
4437 *)      case "$usemultiplicity" in
4438         $define|true|[yY]*)     dflt='y';;
4439         *) dflt='n';;
4440         esac
4441         echo " "
4442         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4443         rp='Build Perl for multiplicity?'
4444         . ./myread
4445         case "$ans" in
4446         y|Y)    val="$define" ;;
4447         *)      val="$undef" ;;
4448         esac
4449         ;;
4450 esac
4451 set usemultiplicity
4452 eval $setvar
4453
4454 : Check if usequadmath is requested
4455 case "$usequadmath" in
4456 "$define"|true|[yY]*)
4457         usequadmath="$define"
4458         ;;
4459 *)      usequadmath="$undef" ;;
4460 esac
4461
4462 : Check if morebits is requested
4463 case "$usemorebits" in
4464 "$define"|true|[yY]*)
4465         use64bitint="$define"
4466         uselongdouble="$define"
4467         usemorebits="$define"
4468         ;;
4469 *)      usemorebits="$undef"
4470         ;;
4471 esac
4472
4473 : Determine the C compiler to be used
4474 echo " "
4475 case "$cc" in
4476 '') dflt=cc;;
4477 *) dflt="$cc";;
4478 esac
4479 rp="Use which C compiler?"
4480 . ./myread
4481 cc="$ans"
4482
4483 : See whether they have no cc but they do have gcc
4484 . ./trygcc
4485 if $test -f cc.cbu; then
4486     . ./cc.cbu
4487 fi
4488 . ./checkcc
4489
4490 : make some quick guesses about what we are up against
4491 echo " "
4492 $echo $n "Hmm...  $c"
4493 echo exit 1 >bsd
4494 echo exit 1 >usg
4495 echo exit 1 >v7
4496 echo exit 1 >osf1
4497 echo exit 1 >eunice
4498 echo exit 1 >xenix
4499 echo exit 1 >venix
4500 echo exit 1 >os2
4501 d_bsd="$undef"
4502 $cat $sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h >foo 2>/dev/null
4503 if test -f /osf_boot || $contains 'OSF/1' $sysroot/usr/include/ctype.h >/dev/null 2>&1
4504 then
4505         echo "Looks kind of like an OSF/1 system, but we'll see..."
4506         echo exit 0 >osf1
4507 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4508         xxx=`./loc addbib blurfl $pth`
4509         if $test -f $xxx; then
4510         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4511                 echo exit 0 >bsd
4512                 echo exit 0 >usg
4513         else
4514                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4515                         echo "Looks kind of like an extended USG system, but we'll see..."
4516                 else
4517                         echo "Looks kind of like a USG system, but we'll see..."
4518                 fi
4519                 echo exit 0 >usg
4520         fi
4521 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4522         echo "Looks kind of like a BSD system, but we'll see..."
4523         d_bsd="$define"
4524         echo exit 0 >bsd
4525 else
4526         echo "Looks kind of like a Version 7 system, but we'll see..."
4527         echo exit 0 >v7
4528 fi
4529 case "$eunicefix" in
4530 *unixtovms*)
4531         $cat <<'EOI'
4532 There is, however, a strange, musty smell in the air that reminds me of
4533 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4534 EOI
4535         echo exit 0 >eunice
4536         d_eunice="$define"
4537 : it so happens the Eunice I know will not run shell scripts in Unix format
4538         ;;
4539 *)
4540         echo " "
4541         echo "Congratulations.  You aren't running Eunice."
4542         d_eunice="$undef"
4543         ;;
4544 esac
4545 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4546 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4547 : semicolon as a patch separator
4548 case "$p_" in
4549 :) ;;
4550 *)
4551         $cat <<'EOI'
4552 I have the feeling something is not exactly right, however...don't tell me...
4553 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4554 (Or you may be running DOS with DJGPP.)
4555 EOI
4556         echo exit 0 >os2
4557         ;;
4558 esac
4559 if test -f /xenix; then
4560         echo "Actually, this looks more like a XENIX system..."
4561         echo exit 0 >xenix
4562         d_xenix="$define"
4563 else
4564         echo " "
4565         echo "It's not Xenix..."
4566         d_xenix="$undef"
4567 fi
4568 chmod +x xenix
4569 $eunicefix xenix
4570 if test -f /venix; then
4571         echo "Actually, this looks more like a VENIX system..."
4572         echo exit 0 >venix
4573 else
4574         echo " "
4575         if ./xenix; then
4576                 : null
4577         else
4578                 echo "Nor is it Venix..."
4579         fi
4580 fi
4581 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4582 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4583 $rm -f foo
4584
4585 : Check if we are using GNU gcc and what its version is
4586 echo " "
4587 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4588 $cat >try.c <<EOM
4589 #include <stdio.h>
4590 int main() {
4591 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4592 #ifdef __VERSION__
4593         printf("%s\n", __VERSION__);
4594 #else
4595         printf("%s\n", "1");
4596 #endif
4597 #endif
4598         return(0);
4599 }
4600 EOM
4601 if $cc -o try $ccflags $ldflags try.c; then
4602         gccversion=`$run ./try`
4603         case "$gccversion" in
4604         '') echo "You are not using GNU cc." ;;
4605         *)  echo "You are using GNU cc $gccversion."
4606             ccname=gcc
4607             ;;
4608         esac
4609 else
4610         echo " "
4611         echo "*** WHOA THERE!!! ***" >&4
4612         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4613         case "$knowitall" in
4614         '')
4615         echo "    You'd better start hunting for one and let me know about it." >&4
4616                 exit 1
4617                 ;;
4618         esac
4619 fi
4620 $rm -f try try.*
4621 case "$gccversion" in
4622 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4623 esac
4624 case "$gccversion" in
4625 '') gccosandvers='' ;;
4626 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4627    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4628    gccshortvers=''
4629    case "$gccosandvers" in
4630    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4631    $osname$osvers) ;; # looking good
4632    $osname*) cat <<EOM >&4
4633
4634 *** WHOA THERE!!! ***
4635
4636     Your gcc has not been compiled for the exact release of
4637     your operating system ($gccosandvers versus $osname$osvers).
4638
4639     In general it is a good idea to keep gcc synchronized with
4640     the operating system because otherwise serious problems
4641     may ensue when trying to compile software, like Perl.
4642
4643     I'm trying to be optimistic here, though, and will continue.
4644     If later during the configuration and build icky compilation
4645     problems appear (headerfile conflicts being the most common
4646     manifestation), I suggest reinstalling the gcc to match
4647     your operating system release.
4648
4649 EOM
4650       ;;
4651    *) gccosandvers='' ;; # failed to parse, better be silent
4652    esac
4653    ;;
4654 esac
4655 case "$ccname" in
4656 '') ccname="$cc" ;;
4657 esac
4658
4659 # gcc 3.* complain about adding -Idirectories that they already know about,
4660 # so we will take those off from locincpth.
4661 case "$gccversion" in
4662 3*)
4663     echo "main(){}">try.c
4664     for incdir in $locincpth; do
4665        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4666              grep '^c[cp]p*[01]: warning: changing search order '`
4667        if test "X$warn" != X; then
4668            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4669        fi
4670     done
4671     $rm -f try try.*
4672 esac
4673
4674 # gcc 4.9 by default does some optimizations that break perl.
4675 # see ticket 121505.
4676 #
4677 # The -fwrapv disables those optimizations (and probably others,) so
4678 # for gcc 4.9 (and later, since the optimizations probably won't go
4679 # away), add -fwrapv unless the user requests -fno-wrapv, which
4680 # disables -fwrapv, or if the user requests -fsanitize=undefined,
4681 # which turns the overflows -fwrapv ignores into runtime errors.
4682 case "$gccversion" in
4683 4.[3-9].*|4.[1-9][0-9]*|[5-9].*|[1-9][0-9]*)
4684     case "$ccflags" in
4685     *-fno-wrapv*|*-fsanitize=undefined*|*-fwrapv*) ;;
4686     *) ccflags="$ccflags -fwrapv" ;;
4687     esac
4688 esac
4689
4690 : What should the include directory be ?
4691 : Use sysroot if set, so findhdr looks in the right place.
4692 echo " "
4693 $echo $n "Hmm...  $c"
4694 dflt="$sysroot/usr/include"
4695 incpath=''
4696 mips_type=''
4697 if $test -f /bin/mips && /bin/mips; then
4698         echo "Looks like a MIPS system..."
4699         $cat >usr.c <<'EOCP'
4700 #ifdef SYSTYPE_BSD43
4701 /bsd43
4702 #endif
4703 EOCP
4704         if $cc $cppflags -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4705                 dflt='/bsd43/usr/include'
4706                 incpath='/bsd43'
4707                 mips_type='BSD 4.3'
4708         else
4709                 mips_type='System V'
4710         fi
4711         $rm -f usr.c usr.out
4712         echo "and you're compiling with the $mips_type compiler and libraries."
4713         xxx_prompt=y
4714         echo "exit 0" >mips
4715 else
4716         echo "Doesn't look like a MIPS system."
4717         xxx_prompt=n
4718         echo "exit 1" >mips
4719 fi
4720 chmod +x mips
4721 $eunicefix mips
4722 case "$usrinc" in
4723 '') ;;
4724 *) dflt="$usrinc";;
4725 esac
4726 case "$xxx_prompt" in
4727 y)      fn=d/
4728         echo " "
4729         rp='Where are the include files you want to use?'
4730         . ./getfile
4731         usrinc="$ans"
4732         ;;
4733 *)      usrinc="$dflt"
4734         ;;
4735 esac
4736
4737 : see how we invoke the C preprocessor
4738 echo " "
4739 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4740 cat <<'EOT' >testcpp.c
4741 #define ABC abc
4742 #define XYZ xyz
4743 ABC.XYZ
4744 EOT
4745 cd ..
4746 if test ! -f cppstdin; then
4747         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4748                 # AIX cc -E doesn't show the absolute headerfile
4749                 # locations but we'll cheat by using the -M flag.
4750                 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
4751         else
4752                 echo 'cat >.$$.c; '"$cc $cppflags"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4753         fi
4754 else
4755         echo "Keeping your $hint cppstdin wrapper."
4756 fi
4757 chmod 755 cppstdin
4758 wrapper=`pwd`/cppstdin
4759 ok='false'
4760 cd UU
4761
4762 if $test "X$cppstdin" != "X" && \
4763         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4764         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4765 then
4766         echo "You used to use $cppstdin $cppminus so we'll use that again."
4767         case "$cpprun" in
4768         '') echo "But let's see if we can live without a wrapper..." ;;
4769         *)
4770                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4771                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4772                 then
4773                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4774                         ok='true'
4775                 else
4776                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4777                 fi
4778                 ;;
4779         esac
4780 else
4781         case "$cppstdin" in
4782         '') ;;
4783         *)
4784                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4785                 ;;
4786         esac
4787 fi
4788
4789 if $ok; then
4790         : nothing
4791 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4792         $cc -E <testcpp.c >testcpp.out 2>&1; \
4793         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4794         echo "Yup, it does."
4795         x_cpp="$cc $cppflags -E"
4796         x_minus='';
4797 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4798         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4799         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4800         echo "Yup, it does."
4801         x_cpp="$cc $cppflags -E"
4802         x_minus='-';
4803 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4804         $cc -P <testcpp.c >testcpp.out 2>&1; \
4805         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4806         echo "Yipee, that works!"
4807         x_cpp="$cc $cppflags -P"
4808         x_minus='';
4809 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4810         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4811         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4812         echo "At long last!"
4813         x_cpp="$cc $cppflags -P"
4814         x_minus='-';
4815 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4816         $cpp <testcpp.c >testcpp.out 2>&1; \
4817         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4818         echo "It works!"
4819         x_cpp="$cpp $cppflags"
4820         x_minus='';
4821 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4822         $cpp - <testcpp.c >testcpp.out 2>&1; \
4823         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4824         echo "Hooray, it works!  I was beginning to wonder."
4825         x_cpp="$cpp $cppflags"
4826         x_minus='-';
4827 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4828         $wrapper <testcpp.c >testcpp.out 2>&1; \
4829         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4830         x_cpp="$wrapper"
4831         x_minus=''
4832         echo "Eureka!"
4833 else
4834         dflt=''
4835         rp="No dice.  I can't find a C preprocessor.  Name one:"
4836         . ./myread
4837         x_cpp="$ans"
4838         x_minus=''
4839         $x_cpp <testcpp.c >testcpp.out 2>&1
4840         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4841                 echo "OK, that will do." >&4
4842         else
4843 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4844                 exit 1
4845         fi
4846 fi
4847
4848 case "$ok" in
4849 false)
4850         cppstdin="$x_cpp"
4851         cppminus="$x_minus"
4852         cpprun="$x_cpp"
4853         cpplast="$x_minus"
4854         set X $x_cpp
4855         shift
4856         case "$1" in
4857         "$cpp")
4858                 echo "Perhaps can we force $cc -E using a wrapper..."
4859                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4860                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4861                 then
4862                         echo "Yup, we can."
4863                         cppstdin="$wrapper"
4864                         cppminus='';
4865                 else
4866                         echo "Nope, we'll have to live without it..."
4867                 fi
4868                 ;;
4869         esac
4870         case "$cpprun" in
4871         "$wrapper")
4872                 cpprun=''
4873                 cpplast=''
4874                 ;;
4875         esac
4876         ;;
4877 esac
4878
4879 case "$cppstdin" in
4880 "$wrapper"|'cppstdin') ;;
4881 *) $rm -f $wrapper;;
4882 esac
4883 $rm -f testcpp.c testcpp.out
4884
4885 : Adjust cppfilter for path component separator
4886 case "$osname" in
4887 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4888 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
4889 *)   cppfilter='' ;;
4890 esac
4891
4892 : Use gcc to determine libpth and incpth
4893 # If using gcc or clang, we can get better values for libpth, incpth
4894 # and usrinc directly from the compiler.
4895 # Note that ccname for clang is also gcc.
4896 case "$ccname" in
4897     gcc)
4898         $echo 'extern int foo;' > try.c
4899         set X `$cppstdin -v try.c 2>&1 | $awk '/^#include </,/^End of search /'|$cppfilter $grep '/include'`
4900         shift
4901         if $test $# -gt 0; then
4902             incpth="$incpth $*"
4903             incpth="`$echo $incpth|$sed 's/^ //'`"
4904             for i in $*; do
4905                 j="`$echo $i|$sed 's,/include$,/lib,'`"
4906                 if $test -d $j; then
4907                     libpth="$libpth $j"
4908                 fi
4909             done
4910             libpth="`$echo $libpth|$sed 's/^ //'`"
4911             for xxx in $libpth $loclibpth $plibpth $glibpth; do
4912                 if $test -d $xxx; then
4913                     case " $libpth " in
4914                     *" $xxx "*) ;;
4915                     *) libpth="$libpth $xxx";;
4916                     esac
4917                 fi
4918             done
4919         fi
4920         $rm -f try.c
4921         case "$usrinc" in
4922         '') for i in $incpth; do
4923                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
4924                     usrinc="$i"
4925                     break
4926                 fi
4927             done
4928             ;;
4929         esac
4930
4931         case "$usecrosscompile" in
4932         $define|true|[yY]*)
4933             case "$incpth" in
4934                 '') echo "Incpth not defined." >&4; croak=y ;;
4935                 *)  echo "Using incpth '$incpth'." >&4 ;;
4936             esac
4937             case "$libpth" in
4938                 '') echo "Libpth not defined." >&4; croak=y ;;
4939                 *)  echo "Using libpth '$libpth'." >&4 ;;
4940             esac
4941             case "$usrinc" in
4942                 '') echo "Usrinc not defined." >&4; croak=y ;;
4943                 *)  echo "Using usrinc $usrinc." >&4 ;;
4944             esac
4945             case "$croak" in
4946                 y)
4947                 if test "X$sysroot" = X; then
4948                     echo "Cannot continue, aborting." >&4; exit 1
4949                 else
4950                     echo "Cross-compiling using sysroot $sysroot, failing to guess inc/lib paths is not fatal" >&4
4951                 fi
4952                 ;;
4953             esac
4954             ;;
4955         esac
4956     ;;
4957 esac
4958
4959 : Default value for incpth is just usrinc
4960 case "$incpth" in
4961 '') incpth="$usrinc";;
4962 esac
4963
4964 : Set private lib path
4965 case "$plibpth" in
4966 '') if ./mips; then
4967         plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
4968     fi;;
4969 esac
4970 case "$libpth" in
4971 ' ') dlist='';;
4972 '') dlist="$loclibpth $plibpth $glibpth";;
4973 *) dlist="$libpth";;
4974 esac
4975
4976 : Now check and see which directories actually exist, avoiding duplicates
4977 for xxx in $dlist
4978 do
4979     if $test -d $xxx; then
4980                 case " $libpth " in
4981                 *" $xxx "*) ;;
4982                 *) libpth="$libpth $xxx";;
4983                 esac
4984     fi
4985 done
4986 $cat <<'EOM'
4987
4988 Some systems have incompatible or broken versions of libraries.  Among
4989 the directories listed in the question below, please remove any you
4990 know not to be holding relevant libraries, and add any that are needed.
4991 Say "none" for none.
4992
4993 EOM
4994
4995 if test "X$sysroot" != X; then
4996     $cat <<EOM
4997 You have set sysroot to $sysroot, please supply the directories excluding sysroot
4998
4999 EOM
5000 fi
5001
5002 case "$libpth" in
5003 '') dflt='none';;
5004 *)
5005         set X $libpth
5006         shift
5007         dflt=${1+"$@"}
5008         ;;
5009 esac
5010 rp="Directories to use for library searches?"
5011 . ./myread
5012 case "$ans" in
5013 none) libpth=' ';;
5014 *) libpth="$ans";;
5015 esac
5016
5017 : compute shared library extension
5018 case "$so" in
5019 '')
5020         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
5021                 dflt='sl'
5022         else
5023                 dflt='so'
5024         fi
5025         ;;
5026 *) dflt="$so";;
5027 esac
5028 $cat <<EOM
5029
5030 On some systems, shared libraries may be available.  Answer 'none' if
5031 you want to suppress searching of shared libraries for the remainder
5032 of this configuration.
5033
5034 EOM
5035 rp='What is the file extension used for shared libraries?'
5036 . ./myread
5037 so="$ans"
5038
5039 : Does target system insist that shared library basenames are unique
5040 $cat << EOM
5041
5042 Some dynamic loaders assume that the *basename* of shared library filenames
5043 are globally unique.  We'll default this to undef as we assume your system
5044 is not this weird. Set to defined if you're on one of them.
5045
5046 EOM
5047
5048 dflt='n'
5049 rp='Make shared library basenames unique?'
5050 . ./myread
5051 case "$ans" in
5052 y|Y) val="$define" ;;
5053 *)   val="$undef"  ;;
5054 esac
5055 set d_libname_unique
5056 eval $setvar
5057
5058 : Define several unixisms.
5059 : Hints files or command line option can be used to override them.
5060 : The convoluted testing is in case hints files set either the old
5061 : or the new name.
5062 case "$_exe" in
5063 '')     case "$exe_ext" in
5064         '')     ;;
5065         *)      _exe="$exe_ext" ;;
5066         esac
5067         ;;
5068 esac
5069 case "$_a" in
5070 '')     case "$lib_ext" in
5071     '') _a='.a';;
5072         *)      _a="$lib_ext" ;;
5073         esac
5074         ;;
5075 esac
5076 case "$_o" in
5077 '') case "$obj_ext" in
5078         '')     _o='.o';;
5079         *)      _o="$obj_ext";;
5080         esac
5081         ;;
5082 esac
5083 case "$p_" in
5084 '') case "$path_sep" in
5085         '')     p_=':';;
5086         *)      p_="$path_sep";;
5087         esac
5088         ;;
5089 esac
5090 exe_ext=$_exe
5091 lib_ext=$_a
5092 obj_ext=$_o
5093 path_sep=$p_
5094
5095 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
5096
5097 : Which makefile gets called first.  This is used by make depend.
5098 case "$firstmakefile" in
5099 '') firstmakefile='makefile';;
5100 esac
5101
5102 : Check is we will use socks
5103 case "$usesocks" in
5104 $define|true|[yY]*)     dflt='y';;
5105 *) dflt='n';;
5106 esac
5107 cat <<EOM
5108
5109 Perl can be built to use the SOCKS proxy protocol library.  To do so,
5110 Configure must be run with -Dusesocks.  If you use SOCKS you also need
5111 to use the PerlIO abstraction layer, this will be implicitly selected.
5112
5113 If this doesn't make any sense to you, just accept the default '$dflt'.
5114 EOM
5115 rp='Build Perl for SOCKS?'
5116 . ./myread
5117 case "$ans" in
5118 y|Y)    val="$define" ;;
5119 *)      val="$undef" ;;
5120 esac
5121 set usesocks
5122 eval $setvar
5123
5124 : Check for uselongdouble support
5125 case "$ccflags" in
5126 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
5127 esac
5128
5129 case "$uselongdouble" in
5130 $define|true|[yY]*)     dflt='y';;
5131 *) dflt='n';;
5132 esac
5133 cat <<EOM
5134
5135 Perl can be built to take advantage of long doubles which
5136 (if available) may give more accuracy and range for floating point numbers.
5137
5138 If this doesn't make any sense to you, just accept the default '$dflt'.
5139 EOM
5140 rp='Try to use long doubles if available?'
5141 . ./myread
5142 case "$ans" in
5143 y|Y)    val="$define"   ;;
5144 *)      val="$undef"    ;;
5145 esac
5146 set uselongdouble
5147 eval $setvar
5148
5149 case "$uselongdouble" in
5150 true|[yY]*) uselongdouble="$define" ;;
5151 esac
5152
5153 : Look for a hint-file generated 'call-back-unit'.  If the
5154 : user has specified that long doubles should be used,
5155 : we may need to set or change some other defaults.
5156 if $test -f uselongdouble.cbu; then
5157     echo "Your platform has some specific hints regarding long doubles, using them..."
5158     . ./uselongdouble.cbu
5159 else
5160     case "$uselongdouble" in
5161         $define)
5162                 $cat <<EOM
5163 (Your platform does not have any specific hints for long doubles.)
5164 EOM
5165         ;;
5166     esac
5167 fi
5168
5169 : Looking for optional libraries
5170 echo " "
5171 echo "Checking for optional libraries..." >&4
5172 case "$libs" in
5173 ' '|'') dflt='';;
5174 *) dflt="$libs";;
5175 esac
5176 case "$libswanted" in
5177 '') libswanted='c_s';;
5178 esac
5179 case "$usesocks" in
5180 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
5181 esac
5182 case "$usecbacktrace" in
5183 "$define") libswanted="$libswanted bfd" ;;
5184 esac
5185 case "$usequadmath" in
5186 "$define") libswanted="$libswanted quadmath" ;;
5187 esac
5188 libsfound=''
5189 libsfiles=''
5190 libsdirs=''
5191 libspath=''
5192 for thisdir in $libpth $xlibpth; do
5193   test -d $thisdir && libspath="$libspath $thisdir"
5194 done
5195 for thislib in $libswanted; do
5196         for thisdir in $libspath; do
5197             xxx=''
5198             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
5199                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
5200                 $test -f "$xxx" && eval $libscheck
5201                 $test -f "$xxx" && libstyle=shared
5202                 xxx=`ls $thisdir/lib$thislib.[0-9].$so 2>/dev/null|sed -n '$p'`
5203                 $test -f "$xxx" && eval $libscheck
5204                 $test -f "$xxx" && libstyle=shared
5205             fi
5206             if test ! -f "$xxx"; then
5207                 xxx=$thisdir/lib$thislib.$so
5208                 $test -f "$xxx" && eval $libscheck
5209                 $test -f "$xxx" && libstyle=shared
5210             fi
5211             if test ! -f "$xxx"; then
5212                 xxx=$thisdir/lib$thislib$_a
5213                 $test -f "$xxx" && eval $libscheck
5214                 $test -f "$xxx" && libstyle=static
5215             fi
5216             if test ! -f "$xxx"; then
5217                 xxx=$thisdir/$thislib$_a
5218                 $test -f "$xxx" && eval $libscheck
5219                 $test -f "$xxx" && libstyle=static
5220             fi
5221             if test ! -f "$xxx"; then
5222                 xxx=$thisdir/lib${thislib}_s$_a
5223                 $test -f "$xxx" && eval $libscheck
5224                 $test -f "$xxx" && libstyle=static
5225                 $test -f "$xxx" && thislib=${thislib}_s
5226             fi
5227             if test ! -f "$xxx"; then
5228                 xxx=$thisdir/Slib$thislib$_a
5229                 $test -f "$xxx" && eval $libscheck
5230                 $test -f "$xxx" && libstyle=static
5231             fi
5232             if $test -f "$xxx"; then
5233                 case "$libstyle" in
5234                 shared) echo "Found -l$thislib (shared)." ;;
5235                 static) echo "Found -l$thislib." ;;
5236                 *)      echo "Found -l$thislib ($libstyle)." ;;
5237                 esac
5238                 case " $dflt " in
5239                 *"-l$thislib "*);;
5240                 *) dflt="$dflt -l$thislib"
5241                    libsfound="$libsfound $xxx"
5242                    yyy=`basename $xxx`
5243                    libsfiles="$libsfiles $yyy"
5244                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
5245                    case " $libsdirs " in
5246                    *" $yyy "*) ;;
5247                    *) libsdirs="$libsdirs $yyy" ;;
5248                    esac
5249                    ;;
5250                 esac
5251                 break
5252             fi
5253         done
5254         if $test ! -f "$xxx"; then
5255             echo "No -l$thislib."
5256         fi
5257 done
5258 set X $dflt
5259 shift
5260 dflt="$*"
5261 case "$libs" in
5262 '') dflt="$dflt";;
5263 *) dflt="$libs";;
5264 esac
5265 case "$dflt" in
5266 ' '|'') dflt='none';;
5267 esac
5268
5269 $cat <<EOM
5270
5271 In order to compile $package on your machine, a number of libraries
5272 are usually needed.  Include any other special libraries here as well.
5273 Say "none" for none.  The default list is almost always right.
5274 EOM
5275
5276 echo " "
5277 rp="What libraries to use?"
5278 . ./myread
5279 case "$ans" in
5280 none) libs=' ';;
5281 *) libs="$ans";;
5282 esac
5283
5284 : determine optimization, if desired, or use for debug flag also
5285 case "$optimize" in
5286 ' '|$undef) dflt='none';;
5287 '') dflt='-O';;
5288 *) dflt="$optimize";;
5289 esac
5290 $cat <<EOH
5291
5292 By default, $package compiles with the -O flag to use the optimizer.
5293 Alternately, you might want to use the symbolic debugger, which uses
5294 the -g flag (on traditional Unix systems).  Either flag can be
5295 specified here.  To use neither flag, specify the word "none".
5296
5297 EOH
5298 rp="What optimizer/debugger flag should be used?"
5299 . ./myread
5300 optimize="$ans"
5301 case "$optimize" in
5302 'none') optimize=" ";;
5303 esac
5304
5305 : Check what DEBUGGING is required from the command line
5306 : -DEBUGGING      or -DDEBUGGING or
5307 : -DEBUGGING=both                       = -g + -DDEBUGGING
5308 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5309 : -DEBUGGING=none or -UDEBUGGING        =
5310 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5311 case "$EBUGGING" in
5312 '')     ;;
5313 *)      DEBUGGING=$EBUGGING ;;
5314 esac
5315
5316 case "$DEBUGGING" in
5317 -g|both|$define)
5318     case "$optimize" in
5319         *-g*) ;;
5320         *)    optimize="$optimize -g" ;;
5321     esac ;;
5322 none|$undef)
5323     case "$optimize" in
5324         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5325                 shift
5326                 optimize="$*"
5327                 ;;
5328     esac ;;
5329 esac
5330
5331 dflt=''
5332 case "$DEBUGGING" in
5333 both|$define) dflt='-DDEBUGGING'
5334 esac
5335
5336 : argument order is deliberate, as the flag will start with - which set could
5337 : think is an option
5338 checkccflag='check=$1; flag=$2; callback=$3;
5339 echo " ";
5340 echo "Checking if your compiler accepts $flag" 2>&1;
5341 [ "X$sysroot" != "X" ] && echo "For sysroot = $sysroot";
5342 echo "int main(void) { return 0; }" > gcctest.c;
5343 if $cc $_sysroot -O2 $flag -o gcctest gcctest.c 2>gcctest.out && $run ./gcctest; then
5344     echo "Yes, it does." 2>&1;
5345     if $test -s gcctest.out ; then
5346         echo "But your platform does not like it:";
5347         cat gcctest.out;
5348     else
5349         case "$ccflags" in
5350         *$check*)
5351             echo "Leaving current flags $ccflags alone." 2>&1
5352             ;;
5353         *) dflt="$dflt $flag";
5354             eval $callback
5355             ;;
5356         esac
5357     fi
5358 else
5359     echo "Nope, it does not, but that is ok." 2>&1;
5360 fi
5361 '
5362
5363 : We will not override a previous value, but we might want to
5364 : augment a hint file
5365 case "$hint" in
5366 default|recommended)
5367         case "$gccversion" in
5368         1*) dflt="$dflt -fpcc-struct-return" ;;
5369         esac
5370         case "$optimize:$DEBUGGING" in
5371         *-g*:old) dflt="$dflt -DDEBUGGING";;
5372         esac
5373         case "$gccversion" in
5374         2*) if $test -d /etc/conf/kconfig.d &&
5375                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5376                 then
5377                         # Interactive Systems (ISC) POSIX mode.
5378                         dflt="$dflt -posix"
5379                 fi
5380                 ;;
5381         esac
5382         case "$gccversion" in
5383         1*) ;;
5384         2.[0-8]*) ;;
5385         ?*)     set strict-aliasing -fno-strict-aliasing
5386                 eval $checkccflag
5387                 ;;
5388         esac
5389         # For gcc, adding -pipe speeds up compilations for some, but apparently
5390         # some assemblers can't read from stdin.  (It also slows down compilations
5391         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5392         case "$gccversion" in
5393         ?*)     set pipe -pipe
5394                 eval $checkccflag
5395                 ;;
5396         esac
5397
5398         # on x86_64 (at least) we require an extra library (libssp) in the
5399         # link command line. This library is not named, so I infer that it is
5400         # an implementation detail that may change. Hence the safest approach
5401         # is to add the flag to the flags passed to the compiler at link time,
5402         # as that way the compiler can do the right implementation dependant
5403         # thing. (NWC)
5404         case "$gccversion" in
5405         ?*)     set stack-protector-strong -fstack-protector-strong
5406                 eval $checkccflag
5407                 case "$dflt" in
5408                 *-fstack-protector-strong*) ;; # It got added.
5409                 *) # Try the plain/older -fstack-protector.
5410                    set stack-protector -fstack-protector
5411                    eval $checkccflag
5412                    ;;
5413                 esac
5414                 ;;
5415         esac
5416         ;;
5417 esac
5418
5419 case "$mips_type" in
5420 *BSD*|'') inclwanted="$locincpth $usrinc";;
5421 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5422 esac
5423 for thisincl in $inclwanted; do
5424         if $test -d $thisincl; then
5425                 if $test x$thisincl != x$usrinc; then
5426                         case "$dflt" in
5427                         *" -I$thisincl "*);;
5428                         *) dflt="$dflt -I$thisincl ";;
5429                         esac
5430                 fi
5431         fi
5432 done
5433
5434 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5435         xxx=true;
5436 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5437         xxx=true;
5438 else
5439         xxx=false;
5440 fi;
5441 if $xxx; then
5442         case "$dflt" in
5443         *$2*);;
5444         *) dflt="$dflt -D$2";;
5445         esac;
5446 fi'
5447
5448 set signal.h LANGUAGE_C; eval $inctest
5449
5450 case "$usesocks" in
5451 $define)
5452         ccflags="$ccflags -DSOCKS"
5453         ;;
5454 esac
5455
5456 case "$hint" in
5457 default|recommended) dflt="$ccflags $dflt" ;;
5458 *) dflt="$ccflags";;
5459 esac
5460
5461 case "$dflt" in
5462 ''|' ') dflt=none;;
5463 esac
5464
5465 $cat <<EOH
5466
5467 Your C compiler may want other flags.  For this question you should include
5468 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5469 but you should NOT include libraries or ld flags like -lwhatever.  If you
5470 want $package to honor its debug switch, you should include -DDEBUGGING here.
5471 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5472
5473 To use no flags, specify the word "none".
5474
5475 EOH
5476 set X $dflt
5477 shift
5478 dflt=${1+"$@"}
5479 rp="Any additional cc flags?"
5480 . ./myread
5481 case "$ans" in
5482 none) ccflags='';;
5483 *) ccflags="$ans";;
5484 esac
5485
5486 : the following weeds options from ccflags that are of no interest to cpp
5487 case "$cppflags" in
5488 '') cppflags="$ccflags" ;;
5489 *)  cppflags="$cppflags $ccflags" ;;
5490 esac
5491 case "$gccversion" in
5492 1*) cppflags="$cppflags -D__GNUC__"
5493 esac
5494 case "$mips_type" in
5495 '');;
5496 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5497 esac
5498 case "$cppflags" in
5499 '');;
5500 *)
5501         echo " "
5502         echo "Let me guess what the preprocessor flags are..." >&4
5503         set X $cppflags
5504         shift
5505         cppflags=''
5506         $cat >cpp.c <<'EOM'
5507 #define BLURFL foo
5508
5509 BLURFL xx LFRULB
5510 EOM
5511         previous=''
5512         for flag in $*
5513         do
5514                 case "$flag" in
5515                 -*) ftry="$flag";;
5516                 *) ftry="$previous $flag";;
5517                 esac
5518                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5519                         >cpp1.out 2>/dev/null && \
5520                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5521                         >cpp2.out 2>/dev/null && \
5522                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5523                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5524                 then
5525                         cppflags="$cppflags $ftry"
5526                         previous=''
5527                 else
5528                         previous="$flag"
5529                 fi
5530         done
5531         set X $cppflags
5532         shift
5533         cppflags=${1+"$@"}
5534         case "$cppflags" in
5535         *-*)  echo "They appear to be: $cppflags";;
5536         esac
5537         $rm -f cpp.c cpp?.out
5538         ;;
5539 esac
5540
5541 : flags used in final linking phase
5542 case "$ldflags" in
5543 '') if ./venix; then
5544                 dflt='-i -z'
5545         else
5546                 dflt=''
5547         fi
5548         case "$ccflags" in
5549         *-posix*) dflt="$dflt -posix" ;;
5550         esac
5551         ;;
5552 *) dflt="$ldflags";;
5553 esac
5554 # See note above about -fstack-protector
5555 case "$ccflags" in
5556 *-fstack-protector-strong*)
5557         case "$dflt" in
5558         *-fstack-protector-strong*) ;; # Don't add it again
5559         *) dflt="$dflt -fstack-protector-strong" ;;
5560         esac
5561         ;;
5562 *-fstack-protector*)
5563         case "$dflt" in
5564         *-fstack-protector*) ;; # Don't add it again
5565         *) dflt="$dflt -fstack-protector" ;;
5566         esac
5567         ;;
5568 esac
5569
5570 : Try to guess additional flags to pick up local libraries.
5571 for thislibdir in $libpth; do
5572         case " $loclibpth " in
5573         *" $thislibdir "*)
5574                 case "$dflt " in
5575                 *"-L$thislibdir "*) ;;
5576                 *)  dflt="$dflt -L$thislibdir" ;;
5577                 esac
5578                 ;;
5579         esac
5580 done
5581
5582 case "$dflt" in
5583 '') dflt='none' ;;
5584 esac
5585
5586 $cat <<EOH
5587
5588 Your C linker may need flags.  For this question you should
5589 include -L/whatever and any other flags used by the C linker, but you
5590 should NOT include libraries like -lwhatever.
5591
5592 Make sure you include the appropriate -L/path flags if your C linker
5593 does not normally search all of the directories you specified above,
5594 namely
5595         $libpth
5596 To use no flags, specify the word "none".
5597
5598 EOH
5599
5600 rp="Any additional ld flags (NOT including libraries)?"
5601 . ./myread
5602 case "$ans" in
5603 none) ldflags='';;
5604 *) ldflags="$ans";;
5605 esac
5606 rmlist="$rmlist pdp11"
5607
5608 : coherency check
5609 echo " "
5610 echo "Checking your choice of C compiler and flags for coherency..." >&4
5611 $cat > try.c <<'EOF'
5612 #include <stdio.h>
5613 int main() { printf("Ok\n"); return(0); }
5614 EOF
5615 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5616 shift
5617 $cat >try.msg <<'EOM'
5618 I've tried to compile and run the following simple program:
5619
5620 EOM
5621 $cat try.c >> try.msg
5622
5623 $cat >> try.msg <<EOM
5624
5625 I used the command:
5626
5627         $*
5628         $run ./try
5629
5630 and I got the following output:
5631
5632 EOM
5633 dflt=y
5634 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5635         if $sh -c "$run ./try " >>try.msg 2>&1; then
5636                 xxx=`$run ./try`
5637                 case "$xxx" in
5638                 "Ok") dflt=n ;;
5639                 *)    echo 'The program compiled OK, but produced no output.' >> try.msg ;;
5640                 esac
5641         else
5642                 echo "The program compiled OK, but exited with status $?." >>try.msg
5643                 rp="You have a problem.  Shall I abort Configure"
5644                 dflt=y
5645         fi
5646 else
5647         echo "I can't compile the test program." >>try.msg
5648         rp="You have a BIG problem.  Shall I abort Configure"
5649         dflt=y
5650 fi
5651 case "$dflt" in
5652 y)
5653         $cat try.msg >&4
5654         case "$knowitall" in
5655         '')
5656                 echo "(The supplied flags or libraries might be incorrect.)"
5657                 ;;
5658         *) dflt=n;;
5659         esac
5660         echo " "
5661         . ./myread
5662         case "$ans" in
5663         n*|N*) ;;
5664         *)      echo "Ok.  Stopping Configure." >&4
5665                 exit 1
5666                 ;;
5667         esac
5668         ;;
5669 n) echo "OK, that should do.";;
5670 esac
5671 $rm_try gcctest gcctest.out
5672
5673 : define a shorthand compile call
5674 compile='
5675 mc_file=$1;
5676 shift;
5677 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5678 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5679 exit 1;
5680 fi;
5681 esac;
5682 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5683 : define a shorthand compile call for compilations that should be ok.
5684 compile_ok='
5685 mc_file=$1;
5686 shift;
5687 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5688
5689 : determine filename position in cpp output
5690 echo " "
5691 echo "Computing filename position in cpp output for #include directives..." >&4
5692 case "$osname" in
5693 vos) testaccess=-e ;;
5694 *)   testaccess=-r ;;
5695 esac
5696 echo '#include <stdio.h>' > foo.c
5697 $cat >fieldn <<EOF
5698 $startsh
5699 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5700 $grep '^[       ]*#.*stdio\.h' | \
5701 while read cline; do
5702         pos=1
5703         set \$cline
5704         while $test \$# -gt 0; do
5705                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5706                         echo "\$pos"
5707                         exit 0
5708                 fi
5709                 shift
5710                 pos=\`expr \$pos + 1\`
5711         done
5712 done
5713 EOF
5714 chmod +x fieldn
5715 fieldn=`./fieldn`
5716 $rm -f foo.c fieldn
5717 case $fieldn in
5718 '') pos='???';;
5719 1) pos=first;;
5720 2) pos=second;;
5721 3) pos=third;;
5722 *) pos="${fieldn}th";;
5723 esac
5724 echo "Your cpp writes the filename in the $pos field of the line."
5725
5726 : locate header file
5727 $cat >findhdr <<EOF
5728 $startsh
5729 wanted=\$1
5730 name=''
5731 for usrincdir in $incpth
5732 do
5733         if test -f \$usrincdir/\$wanted; then
5734                 echo "\$usrincdir/\$wanted"
5735                 exit 0
5736         fi
5737 done
5738 awkprg='{ print \$$fieldn }'
5739 echo "#include <\$wanted>" > foo\$\$.c
5740 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5741 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5742 while read cline; do
5743         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5744         case "\$name" in
5745         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5746         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5747         *) exit 2;;
5748         esac;
5749 done;
5750 #
5751 # status = 0: grep returned 0 lines, case statement not executed
5752 # status = 1: headerfile found
5753 # status = 2: while loop executed, no headerfile found
5754 #
5755 status=\$?
5756 $rm -f foo\$\$.c;
5757 if test \$status -eq 1; then
5758         exit 0;
5759 fi
5760 exit 1
5761 EOF
5762 chmod +x findhdr
5763
5764 : define an alternate in-header-list? function
5765 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5766 cont=true; xxf="echo \"<\$1> found.\" >&4";
5767 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5768 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5769 esac;
5770 case $# in 4) instead=instead;; *) instead="at last";; esac;
5771 while $test "$cont"; do
5772         xxx=`./findhdr $1`
5773         var=$2; eval "was=\$$2";
5774         if $test "$xxx" && $test -r "$xxx";
5775         then eval $xxf;
5776         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5777                 cont="";
5778         else eval $xxnf;
5779         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5780         set $yyy; shift; shift; yyy=$@;
5781         case $# in 0) cont="";;
5782         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5783                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5784         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5785                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5786         esac;
5787 done;
5788 while $test "$yyy";
5789 do set $yyy; var=$2; eval "was=\$$2";
5790         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5791         set $yyy; shift; shift; yyy=$@;
5792 done'
5793
5794 : see if stdlib is available
5795 set stdlib.h i_stdlib
5796 eval $inhdr
5797
5798 : check for lengths of integral types
5799 echo " "
5800 case "$intsize" in
5801 '')
5802         echo "Checking to see how big your integers are..." >&4
5803         $cat >try.c <<EOCP
5804 #include <stdio.h>
5805 #$i_stdlib I_STDLIB
5806 #ifdef I_STDLIB
5807 #include <stdlib.h>
5808 #endif
5809 int main()
5810 {
5811         printf("intsize=%d;\n", (int)sizeof(int));
5812         printf("longsize=%d;\n", (int)sizeof(long));
5813         printf("shortsize=%d;\n", (int)sizeof(short));
5814         exit(0);
5815 }
5816 EOCP
5817         set try
5818         if eval $compile_ok && $run ./try > /dev/null; then
5819                 eval `$run ./try`
5820                 echo "Your integers are $intsize bytes long."
5821                 echo "Your long integers are $longsize bytes long."
5822                 echo "Your short integers are $shortsize bytes long."
5823         else
5824                 $cat >&4 <<EOM
5825 !
5826 Help! I can't compile and run the intsize test program: please enlighten me!
5827 (This is probably a misconfiguration in your system or libraries, and
5828 you really ought to fix it.  Still, I'll try anyway.)
5829 !
5830 EOM
5831                 dflt=4
5832                 rp="What is the size of an integer (in bytes)?"
5833                 . ./myread
5834                 intsize="$ans"
5835                 dflt=$intsize
5836                 rp="What is the size of a long integer (in bytes)?"
5837                 . ./myread
5838                 longsize="$ans"
5839                 dflt=2
5840                 rp="What is the size of a short integer (in bytes)?"
5841                 . ./myread
5842                 shortsize="$ans"
5843         fi
5844         ;;
5845 esac
5846 $rm_try
5847
5848 : check for long long
5849 echo " "
5850 echo "Checking to see if you have long long..." >&4
5851 echo 'int main() { long long x = 7; return 0; }' > try.c
5852 set try
5853 if eval $compile; then
5854         val="$define"
5855         echo "You have long long."
5856 else
5857         val="$undef"
5858         echo "You do not have long long."
5859 fi
5860 $rm_try
5861 set d_longlong
5862 eval $setvar
5863
5864 : check for length of long long
5865 case "${d_longlong}${longlongsize}" in
5866 $define)
5867         echo " "
5868         echo "Checking to see how big your long longs are..." >&4
5869         $cat >try.c <<'EOCP'
5870 #include <stdio.h>
5871 int main()
5872 {
5873     printf("%d\n", (int)sizeof(long long));
5874     return(0);
5875 }
5876 EOCP
5877         set try
5878         if eval $compile_ok; then
5879                 longlongsize=`$run ./try`
5880                 echo "Your long longs are $longlongsize bytes long."
5881         else
5882                 dflt='8'
5883                 echo " "
5884                 echo "(I can't seem to compile the test program.  Guessing...)"
5885                 rp="What is the size of a long long (in bytes)?"
5886                 . ./myread
5887                 longlongsize="$ans"
5888         fi
5889         if $test "X$longsize" = "X$longlongsize"; then
5890                 echo "(That isn't any different from an ordinary long.)"
5891         fi
5892         ;;
5893 esac
5894 $rm_try
5895
5896 : see if inttypes.h is available
5897 : we want a real compile instead of Inhdr because some systems
5898 : have an inttypes.h which includes non-existent headers
5899 echo " "
5900 $cat >try.c <<EOCP
5901 #include <inttypes.h>
5902 int main() {
5903         static int32_t foo32 = 0x12345678;
5904 }
5905 EOCP
5906 set try
5907 if eval $compile; then
5908         echo "<inttypes.h> found." >&4
5909         val="$define"
5910 else
5911         echo "<inttypes.h> NOT found." >&4
5912         val="$undef"
5913 fi
5914 $rm_try
5915 set i_inttypes
5916 eval $setvar
5917
5918 : check for int64_t
5919 echo " "
5920 echo "Checking to see if you have int64_t..." >&4
5921 $cat >try.c <<EOCP
5922 #include <sys/types.h>
5923 #$i_inttypes I_INTTYPES
5924 #ifdef I_INTTYPES
5925 #include <inttypes.h>
5926 #endif
5927 int main() { int64_t x = 7; }
5928 EOCP
5929 set try
5930 if eval $compile; then
5931         val="$define"
5932         echo "You have int64_t."
5933 else
5934         val="$undef"
5935         echo "You do not have int64_t."
5936 fi
5937 $rm_try
5938 set d_int64_t
5939 eval $setvar
5940
5941 : Check if 64bit ints have a quad type
5942 echo " "
5943 echo "Checking which 64-bit integer type we could use..." >&4
5944
5945 case "$intsize" in
5946 8) val=int
5947    set quadtype
5948    eval $setvar
5949    val='"unsigned int"'
5950    set uquadtype
5951    eval $setvar
5952    quadkind=1
5953    ;;
5954 *) case "$longsize" in
5955    8) val=long
5956       set quadtype
5957       eval $setvar
5958       val='"unsigned long"'
5959       set uquadtype
5960       eval $setvar
5961       quadkind=2
5962       ;;
5963    *) case "$d_longlong:$longlongsize" in
5964       define:8)
5965         val='"long long"'
5966         set quadtype
5967         eval $setvar
5968         val='"unsigned long long"'
5969         set uquadtype
5970         eval $setvar
5971         quadkind=3
5972         ;;
5973       *) case "$d_int64_t" in
5974          define)
5975            val=int64_t
5976            set quadtype
5977            eval $setvar
5978            val=uint64_t
5979            set uquadtype
5980            eval $setvar
5981            quadkind=4
5982            ;;
5983          esac
5984          ;;
5985       esac
5986       ;;
5987    esac
5988    ;;
5989 esac
5990
5991 case "$quadtype" in
5992 '')     echo "Alas, no 64-bit integer types in sight." >&4
5993         d_quad="$undef"
5994         ;;
5995 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5996         d_quad="$define"
5997         ;;
5998 esac
5999
6000 : Do we want 64bit support
6001 case "$uselonglong" in
6002 "$define"|true|[yY]*)
6003         cat <<EOM >&4
6004
6005 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
6006 EOM
6007         use64bitint="$define"
6008         ;;
6009 esac
6010 case "$use64bits" in
6011 "$define"|true|[yY]*)
6012         cat <<EOM >&4
6013
6014 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
6015 EOM
6016         use64bitint="$define"
6017         ;;
6018 esac
6019 case "$use64bitints" in
6020 "$define"|true|[yY]*)
6021         cat <<EOM >&4
6022
6023 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
6024 EOM
6025         use64bitint="$define"
6026         ;;
6027 esac
6028 case "$use64bitsint" in
6029 "$define"|true|[yY]*)
6030         cat <<EOM >&4
6031
6032 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
6033 EOM
6034         use64bitint="$define"
6035         ;;
6036 esac
6037 case "$uselonglongs" in
6038 "$define"|true|[yY]*)
6039         cat <<EOM >&4
6040
6041 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
6042 EOM
6043         use64bitint="$define"
6044         ;;
6045 esac
6046 case "$use64bitsall" in
6047 "$define"|true|[yY]*)
6048         cat <<EOM >&4
6049
6050 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
6051 EOM
6052         use64bitall="$define"
6053         ;;
6054 esac
6055
6056 case "$ccflags" in
6057 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
6058 esac
6059 case "$use64bitall" in
6060 "$define"|true|[yY]*) use64bitint="$define" ;;
6061 esac
6062
6063 case "$longsize" in
6064 8) cat <<EOM
6065
6066 You have natively 64-bit long integers.
6067 EOM
6068    val="$define"
6069    ;;
6070 *) case "$use64bitint" in
6071    "$define"|true|[yY]*) dflt='y';;
6072    *) dflt='n';;
6073    esac
6074    case "$d_quad" in
6075    "$define") ;;
6076    *) dflt='n' ;;
6077    esac
6078    cat <<EOM
6079
6080 Perl can be built to take advantage of 64-bit integer types
6081 on some systems.  To do so, Configure can be run with -Duse64bitint.
6082 Choosing this option will most probably introduce binary incompatibilities.
6083
6084 If this doesn't make any sense to you, just accept the default '$dflt'.
6085 (The default has been chosen based on your configuration.)
6086 EOM
6087    rp='Try to use 64-bit integers, if available?'
6088    . ./myread
6089    case "$ans" in
6090    [yY]*) val="$define" ;;
6091    *)     val="$undef"  ;;
6092    esac
6093    ;;
6094 esac
6095 set use64bitint
6096 eval $setvar
6097
6098 case "$use64bitall" in
6099 "$define"|true|[yY]*) dflt='y' ;;
6100 *) case "$longsize" in
6101    8) dflt='y' ;;
6102    *) dflt='n' ;;
6103    esac
6104    ;;
6105 esac
6106 cat <<EOM
6107
6108 You may also choose to try maximal 64-bitness.  It means using as much
6109 64-bitness as possible on the platform.  This in turn means even more
6110 binary incompatibilities.  On the other hand, your platform may not
6111 have any more 64-bitness available than what you already have chosen.
6112
6113 If this doesn't make any sense to you, just accept the default '$dflt'.
6114 (The default has been chosen based on your configuration.)
6115 EOM
6116 rp='Try to use maximal 64-bit support, if available?'
6117 . ./myread
6118 case "$ans" in
6119 [yY]*) val="$define" ;;
6120 *)     val="$undef"  ;;
6121 esac
6122 set use64bitall
6123 eval $setvar
6124 case "$use64bitall" in
6125 "$define")
6126         case "$use64bitint" in
6127         "$undef")
6128                 cat <<EOM
6129
6130 Since you have chosen a maximally 64-bit build, I'm also turning on
6131 the use of 64-bit integers.
6132 EOM
6133                 use64bitint="$define" ;;
6134         esac
6135         ;;
6136 esac
6137
6138 : Look for a hint-file generated 'call-back-unit'.  If the
6139 : user has specified that a 64-bit perl is to be built,
6140 : we may need to set or change some other defaults.
6141 if $test -f use64bitint.cbu; then
6142         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
6143         . ./use64bitint.cbu
6144 fi
6145 case "$use64bitint" in
6146 "$define"|true|[yY]*)
6147         : This test was common to all the OpenBSD forks, and seems harmless for
6148         : other platforms:
6149         echo " "
6150         echo "Checking if your C library has broken 64-bit functions..." >&4
6151         cat >try.c <<EOCP
6152 #include <stdio.h>
6153 typedef $uquadtype myULL;
6154 int main (void)
6155 {
6156     struct {
6157         double d;
6158         myULL  u;
6159     } *p, test[] = {
6160         {4294967303.15, 4294967303ULL},
6161         {4294967294.2,  4294967294ULL},
6162         {4294967295.7,  4294967295ULL},
6163         {0.0, 0ULL}
6164     };
6165     for (p = test; p->u; p++) {
6166         myULL x = (myULL)p->d;
6167         if (x != p->u) {
6168             printf("buggy\n");
6169             return 0;
6170         }
6171     }
6172     printf("ok\n");
6173     return 0;
6174 }
6175 EOCP
6176         set try
6177         if eval $compile_ok; then
6178             libcquad=`$run ./try`
6179             echo "Your C library's 64-bit functions are $libcquad."
6180         else
6181             echo "(I can't seem to compile the test program.)"
6182             echo "Assuming that your C library's 64-bit functions are ok."
6183             libcquad="ok"
6184         fi
6185         $rm_try
6186
6187         case "$libcquad" in
6188             buggy*)
6189                 cat >&4 <<EOM
6190
6191 *** You have a C library with broken 64-bit functions.
6192 *** 64-bit support does not work reliably in this configuration.
6193 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6194 *** Cannot continue, aborting.
6195
6196 EOM
6197                 exit 1
6198                 ;;
6199         esac
6200         case "$longsize" in
6201         4) case "$archname64" in
6202            '') archname64=64int ;;
6203            esac
6204            ;;
6205         esac
6206         ;;
6207 esac
6208
6209 : Look for a hint-file generated 'call-back-unit'.  If the
6210 : user has specified that a maximally 64-bit perl is to be built,
6211 : we may need to set or change some other defaults.
6212 if $test -f use64bitall.cbu; then
6213         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
6214         . ./use64bitall.cbu
6215 fi
6216 case "$use64bitall" in
6217 "$define"|true|[yY]*)
6218         case "$longsize" in
6219         4) case "$archname64" in
6220            ''|64int) archname64=64all ;;
6221            esac
6222            ;;
6223         esac
6224         ;;
6225 esac
6226
6227 case "$d_quad:$use64bitint" in
6228 $undef:$define)
6229         cat >&4 <<EOF
6230
6231 *** You have chosen to use 64-bit integers,
6232 *** but none can be found.
6233 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
6234 *** Cannot continue, aborting.
6235
6236 EOF
6237         exit 1
6238         ;;
6239 esac
6240
6241 : Check if we are using the GNU C library
6242 echo " "
6243 echo "Checking for GNU C Library..." >&4
6244 cat >try.c <<'EOCP'
6245 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6246    alone are insufficient to distinguish different versions, such as
6247    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6248    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6249 */
6250 #include <stdio.h>
6251 int main(void)
6252 {
6253 #ifdef __GLIBC__
6254 #   ifdef __GLIBC_MINOR__
6255 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
6256 #           include <gnu/libc-version.h>
6257             printf("%s\n",  gnu_get_libc_version());
6258 #       else
6259             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6260 #       endif
6261 #   else
6262         printf("%d\n",  __GLIBC__);
6263 #   endif
6264     return 0;
6265 #else
6266     return 1;
6267 #endif
6268 }
6269 EOCP
6270 set try
6271 if eval $compile_ok && $run ./try > glibc.ver; then
6272         val="$define"
6273         gnulibc_version=`$cat glibc.ver`
6274         echo "You are using the GNU C Library version $gnulibc_version"
6275 else
6276         val="$undef"
6277         gnulibc_version=''
6278         echo "You are not using the GNU C Library"
6279 fi
6280 $rm_try glibc.ver
6281 set d_gnulibc
6282 eval $setvar
6283
6284 : see if nm is to be used to determine whether a symbol is defined or not
6285 case "$usenm" in
6286 '')
6287         dflt=''
6288         case "$d_gnulibc" in
6289         "$define")
6290                 echo " "
6291                 echo "nm probably won't work on the GNU C Library." >&4
6292                 dflt=n
6293                 ;;
6294         esac
6295         case "$dflt" in
6296         '')
6297                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6298                         echo " "
6299                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6300                         echo "'nm' won't be sufficient on this system." >&4
6301                         dflt=n
6302                 fi
6303                 ;;
6304         esac
6305         case "$dflt" in
6306         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6307                 if $test $dflt -gt 20; then
6308                         dflt=y
6309                 else
6310                         dflt=n
6311                 fi
6312                 ;;
6313         esac
6314         ;;
6315 *)
6316         case "$usenm" in
6317         true|$define) dflt=y;;
6318         *) dflt=n;;
6319         esac
6320         ;;
6321 esac
6322 $cat <<EOM
6323
6324 I can use $nm to extract the symbols from your C libraries. This
6325 is a time consuming task which may generate huge output on the disk (up
6326 to 3 megabytes) but that should make the symbols extraction faster. The
6327 alternative is to skip the 'nm' extraction part and to compile a small
6328 test program instead to determine whether each symbol is present. If
6329 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
6330 this may be the best solution.
6331
6332 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
6333
6334 EOM
6335 rp="Shall I use $nm to extract C symbols from the libraries?"
6336 . ./myread
6337 case "$ans" in
6338 [Nn]*) usenm=false;;
6339 *) usenm=true;;
6340 esac
6341
6342 runnm=$usenm
6343 case "$reuseval" in
6344 true) runnm=false;;
6345 esac
6346
6347 : nm options which may be necessary
6348 case "$nm_opt" in
6349 '') if $test -f /mach_boot; then
6350                 nm_opt=''       # Mach
6351         elif $test -d /usr/ccs/lib; then
6352                 nm_opt='-p'     # Solaris (and SunOS?)
6353         elif $test -f /dgux; then
6354                 nm_opt='-p'     # DG-UX
6355         elif $test -f /lib64/rld; then
6356                 nm_opt='-p'     # 64-bit Irix
6357         else
6358                 nm_opt=''
6359         fi;;
6360 esac
6361
6362 : nm options which may be necessary for shared libraries but illegal
6363 : for archive libraries.  Thank you, Linux.
6364 case "$nm_so_opt" in
6365 '')     case "$myuname" in
6366         *linux*|gnu*)
6367                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
6368                         nm_so_opt='--dynamic'
6369                 fi
6370                 ;;
6371         esac
6372         ;;
6373 esac
6374
6375 : Figure out where the libc is located
6376 case "$runnm" in
6377 true)
6378 : get list of predefined functions in a handy place
6379 echo " "
6380 case "$libc" in
6381 '') libc=unknown
6382         case "$libs" in
6383         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
6384         esac
6385         ;;
6386 esac
6387 case "$libs" in
6388 '') ;;
6389 *)  for thislib in $libs; do
6390         case "$thislib" in
6391         -lc|-lc_s)
6392                 : Handle C library specially below.
6393                 ;;
6394         -l*)
6395                 thislib=`echo $thislib | $sed -e 's/^-l//'`
6396                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
6397                         :
6398                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
6399                         :
6400                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
6401                         :
6402                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
6403                         :
6404                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
6405                         :
6406                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
6407                         :
6408                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
6409                         :
6410                 else
6411                         try=''
6412                 fi
6413                 libnames="$libnames $try"
6414                 ;;
6415         *) libnames="$libnames $thislib" ;;
6416         esac
6417         done
6418         ;;
6419 esac
6420 xxx=normal
6421 case "$libc" in
6422 unknown)
6423         set /lib/libc.$so
6424         for xxx in $libpth; do
6425                 $test -r $1 || set $xxx/libc.$so
6426                 : The messy sed command sorts on library version numbers.
6427                 $test -r $1 || \
6428                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
6429                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
6430                                 h
6431                                 s/[0-9][0-9]*/0000&/g
6432                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
6433                                 G
6434                                 s/\n/ /' | \
6435                          $sort | $sed -e 's/^.* //'`
6436                 eval set \$$#
6437         done
6438         $test -r $1 || set $sysroot/usr/ccs/lib/libc.$so
6439         $test -r $1 || set $sysroot/lib/libsys_s$_a
6440         ;;
6441 *)
6442         set blurfl
6443         ;;
6444 esac
6445 if $test -r "$1"; then
6446         echo "Your (shared) C library seems to be in $1."
6447         libc="$1"
6448 elif $test -r /lib/libc && $test -r /lib/clib; then
6449         echo "Your C library seems to be in both /lib/clib and /lib/libc."
6450         xxx=apollo
6451         libc='/lib/clib /lib/libc'
6452         if $test -r /lib/syslib; then
6453                 echo "(Your math library is in /lib/syslib.)"
6454                 libc="$libc /lib/syslib"
6455         fi
6456 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6457         echo "Your C library seems to be in $libc, as you said before."
6458 elif $test -r $incpath/usr/lib/libc$_a; then
6459         libc=$incpath/usr/lib/libc$_a;
6460         echo "Your C library seems to be in $libc.  That's fine."
6461 elif $test -r /lib/libc$_a; then
6462         libc=/lib/libc$_a;
6463         echo "Your C library seems to be in $libc.  You're normal."
6464 else
6465         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
6466                 :
6467         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
6468                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
6469         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
6470                 :
6471         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6472                 :
6473         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
6474                 :
6475         else
6476                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
6477         fi
6478         if $test -r "$tans"; then
6479                 echo "Your C library seems to be in $tans, of all places."
6480                 libc=$tans
6481         else
6482                 libc='blurfl'
6483         fi
6484 fi
6485 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
6486         dflt="$libc"
6487         cat <<EOM
6488
6489 If the guess above is wrong (which it might be if you're using a strange
6490 compiler, or your machine supports multiple models), you can override it here.
6491
6492 EOM
6493 else
6494         dflt=''
6495         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
6496         cat >&4 <<EOM
6497 I can't seem to find your C library.  I've looked in the following places:
6498
6499 EOM
6500         $sed 's/^/      /' libpath
6501         cat <<EOM
6502
6503 None of these seems to contain your C library. I need to get its name...
6504
6505 EOM
6506 fi
6507 fn=f
6508 rp='Where is your C library?'
6509 . ./getfile
6510 libc="$ans"
6511
6512 echo " "
6513 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
6514 set X `cat libnames`
6515 shift
6516 xxx=files
6517 case $# in 1) xxx=file; esac
6518 echo "Extracting names from the following $xxx for later perusal:" >&4
6519 echo " "
6520 $sed 's/^/      /' libnames >&4
6521 echo " "
6522 $echo $n "This may take a while...$c" >&4
6523
6524 for file in $*; do
6525         case $file in
6526         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
6527         *) $nm $nm_opt $file 2>/dev/null;;
6528         esac
6529 done >libc.tmp
6530
6531 $echo $n ".$c"
6532 $grep fprintf libc.tmp > libc.ptf
6533 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
6534 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
6535 xxx='[ADTSIWi]'
6536 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
6537         eval $xscan;\
6538         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6539                 eval $xrun
6540 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
6541         eval $xscan;\
6542         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6543                 eval $xrun
6544 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
6545         eval $xscan;\
6546         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6547                 eval $xrun
6548 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
6549         eval $xscan;\
6550         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6551                 eval $xrun
6552 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
6553         eval $xscan;\
6554         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6555                 eval $xrun
6556 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
6557         eval $xscan;\
6558         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6559                 eval $xrun
6560 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
6561                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
6562         eval $xscan;\
6563         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6564                 eval $xrun
6565 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
6566         eval $xscan;\
6567         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6568                 eval $xrun
6569 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
6570         eval $xscan;\
6571         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6572                 eval $xrun
6573 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
6574         eval $xscan;\
6575         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6576                 eval $xrun
6577 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
6578         eval $xscan;\
6579         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6580                 eval $xrun
6581 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
6582         eval $xscan;\
6583         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6584                 eval $xrun
6585 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
6586         eval $xscan;\
6587         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6588                 eval $xrun
6589 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
6590         eval $xscan;\
6591         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
6592                 eval $xrun
6593 else
6594         $nm -p $* 2>/dev/null >libc.tmp
6595         $grep fprintf libc.tmp > libc.ptf
6596         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
6597                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
6598         then
6599                 nm_opt='-p'
6600                 eval $xrun
6601         else
6602                 echo " "
6603                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
6604                 com=''
6605                 if $ar t $libc > libc.tmp && \
6606                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
6607                 then
6608                         for thisname in $libnames $libc; do
6609                                 $ar t $thisname >>libc.tmp
6610                         done
6611                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
6612                         echo "Ok." >&4
6613                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
6614                         for thisname in $libnames $libc; do
6615                                 $ar tv $thisname >>libc.tmp
6616                                 emximp -o tmp.imp $thisname \
6617                                     2>/dev/null && \
6618                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
6619                                     < tmp.imp >>libc.tmp
6620                                 $rm -f tmp.imp
6621                         done
6622                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
6623                         echo "Ok." >&4
6624                 else
6625                         echo "$ar didn't seem to work right." >&4
6626                         echo "Maybe this is a Cray...trying bld instead..." >&4
6627                         if  bld t $libc | \
6628                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
6629                                 $test -s libc.list
6630                         then
6631                                 for thisname in $libnames; do
6632                                         bld t $libnames | \
6633                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
6634                                         $ar t $thisname >>libc.tmp
6635                                 done
6636                                 echo "Ok." >&4
6637                         else
6638                                 echo "That didn't work either.  Giving up." >&4
6639                                 exit 1
6640                         fi
6641                 fi
6642         fi
6643 fi
6644 nm_extract="$com"
6645 case "$PASE" in
6646 define)
6647     echo " "
6648     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
6649     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
6650     ;;
6651 *)  if $test -f /lib/syscalls.exp; then
6652         echo " "
6653         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
6654         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
6655                 /lib/syscalls.exp >>libc.list
6656     fi
6657     ;;
6658 esac
6659 ;;
6660 esac
6661 $rm -f libnames libpath
6662
6663 : Check if we are using C++
6664 echo " "
6665 echo "Checking for C++..." >&4
6666 $cat >try.c <<'EOCP'
6667 #include <stdio.h>
6668 int main(void)
6669 {
6670 #ifdef __cplusplus
6671     return 0;
6672 #else
6673     return 1;
6674 #endif
6675 }
6676 EOCP
6677 set try
6678 if eval $compile_ok && $run ./try; then
6679         val="$define"
6680         echo "You are using a C++ compiler."
6681 else
6682         val="$undef"
6683         echo "You are not using a C++ compiler."
6684 fi
6685 $rm_try cplusplus$$
6686 set d_cplusplus
6687 eval $setvar
6688
6689 : is a C symbol defined?
6690 csym='tlook=$1;
6691 case "$3" in
6692 -v) tf=libc.tmp; tdc="";;
6693 -a) tf=libc.tmp; tdc="[]";;
6694 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
6695 esac;
6696 case "$d_cplusplus" in
6697     $define)    extern_C="extern \"C\"" ;;
6698     *)          extern_C="extern"       ;;
6699 esac;
6700 tx=yes;
6701 case "$reuseval-$4" in
6702 true-) ;;
6703 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
6704 esac;
6705 case "$tx" in
6706 yes)
6707         tval=false;
6708         if $test "$runnm" = true; then
6709                 if $contains $tlook $tf >/dev/null 2>&1; then
6710                         tval=true;
6711                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
6712                         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;
6713                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
6714                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
6715                         $rm_try;
6716                 fi;
6717         else
6718                 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;
6719                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
6720                 $rm_try;
6721         fi;
6722         ;;
6723 *)
6724         case "$tval" in
6725         $define) tval=true;;
6726         *) tval=false;;
6727         esac;
6728         ;;
6729 esac;
6730 eval "$2=$tval"'
6731
6732 : define an is-in-libc? function
6733 inlibc='echo " "; td=$define; tu=$undef;
6734 sym=$1; var=$2; eval "was=\$$2";
6735 tx=yes;
6736 case "$reuseval$was" in
6737 true) ;;
6738 true*) tx=no;;
6739 esac;
6740 case "$tx" in
6741 yes)
6742         set $sym tres -f;
6743         eval $csym;
6744         case "$tres" in
6745         true)
6746                 echo "$sym() found." >&4;
6747                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
6748         *)
6749                 echo "$sym() NOT found." >&4;
6750                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
6751         esac;;
6752 *)
6753         case "$was" in
6754         $define) echo "$sym() found." >&4;;
6755         *) echo "$sym() NOT found." >&4;;
6756         esac;;
6757 esac'
6758
6759 : check for length of double
6760 echo " "
6761 case "$doublesize" in
6762 '')
6763         echo "Checking to see how big your double precision numbers are..." >&4
6764         $cat >try.c <<EOCP
6765 #include <stdio.h>
6766 #$i_stdlib I_STDLIB
6767 #ifdef I_STDLIB
6768 #include <stdlib.h>
6769 #endif
6770 int main()
6771 {
6772     printf("%d\n", (int)sizeof(double));
6773     exit(0);
6774 }
6775 EOCP
6776         set try
6777         if eval $compile_ok; then
6778                 doublesize=`$run ./try`
6779                 echo "Your double is $doublesize bytes long."
6780         else
6781                 dflt='8'
6782                 echo "(I can't seem to compile the test program.  Guessing...)"
6783                 rp="What is the size of a double precision number (in bytes)?"
6784                 . ./myread
6785                 doublesize="$ans"
6786         fi
6787         ;;
6788 esac
6789 $rm_try
6790
6791 : see if this is a float.h system
6792 set float.h i_float
6793 eval $inhdr
6794
6795 echo " "
6796 $echo "Checking the kind of doubles you have..." >&4
6797 $cat <<EOP >try.c
6798 #$i_stdlib I_STDLIB
6799 #define DOUBLESIZE $doublesize
6800 #ifdef I_STDLIB
6801 #include <stdlib.h>
6802 #endif
6803 #include <stdio.h>
6804 static const double d = -0.1;
6805 int main() {
6806   unsigned const char* b = (unsigned const char*)(&d);
6807 #if DOUBLESIZE == 4
6808   if (b[0] == 0xCD && b[3] == 0xBD) {
6809     /* IEEE 754 32-bit little-endian */
6810     printf("1\n");
6811     exit(0);
6812   }
6813   if (b[0] == 0xBD && b[3] == 0xCD) {
6814     /* IEEE 754 32-bit big-endian */
6815     printf("2\n");
6816     exit(0);
6817   }
6818 #endif
6819 #if DOUBLESIZE == 8
6820   if (b[0] == 0x9A && b[7] == 0xBF) {
6821     /* IEEE 754 64-bit little-endian */
6822     printf("3\n");
6823     exit(0);
6824   }
6825   if (b[0] == 0xBF && b[7] == 0x9A) {
6826     /* IEEE 754 64-bit big-endian */
6827     printf("4\n");
6828     exit(0);
6829   }
6830   if (b[0] == 0x99 && b[3] == 0xBF && b[4] == 0x9A && b[7] == 0x99) {
6831    /* ARM mixed endian: two little-endian 32-bit floats, in big endian order:
6832     * 4 5 6 7 0 1 2 3 (MSB = 7, LSB = 0)
6833     * 99 99 b9 bf 9a 99 99 99 */
6834     printf("7\n");
6835     exit(0);
6836   }
6837   if (b[0] == 0x99 && b[3] == 0x9A && b[4] == 0xBF && b[7] == 0x99) {
6838    /* The opposite of case 7, mixed endian: two big-endian 32-bit floats,
6839     * in little endian order: 3 2 1 0 7 6 5 4 (MSB = 7, LSB = 0)
6840     * 99 99 99 9a bf b9 99 99 */
6841     printf("8\n");
6842     exit(0);
6843   }
6844 #endif
6845 #if DOUBLESIZE == 16
6846   if (b[0] == 0x9A && b[15] == 0xBF) {
6847     /* IEEE 754 128-bit little-endian */
6848     printf("5\n");
6849     exit(0);
6850   }
6851   if (b[0] == 0xBF && b[15] == 0x9A) {
6852     /* IEEE 754 128-bit big-endian */
6853     printf("6\n");
6854     exit(0);
6855   }
6856 #endif
6857   /* Rumoredly some old ARM processors have 'mixed endian' doubles,
6858    * two 32-bit little endians stored in big-endian order. */
6859   /* Then there are old mainframe/miniframe formats like VAX, IBM, and CRAY.
6860    * Whether those environments can still build Perl is debatable. */
6861   printf("-1\n"); /* unknown */
6862   exit(0);
6863 }
6864 EOP
6865 set try
6866 if eval $compile; then
6867     doublekind=`$run ./try`
6868 else
6869     doublekind=-1
6870 fi
6871 case "$doublekind" in
6872 1) echo "You have IEEE 754 32-bit little endian doubles." >&4 ;;
6873 2) echo "You have IEEE 754 32-bit big endian doubles." >&4 ;;
6874 3) echo "You have IEEE 754 64-bit little endian doubles." >&4 ;;
6875 4) echo "You have IEEE 754 64-bit big endian doubles." >&4 ;;
6876 5) echo "You have IEEE 754 128-bit little endian doubles." >&4 ;;
6877 6) echo "You have IEEE 754 128-bit big endian doubles." >&4 ;;
6878 *) echo "Cannot figure out your double.  You VAX, or something?" >&4 ;;
6879 esac
6880 $rm_try
6881
6882 : check for long doubles
6883 echo " "
6884 echo "Checking to see if you have long double..." >&4
6885 echo 'int main() { long double x = 7.0; }' > try.c
6886 set try
6887 if eval $compile; then
6888         val="$define"
6889         echo "You have long double."
6890 else
6891         val="$undef"
6892         echo "You do not have long double."
6893 fi
6894 $rm_try
6895 set d_longdbl
6896 eval $setvar
6897
6898 : see if ldexpl exists
6899 set ldexpl d_ldexpl
6900 eval $inlibc
6901
6902 : see if this is a quadmath.h system
6903 set quadmath.h i_quadmath
6904 eval $inhdr
6905
6906 : check for length of long double
6907 case "${d_longdbl}${longdblsize}" in
6908 $define)
6909         echo " "
6910         echo "Checking to see how big your long doubles are..." >&4
6911         $cat >try.c <<'EOCP'
6912 #include <stdio.h>
6913 int main()
6914 {
6915         printf("%d\n", sizeof(long double));
6916 }
6917 EOCP
6918         set try
6919         set try
6920         if eval $compile; then
6921                 longdblsize=`$run ./try`
6922                 echo "Your long doubles are $longdblsize bytes long."
6923         else
6924                 dflt='8'
6925                 echo " "
6926                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6927                 rp="What is the size of a long double (in bytes)?"
6928                 . ./myread
6929                 longdblsize="$ans"
6930         fi
6931         if $test "X$doublesize" = "X$longdblsize"; then
6932                 echo "That isn't any different from an ordinary double."
6933                 echo "I'll keep your setting anyway, but you may see some"
6934                 echo "harmless compilation warnings."
6935         fi
6936         ;;
6937 esac
6938 $rm_try
6939
6940 echo " "
6941 $echo "Checking the kind of long doubles you have..." >&4
6942 case "$d_longdbl" in
6943 define)
6944 $cat <<EOP >try.c
6945 #$i_float I_FLOAT
6946 #$i_stdlib I_STDLIB
6947 #define LONGDBLSIZE $longdblsize
6948 #define DOUBLESIZE $doublesize
6949 #ifdef I_FLOAT
6950 #include <float.h>
6951 #endif
6952 #ifdef I_STDLIB
6953 #include <stdlib.h>
6954 #endif
6955 static const long double d = -0.1L;
6956 #include <stdio.h>
6957 int main() {
6958   unsigned const char* b = (unsigned const char*)(&d);
6959 #if DOUBLESIZE == LONGDBLSIZE
6960   printf("0\n"); /* if it floats like double */
6961   exit(0);
6962 #endif
6963 #if (LDBL_MANT_DIG == 113 || FLT128_MANT_DIG == 113) && LONGDBLSIZE == 16
6964   if (b[0] == 0x9A && b[1] == 0x99 && b[15] == 0xBF) {
6965     /* IEEE 754 128-bit little-endian */
6966     printf("1\n");
6967     exit(0);
6968   }
6969   if (b[0] == 0xBF && b[14] == 0x99 && b[15] == 0x9A) {
6970     /* IEEE 128-bit big-endian, e.g. solaris sparc */
6971     printf("2\n");
6972     exit(0);
6973   }
6974 #endif
6975 /* For alignment 32-bit platforms have the 80 bits in 12 bytes,
6976  * while 64-bits platforms have it in 16 bytes. */
6977 #if LDBL_MANT_DIG == 64 && (LONGDBLSIZE == 16 || LONGDBLSIZE == 12)
6978   if (b[0] == 0xCD && b[9] == 0xBF && b[10] == 0x00) {
6979     /* x86 80-bit little-endian, sizeof 12 (ILP32, Solaris x86)
6980      * or 16 (LP64, Linux and OS X), 4 or 6 bytes of padding.
6981      * Also known as "extended precision". */
6982     printf("3\n");
6983     exit(0);
6984   }
6985   if (b[0] == 0xBF && b[9] == 0xCD && b[10] == 0x00) {
6986     /* is there ever big-endian 80-bit, really? */
6987     printf("4\n");
6988     exit(0);
6989   }
6990 #endif
6991 #if (LDBL_MANT_DIG == 106 || LDBL_MANT_DIG == 107) && LONGDBLSIZE == 16
6992   /* software "double double", the 106 is 53+53.
6993    * but irix thinks it is 107. */
6994   if (b[0] == 0x9A && b[7] == 0x3C && b[8] == 0x9A && b[15] == 0xBF) {
6995     /* double double 128-bit little-endian,
6996      * 9a 99 99 99 99 99 59 3c 9a 99 99 99 99 99 b9 bf */
6997     printf("5\n");
6998     exit(0);
6999   }
7000   if (b[0] == 0xBF && b[7] == 0x9A && b[8] == 0x3C && b[15] == 0x9A) {
7001     /* double double 128-bit big-endian, e.g. PPC/Power and MIPS:
7002      * bf b9 99 99 99 99 99 9a 3c 59 99 99 99 99 99 9a */
7003     printf("6\n");
7004     exit(0);
7005   }
7006 #endif
7007   printf("-1\n"); /* unknown */
7008   exit(0);
7009 }
7010 EOP
7011 set try
7012 if eval $compile; then
7013     longdblkind=`$run ./try`
7014 else
7015     longdblkind=-1
7016 fi
7017 ;;
7018 *) longdblkind=0 ;;
7019 esac
7020 case "$longdblkind" in
7021 0) echo "Your long doubles are doubles." >&4 ;;
7022 1) echo "You have IEEE 754 128-bit little endian long doubles." >&4 ;;
7023 2) echo "You have IEEE 754 128-bit big endian long doubles." >&4 ;;
7024 3) echo "You have x86 80-bit little endian long doubles." >& 4 ;;
7025 4) echo "You have x86 80-bit big endian long doubles." >& 4 ;;
7026 5) echo "You have 128-bit little-endian double-double long doubles." >& 4 ;;
7027 6) echo "You have 128-bit big-endian double-double long doubles." >& 4 ;;
7028 *) echo "Cannot figure out your long double." >&4 ;;
7029 esac
7030 $rm_try
7031
7032
7033 : determine the architecture name
7034 echo " "
7035 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
7036         tarch=`arch`"-$osname"
7037 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
7038         if uname -m > tmparch 2>&1 ; then
7039                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
7040                         -e 's/$/'"-$osname/" tmparch`
7041         else
7042                 tarch="$osname"
7043         fi
7044         $rm -f tmparch
7045 else
7046         tarch="$osname"
7047 fi
7048 case "$myarchname" in
7049 ''|"$tarch") ;;
7050 *)
7051         echo "(Your architecture name used to be $myarchname.)"
7052         archname=''
7053         ;;
7054 esac
7055 case "$targetarch" in
7056 '') ;;
7057 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
7058 esac
7059 myarchname="$tarch"
7060 case "$archname" in
7061 '') dflt="$tarch";;
7062 *) dflt="$archname";;
7063 esac
7064 rp='What is your architecture name'
7065 . ./myread
7066 archname="$ans"
7067
7068 : optionally add API version to the architecture for versioned archlibs
7069 case "$useversionedarchname" in
7070 $define|true|[yY]*) dflt='y';;
7071 *)                  dflt='n';;
7072 esac
7073 rp='Add the Perl API version to your archname?'
7074 . ./myread
7075 case "$ans" in
7076 y|Y)    useversionedarchname="$define" ;;
7077 *)      useversionedarchname="$undef" ;;
7078 esac
7079 case "$useversionedarchname" in
7080 $define)
7081         case "$archname" in
7082         *-$api_versionstring)
7083                 echo "...and architecture name already has -$api_versionstring" >&4
7084                 ;;
7085         *)
7086                 archname="$archname-$api_versionstring"
7087                 echo "...setting architecture name to $archname." >&4
7088                 ;;
7089         esac
7090         ;;
7091 esac
7092
7093 case "$usethreads" in
7094 $define)
7095         echo "Threads selected." >&4
7096         case "$archname" in
7097         *-thread*) echo "...and architecture name already has -thread." >&4
7098                 ;;
7099         *)      archname="$archname-thread"
7100                 echo "...setting architecture name to $archname." >&4
7101                 ;;
7102         esac
7103         ;;
7104 esac
7105 case "$usemultiplicity" in
7106 $define)
7107         echo "Multiplicity selected." >&4
7108         case "$archname" in
7109         *-multi*) echo "...and architecture name already has -multi." >&4
7110                 ;;
7111         *)      archname="$archname-multi"
7112                 echo "...setting architecture name to $archname." >&4
7113                 ;;
7114         esac
7115         ;;
7116 esac
7117 case "$use64bitint$use64bitall" in
7118 *"$define"*)
7119         case "$archname64" in
7120         '')
7121                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
7122                 ;;
7123         *)
7124                 case "$use64bitint" in
7125                 "$define") echo "64 bit integers selected." >&4 ;;
7126                 esac
7127                 case "$use64bitall" in
7128                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
7129                 esac
7130                 case "$archname" in
7131                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
7132                         ;;
7133                 *)      archname="$archname-$archname64"
7134                         echo "...setting architecture name to $archname." >&4
7135                         ;;
7136                 esac
7137                 ;;
7138         esac
7139 esac
7140 case "$uselongdouble" in
7141 $define)
7142         echo "Long doubles selected." >&4
7143         case "$longdblsize" in
7144         $doublesize)
7145                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
7146                 ;;
7147         *)
7148                 case "$archname" in
7149                 *-ld*) echo "...and architecture name already has -ld." >&4
7150                         ;;
7151                 *)      archname="$archname-ld"
7152                         echo "...setting architecture name to $archname." >&4
7153                         ;;
7154                 esac
7155                 ;;
7156         esac
7157         ;;
7158 esac
7159 case "$usequadmath" in
7160 $define)
7161         echo "quadmath selected." >&4
7162         case "$archname" in
7163         *-ld*) echo "...and architecture name already has -quadmath." >&4
7164                 ;;
7165         *)      archname="$archname-quadmath"
7166                 echo "...setting architecture name to $archname." >&4
7167                 ;;
7168         esac
7169         ;;
7170 esac
7171 if $test -f archname.cbu; then
7172         echo "Your platform has some specific hints for architecture name, using them..."
7173         . ./archname.cbu
7174 fi
7175
7176 : set the prefixit variable, to compute a suitable default value
7177 prefixit='case "$3" in
7178 ""|none)
7179         case "$oldprefix" in
7180         "") eval "$1=\"\$$2\"";;
7181         *)
7182                 case "$3" in
7183                 "") eval "$1=";;
7184                 none)
7185                         eval "tp=\"\$$2\"";
7186                         case "$tp" in
7187                         ""|" ") eval "$1=\"\$$2\"";;
7188                         *) eval "$1=";;
7189                         esac;;
7190                 esac;;
7191         esac;;
7192 *)
7193         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
7194         case "$tp" in
7195         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
7196         /*-$oldprefix/*|\~*-$oldprefix/*)
7197                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
7198         *) eval "$1=\"\$$2\"";;
7199         esac;;
7200 esac'
7201
7202 : determine installation style
7203 : For now, try to deduce it from prefix unless it is already set.
7204 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
7205 case "$installstyle" in
7206 '')     case "$prefix" in
7207                 *perl*) dflt='lib';;
7208                 *) dflt='lib/perl5' ;;
7209         esac
7210         ;;
7211 *)      dflt="$installstyle" ;;
7212 esac
7213 : Probably not worth prompting for this since we prompt for all
7214 : the directories individually, and the prompt would be too long and
7215 : confusing anyway.
7216 installstyle=$dflt
7217
7218 : determine where public executables go
7219 echo " "
7220 set dflt bin bin
7221 eval $prefixit
7222 fn=d~
7223 rp='Pathname where the public executables will reside?'
7224 . ./getfile
7225 if $test "X$ansexp" != "X$binexp"; then
7226         installbin=''
7227 fi
7228 prefixvar=bin
7229 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7230 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
7231 :     this via initialinstalllocation
7232 . ./setprefixvar
7233
7234 case "$userelocatableinc" in
7235 $define|true|[yY]*)     dflt='y' ;;
7236 *)                      dflt='n' ;;
7237 esac
7238 cat <<EOM
7239
7240 Would you like to build Perl so that the installation is relocatable, so that
7241 library paths in @INC are determined relative to the path of the perl binary?
7242 This is not advised for system Perl installs, or if you need to run setid
7243 scripts or scripts under taint mode.
7244
7245 If this doesn't make any sense to you, just accept the default '$dflt'.
7246 EOM
7247 rp='Use relocatable @INC?'
7248 . ./myread
7249 case "$ans" in
7250 y|Y)    val="$define" ;;
7251 *)      val="$undef"  ;;
7252 esac
7253 set userelocatableinc
7254 eval $setvar
7255
7256 initialinstalllocation="$binexp"
7257 : Default prefix is now "up one level from where the binaries are"
7258 case "$userelocatableinc" in
7259 $define|true|[yY]*)
7260     bin=".../"
7261     binexp=".../"
7262     prefix=".../.."
7263     prefixexp=".../.."
7264     installprefixexp=".../.."
7265     ;;
7266 esac
7267
7268 : determine where private library files go
7269 : Usual default is /usr/local/lib/perl5/$version.
7270 : Also allow things like /opt/perl/lib/$version, since
7271 : /opt/perl/lib/perl5... would be redundant.
7272 : The default "style" setting is made in installstyle.U
7273 case "$installstyle" in
7274 *lib/perl5*) set dflt privlib lib/$package/$version ;;
7275 *)       set dflt privlib lib/$version ;;
7276 esac
7277 eval $prefixit
7278 $cat <<EOM
7279
7280 There are some auxiliary files for $package that need to be put into a
7281 private library directory that is accessible by everyone.
7282
7283 EOM
7284 fn=$binexp
7285 fn=d~+
7286 rp='Pathname where the private library files will reside?'
7287 . ./getfile
7288 prefixvar=privlib
7289 . ./setprefixvar
7290
7291 : set the prefixup variable, to restore leading tilda escape
7292 prefixup='case "$prefixexp" in
7293 "$prefix") ;;
7294 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
7295 esac'
7296
7297 : determine where public architecture dependent libraries go
7298 set archlib archlib
7299 eval $prefixit
7300 : privlib default is /usr/local/lib/$package/$version
7301 : archlib default is /usr/local/lib/$package/$version/$archname
7302 : privlib may have an optional trailing /share.
7303 tdflt=`echo $privlib | $sed 's,/share$,,'`
7304 tdflt=$tdflt/$archname
7305 case "$archlib" in
7306 '')     dflt=$tdflt
7307         ;;
7308 *)      dflt="$archlib"
7309     ;;
7310 esac
7311 $cat <<EOM
7312
7313 $spackage contains architecture-dependent library files.  If you are
7314 sharing libraries in a heterogeneous environment, you might store
7315 these files in a separate location.  Otherwise, you can just include
7316 them with the rest of the public library files.
7317
7318 EOM
7319 fn=$binexp
7320 fn=d+~
7321 rp='Where do you want to put the public architecture-dependent libraries?'
7322 . ./getfile
7323 prefixvar=archlib
7324 . ./setprefixvar
7325 if $test X"$archlib" = X"$privlib"; then
7326         d_archlib="$undef"
7327 else
7328         d_archlib="$define"
7329 fi
7330
7331 : see if setuid scripts can be secure
7332 $cat <<EOM
7333
7334 Some kernels have a bug that prevents setuid #! scripts from being
7335 secure.  Some sites have disabled setuid #! scripts because of this.
7336
7337 First let's decide if your kernel supports secure setuid #! scripts.
7338 (If setuid #! scripts would be secure but have been disabled anyway,
7339 don't say that they are secure if asked.)
7340
7341 EOM
7342
7343 val="$undef"
7344 if $test -d /dev/fd; then
7345         echo "#!$ls" >reflect
7346         chmod +x,u+s reflect
7347         ./reflect >flect 2>&1
7348         if $contains "/dev/fd" flect >/dev/null; then
7349                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
7350                 val="$define"
7351         else
7352                 $cat <<EOM
7353 If you are not sure if they are secure, I can check but I'll need a
7354 username and password different from the one you are using right now.
7355 If you don't have such a username or don't want me to test, simply
7356 enter 'none'.
7357
7358 EOM
7359                 rp='Other username to test security of setuid scripts with?'
7360                 dflt='none'
7361                 . ./myread
7362                 case "$ans" in
7363                 n|none)
7364                         case "$d_suidsafe" in
7365                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
7366                                 dflt=n;;
7367                         "$undef")
7368                                 echo "Well, the $hint value is *not* secure." >&4
7369                                 dflt=n;;
7370                         *)      echo "Well, the $hint value *is* secure." >&4
7371                                 dflt=y;;
7372                         esac
7373                         ;;
7374                 *)
7375                         $rm -f reflect flect
7376                         echo "#!$ls" >reflect
7377                         chmod +x,u+s reflect
7378                         echo >flect
7379                         chmod a+w flect
7380                         echo '"su" will (probably) prompt you for '"$ans's password."
7381                         su $ans -c './reflect >flect'
7382                         if $contains "/dev/fd" flect >/dev/null; then
7383                                 echo "Okay, it looks like setuid scripts are secure." >&4
7384                                 dflt=y
7385                         else
7386                                 echo "I don't think setuid scripts are secure." >&4
7387                                 dflt=n
7388                         fi
7389                         ;;
7390                 esac
7391                 rp='Does your kernel have *secure* setuid scripts?'
7392                 . ./myread
7393                 case "$ans" in
7394                 [yY]*)  val="$define";;
7395                 *)      val="$undef";;
7396                 esac
7397         fi
7398 else
7399         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
7400         echo "(That's for file descriptors, not floppy disks.)"
7401         val="$undef"
7402 fi
7403 set d_suidsafe
7404 eval $setvar
7405
7406 $rm -f reflect flect
7407
7408 : now see if they want to do setuid emulation
7409 if $test $patchlevel -lt 11; then
7410 echo " "
7411 val="$undef"
7412 case "$d_suidsafe" in
7413 "$define")
7414         val="$undef"
7415         echo "No need to emulate SUID scripts since they are secure here." >&4
7416         ;;
7417 *)
7418         $cat <<EOM
7419 Some systems have disabled setuid scripts, especially systems where
7420 setuid scripts cannot be secure.  On systems where setuid scripts have
7421 been disabled, the setuid/setgid bits on scripts are currently
7422 useless.  It is possible for $package to detect those bits and emulate
7423 setuid/setgid in a secure fashion.  This emulation will only work if
7424 setuid scripts have been disabled in your kernel.
7425
7426 EOM
7427         case "$d_dosuid" in
7428         "$define") dflt=y ;;
7429         *) dflt=n ;;
7430         esac
7431         rp="Do you want to do setuid/setgid emulation?"
7432         . ./myread
7433         case "$ans" in
7434         [yY]*)  val="$define";;
7435         *)      val="$undef";;
7436         esac
7437         ;;
7438 esac
7439 set d_dosuid
7440 eval $setvar
7441 else
7442     case "$d_dosuid" in
7443         "$define")
7444         cat >&4 <<EOH
7445
7446 SUID emulation has been removed for 5.12
7447 Please re-run Configure without -Dd_dosuid
7448
7449 EOH
7450         exit 1;
7451         ;;
7452     esac
7453     d_dosuid=undef
7454 fi
7455
7456 : Find perl5.005 or later.
7457 echo "Looking for a previously installed perl5.005 or later... "
7458 case "$perl5" in
7459 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7460                 : Check if this perl is recent and can load a simple module
7461                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7462                         perl5=$tdir/perl
7463                         break;
7464                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7465                         perl5=$tdir/perl5
7466                         break;
7467                 fi
7468         done
7469         ;;
7470 *)      perl5="$perl5"
7471         ;;
7472 esac
7473 case "$perl5" in
7474 '')     echo "None found.  That's ok.";;
7475 *)      echo "Using $perl5." ;;
7476 esac
7477
7478 : Set the siteprefix variables
7479 $cat <<EOM
7480
7481 After $package is installed, you may wish to install various
7482 add-on modules and utilities.  Typically, these add-ons will
7483 be installed under $prefix with the rest
7484 of this package.  However, you may wish to install such add-ons
7485 elsewhere under a different prefix.
7486
7487 If you do not wish to put everything under a single prefix, that's
7488 ok.  You will be prompted for the individual locations; this siteprefix
7489 is only used to suggest the defaults.
7490
7491 The default should be fine for most people.
7492
7493 EOM
7494 fn=d~+
7495 rp='Installation prefix to use for add-on modules and utilities?'
7496 : XXX Here might be another good place for an installstyle setting.
7497 case "$siteprefix" in
7498 '') dflt=$prefix ;;
7499 *)  dflt=$siteprefix ;;
7500 esac
7501 . ./getfile
7502 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7503 oldsiteprefix=''
7504 case "$siteprefix" in
7505 '') ;;
7506 *)      case "$ans" in
7507         "$prefix") ;;
7508         *) oldsiteprefix="$prefix";;
7509         esac
7510         ;;
7511 esac
7512 siteprefix="$ans"
7513 siteprefixexp="$ansexp"
7514
7515 : determine where site specific libraries go.
7516 : Usual default is /usr/local/lib/perl5/site_perl/$version
7517 : The default "style" setting is made in installstyle.U
7518 : XXX No longer works with Prefixit stuff.
7519 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7520 case "$sitelib" in
7521 '') case "$installstyle" in
7522         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7523         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7524         esac
7525         ;;
7526 *)      dflt="$sitelib"
7527         ;;
7528 esac
7529 $cat <<EOM
7530
7531 The installation process will create a directory for
7532 site-specific extensions and modules.  Most users find it convenient
7533 to place all site-specific files in this directory rather than in the
7534 main distribution directory.
7535
7536 EOM
7537 fn=d~+
7538 rp='Pathname for the site-specific library files?'
7539 . ./getfile
7540 prefixvar=sitelib
7541 . ./setprefixvar
7542 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7543
7544 : Determine list of previous versions to include in @INC
7545 $cat > getverlist <<EOPL
7546 #!$perl5 -w
7547 use File::Basename;
7548 \$api_versionstring = "$api_versionstring";
7549 \$version = "$version";
7550 \$stem = "$sitelib_stem";
7551 \$archname = "$archname";
7552 EOPL
7553         $cat >> getverlist <<'EOPL'
7554 # The list found is store twice for each entry: the original name, and
7555 # the binary broken down version as pack "sss", so sorting is easy and
7556 # unambiguous. This will work for all versions that have a maximum of
7557 # three digit groups, separate by '.'s or '_'s. Names are extended with
7558 # ".0.0" to ensure at least three elements for the pack.
7559 #                                       -- H.Merijn Brand (m)'06 23-10-2006
7560
7561 # Can't have leading @ because metaconfig interprets it as a command!
7562 ;@inc_version_list=();
7563 # XXX Redo to do opendir/readdir?
7564 if (-d $stem) {
7565     chdir($stem);
7566     ;@candidates = map {
7567         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
7568     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
7569 }
7570 else {
7571     ;@candidates = ();
7572 }
7573
7574 ($pversion, $aversion, $vsn5005) = map {
7575     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
7576 foreach $d (@candidates) {
7577     if ($d->[1] lt $pversion) {
7578         if ($d->[1] ge $aversion) {
7579             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
7580         }
7581         elsif ($d->[1] ge $vsn5005) {
7582             unshift(@inc_version_list, grep { -d } $d->[0]);
7583         }
7584     }
7585     else {
7586         # Skip newer version.  I.e. don't look in
7587         # 5.7.0 if we're installing 5.6.1.
7588     }
7589 }
7590
7591 if (@inc_version_list) {
7592     print join(' ', @inc_version_list);
7593 }
7594 else {
7595     # Blank space to preserve value for next Configure run.
7596     print " ";
7597 }
7598 EOPL
7599 chmod +x getverlist
7600 case "$inc_version_list" in
7601 '')     if test -x "$perl5$exe_ext"; then
7602                 dflt=`$perl5 getverlist`
7603         else
7604                 dflt='none'
7605         fi
7606         ;;
7607 $undef) dflt='none' ;;
7608 *)  eval dflt=\"$inc_version_list\" ;;
7609 esac
7610 case "$dflt" in
7611 ''|' ') dflt=none ;;
7612 esac
7613 case "$dflt" in
7614 5.005) dflt=none ;;
7615 esac
7616 $cat <<EOM
7617
7618 In order to ease the process of upgrading, this version of perl
7619 can be configured to use modules built and installed with earlier
7620 versions of perl that were installed under $prefix.  Specify here
7621 the list of earlier versions that this version of perl should check.
7622 If Configure detected no earlier versions of perl installed under
7623 $prefix, then the list will be empty.  Answer 'none' to tell perl
7624 to not search earlier versions.
7625
7626 The default should almost always be sensible, so if you're not sure,
7627 just accept the default.
7628 EOM
7629
7630 rp='List of earlier versions to include in @INC?'
7631 . ./myread
7632 case "$ans" in
7633 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
7634 *) inc_version_list="$ans" ;;
7635 esac
7636 case "$inc_version_list" in
7637 ''|' ')
7638         inc_version_list_init='0'
7639         d_inc_version_list="$undef"
7640         ;;
7641 *)      inc_version_list_init=`echo $inc_version_list |
7642                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7643         d_inc_version_list="$define"
7644         ;;
7645 esac
7646 $rm -f getverlist
7647
7648 : see if malloc/malloc.h has to be included
7649 set malloc/malloc.h i_mallocmalloc
7650 eval $inhdr
7651
7652 : see if this is a malloc.h system
7653 : we want a real compile instead of Inhdr because some systems have a
7654 : malloc.h that just gives a compile error saying to use stdlib.h instead
7655 echo " "
7656 $cat >try.c <<EOCP
7657 #include <stdlib.h>
7658 #include <malloc.h>
7659 #$i_mallocmalloc I_MALLOCMALLOC
7660 #ifdef I_MALLOCMALLOC
7661 # include <malloc/malloc.h>
7662 #endif
7663
7664 int main () { return 0; }
7665 EOCP
7666 set try
7667 if eval $compile; then
7668     echo "<malloc.h> found." >&4
7669     val="$define"
7670 else
7671     echo "<malloc.h> NOT found." >&4
7672     val="$undef"
7673 fi
7674 $rm_try
7675 set i_malloc
7676 eval $setvar
7677
7678 : check for length of pointer
7679 echo " "
7680 case "$ptrsize" in
7681 '')
7682         echo "Checking to see how big your pointers are..." >&4
7683         $cat >>try.c <<EOCP
7684 #include <stdio.h>
7685 #$i_stdlib I_STDLIB
7686 #ifdef I_STDLIB
7687 #include <stdlib.h>
7688 #endif
7689 int main()
7690 {
7691     printf("%d\n", (int)sizeof(void *));
7692     exit(0);
7693 }
7694 EOCP
7695         set try
7696         if eval $compile_ok; then
7697                 ptrsize=`$run ./try`
7698                 echo "Your pointers are $ptrsize bytes long."
7699         else
7700                 dflt='4'
7701                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7702                 rp="What is the size of a pointer (in bytes)?"
7703                 . ./myread
7704                 ptrsize="$ans"
7705         fi
7706         ;;
7707 esac
7708 $rm_try
7709 case "$use64bitall" in
7710 "$define"|true|[yY]*)
7711         case "$ptrsize" in
7712         4)      cat <<EOM >&4
7713
7714 *** You have chosen a maximally 64-bit build,
7715 *** but your pointers are only 4 bytes wide.
7716 *** Please rerun Configure without -Duse64bitall.
7717 EOM
7718                 case "$d_quad" in
7719                 define)
7720                         cat <<EOM >&4
7721 *** Since you have quads, you could possibly try with -Duse64bitint.
7722 EOM
7723                         ;;
7724                 esac
7725                 cat <<EOM >&4
7726 *** Cannot continue, aborting.
7727
7728 EOM
7729
7730                 exit 1
7731                 ;;
7732         esac
7733         ;;
7734 esac
7735
7736
7737 : determine whether to use malloc wrapping
7738 echo " "
7739 case "$usemallocwrap" in
7740 [yY]*|true|$define)     dflt='y' ;;
7741 [nN]*|false|$undef)     dflt='n' ;;
7742 *)      case "$usedevel" in
7743         [yY]*|true|$define)     dflt='y' ;;
7744         *) dflt='n' ;;
7745         esac
7746         ;;
7747 esac
7748 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
7749 . ./myread
7750 usemallocwrap="$ans"
7751 case "$ans" in
7752 y*|true)
7753         usemallocwrap="$define" ;;
7754 *)
7755         usemallocwrap="$undef" ;;
7756 esac
7757
7758 : determine which malloc to compile in
7759 echo " "
7760 case "$usemymalloc" in
7761 [yY]*|true|$define)     dflt='y' ;;
7762 [nN]*|false|$undef)     dflt='n' ;;
7763 *)      case "$ptrsize" in
7764         4) dflt='y' ;;
7765         *) dflt='n' ;;
7766         esac
7767         if test "$useithreads" = "$define"; then dflt='n'; fi
7768         ;;
7769 esac
7770 rp="Do you wish to attempt to use the malloc that comes with $package?"
7771 . ./myread
7772 usemymalloc="$ans"
7773 case "$ans" in
7774 y*|true)
7775         usemymalloc='y'
7776         mallocsrc='malloc.c'
7777         mallocobj="malloc$_o"
7778         d_mymalloc="$define"
7779         case "$libs" in
7780         *-lmalloc*)
7781                 : Remove malloc from list of libraries to use
7782                 echo "Removing unneeded -lmalloc from library list" >&4
7783                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7784                 shift
7785                 libs="$*"
7786                 echo "libs = $libs" >&4
7787                 ;;
7788         esac
7789         ;;
7790 *)
7791         usemymalloc='n'
7792         mallocsrc=''
7793         mallocobj=''
7794         d_mymalloc="$undef"
7795         ;;
7796 esac
7797
7798 : compute the return types of malloc and free
7799 echo " "
7800 $cat >malloc.c <<END
7801 #$i_malloc I_MALLOC
7802 #$i_stdlib I_STDLIB
7803 #include <stdio.h>
7804 #include <sys/types.h>
7805 #ifdef I_MALLOC
7806 #include <malloc.h>
7807 #endif
7808 #ifdef I_STDLIB
7809 #include <stdlib.h>
7810 #endif
7811 #ifdef TRY_MALLOC
7812 void *malloc();
7813 #endif
7814 #ifdef TRY_FREE
7815 void free();
7816 #endif
7817 END
7818 case "$malloctype" in
7819 '')
7820         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7821                 malloctype='void *'
7822         else
7823                 malloctype='char *'
7824         fi
7825         ;;
7826 esac
7827 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7828
7829 case "$freetype" in
7830 '')
7831         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7832                 freetype='void'
7833         else
7834                 freetype='int'
7835         fi
7836         ;;
7837 esac
7838 echo "Your system uses $freetype free(), it would seem." >&4
7839 $rm -f malloc.[co]
7840 : determine where site specific architecture-dependent libraries go.
7841 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7842 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7843 : sitelib may have an optional trailing /share.
7844 case "$sitearch" in
7845 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7846         dflt="$dflt/$archname"
7847         ;;
7848 *)      dflt="$sitearch"
7849         ;;
7850 esac
7851 set sitearch sitearch none
7852 eval $prefixit
7853 $cat <<EOM
7854
7855 The installation process will also create a directory for
7856 architecture-dependent site-specific extensions and modules.
7857
7858 EOM
7859 fn=d~+
7860 rp='Pathname for the site-specific architecture-dependent library files?'
7861 . ./getfile
7862 prefixvar=sitearch
7863 . ./setprefixvar
7864 if $test X"$sitearch" = X"$sitelib"; then
7865         d_sitearch="$undef"
7866 else
7867         d_sitearch="$define"
7868 fi
7869
7870 : Set the vendorprefix variables
7871 $cat <<EOM
7872
7873 The installation process will also create a directory for
7874 vendor-supplied add-ons.  Vendors who supply perl with their system
7875 may find it convenient to place all vendor-supplied files in this
7876 directory rather than in the main distribution directory.  This will
7877 ease upgrades between binary-compatible maintenance versions of perl.
7878
7879 Of course you may also use these directories in whatever way you see
7880 fit.  For example, you might use them to access modules shared over a
7881 company-wide network.
7882
7883 The default answer should be fine for most people.
7884 This causes further questions about vendor add-ons to be skipped
7885 and no vendor-specific directories will be configured for perl.
7886
7887 EOM
7888 rp='Do you want to configure vendor-specific add-on directories?'
7889 case "$usevendorprefix" in
7890 define|true|[yY]*) dflt=y ;;
7891 *)      : User may have set vendorprefix directly on Configure command line.
7892         case "$vendorprefix" in
7893         ''|' ') dflt=n ;;
7894         *)      dflt=y ;;
7895         esac
7896         ;;
7897 esac
7898 . ./myread
7899 case "$ans" in
7900 [yY]*)  fn=d~+
7901         rp='Installation prefix to use for vendor-supplied add-ons?'
7902         case "$vendorprefix" in
7903         '') dflt="$prefix" ;;
7904         *)  dflt=$vendorprefix ;;
7905         esac
7906         . ./getfile
7907         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7908         oldvendorprefix=''
7909         case "$vendorprefix" in
7910         '') ;;
7911         *)      case "$ans" in
7912                 "$prefix") ;;
7913                 *) oldvendorprefix="$prefix";;
7914                 esac
7915                 ;;
7916         esac
7917         usevendorprefix="$define"
7918         vendorprefix="$ans"
7919         vendorprefixexp="$ansexp"
7920         ;;
7921 *)      usevendorprefix="$undef"
7922         vendorprefix=''
7923         vendorprefixexp=''
7924         ;;
7925 esac
7926
7927 : Set the vendorlib variables
7928 case "$vendorprefix" in
7929 '')     d_vendorlib="$undef"
7930         vendorlib=''
7931         vendorlibexp=''
7932         ;;
7933 *)      d_vendorlib="$define"
7934         : determine where vendor-supplied modules go.
7935         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7936         case "$vendorlib" in
7937         '')
7938                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7939                 case "$installstyle" in
7940                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7941                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7942                 esac
7943                 ;;
7944         *)      dflt="$vendorlib"
7945                 ;;
7946         esac
7947         fn=d~+
7948         rp='Pathname for the vendor-supplied library files?'
7949         . ./getfile
7950         vendorlib="$ans"
7951         vendorlibexp="$ansexp"
7952         ;;
7953 esac
7954 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7955 prefixvar=vendorlib
7956 . ./installprefix
7957
7958 : Set the vendorarch variables
7959 case "$vendorprefix" in
7960 '')     d_vendorarch="$undef"
7961         vendorarch=''
7962         vendorarchexp=''
7963         ;;
7964 *)      d_vendorarch="$define"
7965         : determine where vendor-supplied architecture-dependent libraries go.
7966         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7967         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7968         : vendorlib may have an optional trailing /share.
7969         case "$vendorarch" in
7970         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7971                 dflt="$dflt/$archname"
7972                 ;;
7973         *)      dflt="$vendorarch" ;;
7974         esac
7975         fn=d~+
7976         rp='Pathname for vendor-supplied architecture-dependent files?'
7977         . ./getfile
7978         vendorarch="$ans"
7979         vendorarchexp="$ansexp"
7980         ;;
7981 esac
7982 prefixvar=vendorarch
7983 . ./installprefix
7984 if $test X"$vendorarch" = X"$vendorlib"; then
7985         d_vendorarch="$undef"
7986 else
7987         d_vendorarch="$define"
7988 fi
7989
7990 : Final catch-all directories to search
7991 $cat <<EOM
7992
7993 Lastly, you can have perl look in other directories for extensions and
7994 modules in addition to those already specified.
7995 These directories will be searched after
7996         $sitearch
7997         $sitelib
7998 EOM
7999 test X"$vendorlib" != "X" && echo '     ' $vendorlib
8000 test X"$vendorarch" != "X" && echo '    ' $vendorarch
8001 echo ' '
8002 case "$otherlibdirs" in
8003 ''|' ') dflt='none' ;;
8004 *)      dflt="$otherlibdirs" ;;
8005 esac
8006 $cat <<EOM
8007 Enter a colon-separated set of extra paths to include in perl's @INC
8008 search path, or enter 'none' for no extra paths.
8009
8010 EOM
8011
8012 rp='Colon-separated list of additional directories for perl to search?'
8013 . ./myread
8014 case "$ans" in
8015 ' '|''|none)    otherlibdirs=' ' ;;
8016 *)      otherlibdirs="$ans" ;;
8017 esac
8018 case "$otherlibdirs" in
8019 ' ') val=$undef ;;
8020 *)      val=$define ;;
8021 esac
8022 set d_perl_otherlibdirs
8023 eval $setvar
8024
8025 : Cruising for prototypes
8026 echo " "
8027 echo "Checking out function prototypes..." >&4
8028 $cat >prototype.c <<EOCP
8029 #$i_stdlib I_STDLIB
8030 #ifdef I_STDLIB
8031 #include <stdlib.h>
8032 #endif
8033 int main(int argc, char *argv[]) {
8034         exit(0);}
8035 EOCP
8036 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
8037         echo "Your C compiler appears to support function prototypes."
8038         val="$define"
8039 else
8040         echo "Your C compiler doesn't seem to understand function prototypes."
8041         val="$undef"
8042 fi
8043 set prototype
8044 eval $setvar
8045 $rm -f prototype*
8046
8047 : Check if ansi2knr is required
8048 case "$prototype" in
8049 "$define") ;;
8050 *)      ansi2knr='ansi2knr'
8051         echo " "
8052         cat <<EOM >&4
8053
8054 $me:  FATAL ERROR:
8055 This version of $package can only be compiled by a compiler that
8056 understands function prototypes.  Unfortunately, your C compiler
8057         $cc $ccflags
8058 doesn't seem to understand them.  Sorry about that.
8059
8060 If GNU cc is available for your system, perhaps you could try that instead.
8061
8062 Eventually, we hope to support building Perl with pre-ANSI compilers.
8063 If you would like to help in that effort, please contact <perlbug@perl.org>.
8064
8065 Aborting Configure now.
8066 EOM
8067         exit 2
8068         ;;
8069 esac
8070
8071 : DTrace support
8072 dflt_dtrace='/usr/sbin/dtrace'
8073 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
8074
8075 cat <<EOM
8076
8077 Perl can be built to support DTrace on platforms that support it.
8078 DTrace is a diagnosis and performance analysis tool from Sun.
8079
8080 If this doesn't make any sense to you, just accept the default '$dflt'.
8081 EOM
8082
8083 while $test 1 ; do
8084         case "$usedtrace" in
8085         $define|true|[yY]*)
8086                 dflt='y'
8087                 ;;
8088         ?*)
8089                 dflt='y'
8090                 dflt_dtrace=$usedtrace
8091                 ;;
8092         *)
8093                 dflt='n'
8094                 ;;
8095         esac
8096
8097         rp='Support DTrace if available?'
8098         . ./myread
8099         case "$ans" in
8100         y|Y)    val="$define" ;;
8101         *)      val="$undef" ;;
8102         esac
8103         set usedtrace
8104         eval $setvar
8105
8106         test "X$usedtrace" != "X$define" && break
8107
8108         echo " "
8109         rp='Where is the dtrace executable?'
8110         dflt=$dflt_dtrace
8111         . ./getfile
8112         val="$ans"
8113         set dtrace
8114         eval $setvar
8115
8116         if $test -f $dtrace
8117         then
8118                 if $dtrace -h -s ../perldtrace.d \
8119                         -o perldtrace.tmp >/dev/null 2>&1 \
8120                         && rm -f perldtrace.tmp
8121                 then
8122                         echo " "
8123                         echo "Good: your $dtrace knows about the -h flag."
8124                 else
8125                         cat >&2 <<EOM
8126
8127 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
8128 ***
8129 *** Your installed dtrace doesn't support the -h switch to compile a D
8130 *** program into a C header. Can't continue.
8131
8132 EOM
8133                         exit 1
8134                 fi
8135                 break;
8136         fi
8137
8138         case "$fastread" in
8139         yes)
8140                 cat >&2 <<EOM
8141
8142 *** $me:  Fatal Error:  $dtrace not found.
8143 *** Can't continue.
8144
8145 EOM
8146                 exit 1
8147                 ;;
8148         *)
8149                 echo "*** $dtrace was not found."
8150                 echo " "
8151                 ;;
8152         esac
8153 done
8154
8155 : See if we want extra modules installed
8156 echo " "
8157 case "$extras" in
8158 '') dflt='n';;
8159 *) dflt='y';;
8160 esac
8161 cat <<EOM
8162 Perl can be built with extra modules or bundles of modules which
8163 will be fetched from the CPAN and installed alongside Perl.
8164
8165 Notice that you will need access to the CPAN; either via the Internet,
8166 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
8167 be asked later to configure the CPAN.pm module which will in turn do
8168 the installation of the rest of the extra modules or bundles.)
8169
8170 Notice also that if the modules require any external software such as
8171 libraries and headers (the libz library and the zlib.h header for the
8172 Compress::Zlib module, for example) you MUST have any such software
8173 already installed, this configuration process will NOT install such
8174 things for you.
8175
8176 If this doesn't make any sense to you, just accept the default '$dflt'.
8177 EOM
8178 rp='Install any extra modules (y or n)?'
8179 . ./myread
8180 case "$ans" in
8181 y|Y)
8182         cat <<EOM
8183
8184 Please list any extra modules or bundles to be installed from CPAN,
8185 with spaces between the names.  The names can be in any format the
8186 'install' command of CPAN.pm will understand.  (Answer 'none',
8187 without the quotes, to install no extra modules or bundles.)
8188 EOM
8189         rp='Extras?'
8190         dflt="$extras"
8191         . ./myread
8192         extras="$ans"
8193 esac
8194 case "$extras" in
8195 ''|'none')
8196         val=''
8197         $rm -f ../extras.lst
8198         ;;
8199 *)      echo "(Saving the list of extras for later...)"
8200         echo "$extras" > ../extras.lst
8201         val="'$extras'"
8202         ;;
8203 esac
8204 set extras
8205 eval $setvar
8206 echo " "
8207
8208 : determine where html pages for programs go
8209 set html1dir html1dir none
8210 eval $prefixit
8211 $cat <<EOM
8212
8213 If you wish to install html files for programs in $spackage, indicate
8214 the appropriate directory here.  To skip installing html files,
8215 answer "none".
8216 EOM
8217 case "$html1dir" in
8218 ''|none|$undef|' ') dflt=none ;;
8219 *) dflt=$html1dir ;;
8220 esac
8221 fn=dn+~
8222 rp="Directory for the main $spackage html pages?"
8223 . ./getfile
8224 prefixvar=html1dir
8225 . ./setprefixvar
8226 : Use ' ' for none so value is preserved next time through Configure
8227 $test X"$html1dir" = "X" && html1dir=' '
8228
8229 : determine where html pages for libraries and modules go
8230 set html3dir html3dir none
8231 eval $prefixit
8232 $cat <<EOM
8233
8234 If you wish to install html files for modules associated with $spackage,
8235 indicate the appropriate directory here.  To skip installing html files,
8236 answer "none".
8237 EOM
8238 : There is no obvious default.  If they have specified html1dir, then
8239 : try to key off that, possibly changing .../html1 into .../html3.
8240 case "$html3dir" in
8241 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
8242 *) dflt=$html3dir ;;
8243 esac
8244 fn=dn+~
8245 rp="Directory for the $spackage module html pages?"
8246 . ./getfile
8247 prefixvar=html3dir
8248 . ./setprefixvar
8249 : Use ' ' for none so value is preserved next time through Configure
8250 $test X"$html3dir" = "X" && html3dir=' '
8251
8252 : determine whether to install perl also as /usr/bin/perl
8253
8254 echo " "
8255 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
8256         $cat <<EOM
8257 Many scripts expect perl to be installed as /usr/bin/perl.
8258
8259 If you want to, I can install the perl you are about to compile
8260 as /usr/bin/perl (in addition to $bin/perl).
8261 EOM
8262         if test -f /usr/bin/perl; then
8263             $cat <<EOM
8264
8265 However, please note that because you already have a /usr/bin/perl,
8266 overwriting that with a new Perl would very probably cause problems.
8267 Therefore I'm assuming you don't want to do that (unless you insist).
8268
8269 EOM
8270             case "$installusrbinperl" in
8271             "$define"|[yY]*)    dflt='y';;
8272             *)                  dflt='n';;
8273             esac
8274         else
8275             $cat <<EOM
8276
8277 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
8278
8279 EOM
8280             case "$installusrbinperl" in
8281             "$undef"|[nN]*)     dflt='n';;
8282             *)                  dflt='y';;
8283             esac
8284         fi
8285         rp="Do you want to install perl as /usr/bin/perl?"
8286         . ./myread
8287         case "$ans" in
8288         [yY]*)  val="$define";;
8289         *)      val="$undef" ;;
8290         esac
8291 else
8292         val="$undef"
8293 fi
8294 set installusrbinperl
8295 eval $setvar
8296
8297 : see if dlopen exists
8298 xxx_runnm="$runnm"
8299 xxx_ccflags="$ccflags"
8300 runnm=false
8301 : with g++ one needs -shared to get is-in-libc to work for dlopen
8302 case "$gccversion" in
8303 '')     ;;
8304 *)      case "$d_cplusplus" in
8305         "$define") ccflags="$ccflags -shared" ;;
8306         esac
8307         ;;
8308 esac
8309 set dlopen d_dlopen
8310 eval $inlibc
8311 runnm="$xxx_runnm"
8312 ccflags="$xxx_ccflags"
8313
8314 : see if this is a unistd.h system
8315 set unistd.h i_unistd
8316 eval $inhdr
8317
8318 : determine which dynamic loading, if any, to compile in
8319 echo " "
8320 dldir="ext/DynaLoader"
8321 case "$usedl" in
8322     $define|y|true)
8323         dflt='y'
8324         usedl="$define"
8325         ;;
8326     $undef|n|false)
8327         dflt='n'
8328         usedl="$undef"
8329         ;;
8330     *)
8331         dflt='n'
8332         case "$d_dlopen" in
8333             $define) dflt='y' ;;
8334         esac
8335         : Does a dl_xxx.xs file exist for this operating system
8336         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
8337         ;;
8338 esac
8339 rp="Do you wish to use dynamic loading?"
8340 . ./myread
8341 usedl="$ans"
8342 bin_ELF="$undef"
8343 case "$ans" in
8344     y*) usedl="$define"
8345         case "$dlsrc" in
8346             '') if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
8347                     dflt="$dldir/dl_${osname}.xs"
8348                 elif $test "$d_dlopen" = "$define" ; then
8349                     dflt="$dldir/dl_dlopen.xs"
8350                 else
8351                     dflt=''
8352                 fi
8353                 ;;
8354             *)  dflt="$dldir/$dlsrc"
8355                 ;;
8356         esac
8357         echo "The following dynamic loading files are available:"
8358         : Can not go over to $dldir because getfile has path hard-coded in.
8359         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
8360         rp="Source file to use for dynamic loading"
8361         fn="fne"
8362         gfpth="$src"
8363         . ./getfile
8364         usedl="$define"
8365         : emulate basename
8366         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
8367
8368         $cat << EOM
8369
8370 Some systems may require passing special flags to $cc -c to
8371 compile modules that will be used to create a shared library.
8372 To use no flags, say "none".
8373
8374 EOM
8375         case "$cccdlflags" in
8376             '') case "$gccversion" in
8377                 '') case "$osname" in
8378                         hpux)   dflt='+z' ;;
8379                         irix*)  dflt='-KPIC' ;;
8380                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
8381                         sunos)  dflt='-pic' ;;
8382                         *)      dflt='none' ;;
8383                     esac
8384                     ;;
8385                 *)  case "$osname" in
8386                         darwin) dflt='none' ;;
8387                         *linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
8388                         *)      dflt='-fpic' ;;
8389                     esac ;;
8390                 esac ;;
8391             ' ') dflt='none' ;;
8392             *)   dflt="$cccdlflags" ;;
8393         esac
8394
8395         case "$dflt" in
8396             none) dflt='' ;;
8397         esac
8398
8399         # If -Dsysroot was specified, now's the time to add it
8400         # to cccdlflags
8401         if test "X$sysroot" != X; then
8402             case "$gccversion" in
8403                 '') ;;
8404                 *)  case "$dflt" in
8405                         *sysroot*) ;;
8406                         'undef'|*)
8407                             dflt="$dflt --sysroot=$sysroot" ;;
8408                     esac
8409                     ;;
8410             esac
8411         fi
8412
8413         case "$dflt" in
8414             '') dflt='none';;
8415         esac
8416
8417         rp="Any special flags to pass to $cc -c to compile shared library modules?"
8418         . ./myread
8419         case "$ans" in
8420             none) cccdlflags=' ' ;;
8421             *)    cccdlflags="$ans" ;;
8422         esac
8423
8424         cat << EOM
8425
8426 Some systems use ld to create libraries that can be dynamically loaded,
8427 while other systems (such as those using ELF) use $cc.
8428
8429 EOM
8430
8431 : Determine if this is ELF
8432         $cat >try.c <<EOM
8433 /* Test for whether ELF binaries are produced */
8434 #include <fcntl.h>
8435 #$i_stdlib I_STDLIB
8436 #ifdef I_STDLIB
8437 #include <stdlib.h>
8438 #endif
8439 #$i_unistd I_UNISTD
8440 #ifdef I_UNISTD
8441 #include <unistd.h>
8442 #endif
8443 int main() {
8444     char b[4];
8445     int i = open("a.out",O_RDONLY);
8446     if(i == -1)
8447         exit(1); /* fail */
8448     if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
8449         exit(0); /* succeed (yes, it is ELF) */
8450     exit(1); /* fail */
8451 }
8452 EOM
8453         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
8454             bin_ELF="$define"
8455         fi
8456         $rm_try
8457
8458         case "$ld" in
8459             '') if $test $bin_ELF = "$define"; then
8460                     cat <<EOM
8461 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
8462 EOM
8463                     dflt="$cc"
8464                 else
8465                     echo "I'll use ld to build dynamic libraries."
8466                     dflt='ld'
8467                 fi
8468                 ;;
8469             *)  dflt="$ld"
8470                 ;;
8471         esac
8472
8473         rp="What command should be used to create dynamic libraries?"
8474         . ./myread
8475         ld="$ans"
8476
8477         cat << EOM
8478
8479 Some systems may require passing special flags to $ld to create a
8480 library that can be dynamically loaded.  If your ld flags include
8481 -L/other/path options to locate libraries outside your loader's normal
8482 search path, you may need to specify those -L options here as well.  To
8483 use no flags, say "none".
8484
8485 EOM
8486         case "$lddlflags" in
8487             '') case "$osname" in
8488                     haiku) dflt='-shared' ;;
8489                     hpux) dflt='-b';
8490                           case "$gccversion" in
8491                               '') dflt="$dflt +vnocompatwarnings" ;;
8492                           esac
8493                           ;;
8494                     *linux*|irix*|gnu*)  dflt="-shared $optimize" ;;
8495                     solaris) # See [perl #66604].
8496                             # On Solaris 11, gcc -m64 on amd64
8497                             # appears not to understand -G.  gcc versions at
8498                             # least as old as 3.4.3 support -shared, so just
8499                             # use that with Solaris 11 and later, but keep
8500                             # the old behavior for older Solaris versions.
8501                             case "$gccversion" in
8502                                 '') dflt='-G' ;;
8503                                 *)  case "$osvers" in
8504                                         2.?|2.10) dflt='-G' ;;
8505                                         *) dflt='-shared' ;;
8506                                     esac
8507                                     ;;
8508                             esac
8509                             ;;
8510                     sunos) dflt='-assert nodefinitions' ;;
8511                     svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8512                     *)     dflt='none' ;;
8513                 esac
8514                 ;;
8515             *) dflt="$lddlflags" ;;
8516         esac
8517
8518         : Only do this for gcc, since, for example, qcc has no concept
8519         : of --sysroot.
8520         if $test "X$sysroot" != X; then
8521             case "$gccversion" in
8522                 '') ;;
8523                 *)  dflt="$dflt --sysroot $sysroot" ;;
8524             esac
8525         fi
8526
8527         : Try to guess additional flags to pick up local libraries.
8528         : Be careful not to append to a plain 'none'
8529         case "$dflt" in
8530             none) dflt='' ;;
8531         esac
8532         for thisflag in $ldflags; do
8533             case "$thisflag" in
8534                 -L*|-R*|-Wl,-R*)
8535                     case " $dflt " in
8536                         *" $thisflag "*) ;;
8537                         *) dflt="$dflt $thisflag" ;;
8538                     esac
8539                     ;;
8540             esac
8541         done
8542
8543         case "$dflt" in
8544             ''|' ') dflt='none' ;;
8545         esac
8546
8547         case "$ldflags" in
8548             *-fstack-protector-strong*)
8549                 case "$dflt" in
8550                     *-fstack-protector-strong*) ;; # Don't add it again
8551                     *) dflt="$dflt -fstack-protector-strong" ;;
8552                 esac
8553                 ;;
8554             *-fstack-protector*)
8555                 case "$dflt" in
8556                     *-fstack-protector*) ;; # Don't add it again
8557                     *) dflt="$dflt -fstack-protector" ;;
8558                 esac
8559                 ;;
8560         esac
8561
8562         rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8563         . ./myread
8564         case "$ans" in
8565             none) lddlflags=' ' ;;
8566             *) lddlflags="$ans" ;;
8567         esac
8568
8569         cat <<EOM
8570
8571 Some systems may require passing special flags to $cc to indicate that
8572 the resulting executable will use dynamic linking.  To use no flags,
8573 say "none".
8574
8575 EOM
8576         case "$ccdlflags" in
8577             '') case "$osname" in
8578                     *linux*|hpux|gnu*) dflt='-Wl,-E' ;;
8579                     sunos)             dflt='none'   ;;
8580                     *)                 dflt='none'   ;;
8581                 esac ;;
8582             ' ') dflt='none' ;;
8583             *)   dflt="$ccdlflags" ;;
8584         esac
8585         rp="Any special flags to pass to $cc to use dynamic linking?"
8586         . ./myread
8587         case "$ans" in
8588             none) ccdlflags=' ' ;;
8589             *)    ccdlflags="$ans" ;;
8590         esac
8591         ;;
8592
8593     *)  usedl="$undef"
8594         ld='ld'
8595         dlsrc='dl_none.xs'
8596         lddlflags=''
8597         ccdlflags=''
8598         ;;
8599 esac
8600
8601 ld_can_script="$undef"
8602 case "$bin_ELF$usedl" in
8603     $define$define)
8604         # Abuse try.h and a.out names for neat cleanup
8605         $cat >try.c <<EOM
8606 void foo() {}
8607 void bar() {}
8608 EOM
8609         $cat >try.h <<EOM
8610 LIBTEST_42 {
8611  global:
8612   foo;
8613  local: *;
8614  };
8615 EOM
8616         if $cc $cccdlflags $ccdlflags $ccflags \
8617                $ldflags $lddlflags -o a.out try.c \
8618                -Wl,--version-script=try.h >/dev/null 2>&1 \
8619            &&  $test -s a.out ; then
8620             echo "ld supports scripting" >&4
8621             ld_can_script="$define"
8622         else
8623             echo "ld does not support scripting" >&4
8624         fi
8625         $rm_try
8626         ;;
8627 esac
8628
8629 : Do we want a shared libperl?
8630 also=''
8631 case "$usedl" in
8632 $undef)
8633         # No dynamic loading being used, so don't bother even to prompt.
8634         useshrplib='false'
8635         ;;
8636 *)      case "$useshrplib" in
8637         '')     case "$osname" in
8638                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8639                         dflt=y
8640                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8641                         ;;
8642                 *)      dflt=n
8643                         ;;
8644                 esac
8645                 ;;
8646         $define|true|[Yy]*)
8647                 dflt=y
8648                 ;;
8649         *)      dflt=n
8650                 ;;
8651         esac
8652         $cat << EOM
8653
8654 The perl executable is normally obtained by linking perlmain.c with
8655 libperl${_a}, any static extensions (usually just DynaLoader), and
8656 any other libraries needed on this system (such as -lm, etc.).  Since
8657 your system supports dynamic loading, it is probably possible to build
8658 a shared libperl.$so.  If you will have more than one executable linked
8659 to libperl.$so, this will significantly reduce the size of each
8660 executable, but it may have a noticeable effect on performance.  The
8661 default is probably sensible for your system.
8662 $also
8663
8664 EOM
8665         rp="Build a shared libperl.$so (y/n)"
8666         . ./myread
8667         case "$ans" in
8668         true|$define|[Yy]*)
8669                 useshrplib='true'  ;;
8670         *)      useshrplib='false' ;;
8671         esac
8672         ;;
8673 esac
8674
8675 case "$useshrplib" in
8676 true)
8677         case "$userelocatableinc" in
8678         true|define)
8679                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8680                 echo "See INSTALL for an explanation why that won't work." >&4
8681                 exit 4
8682                 ;;
8683         esac
8684         case "$libperl" in
8685         '')
8686                 # Figure out a good name for libperl.so.  Since it gets stored in
8687                 # a version-specific architecture-dependent library, the version
8688                 # number isn't really that important, except for making cc/ld happy.
8689                 #
8690                 # A name such as libperl.so.10.1
8691                 majmin="libperl.$so.$patchlevel.$subversion"
8692                 # A name such as libperl.so.100
8693                 majonly=`echo $patchlevel $subversion |
8694                         $awk '{printf "%d%02d", $1, $2}'`
8695                 majonly=libperl.$so.$majonly
8696                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8697                 # rely on figuring it out from the naming of libc.
8698                 case "${osname}${osvers}" in
8699                 *linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8700                         dflt=libperl.$so
8701                         ;;
8702                 cygwin*) # ld links now against the dll directly
8703                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8704                         majonly=`echo $patchlevel $subversion |
8705                                 $awk '{printf "%03d%03d", $1, $2}'`
8706                         majonly=cygperl5.$majonly.$so
8707                         dflt=$majmin
8708                         ;;
8709                 *)      # Try to guess based on whether libc has major.minor.
8710                         case "$libc" in
8711                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8712                         *libc.$so.[0-9]*) dflt=$majonly ;;
8713                         *)      dflt=libperl.$so ;;
8714                         esac
8715                         ;;
8716                 esac
8717                 ;;
8718         *)      dflt=$libperl
8719                 ;;
8720         esac
8721         cat << EOM
8722
8723 I need to select a good name for the shared libperl.  If your system uses
8724 library names with major and minor numbers, then you might want something
8725 like $majmin.  Alternatively, if your system uses a single version
8726 number for shared libraries, then you might want to use $majonly.
8727 Or, your system might be quite happy with a simple libperl.$so.
8728
8729 Since the shared libperl will get installed into a version-specific
8730 architecture-dependent directory, the version number of the shared perl
8731 library probably isn't important, so the default should be o.k.
8732
8733 EOM
8734         rp='What name do you want to give to the shared libperl?'
8735         . ./myread
8736         libperl=$ans
8737         echo "Ok, I'll use $libperl"
8738         ;;
8739 *)
8740         libperl="libperl${_a}"
8741         ;;
8742 esac
8743
8744 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8745 case "$shrpdir" in
8746 '') ;;
8747 *)      $cat >&4 <<EOM
8748 WARNING:  Use of the shrpdir variable for the installation location of
8749 the shared $libperl is not supported.  It was never documented and
8750 will not work in this version.  Let me (perlbug@perl.org)
8751 know of any problems this may cause.
8752
8753 EOM
8754         case "$shrpdir" in
8755         "$archlibexp/CORE")
8756                 $cat >&4 <<EOM
8757 But your current setting of $shrpdir is
8758 the default anyway, so it's harmless.
8759 EOM
8760                 ;;
8761         *)
8762                 $cat >&4 <<EOM
8763 Further, your current attempted setting of $shrpdir
8764 conflicts with the value of $archlibexp/CORE
8765 that installperl will use.
8766 EOM
8767                 ;;
8768         esac
8769         ;;
8770 esac
8771
8772 # How will the perl executable find the installed shared $libperl?
8773 # Add $xxx to ccdlflags.
8774 # If we can't figure out a command-line option, use $shrpenv to
8775 # set env LD_RUN_PATH.  The main perl makefile uses this.
8776 shrpdir=$archlibexp/CORE
8777 xxx=''
8778 tmp_shrpenv=''
8779 if "$useshrplib"; then
8780     case "$osname" in
8781         aix)
8782                 # We'll set it in Makefile.SH...
8783                 ;;
8784         solaris)
8785                 xxx="-R $shrpdir"
8786                 ;;
8787         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8788                 xxx="-Wl,-R$shrpdir"
8789                 ;;
8790         bsdos|linux|irix*|dec_osf|gnu*)
8791                 xxx="-Wl,-rpath,$shrpdir"
8792                 ;;
8793         haiku)
8794                 # Haiku doesn't like the default, either.
8795                 ;;
8796         hpux*)
8797                 # hpux doesn't like the default, either.
8798                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8799                 ;;
8800         cygwin)
8801                 # cygwin needs only ldlibpth
8802                 ;;
8803         *)
8804                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8805                 ;;
8806         esac
8807         case "$xxx" in
8808         '') ;;
8809         *)
8810                 # Only add $xxx if it isn't already in ccdlflags.
8811                 case " $ccdlflags " in
8812                 *" $xxx "*)     ;;
8813                 *)      ccdlflags="$ccdlflags $xxx"
8814                         cat <<EOM >&4
8815
8816 Adding $xxx to the flags
8817 passed to $ld so that the perl executable will find the
8818 installed shared $libperl.
8819
8820 EOM
8821                         ;;
8822                 esac
8823                 ;;
8824         esac
8825 fi
8826 # Fix ccdlflags in AIX for building external extensions.
8827 # (For building Perl itself bare -bE:perl.exp is needed,
8828 #  Makefile.SH takes care of this.)
8829 case "$osname" in
8830 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8831 esac
8832 # Respect a hint or command-line value.
8833 case "$shrpenv" in
8834 '') shrpenv="$tmp_shrpenv" ;;
8835 esac
8836 case "$ldlibpthname" in
8837 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8838 none)   ldlibpthname='' ;;
8839 esac
8840
8841 : determine where manual pages are on this system
8842 echo " "
8843 case "$sysman" in
8844 '')
8845         syspath='/usr/share/man/man1 /usr/man/man1'
8846         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8847         syspath="$syspath /usr/man/u_man/man1"
8848         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8849         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8850         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8851         sysman=`./loc . /usr/man/man1 $syspath`
8852         ;;
8853 esac
8854 if $test -d "$sysman"; then
8855         echo "System manual is in $sysman." >&4
8856 else
8857         echo "Could not find manual pages in source form." >&4
8858 fi
8859
8860 : determine where manual pages go
8861 set man1dir man1dir none
8862 eval $prefixit
8863 $cat <<EOM
8864
8865 $spackage has manual pages available in source form.
8866 EOM
8867 case "$nroff" in
8868 nroff)
8869         echo "However, you don't have nroff, so they're probably useless to you."
8870         case "$man1dir" in
8871         '') man1dir="none";;
8872         esac;;
8873 esac
8874 echo "If you don't want the manual sources installed, answer 'none'."
8875 case "$man1dir" in
8876 ' ') dflt=none
8877         ;;
8878 '')
8879         lookpath="$prefixexp/share/man/man1"
8880         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8881         lookpath="$lookpath $prefixexp/man/p_man/man1"
8882         lookpath="$lookpath $prefixexp/man/u_man/man1"
8883         lookpath="$lookpath $prefixexp/man/man.1"
8884         case "$sysman" in
8885         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8886         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8887         esac
8888         set dflt
8889         eval $prefixup
8890         ;;
8891 *)  dflt="$man1dir"
8892         ;;
8893 esac
8894 echo " "
8895 fn=dn+~
8896 rp="Where do the main $spackage manual pages (source) go?"
8897 . ./getfile
8898 if $test "X$man1direxp" != "X$ansexp"; then
8899         installman1dir=''
8900 fi
8901 prefixvar=man1dir
8902 . ./setprefixvar
8903
8904 case "$man1dir" in
8905 '')     man1dir=' '
8906         installman1dir='';;
8907 esac
8908
8909 : What suffix to use on installed man pages
8910
8911 case "$man1dir" in
8912 ' ')
8913         man1ext='0'
8914         ;;
8915 *)
8916         rp="What suffix should be used for the main $spackage man pages?"
8917         case "$man1ext" in
8918         '')     case "$man1dir" in
8919                 *1)  dflt=1 ;;
8920                 *1p) dflt=1p ;;
8921                 *1pm) dflt=1pm ;;
8922                 *l) dflt=l;;
8923                 *n) dflt=n;;
8924                 *o) dflt=o;;
8925                 *p) dflt=p;;
8926                 *C) dflt=C;;
8927                 *L) dflt=L;;
8928                 *L1) dflt=L1;;
8929                 *) dflt=1;;
8930                 esac
8931                 ;;
8932         *)      dflt="$man1ext";;
8933         esac
8934         . ./myread
8935         man1ext="$ans"
8936         ;;
8937 esac
8938
8939 : see if we can have long filenames
8940 echo " "
8941 first=123456789abcdef
8942 $rm -f $first
8943 if (echo hi >$first) 2>/dev/null; then
8944         if $test -f 123456789abcde; then
8945                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8946                 val="$undef"
8947         else
8948                 echo 'You can have filenames longer than 14 characters.'>&4
8949                 val="$define"
8950         fi
8951 else
8952         $cat <<'EOM'
8953 You can't have filenames longer than 14 chars.
8954 You can't even think about them!
8955 EOM
8956         val="$undef"
8957 fi
8958 set d_flexfnam
8959 eval $setvar
8960 $rm -rf 123456789abcde*
8961
8962 : determine where library module manual pages go
8963 set man3dir man3dir none
8964 eval $prefixit
8965 $cat <<EOM
8966
8967 $spackage has manual pages for many of the library modules.
8968 EOM
8969
8970 case "$nroff" in
8971 nroff)
8972         $cat <<'EOM'
8973 However, you don't have nroff, so they're probably useless to you.
8974 EOM
8975         case "$man3dir" in
8976         '') man3dir="none";;
8977         esac;;
8978 esac
8979
8980 case "$d_flexfnam" in
8981 undef)
8982         $cat <<'EOM'
8983 However, your system can't handle the long file names like File::Basename.3.
8984 EOM
8985         case "$man3dir" in
8986         '') man3dir="none";;
8987         esac;;
8988 esac
8989
8990 echo "If you don't want the manual sources installed, answer 'none'."
8991 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8992 case "$man3dir" in
8993 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8994         if $test -d "$privlib/man/man3"; then
8995                 cat <<EOM >&4
8996
8997 WARNING:  Previous versions of perl installed man3 pages into
8998 $privlib/man/man3.  This version will suggest a
8999 new default of $dflt.
9000 EOM
9001                 tdflt=$dflt
9002                 dflt='n'
9003                 rp='Do you wish to preserve the old behavior?(y/n)'
9004                 . ./myread
9005                 case "$ans" in
9006                 y*) dflt="$privlib/man/man3" ;;
9007                 *)  dflt=$tdflt ;;
9008                 esac
9009     fi
9010         ;;
9011 *)      dflt="$man3dir" ;;
9012 esac
9013 case "$dflt" in
9014 ' ') dflt=none ;;
9015 esac
9016 echo " "
9017 fn=dn+~
9018 rp="Where do the $package library man pages (source) go?"
9019 . ./getfile
9020 prefixvar=man3dir
9021 . ./setprefixvar
9022
9023 case "$man3dir" in
9024 '')     man3dir=' '
9025         installman3dir='';;
9026 esac
9027
9028 : What suffix to use on installed man pages
9029 case "$man3dir" in
9030 ' ')
9031         man3ext='0'
9032         ;;
9033 *)
9034         rp="What suffix should be used for the $package library man pages?"
9035         case "$man3ext" in
9036         '')     case "$man3dir" in
9037                 *3)  dflt=3 ;;
9038                 *3p) dflt=3p ;;
9039                 *3pm) dflt=3pm ;;
9040                 *l) dflt=l;;
9041                 *n) dflt=n;;
9042                 *o) dflt=o;;
9043                 *p) dflt=p;;
9044                 *C) dflt=C;;
9045                 *L) dflt=L;;
9046                 *L3) dflt=L3;;
9047                 *) dflt=3;;
9048                 esac
9049                 ;;
9050         *)      dflt="$man3ext";;
9051         esac
9052         . ./myread
9053         man3ext="$ans"
9054         ;;
9055 esac
9056
9057 : see if we have to deal with yellow pages, now NIS.
9058 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
9059         case "$hostcat" in
9060         nidump*) ;;
9061         *)
9062                 case "$hostcat" in
9063                 *ypcat*) dflt=y;;
9064                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
9065                                 dflt=y
9066                         else
9067                                 dflt=n
9068                         fi;;
9069                 *) dflt=n;;
9070                 esac
9071                 echo " "
9072                 rp='Are you getting the hosts file via yellow pages?'
9073                 . ./myread
9074                 case "$ans" in
9075                 y*) hostcat='ypcat hosts';;
9076                 *) hostcat='cat /etc/hosts';;
9077                 esac
9078                 ;;
9079         esac
9080 fi
9081 case "$hostcat" in
9082 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
9083 esac
9084 case "$groupcat" in
9085 '') test -f /etc/group && groupcat='cat /etc/group';;
9086 esac
9087 case "$passcat" in
9088 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
9089 esac
9090
9091 : now get the host name
9092 echo " "
9093 echo "Figuring out host name..." >&4
9094 case "$myhostname" in
9095 '') cont=true
9096         echo 'Maybe "hostname" will work...'
9097         if tans=`sh -c hostname 2>&1` ; then
9098                 myhostname=$tans
9099                 phostname=hostname
9100                 cont=''
9101         fi
9102         ;;
9103 *) cont='';;
9104 esac
9105 if $test "$cont"; then
9106         if ./xenix; then
9107                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
9108                 if tans=`cat /etc/systemid 2>&1` ; then
9109                         myhostname=$tans
9110                         phostname='cat /etc/systemid'
9111                         echo "Whadyaknow.  Xenix always was a bit strange..."
9112                         cont=''
9113                 fi
9114         elif $test -r /etc/systemid; then
9115                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
9116         fi
9117 fi
9118 if $test "$cont"; then
9119         echo 'No, maybe "uuname -l" will work...'
9120         if tans=`sh -c 'uuname -l' 2>&1` ; then
9121                 myhostname=$tans
9122                 phostname='uuname -l'
9123         else
9124                 echo 'Strange.  Maybe "uname -n" will work...'
9125                 if tans=`sh -c 'uname -n' 2>&1` ; then
9126                         myhostname=$tans
9127                         phostname='uname -n'
9128                 else
9129                         echo 'Oh well, maybe I can mine it out of whoami.h...'
9130                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
9131                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
9132                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
9133                         else
9134                                 case "$myhostname" in
9135                                 '') echo "Does this machine have an identity crisis or something?"
9136                                         phostname='';;
9137                                 *)
9138                                         echo "Well, you said $myhostname before..."
9139                                         phostname='echo $myhostname';;
9140                                 esac
9141                         fi
9142                 fi
9143         fi
9144 fi
9145 case "$myhostname" in
9146 '') myhostname=noname ;;
9147 esac
9148 : you do not want to know about this
9149 set $myhostname
9150 myhostname=$1
9151
9152 : verify guess
9153 if $test "$myhostname" ; then
9154         dflt=y
9155         rp='Your host name appears to be "'$myhostname'".'" Right?"
9156         . ./myread
9157         case "$ans" in
9158         y*) ;;
9159         *) myhostname='';;
9160         esac
9161 fi
9162
9163 : bad guess or no guess
9164 while $test "X$myhostname" = X ; do
9165         dflt=''
9166         rp="Please type the (one word) name of your host:"
9167         . ./myread
9168         myhostname="$ans"
9169 done
9170
9171 : translate upper to lower if necessary
9172 case "$myhostname" in
9173 *[A-Z]*)
9174         echo "(Normalizing case in your host name)"
9175         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
9176         ;;
9177 esac
9178
9179 case "$myhostname" in
9180 *.*)
9181         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
9182         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
9183         echo "(Trimming domain name from host name--host name is now $myhostname)"
9184         ;;
9185 *) case "$mydomain" in
9186         '')
9187                 {
9188                         test "X$hostcat" = "Xypcat hosts" &&
9189                         ypmatch "$myhostname" hosts 2>/dev/null |\
9190                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
9191                         $test -s hosts
9192                 } || {
9193                         test "X$hostcat" != "X" &&
9194                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
9195                                         /[       ]$myhostname[  . ]/p" > hosts
9196                 }
9197                 tmp_re="[       . ]"
9198                 if $test -f hosts; then
9199                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
9200                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
9201                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
9202                                 hosts | $sort | $uniq | \
9203                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
9204                         case `$echo X$dflt` in
9205                         X*\ *)  echo "(Several hosts in the database matched hostname)"
9206                                 dflt=.
9207                                 ;;
9208                         X.) echo "(You do not have fully-qualified names in the hosts database)"
9209                                 ;;
9210                         esac
9211                 else
9212                         echo "(I cannot locate a hosts database anywhere)"
9213                         dflt=.
9214                 fi
9215                 case "$dflt" in
9216                 .)
9217                         tans=`./loc resolv.conf X /etc /usr/etc`
9218                         if $test -f "$tans"; then
9219                                 echo "(Attempting domain name extraction from $tans)"
9220                                 dflt=.`$sed -n -e 's/   / /g' \
9221                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
9222                                   -e 1q 2>/dev/null`
9223                                 case "$dflt" in
9224                                 .) dflt=.`$sed -n -e 's/        / /g' \
9225                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
9226                                      -e 1q 2>/dev/null`
9227                                         ;;
9228                                 esac
9229                         fi
9230                         ;;
9231                 esac
9232                 case "$dflt" in
9233                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
9234                         dflt=.`sh -c domainname 2>/dev/null`
9235                         case "$dflt" in
9236                         '') dflt='.';;
9237                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
9238                         esac
9239                         ;;
9240                 esac
9241                 case "$dflt$osname" in
9242                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
9243                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
9244                         ;;
9245                 esac
9246                 case "$dflt" in
9247                 .) echo "(Lost all hope -- silly guess then)"
9248                         dflt='.nonet'
9249                         ;;
9250                 esac
9251                 $rm -f hosts
9252                 ;;
9253         *) dflt="$mydomain";;
9254         esac;;
9255 esac
9256 echo " "
9257 rp="What is your domain name?"
9258 . ./myread
9259 tans="$ans"
9260 case "$ans" in
9261 '') ;;
9262 .*) ;;
9263 *) tans=".$tans";;
9264 esac
9265 mydomain="$tans"
9266
9267 : translate upper to lower if necessary
9268 case "$mydomain" in
9269 *[A-Z]*)
9270         echo "(Normalizing case in your domain name)"
9271         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
9272         ;;
9273 esac
9274
9275 : a little sanity check here
9276 case "$phostname" in
9277 '') ;;
9278 *)
9279         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
9280         $myhostname$mydomain|$myhostname) ;;
9281         *)
9282                 case "$phostname" in
9283                 sed*)
9284                         echo "(That doesn't agree with your whoami.h file, by the way.)"
9285                         ;;
9286                 *)
9287                         echo "(That doesn't agree with your $phostname command, by the way.)"
9288                         ;;
9289                 esac
9290         ;;
9291         esac
9292         ;;
9293 esac
9294
9295 : determine the e-mail address of the user who is running us
9296 $cat <<EOM
9297
9298 I need to get your e-mail address in Internet format if possible, i.e.
9299 something like user@host.domain. Please answer accurately since I have
9300 no easy means to double check it. The default value provided below
9301 is most probably close to reality but may not be valid from outside
9302 your organization...
9303
9304 EOM
9305 cont=x
9306 while test "$cont"; do
9307         case "$MAILDOMAIN" in
9308         '')
9309                 if $test -s /etc/mailname; then
9310                         maildomain=`$cat /etc/mailname`
9311                 else
9312                         maildomain="$myhostname$mydomain"
9313                 fi
9314                 ;;
9315         *)  maildomain="$MAILDOMAIN";;
9316         esac
9317         case "$cf_email" in
9318         '') dflt="$cf_by@$maildomain";;
9319         *)  dflt="$cf_email";;
9320         esac
9321         rp='What is your e-mail address?'
9322         . ./myread
9323         cf_email="$ans"
9324         case "$cf_email" in
9325         *@*.*) cont='' ;;
9326         *)
9327                 rp='Address does not look like an Internet one.  Use it anyway?'
9328                 case "$fastread" in
9329                 yes) dflt=y ;;
9330                 *) dflt=n ;;
9331                 esac
9332                 . ./myread
9333                 case "$ans" in
9334                 y*) cont='' ;;
9335                 *) echo " " ;;
9336                 esac
9337                 ;;
9338         esac
9339 done
9340
9341 : Ask e-mail of administrator
9342 $cat <<EOM
9343
9344 If you or somebody else will be maintaining perl at your site, please
9345 fill in the correct e-mail address here so that they may be contacted
9346 if necessary. Currently, the "perlbug" program included with perl
9347 will send mail to this address in addition to perlbug@perl.org. You may
9348 enter "none" for no administrator.
9349
9350 EOM
9351 case "$perladmin" in
9352 '') dflt="$cf_email";;
9353 *) dflt="$perladmin";;
9354 esac
9355 rp='Perl administrator e-mail address'
9356 . ./myread
9357 perladmin="$ans"
9358
9359 : determine whether to only install version-specific parts.
9360 echo " "
9361 $cat <<EOM
9362 Do you want to install only the version-specific parts of the perl
9363 distribution?  Usually you do *not* want to do this.
9364 EOM
9365 case "$versiononly" in
9366 "$define"|[Yy]*|true) dflt='y' ;;
9367 *) dflt='n';
9368 esac
9369 rp="Do you want to install only the version-specific parts of perl?"
9370 . ./myread
9371 case "$ans" in
9372 [yY]*)  val="$define";;
9373 *)      val="$undef" ;;
9374 esac
9375 set versiononly
9376 eval $setvar
9377
9378 case "$versiononly" in
9379 "$define") inc_version_list=''
9380            inc_version_list_init=0
9381            ;;
9382 esac
9383
9384 : figure out how to guarantee perl startup
9385 : XXX Note that this currently takes advantage of the bug that binexp ignores
9386 :     the Configure -Dinstallprefix setting, which in turn means that under
9387 :     relocatable @INC, initialinstalllocation is what binexp started as.
9388 case "$startperl" in
9389 '')
9390         case "$sharpbang" in
9391         *!)
9392                 $cat <<EOH
9393
9394 I can use the #! construct to start perl on your system. This will
9395 make startup of perl scripts faster, but may cause problems if you
9396 want to share those scripts and perl is not in a standard place
9397 ($initialinstalllocation/perl) on all your platforms. The alternative
9398 is to force a shell by starting the script with a single ':' character.
9399
9400 EOH
9401                 case "$versiononly" in
9402                 "$define")      dflt="$initialinstalllocation/perl$version";;
9403                 *)              dflt="$initialinstalllocation/perl";;
9404                 esac
9405                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
9406                 . ./myread
9407                 case "$ans" in
9408                 none)   startperl=": # use perl";;
9409                 *)      startperl="#!$ans"
9410                         if $test 30 -lt `echo "$ans" | wc -c`; then
9411                                 $cat >&4 <<EOM
9412
9413 WARNING:  Some systems limit the #! command to 32 characters.
9414 If you experience difficulty running Perl scripts with #!, try
9415 installing Perl in a directory with a shorter pathname.
9416
9417 EOM
9418                         fi ;;
9419                 esac
9420                 ;;
9421         *) startperl=": # use perl"
9422                 ;;
9423         esac
9424         ;;
9425 esac
9426 echo "I'll use $startperl to start perl scripts."
9427
9428 : figure best path for perl in scripts
9429 case "$perlpath" in
9430 '')
9431         case "$versiononly" in
9432         "$define")      perlpath="$initialinstalllocation/perl$version";;
9433         *)              perlpath="$initialinstalllocation/perl";;
9434         esac
9435         case "$startperl" in
9436         *!*) ;;
9437         *)
9438                 $cat <<EOH
9439
9440 I will use the "eval 'exec'" idiom to start Perl on your system.
9441 I can use the full path of your Perl binary for this purpose, but
9442 doing so may cause problems if you want to share those scripts and
9443 Perl is not always in a standard place ($initialinstalllocation/perl).
9444
9445 EOH
9446                 dflt="$initialinstalllocation/perl"
9447                 rp="What path shall I use in \"eval 'exec'\"?"
9448                 . ./myread
9449                 perlpath="$ans"
9450                 ;;
9451         esac
9452         ;;
9453 esac
9454 case "$startperl" in
9455 *!*)    ;;
9456 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
9457 esac
9458
9459 : determine where public executable scripts go
9460 set scriptdir scriptdir
9461 eval $prefixit
9462 case "$scriptdir" in
9463 '')
9464         dflt="$bin"
9465         : guess some guesses
9466         $test -d /usr/share/scripts && dflt=/usr/share/scripts
9467         $test -d /usr/share/bin     && dflt=/usr/share/bin
9468         $test -d /usr/local/script  && dflt=/usr/local/script
9469         $test -d /usr/local/scripts && dflt=/usr/local/scripts
9470         $test -d $prefixexp/script  && dflt=$prefixexp/script
9471         set dflt
9472         eval $prefixup
9473         ;;
9474 *)  dflt="$scriptdir"
9475         ;;
9476 esac
9477 $cat <<EOM
9478
9479 Some installations have a separate directory just for executable scripts so
9480 that they can mount it across multiple architectures but keep the scripts in
9481 one spot.  You might, for example, have a subdirectory of /usr/share for this.
9482 Or you might just lump your scripts in with all your other executables.
9483
9484 EOM
9485 fn=d~
9486 rp='Where do you keep publicly executable scripts?'
9487 . ./getfile
9488 if $test "X$ansexp" != "X$scriptdirexp"; then
9489         installscript=''
9490 fi
9491 installscriptdir=''
9492 prefixvar=scriptdir
9493 . ./setprefixvar
9494 : A little fix up for an irregularly named variable.
9495 installscript="$installscriptdir"
9496
9497 : determine where add-on public executables go
9498 case "$sitebin" in
9499 '')     dflt=$siteprefix/bin ;;
9500 *)      dflt=$sitebin ;;
9501 esac
9502 fn=d~
9503 rp='Pathname where the add-on public executables should be installed?'
9504 . ./getfile
9505 prefixvar=sitebin
9506 . ./setprefixvar
9507
9508 : determine where add-on html pages go
9509 : There is no standard location, so try to copy the previously-selected
9510 : directory structure for the core html pages.
9511 case "$sitehtml1dir" in
9512 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9513 *)     dflt=$sitehtml1dir ;;
9514 esac
9515 case "$dflt" in
9516 ''|' ') dflt=none ;;
9517 esac
9518 fn=dn+~
9519 rp='Pathname where the site-specific html pages should be installed?'
9520 . ./getfile
9521 prefixvar=sitehtml1dir
9522 . ./setprefixvar
9523
9524 : determine where add-on library html pages go
9525 : There is no standard location, so try to copy the previously-selected
9526 : directory structure for the core html pages.
9527 case "$sitehtml3dir" in
9528 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9529 *)     dflt=$sitehtml3dir ;;
9530 esac
9531 case "$dflt" in
9532 ''|' ') dflt=none ;;
9533 esac
9534 fn=dn+~
9535 rp='Pathname where the site-specific library html pages should be installed?'
9536 . ./getfile
9537 prefixvar=sitehtml3dir
9538 . ./setprefixvar
9539
9540 : determine where add-on manual pages go
9541 case "$siteman1dir" in
9542 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9543 *)      dflt=$siteman1dir ;;
9544 esac
9545 case "$dflt" in
9546 ''|' ') dflt=none ;;
9547 esac
9548 fn=dn+~
9549 rp='Pathname where the site-specific manual pages should be installed?'
9550 . ./getfile
9551 prefixvar=siteman1dir
9552 . ./setprefixvar
9553
9554 : determine where add-on library man pages go
9555 case "$siteman3dir" in
9556 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9557 *)      dflt=$siteman3dir ;;
9558 esac
9559 case "$dflt" in
9560 ''|' ') dflt=none ;;
9561 esac
9562 fn=dn+~
9563 rp='Pathname where the site-specific library manual pages should be installed?'
9564 . ./getfile
9565 prefixvar=siteman3dir
9566 . ./setprefixvar
9567
9568 : determine where add-on public executable scripts go
9569 case "$sitescript" in
9570 '')     dflt=$siteprefix/script
9571         $test -d $dflt || dflt=$sitebin ;;
9572 *)  dflt="$sitescript" ;;
9573 esac
9574 fn=d~+
9575 rp='Pathname where add-on public executable scripts should be installed?'
9576 . ./getfile
9577 prefixvar=sitescript
9578 . ./setprefixvar
9579
9580 : see if backtrace exists
9581 set backtrace d_backtrace
9582 eval $inlibc
9583
9584 : add flags if using c backtrace
9585 case "$usecbacktrace" in
9586   "") usecbacktrace=$undef ;;
9587   [yY]*|true|$define)
9588     case "$d_backtrace" in
9589       [yY]*|true|$define)
9590         case " $ccflags " in
9591           *" -DUSE_C_BACKTRACE "*) ;; # Already there.
9592           *) ccflags="$ccflags -DUSE_C_BACKTRACE -g" ;;
9593           esac
9594         ;;
9595       *)
9596         echo "This system does not support backtrace" >&4
9597         usecbacktrace=$undef
9598         ;;
9599       esac
9600     ;;
9601   esac
9602
9603 : Check if faststdio is requested and available
9604 case "$usefaststdio" in
9605 $define|true|[yY]*|'')
9606         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9607         case "$xversion" in
9608         [68])   dflt='y' ;;
9609         *)      dflt='n' ;;
9610         esac
9611         ;;
9612 *) dflt='n';;
9613 esac
9614 cat <<EOM
9615
9616 Perl can be built to use 'fast stdio', which means using the stdio
9617 library but also directly manipulating the stdio buffers to enable
9618 faster I/O.  Using stdio is better for backward compatibility (especially
9619 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9620 interface has been preferred instead of stdio.
9621
9622 If this doesn't make any sense to you, just accept the default '$dflt'.
9623 EOM
9624 rp='Use the "fast stdio" if available?'
9625 . ./myread
9626 case "$ans" in
9627 y|Y)    val="$define" ;;
9628 *)      val="$undef" ;;
9629 esac
9630 set usefaststdio
9631 eval $setvar
9632
9633
9634 : define an is-a-typedef? function
9635 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9636 case "$inclist" in
9637 "") inclist="sys/types.h";;
9638 esac;
9639 eval "varval=\$$var";
9640 case "$varval" in
9641 "")
9642         $rm -f temp.c;
9643         for inc in $inclist; do
9644                 echo "#include <$inc>" >>temp.c;
9645         done;
9646         echo "#ifdef $type" >> temp.c;
9647         echo "printf(\"We have $type\");" >> temp.c;
9648         echo "#endif" >> temp.c;
9649         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9650         if $contains $type temp.E >/dev/null 2>&1; then
9651                 eval "$var=\$type";
9652         else
9653                 eval "$var=\$def";
9654         fi;
9655         $rm -f temp.?;;
9656 *) eval "$var=\$varval";;
9657 esac'
9658
9659 : define an is-a-typedef? function that prompts if the type is not available.
9660 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9661 case "$inclist" in
9662 "") inclist="sys/types.h";;
9663 esac;
9664 eval "varval=\$$var";
9665 case "$varval" in
9666 "")
9667         $rm -f temp.c;
9668         for inc in $inclist; do
9669                 echo "#include <$inc>" >>temp.c;
9670         done;
9671         echo "#ifdef $type" >> temp.c;
9672         echo "printf(\"We have $type\");" >> temp.c;
9673         echo "#endif" >> temp.c;
9674         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9675         echo " " ;
9676         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9677         if $contains $type temp.E >/dev/null 2>&1; then
9678                 echo "$type found." >&4;
9679                 eval "$var=\$type";
9680         else
9681                 echo "$type NOT found." >&4;
9682                 dflt="$def";
9683                 . ./myread ;
9684                 eval "$var=\$ans";
9685         fi;
9686         $rm -f temp.?;;
9687 *) eval "$var=\$varval";;
9688 esac'
9689
9690 : see what type lseek is declared as in the kernel
9691 rp="What is the type used for lseek's offset on this system?"
9692 set off_t lseektype long stdio.h sys/types.h
9693 eval $typedef_ask
9694
9695 echo " "
9696 echo "Checking to see how big your file offsets are..." >&4
9697 $cat >try.c <<EOCP
9698 #include <sys/types.h>
9699 #include <stdio.h>
9700 int main()
9701 {
9702     printf("%d\n", (int)sizeof($lseektype));
9703     return(0);
9704 }
9705 EOCP
9706 set try
9707 if eval $compile_ok; then
9708         lseeksize=`$run ./try`
9709         echo "Your file offsets are $lseeksize bytes long."
9710 else
9711         dflt=$longsize
9712         echo " "
9713         echo "(I can't seem to compile the test program.  Guessing...)"
9714         rp="What is the size of your file offsets (in bytes)?"
9715         . ./myread
9716         lseeksize="$ans"
9717 fi
9718 $rm_try
9719
9720 : see what type file positions are declared as in the library
9721 rp="What is the type for file position used by fsetpos()?"
9722 set fpos_t fpostype long stdio.h sys/types.h
9723 eval $typedef_ask
9724
9725 : Check size for Fpos_t
9726 echo " "
9727 case "$fpostype" in
9728 *_t) zzz="$fpostype"    ;;
9729 *)   zzz="fpos_t"       ;;
9730 esac
9731 echo "Checking the size of $zzz..." >&4
9732 cat > try.c <<EOCP
9733 #include <sys/types.h>
9734 #include <stdio.h>
9735 #$i_stdlib I_STDLIB
9736 #ifdef I_STDLIB
9737 #include <stdlib.h>
9738 #endif
9739 int main() {
9740     printf("%d\n", (int)sizeof($fpostype));
9741     exit(0);
9742 }
9743 EOCP
9744 set try
9745 if eval $compile_ok; then
9746         yyy=`$run ./try`
9747         case "$yyy" in
9748         '')     fpossize=4
9749                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9750                 ;;
9751         *)      fpossize=$yyy
9752                 echo "Your $zzz is $fpossize bytes long."
9753                 ;;
9754         esac
9755 else
9756         dflt="$longsize"
9757         echo " " >&4
9758         echo "(I can't compile the test program.  Guessing...)" >&4
9759         rp="What is the size of your file positions (in bytes)?"
9760         . ./myread
9761         fpossize="$ans"
9762 fi
9763
9764 : Check for large file support
9765 # Backward compatibility (uselfs is deprecated).
9766 case "$uselfs" in
9767 "$define"|true|[yY]*)
9768         cat <<EOM >&4
9769
9770 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9771 EOM
9772         uselargefiles="$define"
9773         ;;
9774 esac
9775
9776 case "$lseeksize:$fpossize" in
9777 8:8) cat <<EOM
9778
9779 You can have files larger than 2 gigabytes.
9780 EOM
9781    val="$define" ;;
9782 *)    case "$uselargefiles" in
9783    "$undef"|false|[nN]*) dflt='n' ;;
9784    *)   dflt='y' ;;
9785    esac
9786    cat <<EOM
9787
9788 Perl can be built to understand large files (files larger than 2 gigabytes)
9789 on some systems.  To do so, Configure can be run with -Duselargefiles.
9790
9791 If this doesn't make any sense to you, just accept the default '$dflt'.
9792 EOM
9793    rp='Try to understand large files, if available?'
9794    . ./myread
9795    case "$ans" in
9796    y|Y)         val="$define" ;;
9797    *)           val="$undef"  ;;
9798    esac
9799    ;;
9800 esac
9801 set uselargefiles
9802 eval $setvar
9803 : Look for a hint-file generated 'call-back-unit'.  If the
9804 : user has specified that a large files perl is to be built,
9805 : we may need to set or change some other defaults.
9806 if $test -f uselargefiles.cbu; then
9807         echo "Your platform has some specific hints regarding large file builds, using them..."
9808         . ./uselargefiles.cbu
9809 fi
9810 case "$uselargefiles" in
9811 "$define")
9812         if $test -f uselargefiles.cbu; then
9813                 echo " "
9814                 echo "Rechecking to see how big your file offsets are..." >&4
9815                 $cat >try.c <<EOCP
9816 #include <sys/types.h>
9817 #include <stdio.h>
9818 int main()
9819 {
9820     printf("%d\n", (int)sizeof($lseektype));
9821     return(0);
9822 }
9823 EOCP
9824                 set try
9825                 if eval $compile_ok; then
9826                         lseeksize=`$run ./try`
9827                         $echo "Your file offsets are now $lseeksize bytes long."
9828                 else
9829                         dflt="$lseeksize"
9830                         echo " "
9831                         echo "(I can't seem to compile the test program.  Guessing...)"
9832                         rp="What is the size of your file offsets (in bytes)?"
9833                         . ./myread
9834                         lseeksize="$ans"
9835                 fi
9836                 case "$fpostype" in
9837                 *_t) zzz="$fpostype"    ;;
9838                 *)   zzz="fpos_t"       ;;
9839                 esac
9840                 $echo $n "Rechecking the size of $zzz...$c" >&4
9841                 $cat > try.c <<EOCP
9842 #include <sys/types.h>
9843 #include <stdio.h>
9844 #$i_stdlib I_STDLIB
9845 #ifdef I_STDLIB
9846 #include <stdlib.h>
9847 #endif
9848 int main() {
9849     printf("%d\n", (int)sizeof($fpostype));
9850     return(0);
9851 }
9852 EOCP
9853                 set try
9854                 if eval $compile_ok; then
9855                         yyy=`$run ./try`
9856                         dflt="$lseeksize"
9857                         case "$yyy" in
9858                         '')     echo " "
9859                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9860                                 ;;
9861                         *)      fpossize=$yyy
9862                                 echo " $fpossize bytes." >&4
9863                                 ;;
9864                         esac
9865                 else
9866                         dflt="$fpossize"
9867                         echo " "
9868                         echo "(I can't compile the test program.  Guessing...)" >&4
9869                         rp="What is the size of your file positions (in bytes)?"
9870                         . ./myread
9871                         fpossize="$ans"
9872                 fi
9873                 $rm_try
9874         fi
9875         ;;
9876 esac
9877
9878 : Check if we want perlio
9879 useperlio="$define"
9880
9881 : Set the vendorbin variables
9882 case "$vendorprefix" in
9883 '')     d_vendorbin="$undef"
9884         vendorbin=''
9885         vendorbinexp=''
9886         ;;
9887 *)      d_vendorbin="$define"
9888         : determine where vendor-supplied executables go.
9889         case "$vendorbin" in
9890         '') dflt=$vendorprefix/bin ;;
9891         *)      dflt="$vendorbin" ;;
9892         esac
9893         fn=d~+
9894         rp='Pathname for the vendor-supplied executables directory?'
9895         . ./getfile
9896         vendorbin="$ans"
9897         vendorbinexp="$ansexp"
9898         ;;
9899 esac
9900 prefixvar=vendorbin
9901 . ./installprefix
9902
9903 : Set the vendorhtml1dir variables
9904 case "$vendorprefix" in
9905 '')     vendorhtml1dir=''
9906         vendorhtml1direxp=''
9907         ;;
9908 *)      : determine where vendor-supplied html pages go.
9909         : There is no standard location, so try to copy the previously-selected
9910         : directory structure for the core html pages.
9911         : XXX Better default suggestions would be welcome.
9912         case "$vendorhtml1dir" in
9913         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9914         *)      dflt=$vendorhtml1dir ;;
9915         esac
9916         case "$dflt" in
9917         ''|' ') dflt=none ;;
9918         esac
9919         fn=dn+~
9920         rp='Pathname for the vendor-supplied html pages?'
9921         . ./getfile
9922         vendorhtml1dir="$ans"
9923         vendorhtml1direxp="$ansexp"
9924         ;;
9925 esac
9926 : Use ' ' for none so value is preserved next time through Configure
9927 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9928 prefixvar=vendorhtml1dir
9929 . ./installprefix
9930
9931 : Set the vendorhtml3dir variables
9932 case "$vendorprefix" in
9933 '')     vendorhtml3dir=''
9934         vendorhtml3direxp=''
9935         ;;
9936 *)      : determine where vendor-supplied module html pages go.
9937         : There is no standard location, so try to copy the previously-selected
9938         : directory structure for the core html pages.
9939         : XXX Better default suggestions would be welcome.
9940         case "$vendorhtml3dir" in
9941         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9942         *)      dflt=$vendorhtml3dir ;;
9943         esac
9944         case "$dflt" in
9945         ''|' ') dflt=none ;;
9946         esac
9947         fn=dn+~
9948         rp='Pathname for the vendor-supplied html pages?'
9949         . ./getfile
9950         vendorhtml3dir="$ans"
9951         vendorhtml3direxp="$ansexp"
9952         ;;
9953 esac
9954 : Use ' ' for none so value is preserved next time through Configure
9955 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9956 prefixvar=vendorhtml3dir
9957 . ./installprefix
9958
9959 : Set the vendorman1dir variables
9960 case "$vendorprefix" in
9961 '')     vendorman1dir=''
9962         vendorman1direxp=''
9963         ;;
9964 *)      : determine where vendor-supplied manual pages go.
9965         case "$vendorman1dir" in
9966         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9967         *)      dflt=$vendorman1dir ;;
9968         esac
9969         case "$dflt" in
9970         ''|' ') dflt=none ;;
9971         esac
9972         fn=nd~+
9973         rp='Pathname for the vendor-supplied manual section 1 pages?'
9974         . ./getfile
9975         vendorman1dir="$ans"
9976         vendorman1direxp="$ansexp"
9977         ;;
9978 esac
9979 : Use ' ' for none so value is preserved next time through Configure
9980 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9981 prefixvar=vendorman1dir
9982 . ./installprefix
9983
9984 : Set the vendorman3dir variables
9985 case "$vendorprefix" in
9986 '')     vendorman3dir=''
9987         vendorman3direxp=''
9988         ;;
9989 *)      : determine where vendor-supplied module manual pages go.
9990         case "$vendorman3dir" in
9991         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9992         *)      dflt=$vendorman3dir ;;
9993         esac
9994         case "$dflt" in
9995         ''|' ') dflt=none ;;
9996         esac
9997         fn=nd~+
9998         rp='Pathname for the vendor-supplied manual section 3 pages?'
9999         . ./getfile
10000         vendorman3dir="$ans"
10001         vendorman3direxp="$ansexp"
10002         ;;
10003 esac
10004 : Use ' ' for none so value is preserved next time through Configure
10005 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
10006 prefixvar=vendorman3dir
10007 . ./installprefix
10008
10009 : Set the vendorscript variables
10010 case "$vendorprefix" in
10011 '')     d_vendorscript="$undef"
10012         vendorscript=''
10013         vendorscriptexp=''
10014         ;;
10015 *)      d_vendorscript="$define"
10016         : determine where vendor-supplied scripts go.
10017         case "$vendorscript" in
10018         '')     dflt=$vendorprefix/script
10019                 $test -d $dflt || dflt=$vendorbin ;;
10020         *)  dflt="$vendorscript" ;;
10021         esac
10022         $cat <<EOM
10023
10024 The installation process will create a directory for
10025 vendor-supplied scripts.
10026
10027 EOM
10028         fn=d~+
10029         rp='Pathname for the vendor-supplied scripts directory?'
10030         . ./getfile
10031         vendorscript="$ans"
10032         vendorscriptexp="$ansexp"
10033         ;;
10034 esac
10035 prefixvar=vendorscript
10036 . ./installprefix
10037
10038 : script used to emit important warnings
10039 cat >warn <<EOS
10040 $startsh
10041 if test \$# -gt 0; then
10042         echo "\$@" >msg
10043 else
10044         cat >msg
10045 fi
10046 echo "*** WARNING:" >&4
10047 sed -e 's/^/*** /' <msg >&4
10048 echo "*** " >&4
10049 cat msg >>config.msg
10050 echo " " >>config.msg
10051 rm -f msg
10052 EOS
10053 chmod +x warn
10054 $eunicefix warn
10055
10056 : see which of string.h or strings.h is needed
10057 echo " "
10058 strings=`./findhdr string.h`
10059 if $test "$strings" && $test -r "$strings"; then
10060         echo "Using <string.h> instead of <strings.h>." >&4
10061         val="$define"
10062 else
10063         val="$undef"
10064         strings=`./findhdr strings.h`
10065         if $test "$strings" && $test -r "$strings"; then
10066                 echo "Using <strings.h> instead of <string.h>." >&4
10067         else
10068                 ./warn "No string header found -- You'll surely have problems."
10069         fi
10070 fi
10071 set i_string
10072 eval $setvar
10073 case "$i_string" in
10074 "$undef") strings=`./findhdr strings.h`;;
10075 *)        strings=`./findhdr string.h`;;
10076 esac
10077
10078 : see if qgcvt exists
10079 set qgcvt d_qgcvt
10080 eval $inlibc
10081
10082 : Check print/scan long double stuff
10083 echo " "
10084
10085 if $test X"$d_longdbl" = X"$define"; then
10086
10087 echo "Checking how to print long doubles..." >&4
10088
10089 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
10090         $cat >try.c <<'EOCP'
10091 #include <sys/types.h>
10092 #include <stdio.h>
10093 int main() {
10094   double d = 123.456;
10095   printf("%.3f\n", d);
10096 }
10097 EOCP
10098         set try
10099         if eval $compile; then
10100                 yyy=`$run ./try`
10101                 case "$yyy" in
10102                 123.456)
10103                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
10104                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
10105                         echo "We will use %f."
10106                         ;;
10107                 esac
10108         fi
10109 fi
10110
10111 if $test X"$sPRIfldbl" = X; then
10112         $cat >try.c <<'EOCP'
10113 #include <sys/types.h>
10114 #include <stdio.h>
10115 int main() {
10116   long double d = 123.456;
10117   printf("%.3Lf\n", d);
10118 }
10119 EOCP
10120         set try
10121         if eval $compile; then
10122                 yyy=`$run ./try`
10123                 case "$yyy" in
10124                 123.456)
10125                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
10126                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
10127                         echo "We will use %Lf."
10128                         ;;
10129                 esac
10130         fi
10131 fi
10132
10133 if $test X"$sPRIfldbl" = X; then
10134         $cat >try.c <<'EOCP'
10135 #include <sys/types.h>
10136 #include <stdio.h>
10137 int main() {
10138   long double d = 123.456;
10139   printf("%.3llf\n", d);
10140 }
10141 EOCP
10142         set try
10143         if eval $compile; then
10144                 yyy=`$run ./try`
10145                 case "$yyy" in
10146                 123.456)
10147                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
10148                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
10149                         echo "We will use %llf."
10150                         ;;
10151                 esac
10152         fi
10153 fi
10154
10155 if $test X"$sPRIfldbl" = X; then
10156         $cat >try.c <<'EOCP'
10157 #include <sys/types.h>
10158 #include <stdio.h>
10159 int main() {
10160   long double d = 123.456;
10161   printf("%.3lf\n", d);
10162 }
10163 EOCP
10164         set try
10165         if eval $compile; then
10166                 yyy=`$run ./try`
10167                 case "$yyy" in
10168                 123.456)
10169                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
10170                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
10171                         echo "We will use %lf."
10172                         ;;
10173                 esac
10174         fi
10175 fi
10176
10177 if $test X"$sPRIfldbl" = X; then
10178         echo "Cannot figure out how to print long doubles." >&4
10179 else
10180         sSCNfldbl=$sPRIfldbl    # expect consistency
10181 fi
10182
10183 $rm_try
10184
10185 fi # d_longdbl
10186
10187 case "$sPRIfldbl" in
10188 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
10189         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
10190         d_SCNfldbl="$undef";
10191         ;;
10192 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
10193         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
10194         d_SCNfldbl="$define";
10195         ;;
10196 esac
10197
10198 : Check how to convert floats to strings.
10199
10200 if test "X$d_Gconvert" = X; then
10201
10202 echo " "
10203 echo "Checking for an efficient way to convert floats to strings."
10204 echo " " > try.c
10205 case "$uselongdouble" in
10206 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
10207 esac
10208 case "$d_longdbl" in
10209 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
10210 esac
10211 case "$d_PRIgldbl" in
10212 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
10213 esac
10214 $cat >>try.c <<EOP
10215 #ifdef TRY_gconvert
10216 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
10217 char *myname = "gconvert";
10218 #endif
10219 #ifdef TRY_gcvt
10220 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
10221 char *myname = "gcvt";
10222 #endif
10223 #ifdef TRY_qgcvt
10224 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
10225 char *myname = "qgcvt";
10226 #define DOUBLETYPE long double
10227 #endif
10228 #ifdef TRY_sprintf
10229 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10230 #ifdef HAS_PRIgldbl
10231 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
10232 #else
10233 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
10234 #endif
10235 #else
10236 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
10237 #endif
10238 char *myname = "sprintf";
10239 #endif
10240
10241 #ifndef DOUBLETYPE
10242 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
10243 #define DOUBLETYPE long double
10244 #else
10245 #define DOUBLETYPE double
10246 #endif
10247 #endif
10248
10249 #include <stdio.h>
10250
10251 #$i_stdlib I_STDLIB
10252 #ifdef I_STDLIB
10253 #include <stdlib.h>
10254 #endif
10255 #$i_string I_STRING
10256 #ifdef I_STRING
10257 #  include <string.h>
10258 #else
10259 #  include <strings.h>
10260 #endif
10261
10262 int checkit(char *expect, char *got)
10263 {
10264     if (strcmp(expect, got)) {
10265                 printf("%s oddity:  Expected %s, got %s\n",
10266                         myname, expect, got);
10267                 exit(1);
10268         }
10269 }
10270
10271 int main()
10272 {
10273         char buf[64];
10274         buf[63] = '\0';
10275
10276         /* This must be 1st test on (which?) platform */
10277         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
10278         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
10279         checkit("0.1", buf);
10280
10281         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
10282         checkit("0.01", buf);
10283
10284         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
10285         checkit("0.001", buf);
10286
10287         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
10288         checkit("0.0001", buf);
10289
10290         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
10291         if (strlen(buf) > 5)
10292             checkit("9e-005", buf); /* for Microsoft ?? */
10293         else
10294             checkit("9e-05", buf);
10295
10296         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
10297         checkit("1", buf);
10298
10299         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
10300         checkit("1.1", buf);
10301
10302         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
10303         checkit("1.01", buf);
10304
10305         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
10306         checkit("1.001", buf);
10307
10308         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
10309         checkit("1.0001", buf);
10310
10311         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
10312         checkit("1.00001", buf);
10313
10314         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
10315         checkit("1.000001", buf);
10316
10317         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
10318         checkit("0", buf);
10319
10320         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
10321         checkit("-1", buf);
10322
10323         /* Some Linux gcvt's give 1.e+5 here. */
10324         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
10325         checkit("100000", buf);
10326
10327         /* Some Linux gcvt's give -1.e+5 here. */
10328         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
10329         checkit("-100000", buf);
10330
10331         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
10332         checkit("123.456", buf);
10333
10334         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
10335         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
10336         /* 34 should be enough to scare even long double
10337          * places into using the e notation. */
10338         if (strlen(buf) > 5)
10339             checkit("1e+034", buf); /* for Microsoft */
10340         else
10341             checkit("1e+34", buf);
10342
10343         /* For Perl, if you add additional tests here, also add them to
10344          * t/base/num.t for benefit of platforms not using Configure or
10345          * overriding d_Gconvert */
10346
10347         exit(0);
10348 }
10349 EOP
10350 : first add preferred functions to our list
10351 xxx_list=""
10352 for xxx_convert in $gconvert_preference; do
10353     case $xxx_convert in
10354     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
10355     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
10356     esac
10357 done
10358 : then add any others
10359 for xxx_convert in gconvert gcvt sprintf; do
10360     case "$xxx_list" in
10361     *$xxx_convert*) ;;
10362     *) xxx_list="$xxx_list $xxx_convert" ;;
10363     esac
10364 done
10365
10366 case "$d_longdbl$uselongdouble" in
10367 "$define$define")
10368     : again, add preferred functions to our list first
10369     xxx_ld_list=""
10370     for xxx_convert in $gconvert_ld_preference; do
10371         case $xxx_convert in
10372         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10373         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
10374         esac
10375     done
10376     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
10377     for xxx_convert in qgcvt sprintf $xxx_list; do
10378         case "$xxx_ld_list" in
10379         $xxx_convert*|*" $xxx_convert"*) ;;
10380         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
10381         esac
10382     done
10383     : if sprintf cannot do long doubles, move it to the end
10384     if test "$d_PRIgldbl" != "$define"; then
10385         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
10386     fi
10387     : if no qgcvt, remove it
10388     if test "$d_qgcvt" != "$define"; then
10389         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
10390     fi
10391     : use the ld_list
10392     xxx_list="$xxx_ld_list"
10393     ;;
10394 esac
10395
10396 for xxx_convert in $xxx_list; do
10397         echo "Trying $xxx_convert..."
10398         $rm -f try try$_o core
10399         set try -DTRY_$xxx_convert
10400         if eval $compile; then
10401                 echo "$xxx_convert() found." >&4
10402                 if $run ./try; then
10403                         echo "I'll use $xxx_convert to convert floats into a string." >&4
10404                         break;
10405                 else
10406                         echo "...But $xxx_convert didn't work as I expected."
10407                         xxx_convert=''
10408                 fi
10409         else
10410                 echo "$xxx_convert NOT found." >&4
10411         fi
10412 done
10413
10414 if test X$xxx_convert = X; then
10415     echo "*** WHOA THERE!!! ***" >&4
10416     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
10417     xxx_convert=sprintf
10418 fi
10419
10420 case "$xxx_convert" in
10421 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
10422 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
10423 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
10424 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
10425    "$define$define$define")
10426       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
10427    "$define$define$undef")
10428       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
10429    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
10430    esac
10431    ;;
10432 esac
10433
10434 fi
10435 $rm_try
10436
10437 : see if _fwalk exists
10438 set fwalk d__fwalk
10439 eval $inlibc
10440
10441 : Initialize h_fcntl
10442 h_fcntl=false
10443
10444 : Initialize h_sysfile
10445 h_sysfile=false
10446
10447 : access call always available on UNIX
10448 set access d_access
10449 eval $inlibc
10450
10451 : locate the flags for 'access()'
10452 case "$d_access" in
10453 "$define")
10454         echo " "
10455         $cat >access.c <<EOCP
10456 #include <sys/types.h>
10457 #ifdef I_FCNTL
10458 #include <fcntl.h>
10459 #endif
10460 #ifdef I_SYS_FILE
10461 #include <sys/file.h>
10462 #endif
10463 #ifdef I_UNISTD
10464 #include <unistd.h>
10465 #endif
10466 #$i_stdlib I_STDLIB
10467 #ifdef I_STDLIB
10468 #include <stdlib.h>
10469 #endif
10470 int main() {
10471         exit(R_OK);
10472 }
10473 EOCP
10474         : check sys/file.h first, no particular reason here
10475         if $test `./findhdr sys/file.h` && \
10476                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
10477                 h_sysfile=true;
10478                 echo "<sys/file.h> defines the *_OK access constants." >&4
10479         elif $test `./findhdr fcntl.h` && \
10480                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
10481                 h_fcntl=true;
10482                 echo "<fcntl.h> defines the *_OK access constants." >&4
10483         elif $test `./findhdr unistd.h` && \
10484                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
10485                 echo "<unistd.h> defines the *_OK access constants." >&4
10486         else
10487                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
10488         fi
10489         ;;
10490 esac
10491 $rm -f access*
10492
10493 : see if accessx exists
10494 set accessx d_accessx
10495 eval $inlibc
10496
10497 : see if acosh exists
10498 set acosh d_acosh
10499 eval $inlibc
10500
10501 : see if aintl exists
10502 set aintl d_aintl
10503 eval $inlibc
10504
10505 : see if alarm exists
10506 set alarm d_alarm
10507 eval $inlibc
10508
10509 : see if 64bit time functions exists
10510
10511 set ctime64 d_ctime64
10512 eval $inlibc
10513
10514 set localtime64 d_localtime64
10515 eval $inlibc
10516
10517 set gmtime64 d_gmtime64
10518 eval $inlibc
10519
10520 set mktime64 d_mktime64
10521 eval $inlibc
10522
10523 set difftime64 d_difftime64
10524 eval $inlibc
10525
10526 set asctime64 d_asctime64
10527 eval $inlibc
10528
10529 : see if POSIX threads are available
10530 set pthread.h i_pthread
10531 eval $inhdr
10532
10533 : define a function to check prototypes
10534 $cat > protochk <<EOSH
10535 $startsh
10536 cc="$cc"
10537 optimize="$optimize"
10538 ccflags="$ccflags"
10539 prototype="$prototype"
10540 define="$define"
10541 rm_try="$rm_try"
10542 usethreads=$usethreads
10543 i_pthread=$i_pthread
10544 pthread_h_first=$pthread_h_first
10545 EOSH
10546
10547 $cat >> protochk <<'EOSH'
10548
10549 $rm_try
10550 foo="$1"
10551 shift
10552 while test $# -ge 2; do
10553         case "$1" in
10554                 $define) echo "#include <$2>" >> try.c ;;
10555                 literal) echo "$2" >> try.c ;;
10556         esac
10557     # Extra magic for the benefit of systems that need pthread.h
10558     # to be included early to correctly detect threadsafe functions.
10559     # Such functions must guarantee themselves, though, that the usethreads
10560     # and i_pthread have been defined, before calling protochk.
10561     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10562         echo "#include <pthread.h>" >> try.c
10563         pthread_h_done=yes
10564     fi
10565     shift 2
10566 done
10567 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10568 cat >> try.c <<'EOCP'
10569 #ifdef CAN_PROTOTYPE
10570 #define _(args) args
10571 #else
10572 #define _(args) ()
10573 #endif
10574 EOCP
10575 echo "$foo" >> try.c
10576 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10577 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10578 status=$?
10579 $rm_try
10580 exit $status
10581 EOSH
10582 chmod +x protochk
10583 $eunicefix protochk
10584
10585 : Define hasproto macro for Configure internal use
10586 hasproto='varname=$1; func=$2; shift; shift;
10587 while $test $# -ge 2; do
10588         case "$1" in
10589         $define) echo "#include <$2>";;
10590         esac ;
10591     shift 2;
10592 done > try.c;
10593 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10594 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10595         echo "$func() prototype found.";
10596         val="$define";
10597 else
10598         echo "$func() prototype NOT found.";
10599         val="$undef";
10600 fi;
10601 set $varname;
10602 eval $setvar;
10603 $rm_try tryout.c'
10604
10605 : see if sys/types.h has to be included
10606 set sys/types.h i_systypes
10607 eval $inhdr
10608
10609 : see if sys/select.h has to be included
10610 set sys/select.h i_sysselct
10611 eval $inhdr
10612
10613 : Define hasfield macro for Configure internal use
10614 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10615 while $test $# -ge 2; do
10616         case "$1" in
10617         $define) echo "#include <$2>";;
10618         esac ;
10619     shift 2;
10620 done > try.c;
10621 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10622 set try;
10623 if eval $compile; then
10624         val="$define";
10625 else
10626         val="$undef";
10627 fi;
10628 set $varname;
10629 eval $setvar;
10630 $rm_try'
10631
10632 : see if we should include time.h, sys/time.h, or both
10633 echo " "
10634 if test "X$timeincl" = X; then
10635         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10636         $echo $n "I'm now running the test program...$c"
10637         $cat >try.c <<EOCP
10638 #include <sys/types.h>
10639 #ifdef I_TIME
10640 #include <time.h>
10641 #endif
10642 #ifdef I_SYSTIME
10643 #ifdef SYSTIMEKERNEL
10644 #define KERNEL
10645 #endif
10646 #include <sys/time.h>
10647 #endif
10648 #ifdef I_SYSSELECT
10649 #include <sys/select.h>
10650 #endif
10651 #$i_stdlib I_STDLIB
10652 #ifdef I_STDLIB
10653 #include <stdlib.h>
10654 #endif
10655 int main()
10656 {
10657         struct tm foo;
10658 #ifdef S_TIMEVAL
10659         struct timeval bar;
10660 #endif
10661 #ifdef S_TIMEZONE
10662         struct timezone tzp;
10663 #endif
10664         if (foo.tm_sec == foo.tm_sec)
10665                 exit(0);
10666 #ifdef S_TIMEVAL
10667         if (bar.tv_sec == bar.tv_sec)
10668                 exit(0);
10669 #endif
10670         exit(1);
10671 }
10672 EOCP
10673         flags=''
10674         for s_timezone in '-DS_TIMEZONE' ''; do
10675         sysselect=''
10676         for s_timeval in '-DS_TIMEVAL' ''; do
10677         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10678         for i_time in '' '-DI_TIME'; do
10679         for i_systime in '-DI_SYSTIME' ''; do
10680                 case "$flags" in
10681                 '') $echo $n ".$c"
10682                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10683                         if eval $compile; then
10684                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10685                                 shift
10686                                 flags="$*"
10687                                 echo " "
10688                                 $echo $n "Succeeded with $flags$c"
10689                         fi
10690                         ;;
10691                 esac
10692         done
10693         done
10694         done
10695         done
10696         done
10697         timeincl=''
10698         echo " "
10699         case "$flags" in
10700         *SYSTIMEKERNEL*) i_systimek="$define"
10701                 timeincl=`./findhdr sys/time.h`
10702                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10703         *) i_systimek="$undef";;
10704         esac
10705         case "$flags" in
10706         *I_TIME*) i_time="$define"
10707                 timeincl=`./findhdr time.h`" $timeincl"
10708                 echo "We'll include <time.h>." >&4;;
10709         *) i_time="$undef";;
10710         esac
10711         case "$flags" in
10712         *I_SYSTIME*) i_systime="$define"
10713                 timeincl=`./findhdr sys/time.h`" $timeincl"
10714                 echo "We'll include <sys/time.h>." >&4;;
10715         *) i_systime="$undef";;
10716         esac
10717         $rm_try
10718 fi
10719 : see if struct tm knows about tm_zone
10720 case "$i_systime$i_time" in
10721 *$define*)
10722         echo " "
10723         echo "Checking to see if your struct tm has tm_zone field..." >&4
10724         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10725         eval $hasfield
10726         ;;
10727 *)      val="$undef"
10728         set d_tm_tm_zone
10729         eval $setvar
10730         ;;
10731 esac
10732 case "$d_tm_tm_zone" in
10733 "$define")      echo "Yes, it does."   ;;
10734 *)              echo "No, it doesn't." ;;
10735 esac
10736 : see if struct tm knows about tm_gmtoff
10737 case "$i_systime$i_time" in
10738 *$define*)
10739         echo " "
10740         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10741         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10742         eval $hasfield
10743         ;;
10744 *)      val="$undef"
10745         set d_tm_tm_gmtoff
10746         eval $setvar
10747         ;;
10748 esac
10749 case "$d_tm_tm_gmtoff" in
10750 "$define")      echo "Yes, it does."   ;;
10751 *)              echo "No, it doesn't." ;;
10752 esac
10753
10754 : see if asctime_r exists
10755 set asctime_r d_asctime_r
10756 eval $inlibc
10757 case "$d_asctime_r" in
10758 "$define")
10759         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10760         case "$d_asctime_r_proto:$usethreads" in
10761         ":define")      d_asctime_r_proto=define
10762                 set d_asctime_r_proto asctime_r $hdrs
10763                 eval $hasproto ;;
10764         *)      ;;
10765         esac
10766         case "$d_asctime_r_proto" in
10767         define)
10768         case "$asctime_r_proto" in
10769         ''|0) try='char* asctime_r(const struct tm*, char*);'
10770         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10771         esac
10772         case "$asctime_r_proto" in
10773         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10774         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10775         esac
10776         case "$asctime_r_proto" in
10777         ''|0) try='int asctime_r(const struct tm*, char*);'
10778         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10779         esac
10780         case "$asctime_r_proto" in
10781         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10782         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10783         esac
10784         case "$asctime_r_proto" in
10785         ''|0)   d_asctime_r=undef
10786                 asctime_r_proto=0
10787                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10788         * )     case "$asctime_r_proto" in
10789                 REENTRANT_PROTO*) ;;
10790                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10791                 esac
10792                 echo "Prototype: $try" ;;
10793         esac
10794         ;;
10795         *)      case "$usethreads" in
10796                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10797                 esac
10798                 d_asctime_r=undef
10799                 asctime_r_proto=0
10800                 ;;
10801         esac
10802         ;;
10803 *)      asctime_r_proto=0
10804         ;;
10805 esac
10806
10807 : see if atolf exists
10808 set atolf d_atolf
10809 eval $inlibc
10810
10811 : see if atoll exists
10812 set atoll d_atoll
10813 eval $inlibc
10814
10815 : Look for GCC-style attribute format
10816 case "$d_attribute_format" in
10817 '')
10818 echo " "
10819 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10820 $cat >attrib.c <<'EOCP'
10821 #include <stdio.h>
10822 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10823 EOCP
10824 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10825         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10826                 echo "Your C compiler doesn't support __attribute__((format))."
10827                 val="$undef"
10828         else
10829                 echo "Your C compiler supports __attribute__((format))."
10830                 val="$define"
10831         fi
10832 else
10833         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10834         val="$undef"
10835 fi
10836 ;;
10837 *) val="$d_attribute_format" ;;
10838 esac
10839 set d_attribute_format
10840 eval $setvar
10841 $rm -f attrib*
10842
10843 : Look for GCC-style attribute format with null format allowed
10844 case "$d_printf_format_null" in
10845 '') case "$d_attribute_format" in
10846     $define)
10847         echo " "
10848         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10849 $cat >attrib.c <<EOCP
10850 #include <stdio.h>
10851 #$i_stdlib I_STDLIB
10852 #ifdef I_STDLIB
10853 #include <stdlib.h>
10854 #endif
10855 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10856 int null_printf (char* pat,...) { return (int)pat; }
10857 int main () { exit(null_printf(NULL)); }
10858 EOCP
10859         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10860             : run the executable in case it produces a run-time warning
10861             if $run ./attrib >>attrib.out 2>&1; then
10862                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10863                     echo "Your C compiler doesn't allow __printf__ format to be null."
10864                     val="$undef"
10865                 else
10866                     echo "Your C compiler allows __printf__ format to be null."
10867                     val="$define"
10868                 fi
10869             else
10870             echo "Your C compiler executable failed with __printf__ format null."
10871             val="$undef"
10872         fi
10873     else
10874         echo "Your C compiler fails with __printf__ format null."
10875         val="$undef"
10876     fi
10877     ;;
10878     *)  val="$undef" ;;
10879     esac
10880 ;;
10881 *)  val="$d_printf_format_null" ;;
10882 esac
10883 set d_printf_format_null
10884 eval $setvar
10885 $rm -f attrib*
10886
10887 : Look for GCC-style attribute malloc
10888 case "$d_attribute_malloc" in
10889 '')
10890 echo " "
10891 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10892 $cat >attrib.c <<'EOCP'
10893 #include <stdio.h>
10894 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10895 EOCP
10896 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10897         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10898                 echo "Your C compiler doesn't support __attribute__((malloc))."
10899                 val="$undef"
10900         else
10901                 echo "Your C compiler supports __attribute__((malloc))."
10902                 val="$define"
10903         fi
10904 else
10905         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10906         val="$undef"
10907 fi
10908 ;;
10909 *) val="$d_attribute_malloc" ;;
10910 esac
10911 set d_attribute_malloc
10912 eval $setvar
10913 $rm -f attrib*
10914
10915 : Look for GCC-style attribute nonnull
10916 case "$d_attribute_nonnull" in
10917 '')
10918 echo " "
10919 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10920 $cat >attrib.c <<'EOCP'
10921 #include <stdio.h>
10922 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10923 EOCP
10924 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10925         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10926                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10927                 val="$undef"
10928         else
10929                 echo "Your C compiler supports __attribute__((nonnull))."
10930                 val="$define"
10931         fi
10932 else
10933         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10934         val="$undef"
10935 fi
10936 ;;
10937 *) val="$d_attribute_nonnull" ;;
10938 esac
10939 set d_attribute_nonnull
10940 eval $setvar
10941 $rm -f attrib*
10942
10943 : Look for GCC-style attribute noreturn
10944 case "$d_attribute_noreturn" in
10945 '')
10946 echo " "
10947 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10948 $cat >attrib.c <<'EOCP'
10949 #include <stdio.h>
10950 void fall_over_dead( void ) __attribute__((noreturn));
10951 EOCP
10952 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10953         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10954                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10955                 val="$undef"
10956         else
10957                 echo "Your C compiler supports __attribute__((noreturn))."
10958                 val="$define"
10959         fi
10960 else
10961         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10962         val="$undef"
10963 fi
10964 ;;
10965 *) val="$d_attribute_noreturn" ;;
10966 esac
10967 set d_attribute_noreturn
10968 eval $setvar
10969 $rm -f attrib*
10970
10971 : Look for GCC-style attribute pure
10972 case "$d_attribute_pure" in
10973 '')
10974 echo " "
10975 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10976 $cat >attrib.c <<'EOCP'
10977 #include <stdio.h>
10978 int square( int n ) __attribute__((pure));
10979 EOCP
10980 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10981         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10982                 echo "Your C compiler doesn't support __attribute__((pure))."
10983                 val="$undef"
10984         else
10985                 echo "Your C compiler supports __attribute__((pure))."
10986                 val="$define"
10987         fi
10988 else
10989         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10990         val="$undef"
10991 fi
10992 ;;
10993 *) val="$d_attribute_pure" ;;
10994 esac
10995 set d_attribute_pure
10996 eval $setvar
10997 $rm -f attrib*
10998
10999 : Look for GCC-style attribute unused
11000 case "$d_attribute_unused" in
11001 '')
11002 echo " "
11003 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
11004 $cat >attrib.c <<'EOCP'
11005 #include <stdio.h>
11006 int do_something( int dummy __attribute__((unused)), int n );
11007 EOCP
11008 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11009         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11010                 echo "Your C compiler doesn't support __attribute__((unused))."
11011                 val="$undef"
11012         else
11013                 echo "Your C compiler supports __attribute__((unused))."
11014                 val="$define"
11015         fi
11016 else
11017         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11018         val="$undef"
11019 fi
11020 ;;
11021 *) val="$d_attribute_unused" ;;
11022 esac
11023 set d_attribute_unused
11024 eval $setvar
11025 $rm -f attrib*
11026
11027 : Look for GCC-style attribute deprecated
11028 case "$d_attribute_deprecated" in
11029 '')
11030 echo " "
11031 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
11032 $cat >attrib.c <<'EOCP'
11033 #include <stdio.h>
11034 int I_am_deprecated(void) __attribute__((deprecated));
11035 EOCP
11036 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11037         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11038                 echo "Your C compiler doesn't support __attribute__((deprecated))."
11039                 val="$undef"
11040         else
11041                 echo "Your C compiler supports __attribute__((deprecated))."
11042                 val="$define"
11043         fi
11044 else
11045         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11046         val="$undef"
11047 fi
11048 ;;
11049 *) val="$d_attribute_deprecated" ;;
11050 esac
11051 set d_attribute_deprecated
11052 eval $setvar
11053 $rm -f attrib*
11054
11055 : Look for GCC-style attribute warn_unused_result
11056 case "$d_attribute_warn_unused_result" in
11057 '')
11058 echo " "
11059 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
11060 $cat >attrib.c <<'EOCP'
11061 #include <stdio.h>
11062 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
11063 EOCP
11064 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
11065         if $contains 'warning' attrib.out >/dev/null 2>&1; then
11066                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
11067                 val="$undef"
11068         else
11069                 echo "Your C compiler supports __attribute__((warn_unused_result))."
11070                 val="$define"
11071         fi
11072 else
11073         echo "Your C compiler doesn't seem to understand __attribute__ at all."
11074         val="$undef"
11075 fi
11076 ;;
11077 *) val="$d_attribute_warn_unused_result" ;;
11078 esac
11079 set d_attribute_warn_unused_result
11080 eval $setvar
11081 $rm -f attrib*
11082
11083 : see if bcmp exists
11084 set bcmp d_bcmp
11085 eval $inlibc
11086
11087 : see if bcopy exists
11088 set bcopy d_bcopy
11089 eval $inlibc
11090
11091 : see if getpgrp exists
11092 set getpgrp d_getpgrp
11093 eval $inlibc
11094
11095 case "$d_getpgrp" in
11096 "$define")
11097         echo " "
11098         echo "Checking to see which flavor of getpgrp is in use..."
11099         $cat >try.c <<EOP
11100 #$i_unistd I_UNISTD
11101 #include <sys/types.h>
11102 #ifdef I_UNISTD
11103 #  include <unistd.h>
11104 #endif
11105 #$i_stdlib I_STDLIB
11106 #ifdef I_STDLIB
11107 #include <stdlib.h>
11108 #endif
11109 int main()
11110 {
11111         if (getuid() == 0) {
11112                 printf("(I see you are running Configure as super-user...)\n");
11113                 setuid(1);
11114         }
11115 #ifdef TRY_BSD_PGRP
11116         if (getpgrp(1) == 0)
11117                 exit(0);
11118 #else
11119         if (getpgrp() > 0)
11120                 exit(0);
11121 #endif
11122         exit(1);
11123 }
11124 EOP
11125         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11126                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
11127                 val="$define"
11128         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11129                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
11130                 val="$undef"
11131         else
11132                 echo "I can't seem to compile and run the test program."
11133                 if ./usg; then
11134                         xxx="a USG one, i.e. you use getpgrp()."
11135                 else
11136                         # SVR4 systems can appear rather BSD-ish.
11137                         case "$i_unistd" in
11138                         $undef)
11139                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
11140                                 val="$define"
11141                                 ;;
11142                         $define)
11143                                 xxx="probably a USG one, i.e. you use getpgrp()."
11144                                 val="$undef"
11145                                 ;;
11146                         esac
11147                 fi
11148                 echo "Assuming your getpgrp is $xxx" >&4
11149         fi
11150         ;;
11151 *) val="$undef";;
11152 esac
11153 set d_bsdgetpgrp
11154 eval $setvar
11155 $rm_try
11156
11157 : see if setpgrp exists
11158 set setpgrp d_setpgrp
11159 eval $inlibc
11160
11161 case "$d_setpgrp" in
11162 "$define")
11163         echo " "
11164         echo "Checking to see which flavor of setpgrp is in use..."
11165         $cat >try.c <<EOP
11166 #$i_unistd I_UNISTD
11167 #include <sys/types.h>
11168 #ifdef I_UNISTD
11169 #  include <unistd.h>
11170 #endif
11171 #$i_stdlib I_STDLIB
11172 #ifdef I_STDLIB
11173 #include <stdlib.h>
11174 #endif
11175 int main()
11176 {
11177         if (getuid() == 0) {
11178                 printf("(I see you are running Configure as super-user...)\n");
11179                 setuid(1);
11180         }
11181 #ifdef TRY_BSD_PGRP
11182         if (-1 == setpgrp(1, 1))
11183                 exit(0);
11184 #else
11185         if (setpgrp() != -1)
11186                 exit(0);
11187 #endif
11188         exit(1);
11189 }
11190 EOP
11191         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11192                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
11193                 val="$define"
11194         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
11195                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
11196                 val="$undef"
11197         else
11198                 echo "(I can't seem to compile and run the test program.)"
11199                 if ./usg; then
11200                         xxx="a USG one, i.e. you use setpgrp()."
11201                 else
11202                         # SVR4 systems can appear rather BSD-ish.
11203                         case "$i_unistd" in
11204                         $undef)
11205                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
11206                                 val="$define"
11207                                 ;;
11208                         $define)
11209                                 xxx="probably a USG one, i.e. you use setpgrp()."
11210                                 val="$undef"
11211                                 ;;
11212                         esac
11213                 fi
11214                 echo "Assuming your setpgrp is $xxx" >&4
11215         fi
11216         ;;
11217 *) val="$undef";;
11218 esac
11219 set d_bsdsetpgrp
11220 eval $setvar
11221 $rm_try
11222
11223 : Look for GCC-style __builtin_choose_expr
11224 case "$d_builtin_choose_expr" in
11225 '')
11226     echo " "
11227     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
11228     $cat >try.c <<'EOCP'
11229 #include <assert.h>
11230 #include <stdlib.h>
11231 #include <stdio.h>
11232
11233 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
11234
11235 int main(void) {
11236     assert( SYRINX(1) == 2112 );
11237     assert( SYRINX(1) != 5150 );
11238     assert( SYRINX(0) == 5150 );
11239     assert( SYRINX(0) != 2112 );
11240     puts( "All good!" );
11241     exit(0);
11242 }
11243
11244 EOCP
11245     set try
11246     if eval $compile && $run ./try; then
11247         echo "Your C compiler supports __builtin_choose_expr."
11248         val="$define"
11249     else
11250         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
11251         val="$undef"
11252     fi
11253 ;;
11254 *) val="$d_builtin_choose_expr" ;;
11255 esac
11256
11257 set d_builtin_choose_expr
11258 eval $setvar
11259 $rm_try
11260
11261 : Look for GCC-style __builtin_expect
11262 case "$d_builtin_expect" in
11263 '')
11264     echo " "
11265     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
11266     $cat >try.c <<'EOCP'
11267 int main(void) {
11268     int n = 50;
11269     if ( __builtin_expect(n, 0) ) n = 1;
11270     /* Remember shell exit code truth is 0, C truth is non-zero */
11271     return !(n == 1);
11272 }
11273 EOCP
11274     set try
11275     if eval $compile && $run ./try; then
11276         echo "Your C compiler supports __builtin_expect."
11277         val="$define"
11278     else
11279         echo "Your C compiler doesn't seem to understand __builtin_expect."
11280         val="$undef"
11281     fi
11282     ;;
11283 *) val="$d_builtin_expect" ;;
11284 esac
11285
11286 set d_builtin_expect
11287 eval $setvar
11288 $rm_try
11289
11290 : see if bzero exists
11291 set bzero d_bzero
11292 eval $inlibc
11293
11294 : see if stdarg is available
11295 echo " "
11296 if $test `./findhdr stdarg.h`; then
11297         echo "<stdarg.h> found." >&4
11298         valstd="$define"
11299 else
11300         echo "<stdarg.h> NOT found." >&4
11301         valstd="$undef"
11302 fi
11303
11304 : see if varargs is available
11305 echo " "
11306 if $test `./findhdr varargs.h`; then
11307         echo "<varargs.h> found." >&4
11308 else
11309         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
11310 fi
11311
11312 : set up the varargs testing programs
11313 $cat > varargs.c <<EOP
11314 #ifdef I_STDARG
11315 #include <stdarg.h>
11316 #endif
11317 #ifdef I_VARARGS
11318 #include <varargs.h>
11319 #endif
11320
11321 #ifdef I_STDARG
11322 int f(char *p, ...)
11323 #else
11324 int f(va_alist)
11325 va_dcl
11326 #endif
11327 {
11328         va_list ap;
11329 #ifndef I_STDARG
11330         char *p;
11331 #endif
11332 #ifdef I_STDARG
11333         va_start(ap,p);
11334 #else
11335         va_start(ap);
11336         p = va_arg(ap, char *);
11337 #endif
11338         va_end(ap);
11339         return 0;
11340 }
11341 EOP
11342 $cat > varargs <<EOP
11343 $startsh
11344 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
11345         echo "true"
11346 else
11347         echo "false"
11348 fi
11349 $rm -f varargs$_o
11350 EOP
11351 chmod +x varargs
11352
11353 : now check which varargs header should be included
11354 echo " "
11355 i_varhdr=''
11356 val=''
11357 case "$valstd" in
11358 "$define")
11359         if `./varargs I_STDARG`; then
11360                 val='stdarg.h'
11361         elif `./varargs I_VARARGS`; then
11362                 val='varargs.h'
11363         fi
11364         ;;
11365 *)
11366         if `./varargs I_VARARGS`; then
11367                 val='varargs.h'
11368         fi
11369         ;;
11370 esac
11371 case "$val" in
11372 '')
11373         echo " "
11374         echo "*** WHOA THERE!!! ***" >&4
11375         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
11376         case "$knowitall" in
11377         '')
11378         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
11379                 exit 1
11380                 ;;
11381         esac
11382 echo "I could not find the definition for va_dcl... You have problems..." >&4
11383         val="$undef"; set i_stdarg; eval $setvar
11384         val="$undef"; set i_varargs; eval $setvar
11385         ;;
11386 *)
11387         set i_varhdr
11388         eval $setvar
11389         case "$i_varhdr" in
11390         stdarg.h)
11391                 val="$define"; set i_stdarg; eval $setvar
11392                 val="$undef"; set i_varargs; eval $setvar
11393                 ;;
11394         varargs.h)
11395                 val="$undef"; set i_stdarg; eval $setvar
11396                 val="$define"; set i_varargs; eval $setvar
11397                 ;;
11398         esac
11399         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
11400 esac
11401 $rm -f varargs*
11402
11403 : see if the Compiler supports C99 variadic macros
11404 case "$i_stdarg$i_stdlib" in
11405     "$define$define")
11406     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
11407     $cat >try.c <<EOCP
11408 #include <stdio.h>
11409 #include <stdarg.h>
11410
11411 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
11412
11413 int main() {
11414   char buf[20];
11415   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
11416   puts(buf);
11417   return 0;
11418 }
11419 EOCP
11420     set try
11421     if eval $compile && $run ./try 2>&1 >/dev/null; then
11422         case "`$run ./try`" in
11423             "123 456 789")
11424             echo "You have C99 variadic macros." >&4
11425             d_c99_variadic_macros="$define"
11426             ;;
11427             *)
11428             echo "You don't have functional C99 variadic macros." >&4
11429             d_c99_variadic_macros="$undef"
11430             ;;
11431         esac
11432     else
11433         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
11434         d_c99_variadic_macros="$undef"
11435     fi
11436     $rm_try
11437     ;;
11438     *)
11439     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
11440     d_c99_variadic_macros="$undef"
11441     ;;
11442 esac
11443
11444 : see if signal is declared as pointer to function returning int or void
11445 echo " "
11446 xxx=`./findhdr signal.h`
11447 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
11448 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
11449         echo "You have int (*signal())() instead of void." >&4
11450         val="$undef"
11451 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
11452         echo "You have void (*signal())()." >&4
11453         val="$define"
11454 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
11455         echo "You have int (*signal())() instead of void." >&4
11456         val="$undef"
11457 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
11458         echo "You have void (*signal())()." >&4
11459         val="$define"
11460 else
11461         case "$d_voidsig" in
11462         '')
11463         echo "I can't determine whether signal handler returns void or int..." >&4
11464                 dflt=void
11465                 rp="What type does your signal handler return?"
11466                 . ./myread
11467                 case "$ans" in
11468                 v*) val="$define";;
11469                 *) val="$undef";;
11470                 esac;;
11471         "$define")
11472                 echo "As you already told me, signal handler returns void." >&4
11473                 val="$define"
11474                 ;;
11475         *)      echo "As you already told me, signal handler returns int." >&4
11476                 val="$undef"
11477                 ;;
11478         esac
11479 fi
11480 set d_voidsig
11481 eval $setvar
11482 case "$d_voidsig" in
11483 "$define") signal_t="void";;
11484 *) signal_t="int";;
11485 esac
11486 $rm -f $$.tmp
11487
11488 : check for ability to cast large floats to 32-bit ints.
11489 echo " "
11490 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
11491 if $test "$intsize" -ge 4; then
11492         xxx=int
11493 else
11494         xxx=long
11495 fi
11496 $cat >try.c <<EOCP
11497 #include <stdio.h>
11498 #$i_stdlib I_STDLIB
11499 #ifdef I_STDLIB
11500 #include <stdlib.h>
11501 #endif
11502 #include <sys/types.h>
11503 #include <signal.h>
11504 $signal_t blech(int s) { exit(3); }
11505 int main()
11506 {
11507         $xxx i32;
11508         double f, g;
11509         int result = 0;
11510         char str[16];
11511         signal(SIGFPE, blech);
11512
11513         /* Don't let compiler optimize the test away.  Store the number
11514            in a writable string for gcc to pass to sscanf under HP-UX.
11515         */
11516         sprintf(str, "2147483647");
11517         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11518         g = 10 * f;
11519         i32  = ($xxx) g;
11520
11521         /* x86 processors will probably give 0x8000 0000, which is a
11522            sign change.  We don't want that.  We want to mimic SPARC
11523            behavior here, which is to preserve the sign and give
11524            back 0x7fff ffff.
11525         */
11526         if (i32 != ($xxx) f)
11527                 result |= 1;
11528         exit(result);
11529 }
11530 EOCP
11531 set try
11532 if eval $compile_ok; then
11533         $run ./try
11534         yyy=$?
11535 else
11536         echo "(I can't seem to compile the test program--assuming it can't)"
11537         yyy=1
11538 fi
11539 case "$yyy" in
11540 0)      val="$define"
11541         echo "Yup, it can."
11542         ;;
11543 *)      val="$undef"
11544         echo "Nope, it can't."
11545         ;;
11546 esac
11547 set d_casti32
11548 eval $setvar
11549 $rm_try
11550
11551 : check for ability to cast negative floats to unsigned
11552 echo " "
11553 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11554 $cat >try.c <<EOCP
11555 #include <stdio.h>
11556 #$i_stdlib I_STDLIB
11557 #ifdef I_STDLIB
11558 #include <stdlib.h>
11559 #endif
11560 #include <sys/types.h>
11561 #include <signal.h>
11562 $signal_t blech(int s) { exit(7); }
11563 $signal_t blech_in_list(int s) { exit(4); }
11564 unsigned long dummy_long(unsigned long p) { return p; }
11565 unsigned int dummy_int(unsigned int p) { return p; }
11566 unsigned short dummy_short(unsigned short p) { return p; }
11567 int main()
11568 {
11569         double f;
11570         unsigned long along;
11571         unsigned int aint;
11572         unsigned short ashort;
11573         int result = 0;
11574         char str[16];
11575
11576         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11577            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11578            optimized the whole file away
11579         */
11580         /* Store the number in a writable string for gcc to pass to
11581            sscanf under HP-UX.
11582         */
11583         sprintf(str, "-123");
11584         sscanf(str, "%lf", &f);  /* f = -123.; */
11585
11586         signal(SIGFPE, blech);
11587         along = (unsigned long)f;
11588         aint = (unsigned int)f;
11589         ashort = (unsigned short)f;
11590         if (along != (unsigned long)-123)
11591                 result |= 1;
11592         if (aint != (unsigned int)-123)
11593                 result |= 1;
11594         if (ashort != (unsigned short)-123)
11595                 result |= 1;
11596         sprintf(str, "1073741824.");
11597         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11598         f = f + f;
11599         along = 0;
11600         along = (unsigned long)f;
11601         if (along != 0x80000000)
11602                 result |= 2;
11603         f -= 1.;
11604         along = 0;
11605         along = (unsigned long)f;
11606         if (along != 0x7fffffff)
11607                 result |= 1;
11608         f += 2.;
11609         along = 0;
11610         along = (unsigned long)f;
11611         if (along != 0x80000001)
11612                 result |= 2;
11613         if (result)
11614                 exit(result);
11615         signal(SIGFPE, blech_in_list);
11616         sprintf(str, "123.");
11617         sscanf(str, "%lf", &f);  /* f = 123.; */
11618         along = dummy_long((unsigned long)f);
11619         aint = dummy_int((unsigned int)f);
11620         ashort = dummy_short((unsigned short)f);
11621         if (along != (unsigned long)123)
11622                 result |= 4;
11623         if (aint != (unsigned int)123)
11624                 result |= 4;
11625         if (ashort != (unsigned short)123)
11626                 result |= 4;
11627         exit(result);
11628
11629 }
11630 EOCP
11631 set try
11632 if eval $compile_ok; then
11633         $run ./try
11634         castflags=$?
11635 else
11636         echo "(I can't seem to compile the test program--assuming it can't)"
11637         castflags=7
11638 fi
11639 case "$castflags" in
11640 0)      val="$define"
11641         echo "Yup, it can."
11642         ;;
11643 *)      val="$undef"
11644         echo "Nope, it can't."
11645         ;;
11646 esac
11647 set d_castneg
11648 eval $setvar
11649 $rm_try
11650
11651 : see if vprintf exists
11652 echo " "
11653 if set vprintf val -f d_vprintf; eval $csym; $val; then
11654         echo 'vprintf() found.' >&4
11655         val="$define"
11656         $cat >try.c <<EOF
11657 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11658 #$i_varargs I_VARARGS
11659
11660 #$i_stdlib I_STDLIB
11661 #$i_unistd I_UNISTD
11662
11663 #ifdef I_STDARG
11664 #  include <stdarg.h>
11665 #else /* I_VARARGS */
11666 #  include <varargs.h>
11667 #endif
11668
11669 #ifdef I_UNISTD
11670 #  include <unistd.h>
11671 #endif
11672
11673 #ifdef I_STDLIB
11674 #  include <stdlib.h>
11675 #endif
11676
11677 #include <stdio.h> /* vsprintf prototype */
11678
11679 #ifdef I_STDARG
11680 void xxx(int n, ...)
11681 {
11682     va_list args;
11683     char buf[10];
11684     va_start(args, n);
11685     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11686 }
11687 int main() { xxx(1, "foo"); }
11688
11689 #else /* I_VARARGS */
11690
11691 xxx(va_alist)
11692 va_dcl
11693 {
11694     va_list args;
11695     char buf[10];
11696     va_start(args);
11697     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11698 }
11699 int main() { xxx("foo"); }
11700
11701 #endif
11702
11703 EOF
11704         set try
11705         if eval $compile_ok; then
11706                 if $run ./try; then
11707                         echo "Your vsprintf() returns (int)." >&4
11708                         val2="$undef"
11709                 else
11710                         echo "Your vsprintf() returns (char*)." >&4
11711                         val2="$define"
11712                 fi
11713         else
11714                 echo 'I am unable to compile the vsprintf() test program.' >&4
11715                 # We shouldn't get here.  If we do, assume the standard signature,
11716                 # not the old BSD one.
11717                 echo 'Guessing that vsprintf() returns (int).' >&4
11718                 val2="$undef"
11719         fi
11720 else
11721         echo 'vprintf() NOT found.' >&4
11722         val="$undef"
11723         val2="$undef"
11724 fi
11725 $rm_try
11726 set d_vprintf
11727 eval $setvar
11728 val=$val2
11729 set d_charvspr
11730 eval $setvar
11731
11732 : see if chown exists
11733 set chown d_chown
11734 eval $inlibc
11735
11736 : see if chroot exists
11737 set chroot d_chroot
11738 eval $inlibc
11739
11740 : see if chsize exists
11741 set chsize d_chsize
11742 eval $inlibc
11743
11744 : see if class exists
11745 set class d_class
11746 eval $inlibc
11747
11748 : see if clearenv exists
11749 set clearenv d_clearenv
11750 eval $inlibc
11751
11752 : Define hasstruct macro for Configure internal use
11753 hasstruct='varname=$1; struct=$2; shift; shift;
11754 while $test $# -ge 2; do
11755         case "$1" in
11756         $define) echo "#include <$2>";;
11757         esac ;
11758     shift 2;
11759 done > try.c;
11760 echo "int main () { struct $struct foo; }" >> try.c;
11761 set try;
11762 if eval $compile; then
11763         val="$define";
11764 else
11765         val="$undef";
11766 fi;
11767 set $varname;
11768 eval $setvar;
11769 $rm_try'
11770
11771 : see whether socket exists
11772 socketlib=''
11773 sockethdr=''
11774 echo " "
11775 $echo $n "Hmm... $c" >&4
11776 if set socket val -f d_socket; eval $csym; $val; then
11777     echo "Looks like you have Berkeley networking support." >&4
11778     d_socket="$define"
11779     if set setsockopt val -f; eval $csym; $val; then
11780         d_oldsock="$undef"
11781     else
11782         echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11783         d_oldsock="$define"
11784     fi
11785 else
11786     if $contains socklib libc.list >/dev/null 2>&1; then
11787         echo "Looks like you have Berkeley networking support." >&4
11788         d_socket="$define"
11789         : we will have to assume that it supports the 4.2 BSD interface
11790         d_oldsock="$undef"
11791     else
11792         echo "You don't have Berkeley networking in libc$_a..." >&4
11793         if test "X$d_socket" = "X$define"; then
11794             echo "...but you seem to believe that you have sockets." >&4
11795         else
11796             for net in net socket
11797             do
11798                 if test -f $sysroot/usr/lib/lib$net$_a; then
11799                     ( ($nm $nm_opt $sysroot/usr/lib/lib$net$_a | eval $nm_extract) ||  \
11800                     $ar t $sysroot/usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11801                     if $contains socket libc.list >/dev/null 2>&1; then
11802                         d_socket="$define"
11803                         socketlib="-l$net"
11804                         case "$net" in
11805                         net)
11806                             echo "...but the Wollongong group seems to have hacked it in." >&4
11807                             sockethdr="-I$sysroot/usr/netinclude"
11808                             ;;
11809                         esac
11810                         echo "Found Berkeley sockets interface in lib$net." >&4
11811                         if $contains setsockopt libc.list >/dev/null 2>&1; then
11812                             d_oldsock="$undef"
11813                         else
11814                             echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11815                             d_oldsock="$define"
11816                         fi
11817                         break
11818                     fi
11819                 fi
11820             done
11821             if test "X$d_socket" != "X$define"; then
11822                echo "or anywhere else I see." >&4
11823                d_socket="$undef"
11824                d_oldsock="$undef"
11825             fi
11826         fi
11827     fi
11828 fi
11829
11830 : see if socketpair exists
11831 set socketpair d_sockpair
11832 eval $inlibc
11833
11834
11835 echo " "
11836 echo "Checking the availability sa_len in the sock struct ..." >&4
11837 $cat >try.c <<EOF
11838 #include <sys/types.h>
11839 #include <sys/socket.h>
11840 int main() {
11841 struct sockaddr sa;
11842 return (sa.sa_len);
11843 }
11844 EOF
11845 val="$undef"
11846 set try; if eval $compile; then
11847     val="$define"
11848 fi
11849 set d_sockaddr_sa_len; eval $setvar
11850 $rm_try
11851
11852 echo " "
11853 echo "Checking the availability struct sockaddr_in6 ..." >&4
11854 $cat >try.c <<EOF
11855 #include <sys/types.h>
11856 #include <sys/socket.h>
11857 #include <netinet/in.h>
11858 int main() {
11859 struct sockaddr_in6 sin6;
11860 return (sin6.sin6_family);
11861 }
11862 EOF
11863 val="$undef"
11864 set try; if eval $compile; then
11865     val="$define"
11866 fi
11867 set d_sockaddr_in6; eval $setvar
11868 $rm_try
11869
11870 echo " "
11871 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11872 $cat >try.c <<EOF
11873 #include <sys/types.h>
11874 #include <sys/socket.h>
11875 #include <netinet/in.h>
11876 int main() {
11877 struct sockaddr_in6 sin6;
11878 return (sin6.sin6_scope_id);
11879 }
11880 EOF
11881 val="$undef"
11882 set try; if eval $compile; then
11883     val="$define"
11884 fi
11885 set d_sin6_scope_id; eval $setvar
11886 $rm_try
11887
11888 echo " "
11889 echo "Checking the availability struct ip_mreq ..." >&4
11890 $cat >try.c <<EOF
11891 #include <sys/types.h>
11892 #include <sys/socket.h>
11893 #include <netinet/in.h>
11894 int main() {
11895 struct ip_mreq mreq;
11896 return (mreq.imr_multiaddr.s_addr);
11897 }
11898 EOF
11899 val="$undef"
11900 set try; if eval $compile; then
11901        val="$define"
11902 fi
11903 set d_ip_mreq; eval $setvar
11904 $rm_try
11905
11906 echo " "
11907 echo "Checking the availability struct ip_mreq_source ..." >&4
11908 $cat >try.c <<EOF
11909 #include <sys/types.h>
11910 #include <sys/socket.h>
11911 #include <netinet/in.h>
11912 int main() {
11913 struct ip_mreq_source mreq;
11914 return (mreq.imr_multiaddr.s_addr);
11915 }
11916 EOF
11917 val="$undef"
11918 set try; if eval $compile; then
11919        val="$define"
11920 fi
11921 set d_ip_mreq_source; eval $setvar
11922 $rm_try
11923
11924 echo " "
11925 echo "Checking the availability struct ipv6_mreq ..." >&4
11926 $cat >try.c <<EOF
11927 #include <sys/types.h>
11928 #include <sys/socket.h>
11929 #include <netinet/in.h>
11930 int main() {
11931 struct ipv6_mreq mreq;
11932 return (mreq.ipv6mr_interface);
11933 }
11934 EOF
11935 val="$undef"
11936 set try; if eval $compile; then
11937     val="$define"
11938 fi
11939 set d_ipv6_mreq; eval $setvar
11940 $rm_try
11941
11942 echo " "
11943 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11944 $cat >try.c <<EOF
11945 #include <sys/types.h>
11946 #include <sys/socket.h>
11947 #include <netinet/in.h>
11948 int main() {
11949 struct ipv6_mreq_source mreq;
11950 return (mreq.imr_multiaddr.s_addr);
11951 }
11952 EOF
11953 val="$undef"
11954 set try; if eval $compile; then
11955        val="$define"
11956 fi
11957 set d_ipv6_mreq_source; eval $setvar
11958 $rm_try
11959
11960 echo " "
11961 echo "Checking the availability of certain socket constants..." >&4
11962 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11963     enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11964     $cat >try.c <<EOF
11965 #include <sys/types.h>
11966 #include <sys/socket.h>
11967 int main() {
11968     int i = $ENUM;
11969 }
11970 EOF
11971     val="$undef"
11972     set try; if eval $compile; then
11973         val="$define"
11974     fi
11975     set d_${enum}; eval $setvar
11976     $rm_try
11977 done
11978
11979 : see if this is a sys/uio.h system
11980 set sys/uio.h i_sysuio
11981 eval $inhdr
11982
11983 : Check for cmsghdr support
11984 echo " "
11985 echo "Checking to see if your system supports struct cmsghdr..." >&4
11986 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11987 eval $hasstruct
11988 case "$d_cmsghdr_s" in
11989 "$define")      echo "Yes, it does."   ;;
11990 *)              echo "No, it doesn't." ;;
11991 esac
11992
11993
11994 : check for const keyword
11995 echo " "
11996 echo 'Checking to see if your C compiler knows about "const"...' >&4
11997 $cat >const.c <<'EOCP'
11998 typedef struct spug { int drokk; } spug;
11999 int main()
12000 {
12001         const char *foo;
12002         const spug y = { 0 };
12003 }
12004 EOCP
12005 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
12006         val="$define"
12007         echo "Yup, it does."
12008 else
12009         val="$undef"
12010         echo "Nope, it doesn't."
12011 fi
12012 set d_const
12013 eval $setvar
12014
12015 : see if copysignl exists
12016 set copysignl d_copysignl
12017 eval $inlibc
12018
12019 : see if crypt exists
12020 echo " "
12021 set crypt d_crypt
12022 eval $inlibc
12023 case "$d_crypt" in
12024 $define) cryptlib='' ;;
12025 *)      if set crypt val -f d_crypt; eval $csym; $val; then
12026                 echo 'crypt() found.' >&4
12027                 val="$define"
12028                 cryptlib=''
12029         else
12030                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
12031                 if $test -z "$cryptlib"; then
12032                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
12033                 else
12034                         cryptlib=-lcrypt
12035                 fi
12036                 if $test -z "$cryptlib"; then
12037                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
12038                 else
12039                         cryptlib=-lcrypt
12040                 fi
12041                 if $test -z "$cryptlib"; then
12042                         cryptlib=`./loc libcrypt$_a "" $libpth`
12043                 else
12044                         cryptlib=-lcrypt
12045                 fi
12046                 if $test -z "$cryptlib"; then
12047                         echo 'crypt() NOT found.' >&4
12048                         val="$undef"
12049                 else
12050                         val="$define"
12051                 fi
12052         fi
12053         set d_crypt
12054         eval $setvar
12055         ;;
12056 esac
12057
12058 : see if this is a crypt.h system
12059 set crypt.h i_crypt
12060 eval $inhdr
12061
12062 : see if crypt_r exists
12063 set crypt_r d_crypt_r
12064 eval $inlibc
12065 case "$d_crypt_r" in
12066 "$define")
12067         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
12068         case "$d_crypt_r_proto:$usethreads" in
12069         ":define")      d_crypt_r_proto=define
12070                 set d_crypt_r_proto crypt_r $hdrs
12071                 eval $hasproto ;;
12072         *)      ;;
12073         esac
12074         case "$d_crypt_r_proto" in
12075         define)
12076         case "$crypt_r_proto" in
12077         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
12078         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
12079         esac
12080         case "$crypt_r_proto" in
12081         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
12082         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
12083         esac
12084         case "$crypt_r_proto" in
12085         ''|0)   d_crypt_r=undef
12086                 crypt_r_proto=0
12087                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
12088         * )     case "$crypt_r_proto" in
12089                 REENTRANT_PROTO*) ;;
12090                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
12091                 esac
12092                 echo "Prototype: $try" ;;
12093         esac
12094         ;;
12095         *)      case "$usethreads" in
12096                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
12097                 esac
12098                 d_crypt_r=undef
12099                 crypt_r_proto=0
12100                 ;;
12101         esac
12102         ;;
12103 *)      crypt_r_proto=0
12104         ;;
12105 esac
12106
12107 : get csh whereabouts
12108 case "$csh" in
12109 'csh') val="$undef" ;;
12110 *) val="$define" ;;
12111 esac
12112 set d_csh
12113 eval $setvar
12114 : Respect a hint or command line value for full_csh.
12115 case "$full_csh" in
12116 '') full_csh=$csh ;;
12117 esac
12118
12119 : see if ctermid exists
12120 set ctermid d_ctermid
12121 eval $inlibc
12122
12123 : see if ctermid_r exists
12124 set ctermid_r d_ctermid_r
12125 eval $inlibc
12126 case "$d_ctermid_r" in
12127 "$define")
12128         hdrs="$i_systypes sys/types.h define stdio.h "
12129         case "$d_ctermid_r_proto:$usethreads" in
12130         ":define")      d_ctermid_r_proto=define
12131                 set d_ctermid_r_proto ctermid_r $hdrs
12132                 eval $hasproto ;;
12133         *)      ;;
12134         esac
12135         case "$d_ctermid_r_proto" in
12136         define)
12137         case "$ctermid_r_proto" in
12138         ''|0) try='char* ctermid_r(char*);'
12139         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
12140         esac
12141         case "$ctermid_r_proto" in
12142         ''|0)   d_ctermid_r=undef
12143                 ctermid_r_proto=0
12144                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
12145         * )     case "$ctermid_r_proto" in
12146                 REENTRANT_PROTO*) ;;
12147                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
12148                 esac
12149                 echo "Prototype: $try" ;;
12150         esac
12151         ;;
12152         *)      case "$usethreads" in
12153                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
12154                 esac
12155                 d_ctermid_r=undef
12156                 ctermid_r_proto=0
12157                 ;;
12158         esac
12159         ;;
12160 *)      ctermid_r_proto=0
12161         ;;
12162 esac
12163
12164 : see if ctime_r exists
12165 set ctime_r d_ctime_r
12166 eval $inlibc
12167 case "$d_ctime_r" in
12168 "$define")
12169         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
12170         case "$d_ctime_r_proto:$usethreads" in
12171         ":define")      d_ctime_r_proto=define
12172                 set d_ctime_r_proto ctime_r $hdrs
12173                 eval $hasproto ;;
12174         *)      ;;
12175         esac
12176         case "$d_ctime_r_proto" in
12177         define)
12178         case "$ctime_r_proto" in
12179         ''|0) try='char* ctime_r(const time_t*, char*);'
12180         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
12181         esac
12182         case "$ctime_r_proto" in
12183         ''|0) try='char* ctime_r(const time_t*, char*, int);'
12184         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
12185         esac
12186         case "$ctime_r_proto" in
12187         ''|0) try='int ctime_r(const time_t*, char*);'
12188         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
12189         esac
12190         case "$ctime_r_proto" in
12191         ''|0) try='int ctime_r(const time_t*, char*, int);'
12192         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
12193         esac
12194         case "$ctime_r_proto" in
12195         ''|0)   d_ctime_r=undef
12196                 ctime_r_proto=0
12197                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
12198         * )     case "$ctime_r_proto" in
12199                 REENTRANT_PROTO*) ;;
12200                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
12201                 esac
12202                 echo "Prototype: $try" ;;
12203         esac
12204         ;;
12205         *)      case "$usethreads" in
12206                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
12207                 esac
12208                 d_ctime_r=undef
12209                 ctime_r_proto=0
12210                 ;;
12211         esac
12212         ;;
12213 *)      ctime_r_proto=0
12214         ;;
12215 esac
12216
12217 : see if cuserid exists
12218 set cuserid d_cuserid
12219 eval $inlibc
12220
12221 : see if this is a limits.h system
12222 set limits.h i_limits
12223 eval $inhdr
12224
12225 : See if number of significant digits in a double precision number is known
12226 echo " "
12227 $cat >dbl_dig.c <<EOM
12228 #$i_limits I_LIMITS
12229 #$i_float I_FLOAT
12230 #ifdef I_LIMITS
12231 #include <limits.h>
12232 #endif
12233 #ifdef I_FLOAT
12234 #include <float.h>
12235 #endif
12236 #ifdef DBL_DIG
12237 printf("Contains DBL_DIG");
12238 #endif
12239 EOM
12240 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
12241 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
12242         echo "DBL_DIG found." >&4
12243         val="$define"
12244 else
12245         echo "DBL_DIG NOT found." >&4
12246         val="$undef"
12247 fi
12248 $rm -f dbl_dig.?
12249 set d_dbl_dig
12250 eval $setvar
12251
12252 : see if dbm.h is available
12253 : see if dbmclose exists
12254 set dbmclose d_dbmclose
12255 eval $inlibc
12256
12257 case "$d_dbmclose" in
12258 $define)
12259         set dbm.h i_dbm
12260         eval $inhdr
12261         case "$i_dbm" in
12262         $define)
12263                 val="$undef"
12264                 set i_rpcsvcdbm
12265                 eval $setvar
12266                 ;;
12267         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12268                 eval $inhdr
12269                 ;;
12270         esac
12271         ;;
12272 *)      echo "We won't be including <dbm.h>"
12273         val="$undef"
12274         set i_dbm
12275         eval $setvar
12276         val="$undef"
12277         set i_rpcsvcdbm
12278         eval $setvar
12279         ;;
12280 esac
12281
12282 : see if prototype for dbminit is available
12283 echo " "
12284 set d_dbminitproto dbminit $i_dbm dbm.h
12285 eval $hasproto
12286
12287 : see if difftime exists
12288 set difftime d_difftime
12289 eval $inlibc
12290
12291 : see if this is a dirent system
12292 echo " "
12293 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
12294         val="$define"
12295         echo "<dirent.h> found." >&4
12296 else
12297         val="$undef"
12298         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
12299                 echo "<sys/dir.h> found." >&4
12300                 echo " "
12301         else
12302                 xinc=`./findhdr sys/ndir.h`
12303         fi
12304         echo "<dirent.h> NOT found." >&4
12305 fi
12306 set i_dirent
12307 eval $setvar
12308
12309 : Look for type of directory structure.
12310 echo " "
12311 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12312
12313 case "$direntrytype" in
12314 ''|' ')
12315         case "$i_dirent" in
12316         $define) guess1='struct dirent' ;;
12317         *) guess1='struct direct'  ;;
12318         esac
12319         ;;
12320 *)      guess1="$direntrytype"
12321         ;;
12322 esac
12323
12324 case "$guess1" in
12325 'struct dirent') guess2='struct direct' ;;
12326 *) guess2='struct dirent' ;;
12327 esac
12328
12329 if $contains "$guess1" try.c >/dev/null 2>&1; then
12330         direntrytype="$guess1"
12331         echo "Your directory entries are $direntrytype." >&4
12332 elif $contains "$guess2" try.c >/dev/null 2>&1; then
12333         direntrytype="$guess2"
12334         echo "Your directory entries seem to be $direntrytype." >&4
12335 else
12336         echo "I don't recognize your system's directory entries." >&4
12337         rp="What type is used for directory entries on this system?"
12338         dflt="$guess1"
12339         . ./myread
12340         direntrytype="$ans"
12341 fi
12342 $rm_try
12343
12344 : see if the directory entry stores field length
12345 echo " "
12346 $cppstdin $cppflags $cppminus < "$xinc" > try.c
12347 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
12348         echo "Good, your directory entry keeps length information in d_namlen." >&4
12349         val="$define"
12350 else
12351         echo "Your directory entry does not know about the d_namlen field." >&4
12352         val="$undef"
12353 fi
12354 set d_dirnamlen
12355 eval $setvar
12356 $rm_try
12357
12358 : Look for DIR.dd_fd
12359 case "$i_dirent" in
12360 "$define")
12361     echo "Checking to see if DIR has a dd_fd member variable" >&4
12362     $cat >try.c <<EOCP
12363 #$i_stdlib I_STDLIB
12364 #ifdef I_STDLIB
12365 #include <stdlib.h>
12366 #endif
12367 #include <dirent.h>
12368
12369 int main() {
12370     DIR dir;
12371     dir.dd_fd = 1;
12372     return 0;
12373 }
12374 EOCP
12375     val=$undef
12376     set try
12377     if eval $compile; then
12378         echo "Yes, it does."
12379         val="$define"
12380     else
12381         echo "No, it does not."
12382         val="$undef"
12383     fi
12384     ;;
12385 *)
12386     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
12387     val="$undef"
12388     ;;
12389 esac
12390 set d_dir_dd_fd
12391 eval $setvar
12392 $rm_try
12393
12394 : see if this is an sysdir system
12395 set sys/dir.h i_sysdir
12396 eval $inhdr
12397
12398 : see if this is an sysndir system
12399 set sys/ndir.h i_sysndir
12400 eval $inhdr
12401
12402 : Look for dirfd
12403 echo " "
12404 $cat >dirfd.c <<EOM
12405 #include <stdio.h>
12406 #$i_stdlib I_STDLIB
12407 #ifdef I_STDLIB
12408 #include <stdlib.h>
12409 #endif
12410 #$i_dirent I_DIRENT             /**/
12411 #$i_sysdir I_SYS_DIR            /**/
12412 #$i_sysndir I_SYS_NDIR          /**/
12413 #$i_systypes I_SYS_TYPES        /**/
12414 #if defined(I_SYS_TYPES)
12415 #include <sys/types.h>
12416 #endif
12417 #if defined(I_DIRENT)
12418 #include <dirent.h>
12419 #else
12420 #ifdef I_SYS_NDIR
12421 #include <sys/ndir.h>
12422 #else
12423 #ifdef I_SYS_DIR
12424 #ifdef hp9000s500
12425 #include <ndir.h>       /* may be wrong in the future */
12426 #else
12427 #include <sys/dir.h>
12428 #endif
12429 #endif
12430 #endif
12431 #endif
12432 int main() {
12433         DIR *dirp = opendir(".");
12434         if (dirfd(dirp) >= 0)
12435                 exit(0);
12436         else
12437                 exit(1);
12438 }
12439 EOM
12440 val=$undef
12441 set dirfd
12442 if eval $compile; then
12443         val="$define"
12444 fi
12445 case "$val" in
12446 $define)        echo "dirfd() found." >&4       ;;
12447 *)              echo "dirfd() NOT found." >&4   ;;
12448 esac
12449 set d_dirfd
12450 eval $setvar
12451 $rm -f dirfd*
12452
12453 : see if dladdr exists
12454 set dladdr d_dladdr
12455 eval $inlibc
12456
12457 : see if dlerror exists
12458 xxx_runnm="$runnm"
12459 runnm=false
12460 set dlerror d_dlerror
12461 eval $inlibc
12462 runnm="$xxx_runnm"
12463
12464 : see if dlfcn is available
12465 set dlfcn.h i_dlfcn
12466 eval $inhdr
12467
12468 : Check what extension to use for shared libs
12469 case "$usedl" in
12470 $define|y|true)
12471         $cat << EOM
12472
12473 On a few systems, the dynamically loaded modules that perl generates and uses
12474 will need a different extension than shared libs. The default will probably
12475 be appropriate.
12476
12477 EOM
12478         case "$dlext" in
12479         '')     dflt="$so" ;;
12480         *)      dflt="$dlext" ;;
12481         esac
12482         rp='What is the extension of dynamically loaded modules'
12483         . ./myread
12484         dlext="$ans"
12485         ;;
12486 *)
12487         dlext="none"
12488         ;;
12489 esac
12490
12491 : Check if dlsym need a leading underscore
12492 echo " "
12493 val="$undef"
12494
12495 case "$dlsrc" in
12496 dl_dlopen.xs)
12497         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
12498         $cat >dyna.c <<'EOM'
12499 fred () { }
12500 EOM
12501
12502 $cat >fred.c<<EOM
12503
12504 #include <stdio.h>
12505 #$i_stdlib I_STDLIB
12506 #ifdef I_STDLIB
12507 #include <stdlib.h>
12508 #endif
12509 #$i_dlfcn I_DLFCN
12510 #ifdef I_DLFCN
12511 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
12512 #else
12513 #include <sys/types.h>
12514 #include <nlist.h>
12515 #include <link.h>
12516 #endif
12517
12518 extern int fred() ;
12519
12520 int main()
12521 {
12522     void * handle ;
12523     void * symbol ;
12524 #ifndef RTLD_LAZY
12525     int mode = 1 ;
12526 #else
12527     int mode = RTLD_LAZY ;
12528 #endif
12529     handle = dlopen("./dyna.$dlext", mode) ;
12530     if (handle == NULL) {
12531         printf ("1\n") ;
12532         fflush (stdout) ;
12533         exit(0);
12534     }
12535     symbol = dlsym(handle, "fred") ;
12536     if (symbol == NULL) {
12537         /* try putting a leading underscore */
12538         symbol = dlsym(handle, "_fred") ;
12539         if (symbol == NULL) {
12540             printf ("2\n") ;
12541             fflush (stdout) ;
12542             exit(0);
12543         }
12544         printf ("3\n") ;
12545     }
12546     else
12547         printf ("4\n") ;
12548     fflush (stdout) ;
12549     exit(0);
12550 }
12551 EOM
12552         : Call the object file tmp-dyna.o in case dlext=o.
12553         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12554                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12555                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12556                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12557                 xxx=`$run ./fred`
12558                 case $xxx in
12559                 1)      echo "Test program failed using dlopen." >&4
12560                         echo "Perhaps you should not use dynamic loading." >&4;;
12561                 2)      echo "Test program failed using dlsym." >&4
12562                         echo "Perhaps you should not use dynamic loading." >&4;;
12563                 3)      echo "dlsym needs a leading underscore" >&4
12564                         val="$define" ;;
12565                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12566                 esac
12567         else
12568                 echo "I can't compile and run the test program." >&4
12569                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12570         fi
12571         ;;
12572 esac
12573
12574 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12575
12576 set d_dlsymun
12577 eval $setvar
12578
12579 : see if drand48_r exists
12580 set drand48_r d_drand48_r
12581 eval $inlibc
12582 case "$d_drand48_r" in
12583 "$define")
12584         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12585         case "$d_drand48_r_proto:$usethreads" in
12586         ":define")      d_drand48_r_proto=define
12587                 set d_drand48_r_proto drand48_r $hdrs
12588                 eval $hasproto ;;
12589         *)      ;;
12590         esac
12591         case "$d_drand48_r_proto" in
12592         define)
12593         case "$drand48_r_proto" in
12594         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12595         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12596         esac
12597         case "$drand48_r_proto" in
12598         ''|0)   d_drand48_r=undef
12599                 drand48_r_proto=0
12600                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12601         * )     case "$drand48_r_proto" in
12602                 REENTRANT_PROTO*) ;;
12603                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12604                 esac
12605                 echo "Prototype: $try" ;;
12606         esac
12607         ;;
12608         *)      case "$usethreads" in
12609                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12610                 esac
12611                 d_drand48_r=undef
12612                 drand48_r_proto=0
12613                 ;;
12614         esac
12615         ;;
12616 *)      drand48_r_proto=0
12617         ;;
12618 esac
12619
12620 : see if prototype for drand48 is available
12621 echo " "
12622 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12623 eval $hasproto
12624
12625 : see if dup2 exists
12626 set dup2 d_dup2
12627 eval $inlibc
12628
12629 : see if eaccess exists
12630 set eaccess d_eaccess
12631 eval $inlibc
12632
12633 : see if endgrent exists
12634 set endgrent d_endgrent
12635 eval $inlibc
12636
12637 : see if this is an grp system
12638 set grp.h i_grp
12639 eval $inhdr
12640
12641 case "$i_grp" in
12642 $define)
12643         xxx=`./findhdr grp.h`
12644         $cppstdin $cppflags $cppminus < $xxx >$$.h
12645
12646         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12647                 val="$define"
12648         else
12649                 val="$undef"
12650         fi
12651         set d_grpasswd
12652         eval $setvar
12653
12654         $rm -f $$.h
12655         ;;
12656 *)
12657         val="$undef";
12658         set d_grpasswd; eval $setvar
12659         ;;
12660 esac
12661
12662 : see if endgrent_r exists
12663 set endgrent_r d_endgrent_r
12664 eval $inlibc
12665 case "$d_endgrent_r" in
12666 "$define")
12667         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12668         case "$d_endgrent_r_proto:$usethreads" in
12669         ":define")      d_endgrent_r_proto=define
12670                 set d_endgrent_r_proto endgrent_r $hdrs
12671                 eval $hasproto ;;
12672         *)      ;;
12673         esac
12674         case "$d_endgrent_r_proto" in
12675         define)
12676         case "$endgrent_r_proto" in
12677         ''|0) try='int endgrent_r(FILE**);'
12678         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12679         esac
12680         case "$endgrent_r_proto" in
12681         ''|0) try='void endgrent_r(FILE**);'
12682         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12683         esac
12684         case "$endgrent_r_proto" in
12685         ''|0)   d_endgrent_r=undef
12686                 endgrent_r_proto=0
12687                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12688         * )     case "$endgrent_r_proto" in
12689                 REENTRANT_PROTO*) ;;
12690                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12691                 esac
12692                 echo "Prototype: $try" ;;
12693         esac
12694         ;;
12695         *)      case "$usethreads" in
12696                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12697                 esac
12698                 d_endgrent_r=undef
12699                 endgrent_r_proto=0
12700                 ;;
12701         esac
12702         ;;
12703 *)      endgrent_r_proto=0
12704         ;;
12705 esac
12706
12707 : see if endhostent exists
12708 set endhostent d_endhent
12709 eval $inlibc
12710
12711 : see if this is a netdb.h system
12712 set netdb.h i_netdb
12713 eval $inhdr
12714
12715 : see if endhostent_r exists
12716 set endhostent_r d_endhostent_r
12717 eval $inlibc
12718 case "$d_endhostent_r" in
12719 "$define")
12720         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12721         case "$d_endhostent_r_proto:$usethreads" in
12722         ":define")      d_endhostent_r_proto=define
12723                 set d_endhostent_r_proto endhostent_r $hdrs
12724                 eval $hasproto ;;
12725         *)      ;;
12726         esac
12727         case "$d_endhostent_r_proto" in
12728         define)
12729         case "$endhostent_r_proto" in
12730         ''|0) try='int endhostent_r(struct hostent_data*);'
12731         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12732         esac
12733         case "$endhostent_r_proto" in
12734         ''|0) try='void endhostent_r(struct hostent_data*);'
12735         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12736         esac
12737         case "$endhostent_r_proto" in
12738         ''|0)   d_endhostent_r=undef
12739                 endhostent_r_proto=0
12740                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12741         * )     case "$endhostent_r_proto" in
12742                 REENTRANT_PROTO*) ;;
12743                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12744                 esac
12745                 echo "Prototype: $try" ;;
12746         esac
12747         ;;
12748         *)      case "$usethreads" in
12749                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12750                 esac
12751                 d_endhostent_r=undef
12752                 endhostent_r_proto=0
12753                 ;;
12754         esac
12755         ;;
12756 *)      endhostent_r_proto=0
12757         ;;
12758 esac
12759
12760 : see if endnetent exists
12761 set endnetent d_endnent
12762 eval $inlibc
12763
12764 : see if endnetent_r exists
12765 set endnetent_r d_endnetent_r
12766 eval $inlibc
12767 case "$d_endnetent_r" in
12768 "$define")
12769         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12770         case "$d_endnetent_r_proto:$usethreads" in
12771         ":define")      d_endnetent_r_proto=define
12772                 set d_endnetent_r_proto endnetent_r $hdrs
12773                 eval $hasproto ;;
12774         *)      ;;
12775         esac
12776         case "$d_endnetent_r_proto" in
12777         define)
12778         case "$endnetent_r_proto" in
12779         ''|0) try='int endnetent_r(struct netent_data*);'
12780         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12781         esac
12782         case "$endnetent_r_proto" in
12783         ''|0) try='void endnetent_r(struct netent_data*);'
12784         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12785         esac
12786         case "$endnetent_r_proto" in
12787         ''|0)   d_endnetent_r=undef
12788                 endnetent_r_proto=0
12789                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12790         * )     case "$endnetent_r_proto" in
12791                 REENTRANT_PROTO*) ;;
12792                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12793                 esac
12794                 echo "Prototype: $try" ;;
12795         esac
12796         ;;
12797         *)      case "$usethreads" in
12798                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12799                 esac
12800                 d_endnetent_r=undef
12801                 endnetent_r_proto=0
12802                 ;;
12803         esac
12804         ;;
12805 *)      endnetent_r_proto=0
12806         ;;
12807 esac
12808
12809 : see if endprotoent exists
12810 set endprotoent d_endpent
12811 eval $inlibc
12812
12813 : see if endprotoent_r exists
12814 set endprotoent_r d_endprotoent_r
12815 eval $inlibc
12816 case "$d_endprotoent_r" in
12817 "$define")
12818         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12819         case "$d_endprotoent_r_proto:$usethreads" in
12820         ":define")      d_endprotoent_r_proto=define
12821                 set d_endprotoent_r_proto endprotoent_r $hdrs
12822                 eval $hasproto ;;
12823         *)      ;;
12824         esac
12825         case "$d_endprotoent_r_proto" in
12826         define)
12827         case "$endprotoent_r_proto" in
12828         ''|0) try='int endprotoent_r(struct protoent_data*);'
12829         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12830         esac
12831         case "$endprotoent_r_proto" in
12832         ''|0) try='void endprotoent_r(struct protoent_data*);'
12833         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12834         esac
12835         case "$endprotoent_r_proto" in
12836         ''|0)   d_endprotoent_r=undef
12837                 endprotoent_r_proto=0
12838                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12839         * )     case "$endprotoent_r_proto" in
12840                 REENTRANT_PROTO*) ;;
12841                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12842                 esac
12843                 echo "Prototype: $try" ;;
12844         esac
12845         ;;
12846         *)      case "$usethreads" in
12847                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12848                 esac
12849                 d_endprotoent_r=undef
12850                 endprotoent_r_proto=0
12851                 ;;
12852         esac
12853         ;;
12854 *)      endprotoent_r_proto=0
12855         ;;
12856 esac
12857
12858 : see if endpwent exists
12859 set endpwent d_endpwent
12860 eval $inlibc
12861
12862 : see if this is a pwd.h system
12863 set pwd.h i_pwd
12864 eval $inhdr
12865
12866 case "$i_pwd" in
12867 $define)
12868         xxx=`./findhdr pwd.h`
12869         $cppstdin $cppflags $cppminus < $xxx >$$.h
12870
12871         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12872                 val="$define"
12873         else
12874                 val="$undef"
12875         fi
12876         set d_pwquota
12877         eval $setvar
12878
12879         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12880                 val="$define"
12881         else
12882                 val="$undef"
12883         fi
12884         set d_pwage
12885         eval $setvar
12886
12887         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12888                 val="$define"
12889         else
12890                 val="$undef"
12891         fi
12892         set d_pwchange
12893         eval $setvar
12894
12895         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12896                 val="$define"
12897         else
12898                 val="$undef"
12899         fi
12900         set d_pwclass
12901         eval $setvar
12902
12903         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12904                 val="$define"
12905         else
12906                 val="$undef"
12907         fi
12908         set d_pwexpire
12909         eval $setvar
12910
12911         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12912                 val="$define"
12913         else
12914                 val="$undef"
12915         fi
12916         set d_pwcomment
12917         eval $setvar
12918
12919         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12920                 val="$define"
12921         else
12922                 val="$undef"
12923         fi
12924         set d_pwgecos
12925         eval $setvar
12926
12927         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12928                 val="$define"
12929         else
12930                 val="$undef"
12931         fi
12932         set d_pwpasswd
12933         eval $setvar
12934
12935         $rm -f $$.h
12936         ;;
12937 *)
12938         val="$undef";
12939         set d_pwquota; eval $setvar
12940         set d_pwage; eval $setvar
12941         set d_pwchange; eval $setvar
12942         set d_pwclass; eval $setvar
12943         set d_pwexpire; eval $setvar
12944         set d_pwcomment; eval $setvar
12945         set d_pwgecos; eval $setvar
12946         set d_pwpasswd; eval $setvar
12947         ;;
12948 esac
12949
12950 : see if endpwent_r exists
12951 set endpwent_r d_endpwent_r
12952 eval $inlibc
12953 case "$d_endpwent_r" in
12954 "$define")
12955         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12956         case "$d_endpwent_r_proto:$usethreads" in
12957         ":define")      d_endpwent_r_proto=define
12958                 set d_endpwent_r_proto endpwent_r $hdrs
12959                 eval $hasproto ;;
12960         *)      ;;
12961         esac
12962         case "$d_endpwent_r_proto" in
12963         define)
12964         case "$endpwent_r_proto" in
12965         ''|0) try='int endpwent_r(FILE**);'
12966         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12967         esac
12968         case "$endpwent_r_proto" in
12969         ''|0) try='void endpwent_r(FILE**);'
12970         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12971         esac
12972         case "$endpwent_r_proto" in
12973         ''|0)   d_endpwent_r=undef
12974                 endpwent_r_proto=0
12975                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12976         * )     case "$endpwent_r_proto" in
12977                 REENTRANT_PROTO*) ;;
12978                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12979                 esac
12980                 echo "Prototype: $try" ;;
12981         esac
12982         ;;
12983         *)      case "$usethreads" in
12984                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12985                 esac
12986                 d_endpwent_r=undef
12987                 endpwent_r_proto=0
12988                 ;;
12989         esac
12990         ;;
12991 *)      endpwent_r_proto=0
12992         ;;
12993 esac
12994
12995 : see if endservent exists
12996 set endservent d_endsent
12997 eval $inlibc
12998
12999 : see if endservent_r exists
13000 set endservent_r d_endservent_r
13001 eval $inlibc
13002 case "$d_endservent_r" in
13003 "$define")
13004         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13005         case "$d_endservent_r_proto:$usethreads" in
13006         ":define")      d_endservent_r_proto=define
13007                 set d_endservent_r_proto endservent_r $hdrs
13008                 eval $hasproto ;;
13009         *)      ;;
13010         esac
13011         case "$d_endservent_r_proto" in
13012         define)
13013         case "$endservent_r_proto" in
13014         ''|0) try='int endservent_r(struct servent_data*);'
13015         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
13016         esac
13017         case "$endservent_r_proto" in
13018         ''|0) try='void endservent_r(struct servent_data*);'
13019         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
13020         esac
13021         case "$endservent_r_proto" in
13022         ''|0)   d_endservent_r=undef
13023                 endservent_r_proto=0
13024                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
13025         * )     case "$endservent_r_proto" in
13026                 REENTRANT_PROTO*) ;;
13027                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
13028                 esac
13029                 echo "Prototype: $try" ;;
13030         esac
13031         ;;
13032         *)      case "$usethreads" in
13033                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
13034                 esac
13035                 d_endservent_r=undef
13036                 endservent_r_proto=0
13037                 ;;
13038         esac
13039         ;;
13040 *)      endservent_r_proto=0
13041         ;;
13042 esac
13043
13044 : Locate the flags for 'open()'
13045 echo " "
13046 $cat >try.c <<EOCP
13047 #include <sys/types.h>
13048 #ifdef I_FCNTL
13049 #include <fcntl.h>
13050 #endif
13051 #ifdef I_SYS_FILE
13052 #include <sys/file.h>
13053 #endif
13054 #$i_stdlib I_STDLIB
13055 #ifdef I_STDLIB
13056 #include <stdlib.h>
13057 #endif
13058 int main() {
13059         if(O_RDONLY);
13060 #ifdef O_TRUNC
13061         exit(0);
13062 #else
13063         exit(1);
13064 #endif
13065 }
13066 EOCP
13067 : check sys/file.h first to get FREAD on Sun
13068 if $test `./findhdr sys/file.h` && \
13069                 set try -DI_SYS_FILE && eval $compile; then
13070         h_sysfile=true;
13071         echo "<sys/file.h> defines the O_* constants..." >&4
13072         if $run ./try; then
13073                 echo "and you have the 3 argument form of open()." >&4
13074                 val="$define"
13075         else
13076                 echo "but not the 3 argument form of open().  Oh, well." >&4
13077                 val="$undef"
13078         fi
13079 elif $test `./findhdr fcntl.h` && \
13080                 set try -DI_FCNTL && eval $compile; then
13081         h_fcntl=true;
13082         echo "<fcntl.h> defines the O_* constants..." >&4
13083         if $run ./try; then
13084                 echo "and you have the 3 argument form of open()." >&4
13085                 val="$define"
13086         else
13087                 echo "but not the 3 argument form of open().  Oh, well." >&4
13088                 val="$undef"
13089         fi
13090 else
13091         val="$undef"
13092         echo "I can't find the O_* constant definitions!  You got problems." >&4
13093 fi
13094 set d_open3
13095 eval $setvar
13096 $rm_try
13097
13098 : see if this is a sys/file.h system
13099 val=''
13100 set sys/file.h val
13101 eval $inhdr
13102
13103 : do we need to include sys/file.h ?
13104 case "$val" in
13105 "$define")
13106         echo " "
13107         if $h_sysfile; then
13108                 val="$define"
13109                 echo "We'll be including <sys/file.h>." >&4
13110         else
13111                 val="$undef"
13112                 echo "We won't be including <sys/file.h>." >&4
13113         fi
13114         ;;
13115 *)
13116         h_sysfile=false
13117         ;;
13118 esac
13119 set i_sysfile
13120 eval $setvar
13121
13122 : see if fcntl.h is there
13123 val=''
13124 set fcntl.h val
13125 eval $inhdr
13126
13127 : see if we can include fcntl.h
13128 case "$val" in
13129 "$define")
13130         echo " "
13131         if $h_fcntl; then
13132                 val="$define"
13133                 echo "We'll be including <fcntl.h>." >&4
13134         else
13135                 val="$undef"
13136                 if $h_sysfile; then
13137         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
13138                 else
13139                         echo "We won't be including <fcntl.h>." >&4
13140                 fi
13141         fi
13142         ;;
13143 *)
13144         h_fcntl=false
13145         val="$undef"
13146         ;;
13147 esac
13148 set i_fcntl
13149 eval $setvar
13150
13151 : see if fork exists
13152 set fork d_fork
13153 eval $inlibc
13154
13155 : see if pipe exists
13156 set pipe d_pipe
13157 eval $inlibc
13158
13159 : check for non-blocking I/O stuff
13160 case "$h_sysfile" in
13161 true) echo "#include <sys/file.h>" > head.c;;
13162 *)
13163        case "$h_fcntl" in
13164        true) echo "#include <fcntl.h>" > head.c;;
13165        *) echo "#include <sys/fcntl.h>" > head.c;;
13166        esac
13167        ;;
13168 esac
13169 echo " "
13170 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
13171 case "$o_nonblock" in
13172 '')
13173         $cat head.c > try.c
13174         $cat >>try.c <<EOCP
13175 #include <stdio.h>
13176 #$i_stdlib I_STDLIB
13177 #ifdef I_STDLIB
13178 #include <stdlib.h>
13179 #endif
13180 #$i_fcntl I_FCNTL
13181 #ifdef I_FCNTL
13182 #include <fcntl.h>
13183 #endif
13184 int main() {
13185 #ifdef O_NONBLOCK
13186         printf("O_NONBLOCK\n");
13187         exit(0);
13188 #endif
13189 #ifdef O_NDELAY
13190         printf("O_NDELAY\n");
13191         exit(0);
13192 #endif
13193 #ifdef FNDELAY
13194         printf("FNDELAY\n");
13195         exit(0);
13196 #endif
13197         exit(0);
13198 }
13199 EOCP
13200         set try
13201         if eval $compile_ok; then
13202                 o_nonblock=`$run ./try`
13203                 case "$o_nonblock" in
13204                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
13205                 *) echo "Seems like we can use $o_nonblock.";;
13206                 esac
13207         else
13208                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
13209         fi
13210         ;;
13211 *) echo "Using $hint value $o_nonblock.";;
13212 esac
13213 $rm_try
13214
13215 echo " "
13216 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
13217 case "$eagain" in
13218 '')
13219         case "$d_fork:$d_pipe" in
13220         define:define)
13221         $cat head.c > try.c
13222         $cat >>try.c <<EOCP
13223 #include <errno.h>
13224 #include <sys/types.h>
13225 #include <signal.h>
13226 #include <stdio.h>
13227 #$i_stdlib I_STDLIB
13228 #ifdef I_STDLIB
13229 #include <stdlib.h>
13230 #endif
13231 #$i_fcntl I_FCNTL
13232 #ifdef I_FCNTL
13233 #include <fcntl.h>
13234 #endif
13235 #define MY_O_NONBLOCK $o_nonblock
13236 #ifndef errno  /* XXX need better Configure test */
13237 extern int errno;
13238 #endif
13239 #$i_unistd I_UNISTD
13240 #ifdef I_UNISTD
13241 #include <unistd.h>
13242 #endif
13243 #$i_string I_STRING
13244 #ifdef I_STRING
13245 #include <string.h>
13246 #else
13247 #include <strings.h>
13248 #endif
13249 $signal_t blech(int x) { exit(3); }
13250 EOCP
13251         $cat >> try.c <<'EOCP'
13252 int main()
13253 {
13254         int pd[2];
13255         int pu[2];
13256         char buf[1];
13257         char string[100];
13258         int ret;
13259
13260         ret = pipe(pd); /* Down: child -> parent */
13261         if (ret != 0)
13262                 exit(3);
13263         ret = pipe(pu); /* Up: parent -> child */
13264         if (ret != 0)
13265                 exit(3);
13266         if (0 != fork()) {
13267                 close(pd[1]);   /* Parent reads from pd[0] */
13268                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
13269 #ifdef F_SETFL
13270                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
13271                         exit(1);
13272 #else
13273                 exit(4);
13274 #endif
13275                 signal(SIGALRM, blech);
13276                 alarm(5);
13277                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
13278                         exit(2);
13279                 sprintf(string, "%d\n", ret);
13280                 ret = write(2, string, strlen(string));
13281                 if (ret != strlen(string))
13282                         exit(3);
13283                 alarm(0);
13284 #ifdef EAGAIN
13285                 if (errno == EAGAIN) {
13286                         printf("EAGAIN\n");
13287                         goto ok;
13288                 }
13289 #endif
13290 #ifdef EWOULDBLOCK
13291                 if (errno == EWOULDBLOCK)
13292                         printf("EWOULDBLOCK\n");
13293 #endif
13294         ok:
13295                 ret = write(pu[1], buf, 1);     /* Unblocks child, tell it to close our pipe */
13296                 if (ret != 1)
13297                         exit(3);
13298                 sleep(2);                               /* Give it time to close our pipe */
13299                 alarm(5);
13300                 ret = read(pd[0], buf, 1);      /* Should read EOF */
13301                 alarm(0);
13302                 sprintf(string, "%d\n", ret);
13303                 ret = write(4, string, strlen(string));
13304                 if (ret != strlen(string))
13305                         exit(3);
13306                 exit(0);
13307         }
13308
13309         close(pd[0]);                   /* We write to pd[1] */
13310         close(pu[1]);                   /* We read from pu[0] */
13311         ret = read(pu[0], buf, 1);      /* Wait for parent to signal us we may continue */
13312         if (ret != 1)
13313                 exit(3);
13314         close(pd[1]);                   /* Pipe pd is now fully closed! */
13315         exit(0);                                /* Bye bye, thank you for playing! */
13316 }
13317 EOCP
13318         set try
13319         if eval $compile_ok; then
13320                 echo "$startsh" >mtry
13321                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
13322                 chmod +x mtry
13323                 $run ./mtry >/dev/null 2>&1
13324                 case $? in
13325                 0) eagain=`$cat try.out`;;
13326                 1) echo "Could not perform non-blocking setting!";;
13327                 2) echo "I did a successful read() for something that was not there!";;
13328                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
13329                 4) echo "Could not find F_SETFL!";;
13330                 *) echo "Something terribly wrong happened during testing.";;
13331                 esac
13332                 rd_nodata=`$cat try.ret`
13333                 echo "A read() system call with no data present returns $rd_nodata."
13334                 case "$rd_nodata" in
13335                 0|-1) ;;
13336                 *)
13337                         echo "(That's peculiar, fixing that to be -1.)"
13338                         rd_nodata=-1
13339                         ;;
13340                 esac
13341                 case "$eagain" in
13342                 '')
13343                         echo "Forcing errno EAGAIN on read() with no data available."
13344                         eagain=EAGAIN
13345                         ;;
13346                 *)
13347                         echo "Your read() sets errno to $eagain when no data is available."
13348                         ;;
13349                 esac
13350                 status=`$cat try.err`
13351                 case "$status" in
13352                 0) echo "And it correctly returns 0 to signal EOF.";;
13353                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
13354                 *) echo "However, your read() returns '$status' on EOF??";;
13355                 esac
13356                 val="$define"
13357                 if test "$status" = "$rd_nodata"; then
13358                         echo "WARNING: you can't distinguish between EOF and no data!"
13359                         val="$undef"
13360                 fi
13361         else
13362                 echo "I can't compile the test program--assuming errno EAGAIN will do."
13363                 eagain=EAGAIN
13364         fi
13365         ;;
13366         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
13367                 eagain=EAGAIN
13368                 val="$define"
13369                 ;;
13370         esac
13371         set d_eofnblk
13372         eval $setvar
13373         ;;
13374 *)
13375         echo "Using $hint value $eagain."
13376         echo "Your read() returns $rd_nodata when no data is present."
13377         case "$d_eofnblk" in
13378         "$define") echo "And you can see EOF because read() returns 0.";;
13379         "$undef") echo "But you can't see EOF status from read() returned value.";;
13380         *)
13381                 echo "(Assuming you can't see EOF status from read anyway.)"
13382                 d_eofnblk=$undef
13383                 ;;
13384         esac
13385         ;;
13386 esac
13387 $rm_try head.c mtry
13388
13389 : see if _ptr and _cnt from stdio act std
13390 echo " "
13391
13392 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
13393         echo "(Looks like you have stdio.h from BSD.)"
13394         case "$stdio_ptr" in
13395         '') stdio_ptr='((fp)->_p)'
13396                 ptr_lval=$define
13397                 ;;
13398         *)      ptr_lval=$d_stdio_ptr_lval;;
13399         esac
13400         case "$stdio_cnt" in
13401         '') stdio_cnt='((fp)->_r)'
13402                 cnt_lval=$define
13403                 ;;
13404         *)      cnt_lval=$d_stdio_cnt_lval;;
13405         esac
13406         case "$stdio_base" in
13407         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
13408         esac
13409         case "$stdio_bufsiz" in
13410         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
13411         esac
13412 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
13413         echo "(Looks like you have stdio.h from Linux.)"
13414         case "$stdio_ptr" in
13415         '') stdio_ptr='((fp)->_IO_read_ptr)'
13416                 ptr_lval=$define
13417                 ;;
13418         *)      ptr_lval=$d_stdio_ptr_lval;;
13419         esac
13420         case "$stdio_cnt" in
13421         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
13422                 cnt_lval=$undef
13423                 ;;
13424         *)      cnt_lval=$d_stdio_cnt_lval;;
13425         esac
13426         case "$stdio_base" in
13427         '') stdio_base='((fp)->_IO_read_base)';;
13428         esac
13429         case "$stdio_bufsiz" in
13430         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
13431         esac
13432 else
13433         case "$stdio_ptr" in
13434         '') stdio_ptr='((fp)->_ptr)'
13435                 ptr_lval=$define
13436                 ;;
13437         *)      ptr_lval=$d_stdio_ptr_lval;;
13438         esac
13439         case "$stdio_cnt" in
13440         '') stdio_cnt='((fp)->_cnt)'
13441                 cnt_lval=$define
13442                 ;;
13443         *)      cnt_lval=$d_stdio_cnt_lval;;
13444         esac
13445         case "$stdio_base" in
13446         '') stdio_base='((fp)->_base)';;
13447         esac
13448         case "$stdio_bufsiz" in
13449         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
13450         esac
13451 fi
13452
13453 : test whether _ptr and _cnt really work
13454 echo "Checking how std your stdio is..." >&4
13455 $cat >try.c <<EOP
13456 #include <stdio.h>
13457 #$i_stdlib I_STDLIB
13458 #ifdef I_STDLIB
13459 #include <stdlib.h>
13460 #endif
13461 #define FILE_ptr(fp)    $stdio_ptr
13462 #define FILE_cnt(fp)    $stdio_cnt
13463 int main() {
13464         FILE *fp = fopen("try.c", "r");
13465         char c = getc(fp);
13466         if (
13467                 18 <= FILE_cnt(fp) &&
13468                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13469         )
13470                 exit(0);
13471         exit(1);
13472 }
13473 EOP
13474 val="$undef"
13475 set try
13476 if eval $compile && $to try.c; then
13477         if $run ./try; then
13478                 echo "Your stdio acts pretty std."
13479                 val="$define"
13480         else
13481                 echo "Your stdio isn't very std."
13482         fi
13483 else
13484         echo "Your stdio doesn't appear very std."
13485 fi
13486 $rm_try
13487
13488 # glibc 2.2.90 and above apparently change stdio streams so Perl's
13489 # direct buffer manipulation no longer works.  The Configure tests
13490 # should be changed to correctly detect this, but until then,
13491 # the following check should at least let perl compile and run.
13492 # (This quick fix should be updated before 5.8.1.)
13493 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
13494 # A. Dougherty, June 3, 2002.
13495 case "$d_gnulibc" in
13496 $define)
13497         case "$gnulibc_version" in
13498         2.[01]*)  ;;
13499         2.2) ;;
13500         2.2.[0-9]) ;;
13501         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
13502                 val="$undef"
13503                 ;;
13504         esac
13505         ;;
13506 esac
13507 set d_stdstdio
13508 eval $setvar
13509
13510 : Can _ptr be used as an lvalue?
13511 case "$d_stdstdio$ptr_lval" in
13512 $define$define) val=$define ;;
13513 *) val=$undef ;;
13514 esac
13515 set d_stdio_ptr_lval
13516 eval $setvar
13517
13518 : Can _cnt be used as an lvalue?
13519 case "$d_stdstdio$cnt_lval" in
13520 $define$define) val=$define ;;
13521 *) val=$undef ;;
13522 esac
13523 set d_stdio_cnt_lval
13524 eval $setvar
13525
13526
13527 : test whether setting _ptr sets _cnt as a side effect
13528 d_stdio_ptr_lval_sets_cnt="$undef"
13529 d_stdio_ptr_lval_nochange_cnt="$undef"
13530 case "$d_stdio_ptr_lval$d_stdstdio" in
13531 $define$define)
13532         echo "Checking to see what happens if we set the stdio ptr..." >&4
13533 $cat >try.c <<EOP
13534 #include <stdio.h>
13535 /* Can we scream? */
13536 /* Eat dust sed :-) */
13537 /* In the buffer space, no one can hear you scream. */
13538 #$i_stdlib I_STDLIB
13539 #ifdef I_STDLIB
13540 #include <stdlib.h>
13541 #endif
13542 #define FILE_ptr(fp)    $stdio_ptr
13543 #define FILE_cnt(fp)    $stdio_cnt
13544 #include <sys/types.h>
13545 int main() {
13546         FILE *fp = fopen("try.c", "r");
13547         int c;
13548         char *ptr;
13549         size_t cnt;
13550         if (!fp) {
13551             puts("Fail even to read");
13552             exit(1);
13553         }
13554         c = getc(fp); /* Read away the first # */
13555         if (c == EOF) {
13556             puts("Fail even to read");
13557             exit(1);
13558         }
13559         if (!(
13560                 18 <= FILE_cnt(fp) &&
13561                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13562         )) {
13563                 puts("Fail even to read");
13564                 exit (1);
13565         }
13566         ptr = (char*) FILE_ptr(fp);
13567         cnt = (size_t)FILE_cnt(fp);
13568
13569         FILE_ptr(fp) += 42;
13570
13571         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13572                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13573                 exit (1);
13574         }
13575         if (FILE_cnt(fp) <= 20) {
13576                 printf ("Fail (<20 chars to test)");
13577                 exit (1);
13578         }
13579         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13580                 puts("Fail compare");
13581                 exit (1);
13582         }
13583         if (cnt == FILE_cnt(fp)) {
13584                 puts("Pass_unchanged");
13585                 exit (0);
13586         }
13587         if (FILE_cnt(fp) == (cnt - 42)) {
13588                 puts("Pass_changed");
13589                 exit (0);
13590         }
13591         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13592         return 1;
13593
13594 }
13595 EOP
13596         set try
13597         if eval $compile && $to try.c; then
13598                 case `$run ./try` in
13599                 Pass_changed)
13600                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13601                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13602                 Pass_unchanged)
13603                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13604                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13605                 Fail*)
13606                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13607                 *)
13608                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13609         esac
13610         else
13611                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13612         fi
13613         $rm_try
13614         ;;
13615 esac
13616
13617 : see if _base is also standard
13618 val="$undef"
13619 case "$d_stdstdio" in
13620 $define)
13621         $cat >try.c <<EOP
13622 #include <stdio.h>
13623 #$i_stdlib I_STDLIB
13624 #ifdef I_STDLIB
13625 #include <stdlib.h>
13626 #endif
13627 #define FILE_base(fp)   $stdio_base
13628 #define FILE_bufsiz(fp) $stdio_bufsiz
13629 int main() {
13630         FILE *fp = fopen("try.c", "r");
13631         char c = getc(fp);
13632         if (
13633                 19 <= FILE_bufsiz(fp) &&
13634                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13635         )
13636                 exit(0);
13637         exit(1);
13638 }
13639 EOP
13640         set try
13641         if eval $compile && $to try.c; then
13642                 if $run ./try; then
13643                         echo "And its _base field acts std."
13644                         val="$define"
13645                 else
13646                         echo "But its _base field isn't std."
13647                 fi
13648         else
13649                 echo "However, it seems to be lacking the _base field."
13650         fi
13651         $rm_try
13652         ;;
13653 esac
13654 set d_stdiobase
13655 eval $setvar
13656
13657 : see if fast_stdio exists
13658 val="$undef"
13659 case "$d_stdstdio:$d_stdio_ptr_lval" in
13660 "$define:$define")
13661         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13662         *$define*)
13663                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13664                 val="$define"
13665                 ;;
13666         esac
13667         ;;
13668 esac
13669 set d_faststdio
13670 eval $setvar
13671
13672
13673
13674 : see if fchdir exists
13675 set fchdir d_fchdir
13676 eval $inlibc
13677
13678 : see if fchmod exists
13679 set fchmod d_fchmod
13680 eval $inlibc
13681
13682 : see if fchown exists
13683 set fchown d_fchown
13684 eval $inlibc
13685
13686 : see if this is an fcntl system
13687 set fcntl d_fcntl
13688 eval $inlibc
13689
13690 : See if fcntl-based locking works.
13691 echo " "
13692 $cat >try.c <<EOCP
13693 #$i_stdlib I_STDLIB
13694 #ifdef I_STDLIB
13695 #include <stdlib.h>
13696 #endif
13697 #include <unistd.h>
13698 #include <fcntl.h>
13699 #include <signal.h>
13700 $signal_t blech(int x) { exit(3); }
13701 int main() {
13702 #if defined(F_SETLK) && defined(F_SETLKW)
13703      struct flock flock;
13704      int retval, fd;
13705      fd = open("try.c", O_RDONLY);
13706      flock.l_type = F_RDLCK;
13707      flock.l_whence = SEEK_SET;
13708      flock.l_start = flock.l_len = 0;
13709      signal(SIGALRM, blech);
13710      alarm(10);
13711      retval = fcntl(fd, F_SETLK, &flock);
13712      close(fd);
13713      (retval < 0 ? exit(2) : exit(0));
13714 #else
13715      exit(2);
13716 #endif
13717 }
13718 EOCP
13719 echo "Checking if fcntl-based file locking works... "
13720 case "$d_fcntl" in
13721 "$define")
13722         set try
13723         if eval $compile_ok; then
13724                 if $run ./try; then
13725                         echo "Yes, it seems to work."
13726                         val="$define"
13727                 else
13728                         echo "Nope, it didn't work."
13729                         val="$undef"
13730                         case "$?" in
13731                         3) $cat >&4 <<EOM
13732 ***
13733 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13734 *** This is (almost) impossible.
13735 *** If your NFS lock daemons are not feeling well, something like
13736 *** this may happen, please investigate.  Cannot continue, aborting.
13737 ***
13738 EOM
13739                                 exit 1
13740                                 ;;
13741                         esac
13742                 fi
13743         else
13744                 echo "I'm unable to compile the test program, so I'll assume not."
13745                 val="$undef"
13746         fi
13747         ;;
13748 *) val="$undef";
13749         echo "Nope, since you don't even have fcntl()."
13750         ;;
13751 esac
13752 set d_fcntl_can_lock
13753 eval $setvar
13754 $rm_try
13755
13756 : check for fd_set items
13757 $cat <<EOM
13758
13759 Checking to see how well your C compiler handles fd_set and friends ...
13760 EOM
13761 $cat >try.c <<EOCP
13762 #$i_stdlib I_STDLIB
13763 #ifdef I_STDLIB
13764 #include <stdlib.h>
13765 #endif
13766 #$i_systime I_SYS_TIME
13767 #$i_sysselct I_SYS_SELECT
13768 #$d_socket HAS_SOCKET
13769 #include <sys/types.h>
13770 #ifdef HAS_SOCKET
13771 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13772 #endif
13773 #ifdef I_SYS_TIME
13774 #include <sys/time.h>
13775 #endif
13776 #ifdef I_SYS_SELECT
13777 #include <sys/select.h>
13778 #endif
13779 int main() {
13780         fd_set fds;
13781
13782 #ifdef TRYBITS
13783         if(fds.fds_bits);
13784 #endif
13785
13786 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13787         exit(0);
13788 #else
13789         exit(1);
13790 #endif
13791 }
13792 EOCP
13793 set try -DTRYBITS
13794 if eval $compile; then
13795         d_fds_bits="$define"
13796         d_fd_set="$define"
13797         echo "Well, your system knows about the normal fd_set typedef..." >&4
13798         if $run ./try; then
13799                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13800                 d_fd_macros="$define"
13801         else
13802                 $cat >&4 <<'EOM'
13803 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13804 EOM
13805                 d_fd_macros="$undef"
13806         fi
13807 else
13808         $cat <<'EOM'
13809 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13810 EOM
13811         set try
13812         if eval $compile; then
13813                 d_fds_bits="$undef"
13814                 d_fd_set="$define"
13815                 echo "Well, your system has some sort of fd_set available..." >&4
13816                 if $run ./try; then
13817                         echo "and you have the normal fd_set macros." >&4
13818                         d_fd_macros="$define"
13819                 else
13820                         $cat <<'EOM'
13821 but not the normal fd_set macros!  Gross!  More work for me...
13822 EOM
13823                         d_fd_macros="$undef"
13824                 fi
13825         else
13826         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13827                 d_fd_set="$undef"
13828                 d_fds_bits="$undef"
13829                 d_fd_macros="$undef"
13830         fi
13831 fi
13832 $rm_try
13833
13834 : see if fegetround exists
13835 set fegetround d_fegetround
13836 eval $inlibc
13837
13838 : see if fgetpos exists
13839 set fgetpos d_fgetpos
13840 eval $inlibc
13841
13842 : see if finite exists
13843 set finite d_finite
13844 eval $inlibc
13845
13846 : see if finitel exists
13847 set finitel d_finitel
13848 eval $inlibc
13849
13850 : see if flock exists
13851 set flock d_flock
13852 eval $inlibc
13853
13854 : see if prototype for flock is available
13855 echo " "
13856 set d_flockproto flock $i_sysfile sys/file.h
13857 eval $hasproto
13858
13859 : see if fp_class exists
13860 set fp_class d_fp_class
13861 eval $inlibc
13862
13863 : see if this is a math.h system
13864 set math.h i_math
13865 eval $inhdr
13866
13867 : check for fpclassify
13868 echo "Checking to see if you have fpclassify..." >&4
13869 $cat >try.c <<EOCP
13870 #$i_math I_MATH
13871 #ifdef I_MATH
13872 #include <math.h>
13873 #endif
13874 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
13875 EOCP
13876 set try
13877 if eval $compile; then
13878         val="$define"
13879         echo "You have fpclassify."
13880 else
13881         val="$undef"
13882         echo "You do not have fpclassify."
13883 fi
13884 $rm_try
13885 set d_fpclassify
13886 eval $setvar
13887
13888 : see if fp_classify exists
13889 set fp_classify d_fp_classify
13890 eval $inlibc
13891
13892 : see if fp_classl exists
13893 set fp_classl d_fp_classl
13894 eval $inlibc
13895
13896 : see if pathconf exists
13897 set pathconf d_pathconf
13898 eval $inlibc
13899
13900 : see if fpathconf exists
13901 set fpathconf d_fpathconf
13902 eval $inlibc
13903
13904 : see if fpclass exists
13905 set fpclass d_fpclass
13906 eval $inlibc
13907
13908 : see if fpclassl exists
13909 set fpclassl d_fpclassl
13910 eval $inlibc
13911
13912 : see if fpgetround exists
13913 set fpgetround d_fpgetround
13914 eval $inlibc
13915
13916 : check for fpos64_t
13917 echo " "
13918 echo "Checking to see if you have fpos64_t..." >&4
13919 $cat >try.c <<EOCP
13920 #include <stdio.h>
13921 int main() { fpos64_t x = 7; }
13922 EOCP
13923 set try
13924 if eval $compile; then
13925         val="$define"
13926         echo "You have fpos64_t."
13927 else
13928         val="$undef"
13929         echo "You do not have fpos64_t."
13930         case "$fpossize" in
13931         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13932         esac
13933 fi
13934 $rm_try
13935 set d_fpos64_t
13936 eval $setvar
13937
13938 : see if frexpl exists
13939 set frexpl d_frexpl
13940 eval $inlibc
13941
13942 : see if this is a sys/param system
13943 set sys/param.h i_sysparam
13944 eval $inhdr
13945
13946 : see if this is a sys/mount.h system
13947 set sys/mount.h i_sysmount
13948 eval $inhdr
13949
13950 : Check for fs_data_s
13951 echo " "
13952 echo "Checking to see if your system supports struct fs_data..." >&4
13953 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13954 eval $hasstruct
13955 case "$d_fs_data_s" in
13956 "$define")      echo "Yes, it does."   ;;
13957 *)              echo "No, it doesn't." ;;
13958 esac
13959
13960 : see if fseeko exists
13961 set fseeko d_fseeko
13962 eval $inlibc
13963 case "$longsize" in
13964 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13965 esac
13966
13967 : see if fsetpos exists
13968 set fsetpos d_fsetpos
13969 eval $inlibc
13970
13971 : see if fstatfs exists
13972 set fstatfs d_fstatfs
13973 eval $inlibc
13974
13975 : see if statvfs exists
13976 set statvfs d_statvfs
13977 eval $inlibc
13978
13979 : see if fstatvfs exists
13980 set fstatvfs d_fstatvfs
13981 eval $inlibc
13982
13983
13984 : see if fsync exists
13985 set fsync d_fsync
13986 eval $inlibc
13987
13988 : see if ftello exists
13989 set ftello d_ftello
13990 eval $inlibc
13991 case "$longsize" in
13992 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13993 esac
13994
13995 : check for a working futimes
13996 d_futimes="$undef"
13997 echo " "
13998 echo "Checking if you have a working futimes()" >&4
13999 $cat >try.c <<EOCP
14000 #include <stdio.h>
14001 #include <sys/time.h>
14002 #include <errno.h>
14003 #include <fcntl.h>
14004
14005 int main ()
14006 {
14007     int fd, rv;
14008     fd = open ("try.c", O_RDWR);
14009     if (-1 == fd) exit (1);
14010     rv = futimes (fd, NULL);
14011     exit (rv == -1 ? errno : 0);
14012 }
14013 EOCP
14014 set try
14015 if eval $compile; then
14016     `$run ./try`
14017     rc=$?
14018     case "$rc" in
14019         0)  echo "Yes, you have" >&4
14020             d_futimes="$define"
14021             ;;
14022         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
14023             ;;
14024     esac
14025 else
14026     echo "No, it does not (probably harmless)" >&4
14027 fi
14028 $rm_try
14029
14030 : see if ndbm.h is available
14031 set ndbm.h i_ndbm
14032 eval $inhdr
14033 : Compatibility location for RedHat 7.1
14034 set gdbm/ndbm.h i_gdbmndbm
14035 eval $inhdr
14036 : Compatibility location for Debian 4.0
14037 set gdbm-ndbm.h i_gdbm_ndbm
14038 eval $inhdr
14039
14040 val="$undef"
14041 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
14042         : see if dbm_open exists
14043         set dbm_open d_dbm_open
14044         eval $inlibc
14045         case "$d_dbm_open" in
14046         $undef)
14047                 i_ndbm="$undef"
14048                 i_gdbmndbm="$undef"
14049                 i_gdbm_ndbm="$undef"
14050                 echo "We won't be including <ndbm.h>"
14051                 val="$undef"
14052                 ;;
14053         *) val="$define"
14054            ;;
14055         esac
14056 fi
14057 set d_ndbm
14058 eval $setvar
14059
14060 ndbm_hdr_protochk='name=$1; hdr=$2;
14061 eval "ihdr=\$""i_$name";
14062 val="$undef";
14063 if $test "$ihdr" = "$define"; then
14064         $echo "Checking if your <$hdr> uses prototypes..." >&4;
14065         case "$d_cplusplus" in
14066         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
14067         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
14068         esac;
14069         case "$val" in
14070         $define) $echo "Your <$hdr> seems to have prototypes";;
14071         *) $echo "Your <$hdr> does not seem to have prototypes";;
14072         esac;
14073 fi;
14074 set "d_${name}_h_uses_prototypes";
14075 eval $setvar'
14076
14077 set ndbm ndbm.h
14078 eval $ndbm_hdr_protochk
14079 set gdbmndbm gdbm/ndbm.h
14080 eval $ndbm_hdr_protochk
14081 set gdbm_ndbm gdbm-ndbm.h
14082 eval $ndbm_hdr_protochk
14083
14084 : see if getaddrinfo exists
14085 set getaddrinfo d_getaddrinfo
14086 eval $inlibc
14087
14088 : see if getcwd exists
14089 set getcwd d_getcwd
14090 eval $inlibc
14091
14092 : see if getespwnam exists
14093 set getespwnam d_getespwnam
14094 eval $inlibc
14095
14096 : see if getfsstat exists
14097 set getfsstat d_getfsstat
14098 eval $inlibc
14099
14100 : see if getgrent exists
14101 set getgrent d_getgrent
14102 eval $inlibc
14103
14104 : see if getgrent_r exists
14105 set getgrent_r d_getgrent_r
14106 eval $inlibc
14107 case "$d_getgrent_r" in
14108 "$define")
14109         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14110         case "$d_getgrent_r_proto:$usethreads" in
14111         ":define")      d_getgrent_r_proto=define
14112                 set d_getgrent_r_proto getgrent_r $hdrs
14113                 eval $hasproto ;;
14114         *)      ;;
14115         esac
14116         case "$d_getgrent_r_proto" in
14117         define)
14118         case "$getgrent_r_proto" in
14119         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
14120         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
14121         esac
14122         case "$getgrent_r_proto" in
14123         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
14124         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
14125         esac
14126         case "$getgrent_r_proto" in
14127         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
14128         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
14129         esac
14130         case "$getgrent_r_proto" in
14131         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
14132         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
14133         esac
14134         case "$getgrent_r_proto" in
14135         ''|0) try='int getgrent_r(struct group*, char*, int);'
14136         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
14137         esac
14138         case "$getgrent_r_proto" in
14139         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
14140         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
14141         esac
14142         case "$getgrent_r_proto" in
14143         ''|0)   d_getgrent_r=undef
14144                 getgrent_r_proto=0
14145                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
14146         * )     case "$getgrent_r_proto" in
14147                 REENTRANT_PROTO*) ;;
14148                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
14149                 esac
14150                 echo "Prototype: $try" ;;
14151         esac
14152         ;;
14153         *)      case "$usethreads" in
14154                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
14155                 esac
14156                 d_getgrent_r=undef
14157                 getgrent_r_proto=0
14158                 ;;
14159         esac
14160         ;;
14161 *)      getgrent_r_proto=0
14162         ;;
14163 esac
14164
14165 : see if getgrgid_r exists
14166 set getgrgid_r d_getgrgid_r
14167 eval $inlibc
14168 case "$d_getgrgid_r" in
14169 "$define")
14170         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14171         case "$d_getgrgid_r_proto:$usethreads" in
14172         ":define")      d_getgrgid_r_proto=define
14173                 set d_getgrgid_r_proto getgrgid_r $hdrs
14174                 eval $hasproto ;;
14175         *)      ;;
14176         esac
14177         case "$d_getgrgid_r_proto" in
14178         define)
14179         case "$getgrgid_r_proto" in
14180         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
14181         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
14182         esac
14183         case "$getgrgid_r_proto" in
14184         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
14185         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
14186         esac
14187         case "$getgrgid_r_proto" in
14188         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
14189         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
14190         esac
14191         case "$getgrgid_r_proto" in
14192         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
14193         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
14194         esac
14195         case "$getgrgid_r_proto" in
14196         ''|0)   d_getgrgid_r=undef
14197                 getgrgid_r_proto=0
14198                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
14199         * )     case "$getgrgid_r_proto" in
14200                 REENTRANT_PROTO*) ;;
14201                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
14202                 esac
14203                 echo "Prototype: $try" ;;
14204         esac
14205         ;;
14206         *)      case "$usethreads" in
14207                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
14208                 esac
14209                 d_getgrgid_r=undef
14210                 getgrgid_r_proto=0
14211                 ;;
14212         esac
14213         ;;
14214 *)      getgrgid_r_proto=0
14215         ;;
14216 esac
14217
14218 : see if getgrnam_r exists
14219 set getgrnam_r d_getgrnam_r
14220 eval $inlibc
14221 case "$d_getgrnam_r" in
14222 "$define")
14223         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14224         case "$d_getgrnam_r_proto:$usethreads" in
14225         ":define")      d_getgrnam_r_proto=define
14226                 set d_getgrnam_r_proto getgrnam_r $hdrs
14227                 eval $hasproto ;;
14228         *)      ;;
14229         esac
14230         case "$d_getgrnam_r_proto" in
14231         define)
14232         case "$getgrnam_r_proto" in
14233         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
14234         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
14235         esac
14236         case "$getgrnam_r_proto" in
14237         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
14238         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
14239         esac
14240         case "$getgrnam_r_proto" in
14241         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
14242         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
14243         esac
14244         case "$getgrnam_r_proto" in
14245         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
14246         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
14247         esac
14248         case "$getgrnam_r_proto" in
14249         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
14250         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
14251         esac
14252         case "$getgrnam_r_proto" in
14253         ''|0)   d_getgrnam_r=undef
14254                 getgrnam_r_proto=0
14255                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
14256         * )     case "$getgrnam_r_proto" in
14257                 REENTRANT_PROTO*) ;;
14258                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
14259                 esac
14260                 echo "Prototype: $try" ;;
14261         esac
14262         ;;
14263         *)      case "$usethreads" in
14264                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
14265                 esac
14266                 d_getgrnam_r=undef
14267                 getgrnam_r_proto=0
14268                 ;;
14269         esac
14270         ;;
14271 *)      getgrnam_r_proto=0
14272         ;;
14273 esac
14274
14275 : see if gethostbyaddr exists
14276 set gethostbyaddr d_gethbyaddr
14277 eval $inlibc
14278
14279 : see if gethostbyname exists
14280 set gethostbyname d_gethbyname
14281 eval $inlibc
14282
14283 : see if gethostent exists
14284 set gethostent d_gethent
14285 eval $inlibc
14286
14287 : see how we will look up host name
14288 echo " "
14289 call=''
14290 if set gethostname val -f d_gethname; eval $csym; $val; then
14291         echo 'gethostname() found.' >&4
14292         d_gethname="$define"
14293         call=gethostname
14294 fi
14295 if set uname val -f d_uname; eval $csym; $val; then
14296         if ./xenix; then
14297                 $cat <<'EOM'
14298 uname() was found, but you're running xenix, and older versions of xenix
14299 have a broken uname(). If you don't really know whether your xenix is old
14300 enough to have a broken system call, use the default answer.
14301
14302 EOM
14303                 dflt=y
14304                 case "$d_uname" in
14305                 "$define") dflt=n;;
14306                 esac
14307                 rp='Is your uname() broken?'
14308                 . ./myread
14309                 case "$ans" in
14310                 n*) d_uname="$define"; call=uname;;
14311                 esac
14312         else
14313                 echo 'uname() found.' >&4
14314                 d_uname="$define"
14315                 case "$call" in
14316                 '') call=uname ;;
14317                 esac
14318         fi
14319 fi
14320 case "$d_gethname" in
14321 '') d_gethname="$undef";;
14322 esac
14323 case "$d_uname" in
14324 '') d_uname="$undef";;
14325 esac
14326 case "$d_uname$d_gethname" in
14327 *define*)
14328         dflt=n
14329         cat <<EOM
14330
14331 Every now and then someone has a $call() that lies about the hostname
14332 but can't be fixed for political or economic reasons.  If you wish, I can
14333 pretend $call() isn't there and maybe compute hostname at run-time
14334 thanks to the '$phostname' command.
14335
14336 EOM
14337         rp="Shall I ignore $call() from now on?"
14338         . ./myread
14339         case "$ans" in
14340         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
14341         esac;;
14342 esac
14343 case "$phostname" in
14344 '') aphostname='';;
14345 *) case "$aphostname" in
14346         /*) ;;
14347         *) set X $phostname
14348                 shift
14349                 file=$1
14350                 shift
14351                 file=`./loc $file $file $pth`
14352                 aphostname=`echo $file $*`
14353                 ;;
14354         esac
14355         ;;
14356 esac
14357 case "$d_uname$d_gethname" in
14358 *define*) ;;
14359 *)
14360         case "$phostname" in
14361         '')
14362                 echo "There will be no way for $package to get your hostname." >&4;;
14363         *)
14364         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
14365                 ;;
14366         esac;;
14367 esac
14368 case "$d_phostname" in
14369 '') d_phostname="$undef";;
14370 esac
14371
14372 : see if gethostbyaddr_r exists
14373 set gethostbyaddr_r d_gethostbyaddr_r
14374 eval $inlibc
14375 case "$d_gethostbyaddr_r" in
14376 "$define")
14377         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14378         case "$d_gethostbyaddr_r_proto:$usethreads" in
14379         ":define")      d_gethostbyaddr_r_proto=define
14380                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
14381                 eval $hasproto ;;
14382         *)      ;;
14383         esac
14384         case "$d_gethostbyaddr_r_proto" in
14385         define)
14386         case "$gethostbyaddr_r_proto" in
14387         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14388         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
14389         esac
14390         case "$gethostbyaddr_r_proto" in
14391         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
14392         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
14393         esac
14394         case "$gethostbyaddr_r_proto" in
14395         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
14396         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
14397         esac
14398         case "$gethostbyaddr_r_proto" in
14399         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
14400         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
14401         esac
14402         case "$gethostbyaddr_r_proto" in
14403         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
14404         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
14405         esac
14406         case "$gethostbyaddr_r_proto" in
14407         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
14408         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
14409         esac
14410         case "$gethostbyaddr_r_proto" in
14411         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
14412         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
14413         esac
14414         case "$gethostbyaddr_r_proto" in
14415         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
14416         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
14417         esac
14418         case "$gethostbyaddr_r_proto" in
14419         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
14420         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
14421         esac
14422         case "$gethostbyaddr_r_proto" in
14423         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
14424         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
14425         esac
14426         case "$gethostbyaddr_r_proto" in
14427         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
14428         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
14429         esac
14430         case "$gethostbyaddr_r_proto" in
14431         ''|0)   d_gethostbyaddr_r=undef
14432                 gethostbyaddr_r_proto=0
14433                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
14434         * )     case "$gethostbyaddr_r_proto" in
14435                 REENTRANT_PROTO*) ;;
14436                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
14437                 esac
14438                 echo "Prototype: $try" ;;
14439         esac
14440         ;;
14441         *)      case "$usethreads" in
14442                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
14443                 esac
14444                 d_gethostbyaddr_r=undef
14445                 gethostbyaddr_r_proto=0
14446                 ;;
14447         esac
14448         ;;
14449 *)      gethostbyaddr_r_proto=0
14450         ;;
14451 esac
14452
14453 : see if gethostbyname_r exists
14454 set gethostbyname_r d_gethostbyname_r
14455 eval $inlibc
14456 case "$d_gethostbyname_r" in
14457 "$define")
14458         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14459         case "$d_gethostbyname_r_proto:$usethreads" in
14460         ":define")      d_gethostbyname_r_proto=define
14461                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
14462                 eval $hasproto ;;
14463         *)      ;;
14464         esac
14465         case "$d_gethostbyname_r_proto" in
14466         define)
14467         case "$gethostbyname_r_proto" in
14468         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
14469         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
14470         esac
14471         case "$gethostbyname_r_proto" in
14472         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
14473         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
14474         esac
14475         case "$gethostbyname_r_proto" in
14476         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
14477         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
14478         esac
14479         case "$gethostbyname_r_proto" in
14480         ''|0)   d_gethostbyname_r=undef
14481                 gethostbyname_r_proto=0
14482                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
14483         * )     case "$gethostbyname_r_proto" in
14484                 REENTRANT_PROTO*) ;;
14485                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
14486                 esac
14487                 echo "Prototype: $try" ;;
14488         esac
14489         ;;
14490         *)      case "$usethreads" in
14491                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
14492                 esac
14493                 d_gethostbyname_r=undef
14494                 gethostbyname_r_proto=0
14495                 ;;
14496         esac
14497         ;;
14498 *)      gethostbyname_r_proto=0
14499         ;;
14500 esac
14501
14502 : see if gethostent_r exists
14503 set gethostent_r d_gethostent_r
14504 eval $inlibc
14505 case "$d_gethostent_r" in
14506 "$define")
14507         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14508         case "$d_gethostent_r_proto:$usethreads" in
14509         ":define")      d_gethostent_r_proto=define
14510                 set d_gethostent_r_proto gethostent_r $hdrs
14511                 eval $hasproto ;;
14512         *)      ;;
14513         esac
14514         case "$d_gethostent_r_proto" in
14515         define)
14516         case "$gethostent_r_proto" in
14517         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
14518         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
14519         esac
14520         case "$gethostent_r_proto" in
14521         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
14522         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
14523         esac
14524         case "$gethostent_r_proto" in
14525         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
14526         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
14527         esac
14528         case "$gethostent_r_proto" in
14529         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
14530         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
14531         esac
14532         case "$gethostent_r_proto" in
14533         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
14534         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
14535         esac
14536         case "$gethostent_r_proto" in
14537         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
14538         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
14539         esac
14540         case "$gethostent_r_proto" in
14541         ''|0)   d_gethostent_r=undef
14542                 gethostent_r_proto=0
14543                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
14544         * )     case "$gethostent_r_proto" in
14545                 REENTRANT_PROTO*) ;;
14546                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
14547                 esac
14548                 echo "Prototype: $try" ;;
14549         esac
14550         ;;
14551         *)      case "$usethreads" in
14552                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
14553                 esac
14554                 d_gethostent_r=undef
14555                 gethostent_r_proto=0
14556                 ;;
14557         esac
14558         ;;
14559 *)      gethostent_r_proto=0
14560         ;;
14561 esac
14562
14563 : see if prototypes for various gethostxxx netdb.h functions are available
14564 echo " "
14565 set d_gethostprotos gethostent $i_netdb netdb.h
14566 eval $hasproto
14567
14568 : see if getitimer exists
14569 set getitimer d_getitimer
14570 eval $inlibc
14571
14572 : see if getlogin exists
14573 set getlogin d_getlogin
14574 eval $inlibc
14575
14576 : see if getlogin_r exists
14577 set getlogin_r d_getlogin_r
14578 eval $inlibc
14579 case "$d_getlogin_r" in
14580 "$define")
14581         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14582         case "$d_getlogin_r_proto:$usethreads" in
14583         ":define")      d_getlogin_r_proto=define
14584                 set d_getlogin_r_proto getlogin_r $hdrs
14585                 eval $hasproto ;;
14586         *)      ;;
14587         esac
14588         case "$d_getlogin_r_proto" in
14589         define)
14590         case "$getlogin_r_proto" in
14591         ''|0) try='int getlogin_r(char*, size_t);'
14592         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14593         esac
14594         case "$getlogin_r_proto" in
14595         ''|0) try='int getlogin_r(char*, int);'
14596         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14597         esac
14598         case "$getlogin_r_proto" in
14599         ''|0) try='char* getlogin_r(char*, size_t);'
14600         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14601         esac
14602         case "$getlogin_r_proto" in
14603         ''|0) try='char* getlogin_r(char*, int);'
14604         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14605         esac
14606         case "$getlogin_r_proto" in
14607         ''|0)   d_getlogin_r=undef
14608                 getlogin_r_proto=0
14609                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14610         * )     case "$getlogin_r_proto" in
14611                 REENTRANT_PROTO*) ;;
14612                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14613                 esac
14614                 echo "Prototype: $try" ;;
14615         esac
14616         ;;
14617         *)      case "$usethreads" in
14618                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14619                 esac
14620                 d_getlogin_r=undef
14621                 getlogin_r_proto=0
14622                 ;;
14623         esac
14624         ;;
14625 *)      getlogin_r_proto=0
14626         ;;
14627 esac
14628
14629 : see if getmnt exists
14630 set getmnt d_getmnt
14631 eval $inlibc
14632
14633 : see if getmntent exists
14634 set getmntent d_getmntent
14635 eval $inlibc
14636
14637 : see if getnameinfo exists
14638 set getnameinfo d_getnameinfo
14639 eval $inlibc
14640
14641 : see if getnetbyaddr exists
14642 set getnetbyaddr d_getnbyaddr
14643 eval $inlibc
14644
14645 : see if getnetbyname exists
14646 set getnetbyname d_getnbyname
14647 eval $inlibc
14648
14649 : see if getnetent exists
14650 set getnetent d_getnent
14651 eval $inlibc
14652
14653 : see if getnetbyaddr_r exists
14654 set getnetbyaddr_r d_getnetbyaddr_r
14655 eval $inlibc
14656 case "$d_getnetbyaddr_r" in
14657 "$define")
14658         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14659         case "$d_getnetbyaddr_r_proto:$usethreads" in
14660         ":define")      d_getnetbyaddr_r_proto=define
14661                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14662                 eval $hasproto ;;
14663         *)      ;;
14664         esac
14665         case "$d_getnetbyaddr_r_proto" in
14666         define)
14667         case "$getnetbyaddr_r_proto" in
14668         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14669         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14670         esac
14671         case "$getnetbyaddr_r_proto" in
14672         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14673         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14674         esac
14675         case "$getnetbyaddr_r_proto" in
14676         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14677         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14678         esac
14679         case "$getnetbyaddr_r_proto" in
14680         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14681         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14682         esac
14683         case "$getnetbyaddr_r_proto" in
14684         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14685         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14686         esac
14687         case "$getnetbyaddr_r_proto" in
14688         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14689         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14690         esac
14691         case "$getnetbyaddr_r_proto" in
14692         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14693         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14694         esac
14695         case "$getnetbyaddr_r_proto" in
14696         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14697         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14698         esac
14699         case "$getnetbyaddr_r_proto" in
14700         ''|0)   d_getnetbyaddr_r=undef
14701                 getnetbyaddr_r_proto=0
14702                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14703         * )     case "$getnetbyaddr_r_proto" in
14704                 REENTRANT_PROTO*) ;;
14705                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14706                 esac
14707                 echo "Prototype: $try" ;;
14708         esac
14709         ;;
14710         *)      case "$usethreads" in
14711                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14712                 esac
14713                 d_getnetbyaddr_r=undef
14714                 getnetbyaddr_r_proto=0
14715                 ;;
14716         esac
14717         ;;
14718 *)      getnetbyaddr_r_proto=0
14719         ;;
14720 esac
14721
14722 : see if getnetbyname_r exists
14723 set getnetbyname_r d_getnetbyname_r
14724 eval $inlibc
14725 case "$d_getnetbyname_r" in
14726 "$define")
14727         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14728         case "$d_getnetbyname_r_proto:$usethreads" in
14729         ":define")      d_getnetbyname_r_proto=define
14730                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14731                 eval $hasproto ;;
14732         *)      ;;
14733         esac
14734         case "$d_getnetbyname_r_proto" in
14735         define)
14736         case "$getnetbyname_r_proto" in
14737         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14738         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14739         esac
14740         case "$getnetbyname_r_proto" in
14741         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14742         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14743         esac
14744         case "$getnetbyname_r_proto" in
14745         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14746         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14747         esac
14748         case "$getnetbyname_r_proto" in
14749         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14750         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14751         esac
14752         case "$getnetbyname_r_proto" in
14753         ''|0)   d_getnetbyname_r=undef
14754                 getnetbyname_r_proto=0
14755                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14756         * )     case "$getnetbyname_r_proto" in
14757                 REENTRANT_PROTO*) ;;
14758                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14759                 esac
14760                 echo "Prototype: $try" ;;
14761         esac
14762         ;;
14763         *)      case "$usethreads" in
14764                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14765                 esac
14766                 d_getnetbyname_r=undef
14767                 getnetbyname_r_proto=0
14768                 ;;
14769         esac
14770         ;;
14771 *)      getnetbyname_r_proto=0
14772         ;;
14773 esac
14774
14775 : see if getnetent_r exists
14776 set getnetent_r d_getnetent_r
14777 eval $inlibc
14778 case "$d_getnetent_r" in
14779 "$define")
14780         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14781         case "$d_getnetent_r_proto:$usethreads" in
14782         ":define")      d_getnetent_r_proto=define
14783                 set d_getnetent_r_proto getnetent_r $hdrs
14784                 eval $hasproto ;;
14785         *)      ;;
14786         esac
14787         case "$d_getnetent_r_proto" in
14788         define)
14789         case "$getnetent_r_proto" in
14790         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14791         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14792         esac
14793         case "$getnetent_r_proto" in
14794         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14795         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14796         esac
14797         case "$getnetent_r_proto" in
14798         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14799         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14800         esac
14801         case "$getnetent_r_proto" in
14802         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14803         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14804         esac
14805         case "$getnetent_r_proto" in
14806         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14807         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14808         esac
14809         case "$getnetent_r_proto" in
14810         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14811         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14812         esac
14813         case "$getnetent_r_proto" in
14814         ''|0)   d_getnetent_r=undef
14815                 getnetent_r_proto=0
14816                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14817         * )     case "$getnetent_r_proto" in
14818                 REENTRANT_PROTO*) ;;
14819                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14820                 esac
14821                 echo "Prototype: $try" ;;
14822         esac
14823         ;;
14824         *)      case "$usethreads" in
14825                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14826                 esac
14827                 d_getnetent_r=undef
14828                 getnetent_r_proto=0
14829                 ;;
14830         esac
14831         ;;
14832 *)      getnetent_r_proto=0
14833         ;;
14834 esac
14835
14836 : see if prototypes for various getnetxxx netdb.h functions are available
14837 echo " "
14838 set d_getnetprotos getnetent $i_netdb netdb.h
14839 eval $hasproto
14840
14841 : see if getpagesize exists
14842 set getpagesize d_getpagsz
14843 eval $inlibc
14844
14845 : Optional checks for getprotobyname and getprotobynumber
14846
14847 : see if getprotobyname exists
14848 set getprotobyname d_getpbyname
14849 eval $inlibc
14850
14851 : see if getprotobynumber exists
14852 set getprotobynumber d_getpbynumber
14853 eval $inlibc
14854
14855 : see if getprotoent exists
14856 set getprotoent d_getpent
14857 eval $inlibc
14858
14859 : see if getpgid exists
14860 set getpgid d_getpgid
14861 eval $inlibc
14862
14863 : see if getpgrp2 exists
14864 set getpgrp2 d_getpgrp2
14865 eval $inlibc
14866
14867 : see if getppid exists
14868 set getppid d_getppid
14869 eval $inlibc
14870
14871 : see if getpriority exists
14872 set getpriority d_getprior
14873 eval $inlibc
14874
14875 : see if getprotobyname_r exists
14876 set getprotobyname_r d_getprotobyname_r
14877 eval $inlibc
14878 case "$d_getprotobyname_r" in
14879 "$define")
14880         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14881         case "$d_getprotobyname_r_proto:$usethreads" in
14882         ":define")      d_getprotobyname_r_proto=define
14883                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14884                 eval $hasproto ;;
14885         *)      ;;
14886         esac
14887         case "$d_getprotobyname_r_proto" in
14888         define)
14889         case "$getprotobyname_r_proto" in
14890         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14891         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14892         esac
14893         case "$getprotobyname_r_proto" in
14894         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14895         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14896         esac
14897         case "$getprotobyname_r_proto" in
14898         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14899         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14900         esac
14901         case "$getprotobyname_r_proto" in
14902         ''|0)   d_getprotobyname_r=undef
14903                 getprotobyname_r_proto=0
14904                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14905         * )     case "$getprotobyname_r_proto" in
14906                 REENTRANT_PROTO*) ;;
14907                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14908                 esac
14909                 echo "Prototype: $try" ;;
14910         esac
14911         ;;
14912         *)      case "$usethreads" in
14913                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14914                 esac
14915                 d_getprotobyname_r=undef
14916                 getprotobyname_r_proto=0
14917                 ;;
14918         esac
14919         ;;
14920 *)      getprotobyname_r_proto=0
14921         ;;
14922 esac
14923
14924 : see if getprotobynumber_r exists
14925 set getprotobynumber_r d_getprotobynumber_r
14926 eval $inlibc
14927 case "$d_getprotobynumber_r" in
14928 "$define")
14929         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14930         case "$d_getprotobynumber_r_proto:$usethreads" in
14931         ":define")      d_getprotobynumber_r_proto=define
14932                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14933                 eval $hasproto ;;
14934         *)      ;;
14935         esac
14936         case "$d_getprotobynumber_r_proto" in
14937         define)
14938         case "$getprotobynumber_r_proto" in
14939         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14940         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14941         esac
14942         case "$getprotobynumber_r_proto" in
14943         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14944         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14945         esac
14946         case "$getprotobynumber_r_proto" in
14947         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14948         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14949         esac
14950         case "$getprotobynumber_r_proto" in
14951         ''|0)   d_getprotobynumber_r=undef
14952                 getprotobynumber_r_proto=0
14953                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14954         * )     case "$getprotobynumber_r_proto" in
14955                 REENTRANT_PROTO*) ;;
14956                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14957                 esac
14958                 echo "Prototype: $try" ;;
14959         esac
14960         ;;
14961         *)      case "$usethreads" in
14962                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14963                 esac
14964                 d_getprotobynumber_r=undef
14965                 getprotobynumber_r_proto=0
14966                 ;;
14967         esac
14968         ;;
14969 *)      getprotobynumber_r_proto=0
14970         ;;
14971 esac
14972
14973 : see if getprotoent_r exists
14974 set getprotoent_r d_getprotoent_r
14975 eval $inlibc
14976 case "$d_getprotoent_r" in
14977 "$define")
14978         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14979         case "$d_getprotoent_r_proto:$usethreads" in
14980         ":define")      d_getprotoent_r_proto=define
14981                 set d_getprotoent_r_proto getprotoent_r $hdrs
14982                 eval $hasproto ;;
14983         *)      ;;
14984         esac
14985         case "$d_getprotoent_r_proto" in
14986         define)
14987         case "$getprotoent_r_proto" in
14988         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14989         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14990         esac
14991         case "$getprotoent_r_proto" in
14992         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14993         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14994         esac
14995         case "$getprotoent_r_proto" in
14996         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14997         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14998         esac
14999         case "$getprotoent_r_proto" in
15000         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
15001         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
15002         esac
15003         case "$getprotoent_r_proto" in
15004         ''|0)   d_getprotoent_r=undef
15005                 getprotoent_r_proto=0
15006                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
15007         * )     case "$getprotoent_r_proto" in
15008                 REENTRANT_PROTO*) ;;
15009                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
15010                 esac
15011                 echo "Prototype: $try" ;;
15012         esac
15013         ;;
15014         *)      case "$usethreads" in
15015                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
15016                 esac
15017                 d_getprotoent_r=undef
15018                 getprotoent_r_proto=0
15019                 ;;
15020         esac
15021         ;;
15022 *)      getprotoent_r_proto=0
15023         ;;
15024 esac
15025
15026 : see if prototypes for various getprotoxxx netdb.h functions are available
15027 echo " "
15028 set d_getprotoprotos getprotoent $i_netdb netdb.h
15029 eval $hasproto
15030
15031 : see if getprpwnam exists
15032 set getprpwnam d_getprpwnam
15033 eval $inlibc
15034
15035 : see if getpwent exists
15036 set getpwent d_getpwent
15037 eval $inlibc
15038
15039 : see if getpwent_r exists
15040 set getpwent_r d_getpwent_r
15041 eval $inlibc
15042 case "$d_getpwent_r" in
15043 "$define")
15044         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15045         case "$d_getpwent_r_proto:$usethreads" in
15046         ":define")      d_getpwent_r_proto=define
15047                 set d_getpwent_r_proto getpwent_r $hdrs
15048                 eval $hasproto ;;
15049         *)      ;;
15050         esac
15051         case "$d_getpwent_r_proto" in
15052         define)
15053         case "$getpwent_r_proto" in
15054         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
15055         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
15056         esac
15057         case "$getpwent_r_proto" in
15058         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
15059         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
15060         esac
15061         case "$getpwent_r_proto" in
15062         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
15063         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
15064         esac
15065         case "$getpwent_r_proto" in
15066         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
15067         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
15068         esac
15069         case "$getpwent_r_proto" in
15070         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
15071         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
15072         esac
15073         case "$getpwent_r_proto" in
15074         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
15075         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
15076         esac
15077         case "$getpwent_r_proto" in
15078         ''|0)   d_getpwent_r=undef
15079                 getpwent_r_proto=0
15080                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
15081         * )     case "$getpwent_r_proto" in
15082                 REENTRANT_PROTO*) ;;
15083                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
15084                 esac
15085                 echo "Prototype: $try" ;;
15086         esac
15087         ;;
15088         *)      case "$usethreads" in
15089                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
15090                 esac
15091                 d_getpwent_r=undef
15092                 getpwent_r_proto=0
15093                 ;;
15094         esac
15095         ;;
15096 *)      getpwent_r_proto=0
15097         ;;
15098 esac
15099
15100 : see if getpwnam_r exists
15101 set getpwnam_r d_getpwnam_r
15102 eval $inlibc
15103 case "$d_getpwnam_r" in
15104 "$define")
15105         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15106         case "$d_getpwnam_r_proto:$usethreads" in
15107         ":define")      d_getpwnam_r_proto=define
15108                 set d_getpwnam_r_proto getpwnam_r $hdrs
15109                 eval $hasproto ;;
15110         *)      ;;
15111         esac
15112         case "$d_getpwnam_r_proto" in
15113         define)
15114         case "$getpwnam_r_proto" in
15115         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
15116         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
15117         esac
15118         case "$getpwnam_r_proto" in
15119         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
15120         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
15121         esac
15122         case "$getpwnam_r_proto" in
15123         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
15124         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
15125         esac
15126         case "$getpwnam_r_proto" in
15127         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
15128         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
15129         esac
15130         case "$getpwnam_r_proto" in
15131         ''|0)   d_getpwnam_r=undef
15132                 getpwnam_r_proto=0
15133                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
15134         * )     case "$getpwnam_r_proto" in
15135                 REENTRANT_PROTO*) ;;
15136                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
15137                 esac
15138                 echo "Prototype: $try" ;;
15139         esac
15140         ;;
15141         *)      case "$usethreads" in
15142                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
15143                 esac
15144                 d_getpwnam_r=undef
15145                 getpwnam_r_proto=0
15146                 ;;
15147         esac
15148         ;;
15149 *)      getpwnam_r_proto=0
15150         ;;
15151 esac
15152
15153 : see if getpwuid_r exists
15154 set getpwuid_r d_getpwuid_r
15155 eval $inlibc
15156 case "$d_getpwuid_r" in
15157 "$define")
15158         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15159         case "$d_getpwuid_r_proto:$usethreads" in
15160         ":define")      d_getpwuid_r_proto=define
15161                 set d_getpwuid_r_proto getpwuid_r $hdrs
15162                 eval $hasproto ;;
15163         *)      ;;
15164         esac
15165         case "$d_getpwuid_r_proto" in
15166         define)
15167         case "$getpwuid_r_proto" in
15168         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
15169         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
15170         esac
15171         case "$getpwuid_r_proto" in
15172         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
15173         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
15174         esac
15175         case "$getpwuid_r_proto" in
15176         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
15177         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
15178         esac
15179         case "$getpwuid_r_proto" in
15180         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
15181         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
15182         esac
15183         case "$getpwuid_r_proto" in
15184         ''|0)   d_getpwuid_r=undef
15185                 getpwuid_r_proto=0
15186                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
15187         * )     case "$getpwuid_r_proto" in
15188                 REENTRANT_PROTO*) ;;
15189                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
15190                 esac
15191                 echo "Prototype: $try" ;;
15192         esac
15193         ;;
15194         *)      case "$usethreads" in
15195                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
15196                 esac
15197                 d_getpwuid_r=undef
15198                 getpwuid_r_proto=0
15199                 ;;
15200         esac
15201         ;;
15202 *)      getpwuid_r_proto=0
15203         ;;
15204 esac
15205
15206 : Optional checks for getsbyname and getsbyport
15207
15208 : see if getservbyname exists
15209 set getservbyname d_getsbyname
15210 eval $inlibc
15211
15212 : see if getservbyport exists
15213 set getservbyport d_getsbyport
15214 eval $inlibc
15215
15216 : see if getservent exists
15217 set getservent d_getsent
15218 eval $inlibc
15219
15220 : see if getservbyname_r exists
15221 set getservbyname_r d_getservbyname_r
15222 eval $inlibc
15223 case "$d_getservbyname_r" in
15224 "$define")
15225         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15226         case "$d_getservbyname_r_proto:$usethreads" in
15227         ":define")      d_getservbyname_r_proto=define
15228                 set d_getservbyname_r_proto getservbyname_r $hdrs
15229                 eval $hasproto ;;
15230         *)      ;;
15231         esac
15232         case "$d_getservbyname_r_proto" in
15233         define)
15234         case "$getservbyname_r_proto" in
15235         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
15236         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
15237         esac
15238         case "$getservbyname_r_proto" in
15239         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
15240         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
15241         esac
15242         case "$getservbyname_r_proto" in
15243         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
15244         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
15245         esac
15246         case "$getservbyname_r_proto" in
15247         ''|0)   d_getservbyname_r=undef
15248                 getservbyname_r_proto=0
15249                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
15250         * )     case "$getservbyname_r_proto" in
15251                 REENTRANT_PROTO*) ;;
15252                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
15253                 esac
15254                 echo "Prototype: $try" ;;
15255         esac
15256         ;;
15257         *)      case "$usethreads" in
15258                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
15259                 esac
15260                 d_getservbyname_r=undef
15261                 getservbyname_r_proto=0
15262                 ;;
15263         esac
15264         ;;
15265 *)      getservbyname_r_proto=0
15266         ;;
15267 esac
15268
15269 : see if getservbyport_r exists
15270 set getservbyport_r d_getservbyport_r
15271 eval $inlibc
15272 case "$d_getservbyport_r" in
15273 "$define")
15274         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15275         case "$d_getservbyport_r_proto:$usethreads" in
15276         ":define")      d_getservbyport_r_proto=define
15277                 set d_getservbyport_r_proto getservbyport_r $hdrs
15278                 eval $hasproto ;;
15279         *)      ;;
15280         esac
15281         case "$d_getservbyport_r_proto" in
15282         define)
15283         case "$getservbyport_r_proto" in
15284         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
15285         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
15286         esac
15287         case "$getservbyport_r_proto" in
15288         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
15289         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
15290         esac
15291         case "$getservbyport_r_proto" in
15292         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
15293         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
15294         esac
15295         case "$getservbyport_r_proto" in
15296         ''|0)   d_getservbyport_r=undef
15297                 getservbyport_r_proto=0
15298                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
15299         * )     case "$getservbyport_r_proto" in
15300                 REENTRANT_PROTO*) ;;
15301                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
15302                 esac
15303                 echo "Prototype: $try" ;;
15304         esac
15305         ;;
15306         *)      case "$usethreads" in
15307                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
15308                 esac
15309                 d_getservbyport_r=undef
15310                 getservbyport_r_proto=0
15311                 ;;
15312         esac
15313         ;;
15314 *)      getservbyport_r_proto=0
15315         ;;
15316 esac
15317
15318 : see if getservent_r exists
15319 set getservent_r d_getservent_r
15320 eval $inlibc
15321 case "$d_getservent_r" in
15322 "$define")
15323         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15324         case "$d_getservent_r_proto:$usethreads" in
15325         ":define")      d_getservent_r_proto=define
15326                 set d_getservent_r_proto getservent_r $hdrs
15327                 eval $hasproto ;;
15328         *)      ;;
15329         esac
15330         case "$d_getservent_r_proto" in
15331         define)
15332         case "$getservent_r_proto" in
15333         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
15334         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
15335         esac
15336         case "$getservent_r_proto" in
15337         ''|0) try='int getservent_r(struct servent*, char*, int);'
15338         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
15339         esac
15340         case "$getservent_r_proto" in
15341         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
15342         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
15343         esac
15344         case "$getservent_r_proto" in
15345         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
15346         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
15347         esac
15348         case "$getservent_r_proto" in
15349         ''|0)   d_getservent_r=undef
15350                 getservent_r_proto=0
15351                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
15352         * )     case "$getservent_r_proto" in
15353                 REENTRANT_PROTO*) ;;
15354                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
15355                 esac
15356                 echo "Prototype: $try" ;;
15357         esac
15358         ;;
15359         *)      case "$usethreads" in
15360                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
15361                 esac
15362                 d_getservent_r=undef
15363                 getservent_r_proto=0
15364                 ;;
15365         esac
15366         ;;
15367 *)      getservent_r_proto=0
15368         ;;
15369 esac
15370
15371 : see if prototypes for various getservxxx netdb.h functions are available
15372 echo " "
15373 set d_getservprotos getservent $i_netdb netdb.h
15374 eval $hasproto
15375
15376 : see if getspnam exists
15377 set getspnam d_getspnam
15378 eval $inlibc
15379
15380 : see if this is a shadow.h system
15381 set shadow.h i_shadow
15382 eval $inhdr
15383
15384 : see if getspnam_r exists
15385 set getspnam_r d_getspnam_r
15386 eval $inlibc
15387 case "$d_getspnam_r" in
15388 "$define")
15389         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
15390         case "$d_getspnam_r_proto:$usethreads" in
15391         ":define")      d_getspnam_r_proto=define
15392                 set d_getspnam_r_proto getspnam_r $hdrs
15393                 eval $hasproto ;;
15394         *)      ;;
15395         esac
15396         case "$d_getspnam_r_proto" in
15397         define)
15398         case "$getspnam_r_proto" in
15399         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
15400         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
15401         esac
15402         case "$getspnam_r_proto" in
15403         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
15404         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
15405         esac
15406         case "$getspnam_r_proto" in
15407         ''|0)   d_getspnam_r=undef
15408                 getspnam_r_proto=0
15409                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
15410         * )     case "$getspnam_r_proto" in
15411                 REENTRANT_PROTO*) ;;
15412                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
15413                 esac
15414                 echo "Prototype: $try" ;;
15415         esac
15416         ;;
15417         *)      case "$usethreads" in
15418                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
15419                 esac
15420                 d_getspnam_r=undef
15421                 getspnam_r_proto=0
15422                 ;;
15423         esac
15424         ;;
15425 *)      getspnam_r_proto=0
15426         ;;
15427 esac
15428
15429 : see if gettimeofday or ftime exists
15430 set gettimeofday d_gettimeod
15431 eval $inlibc
15432 case "$d_gettimeod" in
15433 "$undef")
15434         set ftime d_ftime 
15435         eval $inlibc
15436         ;;
15437 *)
15438         val="$undef"; set d_ftime; eval $setvar
15439         ;;
15440 esac
15441 case "$d_gettimeod$d_ftime" in
15442 "$undef$undef")
15443         echo " "
15444         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
15445         ;;
15446 esac
15447
15448 : see if gmtime_r exists
15449 set gmtime_r d_gmtime_r
15450 eval $inlibc
15451 case "$d_gmtime_r" in
15452 "$define")
15453         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15454         case "$d_gmtime_r_proto:$usethreads" in
15455         ":define")      d_gmtime_r_proto=define
15456                 set d_gmtime_r_proto gmtime_r $hdrs
15457                 eval $hasproto ;;
15458         *)      ;;
15459         esac
15460         case "$d_gmtime_r_proto" in
15461         define)
15462         case "$gmtime_r_proto" in
15463         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
15464         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
15465         esac
15466         case "$gmtime_r_proto" in
15467         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
15468         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
15469         esac
15470         case "$gmtime_r_proto" in
15471         ''|0)   d_gmtime_r=undef
15472                 gmtime_r_proto=0
15473                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
15474         * )     case "$gmtime_r_proto" in
15475                 REENTRANT_PROTO*) ;;
15476                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
15477                 esac
15478                 echo "Prototype: $try" ;;
15479         esac
15480         ;;
15481         *)      case "$usethreads" in
15482                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
15483                 esac
15484                 d_gmtime_r=undef
15485                 gmtime_r_proto=0
15486                 ;;
15487         esac
15488         ;;
15489 *)      gmtime_r_proto=0
15490         ;;
15491 esac
15492
15493 : see if hasmntopt exists
15494 set hasmntopt d_hasmntopt
15495 eval $inlibc
15496
15497 : see if this is a netinet/in.h or sys/in.h system
15498 set netinet/in.h i_niin sys/in.h i_sysin
15499 eval $inhdr
15500
15501 : see if arpa/inet.h has to be included
15502 set arpa/inet.h i_arpainet
15503 eval $inhdr
15504
15505 : see if htonl --and friends-- exists
15506 val=''
15507 set htonl val
15508 eval $inlibc
15509
15510 : Maybe they are macros.
15511 case "$val" in
15512 $undef)
15513         $cat >htonl.c <<EOM
15514 #include <stdio.h>
15515 #include <sys/types.h>
15516 #$i_niin I_NETINET_IN
15517 #$i_sysin I_SYS_IN
15518 #$i_arpainet I_ARPA_INET
15519 #ifdef I_NETINET_IN
15520 #include <netinet/in.h>
15521 #endif
15522 #ifdef I_SYS_IN
15523 #include <sys/in.h>
15524 #endif
15525 #ifdef I_ARPA_INET
15526 #include <arpa/inet.h>
15527 #endif
15528 #ifdef htonl
15529 printf("Defined as a macro.");
15530 #endif
15531 EOM
15532         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
15533         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
15534                 val="$define"
15535                 echo "But it seems to be defined as a macro." >&4
15536         fi
15537         $rm -f htonl.?
15538         ;;
15539 esac
15540 set d_htonl
15541 eval $setvar
15542
15543 : see if ilogbl exists
15544 set ilogbl d_ilogbl
15545 eval $inlibc
15546
15547 : index or strchr
15548 echo " "
15549 if set index val -f; eval $csym; $val; then
15550         if set strchr val -f d_strchr; eval $csym; $val; then
15551                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
15552                         val="$define"
15553                         vali="$undef"
15554                         echo "strchr() found." >&4
15555                 else
15556                         val="$undef"
15557                         vali="$define"
15558                         echo "index() found." >&4
15559                 fi
15560         else
15561                 val="$undef"
15562                 vali="$define"
15563                 echo "index() found." >&4
15564         fi
15565 else
15566         if set strchr val -f d_strchr; eval $csym; $val; then
15567                 val="$define"
15568                 vali="$undef"
15569                 echo "strchr() found." >&4
15570         else
15571                 echo "No index() or strchr() found!" >&4
15572                 val="$undef"
15573                 vali="$undef"
15574         fi
15575 fi
15576 set d_strchr; eval $setvar
15577 val="$vali"
15578 set d_index; eval $setvar
15579
15580 : check whether inet_aton exists
15581 set inet_aton d_inetaton
15582 eval $inlibc
15583
15584 : see if inet_ntop exists
15585 set inet_ntop d_inetntop
15586 eval $inlibc
15587
15588 : see if inet_pton exists
15589 set inet_pton d_inetpton
15590 eval $inlibc
15591
15592 : Look for isascii
15593 echo " "
15594 $cat >isascii.c <<EOCP
15595 #include <stdio.h>
15596 #include <ctype.h>
15597 #$i_stdlib I_STDLIB
15598 #ifdef I_STDLIB
15599 #include <stdlib.h>
15600 #endif
15601 int main() {
15602         int c = 'A';
15603         if (isascii(c))
15604                 exit(0);
15605         else
15606                 exit(1);
15607 }
15608 EOCP
15609 set isascii
15610 if eval $compile; then
15611         echo "isascii() found." >&4
15612         val="$define"
15613 else
15614         echo "isascii() NOT found." >&4
15615         val="$undef"
15616 fi
15617 set d_isascii
15618 eval $setvar
15619 $rm -f isascii*
15620
15621 : Look for isblank
15622 echo " "
15623 $cat >isblank.c <<'EOCP'
15624 #include <stdio.h>
15625 #include <ctype.h>
15626 int main() {
15627         int c = ' ';
15628         if (isblank(c))
15629                 return 0 ;
15630         else
15631                 return 1 ;
15632 }
15633 EOCP
15634 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15635         echo "isblank() found." >&4
15636         val="$define"
15637 else
15638         echo "isblank() NOT found." >&4
15639         val="$undef"
15640 fi
15641 set d_isblank
15642 eval $setvar
15643 $rm -f isblank*
15644
15645 : check for isfinite
15646 echo "Checking to see if you have isfinite..." >&4
15647 $cat >try.c <<EOCP
15648 #$i_math I_MATH
15649 #ifdef I_MATH
15650 #include <math.h>
15651 #endif
15652 int main() { return isfinite(0.0); }
15653 EOCP
15654 set try
15655 if eval $compile; then
15656         val="$define"
15657         echo "You have isfinite."
15658 else
15659         val="$undef"
15660         echo "You do not have isfinite."
15661 fi
15662 $rm_try
15663 set d_isfinite
15664 eval $setvar
15665
15666 : see if isfinitel exists
15667 set isfinitel d_isfinitel
15668 eval $inlibc
15669
15670 : check for isinf
15671 echo "Checking to see if you have isinf..." >&4
15672 $cat >try.c <<EOCP
15673 #$i_math I_MATH
15674 #ifdef I_MATH
15675 #include <math.h>
15676 #endif
15677 int main() { return isinf(0.0); }
15678 EOCP
15679 set try
15680 if eval $compile; then
15681         val="$define"
15682         echo "You have isinf."
15683 else
15684         val="$undef"
15685         echo "You do not have isinf."
15686 fi
15687 $rm_try
15688 set d_isinf
15689 eval $setvar
15690
15691 : see if isinfl exists
15692 set isinfl d_isinfl
15693 eval $inlibc
15694
15695 : check for isnan
15696 echo "Checking to see if you have isnan..." >&4
15697 $cat >try.c <<EOCP
15698 #$i_math I_MATH
15699 #ifdef I_MATH
15700 #include <math.h>
15701 #endif
15702 int main() { return isnan(0.0); }
15703 EOCP
15704 set try
15705 if eval $compile; then
15706         val="$define"
15707         echo "You have isnan."
15708 else
15709         val="$undef"
15710         echo "You do not have isnan."
15711 fi
15712 $rm_try
15713 set d_isnan
15714 eval $setvar
15715
15716 : see if isnanl exists
15717 set isnanl d_isnanl
15718 eval $inlibc
15719
15720 : see if j0 exists
15721 set j0 d_j0
15722 eval $inlibc
15723
15724 : see if j0l exists
15725 set j0l d_j0l
15726 eval $inlibc
15727
15728 : see if killpg exists
15729 set killpg d_killpg
15730 eval $inlibc
15731
15732 : see if lchown exists
15733 echo " "
15734 $cat > try.c <<'EOCP'
15735 /* System header to define __stub macros and hopefully few prototypes,
15736     which can conflict with char lchown(); below.  */
15737 #include <assert.h>
15738 /* Override any gcc2 internal prototype to avoid an error.  */
15739 /* We use char because int might match the return type of a gcc2
15740    builtin and then its argument prototype would still apply.  */
15741 char lchown();
15742 int main() {
15743     /*  The GNU C library defines this for functions which it implements
15744         to always fail with ENOSYS.  Some functions are actually named
15745         something starting with __ and the normal name is an alias.  */
15746 #if defined (__stub_lchown) || defined (__stub___lchown)
15747 choke me
15748 #else
15749 lchown();
15750 #endif
15751 ; return 0; }
15752 EOCP
15753 set try
15754 if eval $compile; then
15755     $echo "lchown() found." >&4
15756     val="$define"
15757 else
15758     $echo "lchown() NOT found." >&4
15759     val="$undef"
15760 fi
15761 set d_lchown
15762 eval $setvar
15763
15764 : See if number of significant digits in a double precision number is known
15765 echo " "
15766 $cat >ldbl_dig.c <<EOM
15767 #$i_limits I_LIMITS
15768 #$i_float I_FLOAT
15769 #ifdef I_LIMITS
15770 #include <limits.h>
15771 #endif
15772 #ifdef I_FLOAT
15773 #include <float.h>
15774 #endif
15775 #ifdef LDBL_DIG
15776 printf("Contains LDBL_DIG");
15777 #endif
15778 EOM
15779 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15780 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15781         echo "LDBL_DIG found." >&4
15782         val="$define"
15783 else
15784         echo "LDBL_DIG NOT found." >&4
15785         val="$undef"
15786 fi
15787 $rm -f ldbl_dig.?
15788 set d_ldbl_dig
15789 eval $setvar
15790
15791 : check to see if math.h defines _LIB_VERSION
15792 d_libm_lib_version="$undef"
15793 case $i_math in
15794     $define)
15795         echo " "
15796         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15797         $cat >try.c <<EOCP
15798 #include <unistd.h>
15799 #include <math.h>
15800 int main (int argc, char *argv[])
15801 {
15802     printf ("%d\n", _LIB_VERSION);
15803     return (0);
15804     } /* main */
15805 EOCP
15806         set try
15807         if eval $compile; then
15808             foo=`$run ./try`
15809             echo "Yes, it does ($foo)" >&4
15810             d_libm_lib_version="$define"
15811         else
15812             echo "No, it does not (probably harmless)" >&4
15813             fi
15814         $rm_try
15815         ;;
15816
15817     esac
15818
15819 : check for fpclassify
15820 echo " "
15821 echo "Checking to see if you have fpclassify..." >&4
15822 $cat >try.c <<EOCP
15823 #$i_math I_MATH
15824 #ifdef I_MATH
15825 #include <math.h>
15826 #endif
15827 int main() { return fpclassify(1.0) == FP_NORMAL ? 0 : 1; }
15828 EOCP
15829 set try
15830 if eval $compile; then
15831         val="$define"
15832         echo "You have fpclassify."
15833 else
15834         val="$undef"
15835         echo "You do not have fpclassify."
15836 fi
15837 $rm_try
15838 set d_fpclassify
15839 eval $setvar
15840
15841 : check for isfinite
15842 echo " "
15843 echo "Checking to see if you have isfinite..." >&4
15844 $cat >try.c <<EOCP
15845 #$i_math I_MATH
15846 #ifdef I_MATH
15847 #include <math.h>
15848 #endif
15849 int main() { return isfinite(0.0); }
15850 EOCP
15851 set try
15852 if eval $compile; then
15853         val="$define"
15854         echo "You have isfinite."
15855 else
15856         val="$undef"
15857         echo "You do not have isfinite."
15858 fi
15859 $rm_try
15860 set d_isfinite
15861 eval $setvar
15862
15863 : check for isinf
15864 echo " "
15865 echo "Checking to see if you have isinf..." >&4
15866 $cat >try.c <<EOCP
15867 #$i_math I_MATH
15868 #ifdef I_MATH
15869 #include <math.h>
15870 #endif
15871 int main() { return isinf(0.0); }
15872 EOCP
15873 set try
15874 if eval $compile; then
15875         val="$define"
15876         echo "You have isinf."
15877 else
15878         val="$undef"
15879         echo "You do not have isinf."
15880 fi
15881 $rm_try
15882 set d_isinf
15883 eval $setvar
15884
15885 : check for isnan
15886 echo " "
15887 echo "Checking to see if you have isnan..." >&4
15888 $cat >try.c <<EOCP
15889 #$i_math I_MATH
15890 #ifdef I_MATH
15891 #include <math.h>
15892 #endif
15893 int main() { return isnan(0.0); }
15894 EOCP
15895 set try
15896 if eval $compile; then
15897         val="$define"
15898         echo "You have isnan."
15899 else
15900         val="$undef"
15901         echo "You do not have isnan."
15902 fi
15903 $rm_try
15904 set d_isnan
15905 eval $setvar
15906
15907 : see if this is a quadmath.h system
15908 set quadmath.h i_quadmath
15909 eval $inhdr
15910
15911 : see if link exists
15912 set link d_link
15913 eval $inlibc
15914
15915 : see if localtime_r exists
15916 set localtime_r d_localtime_r
15917 eval $inlibc
15918 case "$d_localtime_r" in
15919 "$define")
15920         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15921         case "$d_localtime_r_proto:$usethreads" in
15922         ":define")      d_localtime_r_proto=define
15923                 set d_localtime_r_proto localtime_r $hdrs
15924                 eval $hasproto ;;
15925         *)      ;;
15926         esac
15927         case "$d_localtime_r_proto" in
15928         define)
15929         case "$localtime_r_proto" in
15930         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15931         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15932         esac
15933         case "$localtime_r_proto" in
15934         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15935         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15936         esac
15937         case "$localtime_r_proto" in
15938         ''|0)   d_localtime_r=undef
15939                 localtime_r_proto=0
15940                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15941         * )     case "$localtime_r_proto" in
15942                 REENTRANT_PROTO*) ;;
15943                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15944                 esac
15945                 echo "Prototype: $try" ;;
15946         esac
15947         ;;
15948         *)      case "$usethreads" in
15949                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15950                 esac
15951                 d_localtime_r=undef
15952                 localtime_r_proto=0
15953                 ;;
15954         esac
15955         ;;
15956 *)      localtime_r_proto=0
15957         ;;
15958 esac
15959
15960 : see if localtime_r calls tzset
15961 case "$localtime_r_proto" in
15962 REENTRANT_PROTO*)
15963         $cat >try.c <<EOCP
15964 /*  Does our libc's localtime_r call tzset ?
15965  *  return 0 if so, 1 otherwise.
15966  */
15967 #$i_systypes    I_SYS_TYPES
15968 #$i_unistd      I_UNISTD
15969 #$i_time        I_TIME
15970 #$i_stdlib      I_STDLIB
15971 #$i_string      I_STRING
15972 #$i_malloc      I_MALLOC
15973 #ifdef I_SYS_TYPES
15974 #  include <sys/types.h>
15975 #endif
15976 #ifdef I_UNISTD
15977 #  include <unistd.h>
15978 #endif
15979 #ifdef I_TIME
15980 #  include <time.h>
15981 #endif
15982 #ifdef I_STDLIB
15983 #include <stdlib.h>
15984 #endif
15985 #ifdef I_STRING
15986 #  include <string.h>
15987 #else
15988 #  include <strings.h>
15989 #endif
15990 #ifdef I_MALLOC
15991 #  include <malloc.h>
15992 #endif
15993 int main()
15994 {
15995     time_t t = time(0L);
15996     char w_tz[]="TZ" "=GMT+5",
15997          e_tz[]="TZ" "=GMT-5",
15998         *tz_e = (char*)malloc(16),
15999         *tz_w = (char*)malloc(16);
16000     struct tm tm_e, tm_w;
16001     memset(&tm_e,'\0',sizeof(struct tm));
16002     memset(&tm_w,'\0',sizeof(struct tm));
16003     strcpy(tz_e,e_tz);
16004     strcpy(tz_w,w_tz);
16005
16006     putenv(tz_e);
16007     localtime_r(&t, &tm_e);
16008
16009     putenv(tz_w);
16010     localtime_r(&t, &tm_w);
16011
16012     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
16013         return 1;
16014     return 0;
16015 }
16016 EOCP
16017         set try
16018         if eval $compile; then
16019             if $run ./try; then
16020                 d_localtime_r_needs_tzset=undef;
16021             else
16022                 d_localtime_r_needs_tzset=define;
16023             fi;
16024         else
16025             d_localtime_r_needs_tzset=undef;
16026         fi;
16027      ;;
16028   *)
16029      d_localtime_r_needs_tzset=undef;
16030      ;;
16031 esac
16032 $rm_try
16033
16034 : see if localeconv exists
16035 set localeconv d_locconv
16036 eval $inlibc
16037
16038 : see if libc has the POSIX.1-2008 currency locale rules
16039 case "$d_locconv:$d_lc_monetary_2008" in
16040   $define:)
16041         $cat >try.c <<EOCP
16042 #include <locale.h>
16043 int main() {
16044         struct lconv *lc = localeconv();
16045         char int_p_cs_precedes = lc->int_p_cs_precedes;
16046         return 0;
16047 }
16048 EOCP
16049         set try
16050         if eval $compile; then
16051                 d_lc_monetary_2008="$define"
16052         else
16053                 d_lc_monetary_2008="$undef"
16054         fi;
16055         $rm_try
16056         ;;
16057 esac
16058
16059 : see if lockf exists
16060 set lockf d_lockf
16061 eval $inlibc
16062
16063 : see if prototype for lseek is available
16064 echo " "
16065 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
16066 eval $hasproto
16067
16068 : see if lstat exists
16069 set lstat d_lstat
16070 eval $inlibc
16071
16072 : see if madvise exists
16073 set madvise d_madvise
16074 eval $inlibc
16075
16076 : see if malloc_size exists
16077 set malloc_size d_malloc_size
16078 eval $inlibc
16079
16080 : see if malloc_size_good exists
16081 set malloc_good_size d_malloc_good_size
16082 eval $inlibc
16083
16084 : see if mblen exists
16085 set mblen d_mblen
16086 eval $inlibc
16087
16088 : see if mbstowcs exists
16089 set mbstowcs d_mbstowcs
16090 eval $inlibc
16091
16092 : see if mbtowc exists
16093 set mbtowc d_mbtowc
16094 eval $inlibc
16095
16096 : see if memchr exists
16097 set memchr d_memchr
16098 eval $inlibc
16099
16100 : see if memcmp exists
16101 set memcmp d_memcmp
16102 eval $inlibc
16103
16104 : see if memcpy exists
16105 set memcpy d_memcpy
16106 eval $inlibc
16107
16108 : see if memmove exists
16109 set memmove d_memmove
16110 eval $inlibc
16111
16112 : see if memset exists
16113 set memset d_memset
16114 eval $inlibc
16115
16116 : see if mkdir exists
16117 set mkdir d_mkdir
16118 eval $inlibc
16119
16120 : see if mkdtemp exists
16121 set mkdtemp d_mkdtemp
16122 eval $inlibc
16123
16124 : see if mkfifo exists
16125 set mkfifo d_mkfifo
16126 eval $inlibc
16127
16128 : see if mkstemp exists
16129 set mkstemp d_mkstemp
16130 eval $inlibc
16131
16132 : see if mkstemps exists
16133 set mkstemps d_mkstemps
16134 eval $inlibc
16135
16136 : see if mktime exists
16137 set mktime d_mktime
16138 eval $inlibc
16139
16140 : see if this is a sys/mman.h system
16141 set sys/mman.h i_sysmman
16142 eval $inhdr
16143
16144 : see if mmap exists
16145 set mmap d_mmap
16146 eval $inlibc
16147 : see what shmat returns
16148 : default to something harmless
16149 mmaptype='void *'
16150 case "$i_sysmman$d_mmap" in
16151 "$define$define")
16152         $cat >mmap.c <<'END'
16153 #include <sys/mman.h>
16154 void *mmap();
16155 END
16156         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
16157                 mmaptype='void *'
16158         else
16159                 mmaptype='caddr_t'
16160         fi
16161         echo "and it returns ($mmaptype)." >&4
16162         ;;
16163 esac
16164
16165
16166
16167 : see if sqrtl exists
16168 set sqrtl d_sqrtl
16169 eval $inlibc
16170
16171 : see if scalbnl exists
16172 set scalbnl d_scalbnl
16173 eval $inlibc
16174
16175 : see if truncl exists
16176 set truncl d_truncl
16177 eval $inlibc
16178
16179 : see if modfl exists
16180 set modfl d_modfl
16181 eval $inlibc
16182
16183 : see if prototype for modfl is available
16184 echo " "
16185 set d_modflproto modfl $i_math math.h
16186 eval $hasproto
16187
16188 d_modfl_pow32_bug="$undef"
16189
16190 case "$d_longdbl$d_modfl" in
16191 $define$define)
16192         $cat <<EOM
16193 Checking to see whether your modfl() is okay for large values...
16194 EOM
16195 $cat >try.c <<EOCP
16196 #include <math.h>
16197 #include <stdio.h>
16198 EOCP
16199 if $test "X$d_modflproto" != "X$define"; then
16200         $cat >>try.c <<EOCP
16201 /* Sigh. many current glibcs provide the function, but do not prototype it. */
16202 long double modfl (long double, long double *);
16203 EOCP
16204 fi
16205 $cat >>try.c <<EOCP
16206 int main() {
16207     long double nv = 4294967303.15;
16208     long double v, w;
16209     v = modfl(nv, &w);
16210 #ifdef __GLIBC__
16211     printf("glibc");
16212 #endif
16213     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
16214     return 0;
16215 }
16216 EOCP
16217         case "$osname:$gccversion" in
16218         aix:)   saveccflags="$ccflags"
16219                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
16220         esac
16221         set try
16222         if eval $compile; then
16223                 foo=`$run ./try`
16224                 case "$foo" in
16225                 *" 4294967303.150000 1.150000 4294967302.000000")
16226                         echo >&4 "Your modfl() is broken for large values."
16227                         d_modfl_pow32_bug="$define"
16228                         case "$foo" in
16229                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
16230                         ;;
16231                         esac
16232                         ;;
16233                 *" 4294967303.150000 0.150000 4294967303.000000")
16234                         echo >&4 "Your modfl() seems okay for large values."
16235                         ;;
16236                 *)      echo >&4 "I don't understand your modfl() at all."
16237                         d_modfl="$undef"
16238                         ;;
16239                 esac
16240                 $rm_try
16241         else
16242                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
16243                 d_modfl="$undef"
16244         fi
16245         case "$osname:$gccversion" in
16246         aix:)   ccflags="$saveccflags" ;; # restore
16247         esac
16248         ;;
16249 esac
16250
16251 if $test "$uselongdouble" = "$define"; then
16252     message=""
16253     if $test "$d_sqrtl" != "$define"; then
16254         message="$message sqrtl"
16255     fi
16256     if $test "$d_modfl" != "$define"; then
16257         if $test "$d_truncl:$d_copysignl" = "$define:$define"; then
16258             echo "You have both truncl and copysignl, so I can emulate modfl."
16259         else
16260             if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
16261                 echo "You have both aintl and copysignl, so I can emulate modfl."
16262             else
16263                 message="$message modfl"
16264             fi
16265         fi
16266     fi
16267     if $test "$d_frexpl" != "$define"; then
16268         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
16269             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
16270         else
16271             message="$message frexpl"
16272         fi
16273     fi
16274     if $test "$d_ldexpl" != "$define"; then
16275         message="$message ldexpl"
16276     fi
16277
16278     if $test "$message" != ""; then
16279         $cat <<EOM >&4
16280
16281 *** You requested the use of long doubles but you do not seem to have
16282 *** the following mathematical functions needed for long double support:
16283 ***    $message
16284 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
16285 *** Cannot continue, aborting.
16286
16287 EOM
16288
16289         exit 1
16290     fi
16291 fi
16292
16293 : see if mprotect exists
16294 set mprotect d_mprotect
16295 eval $inlibc
16296
16297 : see if msgctl exists
16298 set msgctl d_msgctl
16299 eval $inlibc
16300
16301 : see if msgget exists
16302 set msgget d_msgget
16303 eval $inlibc
16304
16305 : see if msgsnd exists
16306 set msgsnd d_msgsnd
16307 eval $inlibc
16308
16309 : see if msgrcv exists
16310 set msgrcv d_msgrcv
16311 eval $inlibc
16312
16313 : see how much of the 'msg*(2)' library is present.
16314 h_msg=true
16315 echo " "
16316 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
16317 *"$undef"*) h_msg=false;;
16318 esac
16319 case "$osname" in
16320 freebsd)
16321     case "`ipcs 2>&1`" in
16322     "SVID messages"*"not configured"*)
16323         echo "Your $osname does not have the msg*(2) configured." >&4
16324         h_msg=false
16325         val="$undef"
16326         set msgctl d_msgctl
16327         eval $setvar
16328         set msgget d_msgget
16329         eval $setvar
16330         set msgsnd d_msgsnd
16331         eval $setvar
16332         set msgrcv d_msgrcv
16333         eval $setvar
16334         ;;
16335     esac
16336     ;;
16337 esac
16338 : we could also check for sys/ipc.h ...
16339 if $h_msg && $test `./findhdr sys/msg.h`; then
16340         echo "You have the full msg*(2) library." >&4
16341         val="$define"
16342 else
16343         echo "You don't have the full msg*(2) library." >&4
16344         val="$undef"
16345 fi
16346 set d_msg
16347 eval $setvar
16348
16349 : Check for msghdr_s
16350 echo " "
16351 echo "Checking to see if your system supports struct msghdr..." >&4
16352 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
16353 eval $hasstruct
16354 case "$d_msghdr_s" in
16355 "$define")      echo "Yes, it does."   ;;
16356 *)              echo "No, it doesn't." ;;
16357 esac
16358
16359
16360 : see if msync exists
16361 set msync d_msync
16362 eval $inlibc
16363
16364 : see if munmap exists
16365 set munmap d_munmap
16366 eval $inlibc
16367
16368 : see if nice exists
16369 set nice d_nice
16370 eval $inlibc
16371
16372 : see if this is a langinfo.h system
16373 set langinfo.h i_langinfo
16374 eval $inhdr
16375
16376 : see if nl_langinfo exists
16377 set nl_langinfo d_nl_langinfo
16378 eval $inlibc
16379
16380 : check for volatile keyword
16381 echo " "
16382 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
16383 $cat >try.c <<'EOCP'
16384 int main()
16385 {
16386         typedef struct _goo_struct goo_struct;
16387         goo_struct * volatile goo = ((goo_struct *)0);
16388         struct _goo_struct {
16389                 long long_int;
16390                 int reg_int;
16391                 char char_var;
16392         };
16393         typedef unsigned short foo_t;
16394         char *volatile foo;
16395         volatile int bar;
16396         volatile foo_t blech;
16397         foo = foo;
16398 }
16399 EOCP
16400 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
16401         val="$define"
16402         echo "Yup, it does."
16403 else
16404         val="$undef"
16405         echo "Nope, it doesn't."
16406 fi
16407 set d_volatile
16408 eval $setvar
16409 $rm_try
16410
16411 : Check basic sizes
16412 echo " "
16413 $echo "Choosing the C types to be used for Perl's internal types..." >&4
16414
16415 case "$use64bitint:$d_quad:$quadtype" in
16416 define:define:?*)
16417         ivtype="$quadtype"
16418         uvtype="$uquadtype"
16419         ivsize=8
16420         uvsize=8
16421         ;;
16422 *)      ivtype="long"
16423         uvtype="unsigned long"
16424         ivsize=$longsize
16425         uvsize=$longsize
16426         ;;
16427 esac
16428
16429 case "$uselongdouble:$d_longdbl" in
16430 define:define)
16431         nvtype="long double"
16432         nvsize=$longdblsize
16433         ;;
16434 *)      nvtype=double
16435         nvsize=$doublesize
16436         ;;
16437 esac
16438
16439 case "$usequadmath:$i_quadmath" in
16440 define:define)
16441   nvtype="__float128"
16442   nvsize=16
16443   case "$libs" in
16444   *quadmath*) ;;
16445   *) $cat <<EOM >&4
16446
16447 *** You requested the use of the quadmath library, but you
16448 *** do not seem to have the quadmath library installed.
16449 *** Cannot continue, aborting.
16450 EOM
16451     exit 1
16452     ;;
16453   esac
16454   ;;
16455 define:*) $cat <<EOM >&4
16456
16457 *** You requested the use of the quadmath library, but you
16458 *** do not seem to have the required header, <quadmath.h>.
16459 EOM
16460   case "$gccversion" in
16461   [23].*|4.[0-5]*)
16462    $cat <<EOM >&4
16463 *** Your gcc looks a bit old:
16464 *** $gccversion
16465 EOM
16466     ;;
16467   '')
16468    $cat <<EOM >&4
16469 *** You are not running a gcc.
16470 EOM
16471     ;;
16472   esac
16473   $cat <<EOM >&4
16474 *** For the quadmath library you need at least gcc 4.6.
16475 *** Cannot continue, aborting.
16476 EOM
16477   exit 1
16478   ;;
16479 esac
16480
16481 $echo "(IV will be "$ivtype", $ivsize bytes)"
16482 $echo "(UV will be "$uvtype", $uvsize bytes)"
16483 $echo "(NV will be "$nvtype", $nvsize bytes)"
16484
16485 $cat >try.c <<EOCP
16486 #$i_inttypes I_INTTYPES
16487 #ifdef I_INTTYPES
16488 #include <inttypes.h>
16489 #endif
16490 #include <stdio.h>
16491 int main() {
16492 #ifdef INT8
16493    int8_t i =  INT8_MAX;
16494   uint8_t u = UINT8_MAX;
16495   printf("int8_t\n");
16496 #endif
16497 #ifdef INT16
16498    int16_t i =  INT16_MAX;
16499   uint16_t u = UINT16_MAX;
16500   printf("int16_t\n");
16501 #endif
16502 #ifdef INT32
16503    int32_t i =  INT32_MAX;
16504   uint32_t u = UINT32_MAX;
16505   printf("int32_t\n");
16506 #endif
16507 }
16508 EOCP
16509
16510 i8type="signed char"
16511 u8type="unsigned char"
16512 i8size=1
16513 u8size=1
16514
16515 case "$i16type" in
16516 '')     case "$shortsize" in
16517         2)      i16type=short
16518                 u16type="unsigned short"
16519                 i16size=$shortsize
16520                 u16size=$shortsize
16521                 ;;
16522         esac
16523         ;;
16524 esac
16525 case "$i16type" in
16526 '')     set try -DINT16
16527         if eval $compile; then
16528                 case "`$run ./try`" in
16529                 int16_t)
16530                         i16type=int16_t
16531                         u16type=uint16_t
16532                         i16size=2
16533                         u16size=2
16534                         ;;
16535                 esac
16536         fi
16537         ;;
16538 esac
16539 case "$i16type" in
16540 '')     if $test $shortsize -ge 2; then
16541                 i16type=short
16542                 u16type="unsigned short"
16543                 i16size=$shortsize
16544                 u16size=$shortsize
16545         fi
16546         ;;
16547 esac
16548
16549 case "$i32type" in
16550 '')     case "$longsize" in
16551         4)      i32type=long
16552                 u32type="unsigned long"
16553                 i32size=$longsize
16554                 u32size=$longsize
16555                 ;;
16556         *)      case "$intsize" in
16557                 4)      i32type=int
16558                         u32type="unsigned int"
16559                         i32size=$intsize
16560                         u32size=$intsize
16561                         ;;
16562                 esac
16563                 ;;
16564         esac
16565         ;;
16566 esac
16567 case "$i32type" in
16568 '')     set try -DINT32
16569         if eval $compile; then
16570                 case "`$run ./try`" in
16571                 int32_t)
16572                         i32type=int32_t
16573                         u32type=uint32_t
16574                         i32size=4
16575                         u32size=4
16576                         ;;
16577                 esac
16578         fi
16579         ;;
16580 esac
16581 case "$i32type" in
16582 '')     if $test $intsize -ge 4; then
16583                 i32type=int
16584                 u32type="unsigned int"
16585                 i32size=$intsize
16586                 u32size=$intsize
16587         fi
16588         ;;
16589 esac
16590
16591 case "$i64type" in
16592 '')     case "$d_quad:$quadtype" in
16593         define:?*)
16594                 i64type="$quadtype"
16595                 u64type="$uquadtype"
16596                 i64size=8
16597                 u64size=8
16598                 ;;
16599         esac
16600         ;;
16601 esac
16602
16603 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
16604 : volatile so that the compiler has to store it out to memory.
16605 if test X"$d_volatile" = X"$define"; then
16606         volatile=volatile
16607 fi
16608 $cat <<EOP >try.c
16609 #include <stdio.h>
16610 #$i_stdlib I_STDLIB
16611 #ifdef I_STDLIB
16612 #include <stdlib.h>
16613 #endif
16614 #include <sys/types.h>
16615 #include <signal.h>
16616 #ifdef SIGFPE
16617 $volatile int bletched = 0;
16618 $signal_t blech(int s) { bletched = 1; }
16619 #endif
16620 int main() {
16621     $uvtype u = 0;
16622     $nvtype d;
16623     int     n = 8 * $uvsize;
16624     int     i;
16625 #ifdef SIGFPE
16626     signal(SIGFPE, blech);
16627 #endif
16628
16629     for (i = 0; i < n; i++) {
16630       u = u << 1 | ($uvtype)1;
16631       d = ($nvtype)u;
16632       if (($uvtype)d != u)
16633         break;
16634       if (d <= 0)
16635         break;
16636       d = ($nvtype)(u - 1);
16637       if (($uvtype)d != (u - 1))
16638         break;
16639 #ifdef SIGFPE
16640       if (bletched)
16641         break;
16642 #endif
16643     }
16644     printf("%d\n", ((i == n) ? -n : i));
16645     exit(0);
16646 }
16647 EOP
16648 set try
16649
16650 d_nv_preserves_uv="$undef"
16651 if eval $compile; then
16652         nv_preserves_uv_bits="`$run ./try`"
16653 fi
16654 case "$nv_preserves_uv_bits" in
16655 \-[1-9]*)
16656         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
16657         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
16658         d_nv_preserves_uv="$define"
16659         ;;
16660 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
16661         d_nv_preserves_uv="$undef" ;;
16662 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
16663         nv_preserves_uv_bits="0" ;;
16664 esac
16665 $rm_try
16666
16667 $echo "Checking to find the largest integer value your NVs can hold..." >&4
16668 : volatile so that the compiler has to store it out to memory.
16669 if test X"$d_volatile" = X"$define"; then
16670         volatile=volatile
16671 fi
16672 $cat <<EOP >try.c
16673 #include <stdio.h>
16674
16675 typedef $nvtype NV;
16676
16677 int
16678 main() {
16679   NV value = 2;
16680   int count = 1;
16681
16682   while(count < 256) {
16683     $volatile NV up = value + 1.0;
16684     $volatile NV negated = -value;
16685     $volatile NV down = negated - 1.0;
16686     $volatile NV got_up = up - value;
16687     int up_good = got_up == 1.0;
16688     int got_down = down - negated;
16689     int down_good = got_down == -1.0;
16690
16691     if (down_good != up_good) {
16692       fprintf(stderr,
16693               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
16694               up_good, (double) got_up, down_good, (double) got_down,
16695               count, (double) value);
16696       return 1;
16697     }
16698     if (!up_good) {
16699       while (1) {
16700         if (count > 8) {
16701           count -= 8;
16702           fputs("256.0", stdout);
16703         } else {
16704           count--;
16705           fputs("2.0", stdout);
16706         }
16707         if (!count) {
16708           puts("");
16709           return 0;
16710         }
16711         fputs("*", stdout);
16712       }
16713     }
16714     value *= 2;
16715     ++count;
16716   }
16717   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
16718           count, (double) value);
16719   return 1;
16720 }
16721 EOP
16722 set try
16723
16724 nv_overflows_integers_at='0'
16725 if eval $compile; then
16726     xxx="`$run ./try`"
16727     case "$?" in
16728         0)
16729             case "$xxx" in
16730                 2*)  cat >&4 <<EOM
16731 The largest integer your NVs can preserve is equal to $xxx
16732 EOM
16733                     nv_overflows_integers_at="$xxx"
16734                     ;;
16735                 *)  cat >&4 <<EOM
16736 Cannot determine the largest integer value your NVs can hold, unexpected output
16737 '$xxx'
16738 EOM
16739                     ;;
16740             esac
16741             ;;
16742         *)  cat >&4 <<EOM
16743 Cannot determine the largest integer value your NVs can hold
16744 EOM
16745             ;;
16746     esac
16747 fi
16748 $rm_try
16749
16750 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
16751 : volatile so that the compiler has to store it out to memory.
16752 if test X"$d_volatile" = X"$define"; then
16753         volatile=volatile
16754 fi
16755 $cat <<EOP >try.c
16756 #include <stdio.h>
16757 #$i_stdlib I_STDLIB
16758 #ifdef I_STDLIB
16759 #include <stdlib.h>
16760 #endif
16761 #$i_string I_STRING
16762 #ifdef I_STRING
16763 #  include <string.h>
16764 #else
16765 #  include <strings.h>
16766 #endif
16767 #include <sys/types.h>
16768 #include <signal.h>
16769 #ifdef SIGFPE
16770 $volatile int bletched = 0;
16771 $signal_t blech(int s) { bletched = 1; }
16772 #endif
16773
16774 int checkit($nvtype d, char *where) {
16775     unsigned char *p = (char *)&d;
16776     unsigned char *end = p + sizeof(d);
16777     int fail = 0;
16778
16779     while (p < end)
16780         fail += *p++;
16781
16782     if (!fail)
16783         return 0;
16784
16785     p = (char *)&d;
16786     printf("No - %s: 0x", where);
16787     while (p < end)
16788         printf ("%02X", *p++);
16789     printf("\n");
16790     return 1;
16791 }
16792
16793 int main(int argc, char **argv) {
16794     $nvtype d = 0.0;
16795     int fail = 0;
16796     fail += checkit(d, "0.0");
16797
16798     /* The compiler shouldn't be assuming that bletched is 0  */
16799     d = bletched;
16800
16801     fail += checkit(d, "bleched");
16802
16803 #ifdef SIGFPE
16804     signal(SIGFPE, blech);
16805 #endif
16806
16807     /* Paranoia - the compiler should have no way of knowing that ANSI says
16808        that argv[argc] will always be NULL.  Actually, if it did assume this it
16809        would be buggy, as this is C and main() can be called from elsewhere in
16810        the program.  */
16811     d = argv[argc] ? 1 : 0;
16812
16813     if (d) {
16814         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16815     }
16816
16817     fail += checkit(d, "ternary");
16818
16819     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16820
16821     if (d != 0.0) {
16822         printf("No - memset doesn't give 0.0\n");
16823         /* This might just blow up:  */
16824         printf("(gives %g)\n", d);
16825         return 1;
16826     }
16827
16828 #ifdef SIGFPE
16829     if (bletched) {
16830         printf("No - something bleched\n");
16831         return 1;
16832     }
16833 #endif
16834     if (fail) {
16835       printf("No - %d fail(s)\n", fail);
16836       return 1;
16837     }
16838     printf("Yes\n");
16839     return 0;
16840 }
16841 EOP
16842 set try
16843
16844 d_nv_zero_is_allbits_zero="$undef"
16845 if eval $compile; then
16846     xxx="`$run ./try`"
16847     case "$?" in
16848         0)
16849             case "$xxx" in
16850                 Yes)  cat >&4 <<EOM
16851 0.0 is represented as all bits zero in memory
16852 EOM
16853                     d_nv_zero_is_allbits_zero="$define"
16854                     ;;
16855                 *)  cat >&4 <<EOM
16856 0.0 is not represented as all bits zero in memory
16857 EOM
16858                     d_nv_zero_is_allbits_zero="$undef"
16859                     ;;
16860             esac
16861             ;;
16862         *)  cat >&4 <<EOM
16863 0.0 is not represented as all bits zero in memory
16864 EOM
16865             d_nv_zero_is_allbits_zero="$undef"
16866             ;;
16867     esac
16868 fi
16869 $rm_try
16870
16871 : check for off64_t
16872 echo " "
16873 echo "Checking to see if you have off64_t..." >&4
16874 $cat >try.c <<EOCP
16875 #include <sys/types.h>
16876 #include <unistd.h>
16877 int main() { off64_t x = 7; }
16878 EOCP
16879 set try
16880 if eval $compile; then
16881         val="$define"
16882         echo "You have off64_t."
16883 else
16884         val="$undef"
16885         echo "You do not have off64_t."
16886         case "$lseeksize" in
16887         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16888         esac
16889 fi
16890 $rm_try
16891 set d_off64_t
16892 eval $setvar
16893
16894 : how to create joinable pthreads
16895 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16896         echo " "
16897         echo "Checking what constant to use for creating joinable pthreads..." >&4
16898         $cat >try.c <<'EOCP'
16899 #include <pthread.h>
16900 int main() {
16901     int detachstate = JOINABLE;
16902 }
16903 EOCP
16904         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16905         if eval $compile; then
16906                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16907                 val="$undef" # Yes, undef.
16908                 set d_old_pthread_create_joinable
16909                 eval $setvar
16910                 val=""
16911                 set old_pthread_create_joinable
16912                 eval $setvar
16913         else
16914                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16915                 if eval $compile; then
16916                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16917                         val="$define"
16918                         set d_old_pthread_create_joinable
16919                         eval $setvar
16920                         val=PTHREAD_CREATE_UNDETACHED
16921                         set old_pthread_create_joinable
16922                         eval $setvar
16923                 else
16924                         set try -DJOINABLE=__UNDETACHED
16925                         if eval $compile; then
16926                                 echo "You seem to use __UNDETACHED." >&4
16927                                 val="$define"
16928                                 set d_old_pthread_create_joinable
16929                                 eval $setvar
16930                                 val=__UNDETACHED
16931                                 set old_pthread_create_joinable
16932                                 eval $setvar
16933                         else
16934                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16935                                 val="$define"
16936                                 set d_old_pthread_create_joinable
16937                                 eval $setvar
16938                                 val=0
16939                                 set old_pthread_create_joinable
16940                                 eval $setvar
16941                         fi
16942                 fi
16943         fi
16944         $rm_try
16945 else
16946     d_old_pthread_create_joinable="$undef"
16947     old_pthread_create_joinable=""
16948 fi
16949
16950 : see if pause exists
16951 set pause d_pause
16952 eval $inlibc
16953
16954 : see if poll exists
16955 set poll d_poll
16956 eval $inlibc
16957
16958 : see if prctl exists
16959 set prctl d_prctl
16960 eval $inlibc
16961
16962 : see if prctl supports PR_SET_NAME
16963 d_prctl_set_name=$undef
16964 case $d_prctl in
16965     $define)
16966         $cat >try.c <<EOM
16967 #ifdef __ANDROID__
16968 #include <unistd.h>
16969 #endif
16970 #include <sys/prctl.h>
16971
16972 int main (int argc, char *argv[])
16973 {
16974     return (prctl (PR_SET_NAME, "Test"));
16975     } /* main */
16976 EOM
16977         set try
16978         if eval $compile_ok && $run ./try; then
16979             echo "Your prctl (PR_SET_NAME, ...) works"
16980             d_prctl_set_name=$define
16981             fi
16982         $rm_try
16983         ;;
16984     esac
16985
16986 : see if readlink exists
16987 set readlink d_readlink
16988 eval $inlibc
16989
16990 : Check if exe is symlink to abs path of executing program
16991 echo " "
16992 procselfexe=''
16993 val="$undef"
16994 case "$d_readlink" in
16995     "$define")
16996         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16997         : more tidy to avoid an extra level of symlink
16998         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16999         while test $# -gt 0; do
17000             type=$1; try=$2
17001             shift; shift
17002             if $issymlink $try; then
17003                 $ls -l $try > reflect
17004                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
17005                     echo "You have $type-like $try."
17006                     procselfexe='"'$try'"'
17007                     val="$define"
17008                     : This will break out of the loop
17009                     set X; shift
17010                 fi
17011             fi
17012         done
17013         ;;
17014 esac
17015 $rm -f reflect
17016 set d_procselfexe
17017 eval $setvar
17018
17019 : backward compatibility for d_hvfork
17020 if test X$d_hvfork != X; then
17021         d_vfork="$d_hvfork"
17022         d_hvfork=''
17023 fi
17024 : see if there is a vfork
17025 val=''
17026 set vfork val
17027 eval $inlibc
17028
17029 d_pseudofork=$undef
17030
17031 : Ok, but do we want to use it. vfork is reportedly unreliable in
17032 : perl on Solaris 2.x, and probably elsewhere.
17033 case "$val" in
17034 $define)
17035         echo " "
17036         case "$usevfork" in
17037         false) dflt='n';;
17038         *) dflt='y';;
17039         esac
17040         cat <<'EOM'
17041
17042 Perl can only use a vfork() that doesn't suffer from strict
17043 restrictions on calling functions or modifying global data in
17044 the child.  For example, glibc-2.1 contains such a vfork()
17045 that is unsuitable.  If your system provides a proper fork()
17046 call, chances are that you do NOT want perl to use vfork().
17047
17048 EOM
17049         rp="Do you still want to use vfork()?"
17050         . ./myread
17051         case "$ans" in
17052         y|Y) ;;
17053         *)
17054                 echo "Ok, we won't use vfork()."
17055                 val="$undef"
17056                 ;;
17057         esac
17058         ;;
17059 esac
17060 set d_vfork
17061 eval $setvar
17062 case "$d_vfork" in
17063 $define) usevfork='true';;
17064 *) usevfork='false';;
17065 esac
17066
17067 : see whether the pthread_atfork exists
17068 $cat >try.c <<EOP
17069 #include <pthread.h>
17070 #include <stdio.h>
17071 int main() {
17072 #ifdef  PTHREAD_ATFORK
17073         pthread_atfork(NULL,NULL,NULL);
17074 #endif
17075 }
17076 EOP
17077
17078 : see if pthread_atfork exists
17079 set try -DPTHREAD_ATFORK
17080 if eval $compile; then
17081     val="$define"
17082 else
17083     val="$undef"
17084 fi
17085 case "$usethreads" in
17086 $define)
17087         case "$val" in
17088         $define) echo 'pthread_atfork found.' >&4        ;;
17089         *)       echo 'pthread_atfork NOT found.' >&4    ;;
17090         esac
17091 esac
17092 set d_pthread_atfork
17093 eval $setvar
17094
17095 : see if pthread_attr_setscope exists
17096 set pthread_attr_setscope d_pthread_attr_setscope
17097 eval $inlibc
17098
17099 : see whether the various POSIXish _yields exist
17100 $cat >try.c <<EOP
17101 #include <pthread.h>
17102 #include <stdio.h>
17103 int main() {
17104 #ifdef SCHED_YIELD
17105         sched_yield();
17106 #else
17107 #ifdef PTHREAD_YIELD
17108         pthread_yield();
17109 #else
17110 #ifdef PTHREAD_YIELD_NULL
17111         pthread_yield(NULL);
17112 #endif
17113 #endif
17114 #endif
17115 }
17116 EOP
17117 : see if sched_yield exists
17118 set try -DSCHED_YIELD
17119 if eval $compile; then
17120     val="$define"
17121     sched_yield='sched_yield()'
17122 else
17123     val="$undef"
17124 fi
17125 case "$usethreads" in
17126 $define)
17127         case "$val" in
17128         $define) echo 'sched_yield() found.' >&4        ;;
17129         *)       echo 'sched_yield() NOT found.' >&4    ;;
17130         esac
17131 esac
17132 set d_sched_yield
17133 eval $setvar
17134
17135 : see if pthread_yield exists
17136 set try -DPTHREAD_YIELD
17137 if eval $compile; then
17138     val="$define"
17139     case "$sched_yield" in
17140     '') sched_yield='pthread_yield()' ;;
17141     esac
17142 else
17143     set try -DPTHREAD_YIELD_NULL
17144     if eval $compile; then
17145         val="$define"
17146         case "$sched_yield" in
17147         '') sched_yield='pthread_yield(NULL)' ;;
17148         esac
17149     else
17150         val="$undef"
17151     fi
17152 fi
17153 case "$usethreads" in
17154 $define)
17155         case "$val" in
17156         $define) echo 'pthread_yield() found.' >&4      ;;
17157         *)       echo 'pthread_yield() NOT found.' >&4  ;;
17158         esac
17159         ;;
17160 esac
17161 set d_pthread_yield
17162 eval $setvar
17163 case "$sched_yield" in
17164 '') sched_yield=undef ;;
17165 esac
17166 $rm_try
17167
17168 : check for ptrdiff_t
17169 echo " "
17170 echo "Checking to see if you have ptrdiff_t..." >&4
17171 $cat >try.c <<EOCP
17172 #include <stddef.h>
17173 int main() { ptrdiff_t x = 7; }
17174 EOCP
17175 set try
17176 if eval $compile; then
17177         val="$define"
17178         echo "You have ptrdiff_t."
17179 else
17180         val="$undef"
17181         echo "You do not have ptrdiff_t."
17182 fi
17183 $rm_try
17184 set d_ptrdiff_t
17185 eval $setvar
17186
17187 : see if random_r exists
17188 set random_r d_random_r
17189 eval $inlibc
17190 case "$d_random_r" in
17191 "$define")
17192         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17193         case "$d_random_r_proto:$usethreads" in
17194         ":define")      d_random_r_proto=define
17195                 set d_random_r_proto random_r $hdrs
17196                 eval $hasproto ;;
17197         *)      ;;
17198         esac
17199         case "$d_random_r_proto" in
17200         define)
17201         case "$random_r_proto" in
17202         ''|0) try='int random_r(int*, struct random_data*);'
17203         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
17204         esac
17205         case "$random_r_proto" in
17206         ''|0) try='int random_r(long*, struct random_data*);'
17207         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
17208         esac
17209         case "$random_r_proto" in
17210         ''|0) try='int random_r(struct random_data*, int32_t*);'
17211         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
17212         esac
17213         case "$random_r_proto" in
17214         ''|0)   d_random_r=undef
17215                 random_r_proto=0
17216                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
17217         * )     case "$random_r_proto" in
17218                 REENTRANT_PROTO*) ;;
17219                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
17220                 esac
17221                 echo "Prototype: $try" ;;
17222         esac
17223         ;;
17224         *)      case "$usethreads" in
17225                 define) echo "random_r has no prototype, not using it." >&4 ;;
17226                 esac
17227                 d_random_r=undef
17228                 random_r_proto=0
17229                 ;;
17230         esac
17231         ;;
17232 *)      random_r_proto=0
17233         ;;
17234 esac
17235
17236 : see if readdir and friends exist
17237 set readdir d_readdir
17238 eval $inlibc
17239 set seekdir d_seekdir
17240 eval $inlibc
17241 set telldir d_telldir
17242 eval $inlibc
17243 set rewinddir d_rewinddir
17244 eval $inlibc
17245
17246 : see if readdir64_r exists
17247 set readdir64_r d_readdir64_r
17248 eval $inlibc
17249 case "$d_readdir64_r" in
17250 "$define")
17251         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17252         case "$d_readdir64_r_proto:$usethreads" in
17253         ":define")      d_readdir64_r_proto=define
17254                 set d_readdir64_r_proto readdir64_r $hdrs
17255                 eval $hasproto ;;
17256         *)      ;;
17257         esac
17258         case "$d_readdir64_r_proto" in
17259         define)
17260         case "$readdir64_r_proto" in
17261         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
17262         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
17263         esac
17264         case "$readdir64_r_proto" in
17265         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
17266         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
17267         esac
17268         case "$readdir64_r_proto" in
17269         ''|0)   d_readdir64_r=undef
17270                 readdir64_r_proto=0
17271                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
17272         * )     case "$readdir64_r_proto" in
17273                 REENTRANT_PROTO*) ;;
17274                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
17275                 esac
17276                 echo "Prototype: $try" ;;
17277         esac
17278         ;;
17279         *)      case "$usethreads" in
17280                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
17281                 esac
17282                 d_readdir64_r=undef
17283                 readdir64_r_proto=0
17284                 ;;
17285         esac
17286         ;;
17287 *)      readdir64_r_proto=0
17288         ;;
17289 esac
17290
17291 : see if readdir_r exists
17292 set readdir_r d_readdir_r
17293 eval $inlibc
17294 case "$d_readdir_r" in
17295 "$define")
17296         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
17297         case "$d_readdir_r_proto:$usethreads" in
17298         ":define")      d_readdir_r_proto=define
17299                 set d_readdir_r_proto readdir_r $hdrs
17300                 eval $hasproto ;;
17301         *)      ;;
17302         esac
17303         case "$d_readdir_r_proto" in
17304         define)
17305         case "$readdir_r_proto" in
17306         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
17307         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
17308         esac
17309         case "$readdir_r_proto" in
17310         ''|0) try='int readdir_r(DIR*, struct dirent*);'
17311         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
17312         esac
17313         case "$readdir_r_proto" in
17314         ''|0)   d_readdir_r=undef
17315                 readdir_r_proto=0
17316                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
17317         * )     case "$readdir_r_proto" in
17318                 REENTRANT_PROTO*) ;;
17319                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
17320                 esac
17321                 echo "Prototype: $try" ;;
17322         esac
17323         ;;
17324         *)      case "$usethreads" in
17325                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
17326                 esac
17327                 d_readdir_r=undef
17328                 readdir_r_proto=0
17329                 ;;
17330         esac
17331         ;;
17332 *)      readdir_r_proto=0
17333         ;;
17334 esac
17335
17336 : see if readv exists
17337 set readv d_readv
17338 eval $inlibc
17339
17340 : see if recvmsg exists
17341 set recvmsg d_recvmsg
17342 eval $inlibc
17343
17344 : see if rename exists
17345 set rename d_rename
17346 eval $inlibc
17347
17348 : see if rmdir exists
17349 set rmdir d_rmdir
17350 eval $inlibc
17351
17352 : see if memory.h is available.
17353 val=''
17354 set memory.h val
17355 eval $inhdr
17356
17357 : See if it conflicts with string.h
17358 case "$val" in
17359 $define)
17360         case "$strings" in
17361         '') ;;
17362         *)
17363                 $cppstdin $cppflags $cppminus < $strings > mem.h
17364                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
17365                         echo " "
17366                         echo "We won't be including <memory.h>."
17367                         val="$undef"
17368                 fi
17369                 $rm -f mem.h
17370                 ;;
17371         esac
17372 esac
17373 set i_memory
17374 eval $setvar
17375
17376 : can bcopy handle overlapping blocks?
17377 echo " "
17378 val="$undef"
17379 case "$d_memmove" in
17380 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
17381 *)      case "$d_bcopy" in
17382         "$define")
17383                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
17384                 $cat >try.c <<EOCP
17385 #$i_memory I_MEMORY
17386 #$i_stdlib I_STDLIB
17387 #$i_string I_STRING
17388 #$i_unistd I_UNISTD
17389 EOCP
17390         $cat >>try.c <<'EOCP'
17391 #include <stdio.h>
17392 #ifdef I_MEMORY
17393 #  include <memory.h>
17394 #endif
17395 #ifdef I_STDLIB
17396 #  include <stdlib.h>
17397 #endif
17398 #ifdef I_STRING
17399 #  include <string.h>
17400 #else
17401 #  include <strings.h>
17402 #endif
17403 #ifdef I_UNISTD
17404 #  include <unistd.h>  /* Needed for NetBSD */
17405 #endif
17406 int main()
17407 {
17408 char buf[128], abc[128];
17409 char *b;
17410 int len;
17411 int off;
17412 int align;
17413
17414 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17415    try to store the string in read-only memory. */
17416 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
17417
17418 for (align = 7; align >= 0; align--) {
17419         for (len = 36; len; len--) {
17420                 b = buf+align;
17421                 bcopy(abc, b, len);
17422                 for (off = 1; off <= len; off++) {
17423                         bcopy(b, b+off, len);
17424                         bcopy(b+off, b, len);
17425                         if (bcmp(b, abc, len))
17426                                 exit(1);
17427                 }
17428         }
17429 }
17430 exit(0);
17431 }
17432 EOCP
17433                 set try
17434                 if eval $compile_ok; then
17435                         if $run ./try 2>/dev/null; then
17436                                 echo "Yes, it can."
17437                                 val="$define"
17438                         else
17439                                 echo "It can't, sorry."
17440                         fi
17441                 else
17442                         echo "(I can't compile the test program, so we'll assume not...)"
17443                 fi
17444                 ;;
17445         esac
17446         $rm_try
17447         ;;
17448 esac
17449 set d_safebcpy
17450 eval $setvar
17451
17452 : can memcpy handle overlapping blocks?
17453 echo " "
17454 val="$undef"
17455 case "$d_memmove" in
17456 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
17457 *)      case "$d_memcpy" in
17458         "$define")
17459                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
17460                 $cat >try.c <<EOCP
17461 #$i_memory I_MEMORY
17462 #$i_stdlib I_STDLIB
17463 #$i_string I_STRING
17464 #$i_unistd I_UNISTD
17465 EOCP
17466         $cat >>try.c <<'EOCP'
17467 #include <stdio.h>
17468 #ifdef I_MEMORY
17469 #  include <memory.h>
17470 #endif
17471 #ifdef I_STDLIB
17472 #  include <stdlib.h>
17473 #endif
17474 #ifdef I_STRING
17475 #  include <string.h>
17476 #else
17477 #  include <strings.h>
17478 #endif
17479 #ifdef I_UNISTD
17480 #  include <unistd.h>  /* Needed for NetBSD */
17481 #endif
17482 int main()
17483 {
17484 char buf[128], abc[128];
17485 char *b;
17486 int len;
17487 int off;
17488 int align;
17489
17490 /* Copy "abcde..." string to char abc[] so that gcc doesn't
17491    try to store the string in read-only memory. */
17492 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
17493
17494 for (align = 7; align >= 0; align--) {
17495         for (len = 36; len; len--) {
17496                 b = buf+align;
17497                 memcpy(b, abc, len);
17498                 for (off = 1; off <= len; off++) {
17499                         memcpy(b+off, b, len);
17500                         memcpy(b, b+off, len);
17501                         if (memcmp(b, abc, len))
17502                                 exit(1);
17503                 }
17504         }
17505 }
17506 exit(0);
17507 }
17508 EOCP
17509                 set try
17510                 if eval $compile_ok; then
17511                         if $run ./try 2>/dev/null; then
17512                                 echo "Yes, it can."
17513                                 val="$define"
17514                         else
17515                                 echo "It can't, sorry."
17516                         fi
17517                 else
17518                         echo "(I can't compile the test program, so we'll assume not...)"
17519                 fi
17520                 ;;
17521         esac
17522         $rm_try
17523         ;;
17524 esac
17525 set d_safemcpy
17526 eval $setvar
17527
17528 : can memcmp be trusted to compare relative magnitude?
17529 val="$undef"
17530 case "$d_memcmp" in
17531 "$define")
17532         echo " "
17533         echo "Checking if your memcmp() can compare relative magnitude..." >&4
17534         $cat >try.c <<EOCP
17535 #$i_memory I_MEMORY
17536 #$i_stdlib I_STDLIB
17537 #$i_string I_STRING
17538 #$i_unistd I_UNISTD
17539 EOCP
17540         $cat >>try.c <<'EOCP'
17541 #include <stdio.h>
17542 #ifdef I_MEMORY
17543 #  include <memory.h>
17544 #endif
17545 #ifdef I_STDLIB
17546 #  include <stdlib.h>
17547 #endif
17548 #ifdef I_STRING
17549 #  include <string.h>
17550 #else
17551 #  include <strings.h>
17552 #endif
17553 #ifdef I_UNISTD
17554 #  include <unistd.h>  /* Needed for NetBSD */
17555 #endif
17556 int main()
17557 {
17558 char a = -1;
17559 char b = 0;
17560 if ((a < b) && memcmp(&a, &b, 1) < 0)
17561         exit(1);
17562 exit(0);
17563 }
17564 EOCP
17565         set try
17566         if eval $compile_ok; then
17567                 if $run ./try 2>/dev/null; then
17568                         echo "Yes, it can."
17569                         val="$define"
17570                 else
17571                         echo "No, it can't (it uses signed chars)."
17572                 fi
17573         else
17574                 echo "(I can't compile the test program, so we'll assume not...)"
17575         fi
17576         ;;
17577 esac
17578 $rm_try
17579 set d_sanemcmp
17580 eval $setvar
17581
17582 : see if prototype for sbrk is available
17583 echo " "
17584 set d_sbrkproto sbrk $i_unistd unistd.h
17585 eval $hasproto
17586
17587 : see if select exists
17588 set select d_select
17589 eval $inlibc
17590
17591 : see if semctl exists
17592 set semctl d_semctl
17593 eval $inlibc
17594
17595 : see if semget exists
17596 set semget d_semget
17597 eval $inlibc
17598
17599 : see if semop exists
17600 set semop d_semop
17601 eval $inlibc
17602
17603 : see how much of the 'sem*(2)' library is present.
17604 h_sem=true
17605 echo " "
17606 case "$d_semctl$d_semget$d_semop" in
17607 *"$undef"*) h_sem=false;;
17608 esac
17609 case "$osname" in
17610 freebsd)
17611     case "`ipcs 2>&1`" in
17612     "SVID messages"*"not configured"*)
17613         echo "Your $osname does not have the sem*(2) configured." >&4
17614         h_sem=false
17615         val="$undef"
17616         set semctl d_semctl
17617         eval $setvar
17618         set semget d_semget
17619         eval $setvar
17620         set semop d_semop
17621         eval $setvar
17622         ;;
17623     esac
17624     ;;
17625 esac
17626 : we could also check for sys/ipc.h ...
17627 if $h_sem && $test `./findhdr sys/sem.h`; then
17628         echo "You have the full sem*(2) library." >&4
17629         val="$define"
17630 else
17631         echo "You don't have the full sem*(2) library." >&4
17632         val="$undef"
17633 fi
17634 set d_sem
17635 eval $setvar
17636
17637 : see whether sys/sem.h defines union semun
17638 echo " "
17639 $cat > try.c <<'END'
17640 #include <sys/types.h>
17641 #include <sys/ipc.h>
17642 #include <sys/sem.h>
17643 int main () { union semun semun; semun.buf = 0; }
17644 END
17645 set try
17646 if eval $compile; then
17647     echo "You have union semun in <sys/sem.h>." >&4
17648     val="$define"
17649 else
17650     echo "You do not have union semun in <sys/sem.h>." >&4
17651     val="$undef"
17652 fi
17653 $rm_try
17654 set d_union_semun
17655 eval $setvar
17656
17657 : see how to do semctl IPC_STAT
17658 case "$d_sem" in
17659 $define)
17660     echo " "
17661     $cat > tryh.h <<END
17662 #ifndef S_IRUSR
17663 #   ifdef S_IREAD
17664 #       define S_IRUSR S_IREAD
17665 #       define S_IWUSR S_IWRITE
17666 #       define S_IXUSR S_IEXEC
17667 #   else
17668 #       define S_IRUSR 0400
17669 #       define S_IWUSR 0200
17670 #       define S_IXUSR 0100
17671 #   endif
17672 #   define S_IRGRP (S_IRUSR>>3)
17673 #   define S_IWGRP (S_IWUSR>>3)
17674 #   define S_IXGRP (S_IXUSR>>3)
17675 #   define S_IROTH (S_IRUSR>>6)
17676 #   define S_IWOTH (S_IWUSR>>6)
17677 #   define S_IXOTH (S_IXUSR>>6)
17678 #endif
17679 #ifndef S_IRWXU
17680 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
17681 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
17682 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
17683 #endif
17684 END
17685     : see whether semctl IPC_STAT can use union semun
17686     case "$d_semctl_semun" in
17687     '')
17688       val="$undef"
17689       $cat > try.c <<END
17690 #include <sys/types.h>
17691 #include <sys/ipc.h>
17692 #include <sys/sem.h>
17693 #include <sys/stat.h>
17694 #include <stdio.h>
17695 #include <errno.h>
17696 #include "tryh.h"
17697 #ifndef errno
17698 extern int errno;
17699 #endif
17700 #$d_union_semun HAS_UNION_SEMUN
17701 int main() {
17702     union semun
17703 #ifndef HAS_UNION_SEMUN
17704     {
17705         int val;
17706         struct semid_ds *buf;
17707         unsigned short *array;
17708     }
17709 #endif
17710     arg;
17711     int sem, st;
17712
17713 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
17714     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17715     if (sem > -1) {
17716         struct semid_ds argbuf;
17717         arg.buf = &argbuf;
17718 #       ifdef IPC_STAT
17719         st = semctl(sem, 0, IPC_STAT, arg);
17720         if (st == 0)
17721             printf("semun\n");
17722         else
17723 #       endif /* IPC_STAT */
17724             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17725 #       ifdef IPC_RMID
17726         if (semctl(sem, 0, IPC_RMID, arg) != 0)
17727 #       endif /* IPC_RMID */
17728             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17729     } else
17730 #endif /* IPC_PRIVATE && ... */
17731         printf("semget failed: errno = %d\n", errno);
17732   return 0;
17733 }
17734 END
17735       set try
17736       if eval $compile; then
17737           xxx=`$run ./try`
17738           case "$xxx" in
17739           semun) val="$define" ;;
17740           esac
17741       fi
17742       $rm_try
17743       set d_semctl_semun
17744       eval $setvar
17745       ;;
17746     esac
17747     case "$d_semctl_semun" in
17748     $define)
17749         echo "You can use union semun for semctl IPC_STAT." >&4
17750         also='also'
17751         ;;
17752     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
17753         also=''
17754         ;;
17755     esac
17756
17757     : see whether semctl IPC_STAT can use struct semid_ds pointer
17758     case "$d_semctl_semid_ds" in
17759     '')
17760       val="$undef"
17761       $cat > try.c <<'END'
17762 #include <sys/types.h>
17763 #include <sys/ipc.h>
17764 #include <sys/sem.h>
17765 #include <sys/stat.h>
17766 #include "tryh.h"
17767 #include <stdio.h>
17768 #include <errno.h>
17769 #ifndef errno
17770 extern int errno;
17771 #endif
17772 int main() {
17773     struct semid_ds arg;
17774     int sem, st;
17775
17776 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
17777     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
17778     if (sem > -1) {
17779 #       ifdef IPC_STAT
17780         st = semctl(sem, 0, IPC_STAT, &arg);
17781         if (st == 0)
17782             printf("semid_ds\n");
17783         else
17784 #       endif /* IPC_STAT */
17785             printf("semctl IPC_STAT failed: errno = %d\n", errno);
17786 #       ifdef IPC_RMID
17787         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
17788 #       endif /* IPC_RMID */
17789             printf("semctl IPC_RMID failed: errno = %d\n", errno);
17790     } else
17791 #endif /* IPC_PRIVATE && ... */
17792         printf("semget failed: errno = %d\n", errno);
17793
17794     return 0;
17795 }
17796 END
17797       set try
17798       if eval $compile; then
17799           xxx=`$run ./try`
17800           case "$xxx" in
17801           semid_ds) val="$define" ;;
17802           esac
17803       fi
17804       $rm_try
17805       set d_semctl_semid_ds
17806       eval $setvar
17807       ;;
17808     esac
17809     case "$d_semctl_semid_ds" in
17810     $define)
17811         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
17812         ;;
17813     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17814         ;;
17815     esac
17816     ;;
17817 *)  val="$undef"
17818
17819     # We do not have the full sem*(2) library, so assume we can not
17820     # use either.
17821
17822     set d_semctl_semun
17823     eval $setvar
17824
17825     set d_semctl_semid_ds
17826     eval $setvar
17827     ;;
17828 esac
17829 $rm_try tryh.h
17830
17831 : see if sendmsg exists
17832 set sendmsg d_sendmsg
17833 eval $inlibc
17834
17835 : see if setegid exists
17836 set setegid d_setegid
17837 eval $inlibc
17838
17839 : see if seteuid exists
17840 set seteuid d_seteuid
17841 eval $inlibc
17842
17843 : see if setgrent exists
17844 set setgrent d_setgrent
17845 eval $inlibc
17846
17847 : see if setgrent_r exists
17848 set setgrent_r d_setgrent_r
17849 eval $inlibc
17850 case "$d_setgrent_r" in
17851 "$define")
17852         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17853         case "$d_setgrent_r_proto:$usethreads" in
17854         ":define")      d_setgrent_r_proto=define
17855                 set d_setgrent_r_proto setgrent_r $hdrs
17856                 eval $hasproto ;;
17857         *)      ;;
17858         esac
17859         case "$d_setgrent_r_proto" in
17860         define)
17861         case "$setgrent_r_proto" in
17862         ''|0) try='int setgrent_r(FILE**);'
17863         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17864         esac
17865         case "$setgrent_r_proto" in
17866         ''|0) try='void setgrent_r(FILE**);'
17867         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17868         esac
17869         case "$setgrent_r_proto" in
17870         ''|0)   d_setgrent_r=undef
17871                 setgrent_r_proto=0
17872                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17873         * )     case "$setgrent_r_proto" in
17874                 REENTRANT_PROTO*) ;;
17875                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17876                 esac
17877                 echo "Prototype: $try" ;;
17878         esac
17879         ;;
17880         *)      case "$usethreads" in
17881                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17882                 esac
17883                 d_setgrent_r=undef
17884                 setgrent_r_proto=0
17885                 ;;
17886         esac
17887         ;;
17888 *)      setgrent_r_proto=0
17889         ;;
17890 esac
17891
17892 : see if sethostent exists
17893 set sethostent d_sethent
17894 eval $inlibc
17895
17896 : see if sethostent_r exists
17897 set sethostent_r d_sethostent_r
17898 eval $inlibc
17899 case "$d_sethostent_r" in
17900 "$define")
17901         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17902         case "$d_sethostent_r_proto:$usethreads" in
17903         ":define")      d_sethostent_r_proto=define
17904                 set d_sethostent_r_proto sethostent_r $hdrs
17905                 eval $hasproto ;;
17906         *)      ;;
17907         esac
17908         case "$d_sethostent_r_proto" in
17909         define)
17910         case "$sethostent_r_proto" in
17911         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17912         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17913         esac
17914         case "$sethostent_r_proto" in
17915         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17916         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17917         esac
17918         case "$sethostent_r_proto" in
17919         ''|0)   d_sethostent_r=undef
17920                 sethostent_r_proto=0
17921                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17922         * )     case "$sethostent_r_proto" in
17923                 REENTRANT_PROTO*) ;;
17924                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17925                 esac
17926                 echo "Prototype: $try" ;;
17927         esac
17928         ;;
17929         *)      case "$usethreads" in
17930                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17931                 esac
17932                 d_sethostent_r=undef
17933                 sethostent_r_proto=0
17934                 ;;
17935         esac
17936         ;;
17937 *)      sethostent_r_proto=0
17938         ;;
17939 esac
17940
17941 : see if setitimer exists
17942 set setitimer d_setitimer
17943 eval $inlibc
17944
17945 : see if setlinebuf exists
17946 set setlinebuf d_setlinebuf
17947 eval $inlibc
17948
17949 : see if setlocale exists
17950 set setlocale d_setlocale
17951 eval $inlibc
17952
17953 : see if locale.h is available
17954 set locale.h i_locale
17955 eval $inhdr
17956
17957 : see if setlocale_r exists
17958 set setlocale_r d_setlocale_r
17959 eval $inlibc
17960 case "$d_setlocale_r" in
17961 "$define")
17962         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17963         case "$d_setlocale_r_proto:$usethreads" in
17964         ":define")      d_setlocale_r_proto=define
17965                 set d_setlocale_r_proto setlocale_r $hdrs
17966                 eval $hasproto ;;
17967         *)      ;;
17968         esac
17969         case "$d_setlocale_r_proto" in
17970         define)
17971         case "$setlocale_r_proto" in
17972         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17973         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17974         esac
17975         case "$setlocale_r_proto" in
17976         ''|0)   d_setlocale_r=undef
17977                 setlocale_r_proto=0
17978                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17979         * )     case "$setlocale_r_proto" in
17980                 REENTRANT_PROTO*) ;;
17981                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17982                 esac
17983                 echo "Prototype: $try" ;;
17984         esac
17985         ;;
17986         *)      case "$usethreads" in
17987                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17988                 esac
17989                 d_setlocale_r=undef
17990                 setlocale_r_proto=0
17991                 ;;
17992         esac
17993         ;;
17994 *)      setlocale_r_proto=0
17995         ;;
17996 esac
17997
17998 : see if setnetent exists
17999 set setnetent d_setnent
18000 eval $inlibc
18001
18002 : see if setnetent_r exists
18003 set setnetent_r d_setnetent_r
18004 eval $inlibc
18005 case "$d_setnetent_r" in
18006 "$define")
18007         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18008         case "$d_setnetent_r_proto:$usethreads" in
18009         ":define")      d_setnetent_r_proto=define
18010                 set d_setnetent_r_proto setnetent_r $hdrs
18011                 eval $hasproto ;;
18012         *)      ;;
18013         esac
18014         case "$d_setnetent_r_proto" in
18015         define)
18016         case "$setnetent_r_proto" in
18017         ''|0) try='int setnetent_r(int, struct netent_data*);'
18018         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
18019         esac
18020         case "$setnetent_r_proto" in
18021         ''|0) try='void setnetent_r(int, struct netent_data*);'
18022         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
18023         esac
18024         case "$setnetent_r_proto" in
18025         ''|0)   d_setnetent_r=undef
18026                 setnetent_r_proto=0
18027                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
18028         * )     case "$setnetent_r_proto" in
18029                 REENTRANT_PROTO*) ;;
18030                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
18031                 esac
18032                 echo "Prototype: $try" ;;
18033         esac
18034         ;;
18035         *)      case "$usethreads" in
18036                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
18037                 esac
18038                 d_setnetent_r=undef
18039                 setnetent_r_proto=0
18040                 ;;
18041         esac
18042         ;;
18043 *)      setnetent_r_proto=0
18044         ;;
18045 esac
18046
18047 : see if setprotoent exists
18048 set setprotoent d_setpent
18049 eval $inlibc
18050
18051 : see if setpgid exists
18052 set setpgid d_setpgid
18053 eval $inlibc
18054
18055 : see if setpgrp2 exists
18056 set setpgrp2 d_setpgrp2
18057 eval $inlibc
18058
18059 : see if setpriority exists
18060 set setpriority d_setprior
18061 eval $inlibc
18062
18063 : see if setproctitle exists
18064 set setproctitle d_setproctitle
18065 eval $inlibc
18066
18067 : see if setprotoent_r exists
18068 set setprotoent_r d_setprotoent_r
18069 eval $inlibc
18070 case "$d_setprotoent_r" in
18071 "$define")
18072         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18073         case "$d_setprotoent_r_proto:$usethreads" in
18074         ":define")      d_setprotoent_r_proto=define
18075                 set d_setprotoent_r_proto setprotoent_r $hdrs
18076                 eval $hasproto ;;
18077         *)      ;;
18078         esac
18079         case "$d_setprotoent_r_proto" in
18080         define)
18081         case "$setprotoent_r_proto" in
18082         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
18083         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
18084         esac
18085         case "$setprotoent_r_proto" in
18086         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
18087         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
18088         esac
18089         case "$setprotoent_r_proto" in
18090         ''|0)   d_setprotoent_r=undef
18091                 setprotoent_r_proto=0
18092                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
18093         * )     case "$setprotoent_r_proto" in
18094                 REENTRANT_PROTO*) ;;
18095                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
18096                 esac
18097                 echo "Prototype: $try" ;;
18098         esac
18099         ;;
18100         *)      case "$usethreads" in
18101                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
18102                 esac
18103                 d_setprotoent_r=undef
18104                 setprotoent_r_proto=0
18105                 ;;
18106         esac
18107         ;;
18108 *)      setprotoent_r_proto=0
18109         ;;
18110 esac
18111
18112 : see if setpwent exists
18113 set setpwent d_setpwent
18114 eval $inlibc
18115
18116 : see if setpwent_r exists
18117 set setpwent_r d_setpwent_r
18118 eval $inlibc
18119 case "$d_setpwent_r" in
18120 "$define")
18121         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
18122         case "$d_setpwent_r_proto:$usethreads" in
18123         ":define")      d_setpwent_r_proto=define
18124                 set d_setpwent_r_proto setpwent_r $hdrs
18125                 eval $hasproto ;;
18126         *)      ;;
18127         esac
18128         case "$d_setpwent_r_proto" in
18129         define)
18130         case "$setpwent_r_proto" in
18131         ''|0) try='int setpwent_r(FILE**);'
18132         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
18133         esac
18134         case "$setpwent_r_proto" in
18135         ''|0) try='void setpwent_r(FILE**);'
18136         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
18137         esac
18138         case "$setpwent_r_proto" in
18139         ''|0)   d_setpwent_r=undef
18140                 setpwent_r_proto=0
18141                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
18142         * )     case "$setpwent_r_proto" in
18143                 REENTRANT_PROTO*) ;;
18144                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
18145                 esac
18146                 echo "Prototype: $try" ;;
18147         esac
18148         ;;
18149         *)      case "$usethreads" in
18150                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
18151                 esac
18152                 d_setpwent_r=undef
18153                 setpwent_r_proto=0
18154                 ;;
18155         esac
18156         ;;
18157 *)      setpwent_r_proto=0
18158         ;;
18159 esac
18160
18161 : see if setregid exists
18162 set setregid d_setregid
18163 eval $inlibc
18164 set setresgid d_setresgid
18165 eval $inlibc
18166
18167 : see if setreuid exists
18168 set setreuid d_setreuid
18169 eval $inlibc
18170 set setresuid d_setresuid
18171 eval $inlibc
18172
18173 : see if setrgid exists
18174 set setrgid d_setrgid
18175 eval $inlibc
18176
18177 : see if setruid exists
18178 set setruid d_setruid
18179 eval $inlibc
18180
18181 : see if setservent exists
18182 set setservent d_setsent
18183 eval $inlibc
18184
18185 : see if setservent_r exists
18186 set setservent_r d_setservent_r
18187 eval $inlibc
18188 case "$d_setservent_r" in
18189 "$define")
18190         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
18191         case "$d_setservent_r_proto:$usethreads" in
18192         ":define")      d_setservent_r_proto=define
18193                 set d_setservent_r_proto setservent_r $hdrs
18194                 eval $hasproto ;;
18195         *)      ;;
18196         esac
18197         case "$d_setservent_r_proto" in
18198         define)
18199         case "$setservent_r_proto" in
18200         ''|0) try='int setservent_r(int, struct servent_data*);'
18201         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
18202         esac
18203         case "$setservent_r_proto" in
18204         ''|0) try='void setservent_r(int, struct servent_data*);'
18205         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
18206         esac
18207         case "$setservent_r_proto" in
18208         ''|0)   d_setservent_r=undef
18209                 setservent_r_proto=0
18210                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
18211         * )     case "$setservent_r_proto" in
18212                 REENTRANT_PROTO*) ;;
18213                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
18214                 esac
18215                 echo "Prototype: $try" ;;
18216         esac
18217         ;;
18218         *)      case "$usethreads" in
18219                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
18220                 esac
18221                 d_setservent_r=undef
18222                 setservent_r_proto=0
18223                 ;;
18224         esac
18225         ;;
18226 *)      setservent_r_proto=0
18227         ;;
18228 esac
18229
18230 : see if setsid exists
18231 set setsid d_setsid
18232 eval $inlibc
18233
18234 : see if setvbuf exists
18235 set setvbuf d_setvbuf
18236 eval $inlibc
18237
18238 : see if shmctl exists
18239 set shmctl d_shmctl
18240 eval $inlibc
18241
18242 : see if shmget exists
18243 set shmget d_shmget
18244 eval $inlibc
18245
18246 : see if shmat exists
18247 set shmat d_shmat
18248 eval $inlibc
18249 : see what shmat returns
18250 case "$d_shmat" in
18251 "$define")
18252         $cat >shmat.c <<'END'
18253 #include <sys/shm.h>
18254 void *shmat();
18255 END
18256         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
18257                 shmattype='void *'
18258         else
18259                 shmattype='char *'
18260         fi
18261         echo "and it returns ($shmattype)." >&4
18262         : see if a prototype for shmat is available
18263         xxx=`./findhdr sys/shm.h`
18264         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
18265         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
18266                 val="$define"
18267         else
18268                 val="$undef"
18269         fi
18270         $rm -f shmat.[co]
18271         ;;
18272 *)
18273         val="$undef"
18274         ;;
18275 esac
18276 set d_shmatprototype
18277 eval $setvar
18278
18279 : see if shmdt exists
18280 set shmdt d_shmdt
18281 eval $inlibc
18282
18283 : see how much of the 'shm*(2)' library is present.
18284 h_shm=true
18285 echo " "
18286 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
18287 *"$undef"*) h_shm=false;;
18288 esac
18289 case "$osname" in
18290 freebsd)
18291     case "`ipcs 2>&1`" in
18292     "SVID shared memory"*"not configured"*)
18293         echo "Your $osname does not have the shm*(2) configured." >&4
18294         h_shm=false
18295         val="$undef"
18296         set shmctl d_shmctl
18297         eval $setvar
18298         set shmget d_shmget
18299         eval $setvar
18300         set shmat d_shmat
18301         eval $setvar
18302         set shmdt d_shmdt
18303         eval $setvar
18304         ;;
18305     esac
18306     ;;
18307 esac
18308 : we could also check for sys/ipc.h ...
18309 if $h_shm && $test `./findhdr sys/shm.h`; then
18310         echo "You have the full shm*(2) library." >&4
18311         val="$define"
18312 else
18313         echo "You don't have the full shm*(2) library." >&4
18314         val="$undef"
18315 fi
18316 set d_shm
18317 eval $setvar
18318
18319 : see if we have sigaction
18320 echo " "
18321 if set sigaction val -f d_sigaction; eval $csym; $val; then
18322         echo 'sigaction() found.' >&4
18323         $cat > try.c <<EOP
18324 #include <stdio.h>
18325 #include <sys/types.h>
18326 #include <signal.h>
18327 #$i_stdlib I_STDLIB
18328 #ifdef I_STDLIB
18329 #include <stdlib.h>
18330 #endif
18331 int main()
18332 {
18333     struct sigaction act, oact;
18334     act.sa_flags = 0;
18335     oact.sa_handler = 0;
18336     /* so that act and oact are used */
18337     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
18338 }
18339 EOP
18340         set try
18341         if eval $compile_ok; then
18342                 val="$define"
18343         else
18344                 echo "But you don't seem to have a usable struct sigaction." >&4
18345                 val="$undef"
18346         fi
18347 else
18348         echo 'sigaction NOT found.' >&4
18349         val="$undef"
18350 fi
18351 set d_sigaction; eval $setvar
18352 $rm_try
18353
18354 : see if this is a sunmath.h system
18355 set sunmath.h i_sunmath
18356 eval $inhdr
18357
18358 : see if signbit exists
18359 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
18360 $cat >try.c <<EOCP
18361 #$i_math I_MATH
18362 #$i_sunmath I_SUNMATH
18363 #ifdef I_MATH
18364 #  include <math.h>
18365 #endif
18366 #ifdef I_SUNMATH  /* Solaris special math library */
18367 #  include <sunmath.h>
18368 #endif
18369 #define NV $nvtype
18370 int main(int argc, char **argv)
18371 {
18372     NV x = 0.0;
18373     NV y = -0.0;
18374     if ((signbit(x) == 0) && (signbit(y) != 0))
18375         return 0;
18376     else
18377         return 1;
18378 }
18379 EOCP
18380 val="$undef"
18381 set try
18382 if eval $compile; then
18383     if $run ./try; then
18384         $echo "Yes." >&4
18385         val="$define"
18386     else
18387         $echo "Signbit seems to be available, but doesn't work as I expected."
18388         $echo "I won't use it." >&4
18389         val="$undef"
18390     fi
18391 else
18392     $echo "Nope." >&4
18393     dflt="$undef"
18394 fi
18395 set d_signbit
18396 eval $setvar
18397 $rm_try
18398
18399 : see if sigprocmask exists
18400 set sigprocmask d_sigprocmask
18401 eval $inlibc
18402
18403 : see if sigsetjmp exists
18404 echo " "
18405 case "$d_sigsetjmp" in
18406 '')
18407         $cat >try.c <<EOP
18408 #include <setjmp.h>
18409 #$i_stdlib I_STDLIB
18410 #ifdef I_STDLIB
18411 #include <stdlib.h>
18412 #endif
18413 sigjmp_buf env;
18414 int set = 1;
18415 int main()
18416 {
18417         if (sigsetjmp(env,1))
18418                 exit(set);
18419         set = 0;
18420         siglongjmp(env, 1);
18421         exit(1);
18422 }
18423 EOP
18424         set try
18425         if eval $compile; then
18426                 if $run ./try >/dev/null 2>&1; then
18427                         echo "POSIX sigsetjmp found." >&4
18428                         val="$define"
18429                 else
18430                         $cat >&4 <<EOM
18431 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
18432 I'll ignore them.
18433 EOM
18434                         val="$undef"
18435                 fi
18436         else
18437                 echo "sigsetjmp not found." >&4
18438                 val="$undef"
18439         fi
18440         ;;
18441 *) val="$d_sigsetjmp"
18442         case "$d_sigsetjmp" in
18443         $define) echo "POSIX sigsetjmp found." >&4;;
18444         $undef) echo "sigsetjmp not found." >&4;;
18445         esac
18446         ;;
18447 esac
18448 set d_sigsetjmp
18449 eval $setvar
18450 $rm_try
18451
18452 : see if snprintf exists
18453 set snprintf d_snprintf
18454 eval $inlibc
18455
18456 : see if vsnprintf exists
18457 set vsnprintf d_vsnprintf
18458 eval $inlibc
18459
18460 case "$d_snprintf-$d_vsnprintf" in
18461 "$define-$define")
18462     $cat <<EOM
18463 Checking whether your snprintf() and vsnprintf() work okay...
18464 EOM
18465     $cat >try.c <<'EOCP'
18466 /* v?snprintf testing logic courtesy of Russ Allbery.
18467  * According to C99:
18468  * - if the buffer is too short it still must be \0-terminated
18469  * - if the buffer is too short the potentially required length
18470  *   must be returned and not -1
18471  * - if the buffer is NULL the potentially required length
18472  *   must be returned and not -1 or core dump
18473  */
18474 #include <stdio.h>
18475 #include <stdarg.h>
18476
18477 char buf[2];
18478
18479 int test (char *format, ...)
18480 {
18481     va_list args;
18482     int count;
18483
18484     va_start (args, format);
18485     count = vsnprintf (buf, sizeof buf, format, args);
18486     va_end (args);
18487     return count;
18488 }
18489
18490 int main ()
18491 {
18492     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
18493              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
18494 }
18495 EOCP
18496     set try
18497     if eval $compile; then
18498         `$run ./try`
18499         case "$?" in
18500         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
18501         *) cat <<EOM >&4
18502 Your snprintf() and snprintf() don't seem to be working okay.
18503 EOM
18504            d_snprintf="$undef"
18505            d_vsnprintf="$undef"
18506            ;;
18507         esac
18508     else
18509         echo "(I can't seem to compile the test program--assuming they don't)"
18510         d_snprintf="$undef"
18511         d_vsnprintf="$undef"
18512     fi
18513     $rm_try
18514     ;;
18515 esac
18516
18517 : see if sockatmark exists
18518 set sockatmark d_sockatmark
18519 eval $inlibc
18520
18521 : see if prototype for sockatmark is available
18522 echo " "
18523 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
18524 eval $hasproto
18525
18526 : see if socks5_init exists
18527 set socks5_init d_socks5_init
18528 eval $inlibc
18529
18530 : see if sprintf returns the length of the string in the buffer as per ANSI
18531 $echo "Checking whether sprintf returns the length of the string..." >&4
18532 $cat <<EOP >try.c
18533 #include <stdio.h>
18534 #$i_stdlib I_STDLIB
18535 #ifdef I_STDLIB
18536 #include <stdlib.h>
18537 #endif
18538 #$i_string I_STRING
18539 #ifdef I_STRING
18540 #  include <string.h>
18541 #else
18542 #  include <strings.h>
18543 #endif
18544 #$i_math I_MATH
18545 #ifdef I_MATH
18546 #include <math.h>
18547 #endif
18548
18549 char buffer[256];
18550
18551 int check (size_t expect, int test) {
18552   size_t got = strlen(buffer);
18553   if (expect == got)
18554     return 0;
18555
18556   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
18557        test, buffer);
18558   exit (test);
18559 }
18560
18561 int main(int argc, char **argv) {
18562   int test = 0;
18563
18564   check(sprintf(buffer, ""), ++test);
18565   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
18566   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
18567
18568   return 0;
18569 }
18570 EOP
18571 set try
18572
18573 if eval $compile; then
18574     xxx="`$run ./try`"
18575     case "$?" in
18576         0) cat >&4 <<EOM
18577 sprintf returns the length of the string (as ANSI says it should)
18578 EOM
18579         d_sprintf_returns_strlen="$define"
18580         ;;
18581         *) cat >&4 <<EOM
18582 sprintf does not return the length of the string (how old is this system?)
18583 EOM
18584         d_sprintf_returns_strlen="$undef"
18585         ;;
18586     esac
18587 else
18588     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
18589     d_sprintf_returns_strlen="$undef"
18590 fi
18591 $rm_try
18592
18593 : see if srand48_r exists
18594 set srand48_r d_srand48_r
18595 eval $inlibc
18596 case "$d_srand48_r" in
18597 "$define")
18598         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18599         case "$d_srand48_r_proto:$usethreads" in
18600         ":define")      d_srand48_r_proto=define
18601                 set d_srand48_r_proto srand48_r $hdrs
18602                 eval $hasproto ;;
18603         *)      ;;
18604         esac
18605         case "$d_srand48_r_proto" in
18606         define)
18607         case "$srand48_r_proto" in
18608         ''|0) try='int srand48_r(long, struct drand48_data*);'
18609         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
18610         esac
18611         case "$srand48_r_proto" in
18612         ''|0)   d_srand48_r=undef
18613                 srand48_r_proto=0
18614                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
18615         * )     case "$srand48_r_proto" in
18616                 REENTRANT_PROTO*) ;;
18617                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
18618                 esac
18619                 echo "Prototype: $try" ;;
18620         esac
18621         ;;
18622         *)      case "$usethreads" in
18623                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
18624                 esac
18625                 d_srand48_r=undef
18626                 srand48_r_proto=0
18627                 ;;
18628         esac
18629         ;;
18630 *)      srand48_r_proto=0
18631         ;;
18632 esac
18633
18634 : see if srandom_r exists
18635 set srandom_r d_srandom_r
18636 eval $inlibc
18637 case "$d_srandom_r" in
18638 "$define")
18639         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
18640         case "$d_srandom_r_proto:$usethreads" in
18641         ":define")      d_srandom_r_proto=define
18642                 set d_srandom_r_proto srandom_r $hdrs
18643                 eval $hasproto ;;
18644         *)      ;;
18645         esac
18646         case "$d_srandom_r_proto" in
18647         define)
18648         case "$srandom_r_proto" in
18649         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
18650         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
18651         esac
18652         case "$srandom_r_proto" in
18653         ''|0)   d_srandom_r=undef
18654                 srandom_r_proto=0
18655                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
18656         * )     case "$srandom_r_proto" in
18657                 REENTRANT_PROTO*) ;;
18658                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
18659                 esac
18660                 echo "Prototype: $try" ;;
18661         esac
18662         ;;
18663         *)      case "$usethreads" in
18664                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
18665                 esac
18666                 d_srandom_r=undef
18667                 srandom_r_proto=0
18668                 ;;
18669         esac
18670         ;;
18671 *)      srandom_r_proto=0
18672         ;;
18673 esac
18674
18675 : see if prototype for setresgid is available
18676 echo " "
18677 set d_sresgproto setresgid $i_unistd unistd.h
18678 eval $hasproto
18679
18680 : see if prototype for setresuid is available
18681 echo " "
18682 set d_sresuproto setresuid $i_unistd unistd.h
18683 eval $hasproto
18684
18685 : see if sys/stat.h is available
18686 set sys/stat.h i_sysstat
18687 eval $inhdr
18688
18689 : see if stat knows about block sizes
18690 echo " "
18691 echo "Checking to see if your struct stat has st_blocks field..." >&4
18692 set d_statblks stat st_blocks $i_sysstat sys/stat.h
18693 eval $hasfield
18694
18695 : see if this is a sys/vfs.h system
18696 set sys/vfs.h i_sysvfs
18697 eval $inhdr
18698
18699 : see if this is a sys/statfs.h system
18700 set sys/statfs.h i_sysstatfs
18701 eval $inhdr
18702
18703 : Check for statfs_s
18704 echo " "
18705 echo "Checking to see if your system supports struct statfs..." >&4
18706 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
18707 eval $hasstruct
18708 case "$d_statfs_s" in
18709 "$define")      echo "Yes, it does."   ;;
18710 *)              echo "No, it doesn't." ;;
18711 esac
18712
18713
18714 : see if struct statfs knows about f_flags
18715 case "$d_statfs_s" in
18716 define)
18717         echo " "
18718         echo "Checking to see if your struct statfs has f_flags field..." >&4
18719         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
18720         eval $hasfield
18721         ;;
18722 *)      val="$undef"
18723         set d_statfs_f_flags
18724         eval $setvar
18725         ;;
18726 esac
18727 case "$d_statfs_f_flags" in
18728 "$define")      echo "Yes, it does."   ;;
18729 *)              echo "No, it doesn't." ;;
18730 esac
18731
18732 : see what flavor, if any, of static inline is supported
18733 echo " "
18734 echo "Checking to see if your system supports static inline..."
18735 $cat > try.c <<'EOCP'
18736 #include <stdlib.h>
18737 extern int f_via_a(int x);
18738 extern int f_via_b(int x);
18739 int main(int argc, char **argv)
18740 {
18741     int y;
18742
18743     y = f_via_a(0);
18744 #ifdef USE_B
18745     y = f_via_b(0);
18746 #endif
18747     if (y == 42) {
18748         return EXIT_SUCCESS;
18749     }
18750     else {
18751         return EXIT_FAILURE;
18752     }
18753 }
18754 EOCP
18755 $cat > a.c <<'EOCP'
18756 static INLINE int f(int x) {
18757     int y;
18758     y = x + 42;
18759     return y;
18760 }
18761
18762 int f_via_a(int x)
18763 {
18764     return f(x);
18765 }
18766 EOCP
18767 $cat > b.c <<'EOCP'
18768 extern int f(int x);
18769
18770 int f_via_b(int x)
18771 {
18772     return f(x);
18773 }
18774 EOCP
18775
18776 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18777 case "$perl_static_inline" in
18778 '')     # Check the various possibilities, and break out on success.
18779         # For gcc, prefer __inline__, which will still permit
18780         # cflags.SH to add in -ansi.
18781         case "$gccversion" in
18782                 '') xxx="inline __inline__ __inline _inline";;
18783                 *)  xxx="__inline__ inline __inline _inline";;
18784         esac
18785         for inline in $xxx; do
18786                 set try -DINLINE=$inline a.c
18787                 if eval $compile && $run ./try; then
18788                         # Now make sure there is no external linkage of static
18789                         # functions
18790                         set try -DINLINE=$inline -DUSE_B a.c b.c
18791                         if eval $compile && $run ./try; then
18792                                 $echo "Your compiler supports static $inline, " >&4
18793                                 $echo "but it also creates an external definition," >&4
18794                                 $echo "so I won't use it." >&4
18795                                 val=$undef
18796                         else
18797                                 $echo "Your compiler supports static $inline." >&4
18798                                 val=$define
18799                                 perl_static_inline="static $inline";
18800                                 break;
18801                         fi
18802                 else
18803                         $echo "Your compiler does NOT support static $inline." >&4
18804                         val="$undef"
18805                 fi
18806         done
18807         ;;
18808 *inline*) # Some variant of inline exists.
18809         echo "Keeping your $hint value of $perl_static_inline."
18810         val=$define
18811         ;;
18812 static)  # No inline capabilities
18813         echo "Keeping your $hint value of $perl_static_inline."
18814         val=$undef
18815         ;;
18816 *)  # Unrecognized previous value -- blindly trust the supplied
18817         # value and hope it makes sense.  Use old value for
18818         # d_static_inline, if there is one.
18819         echo "Keeping your $hint value of $perl_static_inline."
18820         case "$d_static_inline" in
18821                 '') val=$define ;;
18822                 *)  val=$d_static_inline ;;
18823         esac
18824         ;;
18825 esac
18826 # Fallback to plain 'static' if nothing worked.
18827 case "$perl_static_inline" in
18828 '')
18829         perl_static_inline="static"
18830         val=$undef
18831         ;;
18832 esac
18833 set d_static_inline
18834 eval $setvar
18835 $rm -f a.[co] b.[co]
18836 $rm_try
18837
18838 : Check stream access
18839 $cat >&4 <<EOM
18840 Checking how to access stdio streams by file descriptor number...
18841 EOM
18842 case "$stdio_stream_array" in
18843 '')     $cat >try.c <<EOCP
18844 #include <stdio.h>
18845 int main() {
18846   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18847     printf("yes\n");
18848 }
18849 EOCP
18850         for s in _iob __iob __sF
18851         do
18852                 set try -DSTDIO_STREAM_ARRAY=$s
18853                 if eval $compile; then
18854                         case "`$run ./try`" in
18855                         yes)    stdio_stream_array=$s; break ;;
18856                         esac
18857                 fi
18858         done
18859         $rm_try
18860 esac
18861 case "$stdio_stream_array" in
18862 '')     $cat >&4 <<EOM
18863 I can't figure out how to access stdio streams by file descriptor number.
18864 EOM
18865         d_stdio_stream_array="$undef"
18866         ;;
18867 *)      $cat >&4 <<EOM
18868 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18869 EOM
18870         d_stdio_stream_array="$define"
18871         ;;
18872 esac
18873
18874 : see if strcoll exists
18875 set strcoll d_strcoll
18876 eval $inlibc
18877
18878 : check for structure copying
18879 echo " "
18880 echo "Checking to see if your C compiler can copy structs..." >&4
18881 $cat >try.c <<'EOCP'
18882 int main()
18883 {
18884         struct blurfl {
18885                 int dyick;
18886         } foo, bar;
18887
18888         foo = bar;
18889 }
18890 EOCP
18891 if $cc -c try.c >/dev/null 2>&1 ; then
18892         val="$define"
18893         echo "Yup, it can."
18894 else
18895         val="$undef"
18896         echo "Nope, it can't."
18897 fi
18898 set d_strctcpy
18899 eval $setvar
18900 $rm_try
18901
18902 : see if strerror and/or sys_errlist[] exist
18903 echo " "
18904 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18905     if set strerror val -f d_strerror; eval $csym; $val; then
18906                 echo 'strerror() found.' >&4
18907                 d_strerror="$define"
18908                 d_strerrm='strerror(e)'
18909                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18910                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18911                         d_syserrlst="$define"
18912                 else
18913                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18914                         d_syserrlst="$undef"
18915                 fi
18916     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18917                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18918                 echo 'strerror() found in string header.' >&4
18919                 d_strerror="$define"
18920                 d_strerrm='strerror(e)'
18921                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18922                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18923                                 d_syserrlst="$define"
18924                 else
18925                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18926                         d_syserrlst="$undef"
18927                 fi
18928     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18929                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18930                 d_strerror="$undef"
18931                 d_syserrlst="$define"
18932                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18933     else
18934                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18935                 d_strerror="$undef"
18936                 d_syserrlst="$undef"
18937                 d_strerrm='"unknown"'
18938     fi
18939 fi
18940
18941 : see if strerror_r exists
18942 set strerror_r d_strerror_r
18943 eval $inlibc
18944 case "$d_strerror_r" in
18945 "$define")
18946         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18947         case "$d_strerror_r_proto:$usethreads" in
18948         ":define")      d_strerror_r_proto=define
18949                 set d_strerror_r_proto strerror_r $hdrs
18950                 eval $hasproto ;;
18951         *)      ;;
18952         esac
18953         case "$d_strerror_r_proto" in
18954         define)
18955         case "$strerror_r_proto" in
18956         ''|0) try='int strerror_r(int, char*, size_t);'
18957         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18958         esac
18959         case "$strerror_r_proto" in
18960         ''|0) try='int strerror_r(int, char*, int);'
18961         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18962         esac
18963         case "$strerror_r_proto" in
18964         ''|0) try='char* strerror_r(int, char*, size_t);'
18965         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18966         esac
18967         case "$strerror_r_proto" in
18968         ''|0)   d_strerror_r=undef
18969                 strerror_r_proto=0
18970                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18971         * )     case "$strerror_r_proto" in
18972                 REENTRANT_PROTO*) ;;
18973                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18974                 esac
18975                 echo "Prototype: $try" ;;
18976         esac
18977         ;;
18978         *)      case "$usethreads" in
18979                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18980                 esac
18981                 d_strerror_r=undef
18982                 strerror_r_proto=0
18983                 ;;
18984         esac
18985         ;;
18986 *)      strerror_r_proto=0
18987         ;;
18988 esac
18989
18990 : see if strftime exists
18991 set strftime d_strftime
18992 eval $inlibc
18993
18994 : see if strlcat exists
18995 set strlcat d_strlcat
18996 eval $inlibc
18997
18998 : see if strlcpy exists
18999 set strlcpy d_strlcpy
19000 eval $inlibc
19001
19002 : see if strtod exists
19003 set strtod d_strtod
19004 eval $inlibc
19005
19006 : see if strtol exists
19007 set strtol d_strtol
19008 eval $inlibc
19009
19010 : see if strtold exists
19011 set strtold d_strtold
19012 eval $inlibc
19013
19014 : see if strtoll exists
19015 set strtoll d_strtoll
19016 eval $inlibc
19017
19018 case "$d_longlong-$d_strtoll" in
19019 "$define-$define")
19020         $cat <<EOM
19021 Checking whether your strtoll() works okay...
19022 EOM
19023         $cat >try.c <<'EOCP'
19024 #include <errno.h>
19025 #ifdef __hpux
19026 #define strtoll __strtoll
19027 #endif
19028 #ifdef __EMX__
19029 #define strtoll _strtoll
19030 #endif
19031 #include <stdio.h>
19032 extern long long int strtoll(char *s, char **, int);
19033 static int bad = 0;
19034 int check(char *s, long long ell, int een) {
19035         long long gll;
19036         errno = 0;
19037         gll = strtoll(s, 0, 10);
19038         if (!((gll == ell) && (errno == een)))
19039                 bad++;
19040 }
19041 int main() {
19042         check(" 1",                                      1LL, 0);
19043         check(" 0",                                      0LL, 0);
19044         check("-1",                                     -1LL, 0);
19045         check("-9223372036854775808", -9223372036854775808LL, 0);
19046         check("-9223372036854775808", -9223372036854775808LL, 0);
19047         check(" 9223372036854775807",  9223372036854775807LL, 0);
19048         check("-9223372036854775808", -9223372036854775808LL, 0);
19049         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
19050         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
19051         if (!bad)
19052                 printf("ok\n");
19053 }
19054 EOCP
19055         set try
19056         if eval $compile; then
19057                 yyy=`$run ./try`
19058                 case "$yyy" in
19059                 ok) echo "Your strtoll() seems to be working okay." ;;
19060                 *) cat <<EOM >&4
19061 Your strtoll() doesn't seem to be working okay.
19062 EOM
19063                    d_strtoll="$undef"
19064                    ;;
19065                 esac
19066         else
19067                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19068                 d_strtoll="$undef"
19069         fi
19070         ;;
19071 esac
19072
19073 : see if strtoq exists
19074 set strtoq d_strtoq
19075 eval $inlibc
19076
19077 : see if strtoul exists
19078 set strtoul d_strtoul
19079 eval $inlibc
19080
19081 case "$d_strtoul" in
19082 "$define")
19083         $cat <<EOM
19084 Checking whether your strtoul() works okay...
19085 EOM
19086         $cat >try.c <<'EOCP'
19087 #include <errno.h>
19088 #include <stdio.h>
19089 extern unsigned long int strtoul(char *s, char **, int);
19090 static int bad = 0;
19091 void check(char *s, unsigned long eul, int een) {
19092         unsigned long gul;
19093         errno = 0;
19094         gul = strtoul(s, 0, 10);
19095         if (!((gul == eul) && (errno == een)))
19096                 bad++;
19097 }
19098 int main() {
19099         check(" 1", 1L, 0);
19100         check(" 0", 0L, 0);
19101 EOCP
19102         case "$longsize" in
19103         8)
19104             $cat >>try.c <<'EOCP'
19105         check("18446744073709551615", 18446744073709551615UL, 0);
19106         check("18446744073709551616", 18446744073709551615UL, ERANGE);
19107 #if 0 /* strtoul() for /^-/ strings is undefined. */
19108         check("-1", 18446744073709551615UL, 0);
19109         check("-18446744073709551614", 2, 0);
19110         check("-18446744073709551615", 1, 0);
19111         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
19112         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
19113 #endif
19114 EOCP
19115                 ;;
19116         4)
19117                     $cat >>try.c <<'EOCP'
19118         check("4294967295", 4294967295UL, 0);
19119         check("4294967296", 4294967295UL, ERANGE);
19120 #if 0 /* strtoul() for /^-/ strings is undefined. */
19121         check("-1", 4294967295UL, 0);
19122         check("-4294967294", 2, 0);
19123         check("-4294967295", 1, 0);
19124         check("-4294967296", 4294967295UL, ERANGE);
19125         check("-4294967297", 4294967295UL, ERANGE);
19126 #endif
19127 EOCP
19128                 ;;
19129         *)
19130 : Should we write these tests to be more portable by sprintf-ing
19131 : ~0 and then manipulating that char string as input for strtol?
19132                 ;;
19133         esac
19134         $cat >>try.c <<'EOCP'
19135         if (!bad)
19136                 printf("ok\n");
19137         return 0;
19138 }
19139 EOCP
19140         set try
19141         if eval $compile; then
19142                 case "`$run ./try`" in
19143                 ok) echo "Your strtoul() seems to be working okay." ;;
19144                 *) cat <<EOM >&4
19145 Your strtoul() doesn't seem to be working okay.
19146 EOM
19147                    d_strtoul="$undef"
19148                    ;;
19149                 esac
19150         else
19151                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19152                 d_strtoul="$undef"
19153         fi
19154         ;;
19155 esac
19156
19157 : see if strtoull exists
19158 set strtoull d_strtoull
19159 eval $inlibc
19160
19161 case "$d_longlong-$d_strtoull" in
19162 "$define-$define")
19163         $cat <<EOM
19164 Checking whether your strtoull() works okay...
19165 EOM
19166         $cat >try.c <<'EOCP'
19167 #include <errno.h>
19168 #ifdef __hpux
19169 #define strtoull __strtoull
19170 #endif
19171 #include <stdio.h>
19172 extern unsigned long long int strtoull(char *s, char **, int);
19173 static int bad = 0;
19174 int check(char *s, long long eull, int een) {
19175         long long gull;
19176         errno = 0;
19177         gull = strtoull(s, 0, 10);
19178         if (!((gull == eull) && (errno == een)))
19179                 bad++;
19180 }
19181 int main() {
19182         check(" 1",                                        1LL, 0);
19183         check(" 0",                                        0LL, 0);
19184         check("18446744073709551615",  18446744073709551615ULL, 0);
19185         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19186 #if 0 /* strtoull() for /^-/ strings is undefined. */
19187         check("-1",                    18446744073709551615ULL, 0);
19188         check("-18446744073709551614",                     2LL, 0);
19189         check("-18446744073709551615",                     1LL, 0);
19190         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19191         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19192 #endif
19193         if (!bad)
19194                 printf("ok\n");
19195 }
19196 EOCP
19197         set try
19198         if eval $compile; then
19199                 case "`$run ./try`" in
19200                 ok) echo "Your strtoull() seems to be working okay." ;;
19201                 *) cat <<EOM >&4
19202 Your strtoull() doesn't seem to be working okay.
19203 EOM
19204                    d_strtoull="$undef"
19205                    ;;
19206                 esac
19207         else
19208                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19209                 d_strtoull="$undef"
19210         fi
19211         ;;
19212 esac
19213
19214 : see if strtouq exists
19215 set strtouq d_strtouq
19216 eval $inlibc
19217
19218 case "$d_strtouq" in
19219 "$define")
19220         $cat <<EOM
19221 Checking whether your strtouq() works okay...
19222 EOM
19223         $cat >try.c <<'EOCP'
19224 #include <errno.h>
19225 #include <stdio.h>
19226 extern unsigned long long int strtouq(char *s, char **, int);
19227 static int bad = 0;
19228 void check(char *s, unsigned long long eull, int een) {
19229         unsigned long long gull;
19230         errno = 0;
19231         gull = strtouq(s, 0, 10);
19232         if (!((gull == eull) && (errno == een)))
19233                 bad++;
19234 }
19235 int main() {
19236         check(" 1",                                        1LL, 0);
19237         check(" 0",                                        0LL, 0);
19238         check("18446744073709551615",  18446744073709551615ULL, 0);
19239         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
19240 #if 0 /* strtouq() for /^-/ strings is undefined. */
19241         check("-1",                    18446744073709551615ULL, 0);
19242         check("-18446744073709551614",                     2LL, 0);
19243         check("-18446744073709551615",                     1LL, 0);
19244         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
19245         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
19246 #endif
19247         if (!bad)
19248                 printf("ok\n");
19249         return 0;
19250 }
19251 EOCP
19252         set try
19253         if eval $compile; then
19254                 case "`$run ./try`" in
19255                 ok) echo "Your strtouq() seems to be working okay." ;;
19256                 *) cat <<EOM >&4
19257 Your strtouq() doesn't seem to be working okay.
19258 EOM
19259                    d_strtouq="$undef"
19260                    ;;
19261                 esac
19262         else
19263                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19264                 d_strtouq="$undef"
19265         fi
19266         ;;
19267 esac
19268
19269 : see if strxfrm exists
19270 set strxfrm d_strxfrm
19271 eval $inlibc
19272
19273 : see if symlink exists
19274 set symlink d_symlink
19275 eval $inlibc
19276
19277 : see if syscall exists
19278 set syscall d_syscall
19279 eval $inlibc
19280
19281 : see if prototype for syscall is available
19282 echo " "
19283 set d_syscallproto syscall $i_unistd unistd.h
19284 eval $hasproto
19285
19286 : see if sysconf exists
19287 set sysconf d_sysconf
19288 eval $inlibc
19289
19290 : see if system exists
19291 set system d_system
19292 eval $inlibc
19293
19294 : see if tcgetpgrp exists
19295 set tcgetpgrp d_tcgetpgrp
19296 eval $inlibc
19297
19298 : see if tcsetpgrp exists
19299 set tcsetpgrp d_tcsetpgrp
19300 eval $inlibc
19301
19302 : see if prototype for telldir is available
19303 echo " "
19304 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
19305 eval $hasproto
19306
19307 : see if time exists
19308 echo " "
19309 if test "X$d_time" = X -o X"$timetype" = X; then
19310     if set time val -f d_time; eval $csym; $val; then
19311                 echo 'time() found.' >&4
19312                 val="$define"
19313                 rp="What is the type returned by time() on this system?"
19314                 set time_t timetype long stdio.h sys/types.h
19315                 eval $typedef_ask
19316     else
19317                 echo 'time() not found, hope that will do.' >&4
19318                 val="$undef"
19319                 timetype='int';
19320     fi
19321     set d_time
19322     eval $setvar
19323 fi
19324
19325 : see if timegm exists
19326 set timegm d_timegm
19327 eval $inlibc
19328
19329 : see if this is a sys/times.h system
19330 set sys/times.h i_systimes
19331 eval $inhdr
19332
19333 : see if times exists
19334 echo " "
19335 if set times val -f d_times; eval $csym; $val; then
19336         echo 'times() found.' >&4
19337         d_times="$define"
19338         inc=''
19339         case "$i_systimes" in
19340         "$define") inc='sys/times.h';;
19341         esac
19342         rp="What is the type returned by times() on this system?"
19343         set clock_t clocktype long stdio.h sys/types.h $inc
19344         eval $typedef_ask
19345 else
19346         echo 'times() NOT found, hope that will do.' >&4
19347         d_times="$undef"
19348         clocktype='int'
19349 fi
19350
19351 : see if tmpnam_r exists
19352 set tmpnam_r d_tmpnam_r
19353 eval $inlibc
19354 case "$d_tmpnam_r" in
19355 "$define")
19356         hdrs="$i_systypes sys/types.h define stdio.h "
19357         case "$d_tmpnam_r_proto:$usethreads" in
19358         ":define")      d_tmpnam_r_proto=define
19359                 set d_tmpnam_r_proto tmpnam_r $hdrs
19360                 eval $hasproto ;;
19361         *)      ;;
19362         esac
19363         case "$d_tmpnam_r_proto" in
19364         define)
19365         case "$tmpnam_r_proto" in
19366         ''|0) try='char* tmpnam_r(char*);'
19367         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
19368         esac
19369         case "$tmpnam_r_proto" in
19370         ''|0)   d_tmpnam_r=undef
19371                 tmpnam_r_proto=0
19372                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
19373         * )     case "$tmpnam_r_proto" in
19374                 REENTRANT_PROTO*) ;;
19375                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
19376                 esac
19377                 echo "Prototype: $try" ;;
19378         esac
19379         ;;
19380         *)      case "$usethreads" in
19381                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
19382                 esac
19383                 d_tmpnam_r=undef
19384                 tmpnam_r_proto=0
19385                 ;;
19386         esac
19387         ;;
19388 *)      tmpnam_r_proto=0
19389         ;;
19390 esac
19391
19392 : see if truncate exists
19393 set truncate d_truncate
19394 eval $inlibc
19395
19396 : see if ttyname_r exists
19397 set ttyname_r d_ttyname_r
19398 eval $inlibc
19399 case "$d_ttyname_r" in
19400 "$define")
19401         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
19402         case "$d_ttyname_r_proto:$usethreads" in
19403         ":define")      d_ttyname_r_proto=define
19404                 set d_ttyname_r_proto ttyname_r $hdrs
19405                 eval $hasproto ;;
19406         *)      ;;
19407         esac
19408         case "$d_ttyname_r_proto" in
19409         define)
19410         case "$ttyname_r_proto" in
19411         ''|0) try='int ttyname_r(int, char*, size_t);'
19412         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
19413         esac
19414         case "$ttyname_r_proto" in
19415         ''|0) try='int ttyname_r(int, char*, int);'
19416         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
19417         esac
19418         case "$ttyname_r_proto" in
19419         ''|0) try='char* ttyname_r(int, char*, int);'
19420         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
19421         esac
19422         case "$ttyname_r_proto" in
19423         ''|0)   d_ttyname_r=undef
19424                 ttyname_r_proto=0
19425                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
19426         * )     case "$ttyname_r_proto" in
19427                 REENTRANT_PROTO*) ;;
19428                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
19429                 esac
19430                 echo "Prototype: $try" ;;
19431         esac
19432         ;;
19433         *)      case "$usethreads" in
19434                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
19435                 esac
19436                 d_ttyname_r=undef
19437                 ttyname_r_proto=0
19438                 ;;
19439         esac
19440         ;;
19441 *)      ttyname_r_proto=0
19442         ;;
19443 esac
19444
19445 : see if tzname[] exists
19446 echo " "
19447 if set tzname val -a d_tzname; eval $csym; $val; then
19448         val="$define"
19449         echo 'tzname[] found.' >&4
19450 else
19451         val="$undef"
19452         echo 'tzname[] NOT found.' >&4
19453 fi
19454 set d_tzname
19455 eval $setvar
19456
19457 : Check if is a multiplatform env
19458 case "$osname" in
19459 darwin) multiarch="$define" ;;
19460 esac
19461 case "$multiarch" in
19462 ''|[nN]*) multiarch="$undef" ;;
19463 esac
19464
19465 : check for ordering of bytes in a UV
19466 echo " "
19467 case "$multiarch" in
19468 *$define*)
19469         $cat <<EOM
19470 You seem to be doing a multiarchitecture build,
19471 skipping the byteorder check.
19472
19473 EOM
19474         byteorder='ffff'
19475         ;;
19476 *)
19477         case "$byteorder" in
19478         '')
19479                 $cat <<'EOM'
19480 In the following, larger digits indicate more significance.  A big-endian
19481 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
19482 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
19483 machines may have weird orders like 3412.  A Cray will report 87654321,
19484 an Alpha will report 12345678. If the test program works the default is
19485 probably right.
19486 I'm now running the test program...
19487 EOM
19488                 $cat >try.c <<EOCP
19489 #include <stdio.h>
19490 #$i_stdlib I_STDLIB
19491 #ifdef I_STDLIB
19492 #include <stdlib.h>
19493 #endif
19494 #include <sys/types.h>
19495 typedef $uvtype UV;
19496 int main()
19497 {
19498         int i;
19499         union {
19500                 UV l;
19501                 char c[$uvsize];
19502         } u;
19503
19504         if ($uvsize > 4)
19505                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
19506         else
19507                 u.l = (UV)0x04030201;
19508         for (i = 0; i < $uvsize; i++)
19509                 printf("%c", u.c[i]+'0');
19510         printf("\n");
19511         exit(0);
19512 }
19513 EOCP
19514                 xxx_prompt=y
19515                 set try
19516                 if eval $compile && $run ./try > /dev/null; then
19517                         dflt=`$run ./try`
19518                         case "$dflt" in
19519                         [1-4][1-4][1-4][1-4]|12345678|87654321)
19520                                 echo "(The test program ran ok.)"
19521                                 echo "byteorder=$dflt"
19522                                 xxx_prompt=n
19523                         ;;
19524                         ????|????????) echo "(The test program ran ok.)" ;;
19525                         *) echo "(The test program didn't run right for some reason.)" ;;
19526                         esac
19527                 else
19528                         dflt='4321'
19529                         cat <<'EOM'
19530 (I can't seem to compile the test program.  Guessing big-endian...)
19531 EOM
19532                 fi
19533                 case "$xxx_prompt" in
19534                 y)
19535                         rp="What is the order of bytes in $uvtype?"
19536                         . ./myread
19537                         byteorder="$ans"
19538                         ;;
19539                 *)      byteorder=$dflt
19540                         ;;
19541                 esac
19542                 ;;
19543         esac
19544         $rm_try
19545         ;;
19546 esac
19547
19548 : Checking 32bit alignedness
19549 $cat <<EOM
19550
19551 Checking to see whether you can access character data unalignedly...
19552 EOM
19553 case "$d_u32align" in
19554 '')   $cat >try.c <<EOCP
19555 #include <stdio.h>
19556 #$i_stdlib I_STDLIB
19557 #ifdef I_STDLIB
19558 #include <stdlib.h>
19559 #endif
19560 #define U32 $u32type
19561 #define BYTEORDER 0x$byteorder
19562 #define U8 $u8type
19563 #include <signal.h>
19564 #ifdef SIGBUS
19565 $signal_t bletch(int s) { exit(4); }
19566 #endif
19567 int main() {
19568 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
19569     volatile U8 buf[8];
19570     volatile U32 *up;
19571     int i;
19572
19573     if (sizeof(U32) != 4) {
19574         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
19575         exit(1);
19576     }
19577
19578     fflush(stdout);
19579
19580 #ifdef SIGBUS
19581     signal(SIGBUS, bletch);
19582 #endif
19583
19584     buf[0] = 0;
19585     buf[1] = 0;
19586     buf[2] = 0;
19587     buf[3] = 1;
19588     buf[4] = 0;
19589     buf[5] = 0;
19590     buf[6] = 0;
19591     buf[7] = 1;
19592
19593     for (i = 0; i < 4; i++) {
19594         up = (U32*)(buf + i);
19595         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
19596                (*up == 1 << (8*(3-i)))  /* little-endian */
19597               )
19598            )
19599         {
19600             printf("read failed (%x)\n", *up);
19601             exit(2);
19602         }
19603     }
19604
19605     /* write test */
19606     for (i = 0; i < 4; i++) {
19607         up = (U32*)(buf + i);
19608         *up = 0xBeef;
19609         if (*up != 0xBeef) {
19610             printf("write failed (%x)\n", *up);
19611             exit(3);
19612         }
19613     }
19614
19615     exit(0);
19616 #else
19617     printf("1\n");
19618     exit(1);
19619 #endif
19620     return 0;
19621 }
19622 EOCP
19623 set try
19624 if eval $compile_ok; then
19625         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
19626         $run ./try 2>&1 >/dev/null
19627         case "$?" in
19628         0)      cat >&4 <<EOM
19629 You can access character data pretty unalignedly.
19630 EOM
19631                 d_u32align="$undef"
19632                 ;;
19633         *)      cat >&4 <<EOM
19634 It seems that you must access character data in an aligned manner.
19635 EOM
19636                 d_u32align="$define"
19637                 ;;
19638         esac
19639 else
19640         rp='Can you access character data at unaligned addresses?'
19641         dflt='n'
19642         . ./myread
19643         case "$ans" in
19644         [yY]*)  d_u32align="$undef"  ;;
19645         *)      d_u32align="$define" ;;
19646         esac
19647 fi
19648 $rm_try
19649 ;;
19650 esac
19651
19652 : see if ualarm exists
19653 set ualarm d_ualarm
19654 eval $inlibc
19655
19656 : see if umask exists
19657 set umask d_umask
19658 eval $inlibc
19659
19660 : see if unordered exists
19661 set unordered d_unordered
19662 eval $inlibc
19663
19664 : see if unsetenv exists
19665 set unsetenv d_unsetenv
19666 eval $inlibc
19667
19668 : see if usleep exists
19669 set usleep d_usleep
19670 eval $inlibc
19671
19672 : see if prototype for usleep is available
19673 echo " "
19674 set d_usleepproto usleep $i_unistd unistd.h
19675 eval $hasproto
19676
19677 : see if ustat exists
19678 set ustat d_ustat
19679 eval $inlibc
19680
19681 : see if closedir exists
19682 set closedir d_closedir
19683 eval $inlibc
19684
19685 case "$d_closedir" in
19686 "$define")
19687         echo " "
19688         echo "Checking whether closedir() returns a status..." >&4
19689         cat > try.c <<EOM
19690 #$i_dirent I_DIRENT             /**/
19691 #$i_sysdir I_SYS_DIR            /**/
19692 #$i_sysndir I_SYS_NDIR          /**/
19693 #$i_systypes I_SYS_TYPES        /**/
19694
19695 #if defined(I_SYS_TYPES)
19696 #include <sys/types.h>
19697 #endif
19698 #if defined(I_DIRENT)
19699 #include <dirent.h>
19700 #else
19701 #ifdef I_SYS_NDIR
19702 #include <sys/ndir.h>
19703 #else
19704 #ifdef I_SYS_DIR
19705 #ifdef hp9000s500
19706 #include <ndir.h>       /* may be wrong in the future */
19707 #else
19708 #include <sys/dir.h>
19709 #endif
19710 #endif
19711 #endif
19712 #endif
19713 int main() { return closedir(opendir(".")); }
19714 EOM
19715         set try
19716         if eval $compile_ok; then
19717                 if $run ./try > /dev/null 2>&1 ; then
19718                         echo "Yes, it does."
19719                         val="$undef"
19720                 else
19721                         echo "No, it doesn't."
19722                         val="$define"
19723                 fi
19724         else
19725                 echo "(I can't seem to compile the test program--assuming it doesn't)"
19726                 val="$define"
19727         fi
19728         ;;
19729 *)
19730         val="$undef";
19731         ;;
19732 esac
19733 set d_void_closedir
19734 eval $setvar
19735 $rm_try
19736
19737 : see if there is a wait4
19738 set wait4 d_wait4
19739 eval $inlibc
19740
19741 : see if waitpid exists
19742 set waitpid d_waitpid
19743 eval $inlibc
19744
19745 : look for wcscmp
19746 echo " "
19747 $cat >try.c <<'EOCP'
19748 #include <stdio.h>
19749 #include <wchar.h>
19750 int main ()
19751 {
19752     wchar_t *s = L" ";
19753     return (wcscmp (s, s) ? 1 : 0);
19754     }
19755 EOCP
19756 set try
19757 val="$undef"
19758 if eval $compile; then
19759     `$run ./try`
19760     case "$?" in
19761         0)  echo "A working wcscmp() found." >&4
19762             val="$define" ;;
19763         *)  echo "wcscmp() found, but it doesn't work" >&4
19764             ;;
19765         esac
19766 else
19767     echo "wcscmp() NOT found." >&4
19768     fi
19769 set d_wcscmp
19770 eval $setvar
19771 $rm_try
19772
19773 : see if wcstombs exists
19774 set wcstombs d_wcstombs
19775 eval $inlibc
19776
19777 : look for wcsxfrm
19778 echo " "
19779 $cat >try.c <<'EOCP'
19780 #include <errno.h>
19781 #include <wchar.h>
19782 int main ()
19783 {
19784     wchar_t dst[4], *src = L" ";
19785     errno = 0;
19786     return (wcsxfrm (dst, src, 1) ? errno ? errno : 0 : 1);
19787     }
19788 EOCP
19789 set try
19790 val="$undef"
19791 if eval $compile; then
19792     `$run ./try`
19793     case "$?" in
19794         0)  echo "A working wcsxfrm() found." >&4
19795             val="$define" ;;
19796         *)  echo "wcsxfrm() found, but it doesn't work" >&4
19797             ;;
19798         esac
19799 else
19800     echo "wcsxfrm() NOT found." >&4
19801     fi
19802 set d_wcsxfrm
19803 eval $setvar
19804 $rm_try
19805
19806 : see if wctomb exists
19807 set wctomb d_wctomb
19808 eval $inlibc
19809
19810 : see if writev exists
19811 set writev d_writev
19812 eval $inlibc
19813
19814 : check for alignment requirements
19815 echo " "
19816 case "$alignbytes" in
19817     '') echo "Checking alignment constraints..." >&4
19818         if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19819             $cat >try.c <<'EOCP'
19820 typedef long double NV;
19821 EOCP
19822         else
19823             $cat >try.c <<'EOCP'
19824 typedef double NV;
19825 EOCP
19826         fi
19827         $cat >>try.c <<'EOCP'
19828 #include <stdio.h>
19829 struct foobar {
19830     char foo;
19831     NV bar;
19832 } try_algn;
19833 int main()
19834 {
19835     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19836     return(0);
19837 }
19838 EOCP
19839         set try
19840         if eval $compile_ok; then
19841             dflt=`$run ./try`
19842         else
19843             dflt='8'
19844             echo "(I can't seem to compile the test program...)"
19845         fi
19846         case "$multiarch" in
19847             *$define*)
19848                 : The usual safe value is 8, but Darwin with -Duselongdouble
19849                 : needs 16.  Hence, we will take 8 as a minimum, but allow
19850                 : Configure to pick a larger value if needed.
19851                 if $test "$dflt" -lt 8; then
19852                     dflt='8'
19853                     echo "Setting alignment to 8 for multiarch support.">&4
19854                 fi
19855                 ;;
19856         esac
19857         ;;
19858     *) dflt="$alignbytes"
19859         ;;
19860 esac
19861 rp="Doubles must be aligned on a how-many-byte boundary?"
19862 . ./myread
19863 alignbytes="$ans"
19864 $rm_try
19865
19866 : set the base revision
19867 baserev=5.0
19868
19869 : length of character in bytes. Is always 1, otherwise it is not C
19870 : This used to be a test using sizeof
19871 charsize=1
19872
19873 : Check for the number of bits in a character
19874 case "$charbits" in
19875 '')     echo "Checking how long a character is (in bits)..." >&4
19876         $cat >try.c <<EOCP
19877 #include <stdio.h>
19878 int main ()
19879 {
19880     int n;
19881     unsigned char c;
19882     for (c = 1, n = 0; c; c <<= 1, n++) ;
19883     printf ("%d\n", n);
19884     return (0);
19885     }
19886 EOCP
19887         set try
19888         if eval $compile_ok; then
19889                 dflt=`$run ./try`
19890         else
19891                 dflt='8'
19892                 echo "(I can't seem to compile the test program.  Guessing...)"
19893         fi
19894         ;;
19895 *)
19896         dflt="$charbits"
19897         ;;
19898 esac
19899 rp="What is the length of a character (in bits)?"
19900 . ./myread
19901 charbits="$ans"
19902 $rm_try
19903 case "$charbits" in
19904 8)      ;;
19905 *)      cat >&4 << EOM
19906 Your system has an unsigned character size of $charbits bits, which
19907 is rather unusual (normally it is 8 bits).  Perl likely will not work
19908 correctly on your system, with subtle bugs in various places.
19909 EOM
19910         rp='Do you really want to continue?'
19911         dflt='n'
19912         . ./myread
19913         case "$ans" in
19914                 [yY])   echo >&4 "Okay, continuing."    ;;
19915                 *)      exit 1                          ;;
19916         esac
19917 esac
19918
19919 : how do we concatenate cpp tokens here?
19920 echo " "
19921 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19922 $cat >cpp_stuff.c <<'EOCP'
19923 #define RCAT(a,b)a/**/b
19924 #define ACAT(a,b)a ## b
19925 RCAT(Rei,ser)
19926 ACAT(Cir,cus)
19927 EOCP
19928 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19929 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19930         echo "Oh!  Smells like ANSI's been here." >&4
19931         echo "We can catify or stringify, separately or together!"
19932         cpp_stuff=42
19933 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19934         echo "Ah, yes!  The good old days!" >&4
19935         echo "However, in the good old days we don't know how to stringify and"
19936         echo "catify at the same time."
19937         cpp_stuff=1
19938 else
19939         $cat >&4 <<EOM
19940 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19941 You're going to have to edit the values of CAT[2-5] in config.h...
19942 EOM
19943         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19944 fi
19945 $rm -f cpp_stuff.*
19946
19947 : see if this is a db.h system
19948 set db.h i_db
19949 eval $inhdr
19950
19951 case "$i_db" in
19952 $define)
19953         : Check db version.
19954         echo " "
19955         echo "Checking Berkeley DB version ..." >&4
19956         $cat >try.c <<EOCP
19957 #$d_const HASCONST
19958 #ifndef HASCONST
19959 #define const
19960 #endif
19961 #include <sys/types.h>
19962 #include <stdio.h>
19963 #$i_stdlib I_STDLIB
19964 #ifdef I_STDLIB
19965 #include <stdlib.h>
19966 #endif
19967 #include <db.h>
19968 int main(int argc, char *argv[])
19969 {
19970 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19971     int Major, Minor, Patch ;
19972     unsigned long Version ;
19973     (void)db_version(&Major, &Minor, &Patch) ;
19974     if (argc == 2) {
19975         printf("%d %d %d %d %d %d\n",
19976                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19977                Major, Minor, Patch);
19978         exit(0);
19979     }
19980     printf("You have Berkeley DB Version 2 or greater.\n");
19981
19982     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19983                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19984     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19985                 Major, Minor, Patch) ;
19986
19987     /* check that db.h & libdb are compatible */
19988     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19989         printf("db.h and libdb are incompatible.\n") ;
19990         exit(3);
19991     }
19992
19993     printf("db.h and libdb are compatible.\n") ;
19994
19995     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19996                 + DB_VERSION_PATCH ;
19997
19998     /* needs to be >= 2.3.4 */
19999     if (Version < 2003004) {
20000     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
20001         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
20002         exit(2);
20003     }
20004
20005     exit(0);
20006 #else
20007 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
20008     if (argc == 2) {
20009         printf("1 0 0\n");
20010         exit(0);
20011     }
20012     printf("You have Berkeley DB Version 1.\n");
20013     exit(0);    /* DB version < 2: the coast is clear. */
20014 #else
20015     exit(1);    /* <db.h> not Berkeley DB? */
20016 #endif
20017 #endif
20018 }
20019 EOCP
20020         set try
20021         if eval $compile_ok && $run ./try; then
20022                 echo 'Looks OK.' >&4
20023                 set `$run ./try 1`
20024                 db_version_major=$1
20025                 db_version_minor=$2
20026                 db_version_patch=$3
20027         else
20028                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
20029                 i_db=$undef
20030                 case " $libs " in
20031                 *"-ldb "*)
20032                         : Remove db from list of libraries to use
20033                         echo "Removing unusable -ldb from library list" >&4
20034                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
20035                         shift
20036                         libs="$*"
20037                         echo "libs = $libs" >&4
20038                         ;;
20039                 esac
20040         fi
20041         $rm_try
20042         ;;
20043 esac
20044
20045 case "$i_db" in
20046 define)
20047         : Check the return type needed for hash
20048         echo " "
20049         echo "Checking return type needed for hash for Berkeley DB ..." >&4
20050         $cat >try.c <<EOCP
20051 #$d_const HASCONST
20052 #ifndef HASCONST
20053 #define const
20054 #endif
20055 #include <sys/types.h>
20056 #include <db.h>
20057
20058 #ifndef DB_VERSION_MAJOR
20059 u_int32_t hash_cb (const void* ptr, size_t size)
20060 {
20061 }
20062 HASHINFO info;
20063 int main()
20064 {
20065         info.hash = hash_cb;
20066 }
20067 #endif
20068 EOCP
20069         if $cc $ccflags -c try.c >try.out 2>&1 ; then
20070                 if $contains warning try.out >>/dev/null 2>&1 ; then
20071                         db_hashtype='int'
20072                 else
20073                         db_hashtype='u_int32_t'
20074                 fi
20075         else
20076                 : XXX Maybe we should just give up here.
20077                 db_hashtype=u_int32_t
20078                 $cat try.out >&4
20079                 echo "Help:  I can't seem to compile the db test program." >&4
20080                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
20081         fi
20082         $rm_try
20083         echo "Your version of Berkeley DB uses $db_hashtype for hash."
20084         ;;
20085 *)      db_hashtype=u_int32_t
20086         ;;
20087 esac
20088 case "$i_db" in
20089 define)
20090         : Check the return type needed for prefix
20091         echo " "
20092         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
20093         cat >try.c <<EOCP
20094 #$d_const HASCONST
20095 #ifndef HASCONST
20096 #define const
20097 #endif
20098 #include <sys/types.h>
20099 #include <db.h>
20100
20101 #ifndef DB_VERSION_MAJOR
20102 size_t prefix_cb (const DBT *key1, const DBT *key2)
20103 {
20104 }
20105 BTREEINFO info;
20106 int main()
20107 {
20108         info.prefix = prefix_cb;
20109 }
20110 #endif
20111 EOCP
20112         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
20113                 if $contains warning try.out >>/dev/null 2>&1 ; then
20114                         db_prefixtype='int'
20115                 else
20116                         db_prefixtype='size_t'
20117                 fi
20118         else
20119                 db_prefixtype='size_t'
20120                 : XXX Maybe we should just give up here.
20121                 $cat try.out >&4
20122                 echo "Help:  I can't seem to compile the db test program." >&4
20123                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
20124         fi
20125         $rm_try
20126         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
20127         ;;
20128 *)      db_prefixtype='size_t'
20129         ;;
20130 esac
20131
20132 : How can we generate normalized random numbers ?
20133 echo " "
20134 echo "Using our internal random number implementation..." >&4
20135
20136 case "$ccflags" in
20137 *-Dmy_rand=*|*-Dmy_srand=*)
20138         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
20139         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
20140         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
20141         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
20142         ;;
20143 esac
20144
20145 randfunc=Perl_drand48
20146 drand01="Perl_drand48()"
20147 seedfunc="Perl_drand48_init"
20148 randbits=48
20149 randseedtype=U32
20150
20151 : Determine if this is an EBCDIC system
20152 echo " "
20153 echo "Determining whether or not we are on an EBCDIC system..." >&4
20154 $cat >try.c <<'EOM'
20155 int main()
20156 {
20157   if ('M'==0xd4) return 0;
20158   return 1;
20159 }
20160 EOM
20161
20162 val=$undef
20163 set try
20164 if eval $compile_ok; then
20165         if $run ./try; then
20166                 echo "You seem to speak EBCDIC." >&4
20167                 val="$define"
20168         else
20169                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
20170         fi
20171 else
20172         echo "I'm unable to compile the test program." >&4
20173         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
20174 fi
20175 $rm_try
20176 set ebcdic
20177 eval $setvar
20178
20179 : Check how to flush
20180 echo " "
20181 $cat >&4 <<EOM
20182 Checking how to flush all pending stdio output...
20183 EOM
20184 # I only know how to find the first 32 possibly open files on SunOS.
20185 # See also hints/sunos_4_1.sh and util.c  --AD
20186 case "$osname" in
20187 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
20188 esac
20189 $cat >>try.c <<EOCP
20190 #include <stdio.h>
20191 #$i_stdlib I_STDLIB
20192 #ifdef I_STDLIB
20193 #include <stdlib.h>
20194 #endif
20195 #$i_unistd I_UNISTD
20196 #ifdef I_UNISTD
20197 # include <unistd.h>
20198 #endif
20199 #$d_sysconf HAS_SYSCONF
20200 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
20201 #ifdef HAS_STDIO_STREAM_ARRAY
20202 # define STDIO_STREAM_ARRAY $stdio_stream_array
20203 #endif
20204 int main() {
20205   FILE* p;
20206   unlink("try.out");
20207   p = fopen("try.out", "w");
20208 #ifdef TRY_FPUTC
20209   fputc('x', p);
20210 #else
20211 # ifdef TRY_FPRINTF
20212   fprintf(p, "x");
20213 # endif
20214 #endif
20215 #ifdef TRY_FFLUSH_NULL
20216   fflush(NULL);
20217 #endif
20218 #ifdef TRY_FFLUSH_ALL
20219   {
20220     long open_max = -1;
20221 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
20222     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
20223 # else
20224 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
20225     open_max = sysconf(_SC_OPEN_MAX);
20226 #  else
20227 #   ifdef FOPEN_MAX
20228     open_max = FOPEN_MAX;
20229 #   else
20230 #    ifdef OPEN_MAX
20231     open_max = OPEN_MAX;
20232 #    else
20233 #     ifdef _NFILE
20234     open_max = _NFILE;
20235 #     endif
20236 #    endif
20237 #   endif
20238 #  endif
20239 # endif
20240 # ifdef HAS_STDIO_STREAM_ARRAY
20241     if (open_max > 0) {
20242       long i;
20243       for (i = 0; i < open_max; i++)
20244             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
20245                 STDIO_STREAM_ARRAY[i]._file < open_max &&
20246                 STDIO_STREAM_ARRAY[i]._flag)
20247                 fflush(&STDIO_STREAM_ARRAY[i]);
20248     }
20249   }
20250 # endif
20251 #endif
20252   _exit(42);
20253 }
20254 EOCP
20255 : first we have to find out how _not_ to flush
20256 $to try.c
20257 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
20258     output=''
20259     set try -DTRY_FPUTC
20260     if eval $compile; then
20261             $run ./try 2>/dev/null
20262             code="$?"
20263             $from try.out
20264             if $test ! -s try.out -a "X$code" = X42; then
20265                 output=-DTRY_FPUTC
20266             fi
20267     fi
20268     case "$output" in
20269     '')
20270             set try -DTRY_FPRINTF
20271             if eval $compile; then
20272                     $run ./try 2>/dev/null
20273                     code="$?"
20274                     $from try.out
20275                     if $test ! -s try.out -a "X$code" = X42; then
20276                         output=-DTRY_FPRINTF
20277                     fi
20278             fi
20279         ;;
20280     esac
20281 fi
20282 : check for fflush NULL behavior
20283 case "$fflushNULL" in
20284 '')     set try -DTRY_FFLUSH_NULL $output
20285         if eval $compile; then
20286                 $run ./try 2>/dev/null
20287                 code="$?"
20288                 $from try.out
20289                 if $test -s try.out -a "X$code" = X42; then
20290                         fflushNULL="`$cat try.out`"
20291                 else
20292                         if $test "X$code" != X42; then
20293                                 $cat >&4 <<EOM
20294 (If this test failed, don't worry, we'll try another method shortly.)
20295 EOM
20296                         fi
20297                 fi
20298         fi
20299         $rm -f core try.core core.try.*
20300         case "$fflushNULL" in
20301         x)      $cat >&4 <<EOM
20302 Your fflush(NULL) works okay for output streams.
20303 Let's see if it clobbers input pipes...
20304 EOM
20305 # As of mid-March 2000 all versions of Solaris appear to have a stdio
20306 # bug that improperly flushes the input end of pipes.  So we avoid the
20307 # autoflush on fork/system/exec support for now. :-(
20308 $cat >tryp.c <<EOCP
20309 #include <stdio.h>
20310 int
20311 main(int argc, char **argv)
20312 {
20313     char buf[1024];
20314     int i;
20315     char *bp = buf;
20316     while (1) {
20317         while ((i = getc(stdin)) != -1
20318                && (*bp++ = i) != '\n'
20319                && bp < &buf[1024])
20320         /* DO NOTHING */ ;
20321         *bp = '\0';
20322         fprintf(stdout, "%s", buf);
20323         fflush(NULL);
20324         if (i == -1)
20325             return 0;
20326         bp = buf;
20327     }
20328 }
20329 EOCP
20330                 fflushNULL="$define"
20331                 set tryp
20332                 if eval $compile; then
20333                     $rm -f tryp.out
20334                     # Copy the .c file to the remote host ($to is an ssh-alike if targethost is set)
20335                     if $test "X$targethost" != X; then
20336                         $to tryp.c
20337                         $to tryp
20338                         $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20339                     else
20340                         $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20341                     fi
20342                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
20343                        $cat >&4 <<EOM
20344 fflush(NULL) seems to behave okay with input streams.
20345 EOM
20346                         fflushNULL="$define"
20347                     else
20348                         $cat >&4 <<EOM
20349 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
20350 EOM
20351                         fflushNULL="$undef"
20352                     fi
20353                 fi
20354                 $rm -f core tryp.c tryp.core core.tryp.*
20355                 ;;
20356         '')     $cat >&4 <<EOM
20357 Your fflush(NULL) isn't working (contrary to ANSI C).
20358 EOM
20359                 fflushNULL="$undef"
20360                 ;;
20361         *)      $cat >&4 <<EOM
20362 Cannot figure out whether your fflush(NULL) works or not.
20363 I'm assuming it doesn't (contrary to ANSI C).
20364 EOM
20365                 fflushNULL="$undef"
20366                 ;;
20367         esac
20368         ;;
20369 $define|true|[yY]*)
20370         fflushNULL="$define"
20371         ;;
20372 *)
20373         fflushNULL="$undef"
20374         ;;
20375 esac
20376 : check explicit looping only if NULL did not work, and if the pipe
20377 : bug does not show up on an explicit flush too
20378 case "$fflushNULL" in
20379 "$undef")
20380         $cat >tryp.c <<EOCP
20381 #include <stdio.h>
20382 int
20383 main(int argc, char **argv)
20384 {
20385     char buf[1024];
20386     int i;
20387     char *bp = buf;
20388     while (1) {
20389         while ((i = getc(stdin)) != -1
20390                && (*bp++ = i) != '\n'
20391                && bp < &buf[1024])
20392         /* DO NOTHING */ ;
20393         *bp = '\0';
20394         fprintf(stdout, "%s", buf);
20395         fflush(stdin);
20396         if (i == -1)
20397             return 0;
20398         bp = buf;
20399     }
20400 }
20401 EOCP
20402         set tryp
20403         if eval $compile; then
20404             $rm -f tryp.out
20405             if $test "X$targethost" != X; then
20406                 $to tryp.c
20407                 $to tryp
20408                 $run "cat tryp.c | ./tryp " 2>/dev/null > tryp.out
20409             else
20410                 $cat tryp.c | $run ./tryp   2>/dev/null > tryp.out
20411             fi
20412             if cmp tryp.c tryp.out >/dev/null 2>&1; then
20413                $cat >&4 <<EOM
20414 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
20415 EOM
20416                 : now check for fflushall behaviour
20417                 case "$fflushall" in
20418                 '')     set try -DTRY_FFLUSH_ALL $output
20419                         if eval $compile; then
20420                                 $cat >&4 <<EOM
20421 (Now testing the other method--but note that this also may fail.)
20422 EOM
20423                                 $run ./try 2>/dev/null
20424                                 code=$?
20425                                 $from try.out
20426                                 if $test -s try.out -a "X$code" = X42; then
20427                                         fflushall="`$cat try.out`"
20428                                 fi
20429                         fi
20430                         $rm_try
20431                         case "$fflushall" in
20432                         x)      $cat >&4 <<EOM
20433 Whew. Flushing explicitly all the stdio streams works.
20434 EOM
20435                                 fflushall="$define"
20436                                 ;;
20437                         '')     $cat >&4 <<EOM
20438 Sigh. Flushing explicitly all the stdio streams doesn't work.
20439 EOM
20440                                 fflushall="$undef"
20441                                 ;;
20442                         *)      $cat >&4 <<EOM
20443 Cannot figure out whether flushing stdio streams explicitly works or not.
20444 I'm assuming it doesn't.
20445 EOM
20446                                 fflushall="$undef"
20447                                 ;;
20448                         esac
20449                         ;;
20450                 "$define"|true|[yY]*)
20451                         fflushall="$define"
20452                         ;;
20453                 *)
20454                         fflushall="$undef"
20455                         ;;
20456                 esac
20457             else
20458                 $cat >&4 <<EOM
20459 All is futile.  Even fflush(stdin) clobbers input pipes!
20460 EOM
20461                 fflushall="$undef"
20462             fi
20463         else
20464             fflushall="$undef"
20465         fi
20466         $rm -f core tryp.c tryp.core core.tryp.*
20467         ;;
20468 *)      fflushall="$undef"
20469         ;;
20470 esac
20471
20472 case "$fflushNULL$fflushall" in
20473 undefundef)
20474         $cat <<EOM
20475 OK, I give up.  I cannot figure out how to flush pending stdio output.
20476 We won't be flushing handles at all before fork/exec/popen.
20477 EOM
20478         ;;
20479 esac
20480 $rm_try tryp
20481
20482 : Store the full pathname to the ar program for use in the C program
20483 : Respect a hint or command line value for full_ar.
20484 case "$full_ar" in
20485 '') full_ar=$ar ;;
20486 esac
20487
20488 : Store the full pathname to the sed program for use in the C program
20489 full_sed=$sed
20490
20491 : see what type gids are declared as in the kernel
20492 echo " "
20493 echo "Looking for the type for group ids returned by getgid()."
20494 set gid_t gidtype xxx stdio.h sys/types.h
20495 eval $typedef
20496 case "$gidtype" in
20497 xxx)
20498         xxx=`./findhdr sys/user.h`
20499         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
20500         case $1 in
20501         unsigned) dflt="$1 $2" ;;
20502         *) dflt="$1" ;;
20503         esac
20504         ;;
20505 *) dflt="$gidtype";;
20506 esac
20507 case "$gidtype" in
20508 gid_t) echo "gid_t found." ;;
20509 *)      rp="What is the type for group ids returned by getgid()?"
20510         . ./myread
20511         gidtype="$ans"
20512         ;;
20513 esac
20514
20515 : Check the size of GID
20516 echo " "
20517 case "$gidtype" in
20518 *_t) zzz="$gidtype"     ;;
20519 *)   zzz="gid"          ;;
20520 esac
20521 echo "Checking the size of $zzz..." >&4
20522 cat > try.c <<EOCP
20523 #include <sys/types.h>
20524 #include <stdio.h>
20525 #$i_stdlib I_STDLIB
20526 #ifdef I_STDLIB
20527 #include <stdlib.h>
20528 #endif
20529 int main() {
20530     printf("%d\n", (int)sizeof($gidtype));
20531     exit(0);
20532 }
20533 EOCP
20534 set try
20535 if eval $compile_ok; then
20536         yyy=`$run ./try`
20537         case "$yyy" in
20538         '')     gidsize=4
20539                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
20540                 ;;
20541         *)      gidsize=$yyy
20542                 echo "Your $zzz is $gidsize bytes long."
20543                 ;;
20544         esac
20545 else
20546         gidsize=4
20547         echo "(I can't compile the test program--guessing $gidsize.)" >&4
20548 fi
20549
20550
20551 : Check if GID is signed
20552 echo " "
20553 case "$gidtype" in
20554 *_t) zzz="$gidtype"     ;;
20555 *)   zzz="gid"          ;;
20556 esac
20557 echo "Checking the sign of $zzz..." >&4
20558 cat > try.c <<EOCP
20559 #include <sys/types.h>
20560 #include <stdio.h>
20561 int main() {
20562         $gidtype foo = -1;
20563         if (foo < 0)
20564                 printf("-1\n");
20565         else
20566                 printf("1\n");
20567 }
20568 EOCP
20569 set try
20570 if eval $compile; then
20571         yyy=`$run ./try`
20572         case "$yyy" in
20573         '')     gidsign=1
20574                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20575                 ;;
20576         *)      gidsign=$yyy
20577                 case "$gidsign" in
20578                  1) echo "Your $zzz is unsigned." ;;
20579                 -1) echo "Your $zzz is signed."   ;;
20580                 esac
20581                 ;;
20582         esac
20583 else
20584         gidsign=1
20585         echo "(I can't compile the test program--guessing unsigned.)" >&4
20586 fi
20587
20588
20589 : Check 64bit sizes
20590 echo " "
20591
20592 if $test X"$quadtype" != X; then
20593
20594 echo "Checking how to print 64-bit integers..." >&4
20595
20596 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
20597         $cat >try.c <<'EOCP'
20598 #include <sys/types.h>
20599 #include <stdio.h>
20600 int main() {
20601   int q = 12345678901;
20602   printf("%ld\n", q);
20603 }
20604 EOCP
20605         set try
20606         if eval $compile; then
20607                 yyy=`$run ./try`
20608                 case "$yyy" in
20609                 12345678901)
20610                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
20611                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
20612                         echo "We will use %d."
20613                         ;;
20614                 esac
20615         fi
20616 fi
20617
20618 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
20619         $cat >try.c <<'EOCP'
20620 #include <sys/types.h>
20621 #include <stdio.h>
20622 int main() {
20623   long q = 12345678901;
20624   printf("%ld\n", q);
20625 }
20626 EOCP
20627         set try
20628         if eval $compile; then
20629                 yyy=`$run ./try`
20630                 case "$yyy" in
20631                 12345678901)
20632                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
20633                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
20634                         echo "We will use %ld."
20635                         ;;
20636                 esac
20637         fi
20638 fi
20639
20640 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
20641         $cat >try.c <<'EOCP'
20642 #include <sys/types.h>
20643 #include <inttypes.h>
20644 #include <stdio.h>
20645 int main() {
20646   int64_t q = 12345678901;
20647   printf("%" PRId64 "\n", q);
20648 }
20649 EOCP
20650         set try
20651         if eval $compile; then
20652                 yyy=`$run ./try`
20653                 case "$yyy" in
20654                 12345678901)
20655                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
20656                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
20657                         echo "We will use the C9X style."
20658                         ;;
20659                 esac
20660         fi
20661 fi
20662
20663 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20664         $cat >try.c <<EOCP
20665 #include <sys/types.h>
20666 #include <stdio.h>
20667 int main() {
20668   $quadtype q = 12345678901;
20669   printf("%Ld\n", q);
20670 }
20671 EOCP
20672         set try
20673         if eval $compile; then
20674                 yyy=`$run ./try`
20675                 case "$yyy" in
20676                 12345678901)
20677                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
20678                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
20679                         echo "We will use %Ld."
20680                         ;;
20681                 esac
20682         fi
20683 fi
20684
20685 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
20686         $cat >try.c <<'EOCP'
20687 #include <sys/types.h>
20688 #include <stdio.h>
20689 int main() {
20690   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
20691   printf("%lld\n", q);
20692 }
20693 EOCP
20694         set try
20695         if eval $compile; then
20696                 yyy=`$run ./try`
20697                 case "$yyy" in
20698                 12345678901)
20699                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
20700                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
20701                         echo "We will use the %lld style."
20702                         ;;
20703                 esac
20704         fi
20705 fi
20706
20707 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
20708         $cat >try.c <<EOCP
20709 #include <sys/types.h>
20710 #include <stdio.h>
20711 int main() {
20712   $quadtype q = 12345678901;
20713   printf("%qd\n", q);
20714 }
20715 EOCP
20716         set try
20717         if eval $compile; then
20718                 yyy=`$run ./try`
20719                 case "$yyy" in
20720                 12345678901)
20721                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
20722                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
20723                         echo "We will use %qd."
20724                         ;;
20725                 esac
20726         fi
20727 fi
20728
20729 if $test X"$sPRId64" = X; then
20730         echo "Cannot figure out how to print 64-bit integers." >&4
20731 fi
20732 $rm_try
20733
20734 fi
20735
20736 case "$sPRId64" in
20737 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
20738         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
20739         ;;
20740 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
20741         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
20742         ;;
20743 esac
20744
20745 : Check format strings for internal types
20746 echo " "
20747 $echo "Checking the format strings to be used for Perl's internal types..." >&4
20748
20749 if $test X"$ivsize" = X8; then
20750         ivdformat="$sPRId64"
20751         uvuformat="$sPRIu64"
20752         uvoformat="$sPRIo64"
20753         uvxformat="$sPRIx64"
20754         uvXUformat="$sPRIXU64"
20755 else
20756         if $test X"$ivsize" = X"$longsize"; then
20757                 ivdformat='"ld"'
20758                 uvuformat='"lu"'
20759                 uvoformat='"lo"'
20760                 uvxformat='"lx"'
20761                 uvXUformat='"lX"'
20762         else
20763                 if $test X"$ivsize" = X"$intsize"; then
20764                         ivdformat='"d"'
20765                         uvuformat='"u"'
20766                         uvoformat='"o"'
20767                         uvxformat='"x"'
20768                         uvXUformat='"X"'
20769                 else
20770                         : far out
20771                         if $test X"$ivsize" = X"$shortsize"; then
20772                                 ivdformat='"hd"'
20773                                 uvuformat='"hu"'
20774                                 uvoformat='"ho"'
20775                                 uvxformat='"hx"'
20776                                 uvXUformat='"hX"'
20777                         fi
20778                 fi
20779         fi
20780 fi
20781
20782 if $test X"$usequadmath" = X"$define"; then
20783     nveformat='"Qe"'
20784     nvfformat='"Qf"'
20785     nvgformat='"Qg"'
20786     nvEUformat='"QE"'
20787     nvFUformat='"QF"'
20788     nvGUformat='"QG"'
20789 else
20790     if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20791         nveformat="$sPRIeldbl"
20792         nvfformat="$sPRIfldbl"
20793         nvgformat="$sPRIgldbl"
20794         nvEUformat="$sPRIEUldbl"
20795         nvFUformat="$sPRIFUldbl"
20796         nvGUformat="$sPRIGUldbl"
20797     else
20798         nveformat='"e"'
20799         nvfformat='"f"'
20800         nvgformat='"g"'
20801         nvEUformat='"E"'
20802         nvFUformat='"F"'
20803         nvGUformat='"G"'
20804     fi
20805 fi
20806
20807 case "$ivdformat" in
20808 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20809     exit 1
20810     ;;
20811 esac
20812
20813 : Check format string for GID
20814
20815 echo " "
20816 $echo "Checking the format string to be used for gids..." >&4
20817
20818 case "$gidsign" in
20819 -1)     if $test X"$gidsize" = X"$ivsize"; then
20820                 gidformat="$ivdformat"
20821         else
20822                 if $test X"$gidsize" = X"$longsize"; then
20823                         gidformat='"ld"'
20824                 else
20825                         if $test X"$gidsize" = X"$intsize"; then
20826                                 gidformat='"d"'
20827                         else
20828                                 if $test X"$gidsize" = X"$shortsize"; then
20829                                         gidformat='"hd"'
20830                                 fi
20831                         fi
20832                 fi
20833         fi
20834         ;;
20835 *)      if $test X"$gidsize" = X"$uvsize"; then
20836                 gidformat="$uvuformat"
20837         else
20838                 if $test X"$gidsize" = X"$longsize"; then
20839                         gidformat='"lu"'
20840                 else
20841                         if $test X"$gidsize" = X"$intsize"; then
20842                                 gidformat='"u"'
20843                         else
20844                                 if $test X"$gidsize" = X"$shortsize"; then
20845                                         gidformat='"hu"'
20846                                 fi
20847                         fi
20848                 fi
20849         fi
20850         ;;
20851 esac
20852
20853 : see if getgroups exists
20854 set getgroups d_getgrps
20855 eval $inlibc
20856
20857 : see if setgroups exists
20858 set setgroups d_setgrps
20859 eval $inlibc
20860
20861 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20862 echo " "
20863 case "$d_getgrps$d_setgrps" in
20864 *define*)
20865         case "$groupstype" in
20866         '') dflt="$gidtype" ;;
20867         *)  dflt="$groupstype" ;;
20868         esac
20869         $cat <<EOM
20870 What type of pointer is the second argument to getgroups() and setgroups()?
20871 Usually this is the same as group ids, $gidtype, but not always.
20872
20873 EOM
20874         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20875         . ./myread
20876         groupstype="$ans"
20877         ;;
20878 *)  groupstype="$gidtype";;
20879 esac
20880
20881 : check whether make sets MAKE
20882 echo " "
20883 echo "Checking if your $make program sets \$(MAKE)..." >&4
20884 case "$make_set_make" in
20885 '')
20886         $sed 's/^X //' > testmake.mak << 'EOF'
20887 Xall:
20888 X       @echo 'maketemp="$(MAKE)"'
20889 EOF
20890         case "`$make -f testmake.mak 2>/dev/null`" in
20891         *maketemp=*) make_set_make='#' ;;
20892         *)      make_set_make="MAKE=$make" ;;
20893         esac
20894         $rm -f testmake.mak
20895         ;;
20896 esac
20897 case "$make_set_make" in
20898 '#') echo "Yup, it does.";;
20899 *) echo "Nope, it doesn't.";;
20900 esac
20901
20902 : see what type is used for mode_t
20903 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20904 set mode_t modetype int stdio.h sys/types.h
20905 eval $typedef_ask
20906
20907 : see if we need va_copy
20908 echo " "
20909 case "$i_stdarg" in
20910 "$define")
20911         $cat >try.c <<EOCP
20912 #include <stdarg.h>
20913 #include <stdio.h>
20914 #$i_stdlib I_STDLIB
20915 #ifdef I_STDLIB
20916 #include <stdlib.h>
20917 #endif
20918 #include <signal.h>
20919
20920 int
20921 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20922 {
20923   return vfprintf(f, fmt, *valp);
20924 }
20925
20926 int
20927 myvfprintf(FILE *f, const  char *fmt, va_list val)
20928 {
20929   return ivfprintf(f, fmt, &val);
20930 }
20931
20932 int
20933 myprintf(char *fmt, ...)
20934 {
20935   va_list val;
20936   va_start(val, fmt);
20937   return myvfprintf(stdout, fmt, val);
20938 }
20939
20940 int
20941 main(int ac, char **av)
20942 {
20943   signal(SIGSEGV, exit);
20944
20945   myprintf("%s%cs all right, then\n", "that", '\'');
20946   exit(0);
20947 }
20948 EOCP
20949         set try
20950         if eval $compile && $run ./try 2>&1 >/dev/null; then
20951                 case "`$run ./try`" in
20952                 "that's all right, then")
20953                         okay=yes
20954                         ;;
20955                 esac
20956         fi
20957         case "$okay" in
20958         yes)    echo "It seems that you don't need va_copy()." >&4
20959                 need_va_copy="$undef"
20960                 ;;
20961         *)      echo "It seems that va_copy() or similar will be needed." >&4
20962                 need_va_copy="$define"
20963                 ;;
20964         esac
20965         $rm_try
20966         ;;
20967 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20968         need_va_copy="$undef"
20969         ;;
20970 esac
20971
20972 : see what type is used for size_t
20973 rp="What is the type used for the length parameter for string functions?"
20974 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20975 eval $typedef_ask
20976
20977 : check for type of arguments to gethostbyaddr.
20978 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20979         case "$d_gethbyaddr" in
20980         $define)
20981                 $cat <<EOM
20982
20983 Checking to see what type of arguments are accepted by gethostbyaddr().
20984 EOM
20985                 hdrs="$define sys/types.h
20986                         $d_socket sys/socket.h
20987                         $i_niin netinet/in.h
20988                         $i_netdb netdb.h
20989                         $i_unistd unistd.h"
20990                 : The first arg can 'char *' or 'void *'
20991                 : The second arg is some of integral type
20992                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20993                         for yyy in size_t long int; do
20994                                 case "$netdb_host_type" in
20995                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20996                                         if ./protochk "$try" $hdrs; then
20997                                                 echo "Your system accepts $xxx for the first arg."
20998                                                 echo "...and $yyy for the second arg."
20999                                                 netdb_host_type="$xxx"
21000                                                 netdb_hlen_type="$yyy"
21001                                         fi
21002                                         ;;
21003                                 esac
21004                         done
21005                 done
21006                 : In case none of those worked, prompt the user.
21007                 case "$netdb_host_type" in
21008                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
21009                         dflt='char *'
21010                         . ./myread
21011                         netdb_host_type=$ans
21012                         rp='What is the type for the 2nd argument to gethostbyaddr?'
21013                         dflt="$sizetype"
21014                         . ./myread
21015                         netdb_hlen_type=$ans
21016                         ;;
21017                 esac
21018                 ;;
21019         *)      : no gethostbyaddr, so pick harmless defaults
21020                 netdb_host_type='char *'
21021                 netdb_hlen_type="$sizetype"
21022                 ;;
21023         esac
21024         # Remove the "const" if needed. -- but then we'll have a
21025         # prototype clash!
21026         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
21027 fi
21028
21029 : check for type of argument to gethostbyname.
21030 if test "X$netdb_name_type" = X ; then
21031         case "$d_gethbyname" in
21032         $define)
21033                 $cat <<EOM
21034
21035 Checking to see what type of argument is accepted by gethostbyname().
21036 EOM
21037                 hdrs="$define sys/types.h
21038                         $d_socket sys/socket.h
21039                         $i_niin netinet/in.h
21040                         $i_netdb netdb.h
21041                         $i_unistd unistd.h"
21042                 for xxx in "const char *" "char *"; do
21043                         case "$netdb_name_type" in
21044                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
21045                                 if ./protochk "$try" $hdrs; then
21046                                         echo "Your system accepts $xxx."
21047                                         netdb_name_type="$xxx"
21048                                 fi
21049                                 ;;
21050                         esac
21051                 done
21052                 : In case none of those worked, prompt the user.
21053                 case "$netdb_name_type" in
21054                 '')     rp='What is the type for the 1st argument to gethostbyname?'
21055                         dflt='char *'
21056                         . ./myread
21057                         netdb_name_type=$ans
21058                         ;;
21059                 esac
21060                 ;;
21061         *)      : no gethostbyname, so pick harmless default
21062                 netdb_name_type='char *'
21063                 ;;
21064         esac
21065 fi
21066
21067 : check for type of 1st argument to getnetbyaddr.
21068 if test "X$netdb_net_type" = X ; then
21069         case "$d_getnbyaddr" in
21070         $define)
21071                 $cat <<EOM
21072
21073 Checking to see what type of 1st argument is accepted by getnetbyaddr().
21074 EOM
21075                 hdrs="$define sys/types.h
21076                         $d_socket sys/socket.h
21077                         $i_niin netinet/in.h
21078                         $i_netdb netdb.h
21079                         $i_unistd unistd.h"
21080                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
21081                         case "$netdb_net_type" in
21082                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
21083                                 if ./protochk "$try" $hdrs; then
21084                                         echo "Your system accepts $xxx."
21085                                         netdb_net_type="$xxx"
21086                                 fi
21087                                 ;;
21088                         esac
21089                 done
21090                 : In case none of those worked, prompt the user.
21091                 case "$netdb_net_type" in
21092                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
21093                         dflt='long'
21094                         . ./myread
21095                         netdb_net_type=$ans
21096                         ;;
21097                 esac
21098                 ;;
21099         *)      : no getnetbyaddr, so pick harmless default
21100                 netdb_net_type='long'
21101                 ;;
21102         esac
21103 fi
21104 : locate the preferred pager for this system
21105 fn=f/
21106 case "$pager" in
21107 '')
21108         dflt=''
21109         case "$pg" in
21110         /*) dflt=$pg;;
21111         [a-zA-Z]:/*) dflt=$pg;;
21112         esac
21113         case "$more" in
21114         /*) dflt=$more;;
21115         [a-zA-Z]:/*) dflt=$more;;
21116         esac
21117         case "$less" in
21118         /*) dflt=$less;;
21119         [a-zA-Z]:/*) dflt=$less;;
21120         esac
21121         case "$dflt" in
21122         '') dflt=/usr/ucb/more;;
21123         esac
21124         ;;
21125 *)      dflt="$pager"
21126         ;;
21127 esac
21128 fn="f/($dflt)"
21129 echo " "
21130 rp='What pager is used on your system?'
21131 . ./getfile
21132 pager="$ans"
21133
21134 : see what type pids are declared as in the kernel
21135 rp="What is the type of process ids on this system?"
21136 set pid_t pidtype int stdio.h sys/types.h
21137 eval $typedef_ask
21138
21139 : see if ar generates random libraries by itself
21140 echo " "
21141 echo "Checking how to generate random libraries on your machine..." >&4
21142 echo 'int bar1() { return bar2(); }' > bar1.c
21143 echo 'int bar2() { return 2; }' > bar2.c
21144 $cat > foo.c <<EOP
21145 #$i_stdlib I_STDLIB
21146 #ifdef I_STDLIB
21147 #include <stdlib.h>
21148 #endif
21149 int main() { printf("%d\n", bar1()); exit(0); }
21150 EOP
21151 $cc $ccflags -c bar1.c >/dev/null 2>&1
21152 $cc $ccflags -c bar2.c >/dev/null 2>&1
21153 $cc $ccflags -c foo.c >/dev/null 2>&1
21154 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
21155 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21156         $run ./foobar >/dev/null 2>&1; then
21157         echo "$ar appears to generate random libraries itself."
21158         orderlib=false
21159         if [ "X$ranlib" = "X" ]; then
21160             ranlib=":"
21161         fi
21162 elif $ar s bar$_a >/dev/null 2>&1 &&
21163         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21164         $run ./foobar >/dev/null 2>&1; then
21165                 echo "a table of contents needs to be added with '$ar s'."
21166                 orderlib=false
21167                 ranlib="$ar s"
21168 elif $ar ts bar$_a >/dev/null 2>&1 &&
21169         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
21170         $run ./foobar >/dev/null 2>&1; then
21171                 echo "a table of contents needs to be added with '$ar ts'."
21172                 orderlib=false
21173                 ranlib="$ar ts"
21174 else
21175         case "$ranlib" in
21176         :) ranlib='';;
21177         '')
21178                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
21179                 $test -f $ranlib || ranlib=''
21180                 ;;
21181         esac
21182         if $test -n "$ranlib"; then
21183                 echo "your system has '$ranlib'; we'll use that."
21184                 orderlib=false
21185         else
21186                 echo "your system doesn't seem to support random libraries"
21187                 echo "so we'll use lorder and tsort to order the libraries."
21188                 orderlib=true
21189                 ranlib=":"
21190         fi
21191 fi
21192 $rm -f foo* bar*
21193
21194 : see if this is a values.h system
21195 set values.h i_values
21196 eval $inhdr
21197
21198 : Check the max offset that gmtime and localtime accept
21199 echo "Checking max offsets that gmtime () accepts"
21200
21201 case $i_values in
21202     define) yyy="#include <values.h>" ;;
21203     *)      yyy="" ;;
21204     esac
21205
21206 case "$sGMTIME_min/$sGMTIME_max" in
21207     0/0|/)
21208         $cat >try.c <<EOCP
21209 #include <sys/types.h>
21210 #include <stdio.h>
21211 #include <time.h>
21212 $yyy
21213
21214 int i;
21215 struct tm *tmp;
21216 time_t pt;
21217
21218 void gm_check (time_t t, int min_year, int max_year)
21219 {
21220     tmp = gmtime (&t);
21221     if ( tmp == NULL ||
21222         /* Check tm_year overflow */
21223          tmp->tm_year < min_year || tmp->tm_year > max_year)
21224         tmp = NULL;
21225     else
21226         pt = t;
21227     } /* gm_check */
21228
21229 int check_max ()
21230 {
21231     tmp = NULL;
21232     pt  = 0;
21233 #ifdef MAXLONG
21234     gm_check (MAXLONG, 69, 0x7fffffff);
21235 #endif
21236     if (tmp == NULL || tmp->tm_year < 0) {
21237         for (i = 63; i >= 0; i--) {
21238             time_t x = pt | ((time_t)1 << i);
21239             if (x < 0 || x < pt) continue;
21240             gm_check (x, 69, 0x7fffffff);
21241             }
21242         }
21243     printf ("sGMTIME_max=%ld\n", pt);
21244     return (0);
21245     } /* check_max */
21246
21247 int check_min ()
21248 {
21249     tmp = NULL;
21250     pt  = 0;
21251 #ifdef MINLONG
21252     gm_check (MINLONG, -1900, 70);
21253 #endif
21254     if (tmp == NULL) {
21255         for (i = 36; i >= 0; i--) {
21256             time_t x = pt - ((time_t)1 << i);
21257             if (x > 0) continue;
21258             gm_check (x, -1900, 70);
21259             }
21260         }
21261     printf ("sGMTIME_min=%ld\n", pt);
21262     return (0);
21263     } /* check_min */
21264
21265 int main (int argc, char *argv[])
21266 {
21267     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
21268     check_max ();
21269     check_min ();
21270     return (0);
21271     } /* main */
21272 EOCP
21273         set try
21274         if eval $compile; then
21275             eval `$run ./try`
21276         else
21277             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
21278             fi
21279         $rm_try
21280         ;;
21281     esac
21282
21283 echo "Checking max offsets that localtime () accepts"
21284
21285 case "$sLOCALTIME_min/$sLOCALTIME_max" in
21286     0/0|/)
21287         $cat >try.c <<EOCP
21288 #include <sys/types.h>
21289 #include <stdio.h>
21290 #include <time.h>
21291 $yyy
21292
21293 int i;
21294 struct tm *tmp;
21295 time_t pt;
21296
21297 void local_check (time_t t, int min_year, int max_year)
21298 {
21299     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
21300         tmp = NULL;
21301     else
21302         tmp = localtime (&t);
21303     if ( tmp == NULL ||
21304         /* Check tm_year overflow */
21305          tmp->tm_year < min_year || tmp->tm_year > max_year)
21306         tmp = NULL;
21307     else
21308         pt = t;
21309     } /* local_check */
21310
21311 int check_max ()
21312 {
21313     tmp = NULL;
21314     pt  = 0;
21315 #ifdef MAXLONG
21316     local_check (MAXLONG, 69, 0x7fffffff);
21317 #endif
21318     if (tmp == NULL || tmp->tm_year < 0) {
21319         for (i = 63; i >= 0; i--) {
21320             time_t x = pt | ((time_t)1 << i);
21321             if (x < 0 || x < pt) continue;
21322             local_check (x, 69, 0x7fffffff);
21323             }
21324         }
21325     printf ("sLOCALTIME_max=%ld\n", pt);
21326     return (0);
21327    } /* check_max */
21328
21329 int check_min ()
21330 {
21331     tmp = NULL;
21332     pt  = 0;
21333 #ifdef MINLONG
21334     local_check (MINLONG, -1900, 70);
21335 #endif
21336     if (tmp == NULL) {
21337         for (i = 36; i >= 0; i--) {
21338             time_t x = pt - ((time_t)1 << i);
21339             if (x > 0) continue;
21340             local_check (x, -1900, 70);
21341             }
21342         }
21343     printf ("sLOCALTIME_min=%ld\n", pt);
21344     return (0);
21345     } /* check_min */
21346
21347 int main (int argc, char *argv[])
21348 {
21349     check_max ();
21350     check_min ();
21351     return (0);
21352     } /* main */
21353 EOCP
21354         set try
21355         if eval $compile; then
21356             eval `$run ./try`
21357         else
21358             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
21359             fi
21360         $rm_try
21361         ;;
21362     esac
21363
21364 : check for type of arguments to select.
21365 case "$selecttype" in
21366 '') case "$d_select" in
21367         $define)
21368                 echo " "
21369                 $cat <<EOM
21370 Checking to see what type of arguments are accepted by select().
21371 EOM
21372                 hdrs="$define sys/types.h
21373                         $i_systime sys/time.h
21374                         $i_sysselct sys/select.h
21375                         $d_socket sys/socket.h"
21376                 : The first arg can be int, unsigned, or size_t
21377                 : The last arg may or may not be 'const'
21378                 val=''
21379                 : void pointer has been seen but using that
21380                 : breaks the selectminbits test
21381                 for xxx in 'fd_set *' 'int *'; do
21382                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
21383                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
21384                                         case "$val" in
21385                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
21386                                                 if ./protochk "$try" $hdrs; then
21387                                                         echo "Your system accepts $xxx."
21388                                                         val="$xxx"
21389                                                 fi
21390                                                 ;;
21391                                         esac
21392                                 done
21393                         done
21394                 done
21395                 case "$val" in
21396                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
21397                         case "$d_fd_set" in
21398                                 $define) dflt="fd_set *" ;;
21399                                 *)              dflt="int *" ;;
21400                         esac
21401                         . ./myread
21402                         val=$ans
21403                         ;;
21404                 esac
21405                 selecttype="$val"
21406                 ;;
21407         *)      : no select, so pick a harmless default
21408                 selecttype='int *'
21409                 ;;
21410         esac
21411         ;;
21412 esac
21413
21414 : check for the select 'width'
21415 case "$selectminbits" in
21416 '') safebits=`expr $ptrsize \* 8`
21417     case "$d_select" in
21418         $define)
21419                 $cat <<EOM
21420
21421 Checking to see on how many bits at a time your select() operates...
21422 EOM
21423                 $cat >try.c <<EOCP
21424 #include <sys/types.h>
21425 #$i_time I_TIME
21426 #$i_systime I_SYS_TIME
21427 #$i_systimek I_SYS_TIME_KERNEL
21428 #ifdef I_TIME
21429 #   include <time.h>
21430 #endif
21431 #ifdef I_SYS_TIME
21432 #   ifdef I_SYS_TIME_KERNEL
21433 #       define KERNEL
21434 #   endif
21435 #   include <sys/time.h>
21436 #   ifdef I_SYS_TIME_KERNEL
21437 #       undef KERNEL
21438 #   endif
21439 #endif
21440 #$i_sysselct I_SYS_SELECT
21441 #ifdef I_SYS_SELECT
21442 #include <sys/select.h>
21443 #endif
21444 #$d_socket HAS_SOCKET
21445 #ifdef HAS_SOCKET
21446 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
21447 #endif
21448 #include <stdio.h>
21449 #$i_stdlib I_STDLIB
21450 #ifdef I_STDLIB
21451 #include <stdlib.h>
21452 #endif
21453 $selecttype b;
21454 #define S sizeof(*(b))
21455 #define MINBITS 64
21456 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
21457 #define NBITS  (NBYTES * 8)
21458 int main() {
21459     char *s = (char *)malloc(NBYTES);
21460     struct timeval t;
21461     int i;
21462     FILE* fp;
21463     int fd;
21464
21465     if (!s)
21466         exit(1);
21467     fclose(stdin);
21468     fp = fopen("try.c", "r");
21469     if (fp == 0)
21470       exit(2);
21471     fd = fileno(fp);
21472     if (fd < 0)
21473       exit(3);
21474     b = ($selecttype)s;
21475     for (i = 0; i < NBITS; i++)
21476         FD_SET(i, b);
21477     t.tv_sec  = 0;
21478     t.tv_usec = 0;
21479     select(fd + 1, b, 0, 0, &t);
21480     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
21481     free(s);
21482     printf("%d\n", i + 1);
21483     return 0;
21484 }
21485 EOCP
21486                 set try
21487                 if eval $compile_ok; then
21488                         selectminbits=`$run ./try`
21489                         case "$selectminbits" in
21490                         '')     cat >&4 <<EOM
21491 Cannot figure out on how many bits at a time your select() operates.
21492 I'll play safe and guess it is $safebits bits.
21493 EOM
21494                                 selectminbits=$safebits
21495                                 bits="$safebits bits"
21496                                 ;;
21497                         1)      bits="1 bit" ;;
21498                         *)      bits="$selectminbits bits" ;;
21499                         esac
21500                         echo "Your select() operates on $bits at a time." >&4
21501                 else
21502                         rp='What is the minimum number of bits your select() operates on?'
21503                         case "$byteorder" in
21504                         12345678)       dflt=64 ;;
21505                         1234)           dflt=32 ;;
21506                         *)              dflt=1  ;;
21507                         esac
21508                         . ./myread
21509                         val=$ans
21510                         selectminbits="$val"
21511                 fi
21512                 $rm_try
21513                 ;;
21514         *)      : no select, so pick a harmless default
21515                 selectminbits=$safebits
21516                 ;;
21517         esac
21518         ;;
21519 esac
21520
21521 : Trace out the files included by signal.h, then look for SIGxxx names.
21522 if [ "X$fieldn" = X ]; then
21523         : Just make some guesses.  We check them later.
21524         xxx="$sysroot/usr/include/signal.h $sysroot/usr/include/sys/signal.h"
21525 else
21526         xxx=`echo '#include <signal.h>' |
21527         $cppstdin $cppminus $cppflags 2>/dev/null |
21528         $grep '^[       ]*#.*include' |
21529         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
21530                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
21531 fi
21532 xxxfiles=''
21533 for xx in $xxx /dev/null ; do
21534         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
21535 done
21536 case "$xxxfiles" in
21537 '')     xxxfiles=`./findhdr signal.h` ;;
21538 esac
21539 xxx=`awk '
21540 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
21541         print substr($2, 4, 20)
21542 }
21543 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
21544         print substr($3, 4, 20)
21545 }' $xxxfiles`
21546 : Append some common names just in case the awk scan failed.
21547 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
21548 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
21549 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
21550 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
21551 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
21552
21553 : generate a few handy files for later
21554 $cat > signal.c <<EOCP
21555 #include <sys/types.h>
21556 #include <signal.h>
21557 #$i_stdlib I_STDLIB
21558 #ifdef I_STDLIB
21559 #include <stdlib.h>
21560 #endif
21561 #include <stdio.h>
21562 int main() {
21563
21564 /* Strange style to avoid deeply-nested #if/#else/#endif */
21565 #ifndef NSIG
21566 #  ifdef _NSIG
21567 #    define NSIG (_NSIG)
21568 #  endif
21569 #endif
21570
21571 #ifndef NSIG
21572 #  ifdef SIGMAX
21573 #    define NSIG (SIGMAX+1)
21574 #  endif
21575 #endif
21576
21577 #ifndef NSIG
21578 #  ifdef SIG_MAX
21579 #    define NSIG (SIG_MAX+1)
21580 #  endif
21581 #endif
21582
21583 #ifndef NSIG
21584 #  ifdef _SIG_MAX
21585 #    define NSIG (_SIG_MAX+1)
21586 #  endif
21587 #endif
21588
21589 #ifndef NSIG
21590 #  ifdef MAXSIG
21591 #    define NSIG (MAXSIG+1)
21592 #  endif
21593 #endif
21594
21595 #ifndef NSIG
21596 #  ifdef MAX_SIG
21597 #    define NSIG (MAX_SIG+1)
21598 #  endif
21599 #endif
21600
21601 #ifndef NSIG
21602 #  ifdef SIGARRAYSIZE
21603 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
21604 #  endif
21605 #endif
21606
21607 #ifndef NSIG
21608 #  ifdef _sys_nsig
21609 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
21610 #  endif
21611 #endif
21612
21613 /* Default to some arbitrary number that's big enough to get most
21614    of the common signals.
21615 */
21616 #ifndef NSIG
21617 #    define NSIG 50
21618 #endif
21619
21620 printf("NSIG %d\n", NSIG);
21621
21622 #ifndef JUST_NSIG
21623
21624 EOCP
21625
21626 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
21627 {
21628         printf "#ifdef SIG"; printf $1; printf "\n"
21629         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
21630         printf $1; printf ");\n"
21631         printf "#endif\n"
21632 }
21633 END {
21634         printf "#endif /* JUST_NSIG */\n";
21635         printf "exit(0);\n}\n";
21636 }
21637 ' >>signal.c
21638 $cat >signal.awk <<'EOP'
21639 BEGIN { ndups = 0 }
21640 $1 ~ /^NSIG$/ { nsig = $2 }
21641 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
21642     if ($2 > maxsig) { maxsig = $2 }
21643     if (sig_name[$2]) {
21644         dup_name[ndups] = $1
21645         dup_num[ndups] = $2
21646         ndups++
21647     }
21648     else {
21649         sig_name[$2] = $1
21650         sig_num[$2] = $2
21651     }
21652 }
21653 END {
21654     if (nsig == 0) {
21655         nsig = maxsig + 1
21656     }
21657     printf("NSIG %d\n", nsig);
21658     for (n = 1; n < nsig; n++) {
21659         if (sig_name[n]) {
21660             printf("%s %d\n", sig_name[n], sig_num[n])
21661         }
21662         else {
21663             printf("NUM%d %d\n", n, n)
21664         }
21665     }
21666     for (n = 0; n < ndups; n++) {
21667         printf("%s %d\n", dup_name[n], dup_num[n])
21668     }
21669 }
21670 EOP
21671 $cat >signal_cmd <<EOS
21672 $startsh
21673 if $test -s signal.lst; then
21674     echo "Using your existing signal.lst file"
21675         exit 0
21676 fi
21677 xxx="$xxx"
21678 EOS
21679 $cat >>signal_cmd <<'EOS'
21680
21681 set signal
21682 if eval $compile_ok; then
21683         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
21684                 $uniq | $awk -f signal.awk >signal.lst
21685 else
21686         echo "(I can't seem be able to compile the whole test program)" >&4
21687         echo "(I'll try it in little pieces.)" >&4
21688         set signal -DJUST_NSIG
21689         if eval $compile_ok; then
21690                 $run ./signal$_exe > signal.nsg
21691                 $cat signal.nsg
21692         else
21693                 echo "I can't seem to figure out how many signals you have." >&4
21694                 echo "Guessing 50." >&4
21695                 echo 'NSIG 50' > signal.nsg
21696         fi
21697         : Now look at all the signal names, one at a time.
21698         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
21699                 $cat > signal.c <<EOCP
21700 #include <sys/types.h>
21701 #include <signal.h>
21702 #include <stdio.h>
21703 int main() {
21704 printf("$xx %d\n", SIG${xx});
21705 return 0;
21706 }
21707 EOCP
21708                 set signal
21709                 if eval $compile; then
21710                         echo "SIG${xx} found."
21711                         $run ./signal$_exe  >> signal.ls1
21712                 else
21713                         echo "SIG${xx} NOT found."
21714                 fi
21715         done
21716         if $test -s signal.ls1; then
21717                 $cat signal.nsg signal.ls1 |
21718                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
21719         fi
21720
21721 fi
21722 if $test -s signal.lst; then
21723         :
21724 else
21725         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
21726         echo 'kill -l' >signal
21727         set X `csh -f <signal`
21728         $rm -f signal
21729         shift
21730         case $# in
21731         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
21732         esac
21733         echo $@ | $tr ' ' $trnl | \
21734             $awk '{ printf "%s %d\n", $1, ++s; }
21735                   END { printf "NSIG %d\n", ++s }' >signal.lst
21736 fi
21737 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
21738 EOS
21739 chmod a+x signal_cmd
21740 $eunicefix signal_cmd
21741
21742 : generate list of signal names
21743 echo " "
21744 case "$sig_name_init" in
21745 '') doinit=yes ;;
21746 *)  case "$sig_num_init" in
21747     ''|*,*) doinit=yes ;;
21748     esac ;;
21749 esac
21750 case "$doinit" in
21751 yes)
21752         echo "Generating a list of signal names and numbers..." >&4
21753         . ./signal_cmd
21754         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21755         sig_name=`$awk 'BEGIN { printf "ZERO " }
21756                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21757         sig_num=`$awk  'BEGIN { printf "0 " }
21758                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21759         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21760                              !/^NSIG/   { printf "\"%s\", ", $1 }
21761                              END        { printf "0\n" }' signal.lst`
21762         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21763                              !/^NSIG/   { printf "%d, ", $2}
21764                              END        { printf "0\n"}' signal.lst`
21765         ;;
21766 esac
21767 echo "The following $sig_count signals are available:"
21768 echo " "
21769 echo $sig_name | $awk \
21770 'BEGIN { linelen = 0 }
21771 {
21772         for (i = 1; i <= NF; i++) {
21773                 name = "SIG" $i " "
21774                 linelen = linelen + length(name)
21775                 if (linelen > 70) {
21776                         printf "\n"
21777                         linelen = length(name)
21778                 }
21779                 printf "%s", name
21780         }
21781         printf "\n"
21782 }'
21783 sig_size=`echo $sig_name | awk '{print NF}'`
21784 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21785
21786 : Check size of size
21787 echo " "
21788 case "$sizetype" in
21789 *_t) zzz="$sizetype"    ;;
21790 *)   zzz="filesize"     ;;
21791 esac
21792 echo "Checking the size of $zzz..." >&4
21793 cat > try.c <<EOCP
21794 #include <sys/types.h>
21795 #include <stdio.h>
21796 #$i_stdlib I_STDLIB
21797 #ifdef I_STDLIB
21798 #include <stdlib.h>
21799 #endif
21800 int main() {
21801     printf("%d\n", (int)sizeof($sizetype));
21802     exit(0);
21803 }
21804 EOCP
21805 set try
21806 if eval $compile_ok; then
21807         yyy=`$run ./try`
21808         case "$yyy" in
21809         '')     sizesize=4
21810                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21811                 ;;
21812         *)      sizesize=$yyy
21813                 echo "Your $zzz size is $sizesize bytes."
21814                 ;;
21815         esac
21816 else
21817         sizesize=4
21818         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21819 fi
21820
21821
21822 : check for socklen_t
21823 echo " "
21824 echo "Checking to see if you have socklen_t..." >&4
21825 $cat >try.c <<EOCP
21826 #include <sys/types.h>
21827 #$d_socket HAS_SOCKET
21828 #ifdef HAS_SOCKET
21829 #include <sys/socket.h>
21830 #endif
21831 int main() { socklen_t x = 16; }
21832 EOCP
21833 set try
21834 if eval $compile; then
21835         val="$define"
21836         echo "You have socklen_t."
21837 else
21838         val="$undef"
21839         echo "You do not have socklen_t."
21840         case "$sizetype" in
21841         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21842         esac
21843 fi
21844 $rm_try
21845 set d_socklen_t
21846 eval $setvar
21847
21848 : see if this is a socks.h system
21849 set socks.h i_socks
21850 eval $inhdr
21851
21852 : check for type of the size argument to socket calls
21853 case "$d_socket" in
21854 "$define")
21855         $cat <<EOM
21856
21857 Checking to see what type is the last argument of accept().
21858 EOM
21859         yyy=''
21860         case "$d_socklen_t" in
21861         "$define") yyy="$yyy socklen_t"
21862         esac
21863         yyy="$yyy $sizetype int long unsigned"
21864         for xxx in $yyy; do
21865                 case "$socksizetype" in
21866                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21867                         case "$usesocks" in
21868                         "$define")
21869                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21870                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21871                                         socksizetype="$xxx"
21872                                 fi
21873                                 ;;
21874                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21875                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21876                                         socksizetype="$xxx"
21877                                 fi
21878                                 ;;
21879                         esac
21880                         ;;
21881                 esac
21882         done
21883 : In case none of those worked, prompt the user.
21884         case "$socksizetype" in
21885         '')     rp='What is the type for socket address structure sizes?'
21886                 dflt='int'
21887                 . ./myread
21888                 socksizetype=$ans
21889                 ;;
21890         esac
21891         ;;
21892 *)      : no sockets, so pick relatively harmless default
21893         socksizetype='int'
21894         ;;
21895 esac
21896
21897 : see what type is used for signed size_t
21898 set ssize_t ssizetype int stdio.h sys/types.h
21899 eval $typedef
21900 dflt="$ssizetype"
21901 $cat > try.c <<EOM
21902 #include <stdio.h>
21903 #$i_stdlib I_STDLIB
21904 #ifdef I_STDLIB
21905 #include <stdlib.h>
21906 #endif
21907 #include <sys/types.h>
21908 #define Size_t $sizetype
21909 #define SSize_t $dflt
21910 int main()
21911 {
21912         if (sizeof(Size_t) == sizeof(SSize_t))
21913                 printf("$dflt\n");
21914         else if (sizeof(Size_t) == sizeof(int))
21915                 printf("int\n");
21916         else
21917                 printf("long\n");
21918         exit(0);
21919 }
21920 EOM
21921 echo " "
21922 set try
21923 if eval $compile_ok && $run ./try > /dev/null; then
21924         ssizetype=`$run ./try`
21925         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21926 else
21927         $cat >&4 <<EOM
21928 Help! I can't compile and run the ssize_t test program: please enlighten me!
21929 (This is probably a misconfiguration in your system or libraries, and
21930 you really ought to fix it.  Still, I'll try anyway.)
21931
21932 I need a type that is the same size as $sizetype, but is guaranteed to
21933 be signed.  Common values are ssize_t, int and long.
21934
21935 EOM
21936         rp="What signed type is the same size as $sizetype?"
21937         . ./myread
21938         ssizetype="$ans"
21939 fi
21940 $rm_try
21941
21942 : Check the size of st_ino
21943 $echo " "
21944 $echo "Checking the size of st_ino..." >&4
21945 $cat > try.c <<EOCP
21946 #include <sys/stat.h>
21947 #include <stdio.h>
21948 #$i_stdlib I_STDLIB
21949 #ifdef I_STDLIB
21950 #include <stdlib.h>
21951 #endif
21952 int main() {
21953     struct stat st;
21954     printf("%d\n", (int)sizeof(st.st_ino));
21955     exit(0);
21956 }
21957 EOCP
21958 set try
21959 if eval $compile_ok; then
21960         val=`$run ./try`
21961         case "$val" in
21962         '')     st_ino_size=4
21963                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21964                 ;;
21965         *)      st_ino_size=$val
21966                 $echo "Your st_ino is $st_ino_size bytes long."
21967                 ;;
21968         esac
21969 else
21970         st_ino_size=4
21971         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21972 fi
21973 $rm_try
21974
21975 : Check if st_ino is signed
21976 $echo " "
21977 $echo "Checking the sign of st_ino..." >&4
21978 $cat > try.c <<EOCP
21979 #include <sys/stat.h>
21980 #include <stdio.h>
21981 int main() {
21982         struct stat foo;
21983         foo.st_ino = -1;
21984         if (foo.st_ino < 0)
21985                 printf("-1\n");
21986         else
21987                 printf("1\n");
21988 }
21989 EOCP
21990 set try
21991 if eval $compile; then
21992         val=`$run ./try`
21993         case "$val" in
21994         '')     st_ino_sign=1
21995                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21996                 ;;
21997         *)      st_ino_sign=$val
21998                 case "$st_ino_sign" in
21999                  1) $echo "Your st_ino is unsigned." ;;
22000                 -1) $echo "Your st_ino is signed."   ;;
22001                 esac
22002                 ;;
22003         esac
22004 else
22005         st_ino_sign=1
22006         $echo "(I can't compile the test program--guessing unsigned.)" >&4
22007 fi
22008 $rm_try
22009
22010 : see what type of char stdio uses.
22011 echo " "
22012 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
22013 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
22014         echo "Your stdio uses unsigned chars." >&4
22015         stdchar="unsigned char"
22016 else
22017         echo "Your stdio uses signed chars." >&4
22018         stdchar="char"
22019 fi
22020 $rm -f stdioh
22021
22022 : see what type uids are declared as in the kernel
22023 echo " "
22024 echo "Looking for the type for user ids returned by getuid()."
22025 set uid_t uidtype xxx stdio.h sys/types.h
22026 eval $typedef
22027 case "$uidtype" in
22028 xxx)
22029         xxx=`./findhdr sys/user.h`
22030         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
22031         case $1 in
22032         unsigned) dflt="$1 $2" ;;
22033         *) dflt="$1" ;;
22034         esac
22035         ;;
22036 *) dflt="$uidtype";;
22037 esac
22038 case "$uidtype" in
22039 uid_t)  echo "uid_t found." ;;
22040 *)      rp="What is the type for user ids returned by getuid()?"
22041         . ./myread
22042         uidtype="$ans"
22043         ;;
22044 esac
22045
22046 : Check size of UID
22047 echo " "
22048 case "$uidtype" in
22049 *_t) zzz="$uidtype"     ;;
22050 *)   zzz="uid"          ;;
22051 esac
22052 echo "Checking the size of $zzz..." >&4
22053 cat > try.c <<EOCP
22054 #include <sys/types.h>
22055 #include <stdio.h>
22056 #$i_stdlib I_STDLIB
22057 #ifdef I_STDLIB
22058 #include <stdlib.h>
22059 #endif
22060 int main() {
22061     printf("%d\n", (int)sizeof($uidtype));
22062     exit(0);
22063 }
22064 EOCP
22065 set try
22066 if eval $compile_ok; then
22067         yyy=`$run ./try`
22068         case "$yyy" in
22069         '')     uidsize=4
22070                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
22071                 ;;
22072         *)      uidsize=$yyy
22073                 echo "Your $zzz is $uidsize bytes long."
22074                 ;;
22075         esac
22076 else
22077         uidsize=4
22078         echo "(I can't compile the test program--guessing $uidsize.)" >&4
22079 fi
22080
22081 : Check if UID is signed
22082 echo " "
22083 case "$uidtype" in
22084 *_t) zzz="$uidtype"     ;;
22085 *)   zzz="uid"          ;;
22086 esac
22087 echo "Checking the sign of $zzz..." >&4
22088 cat > try.c <<EOCP
22089 #include <sys/types.h>
22090 #include <stdio.h>
22091 int main() {
22092         $uidtype foo = -1;
22093         if (foo < 0)
22094                 printf("-1\n");
22095         else
22096                 printf("1\n");
22097 }
22098 EOCP
22099 set try
22100 if eval $compile; then
22101         yyy=`$run ./try`
22102         case "$yyy" in
22103         '')     uidsign=1
22104                 echo "(I can't execute the test program--guessing unsigned.)" >&4
22105                 ;;
22106         *)      uidsign=$yyy
22107                 case "$uidsign" in
22108                  1) echo "Your $zzz is unsigned." ;;
22109                 -1) echo "Your $zzz is signed."   ;;
22110                 esac
22111                 ;;
22112         esac
22113 else
22114         uidsign=1
22115         echo "(I can't compile the test program--guessing unsigned.)" >&4
22116 fi
22117
22118
22119 : Check format string for UID
22120 echo " "
22121 $echo "Checking the format string to be used for uids..." >&4
22122
22123 case "$uidsign" in
22124 -1)     if $test X"$uidsize" = X"$ivsize"; then
22125                 uidformat="$ivdformat"
22126         else
22127                 if $test X"$uidsize" = X"$longsize"; then
22128                         uidformat='"ld"'
22129                 else
22130                         if $test X"$uidsize" = X"$intsize"; then
22131                                 uidformat='"d"'
22132                         else
22133                                 if $test X"$uidsize" = X"$shortsize"; then
22134                                         uidformat='"hd"'
22135                                 fi
22136                         fi
22137                 fi
22138         fi
22139         ;;
22140 *)      if $test X"$uidsize" = X"$uvsize"; then
22141                 uidformat="$uvuformat"
22142         else
22143                 if $test X"$uidsize" = X"$longsize"; then
22144                         uidformat='"lu"'
22145                 else
22146                         if $test X"$uidsize" = X"$intsize"; then
22147                                 uidformat='"u"'
22148                         else
22149                                 if $test X"$uidsize" = X"$shortsize"; then
22150                                         uidformat='"hu"'
22151                                 fi
22152                         fi
22153                 fi
22154         fi
22155         ;;
22156 esac
22157
22158 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
22159 echo " "
22160 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
22161 $cat >try.c <<'EOM'
22162 /* Intentionally a long probe as I'd like to sanity check that the exact
22163    approach is going to work, as thinking it will work, but only having it
22164    part working at runtime is worse than not having it.  */
22165
22166 #include <sys/types.h>
22167 #include <sys/sysctl.h>
22168 #include <sys/param.h>
22169 #include <stdio.h>
22170 #include <string.h>
22171 #include <stdlib.h>
22172 #include <unistd.h>
22173
22174 int
22175 main(int argc, char **argv) {
22176     char *buffer;
22177     char *argv_leaf = strrchr(argv[0], '/');
22178     char *buffer_leaf;
22179     size_t size = 0;
22180     int mib[4];
22181
22182     mib[0] = CTL_KERN;
22183     mib[1] = KERN_PROC;
22184     mib[2] = KERN_PROC_PATHNAME;
22185     mib[3] = -1;
22186
22187     if (!argv_leaf) {
22188         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22189         return 1;
22190     }
22191
22192     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
22193         perror("sysctl");
22194         return 2;
22195     }
22196
22197     if (size < strlen(argv_leaf) + 1) {
22198         fprintf(stderr, "size %lu is too short for a path\n",
22199                 (unsigned long) size);
22200         return 3;
22201     }
22202
22203     if (size > MAXPATHLEN * MAXPATHLEN) {
22204         fprintf(stderr, "size %lu is too long for a path\n",
22205                 (unsigned long) size);
22206         return 4;
22207     }
22208
22209     buffer = malloc(size);
22210     if (!buffer) {
22211         perror("malloc");
22212         return 5;
22213     }
22214
22215     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
22216         perror("sysctl");
22217         return 6;
22218     }
22219
22220     if (strlen(buffer) + 1 != size) {
22221         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
22222                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
22223         return 7;
22224     }
22225
22226
22227     if (*buffer != '/') {
22228         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
22229         return 8;
22230     }
22231
22232     if (strstr(buffer, "/./")) {
22233         fprintf(stderr, "Contains /./: '%s'\n", buffer);
22234         return 9;
22235     }
22236
22237     if (strstr(buffer, "/../")) {
22238         fprintf(stderr, "Contains /../: '%s'\n", buffer);
22239         return 10;
22240     }
22241
22242     buffer_leaf = strrchr(buffer, '/');
22243     if (strcmp(buffer_leaf, argv_leaf) != 0) {
22244         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
22245         return 11;
22246     }
22247
22248     free(buffer);
22249
22250     return 0;
22251 }
22252 EOM
22253
22254 val=$undef
22255 set try
22256 if eval $compile; then
22257         if $run ./try; then
22258                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
22259                 val="$define"
22260         else
22261                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
22262                 val="$undef"
22263         fi
22264 else
22265         echo "I'm unable to compile the test program." >&4
22266         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
22267         val="$undef"
22268 fi
22269 $rm_try
22270 set usekernprocpathname
22271 eval $setvar
22272
22273 : Determine if we can use _NSGetExecutablePath to find executing program
22274 echo " "
22275 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
22276 $cat >try.c <<'EOM'
22277 /* Intentionally a long probe as I'd like to sanity check that the exact
22278    approach is going to work, as thinking it will work, but only having it
22279    part working at runtime is worse than not having it.  */
22280 #include <mach-o/dyld.h>
22281 #include <stdio.h>
22282 #include <stdlib.h>
22283 #include <sys/param.h>
22284 #include <string.h>
22285
22286 int
22287 main(int argc, char **argv) {
22288     char buf[1];
22289     uint32_t size = sizeof(buf);
22290     int result;
22291     char *buffer;
22292     char *tidied;
22293     char *argv_leaf = strrchr(argv[0], '/');
22294     char *tidied_leaf;
22295
22296     if (!argv_leaf) {
22297         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
22298         return 1;
22299     }
22300
22301     _NSGetExecutablePath(buf, &size);
22302     if (size > MAXPATHLEN * MAXPATHLEN) {
22303         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
22304                 (unsigned int) size);
22305         return 2;
22306     }
22307
22308     buffer = malloc(size);
22309     if (!buffer) {
22310         perror("malloc");
22311         return 3;
22312     }
22313
22314     result = _NSGetExecutablePath(buffer, &size);
22315     if (result != 0) {
22316         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
22317                 result, (unsigned int) size);
22318         return 4;
22319     }
22320
22321     tidied = realpath(buffer, NULL);
22322     if (!tidied) {
22323         perror("realpath");
22324         return 5;
22325     }
22326
22327     free(buffer);
22328
22329     if (*tidied != '/') {
22330         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
22331         return 6;
22332     }
22333
22334     if (strstr(tidied, "/./")) {
22335         fprintf(stderr, "Contains /./: '%s'\n", tidied);
22336         return 7;
22337     }
22338
22339     if (strstr(tidied, "/../")) {
22340         fprintf(stderr, "Contains /../: '%s'\n", tidied);
22341         return 8;
22342     }
22343
22344     tidied_leaf = strrchr(tidied, '/');
22345     if (strcmp(tidied_leaf, argv_leaf) != 0) {
22346         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
22347         return 9;
22348     }
22349
22350     free(tidied);
22351
22352     return 0;
22353 }
22354 EOM
22355
22356 val=$undef
22357 set try
22358 if eval $compile; then
22359         if $run ./try; then
22360                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
22361                 val="$define"
22362         else
22363                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
22364         fi
22365 else
22366         echo "I'm unable to compile the test program." >&4
22367         echo "I'll assume no _NSGetExecutablePath here." >&4
22368 fi
22369 $rm_try
22370 set usensgetexecutablepath
22371 eval $setvar
22372
22373 : Check if site customization support was requested
22374 case "$usesitecustomize" in
22375     $define|true|[Yy]*)
22376         usesitecustomize="$define"
22377         ;;
22378     *)
22379         usesitecustomize="$undef"
22380         ;;
22381     esac
22382
22383 : see if prototypes support variable argument declarations
22384 echo " "
22385 case "$prototype$i_stdarg" in
22386 $define$define)
22387         echo "It appears we'll be able to prototype varargs functions." >&4
22388         val="$define"
22389         ;;
22390 *)
22391         echo "Too bad... We won't be using prototyped varargs functions..." >&4
22392         val="$undef"
22393         ;;
22394 esac
22395 set vaproto
22396 eval $setvar
22397
22398 : determine compiler compiler
22399 case "$yacc" in
22400 '')
22401         dflt=yacc;;
22402 *)
22403         dflt="$yacc";;
22404 esac
22405 echo " "
22406 comp='yacc'
22407 if $test -f "$byacc$_exe"; then
22408         dflt="$byacc"
22409         comp="byacc or $comp"
22410 fi
22411 if $test -f "$bison$_exe"; then
22412         comp="$comp or bison -y"
22413 fi
22414 rp="Which compiler compiler ($comp) shall I use?"
22415 . ./myread
22416 yacc="$ans"
22417 case "$yacc" in
22418 *bis*)
22419         case "$yacc" in
22420         *-y*) ;;
22421         *)
22422                 yacc="$yacc -y"
22423                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
22424                 ;;
22425         esac
22426         ;;
22427 esac
22428
22429 : see if this is a assert.h system
22430 set assert.h i_assert
22431 eval $inhdr
22432
22433 : see if this is a bfd.h system
22434 set bfd.h i_bfd
22435 eval $inhdr
22436
22437 : see if this is an execinfo.h system
22438 set execinfo.h i_execinfo
22439 eval $inhdr
22440
22441 : see if this is a fenv.h system
22442 set fenv.h i_fenv
22443 eval $inhdr
22444
22445 : see if this is a fp.h system
22446 set fp.h i_fp
22447 eval $inhdr
22448
22449 : see if this is a fp_class.h system
22450 set fp_class.h i_fp_class
22451 eval $inhdr
22452
22453 : see if gdbm.h is available
22454 set gdbm.h t_gdbm
22455 eval $inhdr
22456 case "$t_gdbm" in
22457 $define)
22458         : see if gdbm_open exists
22459         set gdbm_open d_gdbm_open
22460         eval $inlibc
22461         case "$d_gdbm_open" in
22462         $undef)
22463                 t_gdbm="$undef"
22464                 echo "We won't be including <gdbm.h>"
22465                 ;;
22466         esac
22467         ;;
22468 esac
22469 val="$t_gdbm"
22470 set i_gdbm
22471 eval $setvar
22472
22473 : see if this is a ieeefp.h system
22474 case "$i_ieeefp" in
22475 '' ) set ieeefp.h i_ieeefp
22476      eval $inhdr
22477      ;;
22478 esac
22479
22480 : see if this is a libutil.h system
22481 set libutil.h i_libutil
22482 eval $inhdr
22483
22484 : see if mach cthreads are available
22485 if test "X$usethreads" = "X$define"; then
22486         set mach/cthreads.h i_machcthr
22487         eval $inhdr
22488 else
22489         i_machcthr="$undef"
22490 fi
22491
22492 : see if this is a mntent.h system
22493 set mntent.h i_mntent
22494 eval $inhdr
22495
22496 : see if net/errno.h is available
22497 val=''
22498 set net/errno.h val
22499 eval $inhdr
22500
22501 : Unfortunately, it causes problems on some systems.  Arrgh.
22502 case "$val" in
22503 $define)
22504         cat > try.c <<'EOM'
22505 #include <stdio.h>
22506 #include <errno.h>
22507 #include <net/errno.h>
22508 int func()
22509 {
22510         return ENOTSOCK;
22511 }
22512 EOM
22513         if $cc $ccflags -c try.c >/dev/null 2>&1; then
22514                 echo "We'll be including <net/errno.h>." >&4
22515         else
22516                 echo "We won't be including <net/errno.h>." >&4
22517                 val="$undef"
22518         fi
22519         $rm_try
22520         ;;
22521 esac
22522 set i_neterrno
22523 eval $setvar
22524
22525 : see if netinet/tcp.h is available
22526 set netinet/tcp.h i_netinettcp
22527 eval $inhdr
22528
22529 : see if this is a poll.h system
22530 set poll.h i_poll
22531 eval $inhdr
22532
22533 : see if this is a prot.h system
22534 set prot.h i_prot
22535 eval $inhdr
22536
22537 : Preprocessor symbols
22538 echo " "
22539 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
22540 $cat <<'EOSH' > Cppsym.know
22541 a29k aarch64 ABI64 aegis AES_SOURCE AIX AIX32 AIX370 AIX41 AIX42
22542 AIX43 aixpc AIX_SOURCE alliant ALL_SOURCE alpha AM29000 am29000
22543 AMD64 amd64 amiga AMIGAOS AMIX ansi ANSI_C_SOURCE apollo arch_ppc
22544 arch_pwr ardent ARM ARM32 atarist att386 att3b
22545 BeOS BIG_ENDIAN BIT_MSF BSD bsd bsd43 bsd4_2 BSD4_3 bsd4_3 bsd4_4
22546 BSDCOMPAT bsdi BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES bull
22547 byteorder byte_order
22548 c cadmus clang clipper CMU COFF COMPILER_VERSION concurrent
22549 convex cpu CRAY cray CRAYMPP ctix CX_UX CYGWIN
22550 DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO Dynix DynixPTX
22551 ELF encore EPI EXTENSIONS
22552 FAVOR_BSD FILE_OFFSET_BITS FORTIFY_SOURCE FreeBSD
22553 GCC_NEW_VARARGS gcos gcx gimpel GLIBC GLIBC_MINOR GNUC GNUC_MINOR
22554 GNU_LIBRARY GNU_SOURCE GO32 gould GOULD_PN
22555 H3050R H3050RX hbullx20 hcx host_mips hp200 hp300 HP700 hp700
22556 hp800 hp9000 hp9000s200 hp9000s300 hp9000s400 hp9000s500
22557 hp9000s700 hp9000s800 hp9k8 hppa hpux HPUX_SOURCE hp_osf
22558 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960 IA32 IA64
22559 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
22560 INLINE_INTRINSICS INT64 INTEL interdata INTRINSICS is68k itanium
22561 ksr1
22562 LANGUAGE_C LARGEFILE64_SOURCE LARGEFILE_SOURCE LARGE_FILE_API
22563 LFS64_LARGEFILE LFS_LARGEFILE LIBCATAMOUNT Linux LITTLE_ENDIAN
22564 LONG64 LONGDOUBLE LONGLONG LONG_DOUBLE LONG_LONG LP64 luna
22565 luna88k Lynx
22566 M68000 m68k m88100 m88k M88KBCS_TARGET MACH machine MachTen
22567 MATH_HAS_NO_SIDE_EFFECTS mc300 mc500 mc68000 mc68010 mc68020
22568 mc68030 mc68040 mc68060 mc68k mc68k32 mc700 mc88000 mc88100
22569 merlin mert MiNT mips MIPSEB MIPSEL MIPS_FPSET MIPS_ISA MIPS_SIM
22570 MIPS_SZINT MIPS_SZLONG MIPS_SZPTR MODERN_C motorola mpeix MSDOS
22571 MTXINU MULTIMAX MVS mvs M_AMD64 M_ARM M_ARMT M_COFF M_I186 M_I286
22572 M_I386 M_I8086 M_I86 M_I86SM M_IA64 M_IX86 M_PPC M_SYS3 M_SYS5
22573 M_SYSIII M_SYSV M_UNIX M_X86 M_XENIX
22574 n16 ncl_el ncl_mr NetBSD news1500 news1700 news1800 news1900
22575 news3700 news700 news800 news900 NeXT NLS nonstopux ns16000
22576 ns32000 ns32016 ns32332 ns32k nsc32000
22577 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
22578 PARAGON parisc pa_risc PA_RISC1_1 PA_RISC2_0 pc532 pdp11 PGC PIC
22579 plexus PORTAR posix POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
22580 POSIX_C_SOURCE POSIX_SOURCE POWER powerpc ppc PROTOTYPES PWB pyr
22581 QK_USER QNX
22582 R3000 REENTRANT RES Rhapsody RISC6000 riscix riscos RT
22583 S390 S390x SA110 SCO scs sequent sgi SGI_SOURCE SH SH3 sinix
22584 SIZE_INT SIZE_LONG SIZE_PTR SOCKETS_SOURCE SOCKET_SOURCE sony
22585 sonyrisc sony_news sparc sparclite sparcv8 sparcv9 spectrum
22586 stardent stdc STDC_EXT stratos sun sun3 sun386 Sun386i svr3 svr4
22587 SVR4_2 SVR4_SOURCE svr5 SX system SYSTYPE_BSD SYSTYPE_BSD43
22588 SYSTYPE_BSD44 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3
22589 SYSV4 SYSV5 sysV68 sysV88
22590 Tek4132 Tek4300 thumb thw_370 thw_intel thw_rs6000 titan TM3200
22591 TM5400 TM5600 tower tower32 tower32_200 tower32_600 tower32_700
22592 tower32_800 tower32_850 tss
22593 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5 ultrix UMAXV UnicomPBB
22594 UnicomPBD UNICOS UNICOSMK unix UNIX95 UNIX99 unixpc unos USE_BSD
22595 USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE
22596 USE_LARGEFILE64 USE_MISC USE_POSIX USE_POSIX199309
22597 USE_POSIX199506 USE_POSIX2 USE_REENTRANT USE_SVID USE_UNIX98
22598 USE_XOPEN USE_XOPEN_EXTENDED USGr4 USGr4_2 UTek Utek UTS UWIN
22599 uxpm uxps
22600 vax venix VMESA vms
22601 x86_64 xenix Xenix286 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2
22602 XPG2_EXTENDED XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
22603 z8000 zarch
22604 EOSH
22605 # Maybe put other stuff here too.
22606 ./tr '-' '_' <<EOSH >>Cppsym.know
22607 $osname
22608 EOSH
22609 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
22610 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
22611 $cat Cppsym.know > Cppsym.c
22612 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
22613 $rm -f Cppsym.a Cppsym.b Cppsym.c
22614 cat <<EOSH > Cppsym
22615 $startsh
22616 if $test \$# -gt 0; then
22617     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
22618     if $test -s Cppsym.got; then
22619         $rm -f Cppsym.got
22620         exit 0
22621     fi
22622     $rm -f Cppsym.got
22623     exit 1
22624 else
22625     $tr " " "$trnl" | ./Cppsym.try
22626     exit 0
22627 fi
22628 EOSH
22629 chmod +x Cppsym
22630 $eunicefix Cppsym
22631 cat <<EOSH > Cppsym.try
22632 $startsh
22633 cat <<'EOCP' > try.c
22634 #include <stdio.h>
22635 #if cpp_stuff == 1
22636 #define STRINGIFY(a)    "a"
22637 #endif
22638 #if cpp_stuff == 42
22639 #define StGiFy(a)  #a
22640 #define STRINGIFY(a)    StGiFy(a)
22641 #endif
22642 #if $cpp_stuff != 1 && $cpp_stuff != 42
22643 #   include "Bletch: How does this C preprocessor stringify macros?"
22644 #endif
22645 int main() {
22646 EOCP
22647 $awk \\
22648 EOSH
22649 cat <<'EOSH' >> Cppsym.try
22650 'length($1) > 0 {
22651     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
22652     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
22653     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
22654     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
22655 }'       >> try.c
22656 echo 'return 0;}' >> try.c
22657 EOSH
22658 cat <<EOSH >> Cppsym.try
22659 ccflags="$ccflags"
22660 case "$osname-$gccversion" in
22661 irix-) ccflags="\$ccflags -woff 1178" ;;
22662 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
22663 esac
22664 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
22665 EOSH
22666 chmod +x Cppsym.try
22667 $eunicefix Cppsym.try
22668 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
22669 : Add in any Linux cpp "predefined macros":
22670 case "$osname::$gccversion" in
22671   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
22672     tHdrH=_tmpHdr
22673     rm -f $tHdrH'.h' $tHdrH
22674     touch $tHdrH'.h'
22675     # Filter out macro arguments, such as Linux's __INT8_C(c)
22676     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
22677        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
22678        if [ -s $tHdrH'_cppsym.real' ]; then
22679           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
22680        fi
22681     fi
22682     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
22683   ;;
22684 esac
22685 : now check the C compiler for additional symbols
22686 postprocess_cc_v=''
22687 case "$osname" in
22688 aix) postprocess_cc_v="|$tr , ' '" ;;
22689 esac
22690 $cat >ccsym <<EOS
22691 $startsh
22692 $cat >tmp.c <<EOF
22693 extern int foo;
22694 EOF
22695 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
22696 do
22697         case "\$i" in
22698         -D*) echo "\$i" | $sed 's/^-D//';;
22699         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
22700         esac
22701 done
22702 $rm_try
22703 EOS
22704 postprocess_cc_v=''
22705 chmod +x ccsym
22706 $eunicefix ccsym
22707 ./ccsym > ccsym1.raw
22708 if $test -s ccsym1.raw; then
22709     $sort ccsym1.raw | $uniq >ccsym.raw
22710 else
22711     mv ccsym1.raw ccsym.raw
22712 fi
22713
22714 $awk '/\=/ { print $0; next }
22715         { print $0"=1" }' ccsym.raw >ccsym.list
22716 $comm -13 Cppsym.true ccsym.list >ccsym.own
22717 $comm -12 Cppsym.true ccsym.list >ccsym.com
22718 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
22719 also=''
22720 if $test -z ccsym.raw; then
22721         echo "Your C compiler doesn't seem to define any symbols!" >&4
22722         echo " "
22723         echo "However, your C preprocessor defines the following symbols:"
22724         $cat Cppsym.true
22725         ccsymbols=''
22726         cppsymbols=`$cat Cppsym.true`
22727         cppsymbols=`echo $cppsymbols`
22728         cppccsymbols="$cppsymbols"
22729 else
22730         if $test -s ccsym.com; then
22731                 echo "Your C compiler and pre-processor define these symbols:"
22732                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
22733                 also='also '
22734                 symbols='ones'
22735                 cppccsymbols=`$cat ccsym.com`
22736                 cppccsymbols=`echo $cppccsymbols`
22737                 $test "$silent" || sleep 1
22738         fi
22739         if $test -s ccsym.cpp; then
22740                 $test "$also" && echo " "
22741                 echo "Your C pre-processor ${also}defines the following symbols:"
22742                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
22743                 also='further '
22744                 cppsymbols=`$cat ccsym.cpp`
22745                 cppsymbols=`echo $cppsymbols`
22746                 $test "$silent" || sleep 1
22747         fi
22748         if $test -s ccsym.own; then
22749                 $test "$also" && echo " "
22750                 echo "Your C compiler ${also}defines the following cpp symbols:"
22751                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
22752                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
22753                 ccsymbols=`$cat ccsym.own`
22754                 ccsymbols=`echo $ccsymbols`
22755                 $test "$silent" || sleep 1
22756         fi
22757 fi
22758
22759 : add -D_FORTIFY_SOURCE if feasible and not already there
22760 case "$gccversion" in
22761 4.*)    case "$optimize$ccflags" in
22762         *-O*)   case "$ccflags$cppsymbols" in
22763                 *_FORTIFY_SOURCE=*) # Don't add it again.
22764                         echo "You seem to have -D_FORTIFY_SOURCE already, not adding it." >&4
22765                         ;;
22766                 *)      echo "Adding -D_FORTIFY_SOURCE=2 to ccflags..." >&4
22767                         ccflags="$ccflags -D_FORTIFY_SOURCE=2"
22768                         ;;
22769                 esac
22770                 ;;
22771         *)      echo "You have gcc 4.* but not optimizing, not adding -D_FORTIFY_SOURCE." >&4
22772                 ;;
22773         esac
22774         ;;
22775 *)      echo "You seem not to have gcc 4.*, not adding -D_FORTIFY_SOURCE." >&4
22776         ;;
22777 esac
22778
22779 : see if this is a termio system
22780 val="$undef"
22781 val2="$undef"
22782 val3="$undef"
22783 if $test `./findhdr termios.h`; then
22784     set tcsetattr i_termios
22785     eval $inlibc
22786     val3="$i_termios"
22787 fi
22788 echo " "
22789 case "$val3" in
22790     "$define") echo "You have POSIX termios.h... good!" >&4;;
22791     *)  if ./Cppsym pyr; then
22792             case "`$run /bin/universe`" in
22793                 ucb) if $test `./findhdr sgtty.h`; then
22794                         val2="$define"
22795                         echo "<sgtty.h> found." >&4
22796                     else
22797                         echo "System is pyramid with BSD universe."
22798                         ./warn "<sgtty.h> not found--you could have problems."
22799                     fi;;
22800                 *)  if $test `./findhdr termio.h`; then
22801                         val="$define"
22802                         echo "<termio.h> found." >&4
22803                     else
22804                         echo "System is pyramid with USG universe."
22805                         ./warn "<termio.h> not found--you could have problems."
22806                     fi;;
22807             esac
22808         elif ./usg; then
22809             if $test `./findhdr termio.h`; then
22810                 echo "<termio.h> found." >&4
22811                 val="$define"
22812             elif $test `./findhdr sgtty.h`; then
22813                 echo "<sgtty.h> found." >&4
22814                 val2="$define"
22815             else
22816                 ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22817             fi
22818         else
22819             if $test `./findhdr sgtty.h`; then
22820                 echo "<sgtty.h> found." >&4
22821                 val2="$define"
22822             elif $test `./findhdr termio.h`; then
22823                 echo "<termio.h> found." >&4
22824                 val="$define"
22825             else
22826                 ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22827             fi
22828         fi;;
22829 esac
22830 set i_termio; eval $setvar
22831 val=$val2; set i_sgtty; eval $setvar
22832 val=$val3; set i_termios; eval $setvar
22833
22834 : see if stdbool is available
22835 : we want a real compile instead of Inhdr because some Solaris systems
22836 : have stdbool.h, but it can only be used if the compiler indicates it
22837 : is sufficiently c99-compliant.
22838 echo " "
22839 $cat >try.c <<EOCP
22840 #include <stdio.h>
22841 #include <stdbool.h>
22842 int func(bool x)
22843 {
22844     return x ? 1 : 0;
22845 }
22846 int main(int argc, char **argv)
22847 {
22848     return func(0);
22849 }
22850 EOCP
22851 set try
22852 if eval $compile; then
22853         echo "<stdbool.h> found." >&4
22854         val="$define"
22855 else
22856         echo "<stdbool.h> NOT found." >&4
22857         val="$undef"
22858 fi
22859 $rm_try
22860 set i_stdbool
22861 eval $setvar
22862
22863 : see if stddef is available
22864 set stddef.h i_stddef
22865 eval $inhdr
22866
22867 : see if stdint is available
22868 set stdint.h i_stdint
22869 eval $inhdr
22870
22871 : see if sys/access.h is available
22872 set sys/access.h i_sysaccess
22873 eval $inhdr
22874
22875 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22876 set sys/filio.h i_sysfilio
22877 eval $inhdr
22878 echo " "
22879 if $test `./findhdr sys/ioctl.h`; then
22880         val="$define"
22881         echo '<sys/ioctl.h> found.' >&4
22882 else
22883         val="$undef"
22884         if $test $i_sysfilio = "$define"; then
22885             echo '<sys/ioctl.h> NOT found.' >&4
22886         else
22887                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22888                 $test $i_termio = "$define" && xxx="termio.h"
22889                 $test $i_termios = "$define" && xxx="termios.h"
22890 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22891         fi
22892 fi
22893 set i_sysioctl
22894 eval $setvar
22895
22896 : see if socket ioctl defs are in sys/sockio.h
22897 echo " "
22898 xxx=`./findhdr sys/sockio.h`
22899 if $test "$xxx"; then
22900         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22901                 val="$define"
22902                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22903         else
22904                 val="$undef"
22905                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22906         fi
22907 else
22908         val="$undef"
22909         $cat <<EOM
22910 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22911 EOM
22912 fi
22913 set i_syssockio
22914 eval $setvar
22915
22916 : see if this is a syslog.h system
22917 set syslog.h i_syslog
22918 eval $inhdr
22919
22920 : see if this is a sys/mode.h system
22921 set sys/mode.h i_sysmode
22922 eval $inhdr
22923
22924 : see if there is a sys/poll.h file
22925 set sys/poll.h i_syspoll
22926 eval $inhdr
22927
22928 : see if sys/resource.h has to be included
22929 set sys/resource.h i_sysresrc
22930 eval $inhdr
22931
22932 : see if sys/security.h is available
22933 set sys/security.h i_syssecrt
22934 eval $inhdr
22935
22936 : see if this is a sys/statvfs.h system
22937 set sys/statvfs.h i_sysstatvfs
22938 eval $inhdr
22939
22940 : see if this is a sys/un.h system
22941 set sys/un.h i_sysun
22942 eval $inhdr
22943
22944 : see if this is a sys/utsname.h system
22945 set sys/utsname.h i_sysutsname
22946 eval $inhdr
22947
22948 : see if this is a syswait system
22949 set sys/wait.h i_syswait
22950 eval $inhdr
22951
22952 : see if this is a ustat.h system
22953 set ustat.h i_ustat
22954 eval $inhdr
22955
22956 : see if this is an utime system
22957 set utime.h i_utime
22958 eval $inhdr
22959
22960 : see if this is a vfork system
22961 case "$d_vfork" in
22962 "$define")
22963         set vfork.h i_vfork
22964         eval $inhdr
22965         ;;
22966 *)
22967         i_vfork="$undef"
22968         ;;
22969 esac
22970
22971 : Check extensions
22972 echo " "
22973 echo "Looking for extensions..." >&4
22974 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22975 : contain old or inaccurate or duplicate values.
22976 nonxs_extensions=''
22977 xs_extensions=''
22978 : We do not use find because it might not be available.
22979 : We do not just use MANIFEST because the user may have dropped
22980 : some additional extensions into the source tree and expect them
22981 : to be built.
22982
22983 : Function to recursively find available extensions, ignoring DynaLoader
22984 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22985 : In 5.10.1 and later, extensions are stored in directories
22986 : like File-Glob instead of the older File/Glob/.
22987 find_extensions='
22988     for xxx in *; do
22989         case "$xxx" in
22990             DynaLoader|dynaload) ;;
22991             *)
22992             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22993             case "$this_ext" in
22994                 Scalar/List/Utils) this_ext="List/Util" ;;
22995                 PathTools)         this_ext="Cwd"       ;;
22996             esac;
22997             echo " $xs_extensions $nonxs_extensions" > $tdir/$$.tmp;
22998             if $contains " $this_ext " $tdir/$$.tmp; then
22999                 echo >&4;
23000                 echo "Duplicate directories detected for extension $xxx" >&4;
23001                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
23002                 case "$knowitall" in
23003                 "") dflt=y;;
23004                 *) dflt=n;;
23005                 esac;
23006                 . ../UU/myread;
23007                 case "$ans" in
23008                 n*|N*) ;;
23009                 *) echo >&4;
23010                     echo "Ok.  Stopping Configure." >&4;
23011                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
23012                     exit 1;;
23013                 esac;
23014                 echo "Ok.  You will need to correct config.sh before running make." >&4;
23015             fi;
23016             $ls -1 $xxx > $tdir/$$.tmp;
23017             if   $contains "\.xs$" $tdir/$$.tmp > /dev/null 2>&1; then
23018                 xs_extensions="$xs_extensions $this_ext";
23019             elif $contains "\.c$"  $tdir/$$.tmp > /dev/null 2>&1; then
23020                 xs_extensions="$xs_extensions $this_ext";
23021             elif $test -d $xxx; then
23022                 nonxs_extensions="$nonxs_extensions $this_ext";
23023             fi;
23024             $rm -f $tdir/$$.tmp;
23025             ;;
23026         esac;
23027     done'
23028 tdir=`pwd`
23029 cd "$rsrc/cpan"
23030 set X
23031 shift
23032 eval $find_extensions
23033 cd "$rsrc/dist"
23034 set X
23035 shift
23036 eval $find_extensions
23037 cd "$rsrc/ext"
23038 set X
23039 shift
23040 eval $find_extensions
23041 set X $xs_extensions
23042 shift
23043 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23044 set X $nonxs_extensions
23045 shift
23046 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
23047 cd "$tdir"
23048 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
23049
23050 : Now see which are supported on this system.
23051 avail_ext=''
23052 for xxx in $xs_extensions ; do
23053         case "$xxx" in
23054         DB_File|db_file)
23055                 case "$i_db" in
23056                 $define) avail_ext="$avail_ext $xxx" ;;
23057                 esac
23058                 ;;
23059         GDBM_File|gdbm_fil)
23060                 case "$i_gdbm" in
23061                 $define) avail_ext="$avail_ext $xxx" ;;
23062                 esac
23063                 ;;
23064         I18N/Langinfo|i18n_lan)
23065                 case "$i_langinfo$d_nl_langinfo" in
23066                 $define$define) avail_ext="$avail_ext $xxx" ;;
23067                 esac
23068                 ;;
23069         IPC/SysV|ipc/sysv)
23070                 : XXX Do we need a useipcsysv variable here
23071                 case "${d_msg}${d_sem}${d_shm}" in
23072                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
23073                 esac
23074                 ;;
23075         NDBM_File|ndbm_fil)
23076                 case "$d_ndbm" in
23077                 $define)
23078                     case "$osname-$use64bitint" in
23079                     hpux-define)
23080                         case "$libs" in
23081                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
23082                         esac
23083                         ;;
23084                     *) avail_ext="$avail_ext $xxx" ;;
23085                     esac
23086                     ;;
23087                 esac
23088                 ;;
23089         ODBM_File|odbm_fil)
23090                 case "${i_dbm}${i_rpcsvcdbm}" in
23091                 *"${define}"*)
23092                     case "$d_cplusplus" in
23093                     define) ;; # delete as a function name will not work
23094                     *)  case "$osname-$use64bitint" in
23095                         hpux-define)
23096                             case "$libs" in
23097                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
23098                             esac
23099                             ;;
23100                         *) avail_ext="$avail_ext $xxx" ;;
23101                         esac
23102                         ;;
23103                     esac
23104                     ;;
23105                 esac
23106                 ;;
23107         Opcode|opcode)
23108                 case "$useopcode" in
23109                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23110                 esac
23111                 ;;
23112         POSIX|posix)
23113                 case "$useposix" in
23114                 true|define|y) avail_ext="$avail_ext $xxx" ;;
23115                 esac
23116                 ;;
23117         Socket|socket)
23118                 case "$d_socket" in
23119                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23120                 esac
23121                 ;;
23122         Sys/Syslog|sys/syslog)
23123                 : XXX syslog requires socket
23124                 case "$d_socket" in
23125                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
23126                 esac
23127                 ;;
23128         Thread|thread)
23129                 case "$usethreads" in
23130                 true|$define|y)
23131                         case "$use5005threads" in
23132                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
23133                         esac
23134                 esac
23135                 ;;
23136         threads|threads/shared)
23137                 # threads and threads::shared are special cases.
23138                 # To stop people from asking "Perl 5.8.0 was supposed
23139                 # to have this new fancy threads implementation but my
23140                 # perl doesn't have it" and from people trying to
23141                 # (re)install the threads module using CPAN.pm and
23142                 # CPAN.pm then offering to reinstall Perl 5.8.0,
23143                 # the threads.pm and threads/shared.pm will always be
23144                 # there, croaking informatively ("you need to rebuild
23145                 # all of Perl with threads, sorry") when threads haven't
23146                 # been compiled in.
23147                 # --jhi
23148                 avail_ext="$avail_ext $xxx"
23149                 ;;
23150         VMS*)
23151                 ;;
23152         Win32*)
23153                 case "$osname" in
23154                 cygwin) avail_ext="$avail_ext $xxx" ;;
23155                 esac
23156                 ;;
23157         XS/APItest|xs/apitest)
23158                 # This is just for testing.  Skip it unless we have dynamic loading.
23159
23160                 case "$usedl" in
23161                 $define) avail_ext="$avail_ext $xxx" ;;
23162                 esac
23163                 ;;
23164         XS/Typemap|xs/typemap)
23165                 # This is just for testing.  Skip it unless we have dynamic loading.
23166                 case "$usedl" in
23167                 $define) avail_ext="$avail_ext $xxx" ;;
23168                 esac
23169                 ;;
23170         *)      avail_ext="$avail_ext $xxx"
23171                 ;;
23172         esac
23173 done
23174
23175 set X $avail_ext
23176 shift
23177 avail_ext="$*"
23178
23179 case "$onlyextensions" in
23180 '') ;;
23181 *)  keepextensions=''
23182     echo "You have requested that only certain extensions be included..." >&4
23183     for i in $onlyextensions; do
23184         case " $avail_ext " in
23185         *" $i "*)
23186             echo "Keeping extension $i."
23187             keepextensions="$keepextensions $i"
23188             ;;
23189         *) echo "Ignoring extension $i." ;;
23190         esac
23191     done
23192     avail_ext="$keepextensions"
23193     ;;
23194 esac
23195
23196 case "$noextensions" in
23197 '') ;;
23198 *)  keepextensions=''
23199     echo "You have requested that certain extensions be ignored..." >&4
23200     for i in $avail_ext; do
23201         case " $noextensions " in
23202         *" $i "*) echo "Ignoring extension $i." ;;
23203         *) echo "Keeping extension $i.";
23204            keepextensions="$keepextensions $i"
23205            ;;
23206         esac
23207     done
23208     avail_ext="$keepextensions"
23209     ;;
23210 esac
23211
23212 : Now see which nonxs extensions are supported on this system.
23213 : For now assume all are.
23214 nonxs_ext=''
23215 for xxx in $nonxs_extensions ; do
23216         case "$xxx" in
23217         VMS*)
23218                 ;;
23219         *)      nonxs_ext="$nonxs_ext $xxx"
23220                 ;;
23221         esac
23222 done
23223
23224 set X $nonxs_ext
23225 shift
23226 nonxs_ext="$*"
23227
23228 case $usedl in
23229 $define)
23230         $cat <<EOM
23231 A number of extensions are supplied with $package.  You may choose to
23232 compile these extensions for dynamic loading (the default), compile
23233 them into the $package executable (static loading), or not include
23234 them at all.  Answer "none" to include no extensions.
23235 Note that DynaLoader is always built and need not be mentioned here.
23236
23237 EOM
23238         case "$dynamic_ext" in
23239         '')
23240                 : Exclude those listed in static_ext
23241                 dflt=''
23242                 for xxx in $avail_ext; do
23243                         case " $static_ext " in
23244                         *" $xxx "*) ;;
23245                         *) dflt="$dflt $xxx" ;;
23246                         esac
23247                 done
23248                 set X $dflt
23249                 shift
23250                 dflt="$*"
23251                 ;;
23252         *)      dflt="$dynamic_ext"
23253                 # Perhaps we are reusing an old out-of-date config.sh.
23254                 case "$hint" in
23255                 previous)
23256                         if test X"$dynamic_ext" != X"$avail_ext"; then
23257                                 $cat <<EOM
23258 NOTICE:  Your previous config.sh list may be incorrect.
23259 The extensions now available to you are
23260         ${avail_ext}
23261 but the default list from your previous config.sh is
23262         ${dynamic_ext}
23263
23264 EOM
23265                         fi
23266                         ;;
23267                 esac
23268                 ;;
23269         esac
23270         case "$dflt" in
23271         '')     dflt=none;;
23272         esac
23273         rp="What extensions do you wish to load dynamically?"
23274         . ./myread
23275         case "$ans" in
23276         none) dynamic_ext=' ' ;;
23277         *) dynamic_ext="$ans" ;;
23278         esac
23279
23280         case "$static_ext" in
23281         '')
23282                 : Exclude those already listed in dynamic linking
23283                 dflt=''
23284                 for xxx in $avail_ext; do
23285                         case " $dynamic_ext " in
23286                         *" $xxx "*) ;;
23287                         *) dflt="$dflt $xxx" ;;
23288                         esac
23289                 done
23290                 set X $dflt
23291                 shift
23292                 dflt="$*"
23293                 ;;
23294         *)  dflt="$static_ext"
23295                 ;;
23296         esac
23297
23298         case "$dflt" in
23299         '')     dflt=none;;
23300         esac
23301         rp="What extensions do you wish to load statically?"
23302         . ./myread
23303         case "$ans" in
23304         none) static_ext=' ' ;;
23305         *) static_ext="$ans" ;;
23306         esac
23307         ;;
23308 *)
23309         $cat <<EOM
23310 A number of extensions are supplied with $package.  Answer "none"
23311 to include no extensions.
23312 Note that DynaLoader is always built and need not be mentioned here.
23313
23314 EOM
23315         case "$static_ext" in
23316         '') dflt="$avail_ext" ;;
23317         *)      dflt="$static_ext"
23318                 # Perhaps we are reusing an old out-of-date config.sh.
23319                 case "$hint" in
23320                 previous)
23321                         if test X"$static_ext" != X"$avail_ext"; then
23322                                 $cat <<EOM
23323 NOTICE:  Your previous config.sh list may be incorrect.
23324 The extensions now available to you are
23325         ${avail_ext}
23326 but the default list from your previous config.sh is
23327         ${static_ext}
23328
23329 EOM
23330                         fi
23331                         ;;
23332                 esac
23333                 ;;
23334         esac
23335         : Exclude those that are not xs extensions
23336         case "$dflt" in
23337         '')     dflt=none;;
23338         esac
23339         rp="What extensions do you wish to include?"
23340         . ./myread
23341         case "$ans" in
23342         none) static_ext=' ' ;;
23343         *) static_ext="$ans" ;;
23344         esac
23345         ;;
23346 esac
23347 #
23348 # Encode is a special case.  If we are building Encode as a static
23349 # extension, we need to explicitly list its subextensions as well.
23350 # For other nested extensions, this is handled automatically by
23351 # the appropriate Makefile.PL.
23352 case " $static_ext " in
23353         *" Encode "*) # Add the subextensions of Encode
23354         cd "$rsrc/cpan"
23355         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
23356                 static_ext="$static_ext Encode/$xxx"
23357                 known_extensions="$known_extensions Encode/$xxx"
23358         done
23359         cd "$tdir"
23360         ;;
23361 esac
23362
23363 set X $dynamic_ext $static_ext $nonxs_ext
23364 shift
23365 extensions="$*"
23366
23367 # Sanity check:  We require an extension suitable for use with
23368 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
23369 # should show up as failures in the test suite, but it's helpful to
23370 # catch them now.) The 'extensions' list is normally sorted
23371 # alphabetically, so we need to accept either
23372 #    DB_File ... Fcntl ... IO  ....
23373 # or something like
23374 #    Fcntl ... NDBM_File ... IO  ....
23375 case " $extensions"  in
23376 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
23377 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
23378 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
23379 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
23380    echo "WARNING: The Perl you are building will be quite crippled." >& 4
23381    ;;
23382 esac
23383
23384 : Remove libraries needed only for extensions
23385 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
23386 : The exception is SunOS 4.x, which needs them.
23387 case "${osname}X${osvers}" in
23388 sunos*X4*)
23389     perllibs="$libs"
23390     ;;
23391 *) case "$usedl" in
23392     $define|true|[yY]*)
23393             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
23394             shift
23395             perllibs="$*"
23396             ;;
23397     *)  perllibs="$libs"
23398             ;;
23399     esac
23400     ;;
23401 esac
23402
23403 : Remove build directory name from cppstdin so it can be used from
23404 : either the present location or the final installed location.
23405 echo " "
23406 : Get out of the UU directory to get correct path name.
23407 cd ..
23408 case "$cppstdin" in
23409 `pwd`/cppstdin)
23410         echo "Stripping down cppstdin path name"
23411         cppstdin=cppstdin
23412         ;;
23413 esac
23414 cd UU
23415
23416 : end of configuration questions
23417 echo " "
23418 echo "End of configuration questions."
23419 echo " "
23420
23421 : back to where it started
23422 if test -d ../UU; then
23423         cd ..
23424 fi
23425
23426 : configuration may be unconditionally patched via a 'config.arch' file
23427 if $test -f config.arch; then
23428         echo "I see a config.arch file, loading it." >&4
23429         . ./config.arch
23430 fi
23431
23432 : configuration may be patched via a 'config.over' file
23433 if $test -f config.over; then
23434         echo " "
23435         dflt=y
23436         rp='I see a config.over file.  Do you wish to load it?'
23437         . UU/myread
23438         case "$ans" in
23439         n*) echo "OK, I'll ignore it.";;
23440         *)      . ./config.over
23441                 echo "Configuration override changes have been loaded."
23442                 ;;
23443         esac
23444 fi
23445
23446 : in case they want portability, strip down executable paths
23447 case "$d_portable" in
23448 "$define")
23449         echo " "
23450         echo "Stripping down executable paths..." >&4
23451         for file in $loclist $trylist; do
23452                 eval temp=\$$file
23453                 eval $file=`basename $temp`
23454         done
23455         ;;
23456 esac
23457
23458 : create config.sh file
23459 echo " "
23460 echo "Creating config.sh..." >&4
23461 $spitshell <<EOT >config.sh
23462 $startsh
23463 #
23464 # This file was produced by running the Configure script. It holds all the
23465 # definitions figured out by Configure. Should you modify one of these values,
23466 # do not forget to propagate your changes by running "Configure -der". You may
23467 # instead choose to run each of the .SH files by yourself, or "Configure -S".
23468 #
23469
23470 # Package name      : $package
23471 # Source directory  : $src
23472 # Configuration time: $cf_time
23473 # Configured by     : $cf_by
23474 # Target system     : $myuname
23475
23476 EOT
23477 : Add in command line options if available
23478 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
23479
23480 $spitshell <<EOT >>config.sh
23481
23482 Author='$Author'
23483 Date='$Date'
23484 Header='$Header'
23485 Id='$Id'
23486 Locker='$Locker'
23487 Log='$Log'
23488 RCSfile='$RCSfile'
23489 Revision='$Revision'
23490 Source='$Source'
23491 State='$State'
23492 _a='$_a'
23493 _exe='$_exe'
23494 _o='$_o'
23495 afs='$afs'
23496 afsroot='$afsroot'
23497 alignbytes='$alignbytes'
23498 ansi2knr='$ansi2knr'
23499 aphostname='$aphostname'
23500 api_revision='$api_revision'
23501 api_subversion='$api_subversion'
23502 api_version='$api_version'
23503 api_versionstring='$api_versionstring'
23504 ar='$ar'
23505 archlib='$archlib'
23506 archlibexp='$archlibexp'
23507 archname64='$archname64'
23508 archname='$archname'
23509 archobjs='$archobjs'
23510 asctime_r_proto='$asctime_r_proto'
23511 awk='$awk'
23512 baserev='$baserev'
23513 bash='$bash'
23514 bin='$bin'
23515 bin_ELF='$bin_ELF'
23516 binexp='$binexp'
23517 bison='$bison'
23518 byacc='$byacc'
23519 byteorder='$byteorder'
23520 c='$c'
23521 castflags='$castflags'
23522 cat='$cat'
23523 cc='$cc'
23524 cccdlflags='$cccdlflags'
23525 ccdlflags='$ccdlflags'
23526 ccflags='$ccflags'
23527 ccflags_uselargefiles='$ccflags_uselargefiles'
23528 ccname='$ccname'
23529 ccsymbols='$ccsymbols'
23530 ccversion='$ccversion'
23531 cf_by='$cf_by'
23532 cf_email='$cf_email'
23533 cf_time='$cf_time'
23534 charbits='$charbits'
23535 charsize='$charsize'
23536 chgrp='$chgrp'
23537 chmod='$chmod'
23538 chown='$chown'
23539 clocktype='$clocktype'
23540 comm='$comm'
23541 compress='$compress'
23542 contains='$contains'
23543 cp='$cp'
23544 cpio='$cpio'
23545 cpp='$cpp'
23546 cpp_stuff='$cpp_stuff'
23547 cppccsymbols='$cppccsymbols'
23548 cppflags='$cppflags'
23549 cpplast='$cpplast'
23550 cppminus='$cppminus'
23551 cpprun='$cpprun'
23552 cppstdin='$cppstdin'
23553 cppsymbols='$cppsymbols'
23554 crypt_r_proto='$crypt_r_proto'
23555 cryptlib='$cryptlib'
23556 csh='$csh'
23557 ctermid_r_proto='$ctermid_r_proto'
23558 ctime_r_proto='$ctime_r_proto'
23559 d_Gconvert='$d_Gconvert'
23560 d_PRIEUldbl='$d_PRIEUldbl'
23561 d_PRIFUldbl='$d_PRIFUldbl'
23562 d_PRIGUldbl='$d_PRIGUldbl'
23563 d_PRIXU64='$d_PRIXU64'
23564 d_PRId64='$d_PRId64'
23565 d_PRIeldbl='$d_PRIeldbl'
23566 d_PRIfldbl='$d_PRIfldbl'
23567 d_PRIgldbl='$d_PRIgldbl'
23568 d_PRIi64='$d_PRIi64'
23569 d_PRIo64='$d_PRIo64'
23570 d_PRIu64='$d_PRIu64'
23571 d_PRIx64='$d_PRIx64'
23572 d_SCNfldbl='$d_SCNfldbl'
23573 d__fwalk='$d__fwalk'
23574 d_access='$d_access'
23575 d_accessx='$d_accessx'
23576 d_acosh='$d_acosh'
23577 d_aintl='$d_aintl'
23578 d_alarm='$d_alarm'
23579 d_archlib='$d_archlib'
23580 d_asctime64='$d_asctime64'
23581 d_asctime_r='$d_asctime_r'
23582 d_atolf='$d_atolf'
23583 d_atoll='$d_atoll'
23584 d_attribute_deprecated='$d_attribute_deprecated'
23585 d_attribute_format='$d_attribute_format'
23586 d_attribute_malloc='$d_attribute_malloc'
23587 d_attribute_nonnull='$d_attribute_nonnull'
23588 d_attribute_noreturn='$d_attribute_noreturn'
23589 d_attribute_pure='$d_attribute_pure'
23590 d_attribute_unused='$d_attribute_unused'
23591 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
23592 d_backtrace='$d_backtrace'
23593 d_bcmp='$d_bcmp'
23594 d_bcopy='$d_bcopy'
23595 d_bsd='$d_bsd'
23596 d_bsdgetpgrp='$d_bsdgetpgrp'
23597 d_bsdsetpgrp='$d_bsdsetpgrp'
23598 d_builtin_choose_expr='$d_builtin_choose_expr'
23599 d_builtin_expect='$d_builtin_expect'
23600 d_bzero='$d_bzero'
23601 d_c99_variadic_macros='$d_c99_variadic_macros'
23602 d_casti32='$d_casti32'
23603 d_castneg='$d_castneg'
23604 d_charvspr='$d_charvspr'
23605 d_chown='$d_chown'
23606 d_chroot='$d_chroot'
23607 d_chsize='$d_chsize'
23608 d_class='$d_class'
23609 d_clearenv='$d_clearenv'
23610 d_closedir='$d_closedir'
23611 d_cmsghdr_s='$d_cmsghdr_s'
23612 d_const='$d_const'
23613 d_copysignl='$d_copysignl'
23614 d_cplusplus='$d_cplusplus'
23615 d_crypt='$d_crypt'
23616 d_crypt_r='$d_crypt_r'
23617 d_csh='$d_csh'
23618 d_ctermid='$d_ctermid'
23619 d_ctermid_r='$d_ctermid_r'
23620 d_ctime64='$d_ctime64'
23621 d_ctime_r='$d_ctime_r'
23622 d_cuserid='$d_cuserid'
23623 d_dbl_dig='$d_dbl_dig'
23624 d_dbminitproto='$d_dbminitproto'
23625 d_difftime64='$d_difftime64'
23626 d_difftime='$d_difftime'
23627 d_dir_dd_fd='$d_dir_dd_fd'
23628 d_dirfd='$d_dirfd'
23629 d_dirnamlen='$d_dirnamlen'
23630 d_dladdr='$d_dladdr'
23631 d_dlerror='$d_dlerror'
23632 d_dlopen='$d_dlopen'
23633 d_dlsymun='$d_dlsymun'
23634 d_dosuid='$d_dosuid'
23635 d_drand48_r='$d_drand48_r'
23636 d_drand48proto='$d_drand48proto'
23637 d_dup2='$d_dup2'
23638 d_eaccess='$d_eaccess'
23639 d_endgrent='$d_endgrent'
23640 d_endgrent_r='$d_endgrent_r'
23641 d_endhent='$d_endhent'
23642 d_endhostent_r='$d_endhostent_r'
23643 d_endnent='$d_endnent'
23644 d_endnetent_r='$d_endnetent_r'
23645 d_endpent='$d_endpent'
23646 d_endprotoent_r='$d_endprotoent_r'
23647 d_endpwent='$d_endpwent'
23648 d_endpwent_r='$d_endpwent_r'
23649 d_endsent='$d_endsent'
23650 d_endservent_r='$d_endservent_r'
23651 d_eofnblk='$d_eofnblk'
23652 d_eunice='$d_eunice'
23653 d_faststdio='$d_faststdio'
23654 d_fchdir='$d_fchdir'
23655 d_fchmod='$d_fchmod'
23656 d_fchown='$d_fchown'
23657 d_fcntl='$d_fcntl'
23658 d_fcntl_can_lock='$d_fcntl_can_lock'
23659 d_fd_macros='$d_fd_macros'
23660 d_fd_set='$d_fd_set'
23661 d_fds_bits='$d_fds_bits'
23662 d_fegetround='$d_fegetround'
23663 d_fgetpos='$d_fgetpos'
23664 d_finite='$d_finite'
23665 d_finitel='$d_finitel'
23666 d_flexfnam='$d_flexfnam'
23667 d_flock='$d_flock'
23668 d_flockproto='$d_flockproto'
23669 d_fork='$d_fork'
23670 d_fp_class='$d_fp_class'
23671 d_fp_classify='$d_fp_classify'
23672 d_fp_classl='$d_fp_classl'
23673 d_fpathconf='$d_fpathconf'
23674 d_fpclass='$d_fpclass'
23675 d_fpclassify='$d_fpclassify'
23676 d_fpclassl='$d_fpclassl'
23677 d_fpgetround='$d_fpgetround'
23678 d_fpos64_t='$d_fpos64_t'
23679 d_frexpl='$d_frexpl'
23680 d_fs_data_s='$d_fs_data_s'
23681 d_fseeko='$d_fseeko'
23682 d_fsetpos='$d_fsetpos'
23683 d_fstatfs='$d_fstatfs'
23684 d_fstatvfs='$d_fstatvfs'
23685 d_fsync='$d_fsync'
23686 d_ftello='$d_ftello'
23687 d_ftime='$d_ftime'
23688 d_futimes='$d_futimes'
23689 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
23690 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
23691 d_getaddrinfo='$d_getaddrinfo'
23692 d_getcwd='$d_getcwd'
23693 d_getespwnam='$d_getespwnam'
23694 d_getfsstat='$d_getfsstat'
23695 d_getgrent='$d_getgrent'
23696 d_getgrent_r='$d_getgrent_r'
23697 d_getgrgid_r='$d_getgrgid_r'
23698 d_getgrnam_r='$d_getgrnam_r'
23699 d_getgrps='$d_getgrps'
23700 d_gethbyaddr='$d_gethbyaddr'
23701 d_gethbyname='$d_gethbyname'
23702 d_gethent='$d_gethent'
23703 d_gethname='$d_gethname'
23704 d_gethostbyaddr_r='$d_gethostbyaddr_r'
23705 d_gethostbyname_r='$d_gethostbyname_r'
23706 d_gethostent_r='$d_gethostent_r'
23707 d_gethostprotos='$d_gethostprotos'
23708 d_getitimer='$d_getitimer'
23709 d_getlogin='$d_getlogin'
23710 d_getlogin_r='$d_getlogin_r'
23711 d_getmnt='$d_getmnt'
23712 d_getmntent='$d_getmntent'
23713 d_getnameinfo='$d_getnameinfo'
23714 d_getnbyaddr='$d_getnbyaddr'
23715 d_getnbyname='$d_getnbyname'
23716 d_getnent='$d_getnent'
23717 d_getnetbyaddr_r='$d_getnetbyaddr_r'
23718 d_getnetbyname_r='$d_getnetbyname_r'
23719 d_getnetent_r='$d_getnetent_r'
23720 d_getnetprotos='$d_getnetprotos'
23721 d_getpagsz='$d_getpagsz'
23722 d_getpbyname='$d_getpbyname'
23723 d_getpbynumber='$d_getpbynumber'
23724 d_getpent='$d_getpent'
23725 d_getpgid='$d_getpgid'
23726 d_getpgrp2='$d_getpgrp2'
23727 d_getpgrp='$d_getpgrp'
23728 d_getppid='$d_getppid'
23729 d_getprior='$d_getprior'
23730 d_getprotobyname_r='$d_getprotobyname_r'
23731 d_getprotobynumber_r='$d_getprotobynumber_r'
23732 d_getprotoent_r='$d_getprotoent_r'
23733 d_getprotoprotos='$d_getprotoprotos'
23734 d_getprpwnam='$d_getprpwnam'
23735 d_getpwent='$d_getpwent'
23736 d_getpwent_r='$d_getpwent_r'
23737 d_getpwnam_r='$d_getpwnam_r'
23738 d_getpwuid_r='$d_getpwuid_r'
23739 d_getsbyname='$d_getsbyname'
23740 d_getsbyport='$d_getsbyport'
23741 d_getsent='$d_getsent'
23742 d_getservbyname_r='$d_getservbyname_r'
23743 d_getservbyport_r='$d_getservbyport_r'
23744 d_getservent_r='$d_getservent_r'
23745 d_getservprotos='$d_getservprotos'
23746 d_getspnam='$d_getspnam'
23747 d_getspnam_r='$d_getspnam_r'
23748 d_gettimeod='$d_gettimeod'
23749 d_gmtime64='$d_gmtime64'
23750 d_gmtime_r='$d_gmtime_r'
23751 d_gnulibc='$d_gnulibc'
23752 d_grpasswd='$d_grpasswd'
23753 d_hasmntopt='$d_hasmntopt'
23754 d_htonl='$d_htonl'
23755 d_ilogbl='$d_ilogbl'
23756 d_inc_version_list='$d_inc_version_list'
23757 d_index='$d_index'
23758 d_inetaton='$d_inetaton'
23759 d_inetntop='$d_inetntop'
23760 d_inetpton='$d_inetpton'
23761 d_int64_t='$d_int64_t'
23762 d_ip_mreq='$d_ip_mreq'
23763 d_ip_mreq_source='$d_ip_mreq_source'
23764 d_ipv6_mreq='$d_ipv6_mreq'
23765 d_ipv6_mreq_source='$d_ipv6_mreq_source'
23766 d_isascii='$d_isascii'
23767 d_isblank='$d_isblank'
23768 d_isfinite='$d_isfinite'
23769 d_isfinitel='$d_isfinitel'
23770 d_isinf='$d_isinf'
23771 d_isinfl='$d_isinfl'
23772 d_isnan='$d_isnan'
23773 d_isnanl='$d_isnanl'
23774 d_j0='$d_j0'
23775 d_j0l='$d_j0l'
23776 d_killpg='$d_killpg'
23777 d_lchown='$d_lchown'
23778 d_ldbl_dig='$d_ldbl_dig'
23779 d_ldexpl='$d_ldexpl'
23780 d_libm_lib_version='$d_libm_lib_version'
23781 d_libname_unique='$d_libname_unique'
23782 d_link='$d_link'
23783 d_localtime64='$d_localtime64'
23784 d_localtime_r='$d_localtime_r'
23785 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23786 d_locconv='$d_locconv'
23787 d_lc_monetary_2008='$d_lc_monetary_2008'
23788 d_lockf='$d_lockf'
23789 d_longdbl='$d_longdbl'
23790 d_longlong='$d_longlong'
23791 d_lseekproto='$d_lseekproto'
23792 d_lstat='$d_lstat'
23793 d_madvise='$d_madvise'
23794 d_malloc_good_size='$d_malloc_good_size'
23795 d_malloc_size='$d_malloc_size'
23796 d_mblen='$d_mblen'
23797 d_mbstowcs='$d_mbstowcs'
23798 d_mbtowc='$d_mbtowc'
23799 d_memchr='$d_memchr'
23800 d_memcmp='$d_memcmp'
23801 d_memcpy='$d_memcpy'
23802 d_memmove='$d_memmove'
23803 d_memset='$d_memset'
23804 d_mkdir='$d_mkdir'
23805 d_mkdtemp='$d_mkdtemp'
23806 d_mkfifo='$d_mkfifo'
23807 d_mkstemp='$d_mkstemp'
23808 d_mkstemps='$d_mkstemps'
23809 d_mktime64='$d_mktime64'
23810 d_mktime='$d_mktime'
23811 d_mmap='$d_mmap'
23812 d_modfl='$d_modfl'
23813 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23814 d_modflproto='$d_modflproto'
23815 d_mprotect='$d_mprotect'
23816 d_msg='$d_msg'
23817 d_msg_ctrunc='$d_msg_ctrunc'
23818 d_msg_dontroute='$d_msg_dontroute'
23819 d_msg_oob='$d_msg_oob'
23820 d_msg_peek='$d_msg_peek'
23821 d_msg_proxy='$d_msg_proxy'
23822 d_msgctl='$d_msgctl'
23823 d_msgget='$d_msgget'
23824 d_msghdr_s='$d_msghdr_s'
23825 d_msgrcv='$d_msgrcv'
23826 d_msgsnd='$d_msgsnd'
23827 d_msync='$d_msync'
23828 d_munmap='$d_munmap'
23829 d_mymalloc='$d_mymalloc'
23830 d_ndbm='$d_ndbm'
23831 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23832 d_nice='$d_nice'
23833 d_nl_langinfo='$d_nl_langinfo'
23834 d_nv_preserves_uv='$d_nv_preserves_uv'
23835 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23836 d_off64_t='$d_off64_t'
23837 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23838 d_oldpthreads='$d_oldpthreads'
23839 d_oldsock='$d_oldsock'
23840 d_open3='$d_open3'
23841 d_pathconf='$d_pathconf'
23842 d_pause='$d_pause'
23843 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23844 d_phostname='$d_phostname'
23845 d_pipe='$d_pipe'
23846 d_poll='$d_poll'
23847 d_portable='$d_portable'
23848 d_prctl='$d_prctl'
23849 d_prctl_set_name='$d_prctl_set_name'
23850 d_printf_format_null='$d_printf_format_null'
23851 d_procselfexe='$d_procselfexe'
23852 d_pseudofork='$d_pseudofork'
23853 d_pthread_atfork='$d_pthread_atfork'
23854 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23855 d_pthread_yield='$d_pthread_yield'
23856 d_ptrdiff_t='$d_ptrdiff_t'
23857 d_pwage='$d_pwage'
23858 d_pwchange='$d_pwchange'
23859 d_pwclass='$d_pwclass'
23860 d_pwcomment='$d_pwcomment'
23861 d_pwexpire='$d_pwexpire'
23862 d_pwgecos='$d_pwgecos'
23863 d_pwpasswd='$d_pwpasswd'
23864 d_pwquota='$d_pwquota'
23865 d_qgcvt='$d_qgcvt'
23866 d_quad='$d_quad'
23867 d_random_r='$d_random_r'
23868 d_readdir64_r='$d_readdir64_r'
23869 d_readdir='$d_readdir'
23870 d_readdir_r='$d_readdir_r'
23871 d_readlink='$d_readlink'
23872 d_readv='$d_readv'
23873 d_recvmsg='$d_recvmsg'
23874 d_rename='$d_rename'
23875 d_rewinddir='$d_rewinddir'
23876 d_rmdir='$d_rmdir'
23877 d_safebcpy='$d_safebcpy'
23878 d_safemcpy='$d_safemcpy'
23879 d_sanemcmp='$d_sanemcmp'
23880 d_sbrkproto='$d_sbrkproto'
23881 d_scalbnl='$d_scalbnl'
23882 d_sched_yield='$d_sched_yield'
23883 d_scm_rights='$d_scm_rights'
23884 d_seekdir='$d_seekdir'
23885 d_select='$d_select'
23886 d_sem='$d_sem'
23887 d_semctl='$d_semctl'
23888 d_semctl_semid_ds='$d_semctl_semid_ds'
23889 d_semctl_semun='$d_semctl_semun'
23890 d_semget='$d_semget'
23891 d_semop='$d_semop'
23892 d_sendmsg='$d_sendmsg'
23893 d_setegid='$d_setegid'
23894 d_seteuid='$d_seteuid'
23895 d_setgrent='$d_setgrent'
23896 d_setgrent_r='$d_setgrent_r'
23897 d_setgrps='$d_setgrps'
23898 d_sethent='$d_sethent'
23899 d_sethostent_r='$d_sethostent_r'
23900 d_setitimer='$d_setitimer'
23901 d_setlinebuf='$d_setlinebuf'
23902 d_setlocale='$d_setlocale'
23903 d_setlocale_r='$d_setlocale_r'
23904 d_setnent='$d_setnent'
23905 d_setnetent_r='$d_setnetent_r'
23906 d_setpent='$d_setpent'
23907 d_setpgid='$d_setpgid'
23908 d_setpgrp2='$d_setpgrp2'
23909 d_setpgrp='$d_setpgrp'
23910 d_setprior='$d_setprior'
23911 d_setproctitle='$d_setproctitle'
23912 d_setprotoent_r='$d_setprotoent_r'
23913 d_setpwent='$d_setpwent'
23914 d_setpwent_r='$d_setpwent_r'
23915 d_setregid='$d_setregid'
23916 d_setresgid='$d_setresgid'
23917 d_setresuid='$d_setresuid'
23918 d_setreuid='$d_setreuid'
23919 d_setrgid='$d_setrgid'
23920 d_setruid='$d_setruid'
23921 d_setsent='$d_setsent'
23922 d_setservent_r='$d_setservent_r'
23923 d_setsid='$d_setsid'
23924 d_setvbuf='$d_setvbuf'
23925 d_shm='$d_shm'
23926 d_shmat='$d_shmat'
23927 d_shmatprototype='$d_shmatprototype'
23928 d_shmctl='$d_shmctl'
23929 d_shmdt='$d_shmdt'
23930 d_shmget='$d_shmget'
23931 d_sigaction='$d_sigaction'
23932 d_signbit='$d_signbit'
23933 d_sigprocmask='$d_sigprocmask'
23934 d_sigsetjmp='$d_sigsetjmp'
23935 d_sin6_scope_id='$d_sin6_scope_id'
23936 d_sitearch='$d_sitearch'
23937 d_snprintf='$d_snprintf'
23938 d_sockaddr_in6='$d_sockaddr_in6'
23939 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23940 d_sockatmark='$d_sockatmark'
23941 d_sockatmarkproto='$d_sockatmarkproto'
23942 d_socket='$d_socket'
23943 d_socklen_t='$d_socklen_t'
23944 d_sockpair='$d_sockpair'
23945 d_socks5_init='$d_socks5_init'
23946 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23947 d_sqrtl='$d_sqrtl'
23948 d_srand48_r='$d_srand48_r'
23949 d_srandom_r='$d_srandom_r'
23950 d_sresgproto='$d_sresgproto'
23951 d_sresuproto='$d_sresuproto'
23952 d_statblks='$d_statblks'
23953 d_statfs_f_flags='$d_statfs_f_flags'
23954 d_statfs_s='$d_statfs_s'
23955 d_static_inline='$d_static_inline'
23956 d_statvfs='$d_statvfs'
23957 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23958 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23959 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23960 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23961 d_stdio_stream_array='$d_stdio_stream_array'
23962 d_stdiobase='$d_stdiobase'
23963 d_stdstdio='$d_stdstdio'
23964 d_strchr='$d_strchr'
23965 d_strcoll='$d_strcoll'
23966 d_strctcpy='$d_strctcpy'
23967 d_strerrm='$d_strerrm'
23968 d_strerror='$d_strerror'
23969 d_strerror_r='$d_strerror_r'
23970 d_strftime='$d_strftime'
23971 d_strlcat='$d_strlcat'
23972 d_strlcpy='$d_strlcpy'
23973 d_strtod='$d_strtod'
23974 d_strtol='$d_strtol'
23975 d_strtold='$d_strtold'
23976 d_strtoll='$d_strtoll'
23977 d_strtoq='$d_strtoq'
23978 d_strtoul='$d_strtoul'
23979 d_strtoull='$d_strtoull'
23980 d_strtouq='$d_strtouq'
23981 d_strxfrm='$d_strxfrm'
23982 d_suidsafe='$d_suidsafe'
23983 d_symlink='$d_symlink'
23984 d_syscall='$d_syscall'
23985 d_syscallproto='$d_syscallproto'
23986 d_sysconf='$d_sysconf'
23987 d_sysernlst='$d_sysernlst'
23988 d_syserrlst='$d_syserrlst'
23989 d_system='$d_system'
23990 d_tcgetpgrp='$d_tcgetpgrp'
23991 d_tcsetpgrp='$d_tcsetpgrp'
23992 d_telldir='$d_telldir'
23993 d_telldirproto='$d_telldirproto'
23994 d_time='$d_time'
23995 d_timegm='$d_timegm'
23996 d_times='$d_times'
23997 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23998 d_tm_tm_zone='$d_tm_tm_zone'
23999 d_tmpnam_r='$d_tmpnam_r'
24000 d_truncate='$d_truncate'
24001 d_truncl='$d_truncl'
24002 d_ttyname_r='$d_ttyname_r'
24003 d_tzname='$d_tzname'
24004 d_u32align='$d_u32align'
24005 d_ualarm='$d_ualarm'
24006 d_umask='$d_umask'
24007 d_uname='$d_uname'
24008 d_union_semun='$d_union_semun'
24009 d_unordered='$d_unordered'
24010 d_unsetenv='$d_unsetenv'
24011 d_usleep='$d_usleep'
24012 d_usleepproto='$d_usleepproto'
24013 d_ustat='$d_ustat'
24014 d_vendorarch='$d_vendorarch'
24015 d_vendorbin='$d_vendorbin'
24016 d_vendorlib='$d_vendorlib'
24017 d_vendorscript='$d_vendorscript'
24018 d_vfork='$d_vfork'
24019 d_void_closedir='$d_void_closedir'
24020 d_voidsig='$d_voidsig'
24021 d_voidtty='$d_voidtty'
24022 d_volatile='$d_volatile'
24023 d_vprintf='$d_vprintf'
24024 d_vsnprintf='$d_vsnprintf'
24025 d_wait4='$d_wait4'
24026 d_waitpid='$d_waitpid'
24027 d_wcscmp='$d_wcscmp'
24028 d_wcstombs='$d_wcstombs'
24029 d_wcsxfrm='$d_wcsxfrm'
24030 d_wctomb='$d_wctomb'
24031 d_writev='$d_writev'
24032 d_xenix='$d_xenix'
24033 date='$date'
24034 db_hashtype='$db_hashtype'
24035 db_prefixtype='$db_prefixtype'
24036 db_version_major='$db_version_major'
24037 db_version_minor='$db_version_minor'
24038 db_version_patch='$db_version_patch'
24039 direntrytype='$direntrytype'
24040 dlext='$dlext'
24041 dlsrc='$dlsrc'
24042 doublekind='$doublekind'
24043 doublesize='$doublesize'
24044 drand01='$drand01'
24045 drand48_r_proto='$drand48_r_proto'
24046 dtrace='$dtrace'
24047 dynamic_ext='$dynamic_ext'
24048 eagain='$eagain'
24049 ebcdic='$ebcdic'
24050 echo='$echo'
24051 egrep='$egrep'
24052 emacs='$emacs'
24053 endgrent_r_proto='$endgrent_r_proto'
24054 endhostent_r_proto='$endhostent_r_proto'
24055 endnetent_r_proto='$endnetent_r_proto'
24056 endprotoent_r_proto='$endprotoent_r_proto'
24057 endpwent_r_proto='$endpwent_r_proto'
24058 endservent_r_proto='$endservent_r_proto'
24059 eunicefix='$eunicefix'
24060 exe_ext='$exe_ext'
24061 expr='$expr'
24062 extensions='$extensions'
24063 extern_C='$extern_C'
24064 extras='$extras'
24065 fflushNULL='$fflushNULL'
24066 fflushall='$fflushall'
24067 find='$find'
24068 firstmakefile='$firstmakefile'
24069 flex='$flex'
24070 fpossize='$fpossize'
24071 fpostype='$fpostype'
24072 freetype='$freetype'
24073 from='$from'
24074 full_ar='$full_ar'
24075 full_csh='$full_csh'
24076 full_sed='$full_sed'
24077 gccansipedantic='$gccansipedantic'
24078 gccosandvers='$gccosandvers'
24079 gccversion='$gccversion'
24080 getgrent_r_proto='$getgrent_r_proto'
24081 getgrgid_r_proto='$getgrgid_r_proto'
24082 getgrnam_r_proto='$getgrnam_r_proto'
24083 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
24084 gethostbyname_r_proto='$gethostbyname_r_proto'
24085 gethostent_r_proto='$gethostent_r_proto'
24086 getlogin_r_proto='$getlogin_r_proto'
24087 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
24088 getnetbyname_r_proto='$getnetbyname_r_proto'
24089 getnetent_r_proto='$getnetent_r_proto'
24090 getprotobyname_r_proto='$getprotobyname_r_proto'
24091 getprotobynumber_r_proto='$getprotobynumber_r_proto'
24092 getprotoent_r_proto='$getprotoent_r_proto'
24093 getpwent_r_proto='$getpwent_r_proto'
24094 getpwnam_r_proto='$getpwnam_r_proto'
24095 getpwuid_r_proto='$getpwuid_r_proto'
24096 getservbyname_r_proto='$getservbyname_r_proto'
24097 getservbyport_r_proto='$getservbyport_r_proto'
24098 getservent_r_proto='$getservent_r_proto'
24099 getspnam_r_proto='$getspnam_r_proto'
24100 gidformat='$gidformat'
24101 gidsign='$gidsign'
24102 gidsize='$gidsize'
24103 gidtype='$gidtype'
24104 glibpth='$glibpth'
24105 gmake='$gmake'
24106 gmtime_r_proto='$gmtime_r_proto'
24107 gnulibc_version='$gnulibc_version'
24108 grep='$grep'
24109 groupcat='$groupcat'
24110 groupstype='$groupstype'
24111 gzip='$gzip'
24112 h_fcntl='$h_fcntl'
24113 h_sysfile='$h_sysfile'
24114 hint='$hint'
24115 hostcat='$hostcat'
24116 hostgenerate='$hostgenerate'
24117 hostosname='$hostosname'
24118 hostperl='$hostperl'
24119 html1dir='$html1dir'
24120 html1direxp='$html1direxp'
24121 html3dir='$html3dir'
24122 html3direxp='$html3direxp'
24123 i16size='$i16size'
24124 i16type='$i16type'
24125 i32size='$i32size'
24126 i32type='$i32type'
24127 i64size='$i64size'
24128 i64type='$i64type'
24129 i8size='$i8size'
24130 i8type='$i8type'
24131 i_arpainet='$i_arpainet'
24132 i_assert='$i_assert'
24133 i_bfd='$i_bfd'
24134 i_bsdioctl='$i_bsdioctl'
24135 i_crypt='$i_crypt'
24136 i_db='$i_db'
24137 i_dbm='$i_dbm'
24138 i_dirent='$i_dirent'
24139 i_dlfcn='$i_dlfcn'
24140 i_execinfo='$i_execinfo'
24141 i_fcntl='$i_fcntl'
24142 i_fenv='$i_fenv'
24143 i_float='$i_float'
24144 i_fp='$i_fp'
24145 i_fp_class='$i_fp_class'
24146 i_gdbm='$i_gdbm'
24147 i_gdbm_ndbm='$i_gdbm_ndbm'
24148 i_gdbmndbm='$i_gdbmndbm'
24149 i_grp='$i_grp'
24150 i_ieeefp='$i_ieeefp'
24151 i_inttypes='$i_inttypes'
24152 i_langinfo='$i_langinfo'
24153 i_libutil='$i_libutil'
24154 i_limits='$i_limits'
24155 i_locale='$i_locale'
24156 i_machcthr='$i_machcthr'
24157 i_malloc='$i_malloc'
24158 i_mallocmalloc='$i_mallocmalloc'
24159 i_math='$i_math'
24160 i_memory='$i_memory'
24161 i_mntent='$i_mntent'
24162 i_ndbm='$i_ndbm'
24163 i_netdb='$i_netdb'
24164 i_neterrno='$i_neterrno'
24165 i_netinettcp='$i_netinettcp'
24166 i_niin='$i_niin'
24167 i_poll='$i_poll'
24168 i_prot='$i_prot'
24169 i_pthread='$i_pthread'
24170 i_pwd='$i_pwd'
24171 i_quadmath='$i_quadmath'
24172 i_rpcsvcdbm='$i_rpcsvcdbm'
24173 i_sgtty='$i_sgtty'
24174 i_shadow='$i_shadow'
24175 i_socks='$i_socks'
24176 i_stdarg='$i_stdarg'
24177 i_stdbool='$i_stdbool'
24178 i_stddef='$i_stddef'
24179 i_stdint='$i_stdint'
24180 i_stdlib='$i_stdlib'
24181 i_string='$i_string'
24182 i_sunmath='$i_sunmath'
24183 i_sysaccess='$i_sysaccess'
24184 i_sysdir='$i_sysdir'
24185 i_sysfile='$i_sysfile'
24186 i_sysfilio='$i_sysfilio'
24187 i_sysin='$i_sysin'
24188 i_sysioctl='$i_sysioctl'
24189 i_syslog='$i_syslog'
24190 i_sysmman='$i_sysmman'
24191 i_sysmode='$i_sysmode'
24192 i_sysmount='$i_sysmount'
24193 i_sysndir='$i_sysndir'
24194 i_sysparam='$i_sysparam'
24195 i_syspoll='$i_syspoll'
24196 i_sysresrc='$i_sysresrc'
24197 i_syssecrt='$i_syssecrt'
24198 i_sysselct='$i_sysselct'
24199 i_syssockio='$i_syssockio'
24200 i_sysstat='$i_sysstat'
24201 i_sysstatfs='$i_sysstatfs'
24202 i_sysstatvfs='$i_sysstatvfs'
24203 i_systime='$i_systime'
24204 i_systimek='$i_systimek'
24205 i_systimes='$i_systimes'
24206 i_systypes='$i_systypes'
24207 i_sysuio='$i_sysuio'
24208 i_sysun='$i_sysun'
24209 i_sysutsname='$i_sysutsname'
24210 i_sysvfs='$i_sysvfs'
24211 i_syswait='$i_syswait'
24212 i_termio='$i_termio'
24213 i_termios='$i_termios'
24214 i_time='$i_time'
24215 i_unistd='$i_unistd'
24216 i_ustat='$i_ustat'
24217 i_utime='$i_utime'
24218 i_values='$i_values'
24219 i_varargs='$i_varargs'
24220 i_varhdr='$i_varhdr'
24221 i_vfork='$i_vfork'
24222 ignore_versioned_solibs='$ignore_versioned_solibs'
24223 inc_version_list='$inc_version_list'
24224 inc_version_list_init='$inc_version_list_init'
24225 incpath='$incpath'
24226 incpth='$incpth'
24227 inews='$inews'
24228 initialinstalllocation='$initialinstalllocation'
24229 installarchlib='$installarchlib'
24230 installbin='$installbin'
24231 installhtml1dir='$installhtml1dir'
24232 installhtml3dir='$installhtml3dir'
24233 installman1dir='$installman1dir'
24234 installman3dir='$installman3dir'
24235 installprefix='$installprefix'
24236 installprefixexp='$installprefixexp'
24237 installprivlib='$installprivlib'
24238 installscript='$installscript'
24239 installsitearch='$installsitearch'
24240 installsitebin='$installsitebin'
24241 installsitehtml1dir='$installsitehtml1dir'
24242 installsitehtml3dir='$installsitehtml3dir'
24243 installsitelib='$installsitelib'
24244 installsiteman1dir='$installsiteman1dir'
24245 installsiteman3dir='$installsiteman3dir'
24246 installsitescript='$installsitescript'
24247 installstyle='$installstyle'
24248 installusrbinperl='$installusrbinperl'
24249 installvendorarch='$installvendorarch'
24250 installvendorbin='$installvendorbin'
24251 installvendorhtml1dir='$installvendorhtml1dir'
24252 installvendorhtml3dir='$installvendorhtml3dir'
24253 installvendorlib='$installvendorlib'
24254 installvendorman1dir='$installvendorman1dir'
24255 installvendorman3dir='$installvendorman3dir'
24256 installvendorscript='$installvendorscript'
24257 intsize='$intsize'
24258 issymlink='$issymlink'
24259 ivdformat='$ivdformat'
24260 ivsize='$ivsize'
24261 ivtype='$ivtype'
24262 known_extensions='$known_extensions'
24263 ksh='$ksh'
24264 ld='$ld'
24265 ld_can_script='$ld_can_script'
24266 lddlflags='$lddlflags'
24267 ldflags='$ldflags'
24268 ldflags_uselargefiles='$ldflags_uselargefiles'
24269 ldlibpthname='$ldlibpthname'
24270 less='$less'
24271 lib_ext='$lib_ext'
24272 libc='$libc'
24273 libperl='$libperl'
24274 libpth='$libpth'
24275 libs='$libs'
24276 libsdirs='$libsdirs'
24277 libsfiles='$libsfiles'
24278 libsfound='$libsfound'
24279 libspath='$libspath'
24280 libswanted='$libswanted'
24281 libswanted_uselargefiles='$libswanted_uselargefiles'
24282 line='$line'
24283 lint='$lint'
24284 lkflags='$lkflags'
24285 ln='$ln'
24286 lns='$lns'
24287 localtime_r_proto='$localtime_r_proto'
24288 locincpth='$locincpth'
24289 loclibpth='$loclibpth'
24290 longdblkind='$longdblkind'
24291 longdblsize='$longdblsize'
24292 longlongsize='$longlongsize'
24293 longsize='$longsize'
24294 lp='$lp'
24295 lpr='$lpr'
24296 ls='$ls'
24297 lseeksize='$lseeksize'
24298 lseektype='$lseektype'
24299 mail='$mail'
24300 mailx='$mailx'
24301 make='$make'
24302 make_set_make='$make_set_make'
24303 mallocobj='$mallocobj'
24304 mallocsrc='$mallocsrc'
24305 malloctype='$malloctype'
24306 man1dir='$man1dir'
24307 man1direxp='$man1direxp'
24308 man1ext='$man1ext'
24309 man3dir='$man3dir'
24310 man3direxp='$man3direxp'
24311 man3ext='$man3ext'
24312 mips_type='$mips_type'
24313 mistrustnm='$mistrustnm'
24314 mkdir='$mkdir'
24315 mmaptype='$mmaptype'
24316 modetype='$modetype'
24317 more='$more'
24318 multiarch='$multiarch'
24319 mv='$mv'
24320 myarchname='$myarchname'
24321 mydomain='$mydomain'
24322 myhostname='$myhostname'
24323 myuname='$myuname'
24324 n='$n'
24325 need_va_copy='$need_va_copy'
24326 netdb_hlen_type='$netdb_hlen_type'
24327 netdb_host_type='$netdb_host_type'
24328 netdb_name_type='$netdb_name_type'
24329 netdb_net_type='$netdb_net_type'
24330 nm='$nm'
24331 nm_opt='$nm_opt'
24332 nm_so_opt='$nm_so_opt'
24333 nonxs_ext='$nonxs_ext'
24334 nroff='$nroff'
24335 nvEUformat='$nvEUformat'
24336 nvFUformat='$nvFUformat'
24337 nvGUformat='$nvGUformat'
24338 nv_overflows_integers_at='$nv_overflows_integers_at'
24339 nv_preserves_uv_bits='$nv_preserves_uv_bits'
24340 nveformat='$nveformat'
24341 nvfformat='$nvfformat'
24342 nvgformat='$nvgformat'
24343 nvsize='$nvsize'
24344 nvtype='$nvtype'
24345 o_nonblock='$o_nonblock'
24346 obj_ext='$obj_ext'
24347 old_pthread_create_joinable='$old_pthread_create_joinable'
24348 optimize='$optimize'
24349 orderlib='$orderlib'
24350 osname='$osname'
24351 osvers='$osvers'
24352 otherlibdirs='$otherlibdirs'
24353 package='$package'
24354 pager='$pager'
24355 passcat='$passcat'
24356 patchlevel='$patchlevel'
24357 path_sep='$path_sep'
24358 perl5='$perl5'
24359 perl='$perl'
24360 perl_patchlevel='$perl_patchlevel'
24361 perl_static_inline='$perl_static_inline'
24362 perladmin='$perladmin'
24363 perllibs='$perllibs'
24364 perlpath='$perlpath'
24365 pg='$pg'
24366 phostname='$phostname'
24367 pidtype='$pidtype'
24368 plibpth='$plibpth'
24369 pmake='$pmake'
24370 pr='$pr'
24371 prefix='$prefix'
24372 prefixexp='$prefixexp'
24373 privlib='$privlib'
24374 privlibexp='$privlibexp'
24375 procselfexe='$procselfexe'
24376 prototype='$prototype'
24377 ptrsize='$ptrsize'
24378 quadkind='$quadkind'
24379 quadtype='$quadtype'
24380 randbits='$randbits'
24381 randfunc='$randfunc'
24382 random_r_proto='$random_r_proto'
24383 randseedtype='$randseedtype'
24384 ranlib='$ranlib'
24385 rd_nodata='$rd_nodata'
24386 readdir64_r_proto='$readdir64_r_proto'
24387 readdir_r_proto='$readdir_r_proto'
24388 revision='$revision'
24389 rm='$rm'
24390 rm_try='$rm_try'
24391 rmail='$rmail'
24392 run='$run'
24393 runnm='$runnm'
24394 sGMTIME_max='$sGMTIME_max'
24395 sGMTIME_min='$sGMTIME_min'
24396 sLOCALTIME_max='$sLOCALTIME_max'
24397 sLOCALTIME_min='$sLOCALTIME_min'
24398 sPRIEUldbl='$sPRIEUldbl'
24399 sPRIFUldbl='$sPRIFUldbl'
24400 sPRIGUldbl='$sPRIGUldbl'
24401 sPRIXU64='$sPRIXU64'
24402 sPRId64='$sPRId64'
24403 sPRIeldbl='$sPRIeldbl'
24404 sPRIfldbl='$sPRIfldbl'
24405 sPRIgldbl='$sPRIgldbl'
24406 sPRIi64='$sPRIi64'
24407 sPRIo64='$sPRIo64'
24408 sPRIu64='$sPRIu64'
24409 sPRIx64='$sPRIx64'
24410 sSCNfldbl='$sSCNfldbl'
24411 sched_yield='$sched_yield'
24412 scriptdir='$scriptdir'
24413 scriptdirexp='$scriptdirexp'
24414 sed='$sed'
24415 seedfunc='$seedfunc'
24416 selectminbits='$selectminbits'
24417 selecttype='$selecttype'
24418 sendmail='$sendmail'
24419 setgrent_r_proto='$setgrent_r_proto'
24420 sethostent_r_proto='$sethostent_r_proto'
24421 setlocale_r_proto='$setlocale_r_proto'
24422 setnetent_r_proto='$setnetent_r_proto'
24423 setprotoent_r_proto='$setprotoent_r_proto'
24424 setpwent_r_proto='$setpwent_r_proto'
24425 setservent_r_proto='$setservent_r_proto'
24426 sh='$sh'
24427 shar='$shar'
24428 sharpbang='$sharpbang'
24429 shmattype='$shmattype'
24430 shortsize='$shortsize'
24431 shrpenv='$shrpenv'
24432 shsharp='$shsharp'
24433 sig_count='$sig_count'
24434 sig_name='$sig_name'
24435 sig_name_init='$sig_name_init'
24436 sig_num='$sig_num'
24437 sig_num_init='$sig_num_init'
24438 sig_size='$sig_size'
24439 signal_t='$signal_t'
24440 sitearch='$sitearch'
24441 sitearchexp='$sitearchexp'
24442 sitebin='$sitebin'
24443 sitebinexp='$sitebinexp'
24444 sitehtml1dir='$sitehtml1dir'
24445 sitehtml1direxp='$sitehtml1direxp'
24446 sitehtml3dir='$sitehtml3dir'
24447 sitehtml3direxp='$sitehtml3direxp'
24448 sitelib='$sitelib'
24449 sitelib_stem='$sitelib_stem'
24450 sitelibexp='$sitelibexp'
24451 siteman1dir='$siteman1dir'
24452 siteman1direxp='$siteman1direxp'
24453 siteman3dir='$siteman3dir'
24454 siteman3direxp='$siteman3direxp'
24455 siteprefix='$siteprefix'
24456 siteprefixexp='$siteprefixexp'
24457 sitescript='$sitescript'
24458 sitescriptexp='$sitescriptexp'
24459 sizesize='$sizesize'
24460 sizetype='$sizetype'
24461 sleep='$sleep'
24462 smail='$smail'
24463 so='$so'
24464 sockethdr='$sockethdr'
24465 socketlib='$socketlib'
24466 socksizetype='$socksizetype'
24467 sort='$sort'
24468 spackage='$spackage'
24469 spitshell='$spitshell'
24470 srand48_r_proto='$srand48_r_proto'
24471 srandom_r_proto='$srandom_r_proto'
24472 src='$src'
24473 ssizetype='$ssizetype'
24474 st_ino_sign='$st_ino_sign'
24475 st_ino_size='$st_ino_size'
24476 startperl='$startperl'
24477 startsh='$startsh'
24478 static_ext='$static_ext'
24479 stdchar='$stdchar'
24480 stdio_base='$stdio_base'
24481 stdio_bufsiz='$stdio_bufsiz'
24482 stdio_cnt='$stdio_cnt'
24483 stdio_filbuf='$stdio_filbuf'
24484 stdio_ptr='$stdio_ptr'
24485 stdio_stream_array='$stdio_stream_array'
24486 strerror_r_proto='$strerror_r_proto'
24487 strings='$strings'
24488 submit='$submit'
24489 subversion='$subversion'
24490 sysman='$sysman'
24491 sysroot='$sysroot'
24492 tail='$tail'
24493 tar='$tar'
24494 targetarch='$targetarch'
24495 targetdir='$targetdir'
24496 targetenv='$targetenv'
24497 targethost='$targethost'
24498 targetmkdir='$targetmkdir'
24499 targetport='$targetport'
24500 targetsh='$targetsh'
24501 tbl='$tbl'
24502 tee='$tee'
24503 test='$test'
24504 timeincl='$timeincl'
24505 timetype='$timetype'
24506 tmpnam_r_proto='$tmpnam_r_proto'
24507 to='$to'
24508 touch='$touch'
24509 tr='$tr'
24510 trnl='$trnl'
24511 troff='$troff'
24512 ttyname_r_proto='$ttyname_r_proto'
24513 u16size='$u16size'
24514 u16type='$u16type'
24515 u32size='$u32size'
24516 u32type='$u32type'
24517 u64size='$u64size'
24518 u64type='$u64type'
24519 u8size='$u8size'
24520 u8type='$u8type'
24521 uidformat='$uidformat'
24522 uidsign='$uidsign'
24523 uidsize='$uidsize'
24524 uidtype='$uidtype'
24525 uname='$uname'
24526 uniq='$uniq'
24527 uquadtype='$uquadtype'
24528 use5005threads='$use5005threads'
24529 use64bitall='$use64bitall'
24530 use64bitint='$use64bitint'
24531 usecbacktrace='$usecbacktrace'
24532 usecrosscompile='$usecrosscompile'
24533 usedevel='$usedevel'
24534 usedl='$usedl'
24535 usedtrace='$usedtrace'
24536 usefaststdio='$usefaststdio'
24537 useithreads='$useithreads'
24538 usekernprocpathname='$usekernprocpathname'
24539 uselargefiles='$uselargefiles'
24540 uselongdouble='$uselongdouble'
24541 usemallocwrap='$usemallocwrap'
24542 usemorebits='$usemorebits'
24543 usemultiplicity='$usemultiplicity'
24544 usemymalloc='$usemymalloc'
24545 usenm='$usenm'
24546 usensgetexecutablepath='$usensgetexecutablepath'
24547 useopcode='$useopcode'
24548 useperlio='$useperlio'
24549 useposix='$useposix'
24550 usequadmath='$usequadmath'
24551 usereentrant='$usereentrant'
24552 userelocatableinc='$userelocatableinc'
24553 useshrplib='$useshrplib'
24554 usesitecustomize='$usesitecustomize'
24555 usesocks='$usesocks'
24556 usethreads='$usethreads'
24557 usevendorprefix='$usevendorprefix'
24558 useversionedarchname='$useversionedarchname'
24559 usevfork='$usevfork'
24560 usrinc='$usrinc'
24561 uuname='$uuname'
24562 uvXUformat='$uvXUformat'
24563 uvoformat='$uvoformat'
24564 uvsize='$uvsize'
24565 uvtype='$uvtype'
24566 uvuformat='$uvuformat'
24567 uvxformat='$uvxformat'
24568 vaproto='$vaproto'
24569 vendorarch='$vendorarch'
24570 vendorarchexp='$vendorarchexp'
24571 vendorbin='$vendorbin'
24572 vendorbinexp='$vendorbinexp'
24573 vendorhtml1dir='$vendorhtml1dir'
24574 vendorhtml1direxp='$vendorhtml1direxp'
24575 vendorhtml3dir='$vendorhtml3dir'
24576 vendorhtml3direxp='$vendorhtml3direxp'
24577 vendorlib='$vendorlib'
24578 vendorlib_stem='$vendorlib_stem'
24579 vendorlibexp='$vendorlibexp'
24580 vendorman1dir='$vendorman1dir'
24581 vendorman1direxp='$vendorman1direxp'
24582 vendorman3dir='$vendorman3dir'
24583 vendorman3direxp='$vendorman3direxp'
24584 vendorprefix='$vendorprefix'
24585 vendorprefixexp='$vendorprefixexp'
24586 vendorscript='$vendorscript'
24587 vendorscriptexp='$vendorscriptexp'
24588 version='$version'
24589 version_patchlevel_string='$version_patchlevel_string'
24590 versiononly='$versiononly'
24591 vi='$vi'
24592 xlibpth='$xlibpth'
24593 yacc='$yacc'
24594 yaccflags='$yaccflags'
24595 zcat='$zcat'
24596 zip='$zip'
24597 EOT
24598
24599 : add special variables
24600 $test -f $src/patchlevel.h && \
24601 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
24602 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
24603 echo "PERL_CONFIG_SH=true" >>config.sh
24604
24605 : propagate old symbols
24606 if $test -f UU/config.sh; then
24607         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
24608         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
24609                 config.sh config.sh UU/oldconfig.sh |\
24610                 $sort | $uniq -u >UU/oldsyms
24611         set X `$cat UU/oldsyms`
24612         shift
24613         case $# in
24614         0) ;;
24615         *)
24616                 $cat <<EOM
24617 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
24618 EOM
24619                 echo ": Variables propagated from previous config.sh file." >>config.sh
24620                 for sym in `$cat UU/oldsyms`; do
24621                         echo "    Propagating $hint variable "'$'"$sym..."
24622                         eval 'tmp="$'"${sym}"'"'
24623                         echo "$tmp" | \
24624                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
24625                 done
24626                 ;;
24627         esac
24628 fi
24629
24630 : preserve RCS keywords in files with variable substitution, grrr
24631 Id='$Id'
24632
24633 : Finish up by extracting the .SH files
24634 case "$alldone" in
24635 exit)
24636         $rm -rf UU
24637         echo "Extraction done."
24638         exit 0
24639         ;;
24640 cont)
24641         ;;
24642 '')
24643         dflt=''
24644         nostick=true
24645         $cat <<EOM
24646
24647 If you'd like to make any changes to the config.sh file before I begin
24648 to configure things, do it as a shell escape now (e.g. !vi config.sh).
24649
24650 EOM
24651         rp="Press return or use a shell escape to edit config.sh:"
24652         . UU/myread
24653         nostick=''
24654         case "$ans" in
24655         '') ;;
24656         *) : in case they cannot read
24657                 sh 1>&4 -c "$ans";;
24658         esac
24659         ;;
24660 esac
24661
24662 : if this fails, just run all the .SH files by hand
24663 . ./config.sh
24664
24665 echo " "
24666 exec 1>&4
24667 pwd=`pwd`
24668 . ./UU/extract
24669 cd "$pwd"
24670
24671 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
24672         dflt=y
24673         case "$silent" in
24674         true) ;;
24675         *)
24676                 $cat <<EOM
24677
24678 Now you need to generate make dependencies by running "$make depend".
24679 You might prefer to run it in background: "$make depend > makedepend.out &"
24680 It can take a while, so you might not want to run it right now.
24681
24682 EOM
24683                 ;;
24684         esac
24685         rp="Run $make depend now?"
24686         . UU/myread
24687         case "$ans" in
24688         y*)
24689                 $make depend && echo "Now you must run '$make'."
24690                 ;;
24691         *)
24692                 echo "You must run '$make depend' then '$make'."
24693                 ;;
24694         esac
24695 elif test -f [Mm]akefile; then
24696         echo " "
24697         echo "Now you must run a $make."
24698 else
24699         echo "Configure done."
24700 fi
24701
24702 if $test -f Policy.sh; then
24703     $cat <<EOM
24704
24705 If you compile $package on a different machine or from a different object
24706 directory, copy the Policy.sh file from this object directory to the
24707 new one before you run Configure -- this will help you with most of
24708 the policy defaults.
24709
24710 EOM
24711 fi
24712 if $test -f config.msg; then
24713     echo "Hmm.  I also noted the following information while running:"
24714     echo " "
24715     $cat config.msg >&4
24716     $rm -f config.msg
24717 fi
24718 $rm -f kit*isdone ark*isdone
24719 $rm -rf UU
24720
24721 : End of Configure
24722