This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta for the previous commit
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist package (which contains metaconfig) is available via SVN:
17 #     svn co https://svn.code.sf.net/p/dist/code/trunk/dist
18 #
19 # Though this script was generated by metaconfig from metaunits, it is
20 # OK to send patches against Configure itself. It's up to the Configure
21 # pumpkin to backport the patch to the metaunits if it is accepted.
22 # For more information on patching Configure, see pod/perlhack.pod
23 #
24 # The metaunits are also available from the public git repository:
25 #     http://perl5.git.perl.org/metaconfig.git/ or
26 #     $ git clone git://perl5.git.perl.org/metaconfig.git metaconfig
27 #
28 # See Porting/pumpkin.pod for more information on metaconfig.
29 #
30
31 # Generated on Tue Sep 17 10:34:33 CEST 2013 [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 >/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 run=''
210 targetarch=''
211 to=''
212 usecrosscompile=''
213 extern_C=''
214 mistrustnm=''
215 usedevel=''
216 perllibs=''
217 dynamic_ext=''
218 extensions=''
219 known_extensions=''
220 nonxs_ext=''
221 static_ext=''
222 useopcode=''
223 useposix=''
224 extras=''
225 d_bsd=''
226 d_eunice=''
227 d_xenix=''
228 eunicefix=''
229 ar=''
230 awk=''
231 bash=''
232 bison=''
233 byacc=''
234 cat=''
235 chgrp=''
236 chmod=''
237 chown=''
238 comm=''
239 compress=''
240 cp=''
241 cpio=''
242 cpp=''
243 csh=''
244 date=''
245 echo=''
246 egrep=''
247 emacs=''
248 expr=''
249 find=''
250 flex=''
251 gmake=''
252 grep=''
253 gzip=''
254 inews=''
255 ksh=''
256 less=''
257 line=''
258 lint=''
259 ln=''
260 lp=''
261 lpr=''
262 ls=''
263 mail=''
264 mailx=''
265 make=''
266 mkdir=''
267 more=''
268 mv=''
269 nm=''
270 nroff=''
271 perl=''
272 pg=''
273 pmake=''
274 pr=''
275 rm=''
276 rmail=''
277 sed=''
278 sendmail=''
279 shar=''
280 sleep=''
281 smail=''
282 sort=''
283 submit=''
284 tail=''
285 tar=''
286 tbl=''
287 tee=''
288 test=''
289 touch=''
290 tr=''
291 troff=''
292 uname=''
293 uniq=''
294 uuname=''
295 vi=''
296 zcat=''
297 zip=''
298 full_ar=''
299 full_sed=''
300 libswanted=''
301 hint=''
302 myuname=''
303 osname=''
304 osvers=''
305 Author=''
306 Date=''
307 Header=''
308 Id=''
309 Locker=''
310 Log=''
311 RCSfile=''
312 Revision=''
313 Source=''
314 State=''
315 _a=''
316 _exe=''
317 _o=''
318 archobjs=''
319 exe_ext=''
320 firstmakefile=''
321 lib_ext=''
322 obj_ext=''
323 path_sep=''
324 rm_try=''
325 afs=''
326 afsroot=''
327 alignbytes=''
328 ansi2knr=''
329 archlib=''
330 archlibexp=''
331 d_archlib=''
332 installarchlib=''
333 archname=''
334 myarchname=''
335 useversionedarchname=''
336 d_atolf=''
337 d_atoll=''
338 baserev=''
339 bin=''
340 binexp=''
341 initialinstalllocation=''
342 installbin=''
343 userelocatableinc=''
344 byteorder=''
345 cc=''
346 ccflags=''
347 cppflags=''
348 ldflags=''
349 lkflags=''
350 locincpth=''
351 optimize=''
352 cf_email=''
353 cf_by=''
354 cf_time=''
355 charbits=''
356 charsize=''
357 contains=''
358 cpp_stuff=''
359 cpplast=''
360 cppminus=''
361 cpprun=''
362 cppstdin=''
363 d__fwalk=''
364 d_access=''
365 d_accessx=''
366 d_aintl=''
367 d_alarm=''
368 asctime_r_proto=''
369 d_asctime_r=''
370 d_attribute_deprecated=''
371 d_attribute_format=''
372 d_attribute_malloc=''
373 d_attribute_nonnull=''
374 d_attribute_noreturn=''
375 d_attribute_pure=''
376 d_attribute_unused=''
377 d_attribute_warn_unused_result=''
378 d_printf_format_null=''
379 d_bcmp=''
380 d_bcopy=''
381 d_builtin_choose_expr=''
382 d_builtin_expect=''
383 d_bzero=''
384 d_c99_variadic_macros=''
385 d_casti32=''
386 castflags=''
387 d_castneg=''
388 d_chown=''
389 d_chroot=''
390 d_chsize=''
391 d_class=''
392 d_clearenv=''
393 d_closedir=''
394 d_void_closedir=''
395 d_cmsghdr_s=''
396 d_const=''
397 d_copysignl=''
398 d_cplusplus=''
399 cryptlib=''
400 d_crypt=''
401 crypt_r_proto=''
402 d_crypt_r=''
403 d_csh=''
404 full_csh=''
405 d_ctermid=''
406 ctermid_r_proto=''
407 d_ctermid_r=''
408 ctime_r_proto=''
409 d_ctime_r=''
410 d_cuserid=''
411 d_dbl_dig=''
412 d_dbminitproto=''
413 d_difftime=''
414 d_dir_dd_fd=''
415 d_dirfd=''
416 d_dlerror=''
417 d_dlopen=''
418 d_dlsymun=''
419 d_dosuid=''
420 d_suidsafe=''
421 d_drand48_r=''
422 drand48_r_proto=''
423 d_drand48proto=''
424 d_dup2=''
425 d_eaccess=''
426 d_endgrent=''
427 d_endgrent_r=''
428 endgrent_r_proto=''
429 d_endhent=''
430 d_endhostent_r=''
431 endhostent_r_proto=''
432 d_endnent=''
433 d_endnetent_r=''
434 endnetent_r_proto=''
435 d_endpent=''
436 d_endprotoent_r=''
437 endprotoent_r_proto=''
438 d_endpwent=''
439 d_endpwent_r=''
440 endpwent_r_proto=''
441 d_endsent=''
442 d_endservent_r=''
443 endservent_r_proto=''
444 d_faststdio=''
445 d_fchdir=''
446 d_fchmod=''
447 d_fchown=''
448 d_fcntl=''
449 d_fcntl_can_lock=''
450 d_fd_macros=''
451 d_fd_set=''
452 d_fds_bits=''
453 d_fgetpos=''
454 d_finite=''
455 d_finitel=''
456 d_flexfnam=''
457 d_flock=''
458 d_flockproto=''
459 d_fork=''
460 d_fp_class=''
461 d_fpclass=''
462 d_fpclassify=''
463 d_fpclassl=''
464 d_fpos64_t=''
465 d_frexpl=''
466 d_fs_data_s=''
467 d_fseeko=''
468 d_fsetpos=''
469 d_fstatfs=''
470 d_fsync=''
471 d_ftello=''
472 d_ftime=''
473 d_gettimeod=''
474 d_futimes=''
475 d_Gconvert=''
476 d_getaddrinfo=''
477 d_getcwd=''
478 d_getespwnam=''
479 d_getfsstat=''
480 d_getgrent=''
481 d_getgrent_r=''
482 getgrent_r_proto=''
483 d_getgrgid_r=''
484 getgrgid_r_proto=''
485 d_getgrnam_r=''
486 getgrnam_r_proto=''
487 d_getgrps=''
488 d_gethbyaddr=''
489 d_gethbyname=''
490 d_gethent=''
491 aphostname=''
492 d_gethname=''
493 d_phostname=''
494 d_uname=''
495 d_gethostbyaddr_r=''
496 gethostbyaddr_r_proto=''
497 d_gethostbyname_r=''
498 gethostbyname_r_proto=''
499 d_gethostent_r=''
500 gethostent_r_proto=''
501 d_gethostprotos=''
502 d_getitimer=''
503 d_getlogin=''
504 d_getlogin_r=''
505 getlogin_r_proto=''
506 d_getmnt=''
507 d_getmntent=''
508 d_getnameinfo=''
509 d_getnbyaddr=''
510 d_getnbyname=''
511 d_getnent=''
512 d_getnetbyaddr_r=''
513 getnetbyaddr_r_proto=''
514 d_getnetbyname_r=''
515 getnetbyname_r_proto=''
516 d_getnetent_r=''
517 getnetent_r_proto=''
518 d_getnetprotos=''
519 d_getpagsz=''
520 d_getpent=''
521 d_getpgid=''
522 d_getpgrp2=''
523 d_bsdgetpgrp=''
524 d_getpgrp=''
525 d_getppid=''
526 d_getprior=''
527 d_getpbyname=''
528 d_getpbynumber=''
529 d_getprotobyname_r=''
530 getprotobyname_r_proto=''
531 d_getprotobynumber_r=''
532 getprotobynumber_r_proto=''
533 d_getprotoent_r=''
534 getprotoent_r_proto=''
535 d_getprotoprotos=''
536 d_getprpwnam=''
537 d_getpwent=''
538 d_getpwent_r=''
539 getpwent_r_proto=''
540 d_getpwnam_r=''
541 getpwnam_r_proto=''
542 d_getpwuid_r=''
543 getpwuid_r_proto=''
544 d_getsent=''
545 d_getservbyname_r=''
546 getservbyname_r_proto=''
547 d_getservbyport_r=''
548 getservbyport_r_proto=''
549 d_getservent_r=''
550 getservent_r_proto=''
551 d_getservprotos=''
552 d_getspnam=''
553 d_getspnam_r=''
554 getspnam_r_proto=''
555 d_getsbyname=''
556 d_getsbyport=''
557 d_gmtime_r=''
558 gmtime_r_proto=''
559 d_gnulibc=''
560 gnulibc_version=''
561 d_hasmntopt=''
562 d_htonl=''
563 d_ilogbl=''
564 d_inetaton=''
565 d_inetntop=''
566 d_inetpton=''
567 d_int64_t=''
568 d_isascii=''
569 d_isblank=''
570 d_isfinite=''
571 d_isinf=''
572 d_isnan=''
573 d_isnanl=''
574 d_killpg=''
575 d_lchown=''
576 d_ldbl_dig=''
577 d_libm_lib_version=''
578 d_link=''
579 d_localtime_r=''
580 d_localtime_r_needs_tzset=''
581 localtime_r_proto=''
582 d_locconv=''
583 d_lockf=''
584 d_longdbl=''
585 longdblsize=''
586 d_longlong=''
587 longlongsize=''
588 d_lseekproto=''
589 d_lstat=''
590 d_madvise=''
591 d_malloc_good_size=''
592 d_malloc_size=''
593 d_mblen=''
594 d_mbstowcs=''
595 d_mbtowc=''
596 d_memchr=''
597 d_memcmp=''
598 d_memcpy=''
599 d_memmove=''
600 d_memset=''
601 d_mkdir=''
602 d_mkdtemp=''
603 d_mkfifo=''
604 d_mkstemp=''
605 d_mkstemps=''
606 d_mktime=''
607 d_mmap=''
608 mmaptype=''
609 d_modfl=''
610 d_modfl_pow32_bug=''
611 d_modflproto=''
612 d_mprotect=''
613 d_msg=''
614 d_msgctl=''
615 d_msgget=''
616 d_msghdr_s=''
617 d_msgrcv=''
618 d_msgsnd=''
619 d_msync=''
620 d_munmap=''
621 d_nice=''
622 d_nl_langinfo=''
623 d_off64_t=''
624 d_open3=''
625 d_fpathconf=''
626 d_pathconf=''
627 d_pause=''
628 d_pipe=''
629 d_poll=''
630 d_portable=''
631 d_prctl=''
632 d_prctl_set_name=''
633 d_procselfexe=''
634 procselfexe=''
635 d_old_pthread_create_joinable=''
636 old_pthread_create_joinable=''
637 d_pthread_atfork=''
638 d_pthread_attr_setscope=''
639 d_pthread_yield=''
640 d_sched_yield=''
641 sched_yield=''
642 d_qgcvt=''
643 d_random_r=''
644 random_r_proto=''
645 d_readdir64_r=''
646 readdir64_r_proto=''
647 d_readdir=''
648 d_rewinddir=''
649 d_seekdir=''
650 d_telldir=''
651 d_readdir_r=''
652 readdir_r_proto=''
653 d_readlink=''
654 d_readv=''
655 d_recvmsg=''
656 d_rename=''
657 d_rmdir=''
658 d_safebcpy=''
659 d_safemcpy=''
660 d_sanemcmp=''
661 d_sbrkproto=''
662 d_scalbnl=''
663 d_select=''
664 d_sem=''
665 d_semctl=''
666 d_semget=''
667 d_semop=''
668 d_sendmsg=''
669 d_setegid=''
670 d_seteuid=''
671 d_setgrent=''
672 d_setgrent_r=''
673 setgrent_r_proto=''
674 d_setgrps=''
675 d_sethent=''
676 d_sethostent_r=''
677 sethostent_r_proto=''
678 d_setitimer=''
679 d_setlinebuf=''
680 d_setlocale=''
681 d_setlocale_r=''
682 setlocale_r_proto=''
683 d_setnent=''
684 d_setnetent_r=''
685 setnetent_r_proto=''
686 d_setpent=''
687 d_setpgid=''
688 d_setpgrp2=''
689 d_bsdsetpgrp=''
690 d_setpgrp=''
691 d_setprior=''
692 d_setproctitle=''
693 d_setprotoent_r=''
694 setprotoent_r_proto=''
695 d_setpwent=''
696 d_setpwent_r=''
697 setpwent_r_proto=''
698 d_setregid=''
699 d_setresgid=''
700 d_setresuid=''
701 d_setreuid=''
702 d_setrgid=''
703 d_setruid=''
704 d_setsent=''
705 d_setservent_r=''
706 setservent_r_proto=''
707 d_setsid=''
708 d_setvbuf=''
709 d_sfio=''
710 usesfio=''
711 d_shm=''
712 d_shmat=''
713 d_shmatprototype=''
714 shmattype=''
715 d_shmctl=''
716 d_shmdt=''
717 d_shmget=''
718 d_sigaction=''
719 d_signbit=''
720 d_sigprocmask=''
721 d_sigsetjmp=''
722 usesitecustomize=''
723 d_snprintf=''
724 d_vsnprintf=''
725 d_sockatmark=''
726 d_sockatmarkproto=''
727 d_ip_mreq=''
728 d_ip_mreq_source=''
729 d_ipv6_mreq=''
730 d_ipv6_mreq_source=''
731 d_msg_ctrunc=''
732 d_msg_dontroute=''
733 d_msg_oob=''
734 d_msg_peek=''
735 d_msg_proxy=''
736 d_oldsock=''
737 d_scm_rights=''
738 d_sin6_scope_id=''
739 d_sockaddr_in6=''
740 d_sockaddr_sa_len=''
741 d_socket=''
742 d_sockpair=''
743 sockethdr=''
744 socketlib=''
745 d_socklen_t=''
746 d_socks5_init=''
747 d_sprintf_returns_strlen=''
748 d_sqrtl=''
749 d_srand48_r=''
750 srand48_r_proto=''
751 d_srandom_r=''
752 srandom_r_proto=''
753 d_sresgproto=''
754 d_sresuproto=''
755 d_statblks=''
756 d_statfs_f_flags=''
757 d_statfs_s=''
758 d_static_inline=''
759 perl_static_inline=''
760 d_fstatvfs=''
761 d_statvfs=''
762 d_stdio_cnt_lval=''
763 d_stdio_ptr_lval=''
764 d_stdio_ptr_lval_nochange_cnt=''
765 d_stdio_ptr_lval_sets_cnt=''
766 d_stdiobase=''
767 d_stdstdio=''
768 stdio_base=''
769 stdio_bufsiz=''
770 stdio_cnt=''
771 stdio_filbuf=''
772 stdio_ptr=''
773 d_index=''
774 d_strchr=''
775 d_strcoll=''
776 d_strctcpy=''
777 d_strerrm=''
778 d_strerror=''
779 d_sysernlst=''
780 d_syserrlst=''
781 d_strerror_r=''
782 strerror_r_proto=''
783 d_strftime=''
784 d_strlcat=''
785 d_strlcpy=''
786 d_strtod=''
787 d_strtol=''
788 d_strtold=''
789 d_strtoll=''
790 d_strtoq=''
791 d_strtoul=''
792 d_strtoull=''
793 d_strtouq=''
794 d_strxfrm=''
795 d_symlink=''
796 d_syscall=''
797 d_syscallproto=''
798 d_sysconf=''
799 d_system=''
800 d_tcgetpgrp=''
801 d_tcsetpgrp=''
802 d_telldirproto=''
803 d_time=''
804 timetype=''
805 d_asctime64=''
806 d_ctime64=''
807 d_difftime64=''
808 d_gmtime64=''
809 d_localtime64=''
810 d_mktime64=''
811 d_timegm=''
812 clocktype=''
813 d_times=''
814 d_tmpnam_r=''
815 tmpnam_r_proto=''
816 d_truncate=''
817 d_ttyname_r=''
818 ttyname_r_proto=''
819 d_tzname=''
820 d_u32align=''
821 d_ualarm=''
822 d_umask=''
823 d_semctl_semid_ds=''
824 d_semctl_semun=''
825 d_union_semun=''
826 d_unordered=''
827 d_unsetenv=''
828 d_usleep=''
829 d_usleepproto=''
830 d_ustat=''
831 d_pseudofork=''
832 d_vfork=''
833 usevfork=''
834 d_voidsig=''
835 signal_t=''
836 d_volatile=''
837 d_charvspr=''
838 d_vprintf=''
839 d_wait4=''
840 d_waitpid=''
841 d_wcstombs=''
842 d_wctomb=''
843 d_writev=''
844 dlext=''
845 bin_ELF=''
846 cccdlflags=''
847 ccdlflags=''
848 dlsrc=''
849 ld=''
850 ld_can_script=''
851 lddlflags=''
852 usedl=''
853 doublesize=''
854 bootstrap_charset=''
855 ebcdic=''
856 fflushNULL=''
857 fflushall=''
858 fpossize=''
859 fpostype=''
860 gccansipedantic=''
861 gccosandvers=''
862 gccversion=''
863 gidformat=''
864 gidsign=''
865 gidsize=''
866 gidtype=''
867 groupstype=''
868 h_fcntl=''
869 h_sysfile=''
870 html1dir=''
871 html1direxp=''
872 installhtml1dir=''
873 html3dir=''
874 html3direxp=''
875 installhtml3dir=''
876 i_arpainet=''
877 i_assert=''
878 i_crypt=''
879 db_hashtype=''
880 db_prefixtype=''
881 db_version_major=''
882 db_version_minor=''
883 db_version_patch=''
884 i_db=''
885 i_dbm=''
886 i_rpcsvcdbm=''
887 d_dirnamlen=''
888 direntrytype=''
889 i_dirent=''
890 i_dlfcn=''
891 i_fcntl=''
892 i_float=''
893 i_fp=''
894 i_fp_class=''
895 i_gdbm=''
896 d_grpasswd=''
897 i_grp=''
898 i_ieeefp=''
899 i_inttypes=''
900 i_langinfo=''
901 i_libutil=''
902 i_limits=''
903 i_locale=''
904 i_machcthr=''
905 i_malloc=''
906 i_mallocmalloc=''
907 i_math=''
908 i_memory=''
909 i_mntent=''
910 d_gdbm_ndbm_h_uses_prototypes=''
911 d_gdbmndbm_h_uses_prototypes=''
912 d_ndbm=''
913 d_ndbm_h_uses_prototypes=''
914 i_gdbm_ndbm=''
915 i_gdbmndbm=''
916 i_ndbm=''
917 i_netdb=''
918 i_neterrno=''
919 i_netinettcp=''
920 i_niin=''
921 i_sysin=''
922 i_poll=''
923 i_prot=''
924 i_pthread=''
925 d_pwage=''
926 d_pwchange=''
927 d_pwclass=''
928 d_pwcomment=''
929 d_pwexpire=''
930 d_pwgecos=''
931 d_pwpasswd=''
932 d_pwquota=''
933 i_pwd=''
934 i_sfio=''
935 i_shadow=''
936 i_socks=''
937 i_stdbool=''
938 i_stddef=''
939 i_stdlib=''
940 i_string=''
941 strings=''
942 i_sunmath=''
943 i_sysaccess=''
944 i_sysdir=''
945 i_sysfile=''
946 d_voidtty=''
947 i_bsdioctl=''
948 i_sysfilio=''
949 i_sysioctl=''
950 i_syssockio=''
951 i_syslog=''
952 i_sysmman=''
953 i_sysmode=''
954 i_sysmount=''
955 i_sysndir=''
956 i_sysparam=''
957 i_syspoll=''
958 i_sysresrc=''
959 i_syssecrt=''
960 i_sysselct=''
961 i_sysstat=''
962 i_sysstatfs=''
963 i_sysstatvfs=''
964 i_systimes=''
965 i_systypes=''
966 i_sysuio=''
967 i_sysun=''
968 i_sysutsname=''
969 i_sysvfs=''
970 i_syswait=''
971 i_sgtty=''
972 i_termio=''
973 i_termios=''
974 d_tm_tm_gmtoff=''
975 d_tm_tm_zone=''
976 i_systime=''
977 i_systimek=''
978 i_time=''
979 timeincl=''
980 i_unistd=''
981 i_ustat=''
982 i_utime=''
983 i_values=''
984 i_stdarg=''
985 i_varargs=''
986 i_varhdr=''
987 i_vfork=''
988 d_inc_version_list=''
989 inc_version_list=''
990 inc_version_list_init=''
991 installprefix=''
992 installprefixexp=''
993 installstyle=''
994 installusrbinperl=''
995 intsize=''
996 longsize=''
997 shortsize=''
998 issymlink=''
999 libc=''
1000 ldlibpthname=''
1001 libperl=''
1002 shrpenv=''
1003 useshrplib=''
1004 glibpth=''
1005 libpth=''
1006 loclibpth=''
1007 plibpth=''
1008 xlibpth=''
1009 ignore_versioned_solibs=''
1010 libs=''
1011 libsdirs=''
1012 libsfiles=''
1013 libsfound=''
1014 libspath=''
1015 lns=''
1016 d_PRIEUldbl=''
1017 d_PRIFUldbl=''
1018 d_PRIGUldbl=''
1019 d_PRIeldbl=''
1020 d_PRIfldbl=''
1021 d_PRIgldbl=''
1022 d_SCNfldbl=''
1023 sPRIEUldbl=''
1024 sPRIFUldbl=''
1025 sPRIGUldbl=''
1026 sPRIeldbl=''
1027 sPRIfldbl=''
1028 sPRIgldbl=''
1029 sSCNfldbl=''
1030 lseeksize=''
1031 lseektype=''
1032 mad=''
1033 madlyh=''
1034 madlyobj=''
1035 madlysrc=''
1036 make_set_make=''
1037 d_mymalloc=''
1038 freetype=''
1039 mallocobj=''
1040 mallocsrc=''
1041 malloctype=''
1042 usemallocwrap=''
1043 usemymalloc=''
1044 installman1dir=''
1045 man1dir=''
1046 man1direxp=''
1047 man1ext=''
1048 installman3dir=''
1049 man3dir=''
1050 man3direxp=''
1051 man3ext=''
1052 modetype=''
1053 multiarch=''
1054 mydomain=''
1055 myhostname=''
1056 phostname=''
1057 c=''
1058 n=''
1059 d_eofnblk=''
1060 eagain=''
1061 o_nonblock=''
1062 rd_nodata=''
1063 need_va_copy=''
1064 netdb_hlen_type=''
1065 netdb_host_type=''
1066 netdb_name_type=''
1067 netdb_net_type=''
1068 groupcat=''
1069 hostcat=''
1070 passcat=''
1071 orderlib=''
1072 ranlib=''
1073 d_perl_otherlibdirs=''
1074 otherlibdirs=''
1075 package=''
1076 spackage=''
1077 pager=''
1078 api_revision=''
1079 api_subversion=''
1080 api_version=''
1081 api_versionstring=''
1082 patchlevel=''
1083 perl_patchlevel=''
1084 revision=''
1085 subversion=''
1086 version=''
1087 version_patchlevel_string=''
1088 perl5=''
1089 perladmin=''
1090 perlpath=''
1091 d_nv_preserves_uv=''
1092 d_nv_zero_is_allbits_zero=''
1093 i16size=''
1094 i16type=''
1095 i32size=''
1096 i32type=''
1097 i64size=''
1098 i64type=''
1099 i8size=''
1100 i8type=''
1101 ivsize=''
1102 ivtype=''
1103 nv_overflows_integers_at=''
1104 nv_preserves_uv_bits=''
1105 nvsize=''
1106 nvtype=''
1107 u16size=''
1108 u16type=''
1109 u32size=''
1110 u32type=''
1111 u64size=''
1112 u64type=''
1113 u8size=''
1114 u8type=''
1115 uvsize=''
1116 uvtype=''
1117 ivdformat=''
1118 nvEUformat=''
1119 nvFUformat=''
1120 nvGUformat=''
1121 nveformat=''
1122 nvfformat=''
1123 nvgformat=''
1124 uvXUformat=''
1125 uvoformat=''
1126 uvuformat=''
1127 uvxformat=''
1128 pidtype=''
1129 prefix=''
1130 prefixexp=''
1131 installprivlib=''
1132 privlib=''
1133 privlibexp=''
1134 prototype=''
1135 ptrsize=''
1136 d_PRIXU64=''
1137 d_PRId64=''
1138 d_PRIi64=''
1139 d_PRIo64=''
1140 d_PRIu64=''
1141 d_PRIx64=''
1142 sPRIXU64=''
1143 sPRId64=''
1144 sPRIi64=''
1145 sPRIo64=''
1146 sPRIu64=''
1147 sPRIx64=''
1148 d_quad=''
1149 quadkind=''
1150 quadtype=''
1151 uquadtype=''
1152 drand01=''
1153 randbits=''
1154 randfunc=''
1155 randseedtype=''
1156 seedfunc=''
1157 installscript=''
1158 scriptdir=''
1159 scriptdirexp=''
1160 selectminbits=''
1161 selecttype=''
1162 sh=''
1163 sig_count=''
1164 sig_name=''
1165 sig_name_init=''
1166 sig_num=''
1167 sig_num_init=''
1168 sig_size=''
1169 d_sitearch=''
1170 installsitearch=''
1171 sitearch=''
1172 sitearchexp=''
1173 installsitebin=''
1174 sitebin=''
1175 sitebinexp=''
1176 installsitehtml1dir=''
1177 sitehtml1dir=''
1178 sitehtml1direxp=''
1179 installsitehtml3dir=''
1180 sitehtml3dir=''
1181 sitehtml3direxp=''
1182 installsitelib=''
1183 sitelib=''
1184 sitelib_stem=''
1185 sitelibexp=''
1186 installsiteman1dir=''
1187 siteman1dir=''
1188 siteman1direxp=''
1189 installsiteman3dir=''
1190 siteman3dir=''
1191 siteman3direxp=''
1192 siteprefix=''
1193 siteprefixexp=''
1194 installsitescript=''
1195 sitescript=''
1196 sitescriptexp=''
1197 sizesize=''
1198 sizetype=''
1199 so=''
1200 socksizetype=''
1201 sharpbang=''
1202 shsharp=''
1203 spitshell=''
1204 src=''
1205 ssizetype=''
1206 st_ino_sign=''
1207 st_ino_size=''
1208 startperl=''
1209 startsh=''
1210 stdchar=''
1211 d_stdio_stream_array=''
1212 stdio_stream_array=''
1213 sysman=''
1214 sGMTIME_max=''
1215 sGMTIME_min=''
1216 sLOCALTIME_max=''
1217 sLOCALTIME_min=''
1218 trnl=''
1219 uidformat=''
1220 uidsign=''
1221 uidsize=''
1222 uidtype=''
1223 archname64=''
1224 use64bitall=''
1225 use64bitint=''
1226 dtrace=''
1227 usedtrace=''
1228 usefaststdio=''
1229 usekernprocpathname=''
1230 ccflags_uselargefiles=''
1231 ldflags_uselargefiles=''
1232 libswanted_uselargefiles=''
1233 uselargefiles=''
1234 uselongdouble=''
1235 usemorebits=''
1236 usemultiplicity=''
1237 nm_opt=''
1238 nm_so_opt=''
1239 runnm=''
1240 usenm=''
1241 usensgetexecutablepath=''
1242 useperlio=''
1243 usesocks=''
1244 d_oldpthreads=''
1245 use5005threads=''
1246 useithreads=''
1247 usereentrant=''
1248 usethreads=''
1249 incpath=''
1250 mips_type=''
1251 usrinc=''
1252 vaproto=''
1253 d_vendorarch=''
1254 installvendorarch=''
1255 vendorarch=''
1256 vendorarchexp=''
1257 d_vendorbin=''
1258 installvendorbin=''
1259 vendorbin=''
1260 vendorbinexp=''
1261 installvendorhtml1dir=''
1262 vendorhtml1dir=''
1263 vendorhtml1direxp=''
1264 installvendorhtml3dir=''
1265 vendorhtml3dir=''
1266 vendorhtml3direxp=''
1267 d_vendorlib=''
1268 installvendorlib=''
1269 vendorlib=''
1270 vendorlib_stem=''
1271 vendorlibexp=''
1272 installvendorman1dir=''
1273 vendorman1dir=''
1274 vendorman1direxp=''
1275 installvendorman3dir=''
1276 vendorman3dir=''
1277 vendorman3direxp=''
1278 usevendorprefix=''
1279 vendorprefix=''
1280 vendorprefixexp=''
1281 d_vendorscript=''
1282 installvendorscript=''
1283 vendorscript=''
1284 vendorscriptexp=''
1285 versiononly=''
1286 yacc=''
1287 yaccflags=''
1288 CONFIG=''
1289
1290 : Detect odd OSs
1291 define='define'
1292 undef='undef'
1293 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1294 rmlist=''
1295
1296 : We must find out about Eunice early
1297 eunicefix=':'
1298 if test -f /etc/unixtovms; then
1299         eunicefix=/etc/unixtovms
1300 fi
1301 if test -f /etc/unixtovms.exe; then
1302         eunicefix=/etc/unixtovms.exe
1303 fi
1304
1305 : Set executable suffix now -- needed before hints available
1306 if test -f "/libs/version.library"; then
1307 : Amiga OS
1308     _exe=""
1309 elif test -f "/system/gnu_library/bin/ar.pm"; then
1310 : Stratus VOS
1311     _exe=".pm"
1312 elif test -n "$DJGPP"; then
1313 : DOS DJGPP
1314     _exe=".exe"
1315 elif test -f /kern/cookiejar; then
1316 : MiNT
1317     _exe=""
1318 elif test -d c:/. -o -n "$is_os2" ; then
1319 : OS/2 or cygwin
1320     _exe=".exe"
1321 fi
1322
1323 groupstype=''
1324 i_whoami=''
1325 : Trailing extension.  Override this in a hint file, if needed.
1326 : Extra object files, if any, needed on this platform.
1327 archobjs=''
1328 archname=''
1329 : Possible local include directories to search.
1330 : Set locincpth to "" in a hint file to defeat local include searches.
1331 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1332 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1333 :
1334 : no include file wanted by default
1335 inclwanted=''
1336
1337 : Enable -DEBUGGING and -DDEBUGGING from the command line
1338 EBUGGING=''
1339 DEBUGGING=''
1340
1341 libnames=''
1342 : change the next line if compiling for Xenix/286 on Xenix/386
1343 xlibpth='/usr/lib/386 /lib/386'
1344 : Possible local library directories to search.
1345 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1346 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1347
1348 : general looking path for locating libraries
1349 glibpth="/lib /usr/lib $xlibpth"
1350 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1351 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1352 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1353 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1354
1355 : Private path used by Configure to find libraries.  Its value
1356 : is prepended to libpth. This variable takes care of special
1357 : machines, like the mips.  Usually, it should be empty.
1358 plibpth=''
1359
1360 : default library list
1361 libswanted=''
1362 : some systems want to use only the non-versioned libso:s
1363 ignore_versioned_solibs=''
1364 : set usethreads on the Configure command line to enable threads.
1365 usereentrant='undef'
1366 ccname=''
1367 ccversion=''
1368 perllibs=''
1369 : set useposix=false in your hint file to disable the POSIX extension.
1370 useposix=true
1371 : set useopcode=false in your hint file to disable the Opcode extension.
1372 useopcode=true
1373 archname64=''
1374 ccflags_uselargefiles=''
1375 ldflags_uselargefiles=''
1376 libswanted_uselargefiles=''
1377 : set usemultiplicity on the Configure command line to enable multiplicity.
1378 : set usesocks on the Configure command line to enable socks.
1379 : List of libraries we want.
1380 : If anyone needs extra -lxxx, put those in a hint file.
1381 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
1382 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1383 : We probably want to search /usr/shlib before most other libraries.
1384 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1385 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1386 glibpth="/usr/shlib $glibpth"
1387 : Do not use vfork unless overridden by a hint file.
1388 usevfork=false
1389
1390 : Find the basic shell for Bourne shell scripts
1391 case "$sh" in
1392 '')
1393         case "$SYSTYPE" in
1394         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1395         *) xxx='/bin/sh';;
1396         esac
1397         if test -f "$xxx"; then
1398                 sh="$xxx"
1399         else
1400                 : Build up a list and do a single loop so we can 'break' out.
1401                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1402                 for xxx in sh bash ksh pdksh ash; do
1403                         for p in $pth; do
1404                                 try="$try ${p}/${xxx}"
1405                         done
1406                 done
1407                 for xxx in $try; do
1408                         if test -f "$xxx"; then
1409                                 sh="$xxx";
1410                                 break
1411                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1412                                 sh="$xxx";
1413                                 break
1414                         elif test -f "$xxx.exe"; then
1415                                 sh="$xxx";
1416                                 break
1417                         fi
1418                 done
1419         fi
1420         ;;
1421 esac
1422
1423 case "$sh" in
1424 '')     cat >&2 <<EOM
1425 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.
1426
1427 Usually it's in /bin/sh.  How did you even get this far?
1428 Please contact me (Perl Maintainers) at perlbug@perl.org and
1429 we'll try to straighten this all out.
1430 EOM
1431         exit 1
1432         ;;
1433 esac
1434
1435 : see if sh knows # comments
1436 if `$sh -c '#' >/dev/null 2>&1`; then
1437         shsharp=true
1438         spitshell=cat
1439         xcat=/bin/cat
1440         test -f $xcat$_exe || xcat=/usr/bin/cat
1441         if test ! -f $xcat$_exe; then
1442                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1443                         if test -f $p/cat$_exe; then
1444                                 xcat=$p/cat
1445                                 break
1446                         fi
1447                 done
1448                 if test ! -f $xcat$_exe; then
1449                         echo "Can't find cat anywhere!"
1450                         exit 1
1451                 fi
1452         fi
1453         echo "#!$xcat" >sharp
1454         $eunicefix sharp
1455         chmod +x sharp
1456         ./sharp > today 2>/dev/null
1457         if test -s today; then
1458                 sharpbang='#!'
1459         else
1460                 echo "#! $xcat" > sharp
1461                 $eunicefix sharp
1462                 chmod +x sharp
1463                 ./sharp > today 2>/dev/null
1464                 if test -s today; then
1465                         sharpbang='#! '
1466                 else
1467                         sharpbang=': use '
1468                 fi
1469         fi
1470 else
1471         echo " "
1472         echo "Your $sh doesn't grok # comments--I will strip them later on."
1473         shsharp=false
1474         cd ..
1475         echo "exec grep -v '^[  ]*#'" >spitshell
1476         chmod +x spitshell
1477         $eunicefix spitshell
1478         spitshell=`pwd`/spitshell
1479         cd UU
1480         echo "I presume that if # doesn't work, #! won't work either!"
1481         sharpbang=': use '
1482 fi
1483 rm -f sharp today
1484
1485 : figure out how to guarantee sh startup
1486 case "$startsh" in
1487 '') startsh=${sharpbang}${sh} ;;
1488 *)
1489 esac
1490 cat >sharp <<EOSS
1491 $startsh
1492 set abc
1493 test "$?abc" != 1
1494 EOSS
1495
1496 chmod +x sharp
1497 $eunicefix sharp
1498 if ./sharp; then
1499         : echo "Yup, it does."
1500 else
1501         echo "Hmm... '$startsh' does not guarantee sh startup..."
1502         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1503 fi
1504 rm -f sharp
1505
1506 : Save command line options in file UU/cmdline.opt for later use in
1507 : generating config.sh.
1508 cat > cmdline.opt <<EOSH
1509 : Configure command line arguments.
1510 config_arg0='$0'
1511 config_args='$*'
1512 config_argc=$#
1513 EOSH
1514 argn=1
1515 args_exp=''
1516 args_sep=''
1517 for arg in "$@"; do
1518         cat >>cmdline.opt <<EOSH
1519 config_arg$argn='$arg'
1520 EOSH
1521         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1522 $arg
1523 EOC
1524         arg_exp=`cat cmdl.opt`
1525         args_exp="$args_exp$args_sep'$arg_exp'"
1526         argn=`expr $argn + 1`
1527         args_sep=' '
1528 done
1529 rm -f cmdl.opt
1530
1531 : produce awk script to parse command line options
1532 cat >options.awk <<'EOF'
1533 BEGIN {
1534         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1535
1536         len = length(optstr);
1537         for (i = 1; i <= len; i++) {
1538                 c = substr(optstr, i, 1);
1539                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1540                 if (a == ":") {
1541                         arg[c] = 1;
1542                         i++;
1543                 }
1544                 opt[c] = 1;
1545         }
1546 }
1547 {
1548         expect = 0;
1549         str = $0;
1550         if (substr(str, 1, 1) != "-") {
1551                 printf("'%s'\n", str);
1552                 next;
1553         }
1554         len = length($0);
1555         for (i = 2; i <= len; i++) {
1556                 c = substr(str, i, 1);
1557                 if (!opt[c]) {
1558                         printf("-%s\n", substr(str, i));
1559                         next;
1560                 }
1561                 printf("-%s\n", c);
1562                 if (arg[c]) {
1563                         if (i < len)
1564                                 printf("'%s'\n", substr(str, i + 1));
1565                         else
1566                                 expect = 1;
1567                         next;
1568                 }
1569         }
1570 }
1571 END {
1572         if (expect)
1573                 print "?";
1574 }
1575 EOF
1576
1577 : process the command line options
1578 set X `for arg in "$@"; do echo "X$arg"; done |
1579         sed -e s/X// | awk -f options.awk`
1580 eval "set $*"
1581 shift
1582 rm -f options.awk
1583
1584 : set up default values
1585 fastread=''
1586 reuseval=false
1587 config_sh=''
1588 alldone=''
1589 error=''
1590 silent=''
1591 extractsh=''
1592 override=''
1593 knowitall=''
1594 rm -f optdef.sh posthint.sh
1595 cat >optdef.sh <<EOS
1596 $startsh
1597 EOS
1598
1599
1600 : option parsing
1601 while test $# -gt 0; do
1602         case "$1" in
1603         -d) shift; fastread=yes;;
1604         -e) shift; alldone=cont;;
1605         -f)
1606                 shift
1607                 cd ..
1608                 if test -r "$1"; then
1609                         config_sh="$1"
1610                 else
1611                         echo "$me: cannot read config file $1." >&2
1612                         error=true
1613                 fi
1614                 cd UU
1615                 shift;;
1616         --help|\
1617         -h) shift; error=true;;
1618         -r) shift; reuseval=true;;
1619         -s) shift; silent=true; realsilent=true;;
1620         -E) shift; alldone=exit;;
1621         -K) shift; knowitall=true;;
1622         -O) shift; override=true;;
1623         -S) shift; silent=true; extractsh=true;;
1624         -D)
1625                 shift
1626                 case "$1" in
1627                 *=)
1628                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1629                         echo "$me: ignoring -D $1" >&2
1630                         ;;
1631                 *=*) echo "$1" | \
1632                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1633                 *) echo "$1='define'" >> optdef.sh;;
1634                 esac
1635                 shift
1636                 ;;
1637         -U)
1638                 shift
1639                 case "$1" in
1640                 *=) echo "$1" >> optdef.sh;;
1641                 *=*)
1642                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1643                         echo "$me: ignoring -U $1" >&2
1644                         ;;
1645                 *) echo "$1='undef'" >> optdef.sh;;
1646                 esac
1647                 shift
1648                 ;;
1649         -A)
1650             shift
1651             xxx=''
1652             yyy="$1"
1653             zzz=''
1654             uuu=undef
1655             case "$yyy" in
1656             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1657                  case "$zzz" in
1658                  *:*) zzz='' ;;
1659                  *)   xxx=append
1660                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1661                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1662                  esac
1663                  ;;
1664             esac
1665             case "$xxx" in
1666             '')  case "$yyy" in
1667                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1668                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1669                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1670                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1671                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1672                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1673                  esac
1674                  ;;
1675             esac
1676             case "$xxx" in
1677             append)
1678                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1679             clear)
1680                 echo "$yyy=''"                  >> posthint.sh ;;
1681             define)
1682                 case "$zzz" in
1683                 '') zzz=define ;;
1684                 esac
1685                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1686             eval)
1687                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1688             prepend)
1689                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1690             undef)
1691                 case "$zzz" in
1692                 '') zzz="$uuu" ;;
1693                 esac
1694                 echo "$yyy=$zzz"                >> posthint.sh ;;
1695             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1696             esac
1697             shift
1698             ;;
1699         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1700             exit 0;;
1701         --) break;;
1702         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1703         *) break;;
1704         esac
1705 done
1706
1707 case "$error" in
1708 true)
1709         cat >&2 <<EOM
1710 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1711                  [-U symbol] [-U symbol=] [-A command:symbol...]
1712   -d : use defaults for all answers.
1713   -e : go on without questioning past the production of config.sh.
1714   -f : specify an alternate default configuration file.
1715   -h : print this help message and exit (with an error status).
1716   -r : reuse C symbols value if possible (skips costly nm extraction).
1717   -s : silent mode, only echoes questions and essential information.
1718   -D : define symbol to have some value:
1719          -D symbol         symbol gets the value 'define'
1720          -D symbol=value   symbol gets the value 'value'
1721        common used examples (see INSTALL for more info):
1722          -Duse64bitint            use 64bit integers
1723          -Duse64bitall            use 64bit integers and pointers
1724          -Dusethreads             use thread support
1725          -Dinc_version_list=none  do not include older perl trees in @INC
1726          -DEBUGGING=none          DEBUGGING options
1727          -Dcc=gcc                 choose your compiler
1728          -Dprefix=/opt/perl5      choose your destination
1729   -E : stop at the end of questions, after having produced config.sh.
1730   -K : do not use unless you know what you are doing.
1731   -O : let -D and -U override definitions from loaded configuration file.
1732   -S : perform variable substitutions on all .SH files (can mix with -f)
1733   -U : undefine symbol:
1734          -U symbol    symbol gets the value 'undef'
1735          -U symbol=   symbol gets completely empty
1736        e.g.:  -Uversiononly
1737   -A : manipulate symbol after the platform specific hints have been applied:
1738          -A append:symbol=value   append value to symbol
1739          -A symbol=value          like append:, but with a separating space
1740          -A define:symbol=value   define symbol to have value
1741          -A clear:symbol          define symbol to be ''
1742          -A define:symbol         define symbol to be 'define'
1743          -A eval:symbol=value     define symbol to be eval of value
1744          -A prepend:symbol=value  prepend value to symbol
1745          -A undef:symbol          define symbol to be 'undef'
1746          -A undef:symbol=         define symbol to be ''
1747        e.g.:  -A prepend:libswanted='cl pthread '
1748               -A ccflags=-DSOME_MACRO
1749   -V : print version number and exit (with a zero status).
1750 EOM
1751         exit 1
1752         ;;
1753 esac
1754
1755 : Sanity checks
1756 case "$fastread$alldone" in
1757 yescont|yesexit) ;;
1758 *)
1759         case "$extractsh" in
1760         true) ;;
1761         *)
1762                 if test ! -t 0; then
1763                         echo "Say 'sh Configure', not 'sh <Configure'"
1764                         exit 1
1765                 fi
1766                 ;;
1767         esac
1768         ;;
1769 esac
1770
1771 exec 4>&1
1772 case "$silent" in
1773 true) exec 1>/dev/null;;
1774 esac
1775
1776 : run the defines and the undefines, if any, but leave the file out there...
1777 touch optdef.sh
1778 . ./optdef.sh
1779 : create the posthint manipulation script and leave the file out there...
1780 touch posthint.sh
1781
1782 : set package name
1783 package='perl5'
1784 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1785 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1786 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1787 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1788 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1789 esac
1790
1791 : Some greps do not return status, grrr.
1792 echo "grimblepritz" >grimble
1793 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1794         contains=contains
1795 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1796         contains=grep
1797 else
1798         contains=contains
1799 fi
1800 rm -f grimble
1801 : the following should work in any shell
1802 case "$contains" in
1803 contains*)
1804         echo " "
1805         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1806         cat >contains <<'EOSS'
1807 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1808 EOSS
1809 chmod +x contains
1810 esac
1811
1812 : Find the path to the source tree
1813 case "$src" in
1814 '') case "$0" in
1815     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1816          case "$src" in
1817          /*)    ;;
1818          .)     ;;
1819          *)     src=`cd ../$src && pwd` ;;
1820          esac
1821          ;;
1822     *)   src='.';;
1823     esac;;
1824 esac
1825 case "$src" in
1826 '')     src=/
1827         rsrc=/
1828         ;;
1829 /*)     rsrc="$src";;
1830 *)      rsrc="../$src";;
1831 esac
1832 if test -f $rsrc/Configure && \
1833         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1834 then
1835    : found it, so we are ok.
1836 else
1837         rsrc=''
1838         for src in . .. ../.. ../../.. ../../../..; do
1839                 if test -f ../$src/Configure && \
1840                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1841                 then
1842                         rsrc=../$src
1843                         break
1844                 fi
1845         done
1846 fi
1847 case "$rsrc" in
1848 '')
1849         cat <<EOM >&4
1850
1851 Sorry, I can't seem to locate the source dir for $package.  Please start
1852 Configure with an explicit path -- i.e. /some/path/Configure.
1853
1854 EOM
1855         exit 1
1856         ;;
1857 ../.)   rsrc='..';;
1858 *)
1859         echo " "
1860         echo "Sources for $package found in \"$src\"." >&4
1861         ;;
1862 esac
1863
1864 : script used to extract .SH files with variable substitutions
1865 cat >extract <<'EOS'
1866 PERL_CONFIG_SH=true
1867 echo "Doing variable substitutions on .SH files..."
1868 if test -f MANIFEST; then
1869         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1870 else
1871         echo "(Looking for .SH files under the source directory.)"
1872         set x `(cd "$src"; find . -name "*.SH" -print)`
1873 fi
1874 shift
1875 case $# in
1876 0) set x `(cd "$src"; echo *.SH)`; shift;;
1877 esac
1878 if test ! -f "$src/$1"; then
1879         shift
1880 fi
1881 mkdir_p='
1882 name=$1;
1883 create="";
1884 while test $name; do
1885         if test ! -d "$name"; then
1886                 create="$name $create";
1887                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1888                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1889         else
1890                 name="";
1891         fi;
1892 done;
1893 for file in $create; do
1894         mkdir $file;
1895 done
1896 '
1897 for file in $*; do
1898         case "$src" in
1899         ".")
1900                 case "$file" in
1901                 */*)
1902                         dir=`expr X$file : 'X\(.*\)/'`
1903                         file=`expr X$file : 'X.*/\(.*\)'`
1904                         (cd "$dir" && . ./$file)
1905                         ;;
1906                 *)
1907                         . ./$file
1908                         ;;
1909                 esac
1910                 ;;
1911         *)
1912                 case "$file" in
1913                 */*)
1914                         dir=`expr X$file : 'X\(.*\)/'`
1915                         file=`expr X$file : 'X.*/\(.*\)'`
1916                         (set x $dir; shift; eval $mkdir_p)
1917                         sh <"$src/$dir/$file"
1918                         ;;
1919                 *)
1920                         sh <"$src/$file"
1921                         ;;
1922                 esac
1923                 ;;
1924         esac
1925 done
1926 if test -f "$src/config_h.SH"; then
1927         if test ! -f config.h; then
1928         : oops, they left it out of MANIFEST, probably, so do it anyway.
1929         . "$src/config_h.SH"
1930         fi
1931 fi
1932 EOS
1933
1934 : extract files and exit if asked to do so
1935 case "$extractsh" in
1936 true)
1937         case "$realsilent" in
1938         true) ;;
1939         *) exec 1>&4;;
1940         esac
1941         case "$config_sh" in
1942         '') config_sh='config.sh';;
1943         esac
1944         echo " "
1945         echo "Fetching answers from $config_sh..."
1946         cd ..
1947         . $config_sh
1948         test "$override" && . ./optdef.sh
1949         echo " "
1950         . UU/extract
1951         rm -rf UU
1952         echo "Extraction done."
1953         exit 0
1954         ;;
1955 esac
1956
1957 : Eunice requires " " instead of "", can you believe it
1958 echo " "
1959 : Here we go...
1960 echo "Beginning of configuration questions for $package."
1961
1962 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1963
1964 : first determine how to suppress newline on echo command
1965 echo " "
1966 echo "Checking echo to see how to suppress newlines..."
1967 (echo "hi there\c" ; echo " ") >.echotmp
1968 if $contains c .echotmp >/dev/null 2>&1 ; then
1969         echo "...using -n."
1970         n='-n'
1971         c=''
1972 else
1973         cat <<'EOM'
1974 ...using \c
1975 EOM
1976         n=''
1977         c='\c'
1978 fi
1979 echo $n "The star should be here-->$c"
1980 echo '*'
1981 rm -f .echotmp
1982
1983 : Now test for existence of everything in MANIFEST
1984 echo " "
1985 if test -f "$rsrc/MANIFEST"; then
1986         echo "First let's make sure your kit is complete.  Checking..." >&4
1987         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1988                 (split -l 50 2>/dev/null || split -50)
1989         rm -f missing
1990         tmppwd=`pwd`
1991         for filelist in x??; do
1992                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1993                         >/dev/null 2>>"$tmppwd/missing")
1994         done
1995         if test -s missing; then
1996                 cat missing >&4
1997                 cat >&4 <<'EOM'
1998
1999 THIS PACKAGE SEEMS TO BE INCOMPLETE.
2000
2001 You have the option of continuing the configuration process, despite the
2002 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2003 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2004 and contact the author (perlbug@perl.org).
2005
2006 EOM
2007                 echo $n "Continue? [n] $c" >&4
2008                 read ans
2009                 case "$ans" in
2010                 y*)
2011                         echo "Continuing..." >&4
2012                         rm -f missing
2013                         ;;
2014                 *)
2015                         echo "ABORTING..." >&4
2016                         kill $$
2017                         ;;
2018                 esac
2019         else
2020                 echo "Looks good..."
2021         fi
2022 else
2023         echo "There is no MANIFEST file.  I hope your kit is complete !"
2024 fi
2025 rm -f missing x??
2026
2027 : Find the appropriate value for a newline for tr
2028 echo " "
2029 if test -n "$DJGPP"; then
2030        trnl='\012'
2031 fi
2032 if test X"$trnl" = X; then
2033         case "`echo foo|tr '\n' x 2>/dev/null`" in
2034         foox) trnl='\n' ;;
2035         esac
2036 fi
2037 if test X"$trnl" = X; then
2038         case "`echo foo|tr '\012' x 2>/dev/null`" in
2039         foox) trnl='\012' ;;
2040         esac
2041 fi
2042 if test X"$trnl" = X; then
2043        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2044        fooxy) trnl='\n\r' ;;
2045        esac
2046 fi
2047 if test X"$trnl" = X; then
2048         cat <<EOM >&2
2049
2050 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2051
2052 EOM
2053         exit 1
2054 fi
2055
2056 : compute the number of columns on the terminal for proper question formatting
2057 case "$COLUMNS" in
2058 '') COLUMNS='80';;
2059 esac
2060
2061 : set up the echo used in my read
2062 myecho="case \"\$xxxm\" in
2063 '') echo $n \"\$rp $c\" >&4;;
2064 *) case \"\$rp\" in
2065         '') echo $n \"[\$xxxm] $c\";;
2066         *)
2067                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2068                         echo \"\$rp\" >&4
2069                         echo $n \"[\$xxxm] $c\" >&4
2070                 else
2071                         echo $n \"\$rp [\$xxxm] $c\" >&4
2072                 fi
2073                 ;;
2074         esac;;
2075 esac"
2076
2077 : now set up to do reads with possible shell escape and default assignment
2078 cat <<EOSC >myread
2079 $startsh
2080 xxxm=\$dflt
2081 $myecho
2082 ans='!'
2083 case "\$fastread" in
2084 yes) case "\$dflt" in
2085         '') ;;
2086         *) ans='';
2087                 case "\$silent-\$rp" in
2088                 true-) ;;
2089                 *) echo " " >&4;;
2090                 esac;;
2091         esac;;
2092 *) case "\$silent" in
2093         true) case "\$rp" in
2094                 '') ans='';;
2095                 esac;;
2096         esac;;
2097 esac
2098 while expr "X\$ans" : "X!" >/dev/null; do
2099         read answ
2100         set x \$xxxm
2101         shift
2102         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2103         case  "\$answ" in
2104         "!")
2105                 sh 1>&4
2106                 echo " "
2107                 $myecho
2108                 ;;
2109         !*)
2110                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2111                 shift
2112                 sh 1>&4 -c "\$*"
2113                 echo " "
2114                 $myecho
2115                 ;;
2116         "\$ans")
2117                 case "\$ans" in
2118                 \\&*)
2119                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2120                         shift
2121                         case "\$1" in
2122                         -d)
2123                                 fastread=yes
2124                                 echo "(OK, I'll run with -d after this question.)" >&4
2125                                 ;;
2126                         -*)
2127                                 echo "*** Sorry, \$1 not supported yet." >&4
2128                                 ;;
2129                         esac
2130                         $myecho
2131                         ans=!
2132                         ;;
2133                 esac;;
2134         *)
2135                 case "\$aok" in
2136                 y)
2137                         echo "*** Substitution done -- please confirm."
2138                         xxxm="\$ans"
2139                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2140                         xxxm="\$ans"
2141                         ans=!
2142                         ;;
2143                 *)
2144                         echo "*** Error -- try again."
2145                         ans=!
2146                         ;;
2147                 esac
2148                 $myecho
2149                 ;;
2150         esac
2151         case "\$ans\$xxxm\$nostick" in
2152         '')
2153                 ans=!
2154                 $myecho
2155                 ;;
2156         esac
2157 done
2158 case "\$ans" in
2159 '') ans="\$xxxm";;
2160 esac
2161 EOSC
2162
2163 : create .config dir to save info across Configure sessions
2164 test -d ../.config || mkdir ../.config
2165 cat >../.config/README <<EOF
2166 This directory created by Configure to save information that should
2167 persist across sessions for $package.
2168
2169 You may safely delete it if you wish.
2170 EOF
2171
2172 : See if we are using a devel version and want that
2173 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2174 case "$usedevel" in
2175 $define|true|[yY]*)
2176     usedevel="$define" ;;
2177 *) case "$xversion" in
2178    *[13579])
2179         cat >&4 <<EOH
2180 *** WHOA THERE!!! ***
2181
2182     This is an UNSTABLE DEVELOPMENT release.
2183     The version of this $package distribution is $xversion, that is, odd,
2184     (as opposed to even) and that signifies a development release.
2185     If you want a maintenance release, you want an even-numbered version.
2186
2187     Do ***NOT*** install this into production use.
2188     Data corruption and crashes are possible.
2189
2190     It is most seriously suggested that you do not continue any further
2191     unless you want to help in developing and debugging Perl.
2192
2193     If you *still* want to build perl, you can answer 'y' now,
2194     or pass -Dusedevel to Configure.
2195
2196 EOH
2197         rp='Do you really want to continue?'
2198         dflt='n'
2199         . ./myread
2200         case "$ans" in
2201         [yY]) echo >&4 "Okay, continuing."
2202               usedevel="$define" ;;
2203         *) echo >&4 "Okay, bye."
2204            exit 1
2205            ;;
2206         esac
2207         ;;
2208     esac
2209     usedevel="$undef"
2210     ;;
2211 esac
2212 case "$usedevel" in
2213 $define|true|[yY]*)
2214         case "$versiononly" in
2215         '') versiononly="$define" ;;
2216         esac
2217         case "$installusrbinperl" in
2218         '') installusrbinperl="$undef" ;;
2219         esac
2220         ;;
2221 esac
2222
2223 : general instructions
2224 needman=true
2225 firsttime=true
2226 user=`(logname) 2>/dev/null`
2227 case "$user" in
2228 '') user=`whoami 2>&1`;;
2229 esac
2230 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2231         firsttime=false
2232         echo " "
2233         rp='Would you like to see the instructions?'
2234         dflt=n
2235         . ./myread
2236         case "$ans" in
2237         [yY]*) ;;
2238         *) needman=false;;
2239         esac
2240 fi
2241 if $needman; then
2242         cat <<EOH
2243
2244 This installation shell script will examine your system and ask you questions
2245 to determine how the perl5 package should be installed. If you get
2246 stuck on a question, you may use a ! shell escape to start a subshell or
2247 execute a command.  Many of the questions will have default answers in square
2248 brackets; typing carriage return will give you the default.
2249
2250 On some of the questions which ask for file or directory names you are allowed
2251 to use the ~name construct to specify the login directory belonging to "name",
2252 even if you don't have a shell which knows about that.  Questions where this is
2253 allowed will be marked "(~name ok)".
2254
2255 EOH
2256         rp=''
2257         dflt='Type carriage return to continue'
2258         . ./myread
2259         cat <<'EOH'
2260
2261 The prompter used in this script allows you to use shell variables and
2262 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2263 in the default answer, as if the default line was a set of arguments given to a
2264 script shell.  This means you may also use $* to repeat the whole default line,
2265 so you do not have to re-type everything to add something to the default.
2266
2267 Every time there is a substitution, you will have to confirm.  If there is an
2268 error (e.g. an unmatched backtick), the default answer will remain unchanged
2269 and you will be prompted again.
2270
2271 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2272 the questions and use the computed defaults (or the previous answers if there
2273 was already a config.sh file). Type 'Configure -h' for a list of options.
2274 You may also start interactively and then answer '& -d' at any prompt to turn
2275 on the non-interactive behaviour for the remainder of the execution.
2276
2277 EOH
2278         . ./myread
2279         cat <<EOH
2280
2281 Much effort has been expended to ensure that this shell script will run on any
2282 Unix system.  If despite that it blows up on yours, your best bet is to edit
2283 Configure and run it again.  If you can't run Configure for some reason,
2284 you'll have to generate a config.sh file by hand.  Whatever problems you
2285 have, let me (perlbug@perl.org) know how I blew it.
2286
2287 This installation script affects things in two ways:
2288
2289 1) it may do direct variable substitutions on some of the files included
2290    in this kit.
2291 2) it builds a config.h file for inclusion in C programs.  You may edit
2292    any of these files as the need arises after running this script.
2293
2294 If you make a mistake on a question, there is no easy way to back up to it
2295 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2296 files.  Configure will offer to let you do this before it runs the SH files.
2297
2298 EOH
2299         dflt='Type carriage return to continue'
2300         . ./myread
2301         case "$firsttime" in
2302         true) echo $user >>../.config/instruct;;
2303         esac
2304 fi
2305
2306 : find out where common programs are
2307 echo " "
2308 echo "Locating common programs..." >&4
2309 cat <<EOSC >loc
2310 $startsh
2311 case \$# in
2312 0) exit 1;;
2313 esac
2314 thing=\$1
2315 shift
2316 dflt=\$1
2317 shift
2318 for dir in \$*; do
2319         case "\$thing" in
2320         .)
2321         if test -d \$dir/\$thing; then
2322                 echo \$dir
2323                 exit 0
2324         fi
2325         ;;
2326         *)
2327         for thisthing in \$dir/\$thing; do
2328                 : just loop through to pick last item
2329         done
2330         if test -f \$thisthing; then
2331                 echo \$thisthing
2332                 exit 0
2333         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2334                 echo \$thisthing
2335                 exit 0
2336         elif test -f \$dir/\$thing.exe; then
2337                 if test -n "$DJGPP"; then
2338                         echo \$dir/\$thing.exe
2339                 elif test "$eunicefix" != ":"; then
2340                         : on Eunice apparently
2341                         echo \$dir/\$thing
2342                 fi
2343                 exit 0
2344         fi
2345         ;;
2346         esac
2347 done
2348 echo \$dflt
2349 exit 1
2350 EOSC
2351 chmod +x loc
2352 $eunicefix loc
2353 loclist="
2354 awk
2355 cat
2356 chmod
2357 comm
2358 cp
2359 echo
2360 expr
2361 grep
2362 ls
2363 mkdir
2364 rm
2365 sed
2366 sort
2367 touch
2368 tr
2369 uniq
2370 "
2371 trylist="
2372 ar
2373 bison
2374 byacc
2375 cpp
2376 csh
2377 date
2378 egrep
2379 gmake
2380 gzip
2381 less
2382 ln
2383 make
2384 more
2385 nm
2386 nroff
2387 perl
2388 pg
2389 test
2390 uname
2391 zip
2392 "
2393 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2394 pth="$pth /lib /usr/lib"
2395 for file in $loclist; do
2396         eval xxx=\$$file
2397         case "$xxx" in
2398         /*|?:[\\/]*)
2399                 if test -f "$xxx"; then
2400                         : ok
2401                 else
2402                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2403                         xxx=`./loc $file $file $pth`
2404                 fi
2405                 ;;
2406         '') xxx=`./loc $file $file $pth`;;
2407         *) xxx=`./loc $xxx $xxx $pth`;;
2408         esac
2409         eval $file=$xxx$_exe
2410         eval _$file=$xxx
2411         case "$xxx" in
2412         /*)
2413                 echo $file is in $xxx.
2414                 ;;
2415         ?:[\\/]*)
2416                 echo $file is in $xxx.
2417                 ;;
2418         *)
2419                 echo "I don't know where '$file' is, and my life depends on it." >&4
2420                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2421                 exit 1
2422                 ;;
2423         esac
2424 done
2425 echo " "
2426 echo "Don't worry if any of the following aren't found..."
2427 say=offhand
2428 for file in $trylist; do
2429         eval xxx=\$$file
2430         case "$xxx" in
2431         /*|?:[\\/]*)
2432                 if test -f "$xxx"; then
2433                         : ok
2434                 else
2435                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2436                         xxx=`./loc $file $file $pth`
2437                 fi
2438                 ;;
2439         '') xxx=`./loc $file $file $pth`;;
2440         *) xxx=`./loc $xxx $xxx $pth`;;
2441         esac
2442         eval $file=$xxx$_exe
2443         eval _$file=$xxx
2444         case "$xxx" in
2445         /*)
2446                 echo $file is in $xxx.
2447                 ;;
2448         ?:[\\/]*)
2449                 echo $file is in $xxx.
2450                 ;;
2451         *)
2452                 echo "I don't see $file out there, $say."
2453                 say=either
2454                 ;;
2455         esac
2456 done
2457 case "$egrep" in
2458 egrep)
2459         echo "Substituting grep for egrep."
2460         egrep=$grep
2461         _egrep=$grep
2462         ;;
2463 esac
2464 case "$less" in
2465 '')     ;;
2466 *)      if $less -R </dev/null >/dev/null; then
2467                echo "Substituting less -R for less."
2468                less="$less -R"
2469                _less=$less
2470         fi
2471         ;;
2472 esac
2473 case "$ln" in
2474 ln)
2475         echo "Substituting cp for ln."
2476         ln=$cp
2477         _ln=$cp
2478         ;;
2479 esac
2480 case "$make" in
2481 make)
2482         case "$gmake" in
2483         gmake)
2484         echo "I can't find make or gmake, and my life depends on it." >&4
2485         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2486         exit 1
2487         ;;
2488         esac
2489         ;;
2490 esac
2491 case "$gmake" in
2492 gmake)  ;;
2493 *)      # We can't have osname yet.
2494         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2495                 # Assume that gmake, if found, is definitely GNU make
2496                 # and prefer it over the system make.
2497                 echo "Substituting gmake for make."
2498                 make=$gmake
2499                 _make=$gmake
2500         fi
2501         ;;
2502 esac
2503 case "$test" in
2504 test)
2505         echo "Hopefully test is built into your sh."
2506         ;;
2507 *)
2508         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2509                 echo "Using the test built into your sh."
2510                 test=test
2511                 _test=test
2512         fi
2513         ;;
2514 esac
2515 case "$echo" in
2516 echo)
2517         echo "Hopefully echo is built into your sh."
2518         ;;
2519 '') ;;
2520 *)
2521         echo " "
2522 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2523         $echo $n "hi there$c" >foo1
2524         echo $n "hi there$c" >foo2
2525         if cmp foo1 foo2 >/dev/null 2>&1; then
2526                 echo "They are compatible.  In fact, they may be identical."
2527         else
2528                 case "$n" in
2529                 '-n') n='' c='\c';;
2530                 *) n='-n' c='';;
2531                 esac
2532                 cat <<FOO
2533 They are not compatible!  You are probably running ksh on a non-USG system.
2534 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2535 have echo built in and we may have to run some Bourne shell scripts.  That
2536 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2537
2538 FOO
2539                 $echo $n "The star should be here-->$c"
2540                 $echo "*"
2541         fi
2542         $rm -f foo1 foo2
2543         ;;
2544 esac
2545
2546 # This question was auctioned at YAPC::Europe-2007 in Vienna
2547 # I never promised you could answer it. I only auctioned the question.
2548 cat <<FOO
2549 The following message is sponsored by
2550
2551   Dresden.pm<--The stars should be here.
2552
2553 Dear Perl user, system administrator or package
2554 maintainer, the Perl community sends greetings to
2555 you. Do you (emblematical) greet back [Y/n]? n
2556
2557 FOO
2558
2559 : Check what type of C compiler we use
2560 cat <<EOS >trygcc
2561 $startsh
2562 EOS
2563 cat <<'EOSC' >>trygcc
2564 case "$cc" in
2565 '') ;;
2566 *)  $rm -f try try.*
2567     $cat >try.c <<EOM
2568 int main(int argc, char *argv[]) {
2569   return 0;
2570 }
2571 EOM
2572     if $cc -o try $ccflags $ldflags try.c; then
2573        :
2574     else
2575         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2576         despair=yes
2577         trygcc=yes
2578         case "$cc" in
2579         *gcc*) trygcc=no ;;
2580         esac
2581         # Skip this test because it gives a false match on output like:
2582         #    ./trygcc: line 23: cc: command not found
2583         # case "`$cc -v -c try.c 2>&1`" in
2584         # *gcc*) trygcc=no ;;
2585         # esac
2586         if $test X"$trygcc" = Xyes; then
2587             if gcc -o try -c try.c; then
2588                 echo " "
2589                 echo "You seem to have a working gcc, though." >&4
2590                 # Switching compilers may undo the work of hints files.
2591                 # The most common problem is -D_REENTRANT for threads.
2592                 # This heuristic catches that case, but gets false positives
2593                 # if -Dusethreads was not actually specified.  Better to
2594                 # bail out here with a useful message than fail 
2595                 # mysteriously later. Should we perhaps just try to
2596                 # re-invoke Configure -Dcc=gcc config_args ?
2597                 if $test -f usethreads.cbu; then
2598                         $cat >&4 <<EOM 
2599
2600 *** However, any setting of the C compiler flags (e.g. for thread support)
2601 *** will be lost.  It may be necessary for you to restart Configure and
2602 *** add -Dcc=gcc to your Configure command line.
2603
2604 EOM
2605                         rp="Would you like to go ahead and try gcc anyway?"
2606                         dflt=n
2607                 else
2608                         rp="Would you like to use it?"
2609                         dflt=y
2610                 fi
2611                 if $test -f myread; then
2612                     . ./myread
2613                 else
2614                     if $test -f UU/myread; then
2615                         . ./UU/myread
2616                     else
2617                         echo "Cannot find myread, sorry.  Aborting." >&2
2618                         exit 1
2619                     fi
2620                 fi  
2621                 case "$ans" in
2622                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2623                 esac
2624             fi
2625         fi
2626     fi
2627     $rm -f try try.*
2628     ;;
2629 esac
2630 EOSC
2631
2632 cat <<EOS >checkcc
2633 $startsh
2634 EOS
2635 cat <<'EOSC' >>checkcc
2636 case "$cc" in        
2637 '') ;;
2638 *)  $rm -f try try.*              
2639     $cat >try.c <<EOM
2640 int main(int argc, char *argv[]) {
2641   return 0;
2642 }
2643 EOM
2644     if $cc -o try $ccflags $ldflags try.c; then
2645        :
2646     else
2647         if $test X"$despair" = Xyes; then
2648            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2649         fi
2650         $cat >&4 <<EOM         
2651 You need to find a working C compiler.
2652 Either (purchase and) install the C compiler supplied by your OS vendor,
2653 or for a free C compiler try http://gcc.gnu.org/
2654 I cannot continue any further, aborting.
2655 EOM
2656         exit 1
2657     fi
2658     $rm -f try try.*
2659     ;;
2660 esac
2661 EOSC
2662
2663 : determine whether symbolic links are supported
2664 echo " "
2665 $touch blurfl
2666 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2667         echo "Symbolic links are supported." >&4
2668         lns="$ln -s"
2669 else
2670         echo "Symbolic links are NOT supported." >&4
2671         lns="$ln"
2672 fi
2673 $rm -f blurfl sym
2674
2675 : determine whether symbolic links are supported
2676 echo " "
2677 case "$lns" in
2678 *"ln"*" -s")
2679         echo "Checking how to test for symbolic links..." >&4
2680         $lns blurfl sym
2681         if $test "X$issymlink" = X; then
2682                 case "$newsh" in
2683                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2684                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2685                 esac
2686                 if test $? = 0; then
2687                         issymlink="test -h"
2688                 else
2689                         echo "Your builtin 'test -h' may be broken." >&4
2690                         case "$test" in
2691                         /*)     ;;
2692                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2693                                 for p in $pth
2694                                 do
2695                                         if test -f "$p/$test"; then
2696                                                 test="$p/$test"
2697                                                 break
2698                                         fi
2699                                 done
2700                                 ;;
2701                         esac
2702                         case "$test" in
2703                         /*)
2704                                 echo "Trying external '$test -h'." >&4
2705                                 issymlink="$test -h"
2706                                 if $test ! -h sym >/dev/null 2>&1; then
2707                                         echo "External '$test -h' is broken, too." >&4
2708                                         issymlink=''
2709                                 fi
2710                                 ;;
2711                         *)      issymlink='' ;;
2712                         esac
2713                 fi
2714         fi
2715         if $test "X$issymlink" = X; then
2716                 if $test -L sym 2>/dev/null; then
2717                         issymlink="$test -L"
2718                         echo "The builtin '$test -L' worked." >&4
2719                 fi
2720         fi
2721         if $test "X$issymlink" != X; then
2722                 echo "You can test for symbolic links with '$issymlink'." >&4
2723         else
2724                 echo "I do not know how you can test for symbolic links." >&4
2725         fi
2726         $rm -f blurfl sym
2727         ;;
2728 *)      echo "No symbolic links, so not testing for their testing..." >&4
2729         ;;
2730 esac
2731 echo " "
2732
2733 : Make symlinks util
2734 case "$mksymlinks" in
2735 $define|true|[yY]*)
2736         case "$src" in
2737         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2738                 exit 1
2739                 ;;
2740         *)      case "$lns:$issymlink" in
2741                 *"ln"*" -s:"*"test -"?)
2742                         echo "Creating the symbolic links..." >&4
2743                         echo "(First creating the subdirectories...)" >&4
2744                         cd ..
2745                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2746                                 read directory
2747                                 test -z "$directory" && break
2748                                 mkdir -p $directory
2749                         done
2750                         # Sanity check 1.
2751                         if test ! -d t/base; then
2752                                 echo "Failed to create the subdirectories.  Aborting." >&4
2753                                 exit 1
2754                         fi
2755                         echo "(Then creating the symlinks...)" >&4
2756                         awk '{print $1}' $src/MANIFEST | while true; do
2757                                 read filename
2758                                 test -z "$filename" && break
2759                                 if test -f $filename; then
2760                                         if $issymlink $filename; then
2761                                                 rm -f $filename
2762                                         fi
2763                                 fi
2764                                 if test -f $filename; then
2765                                         echo "$filename already exists, not symlinking."
2766                                 else
2767                                         ln -s $src/$filename $filename
2768                                 fi
2769                         done
2770                         # Sanity check 2.
2771                         if test ! -f t/base/lex.t; then
2772                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2773                                 exit 1
2774                         fi
2775                         cd UU
2776                         ;;
2777                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2778                         ;;
2779                 esac
2780                 ;;
2781         esac
2782         ;;
2783 esac
2784
2785 : Check for Cross-Compilation
2786 case "$usecrosscompile" in
2787 $define|true|[yY]*)
2788         $echo "Cross-compiling..."
2789         croak=''
2790         case "$cc" in
2791         *-*-gcc) # A cross-compiling gcc, probably.
2792             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2793             ar=$targetarch-ar
2794             # leave out ld, choosing it is more complex
2795             nm=$targetarch-nm
2796             ranlib=$targetarch-ranlib
2797             $echo 'extern int foo;' > try.c
2798             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2799             shift
2800             if $test $# -gt 0; then
2801                 incpth="$incpth $*"
2802                 incpth="`$echo $incpth|$sed 's/^ //'`"
2803                 echo "Guessing incpth '$incpth'." >&4
2804                 for i in $*; do
2805                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2806                     if $test -d $j; then
2807                         libpth="$libpth $j"
2808                     fi
2809                 done   
2810                 libpth="`$echo $libpth|$sed 's/^ //'`"
2811                 echo "Guessing libpth '$libpth'." >&4
2812             fi
2813             $rm -f try.c
2814             ;;
2815         esac
2816         case "$targetarch" in
2817         '') echo "Targetarch not defined." >&4; croak=y ;;
2818         *)  echo "Using targetarch $targetarch." >&4 ;;
2819         esac
2820         case "$incpth" in
2821         '') echo "Incpth not defined." >&4; croak=y ;;
2822         *)  echo "Using incpth '$incpth'." >&4 ;;
2823         esac
2824         case "$libpth" in
2825         '') echo "Libpth not defined." >&4; croak=y ;;
2826         *)  echo "Using libpth '$libpth'." >&4 ;;
2827         esac
2828         case "$usrinc" in
2829         '') for i in $incpth; do
2830                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2831                     usrinc=$i
2832                     echo "Guessing usrinc $usrinc." >&4
2833                     break
2834                 fi
2835             done
2836             case "$usrinc" in
2837             '') echo "Usrinc not defined." >&4; croak=y ;;
2838             esac
2839             ;;
2840         *)  echo "Using usrinc $usrinc." >&4 ;;
2841         esac
2842         case "$targethost" in
2843         '') echo "Targethost not defined." >&4; croak=y ;;
2844         *)  echo "Using targethost $targethost." >&4
2845         esac
2846         locincpth=' '
2847         loclibpth=' '
2848         case "$croak" in
2849         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2850         esac
2851         case "$src" in
2852         /*) run=$src/Cross/run
2853             targetmkdir=$src/Cross/mkdir
2854             to=$src/Cross/to
2855             from=$src/Cross/from
2856             ;;
2857         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2858             run=$pwd/Cross/run
2859             targetmkdir=$pwd/Cross/mkdir
2860             to=$pwd/Cross/to
2861             from=$pwd/Cross/from
2862             ;;
2863         esac
2864         case "$targetrun" in
2865         '') targetrun=ssh ;;
2866         esac
2867         case "$targetto" in
2868         '') targetto=scp ;;
2869         esac
2870         case "$targetfrom" in
2871         '') targetfrom=scp ;;
2872         esac
2873         run=$run-$targetrun
2874         to=$to-$targetto
2875         from=$from-$targetfrom
2876         case "$targetdir" in
2877         '')  targetdir=/tmp
2878              echo "Guessing targetdir $targetdir." >&4
2879              ;;
2880         esac
2881         case "$targetuser" in
2882         '')  targetuser=root
2883              echo "Guessing targetuser $targetuser." >&4
2884              ;;
2885         esac
2886         case "$targetfrom" in
2887         scp)    q=-q ;;
2888         *)      q='' ;;
2889         esac
2890         case "$targetrun" in
2891         ssh|rsh)
2892             cat >$run <<EOF
2893 #!/bin/sh
2894 case "\$1" in
2895 -cwd)
2896   shift
2897   cwd=\$1
2898   shift
2899   ;;
2900 esac
2901 case "\$cwd" in
2902 '') cwd=$targetdir ;;
2903 esac
2904 exe=\$1
2905 shift
2906 if $test ! -f \$exe.xok; then
2907   $to \$exe
2908   $touch \$exe.xok
2909 fi
2910 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2911 EOF
2912             ;;
2913         *)  echo "Unknown targetrun '$targetrun'" >&4
2914             exit 1
2915             ;;
2916         esac
2917         case "$targetmkdir" in
2918         */Cross/mkdir)
2919             cat >$targetmkdir <<EOF
2920 #!/bin/sh
2921 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2922 EOF
2923             $chmod a+rx $targetmkdir
2924             ;;
2925         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2926             exit 1
2927             ;;
2928         esac
2929         case "$targetto" in
2930         scp|rcp)
2931             cat >$to <<EOF
2932 #!/bin/sh
2933 for f in \$@
2934 do
2935   case "\$f" in
2936   /*)
2937     $targetmkdir \`dirname \$f\`
2938     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2939     ;;
2940   *)
2941     $targetmkdir $targetdir/\`dirname \$f\`
2942     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2943     ;;
2944   esac
2945 done
2946 exit 0
2947 EOF
2948             ;;
2949         cp) cat >$to <<EOF
2950 #!/bin/sh
2951 for f in \$@
2952 do
2953   case "\$f" in
2954   /*)
2955     $mkdir -p $targetdir/\`dirname \$f\`
2956     $cp \$f $targetdir/\$f || exit 1
2957     ;;
2958   *)
2959     $targetmkdir $targetdir/\`dirname \$f\`
2960     $cp \$f $targetdir/\$f || exit 1
2961     ;;
2962   esac
2963 done
2964 exit 0
2965 EOF
2966             ;;
2967         *)  echo "Unknown targetto '$targetto'" >&4
2968             exit 1
2969             ;;
2970         esac
2971         case "$targetfrom" in
2972         scp|rcp)
2973           cat >$from <<EOF
2974 #!/bin/sh
2975 for f in \$@
2976 do
2977   $rm -f \$f
2978   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2979 done
2980 exit 0
2981 EOF
2982             ;;
2983         cp) cat >$from <<EOF
2984 #!/bin/sh
2985 for f in \$@
2986 do
2987   $rm -f \$f
2988   cp $targetdir/\$f . || exit 1
2989 done
2990 exit 0
2991 EOF
2992             ;;
2993         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2994             exit 1
2995             ;;
2996         esac
2997         if $test ! -f $run; then
2998             echo "Target 'run' script '$run' not found." >&4
2999         else
3000             $chmod a+rx $run
3001         fi
3002         if $test ! -f $to; then
3003             echo "Target 'to' script '$to' not found." >&4
3004         else
3005             $chmod a+rx $to
3006         fi
3007         if $test ! -f $from; then
3008             echo "Target 'from' script '$from' not found." >&4
3009         else
3010             $chmod a+rx $from
3011         fi
3012         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3013             exit 1
3014         fi
3015         cat >&4 <<EOF
3016 Using '$run' for remote execution,
3017 and '$from' and '$to'
3018 for remote file transfer.
3019 EOF
3020         ;;
3021 *)      run=''
3022         to=:
3023         from=:
3024         usecrosscompile='undef'
3025         targetarch=''
3026         ;;
3027 esac
3028
3029 : see whether [:lower:] and [:upper:] are supported character classes
3030 echo " "
3031 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3032 ABYZ)
3033         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3034         up='[:upper:]'
3035         low='[:lower:]'
3036         ;;
3037 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3038         # (0xd9 and 0xe2), therefore that is a nice testing point.
3039         if test "X$up" = X -o "X$low" = X; then
3040             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3041             rs) up='[A-Z]'
3042                 low='[a-z]'
3043                 ;;
3044             esac
3045         fi
3046         if test "X$up" = X -o "X$low" = X; then
3047             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3048             rs) up='A-Z'
3049                 low='a-z'
3050                 ;;
3051             esac
3052         fi
3053         if test "X$up" = X -o "X$low" = X; then
3054             case "`echo RS | od -x 2>/dev/null`" in
3055             *D9E2*|*d9e2*)
3056                 echo "Hey, this might be EBCDIC." >&4
3057                 if test "X$up" = X -o "X$low" = X; then
3058                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3059                     rs) up='[A-IJ-RS-Z]'
3060                         low='[a-ij-rs-z]'
3061                         ;;
3062                     esac
3063                 fi
3064                 if test "X$up" = X -o "X$low" = X; then
3065                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3066                     rs) up='A-IJ-RS-Z'
3067                         low='a-ij-rs-z'
3068                         ;;
3069                     esac
3070                 fi
3071                 ;;
3072             esac
3073         fi
3074 esac
3075 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3076 rs)
3077     echo "Using $up and $low to convert case." >&4
3078     ;;
3079 *)
3080     echo "I don't know how to translate letters from upper to lower case." >&4
3081     echo "Your tr is not acting any way I know of." >&4
3082     exit 1
3083     ;;
3084 esac
3085 : set up the translation script tr, must be called with ./tr of course
3086 cat >tr <<EOSC
3087 $startsh
3088 case "\$1\$2" in
3089 '[A-Z][a-z]') exec $tr '$up' '$low';;
3090 '[a-z][A-Z]') exec $tr '$low' '$up';;
3091 esac
3092 exec $tr "\$@"
3093 EOSC
3094 chmod +x tr
3095 $eunicefix tr
3096
3097 : Try to determine whether config.sh was made on this system
3098 case "$config_sh" in
3099 '')
3100 myuname=`$uname -a 2>/dev/null`
3101 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3102 # Downcase everything to avoid ambiguity.
3103 # Remove slashes and single quotes so we can use parts of this in
3104 # directory and file names.
3105 # Remove newlines so myuname is sane to use elsewhere.
3106 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3107 # because the A-Z/a-z are not consecutive.
3108 myuname=`echo $myuname | $sed -e "s,['/],,g" | \
3109         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3110 newmyuname="$myuname"
3111 dflt=n
3112 case "$knowitall" in
3113 '')
3114         if test -f ../config.sh; then
3115                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3116                         eval "`grep myuname= ../config.sh`"
3117                 fi
3118                 if test "X$myuname" = "X$newmyuname"; then
3119                         dflt=y
3120                 fi
3121         fi
3122         ;;
3123 *) dflt=y;;
3124 esac
3125
3126 : Get old answers from old config file if Configure was run on the
3127 : same system, otherwise use the hints.
3128 hint=default
3129 cd ..
3130 if test -f config.sh; then
3131         echo " "
3132         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3133         . UU/myread
3134         case "$ans" in
3135         n*|N*) echo "OK, I'll ignore it."
3136                 mv config.sh config.sh.old
3137                 myuname="$newmyuname"
3138                 ;;
3139         *)  echo "Fetching default answers from your old config.sh file..." >&4
3140                 tmp_n="$n"
3141                 tmp_c="$c"
3142                 tmp_sh="$sh"
3143                 . ./config.sh
3144                 cp config.sh UU
3145                 n="$tmp_n"
3146                 c="$tmp_c"
3147                 : Older versions did not always set $sh.  Catch re-use of such
3148                 : an old config.sh.
3149                 case "$sh" in
3150                 '') sh="$tmp_sh" ;;
3151                 esac
3152                 hint=previous
3153                 ;;
3154         esac
3155 fi
3156 . ./UU/checkcc
3157 if test ! -f config.sh; then
3158         $cat <<EOM
3159
3160 First time through, eh?  I have some defaults handy for some systems
3161 that need some extra help getting the Configure answers right:
3162
3163 EOM
3164         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3165         dflt=''
3166         : Half the following guesses are probably wrong... If you have better
3167         : tests or hints, please send them to perlbug@perl.org
3168         : The metaconfig authors would also appreciate a copy...
3169         $test -f /irix && osname=irix
3170         $test -f /xenix && osname=sco_xenix
3171         $test -f /dynix && osname=dynix
3172         $test -f /dnix && osname=dnix
3173         $test -f /lynx.os && osname=lynxos
3174         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3175         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3176         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3177         $test -f /bin/mips && /bin/mips && osname=mips
3178         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3179                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3180         $test -d /usr/apollo/bin && osname=apollo
3181         $test -f /etc/saf/_sactab && osname=svr4
3182         $test -d /usr/include/minix && osname=minix
3183         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3184         if $test -d /MachTen -o -d /MachTen_Folder; then
3185                 osname=machten
3186                 if $test -x /sbin/version; then
3187                         osvers=`/sbin/version | $awk '{print $2}' |
3188                         $sed -e 's/[A-Za-z]$//'`
3189                 elif $test -x /usr/etc/version; then
3190                         osvers=`/usr/etc/version | $awk '{print $2}' |
3191                         $sed -e 's/[A-Za-z]$//'`
3192                 else
3193                         osvers="$2.$3"
3194                 fi
3195         fi
3196
3197         $test -f /sys/posix.dll &&
3198                 $test -f /usr/bin/what &&
3199                 set X `/usr/bin/what /sys/posix.dll` &&
3200                 $test "$3" = UWIN &&
3201                 osname=uwin &&
3202                 osvers="$5"
3203
3204         if $test -f $uname; then
3205                 set X $myuname
3206                 shift
3207
3208                 case "$5" in
3209                 fps*) osname=fps ;;
3210                 mips*)
3211                         case "$4" in
3212                         umips) osname=umips ;;
3213                         *) osname=mips ;;
3214                         esac;;
3215                 [23]100) osname=mips ;;
3216                 next*) osname=next ;;
3217                 i386*)
3218                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3219                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3220                                 osname='sco'
3221                                 osvers=$tmp
3222                         elif $test -f /etc/kconfig; then
3223                                 osname=isc
3224                                 if test "$lns" = "$ln -s"; then
3225                                         osvers=4
3226                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3227                                         osvers=3
3228                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3229                                         osvers=2
3230                                 fi
3231                         fi
3232                         tmp=''
3233                         ;;
3234                 pc*)
3235                         if test -n "$DJGPP"; then
3236                                 osname=dos
3237                                 osvers=djgpp
3238                         fi
3239                         ;;
3240                 esac
3241
3242                 case "$1" in
3243                 aix) osname=aix
3244                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3245                         case "$tmp" in
3246                         # oslevel can fail with:
3247                         # oslevel: Unable to acquire lock.
3248                         *not\ found) osvers="$4"."$3" ;;
3249                         '<3240'|'<>3240') osvers=3.2.0 ;;
3250                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3251                         '=3250'|'>3250') osvers=3.2.5 ;;
3252                         *) osvers=$tmp;;
3253                         esac
3254                         ;;
3255                 bitrig) osname=bitrig
3256                         osvers="$3"
3257                         ;;
3258                 bsd386) osname=bsd386
3259                         osvers=`$uname -r`
3260                         ;;
3261                 cygwin*) osname=cygwin
3262                         osvers="$3"
3263                         ;;
3264                 *dc.osx) osname=dcosx
3265                         osvers="$3"
3266                         ;;
3267                 dnix) osname=dnix
3268                         osvers="$3"
3269                         ;;
3270                 domainos) osname=apollo
3271                         osvers="$3"
3272                         ;;
3273                 dgux)   osname=dgux
3274                         osvers="$3"
3275                         ;;
3276                 dragonfly) osname=dragonfly
3277                         osvers="$3"
3278                         ;;
3279                 dynixptx*) osname=dynixptx
3280                         osvers=`echo "$4"|sed 's/^v//'`
3281                         ;;
3282                 freebsd) osname=freebsd
3283                         osvers="$3" ;;
3284                 genix)  osname=genix ;;
3285                 gnu)    osname=gnu
3286                         osvers="$3" ;;
3287                 hp*)    osname=hpux
3288                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3289                         ;;
3290                 irix*)  osname=irix
3291                         case "$3" in
3292                         4*) osvers=4 ;;
3293                         5*) osvers=5 ;;
3294                         *)      osvers="$3" ;;
3295                         esac
3296                         ;;
3297                 linux)  osname=linux
3298                         case "$3" in
3299                         *)      osvers="$3" ;;
3300                         esac
3301                         ;;
3302                 MiNT)   osname=mint
3303                         ;;
3304                 netbsd*) osname=netbsd
3305                         osvers="$3"
3306                         ;;
3307                 news-os) osvers="$3"
3308                         case "$3" in
3309                         4*) osname=newsos4 ;;
3310                         *) osname=newsos ;;
3311                         esac
3312                         ;;
3313                 next*) osname=next ;;
3314                 nonstop-ux) osname=nonstopux ;;
3315                 openbsd) osname=openbsd
3316                         osvers="$3"
3317                         ;;
3318                 os2)    osname=os2
3319                         osvers="$4"
3320                         ;;
3321                 POSIX-BC | posix-bc ) osname=posix-bc
3322                         osvers="$3"
3323                         ;;
3324                 powerux | power_ux | powermax_os | powermaxos | \
3325                 powerunix | power_unix) osname=powerux
3326                         osvers="$3"
3327                         ;;
3328                 qnx) osname=qnx
3329                         osvers="$4"
3330                         ;;
3331                 solaris) osname=solaris
3332                         case "$3" in
3333                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3334                         *)      osvers="$3" ;;
3335                         esac
3336                         ;;
3337                 sunos) osname=sunos
3338                         case "$3" in
3339                         5*) osname=solaris
3340                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3341                         *)      osvers="$3" ;;
3342                         esac
3343                         ;;
3344                 titanos) osname=titanos
3345                         case "$3" in
3346                         1*) osvers=1 ;;
3347                         2*) osvers=2 ;;
3348                         3*) osvers=3 ;;
3349                         4*) osvers=4 ;;
3350                         *)      osvers="$3" ;;
3351                         esac
3352                         ;;
3353                 ultrix) osname=ultrix
3354                         osvers="$3"
3355                         ;;
3356                 osf1|mls+)      case "$5" in
3357                                 alpha)
3358                                         osname=dec_osf
3359                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3360                                         case "$osvers" in
3361                                         [1-9].[0-9]*) ;;
3362                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3363                                         esac
3364                                         ;;
3365                         hp*)    osname=hp_osf1  ;;
3366                         mips)   osname=mips_osf1 ;;
3367                         esac
3368                         ;;
3369                 # UnixWare 7.1.2 is known as Open UNIX 8
3370                 openunix|unixware) osname=svr5
3371                         osvers="$4"
3372                         ;;
3373                 uts)    osname=uts
3374                         osvers="$3"
3375                         ;;
3376                 vos) osvers="$3"
3377                         ;;
3378                 $2) case "$osname" in
3379                         *isc*) ;;
3380                         *freebsd*) ;;
3381                         svr*)
3382                                 : svr4.x or possibly later
3383                                 case "svr$3" in
3384                                 ${osname}*)
3385                                         osname=svr$3
3386                                         osvers=$4
3387                                         ;;
3388                                 esac
3389                                 case "$osname" in
3390                                 svr4.0)
3391                                         : Check for ESIX
3392                                         if test -f /stand/boot ; then
3393                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3394                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3395                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3396                                                         if test -n "$isesix"; then
3397                                                                 osname=esix4
3398                                                         fi
3399                                                 fi
3400                                         fi
3401                                         ;;
3402                                 esac
3403                                 ;;
3404                         *)      if test -f /etc/systemid; then
3405                                         osname=sco
3406                                         set `echo $3 | $sed 's/\./ /g'` $4
3407                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3408                                                 osvers=$1.$2.$3
3409                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3410                                                 osvers=$1.$2
3411                                         elif $test -f $src/hints/sco_$1.sh; then
3412                                                 osvers=$1
3413                                         fi
3414                                 else
3415                                         case "$osname" in
3416                                         '') : Still unknown.  Probably a generic Sys V.
3417                                                 osname="sysv"
3418                                                 osvers="$3"
3419                                                 ;;
3420                                         esac
3421                                 fi
3422                                 ;;
3423                         esac
3424                         ;;
3425                 *)      case "$osname" in
3426                         '') : Still unknown.  Probably a generic BSD.
3427                                 osname="$1"
3428                                 osvers="$3"
3429                                 ;;
3430                         esac
3431                         ;;
3432                 esac
3433         else
3434                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3435                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3436                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3437                                 osname=news_os
3438                         fi
3439                         $rm -f UU/kernel.what
3440                 elif test -d c:/. -o -n "$is_os2" ; then
3441                         set X $myuname
3442                         osname=os2
3443                         osvers="$5"
3444                 fi
3445         fi
3446
3447         case "$targetarch" in
3448         '') ;;
3449         *)  hostarch=$osname
3450             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3451             osvers=''
3452             ;;
3453         esac
3454
3455         : Now look for a hint file osname_osvers, unless one has been
3456         : specified already.
3457         case "$hintfile" in
3458         ''|' ')
3459                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3460                 : Also try without trailing minor version numbers.
3461                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3462                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3463                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3464                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3465                 case "$file" in
3466                 '') dflt=none ;;
3467                 *)  case "$osvers" in
3468                         '') dflt=$file
3469                                 ;;
3470                         *)  if $test -f $src/hints/$file.sh ; then
3471                                         dflt=$file
3472                                 elif $test -f $src/hints/$xfile.sh ; then
3473                                         dflt=$xfile
3474                                 elif $test -f $src/hints/$xxfile.sh ; then
3475                                         dflt=$xxfile
3476                                 elif $test -f $src/hints/$xxxfile.sh ; then
3477                                         dflt=$xxxfile
3478                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3479                                         dflt=$xxxxfile
3480                                 elif $test -f "$src/hints/${osname}.sh" ; then
3481                                         dflt="${osname}"
3482                                 else
3483                                         dflt=none
3484                                 fi
3485                                 ;;
3486                         esac
3487                         ;;
3488                 esac
3489                 if $test -f Policy.sh ; then
3490                         case "$dflt" in
3491                         *Policy*) ;;
3492                         none) dflt="Policy" ;;
3493                         *) dflt="Policy $dflt" ;;
3494                         esac
3495                 fi
3496                 ;;
3497         *)
3498                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3499                 ;;
3500         esac
3501
3502         if $test -f Policy.sh ; then
3503                 $cat <<EOM
3504
3505 There's also a Policy hint file available, which should make the
3506 site-specific (policy) questions easier to answer.
3507 EOM
3508
3509         fi
3510
3511         $cat <<EOM
3512
3513 You may give one or more space-separated answers, or "none" if appropriate.
3514 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3515 previous run of Configure, you may specify it as well as or instead of
3516 OS-specific hints.  If hints are provided for your OS, you should use them:
3517 although Perl can probably be built without hints on many platforms, using
3518 hints often improve performance and may enable features that Configure can't
3519 set up on its own. If there are no hints that match your OS, specify "none";
3520 DO NOT give a wrong version or a wrong OS.
3521
3522 EOM
3523
3524         rp="Which of these apply, if any?"
3525         . UU/myread
3526         tans=$ans
3527         for file in $tans; do
3528                 if $test X$file = XPolicy -a -f Policy.sh; then
3529                         . Policy.sh
3530                         $cat Policy.sh >> UU/config.sh
3531                 elif $test -f $src/hints/$file.sh; then
3532                         . $src/hints/$file.sh
3533                         $cat $src/hints/$file.sh >> UU/config.sh
3534                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3535                         : nothing
3536                 else
3537                         : Give one chance to correct a possible typo.
3538                         echo "$file.sh does not exist"
3539                         dflt=$file
3540                         rp="hint to use instead?"
3541                         . UU/myread
3542                         for file in $ans; do
3543                                 if $test -f "$src/hints/$file.sh"; then
3544                                         . $src/hints/$file.sh
3545                                         $cat $src/hints/$file.sh >> UU/config.sh
3546                                 elif $test X$ans = X -o X$ans = Xnone ; then
3547                                         : nothing
3548                                 else
3549                                         echo "$file.sh does not exist -- ignored."
3550                                 fi
3551                         done
3552                 fi
3553         done
3554
3555         hint=recommended
3556         : Remember our hint file for later.
3557         if $test -f "$src/hints/$file.sh" ; then
3558                 hintfile="$file"
3559         else
3560                 hintfile=''
3561         fi
3562 fi
3563 cd UU
3564 ;;
3565 *)
3566         echo " "
3567         echo "Fetching default answers from $config_sh..." >&4
3568         tmp_n="$n"
3569         tmp_c="$c"
3570         cd ..
3571         cp $config_sh config.sh 2>/dev/null
3572         chmod +w config.sh
3573         . ./config.sh
3574         cd UU
3575         cp ../config.sh .
3576         n="$tmp_n"
3577         c="$tmp_c"
3578         hint=previous
3579         ;;
3580 esac
3581 test "$override" && . ./optdef.sh
3582
3583 : Restore computed paths
3584 for file in $loclist $trylist; do
3585         eval $file="\$_$file"
3586 done
3587
3588 cat << EOM
3589
3590 Configure uses the operating system name and version to set some defaults.
3591 The default value is probably right if the name rings a bell. Otherwise,
3592 since spelling matters for me, either accept the default or answer "none"
3593 to leave it blank.
3594
3595 EOM
3596 case "$osname" in
3597         ''|' ')
3598                 case "$hintfile" in
3599                 ''|' '|none) dflt=none ;;
3600                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3601                 esac
3602                 ;;
3603         *) dflt="$osname" ;;
3604 esac
3605 rp="Operating system name?"
3606 . ./myread
3607 case "$ans" in
3608 none)  osname='' ;;
3609 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3610 esac
3611 echo " "
3612 case "$osvers" in
3613         ''|' ')
3614                 case "$hintfile" in
3615                 ''|' '|none) dflt=none ;;
3616                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3617                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3618                         case "$dflt" in
3619                         ''|' ') dflt=none ;;
3620                         esac
3621                         ;;
3622                 esac
3623                 ;;
3624         *) dflt="$osvers" ;;
3625 esac
3626 rp="Operating system version?"
3627 . ./myread
3628 case "$ans" in
3629 none)  osvers='' ;;
3630 *) osvers="$ans" ;;
3631 esac
3632
3633
3634 . ./posthint.sh
3635
3636 : who configured the system
3637 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3638 case "$cf_by" in
3639 "")
3640         cf_by=`(logname) 2>/dev/null`
3641         case "$cf_by" in
3642         "")
3643                 cf_by=`(whoami) 2>/dev/null`
3644                 case "$cf_by" in
3645                 "") cf_by=unknown ;;
3646                 esac ;;
3647         esac ;;
3648 esac
3649
3650 : decide how portable to be.  Allow command line overrides.
3651 case "$d_portable" in
3652 "$undef") ;;
3653 *)      d_portable="$define" ;;
3654 esac
3655
3656 : set up shell script to do ~ expansion
3657 cat >filexp <<EOSS
3658 $startsh
3659 : expand filename
3660 case "\$1" in
3661  \~/*|\~)
3662         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3663         ;;
3664  \~*)
3665         if $test -f /bin/csh; then
3666                 /bin/csh -f -c "glob \$1"
3667                 failed=\$?
3668                 echo ""
3669                 exit \$failed
3670         else
3671                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3672                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3673                 if $test ! -d "\$dir"; then
3674                         me=\`basename \$0\`
3675                         echo "\$me: can't locate home directory for: \$name" >&2
3676                         exit 1
3677                 fi
3678                 case "\$1" in
3679                 */*)
3680                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3681                         ;;
3682                 *)
3683                         echo \$dir
3684                         ;;
3685                 esac
3686         fi
3687         ;;
3688 *)
3689         echo \$1
3690         ;;
3691 esac
3692 EOSS
3693 chmod +x filexp
3694 $eunicefix filexp
3695
3696 : now set up to get a file name
3697 cat <<EOS >getfile
3698 $startsh
3699 EOS
3700 cat <<'EOSC' >>getfile
3701 tilde=''
3702 fullpath=''
3703 already=''
3704 skip=''
3705 none_ok=''
3706 exp_file=''
3707 nopath_ok=''
3708 orig_rp="$rp"
3709 orig_dflt="$dflt"
3710 case "$gfpth" in
3711 '') gfpth='.' ;;
3712 esac
3713
3714 case "$fn" in
3715 *\(*)
3716         : getfile will accept an answer from the comma-separated list
3717         : enclosed in parentheses even if it does not meet other criteria.
3718         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3719         fn=`echo $fn | sed 's/(.*)//'`
3720         ;;
3721 esac
3722
3723 case "$fn" in
3724 *:*)
3725         loc_file=`expr $fn : '.*:\(.*\)'`
3726         fn=`expr $fn : '\(.*\):.*'`
3727         ;;
3728 esac
3729
3730 case "$fn" in
3731 *~*) tilde=true;;
3732 esac
3733 case "$fn" in
3734 */*) fullpath=true;;
3735 esac
3736 case "$fn" in
3737 *+*) skip=true;;
3738 esac
3739 case "$fn" in
3740 *n*) none_ok=true;;
3741 esac
3742 case "$fn" in
3743 *e*) exp_file=true;;
3744 esac
3745 case "$fn" in
3746 *p*) nopath_ok=true;;
3747 esac
3748
3749 case "$fn" in
3750 *f*) type='File';;
3751 *d*) type='Directory';;
3752 *l*) type='Locate';;
3753 esac
3754
3755 what="$type"
3756 case "$what" in
3757 Locate) what='File';;
3758 esac
3759
3760 case "$exp_file" in
3761 '')
3762         case "$d_portable" in
3763         "$define") ;;
3764         *) exp_file=true;;
3765         esac
3766         ;;
3767 esac
3768
3769 cd ..
3770 while test "$type"; do
3771         redo=''
3772         rp="$orig_rp"
3773         dflt="$orig_dflt"
3774         case "$tilde" in
3775         true) rp="$rp (~name ok)";;
3776         esac
3777         . UU/myread
3778         if test -f UU/getfile.ok && \
3779                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3780         then
3781                 value="$ans"
3782                 ansexp="$ans"
3783                 break
3784         fi
3785         case "$ans" in
3786         none)
3787                 value=''
3788                 ansexp=''
3789                 case "$none_ok" in
3790                 true) type='';;
3791                 esac
3792                 ;;
3793         *)
3794                 case "$tilde" in
3795                 '') value="$ans"
3796                         ansexp="$ans";;
3797                 *)
3798                         value=`UU/filexp $ans`
3799                         case $? in
3800                         0)
3801                                 if test "$ans" != "$value"; then
3802                                         echo "(That expands to $value on this system.)"
3803                                 fi
3804                                 ;;
3805                         *) value="$ans";;
3806                         esac
3807                         ansexp="$value"
3808                         case "$exp_file" in
3809                         '') value="$ans";;
3810                         esac
3811                         ;;
3812                 esac
3813                 case "$fullpath" in
3814                 true)
3815                         case "$ansexp" in
3816                         /*) value="$ansexp" ;;
3817                         [a-zA-Z]:/*) value="$ansexp" ;;
3818                         *)
3819                                 redo=true
3820                                 case "$already" in
3821                                 true)
3822                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3823                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3824                                         ;;
3825                                 *)
3826                                 echo "Please give a full path name, starting with slash." >&4
3827                                         case "$tilde" in
3828                                         true)
3829                                 echo "Note that using ~name is ok provided it expands well." >&4
3830                                                 already=true
3831                                                 ;;
3832                                         esac
3833                                 esac
3834                                 ;;
3835                         esac
3836                         ;;
3837                 esac
3838                 case "$redo" in
3839                 '')
3840                         case "$type" in
3841                         File)
3842                                 for fp in $gfpth; do
3843                                         if test "X$fp" = X.; then
3844                                             pf="$ansexp"
3845                                         else    
3846                                             pf="$fp/$ansexp"
3847                                         fi
3848                                         if test -f "$pf"; then
3849                                                 type=''
3850                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3851                                         then
3852                                                 echo "($value is not a plain file, but that's ok.)"
3853                                                 type=''
3854                                         fi
3855                                         if test X"$type" = X; then
3856                                             value="$pf"
3857                                             break
3858                                         fi
3859                                 done
3860                                 ;;
3861                         Directory)
3862                                 for fp in $gfpth; do
3863                                         if test "X$fp" = X.; then
3864                                             dir="$ans"
3865                                             direxp="$ansexp"
3866                                         else    
3867                                             dir="$fp/$ansexp"
3868                                             direxp="$fp/$ansexp"
3869                                         fi
3870                                         if test -d "$direxp"; then
3871                                                 type=''
3872                                                 value="$dir"
3873                                                 break
3874                                         fi
3875                                 done
3876                                 ;;
3877                         Locate)
3878                                 if test -d "$ansexp"; then
3879                                         echo "(Looking for $loc_file in directory $value.)"
3880                                         value="$value/$loc_file"
3881                                         ansexp="$ansexp/$loc_file"
3882                                 fi
3883                                 if test -f "$ansexp"; then
3884                                         type=''
3885                                 fi
3886                                 case "$nopath_ok" in
3887                                 true)   case "$value" in
3888                                         */*) ;;
3889                                         *)      echo "Assuming $value will be in people's path."
3890                                                 type=''
3891                                                 ;;
3892                                         esac
3893                                         ;;
3894                                 esac
3895                                 ;;
3896                         esac
3897
3898                         case "$skip" in
3899                         true) type='';
3900                         esac
3901
3902                         case "$type" in
3903                         '') ;;
3904                         *)
3905                                 if test "$fastread" = yes; then
3906                                         dflt=y
3907                                 else
3908                                         dflt=n
3909                                 fi
3910                                 rp="$what $value doesn't exist.  Use that name anyway?"
3911                                 . UU/myread
3912                                 dflt=''
3913                                 case "$ans" in
3914                                 y*) type='';;
3915                                 *) echo " ";;
3916                                 esac
3917                                 ;;
3918                         esac
3919                         ;;
3920                 esac
3921                 ;;
3922         esac
3923 done
3924 cd UU
3925 ans="$value"
3926 rp="$orig_rp"
3927 dflt="$orig_dflt"
3928 rm -f getfile.ok
3929 test "X$gfpthkeep" != Xy && gfpth=""
3930 EOSC
3931
3932 : determine root of directory hierarchy where package will be installed.
3933 case "$prefix" in
3934 '')
3935         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3936         ;;
3937 *?/)
3938         dflt=`echo "$prefix" | sed 's/.$//'`
3939         ;;
3940 *)
3941         dflt="$prefix"
3942         ;;
3943 esac
3944 $cat <<EOM
3945
3946 By default, $package will be installed in $dflt/bin, manual pages
3947 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3948 installation directories. Typically this is something like /usr/local.
3949 If you wish to have binaries under /usr/bin but other parts of the
3950 installation under /usr/local, that's ok: you will be prompted
3951 separately for each of the installation directories, the prefix being
3952 only used to set the defaults.
3953
3954 EOM
3955 fn=d~
3956 rp='Installation prefix to use?'
3957 . ./getfile
3958 oldprefix=''
3959 case "$prefix" in
3960 '') ;;
3961 *)
3962         case "$ans" in
3963         "$prefix") ;;
3964         *) oldprefix="$prefix";;
3965         esac
3966         ;;
3967 esac
3968 prefix="$ans"
3969 prefixexp="$ansexp"
3970
3971 : allow them to override the AFS root
3972 case "$afsroot" in
3973 '')     afsroot=/afs ;;
3974 *)      afsroot=$afsroot ;;
3975 esac
3976
3977 : is AFS running?
3978 echo " "
3979 case "$afs" in
3980 $define|true)   afs=true ;;
3981 $undef|false)   afs=false ;;
3982 *)      if $test -d $afsroot; then
3983                 afs=true
3984         else
3985                 afs=false
3986         fi
3987         ;;
3988 esac
3989 if $afs; then
3990         echo "AFS may be running... I'll be extra cautious then..." >&4
3991 else
3992         echo "AFS does not seem to be running..." >&4
3993 fi
3994
3995 : determine installation prefix for where package is to be installed.
3996 if $afs; then
3997 $cat <<EOM
3998
3999 Since you are running AFS, I need to distinguish the directory in which
4000 files will reside from the directory in which they are installed (and from
4001 which they are presumably copied to the former directory by occult means).
4002
4003 EOM
4004         case "$installprefix" in
4005         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
4006         *) dflt="$installprefix";;
4007         esac
4008 else
4009 $cat <<EOM
4010
4011 In some special cases, particularly when building $package for distribution,
4012 it is convenient to distinguish the directory in which files should be
4013 installed from the directory ($prefix) in which they will
4014 eventually reside.  For most users, these two directories are the same.
4015
4016 EOM
4017         case "$installprefix" in
4018         '') dflt=$prefix ;;
4019         *) dflt=$installprefix;;
4020         esac
4021 fi
4022 fn=d~
4023 rp='What installation prefix should I use for installing files?'
4024 . ./getfile
4025 installprefix="$ans"
4026 installprefixexp="$ansexp"
4027
4028 : Perform the prefixexp/installprefixexp correction if necessary
4029 cat <<EOS >installprefix
4030 $startsh
4031 EOS
4032 cat <<'EOSC' >>installprefix
4033 : Change installation prefix, if necessary.
4034 if $test X"$prefix" != X"$installprefix"; then
4035     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4036 else
4037     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4038 fi
4039 EOSC
4040 chmod +x installprefix
4041 $eunicefix installprefix
4042
4043 : Set variables such as privlib and privlibexp from the output of ./getfile
4044 : performing the prefixexp/installprefixexp correction if necessary.
4045 cat <<EOS >setprefixvar
4046 $startsh
4047 EOS
4048 cat <<'EOSC' >>setprefixvar
4049 eval "${prefixvar}=\"\$ans\""
4050 eval "${prefixvar}exp=\"\$ansexp\""
4051 . ./installprefix
4052 EOSC
4053 chmod +x setprefixvar
4054 $eunicefix setprefixvar
4055
4056 : set up the script used to warn in case of inconsistency
4057 cat <<EOS >whoa
4058 $startsh
4059 EOS
4060 cat <<'EOSC' >>whoa
4061 dflt=y
4062 case "$hint" in
4063     recommended)
4064         case "$hintfile" in
4065         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4066                 ;;
4067         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4068                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4069                 ;;
4070         esac
4071         ;;
4072     *)  echo " "
4073         echo "*** WHOA THERE!!! ***" >&4
4074         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4075         ;;
4076 esac
4077 rp="    Keep the $hint value?"
4078 . ./myread
4079 case "$ans" in
4080 y) td=$was; tu=$was;;
4081 esac
4082 EOSC
4083
4084 : function used to set '$1' to '$val'
4085 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4086 case "$val$was" in
4087 $define$undef) . ./whoa; eval "$var=\$td";;
4088 $undef$define) . ./whoa; eval "$var=\$tu";;
4089 *) eval "$var=$val";;
4090 esac'
4091
4092 : get the patchlevel
4093 echo " "
4094 echo "Getting the current patchlevel..." >&4
4095 if $test -r $rsrc/patchlevel.h;then
4096         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4097         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4098         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4099         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4100         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4101         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4102         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4103 else
4104         revision=0
4105         patchlevel=0
4106         subversion=0
4107         api_revision=0
4108         api_version=0
4109         api_subversion=0
4110         perl_patchlevel=0
4111         $echo "(You do not have patchlevel.h.  Eek.)"
4112 fi
4113 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4114 version_patchlevel_string="version $patchlevel subversion $subversion"
4115 case "$perl_patchlevel" in
4116 0|'') ;;
4117 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4118     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4119     ;;
4120 esac
4121
4122 $echo "(You have $package $version_patchlevel_string.)"
4123
4124 case "$osname" in
4125 dos|vms)
4126         : XXX Should be a Configure test for double-dots in filenames.
4127         version=`echo $revision $patchlevel $subversion | \
4128                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4129         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4130                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4131         ;;
4132 *)
4133         version=`echo $revision $patchlevel $subversion | \
4134                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4135         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4136                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4137         ;;
4138 esac
4139 : Special case the 5.005_xx maintenance series, which used 5.005
4140 : without any subversion label as a subdirectory in $sitelib
4141 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4142         api_versionstring='5.005'
4143 fi
4144
4145 : Do we want threads support and if so, what type
4146 case "$usethreads" in
4147 $define|true|[yY]*)     dflt='y';;
4148 *)     # Catch case where user specified ithreads or 5005threads but
4149        # forgot -Dusethreads (A.D. 4/2002)
4150        case "$useithreads$use5005threads" in
4151        *$define*)       dflt='y';;
4152        *)               dflt='n';;
4153        esac
4154        ;;
4155 esac
4156 cat <<EOM
4157
4158 Perl can be built to offer a form of threading support on some systems
4159 To do so, Configure can be run with -Dusethreads.
4160
4161 Note that Perl built with threading support runs slightly slower
4162 and uses slightly more memory than plain Perl.
4163
4164 If this doesn't make any sense to you, just accept the default '$dflt'.
4165 EOM
4166 rp='Build a threading Perl?'
4167 . ./myread
4168 case "$ans" in
4169 y|Y)    val="$define" ;;
4170 *)      val="$undef" ;;
4171 esac
4172 set usethreads
4173 eval $setvar
4174
4175 if $test $patchlevel -lt 9; then
4176     case "$usethreads" in
4177     $define)
4178         : Default to ithreads unless overridden on command line or with
4179         : old config.sh
4180         dflt='y'
4181         case "$use5005threads" in
4182                 $define|true|[yY]*)
4183                         echo "5.005 threads are no longer supported"
4184                         exit 1
4185                 ;;
4186         esac
4187         case "$useithreads" in
4188                 $undef|false|[nN]*) dflt='n';;
4189         esac
4190         rp='Use the newer interpreter-based ithreads?'
4191         . ./myread
4192         case "$ans" in
4193         y|Y)    val="$define" ;;
4194         *)      val="$undef" ;;
4195         esac
4196         set useithreads
4197         eval $setvar
4198         : Now set use5005threads to the opposite value.
4199         case "$useithreads" in
4200         $define) val="$undef" ;;
4201         *) val="$define" ;;
4202         esac
4203         set use5005threads
4204         eval $setvar
4205         ;;
4206     *)
4207         useithreads="$undef"
4208         use5005threads="$undef"
4209         ;;
4210     esac
4211
4212     case "$useithreads$use5005threads" in
4213     "$define$define")
4214         $cat >&4 <<EOM
4215
4216 You cannot have both the ithreads and the 5.005 threads enabled
4217 at the same time.  Disabling the 5.005 threads since they are
4218 much less stable than the ithreads.
4219
4220 EOM
4221         use5005threads="$undef"
4222         ;;
4223     esac
4224
4225 else
4226 : perl-5.9.x and later
4227
4228     if test X"$usethreads" = "X$define"; then
4229         case "$use5005threads" in
4230             $define|true|[yY]*)
4231                 $cat >&4 <<EOM
4232
4233 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4234
4235 EOM
4236             ;;
4237         esac
4238     fi
4239
4240     use5005threads="$undef"
4241     useithreads="$usethreads"
4242 fi
4243
4244 case "$d_oldpthreads" in
4245 '')     : Configure tests would be welcome here.  For now, assume undef.
4246         val="$undef" ;;
4247 *)      val="$d_oldpthreads" ;;
4248 esac
4249 set d_oldpthreads
4250 eval $setvar
4251
4252
4253 : Look for a hint-file generated 'call-back-unit'.  If the
4254 : user has specified that a threading perl is to be built,
4255 : we may need to set or change some other defaults.
4256 if $test -f usethreads.cbu; then
4257     echo "Your platform has some specific hints regarding threaded builds, using them..."
4258     . ./usethreads.cbu
4259 else
4260     case "$usethreads" in
4261         "$define"|true|[yY]*)
4262                 $cat <<EOM
4263 (Your platform does not have any specific hints for threaded builds.
4264  Assuming POSIX threads, then.)
4265 EOM
4266         ;;
4267     esac
4268 fi
4269
4270 : Check if multiplicity is required
4271 cat <<EOM
4272
4273 Perl can be built so that multiple Perl interpreters can coexist
4274 within the same Perl executable.
4275 EOM
4276
4277 case "$useithreads" in
4278 $define)
4279         cat <<EOM
4280 This multiple interpreter support is required for interpreter-based threads.
4281 EOM
4282         val="$define"
4283         ;;
4284 *)      case "$usemultiplicity" in
4285         $define|true|[yY]*)     dflt='y';;
4286         *) dflt='n';;
4287         esac
4288         echo " "
4289         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4290         rp='Build Perl for multiplicity?'
4291         . ./myread
4292         case "$ans" in
4293         y|Y)    val="$define" ;;
4294         *)      val="$undef" ;;
4295         esac
4296         ;;
4297 esac
4298 set usemultiplicity
4299 eval $setvar
4300
4301 : Check if morebits is requested
4302 case "$usemorebits" in
4303 "$define"|true|[yY]*)
4304         use64bitint="$define"
4305         uselongdouble="$define"
4306         usemorebits="$define"
4307         ;;
4308 *)      usemorebits="$undef"
4309         ;;
4310 esac
4311
4312 : Determine the C compiler to be used
4313 echo " "
4314 case "$cc" in
4315 '') dflt=cc;;
4316 *) dflt="$cc";;
4317 esac
4318 rp="Use which C compiler?"
4319 . ./myread
4320 cc="$ans"
4321
4322 : See whether they have no cc but they do have gcc
4323 . ./trygcc
4324 if $test -f cc.cbu; then
4325     . ./cc.cbu
4326 fi
4327 . ./checkcc
4328
4329 : make some quick guesses about what we are up against
4330 echo " "
4331 $echo $n "Hmm...  $c"
4332 echo exit 1 >bsd
4333 echo exit 1 >usg
4334 echo exit 1 >v7
4335 echo exit 1 >osf1
4336 echo exit 1 >eunice
4337 echo exit 1 >xenix
4338 echo exit 1 >venix
4339 echo exit 1 >os2
4340 d_bsd="$undef"
4341 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4342 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4343 then
4344         echo "Looks kind of like an OSF/1 system, but we'll see..."
4345         echo exit 0 >osf1
4346 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4347         xxx=`./loc addbib blurfl $pth`
4348         if $test -f $xxx; then
4349         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4350                 echo exit 0 >bsd
4351                 echo exit 0 >usg
4352         else
4353                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4354                         echo "Looks kind of like an extended USG system, but we'll see..."
4355                 else
4356                         echo "Looks kind of like a USG system, but we'll see..."
4357                 fi
4358                 echo exit 0 >usg
4359         fi
4360 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4361         echo "Looks kind of like a BSD system, but we'll see..."
4362         d_bsd="$define"
4363         echo exit 0 >bsd
4364 else
4365         echo "Looks kind of like a Version 7 system, but we'll see..."
4366         echo exit 0 >v7
4367 fi
4368 case "$eunicefix" in
4369 *unixtovms*)
4370         $cat <<'EOI'
4371 There is, however, a strange, musty smell in the air that reminds me of
4372 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4373 EOI
4374         echo exit 0 >eunice
4375         d_eunice="$define"
4376 : it so happens the Eunice I know will not run shell scripts in Unix format
4377         ;;
4378 *)
4379         echo " "
4380         echo "Congratulations.  You aren't running Eunice."
4381         d_eunice="$undef"
4382         ;;
4383 esac
4384 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4385 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4386 : semicolon as a patch separator
4387 case "$p_" in
4388 :) ;;
4389 *)
4390         $cat <<'EOI'
4391 I have the feeling something is not exactly right, however...don't tell me...
4392 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4393 (Or you may be running DOS with DJGPP.)
4394 EOI
4395         echo exit 0 >os2
4396         ;;
4397 esac
4398 if test -f /xenix; then
4399         echo "Actually, this looks more like a XENIX system..."
4400         echo exit 0 >xenix
4401         d_xenix="$define"
4402 else
4403         echo " "
4404         echo "It's not Xenix..."
4405         d_xenix="$undef"
4406 fi
4407 chmod +x xenix
4408 $eunicefix xenix
4409 if test -f /venix; then
4410         echo "Actually, this looks more like a VENIX system..."
4411         echo exit 0 >venix
4412 else
4413         echo " "
4414         if ./xenix; then
4415                 : null
4416         else
4417                 echo "Nor is it Venix..."
4418         fi
4419 fi
4420 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4421 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4422 $rm -f foo
4423
4424 : Check if we are using GNU gcc and what its version is
4425 echo " "
4426 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4427 $cat >try.c <<EOM
4428 #include <stdio.h>
4429 int main() {
4430 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4431 #ifdef __VERSION__
4432         printf("%s\n", __VERSION__);
4433 #else
4434         printf("%s\n", "1");
4435 #endif
4436 #endif
4437         return(0);
4438 }
4439 EOM
4440 if $cc -o try $ccflags $ldflags try.c; then
4441         gccversion=`$run ./try`
4442         case "$gccversion" in
4443         '') echo "You are not using GNU cc." ;;
4444         *)  echo "You are using GNU cc $gccversion."
4445             ccname=gcc
4446             ;;
4447         esac
4448 else
4449         echo " "
4450         echo "*** WHOA THERE!!! ***" >&4
4451         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4452         case "$knowitall" in
4453         '')
4454         echo "    You'd better start hunting for one and let me know about it." >&4
4455                 exit 1
4456                 ;;
4457         esac
4458 fi
4459 $rm -f try try.*
4460 case "$gccversion" in
4461 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4462 esac
4463 case "$gccversion" in
4464 '') gccosandvers='' ;;
4465 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4466    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4467    gccshortvers=''
4468    case "$gccosandvers" in
4469    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4470    $osname$osvers) ;; # looking good
4471    $osname*) cat <<EOM >&4
4472
4473 *** WHOA THERE!!! ***
4474
4475     Your gcc has not been compiled for the exact release of
4476     your operating system ($gccosandvers versus $osname$osvers).
4477
4478     In general it is a good idea to keep gcc synchronized with
4479     the operating system because otherwise serious problems
4480     may ensue when trying to compile software, like Perl.
4481
4482     I'm trying to be optimistic here, though, and will continue.
4483     If later during the configuration and build icky compilation
4484     problems appear (headerfile conflicts being the most common
4485     manifestation), I suggest reinstalling the gcc to match
4486     your operating system release.
4487
4488 EOM
4489       ;;
4490    *) gccosandvers='' ;; # failed to parse, better be silent
4491    esac
4492    ;;
4493 esac
4494 case "$ccname" in
4495 '') ccname="$cc" ;;
4496 esac
4497
4498 # gcc 3.* complain about adding -Idirectories that they already know about,
4499 # so we will take those off from locincpth.
4500 case "$gccversion" in
4501 3*)
4502     echo "main(){}">try.c
4503     for incdir in $locincpth; do
4504        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4505              grep '^c[cp]p*[01]: warning: changing search order '`
4506        if test "X$warn" != X; then
4507            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4508        fi
4509     done
4510     $rm -f try try.*
4511 esac
4512
4513 : What should the include directory be ?
4514 echo " "
4515 $echo $n "Hmm...  $c"
4516 dflt='/usr/include'
4517 incpath=''
4518 mips_type=''
4519 if $test -f /bin/mips && /bin/mips; then
4520         echo "Looks like a MIPS system..."
4521         $cat >usr.c <<'EOCP'
4522 #ifdef SYSTYPE_BSD43
4523 /bsd43
4524 #endif
4525 EOCP
4526         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4527                 dflt='/bsd43/usr/include'
4528                 incpath='/bsd43'
4529                 mips_type='BSD 4.3'
4530         else
4531                 mips_type='System V'
4532         fi
4533         $rm -f usr.c usr.out
4534         echo "and you're compiling with the $mips_type compiler and libraries."
4535         xxx_prompt=y
4536         echo "exit 0" >mips
4537 else
4538         echo "Doesn't look like a MIPS system."
4539         xxx_prompt=n
4540         echo "exit 1" >mips
4541 fi
4542 chmod +x mips
4543 $eunicefix mips
4544 case "$usrinc" in
4545 '') ;;
4546 *) dflt="$usrinc";;
4547 esac
4548 case "$xxx_prompt" in
4549 y)      fn=d/
4550         echo " "
4551         rp='Where are the include files you want to use?'
4552         . ./getfile
4553         usrinc="$ans"
4554         ;;
4555 *)      usrinc="$dflt"
4556         ;;
4557 esac
4558
4559 : see how we invoke the C preprocessor
4560 echo " "
4561 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4562 cat <<'EOT' >testcpp.c
4563 #define ABC abc
4564 #define XYZ xyz
4565 ABC.XYZ
4566 EOT
4567 cd ..
4568 if test ! -f cppstdin; then
4569         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4570                 # AIX cc -E doesn't show the absolute headerfile
4571                 # locations but we'll cheat by using the -M flag.
4572                 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
4573         else
4574                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4575         fi
4576 else
4577         echo "Keeping your $hint cppstdin wrapper."
4578 fi
4579 chmod 755 cppstdin
4580 wrapper=`pwd`/cppstdin
4581 ok='false'
4582 cd UU
4583
4584 if $test "X$cppstdin" != "X" && \
4585         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4586         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4587 then
4588         echo "You used to use $cppstdin $cppminus so we'll use that again."
4589         case "$cpprun" in
4590         '') echo "But let's see if we can live without a wrapper..." ;;
4591         *)
4592                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4593                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4594                 then
4595                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4596                         ok='true'
4597                 else
4598                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4599                 fi
4600                 ;;
4601         esac
4602 else
4603         case "$cppstdin" in
4604         '') ;;
4605         *)
4606                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4607                 ;;
4608         esac
4609 fi
4610
4611 if $ok; then
4612         : nothing
4613 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4614         $cc -E <testcpp.c >testcpp.out 2>&1; \
4615         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4616         echo "Yup, it does."
4617         x_cpp="$cc -E"
4618         x_minus='';
4619 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4620         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4621         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4622         echo "Yup, it does."
4623         x_cpp="$cc -E"
4624         x_minus='-';
4625 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4626         $cc -P <testcpp.c >testcpp.out 2>&1; \
4627         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4628         echo "Yipee, that works!"
4629         x_cpp="$cc -P"
4630         x_minus='';
4631 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4632         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4633         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4634         echo "At long last!"
4635         x_cpp="$cc -P"
4636         x_minus='-';
4637 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4638         $cpp <testcpp.c >testcpp.out 2>&1; \
4639         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4640         echo "It works!"
4641         x_cpp="$cpp"
4642         x_minus='';
4643 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4644         $cpp - <testcpp.c >testcpp.out 2>&1; \
4645         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4646         echo "Hooray, it works!  I was beginning to wonder."
4647         x_cpp="$cpp"
4648         x_minus='-';
4649 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4650         $wrapper <testcpp.c >testcpp.out 2>&1; \
4651         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4652         x_cpp="$wrapper"
4653         x_minus=''
4654         echo "Eureka!"
4655 else
4656         dflt=''
4657         rp="No dice.  I can't find a C preprocessor.  Name one:"
4658         . ./myread
4659         x_cpp="$ans"
4660         x_minus=''
4661         $x_cpp <testcpp.c >testcpp.out 2>&1
4662         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4663                 echo "OK, that will do." >&4
4664         else
4665 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4666                 exit 1
4667         fi
4668 fi
4669
4670 case "$ok" in
4671 false)
4672         cppstdin="$x_cpp"
4673         cppminus="$x_minus"
4674         cpprun="$x_cpp"
4675         cpplast="$x_minus"
4676         set X $x_cpp
4677         shift
4678         case "$1" in
4679         "$cpp")
4680                 echo "Perhaps can we force $cc -E using a wrapper..."
4681                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4682                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4683                 then
4684                         echo "Yup, we can."
4685                         cppstdin="$wrapper"
4686                         cppminus='';
4687                 else
4688                         echo "Nope, we'll have to live without it..."
4689                 fi
4690                 ;;
4691         esac
4692         case "$cpprun" in
4693         "$wrapper")
4694                 cpprun=''
4695                 cpplast=''
4696                 ;;
4697         esac
4698         ;;
4699 esac
4700
4701 case "$cppstdin" in
4702 "$wrapper"|'cppstdin') ;;
4703 *) $rm -f $wrapper;;
4704 esac
4705 $rm -f testcpp.c testcpp.out
4706
4707 : Set private lib path
4708 case "$plibpth" in
4709 '') if ./mips; then
4710                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4711         fi;;
4712 esac
4713 case "$libpth" in
4714 ' ') dlist='';;
4715 '') dlist="$loclibpth $plibpth $glibpth";;
4716 *) dlist="$libpth";;
4717 esac
4718
4719 : Now check and see which directories actually exist, avoiding duplicates
4720 libpth=''
4721 for xxx in $dlist
4722 do
4723     if $test -d $xxx; then
4724                 case " $libpth " in
4725                 *" $xxx "*) ;;
4726                 *) libpth="$libpth $xxx";;
4727                 esac
4728     fi
4729 done
4730 $cat <<'EOM'
4731
4732 Some systems have incompatible or broken versions of libraries.  Among
4733 the directories listed in the question below, please remove any you
4734 know not to be holding relevant libraries, and add any that are needed.
4735 Say "none" for none.
4736
4737 EOM
4738 case "$libpth" in
4739 '') dflt='none';;
4740 *)
4741         set X $libpth
4742         shift
4743         dflt=${1+"$@"}
4744         ;;
4745 esac
4746 rp="Directories to use for library searches?"
4747 . ./myread
4748 case "$ans" in
4749 none) libpth=' ';;
4750 *) libpth="$ans";;
4751 esac
4752
4753 : compute shared library extension
4754 case "$so" in
4755 '')
4756         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4757                 dflt='sl'
4758         else
4759                 dflt='so'
4760         fi
4761         ;;
4762 *) dflt="$so";;
4763 esac
4764 $cat <<EOM
4765
4766 On some systems, shared libraries may be available.  Answer 'none' if
4767 you want to suppress searching of shared libraries for the remainder
4768 of this configuration.
4769
4770 EOM
4771 rp='What is the file extension used for shared libraries?'
4772 . ./myread
4773 so="$ans"
4774
4775 : Define several unixisms.
4776 : Hints files or command line option can be used to override them.
4777 : The convoluted testing is in case hints files set either the old
4778 : or the new name.
4779 case "$_exe" in
4780 '')     case "$exe_ext" in
4781         '')     ;;
4782         *)      _exe="$exe_ext" ;;
4783         esac
4784         ;;
4785 esac
4786 case "$_a" in
4787 '')     case "$lib_ext" in
4788     '') _a='.a';;
4789         *)      _a="$lib_ext" ;;
4790         esac
4791         ;;
4792 esac
4793 case "$_o" in
4794 '') case "$obj_ext" in
4795         '')     _o='.o';;
4796         *)      _o="$obj_ext";;
4797         esac
4798         ;;
4799 esac
4800 case "$p_" in
4801 '') case "$path_sep" in
4802         '')     p_=':';;
4803         *)      p_="$path_sep";;
4804         esac
4805         ;;
4806 esac
4807 exe_ext=$_exe
4808 lib_ext=$_a
4809 obj_ext=$_o
4810 path_sep=$p_
4811
4812 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4813
4814 : Which makefile gets called first.  This is used by make depend.
4815 case "$firstmakefile" in
4816 '') firstmakefile='makefile';;
4817 esac
4818
4819 : Check is we will use socks
4820 case "$usesocks" in
4821 $define|true|[yY]*)     dflt='y';;
4822 *) dflt='n';;
4823 esac
4824 cat <<EOM
4825
4826 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4827 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4828 to use the PerlIO abstraction layer, this will be implicitly selected.
4829
4830 If this doesn't make any sense to you, just accept the default '$dflt'.
4831 EOM
4832 rp='Build Perl for SOCKS?'
4833 . ./myread
4834 case "$ans" in
4835 y|Y)    val="$define" ;;
4836 *)      val="$undef" ;;
4837 esac
4838 set usesocks
4839 eval $setvar
4840
4841 : Check for uselongdouble support
4842 case "$ccflags" in
4843 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4844 esac
4845
4846 case "$uselongdouble" in
4847 $define|true|[yY]*)     dflt='y';;
4848 *) dflt='n';;
4849 esac
4850 cat <<EOM
4851
4852 Perl can be built to take advantage of long doubles which
4853 (if available) may give more accuracy and range for floating point numbers.
4854
4855 If this doesn't make any sense to you, just accept the default '$dflt'.
4856 EOM
4857 rp='Try to use long doubles if available?'
4858 . ./myread
4859 case "$ans" in
4860 y|Y)    val="$define"   ;;
4861 *)      val="$undef"    ;;
4862 esac
4863 set uselongdouble
4864 eval $setvar
4865
4866 case "$uselongdouble" in
4867 true|[yY]*) uselongdouble="$define" ;;
4868 esac
4869
4870 : Look for a hint-file generated 'call-back-unit'.  If the
4871 : user has specified that long doubles should be used,
4872 : we may need to set or change some other defaults.
4873 if $test -f uselongdouble.cbu; then
4874     echo "Your platform has some specific hints regarding long doubles, using them..."
4875     . ./uselongdouble.cbu
4876 else
4877     case "$uselongdouble" in
4878         $define)
4879                 $cat <<EOM
4880 (Your platform does not have any specific hints for long doubles.)
4881 EOM
4882         ;;
4883     esac
4884 fi
4885
4886 : Looking for optional libraries
4887 echo " "
4888 echo "Checking for optional libraries..." >&4
4889 case "$libs" in
4890 ' '|'') dflt='';;
4891 *) dflt="$libs";;
4892 esac
4893 case "$libswanted" in
4894 '') libswanted='c_s';;
4895 esac
4896 case "$usesocks" in
4897 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4898 esac
4899 libsfound=''
4900 libsfiles=''
4901 libsdirs=''
4902 libspath=''
4903 for thisdir in $libpth $xlibpth; do
4904   test -d $thisdir && libspath="$libspath $thisdir"
4905 done
4906 for thislib in $libswanted; do
4907         for thisdir in $libspath; do
4908             xxx=''
4909             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4910                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4911                 $test -f "$xxx" && eval $libscheck
4912                 $test -f "$xxx" && libstyle=shared
4913             fi
4914             if test ! -f "$xxx"; then
4915                 xxx=$thisdir/lib$thislib.$so
4916                 $test -f "$xxx" && eval $libscheck
4917                 $test -f "$xxx" && libstyle=shared
4918             fi
4919             if test ! -f "$xxx"; then
4920                 xxx=$thisdir/lib$thislib$_a
4921                 $test -f "$xxx" && eval $libscheck
4922                 $test -f "$xxx" && libstyle=static
4923             fi
4924             if test ! -f "$xxx"; then
4925                 xxx=$thisdir/$thislib$_a
4926                 $test -f "$xxx" && eval $libscheck
4927                 $test -f "$xxx" && libstyle=static
4928             fi
4929             if test ! -f "$xxx"; then
4930                 xxx=$thisdir/lib${thislib}_s$_a
4931                 $test -f "$xxx" && eval $libscheck
4932                 $test -f "$xxx" && libstyle=static
4933                 $test -f "$xxx" && thislib=${thislib}_s
4934             fi
4935             if test ! -f "$xxx"; then
4936                 xxx=$thisdir/Slib$thislib$_a
4937                 $test -f "$xxx" && eval $libscheck
4938                 $test -f "$xxx" && libstyle=static
4939             fi
4940             if $test -f "$xxx"; then
4941                 case "$libstyle" in
4942                 shared) echo "Found -l$thislib (shared)." ;;
4943                 static) echo "Found -l$thislib." ;;
4944                 *)      echo "Found -l$thislib ($libstyle)." ;;
4945                 esac
4946                 case " $dflt " in
4947                 *"-l$thislib "*);;
4948                 *) dflt="$dflt -l$thislib"
4949                    libsfound="$libsfound $xxx"
4950                    yyy=`basename $xxx`
4951                    libsfiles="$libsfiles $yyy"
4952                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4953                    case " $libsdirs " in
4954                    *" $yyy "*) ;;
4955                    *) libsdirs="$libsdirs $yyy" ;;
4956                    esac
4957                    ;;
4958                 esac
4959                 break
4960             fi
4961         done
4962         if $test ! -f "$xxx"; then
4963             echo "No -l$thislib."
4964         fi
4965 done
4966 set X $dflt
4967 shift
4968 dflt="$*"
4969 case "$libs" in
4970 '') dflt="$dflt";;
4971 *) dflt="$libs";;
4972 esac
4973 case "$dflt" in
4974 ' '|'') dflt='none';;
4975 esac
4976
4977 $cat <<EOM
4978
4979 In order to compile $package on your machine, a number of libraries
4980 are usually needed.  Include any other special libraries here as well.
4981 Say "none" for none.  The default list is almost always right.
4982 EOM
4983
4984 echo " "
4985 rp="What libraries to use?"
4986 . ./myread
4987 case "$ans" in
4988 none) libs=' ';;
4989 *) libs="$ans";;
4990 esac
4991
4992 : determine optimization, if desired, or use for debug flag also
4993 case "$optimize" in
4994 ' '|$undef) dflt='none';;
4995 '') dflt='-O';;
4996 *) dflt="$optimize";;
4997 esac
4998 $cat <<EOH
4999
5000 By default, $package compiles with the -O flag to use the optimizer.
5001 Alternately, you might want to use the symbolic debugger, which uses
5002 the -g flag (on traditional Unix systems).  Either flag can be
5003 specified here.  To use neither flag, specify the word "none".
5004
5005 EOH
5006 rp="What optimizer/debugger flag should be used?"
5007 . ./myread
5008 optimize="$ans"
5009 case "$optimize" in
5010 'none') optimize=" ";;
5011 esac
5012
5013 : Check what DEBUGGING is required from the command line
5014 : -DEBUGGING      or -DDEBUGGING or
5015 : -DEBUGGING=both                       = -g + -DDEBUGGING
5016 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5017 : -DEBUGGING=none or -UDEBUGGING        =
5018 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5019 case "$EBUGGING" in
5020 '')     ;;
5021 *)      DEBUGGING=$EBUGGING ;;
5022 esac
5023
5024 case "$DEBUGGING" in
5025 -g|both|$define)
5026     case "$optimize" in
5027         *-g*) ;;
5028         *)    optimize="$optimize -g" ;;
5029     esac ;;
5030 none|$undef)
5031     case "$optimize" in
5032         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5033                 shift
5034                 optimize="$*"
5035                 ;;
5036     esac ;;
5037 esac
5038
5039 dflt=''
5040 case "$DEBUGGING" in
5041 both|$define) dflt='-DDEBUGGING'
5042 esac
5043
5044 : argument order is deliberate, as the flag will start with - which set could
5045 : think is an option
5046 checkccflag='check=$1; flag=$2; callback=$3;
5047 echo " ";
5048 echo "Checking if your compiler accepts $flag" 2>&1;
5049 echo "int main(void) { return 0; }" > gcctest.c;
5050 if $cc -O2 $flag -o gcctest gcctest.c 2>gcctest.out && ./gcctest; then
5051     echo "Yes, it does." 2>&1;
5052     if $test -s gcctest.out ; then
5053         echo "But your platform does not like it:";
5054         cat gcctest.out;
5055     else
5056         case "$ccflags" in
5057         *$check*)
5058             echo "Leaving current flags $ccflags alone." 2>&1
5059             ;;
5060         *) dflt="$dflt $flag";
5061             eval $callback
5062             ;;
5063         esac
5064     fi
5065 else
5066     echo "Nope, it does not, but that is ok." 2>&1;
5067 fi
5068 '
5069
5070 : We will not override a previous value, but we might want to
5071 : augment a hint file
5072 case "$hint" in
5073 default|recommended)
5074         case "$gccversion" in
5075         1*) dflt="$dflt -fpcc-struct-return" ;;
5076         esac
5077         case "$optimize:$DEBUGGING" in
5078         *-g*:old) dflt="$dflt -DDEBUGGING";;
5079         esac
5080         case "$gccversion" in
5081         2*) if $test -d /etc/conf/kconfig.d &&
5082                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5083                 then
5084                         # Interactive Systems (ISC) POSIX mode.
5085                         dflt="$dflt -posix"
5086                 fi
5087                 ;;
5088         esac
5089         case "$gccversion" in
5090         1*) ;;
5091         2.[0-8]*) ;;
5092         ?*)     set strict-aliasing -fno-strict-aliasing
5093                 eval $checkccflag
5094                 ;;
5095         esac
5096         # For gcc, adding -pipe speeds up compilations for some, but apparently
5097         # some assemblers can't read from stdin.  (It also slows down compilations
5098         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5099         case "$gccversion" in
5100         ?*)     set pipe -pipe
5101                 eval $checkccflag
5102                 ;;
5103         esac
5104
5105         # on x86_64 (at least) we require an extra library (libssp) in the
5106         # link command line. This library is not named, so I infer that it is
5107         # an implementation detail that may change. Hence the safest approach
5108         # is to add the flag to the flags passed to the compiler at link time,
5109         # as that way the compiler can do the right implementation dependant
5110         # thing. (NWC)
5111         case "$gccversion" in
5112         ?*)     set stack-protector -fstack-protector
5113                 eval $checkccflag
5114                 ;;
5115         esac
5116         ;;
5117 esac
5118
5119 case "$mips_type" in
5120 *BSD*|'') inclwanted="$locincpth $usrinc";;
5121 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5122 esac
5123 for thisincl in $inclwanted; do
5124         if $test -d $thisincl; then
5125                 if $test x$thisincl != x$usrinc; then
5126                         case "$dflt" in
5127                         *" -I$thisincl "*);;
5128                         *) dflt="$dflt -I$thisincl ";;
5129                         esac
5130                 fi
5131         fi
5132 done
5133
5134 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5135         xxx=true;
5136 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5137         xxx=true;
5138 else
5139         xxx=false;
5140 fi;
5141 if $xxx; then
5142         case "$dflt" in
5143         *$2*);;
5144         *) dflt="$dflt -D$2";;
5145         esac;
5146 fi'
5147
5148 set signal.h LANGUAGE_C; eval $inctest
5149
5150 case "$usesocks" in
5151 $define)
5152         ccflags="$ccflags -DSOCKS"
5153         ;;
5154 esac
5155
5156 case "$hint" in
5157 default|recommended) dflt="$ccflags $dflt" ;;
5158 *) dflt="$ccflags";;
5159 esac
5160
5161 case "$dflt" in
5162 ''|' ') dflt=none;;
5163 esac
5164
5165 $cat <<EOH
5166
5167 Your C compiler may want other flags.  For this question you should include
5168 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5169 but you should NOT include libraries or ld flags like -lwhatever.  If you
5170 want $package to honor its debug switch, you should include -DDEBUGGING here.
5171 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5172
5173 To use no flags, specify the word "none".
5174
5175 EOH
5176 set X $dflt
5177 shift
5178 dflt=${1+"$@"}
5179 rp="Any additional cc flags?"
5180 . ./myread
5181 case "$ans" in
5182 none) ccflags='';;
5183 *) ccflags="$ans";;
5184 esac
5185
5186 : the following weeds options from ccflags that are of no interest to cpp
5187 case "$cppflags" in
5188 '') cppflags="$ccflags" ;;
5189 *)  cppflags="$cppflags $ccflags" ;;
5190 esac
5191 case "$gccversion" in
5192 1*) cppflags="$cppflags -D__GNUC__"
5193 esac
5194 case "$mips_type" in
5195 '');;
5196 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5197 esac
5198 case "$cppflags" in
5199 '');;
5200 *)
5201         echo " "
5202         echo "Let me guess what the preprocessor flags are..." >&4
5203         set X $cppflags
5204         shift
5205         cppflags=''
5206         $cat >cpp.c <<'EOM'
5207 #define BLURFL foo
5208
5209 BLURFL xx LFRULB
5210 EOM
5211         previous=''
5212         for flag in $*
5213         do
5214                 case "$flag" in
5215                 -*) ftry="$flag";;
5216                 *) ftry="$previous $flag";;
5217                 esac
5218                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5219                         >cpp1.out 2>/dev/null && \
5220                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5221                         >cpp2.out 2>/dev/null && \
5222                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5223                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5224                 then
5225                         cppflags="$cppflags $ftry"
5226                         previous=''
5227                 else
5228                         previous="$flag"
5229                 fi
5230         done
5231         set X $cppflags
5232         shift
5233         cppflags=${1+"$@"}
5234         case "$cppflags" in
5235         *-*)  echo "They appear to be: $cppflags";;
5236         esac
5237         $rm -f cpp.c cpp?.out
5238         ;;
5239 esac
5240
5241 : flags used in final linking phase
5242 case "$ldflags" in
5243 '') if ./venix; then
5244                 dflt='-i -z'
5245         else
5246                 dflt=''
5247         fi
5248         case "$ccflags" in
5249         *-posix*) dflt="$dflt -posix" ;;
5250         esac
5251         ;;
5252 *) dflt="$ldflags";;
5253 esac
5254 # See note above about -fstack-protector
5255 case "$ccflags" in
5256 *-fstack-protector*)
5257         case "$dflt" in
5258         *-fstack-protector*) ;; # Don't add it again
5259         *) dflt="$dflt -fstack-protector" ;;
5260         esac
5261         ;;
5262 esac
5263
5264 : Try to guess additional flags to pick up local libraries.
5265 for thislibdir in $libpth; do
5266         case " $loclibpth " in
5267         *" $thislibdir "*)
5268                 case "$dflt " in
5269                 *"-L$thislibdir "*) ;;
5270                 *)  dflt="$dflt -L$thislibdir" ;;
5271                 esac
5272                 ;;
5273         esac
5274 done
5275
5276 case "$dflt" in
5277 '') dflt='none' ;;
5278 esac
5279
5280 $cat <<EOH
5281
5282 Your C linker may need flags.  For this question you should
5283 include -L/whatever and any other flags used by the C linker, but you
5284 should NOT include libraries like -lwhatever.
5285
5286 Make sure you include the appropriate -L/path flags if your C linker
5287 does not normally search all of the directories you specified above,
5288 namely
5289         $libpth
5290 To use no flags, specify the word "none".
5291
5292 EOH
5293
5294 rp="Any additional ld flags (NOT including libraries)?"
5295 . ./myread
5296 case "$ans" in
5297 none) ldflags='';;
5298 *) ldflags="$ans";;
5299 esac
5300 rmlist="$rmlist pdp11"
5301
5302 : coherency check
5303 echo " "
5304 echo "Checking your choice of C compiler and flags for coherency..." >&4
5305 $cat > try.c <<'EOF'
5306 #include <stdio.h>
5307 int main() { printf("Ok\n"); return(0); }
5308 EOF
5309 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5310 shift
5311 $cat >try.msg <<'EOM'
5312 I've tried to compile and run the following simple program:
5313
5314 EOM
5315 $cat try.c >> try.msg
5316
5317 $cat >> try.msg <<EOM
5318
5319 I used the command:
5320
5321         $*
5322         $run ./try
5323
5324 and I got the following output:
5325
5326 EOM
5327 dflt=y
5328 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5329         if $sh -c "$run ./try " >>try.msg 2>&1; then
5330                 xxx=`$run ./try`
5331                 case "$xxx" in
5332                 "Ok") dflt=n ;;
5333                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5334                         case " $libs " in
5335                         *" -lsfio "*)
5336                                 cat >> try.msg <<'EOQS'
5337 If $libs contains -lsfio, and sfio is mis-configured, then it
5338 sometimes (apparently) runs and exits with a 0 status, but with no
5339 output!  It may have to do with sfio's use of _exit vs. exit.
5340
5341 EOQS
5342                                 rp="You have a big problem.  Shall I abort Configure"
5343                                 dflt=y
5344                                 ;;
5345                         esac
5346                         ;;
5347                 esac
5348         else
5349                 echo "The program compiled OK, but exited with status $?." >>try.msg
5350                 rp="You have a problem.  Shall I abort Configure"
5351                 dflt=y
5352         fi
5353 else
5354         echo "I can't compile the test program." >>try.msg
5355         rp="You have a BIG problem.  Shall I abort Configure"
5356         dflt=y
5357 fi
5358 case "$dflt" in
5359 y)
5360         $cat try.msg >&4
5361         case "$knowitall" in
5362         '')
5363                 echo "(The supplied flags or libraries might be incorrect.)"
5364                 ;;
5365         *) dflt=n;;
5366         esac
5367         echo " "
5368         . ./myread
5369         case "$ans" in
5370         n*|N*) ;;
5371         *)      echo "Ok.  Stopping Configure." >&4
5372                 exit 1
5373                 ;;
5374         esac
5375         ;;
5376 n) echo "OK, that should do.";;
5377 esac
5378 $rm_try gcctest gcctest.out
5379
5380 : define a shorthand compile call
5381 compile='
5382 mc_file=$1;
5383 shift;
5384 case "$usedevel" in $define|true|[yY]*) if $test ! -f "${mc_file}.c"; then
5385 echo "Internal Configure script bug - compiler test file ${mc_file}.c is missing. Please report this to perlbug@perl.org" >&4;
5386 exit 1;
5387 fi;
5388 esac;
5389 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5390 : define a shorthand compile call for compilations that should be ok.
5391 compile_ok='
5392 mc_file=$1;
5393 shift;
5394 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5395
5396 : determine filename position in cpp output
5397 echo " "
5398 echo "Computing filename position in cpp output for #include directives..." >&4
5399 case "$osname" in
5400 vos) testaccess=-e ;;
5401 *)   testaccess=-r ;;
5402 esac
5403 echo '#include <stdio.h>' > foo.c
5404 $cat >fieldn <<EOF
5405 $startsh
5406 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5407 $grep '^[       ]*#.*stdio\.h' | \
5408 while read cline; do
5409         pos=1
5410         set \$cline
5411         while $test \$# -gt 0; do
5412                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5413                         echo "\$pos"
5414                         exit 0
5415                 fi
5416                 shift
5417                 pos=\`expr \$pos + 1\`
5418         done
5419 done
5420 EOF
5421 chmod +x fieldn
5422 fieldn=`./fieldn`
5423 $rm -f foo.c fieldn
5424 case $fieldn in
5425 '') pos='???';;
5426 1) pos=first;;
5427 2) pos=second;;
5428 3) pos=third;;
5429 *) pos="${fieldn}th";;
5430 esac
5431 echo "Your cpp writes the filename in the $pos field of the line."
5432
5433 case "$osname" in
5434 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5435 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5436 *)   cppfilter='' ;;
5437 esac
5438 : locate header file
5439 $cat >findhdr <<EOF
5440 $startsh
5441 wanted=\$1
5442 name=''
5443 for usrincdir in $usrinc
5444 do
5445         if test -f \$usrincdir/\$wanted; then
5446                 echo "\$usrincdir/\$wanted"
5447                 exit 0
5448         fi
5449 done
5450 awkprg='{ print \$$fieldn }'
5451 echo "#include <\$wanted>" > foo\$\$.c
5452 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5453 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5454 while read cline; do
5455         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5456         case "\$name" in
5457         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5458         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5459         *) exit 2;;
5460         esac;
5461 done;
5462 #
5463 # status = 0: grep returned 0 lines, case statement not executed
5464 # status = 1: headerfile found
5465 # status = 2: while loop executed, no headerfile found
5466 #
5467 status=\$?
5468 $rm -f foo\$\$.c;
5469 if test \$status -eq 1; then
5470         exit 0;
5471 fi
5472 exit 1
5473 EOF
5474 chmod +x findhdr
5475
5476 : define an alternate in-header-list? function
5477 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5478 cont=true; xxf="echo \"<\$1> found.\" >&4";
5479 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5480 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5481 esac;
5482 case $# in 4) instead=instead;; *) instead="at last";; esac;
5483 while $test "$cont"; do
5484         xxx=`./findhdr $1`
5485         var=$2; eval "was=\$$2";
5486         if $test "$xxx" && $test -r "$xxx";
5487         then eval $xxf;
5488         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5489                 cont="";
5490         else eval $xxnf;
5491         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5492         set $yyy; shift; shift; yyy=$@;
5493         case $# in 0) cont="";;
5494         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5495                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5496         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5497                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5498         esac;
5499 done;
5500 while $test "$yyy";
5501 do set $yyy; var=$2; eval "was=\$$2";
5502         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5503         set $yyy; shift; shift; yyy=$@;
5504 done'
5505
5506 : see if stdlib is available
5507 set stdlib.h i_stdlib
5508 eval $inhdr
5509
5510 : check for lengths of integral types
5511 echo " "
5512 case "$intsize" in
5513 '')
5514         echo "Checking to see how big your integers are..." >&4
5515         $cat >try.c <<EOCP
5516 #include <stdio.h>
5517 #$i_stdlib I_STDLIB
5518 #ifdef I_STDLIB
5519 #include <stdlib.h>
5520 #endif
5521 int main()
5522 {
5523         printf("intsize=%d;\n", (int)sizeof(int));
5524         printf("longsize=%d;\n", (int)sizeof(long));
5525         printf("shortsize=%d;\n", (int)sizeof(short));
5526         exit(0);
5527 }
5528 EOCP
5529         set try
5530         if eval $compile_ok && $run ./try > /dev/null; then
5531                 eval `$run ./try`
5532                 echo "Your integers are $intsize bytes long."
5533                 echo "Your long integers are $longsize bytes long."
5534                 echo "Your short integers are $shortsize bytes long."
5535         else
5536                 $cat >&4 <<EOM
5537 !
5538 Help! I can't compile and run the intsize test program: please enlighten me!
5539 (This is probably a misconfiguration in your system or libraries, and
5540 you really ought to fix it.  Still, I'll try anyway.)
5541 !
5542 EOM
5543                 dflt=4
5544                 rp="What is the size of an integer (in bytes)?"
5545                 . ./myread
5546                 intsize="$ans"
5547                 dflt=$intsize
5548                 rp="What is the size of a long integer (in bytes)?"
5549                 . ./myread
5550                 longsize="$ans"
5551                 dflt=2
5552                 rp="What is the size of a short integer (in bytes)?"
5553                 . ./myread
5554                 shortsize="$ans"
5555         fi
5556         ;;
5557 esac
5558 $rm_try
5559
5560 : check for long long
5561 echo " "
5562 echo "Checking to see if you have long long..." >&4
5563 echo 'int main() { long long x = 7; return 0; }' > try.c
5564 set try
5565 if eval $compile; then
5566         val="$define"
5567         echo "You have long long."
5568 else
5569         val="$undef"
5570         echo "You do not have long long."
5571 fi
5572 $rm_try
5573 set d_longlong
5574 eval $setvar
5575
5576 : check for length of long long
5577 case "${d_longlong}${longlongsize}" in
5578 $define)
5579         echo " "
5580         echo "Checking to see how big your long longs are..." >&4
5581         $cat >try.c <<'EOCP'
5582 #include <stdio.h>
5583 int main()
5584 {
5585     printf("%d\n", (int)sizeof(long long));
5586     return(0);
5587 }
5588 EOCP
5589         set try
5590         if eval $compile_ok; then
5591                 longlongsize=`$run ./try`
5592                 echo "Your long longs are $longlongsize bytes long."
5593         else
5594                 dflt='8'
5595                 echo " "
5596                 echo "(I can't seem to compile the test program.  Guessing...)"
5597                 rp="What is the size of a long long (in bytes)?"
5598                 . ./myread
5599                 longlongsize="$ans"
5600         fi
5601         if $test "X$longsize" = "X$longlongsize"; then
5602                 echo "(That isn't any different from an ordinary long.)"
5603         fi
5604         ;;
5605 esac
5606 $rm_try
5607
5608 : see if inttypes.h is available
5609 : we want a real compile instead of Inhdr because some systems
5610 : have an inttypes.h which includes non-existent headers
5611 echo " "
5612 $cat >try.c <<EOCP
5613 #include <inttypes.h>
5614 int main() {
5615         static int32_t foo32 = 0x12345678;
5616 }
5617 EOCP
5618 set try
5619 if eval $compile; then
5620         echo "<inttypes.h> found." >&4
5621         val="$define"
5622 else
5623         echo "<inttypes.h> NOT found." >&4
5624         val="$undef"
5625 fi
5626 $rm_try
5627 set i_inttypes
5628 eval $setvar
5629
5630 : check for int64_t
5631 echo " "
5632 echo "Checking to see if you have int64_t..." >&4
5633 $cat >try.c <<EOCP
5634 #include <sys/types.h>
5635 #$i_inttypes I_INTTYPES
5636 #ifdef I_INTTYPES
5637 #include <inttypes.h>
5638 #endif
5639 int main() { int64_t x = 7; }
5640 EOCP
5641 set try
5642 if eval $compile; then
5643         val="$define"
5644         echo "You have int64_t."
5645 else
5646         val="$undef"
5647         echo "You do not have int64_t."
5648 fi
5649 $rm_try
5650 set d_int64_t
5651 eval $setvar
5652
5653 : Check if 64bit ints have a quad type
5654 echo " "
5655 echo "Checking which 64-bit integer type we could use..." >&4
5656
5657 case "$intsize" in
5658 8) val=int
5659    set quadtype
5660    eval $setvar
5661    val='"unsigned int"'
5662    set uquadtype
5663    eval $setvar
5664    quadkind=1
5665    ;;
5666 *) case "$longsize" in
5667    8) val=long
5668       set quadtype
5669       eval $setvar
5670       val='"unsigned long"'
5671       set uquadtype
5672       eval $setvar
5673       quadkind=2
5674       ;;
5675    *) case "$d_longlong:$longlongsize" in
5676       define:8)
5677         val='"long long"'
5678         set quadtype
5679         eval $setvar
5680         val='"unsigned long long"'
5681         set uquadtype
5682         eval $setvar
5683         quadkind=3
5684         ;;
5685       *) case "$d_int64_t" in
5686          define)
5687            val=int64_t
5688            set quadtype
5689            eval $setvar
5690            val=uint64_t
5691            set uquadtype
5692            eval $setvar
5693            quadkind=4
5694            ;;
5695          esac
5696          ;;
5697       esac
5698       ;;
5699    esac
5700    ;;
5701 esac
5702
5703 case "$quadtype" in
5704 '')     echo "Alas, no 64-bit integer types in sight." >&4
5705         d_quad="$undef"
5706         ;;
5707 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5708         d_quad="$define"
5709         ;;
5710 esac
5711
5712 : Do we want 64bit support
5713 case "$uselonglong" in
5714 "$define"|true|[yY]*)
5715         cat <<EOM >&4
5716
5717 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5718 EOM
5719         use64bitint="$define"
5720         ;;
5721 esac
5722 case "$use64bits" in
5723 "$define"|true|[yY]*)
5724         cat <<EOM >&4
5725
5726 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5727 EOM
5728         use64bitint="$define"
5729         ;;
5730 esac
5731 case "$use64bitints" in
5732 "$define"|true|[yY]*)
5733         cat <<EOM >&4
5734
5735 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5736 EOM
5737         use64bitint="$define"
5738         ;;
5739 esac
5740 case "$use64bitsint" in
5741 "$define"|true|[yY]*)
5742         cat <<EOM >&4
5743
5744 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5745 EOM
5746         use64bitint="$define"
5747         ;;
5748 esac
5749 case "$uselonglongs" in
5750 "$define"|true|[yY]*)
5751         cat <<EOM >&4
5752
5753 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5754 EOM
5755         use64bitint="$define"
5756         ;;
5757 esac
5758 case "$use64bitsall" in
5759 "$define"|true|[yY]*)
5760         cat <<EOM >&4
5761
5762 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5763 EOM
5764         use64bitall="$define"
5765         ;;
5766 esac
5767
5768 case "$ccflags" in
5769 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5770 esac
5771 case "$use64bitall" in
5772 "$define"|true|[yY]*) use64bitint="$define" ;;
5773 esac
5774
5775 case "$longsize" in
5776 8) cat <<EOM
5777
5778 You have natively 64-bit long integers.
5779 EOM
5780    val="$define"
5781    ;;
5782 *) case "$use64bitint" in
5783    "$define"|true|[yY]*) dflt='y';;
5784    *) dflt='n';;
5785    esac
5786    case "$d_quad" in
5787    "$define") ;;
5788    *) dflt='n' ;;
5789    esac
5790    cat <<EOM
5791
5792 Perl can be built to take advantage of 64-bit integer types
5793 on some systems.  To do so, Configure can be run with -Duse64bitint.
5794 Choosing this option will most probably introduce binary incompatibilities.
5795
5796 If this doesn't make any sense to you, just accept the default '$dflt'.
5797 (The default has been chosen based on your configuration.)
5798 EOM
5799    rp='Try to use 64-bit integers, if available?'
5800    . ./myread
5801    case "$ans" in
5802    [yY]*) val="$define" ;;
5803    *)     val="$undef"  ;;
5804    esac
5805    ;;
5806 esac
5807 set use64bitint
5808 eval $setvar
5809
5810 case "$use64bitall" in
5811 "$define"|true|[yY]*) dflt='y' ;;
5812 *) case "$longsize" in
5813    8) dflt='y' ;;
5814    *) dflt='n' ;;
5815    esac
5816    ;;
5817 esac
5818 cat <<EOM
5819
5820 You may also choose to try maximal 64-bitness.  It means using as much
5821 64-bitness as possible on the platform.  This in turn means even more
5822 binary incompatibilities.  On the other hand, your platform may not
5823 have any more 64-bitness available than what you already have chosen.
5824
5825 If this doesn't make any sense to you, just accept the default '$dflt'.
5826 (The default has been chosen based on your configuration.)
5827 EOM
5828 rp='Try to use maximal 64-bit support, if available?'
5829 . ./myread
5830 case "$ans" in
5831 [yY]*) val="$define" ;;
5832 *)     val="$undef"  ;;
5833 esac
5834 set use64bitall
5835 eval $setvar
5836 case "$use64bitall" in
5837 "$define")
5838         case "$use64bitint" in
5839         "$undef")
5840                 cat <<EOM
5841
5842 Since you have chosen a maximally 64-bit build, I'm also turning on
5843 the use of 64-bit integers.
5844 EOM
5845                 use64bitint="$define" ;;
5846         esac
5847         ;;
5848 esac
5849
5850 : Look for a hint-file generated 'call-back-unit'.  If the
5851 : user has specified that a 64-bit perl is to be built,
5852 : we may need to set or change some other defaults.
5853 if $test -f use64bitint.cbu; then
5854         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5855         . ./use64bitint.cbu
5856 fi
5857 case "$use64bitint" in
5858 "$define"|true|[yY]*)
5859         : This test was common to all the OpenBSD forks, and seems harmless for
5860         : other platforms:
5861         echo " "
5862         echo "Checking if your C library has broken 64-bit functions..." >&4
5863         cat >try.c <<EOCP
5864 #include <stdio.h>
5865 typedef $uquadtype myULL;
5866 int main (void)
5867 {
5868     struct {
5869         double d;
5870         myULL  u;
5871     } *p, test[] = {
5872         {4294967303.15, 4294967303ULL},
5873         {4294967294.2,  4294967294ULL},
5874         {4294967295.7,  4294967295ULL},
5875         {0.0, 0ULL}
5876     };
5877     for (p = test; p->u; p++) {
5878         myULL x = (myULL)p->d;
5879         if (x != p->u) {
5880             printf("buggy\n");
5881             return 0;
5882         }
5883     }
5884     printf("ok\n");
5885     return 0;
5886 }
5887 EOCP
5888         set try
5889         if eval $compile_ok; then
5890             libcquad=`./try`
5891             echo "Your C library's 64-bit functions are $libcquad."
5892         else
5893             echo "(I can't seem to compile the test program.)"
5894             echo "Assuming that your C library's 64-bit functions are ok."
5895             libcquad="ok"
5896         fi
5897         $rm_try
5898
5899         case "$libcquad" in
5900             buggy*)
5901                 cat >&4 <<EOM
5902
5903 *** You have a C library with broken 64-bit functions.
5904 *** 64-bit support does not work reliably in this configuration.
5905 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5906 *** Cannot continue, aborting.
5907
5908 EOM
5909                 exit 1
5910                 ;;
5911         esac
5912         case "$longsize" in
5913         4) case "$archname64" in
5914            '') archname64=64int ;;
5915            esac
5916            ;;
5917         esac
5918         ;;
5919 esac
5920
5921 : Look for a hint-file generated 'call-back-unit'.  If the
5922 : user has specified that a maximally 64-bit perl is to be built,
5923 : we may need to set or change some other defaults.
5924 if $test -f use64bitall.cbu; then
5925         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5926         . ./use64bitall.cbu
5927 fi
5928 case "$use64bitall" in
5929 "$define"|true|[yY]*)
5930         case "$longsize" in
5931         4) case "$archname64" in
5932            ''|64int) archname64=64all ;;
5933            esac
5934            ;;
5935         esac
5936         ;;
5937 esac
5938
5939 case "$d_quad:$use64bitint" in
5940 $undef:$define)
5941         cat >&4 <<EOF
5942
5943 *** You have chosen to use 64-bit integers,
5944 *** but none can be found.
5945 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5946 *** Cannot continue, aborting.
5947
5948 EOF
5949         exit 1
5950         ;;
5951 esac
5952
5953 : check for length of double
5954 echo " "
5955 case "$doublesize" in
5956 '')
5957         echo "Checking to see how big your double precision numbers are..." >&4
5958         $cat >try.c <<EOCP
5959 #include <stdio.h>
5960 #$i_stdlib I_STDLIB
5961 #ifdef I_STDLIB
5962 #include <stdlib.h>
5963 #endif
5964 int main()
5965 {
5966     printf("%d\n", (int)sizeof(double));
5967     exit(0);
5968 }
5969 EOCP
5970         set try
5971         if eval $compile_ok; then
5972                 doublesize=`$run ./try`
5973                 echo "Your double is $doublesize bytes long."
5974         else
5975                 dflt='8'
5976                 echo "(I can't seem to compile the test program.  Guessing...)"
5977                 rp="What is the size of a double precision number (in bytes)?"
5978                 . ./myread
5979                 doublesize="$ans"
5980         fi
5981         ;;
5982 esac
5983 $rm_try
5984
5985 : check for long doubles
5986 echo " "
5987 echo "Checking to see if you have long double..." >&4
5988 echo 'int main() { long double x = 7.0; }' > try.c
5989 set try
5990 if eval $compile; then
5991         val="$define"
5992         echo "You have long double."
5993 else
5994         val="$undef"
5995         echo "You do not have long double."
5996 fi
5997 $rm_try
5998 set d_longdbl
5999 eval $setvar
6000
6001 : check for length of long double
6002 case "${d_longdbl}${longdblsize}" in
6003 $define)
6004         echo " "
6005         echo "Checking to see how big your long doubles are..." >&4
6006         $cat >try.c <<'EOCP'
6007 #include <stdio.h>
6008 int main()
6009 {
6010         printf("%d\n", sizeof(long double));
6011 }
6012 EOCP
6013         set try
6014         set try
6015         if eval $compile; then
6016                 longdblsize=`$run ./try`
6017                 echo "Your long doubles are $longdblsize bytes long."
6018         else
6019                 dflt='8'
6020                 echo " "
6021                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6022                 rp="What is the size of a long double (in bytes)?"
6023                 . ./myread
6024                 longdblsize="$ans"
6025         fi
6026         if $test "X$doublesize" = "X$longdblsize"; then
6027                 echo "That isn't any different from an ordinary double."
6028                 echo "I'll keep your setting anyway, but you may see some"
6029                 echo "harmless compilation warnings."
6030         fi
6031         ;;
6032 esac
6033 $rm_try
6034
6035 : determine the architecture name
6036 echo " "
6037 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6038         tarch=`arch`"-$osname"
6039 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6040         if uname -m > tmparch 2>&1 ; then
6041                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6042                         -e 's/$/'"-$osname/" tmparch`
6043         else
6044                 tarch="$osname"
6045         fi
6046         $rm -f tmparch
6047 else
6048         tarch="$osname"
6049 fi
6050 case "$myarchname" in
6051 ''|"$tarch") ;;
6052 *)
6053         echo "(Your architecture name used to be $myarchname.)"
6054         archname=''
6055         ;;
6056 esac
6057 case "$targetarch" in
6058 '') ;;
6059 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6060 esac
6061 myarchname="$tarch"
6062 case "$archname" in
6063 '') dflt="$tarch";;
6064 *) dflt="$archname";;
6065 esac
6066 rp='What is your architecture name'
6067 . ./myread
6068 archname="$ans"
6069
6070 : optionally add API version to the architecture for versioned archlibs
6071 case "$useversionedarchname" in
6072 $define|true|[yY]*) dflt='y';;
6073 *)                  dflt='n';;
6074 esac
6075 rp='Add the Perl API version to your archname?'
6076 . ./myread
6077 case "$ans" in
6078 y|Y)    useversionedarchname="$define" ;;
6079 *)      useversionedarchname="$undef" ;;
6080 esac
6081 case "$useversionedarchname" in
6082 $define)
6083         case "$archname" in
6084         *-$api_versionstring)
6085                 echo "...and architecture name already has -$api_versionstring" >&4
6086                 ;;
6087         *)
6088                 archname="$archname-$api_versionstring"
6089                 echo "...setting architecture name to $archname." >&4
6090                 ;;
6091         esac
6092         ;;
6093 esac
6094
6095 case "$usethreads" in
6096 $define)
6097         echo "Threads selected." >&4
6098         case "$archname" in
6099         *-thread*) echo "...and architecture name already has -thread." >&4
6100                 ;;
6101         *)      archname="$archname-thread"
6102                 echo "...setting architecture name to $archname." >&4
6103                 ;;
6104         esac
6105         ;;
6106 esac
6107 case "$usemultiplicity" in
6108 $define)
6109         echo "Multiplicity selected." >&4
6110         case "$archname" in
6111         *-multi*) echo "...and architecture name already has -multi." >&4
6112                 ;;
6113         *)      archname="$archname-multi"
6114                 echo "...setting architecture name to $archname." >&4
6115                 ;;
6116         esac
6117         ;;
6118 esac
6119 case "$use64bitint$use64bitall" in
6120 *"$define"*)
6121         case "$archname64" in
6122         '')
6123                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6124                 ;;
6125         *)
6126                 case "$use64bitint" in
6127                 "$define") echo "64 bit integers selected." >&4 ;;
6128                 esac
6129                 case "$use64bitall" in
6130                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6131                 esac
6132                 case "$archname" in
6133                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6134                         ;;
6135                 *)      archname="$archname-$archname64"
6136                         echo "...setting architecture name to $archname." >&4
6137                         ;;
6138                 esac
6139                 ;;
6140         esac
6141 esac
6142 case "$uselongdouble" in
6143 $define)
6144         echo "Long doubles selected." >&4
6145         case "$longdblsize" in
6146         $doublesize)
6147                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6148                 ;;
6149         *)
6150                 case "$archname" in
6151                 *-ld*) echo "...and architecture name already has -ld." >&4
6152                         ;;
6153                 *)      archname="$archname-ld"
6154                         echo "...setting architecture name to $archname." >&4
6155                         ;;
6156                 esac
6157                 ;;
6158         esac
6159         ;;
6160 esac
6161 if $test -f archname.cbu; then
6162         echo "Your platform has some specific hints for architecture name, using them..."
6163         . ./archname.cbu
6164 fi
6165
6166 : set the prefixit variable, to compute a suitable default value
6167 prefixit='case "$3" in
6168 ""|none)
6169         case "$oldprefix" in
6170         "") eval "$1=\"\$$2\"";;
6171         *)
6172                 case "$3" in
6173                 "") eval "$1=";;
6174                 none)
6175                         eval "tp=\"\$$2\"";
6176                         case "$tp" in
6177                         ""|" ") eval "$1=\"\$$2\"";;
6178                         *) eval "$1=";;
6179                         esac;;
6180                 esac;;
6181         esac;;
6182 *)
6183         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6184         case "$tp" in
6185         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6186         /*-$oldprefix/*|\~*-$oldprefix/*)
6187                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6188         *) eval "$1=\"\$$2\"";;
6189         esac;;
6190 esac'
6191
6192 : determine installation style
6193 : For now, try to deduce it from prefix unless it is already set.
6194 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6195 case "$installstyle" in
6196 '')     case "$prefix" in
6197                 *perl*) dflt='lib';;
6198                 *) dflt='lib/perl5' ;;
6199         esac
6200         ;;
6201 *)      dflt="$installstyle" ;;
6202 esac
6203 : Probably not worth prompting for this since we prompt for all
6204 : the directories individually, and the prompt would be too long and
6205 : confusing anyway.
6206 installstyle=$dflt
6207
6208 : determine where public executables go
6209 echo " "
6210 set dflt bin bin
6211 eval $prefixit
6212 fn=d~
6213 rp='Pathname where the public executables will reside?'
6214 . ./getfile
6215 if $test "X$ansexp" != "X$binexp"; then
6216         installbin=''
6217 fi
6218 prefixvar=bin
6219 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6220 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6221 :     this via initialinstalllocation
6222 . ./setprefixvar
6223
6224 case "$userelocatableinc" in
6225 $define|true|[yY]*)     dflt='y' ;;
6226 *)                      dflt='n' ;;
6227 esac
6228 cat <<EOM
6229
6230 Would you like to build Perl so that the installation is relocatable, so that
6231 library paths in @INC are determined relative to the path of the perl binary?
6232 This is not advised for system Perl installs, or if you need to run setid
6233 scripts or scripts under taint mode.
6234
6235 If this doesn't make any sense to you, just accept the default '$dflt'.
6236 EOM
6237 rp='Use relocatable @INC?'
6238 . ./myread
6239 case "$ans" in
6240 y|Y)    val="$define" ;;
6241 *)      val="$undef"  ;;
6242 esac
6243 set userelocatableinc
6244 eval $setvar
6245
6246 initialinstalllocation="$binexp"
6247 : Default prefix is now "up one level from where the binaries are"
6248 case "$userelocatableinc" in
6249 $define|true|[yY]*)
6250     bin=".../"
6251     binexp=".../"
6252     prefix=".../.."
6253     prefixexp=".../.."
6254     installprefixexp=".../.."
6255     ;;
6256 esac
6257
6258 : determine where private library files go
6259 : Usual default is /usr/local/lib/perl5/$version.
6260 : Also allow things like /opt/perl/lib/$version, since
6261 : /opt/perl/lib/perl5... would be redundant.
6262 : The default "style" setting is made in installstyle.U
6263 case "$installstyle" in
6264 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6265 *)       set dflt privlib lib/$version ;;
6266 esac
6267 eval $prefixit
6268 $cat <<EOM
6269
6270 There are some auxiliary files for $package that need to be put into a
6271 private library directory that is accessible by everyone.
6272
6273 EOM
6274 fn=$binexp
6275 fn=d~+
6276 rp='Pathname where the private library files will reside?'
6277 . ./getfile
6278 prefixvar=privlib
6279 . ./setprefixvar
6280
6281 : set the prefixup variable, to restore leading tilda escape
6282 prefixup='case "$prefixexp" in
6283 "$prefix") ;;
6284 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6285 esac'
6286
6287 : determine where public architecture dependent libraries go
6288 set archlib archlib
6289 eval $prefixit
6290 : privlib default is /usr/local/lib/$package/$version
6291 : archlib default is /usr/local/lib/$package/$version/$archname
6292 : privlib may have an optional trailing /share.
6293 tdflt=`echo $privlib | $sed 's,/share$,,'`
6294 tdflt=$tdflt/$archname
6295 case "$archlib" in
6296 '')     dflt=$tdflt
6297         ;;
6298 *)      dflt="$archlib"
6299     ;;
6300 esac
6301 $cat <<EOM
6302
6303 $spackage contains architecture-dependent library files.  If you are
6304 sharing libraries in a heterogeneous environment, you might store
6305 these files in a separate location.  Otherwise, you can just include
6306 them with the rest of the public library files.
6307
6308 EOM
6309 fn=$binexp
6310 fn=d+~
6311 rp='Where do you want to put the public architecture-dependent libraries?'
6312 . ./getfile
6313 prefixvar=archlib
6314 . ./setprefixvar
6315 if $test X"$archlib" = X"$privlib"; then
6316         d_archlib="$undef"
6317 else
6318         d_archlib="$define"
6319 fi
6320
6321 : see if setuid scripts can be secure
6322 $cat <<EOM
6323
6324 Some kernels have a bug that prevents setuid #! scripts from being
6325 secure.  Some sites have disabled setuid #! scripts because of this.
6326
6327 First let's decide if your kernel supports secure setuid #! scripts.
6328 (If setuid #! scripts would be secure but have been disabled anyway,
6329 don't say that they are secure if asked.)
6330
6331 EOM
6332
6333 val="$undef"
6334 if $test -d /dev/fd; then
6335         echo "#!$ls" >reflect
6336         chmod +x,u+s reflect
6337         ./reflect >flect 2>&1
6338         if $contains "/dev/fd" flect >/dev/null; then
6339                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6340                 val="$define"
6341         else
6342                 $cat <<EOM
6343 If you are not sure if they are secure, I can check but I'll need a
6344 username and password different from the one you are using right now.
6345 If you don't have such a username or don't want me to test, simply
6346 enter 'none'.
6347
6348 EOM
6349                 rp='Other username to test security of setuid scripts with?'
6350                 dflt='none'
6351                 . ./myread
6352                 case "$ans" in
6353                 n|none)
6354                         case "$d_suidsafe" in
6355                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6356                                 dflt=n;;
6357                         "$undef")
6358                                 echo "Well, the $hint value is *not* secure." >&4
6359                                 dflt=n;;
6360                         *)      echo "Well, the $hint value *is* secure." >&4
6361                                 dflt=y;;
6362                         esac
6363                         ;;
6364                 *)
6365                         $rm -f reflect flect
6366                         echo "#!$ls" >reflect
6367                         chmod +x,u+s reflect
6368                         echo >flect
6369                         chmod a+w flect
6370                         echo '"su" will (probably) prompt you for '"$ans's password."
6371                         su $ans -c './reflect >flect'
6372                         if $contains "/dev/fd" flect >/dev/null; then
6373                                 echo "Okay, it looks like setuid scripts are secure." >&4
6374                                 dflt=y
6375                         else
6376                                 echo "I don't think setuid scripts are secure." >&4
6377                                 dflt=n
6378                         fi
6379                         ;;
6380                 esac
6381                 rp='Does your kernel have *secure* setuid scripts?'
6382                 . ./myread
6383                 case "$ans" in
6384                 [yY]*)  val="$define";;
6385                 *)      val="$undef";;
6386                 esac
6387         fi
6388 else
6389         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6390         echo "(That's for file descriptors, not floppy disks.)"
6391         val="$undef"
6392 fi
6393 set d_suidsafe
6394 eval $setvar
6395
6396 $rm -f reflect flect
6397
6398 : now see if they want to do setuid emulation
6399 if $test $patchlevel -lt 11; then
6400 echo " "
6401 val="$undef"
6402 case "$d_suidsafe" in
6403 "$define")
6404         val="$undef"
6405         echo "No need to emulate SUID scripts since they are secure here." >&4
6406         ;;
6407 *)
6408         $cat <<EOM
6409 Some systems have disabled setuid scripts, especially systems where
6410 setuid scripts cannot be secure.  On systems where setuid scripts have
6411 been disabled, the setuid/setgid bits on scripts are currently
6412 useless.  It is possible for $package to detect those bits and emulate
6413 setuid/setgid in a secure fashion.  This emulation will only work if
6414 setuid scripts have been disabled in your kernel.
6415
6416 EOM
6417         case "$d_dosuid" in
6418         "$define") dflt=y ;;
6419         *) dflt=n ;;
6420         esac
6421         rp="Do you want to do setuid/setgid emulation?"
6422         . ./myread
6423         case "$ans" in
6424         [yY]*)  val="$define";;
6425         *)      val="$undef";;
6426         esac
6427         ;;
6428 esac
6429 set d_dosuid
6430 eval $setvar
6431 else
6432     case "$d_dosuid" in
6433         "$define")
6434         cat >&4 <<EOH
6435
6436 SUID emulation has been removed for 5.12
6437 Please re-run Configure without -Dd_dosuid
6438
6439 EOH
6440         exit 1;
6441         ;;
6442     esac
6443     d_dosuid=undef
6444 fi
6445
6446 : Find perl5.005 or later.
6447 echo "Looking for a previously installed perl5.005 or later... "
6448 case "$perl5" in
6449 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6450                 : Check if this perl is recent and can load a simple module
6451                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6452                         perl5=$tdir/perl
6453                         break;
6454                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6455                         perl5=$tdir/perl5
6456                         break;
6457                 fi
6458         done
6459         ;;
6460 *)      perl5="$perl5"
6461         ;;
6462 esac
6463 case "$perl5" in
6464 '')     echo "None found.  That's ok.";;
6465 *)      echo "Using $perl5." ;;
6466 esac
6467
6468 : Set the siteprefix variables
6469 $cat <<EOM
6470
6471 After $package is installed, you may wish to install various
6472 add-on modules and utilities.  Typically, these add-ons will
6473 be installed under $prefix with the rest
6474 of this package.  However, you may wish to install such add-ons
6475 elsewhere under a different prefix.
6476
6477 If you do not wish to put everything under a single prefix, that's
6478 ok.  You will be prompted for the individual locations; this siteprefix
6479 is only used to suggest the defaults.
6480
6481 The default should be fine for most people.
6482
6483 EOM
6484 fn=d~+
6485 rp='Installation prefix to use for add-on modules and utilities?'
6486 : XXX Here might be another good place for an installstyle setting.
6487 case "$siteprefix" in
6488 '') dflt=$prefix ;;
6489 *)  dflt=$siteprefix ;;
6490 esac
6491 . ./getfile
6492 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6493 oldsiteprefix=''
6494 case "$siteprefix" in
6495 '') ;;
6496 *)      case "$ans" in
6497         "$prefix") ;;
6498         *) oldsiteprefix="$prefix";;
6499         esac
6500         ;;
6501 esac
6502 siteprefix="$ans"
6503 siteprefixexp="$ansexp"
6504
6505 : determine where site specific libraries go.
6506 : Usual default is /usr/local/lib/perl5/site_perl/$version
6507 : The default "style" setting is made in installstyle.U
6508 : XXX No longer works with Prefixit stuff.
6509 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6510 case "$sitelib" in
6511 '') case "$installstyle" in
6512         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6513         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6514         esac
6515         ;;
6516 *)      dflt="$sitelib"
6517         ;;
6518 esac
6519 $cat <<EOM
6520
6521 The installation process will create a directory for
6522 site-specific extensions and modules.  Most users find it convenient
6523 to place all site-specific files in this directory rather than in the
6524 main distribution directory.
6525
6526 EOM
6527 fn=d~+
6528 rp='Pathname for the site-specific library files?'
6529 . ./getfile
6530 prefixvar=sitelib
6531 . ./setprefixvar
6532 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6533
6534 : Determine list of previous versions to include in @INC
6535 $cat > getverlist <<EOPL
6536 #!$perl5 -w
6537 use File::Basename;
6538 \$api_versionstring = "$api_versionstring";
6539 \$version = "$version";
6540 \$stem = "$sitelib_stem";
6541 \$archname = "$archname";
6542 EOPL
6543         $cat >> getverlist <<'EOPL'
6544 # The list found is store twice for each entry: the original name, and
6545 # the binary broken down version as pack "sss", so sorting is easy and
6546 # unambiguous. This will work for all versions that have a maximum of
6547 # three digit groups, separate by '.'s or '_'s. Names are extended with
6548 # ".0.0" to ensure at least three elements for the pack.
6549 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6550
6551 # Can't have leading @ because metaconfig interprets it as a command!
6552 ;@inc_version_list=();
6553 # XXX Redo to do opendir/readdir?
6554 if (-d $stem) {
6555     chdir($stem);
6556     ;@candidates = map {
6557         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6558     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6559 }
6560 else {
6561     ;@candidates = ();
6562 }
6563
6564 ($pversion, $aversion, $vsn5005) = map {
6565     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6566 foreach $d (@candidates) {
6567     if ($d->[1] lt $pversion) {
6568         if ($d->[1] ge $aversion) {
6569             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6570         }
6571         elsif ($d->[1] ge $vsn5005) {
6572             unshift(@inc_version_list, grep { -d } $d->[0]);
6573         }
6574     }
6575     else {
6576         # Skip newer version.  I.e. don't look in
6577         # 5.7.0 if we're installing 5.6.1.
6578     }
6579 }
6580
6581 if (@inc_version_list) {
6582     print join(' ', @inc_version_list);
6583 }
6584 else {
6585     # Blank space to preserve value for next Configure run.
6586     print " ";
6587 }
6588 EOPL
6589 chmod +x getverlist
6590 case "$inc_version_list" in
6591 '')     if test -x "$perl5$exe_ext"; then
6592                 dflt=`$perl5 getverlist`
6593         else
6594                 dflt='none'
6595         fi
6596         ;;
6597 $undef) dflt='none' ;;
6598 *)  eval dflt=\"$inc_version_list\" ;;
6599 esac
6600 case "$dflt" in
6601 ''|' ') dflt=none ;;
6602 esac
6603 case "$dflt" in
6604 5.005) dflt=none ;;
6605 esac
6606 $cat <<EOM
6607
6608 In order to ease the process of upgrading, this version of perl
6609 can be configured to use modules built and installed with earlier
6610 versions of perl that were installed under $prefix.  Specify here
6611 the list of earlier versions that this version of perl should check.
6612 If Configure detected no earlier versions of perl installed under
6613 $prefix, then the list will be empty.  Answer 'none' to tell perl
6614 to not search earlier versions.
6615
6616 The default should almost always be sensible, so if you're not sure,
6617 just accept the default.
6618 EOM
6619
6620 rp='List of earlier versions to include in @INC?'
6621 . ./myread
6622 case "$ans" in
6623 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6624 *) inc_version_list="$ans" ;;
6625 esac
6626 case "$inc_version_list" in
6627 ''|' ')
6628         inc_version_list_init='0'
6629         d_inc_version_list="$undef"
6630         ;;
6631 *)      inc_version_list_init=`echo $inc_version_list |
6632                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6633         d_inc_version_list="$define"
6634         ;;
6635 esac
6636 $rm -f getverlist
6637
6638 : see if malloc/malloc.h has to be included
6639 set malloc/malloc.h i_mallocmalloc
6640 eval $inhdr
6641
6642 : see if this is a malloc.h system
6643 : we want a real compile instead of Inhdr because some systems have a
6644 : malloc.h that just gives a compile error saying to use stdlib.h instead
6645 echo " "
6646 $cat >try.c <<EOCP
6647 #include <stdlib.h>
6648 #include <malloc.h>
6649 #$i_mallocmalloc I_MALLOCMALLOC
6650 #ifdef I_MALLOCMALLOC
6651 # include <malloc/malloc.h>
6652 #endif
6653
6654 int main () { return 0; }
6655 EOCP
6656 set try
6657 if eval $compile; then
6658     echo "<malloc.h> found." >&4
6659     val="$define"
6660 else
6661     echo "<malloc.h> NOT found." >&4
6662     val="$undef"
6663 fi
6664 $rm_try
6665 set i_malloc
6666 eval $setvar
6667
6668 : check for length of pointer
6669 echo " "
6670 case "$ptrsize" in
6671 '')
6672         echo "Checking to see how big your pointers are..." >&4
6673         $cat >>try.c <<EOCP
6674 #include <stdio.h>
6675 #$i_stdlib I_STDLIB
6676 #ifdef I_STDLIB
6677 #include <stdlib.h>
6678 #endif
6679 int main()
6680 {
6681     printf("%d\n", (int)sizeof(void *));
6682     exit(0);
6683 }
6684 EOCP
6685         set try
6686         if eval $compile_ok; then
6687                 ptrsize=`$run ./try`
6688                 echo "Your pointers are $ptrsize bytes long."
6689         else
6690                 dflt='4'
6691                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6692                 rp="What is the size of a pointer (in bytes)?"
6693                 . ./myread
6694                 ptrsize="$ans"
6695         fi
6696         ;;
6697 esac
6698 $rm_try
6699 case "$use64bitall" in
6700 "$define"|true|[yY]*)
6701         case "$ptrsize" in
6702         4)      cat <<EOM >&4
6703
6704 *** You have chosen a maximally 64-bit build,
6705 *** but your pointers are only 4 bytes wide.
6706 *** Please rerun Configure without -Duse64bitall.
6707 EOM
6708                 case "$d_quad" in
6709                 define)
6710                         cat <<EOM >&4
6711 *** Since you have quads, you could possibly try with -Duse64bitint.
6712 EOM
6713                         ;;
6714                 esac
6715                 cat <<EOM >&4
6716 *** Cannot continue, aborting.
6717
6718 EOM
6719
6720                 exit 1
6721                 ;;
6722         esac
6723         ;;
6724 esac
6725
6726
6727 : determine whether to use malloc wrapping
6728 echo " "
6729 case "$usemallocwrap" in
6730 [yY]*|true|$define)     dflt='y' ;;
6731 [nN]*|false|$undef)     dflt='n' ;;
6732 *)      case "$usedevel" in
6733         [yY]*|true|$define)     dflt='y' ;;
6734         *) dflt='n' ;;
6735         esac
6736         ;;
6737 esac
6738 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6739 . ./myread
6740 usemallocwrap="$ans"
6741 case "$ans" in
6742 y*|true)
6743         usemallocwrap="$define" ;;
6744 *)
6745         usemallocwrap="$undef" ;;
6746 esac
6747
6748 : determine which malloc to compile in
6749 echo " "
6750 case "$usemymalloc" in
6751 [yY]*|true|$define)     dflt='y' ;;
6752 [nN]*|false|$undef)     dflt='n' ;;
6753 *)      case "$ptrsize" in
6754         4) dflt='y' ;;
6755         *) dflt='n' ;;
6756         esac
6757         if test "$useithreads" = "$define"; then dflt='n'; fi
6758         ;;
6759 esac
6760 rp="Do you wish to attempt to use the malloc that comes with $package?"
6761 . ./myread
6762 usemymalloc="$ans"
6763 case "$ans" in
6764 y*|true)
6765         usemymalloc='y'
6766         mallocsrc='malloc.c'
6767         mallocobj="malloc$_o"
6768         d_mymalloc="$define"
6769         case "$libs" in
6770         *-lmalloc*)
6771                 : Remove malloc from list of libraries to use
6772                 echo "Removing unneeded -lmalloc from library list" >&4
6773                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6774                 shift
6775                 libs="$*"
6776                 echo "libs = $libs" >&4
6777                 ;;
6778         esac
6779         ;;
6780 *)
6781         usemymalloc='n'
6782         mallocsrc=''
6783         mallocobj=''
6784         d_mymalloc="$undef"
6785         ;;
6786 esac
6787
6788 : compute the return types of malloc and free
6789 echo " "
6790 $cat >malloc.c <<END
6791 #$i_malloc I_MALLOC
6792 #$i_stdlib I_STDLIB
6793 #include <stdio.h>
6794 #include <sys/types.h>
6795 #ifdef I_MALLOC
6796 #include <malloc.h>
6797 #endif
6798 #ifdef I_STDLIB
6799 #include <stdlib.h>
6800 #endif
6801 #ifdef TRY_MALLOC
6802 void *malloc();
6803 #endif
6804 #ifdef TRY_FREE
6805 void free();
6806 #endif
6807 END
6808 case "$malloctype" in
6809 '')
6810         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6811                 malloctype='void *'
6812         else
6813                 malloctype='char *'
6814         fi
6815         ;;
6816 esac
6817 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6818
6819 case "$freetype" in
6820 '')
6821         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6822                 freetype='void'
6823         else
6824                 freetype='int'
6825         fi
6826         ;;
6827 esac
6828 echo "Your system uses $freetype free(), it would seem." >&4
6829 $rm -f malloc.[co]
6830 : determine where site specific architecture-dependent libraries go.
6831 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6832 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6833 : sitelib may have an optional trailing /share.
6834 case "$sitearch" in
6835 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6836         dflt="$dflt/$archname"
6837         ;;
6838 *)      dflt="$sitearch"
6839         ;;
6840 esac
6841 set sitearch sitearch none
6842 eval $prefixit
6843 $cat <<EOM
6844
6845 The installation process will also create a directory for
6846 architecture-dependent site-specific extensions and modules.
6847
6848 EOM
6849 fn=d~+
6850 rp='Pathname for the site-specific architecture-dependent library files?'
6851 . ./getfile
6852 prefixvar=sitearch
6853 . ./setprefixvar
6854 if $test X"$sitearch" = X"$sitelib"; then
6855         d_sitearch="$undef"
6856 else
6857         d_sitearch="$define"
6858 fi
6859
6860 : Set the vendorprefix variables
6861 $cat <<EOM
6862
6863 The installation process will also create a directory for
6864 vendor-supplied add-ons.  Vendors who supply perl with their system
6865 may find it convenient to place all vendor-supplied files in this
6866 directory rather than in the main distribution directory.  This will
6867 ease upgrades between binary-compatible maintenance versions of perl.
6868
6869 Of course you may also use these directories in whatever way you see
6870 fit.  For example, you might use them to access modules shared over a
6871 company-wide network.
6872
6873 The default answer should be fine for most people.
6874 This causes further questions about vendor add-ons to be skipped
6875 and no vendor-specific directories will be configured for perl.
6876
6877 EOM
6878 rp='Do you want to configure vendor-specific add-on directories?'
6879 case "$usevendorprefix" in
6880 define|true|[yY]*) dflt=y ;;
6881 *)      : User may have set vendorprefix directly on Configure command line.
6882         case "$vendorprefix" in
6883         ''|' ') dflt=n ;;
6884         *)      dflt=y ;;
6885         esac
6886         ;;
6887 esac
6888 . ./myread
6889 case "$ans" in
6890 [yY]*)  fn=d~+
6891         rp='Installation prefix to use for vendor-supplied add-ons?'
6892         case "$vendorprefix" in
6893         '') dflt="$prefix" ;;
6894         *)  dflt=$vendorprefix ;;
6895         esac
6896         . ./getfile
6897         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6898         oldvendorprefix=''
6899         case "$vendorprefix" in
6900         '') ;;
6901         *)      case "$ans" in
6902                 "$prefix") ;;
6903                 *) oldvendorprefix="$prefix";;
6904                 esac
6905                 ;;
6906         esac
6907         usevendorprefix="$define"
6908         vendorprefix="$ans"
6909         vendorprefixexp="$ansexp"
6910         ;;
6911 *)      usevendorprefix="$undef"
6912         vendorprefix=''
6913         vendorprefixexp=''
6914         ;;
6915 esac
6916
6917 : Set the vendorlib variables
6918 case "$vendorprefix" in
6919 '')     d_vendorlib="$undef"
6920         vendorlib=''
6921         vendorlibexp=''
6922         ;;
6923 *)      d_vendorlib="$define"
6924         : determine where vendor-supplied modules go.
6925         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6926         case "$vendorlib" in
6927         '')
6928                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6929                 case "$installstyle" in
6930                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6931                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6932                 esac
6933                 ;;
6934         *)      dflt="$vendorlib"
6935                 ;;
6936         esac
6937         fn=d~+
6938         rp='Pathname for the vendor-supplied library files?'
6939         . ./getfile
6940         vendorlib="$ans"
6941         vendorlibexp="$ansexp"
6942         ;;
6943 esac
6944 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6945 prefixvar=vendorlib
6946 . ./installprefix
6947
6948 : Set the vendorarch variables
6949 case "$vendorprefix" in
6950 '')     d_vendorarch="$undef"
6951         vendorarch=''
6952         vendorarchexp=''
6953         ;;
6954 *)      d_vendorarch="$define"
6955         : determine where vendor-supplied architecture-dependent libraries go.
6956         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6957         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6958         : vendorlib may have an optional trailing /share.
6959         case "$vendorarch" in
6960         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6961                 dflt="$dflt/$archname"
6962                 ;;
6963         *)      dflt="$vendorarch" ;;
6964         esac
6965         fn=d~+
6966         rp='Pathname for vendor-supplied architecture-dependent files?'
6967         . ./getfile
6968         vendorarch="$ans"
6969         vendorarchexp="$ansexp"
6970         ;;
6971 esac
6972 prefixvar=vendorarch
6973 . ./installprefix
6974 if $test X"$vendorarch" = X"$vendorlib"; then
6975         d_vendorarch="$undef"
6976 else
6977         d_vendorarch="$define"
6978 fi
6979
6980 : Final catch-all directories to search
6981 $cat <<EOM
6982
6983 Lastly, you can have perl look in other directories for extensions and
6984 modules in addition to those already specified.
6985 These directories will be searched after
6986         $sitearch
6987         $sitelib
6988 EOM
6989 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6990 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6991 echo ' '
6992 case "$otherlibdirs" in
6993 ''|' ') dflt='none' ;;
6994 *)      dflt="$otherlibdirs" ;;
6995 esac
6996 $cat <<EOM
6997 Enter a colon-separated set of extra paths to include in perl's @INC
6998 search path, or enter 'none' for no extra paths.
6999
7000 EOM
7001
7002 rp='Colon-separated list of additional directories for perl to search?'
7003 . ./myread
7004 case "$ans" in
7005 ' '|''|none)    otherlibdirs=' ' ;;
7006 *)      otherlibdirs="$ans" ;;
7007 esac
7008 case "$otherlibdirs" in
7009 ' ') val=$undef ;;
7010 *)      val=$define ;;
7011 esac
7012 set d_perl_otherlibdirs
7013 eval $setvar
7014
7015 : Cruising for prototypes
7016 echo " "
7017 echo "Checking out function prototypes..." >&4
7018 $cat >prototype.c <<EOCP
7019 #$i_stdlib I_STDLIB
7020 #ifdef I_STDLIB
7021 #include <stdlib.h>
7022 #endif
7023 int main(int argc, char *argv[]) {
7024         exit(0);}
7025 EOCP
7026 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7027         echo "Your C compiler appears to support function prototypes."
7028         val="$define"
7029 else
7030         echo "Your C compiler doesn't seem to understand function prototypes."
7031         val="$undef"
7032 fi
7033 set prototype
7034 eval $setvar
7035 $rm -f prototype*
7036
7037 : Check if ansi2knr is required
7038 case "$prototype" in
7039 "$define") ;;
7040 *)      ansi2knr='ansi2knr'
7041         echo " "
7042         cat <<EOM >&4
7043
7044 $me:  FATAL ERROR:
7045 This version of $package can only be compiled by a compiler that 
7046 understands function prototypes.  Unfortunately, your C compiler 
7047         $cc $ccflags
7048 doesn't seem to understand them.  Sorry about that.
7049
7050 If GNU cc is available for your system, perhaps you could try that instead.  
7051
7052 Eventually, we hope to support building Perl with pre-ANSI compilers.
7053 If you would like to help in that effort, please contact <perlbug@perl.org>.
7054
7055 Aborting Configure now.
7056 EOM
7057         exit 2
7058         ;;
7059 esac
7060
7061 : DTrace support
7062 dflt_dtrace='/usr/sbin/dtrace'
7063 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7064
7065 cat <<EOM
7066
7067 Perl can be built to support DTrace on platforms that support it.
7068 DTrace is a diagnosis and performance analysis tool from Sun.
7069
7070 If this doesn't make any sense to you, just accept the default '$dflt'.
7071 EOM
7072
7073 while $test 1 ; do
7074         case "$usedtrace" in
7075         $define|true|[yY]*)
7076                 dflt='y'
7077                 ;;
7078         ?*)
7079                 dflt='y'
7080                 dflt_dtrace=$usedtrace
7081                 ;;
7082         *)
7083                 dflt='n'
7084                 ;;
7085         esac
7086
7087         rp='Support DTrace if available?'
7088         . ./myread
7089         case "$ans" in
7090         y|Y)    val="$define" ;;
7091         *)      val="$undef" ;;
7092         esac
7093         set usedtrace
7094         eval $setvar
7095
7096         test "X$usedtrace" != "X$define" && break
7097
7098         echo " "
7099         rp='Where is the dtrace executable?'
7100         dflt=$dflt_dtrace
7101         . ./getfile
7102         val="$ans"
7103         set dtrace
7104         eval $setvar
7105
7106         if $test -f $dtrace
7107         then
7108                 if $dtrace -h -s ../perldtrace.d \
7109                         -o perldtrace.tmp >/dev/null 2>&1 \
7110                         && rm -f perldtrace.tmp
7111                 then
7112                         echo " "
7113                         echo "Good: your $dtrace knows about the -h flag."
7114                 else
7115                         cat >&2 <<EOM
7116
7117 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7118 ***
7119 *** Your installed dtrace doesn't support the -h switch to compile a D
7120 *** program into a C header. Can't continue.
7121
7122 EOM
7123                         exit 1
7124                 fi
7125                 break;
7126         fi
7127
7128         case "$fastread" in
7129         yes)
7130                 cat >&2 <<EOM
7131
7132 *** $me:  Fatal Error:  $dtrace not found.
7133 *** Can't continue.
7134
7135 EOM
7136                 exit 1
7137                 ;;
7138         *)
7139                 echo "*** $dtrace was not found."
7140                 echo " "
7141                 ;;
7142         esac
7143 done
7144
7145 : See if we want extra modules installed
7146 echo " "
7147 case "$extras" in
7148 '') dflt='n';;
7149 *) dflt='y';;
7150 esac
7151 cat <<EOM
7152 Perl can be built with extra modules or bundles of modules which
7153 will be fetched from the CPAN and installed alongside Perl.
7154
7155 Notice that you will need access to the CPAN; either via the Internet,
7156 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7157 be asked later to configure the CPAN.pm module which will in turn do
7158 the installation of the rest of the extra modules or bundles.)
7159
7160 Notice also that if the modules require any external software such as
7161 libraries and headers (the libz library and the zlib.h header for the
7162 Compress::Zlib module, for example) you MUST have any such software
7163 already installed, this configuration process will NOT install such
7164 things for you.
7165
7166 If this doesn't make any sense to you, just accept the default '$dflt'.
7167 EOM
7168 rp='Install any extra modules (y or n)?'
7169 . ./myread
7170 case "$ans" in
7171 y|Y)
7172         cat <<EOM
7173
7174 Please list any extra modules or bundles to be installed from CPAN,
7175 with spaces between the names.  The names can be in any format the
7176 'install' command of CPAN.pm will understand.  (Answer 'none',
7177 without the quotes, to install no extra modules or bundles.)
7178 EOM
7179         rp='Extras?'
7180         dflt="$extras"
7181         . ./myread
7182         extras="$ans"
7183 esac
7184 case "$extras" in
7185 ''|'none')
7186         val=''
7187         $rm -f ../extras.lst
7188         ;;
7189 *)      echo "(Saving the list of extras for later...)"
7190         echo "$extras" > ../extras.lst
7191         val="'$extras'"
7192         ;;
7193 esac
7194 set extras
7195 eval $setvar
7196 echo " "
7197
7198 : determine where html pages for programs go
7199 set html1dir html1dir none
7200 eval $prefixit
7201 $cat <<EOM
7202
7203 If you wish to install html files for programs in $spackage, indicate
7204 the appropriate directory here.  To skip installing html files,
7205 answer "none".
7206 EOM
7207 case "$html1dir" in
7208 ''|none|$undef|' ') dflt=none ;;
7209 *) dflt=$html1dir ;;
7210 esac
7211 fn=dn+~
7212 rp="Directory for the main $spackage html pages?"
7213 . ./getfile
7214 prefixvar=html1dir
7215 . ./setprefixvar
7216 : Use ' ' for none so value is preserved next time through Configure
7217 $test X"$html1dir" = "X" && html1dir=' '
7218
7219 : determine where html pages for libraries and modules go
7220 set html3dir html3dir none
7221 eval $prefixit
7222 $cat <<EOM
7223
7224 If you wish to install html files for modules associated with $spackage,
7225 indicate the appropriate directory here.  To skip installing html files,
7226 answer "none".
7227 EOM
7228 : There is no obvious default.  If they have specified html1dir, then
7229 : try to key off that, possibly changing .../html1 into .../html3.
7230 case "$html3dir" in
7231 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7232 *) dflt=$html3dir ;;
7233 esac
7234 fn=dn+~
7235 rp="Directory for the $spackage module html pages?"
7236 . ./getfile
7237 prefixvar=html3dir
7238 . ./setprefixvar
7239 : Use ' ' for none so value is preserved next time through Configure
7240 $test X"$html3dir" = "X" && html3dir=' '
7241
7242 : determine whether to install perl also as /usr/bin/perl
7243
7244 echo " "
7245 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7246         $cat <<EOM
7247 Many scripts expect perl to be installed as /usr/bin/perl.
7248
7249 If you want to, I can install the perl you are about to compile
7250 as /usr/bin/perl (in addition to $bin/perl).
7251 EOM
7252         if test -f /usr/bin/perl; then
7253             $cat <<EOM
7254
7255 However, please note that because you already have a /usr/bin/perl,
7256 overwriting that with a new Perl would very probably cause problems.
7257 Therefore I'm assuming you don't want to do that (unless you insist).
7258
7259 EOM
7260             case "$installusrbinperl" in
7261             "$define"|[yY]*)    dflt='y';;
7262             *)                  dflt='n';;
7263             esac
7264         else
7265             $cat <<EOM
7266
7267 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7268
7269 EOM
7270             case "$installusrbinperl" in
7271             "$undef"|[nN]*)     dflt='n';;
7272             *)                  dflt='y';;
7273             esac
7274         fi
7275         rp="Do you want to install perl as /usr/bin/perl?"
7276         . ./myread
7277         case "$ans" in
7278         [yY]*)  val="$define";;
7279         *)      val="$undef" ;;
7280         esac
7281 else
7282         val="$undef"
7283 fi
7284 set installusrbinperl
7285 eval $setvar
7286
7287 : Check if we are using the GNU C library
7288 echo " "
7289 echo "Checking for GNU C Library..." >&4
7290 cat >try.c <<'EOCP'
7291 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7292    alone are insufficient to distinguish different versions, such as
7293    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7294    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7295 */
7296 #include <stdio.h>
7297 int main(void)
7298 {
7299 #ifdef __GLIBC__
7300 #   ifdef __GLIBC_MINOR__
7301 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7302 #           include <gnu/libc-version.h>
7303             printf("%s\n",  gnu_get_libc_version());
7304 #       else
7305             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7306 #       endif
7307 #   else
7308         printf("%d\n",  __GLIBC__);
7309 #   endif
7310     return 0;
7311 #else
7312     return 1;
7313 #endif
7314 }
7315 EOCP
7316 set try
7317 if eval $compile_ok && $run ./try > glibc.ver; then
7318         val="$define"
7319         gnulibc_version=`$cat glibc.ver`
7320         echo "You are using the GNU C Library version $gnulibc_version"
7321 else
7322         val="$undef"
7323         gnulibc_version=''
7324         echo "You are not using the GNU C Library"
7325 fi
7326 $rm_try glibc.ver
7327 set d_gnulibc
7328 eval $setvar
7329
7330 : see if nm is to be used to determine whether a symbol is defined or not
7331 case "$usenm" in
7332 '')
7333         dflt=''
7334         case "$d_gnulibc" in
7335         "$define")
7336                 echo " "
7337                 echo "nm probably won't work on the GNU C Library." >&4
7338                 dflt=n
7339                 ;;
7340         esac
7341         case "$dflt" in
7342         '')
7343                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7344                         echo " "
7345                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7346                         echo "'nm' won't be sufficient on this system." >&4
7347                         dflt=n
7348                 fi
7349                 ;;
7350         esac
7351         case "$dflt" in
7352         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7353                 if $test $dflt -gt 20; then
7354                         dflt=y
7355                 else
7356                         dflt=n
7357                 fi
7358                 ;;
7359         esac
7360         ;;
7361 *)
7362         case "$usenm" in
7363         true|$define) dflt=y;;
7364         *) dflt=n;;
7365         esac
7366         ;;
7367 esac
7368 $cat <<EOM
7369
7370 I can use $nm to extract the symbols from your C libraries. This
7371 is a time consuming task which may generate huge output on the disk (up
7372 to 3 megabytes) but that should make the symbols extraction faster. The
7373 alternative is to skip the 'nm' extraction part and to compile a small
7374 test program instead to determine whether each symbol is present. If
7375 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7376 this may be the best solution.
7377
7378 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7379
7380 EOM
7381 rp="Shall I use $nm to extract C symbols from the libraries?"
7382 . ./myread
7383 case "$ans" in
7384 [Nn]*) usenm=false;;
7385 *) usenm=true;;
7386 esac
7387
7388 runnm=$usenm
7389 case "$reuseval" in
7390 true) runnm=false;;
7391 esac
7392
7393 : nm options which may be necessary
7394 case "$nm_opt" in
7395 '') if $test -f /mach_boot; then
7396                 nm_opt=''       # Mach
7397         elif $test -d /usr/ccs/lib; then
7398                 nm_opt='-p'     # Solaris (and SunOS?)
7399         elif $test -f /dgux; then
7400                 nm_opt='-p'     # DG-UX
7401         elif $test -f /lib64/rld; then
7402                 nm_opt='-p'     # 64-bit Irix
7403         else
7404                 nm_opt=''
7405         fi;;
7406 esac
7407
7408 : nm options which may be necessary for shared libraries but illegal
7409 : for archive libraries.  Thank you, Linux.
7410 case "$nm_so_opt" in
7411 '')     case "$myuname" in
7412         *linux*|gnu*)
7413                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7414                         nm_so_opt='--dynamic'
7415                 fi
7416                 ;;
7417         esac
7418         ;;
7419 esac
7420
7421 : Figure out where the libc is located
7422 case "$runnm" in
7423 true)
7424 : get list of predefined functions in a handy place
7425 echo " "
7426 case "$libc" in
7427 '') libc=unknown
7428         case "$libs" in
7429         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7430         esac
7431         ;;
7432 esac
7433 case "$libs" in
7434 '') ;;
7435 *)  for thislib in $libs; do
7436         case "$thislib" in
7437         -lc|-lc_s)
7438                 : Handle C library specially below.
7439                 ;;
7440         -l*)
7441                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7442                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7443                         :
7444                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7445                         :
7446                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7447                         :
7448                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7449                         :
7450                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7451                         :
7452                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7453                         :
7454                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7455                         :
7456                 else
7457                         try=''
7458                 fi
7459                 libnames="$libnames $try"
7460                 ;;
7461         *) libnames="$libnames $thislib" ;;
7462         esac
7463         done
7464         ;;
7465 esac
7466 xxx=normal
7467 case "$libc" in
7468 unknown)
7469         set /lib/libc.$so
7470         for xxx in $libpth; do
7471                 $test -r $1 || set $xxx/libc.$so
7472                 : The messy sed command sorts on library version numbers.
7473                 $test -r $1 || \
7474                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7475                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7476                                 h
7477                                 s/[0-9][0-9]*/0000&/g
7478                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7479                                 G
7480                                 s/\n/ /' | \
7481                          $sort | $sed -e 's/^.* //'`
7482                 eval set \$$#
7483         done
7484         $test -r $1 || set /usr/ccs/lib/libc.$so
7485         $test -r $1 || set /lib/libsys_s$_a
7486         ;;
7487 *)
7488         set blurfl
7489         ;;
7490 esac
7491 if $test -r "$1"; then
7492         echo "Your (shared) C library seems to be in $1."
7493         libc="$1"
7494 elif $test -r /lib/libc && $test -r /lib/clib; then
7495         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7496         xxx=apollo
7497         libc='/lib/clib /lib/libc'
7498         if $test -r /lib/syslib; then
7499                 echo "(Your math library is in /lib/syslib.)"
7500                 libc="$libc /lib/syslib"
7501         fi
7502 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7503         echo "Your C library seems to be in $libc, as you said before."
7504 elif $test -r $incpath/usr/lib/libc$_a; then
7505         libc=$incpath/usr/lib/libc$_a;
7506         echo "Your C library seems to be in $libc.  That's fine."
7507 elif $test -r /lib/libc$_a; then
7508         libc=/lib/libc$_a;
7509         echo "Your C library seems to be in $libc.  You're normal."
7510 else
7511         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7512                 :
7513         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7514                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7515         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7516                 :
7517         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7518                 :
7519         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7520                 :
7521         else
7522                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7523         fi
7524         if $test -r "$tans"; then
7525                 echo "Your C library seems to be in $tans, of all places."
7526                 libc=$tans
7527         else
7528                 libc='blurfl'
7529         fi
7530 fi
7531 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7532         dflt="$libc"
7533         cat <<EOM
7534
7535 If the guess above is wrong (which it might be if you're using a strange
7536 compiler, or your machine supports multiple models), you can override it here.
7537
7538 EOM
7539 else
7540         dflt=''
7541         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7542         cat >&4 <<EOM
7543 I can't seem to find your C library.  I've looked in the following places:
7544
7545 EOM
7546         $sed 's/^/      /' libpath
7547         cat <<EOM
7548
7549 None of these seems to contain your C library. I need to get its name...
7550
7551 EOM
7552 fi
7553 fn=f
7554 rp='Where is your C library?'
7555 . ./getfile
7556 libc="$ans"
7557
7558 echo " "
7559 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7560 set X `cat libnames`
7561 shift
7562 xxx=files
7563 case $# in 1) xxx=file; esac
7564 echo "Extracting names from the following $xxx for later perusal:" >&4
7565 echo " "
7566 $sed 's/^/      /' libnames >&4
7567 echo " "
7568 $echo $n "This may take a while...$c" >&4
7569
7570 for file in $*; do
7571         case $file in
7572         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7573         *) $nm $nm_opt $file 2>/dev/null;;
7574         esac
7575 done >libc.tmp
7576
7577 $echo $n ".$c"
7578 $grep fprintf libc.tmp > libc.ptf
7579 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7580 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7581 xxx='[ADTSIWi]'
7582 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7583         eval $xscan;\
7584         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7585                 eval $xrun
7586 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7587         eval $xscan;\
7588         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7589                 eval $xrun
7590 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7591         eval $xscan;\
7592         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7593                 eval $xrun
7594 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7595         eval $xscan;\
7596         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7597                 eval $xrun
7598 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7599         eval $xscan;\
7600         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7601                 eval $xrun
7602 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7603         eval $xscan;\
7604         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7605                 eval $xrun
7606 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7607                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7608         eval $xscan;\
7609         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7610                 eval $xrun
7611 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7612         eval $xscan;\
7613         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7614                 eval $xrun
7615 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7616         eval $xscan;\
7617         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7618                 eval $xrun
7619 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7620         eval $xscan;\
7621         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7622                 eval $xrun
7623 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7624         eval $xscan;\
7625         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7626                 eval $xrun
7627 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7628         eval $xscan;\
7629         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7630                 eval $xrun
7631 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7632         eval $xscan;\
7633         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7634                 eval $xrun
7635 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7636         eval $xscan;\
7637         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7638                 eval $xrun
7639 else
7640         $nm -p $* 2>/dev/null >libc.tmp
7641         $grep fprintf libc.tmp > libc.ptf
7642         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7643                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7644         then
7645                 nm_opt='-p'
7646                 eval $xrun
7647         else
7648                 echo " "
7649                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7650                 com=''
7651                 if $ar t $libc > libc.tmp && \
7652                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7653                 then
7654                         for thisname in $libnames $libc; do
7655                                 $ar t $thisname >>libc.tmp
7656                         done
7657                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7658                         echo "Ok." >&4
7659                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7660                         for thisname in $libnames $libc; do
7661                                 $ar tv $thisname >>libc.tmp
7662                                 emximp -o tmp.imp $thisname \
7663                                     2>/dev/null && \
7664                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7665                                     < tmp.imp >>libc.tmp
7666                                 $rm -f tmp.imp
7667                         done
7668                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7669                         echo "Ok." >&4
7670                 else
7671                         echo "$ar didn't seem to work right." >&4
7672                         echo "Maybe this is a Cray...trying bld instead..." >&4
7673                         if  bld t $libc | \
7674                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7675                                 $test -s libc.list
7676                         then
7677                                 for thisname in $libnames; do
7678                                         bld t $libnames | \
7679                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7680                                         $ar t $thisname >>libc.tmp
7681                                 done
7682                                 echo "Ok." >&4
7683                         else
7684                                 echo "That didn't work either.  Giving up." >&4
7685                                 exit 1
7686                         fi
7687                 fi
7688         fi
7689 fi
7690 nm_extract="$com"
7691 case "$PASE" in
7692 define)
7693     echo " "
7694     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7695     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7696     ;;
7697 *)  if $test -f /lib/syscalls.exp; then
7698         echo " "
7699         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7700         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7701                 /lib/syscalls.exp >>libc.list
7702     fi
7703     ;;
7704 esac
7705 ;;
7706 esac
7707 $rm -f libnames libpath
7708
7709 : Check if we are using C++
7710 echo " "
7711 echo "Checking for C++..." >&4
7712 $cat >try.c <<'EOCP'
7713 #include <stdio.h>
7714 int main(void)
7715 {
7716 #ifdef __cplusplus
7717     return 0;
7718 #else
7719     return 1;
7720 #endif
7721 }
7722 EOCP
7723 set try
7724 if eval $compile_ok && $run ./try; then
7725         val="$define"
7726         echo "You are using a C++ compiler."
7727 else
7728         val="$undef"
7729         echo "You are not using a C++ compiler."
7730 fi
7731 $rm_try cplusplus$$
7732 set d_cplusplus
7733 eval $setvar
7734
7735 : is a C symbol defined?
7736 csym='tlook=$1;
7737 case "$3" in
7738 -v) tf=libc.tmp; tdc="";;
7739 -a) tf=libc.tmp; tdc="[]";;
7740 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7741 esac;
7742 case "$d_cplusplus" in
7743     $define)    extern_C="extern \"C\"" ;;
7744     *)          extern_C="extern"       ;;
7745 esac;
7746 tx=yes;
7747 case "$reuseval-$4" in
7748 true-) ;;
7749 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7750 esac;
7751 case "$tx" in
7752 yes)
7753         tval=false;
7754         if $test "$runnm" = true; then
7755                 if $contains $tlook $tf >/dev/null 2>&1; then
7756                         tval=true;
7757                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7758                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7759                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7760                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7761                         $rm_try;
7762                 fi;
7763         else
7764                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7765                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7766                 $rm_try;
7767         fi;
7768         ;;
7769 *)
7770         case "$tval" in
7771         $define) tval=true;;
7772         *) tval=false;;
7773         esac;
7774         ;;
7775 esac;
7776 eval "$2=$tval"'
7777
7778 : define an is-in-libc? function
7779 inlibc='echo " "; td=$define; tu=$undef;
7780 sym=$1; var=$2; eval "was=\$$2";
7781 tx=yes;
7782 case "$reuseval$was" in
7783 true) ;;
7784 true*) tx=no;;
7785 esac;
7786 case "$tx" in
7787 yes)
7788         set $sym tres -f;
7789         eval $csym;
7790         case "$tres" in
7791         true)
7792                 echo "$sym() found." >&4;
7793                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7794         *)
7795                 echo "$sym() NOT found." >&4;
7796                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7797         esac;;
7798 *)
7799         case "$was" in
7800         $define) echo "$sym() found." >&4;;
7801         *) echo "$sym() NOT found." >&4;;
7802         esac;;
7803 esac'
7804
7805 : see if dlopen exists
7806 xxx_runnm="$runnm"
7807 xxx_ccflags="$ccflags"
7808 runnm=false
7809 : with g++ one needs -shared to get is-in-libc to work for dlopen
7810 case "$gccversion" in
7811 '')     ;;
7812 *)      case "$d_cplusplus" in
7813         "$define") ccflags="$ccflags -shared" ;;
7814         esac
7815         ;;
7816 esac
7817 set dlopen d_dlopen
7818 eval $inlibc
7819 runnm="$xxx_runnm"
7820 ccflags="$xxx_ccflags"
7821
7822 : see if this is a unistd.h system
7823 set unistd.h i_unistd
7824 eval $inhdr
7825
7826 : determine which dynamic loading, if any, to compile in
7827 echo " "
7828 dldir="ext/DynaLoader"
7829 case "$usedl" in
7830 $define|y|true)
7831         dflt='y'
7832         usedl="$define"
7833         ;;
7834 $undef|n|false)
7835         dflt='n'
7836         usedl="$undef"
7837         ;;
7838 *)
7839         dflt='n'
7840         case "$d_dlopen" in
7841             $define) dflt='y' ;;
7842         esac
7843         : Does a dl_xxx.xs file exist for this operating system
7844         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7845         ;;
7846 esac
7847 rp="Do you wish to use dynamic loading?"
7848 . ./myread
7849 usedl="$ans"
7850 bin_ELF="$undef"
7851 case "$ans" in
7852 y*) usedl="$define"
7853         case "$dlsrc" in
7854         '')
7855                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7856                         dflt="$dldir/dl_${osname}.xs"
7857                 elif $test "$d_dlopen" = "$define" ; then
7858                         dflt="$dldir/dl_dlopen.xs"
7859                 else
7860                         dflt=''
7861                 fi
7862                 ;;
7863         *)      dflt="$dldir/$dlsrc"
7864                 ;;
7865         esac
7866     echo "The following dynamic loading files are available:"
7867         : Can not go over to $dldir because getfile has path hard-coded in.
7868         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7869         rp="Source file to use for dynamic loading"
7870         fn="fne"
7871         gfpth="$src"
7872         . ./getfile
7873         usedl="$define"
7874         : emulate basename
7875         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7876
7877         $cat << EOM
7878
7879 Some systems may require passing special flags to $cc -c to
7880 compile modules that will be used to create a shared library.
7881 To use no flags, say "none".
7882
7883 EOM
7884     case "$cccdlflags" in
7885     '') case "$gccversion" in
7886                 '') case "$osname" in
7887                         hpux)   dflt='+z' ;;
7888                         next)   dflt='none' ;;
7889                         irix*)  dflt='-KPIC' ;;
7890                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7891                         sunos)  dflt='-pic' ;;
7892                         *)      dflt='none' ;;
7893                     esac
7894                         ;;
7895                 *)  case "$osname" in
7896                         darwin) dflt='none' ;;
7897                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7898                         *)      dflt='-fpic' ;;
7899                     esac ;;
7900             esac ;;
7901         ' ') dflt='none' ;;
7902     *)  dflt="$cccdlflags" ;;
7903     esac
7904     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7905     . ./myread
7906     case "$ans" in
7907     none) cccdlflags=' ' ;;
7908     *) cccdlflags="$ans" ;;
7909     esac
7910
7911     cat << EOM
7912
7913 Some systems use ld to create libraries that can be dynamically loaded,
7914 while other systems (such as those using ELF) use $cc.
7915
7916 EOM
7917
7918 : Determine if this is ELF
7919         $cat >try.c <<EOM
7920 /* Test for whether ELF binaries are produced */
7921 #include <fcntl.h>
7922 #$i_stdlib I_STDLIB
7923 #ifdef I_STDLIB
7924 #include <stdlib.h>
7925 #endif
7926 #$i_unistd I_UNISTD
7927 #ifdef I_UNISTD
7928 #include <unistd.h>
7929 #endif
7930 int main() {
7931         char b[4];
7932         int i = open("a.out",O_RDONLY);
7933         if(i == -1)
7934                 exit(1); /* fail */
7935         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7936                 exit(0); /* succeed (yes, it is ELF) */
7937         else
7938                 exit(1); /* fail */
7939 }
7940 EOM
7941         if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7942                 bin_ELF="$define"
7943         fi
7944         $rm_try
7945
7946         case "$ld" in
7947         '')     if $test $bin_ELF = "$define"; then
7948                         cat <<EOM
7949 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7950 EOM
7951                         dflt="$cc"
7952                 else
7953                         echo "I'll use ld to build dynamic libraries."
7954                         dflt='ld'
7955                 fi
7956                 ;;
7957         *)      dflt="$ld"
7958                 ;;
7959         esac
7960
7961     rp="What command should be used to create dynamic libraries?"
7962     . ./myread
7963         ld="$ans"
7964
7965     cat << EOM
7966
7967 Some systems may require passing special flags to $ld to create a
7968 library that can be dynamically loaded.  If your ld flags include
7969 -L/other/path options to locate libraries outside your loader's normal
7970 search path, you may need to specify those -L options here as well.  To
7971 use no flags, say "none".
7972
7973 EOM
7974     case "$lddlflags" in
7975     '') case "$osname" in
7976                         haiku) dflt='-shared' ;;
7977                         hpux) dflt='-b';
7978                               case "$gccversion" in
7979                               '') dflt="$dflt +vnocompatwarnings" ;;
7980                               esac
7981                               ;;
7982                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7983                         next)  dflt='none' ;;
7984                         solaris) # See [perl #66604].
7985                                 # On Solaris 11, gcc -m64 on amd64 
7986                                 # appears not to understand -G.  gcc versions at
7987                                 # least as old as 3.4.3 support -shared, so just
7988                                 # use that with Solaris 11 and later, but keep
7989                                 # the old behavior for older Solaris versions.
7990                                 case "$gccversion" in
7991                                         '') dflt='-G' ;;
7992                                         *)      case "$osvers" in
7993                                                         2.?|2.10) dflt='-G' ;;
7994                                                         *) dflt='-shared' ;;
7995                                                 esac
7996                                                 ;;
7997                                 esac
7998                                 ;;
7999                         sunos) dflt='-assert nodefinitions' ;;
8000                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8001                 *)     dflt='none' ;;
8002                         esac
8003                         ;;
8004     *) dflt="$lddlflags" ;;
8005     esac
8006
8007         : Try to guess additional flags to pick up local libraries.
8008         : Be careful not to append to a plain 'none'
8009         case "$dflt" in
8010         none) dflt='' ;;
8011         esac
8012         for thisflag in $ldflags; do
8013                 case "$thisflag" in
8014                 -L*|-R*|-Wl,-R*)
8015                         case " $dflt " in
8016                         *" $thisflag "*) ;;
8017                         *) dflt="$dflt $thisflag" ;;
8018                         esac
8019                         ;;
8020                 esac
8021         done
8022
8023         case "$dflt" in
8024         ''|' ') dflt='none' ;;
8025         esac
8026
8027         case "$ldflags" in
8028         *-fstack-protector*)
8029             case "$dflt" in
8030                         *-fstack-protector*) ;; # Don't add it again
8031                         *) dflt="$dflt -fstack-protector" ;; 
8032                 esac
8033                 ;;
8034         esac
8035
8036
8037     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8038     . ./myread
8039     case "$ans" in
8040     none) lddlflags=' ' ;;
8041     *) lddlflags="$ans" ;;
8042     esac
8043
8044         cat <<EOM
8045
8046 Some systems may require passing special flags to $cc to indicate that
8047 the resulting executable will use dynamic linking.  To use no flags,
8048 say "none".
8049
8050 EOM
8051     case "$ccdlflags" in
8052     '') case "$osname" in
8053             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8054             next|sunos) dflt='none' ;;
8055             *)          dflt='none' ;;
8056             esac ;;
8057     ' ')  dflt='none' ;;
8058     *)  dflt="$ccdlflags" ;;
8059     esac
8060     rp="Any special flags to pass to $cc to use dynamic linking?"
8061     . ./myread
8062     case "$ans" in
8063     none) ccdlflags=' ' ;;
8064     *) ccdlflags="$ans" ;;
8065     esac
8066     ;;
8067 *)  usedl="$undef"
8068         ld='ld'
8069     dlsrc='dl_none.xs'
8070     lddlflags=''
8071     ccdlflags=''
8072     ;;
8073 esac
8074
8075 ld_can_script="$undef"
8076 case "$bin_ELF$usedl" in
8077 $define$define)
8078     # Abuse try.h and a.out names for neat cleanup
8079     $cat >try.c <<EOM
8080 void foo() {}
8081 void bar() {}
8082 EOM
8083     $cat >try.h <<EOM
8084 LIBTEST_42 {
8085  global:
8086   foo;
8087  local: *;
8088  };
8089 EOM
8090     if $cc $cccdlflags $ccdlflags $ccflags \
8091            $ldflags $lddlflags -o a.out try.c \
8092            -Wl,--version-script=try.h >/dev/null 2>&1 \
8093        &&  $test -s a.out ; then
8094         echo "ld supports scripting" >&4
8095         ld_can_script="$define"
8096     else
8097         echo "ld does not support scripting" >&4
8098     fi
8099     $rm_try
8100     ;;
8101 esac
8102
8103 : Do we want a shared libperl?
8104 also=''
8105 case "$usedl" in
8106 $undef)
8107         # No dynamic loading being used, so don't bother even to prompt.
8108         useshrplib='false'
8109         ;;
8110 *)      case "$useshrplib" in
8111         '')     case "$osname" in
8112                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|haiku|cygwin*)
8113                         dflt=y
8114                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8115                         ;;
8116                 next*)
8117                         case "$osvers" in
8118                         4*)     dflt=y
8119                                 also='Building a shared libperl is needed for MAB support.'
8120                                 ;;
8121                         *)      dflt=n
8122                                 ;;
8123                         esac
8124                         ;;
8125                 *)      dflt=n
8126                         ;;
8127                 esac
8128                 ;;
8129         $define|true|[Yy]*)
8130                 dflt=y
8131                 ;;
8132         *)      dflt=n
8133                 ;;
8134         esac
8135         $cat << EOM
8136
8137 The perl executable is normally obtained by linking perlmain.c with
8138 libperl${_a}, any static extensions (usually just DynaLoader), and
8139 any other libraries needed on this system (such as -lm, etc.).  Since
8140 your system supports dynamic loading, it is probably possible to build
8141 a shared libperl.$so.  If you will have more than one executable linked
8142 to libperl.$so, this will significantly reduce the size of each
8143 executable, but it may have a noticeable effect on performance.  The
8144 default is probably sensible for your system.
8145 $also
8146
8147 EOM
8148         rp="Build a shared libperl.$so (y/n)"
8149         . ./myread
8150         case "$ans" in
8151         true|$define|[Yy]*)
8152                 useshrplib='true'  ;;
8153         *)      useshrplib='false' ;;
8154         esac
8155         ;;
8156 esac
8157
8158 case "$useshrplib" in
8159 true)
8160         case "$userelocatableinc" in
8161         true|define)
8162                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8163                 echo "See INSTALL for an explanation why that won't work." >&4
8164                 exit 4
8165                 ;;
8166         esac
8167         case "$libperl" in
8168         '')
8169                 # Figure out a good name for libperl.so.  Since it gets stored in
8170                 # a version-specific architecture-dependent library, the version
8171                 # number isn't really that important, except for making cc/ld happy.
8172                 #
8173                 # A name such as libperl.so.10.1
8174                 majmin="libperl.$so.$patchlevel.$subversion"
8175                 # A name such as libperl.so.100
8176                 majonly=`echo $patchlevel $subversion |
8177                         $awk '{printf "%d%02d", $1, $2}'`
8178                 majonly=libperl.$so.$majonly
8179                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8180                 # rely on figuring it out from the naming of libc.
8181                 case "${osname}${osvers}" in
8182                 next4*)
8183                         dflt=libperl.5.$so
8184                         # XXX How handle the --version stuff for MAB?
8185                         ;;
8186                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8187                         dflt=libperl.$so
8188                         ;;
8189                 cygwin*) # ld links now against the dll directly
8190                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8191                         majonly=`echo $patchlevel $subversion |
8192                                 $awk '{printf "%03d%03d", $1, $2}'`
8193                         majonly=cygperl5.$majonly.$so
8194                         dflt=$majmin
8195                         ;;
8196                 *)      # Try to guess based on whether libc has major.minor.
8197                         case "$libc" in
8198                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8199                         *libc.$so.[0-9]*) dflt=$majonly ;;
8200                         *)      dflt=libperl.$so ;;
8201                         esac
8202                         ;;
8203                 esac
8204                 ;;
8205         *)      dflt=$libperl
8206                 ;;
8207         esac
8208         cat << EOM
8209
8210 I need to select a good name for the shared libperl.  If your system uses
8211 library names with major and minor numbers, then you might want something
8212 like $majmin.  Alternatively, if your system uses a single version
8213 number for shared libraries, then you might want to use $majonly.
8214 Or, your system might be quite happy with a simple libperl.$so.
8215
8216 Since the shared libperl will get installed into a version-specific
8217 architecture-dependent directory, the version number of the shared perl
8218 library probably isn't important, so the default should be o.k.
8219
8220 EOM
8221         rp='What name do you want to give to the shared libperl?'
8222         . ./myread
8223         libperl=$ans
8224         echo "Ok, I'll use $libperl"
8225         ;;
8226 *)
8227         libperl="libperl${_a}"
8228         ;;
8229 esac
8230
8231 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8232 case "$shrpdir" in
8233 '') ;;
8234 *)      $cat >&4 <<EOM
8235 WARNING:  Use of the shrpdir variable for the installation location of
8236 the shared $libperl is not supported.  It was never documented and
8237 will not work in this version.  Let me (perlbug@perl.org)
8238 know of any problems this may cause.
8239
8240 EOM
8241         case "$shrpdir" in
8242         "$archlibexp/CORE")
8243                 $cat >&4 <<EOM
8244 But your current setting of $shrpdir is
8245 the default anyway, so it's harmless.
8246 EOM
8247                 ;;
8248         *)
8249                 $cat >&4 <<EOM
8250 Further, your current attempted setting of $shrpdir
8251 conflicts with the value of $archlibexp/CORE
8252 that installperl will use.
8253 EOM
8254                 ;;
8255         esac
8256         ;;
8257 esac
8258
8259 # How will the perl executable find the installed shared $libperl?
8260 # Add $xxx to ccdlflags.
8261 # If we can't figure out a command-line option, use $shrpenv to
8262 # set env LD_RUN_PATH.  The main perl makefile uses this.
8263 shrpdir=$archlibexp/CORE
8264 xxx=''
8265 tmp_shrpenv=''
8266 if "$useshrplib"; then
8267     case "$osname" in
8268         aix)
8269                 # We'll set it in Makefile.SH...
8270                 ;;
8271         solaris)
8272                 xxx="-R $shrpdir"
8273                 ;;
8274         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly|bitrig)
8275                 xxx="-Wl,-R$shrpdir"
8276                 ;;
8277         bsdos|linux|irix*|dec_osf|gnu*)
8278                 xxx="-Wl,-rpath,$shrpdir"
8279                 ;;
8280         next)
8281                 # next doesn't like the default...
8282                 ;;
8283         haiku)
8284                 # Haiku doesn't like the default, either.
8285                 ;;
8286         hpux*)
8287                 # hpux doesn't like the default, either.
8288                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8289                 ;;
8290         cygwin)
8291                 # cygwin needs only ldlibpth
8292                 ;;
8293         *)
8294                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8295                 ;;
8296         esac
8297         case "$xxx" in
8298         '') ;;
8299         *)
8300                 # Only add $xxx if it isn't already in ccdlflags.
8301                 case " $ccdlflags " in
8302                 *" $xxx "*)     ;;
8303                 *)      ccdlflags="$ccdlflags $xxx"
8304                         cat <<EOM >&4
8305
8306 Adding $xxx to the flags
8307 passed to $ld so that the perl executable will find the
8308 installed shared $libperl.
8309
8310 EOM
8311                         ;;
8312                 esac
8313                 ;;
8314         esac
8315 fi
8316 # Fix ccdlflags in AIX for building external extensions.
8317 # (For building Perl itself bare -bE:perl.exp is needed,
8318 #  Makefile.SH takes care of this.)
8319 case "$osname" in
8320 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8321 esac
8322 # Respect a hint or command-line value.
8323 case "$shrpenv" in
8324 '') shrpenv="$tmp_shrpenv" ;;
8325 esac
8326 case "$ldlibpthname" in
8327 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8328 none)   ldlibpthname='' ;;
8329 esac
8330
8331 : determine where manual pages are on this system
8332 echo " "
8333 case "$sysman" in
8334 '')
8335         syspath='/usr/share/man/man1 /usr/man/man1'
8336         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8337         syspath="$syspath /usr/man/u_man/man1"
8338         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8339         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8340         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8341         sysman=`./loc . /usr/man/man1 $syspath`
8342         ;;
8343 esac
8344 if $test -d "$sysman"; then
8345         echo "System manual is in $sysman." >&4
8346 else
8347         echo "Could not find manual pages in source form." >&4
8348 fi
8349
8350 : determine where manual pages go
8351 set man1dir man1dir none
8352 eval $prefixit
8353 $cat <<EOM
8354
8355 $spackage has manual pages available in source form.
8356 EOM
8357 case "$nroff" in
8358 nroff)
8359         echo "However, you don't have nroff, so they're probably useless to you."
8360         case "$man1dir" in
8361         '') man1dir="none";;
8362         esac;;
8363 esac
8364 echo "If you don't want the manual sources installed, answer 'none'."
8365 case "$man1dir" in
8366 ' ') dflt=none
8367         ;;
8368 '')
8369         lookpath="$prefixexp/share/man/man1"
8370         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8371         lookpath="$lookpath $prefixexp/man/p_man/man1"
8372         lookpath="$lookpath $prefixexp/man/u_man/man1"
8373         lookpath="$lookpath $prefixexp/man/man.1"
8374         case "$sysman" in
8375         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8376         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8377         esac
8378         set dflt
8379         eval $prefixup
8380         ;;
8381 *)  dflt="$man1dir"
8382         ;;
8383 esac
8384 echo " "
8385 fn=dn+~
8386 rp="Where do the main $spackage manual pages (source) go?"
8387 . ./getfile
8388 if $test "X$man1direxp" != "X$ansexp"; then
8389         installman1dir=''
8390 fi
8391 prefixvar=man1dir
8392 . ./setprefixvar
8393
8394 case "$man1dir" in
8395 '')     man1dir=' '
8396         installman1dir='';;
8397 esac
8398
8399 : What suffix to use on installed man pages
8400
8401 case "$man1dir" in
8402 ' ')
8403         man1ext='0'
8404         ;;
8405 *)
8406         rp="What suffix should be used for the main $spackage man pages?"
8407         case "$man1ext" in
8408         '')     case "$man1dir" in
8409                 *1)  dflt=1 ;;
8410                 *1p) dflt=1p ;;
8411                 *1pm) dflt=1pm ;;
8412                 *l) dflt=l;;
8413                 *n) dflt=n;;
8414                 *o) dflt=o;;
8415                 *p) dflt=p;;
8416                 *C) dflt=C;;
8417                 *L) dflt=L;;
8418                 *L1) dflt=L1;;
8419                 *) dflt=1;;
8420                 esac
8421                 ;;
8422         *)      dflt="$man1ext";;
8423         esac
8424         . ./myread
8425         man1ext="$ans"
8426         ;;
8427 esac
8428
8429 : see if we can have long filenames
8430 echo " "
8431 first=123456789abcdef
8432 $rm -f $first
8433 if (echo hi >$first) 2>/dev/null; then
8434         if $test -f 123456789abcde; then
8435                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8436                 val="$undef"
8437         else
8438                 echo 'You can have filenames longer than 14 characters.'>&4
8439                 val="$define"
8440         fi
8441 else
8442         $cat <<'EOM'
8443 You can't have filenames longer than 14 chars.
8444 You can't even think about them!
8445 EOM
8446         val="$undef"
8447 fi
8448 set d_flexfnam
8449 eval $setvar
8450 $rm -rf 123456789abcde*
8451
8452 : determine where library module manual pages go
8453 set man3dir man3dir none
8454 eval $prefixit
8455 $cat <<EOM
8456
8457 $spackage has manual pages for many of the library modules.
8458 EOM
8459
8460 case "$nroff" in
8461 nroff)
8462         $cat <<'EOM'
8463 However, you don't have nroff, so they're probably useless to you.
8464 EOM
8465         case "$man3dir" in
8466         '') man3dir="none";;
8467         esac;;
8468 esac
8469
8470 case "$d_flexfnam" in
8471 undef)
8472         $cat <<'EOM'
8473 However, your system can't handle the long file names like File::Basename.3.
8474 EOM
8475         case "$man3dir" in
8476         '') man3dir="none";;
8477         esac;;
8478 esac
8479
8480 echo "If you don't want the manual sources installed, answer 'none'."
8481 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8482 case "$man3dir" in
8483 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8484         if $test -d "$privlib/man/man3"; then
8485                 cat <<EOM >&4
8486
8487 WARNING:  Previous versions of perl installed man3 pages into
8488 $privlib/man/man3.  This version will suggest a
8489 new default of $dflt.
8490 EOM
8491                 tdflt=$dflt
8492                 dflt='n'
8493                 rp='Do you wish to preserve the old behavior?(y/n)'
8494                 . ./myread
8495                 case "$ans" in
8496                 y*) dflt="$privlib/man/man3" ;;
8497                 *)  dflt=$tdflt ;;
8498                 esac
8499     fi
8500         ;;
8501 *)      dflt="$man3dir" ;;
8502 esac
8503 case "$dflt" in
8504 ' ') dflt=none ;;
8505 esac
8506 echo " "
8507 fn=dn+~
8508 rp="Where do the $package library man pages (source) go?"
8509 . ./getfile
8510 prefixvar=man3dir
8511 . ./setprefixvar
8512
8513 case "$man3dir" in
8514 '')     man3dir=' '
8515         installman3dir='';;
8516 esac
8517
8518 : What suffix to use on installed man pages
8519 case "$man3dir" in
8520 ' ')
8521         man3ext='0'
8522         ;;
8523 *)
8524         rp="What suffix should be used for the $package library man pages?"
8525         case "$man3ext" in
8526         '')     case "$man3dir" in
8527                 *3)  dflt=3 ;;
8528                 *3p) dflt=3p ;;
8529                 *3pm) dflt=3pm ;;
8530                 *l) dflt=l;;
8531                 *n) dflt=n;;
8532                 *o) dflt=o;;
8533                 *p) dflt=p;;
8534                 *C) dflt=C;;
8535                 *L) dflt=L;;
8536                 *L3) dflt=L3;;
8537                 *) dflt=3;;
8538                 esac
8539                 ;;
8540         *)      dflt="$man3ext";;
8541         esac
8542         . ./myread
8543         man3ext="$ans"
8544         ;;
8545 esac
8546
8547 : see if we have to deal with yellow pages, now NIS.
8548 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8549         if $test -f /usr/etc/nibindd; then
8550                 echo " "
8551                 echo "I'm fairly confident you're on a NeXT."
8552                 echo " "
8553                 rp='Do you get the hosts file via NetInfo?'
8554                 dflt=y
8555                 case "$hostcat" in
8556                 nidump*) ;;
8557                 '') ;;
8558                 *) dflt=n;;
8559                 esac
8560                 . ./myread
8561                 case "$ans" in
8562                 y*) hostcat='nidump hosts .';;
8563                 *)      case "$hostcat" in
8564                         nidump*) hostcat='';;
8565                         esac
8566                         ;;
8567                 esac
8568         fi
8569         case "$hostcat" in
8570         nidump*) ;;
8571         *)
8572                 case "$hostcat" in
8573                 *ypcat*) dflt=y;;
8574                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8575                                 dflt=y
8576                         else
8577                                 dflt=n
8578                         fi;;
8579                 *) dflt=n;;
8580                 esac
8581                 echo " "
8582                 rp='Are you getting the hosts file via yellow pages?'
8583                 . ./myread
8584                 case "$ans" in
8585                 y*) hostcat='ypcat hosts';;
8586                 *) hostcat='cat /etc/hosts';;
8587                 esac
8588                 ;;
8589         esac
8590 fi
8591 case "$hostcat" in
8592 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8593 esac
8594 case "$groupcat" in
8595 '') test -f /etc/group && groupcat='cat /etc/group';;
8596 esac
8597 case "$passcat" in
8598 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8599 esac
8600
8601 : now get the host name
8602 echo " "
8603 echo "Figuring out host name..." >&4
8604 case "$myhostname" in
8605 '') cont=true
8606         echo 'Maybe "hostname" will work...'
8607         if tans=`sh -c hostname 2>&1` ; then
8608                 myhostname=$tans
8609                 phostname=hostname
8610                 cont=''
8611         fi
8612         ;;
8613 *) cont='';;
8614 esac
8615 if $test "$cont"; then
8616         if ./xenix; then
8617                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8618                 if tans=`cat /etc/systemid 2>&1` ; then
8619                         myhostname=$tans
8620                         phostname='cat /etc/systemid'
8621                         echo "Whadyaknow.  Xenix always was a bit strange..."
8622                         cont=''
8623                 fi
8624         elif $test -r /etc/systemid; then
8625                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8626         fi
8627 fi
8628 if $test "$cont"; then
8629         echo 'No, maybe "uuname -l" will work...'
8630         if tans=`sh -c 'uuname -l' 2>&1` ; then
8631                 myhostname=$tans
8632                 phostname='uuname -l'
8633         else
8634                 echo 'Strange.  Maybe "uname -n" will work...'
8635                 if tans=`sh -c 'uname -n' 2>&1` ; then
8636                         myhostname=$tans
8637                         phostname='uname -n'
8638                 else
8639                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8640                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8641                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8642                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8643                         else
8644                                 case "$myhostname" in
8645                                 '') echo "Does this machine have an identity crisis or something?"
8646                                         phostname='';;
8647                                 *)
8648                                         echo "Well, you said $myhostname before..."
8649                                         phostname='echo $myhostname';;
8650                                 esac
8651                         fi
8652                 fi
8653         fi
8654 fi
8655 case "$myhostname" in
8656 '') myhostname=noname ;;
8657 esac
8658 : you do not want to know about this
8659 set $myhostname
8660 myhostname=$1
8661
8662 : verify guess
8663 if $test "$myhostname" ; then
8664         dflt=y
8665         rp='Your host name appears to be "'$myhostname'".'" Right?"
8666         . ./myread
8667         case "$ans" in
8668         y*) ;;
8669         *) myhostname='';;
8670         esac
8671 fi
8672
8673 : bad guess or no guess
8674 while $test "X$myhostname" = X ; do
8675         dflt=''
8676         rp="Please type the (one word) name of your host:"
8677         . ./myread
8678         myhostname="$ans"
8679 done
8680
8681 : translate upper to lower if necessary
8682 case "$myhostname" in
8683 *[A-Z]*)
8684         echo "(Normalizing case in your host name)"
8685         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8686         ;;
8687 esac
8688
8689 case "$myhostname" in
8690 *.*)
8691         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8692         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8693         echo "(Trimming domain name from host name--host name is now $myhostname)"
8694         ;;
8695 *) case "$mydomain" in
8696         '')
8697                 {
8698                         test "X$hostcat" = "Xypcat hosts" &&
8699                         ypmatch "$myhostname" hosts 2>/dev/null |\
8700                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8701                         $test -s hosts
8702                 } || {
8703                         test "X$hostcat" != "X" &&
8704                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8705                                         /[       ]$myhostname[  . ]/p" > hosts
8706                 }
8707                 tmp_re="[       . ]"
8708                 if $test -f hosts; then
8709                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8710                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8711                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8712                                 hosts | $sort | $uniq | \
8713                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8714                         case `$echo X$dflt` in
8715                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8716                                 dflt=.
8717                                 ;;
8718                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8719                                 ;;
8720                         esac
8721                 else
8722                         echo "(I cannot locate a hosts database anywhere)"
8723                         dflt=.
8724                 fi
8725                 case "$dflt" in
8726                 .)
8727                         tans=`./loc resolv.conf X /etc /usr/etc`
8728                         if $test -f "$tans"; then
8729                                 echo "(Attempting domain name extraction from $tans)"
8730                                 dflt=.`$sed -n -e 's/   / /g' \
8731                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8732                                   -e 1q 2>/dev/null`
8733                                 case "$dflt" in
8734                                 .) dflt=.`$sed -n -e 's/        / /g' \
8735                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8736                                      -e 1q 2>/dev/null`
8737                                         ;;
8738                                 esac
8739                         fi
8740                         ;;
8741                 esac
8742                 case "$dflt" in
8743                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8744                         dflt=.`sh -c domainname 2>/dev/null`
8745                         case "$dflt" in
8746                         '') dflt='.';;
8747                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8748                         esac
8749                         ;;
8750                 esac
8751                 case "$dflt$osname" in
8752                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8753                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8754                         ;;
8755                 esac
8756                 case "$dflt" in
8757                 .) echo "(Lost all hope -- silly guess then)"
8758                         dflt='.nonet'
8759                         ;;
8760                 esac
8761                 $rm -f hosts
8762                 ;;
8763         *) dflt="$mydomain";;
8764         esac;;
8765 esac
8766 echo " "
8767 rp="What is your domain name?"
8768 . ./myread
8769 tans="$ans"
8770 case "$ans" in
8771 '') ;;
8772 .*) ;;
8773 *) tans=".$tans";;
8774 esac
8775 mydomain="$tans"
8776
8777 : translate upper to lower if necessary
8778 case "$mydomain" in
8779 *[A-Z]*)
8780         echo "(Normalizing case in your domain name)"
8781         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8782         ;;
8783 esac
8784
8785 : a little sanity check here
8786 case "$phostname" in
8787 '') ;;
8788 *)
8789         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8790         $myhostname$mydomain|$myhostname) ;;
8791         *)
8792                 case "$phostname" in
8793                 sed*)
8794                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8795                         ;;
8796                 *)
8797                         echo "(That doesn't agree with your $phostname command, by the way.)"
8798                         ;;
8799                 esac
8800         ;;
8801         esac
8802         ;;
8803 esac
8804
8805 : determine the e-mail address of the user who is running us
8806 $cat <<EOM
8807
8808 I need to get your e-mail address in Internet format if possible, i.e.
8809 something like user@host.domain. Please answer accurately since I have
8810 no easy means to double check it. The default value provided below
8811 is most probably close to reality but may not be valid from outside
8812 your organization...
8813
8814 EOM
8815 cont=x
8816 while test "$cont"; do
8817         case "$MAILDOMAIN" in
8818         '')
8819                 if $test -s /etc/mailname; then
8820                         maildomain=`$cat /etc/mailname`
8821                 else
8822                         maildomain="$myhostname$mydomain"
8823                 fi
8824                 ;;
8825         *)  maildomain="$MAILDOMAIN";;
8826         esac
8827         case "$cf_email" in
8828         '') dflt="$cf_by@$maildomain";;
8829         *)  dflt="$cf_email";;
8830         esac
8831         rp='What is your e-mail address?'
8832         . ./myread
8833         cf_email="$ans"
8834         case "$cf_email" in
8835         *@*.*) cont='' ;;
8836         *)
8837                 rp='Address does not look like an Internet one.  Use it anyway?'
8838                 case "$fastread" in
8839                 yes) dflt=y ;;
8840                 *) dflt=n ;;
8841                 esac
8842                 . ./myread
8843                 case "$ans" in
8844                 y*) cont='' ;;
8845                 *) echo " " ;;
8846                 esac
8847                 ;;
8848         esac
8849 done
8850
8851 : Ask e-mail of administrator
8852 $cat <<EOM
8853
8854 If you or somebody else will be maintaining perl at your site, please
8855 fill in the correct e-mail address here so that they may be contacted
8856 if necessary. Currently, the "perlbug" program included with perl
8857 will send mail to this address in addition to perlbug@perl.org. You may
8858 enter "none" for no administrator.
8859
8860 EOM
8861 case "$perladmin" in
8862 '') dflt="$cf_email";;
8863 *) dflt="$perladmin";;
8864 esac
8865 rp='Perl administrator e-mail address'
8866 . ./myread
8867 perladmin="$ans"
8868
8869 : determine whether to only install version-specific parts.
8870 echo " "
8871 $cat <<EOM
8872 Do you want to install only the version-specific parts of the perl
8873 distribution?  Usually you do *not* want to do this.
8874 EOM
8875 case "$versiononly" in
8876 "$define"|[Yy]*|true) dflt='y' ;;
8877 *) dflt='n';
8878 esac
8879 rp="Do you want to install only the version-specific parts of perl?"
8880 . ./myread
8881 case "$ans" in
8882 [yY]*)  val="$define";;
8883 *)      val="$undef" ;;
8884 esac
8885 set versiononly
8886 eval $setvar
8887
8888 case "$versiononly" in
8889 "$define") inc_version_list=''
8890            inc_version_list_init=0
8891            ;;
8892 esac
8893
8894 : figure out how to guarantee perl startup
8895 : XXX Note that this currently takes advantage of the bug that binexp ignores
8896 :     the Configure -Dinstallprefix setting, which in turn means that under
8897 :     relocatable @INC, initialinstalllocation is what binexp started as.
8898 case "$startperl" in
8899 '')
8900         case "$sharpbang" in
8901         *!)
8902                 $cat <<EOH
8903
8904 I can use the #! construct to start perl on your system. This will
8905 make startup of perl scripts faster, but may cause problems if you
8906 want to share those scripts and perl is not in a standard place
8907 ($initialinstalllocation/perl) on all your platforms. The alternative
8908 is to force a shell by starting the script with a single ':' character.
8909
8910 EOH
8911                 case "$versiononly" in
8912                 "$define")      dflt="$initialinstalllocation/perl$version";;
8913                 *)              dflt="$initialinstalllocation/perl";;
8914                 esac
8915                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8916                 . ./myread
8917                 case "$ans" in
8918                 none)   startperl=": # use perl";;
8919                 *)      startperl="#!$ans"
8920                         if $test 30 -lt `echo "$ans" | wc -c`; then
8921                                 $cat >&4 <<EOM
8922
8923 WARNING:  Some systems limit the #! command to 32 characters.
8924 If you experience difficulty running Perl scripts with #!, try
8925 installing Perl in a directory with a shorter pathname.
8926
8927 EOM
8928                         fi ;;
8929                 esac
8930                 ;;
8931         *) startperl=": # use perl"
8932                 ;;
8933         esac
8934         ;;
8935 esac
8936 echo "I'll use $startperl to start perl scripts."
8937
8938 : figure best path for perl in scripts
8939 case "$perlpath" in
8940 '')
8941         case "$versiononly" in
8942         "$define")      perlpath="$initialinstalllocation/perl$version";;
8943         *)              perlpath="$initialinstalllocation/perl";;
8944         esac
8945         case "$startperl" in
8946         *!*) ;;
8947         *)
8948                 $cat <<EOH
8949
8950 I will use the "eval 'exec'" idiom to start Perl on your system.
8951 I can use the full path of your Perl binary for this purpose, but
8952 doing so may cause problems if you want to share those scripts and
8953 Perl is not always in a standard place ($initialinstalllocation/perl).
8954
8955 EOH
8956                 dflt="$initialinstalllocation/perl"
8957                 rp="What path shall I use in \"eval 'exec'\"?"
8958                 . ./myread
8959                 perlpath="$ans"
8960                 ;;
8961         esac
8962         ;;
8963 esac
8964 case "$startperl" in
8965 *!*)    ;;
8966 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8967 esac
8968
8969 : determine where public executable scripts go
8970 set scriptdir scriptdir
8971 eval $prefixit
8972 case "$scriptdir" in
8973 '')
8974         dflt="$bin"
8975         : guess some guesses
8976         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8977         $test -d /usr/share/bin     && dflt=/usr/share/bin
8978         $test -d /usr/local/script  && dflt=/usr/local/script
8979         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8980         $test -d $prefixexp/script  && dflt=$prefixexp/script
8981         set dflt
8982         eval $prefixup
8983         ;;
8984 *)  dflt="$scriptdir"
8985         ;;
8986 esac
8987 $cat <<EOM
8988
8989 Some installations have a separate directory just for executable scripts so
8990 that they can mount it across multiple architectures but keep the scripts in
8991 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8992 Or you might just lump your scripts in with all your other executables.
8993
8994 EOM
8995 fn=d~
8996 rp='Where do you keep publicly executable scripts?'
8997 . ./getfile
8998 if $test "X$ansexp" != "X$scriptdirexp"; then
8999         installscript=''
9000 fi
9001 installscriptdir=''
9002 prefixvar=scriptdir
9003 . ./setprefixvar
9004 : A little fix up for an irregularly named variable.
9005 installscript="$installscriptdir"
9006
9007 : determine where add-on public executables go
9008 case "$sitebin" in
9009 '')     dflt=$siteprefix/bin ;;
9010 *)      dflt=$sitebin ;;
9011 esac
9012 fn=d~
9013 rp='Pathname where the add-on public executables should be installed?'
9014 . ./getfile
9015 prefixvar=sitebin
9016 . ./setprefixvar
9017
9018 : determine where add-on html pages go
9019 : There is no standard location, so try to copy the previously-selected
9020 : directory structure for the core html pages.
9021 case "$sitehtml1dir" in
9022 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9023 *)     dflt=$sitehtml1dir ;;
9024 esac
9025 case "$dflt" in
9026 ''|' ') dflt=none ;;
9027 esac
9028 fn=dn+~
9029 rp='Pathname where the site-specific html pages should be installed?'
9030 . ./getfile
9031 prefixvar=sitehtml1dir
9032 . ./setprefixvar
9033
9034 : determine where add-on library html pages go
9035 : There is no standard location, so try to copy the previously-selected
9036 : directory structure for the core html pages.
9037 case "$sitehtml3dir" in
9038 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9039 *)     dflt=$sitehtml3dir ;;
9040 esac
9041 case "$dflt" in
9042 ''|' ') dflt=none ;;
9043 esac
9044 fn=dn+~
9045 rp='Pathname where the site-specific library html pages should be installed?'
9046 . ./getfile
9047 prefixvar=sitehtml3dir
9048 . ./setprefixvar
9049
9050 : determine where add-on manual pages go
9051 case "$siteman1dir" in
9052 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9053 *)      dflt=$siteman1dir ;;
9054 esac
9055 case "$dflt" in
9056 ''|' ') dflt=none ;;
9057 esac
9058 fn=dn+~
9059 rp='Pathname where the site-specific manual pages should be installed?'
9060 . ./getfile
9061 prefixvar=siteman1dir
9062 . ./setprefixvar
9063
9064 : determine where add-on library man pages go
9065 case "$siteman3dir" in
9066 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9067 *)      dflt=$siteman3dir ;;
9068 esac
9069 case "$dflt" in
9070 ''|' ') dflt=none ;;
9071 esac
9072 fn=dn+~
9073 rp='Pathname where the site-specific library manual pages should be installed?'
9074 . ./getfile
9075 prefixvar=siteman3dir
9076 . ./setprefixvar
9077
9078 : determine where add-on public executable scripts go
9079 case "$sitescript" in
9080 '')     dflt=$siteprefix/script
9081         $test -d $dflt || dflt=$sitebin ;;
9082 *)  dflt="$sitescript" ;;
9083 esac
9084 fn=d~+
9085 rp='Pathname where add-on public executable scripts should be installed?'
9086 . ./getfile
9087 prefixvar=sitescript
9088 . ./setprefixvar
9089
9090 : Check if faststdio is requested and available
9091 case "$usefaststdio" in
9092 $define|true|[yY]*|'')
9093         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9094         case "$xversion" in
9095         [68])   dflt='y' ;;
9096         *)      dflt='n' ;;
9097         esac
9098         ;;
9099 *) dflt='n';;
9100 esac
9101 cat <<EOM
9102
9103 Perl can be built to use 'fast stdio', which means using the stdio
9104 library but also directly manipulating the stdio buffers to enable
9105 faster I/O.  Using stdio is better for backward compatibility (especially
9106 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9107 interface has been preferred instead of stdio.
9108
9109 If this doesn't make any sense to you, just accept the default '$dflt'.
9110 EOM
9111 rp='Use the "fast stdio" if available?'
9112 . ./myread
9113 case "$ans" in
9114 y|Y)    val="$define" ;;
9115 *)      val="$undef" ;;
9116 esac
9117 set usefaststdio
9118 eval $setvar
9119
9120
9121 : define an is-a-typedef? function
9122 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9123 case "$inclist" in
9124 "") inclist="sys/types.h";;
9125 esac;
9126 eval "varval=\$$var";
9127 case "$varval" in
9128 "")
9129         $rm -f temp.c;
9130         for inc in $inclist; do
9131                 echo "#include <$inc>" >>temp.c;
9132         done;
9133         echo "#ifdef $type" >> temp.c;
9134         echo "printf(\"We have $type\");" >> temp.c;
9135         echo "#endif" >> temp.c;
9136         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9137         if $contains $type temp.E >/dev/null 2>&1; then
9138                 eval "$var=\$type";
9139         else
9140                 eval "$var=\$def";
9141         fi;
9142         $rm -f temp.?;;
9143 *) eval "$var=\$varval";;
9144 esac'
9145
9146 : define an is-a-typedef? function that prompts if the type is not available.
9147 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9148 case "$inclist" in
9149 "") inclist="sys/types.h";;
9150 esac;
9151 eval "varval=\$$var";
9152 case "$varval" in
9153 "")
9154         $rm -f temp.c;
9155         for inc in $inclist; do
9156                 echo "#include <$inc>" >>temp.c;
9157         done;
9158         echo "#ifdef $type" >> temp.c;
9159         echo "printf(\"We have $type\");" >> temp.c;
9160         echo "#endif" >> temp.c;
9161         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9162         echo " " ;
9163         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9164         if $contains $type temp.E >/dev/null 2>&1; then
9165                 echo "$type found." >&4;
9166                 eval "$var=\$type";
9167         else
9168                 echo "$type NOT found." >&4;
9169                 dflt="$def";
9170                 . ./myread ;
9171                 eval "$var=\$ans";
9172         fi;
9173         $rm -f temp.?;;
9174 *) eval "$var=\$varval";;
9175 esac'
9176
9177 : see what type lseek is declared as in the kernel
9178 rp="What is the type used for lseek's offset on this system?"
9179 set off_t lseektype long stdio.h sys/types.h
9180 eval $typedef_ask
9181
9182 echo " "
9183 echo "Checking to see how big your file offsets are..." >&4
9184 $cat >try.c <<EOCP
9185 #include <sys/types.h>
9186 #include <stdio.h>
9187 int main()
9188 {
9189     printf("%d\n", (int)sizeof($lseektype));
9190     return(0);
9191 }
9192 EOCP
9193 set try
9194 if eval $compile_ok; then
9195         lseeksize=`$run ./try`
9196         echo "Your file offsets are $lseeksize bytes long."
9197 else
9198         dflt=$longsize
9199         echo " "
9200         echo "(I can't seem to compile the test program.  Guessing...)"
9201         rp="What is the size of your file offsets (in bytes)?"
9202         . ./myread
9203         lseeksize="$ans"
9204 fi
9205 $rm_try
9206
9207 : see what type file positions are declared as in the library
9208 rp="What is the type for file position used by fsetpos()?"
9209 set fpos_t fpostype long stdio.h sys/types.h
9210 eval $typedef_ask
9211
9212 : Check size for Fpos_t
9213 echo " "
9214 case "$fpostype" in
9215 *_t) zzz="$fpostype"    ;;
9216 *)   zzz="fpos_t"       ;;
9217 esac
9218 echo "Checking the size of $zzz..." >&4
9219 cat > try.c <<EOCP
9220 #include <sys/types.h>
9221 #include <stdio.h>
9222 #$i_stdlib I_STDLIB
9223 #ifdef I_STDLIB
9224 #include <stdlib.h>
9225 #endif
9226 int main() {
9227     printf("%d\n", (int)sizeof($fpostype));
9228     exit(0);
9229 }
9230 EOCP
9231 set try
9232 if eval $compile_ok; then
9233         yyy=`$run ./try`
9234         case "$yyy" in
9235         '')     fpossize=4
9236                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9237                 ;;
9238         *)      fpossize=$yyy
9239                 echo "Your $zzz is $fpossize bytes long."
9240                 ;;
9241         esac
9242 else
9243         dflt="$longsize"
9244         echo " " >&4
9245         echo "(I can't compile the test program.  Guessing...)" >&4
9246         rp="What is the size of your file positions (in bytes)?"
9247         . ./myread
9248         fpossize="$ans"
9249 fi
9250
9251 : Check for large file support
9252 # Backward compatibility (uselfs is deprecated).
9253 case "$uselfs" in
9254 "$define"|true|[yY]*)
9255         cat <<EOM >&4
9256
9257 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9258 EOM
9259         uselargefiles="$define"
9260         ;;
9261 esac
9262
9263 case "$lseeksize:$fpossize" in
9264 8:8) cat <<EOM
9265
9266 You can have files larger than 2 gigabytes.
9267 EOM
9268    val="$define" ;;
9269 *)    case "$uselargefiles" in
9270    "$undef"|false|[nN]*) dflt='n' ;;
9271    *)   dflt='y' ;;
9272    esac
9273    cat <<EOM
9274
9275 Perl can be built to understand large files (files larger than 2 gigabytes)
9276 on some systems.  To do so, Configure can be run with -Duselargefiles.
9277
9278 If this doesn't make any sense to you, just accept the default '$dflt'.
9279 EOM
9280    rp='Try to understand large files, if available?'
9281    . ./myread
9282    case "$ans" in
9283    y|Y)         val="$define" ;;
9284    *)           val="$undef"  ;;
9285    esac
9286    ;;
9287 esac
9288 set uselargefiles
9289 eval $setvar
9290 : Look for a hint-file generated 'call-back-unit'.  If the
9291 : user has specified that a large files perl is to be built,
9292 : we may need to set or change some other defaults.
9293 if $test -f uselargefiles.cbu; then
9294         echo "Your platform has some specific hints regarding large file builds, using them..."
9295         . ./uselargefiles.cbu
9296 fi
9297 case "$uselargefiles" in
9298 "$define")
9299         if $test -f uselargefiles.cbu; then
9300                 echo " "
9301                 echo "Rechecking to see how big your file offsets are..." >&4
9302                 $cat >try.c <<EOCP
9303 #include <sys/types.h>
9304 #include <stdio.h>
9305 int main()
9306 {
9307     printf("%d\n", (int)sizeof($lseektype));
9308     return(0);
9309 }
9310 EOCP
9311                 set try
9312                 if eval $compile_ok; then
9313                         lseeksize=`$run ./try`
9314                         $echo "Your file offsets are now $lseeksize bytes long."
9315                 else
9316                         dflt="$lseeksize"
9317                         echo " "
9318                         echo "(I can't seem to compile the test program.  Guessing...)"
9319                         rp="What is the size of your file offsets (in bytes)?"
9320                         . ./myread
9321                         lseeksize="$ans"
9322                 fi
9323                 case "$fpostype" in
9324                 *_t) zzz="$fpostype"    ;;
9325                 *)   zzz="fpos_t"       ;;
9326                 esac
9327                 $echo $n "Rechecking the size of $zzz...$c" >&4
9328                 $cat > try.c <<EOCP
9329 #include <sys/types.h>
9330 #include <stdio.h>
9331 #$i_stdlib I_STDLIB
9332 #ifdef I_STDLIB
9333 #include <stdlib.h>
9334 #endif
9335 int main() {
9336     printf("%d\n", (int)sizeof($fpostype));
9337     return(0);
9338 }
9339 EOCP
9340                 set try
9341                 if eval $compile_ok; then
9342                         yyy=`$run ./try`
9343                         dflt="$lseeksize"
9344                         case "$yyy" in
9345                         '')     echo " "
9346                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9347                                 ;;
9348                         *)      fpossize=$yyy
9349                                 echo " $fpossize bytes." >&4
9350                                 ;;
9351                         esac
9352                 else
9353                         dflt="$fpossize"
9354                         echo " "
9355                         echo "(I can't compile the test program.  Guessing...)" >&4
9356                         rp="What is the size of your file positions (in bytes)?"
9357                         . ./myread
9358                         fpossize="$ans"
9359                 fi
9360                 $rm_try
9361         fi
9362         ;;
9363 esac
9364
9365 : Check if we want perlio
9366 useperlio="$define"
9367
9368 : Set the vendorbin variables
9369 case "$vendorprefix" in
9370 '')     d_vendorbin="$undef"
9371         vendorbin=''
9372         vendorbinexp=''
9373         ;;
9374 *)      d_vendorbin="$define"
9375         : determine where vendor-supplied executables go.
9376         case "$vendorbin" in
9377         '') dflt=$vendorprefix/bin ;;
9378         *)      dflt="$vendorbin" ;;
9379         esac
9380         fn=d~+
9381         rp='Pathname for the vendor-supplied executables directory?'
9382         . ./getfile
9383         vendorbin="$ans"
9384         vendorbinexp="$ansexp"
9385         ;;
9386 esac
9387 prefixvar=vendorbin
9388 . ./installprefix
9389
9390 : Set the vendorhtml1dir variables
9391 case "$vendorprefix" in
9392 '')     vendorhtml1dir=''
9393         vendorhtml1direxp=''
9394         ;;
9395 *)      : determine where vendor-supplied html pages go.
9396         : There is no standard location, so try to copy the previously-selected
9397         : directory structure for the core html pages.
9398         : XXX Better default suggestions would be welcome.
9399         case "$vendorhtml1dir" in
9400         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9401         *)      dflt=$vendorhtml1dir ;;
9402         esac
9403         case "$dflt" in
9404         ''|' ') dflt=none ;;
9405         esac
9406         fn=dn+~
9407         rp='Pathname for the vendor-supplied html pages?'
9408         . ./getfile
9409         vendorhtml1dir="$ans"
9410         vendorhtml1direxp="$ansexp"
9411         ;;
9412 esac
9413 : Use ' ' for none so value is preserved next time through Configure
9414 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9415 prefixvar=vendorhtml1dir
9416 . ./installprefix
9417
9418 : Set the vendorhtml3dir variables
9419 case "$vendorprefix" in
9420 '')     vendorhtml3dir=''
9421         vendorhtml3direxp=''
9422         ;;
9423 *)      : determine where vendor-supplied module html pages go.
9424         : There is no standard location, so try to copy the previously-selected
9425         : directory structure for the core html pages.
9426         : XXX Better default suggestions would be welcome.
9427         case "$vendorhtml3dir" in
9428         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9429         *)      dflt=$vendorhtml3dir ;;
9430         esac
9431         case "$dflt" in
9432         ''|' ') dflt=none ;;
9433         esac
9434         fn=dn+~
9435         rp='Pathname for the vendor-supplied html pages?'
9436         . ./getfile
9437         vendorhtml3dir="$ans"
9438         vendorhtml3direxp="$ansexp"
9439         ;;
9440 esac
9441 : Use ' ' for none so value is preserved next time through Configure
9442 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9443 prefixvar=vendorhtml3dir
9444 . ./installprefix
9445
9446 : Set the vendorman1dir variables
9447 case "$vendorprefix" in
9448 '')     vendorman1dir=''
9449         vendorman1direxp=''
9450         ;;
9451 *)      : determine where vendor-supplied manual pages go.
9452         case "$vendorman1dir" in
9453         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9454         *)      dflt=$vendorman1dir ;;
9455         esac
9456         case "$dflt" in
9457         ''|' ') dflt=none ;;
9458         esac
9459         fn=nd~+
9460         rp='Pathname for the vendor-supplied manual section 1 pages?'
9461         . ./getfile
9462         vendorman1dir="$ans"
9463         vendorman1direxp="$ansexp"
9464         ;;
9465 esac
9466 : Use ' ' for none so value is preserved next time through Configure
9467 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9468 prefixvar=vendorman1dir
9469 . ./installprefix
9470
9471 : Set the vendorman3dir variables
9472 case "$vendorprefix" in
9473 '')     vendorman3dir=''
9474         vendorman3direxp=''
9475         ;;
9476 *)      : determine where vendor-supplied module manual pages go.
9477         case "$vendorman3dir" in
9478         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9479         *)      dflt=$vendorman3dir ;;
9480         esac
9481         case "$dflt" in
9482         ''|' ') dflt=none ;;
9483         esac
9484         fn=nd~+
9485         rp='Pathname for the vendor-supplied manual section 3 pages?'
9486         . ./getfile
9487         vendorman3dir="$ans"
9488         vendorman3direxp="$ansexp"
9489         ;;
9490 esac
9491 : Use ' ' for none so value is preserved next time through Configure
9492 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9493 prefixvar=vendorman3dir
9494 . ./installprefix
9495
9496 : Set the vendorscript variables
9497 case "$vendorprefix" in
9498 '')     d_vendorscript="$undef"
9499         vendorscript=''
9500         vendorscriptexp=''
9501         ;;
9502 *)      d_vendorscript="$define"
9503         : determine where vendor-supplied scripts go.
9504         case "$vendorscript" in
9505         '')     dflt=$vendorprefix/script
9506                 $test -d $dflt || dflt=$vendorbin ;;
9507         *)  dflt="$vendorscript" ;;
9508         esac
9509         $cat <<EOM
9510
9511 The installation process will create a directory for
9512 vendor-supplied scripts.
9513
9514 EOM
9515         fn=d~+
9516         rp='Pathname for the vendor-supplied scripts directory?'
9517         . ./getfile
9518         vendorscript="$ans"
9519         vendorscriptexp="$ansexp"
9520         ;;
9521 esac
9522 prefixvar=vendorscript
9523 . ./installprefix
9524
9525 : script used to emit important warnings
9526 cat >warn <<EOS
9527 $startsh
9528 if test \$# -gt 0; then
9529         echo "\$@" >msg
9530 else
9531         cat >msg
9532 fi
9533 echo "*** WARNING:" >&4
9534 sed -e 's/^/*** /' <msg >&4
9535 echo "*** " >&4
9536 cat msg >>config.msg
9537 echo " " >>config.msg
9538 rm -f msg
9539 EOS
9540 chmod +x warn
9541 $eunicefix warn
9542
9543 : see which of string.h or strings.h is needed
9544 echo " "
9545 strings=`./findhdr string.h`
9546 if $test "$strings" && $test -r "$strings"; then
9547         echo "Using <string.h> instead of <strings.h>." >&4
9548         val="$define"
9549 else
9550         val="$undef"
9551         strings=`./findhdr strings.h`
9552         if $test "$strings" && $test -r "$strings"; then
9553                 echo "Using <strings.h> instead of <string.h>." >&4
9554         else
9555                 ./warn "No string header found -- You'll surely have problems."
9556         fi
9557 fi
9558 set i_string
9559 eval $setvar
9560 case "$i_string" in
9561 "$undef") strings=`./findhdr strings.h`;;
9562 *)        strings=`./findhdr string.h`;;
9563 esac
9564
9565 : see if qgcvt exists
9566 set qgcvt d_qgcvt
9567 eval $inlibc
9568
9569 : Check print/scan long double stuff
9570 echo " "
9571
9572 if $test X"$d_longdbl" = X"$define"; then
9573
9574 echo "Checking how to print long doubles..." >&4
9575
9576 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9577         $cat >try.c <<'EOCP'
9578 #include <sys/types.h>
9579 #include <stdio.h>
9580 int main() {
9581   double d = 123.456;
9582   printf("%.3f\n", d);
9583 }
9584 EOCP
9585         set try
9586         if eval $compile; then
9587                 yyy=`$run ./try`
9588                 case "$yyy" in
9589                 123.456)
9590                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9591                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9592                         echo "We will use %f."
9593                         ;;
9594                 esac
9595         fi
9596 fi
9597
9598 if $test X"$sPRIfldbl" = X; then
9599         $cat >try.c <<'EOCP'
9600 #include <sys/types.h>
9601 #include <stdio.h>
9602 int main() {
9603   long double d = 123.456;
9604   printf("%.3Lf\n", d);
9605 }
9606 EOCP
9607         set try
9608         if eval $compile; then
9609                 yyy=`$run ./try`
9610                 case "$yyy" in
9611                 123.456)
9612                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9613                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9614                         echo "We will use %Lf."
9615                         ;;
9616                 esac
9617         fi
9618 fi
9619
9620 if $test X"$sPRIfldbl" = X; then
9621         $cat >try.c <<'EOCP'
9622 #include <sys/types.h>
9623 #include <stdio.h>
9624 int main() {
9625   long double d = 123.456;
9626   printf("%.3llf\n", d);
9627 }
9628 EOCP
9629         set try
9630         if eval $compile; then
9631                 yyy=`$run ./try`
9632                 case "$yyy" in
9633                 123.456)
9634                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9635                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9636                         echo "We will use %llf."
9637                         ;;
9638                 esac
9639         fi
9640 fi
9641
9642 if $test X"$sPRIfldbl" = X; then
9643         $cat >try.c <<'EOCP'
9644 #include <sys/types.h>
9645 #include <stdio.h>
9646 int main() {
9647   long double d = 123.456;
9648   printf("%.3lf\n", d);
9649 }
9650 EOCP
9651         set try
9652         if eval $compile; then
9653                 yyy=`$run ./try`
9654                 case "$yyy" in
9655                 123.456)
9656                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9657                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9658                         echo "We will use %lf."
9659                         ;;
9660                 esac
9661         fi
9662 fi
9663
9664 if $test X"$sPRIfldbl" = X; then
9665         echo "Cannot figure out how to print long doubles." >&4
9666 else
9667         sSCNfldbl=$sPRIfldbl    # expect consistency
9668 fi
9669
9670 $rm_try
9671
9672 fi # d_longdbl
9673
9674 case "$sPRIfldbl" in
9675 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9676         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9677         d_SCNfldbl="$undef";
9678         ;;
9679 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9680         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9681         d_SCNfldbl="$define";
9682         ;;
9683 esac
9684
9685 : Check how to convert floats to strings.
9686
9687 if test "X$d_Gconvert" = X; then
9688
9689 echo " "
9690 echo "Checking for an efficient way to convert floats to strings."
9691 echo " " > try.c
9692 case "$uselongdouble" in
9693 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9694 esac
9695 case "$d_longdbl" in
9696 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9697 esac
9698 case "$d_PRIgldbl" in
9699 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9700 esac
9701 $cat >>try.c <<EOP
9702 #ifdef TRY_gconvert
9703 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9704 char *myname = "gconvert";
9705 #endif
9706 #ifdef TRY_gcvt
9707 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9708 char *myname = "gcvt";
9709 #endif
9710 #ifdef TRY_qgcvt
9711 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9712 char *myname = "qgcvt";
9713 #define DOUBLETYPE long double
9714 #endif
9715 #ifdef TRY_sprintf
9716 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9717 #ifdef HAS_PRIgldbl
9718 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9719 #else
9720 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9721 #endif
9722 #else
9723 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9724 #endif
9725 char *myname = "sprintf";
9726 #endif
9727
9728 #ifndef DOUBLETYPE
9729 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9730 #define DOUBLETYPE long double
9731 #else
9732 #define DOUBLETYPE double
9733 #endif
9734 #endif
9735
9736 #include <stdio.h>
9737
9738 #$i_stdlib I_STDLIB
9739 #ifdef I_STDLIB
9740 #include <stdlib.h>
9741 #endif
9742 #$i_string I_STRING
9743 #ifdef I_STRING
9744 #  include <string.h>
9745 #else
9746 #  include <strings.h>
9747 #endif
9748
9749 int checkit(char *expect, char *got)
9750 {
9751     if (strcmp(expect, got)) {
9752                 printf("%s oddity:  Expected %s, got %s\n",
9753                         myname, expect, got);
9754                 exit(1);
9755         }
9756 }
9757
9758 int main()
9759 {
9760         char buf[64];
9761         buf[63] = '\0';
9762
9763         /* This must be 1st test on (which?) platform */
9764         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9765         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9766         checkit("0.1", buf);
9767
9768         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9769         checkit("0.01", buf);
9770
9771         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9772         checkit("0.001", buf);
9773
9774         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9775         checkit("0.0001", buf);
9776
9777         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9778         if (strlen(buf) > 5)
9779             checkit("9e-005", buf); /* for Microsoft ?? */
9780         else
9781             checkit("9e-05", buf);
9782
9783         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9784         checkit("1", buf);
9785
9786         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9787         checkit("1.1", buf);
9788
9789         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9790         checkit("1.01", buf);
9791
9792         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9793         checkit("1.001", buf);
9794
9795         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9796         checkit("1.0001", buf);
9797
9798         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9799         checkit("1.00001", buf);
9800
9801         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9802         checkit("1.000001", buf);
9803
9804         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9805         checkit("0", buf);
9806
9807         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9808         checkit("-1", buf);
9809
9810         /* Some Linux gcvt's give 1.e+5 here. */
9811         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9812         checkit("100000", buf);
9813
9814         /* Some Linux gcvt's give -1.e+5 here. */
9815         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9816         checkit("-100000", buf);
9817
9818         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9819         checkit("123.456", buf);
9820
9821         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9822         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9823         /* 34 should be enough to scare even long double
9824          * places into using the e notation. */
9825         if (strlen(buf) > 5)
9826             checkit("1e+034", buf); /* for Microsoft */
9827         else
9828             checkit("1e+34", buf);
9829
9830         /* For Perl, if you add additional tests here, also add them to
9831          * t/base/num.t for benefit of platforms not using Configure or
9832          * overriding d_Gconvert */
9833
9834         exit(0);
9835 }
9836 EOP
9837 : first add preferred functions to our list
9838 xxx_list=""
9839 for xxx_convert in $gconvert_preference; do
9840     case $xxx_convert in
9841     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9842     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9843     esac
9844 done
9845 : then add any others
9846 for xxx_convert in gconvert gcvt sprintf; do
9847     case "$xxx_list" in
9848     *$xxx_convert*) ;;
9849     *) xxx_list="$xxx_list $xxx_convert" ;;
9850     esac
9851 done
9852
9853 case "$d_longdbl$uselongdouble" in
9854 "$define$define")
9855     : again, add preferred functions to our list first
9856     xxx_ld_list=""
9857     for xxx_convert in $gconvert_ld_preference; do
9858         case $xxx_convert in
9859         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9860         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9861         esac
9862     done
9863     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9864     for xxx_convert in qgcvt sprintf $xxx_list; do
9865         case "$xxx_ld_list" in
9866         $xxx_convert*|*" $xxx_convert"*) ;;
9867         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9868         esac
9869     done
9870     : if sprintf cannot do long doubles, move it to the end
9871     if test "$d_PRIgldbl" != "$define"; then
9872         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9873     fi
9874     : if no qgcvt, remove it
9875     if test "$d_qgcvt" != "$define"; then
9876         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9877     fi
9878     : use the ld_list
9879     xxx_list="$xxx_ld_list"
9880     ;;
9881 esac
9882
9883 for xxx_convert in $xxx_list; do
9884         echo "Trying $xxx_convert..."
9885         $rm -f try try$_o core
9886         set try -DTRY_$xxx_convert
9887         if eval $compile; then
9888                 echo "$xxx_convert() found." >&4
9889                 if $run ./try; then
9890                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9891                         break;
9892                 else
9893                         echo "...But $xxx_convert didn't work as I expected."
9894                         xxx_convert=''
9895                 fi
9896         else
9897                 echo "$xxx_convert NOT found." >&4
9898         fi
9899 done
9900
9901 if test X$xxx_convert = X; then
9902     echo "*** WHOA THERE!!! ***" >&4
9903     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9904     xxx_convert=sprintf
9905 fi
9906
9907 case "$xxx_convert" in
9908 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9909 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9910 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9911 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9912    "$define$define$define")
9913       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9914    "$define$define$undef")
9915       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9916    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9917    esac
9918    ;;
9919 esac
9920
9921 fi
9922 $rm_try
9923
9924 : see if _fwalk exists
9925 set fwalk d__fwalk
9926 eval $inlibc
9927
9928 : Initialize h_fcntl
9929 h_fcntl=false
9930
9931 : Initialize h_sysfile
9932 h_sysfile=false
9933
9934 : access call always available on UNIX
9935 set access d_access
9936 eval $inlibc
9937
9938 : locate the flags for 'access()'
9939 case "$d_access" in
9940 "$define")
9941         echo " "
9942         $cat >access.c <<EOCP
9943 #include <sys/types.h>
9944 #ifdef I_FCNTL
9945 #include <fcntl.h>
9946 #endif
9947 #ifdef I_SYS_FILE
9948 #include <sys/file.h>
9949 #endif
9950 #ifdef I_UNISTD
9951 #include <unistd.h>
9952 #endif
9953 #$i_stdlib I_STDLIB
9954 #ifdef I_STDLIB
9955 #include <stdlib.h>
9956 #endif
9957 int main() {
9958         exit(R_OK);
9959 }
9960 EOCP
9961         : check sys/file.h first, no particular reason here
9962         if $test `./findhdr sys/file.h` && \
9963                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9964                 h_sysfile=true;
9965                 echo "<sys/file.h> defines the *_OK access constants." >&4
9966         elif $test `./findhdr fcntl.h` && \
9967                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9968                 h_fcntl=true;
9969                 echo "<fcntl.h> defines the *_OK access constants." >&4
9970         elif $test `./findhdr unistd.h` && \
9971                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9972                 echo "<unistd.h> defines the *_OK access constants." >&4
9973         else
9974                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9975         fi
9976         ;;
9977 esac
9978 $rm -f access*
9979
9980 : see if accessx exists
9981 set accessx d_accessx
9982 eval $inlibc
9983
9984 : see if aintl exists
9985 set aintl d_aintl
9986 eval $inlibc
9987
9988 : see if alarm exists
9989 set alarm d_alarm
9990 eval $inlibc
9991
9992 : see if 64bit time functions exists
9993
9994 set ctime64 d_ctime64
9995 eval $inlibc
9996
9997 set localtime64 d_localtime64
9998 eval $inlibc
9999
10000 set gmtime64 d_gmtime64
10001 eval $inlibc
10002
10003 set mktime64 d_mktime64
10004 eval $inlibc
10005
10006 set difftime64 d_difftime64
10007 eval $inlibc
10008
10009 set asctime64 d_asctime64
10010 eval $inlibc
10011
10012 : see if POSIX threads are available
10013 set pthread.h i_pthread
10014 eval $inhdr
10015
10016 : define a function to check prototypes
10017 $cat > protochk <<EOSH
10018 $startsh
10019 cc="$cc"
10020 optimize="$optimize"
10021 ccflags="$ccflags"
10022 prototype="$prototype"
10023 define="$define"
10024 rm_try="$rm_try"
10025 usethreads=$usethreads
10026 i_pthread=$i_pthread
10027 pthread_h_first=$pthread_h_first
10028 EOSH
10029
10030 $cat >> protochk <<'EOSH'
10031
10032 $rm_try
10033 foo="$1"
10034 shift
10035 while test $# -ge 2; do
10036         case "$1" in
10037                 $define) echo "#include <$2>" >> try.c ;;
10038                 literal) echo "$2" >> try.c ;;
10039         esac
10040     # Extra magic for the benefit of systems that need pthread.h
10041     # to be included early to correctly detect threadsafe functions.
10042     # Such functions must guarantee themselves, though, that the usethreads
10043     # and i_pthread have been defined, before calling protochk.
10044     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10045         echo "#include <pthread.h>" >> try.c
10046         pthread_h_done=yes
10047     fi
10048     shift 2
10049 done
10050 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10051 cat >> try.c <<'EOCP'
10052 #ifdef CAN_PROTOTYPE
10053 #define _(args) args
10054 #else
10055 #define _(args) ()
10056 #endif
10057 EOCP
10058 echo "$foo" >> try.c
10059 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10060 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10061 status=$?
10062 $rm_try
10063 exit $status
10064 EOSH
10065 chmod +x protochk
10066 $eunicefix protochk
10067
10068 : Define hasproto macro for Configure internal use
10069 hasproto='varname=$1; func=$2; shift; shift;
10070 while $test $# -ge 2; do
10071         case "$1" in
10072         $define) echo "#include <$2>";;
10073         esac ;
10074     shift 2;
10075 done > try.c;
10076 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10077 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10078         echo "$func() prototype found.";
10079         val="$define";
10080 else
10081         echo "$func() prototype NOT found.";
10082         val="$undef";
10083 fi;
10084 set $varname;
10085 eval $setvar;
10086 $rm_try tryout.c'
10087
10088 : see if sys/types.h has to be included
10089 set sys/types.h i_systypes
10090 eval $inhdr
10091
10092 : see if sys/select.h has to be included
10093 set sys/select.h i_sysselct
10094 eval $inhdr
10095
10096 : Define hasfield macro for Configure internal use
10097 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10098 while $test $# -ge 2; do
10099         case "$1" in
10100         $define) echo "#include <$2>";;
10101         esac ;
10102     shift 2;
10103 done > try.c;
10104 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10105 set try;
10106 if eval $compile; then
10107         val="$define";
10108 else
10109         val="$undef";
10110 fi;
10111 set $varname;
10112 eval $setvar;
10113 $rm_try'
10114
10115 : see if we should include time.h, sys/time.h, or both
10116 echo " "
10117 if test "X$timeincl" = X; then
10118         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10119         $echo $n "I'm now running the test program...$c"
10120         $cat >try.c <<EOCP
10121 #include <sys/types.h>
10122 #ifdef I_TIME
10123 #include <time.h>
10124 #endif
10125 #ifdef I_SYSTIME
10126 #ifdef SYSTIMEKERNEL
10127 #define KERNEL
10128 #endif
10129 #include <sys/time.h>
10130 #endif
10131 #ifdef I_SYSSELECT
10132 #include <sys/select.h>
10133 #endif
10134 #$i_stdlib I_STDLIB
10135 #ifdef I_STDLIB
10136 #include <stdlib.h>
10137 #endif
10138 int main()
10139 {
10140         struct tm foo;
10141 #ifdef S_TIMEVAL
10142         struct timeval bar;
10143 #endif
10144 #ifdef S_TIMEZONE
10145         struct timezone tzp;
10146 #endif
10147         if (foo.tm_sec == foo.tm_sec)
10148                 exit(0);
10149 #ifdef S_TIMEVAL
10150         if (bar.tv_sec == bar.tv_sec)
10151                 exit(0);
10152 #endif
10153         exit(1);
10154 }
10155 EOCP
10156         flags=''
10157         for s_timezone in '-DS_TIMEZONE' ''; do
10158         sysselect=''
10159         for s_timeval in '-DS_TIMEVAL' ''; do
10160         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10161         for i_time in '' '-DI_TIME'; do
10162         for i_systime in '-DI_SYSTIME' ''; do
10163                 case "$flags" in
10164                 '') $echo $n ".$c"
10165                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10166                         if eval $compile; then
10167                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10168                                 shift
10169                                 flags="$*"
10170                                 echo " "
10171                                 $echo $n "Succeeded with $flags$c"
10172                         fi
10173                         ;;
10174                 esac
10175         done
10176         done
10177         done
10178         done
10179         done
10180         timeincl=''
10181         echo " "
10182         case "$flags" in
10183         *SYSTIMEKERNEL*) i_systimek="$define"
10184                 timeincl=`./findhdr sys/time.h`
10185                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10186         *) i_systimek="$undef";;
10187         esac
10188         case "$flags" in
10189         *I_TIME*) i_time="$define"
10190                 timeincl=`./findhdr time.h`" $timeincl"
10191                 echo "We'll include <time.h>." >&4;;
10192         *) i_time="$undef";;
10193         esac
10194         case "$flags" in
10195         *I_SYSTIME*) i_systime="$define"
10196                 timeincl=`./findhdr sys/time.h`" $timeincl"
10197                 echo "We'll include <sys/time.h>." >&4;;
10198         *) i_systime="$undef";;
10199         esac
10200         $rm_try
10201 fi
10202 : see if struct tm knows about tm_zone
10203 case "$i_systime$i_time" in
10204 *$define*)
10205         echo " "
10206         echo "Checking to see if your struct tm has tm_zone field..." >&4
10207         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10208         eval $hasfield
10209         ;;
10210 *)      val="$undef"
10211         set d_tm_tm_zone
10212         eval $setvar
10213         ;;
10214 esac
10215 case "$d_tm_tm_zone" in
10216 "$define")      echo "Yes, it does."   ;;
10217 *)              echo "No, it doesn't." ;;
10218 esac
10219 : see if struct tm knows about tm_gmtoff
10220 case "$i_systime$i_time" in
10221 *$define*)
10222         echo " "
10223         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10224         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10225         eval $hasfield
10226         ;;
10227 *)      val="$undef"
10228         set d_tm_tm_gmtoff
10229         eval $setvar
10230         ;;
10231 esac
10232 case "$d_tm_tm_gmtoff" in
10233 "$define")      echo "Yes, it does."   ;;
10234 *)              echo "No, it doesn't." ;;
10235 esac
10236
10237 : see if asctime_r exists
10238 set asctime_r d_asctime_r
10239 eval $inlibc
10240 case "$d_asctime_r" in
10241 "$define")
10242         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10243         case "$d_asctime_r_proto:$usethreads" in
10244         ":define")      d_asctime_r_proto=define
10245                 set d_asctime_r_proto asctime_r $hdrs
10246                 eval $hasproto ;;
10247         *)      ;;
10248         esac
10249         case "$d_asctime_r_proto" in
10250         define)
10251         case "$asctime_r_proto" in
10252         ''|0) try='char* asctime_r(const struct tm*, char*);'
10253         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10254         esac
10255         case "$asctime_r_proto" in
10256         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10257         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10258         esac
10259         case "$asctime_r_proto" in
10260         ''|0) try='int asctime_r(const struct tm*, char*);'
10261         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10262         esac
10263         case "$asctime_r_proto" in
10264         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10265         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10266         esac
10267         case "$asctime_r_proto" in
10268         ''|0)   d_asctime_r=undef
10269                 asctime_r_proto=0
10270                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10271         * )     case "$asctime_r_proto" in
10272                 REENTRANT_PROTO*) ;;
10273                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10274                 esac
10275                 echo "Prototype: $try" ;;
10276         esac
10277         ;;
10278         *)      case "$usethreads" in
10279                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10280                 esac
10281                 d_asctime_r=undef
10282                 asctime_r_proto=0
10283                 ;;
10284         esac
10285         ;;
10286 *)      asctime_r_proto=0
10287         ;;
10288 esac
10289
10290 : see if atolf exists
10291 set atolf d_atolf
10292 eval $inlibc
10293
10294 : see if atoll exists
10295 set atoll d_atoll
10296 eval $inlibc
10297
10298 : Look for GCC-style attribute format
10299 case "$d_attribute_format" in
10300 '')
10301 echo " "
10302 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10303 $cat >attrib.c <<'EOCP'
10304 #include <stdio.h>
10305 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10306 EOCP
10307 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10308         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10309                 echo "Your C compiler doesn't support __attribute__((format))."
10310                 val="$undef"
10311         else
10312                 echo "Your C compiler supports __attribute__((format))."
10313                 val="$define"
10314         fi
10315 else
10316         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10317         val="$undef"
10318 fi
10319 ;;
10320 *) val="$d_attribute_format" ;;
10321 esac
10322 set d_attribute_format
10323 eval $setvar
10324 $rm -f attrib*
10325
10326 : Look for GCC-style attribute format with null format allowed
10327 case "$d_printf_format_null" in
10328 '') case "$d_attribute_format" in
10329     $define)
10330         echo " "
10331         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10332 $cat >attrib.c <<EOCP
10333 #include <stdio.h>
10334 #$i_stdlib I_STDLIB
10335 #ifdef I_STDLIB
10336 #include <stdlib.h>
10337 #endif
10338 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10339 int null_printf (char* pat,...) { return (int)pat; }
10340 int main () { exit(null_printf(NULL)); }
10341 EOCP
10342         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10343             : run the executable in case it produces a run-time warning
10344             if $run ./attrib >>attrib.out 2>&1; then
10345                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10346                     echo "Your C compiler doesn't allow __printf__ format to be null."
10347                     val="$undef"
10348                 else
10349                     echo "Your C compiler allows __printf__ format to be null."
10350                     val="$define"
10351                 fi
10352             else
10353             echo "Your C compiler executable failed with __printf__ format null."
10354             val="$undef"
10355         fi
10356     else
10357         echo "Your C compiler fails with __printf__ format null."
10358         val="$undef"
10359     fi
10360     ;;
10361     *)  val="$undef" ;;
10362     esac
10363 ;;
10364 *)  val="$d_printf_format_null" ;;
10365 esac
10366 set d_printf_format_null
10367 eval $setvar
10368 $rm -f attrib*
10369
10370 : Look for GCC-style attribute malloc
10371 case "$d_attribute_malloc" in
10372 '')
10373 echo " "
10374 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10375 $cat >attrib.c <<'EOCP'
10376 #include <stdio.h>
10377 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10378 EOCP
10379 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10380         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10381                 echo "Your C compiler doesn't support __attribute__((malloc))."
10382                 val="$undef"
10383         else
10384                 echo "Your C compiler supports __attribute__((malloc))."
10385                 val="$define"
10386         fi
10387 else
10388         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10389         val="$undef"
10390 fi
10391 ;;
10392 *) val="$d_attribute_malloc" ;;
10393 esac
10394 set d_attribute_malloc
10395 eval $setvar
10396 $rm -f attrib*
10397
10398 : Look for GCC-style attribute nonnull
10399 case "$d_attribute_nonnull" in
10400 '')
10401 echo " "
10402 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10403 $cat >attrib.c <<'EOCP'
10404 #include <stdio.h>
10405 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10406 EOCP
10407 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10408         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10409                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10410                 val="$undef"
10411         else
10412                 echo "Your C compiler supports __attribute__((nonnull))."
10413                 val="$define"
10414         fi
10415 else
10416         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10417         val="$undef"
10418 fi
10419 ;;
10420 *) val="$d_attribute_nonnull" ;;
10421 esac
10422 set d_attribute_nonnull
10423 eval $setvar
10424 $rm -f attrib*
10425
10426 : Look for GCC-style attribute noreturn
10427 case "$d_attribute_noreturn" in
10428 '')
10429 echo " "
10430 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10431 $cat >attrib.c <<'EOCP'
10432 #include <stdio.h>
10433 void fall_over_dead( void ) __attribute__((noreturn));
10434 EOCP
10435 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10436         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10437                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10438                 val="$undef"
10439         else
10440                 echo "Your C compiler supports __attribute__((noreturn))."
10441                 val="$define"
10442         fi
10443 else
10444         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10445         val="$undef"
10446 fi
10447 ;;
10448 *) val="$d_attribute_noreturn" ;;
10449 esac
10450 set d_attribute_noreturn
10451 eval $setvar
10452 $rm -f attrib*
10453
10454 : Look for GCC-style attribute pure
10455 case "$d_attribute_pure" in
10456 '')
10457 echo " "
10458 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10459 $cat >attrib.c <<'EOCP'
10460 #include <stdio.h>
10461 int square( int n ) __attribute__((pure));
10462 EOCP
10463 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10464         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10465                 echo "Your C compiler doesn't support __attribute__((pure))."
10466                 val="$undef"
10467         else
10468                 echo "Your C compiler supports __attribute__((pure))."
10469                 val="$define"
10470         fi
10471 else
10472         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10473         val="$undef"
10474 fi
10475 ;;
10476 *) val="$d_attribute_pure" ;;
10477 esac
10478 set d_attribute_pure
10479 eval $setvar
10480 $rm -f attrib*
10481
10482 : Look for GCC-style attribute unused
10483 case "$d_attribute_unused" in
10484 '')
10485 echo " "
10486 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10487 $cat >attrib.c <<'EOCP'
10488 #include <stdio.h>
10489 int do_something( int dummy __attribute__((unused)), int n );
10490 EOCP
10491 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10492         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10493                 echo "Your C compiler doesn't support __attribute__((unused))."
10494                 val="$undef"
10495         else
10496                 echo "Your C compiler supports __attribute__((unused))."
10497                 val="$define"
10498         fi
10499 else
10500         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10501         val="$undef"
10502 fi
10503 ;;
10504 *) val="$d_attribute_unused" ;;
10505 esac
10506 set d_attribute_unused
10507 eval $setvar
10508 $rm -f attrib*
10509
10510 : Look for GCC-style attribute deprecated
10511 case "$d_attribute_deprecated" in
10512 '')
10513 echo " "
10514 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10515 $cat >attrib.c <<'EOCP'
10516 #include <stdio.h>
10517 int I_am_deprecated(void) __attribute__((deprecated));
10518 EOCP
10519 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10520         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10521                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10522                 val="$undef"
10523         else
10524                 echo "Your C compiler supports __attribute__((deprecated))."
10525                 val="$define"
10526         fi
10527 else
10528         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10529         val="$undef"
10530 fi
10531 ;;
10532 *) val="$d_attribute_deprecated" ;;
10533 esac
10534 set d_attribute_deprecated
10535 eval $setvar
10536 $rm -f attrib*
10537
10538 : Look for GCC-style attribute warn_unused_result
10539 case "$d_attribute_warn_unused_result" in
10540 '')
10541 echo " "
10542 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10543 $cat >attrib.c <<'EOCP'
10544 #include <stdio.h>
10545 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10546 EOCP
10547 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10548         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10549                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10550                 val="$undef"
10551         else
10552                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10553                 val="$define"
10554         fi
10555 else
10556         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10557         val="$undef"
10558 fi
10559 ;;
10560 *) val="$d_attribute_warn_unused_result" ;;
10561 esac
10562 set d_attribute_warn_unused_result
10563 eval $setvar
10564 $rm -f attrib*
10565
10566 : see if bcmp exists
10567 set bcmp d_bcmp
10568 eval $inlibc
10569
10570 : see if bcopy exists
10571 set bcopy d_bcopy
10572 eval $inlibc
10573
10574 : see if getpgrp exists
10575 set getpgrp d_getpgrp
10576 eval $inlibc
10577
10578 case "$d_getpgrp" in
10579 "$define")
10580         echo " "
10581         echo "Checking to see which flavor of getpgrp is in use..."
10582         $cat >try.c <<EOP
10583 #$i_unistd I_UNISTD
10584 #include <sys/types.h>
10585 #ifdef I_UNISTD
10586 #  include <unistd.h>
10587 #endif
10588 #$i_stdlib I_STDLIB
10589 #ifdef I_STDLIB
10590 #include <stdlib.h>
10591 #endif
10592 int main()
10593 {
10594         if (getuid() == 0) {
10595                 printf("(I see you are running Configure as super-user...)\n");
10596                 setuid(1);
10597         }
10598 #ifdef TRY_BSD_PGRP
10599         if (getpgrp(1) == 0)
10600                 exit(0);
10601 #else
10602         if (getpgrp() > 0)
10603                 exit(0);
10604 #endif
10605         exit(1);
10606 }
10607 EOP
10608         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10609                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10610                 val="$define"
10611         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10612                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10613                 val="$undef"
10614         else
10615                 echo "I can't seem to compile and run the test program."
10616                 if ./usg; then
10617                         xxx="a USG one, i.e. you use getpgrp()."
10618                 else
10619                         # SVR4 systems can appear rather BSD-ish.
10620                         case "$i_unistd" in
10621                         $undef)
10622                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10623                                 val="$define"
10624                                 ;;
10625                         $define)
10626                                 xxx="probably a USG one, i.e. you use getpgrp()."
10627                                 val="$undef"
10628                                 ;;
10629                         esac
10630                 fi
10631                 echo "Assuming your getpgrp is $xxx" >&4
10632         fi
10633         ;;
10634 *) val="$undef";;
10635 esac
10636 set d_bsdgetpgrp
10637 eval $setvar
10638 $rm_try
10639
10640 : see if setpgrp exists
10641 set setpgrp d_setpgrp
10642 eval $inlibc
10643
10644 case "$d_setpgrp" in
10645 "$define")
10646         echo " "
10647         echo "Checking to see which flavor of setpgrp is in use..."
10648         $cat >try.c <<EOP
10649 #$i_unistd I_UNISTD
10650 #include <sys/types.h>
10651 #ifdef I_UNISTD
10652 #  include <unistd.h>
10653 #endif
10654 #$i_stdlib I_STDLIB
10655 #ifdef I_STDLIB
10656 #include <stdlib.h>
10657 #endif
10658 int main()
10659 {
10660         if (getuid() == 0) {
10661                 printf("(I see you are running Configure as super-user...)\n");
10662                 setuid(1);
10663         }
10664 #ifdef TRY_BSD_PGRP
10665         if (-1 == setpgrp(1, 1))
10666                 exit(0);
10667 #else
10668         if (setpgrp() != -1)
10669                 exit(0);
10670 #endif
10671         exit(1);
10672 }
10673 EOP
10674         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10675                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10676                 val="$define"
10677         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10678                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10679                 val="$undef"
10680         else
10681                 echo "(I can't seem to compile and run the test program.)"
10682                 if ./usg; then
10683                         xxx="a USG one, i.e. you use setpgrp()."
10684                 else
10685                         # SVR4 systems can appear rather BSD-ish.
10686                         case "$i_unistd" in
10687                         $undef)
10688                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10689                                 val="$define"
10690                                 ;;
10691                         $define)
10692                                 xxx="probably a USG one, i.e. you use setpgrp()."
10693                                 val="$undef"
10694                                 ;;
10695                         esac
10696                 fi
10697                 echo "Assuming your setpgrp is $xxx" >&4
10698         fi
10699         ;;
10700 *) val="$undef";;
10701 esac
10702 set d_bsdsetpgrp
10703 eval $setvar
10704 $rm_try
10705
10706 : Look for GCC-style __builtin_choose_expr
10707 case "$d_builtin_choose_expr" in
10708 '')
10709     echo " "
10710     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10711     $cat >try.c <<'EOCP'
10712 #include <assert.h>
10713 #include <stdlib.h>
10714 #include <stdio.h>
10715
10716 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10717
10718 int main(void) {
10719     assert( SYRINX(1) == 2112 );
10720     assert( SYRINX(1) != 5150 );
10721     assert( SYRINX(0) == 5150 );
10722     assert( SYRINX(0) != 2112 );
10723     puts( "All good!" );
10724     exit(0);
10725 }
10726
10727 EOCP
10728     set try
10729     if eval $compile && $run ./try; then
10730         echo "Your C compiler supports __builtin_choose_expr."
10731         val="$define"
10732     else
10733         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10734         val="$undef"
10735     fi
10736 ;;
10737 *) val="$d_builtin_choose_expr" ;;
10738 esac
10739
10740 set d_builtin_choose_expr
10741 eval $setvar
10742 $rm_try
10743
10744 : Look for GCC-style __builtin_expect
10745 case "$d_builtin_expect" in
10746 '')
10747     echo " "
10748     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10749     $cat >try.c <<'EOCP'
10750 int main(void) {
10751     int n = 50;
10752     if ( __builtin_expect(n, 0) ) n = 1;
10753     /* Remember shell exit code truth is 0, C truth is non-zero */
10754     return !(n == 1);
10755 }
10756 EOCP
10757     set try
10758     if eval $compile && $run ./try; then
10759         echo "Your C compiler supports __builtin_expect."
10760         val="$define"
10761     else
10762         echo "Your C compiler doesn't seem to understand __builtin_expect."
10763         val="$undef"
10764     fi
10765     ;;
10766 *) val="$d_builtin_expect" ;;
10767 esac
10768
10769 set d_builtin_expect
10770 eval $setvar
10771 $rm_try
10772
10773 : see if bzero exists
10774 set bzero d_bzero
10775 eval $inlibc
10776
10777 : see if stdarg is available
10778 echo " "
10779 if $test `./findhdr stdarg.h`; then
10780         echo "<stdarg.h> found." >&4
10781         valstd="$define"
10782 else
10783         echo "<stdarg.h> NOT found." >&4
10784         valstd="$undef"
10785 fi
10786
10787 : see if varargs is available
10788 echo " "
10789 if $test `./findhdr varargs.h`; then
10790         echo "<varargs.h> found." >&4
10791 else
10792         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10793 fi
10794
10795 : set up the varargs testing programs
10796 $cat > varargs.c <<EOP
10797 #ifdef I_STDARG
10798 #include <stdarg.h>
10799 #endif
10800 #ifdef I_VARARGS
10801 #include <varargs.h>
10802 #endif
10803
10804 #ifdef I_STDARG
10805 int f(char *p, ...)
10806 #else
10807 int f(va_alist)
10808 va_dcl
10809 #endif
10810 {
10811         va_list ap;
10812 #ifndef I_STDARG
10813         char *p;
10814 #endif
10815 #ifdef I_STDARG
10816         va_start(ap,p);
10817 #else
10818         va_start(ap);
10819         p = va_arg(ap, char *);
10820 #endif
10821         va_end(ap);
10822         return 0;
10823 }
10824 EOP
10825 $cat > varargs <<EOP
10826 $startsh
10827 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10828         echo "true"
10829 else
10830         echo "false"
10831 fi
10832 $rm -f varargs$_o
10833 EOP
10834 chmod +x varargs
10835
10836 : now check which varargs header should be included
10837 echo " "
10838 i_varhdr=''
10839 val=''
10840 case "$valstd" in
10841 "$define")
10842         if `./varargs I_STDARG`; then
10843                 val='stdarg.h'
10844         elif `./varargs I_VARARGS`; then
10845                 val='varargs.h'
10846         fi
10847         ;;
10848 *)
10849         if `./varargs I_VARARGS`; then
10850                 val='varargs.h'
10851         fi
10852         ;;
10853 esac
10854 case "$val" in
10855 '')
10856         echo " "
10857         echo "*** WHOA THERE!!! ***" >&4
10858         echo "    Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
10859         case "$knowitall" in
10860         '')
10861         echo "    I'm giving up; maybe you can try again with a different compiler?" >&4
10862                 exit 1
10863                 ;;
10864         esac
10865 echo "I could not find the definition for va_dcl... You have problems..." >&4
10866         val="$undef"; set i_stdarg; eval $setvar
10867         val="$undef"; set i_varargs; eval $setvar
10868         ;;
10869 *)
10870         set i_varhdr
10871         eval $setvar
10872         case "$i_varhdr" in
10873         stdarg.h)
10874                 val="$define"; set i_stdarg; eval $setvar
10875                 val="$undef"; set i_varargs; eval $setvar
10876                 ;;
10877         varargs.h)
10878                 val="$undef"; set i_stdarg; eval $setvar
10879                 val="$define"; set i_varargs; eval $setvar
10880                 ;;
10881         esac
10882         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10883 esac
10884 $rm -f varargs*
10885
10886 : see if the Compiler supports C99 variadic macros
10887 case "$i_stdarg$i_stdlib" in
10888     "$define$define")
10889     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10890     $cat >try.c <<EOCP
10891 #include <stdio.h>
10892 #include <stdarg.h>
10893
10894 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10895
10896 int main() {
10897   char buf[20];
10898   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10899   puts(buf);
10900   return 0;
10901 }
10902 EOCP
10903     set try
10904     if eval $compile && $run ./try 2>&1 >/dev/null; then
10905         case "`$run ./try`" in
10906             "123 456 789")
10907             echo "You have C99 variadic macros." >&4
10908             d_c99_variadic_macros="$define"
10909             ;;
10910             *)
10911             echo "You don't have functional C99 variadic macros." >&4
10912             d_c99_variadic_macros="$undef"
10913             ;;
10914         esac
10915     else
10916         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10917         d_c99_variadic_macros="$undef"
10918     fi
10919     $rm_try
10920     ;;
10921     *)
10922     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10923     d_c99_variadic_macros="$undef"
10924     ;;
10925 esac
10926
10927 : see if signal is declared as pointer to function returning int or void
10928 echo " "
10929 xxx=`./findhdr signal.h`
10930 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10931 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10932         echo "You have int (*signal())() instead of void." >&4
10933         val="$undef"
10934 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10935         echo "You have void (*signal())()." >&4
10936         val="$define"
10937 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10938         echo "You have int (*signal())() instead of void." >&4
10939         val="$undef"
10940 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10941         echo "You have void (*signal())()." >&4
10942         val="$define"
10943 else
10944         case "$d_voidsig" in
10945         '')
10946         echo "I can't determine whether signal handler returns void or int..." >&4
10947                 dflt=void
10948                 rp="What type does your signal handler return?"
10949                 . ./myread
10950                 case "$ans" in
10951                 v*) val="$define";;
10952                 *) val="$undef";;
10953                 esac;;
10954         "$define")
10955                 echo "As you already told me, signal handler returns void." >&4
10956                 val="$define"
10957                 ;;
10958         *)      echo "As you already told me, signal handler returns int." >&4
10959                 val="$undef"
10960                 ;;
10961         esac
10962 fi
10963 set d_voidsig
10964 eval $setvar
10965 case "$d_voidsig" in
10966 "$define") signal_t="void";;
10967 *) signal_t="int";;
10968 esac
10969 $rm -f $$.tmp
10970
10971 : check for ability to cast large floats to 32-bit ints.
10972 echo " "
10973 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10974 if $test "$intsize" -ge 4; then
10975         xxx=int
10976 else
10977         xxx=long
10978 fi
10979 $cat >try.c <<EOCP
10980 #include <stdio.h>
10981 #$i_stdlib I_STDLIB
10982 #ifdef I_STDLIB
10983 #include <stdlib.h>
10984 #endif
10985 #include <sys/types.h>
10986 #include <signal.h>
10987 $signal_t blech(int s) { exit(3); }
10988 int main()
10989 {
10990         $xxx i32;
10991         double f, g;
10992         int result = 0;
10993         char str[16];
10994         signal(SIGFPE, blech);
10995
10996         /* Don't let compiler optimize the test away.  Store the number
10997            in a writable string for gcc to pass to sscanf under HP-UX.
10998         */
10999         sprintf(str, "2147483647");
11000         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
11001         g = 10 * f;
11002         i32  = ($xxx) g;
11003
11004         /* x86 processors will probably give 0x8000 0000, which is a
11005            sign change.  We don't want that.  We want to mimic SPARC
11006            behavior here, which is to preserve the sign and give
11007            back 0x7fff ffff.
11008         */
11009         if (i32 != ($xxx) f)
11010                 result |= 1;
11011         exit(result);
11012 }
11013 EOCP
11014 set try
11015 if eval $compile_ok; then
11016         $run ./try
11017         yyy=$?
11018 else
11019         echo "(I can't seem to compile the test program--assuming it can't)"
11020         yyy=1
11021 fi
11022 case "$yyy" in
11023 0)      val="$define"
11024         echo "Yup, it can."
11025         ;;
11026 *)      val="$undef"
11027         echo "Nope, it can't."
11028         ;;
11029 esac
11030 set d_casti32
11031 eval $setvar
11032 $rm_try
11033
11034 : check for ability to cast negative floats to unsigned
11035 echo " "
11036 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11037 $cat >try.c <<EOCP
11038 #include <stdio.h>
11039 #$i_stdlib I_STDLIB
11040 #ifdef I_STDLIB
11041 #include <stdlib.h>
11042 #endif
11043 #include <sys/types.h>
11044 #include <signal.h>
11045 $signal_t blech(int s) { exit(7); }
11046 $signal_t blech_in_list(int s) { exit(4); }
11047 unsigned long dummy_long(unsigned long p) { return p; }
11048 unsigned int dummy_int(unsigned int p) { return p; }
11049 unsigned short dummy_short(unsigned short p) { return p; }
11050 int main()
11051 {
11052         double f;
11053         unsigned long along;
11054         unsigned int aint;
11055         unsigned short ashort;
11056         int result = 0;
11057         char str[16];
11058
11059         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11060            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11061            optimized the whole file away
11062         */
11063         /* Store the number in a writable string for gcc to pass to
11064            sscanf under HP-UX.
11065         */
11066         sprintf(str, "-123");
11067         sscanf(str, "%lf", &f);  /* f = -123.; */
11068
11069         signal(SIGFPE, blech);
11070         along = (unsigned long)f;
11071         aint = (unsigned int)f;
11072         ashort = (unsigned short)f;
11073         if (along != (unsigned long)-123)
11074                 result |= 1;
11075         if (aint != (unsigned int)-123)
11076                 result |= 1;
11077         if (ashort != (unsigned short)-123)
11078                 result |= 1;
11079         sprintf(str, "1073741824.");
11080         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11081         f = f + f;
11082         along = 0;
11083         along = (unsigned long)f;
11084         if (along != 0x80000000)
11085                 result |= 2;
11086         f -= 1.;
11087         along = 0;
11088         along = (unsigned long)f;
11089         if (along != 0x7fffffff)
11090                 result |= 1;
11091         f += 2.;
11092         along = 0;
11093         along = (unsigned long)f;
11094         if (along != 0x80000001)
11095                 result |= 2;
11096         if (result)
11097                 exit(result);
11098         signal(SIGFPE, blech_in_list);
11099         sprintf(str, "123.");
11100         sscanf(str, "%lf", &f);  /* f = 123.; */
11101         along = dummy_long((unsigned long)f);
11102         aint = dummy_int((unsigned int)f);
11103         ashort = dummy_short((unsigned short)f);
11104         if (along != (unsigned long)123)
11105                 result |= 4;
11106         if (aint != (unsigned int)123)
11107                 result |= 4;
11108         if (ashort != (unsigned short)123)
11109                 result |= 4;
11110         exit(result);
11111
11112 }
11113 EOCP
11114 set try
11115 if eval $compile_ok; then
11116         $run ./try
11117         castflags=$?
11118 else
11119         echo "(I can't seem to compile the test program--assuming it can't)"
11120         castflags=7
11121 fi
11122 case "$castflags" in
11123 0)      val="$define"
11124         echo "Yup, it can."
11125         ;;
11126 *)      val="$undef"
11127         echo "Nope, it can't."
11128         ;;
11129 esac
11130 set d_castneg
11131 eval $setvar
11132 $rm_try
11133
11134 : see if vprintf exists
11135 echo " "
11136 if set vprintf val -f d_vprintf; eval $csym; $val; then
11137         echo 'vprintf() found.' >&4
11138         val="$define"
11139         $cat >try.c <<EOF
11140 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11141 #$i_varargs I_VARARGS
11142
11143 #$i_stdlib I_STDLIB
11144 #$i_unistd I_UNISTD
11145
11146 #ifdef I_STDARG
11147 #  include <stdarg.h>
11148 #else /* I_VARARGS */
11149 #  include <varargs.h>
11150 #endif
11151
11152 #ifdef I_UNISTD
11153 #  include <unistd.h>
11154 #endif
11155
11156 #ifdef I_STDLIB
11157 #  include <stdlib.h>
11158 #endif
11159
11160 #include <stdio.h> /* vsprintf prototype */
11161
11162 #ifdef I_STDARG
11163 void xxx(int n, ...)
11164 {
11165     va_list args;
11166     char buf[10];
11167     va_start(args, n);
11168     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11169 }
11170 int main() { xxx(1, "foo"); }
11171
11172 #else /* I_VARARGS */
11173
11174 xxx(va_alist)
11175 va_dcl
11176 {
11177     va_list args;
11178     char buf[10];
11179     va_start(args);
11180     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11181 }
11182 int main() { xxx("foo"); }
11183
11184 #endif
11185
11186 EOF
11187         set try
11188         if eval $compile_ok; then
11189                 if $run ./try; then
11190                         echo "Your vsprintf() returns (int)." >&4
11191                         val2="$undef"
11192                 else
11193                         echo "Your vsprintf() returns (char*)." >&4
11194                         val2="$define"
11195                 fi
11196         else
11197                 echo 'I am unable to compile the vsprintf() test program.' >&4
11198                 # We shouldn't get here.  If we do, assume the standard signature,
11199                 # not the old BSD one.
11200                 echo 'Guessing that vsprintf() returns (int).' >&4
11201                 val2="$undef"
11202         fi
11203 else
11204         echo 'vprintf() NOT found.' >&4
11205         val="$undef"
11206         val2="$undef"
11207 fi
11208 $rm_try
11209 set d_vprintf
11210 eval $setvar
11211 val=$val2
11212 set d_charvspr
11213 eval $setvar
11214
11215 : see if chown exists
11216 set chown d_chown
11217 eval $inlibc
11218
11219 : see if chroot exists
11220 set chroot d_chroot
11221 eval $inlibc
11222
11223 : see if chsize exists
11224 set chsize d_chsize
11225 eval $inlibc
11226
11227 : see if class exists
11228 set class d_class
11229 eval $inlibc
11230
11231 : see if clearenv exists
11232 set clearenv d_clearenv
11233 eval $inlibc
11234
11235 : Define hasstruct macro for Configure internal use
11236 hasstruct='varname=$1; struct=$2; shift; shift;
11237 while $test $# -ge 2; do
11238         case "$1" in
11239         $define) echo "#include <$2>";;
11240         esac ;
11241     shift 2;
11242 done > try.c;
11243 echo "int main () { struct $struct foo; }" >> try.c;
11244 set try;
11245 if eval $compile; then
11246         val="$define";
11247 else
11248         val="$undef";
11249 fi;
11250 set $varname;
11251 eval $setvar;
11252 $rm_try'
11253
11254 : see whether socket exists
11255 socketlib=''
11256 sockethdr=''
11257 echo " "
11258 $echo $n "Hmm... $c" >&4
11259 if set socket val -f d_socket; eval $csym; $val; then
11260         echo "Looks like you have Berkeley networking support." >&4
11261         d_socket="$define"
11262         if set setsockopt val -f; eval $csym; $val; then
11263                 d_oldsock="$undef"
11264         else
11265                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11266                 d_oldsock="$define"
11267         fi
11268 else
11269         if $contains socklib libc.list >/dev/null 2>&1; then
11270                 echo "Looks like you have Berkeley networking support." >&4
11271                 d_socket="$define"
11272                 : we will have to assume that it supports the 4.2 BSD interface
11273                 d_oldsock="$undef"
11274         else
11275                 echo "You don't have Berkeley networking in libc$_a..." >&4
11276                 if test "X$d_socket" = "X$define"; then
11277                    echo "...but you seem to believe that you have sockets." >&4
11278                 else
11279                         for net in net socket
11280                         do
11281                                 if test -f /usr/lib/lib$net$_a; then
11282                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11283                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11284                                         if $contains socket libc.list >/dev/null 2>&1; then
11285                                                 d_socket="$define"
11286                                                 socketlib="-l$net"
11287                                                 case "$net" in
11288                                                 net)
11289                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11290                                                         sockethdr="-I/usr/netinclude"
11291                                                         ;;
11292                                                 esac
11293                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11294                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11295                                                         d_oldsock="$undef"
11296                                                 else
11297                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11298                                                         d_oldsock="$define"
11299                                                 fi
11300                                                 break
11301                                         fi
11302                                 fi
11303                         done
11304                         if test "X$d_socket" != "X$define"; then
11305                            echo "or anywhere else I see." >&4
11306                            d_socket="$undef"
11307                            d_oldsock="$undef"
11308                         fi
11309                 fi
11310         fi
11311 fi
11312
11313 : see if socketpair exists
11314 set socketpair d_sockpair
11315 eval $inlibc
11316
11317
11318 echo " "
11319 echo "Checking the availability sa_len in the sock struct ..." >&4
11320 $cat >try.c <<EOF
11321 #include <sys/types.h>
11322 #include <sys/socket.h>
11323 int main() {
11324 struct sockaddr sa;
11325 return (sa.sa_len);
11326 }
11327 EOF
11328 val="$undef"
11329 set try; if eval $compile; then
11330         val="$define"
11331 fi
11332 set d_sockaddr_sa_len; eval $setvar
11333 $rm_try
11334
11335 echo " "
11336 echo "Checking the availability struct sockaddr_in6 ..." >&4
11337 $cat >try.c <<EOF
11338 #include <sys/types.h>
11339 #include <sys/socket.h>
11340 #include <netinet/in.h>
11341 int main() {
11342 struct sockaddr_in6 sin6;
11343 return (sin6.sin6_family);
11344 }
11345 EOF
11346 val="$undef"
11347 set try; if eval $compile; then
11348         val="$define"
11349 fi
11350 set d_sockaddr_in6; eval $setvar
11351 $rm_try
11352
11353 echo " "
11354 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11355 $cat >try.c <<EOF
11356 #include <sys/types.h>
11357 #include <sys/socket.h>
11358 #include <netinet/in.h>
11359 int main() {
11360 struct sockaddr_in6 sin6;
11361 return (sin6.sin6_scope_id);
11362 }
11363 EOF
11364 val="$undef"
11365 set try; if eval $compile; then
11366         val="$define"
11367 fi
11368 set d_sin6_scope_id; eval $setvar
11369 $rm_try
11370
11371 echo " "
11372 echo "Checking the availability struct ip_mreq ..." >&4
11373 $cat >try.c <<EOF
11374 #include <sys/types.h>
11375 #include <sys/socket.h>
11376 #include <netinet/in.h>
11377 int main() {
11378 struct ip_mreq mreq;
11379 return (mreq.imr_multiaddr.s_addr);
11380 }
11381 EOF
11382 val="$undef"
11383 set try; if eval $compile; then
11384        val="$define"
11385 fi
11386 set d_ip_mreq; eval $setvar
11387 $rm_try
11388
11389 echo " "
11390 echo "Checking the availability struct ip_mreq_source ..." >&4
11391 $cat >try.c <<EOF
11392 #include <sys/types.h>
11393 #include <sys/socket.h>
11394 #include <netinet/in.h>
11395 int main() {
11396 struct ip_mreq_source mreq;
11397 return (mreq.imr_multiaddr.s_addr);
11398 }
11399 EOF
11400 val="$undef"
11401 set try; if eval $compile; then
11402        val="$define"
11403 fi
11404 set d_ip_mreq_source; eval $setvar
11405 $rm_try
11406
11407 echo " "
11408 echo "Checking the availability struct ipv6_mreq ..." >&4
11409 $cat >try.c <<EOF
11410 #include <sys/types.h>
11411 #include <sys/socket.h>
11412 #include <netinet/in.h>
11413 int main() {
11414 struct ipv6_mreq mreq;
11415 return (mreq.ipv6mr_interface);
11416 }
11417 EOF
11418 val="$undef"
11419 set try; if eval $compile; then
11420         val="$define"
11421 fi
11422 set d_ipv6_mreq; eval $setvar
11423 $rm_try
11424
11425 echo " "
11426 echo "Checking the availability struct ipv6_mreq_source ..." >&4
11427 $cat >try.c <<EOF
11428 #include <sys/types.h>
11429 #include <sys/socket.h>
11430 #include <netinet/in.h>
11431 int main() {
11432 struct ipv6_mreq_source mreq;
11433 return (mreq.imr_multiaddr.s_addr);
11434 }
11435 EOF
11436 val="$undef"
11437 set try; if eval $compile; then
11438        val="$define"
11439 fi
11440 set d_ipv6_mreq_source; eval $setvar
11441 $rm_try
11442
11443 echo " "
11444 echo "Checking the availability of certain socket constants..." >&4
11445 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11446         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11447         $cat >try.c <<EOF
11448 #include <sys/types.h>
11449 #include <sys/socket.h>
11450 int main() {
11451     int i = $ENUM;
11452 }
11453 EOF
11454         val="$undef"
11455         set try; if eval $compile; then
11456                 val="$define"
11457         fi
11458         set d_${enum}; eval $setvar
11459         $rm_try
11460 done
11461
11462 : see if this is a sys/uio.h system
11463 set sys/uio.h i_sysuio
11464 eval $inhdr
11465
11466 : Check for cmsghdr support
11467 echo " "
11468 echo "Checking to see if your system supports struct cmsghdr..." >&4
11469 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11470 eval $hasstruct
11471 case "$d_cmsghdr_s" in
11472 "$define")      echo "Yes, it does."   ;;
11473 *)              echo "No, it doesn't." ;;
11474 esac
11475
11476
11477 : check for const keyword
11478 echo " "
11479 echo 'Checking to see if your C compiler knows about "const"...' >&4
11480 $cat >const.c <<'EOCP'
11481 typedef struct spug { int drokk; } spug;
11482 int main()
11483 {
11484         const char *foo;
11485         const spug y = { 0 };
11486 }
11487 EOCP
11488 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11489         val="$define"
11490         echo "Yup, it does."
11491 else
11492         val="$undef"
11493         echo "Nope, it doesn't."
11494 fi
11495 set d_const
11496 eval $setvar
11497
11498 : see if copysignl exists
11499 set copysignl d_copysignl
11500 eval $inlibc
11501
11502 : see if crypt exists
11503 echo " "
11504 set crypt d_crypt
11505 eval $inlibc
11506 case "$d_crypt" in
11507 $define) cryptlib='' ;;
11508 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11509                 echo 'crypt() found.' >&4
11510                 val="$define"
11511                 cryptlib=''
11512         else
11513                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11514                 if $test -z "$cryptlib"; then
11515                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11516                 else
11517                         cryptlib=-lcrypt
11518                 fi
11519                 if $test -z "$cryptlib"; then
11520                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11521                 else
11522                         cryptlib=-lcrypt
11523                 fi
11524                 if $test -z "$cryptlib"; then
11525                         cryptlib=`./loc libcrypt$_a "" $libpth`
11526                 else
11527                         cryptlib=-lcrypt
11528                 fi
11529                 if $test -z "$cryptlib"; then
11530                         echo 'crypt() NOT found.' >&4
11531                         val="$undef"
11532                 else
11533                         val="$define"
11534                 fi
11535         fi
11536         set d_crypt
11537         eval $setvar
11538         ;;
11539 esac
11540
11541 : see if this is a crypt.h system
11542 set crypt.h i_crypt
11543 eval $inhdr
11544
11545 : see if crypt_r exists
11546 set crypt_r d_crypt_r
11547 eval $inlibc
11548 case "$d_crypt_r" in
11549 "$define")
11550         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11551         case "$d_crypt_r_proto:$usethreads" in
11552         ":define")      d_crypt_r_proto=define
11553                 set d_crypt_r_proto crypt_r $hdrs
11554                 eval $hasproto ;;
11555         *)      ;;
11556         esac
11557         case "$d_crypt_r_proto" in
11558         define)
11559         case "$crypt_r_proto" in
11560         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11561         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11562         esac
11563         case "$crypt_r_proto" in
11564         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11565         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11566         esac
11567         case "$crypt_r_proto" in
11568         ''|0)   d_crypt_r=undef
11569                 crypt_r_proto=0
11570                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11571         * )     case "$crypt_r_proto" in
11572                 REENTRANT_PROTO*) ;;
11573                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11574                 esac
11575                 echo "Prototype: $try" ;;
11576         esac
11577         ;;
11578         *)      case "$usethreads" in
11579                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11580                 esac
11581                 d_crypt_r=undef
11582                 crypt_r_proto=0
11583                 ;;
11584         esac
11585         ;;
11586 *)      crypt_r_proto=0
11587         ;;
11588 esac
11589
11590 : get csh whereabouts
11591 case "$csh" in
11592 'csh') val="$undef" ;;
11593 *) val="$define" ;;
11594 esac
11595 set d_csh
11596 eval $setvar
11597 : Respect a hint or command line value for full_csh.
11598 case "$full_csh" in
11599 '') full_csh=$csh ;;
11600 esac
11601
11602 : see if ctermid exists
11603 set ctermid d_ctermid
11604 eval $inlibc
11605
11606 : see if ctermid_r exists
11607 set ctermid_r d_ctermid_r
11608 eval $inlibc
11609 case "$d_ctermid_r" in
11610 "$define")
11611         hdrs="$i_systypes sys/types.h define stdio.h "
11612         case "$d_ctermid_r_proto:$usethreads" in
11613         ":define")      d_ctermid_r_proto=define
11614                 set d_ctermid_r_proto ctermid_r $hdrs
11615                 eval $hasproto ;;
11616         *)      ;;
11617         esac
11618         case "$d_ctermid_r_proto" in
11619         define)
11620         case "$ctermid_r_proto" in
11621         ''|0) try='char* ctermid_r(char*);'
11622         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11623         esac
11624         case "$ctermid_r_proto" in
11625         ''|0)   d_ctermid_r=undef
11626                 ctermid_r_proto=0
11627                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11628         * )     case "$ctermid_r_proto" in
11629                 REENTRANT_PROTO*) ;;
11630                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11631                 esac
11632                 echo "Prototype: $try" ;;
11633         esac
11634         ;;
11635         *)      case "$usethreads" in
11636                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11637                 esac
11638                 d_ctermid_r=undef
11639                 ctermid_r_proto=0
11640                 ;;
11641         esac
11642         ;;
11643 *)      ctermid_r_proto=0
11644         ;;
11645 esac
11646
11647 : see if ctime_r exists
11648 set ctime_r d_ctime_r
11649 eval $inlibc
11650 case "$d_ctime_r" in
11651 "$define")
11652         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11653         case "$d_ctime_r_proto:$usethreads" in
11654         ":define")      d_ctime_r_proto=define
11655                 set d_ctime_r_proto ctime_r $hdrs
11656                 eval $hasproto ;;
11657         *)      ;;
11658         esac
11659         case "$d_ctime_r_proto" in
11660         define)
11661         case "$ctime_r_proto" in
11662         ''|0) try='char* ctime_r(const time_t*, char*);'
11663         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11664         esac
11665         case "$ctime_r_proto" in
11666         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11667         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11668         esac
11669         case "$ctime_r_proto" in
11670         ''|0) try='int ctime_r(const time_t*, char*);'
11671         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11672         esac
11673         case "$ctime_r_proto" in
11674         ''|0) try='int ctime_r(const time_t*, char*, int);'
11675         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11676         esac
11677         case "$ctime_r_proto" in
11678         ''|0)   d_ctime_r=undef
11679                 ctime_r_proto=0
11680                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11681         * )     case "$ctime_r_proto" in
11682                 REENTRANT_PROTO*) ;;
11683                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11684                 esac
11685                 echo "Prototype: $try" ;;
11686         esac
11687         ;;
11688         *)      case "$usethreads" in
11689                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11690                 esac
11691                 d_ctime_r=undef
11692                 ctime_r_proto=0
11693                 ;;
11694         esac
11695         ;;
11696 *)      ctime_r_proto=0
11697         ;;
11698 esac
11699
11700 : see if cuserid exists
11701 set cuserid d_cuserid
11702 eval $inlibc
11703
11704 : see if this is a limits.h system
11705 set limits.h i_limits
11706 eval $inhdr
11707
11708 : see if this is a float.h system
11709 set float.h i_float
11710 eval $inhdr
11711
11712 : See if number of significant digits in a double precision number is known
11713 echo " "
11714 $cat >dbl_dig.c <<EOM
11715 #$i_limits I_LIMITS
11716 #$i_float I_FLOAT
11717 #ifdef I_LIMITS
11718 #include <limits.h>
11719 #endif
11720 #ifdef I_FLOAT
11721 #include <float.h>
11722 #endif
11723 #ifdef DBL_DIG
11724 printf("Contains DBL_DIG");
11725 #endif
11726 EOM
11727 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11728 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11729         echo "DBL_DIG found." >&4
11730         val="$define"
11731 else
11732         echo "DBL_DIG NOT found." >&4
11733         val="$undef"
11734 fi
11735 $rm -f dbl_dig.?
11736 set d_dbl_dig
11737 eval $setvar
11738
11739 : see if dbm.h is available
11740 : see if dbmclose exists
11741 set dbmclose d_dbmclose
11742 eval $inlibc
11743
11744 case "$d_dbmclose" in
11745 $define)
11746         set dbm.h i_dbm
11747         eval $inhdr
11748         case "$i_dbm" in
11749         $define)
11750                 val="$undef"
11751                 set i_rpcsvcdbm
11752                 eval $setvar
11753                 ;;
11754         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11755                 eval $inhdr
11756                 ;;
11757         esac
11758         ;;
11759 *)      echo "We won't be including <dbm.h>"
11760         val="$undef"
11761         set i_dbm
11762         eval $setvar
11763         val="$undef"
11764         set i_rpcsvcdbm
11765         eval $setvar
11766         ;;
11767 esac
11768
11769 : see if prototype for dbminit is available
11770 echo " "
11771 set d_dbminitproto dbminit $i_dbm dbm.h
11772 eval $hasproto
11773
11774 : see if difftime exists
11775 set difftime d_difftime
11776 eval $inlibc
11777
11778 : see if this is a dirent system
11779 echo " "
11780 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11781         val="$define"
11782         echo "<dirent.h> found." >&4
11783 else
11784         val="$undef"
11785         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11786                 echo "<sys/dir.h> found." >&4
11787                 echo " "
11788         else
11789                 xinc=`./findhdr sys/ndir.h`
11790         fi
11791         echo "<dirent.h> NOT found." >&4
11792 fi
11793 set i_dirent
11794 eval $setvar
11795
11796 : Look for type of directory structure.
11797 echo " "
11798 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11799
11800 case "$direntrytype" in
11801 ''|' ')
11802         case "$i_dirent" in
11803         $define) guess1='struct dirent' ;;
11804         *) guess1='struct direct'  ;;
11805         esac
11806         ;;
11807 *)      guess1="$direntrytype"
11808         ;;
11809 esac
11810
11811 case "$guess1" in
11812 'struct dirent') guess2='struct direct' ;;
11813 *) guess2='struct dirent' ;;
11814 esac
11815
11816 if $contains "$guess1" try.c >/dev/null 2>&1; then
11817         direntrytype="$guess1"
11818         echo "Your directory entries are $direntrytype." >&4
11819 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11820         direntrytype="$guess2"
11821         echo "Your directory entries seem to be $direntrytype." >&4
11822 else
11823         echo "I don't recognize your system's directory entries." >&4
11824         rp="What type is used for directory entries on this system?"
11825         dflt="$guess1"
11826         . ./myread
11827         direntrytype="$ans"
11828 fi
11829 $rm_try
11830
11831 : see if the directory entry stores field length
11832 echo " "
11833 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11834 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11835         echo "Good, your directory entry keeps length information in d_namlen." >&4
11836         val="$define"
11837 else
11838         echo "Your directory entry does not know about the d_namlen field." >&4
11839         val="$undef"
11840 fi
11841 set d_dirnamlen
11842 eval $setvar
11843 $rm_try
11844
11845 : Look for DIR.dd_fd
11846 case "$i_dirent" in
11847 "$define")
11848     echo "Checking to see if DIR has a dd_fd member variable" >&4
11849     $cat >try.c <<EOCP
11850 #$i_stdlib I_STDLIB
11851 #ifdef I_STDLIB
11852 #include <stdlib.h>
11853 #endif
11854 #include <dirent.h>
11855
11856 int main() {
11857     DIR dir;
11858     dir.dd_fd = 1;
11859     return 0;
11860 }
11861 EOCP
11862     val=$undef
11863     set try
11864     if eval $compile; then
11865         echo "Yes, it does."
11866         val="$define"
11867     else
11868         echo "No, it does not."
11869         val="$undef"
11870     fi
11871     ;;
11872 *)
11873     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11874     val="$undef"
11875     ;;
11876 esac
11877 set d_dir_dd_fd
11878 eval $setvar
11879 $rm_try
11880
11881 : see if this is an sysdir system
11882 set sys/dir.h i_sysdir
11883 eval $inhdr
11884
11885 : see if this is an sysndir system
11886 set sys/ndir.h i_sysndir
11887 eval $inhdr
11888
11889 : Look for dirfd
11890 echo " "
11891 $cat >dirfd.c <<EOM
11892 #include <stdio.h>
11893 #$i_stdlib I_STDLIB
11894 #ifdef I_STDLIB
11895 #include <stdlib.h>
11896 #endif
11897 #$i_dirent I_DIRENT             /**/
11898 #$i_sysdir I_SYS_DIR            /**/
11899 #$i_sysndir I_SYS_NDIR          /**/
11900 #$i_systypes I_SYS_TYPES        /**/
11901 #if defined(I_SYS_TYPES)
11902 #include <sys/types.h>
11903 #endif
11904 #if defined(I_DIRENT)
11905 #include <dirent.h>
11906 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11907 #include <sys/dir.h>
11908 #endif
11909 #else
11910 #ifdef I_SYS_NDIR
11911 #include <sys/ndir.h>
11912 #else
11913 #ifdef I_SYS_DIR
11914 #ifdef hp9000s500
11915 #include <ndir.h>       /* may be wrong in the future */
11916 #else
11917 #include <sys/dir.h>
11918 #endif
11919 #endif
11920 #endif
11921 #endif
11922 int main() {
11923         DIR *dirp = opendir(".");
11924         if (dirfd(dirp) >= 0)
11925                 exit(0);
11926         else
11927                 exit(1);
11928 }
11929 EOM
11930 val=$undef
11931 set dirfd
11932 if eval $compile; then
11933         val="$define"
11934 fi
11935 case "$val" in
11936 $define)        echo "dirfd() found." >&4       ;;
11937 *)              echo "dirfd() NOT found." >&4   ;;
11938 esac
11939 set d_dirfd
11940 eval $setvar
11941 $rm -f dirfd*
11942
11943 : see if dlerror exists
11944 xxx_runnm="$runnm"
11945 runnm=false
11946 set dlerror d_dlerror
11947 eval $inlibc
11948 runnm="$xxx_runnm"
11949
11950 : see if dlfcn is available
11951 set dlfcn.h i_dlfcn
11952 eval $inhdr
11953
11954 : Check what extension to use for shared libs
11955 case "$usedl" in
11956 $define|y|true)
11957         $cat << EOM
11958
11959 On a few systems, the dynamically loaded modules that perl generates and uses
11960 will need a different extension than shared libs. The default will probably
11961 be appropriate.
11962
11963 EOM
11964         case "$dlext" in
11965         '')     dflt="$so" ;;
11966         *)      dflt="$dlext" ;;
11967         esac
11968         rp='What is the extension of dynamically loaded modules'
11969         . ./myread
11970         dlext="$ans"
11971         ;;
11972 *)
11973         dlext="none"
11974         ;;
11975 esac
11976
11977 : Check if dlsym need a leading underscore
11978 echo " "
11979 val="$undef"
11980
11981 case "$dlsrc" in
11982 dl_dlopen.xs)
11983         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11984         $cat >dyna.c <<'EOM'
11985 fred () { }
11986 EOM
11987
11988 $cat >fred.c<<EOM
11989
11990 #include <stdio.h>
11991 #$i_stdlib I_STDLIB
11992 #ifdef I_STDLIB
11993 #include <stdlib.h>
11994 #endif
11995 #$i_dlfcn I_DLFCN
11996 #ifdef I_DLFCN
11997 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11998 #else
11999 #include <sys/types.h>
12000 #include <nlist.h>
12001 #include <link.h>
12002 #endif
12003
12004 extern int fred() ;
12005
12006 int main()
12007 {
12008     void * handle ;
12009     void * symbol ;
12010 #ifndef RTLD_LAZY
12011     int mode = 1 ;
12012 #else
12013     int mode = RTLD_LAZY ;
12014 #endif
12015     handle = dlopen("./dyna.$dlext", mode) ;
12016     if (handle == NULL) {
12017         printf ("1\n") ;
12018         fflush (stdout) ;
12019         exit(0);
12020     }
12021     symbol = dlsym(handle, "fred") ;
12022     if (symbol == NULL) {
12023         /* try putting a leading underscore */
12024         symbol = dlsym(handle, "_fred") ;
12025         if (symbol == NULL) {
12026             printf ("2\n") ;
12027             fflush (stdout) ;
12028             exit(0);
12029         }
12030         printf ("3\n") ;
12031     }
12032     else
12033         printf ("4\n") ;
12034     fflush (stdout) ;
12035     exit(0);
12036 }
12037 EOM
12038         : Call the object file tmp-dyna.o in case dlext=o.
12039         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
12040                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
12041                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
12042                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
12043                 xxx=`$run ./fred`
12044                 case $xxx in
12045                 1)      echo "Test program failed using dlopen." >&4
12046                         echo "Perhaps you should not use dynamic loading." >&4;;
12047                 2)      echo "Test program failed using dlsym." >&4
12048                         echo "Perhaps you should not use dynamic loading." >&4;;
12049                 3)      echo "dlsym needs a leading underscore" >&4
12050                         val="$define" ;;
12051                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
12052                 esac
12053         else
12054                 echo "I can't compile and run the test program." >&4
12055                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
12056         fi
12057         ;;
12058 esac
12059
12060 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
12061
12062 set d_dlsymun
12063 eval $setvar
12064
12065 : see if drand48_r exists
12066 set drand48_r d_drand48_r
12067 eval $inlibc
12068 case "$d_drand48_r" in
12069 "$define")
12070         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
12071         case "$d_drand48_r_proto:$usethreads" in
12072         ":define")      d_drand48_r_proto=define
12073                 set d_drand48_r_proto drand48_r $hdrs
12074                 eval $hasproto ;;
12075         *)      ;;
12076         esac
12077         case "$d_drand48_r_proto" in
12078         define)
12079         case "$drand48_r_proto" in
12080         ''|0) try='int drand48_r(struct drand48_data*, double*);'
12081         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
12082         esac
12083         case "$drand48_r_proto" in
12084         ''|0)   d_drand48_r=undef
12085                 drand48_r_proto=0
12086                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12087         * )     case "$drand48_r_proto" in
12088                 REENTRANT_PROTO*) ;;
12089                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12090                 esac
12091                 echo "Prototype: $try" ;;
12092         esac
12093         ;;
12094         *)      case "$usethreads" in
12095                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12096                 esac
12097                 d_drand48_r=undef
12098                 drand48_r_proto=0
12099                 ;;
12100         esac
12101         ;;
12102 *)      drand48_r_proto=0
12103         ;;
12104 esac
12105
12106 : see if prototype for drand48 is available
12107 echo " "
12108 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12109 eval $hasproto
12110
12111 : see if dup2 exists
12112 set dup2 d_dup2
12113 eval $inlibc
12114
12115 : see if eaccess exists
12116 set eaccess d_eaccess
12117 eval $inlibc
12118
12119 : see if endgrent exists
12120 set endgrent d_endgrent
12121 eval $inlibc
12122
12123 : see if this is an grp system
12124 set grp.h i_grp
12125 eval $inhdr
12126
12127 case "$i_grp" in
12128 $define)
12129         xxx=`./findhdr grp.h`
12130         $cppstdin $cppflags $cppminus < $xxx >$$.h
12131
12132         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12133                 val="$define"
12134         else
12135                 val="$undef"
12136         fi
12137         set d_grpasswd
12138         eval $setvar
12139
12140         $rm -f $$.h
12141         ;;
12142 *)
12143         val="$undef";
12144         set d_grpasswd; eval $setvar
12145         ;;
12146 esac
12147
12148 : see if endgrent_r exists
12149 set endgrent_r d_endgrent_r
12150 eval $inlibc
12151 case "$d_endgrent_r" in
12152 "$define")
12153         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12154         case "$d_endgrent_r_proto:$usethreads" in
12155         ":define")      d_endgrent_r_proto=define
12156                 set d_endgrent_r_proto endgrent_r $hdrs
12157                 eval $hasproto ;;
12158         *)      ;;
12159         esac
12160         case "$d_endgrent_r_proto" in
12161         define)
12162         case "$endgrent_r_proto" in
12163         ''|0) try='int endgrent_r(FILE**);'
12164         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12165         esac
12166         case "$endgrent_r_proto" in
12167         ''|0) try='void endgrent_r(FILE**);'
12168         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12169         esac
12170         case "$endgrent_r_proto" in
12171         ''|0)   d_endgrent_r=undef
12172                 endgrent_r_proto=0
12173                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12174         * )     case "$endgrent_r_proto" in
12175                 REENTRANT_PROTO*) ;;
12176                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12177                 esac
12178                 echo "Prototype: $try" ;;
12179         esac
12180         ;;
12181         *)      case "$usethreads" in
12182                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12183                 esac
12184                 d_endgrent_r=undef
12185                 endgrent_r_proto=0
12186                 ;;
12187         esac
12188         ;;
12189 *)      endgrent_r_proto=0
12190         ;;
12191 esac
12192
12193 : see if endhostent exists
12194 set endhostent d_endhent
12195 eval $inlibc
12196
12197 : see if this is a netdb.h system
12198 set netdb.h i_netdb
12199 eval $inhdr
12200
12201 : see if endhostent_r exists
12202 set endhostent_r d_endhostent_r
12203 eval $inlibc
12204 case "$d_endhostent_r" in
12205 "$define")
12206         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12207         case "$d_endhostent_r_proto:$usethreads" in
12208         ":define")      d_endhostent_r_proto=define
12209                 set d_endhostent_r_proto endhostent_r $hdrs
12210                 eval $hasproto ;;
12211         *)      ;;
12212         esac
12213         case "$d_endhostent_r_proto" in
12214         define)
12215         case "$endhostent_r_proto" in
12216         ''|0) try='int endhostent_r(struct hostent_data*);'
12217         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12218         esac
12219         case "$endhostent_r_proto" in
12220         ''|0) try='void endhostent_r(struct hostent_data*);'
12221         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12222         esac
12223         case "$endhostent_r_proto" in
12224         ''|0)   d_endhostent_r=undef
12225                 endhostent_r_proto=0
12226                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12227         * )     case "$endhostent_r_proto" in
12228                 REENTRANT_PROTO*) ;;
12229                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12230                 esac
12231                 echo "Prototype: $try" ;;
12232         esac
12233         ;;
12234         *)      case "$usethreads" in
12235                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12236                 esac
12237                 d_endhostent_r=undef
12238                 endhostent_r_proto=0
12239                 ;;
12240         esac
12241         ;;
12242 *)      endhostent_r_proto=0
12243         ;;
12244 esac
12245
12246 : see if endnetent exists
12247 set endnetent d_endnent
12248 eval $inlibc
12249
12250 : see if endnetent_r exists
12251 set endnetent_r d_endnetent_r
12252 eval $inlibc
12253 case "$d_endnetent_r" in
12254 "$define")
12255         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12256         case "$d_endnetent_r_proto:$usethreads" in
12257         ":define")      d_endnetent_r_proto=define
12258                 set d_endnetent_r_proto endnetent_r $hdrs
12259                 eval $hasproto ;;
12260         *)      ;;
12261         esac
12262         case "$d_endnetent_r_proto" in
12263         define)
12264         case "$endnetent_r_proto" in
12265         ''|0) try='int endnetent_r(struct netent_data*);'
12266         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12267         esac
12268         case "$endnetent_r_proto" in
12269         ''|0) try='void endnetent_r(struct netent_data*);'
12270         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12271         esac
12272         case "$endnetent_r_proto" in
12273         ''|0)   d_endnetent_r=undef
12274                 endnetent_r_proto=0
12275                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12276         * )     case "$endnetent_r_proto" in
12277                 REENTRANT_PROTO*) ;;
12278                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12279                 esac
12280                 echo "Prototype: $try" ;;
12281         esac
12282         ;;
12283         *)      case "$usethreads" in
12284                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12285                 esac
12286                 d_endnetent_r=undef
12287                 endnetent_r_proto=0
12288                 ;;
12289         esac
12290         ;;
12291 *)      endnetent_r_proto=0
12292         ;;
12293 esac
12294
12295 : see if endprotoent exists
12296 set endprotoent d_endpent
12297 eval $inlibc
12298
12299 : see if endprotoent_r exists
12300 set endprotoent_r d_endprotoent_r
12301 eval $inlibc
12302 case "$d_endprotoent_r" in
12303 "$define")
12304         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12305         case "$d_endprotoent_r_proto:$usethreads" in
12306         ":define")      d_endprotoent_r_proto=define
12307                 set d_endprotoent_r_proto endprotoent_r $hdrs
12308                 eval $hasproto ;;
12309         *)      ;;
12310         esac
12311         case "$d_endprotoent_r_proto" in
12312         define)
12313         case "$endprotoent_r_proto" in
12314         ''|0) try='int endprotoent_r(struct protoent_data*);'
12315         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12316         esac
12317         case "$endprotoent_r_proto" in
12318         ''|0) try='void endprotoent_r(struct protoent_data*);'
12319         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12320         esac
12321         case "$endprotoent_r_proto" in
12322         ''|0)   d_endprotoent_r=undef
12323                 endprotoent_r_proto=0
12324                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12325         * )     case "$endprotoent_r_proto" in
12326                 REENTRANT_PROTO*) ;;
12327                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12328                 esac
12329                 echo "Prototype: $try" ;;
12330         esac
12331         ;;
12332         *)      case "$usethreads" in
12333                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12334                 esac
12335                 d_endprotoent_r=undef
12336                 endprotoent_r_proto=0
12337                 ;;
12338         esac
12339         ;;
12340 *)      endprotoent_r_proto=0
12341         ;;
12342 esac
12343
12344 : see if endpwent exists
12345 set endpwent d_endpwent
12346 eval $inlibc
12347
12348 : see if this is a pwd.h system
12349 set pwd.h i_pwd
12350 eval $inhdr
12351
12352 case "$i_pwd" in
12353 $define)
12354         xxx=`./findhdr pwd.h`
12355         $cppstdin $cppflags $cppminus < $xxx >$$.h
12356
12357         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12358                 val="$define"
12359         else
12360                 val="$undef"
12361         fi
12362         set d_pwquota
12363         eval $setvar
12364
12365         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12366                 val="$define"
12367         else
12368                 val="$undef"
12369         fi
12370         set d_pwage
12371         eval $setvar
12372
12373         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12374                 val="$define"
12375         else
12376                 val="$undef"
12377         fi
12378         set d_pwchange
12379         eval $setvar
12380
12381         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12382                 val="$define"
12383         else
12384                 val="$undef"
12385         fi
12386         set d_pwclass
12387         eval $setvar
12388
12389         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12390                 val="$define"
12391         else
12392                 val="$undef"
12393         fi
12394         set d_pwexpire
12395         eval $setvar
12396
12397         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12398                 val="$define"
12399         else
12400                 val="$undef"
12401         fi
12402         set d_pwcomment
12403         eval $setvar
12404
12405         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12406                 val="$define"
12407         else
12408                 val="$undef"
12409         fi
12410         set d_pwgecos
12411         eval $setvar
12412
12413         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12414                 val="$define"
12415         else
12416                 val="$undef"
12417         fi
12418         set d_pwpasswd
12419         eval $setvar
12420
12421         $rm -f $$.h
12422         ;;
12423 *)
12424         val="$undef";
12425         set d_pwquota; eval $setvar
12426         set d_pwage; eval $setvar
12427         set d_pwchange; eval $setvar
12428         set d_pwclass; eval $setvar
12429         set d_pwexpire; eval $setvar
12430         set d_pwcomment; eval $setvar
12431         set d_pwgecos; eval $setvar
12432         set d_pwpasswd; eval $setvar
12433         ;;
12434 esac
12435
12436 : see if endpwent_r exists
12437 set endpwent_r d_endpwent_r
12438 eval $inlibc
12439 case "$d_endpwent_r" in
12440 "$define")
12441         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12442         case "$d_endpwent_r_proto:$usethreads" in
12443         ":define")      d_endpwent_r_proto=define
12444                 set d_endpwent_r_proto endpwent_r $hdrs
12445                 eval $hasproto ;;
12446         *)      ;;
12447         esac
12448         case "$d_endpwent_r_proto" in
12449         define)
12450         case "$endpwent_r_proto" in
12451         ''|0) try='int endpwent_r(FILE**);'
12452         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12453         esac
12454         case "$endpwent_r_proto" in
12455         ''|0) try='void endpwent_r(FILE**);'
12456         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12457         esac
12458         case "$endpwent_r_proto" in
12459         ''|0)   d_endpwent_r=undef
12460                 endpwent_r_proto=0
12461                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12462         * )     case "$endpwent_r_proto" in
12463                 REENTRANT_PROTO*) ;;
12464                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12465                 esac
12466                 echo "Prototype: $try" ;;
12467         esac
12468         ;;
12469         *)      case "$usethreads" in
12470                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12471                 esac
12472                 d_endpwent_r=undef
12473                 endpwent_r_proto=0
12474                 ;;
12475         esac
12476         ;;
12477 *)      endpwent_r_proto=0
12478         ;;
12479 esac
12480
12481 : see if endservent exists
12482 set endservent d_endsent
12483 eval $inlibc
12484
12485 : see if endservent_r exists
12486 set endservent_r d_endservent_r
12487 eval $inlibc
12488 case "$d_endservent_r" in
12489 "$define")
12490         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12491         case "$d_endservent_r_proto:$usethreads" in
12492         ":define")      d_endservent_r_proto=define
12493                 set d_endservent_r_proto endservent_r $hdrs
12494                 eval $hasproto ;;
12495         *)      ;;
12496         esac
12497         case "$d_endservent_r_proto" in
12498         define)
12499         case "$endservent_r_proto" in
12500         ''|0) try='int endservent_r(struct servent_data*);'
12501         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12502         esac
12503         case "$endservent_r_proto" in
12504         ''|0) try='void endservent_r(struct servent_data*);'
12505         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12506         esac
12507         case "$endservent_r_proto" in
12508         ''|0)   d_endservent_r=undef
12509                 endservent_r_proto=0
12510                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12511         * )     case "$endservent_r_proto" in
12512                 REENTRANT_PROTO*) ;;
12513                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12514                 esac
12515                 echo "Prototype: $try" ;;
12516         esac
12517         ;;
12518         *)      case "$usethreads" in
12519                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12520                 esac
12521                 d_endservent_r=undef
12522                 endservent_r_proto=0
12523                 ;;
12524         esac
12525         ;;
12526 *)      endservent_r_proto=0
12527         ;;
12528 esac
12529
12530 : Locate the flags for 'open()'
12531 echo " "
12532 $cat >try.c <<EOCP
12533 #include <sys/types.h>
12534 #ifdef I_FCNTL
12535 #include <fcntl.h>
12536 #endif
12537 #ifdef I_SYS_FILE
12538 #include <sys/file.h>
12539 #endif
12540 #$i_stdlib I_STDLIB
12541 #ifdef I_STDLIB
12542 #include <stdlib.h>
12543 #endif
12544 int main() {
12545         if(O_RDONLY);
12546 #ifdef O_TRUNC
12547         exit(0);
12548 #else
12549         exit(1);
12550 #endif
12551 }
12552 EOCP
12553 : check sys/file.h first to get FREAD on Sun
12554 if $test `./findhdr sys/file.h` && \
12555                 set try -DI_SYS_FILE && eval $compile; then
12556         h_sysfile=true;
12557         echo "<sys/file.h> defines the O_* constants..." >&4
12558         if $run ./try; then
12559                 echo "and you have the 3 argument form of open()." >&4
12560                 val="$define"
12561         else
12562                 echo "but not the 3 argument form of open().  Oh, well." >&4
12563                 val="$undef"
12564         fi
12565 elif $test `./findhdr fcntl.h` && \
12566                 set try -DI_FCNTL && eval $compile; then
12567         h_fcntl=true;
12568         echo "<fcntl.h> defines the O_* constants..." >&4
12569         if $run ./try; then
12570                 echo "and you have the 3 argument form of open()." >&4
12571                 val="$define"
12572         else
12573                 echo "but not the 3 argument form of open().  Oh, well." >&4
12574                 val="$undef"
12575         fi
12576 else
12577         val="$undef"
12578         echo "I can't find the O_* constant definitions!  You got problems." >&4
12579 fi
12580 set d_open3
12581 eval $setvar
12582 $rm_try
12583
12584 : see if this is a sys/file.h system
12585 val=''
12586 set sys/file.h val
12587 eval $inhdr
12588
12589 : do we need to include sys/file.h ?
12590 case "$val" in
12591 "$define")
12592         echo " "
12593         if $h_sysfile; then
12594                 val="$define"
12595                 echo "We'll be including <sys/file.h>." >&4
12596         else
12597                 val="$undef"
12598                 echo "We won't be including <sys/file.h>." >&4
12599         fi
12600         ;;
12601 *)
12602         h_sysfile=false
12603         ;;
12604 esac
12605 set i_sysfile
12606 eval $setvar
12607
12608 : see if fcntl.h is there
12609 val=''
12610 set fcntl.h val
12611 eval $inhdr
12612
12613 : see if we can include fcntl.h
12614 case "$val" in
12615 "$define")
12616         echo " "
12617         if $h_fcntl; then
12618                 val="$define"
12619                 echo "We'll be including <fcntl.h>." >&4
12620         else
12621                 val="$undef"
12622                 if $h_sysfile; then
12623         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12624                 else
12625                         echo "We won't be including <fcntl.h>." >&4
12626                 fi
12627         fi
12628         ;;
12629 *)
12630         h_fcntl=false
12631         val="$undef"
12632         ;;
12633 esac
12634 set i_fcntl
12635 eval $setvar
12636
12637 : see if fork exists
12638 set fork d_fork
12639 eval $inlibc
12640
12641 : see if pipe exists
12642 set pipe d_pipe
12643 eval $inlibc
12644
12645 : check for non-blocking I/O stuff
12646 case "$h_sysfile" in
12647 true) echo "#include <sys/file.h>" > head.c;;
12648 *)
12649        case "$h_fcntl" in
12650        true) echo "#include <fcntl.h>" > head.c;;
12651        *) echo "#include <sys/fcntl.h>" > head.c;;
12652        esac
12653        ;;
12654 esac
12655 echo " "
12656 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12657 case "$o_nonblock" in
12658 '')
12659         $cat head.c > try.c
12660         $cat >>try.c <<EOCP
12661 #include <stdio.h>
12662 #$i_stdlib I_STDLIB
12663 #ifdef I_STDLIB
12664 #include <stdlib.h>
12665 #endif
12666 #$i_fcntl I_FCNTL
12667 #ifdef I_FCNTL
12668 #include <fcntl.h>
12669 #endif
12670 int main() {
12671 #ifdef O_NONBLOCK
12672         printf("O_NONBLOCK\n");
12673         exit(0);
12674 #endif
12675 #ifdef O_NDELAY
12676         printf("O_NDELAY\n");
12677         exit(0);
12678 #endif
12679 #ifdef FNDELAY
12680         printf("FNDELAY\n");
12681         exit(0);
12682 #endif
12683         exit(0);
12684 }
12685 EOCP
12686         set try
12687         if eval $compile_ok; then
12688                 o_nonblock=`$run ./try`
12689                 case "$o_nonblock" in
12690                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12691                 *) echo "Seems like we can use $o_nonblock.";;
12692                 esac
12693         else
12694                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12695         fi
12696         ;;
12697 *) echo "Using $hint value $o_nonblock.";;
12698 esac
12699 $rm_try
12700
12701 echo " "
12702 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12703 case "$eagain" in
12704 '')
12705         case "$d_fork:$d_pipe" in
12706         define:define)
12707         $cat head.c > try.c
12708         $cat >>try.c <<EOCP
12709 #include <errno.h>
12710 #include <sys/types.h>
12711 #include <signal.h>
12712 #include <stdio.h>
12713 #$i_stdlib I_STDLIB
12714 #ifdef I_STDLIB
12715 #include <stdlib.h>
12716 #endif
12717 #$i_fcntl I_FCNTL
12718 #ifdef I_FCNTL
12719 #include <fcntl.h>
12720 #endif
12721 #define MY_O_NONBLOCK $o_nonblock
12722 #ifndef errno  /* XXX need better Configure test */
12723 extern int errno;
12724 #endif
12725 #$i_unistd I_UNISTD
12726 #ifdef I_UNISTD
12727 #include <unistd.h>
12728 #endif
12729 #$i_string I_STRING
12730 #ifdef I_STRING
12731 #include <string.h>
12732 #else
12733 #include <strings.h>
12734 #endif
12735 $signal_t blech(int x) { exit(3); }
12736 EOCP
12737         $cat >> try.c <<'EOCP'
12738 int main()
12739 {
12740         int pd[2];
12741         int pu[2];
12742         char buf[1];
12743         char string[100];
12744
12745         pipe(pd);       /* Down: child -> parent */
12746         pipe(pu);       /* Up: parent -> child */
12747         if (0 != fork()) {
12748                 int ret;
12749                 close(pd[1]);   /* Parent reads from pd[0] */
12750                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12751 #ifdef F_SETFL
12752                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12753                         exit(1);
12754 #else
12755                 exit(4);
12756 #endif
12757                 signal(SIGALRM, blech);
12758                 alarm(5);
12759                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12760                         exit(2);
12761                 sprintf(string, "%d\n", ret);
12762                 write(2, string, strlen(string));
12763                 alarm(0);
12764 #ifdef EAGAIN
12765                 if (errno == EAGAIN) {
12766                         printf("EAGAIN\n");
12767                         goto ok;
12768                 }
12769 #endif
12770 #ifdef EWOULDBLOCK
12771                 if (errno == EWOULDBLOCK)
12772                         printf("EWOULDBLOCK\n");
12773 #endif
12774         ok:
12775                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12776                 sleep(2);                               /* Give it time to close our pipe */
12777                 alarm(5);
12778                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12779                 alarm(0);
12780                 sprintf(string, "%d\n", ret);
12781                 write(4, string, strlen(string));
12782                 exit(0);
12783         }
12784
12785         close(pd[0]);                   /* We write to pd[1] */
12786         close(pu[1]);                   /* We read from pu[0] */
12787         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12788         close(pd[1]);                   /* Pipe pd is now fully closed! */
12789         exit(0);                                /* Bye bye, thank you for playing! */
12790 }
12791 EOCP
12792         set try
12793         if eval $compile_ok; then
12794                 echo "$startsh" >mtry
12795                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12796                 chmod +x mtry
12797                 ./mtry >/dev/null 2>&1
12798                 case $? in
12799                 0) eagain=`$cat try.out`;;
12800                 1) echo "Could not perform non-blocking setting!";;
12801                 2) echo "I did a successful read() for something that was not there!";;
12802                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12803                 4) echo "Could not find F_SETFL!";;
12804                 *) echo "Something terribly wrong happened during testing.";;
12805                 esac
12806                 rd_nodata=`$cat try.ret`
12807                 echo "A read() system call with no data present returns $rd_nodata."
12808                 case "$rd_nodata" in
12809                 0|-1) ;;
12810                 *)
12811                         echo "(That's peculiar, fixing that to be -1.)"
12812                         rd_nodata=-1
12813                         ;;
12814                 esac
12815                 case "$eagain" in
12816                 '')
12817                         echo "Forcing errno EAGAIN on read() with no data available."
12818                         eagain=EAGAIN
12819                         ;;
12820                 *)
12821                         echo "Your read() sets errno to $eagain when no data is available."
12822                         ;;
12823                 esac
12824                 status=`$cat try.err`
12825                 case "$status" in
12826                 0) echo "And it correctly returns 0 to signal EOF.";;
12827                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12828                 *) echo "However, your read() returns '$status' on EOF??";;
12829                 esac
12830                 val="$define"
12831                 if test "$status" = "$rd_nodata"; then
12832                         echo "WARNING: you can't distinguish between EOF and no data!"
12833                         val="$undef"
12834                 fi
12835         else
12836                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12837                 eagain=EAGAIN
12838         fi
12839         ;;
12840         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12841                 eagain=EAGAIN
12842                 val="$define"
12843                 ;;
12844         esac
12845         set d_eofnblk
12846         eval $setvar
12847         ;;
12848 *)
12849         echo "Using $hint value $eagain."
12850         echo "Your read() returns $rd_nodata when no data is present."
12851         case "$d_eofnblk" in
12852         "$define") echo "And you can see EOF because read() returns 0.";;
12853         "$undef") echo "But you can't see EOF status from read() returned value.";;
12854         *)
12855                 echo "(Assuming you can't see EOF status from read anyway.)"
12856                 d_eofnblk=$undef
12857                 ;;
12858         esac
12859         ;;
12860 esac
12861 $rm_try head.c mtry
12862
12863 : see if _ptr and _cnt from stdio act std
12864 echo " "
12865
12866 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12867         echo "(Looks like you have stdio.h from BSD.)"
12868         case "$stdio_ptr" in
12869         '') stdio_ptr='((fp)->_p)'
12870                 ptr_lval=$define
12871                 ;;
12872         *)      ptr_lval=$d_stdio_ptr_lval;;
12873         esac
12874         case "$stdio_cnt" in
12875         '') stdio_cnt='((fp)->_r)'
12876                 cnt_lval=$define
12877                 ;;
12878         *)      cnt_lval=$d_stdio_cnt_lval;;
12879         esac
12880         case "$stdio_base" in
12881         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12882         esac
12883         case "$stdio_bufsiz" in
12884         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12885         esac
12886 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12887         echo "(Looks like you have stdio.h from Linux.)"
12888         case "$stdio_ptr" in
12889         '') stdio_ptr='((fp)->_IO_read_ptr)'
12890                 ptr_lval=$define
12891                 ;;
12892         *)      ptr_lval=$d_stdio_ptr_lval;;
12893         esac
12894         case "$stdio_cnt" in
12895         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12896                 cnt_lval=$undef
12897                 ;;
12898         *)      cnt_lval=$d_stdio_cnt_lval;;
12899         esac
12900         case "$stdio_base" in
12901         '') stdio_base='((fp)->_IO_read_base)';;
12902         esac
12903         case "$stdio_bufsiz" in
12904         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12905         esac
12906 else
12907         case "$stdio_ptr" in
12908         '') stdio_ptr='((fp)->_ptr)'
12909                 ptr_lval=$define
12910                 ;;
12911         *)      ptr_lval=$d_stdio_ptr_lval;;
12912         esac
12913         case "$stdio_cnt" in
12914         '') stdio_cnt='((fp)->_cnt)'
12915                 cnt_lval=$define
12916                 ;;
12917         *)      cnt_lval=$d_stdio_cnt_lval;;
12918         esac
12919         case "$stdio_base" in
12920         '') stdio_base='((fp)->_base)';;
12921         esac
12922         case "$stdio_bufsiz" in
12923         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12924         esac
12925 fi
12926
12927 : test whether _ptr and _cnt really work
12928 echo "Checking how std your stdio is..." >&4
12929 $cat >try.c <<EOP
12930 #include <stdio.h>
12931 #$i_stdlib I_STDLIB
12932 #ifdef I_STDLIB
12933 #include <stdlib.h>
12934 #endif
12935 #define FILE_ptr(fp)    $stdio_ptr
12936 #define FILE_cnt(fp)    $stdio_cnt
12937 int main() {
12938         FILE *fp = fopen("try.c", "r");
12939         char c = getc(fp);
12940         if (
12941                 18 <= FILE_cnt(fp) &&
12942                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12943         )
12944                 exit(0);
12945         exit(1);
12946 }
12947 EOP
12948 val="$undef"
12949 set try
12950 if eval $compile && $to try.c; then
12951         if $run ./try; then
12952                 echo "Your stdio acts pretty std."
12953                 val="$define"
12954         else
12955                 echo "Your stdio isn't very std."
12956         fi
12957 else
12958         echo "Your stdio doesn't appear very std."
12959 fi
12960 $rm_try
12961
12962 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12963 # direct buffer manipulation no longer works.  The Configure tests
12964 # should be changed to correctly detect this, but until then,
12965 # the following check should at least let perl compile and run.
12966 # (This quick fix should be updated before 5.8.1.)
12967 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12968 # A. Dougherty, June 3, 2002.
12969 case "$d_gnulibc" in
12970 $define)
12971         case "$gnulibc_version" in
12972         2.[01]*)  ;;
12973         2.2) ;;
12974         2.2.[0-9]) ;;
12975         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12976                 val="$undef"
12977                 ;;
12978         esac
12979         ;;
12980 esac
12981 set d_stdstdio
12982 eval $setvar
12983
12984 : Can _ptr be used as an lvalue?
12985 case "$d_stdstdio$ptr_lval" in
12986 $define$define) val=$define ;;
12987 *) val=$undef ;;
12988 esac
12989 set d_stdio_ptr_lval
12990 eval $setvar
12991
12992 : Can _cnt be used as an lvalue?
12993 case "$d_stdstdio$cnt_lval" in
12994 $define$define) val=$define ;;
12995 *) val=$undef ;;
12996 esac
12997 set d_stdio_cnt_lval
12998 eval $setvar
12999
13000
13001 : test whether setting _ptr sets _cnt as a side effect
13002 d_stdio_ptr_lval_sets_cnt="$undef"
13003 d_stdio_ptr_lval_nochange_cnt="$undef"
13004 case "$d_stdio_ptr_lval$d_stdstdio" in
13005 $define$define)
13006         echo "Checking to see what happens if we set the stdio ptr..." >&4
13007 $cat >try.c <<EOP
13008 #include <stdio.h>
13009 /* Can we scream? */
13010 /* Eat dust sed :-) */
13011 /* In the buffer space, no one can hear you scream. */
13012 #$i_stdlib I_STDLIB
13013 #ifdef I_STDLIB
13014 #include <stdlib.h>
13015 #endif
13016 #define FILE_ptr(fp)    $stdio_ptr
13017 #define FILE_cnt(fp)    $stdio_cnt
13018 #include <sys/types.h>
13019 int main() {
13020         FILE *fp = fopen("try.c", "r");
13021         int c;
13022         char *ptr;
13023         size_t cnt;
13024         if (!fp) {
13025             puts("Fail even to read");
13026             exit(1);
13027         }
13028         c = getc(fp); /* Read away the first # */
13029         if (c == EOF) {
13030             puts("Fail even to read");
13031             exit(1);
13032         }
13033         if (!(
13034                 18 <= FILE_cnt(fp) &&
13035                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
13036         )) {
13037                 puts("Fail even to read");
13038                 exit (1);
13039         }
13040         ptr = (char*) FILE_ptr(fp);
13041         cnt = (size_t)FILE_cnt(fp);
13042
13043         FILE_ptr(fp) += 42;
13044
13045         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
13046                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
13047                 exit (1);
13048         }
13049         if (FILE_cnt(fp) <= 20) {
13050                 printf ("Fail (<20 chars to test)");
13051                 exit (1);
13052         }
13053         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
13054                 puts("Fail compare");
13055                 exit (1);
13056         }
13057         if (cnt == FILE_cnt(fp)) {
13058                 puts("Pass_unchanged");
13059                 exit (0);
13060         }
13061         if (FILE_cnt(fp) == (cnt - 42)) {
13062                 puts("Pass_changed");
13063                 exit (0);
13064         }
13065         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
13066         return 1;
13067
13068 }
13069 EOP
13070         set try
13071         if eval $compile && $to try.c; then
13072                 case `$run ./try` in
13073                 Pass_changed)
13074                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
13075                         d_stdio_ptr_lval_sets_cnt="$define" ;;
13076                 Pass_unchanged)
13077                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
13078                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
13079                 Fail*)
13080                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
13081                 *)
13082                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
13083         esac
13084         else
13085                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13086         fi
13087         $rm_try
13088         ;;
13089 esac
13090
13091 : see if _base is also standard
13092 val="$undef"
13093 case "$d_stdstdio" in
13094 $define)
13095         $cat >try.c <<EOP
13096 #include <stdio.h>
13097 #$i_stdlib I_STDLIB
13098 #ifdef I_STDLIB
13099 #include <stdlib.h>
13100 #endif
13101 #define FILE_base(fp)   $stdio_base
13102 #define FILE_bufsiz(fp) $stdio_bufsiz
13103 int main() {
13104         FILE *fp = fopen("try.c", "r");
13105         char c = getc(fp);
13106         if (
13107                 19 <= FILE_bufsiz(fp) &&
13108                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13109         )
13110                 exit(0);
13111         exit(1);
13112 }
13113 EOP
13114         set try
13115         if eval $compile && $to try.c; then
13116                 if $run ./try; then
13117                         echo "And its _base field acts std."
13118                         val="$define"
13119                 else
13120                         echo "But its _base field isn't std."
13121                 fi
13122         else
13123                 echo "However, it seems to be lacking the _base field."
13124         fi
13125         $rm_try
13126         ;;
13127 esac
13128 set d_stdiobase
13129 eval $setvar
13130
13131 : see if fast_stdio exists
13132 val="$undef"
13133 case "$d_stdstdio:$d_stdio_ptr_lval" in
13134 "$define:$define")
13135         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13136         *$define*)
13137                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13138                 val="$define"
13139                 ;;
13140         esac
13141         ;;
13142 esac
13143 set d_faststdio
13144 eval $setvar
13145
13146
13147
13148 : see if fchdir exists
13149 set fchdir d_fchdir
13150 eval $inlibc
13151
13152 : see if fchmod exists
13153 set fchmod d_fchmod
13154 eval $inlibc
13155
13156 : see if fchown exists
13157 set fchown d_fchown
13158 eval $inlibc
13159
13160 : see if this is an fcntl system
13161 set fcntl d_fcntl
13162 eval $inlibc
13163
13164 : See if fcntl-based locking works.
13165 echo " "
13166 $cat >try.c <<EOCP
13167 #$i_stdlib I_STDLIB
13168 #ifdef I_STDLIB
13169 #include <stdlib.h>
13170 #endif
13171 #include <unistd.h>
13172 #include <fcntl.h>
13173 #include <signal.h>
13174 $signal_t blech(int x) { exit(3); }
13175 int main() {
13176 #if defined(F_SETLK) && defined(F_SETLKW)
13177      struct flock flock;
13178      int retval, fd;
13179      fd = open("try.c", O_RDONLY);
13180      flock.l_type = F_RDLCK;
13181      flock.l_whence = SEEK_SET;
13182      flock.l_start = flock.l_len = 0;
13183      signal(SIGALRM, blech);
13184      alarm(10);
13185      retval = fcntl(fd, F_SETLK, &flock);
13186      close(fd);
13187      (retval < 0 ? exit(2) : exit(0));
13188 #else
13189      exit(2);
13190 #endif
13191 }
13192 EOCP
13193 echo "Checking if fcntl-based file locking works... "
13194 case "$d_fcntl" in
13195 "$define")
13196         set try
13197         if eval $compile_ok; then
13198                 if $run ./try; then
13199                         echo "Yes, it seems to work."
13200                         val="$define"
13201                 else
13202                         echo "Nope, it didn't work."
13203                         val="$undef"
13204                         case "$?" in
13205                         3) $cat >&4 <<EOM
13206 ***
13207 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13208 *** This is (almost) impossible.
13209 *** If your NFS lock daemons are not feeling well, something like
13210 *** this may happen, please investigate.  Cannot continue, aborting.
13211 ***
13212 EOM
13213                                 exit 1
13214                                 ;;
13215                         esac
13216                 fi
13217         else
13218                 echo "I'm unable to compile the test program, so I'll assume not."
13219                 val="$undef"
13220         fi
13221         ;;
13222 *) val="$undef";
13223         echo "Nope, since you don't even have fcntl()."
13224         ;;
13225 esac
13226 set d_fcntl_can_lock
13227 eval $setvar
13228 $rm_try
13229
13230 : check for fd_set items
13231 $cat <<EOM
13232
13233 Checking to see how well your C compiler handles fd_set and friends ...
13234 EOM
13235 $cat >try.c <<EOCP
13236 #$i_stdlib I_STDLIB
13237 #ifdef I_STDLIB
13238 #include <stdlib.h>
13239 #endif
13240 #$i_systime I_SYS_TIME
13241 #$i_sysselct I_SYS_SELECT
13242 #$d_socket HAS_SOCKET
13243 #include <sys/types.h>
13244 #ifdef HAS_SOCKET
13245 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13246 #endif
13247 #ifdef I_SYS_TIME
13248 #include <sys/time.h>
13249 #endif
13250 #ifdef I_SYS_SELECT
13251 #include <sys/select.h>
13252 #endif
13253 int main() {
13254         fd_set fds;
13255
13256 #ifdef TRYBITS
13257         if(fds.fds_bits);
13258 #endif
13259
13260 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13261         exit(0);
13262 #else
13263         exit(1);
13264 #endif
13265 }
13266 EOCP
13267 set try -DTRYBITS
13268 if eval $compile; then
13269         d_fds_bits="$define"
13270         d_fd_set="$define"
13271         echo "Well, your system knows about the normal fd_set typedef..." >&4
13272         if $run ./try; then
13273                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13274                 d_fd_macros="$define"
13275         else
13276                 $cat >&4 <<'EOM'
13277 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13278 EOM
13279                 d_fd_macros="$undef"
13280         fi
13281 else
13282         $cat <<'EOM'
13283 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13284 EOM
13285         set try
13286         if eval $compile; then
13287                 d_fds_bits="$undef"
13288                 d_fd_set="$define"
13289                 echo "Well, your system has some sort of fd_set available..." >&4
13290                 if $run ./try; then
13291                         echo "and you have the normal fd_set macros." >&4
13292                         d_fd_macros="$define"
13293                 else
13294                         $cat <<'EOM'
13295 but not the normal fd_set macros!  Gross!  More work for me...
13296 EOM
13297                         d_fd_macros="$undef"
13298                 fi
13299         else
13300         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13301                 d_fd_set="$undef"
13302                 d_fds_bits="$undef"
13303                 d_fd_macros="$undef"
13304         fi
13305 fi
13306 $rm_try
13307
13308 : see if fgetpos exists
13309 set fgetpos d_fgetpos
13310 eval $inlibc
13311
13312 : see if finite exists
13313 set finite d_finite
13314 eval $inlibc
13315
13316 : see if finitel exists
13317 set finitel d_finitel
13318 eval $inlibc
13319
13320 : see if flock exists
13321 set flock d_flock
13322 eval $inlibc
13323
13324 : see if prototype for flock is available
13325 echo " "
13326 set d_flockproto flock $i_sysfile sys/file.h
13327 eval $hasproto
13328
13329 : see if fp_class exists
13330 set fp_class d_fp_class
13331 eval $inlibc
13332
13333 : see if pathconf exists
13334 set pathconf d_pathconf
13335 eval $inlibc
13336
13337 : see if fpathconf exists
13338 set fpathconf d_fpathconf
13339 eval $inlibc
13340
13341 : see if fpclass exists
13342 set fpclass d_fpclass
13343 eval $inlibc
13344
13345 : see if fpclassify exists
13346 set fpclassify d_fpclassify
13347 eval $inlibc
13348
13349 : see if fpclassl exists
13350 set fpclassl d_fpclassl
13351 eval $inlibc
13352
13353 : check for fpos64_t
13354 echo " "
13355 echo "Checking to see if you have fpos64_t..." >&4
13356 $cat >try.c <<EOCP
13357 #include <stdio.h>
13358 int main() { fpos64_t x = 7; }
13359 EOCP
13360 set try
13361 if eval $compile; then
13362         val="$define"
13363         echo "You have fpos64_t."
13364 else
13365         val="$undef"
13366         echo "You do not have fpos64_t."
13367         case "$fpossize" in
13368         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13369         esac
13370 fi
13371 $rm_try
13372 set d_fpos64_t
13373 eval $setvar
13374
13375 : see if frexpl exists
13376 set frexpl d_frexpl
13377 eval $inlibc
13378
13379 : see if this is a sys/param system
13380 set sys/param.h i_sysparam
13381 eval $inhdr
13382
13383 : see if this is a sys/mount.h system
13384 set sys/mount.h i_sysmount
13385 eval $inhdr
13386
13387 : Check for fs_data_s
13388 echo " "
13389 echo "Checking to see if your system supports struct fs_data..." >&4
13390 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13391 eval $hasstruct
13392 case "$d_fs_data_s" in
13393 "$define")      echo "Yes, it does."   ;;
13394 *)              echo "No, it doesn't." ;;
13395 esac
13396
13397 : see if fseeko exists
13398 set fseeko d_fseeko
13399 eval $inlibc
13400 case "$longsize" in
13401 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13402 esac
13403
13404 : see if fsetpos exists
13405 set fsetpos d_fsetpos
13406 eval $inlibc
13407
13408 : see if fstatfs exists
13409 set fstatfs d_fstatfs
13410 eval $inlibc
13411
13412 : see if statvfs exists
13413 set statvfs d_statvfs
13414 eval $inlibc
13415
13416 : see if fstatvfs exists
13417 set fstatvfs d_fstatvfs
13418 eval $inlibc
13419
13420
13421 : see if fsync exists
13422 set fsync d_fsync
13423 eval $inlibc
13424
13425 : see if ftello exists
13426 set ftello d_ftello
13427 eval $inlibc
13428 case "$longsize" in
13429 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13430 esac
13431
13432 : check for a working futimes
13433 d_futimes="$undef"
13434 echo " "
13435 echo "Checking if you have a working futimes()" >&4
13436 $cat >try.c <<EOCP
13437 #include <stdio.h>
13438 #include <sys/time.h>
13439 #include <errno.h>
13440 #include <fcntl.h>
13441
13442 int main ()
13443 {
13444     int fd, rv;
13445     fd = open ("try.c", O_RDWR);
13446     if (-1 == fd) exit (1);
13447     rv = futimes (fd, NULL);
13448     exit (rv == -1 ? errno : 0);
13449 }
13450 EOCP
13451 set try
13452 if eval $compile; then
13453     `$run ./try`
13454     rc=$?
13455     case "$rc" in
13456         0)  echo "Yes, you have" >&4
13457             d_futimes="$define"
13458             ;;
13459         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13460             ;;
13461     esac
13462 else
13463     echo "No, it does not (probably harmless)" >&4
13464 fi
13465 $rm_try
13466
13467 : see if ndbm.h is available
13468 set ndbm.h i_ndbm
13469 eval $inhdr
13470 : Compatibility location for RedHat 7.1
13471 set gdbm/ndbm.h i_gdbmndbm
13472 eval $inhdr
13473 : Compatibility location for Debian 4.0
13474 set gdbm-ndbm.h i_gdbm_ndbm
13475 eval $inhdr
13476
13477 val="$undef"
13478 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13479         : see if dbm_open exists
13480         set dbm_open d_dbm_open
13481         eval $inlibc
13482         case "$d_dbm_open" in
13483         $undef)
13484                 i_ndbm="$undef"
13485                 i_gdbmndbm="$undef"
13486                 i_gdbm_ndbm="$undef"
13487                 echo "We won't be including <ndbm.h>"
13488                 val="$undef"
13489                 ;;
13490         *) val="$define"
13491            ;;
13492         esac
13493 fi
13494 set d_ndbm
13495 eval $setvar
13496
13497 ndbm_hdr_protochk='name=$1; hdr=$2;
13498 eval "ihdr=\$""i_$name";
13499 val="$undef";
13500 if $test "$ihdr" = "$define"; then
13501         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13502         case "$d_cplusplus" in
13503         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13504         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13505         esac;
13506         case "$val" in
13507         $define) $echo "Your <$hdr> seems to have prototypes";;
13508         *) $echo "Your <$hdr> does not seem to have prototypes";;
13509         esac;
13510 fi;
13511 set "d_${name}_h_uses_prototypes";
13512 eval $setvar'
13513
13514 set ndbm ndbm.h
13515 eval $ndbm_hdr_protochk
13516 set gdbmndbm gdbm/ndbm.h
13517 eval $ndbm_hdr_protochk
13518 set gdbm_ndbm gdbm-ndbm.h
13519 eval $ndbm_hdr_protochk
13520
13521 : see if getaddrinfo exists
13522 set getaddrinfo d_getaddrinfo
13523 eval $inlibc
13524
13525 : see if getcwd exists
13526 set getcwd d_getcwd
13527 eval $inlibc
13528
13529 : see if getespwnam exists
13530 set getespwnam d_getespwnam
13531 eval $inlibc
13532
13533 : see if getfsstat exists
13534 set getfsstat d_getfsstat
13535 eval $inlibc
13536
13537 : see if getgrent exists
13538 set getgrent d_getgrent
13539 eval $inlibc
13540
13541 : see if getgrent_r exists
13542 set getgrent_r d_getgrent_r
13543 eval $inlibc
13544 case "$d_getgrent_r" in
13545 "$define")
13546         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13547         case "$d_getgrent_r_proto:$usethreads" in
13548         ":define")      d_getgrent_r_proto=define
13549                 set d_getgrent_r_proto getgrent_r $hdrs
13550                 eval $hasproto ;;
13551         *)      ;;
13552         esac
13553         case "$d_getgrent_r_proto" in
13554         define)
13555         case "$getgrent_r_proto" in
13556         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13557         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13558         esac
13559         case "$getgrent_r_proto" in
13560         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13561         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13562         esac
13563         case "$getgrent_r_proto" in
13564         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13565         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13566         esac
13567         case "$getgrent_r_proto" in
13568         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13569         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13570         esac
13571         case "$getgrent_r_proto" in
13572         ''|0) try='int getgrent_r(struct group*, char*, int);'
13573         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13574         esac
13575         case "$getgrent_r_proto" in
13576         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13577         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13578         esac
13579         case "$getgrent_r_proto" in
13580         ''|0)   d_getgrent_r=undef
13581                 getgrent_r_proto=0
13582                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13583         * )     case "$getgrent_r_proto" in
13584                 REENTRANT_PROTO*) ;;
13585                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13586                 esac
13587                 echo "Prototype: $try" ;;
13588         esac
13589         ;;
13590         *)      case "$usethreads" in
13591                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13592                 esac
13593                 d_getgrent_r=undef
13594                 getgrent_r_proto=0
13595                 ;;
13596         esac
13597         ;;
13598 *)      getgrent_r_proto=0
13599         ;;
13600 esac
13601
13602 : see if getgrgid_r exists
13603 set getgrgid_r d_getgrgid_r
13604 eval $inlibc
13605 case "$d_getgrgid_r" in
13606 "$define")
13607         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13608         case "$d_getgrgid_r_proto:$usethreads" in
13609         ":define")      d_getgrgid_r_proto=define
13610                 set d_getgrgid_r_proto getgrgid_r $hdrs
13611                 eval $hasproto ;;
13612         *)      ;;
13613         esac
13614         case "$d_getgrgid_r_proto" in
13615         define)
13616         case "$getgrgid_r_proto" in
13617         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13618         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13619         esac
13620         case "$getgrgid_r_proto" in
13621         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13622         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13623         esac
13624         case "$getgrgid_r_proto" in
13625         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13626         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13627         esac
13628         case "$getgrgid_r_proto" in
13629         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13630         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13631         esac
13632         case "$getgrgid_r_proto" in
13633         ''|0)   d_getgrgid_r=undef
13634                 getgrgid_r_proto=0
13635                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13636         * )     case "$getgrgid_r_proto" in
13637                 REENTRANT_PROTO*) ;;
13638                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13639                 esac
13640                 echo "Prototype: $try" ;;
13641         esac
13642         ;;
13643         *)      case "$usethreads" in
13644                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13645                 esac
13646                 d_getgrgid_r=undef
13647                 getgrgid_r_proto=0
13648                 ;;
13649         esac
13650         ;;
13651 *)      getgrgid_r_proto=0
13652         ;;
13653 esac
13654
13655 : see if getgrnam_r exists
13656 set getgrnam_r d_getgrnam_r
13657 eval $inlibc
13658 case "$d_getgrnam_r" in
13659 "$define")
13660         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13661         case "$d_getgrnam_r_proto:$usethreads" in
13662         ":define")      d_getgrnam_r_proto=define
13663                 set d_getgrnam_r_proto getgrnam_r $hdrs
13664                 eval $hasproto ;;
13665         *)      ;;
13666         esac
13667         case "$d_getgrnam_r_proto" in
13668         define)
13669         case "$getgrnam_r_proto" in
13670         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13671         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13672         esac
13673         case "$getgrnam_r_proto" in
13674         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13675         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13676         esac
13677         case "$getgrnam_r_proto" in
13678         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13679         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13680         esac
13681         case "$getgrnam_r_proto" in
13682         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13683         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13684         esac
13685         case "$getgrnam_r_proto" in
13686         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13687         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13688         esac
13689         case "$getgrnam_r_proto" in
13690         ''|0)   d_getgrnam_r=undef
13691                 getgrnam_r_proto=0
13692                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13693         * )     case "$getgrnam_r_proto" in
13694                 REENTRANT_PROTO*) ;;
13695                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13696                 esac
13697                 echo "Prototype: $try" ;;
13698         esac
13699         ;;
13700         *)      case "$usethreads" in
13701                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13702                 esac
13703                 d_getgrnam_r=undef
13704                 getgrnam_r_proto=0
13705                 ;;
13706         esac
13707         ;;
13708 *)      getgrnam_r_proto=0
13709         ;;
13710 esac
13711
13712 : see if gethostbyaddr exists
13713 set gethostbyaddr d_gethbyaddr
13714 eval $inlibc
13715
13716 : see if gethostbyname exists
13717 set gethostbyname d_gethbyname
13718 eval $inlibc
13719
13720 : see if gethostent exists
13721 set gethostent d_gethent
13722 eval $inlibc
13723
13724 : see how we will look up host name
13725 echo " "
13726 call=''
13727 if set gethostname val -f d_gethname; eval $csym; $val; then
13728         echo 'gethostname() found.' >&4
13729         d_gethname="$define"
13730         call=gethostname
13731 fi
13732 if set uname val -f d_uname; eval $csym; $val; then
13733         if ./xenix; then
13734                 $cat <<'EOM'
13735 uname() was found, but you're running xenix, and older versions of xenix
13736 have a broken uname(). If you don't really know whether your xenix is old
13737 enough to have a broken system call, use the default answer.
13738
13739 EOM
13740                 dflt=y
13741                 case "$d_uname" in
13742                 "$define") dflt=n;;
13743                 esac
13744                 rp='Is your uname() broken?'
13745                 . ./myread
13746                 case "$ans" in
13747                 n*) d_uname="$define"; call=uname;;
13748                 esac
13749         else
13750                 echo 'uname() found.' >&4
13751                 d_uname="$define"
13752                 case "$call" in
13753                 '') call=uname ;;
13754                 esac
13755         fi
13756 fi
13757 case "$d_gethname" in
13758 '') d_gethname="$undef";;
13759 esac
13760 case "$d_uname" in
13761 '') d_uname="$undef";;
13762 esac
13763 case "$d_uname$d_gethname" in
13764 *define*)
13765         dflt=n
13766         cat <<EOM
13767
13768 Every now and then someone has a $call() that lies about the hostname
13769 but can't be fixed for political or economic reasons.  If you wish, I can
13770 pretend $call() isn't there and maybe compute hostname at run-time
13771 thanks to the '$phostname' command.
13772
13773 EOM
13774         rp="Shall I ignore $call() from now on?"
13775         . ./myread
13776         case "$ans" in
13777         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13778         esac;;
13779 esac
13780 case "$phostname" in
13781 '') aphostname='';;
13782 *) case "$aphostname" in
13783         /*) ;;
13784         *) set X $phostname
13785                 shift
13786                 file=$1
13787                 shift
13788                 file=`./loc $file $file $pth`
13789                 aphostname=`echo $file $*`
13790                 ;;
13791         esac
13792         ;;
13793 esac
13794 case "$d_uname$d_gethname" in
13795 *define*) ;;
13796 *)
13797         case "$phostname" in
13798         '')
13799                 echo "There will be no way for $package to get your hostname." >&4;;
13800         *)
13801         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13802                 ;;
13803         esac;;
13804 esac
13805 case "$d_phostname" in
13806 '') d_phostname="$undef";;
13807 esac
13808
13809 : see if gethostbyaddr_r exists
13810 set gethostbyaddr_r d_gethostbyaddr_r
13811 eval $inlibc
13812 case "$d_gethostbyaddr_r" in
13813 "$define")
13814         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13815         case "$d_gethostbyaddr_r_proto:$usethreads" in
13816         ":define")      d_gethostbyaddr_r_proto=define
13817                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13818                 eval $hasproto ;;
13819         *)      ;;
13820         esac
13821         case "$d_gethostbyaddr_r_proto" in
13822         define)
13823         case "$gethostbyaddr_r_proto" in
13824         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13825         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13826         esac
13827         case "$gethostbyaddr_r_proto" in
13828         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13829         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13830         esac
13831         case "$gethostbyaddr_r_proto" in
13832         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13833         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13834         esac
13835         case "$gethostbyaddr_r_proto" in
13836         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13837         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13838         esac
13839         case "$gethostbyaddr_r_proto" in
13840         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13841         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13842         esac
13843         case "$gethostbyaddr_r_proto" in
13844         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13845         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13846         esac
13847         case "$gethostbyaddr_r_proto" in
13848         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13849         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13850         esac
13851         case "$gethostbyaddr_r_proto" in
13852         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13853         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13854         esac
13855         case "$gethostbyaddr_r_proto" in
13856         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13857         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13858         esac
13859         case "$gethostbyaddr_r_proto" in
13860         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13861         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13862         esac
13863         case "$gethostbyaddr_r_proto" in
13864         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13865         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13866         esac
13867         case "$gethostbyaddr_r_proto" in
13868         ''|0)   d_gethostbyaddr_r=undef
13869                 gethostbyaddr_r_proto=0
13870                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13871         * )     case "$gethostbyaddr_r_proto" in
13872                 REENTRANT_PROTO*) ;;
13873                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13874                 esac
13875                 echo "Prototype: $try" ;;
13876         esac
13877         ;;
13878         *)      case "$usethreads" in
13879                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13880                 esac
13881                 d_gethostbyaddr_r=undef
13882                 gethostbyaddr_r_proto=0
13883                 ;;
13884         esac
13885         ;;
13886 *)      gethostbyaddr_r_proto=0
13887         ;;
13888 esac
13889
13890 : see if gethostbyname_r exists
13891 set gethostbyname_r d_gethostbyname_r
13892 eval $inlibc
13893 case "$d_gethostbyname_r" in
13894 "$define")
13895         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13896         case "$d_gethostbyname_r_proto:$usethreads" in
13897         ":define")      d_gethostbyname_r_proto=define
13898                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13899                 eval $hasproto ;;
13900         *)      ;;
13901         esac
13902         case "$d_gethostbyname_r_proto" in
13903         define)
13904         case "$gethostbyname_r_proto" in
13905         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13906         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13907         esac
13908         case "$gethostbyname_r_proto" in
13909         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13910         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13911         esac
13912         case "$gethostbyname_r_proto" in
13913         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13914         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13915         esac
13916         case "$gethostbyname_r_proto" in
13917         ''|0)   d_gethostbyname_r=undef
13918                 gethostbyname_r_proto=0
13919                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13920         * )     case "$gethostbyname_r_proto" in
13921                 REENTRANT_PROTO*) ;;
13922                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13923                 esac
13924                 echo "Prototype: $try" ;;
13925         esac
13926         ;;
13927         *)      case "$usethreads" in
13928                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13929                 esac
13930                 d_gethostbyname_r=undef
13931                 gethostbyname_r_proto=0
13932                 ;;
13933         esac
13934         ;;
13935 *)      gethostbyname_r_proto=0
13936         ;;
13937 esac
13938
13939 : see if gethostent_r exists
13940 set gethostent_r d_gethostent_r
13941 eval $inlibc
13942 case "$d_gethostent_r" in
13943 "$define")
13944         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13945         case "$d_gethostent_r_proto:$usethreads" in
13946         ":define")      d_gethostent_r_proto=define
13947                 set d_gethostent_r_proto gethostent_r $hdrs
13948                 eval $hasproto ;;
13949         *)      ;;
13950         esac
13951         case "$d_gethostent_r_proto" in
13952         define)
13953         case "$gethostent_r_proto" in
13954         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13955         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13956         esac
13957         case "$gethostent_r_proto" in
13958         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13959         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13960         esac
13961         case "$gethostent_r_proto" in
13962         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13963         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13964         esac
13965         case "$gethostent_r_proto" in
13966         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13967         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13968         esac
13969         case "$gethostent_r_proto" in
13970         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13971         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13972         esac
13973         case "$gethostent_r_proto" in
13974         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13975         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13976         esac
13977         case "$gethostent_r_proto" in
13978         ''|0)   d_gethostent_r=undef
13979                 gethostent_r_proto=0
13980                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13981         * )     case "$gethostent_r_proto" in
13982                 REENTRANT_PROTO*) ;;
13983                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13984                 esac
13985                 echo "Prototype: $try" ;;
13986         esac
13987         ;;
13988         *)      case "$usethreads" in
13989                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13990                 esac
13991                 d_gethostent_r=undef
13992                 gethostent_r_proto=0
13993                 ;;
13994         esac
13995         ;;
13996 *)      gethostent_r_proto=0
13997         ;;
13998 esac
13999
14000 : see if prototypes for various gethostxxx netdb.h functions are available
14001 echo " "
14002 set d_gethostprotos gethostent $i_netdb netdb.h
14003 eval $hasproto
14004
14005 : see if getitimer exists
14006 set getitimer d_getitimer
14007 eval $inlibc
14008
14009 : see if getlogin exists
14010 set getlogin d_getlogin
14011 eval $inlibc
14012
14013 : see if getlogin_r exists
14014 set getlogin_r d_getlogin_r
14015 eval $inlibc
14016 case "$d_getlogin_r" in
14017 "$define")
14018         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
14019         case "$d_getlogin_r_proto:$usethreads" in
14020         ":define")      d_getlogin_r_proto=define
14021                 set d_getlogin_r_proto getlogin_r $hdrs
14022                 eval $hasproto ;;
14023         *)      ;;
14024         esac
14025         case "$d_getlogin_r_proto" in
14026         define)
14027         case "$getlogin_r_proto" in
14028         ''|0) try='int getlogin_r(char*, size_t);'
14029         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
14030         esac
14031         case "$getlogin_r_proto" in
14032         ''|0) try='int getlogin_r(char*, int);'
14033         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
14034         esac
14035         case "$getlogin_r_proto" in
14036         ''|0) try='char* getlogin_r(char*, size_t);'
14037         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
14038         esac
14039         case "$getlogin_r_proto" in
14040         ''|0) try='char* getlogin_r(char*, int);'
14041         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
14042         esac
14043         case "$getlogin_r_proto" in
14044         ''|0)   d_getlogin_r=undef
14045                 getlogin_r_proto=0
14046                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
14047         * )     case "$getlogin_r_proto" in
14048                 REENTRANT_PROTO*) ;;
14049                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
14050                 esac
14051                 echo "Prototype: $try" ;;
14052         esac
14053         ;;
14054         *)      case "$usethreads" in
14055                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
14056                 esac
14057                 d_getlogin_r=undef
14058                 getlogin_r_proto=0
14059                 ;;
14060         esac
14061         ;;
14062 *)      getlogin_r_proto=0
14063         ;;
14064 esac
14065
14066 : see if getmnt exists
14067 set getmnt d_getmnt
14068 eval $inlibc
14069
14070 : see if getmntent exists
14071 set getmntent d_getmntent
14072 eval $inlibc
14073
14074 : see if getnameinfo exists
14075 set getnameinfo d_getnameinfo
14076 eval $inlibc
14077
14078 : see if getnetbyaddr exists
14079 set getnetbyaddr d_getnbyaddr
14080 eval $inlibc
14081
14082 : see if getnetbyname exists
14083 set getnetbyname d_getnbyname
14084 eval $inlibc
14085
14086 : see if getnetent exists
14087 set getnetent d_getnent
14088 eval $inlibc
14089
14090 : see if getnetbyaddr_r exists
14091 set getnetbyaddr_r d_getnetbyaddr_r
14092 eval $inlibc
14093 case "$d_getnetbyaddr_r" in
14094 "$define")
14095         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14096         case "$d_getnetbyaddr_r_proto:$usethreads" in
14097         ":define")      d_getnetbyaddr_r_proto=define
14098                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14099                 eval $hasproto ;;
14100         *)      ;;
14101         esac
14102         case "$d_getnetbyaddr_r_proto" in
14103         define)
14104         case "$getnetbyaddr_r_proto" in
14105         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14106         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14107         esac
14108         case "$getnetbyaddr_r_proto" in
14109         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14110         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14111         esac
14112         case "$getnetbyaddr_r_proto" in
14113         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14114         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14115         esac
14116         case "$getnetbyaddr_r_proto" in
14117         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14118         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14119         esac
14120         case "$getnetbyaddr_r_proto" in
14121         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14122         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14123         esac
14124         case "$getnetbyaddr_r_proto" in
14125         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14126         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14127         esac
14128         case "$getnetbyaddr_r_proto" in
14129         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14130         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14131         esac
14132         case "$getnetbyaddr_r_proto" in
14133         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14134         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14135         esac
14136         case "$getnetbyaddr_r_proto" in
14137         ''|0)   d_getnetbyaddr_r=undef
14138                 getnetbyaddr_r_proto=0
14139                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14140         * )     case "$getnetbyaddr_r_proto" in
14141                 REENTRANT_PROTO*) ;;
14142                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14143                 esac
14144                 echo "Prototype: $try" ;;
14145         esac
14146         ;;
14147         *)      case "$usethreads" in
14148                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14149                 esac
14150                 d_getnetbyaddr_r=undef
14151                 getnetbyaddr_r_proto=0
14152                 ;;
14153         esac
14154         ;;
14155 *)      getnetbyaddr_r_proto=0
14156         ;;
14157 esac
14158
14159 : see if getnetbyname_r exists
14160 set getnetbyname_r d_getnetbyname_r
14161 eval $inlibc
14162 case "$d_getnetbyname_r" in
14163 "$define")
14164         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14165         case "$d_getnetbyname_r_proto:$usethreads" in
14166         ":define")      d_getnetbyname_r_proto=define
14167                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14168                 eval $hasproto ;;
14169         *)      ;;
14170         esac
14171         case "$d_getnetbyname_r_proto" in
14172         define)
14173         case "$getnetbyname_r_proto" in
14174         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14175         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14176         esac
14177         case "$getnetbyname_r_proto" in
14178         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14179         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14180         esac
14181         case "$getnetbyname_r_proto" in
14182         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14183         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14184         esac
14185         case "$getnetbyname_r_proto" in
14186         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14187         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14188         esac
14189         case "$getnetbyname_r_proto" in
14190         ''|0)   d_getnetbyname_r=undef
14191                 getnetbyname_r_proto=0
14192                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14193         * )     case "$getnetbyname_r_proto" in
14194                 REENTRANT_PROTO*) ;;
14195                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14196                 esac
14197                 echo "Prototype: $try" ;;
14198         esac
14199         ;;
14200         *)      case "$usethreads" in
14201                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14202                 esac
14203                 d_getnetbyname_r=undef
14204                 getnetbyname_r_proto=0
14205                 ;;
14206         esac
14207         ;;
14208 *)      getnetbyname_r_proto=0
14209         ;;
14210 esac
14211
14212 : see if getnetent_r exists
14213 set getnetent_r d_getnetent_r
14214 eval $inlibc
14215 case "$d_getnetent_r" in
14216 "$define")
14217         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14218         case "$d_getnetent_r_proto:$usethreads" in
14219         ":define")      d_getnetent_r_proto=define
14220                 set d_getnetent_r_proto getnetent_r $hdrs
14221                 eval $hasproto ;;
14222         *)      ;;
14223         esac
14224         case "$d_getnetent_r_proto" in
14225         define)
14226         case "$getnetent_r_proto" in
14227         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14228         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14229         esac
14230         case "$getnetent_r_proto" in
14231         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14232         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14233         esac
14234         case "$getnetent_r_proto" in
14235         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14236         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14237         esac
14238         case "$getnetent_r_proto" in
14239         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14240         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14241         esac
14242         case "$getnetent_r_proto" in
14243         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14244         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14245         esac
14246         case "$getnetent_r_proto" in
14247         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14248         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14249         esac
14250         case "$getnetent_r_proto" in
14251         ''|0)   d_getnetent_r=undef
14252                 getnetent_r_proto=0
14253                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14254         * )     case "$getnetent_r_proto" in
14255                 REENTRANT_PROTO*) ;;
14256                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14257                 esac
14258                 echo "Prototype: $try" ;;
14259         esac
14260         ;;
14261         *)      case "$usethreads" in
14262                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14263                 esac
14264                 d_getnetent_r=undef
14265                 getnetent_r_proto=0
14266                 ;;
14267         esac
14268         ;;
14269 *)      getnetent_r_proto=0
14270         ;;
14271 esac
14272
14273 : see if prototypes for various getnetxxx netdb.h functions are available
14274 echo " "
14275 set d_getnetprotos getnetent $i_netdb netdb.h
14276 eval $hasproto
14277
14278 : see if getpagesize exists
14279 set getpagesize d_getpagsz
14280 eval $inlibc
14281
14282 : Optional checks for getprotobyname and getprotobynumber
14283
14284 : see if getprotobyname exists
14285 set getprotobyname d_getpbyname
14286 eval $inlibc
14287
14288 : see if getprotobynumber exists
14289 set getprotobynumber d_getpbynumber
14290 eval $inlibc
14291
14292 : see if getprotoent exists
14293 set getprotoent d_getpent
14294 eval $inlibc
14295
14296 : see if getpgid exists
14297 set getpgid d_getpgid
14298 eval $inlibc
14299
14300 : see if getpgrp2 exists
14301 set getpgrp2 d_getpgrp2
14302 eval $inlibc
14303
14304 : see if getppid exists
14305 set getppid d_getppid
14306 eval $inlibc
14307
14308 : see if getpriority exists
14309 set getpriority d_getprior
14310 eval $inlibc
14311
14312 : see if getprotobyname_r exists
14313 set getprotobyname_r d_getprotobyname_r
14314 eval $inlibc
14315 case "$d_getprotobyname_r" in
14316 "$define")
14317         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14318         case "$d_getprotobyname_r_proto:$usethreads" in
14319         ":define")      d_getprotobyname_r_proto=define
14320                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14321                 eval $hasproto ;;
14322         *)      ;;
14323         esac
14324         case "$d_getprotobyname_r_proto" in
14325         define)
14326         case "$getprotobyname_r_proto" in
14327         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14328         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14329         esac
14330         case "$getprotobyname_r_proto" in
14331         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14332         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14333         esac
14334         case "$getprotobyname_r_proto" in
14335         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14336         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14337         esac
14338         case "$getprotobyname_r_proto" in
14339         ''|0)   d_getprotobyname_r=undef
14340                 getprotobyname_r_proto=0
14341                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14342         * )     case "$getprotobyname_r_proto" in
14343                 REENTRANT_PROTO*) ;;
14344                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14345                 esac
14346                 echo "Prototype: $try" ;;
14347         esac
14348         ;;
14349         *)      case "$usethreads" in
14350                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14351                 esac
14352                 d_getprotobyname_r=undef
14353                 getprotobyname_r_proto=0
14354                 ;;
14355         esac
14356         ;;
14357 *)      getprotobyname_r_proto=0
14358         ;;
14359 esac
14360
14361 : see if getprotobynumber_r exists
14362 set getprotobynumber_r d_getprotobynumber_r
14363 eval $inlibc
14364 case "$d_getprotobynumber_r" in
14365 "$define")
14366         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14367         case "$d_getprotobynumber_r_proto:$usethreads" in
14368         ":define")      d_getprotobynumber_r_proto=define
14369                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14370                 eval $hasproto ;;
14371         *)      ;;
14372         esac
14373         case "$d_getprotobynumber_r_proto" in
14374         define)
14375         case "$getprotobynumber_r_proto" in
14376         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14377         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14378         esac
14379         case "$getprotobynumber_r_proto" in
14380         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14381         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14382         esac
14383         case "$getprotobynumber_r_proto" in
14384         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14385         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14386         esac
14387         case "$getprotobynumber_r_proto" in
14388         ''|0)   d_getprotobynumber_r=undef
14389                 getprotobynumber_r_proto=0
14390                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14391         * )     case "$getprotobynumber_r_proto" in
14392                 REENTRANT_PROTO*) ;;
14393                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14394                 esac
14395                 echo "Prototype: $try" ;;
14396         esac
14397         ;;
14398         *)      case "$usethreads" in
14399                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14400                 esac
14401                 d_getprotobynumber_r=undef
14402                 getprotobynumber_r_proto=0
14403                 ;;
14404         esac
14405         ;;
14406 *)      getprotobynumber_r_proto=0
14407         ;;
14408 esac
14409
14410 : see if getprotoent_r exists
14411 set getprotoent_r d_getprotoent_r
14412 eval $inlibc
14413 case "$d_getprotoent_r" in
14414 "$define")
14415         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14416         case "$d_getprotoent_r_proto:$usethreads" in
14417         ":define")      d_getprotoent_r_proto=define
14418                 set d_getprotoent_r_proto getprotoent_r $hdrs
14419                 eval $hasproto ;;
14420         *)      ;;
14421         esac
14422         case "$d_getprotoent_r_proto" in
14423         define)
14424         case "$getprotoent_r_proto" in
14425         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14426         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14427         esac
14428         case "$getprotoent_r_proto" in
14429         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14430         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14431         esac
14432         case "$getprotoent_r_proto" in
14433         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14434         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14435         esac
14436         case "$getprotoent_r_proto" in
14437         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14438         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14439         esac
14440         case "$getprotoent_r_proto" in
14441         ''|0)   d_getprotoent_r=undef
14442                 getprotoent_r_proto=0
14443                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14444         * )     case "$getprotoent_r_proto" in
14445                 REENTRANT_PROTO*) ;;
14446                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14447                 esac
14448                 echo "Prototype: $try" ;;
14449         esac
14450         ;;
14451         *)      case "$usethreads" in
14452                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14453                 esac
14454                 d_getprotoent_r=undef
14455                 getprotoent_r_proto=0
14456                 ;;
14457         esac
14458         ;;
14459 *)      getprotoent_r_proto=0
14460         ;;
14461 esac
14462
14463 : see if prototypes for various getprotoxxx netdb.h functions are available
14464 echo " "
14465 set d_getprotoprotos getprotoent $i_netdb netdb.h
14466 eval $hasproto
14467
14468 : see if getprpwnam exists
14469 set getprpwnam d_getprpwnam
14470 eval $inlibc
14471
14472 : see if getpwent exists
14473 set getpwent d_getpwent
14474 eval $inlibc
14475
14476 : see if getpwent_r exists
14477 set getpwent_r d_getpwent_r
14478 eval $inlibc
14479 case "$d_getpwent_r" in
14480 "$define")
14481         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14482         case "$d_getpwent_r_proto:$usethreads" in
14483         ":define")      d_getpwent_r_proto=define
14484                 set d_getpwent_r_proto getpwent_r $hdrs
14485                 eval $hasproto ;;
14486         *)      ;;
14487         esac
14488         case "$d_getpwent_r_proto" in
14489         define)
14490         case "$getpwent_r_proto" in
14491         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14492         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14493         esac
14494         case "$getpwent_r_proto" in
14495         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14496         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14497         esac
14498         case "$getpwent_r_proto" in
14499         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14500         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14501         esac
14502         case "$getpwent_r_proto" in
14503         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14504         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14505         esac
14506         case "$getpwent_r_proto" in
14507         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14508         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14509         esac
14510         case "$getpwent_r_proto" in
14511         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14512         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14513         esac
14514         case "$getpwent_r_proto" in
14515         ''|0)   d_getpwent_r=undef
14516                 getpwent_r_proto=0
14517                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14518         * )     case "$getpwent_r_proto" in
14519                 REENTRANT_PROTO*) ;;
14520                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14521                 esac
14522                 echo "Prototype: $try" ;;
14523         esac
14524         ;;
14525         *)      case "$usethreads" in
14526                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14527                 esac
14528                 d_getpwent_r=undef
14529                 getpwent_r_proto=0
14530                 ;;
14531         esac
14532         ;;
14533 *)      getpwent_r_proto=0
14534         ;;
14535 esac
14536
14537 : see if getpwnam_r exists
14538 set getpwnam_r d_getpwnam_r
14539 eval $inlibc
14540 case "$d_getpwnam_r" in
14541 "$define")
14542         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14543         case "$d_getpwnam_r_proto:$usethreads" in
14544         ":define")      d_getpwnam_r_proto=define
14545                 set d_getpwnam_r_proto getpwnam_r $hdrs
14546                 eval $hasproto ;;
14547         *)      ;;
14548         esac
14549         case "$d_getpwnam_r_proto" in
14550         define)
14551         case "$getpwnam_r_proto" in
14552         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14553         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14554         esac
14555         case "$getpwnam_r_proto" in
14556         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14557         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14558         esac
14559         case "$getpwnam_r_proto" in
14560         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14561         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14562         esac
14563         case "$getpwnam_r_proto" in
14564         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14565         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14566         esac
14567         case "$getpwnam_r_proto" in
14568         ''|0)   d_getpwnam_r=undef
14569                 getpwnam_r_proto=0
14570                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14571         * )     case "$getpwnam_r_proto" in
14572                 REENTRANT_PROTO*) ;;
14573                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14574                 esac
14575                 echo "Prototype: $try" ;;
14576         esac
14577         ;;
14578         *)      case "$usethreads" in
14579                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14580                 esac
14581                 d_getpwnam_r=undef
14582                 getpwnam_r_proto=0
14583                 ;;
14584         esac
14585         ;;
14586 *)      getpwnam_r_proto=0
14587         ;;
14588 esac
14589
14590 : see if getpwuid_r exists
14591 set getpwuid_r d_getpwuid_r
14592 eval $inlibc
14593 case "$d_getpwuid_r" in
14594 "$define")
14595         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14596         case "$d_getpwuid_r_proto:$usethreads" in
14597         ":define")      d_getpwuid_r_proto=define
14598                 set d_getpwuid_r_proto getpwuid_r $hdrs
14599                 eval $hasproto ;;
14600         *)      ;;
14601         esac
14602         case "$d_getpwuid_r_proto" in
14603         define)
14604         case "$getpwuid_r_proto" in
14605         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14606         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14607         esac
14608         case "$getpwuid_r_proto" in
14609         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14610         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14611         esac
14612         case "$getpwuid_r_proto" in
14613         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14614         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14615         esac
14616         case "$getpwuid_r_proto" in
14617         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14618         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14619         esac
14620         case "$getpwuid_r_proto" in
14621         ''|0)   d_getpwuid_r=undef
14622                 getpwuid_r_proto=0
14623                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14624         * )     case "$getpwuid_r_proto" in
14625                 REENTRANT_PROTO*) ;;
14626                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14627                 esac
14628                 echo "Prototype: $try" ;;
14629         esac
14630         ;;
14631         *)      case "$usethreads" in
14632                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14633                 esac
14634                 d_getpwuid_r=undef
14635                 getpwuid_r_proto=0
14636                 ;;
14637         esac
14638         ;;
14639 *)      getpwuid_r_proto=0
14640         ;;
14641 esac
14642
14643 : Optional checks for getsbyname and getsbyport
14644
14645 : see if getservbyname exists
14646 set getservbyname d_getsbyname
14647 eval $inlibc
14648
14649 : see if getservbyport exists
14650 set getservbyport d_getsbyport
14651 eval $inlibc
14652
14653 : see if getservent exists
14654 set getservent d_getsent
14655 eval $inlibc
14656
14657 : see if getservbyname_r exists
14658 set getservbyname_r d_getservbyname_r
14659 eval $inlibc
14660 case "$d_getservbyname_r" in
14661 "$define")
14662         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14663         case "$d_getservbyname_r_proto:$usethreads" in
14664         ":define")      d_getservbyname_r_proto=define
14665                 set d_getservbyname_r_proto getservbyname_r $hdrs
14666                 eval $hasproto ;;
14667         *)      ;;
14668         esac
14669         case "$d_getservbyname_r_proto" in
14670         define)
14671         case "$getservbyname_r_proto" in
14672         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14673         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14674         esac
14675         case "$getservbyname_r_proto" in
14676         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14677         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14678         esac
14679         case "$getservbyname_r_proto" in
14680         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14681         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14682         esac
14683         case "$getservbyname_r_proto" in
14684         ''|0)   d_getservbyname_r=undef
14685                 getservbyname_r_proto=0
14686                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14687         * )     case "$getservbyname_r_proto" in
14688                 REENTRANT_PROTO*) ;;
14689                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14690                 esac
14691                 echo "Prototype: $try" ;;
14692         esac
14693         ;;
14694         *)      case "$usethreads" in
14695                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14696                 esac
14697                 d_getservbyname_r=undef
14698                 getservbyname_r_proto=0
14699                 ;;
14700         esac
14701         ;;
14702 *)      getservbyname_r_proto=0
14703         ;;
14704 esac
14705
14706 : see if getservbyport_r exists
14707 set getservbyport_r d_getservbyport_r
14708 eval $inlibc
14709 case "$d_getservbyport_r" in
14710 "$define")
14711         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14712         case "$d_getservbyport_r_proto:$usethreads" in
14713         ":define")      d_getservbyport_r_proto=define
14714                 set d_getservbyport_r_proto getservbyport_r $hdrs
14715                 eval $hasproto ;;
14716         *)      ;;
14717         esac
14718         case "$d_getservbyport_r_proto" in
14719         define)
14720         case "$getservbyport_r_proto" in
14721         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14722         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14723         esac
14724         case "$getservbyport_r_proto" in
14725         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14726         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14727         esac
14728         case "$getservbyport_r_proto" in
14729         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14730         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14731         esac
14732         case "$getservbyport_r_proto" in
14733         ''|0)   d_getservbyport_r=undef
14734                 getservbyport_r_proto=0
14735                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14736         * )     case "$getservbyport_r_proto" in
14737                 REENTRANT_PROTO*) ;;
14738                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14739                 esac
14740                 echo "Prototype: $try" ;;
14741         esac
14742         ;;
14743         *)      case "$usethreads" in
14744                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14745                 esac
14746                 d_getservbyport_r=undef
14747                 getservbyport_r_proto=0
14748                 ;;
14749         esac
14750         ;;
14751 *)      getservbyport_r_proto=0
14752         ;;
14753 esac
14754
14755 : see if getservent_r exists
14756 set getservent_r d_getservent_r
14757 eval $inlibc
14758 case "$d_getservent_r" in
14759 "$define")
14760         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14761         case "$d_getservent_r_proto:$usethreads" in
14762         ":define")      d_getservent_r_proto=define
14763                 set d_getservent_r_proto getservent_r $hdrs
14764                 eval $hasproto ;;
14765         *)      ;;
14766         esac
14767         case "$d_getservent_r_proto" in
14768         define)
14769         case "$getservent_r_proto" in
14770         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14771         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14772         esac
14773         case "$getservent_r_proto" in
14774         ''|0) try='int getservent_r(struct servent*, char*, int);'
14775         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14776         esac
14777         case "$getservent_r_proto" in
14778         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14779         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14780         esac
14781         case "$getservent_r_proto" in
14782         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14783         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14784         esac
14785         case "$getservent_r_proto" in
14786         ''|0)   d_getservent_r=undef
14787                 getservent_r_proto=0
14788                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14789         * )     case "$getservent_r_proto" in
14790                 REENTRANT_PROTO*) ;;
14791                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14792                 esac
14793                 echo "Prototype: $try" ;;
14794         esac
14795         ;;
14796         *)      case "$usethreads" in
14797                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14798                 esac
14799                 d_getservent_r=undef
14800                 getservent_r_proto=0
14801                 ;;
14802         esac
14803         ;;
14804 *)      getservent_r_proto=0
14805         ;;
14806 esac
14807
14808 : see if prototypes for various getservxxx netdb.h functions are available
14809 echo " "
14810 set d_getservprotos getservent $i_netdb netdb.h
14811 eval $hasproto
14812
14813 : see if getspnam exists
14814 set getspnam d_getspnam
14815 eval $inlibc
14816
14817 : see if this is a shadow.h system
14818 set shadow.h i_shadow
14819 eval $inhdr
14820
14821 : see if getspnam_r exists
14822 set getspnam_r d_getspnam_r
14823 eval $inlibc
14824 case "$d_getspnam_r" in
14825 "$define")
14826         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14827         case "$d_getspnam_r_proto:$usethreads" in
14828         ":define")      d_getspnam_r_proto=define
14829                 set d_getspnam_r_proto getspnam_r $hdrs
14830                 eval $hasproto ;;
14831         *)      ;;
14832         esac
14833         case "$d_getspnam_r_proto" in
14834         define)
14835         case "$getspnam_r_proto" in
14836         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14837         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14838         esac
14839         case "$getspnam_r_proto" in
14840         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14841         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14842         esac
14843         case "$getspnam_r_proto" in
14844         ''|0)   d_getspnam_r=undef
14845                 getspnam_r_proto=0
14846                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14847         * )     case "$getspnam_r_proto" in
14848                 REENTRANT_PROTO*) ;;
14849                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14850                 esac
14851                 echo "Prototype: $try" ;;
14852         esac
14853         ;;
14854         *)      case "$usethreads" in
14855                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14856                 esac
14857                 d_getspnam_r=undef
14858                 getspnam_r_proto=0
14859                 ;;
14860         esac
14861         ;;
14862 *)      getspnam_r_proto=0
14863         ;;
14864 esac
14865
14866 : see if gettimeofday or ftime exists
14867 set gettimeofday d_gettimeod
14868 eval $inlibc
14869 case "$d_gettimeod" in
14870 "$undef")
14871         set ftime d_ftime 
14872         eval $inlibc
14873         ;;
14874 *)
14875         val="$undef"; set d_ftime; eval $setvar
14876         ;;
14877 esac
14878 case "$d_gettimeod$d_ftime" in
14879 "$undef$undef")
14880         echo " "
14881         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14882         ;;
14883 esac
14884
14885 : see if gmtime_r exists
14886 set gmtime_r d_gmtime_r
14887 eval $inlibc
14888 case "$d_gmtime_r" in
14889 "$define")
14890         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14891         case "$d_gmtime_r_proto:$usethreads" in
14892         ":define")      d_gmtime_r_proto=define
14893                 set d_gmtime_r_proto gmtime_r $hdrs
14894                 eval $hasproto ;;
14895         *)      ;;
14896         esac
14897         case "$d_gmtime_r_proto" in
14898         define)
14899         case "$gmtime_r_proto" in
14900         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14901         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14902         esac
14903         case "$gmtime_r_proto" in
14904         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14905         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14906         esac
14907         case "$gmtime_r_proto" in
14908         ''|0)   d_gmtime_r=undef
14909                 gmtime_r_proto=0
14910                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14911         * )     case "$gmtime_r_proto" in
14912                 REENTRANT_PROTO*) ;;
14913                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14914                 esac
14915                 echo "Prototype: $try" ;;
14916         esac
14917         ;;
14918         *)      case "$usethreads" in
14919                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14920                 esac
14921                 d_gmtime_r=undef
14922                 gmtime_r_proto=0
14923                 ;;
14924         esac
14925         ;;
14926 *)      gmtime_r_proto=0
14927         ;;
14928 esac
14929
14930 : see if hasmntopt exists
14931 set hasmntopt d_hasmntopt
14932 eval $inlibc
14933
14934 : see if this is a netinet/in.h or sys/in.h system
14935 set netinet/in.h i_niin sys/in.h i_sysin
14936 eval $inhdr
14937
14938 : see if arpa/inet.h has to be included
14939 set arpa/inet.h i_arpainet
14940 eval $inhdr
14941
14942 : see if htonl --and friends-- exists
14943 val=''
14944 set htonl val
14945 eval $inlibc
14946
14947 : Maybe they are macros.
14948 case "$val" in
14949 $undef)
14950         $cat >htonl.c <<EOM
14951 #include <stdio.h>
14952 #include <sys/types.h>
14953 #$i_niin I_NETINET_IN
14954 #$i_sysin I_SYS_IN
14955 #$i_arpainet I_ARPA_INET
14956 #ifdef I_NETINET_IN
14957 #include <netinet/in.h>
14958 #endif
14959 #ifdef I_SYS_IN
14960 #include <sys/in.h>
14961 #endif
14962 #ifdef I_ARPA_INET
14963 #include <arpa/inet.h>
14964 #endif
14965 #ifdef htonl
14966 printf("Defined as a macro.");
14967 #endif
14968 EOM
14969         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14970         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14971                 val="$define"
14972                 echo "But it seems to be defined as a macro." >&4
14973         fi
14974         $rm -f htonl.?
14975         ;;
14976 esac
14977 set d_htonl
14978 eval $setvar
14979
14980 : see if ilogbl exists
14981 set ilogbl d_ilogbl
14982 eval $inlibc
14983
14984 : index or strchr
14985 echo " "
14986 if set index val -f; eval $csym; $val; then
14987         if set strchr val -f d_strchr; eval $csym; $val; then
14988                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14989                         val="$define"
14990                         vali="$undef"
14991                         echo "strchr() found." >&4
14992                 else
14993                         val="$undef"
14994                         vali="$define"
14995                         echo "index() found." >&4
14996                 fi
14997         else
14998                 val="$undef"
14999                 vali="$define"
15000                 echo "index() found." >&4
15001         fi
15002 else
15003         if set strchr val -f d_strchr; eval $csym; $val; then
15004                 val="$define"
15005                 vali="$undef"
15006                 echo "strchr() found." >&4
15007         else
15008                 echo "No index() or strchr() found!" >&4
15009                 val="$undef"
15010                 vali="$undef"
15011         fi
15012 fi
15013 set d_strchr; eval $setvar
15014 val="$vali"
15015 set d_index; eval $setvar
15016
15017 : check whether inet_aton exists
15018 set inet_aton d_inetaton
15019 eval $inlibc
15020
15021 : see if inet_ntop exists
15022 set inet_ntop d_inetntop
15023 eval $inlibc
15024
15025 : see if inet_pton exists
15026 set inet_pton d_inetpton
15027 eval $inlibc
15028
15029 : Look for isascii
15030 echo " "
15031 $cat >isascii.c <<EOCP
15032 #include <stdio.h>
15033 #include <ctype.h>
15034 #$i_stdlib I_STDLIB
15035 #ifdef I_STDLIB
15036 #include <stdlib.h>
15037 #endif
15038 int main() {
15039         int c = 'A';
15040         if (isascii(c))
15041                 exit(0);
15042         else
15043                 exit(1);
15044 }
15045 EOCP
15046 set isascii
15047 if eval $compile; then
15048         echo "isascii() found." >&4
15049         val="$define"
15050 else
15051         echo "isascii() NOT found." >&4
15052         val="$undef"
15053 fi
15054 set d_isascii
15055 eval $setvar
15056 $rm -f isascii*
15057
15058 : Look for isblank
15059 echo " "
15060 $cat >isblank.c <<'EOCP'
15061 #include <stdio.h>
15062 #include <ctype.h>
15063 int main() {
15064         int c = ' ';
15065         if (isblank(c))
15066                 return 0 ;
15067         else
15068                 return 1 ;
15069 }
15070 EOCP
15071 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
15072         echo "isblank() found." >&4
15073         val="$define"
15074 else
15075         echo "isblank() NOT found." >&4
15076         val="$undef"
15077 fi
15078 set d_isblank
15079 eval $setvar
15080 $rm -f isblank*
15081
15082 : see if isfinite exists
15083 set isfinite d_isfinite
15084 eval $inlibc
15085
15086 : see if isinf exists
15087 set isinf d_isinf
15088 eval $inlibc
15089
15090 : see if isnan exists
15091 set isnan d_isnan
15092 eval $inlibc
15093
15094 : see if isnanl exists
15095 set isnanl d_isnanl
15096 eval $inlibc
15097
15098 : see if killpg exists
15099 set killpg d_killpg
15100 eval $inlibc
15101
15102 : see if lchown exists
15103 echo " "
15104 $cat > try.c <<'EOCP'
15105 /* System header to define __stub macros and hopefully few prototypes,
15106     which can conflict with char lchown(); below.  */
15107 #include <assert.h>
15108 /* Override any gcc2 internal prototype to avoid an error.  */
15109 /* We use char because int might match the return type of a gcc2
15110    builtin and then its argument prototype would still apply.  */
15111 char lchown();
15112 int main() {
15113     /*  The GNU C library defines this for functions which it implements
15114         to always fail with ENOSYS.  Some functions are actually named
15115         something starting with __ and the normal name is an alias.  */
15116 #if defined (__stub_lchown) || defined (__stub___lchown)
15117 choke me
15118 #else
15119 lchown();
15120 #endif
15121 ; return 0; }
15122 EOCP
15123 set try
15124 if eval $compile; then
15125     $echo "lchown() found." >&4
15126     val="$define"
15127 else
15128     $echo "lchown() NOT found." >&4
15129     val="$undef"
15130 fi
15131 set d_lchown
15132 eval $setvar
15133
15134 : See if number of significant digits in a double precision number is known
15135 echo " "
15136 $cat >ldbl_dig.c <<EOM
15137 #$i_limits I_LIMITS
15138 #$i_float I_FLOAT
15139 #ifdef I_LIMITS
15140 #include <limits.h>
15141 #endif
15142 #ifdef I_FLOAT
15143 #include <float.h>
15144 #endif
15145 #ifdef LDBL_DIG
15146 printf("Contains LDBL_DIG");
15147 #endif
15148 EOM
15149 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15150 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15151         echo "LDBL_DIG found." >&4
15152         val="$define"
15153 else
15154         echo "LDBL_DIG NOT found." >&4
15155         val="$undef"
15156 fi
15157 $rm -f ldbl_dig.?
15158 set d_ldbl_dig
15159 eval $setvar
15160
15161 : see if this is a math.h system
15162 set math.h i_math
15163 eval $inhdr
15164
15165 : check to see if math.h defines _LIB_VERSION
15166 d_libm_lib_version="$undef"
15167 case $i_math in
15168     $define)
15169         echo " "
15170         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15171         $cat >try.c <<EOCP
15172 #include <unistd.h>
15173 #include <math.h>
15174 int main (int argc, char *argv[])
15175 {
15176     printf ("%d\n", _LIB_VERSION);
15177     return (0);
15178     } /* main */
15179 EOCP
15180         set try
15181         if eval $compile; then
15182             foo=`$run ./try`
15183             echo "Yes, it does ($foo)" >&4
15184             d_libm_lib_version="$define"
15185         else
15186             echo "No, it does not (probably harmless)" >&4
15187             fi
15188         $rm_try
15189         ;;
15190
15191     esac
15192
15193 : see if link exists
15194 set link d_link
15195 eval $inlibc
15196
15197 : see if localtime_r exists
15198 set localtime_r d_localtime_r
15199 eval $inlibc
15200 case "$d_localtime_r" in
15201 "$define")
15202         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15203         case "$d_localtime_r_proto:$usethreads" in
15204         ":define")      d_localtime_r_proto=define
15205                 set d_localtime_r_proto localtime_r $hdrs
15206                 eval $hasproto ;;
15207         *)      ;;
15208         esac
15209         case "$d_localtime_r_proto" in
15210         define)
15211         case "$localtime_r_proto" in
15212         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15213         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15214         esac
15215         case "$localtime_r_proto" in
15216         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15217         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15218         esac
15219         case "$localtime_r_proto" in
15220         ''|0)   d_localtime_r=undef
15221                 localtime_r_proto=0
15222                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15223         * )     case "$localtime_r_proto" in
15224                 REENTRANT_PROTO*) ;;
15225                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15226                 esac
15227                 echo "Prototype: $try" ;;
15228         esac
15229         ;;
15230         *)      case "$usethreads" in
15231                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15232                 esac
15233                 d_localtime_r=undef
15234                 localtime_r_proto=0
15235                 ;;
15236         esac
15237         ;;
15238 *)      localtime_r_proto=0
15239         ;;
15240 esac
15241
15242 : see if localtime_r calls tzset
15243 case "$localtime_r_proto" in
15244 REENTRANT_PROTO*)
15245         $cat >try.c <<EOCP
15246 /*  Does our libc's localtime_r call tzset ?
15247  *  return 0 if so, 1 otherwise.
15248  */
15249 #$i_systypes    I_SYS_TYPES
15250 #$i_unistd      I_UNISTD
15251 #$i_time        I_TIME
15252 #$i_stdlib      I_STDLIB
15253 #$i_string      I_STRING
15254 #$i_malloc      I_MALLOC
15255 #ifdef I_SYS_TYPES
15256 #  include <sys/types.h>
15257 #endif
15258 #ifdef I_UNISTD
15259 #  include <unistd.h>
15260 #endif
15261 #ifdef I_TIME
15262 #  include <time.h>
15263 #endif
15264 #ifdef I_STDLIB
15265 #include <stdlib.h>
15266 #endif
15267 #ifdef I_STRING
15268 #  include <string.h>
15269 #else
15270 #  include <strings.h>
15271 #endif
15272 #ifdef I_MALLOC
15273 #  include <malloc.h>
15274 #endif
15275 int main()
15276 {
15277     time_t t = time(0L);
15278     char w_tz[]="TZ" "=GMT+5",
15279          e_tz[]="TZ" "=GMT-5",
15280         *tz_e = (char*)malloc(16),
15281         *tz_w = (char*)malloc(16);
15282     struct tm tm_e, tm_w;
15283     memset(&tm_e,'\0',sizeof(struct tm));
15284     memset(&tm_w,'\0',sizeof(struct tm));
15285     strcpy(tz_e,e_tz);
15286     strcpy(tz_w,w_tz);
15287
15288     putenv(tz_e);
15289     localtime_r(&t, &tm_e);
15290
15291     putenv(tz_w);
15292     localtime_r(&t, &tm_w);
15293
15294     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15295         return 1;
15296     return 0;
15297 }
15298 EOCP
15299         set try
15300         if eval $compile; then
15301             if $run ./try; then
15302                 d_localtime_r_needs_tzset=undef;
15303             else
15304                 d_localtime_r_needs_tzset=define;
15305             fi;
15306         else
15307             d_localtime_r_needs_tzset=undef;
15308         fi;
15309      ;;
15310   *)
15311      d_localtime_r_needs_tzset=undef;
15312      ;;
15313 esac
15314 $rm_try
15315
15316 : see if localeconv exists
15317 set localeconv d_locconv
15318 eval $inlibc
15319
15320 : see if lockf exists
15321 set lockf d_lockf
15322 eval $inlibc
15323
15324 : see if prototype for lseek is available
15325 echo " "
15326 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15327 eval $hasproto
15328
15329 : see if lstat exists
15330 set lstat d_lstat
15331 eval $inlibc
15332
15333 : see if madvise exists
15334 set madvise d_madvise
15335 eval $inlibc
15336
15337 : see if malloc_size exists
15338 set malloc_size d_malloc_size
15339 eval $inlibc
15340
15341 : see if malloc_size_good exists
15342 set malloc_good_size d_malloc_good_size
15343 eval $inlibc
15344
15345 : see if mblen exists
15346 set mblen d_mblen
15347 eval $inlibc
15348
15349 : see if mbstowcs exists
15350 set mbstowcs d_mbstowcs
15351 eval $inlibc
15352
15353 : see if mbtowc exists
15354 set mbtowc d_mbtowc
15355 eval $inlibc
15356
15357 : see if memchr exists
15358 set memchr d_memchr
15359 eval $inlibc
15360
15361 : see if memcmp exists
15362 set memcmp d_memcmp
15363 eval $inlibc
15364
15365 : see if memcpy exists
15366 set memcpy d_memcpy
15367 eval $inlibc
15368
15369 : see if memmove exists
15370 set memmove d_memmove
15371 eval $inlibc
15372
15373 : see if memset exists
15374 set memset d_memset
15375 eval $inlibc
15376
15377 : see if mkdir exists
15378 set mkdir d_mkdir
15379 eval $inlibc
15380
15381 : see if mkdtemp exists
15382 set mkdtemp d_mkdtemp
15383 eval $inlibc
15384
15385 : see if mkfifo exists
15386 set mkfifo d_mkfifo
15387 eval $inlibc
15388
15389 : see if mkstemp exists
15390 set mkstemp d_mkstemp
15391 eval $inlibc
15392
15393 : see if mkstemps exists
15394 set mkstemps d_mkstemps
15395 eval $inlibc
15396
15397 : see if mktime exists
15398 set mktime d_mktime
15399 eval $inlibc
15400
15401 : see if this is a sys/mman.h system
15402 set sys/mman.h i_sysmman
15403 eval $inhdr
15404
15405 : see if mmap exists
15406 set mmap d_mmap
15407 eval $inlibc
15408 : see what shmat returns
15409 : default to something harmless
15410 mmaptype='void *'
15411 case "$i_sysmman$d_mmap" in
15412 "$define$define")
15413         $cat >mmap.c <<'END'
15414 #include <sys/mman.h>
15415 void *mmap();
15416 END
15417         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15418                 mmaptype='void *'
15419         else
15420                 mmaptype='caddr_t'
15421         fi
15422         echo "and it returns ($mmaptype)." >&4
15423         ;;
15424 esac
15425
15426
15427
15428 : see if sqrtl exists
15429 set sqrtl d_sqrtl
15430 eval $inlibc
15431
15432 : see if scalbnl exists
15433 set scalbnl d_scalbnl
15434 eval $inlibc
15435
15436 : see if modfl exists
15437 set modfl d_modfl
15438 eval $inlibc
15439
15440 : see if prototype for modfl is available
15441 echo " "
15442 set d_modflproto modfl $i_math math.h
15443 eval $hasproto
15444
15445 d_modfl_pow32_bug="$undef"
15446
15447 case "$d_longdbl$d_modfl" in
15448 $define$define)
15449         $cat <<EOM
15450 Checking to see whether your modfl() is okay for large values...
15451 EOM
15452 $cat >try.c <<EOCP
15453 #include <math.h>
15454 #include <stdio.h>
15455 EOCP
15456 if $test "X$d_modflproto" != "X$define"; then
15457         $cat >>try.c <<EOCP
15458 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15459 long double modfl (long double, long double *);
15460 EOCP
15461 fi
15462 $cat >>try.c <<EOCP
15463 int main() {
15464     long double nv = 4294967303.15;
15465     long double v, w;
15466     v = modfl(nv, &w);
15467 #ifdef __GLIBC__
15468     printf("glibc");
15469 #endif
15470     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15471     return 0;
15472 }
15473 EOCP
15474         case "$osname:$gccversion" in
15475         aix:)   saveccflags="$ccflags"
15476                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15477         esac
15478         set try
15479         if eval $compile; then
15480                 foo=`$run ./try`
15481                 case "$foo" in
15482                 *" 4294967303.150000 1.150000 4294967302.000000")
15483                         echo >&4 "Your modfl() is broken for large values."
15484                         d_modfl_pow32_bug="$define"
15485                         case "$foo" in
15486                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15487                         ;;
15488                         esac
15489                         ;;
15490                 *" 4294967303.150000 0.150000 4294967303.000000")
15491                         echo >&4 "Your modfl() seems okay for large values."
15492                         ;;
15493                 *)      echo >&4 "I don't understand your modfl() at all."
15494                         d_modfl="$undef"
15495                         ;;
15496                 esac
15497                 $rm_try
15498         else
15499                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15500                 d_modfl="$undef"
15501         fi
15502         case "$osname:$gccversion" in
15503         aix:)   ccflags="$saveccflags" ;; # restore
15504         esac
15505         ;;
15506 esac
15507
15508 if $test "$uselongdouble" = "$define"; then
15509     message=""
15510     if $test "$d_sqrtl" != "$define"; then
15511         message="$message sqrtl"
15512     fi
15513     if $test "$d_modfl" != "$define"; then
15514         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15515             echo "You have both aintl and copysignl, so I can emulate modfl."
15516         else
15517             message="$message modfl"
15518         fi
15519     fi
15520     if $test "$d_frexpl" != "$define"; then
15521         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15522             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15523         else
15524             message="$message frexpl"
15525         fi
15526     fi
15527
15528     if $test "$message" != ""; then
15529         $cat <<EOM >&4
15530
15531 *** You requested the use of long doubles but you do not seem to have
15532 *** the following mathematical functions needed for long double support:
15533 ***    $message
15534 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15535 *** Cannot continue, aborting.
15536
15537 EOM
15538
15539         exit 1
15540     fi
15541 fi
15542
15543 : see if mprotect exists
15544 set mprotect d_mprotect
15545 eval $inlibc
15546
15547 : see if msgctl exists
15548 set msgctl d_msgctl
15549 eval $inlibc
15550
15551 : see if msgget exists
15552 set msgget d_msgget
15553 eval $inlibc
15554
15555 : see if msgsnd exists
15556 set msgsnd d_msgsnd
15557 eval $inlibc
15558
15559 : see if msgrcv exists
15560 set msgrcv d_msgrcv
15561 eval $inlibc
15562
15563 : see how much of the 'msg*(2)' library is present.
15564 h_msg=true
15565 echo " "
15566 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15567 *"$undef"*) h_msg=false;;
15568 esac
15569 case "$osname" in
15570 freebsd)
15571     case "`ipcs 2>&1`" in
15572     "SVID messages"*"not configured"*)
15573         echo "Your $osname does not have the msg*(2) configured." >&4
15574         h_msg=false
15575         val="$undef"
15576         set msgctl d_msgctl
15577         eval $setvar
15578         set msgget d_msgget
15579         eval $setvar
15580         set msgsnd d_msgsnd
15581         eval $setvar
15582         set msgrcv d_msgrcv
15583         eval $setvar
15584         ;;
15585     esac
15586     ;;
15587 esac
15588 : we could also check for sys/ipc.h ...
15589 if $h_msg && $test `./findhdr sys/msg.h`; then
15590         echo "You have the full msg*(2) library." >&4
15591         val="$define"
15592 else
15593         echo "You don't have the full msg*(2) library." >&4
15594         val="$undef"
15595 fi
15596 set d_msg
15597 eval $setvar
15598
15599 : Check for msghdr_s
15600 echo " "
15601 echo "Checking to see if your system supports struct msghdr..." >&4
15602 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15603 eval $hasstruct
15604 case "$d_msghdr_s" in
15605 "$define")      echo "Yes, it does."   ;;
15606 *)              echo "No, it doesn't." ;;
15607 esac
15608
15609
15610 : see if msync exists
15611 set msync d_msync
15612 eval $inlibc
15613
15614 : see if munmap exists
15615 set munmap d_munmap
15616 eval $inlibc
15617
15618 : see if nice exists
15619 set nice d_nice
15620 eval $inlibc
15621
15622 : see if this is a langinfo.h system
15623 set langinfo.h i_langinfo
15624 eval $inhdr
15625
15626 : see if nl_langinfo exists
15627 set nl_langinfo d_nl_langinfo
15628 eval $inlibc
15629
15630 : check for volatile keyword
15631 echo " "
15632 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15633 $cat >try.c <<'EOCP'
15634 int main()
15635 {
15636         typedef struct _goo_struct goo_struct;
15637         goo_struct * volatile goo = ((goo_struct *)0);
15638         struct _goo_struct {
15639                 long long_int;
15640                 int reg_int;
15641                 char char_var;
15642         };
15643         typedef unsigned short foo_t;
15644         char *volatile foo;
15645         volatile int bar;
15646         volatile foo_t blech;
15647         foo = foo;
15648 }
15649 EOCP
15650 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15651         val="$define"
15652         echo "Yup, it does."
15653 else
15654         val="$undef"
15655         echo "Nope, it doesn't."
15656 fi
15657 set d_volatile
15658 eval $setvar
15659 $rm_try
15660
15661 : Check basic sizes
15662 echo " "
15663 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15664
15665 case "$use64bitint:$d_quad:$quadtype" in
15666 define:define:?*)
15667         ivtype="$quadtype"
15668         uvtype="$uquadtype"
15669         ivsize=8
15670         uvsize=8
15671         ;;
15672 *)      ivtype="long"
15673         uvtype="unsigned long"
15674         ivsize=$longsize
15675         uvsize=$longsize
15676         ;;
15677 esac
15678
15679 case "$uselongdouble:$d_longdbl" in
15680 define:define)
15681         nvtype="long double"
15682         nvsize=$longdblsize
15683         ;;
15684 *)      nvtype=double
15685         nvsize=$doublesize
15686         ;;
15687 esac
15688
15689 $echo "(IV will be "$ivtype", $ivsize bytes)"
15690 $echo "(UV will be "$uvtype", $uvsize bytes)"
15691 $echo "(NV will be "$nvtype", $nvsize bytes)"
15692
15693 $cat >try.c <<EOCP
15694 #$i_inttypes I_INTTYPES
15695 #ifdef I_INTTYPES
15696 #include <inttypes.h>
15697 #endif
15698 #include <stdio.h>
15699 int main() {
15700 #ifdef INT8
15701    int8_t i =  INT8_MAX;
15702   uint8_t u = UINT8_MAX;
15703   printf("int8_t\n");
15704 #endif
15705 #ifdef INT16
15706    int16_t i =  INT16_MAX;
15707   uint16_t u = UINT16_MAX;
15708   printf("int16_t\n");
15709 #endif
15710 #ifdef INT32
15711    int32_t i =  INT32_MAX;
15712   uint32_t u = UINT32_MAX;
15713   printf("int32_t\n");
15714 #endif
15715 }
15716 EOCP
15717
15718 i8type="signed char"
15719 u8type="unsigned char"
15720 i8size=1
15721 u8size=1
15722
15723 case "$i16type" in
15724 '')     case "$shortsize" in
15725         2)      i16type=short
15726                 u16type="unsigned short"
15727                 i16size=$shortsize
15728                 u16size=$shortsize
15729                 ;;
15730         esac
15731         ;;
15732 esac
15733 case "$i16type" in
15734 '')     set try -DINT16
15735         if eval $compile; then
15736                 case "`$run ./try`" in
15737                 int16_t)
15738                         i16type=int16_t
15739                         u16type=uint16_t
15740                         i16size=2
15741                         u16size=2
15742                         ;;
15743                 esac
15744         fi
15745         ;;
15746 esac
15747 case "$i16type" in
15748 '')     if $test $shortsize -ge 2; then
15749                 i16type=short
15750                 u16type="unsigned short"
15751                 i16size=$shortsize
15752                 u16size=$shortsize
15753         fi
15754         ;;
15755 esac
15756
15757 case "$i32type" in
15758 '')     case "$longsize" in
15759         4)      i32type=long
15760                 u32type="unsigned long"
15761                 i32size=$longsize
15762                 u32size=$longsize
15763                 ;;
15764         *)      case "$intsize" in
15765                 4)      i32type=int
15766                         u32type="unsigned int"
15767                         i32size=$intsize
15768                         u32size=$intsize
15769                         ;;
15770                 esac
15771                 ;;
15772         esac
15773         ;;
15774 esac
15775 case "$i32type" in
15776 '')     set try -DINT32
15777         if eval $compile; then
15778                 case "`$run ./try`" in
15779                 int32_t)
15780                         i32type=int32_t
15781                         u32type=uint32_t
15782                         i32size=4
15783                         u32size=4
15784                         ;;
15785                 esac
15786         fi
15787         ;;
15788 esac
15789 case "$i32type" in
15790 '')     if $test $intsize -ge 4; then
15791                 i32type=int
15792                 u32type="unsigned int"
15793                 i32size=$intsize
15794                 u32size=$intsize
15795         fi
15796         ;;
15797 esac
15798
15799 case "$i64type" in
15800 '')     case "$d_quad:$quadtype" in
15801         define:?*)
15802                 i64type="$quadtype"
15803                 u64type="$uquadtype"
15804                 i64size=8
15805                 u64size=8
15806                 ;;
15807         esac
15808         ;;
15809 esac
15810
15811 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15812 : volatile so that the compiler has to store it out to memory.
15813 if test X"$d_volatile" = X"$define"; then
15814         volatile=volatile
15815 fi
15816 $cat <<EOP >try.c
15817 #include <stdio.h>
15818 #$i_stdlib I_STDLIB
15819 #ifdef I_STDLIB
15820 #include <stdlib.h>
15821 #endif
15822 #include <sys/types.h>
15823 #include <signal.h>
15824 #ifdef SIGFPE
15825 $volatile int bletched = 0;
15826 $signal_t blech(int s) { bletched = 1; }
15827 #endif
15828 int main() {
15829     $uvtype u = 0;
15830     $nvtype d;
15831     int     n = 8 * $uvsize;
15832     int     i;
15833 #ifdef SIGFPE
15834     signal(SIGFPE, blech);
15835 #endif
15836
15837     for (i = 0; i < n; i++) {
15838       u = u << 1 | ($uvtype)1;
15839       d = ($nvtype)u;
15840       if (($uvtype)d != u)
15841         break;
15842       if (d <= 0)
15843         break;
15844       d = ($nvtype)(u - 1);
15845       if (($uvtype)d != (u - 1))
15846         break;
15847 #ifdef SIGFPE
15848       if (bletched)
15849         break;
15850 #endif
15851     }
15852     printf("%d\n", ((i == n) ? -n : i));
15853     exit(0);
15854 }
15855 EOP
15856 set try
15857
15858 d_nv_preserves_uv="$undef"
15859 if eval $compile; then
15860         nv_preserves_uv_bits="`$run ./try`"
15861 fi
15862 case "$nv_preserves_uv_bits" in
15863 \-[1-9]*)
15864         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15865         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15866         d_nv_preserves_uv="$define"
15867         ;;
15868 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15869         d_nv_preserves_uv="$undef" ;;
15870 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15871         nv_preserves_uv_bits="0" ;;
15872 esac
15873 $rm_try
15874
15875 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15876 : volatile so that the compiler has to store it out to memory.
15877 if test X"$d_volatile" = X"$define"; then
15878         volatile=volatile
15879 fi
15880 $cat <<EOP >try.c
15881 #include <stdio.h>
15882
15883 typedef $nvtype NV;
15884
15885 int
15886 main() {
15887   NV value = 2;
15888   int count = 1;
15889
15890   while(count < 256) {
15891     $volatile NV up = value + 1.0;
15892     $volatile NV negated = -value;
15893     $volatile NV down = negated - 1.0;
15894     $volatile NV got_up = up - value;
15895     int up_good = got_up == 1.0;
15896     int got_down = down - negated;
15897     int down_good = got_down == -1.0;
15898
15899     if (down_good != up_good) {
15900       fprintf(stderr,
15901               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15902               up_good, (double) got_up, down_good, (double) got_down,
15903               count, (double) value);
15904       return 1;
15905     }
15906     if (!up_good) {
15907       while (1) {
15908         if (count > 8) {
15909           count -= 8;
15910           fputs("256.0", stdout);
15911         } else {
15912           count--;
15913           fputs("2.0", stdout);
15914         }
15915         if (!count) {
15916           puts("");
15917           return 0;
15918         }
15919         fputs("*", stdout);
15920       }
15921     }
15922     value *= 2;
15923     ++count;
15924   }
15925   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15926           count, (double) value);
15927   return 1;
15928 }
15929 EOP
15930 set try
15931
15932 nv_overflows_integers_at='0'
15933 if eval $compile; then
15934     xxx="`$run ./try`"
15935     case "$?" in
15936         0)
15937             case "$xxx" in
15938                 2*)  cat >&4 <<EOM
15939 The largest integer your NVs can preserve is equal to $xxx
15940 EOM
15941                     nv_overflows_integers_at="$xxx"
15942                     ;;
15943                 *)  cat >&4 <<EOM
15944 Cannot determine the largest integer value your NVs can hold, unexpected output
15945 '$xxx'
15946 EOM
15947                     ;;
15948             esac
15949             ;;
15950         *)  cat >&4 <<EOM
15951 Cannot determine the largest integer value your NVs can hold
15952 EOM
15953             ;;
15954     esac
15955 fi
15956 $rm_try
15957
15958 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15959 : volatile so that the compiler has to store it out to memory.
15960 if test X"$d_volatile" = X"$define"; then
15961         volatile=volatile
15962 fi
15963 $cat <<EOP >try.c
15964 #include <stdio.h>
15965 #$i_stdlib I_STDLIB
15966 #ifdef I_STDLIB
15967 #include <stdlib.h>
15968 #endif
15969 #$i_string I_STRING
15970 #ifdef I_STRING
15971 #  include <string.h>
15972 #else
15973 #  include <strings.h>
15974 #endif
15975 #include <sys/types.h>
15976 #include <signal.h>
15977 #ifdef SIGFPE
15978 $volatile int bletched = 0;
15979 $signal_t blech(int s) { bletched = 1; }
15980 #endif
15981
15982 int checkit($nvtype d, char *where) {
15983     unsigned char *p = (char *)&d;
15984     unsigned char *end = p + sizeof(d);
15985     int fail = 0;
15986
15987     while (p < end)
15988         fail += *p++;
15989
15990     if (!fail)
15991         return 0;
15992
15993     p = (char *)&d;
15994     printf("No - %s: 0x", where);
15995     while (p < end)
15996         printf ("%02X", *p++);
15997     printf("\n");
15998     return 1;
15999 }
16000
16001 int main(int argc, char **argv) {
16002     $nvtype d = 0.0;
16003     int fail = 0;
16004     fail += checkit(d, "0.0");
16005
16006     /* The compiler shouldn't be assuming that bletched is 0  */
16007     d = bletched;
16008
16009     fail += checkit(d, "bleched");
16010
16011 #ifdef SIGFPE
16012     signal(SIGFPE, blech);
16013 #endif
16014
16015     /* Paranoia - the compiler should have no way of knowing that ANSI says
16016        that argv[argc] will always be NULL.  Actually, if it did assume this it
16017        would be buggy, as this is C and main() can be called from elsewhere in
16018        the program.  */
16019     d = argv[argc] ? 1 : 0;
16020
16021     if (d) {
16022         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
16023     }
16024
16025     fail += checkit(d, "ternary");
16026
16027     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
16028
16029     if (d != 0.0) {
16030         printf("No - memset doesn't give 0.0\n");
16031         /* This might just blow up:  */
16032         printf("(gives %g)\n", d);
16033         return 1;
16034     }
16035
16036 #ifdef SIGFPE
16037     if (bletched) {
16038         printf("No - something bleched\n");
16039         return 1;
16040     }
16041 #endif
16042     if (fail) {
16043       printf("No - %d fail(s)\n", fail);
16044       return 1;
16045     }
16046     printf("Yes\n");
16047     return 0;
16048 }
16049 EOP
16050 set try
16051
16052 d_nv_zero_is_allbits_zero="$undef"
16053 if eval $compile; then
16054     xxx="`$run ./try`"
16055     case "$?" in
16056         0)
16057             case "$xxx" in
16058                 Yes)  cat >&4 <<EOM
16059 0.0 is represented as all bits zero in memory
16060 EOM
16061                     d_nv_zero_is_allbits_zero="$define"
16062                     ;;
16063                 *)  cat >&4 <<EOM
16064 0.0 is not represented as all bits zero in memory
16065 EOM
16066                     d_nv_zero_is_allbits_zero="$undef"
16067                     ;;
16068             esac
16069             ;;
16070         *)  cat >&4 <<EOM
16071 0.0 is not represented as all bits zero in memory
16072 EOM
16073             d_nv_zero_is_allbits_zero="$undef"
16074             ;;
16075     esac
16076 fi
16077 $rm_try
16078
16079 : check for off64_t
16080 echo " "
16081 echo "Checking to see if you have off64_t..." >&4
16082 $cat >try.c <<EOCP
16083 #include <sys/types.h>
16084 #include <unistd.h>
16085 int main() { off64_t x = 7; }
16086 EOCP
16087 set try
16088 if eval $compile; then
16089         val="$define"
16090         echo "You have off64_t."
16091 else
16092         val="$undef"
16093         echo "You do not have off64_t."
16094         case "$lseeksize" in
16095         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16096         esac
16097 fi
16098 $rm_try
16099 set d_off64_t
16100 eval $setvar
16101
16102 : how to create joinable pthreads
16103 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16104         echo " "
16105         echo "Checking what constant to use for creating joinable pthreads..." >&4
16106         $cat >try.c <<'EOCP'
16107 #include <pthread.h>
16108 int main() {
16109     int detachstate = JOINABLE;
16110 }
16111 EOCP
16112         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16113         if eval $compile; then
16114                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16115                 val="$undef" # Yes, undef.
16116                 set d_old_pthread_create_joinable
16117                 eval $setvar
16118                 val=""
16119                 set old_pthread_create_joinable
16120                 eval $setvar
16121         else
16122                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16123                 if eval $compile; then
16124                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16125                         val="$define"
16126                         set d_old_pthread_create_joinable
16127                         eval $setvar
16128                         val=PTHREAD_CREATE_UNDETACHED
16129                         set old_pthread_create_joinable
16130                         eval $setvar
16131                 else
16132                         set try -DJOINABLE=__UNDETACHED
16133                         if eval $compile; then
16134                                 echo "You seem to use __UNDETACHED." >&4
16135                                 val="$define"
16136                                 set d_old_pthread_create_joinable
16137                                 eval $setvar
16138                                 val=__UNDETACHED
16139                                 set old_pthread_create_joinable
16140                                 eval $setvar
16141                         else
16142                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16143                                 val="$define"
16144                                 set d_old_pthread_create_joinable
16145                                 eval $setvar
16146                                 val=0
16147                                 set old_pthread_create_joinable
16148                                 eval $setvar
16149                         fi
16150                 fi
16151         fi
16152         $rm_try
16153 else
16154     d_old_pthread_create_joinable="$undef"
16155     old_pthread_create_joinable=""
16156 fi
16157
16158 : see if pause exists
16159 set pause d_pause
16160 eval $inlibc
16161
16162 : see if poll exists
16163 set poll d_poll
16164 eval $inlibc
16165
16166 : see if prctl exists
16167 set prctl d_prctl
16168 eval $inlibc
16169
16170 : see if prctl supports PR_SET_NAME
16171 d_prctl_set_name=$undef
16172 case $d_prctl in
16173     $define)
16174         $cat >try.c <<EOM
16175 #include <sys/prctl.h>
16176
16177 int main (int argc, char *argv[])
16178 {
16179     return (prctl (PR_SET_NAME, "Test"));
16180     } /* main */
16181 EOM
16182         set try
16183         if eval $compile_ok && $run ./try; then
16184             echo "Your prctl (PR_SET_NAME, ...) works"
16185             d_prctl_set_name=$define
16186             fi
16187         $rm_try
16188         ;;
16189     esac
16190
16191 : see if readlink exists
16192 set readlink d_readlink
16193 eval $inlibc
16194
16195 : Check if exe is symlink to abs path of executing program
16196 echo " "
16197 procselfexe=''
16198 val="$undef"
16199 case "$d_readlink" in
16200     "$define")
16201         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16202         : more tidy to avoid an extra level of symlink
16203         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16204         while test $# -gt 0; do
16205             type=$1; try=$2
16206             shift; shift
16207             if $issymlink $try; then
16208                 $ls -l $try > reflect
16209                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16210                     echo "You have $type-like $try."
16211                     procselfexe='"'$try'"'
16212                     val="$define"
16213                     : This will break out of the loop
16214                     set X; shift
16215                 fi
16216             fi
16217         done
16218         ;;
16219 esac
16220 $rm -f reflect
16221 set d_procselfexe
16222 eval $setvar
16223
16224 : backward compatibility for d_hvfork
16225 if test X$d_hvfork != X; then
16226         d_vfork="$d_hvfork"
16227         d_hvfork=''
16228 fi
16229 : see if there is a vfork
16230 val=''
16231 set vfork val
16232 eval $inlibc
16233
16234 d_pseudofork=$undef
16235
16236 : Ok, but do we want to use it. vfork is reportedly unreliable in
16237 : perl on Solaris 2.x, and probably elsewhere.
16238 case "$val" in
16239 $define)
16240         echo " "
16241         case "$usevfork" in
16242         false) dflt='n';;
16243         *) dflt='y';;
16244         esac
16245         cat <<'EOM'
16246
16247 Perl can only use a vfork() that doesn't suffer from strict
16248 restrictions on calling functions or modifying global data in
16249 the child.  For example, glibc-2.1 contains such a vfork()
16250 that is unsuitable.  If your system provides a proper fork()
16251 call, chances are that you do NOT want perl to use vfork().
16252
16253 EOM
16254         rp="Do you still want to use vfork()?"
16255         . ./myread
16256         case "$ans" in
16257         y|Y) ;;
16258         *)
16259                 echo "Ok, we won't use vfork()."
16260                 val="$undef"
16261                 ;;
16262         esac
16263         ;;
16264 esac
16265 set d_vfork
16266 eval $setvar
16267 case "$d_vfork" in
16268 $define) usevfork='true';;
16269 *) usevfork='false';;
16270 esac
16271
16272 : see whether the pthread_atfork exists
16273 $cat >try.c <<EOP
16274 #include <pthread.h>
16275 #include <stdio.h>
16276 int main() {
16277 #ifdef  PTHREAD_ATFORK
16278         pthread_atfork(NULL,NULL,NULL);
16279 #endif
16280 }
16281 EOP
16282
16283 : see if pthread_atfork exists
16284 set try -DPTHREAD_ATFORK
16285 if eval $compile; then
16286     val="$define"
16287 else
16288     val="$undef"
16289 fi
16290 case "$usethreads" in
16291 $define)
16292         case "$val" in
16293         $define) echo 'pthread_atfork found.' >&4        ;;
16294         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16295         esac
16296 esac
16297 set d_pthread_atfork
16298 eval $setvar
16299
16300 : see if pthread_attr_setscope exists
16301 set pthread_attr_setscope d_pthread_attr_setscope
16302 eval $inlibc
16303
16304 : see whether the various POSIXish _yields exist
16305 $cat >try.c <<EOP
16306 #include <pthread.h>
16307 #include <stdio.h>
16308 int main() {
16309 #ifdef SCHED_YIELD
16310         sched_yield();
16311 #else
16312 #ifdef PTHREAD_YIELD
16313         pthread_yield();
16314 #else
16315 #ifdef PTHREAD_YIELD_NULL
16316         pthread_yield(NULL);
16317 #endif
16318 #endif
16319 #endif
16320 }
16321 EOP
16322 : see if sched_yield exists
16323 set try -DSCHED_YIELD
16324 if eval $compile; then
16325     val="$define"
16326     sched_yield='sched_yield()'
16327 else
16328     val="$undef"
16329 fi
16330 case "$usethreads" in
16331 $define)
16332         case "$val" in
16333         $define) echo 'sched_yield() found.' >&4        ;;
16334         *)       echo 'sched_yield() NOT found.' >&4    ;;
16335         esac
16336 esac
16337 set d_sched_yield
16338 eval $setvar
16339
16340 : see if pthread_yield exists
16341 set try -DPTHREAD_YIELD
16342 if eval $compile; then
16343     val="$define"
16344     case "$sched_yield" in
16345     '') sched_yield='pthread_yield()' ;;
16346     esac
16347 else
16348     set try -DPTHREAD_YIELD_NULL
16349     if eval $compile; then
16350         val="$define"
16351         case "$sched_yield" in
16352         '') sched_yield='pthread_yield(NULL)' ;;
16353         esac
16354     else
16355         val="$undef"
16356     fi
16357 fi
16358 case "$usethreads" in
16359 $define)
16360         case "$val" in
16361         $define) echo 'pthread_yield() found.' >&4      ;;
16362         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16363         esac
16364         ;;
16365 esac
16366 set d_pthread_yield
16367 eval $setvar
16368 case "$sched_yield" in
16369 '') sched_yield=undef ;;
16370 esac
16371 $rm_try
16372
16373 : see if random_r exists
16374 set random_r d_random_r
16375 eval $inlibc
16376 case "$d_random_r" in
16377 "$define")
16378         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16379         case "$d_random_r_proto:$usethreads" in
16380         ":define")      d_random_r_proto=define
16381                 set d_random_r_proto random_r $hdrs
16382                 eval $hasproto ;;
16383         *)      ;;
16384         esac
16385         case "$d_random_r_proto" in
16386         define)
16387         case "$random_r_proto" in
16388         ''|0) try='int random_r(int*, struct random_data*);'
16389         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16390         esac
16391         case "$random_r_proto" in
16392         ''|0) try='int random_r(long*, struct random_data*);'
16393         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16394         esac
16395         case "$random_r_proto" in
16396         ''|0) try='int random_r(struct random_data*, int32_t*);'
16397         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16398         esac
16399         case "$random_r_proto" in
16400         ''|0)   d_random_r=undef
16401                 random_r_proto=0
16402                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16403         * )     case "$random_r_proto" in
16404                 REENTRANT_PROTO*) ;;
16405                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16406                 esac
16407                 echo "Prototype: $try" ;;
16408         esac
16409         ;;
16410         *)      case "$usethreads" in
16411                 define) echo "random_r has no prototype, not using it." >&4 ;;
16412                 esac
16413                 d_random_r=undef
16414                 random_r_proto=0
16415                 ;;
16416         esac
16417         ;;
16418 *)      random_r_proto=0
16419         ;;
16420 esac
16421
16422 : see if readdir and friends exist
16423 set readdir d_readdir
16424 eval $inlibc
16425 set seekdir d_seekdir
16426 eval $inlibc
16427 set telldir d_telldir
16428 eval $inlibc
16429 set rewinddir d_rewinddir
16430 eval $inlibc
16431
16432 : see if readdir64_r exists
16433 set readdir64_r d_readdir64_r
16434 eval $inlibc
16435 case "$d_readdir64_r" in
16436 "$define")
16437         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16438         case "$d_readdir64_r_proto:$usethreads" in
16439         ":define")      d_readdir64_r_proto=define
16440                 set d_readdir64_r_proto readdir64_r $hdrs
16441                 eval $hasproto ;;
16442         *)      ;;
16443         esac
16444         case "$d_readdir64_r_proto" in
16445         define)
16446         case "$readdir64_r_proto" in
16447         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16448         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16449         esac
16450         case "$readdir64_r_proto" in
16451         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16452         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16453         esac
16454         case "$readdir64_r_proto" in
16455         ''|0)   d_readdir64_r=undef
16456                 readdir64_r_proto=0
16457                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16458         * )     case "$readdir64_r_proto" in
16459                 REENTRANT_PROTO*) ;;
16460                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16461                 esac
16462                 echo "Prototype: $try" ;;
16463         esac
16464         ;;
16465         *)      case "$usethreads" in
16466                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16467                 esac
16468                 d_readdir64_r=undef
16469                 readdir64_r_proto=0
16470                 ;;
16471         esac
16472         ;;
16473 *)      readdir64_r_proto=0
16474         ;;
16475 esac
16476
16477 : see if readdir_r exists
16478 set readdir_r d_readdir_r
16479 eval $inlibc
16480 case "$d_readdir_r" in
16481 "$define")
16482         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16483         case "$d_readdir_r_proto:$usethreads" in
16484         ":define")      d_readdir_r_proto=define
16485                 set d_readdir_r_proto readdir_r $hdrs
16486                 eval $hasproto ;;
16487         *)      ;;
16488         esac
16489         case "$d_readdir_r_proto" in
16490         define)
16491         case "$readdir_r_proto" in
16492         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16493         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16494         esac
16495         case "$readdir_r_proto" in
16496         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16497         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16498         esac
16499         case "$readdir_r_proto" in
16500         ''|0)   d_readdir_r=undef
16501                 readdir_r_proto=0
16502                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16503         * )     case "$readdir_r_proto" in
16504                 REENTRANT_PROTO*) ;;
16505                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16506                 esac
16507                 echo "Prototype: $try" ;;
16508         esac
16509         ;;
16510         *)      case "$usethreads" in
16511                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16512                 esac
16513                 d_readdir_r=undef
16514                 readdir_r_proto=0
16515                 ;;
16516         esac
16517         ;;
16518 *)      readdir_r_proto=0
16519         ;;
16520 esac
16521
16522 : see if readv exists
16523 set readv d_readv
16524 eval $inlibc
16525
16526 : see if recvmsg exists
16527 set recvmsg d_recvmsg
16528 eval $inlibc
16529
16530 : see if rename exists
16531 set rename d_rename
16532 eval $inlibc
16533
16534 : see if rmdir exists
16535 set rmdir d_rmdir
16536 eval $inlibc
16537
16538 : see if memory.h is available.
16539 val=''
16540 set memory.h val
16541 eval $inhdr
16542
16543 : See if it conflicts with string.h
16544 case "$val" in
16545 $define)
16546         case "$strings" in
16547         '') ;;
16548         *)
16549                 $cppstdin $cppflags $cppminus < $strings > mem.h
16550                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16551                         echo " "
16552                         echo "We won't be including <memory.h>."
16553                         val="$undef"
16554                 fi
16555                 $rm -f mem.h
16556                 ;;
16557         esac
16558 esac
16559 set i_memory
16560 eval $setvar
16561
16562 : can bcopy handle overlapping blocks?
16563 echo " "
16564 val="$undef"
16565 case "$d_memmove" in
16566 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16567 *)      case "$d_bcopy" in
16568         "$define")
16569                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16570                 $cat >try.c <<EOCP
16571 #$i_memory I_MEMORY
16572 #$i_stdlib I_STDLIB
16573 #$i_string I_STRING
16574 #$i_unistd I_UNISTD
16575 EOCP
16576         $cat >>try.c <<'EOCP'
16577 #include <stdio.h>
16578 #ifdef I_MEMORY
16579 #  include <memory.h>
16580 #endif
16581 #ifdef I_STDLIB
16582 #  include <stdlib.h>
16583 #endif
16584 #ifdef I_STRING
16585 #  include <string.h>
16586 #else
16587 #  include <strings.h>
16588 #endif
16589 #ifdef I_UNISTD
16590 #  include <unistd.h>  /* Needed for NetBSD */
16591 #endif
16592 int main()
16593 {
16594 char buf[128], abc[128];
16595 char *b;
16596 int len;
16597 int off;
16598 int align;
16599
16600 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16601    try to store the string in read-only memory. */
16602 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16603
16604 for (align = 7; align >= 0; align--) {
16605         for (len = 36; len; len--) {
16606                 b = buf+align;
16607                 bcopy(abc, b, len);
16608                 for (off = 1; off <= len; off++) {
16609                         bcopy(b, b+off, len);
16610                         bcopy(b+off, b, len);
16611                         if (bcmp(b, abc, len))
16612                                 exit(1);
16613                 }
16614         }
16615 }
16616 exit(0);
16617 }
16618 EOCP
16619                 set try
16620                 if eval $compile_ok; then
16621                         if $run ./try 2>/dev/null; then
16622                                 echo "Yes, it can."
16623                                 val="$define"
16624                         else
16625                                 echo "It can't, sorry."
16626                         fi
16627                 else
16628                         echo "(I can't compile the test program, so we'll assume not...)"
16629                 fi
16630                 ;;
16631         esac
16632         $rm_try
16633         ;;
16634 esac
16635 set d_safebcpy
16636 eval $setvar
16637
16638 : can memcpy handle overlapping blocks?
16639 echo " "
16640 val="$undef"
16641 case "$d_memmove" in
16642 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16643 *)      case "$d_memcpy" in
16644         "$define")
16645                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16646                 $cat >try.c <<EOCP
16647 #$i_memory I_MEMORY
16648 #$i_stdlib I_STDLIB
16649 #$i_string I_STRING
16650 #$i_unistd I_UNISTD
16651 EOCP
16652         $cat >>try.c <<'EOCP'
16653 #include <stdio.h>
16654 #ifdef I_MEMORY
16655 #  include <memory.h>
16656 #endif
16657 #ifdef I_STDLIB
16658 #  include <stdlib.h>
16659 #endif
16660 #ifdef I_STRING
16661 #  include <string.h>
16662 #else
16663 #  include <strings.h>
16664 #endif
16665 #ifdef I_UNISTD
16666 #  include <unistd.h>  /* Needed for NetBSD */
16667 #endif
16668 int main()
16669 {
16670 char buf[128], abc[128];
16671 char *b;
16672 int len;
16673 int off;
16674 int align;
16675
16676 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16677    try to store the string in read-only memory. */
16678 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16679
16680 for (align = 7; align >= 0; align--) {
16681         for (len = 36; len; len--) {
16682                 b = buf+align;
16683                 memcpy(b, abc, len);
16684                 for (off = 1; off <= len; off++) {
16685                         memcpy(b+off, b, len);
16686                         memcpy(b, b+off, len);
16687                         if (memcmp(b, abc, len))
16688                                 exit(1);
16689                 }
16690         }
16691 }
16692 exit(0);
16693 }
16694 EOCP
16695                 set try
16696                 if eval $compile_ok; then
16697                         if $run ./try 2>/dev/null; then
16698                                 echo "Yes, it can."
16699                                 val="$define"
16700                         else
16701                                 echo "It can't, sorry."
16702                         fi
16703                 else
16704                         echo "(I can't compile the test program, so we'll assume not...)"
16705                 fi
16706                 ;;
16707         esac
16708         $rm_try
16709         ;;
16710 esac
16711 set d_safemcpy
16712 eval $setvar
16713
16714 : can memcmp be trusted to compare relative magnitude?
16715 val="$undef"
16716 case "$d_memcmp" in
16717 "$define")
16718         echo " "
16719         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16720         $cat >try.c <<EOCP
16721 #$i_memory I_MEMORY
16722 #$i_stdlib I_STDLIB
16723 #$i_string I_STRING
16724 #$i_unistd I_UNISTD
16725 EOCP
16726         $cat >>try.c <<'EOCP'
16727 #include <stdio.h>
16728 #ifdef I_MEMORY
16729 #  include <memory.h>
16730 #endif
16731 #ifdef I_STDLIB
16732 #  include <stdlib.h>
16733 #endif
16734 #ifdef I_STRING
16735 #  include <string.h>
16736 #else
16737 #  include <strings.h>
16738 #endif
16739 #ifdef I_UNISTD
16740 #  include <unistd.h>  /* Needed for NetBSD */
16741 #endif
16742 int main()
16743 {
16744 char a = -1;
16745 char b = 0;
16746 if ((a < b) && memcmp(&a, &b, 1) < 0)
16747         exit(1);
16748 exit(0);
16749 }
16750 EOCP
16751         set try
16752         if eval $compile_ok; then
16753                 if $run ./try 2>/dev/null; then
16754                         echo "Yes, it can."
16755                         val="$define"
16756                 else
16757                         echo "No, it can't (it uses signed chars)."
16758                 fi
16759         else
16760                 echo "(I can't compile the test program, so we'll assume not...)"
16761         fi
16762         ;;
16763 esac
16764 $rm_try
16765 set d_sanemcmp
16766 eval $setvar
16767
16768 : see if prototype for sbrk is available
16769 echo " "
16770 set d_sbrkproto sbrk $i_unistd unistd.h
16771 eval $hasproto
16772
16773 : see if select exists
16774 set select d_select
16775 eval $inlibc
16776
16777 : see if semctl exists
16778 set semctl d_semctl
16779 eval $inlibc
16780
16781 : see if semget exists
16782 set semget d_semget
16783 eval $inlibc
16784
16785 : see if semop exists
16786 set semop d_semop
16787 eval $inlibc
16788
16789 : see how much of the 'sem*(2)' library is present.
16790 h_sem=true
16791 echo " "
16792 case "$d_semctl$d_semget$d_semop" in
16793 *"$undef"*) h_sem=false;;
16794 esac
16795 case "$osname" in
16796 freebsd)
16797     case "`ipcs 2>&1`" in
16798     "SVID messages"*"not configured"*)
16799         echo "Your $osname does not have the sem*(2) configured." >&4
16800         h_sem=false
16801         val="$undef"
16802         set semctl d_semctl
16803         eval $setvar
16804         set semget d_semget
16805         eval $setvar
16806         set semop d_semop
16807         eval $setvar
16808         ;;
16809     esac
16810     ;;
16811 esac
16812 : we could also check for sys/ipc.h ...
16813 if $h_sem && $test `./findhdr sys/sem.h`; then
16814         echo "You have the full sem*(2) library." >&4
16815         val="$define"
16816 else
16817         echo "You don't have the full sem*(2) library." >&4
16818         val="$undef"
16819 fi
16820 set d_sem
16821 eval $setvar
16822
16823 : see whether sys/sem.h defines union semun
16824 echo " "
16825 $cat > try.c <<'END'
16826 #include <sys/types.h>
16827 #include <sys/ipc.h>
16828 #include <sys/sem.h>
16829 int main () { union semun semun; semun.buf = 0; }
16830 END
16831 set try
16832 if eval $compile; then
16833     echo "You have union semun in <sys/sem.h>." >&4
16834     val="$define"
16835 else
16836     echo "You do not have union semun in <sys/sem.h>." >&4
16837     val="$undef"
16838 fi
16839 $rm_try
16840 set d_union_semun
16841 eval $setvar
16842
16843 : see how to do semctl IPC_STAT
16844 case "$d_sem" in
16845 $define)
16846     echo " "
16847     $cat > tryh.h <<END
16848 #ifndef S_IRUSR
16849 #   ifdef S_IREAD
16850 #       define S_IRUSR S_IREAD
16851 #       define S_IWUSR S_IWRITE
16852 #       define S_IXUSR S_IEXEC
16853 #   else
16854 #       define S_IRUSR 0400
16855 #       define S_IWUSR 0200
16856 #       define S_IXUSR 0100
16857 #   endif
16858 #   define S_IRGRP (S_IRUSR>>3)
16859 #   define S_IWGRP (S_IWUSR>>3)
16860 #   define S_IXGRP (S_IXUSR>>3)
16861 #   define S_IROTH (S_IRUSR>>6)
16862 #   define S_IWOTH (S_IWUSR>>6)
16863 #   define S_IXOTH (S_IXUSR>>6)
16864 #endif
16865 #ifndef S_IRWXU
16866 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16867 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16868 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16869 #endif
16870 END
16871     : see whether semctl IPC_STAT can use union semun
16872     case "$d_semctl_semun" in
16873     '')
16874       val="$undef"
16875       $cat > try.c <<END
16876 #include <sys/types.h>
16877 #include <sys/ipc.h>
16878 #include <sys/sem.h>
16879 #include <sys/stat.h>
16880 #include <stdio.h>
16881 #include <errno.h>
16882 #include "tryh.h"
16883 #ifndef errno
16884 extern int errno;
16885 #endif
16886 #$d_union_semun HAS_UNION_SEMUN
16887 int main() {
16888     union semun
16889 #ifndef HAS_UNION_SEMUN
16890     {
16891         int val;
16892         struct semid_ds *buf;
16893         unsigned short *array;
16894     }
16895 #endif
16896     arg;
16897     int sem, st;
16898
16899 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16900     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16901     if (sem > -1) {
16902         struct semid_ds argbuf;
16903         arg.buf = &argbuf;
16904 #       ifdef IPC_STAT
16905         st = semctl(sem, 0, IPC_STAT, arg);
16906         if (st == 0)
16907             printf("semun\n");
16908         else
16909 #       endif /* IPC_STAT */
16910             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16911 #       ifdef IPC_RMID
16912         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16913 #       endif /* IPC_RMID */
16914             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16915     } else
16916 #endif /* IPC_PRIVATE && ... */
16917         printf("semget failed: errno = %d\n", errno);
16918   return 0;
16919 }
16920 END
16921       set try
16922       if eval $compile; then
16923           xxx=`$run ./try`
16924           case "$xxx" in
16925           semun) val="$define" ;;
16926           esac
16927       fi
16928       $rm_try
16929       set d_semctl_semun
16930       eval $setvar
16931       ;;
16932     esac
16933     case "$d_semctl_semun" in
16934     $define)
16935         echo "You can use union semun for semctl IPC_STAT." >&4
16936         also='also'
16937         ;;
16938     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16939         also=''
16940         ;;
16941     esac
16942
16943     : see whether semctl IPC_STAT can use struct semid_ds pointer
16944     case "$d_semctl_semid_ds" in
16945     '')
16946       val="$undef"
16947       $cat > try.c <<'END'
16948 #include <sys/types.h>
16949 #include <sys/ipc.h>
16950 #include <sys/sem.h>
16951 #include <sys/stat.h>
16952 #include "tryh.h"
16953 #include <stdio.h>
16954 #include <errno.h>
16955 #ifndef errno
16956 extern int errno;
16957 #endif
16958 int main() {
16959     struct semid_ds arg;
16960     int sem, st;
16961
16962 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16963     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16964     if (sem > -1) {
16965 #       ifdef IPC_STAT
16966         st = semctl(sem, 0, IPC_STAT, &arg);
16967         if (st == 0)
16968             printf("semid_ds\n");
16969         else
16970 #       endif /* IPC_STAT */
16971             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16972 #       ifdef IPC_RMID
16973         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16974 #       endif /* IPC_RMID */
16975             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16976     } else
16977 #endif /* IPC_PRIVATE && ... */
16978         printf("semget failed: errno = %d\n", errno);
16979
16980     return 0;
16981 }
16982 END
16983       set try
16984       if eval $compile; then
16985           xxx=`$run ./try`
16986           case "$xxx" in
16987           semid_ds) val="$define" ;;
16988           esac
16989       fi
16990       $rm_try
16991       set d_semctl_semid_ds
16992       eval $setvar
16993       ;;
16994     esac
16995     case "$d_semctl_semid_ds" in
16996     $define)
16997         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16998         ;;
16999     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
17000         ;;
17001     esac
17002     ;;
17003 *)  val="$undef"
17004
17005     # We do not have the full sem*(2) library, so assume we can not
17006     # use either.
17007
17008     set d_semctl_semun
17009     eval $setvar
17010
17011     set d_semctl_semid_ds
17012     eval $setvar
17013     ;;
17014 esac
17015 $rm_try tryh.h
17016
17017 : see if sendmsg exists
17018 set sendmsg d_sendmsg
17019 eval $inlibc
17020
17021 : see if setegid exists
17022 set setegid d_setegid
17023 eval $inlibc
17024
17025 : see if seteuid exists
17026 set seteuid d_seteuid
17027 eval $inlibc
17028
17029 : see if setgrent exists
17030 set setgrent d_setgrent
17031 eval $inlibc
17032
17033 : see if setgrent_r exists
17034 set setgrent_r d_setgrent_r
17035 eval $inlibc
17036 case "$d_setgrent_r" in
17037 "$define")
17038         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
17039         case "$d_setgrent_r_proto:$usethreads" in
17040         ":define")      d_setgrent_r_proto=define
17041                 set d_setgrent_r_proto setgrent_r $hdrs
17042                 eval $hasproto ;;
17043         *)      ;;
17044         esac
17045         case "$d_setgrent_r_proto" in
17046         define)
17047         case "$setgrent_r_proto" in
17048         ''|0) try='int setgrent_r(FILE**);'
17049         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
17050         esac
17051         case "$setgrent_r_proto" in
17052         ''|0) try='void setgrent_r(FILE**);'
17053         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
17054         esac
17055         case "$setgrent_r_proto" in
17056         ''|0)   d_setgrent_r=undef
17057                 setgrent_r_proto=0
17058                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
17059         * )     case "$setgrent_r_proto" in
17060                 REENTRANT_PROTO*) ;;
17061                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
17062                 esac
17063                 echo "Prototype: $try" ;;
17064         esac
17065         ;;
17066         *)      case "$usethreads" in
17067                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
17068                 esac
17069                 d_setgrent_r=undef
17070                 setgrent_r_proto=0
17071                 ;;
17072         esac
17073         ;;
17074 *)      setgrent_r_proto=0
17075         ;;
17076 esac
17077
17078 : see if sethostent exists
17079 set sethostent d_sethent
17080 eval $inlibc
17081
17082 : see if sethostent_r exists
17083 set sethostent_r d_sethostent_r
17084 eval $inlibc
17085 case "$d_sethostent_r" in
17086 "$define")
17087         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17088         case "$d_sethostent_r_proto:$usethreads" in
17089         ":define")      d_sethostent_r_proto=define
17090                 set d_sethostent_r_proto sethostent_r $hdrs
17091                 eval $hasproto ;;
17092         *)      ;;
17093         esac
17094         case "$d_sethostent_r_proto" in
17095         define)
17096         case "$sethostent_r_proto" in
17097         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17098         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17099         esac
17100         case "$sethostent_r_proto" in
17101         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17102         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17103         esac
17104         case "$sethostent_r_proto" in
17105         ''|0)   d_sethostent_r=undef
17106                 sethostent_r_proto=0
17107                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17108         * )     case "$sethostent_r_proto" in
17109                 REENTRANT_PROTO*) ;;
17110                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17111                 esac
17112                 echo "Prototype: $try" ;;
17113         esac
17114         ;;
17115         *)      case "$usethreads" in
17116                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17117                 esac
17118                 d_sethostent_r=undef
17119                 sethostent_r_proto=0
17120                 ;;
17121         esac
17122         ;;
17123 *)      sethostent_r_proto=0
17124         ;;
17125 esac
17126
17127 : see if setitimer exists
17128 set setitimer d_setitimer
17129 eval $inlibc
17130
17131 : see if setlinebuf exists
17132 set setlinebuf d_setlinebuf
17133 eval $inlibc
17134
17135 : see if setlocale exists
17136 set setlocale d_setlocale
17137 eval $inlibc
17138
17139 : see if locale.h is available
17140 set locale.h i_locale
17141 eval $inhdr
17142
17143 : see if setlocale_r exists
17144 set setlocale_r d_setlocale_r
17145 eval $inlibc
17146 case "$d_setlocale_r" in
17147 "$define")
17148         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17149         case "$d_setlocale_r_proto:$usethreads" in
17150         ":define")      d_setlocale_r_proto=define
17151                 set d_setlocale_r_proto setlocale_r $hdrs
17152                 eval $hasproto ;;
17153         *)      ;;
17154         esac
17155         case "$d_setlocale_r_proto" in
17156         define)
17157         case "$setlocale_r_proto" in
17158         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17159         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17160         esac
17161         case "$setlocale_r_proto" in
17162         ''|0)   d_setlocale_r=undef
17163                 setlocale_r_proto=0
17164                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17165         * )     case "$setlocale_r_proto" in
17166                 REENTRANT_PROTO*) ;;
17167                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17168                 esac
17169                 echo "Prototype: $try" ;;
17170         esac
17171         ;;
17172         *)      case "$usethreads" in
17173                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17174                 esac
17175                 d_setlocale_r=undef
17176                 setlocale_r_proto=0
17177                 ;;
17178         esac
17179         ;;
17180 *)      setlocale_r_proto=0
17181         ;;
17182 esac
17183
17184 : see if setnetent exists
17185 set setnetent d_setnent
17186 eval $inlibc
17187
17188 : see if setnetent_r exists
17189 set setnetent_r d_setnetent_r
17190 eval $inlibc
17191 case "$d_setnetent_r" in
17192 "$define")
17193         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17194         case "$d_setnetent_r_proto:$usethreads" in
17195         ":define")      d_setnetent_r_proto=define
17196                 set d_setnetent_r_proto setnetent_r $hdrs
17197                 eval $hasproto ;;
17198         *)      ;;
17199         esac
17200         case "$d_setnetent_r_proto" in
17201         define)
17202         case "$setnetent_r_proto" in
17203         ''|0) try='int setnetent_r(int, struct netent_data*);'
17204         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17205         esac
17206         case "$setnetent_r_proto" in
17207         ''|0) try='void setnetent_r(int, struct netent_data*);'
17208         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17209         esac
17210         case "$setnetent_r_proto" in
17211         ''|0)   d_setnetent_r=undef
17212                 setnetent_r_proto=0
17213                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17214         * )     case "$setnetent_r_proto" in
17215                 REENTRANT_PROTO*) ;;
17216                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17217                 esac
17218                 echo "Prototype: $try" ;;
17219         esac
17220         ;;
17221         *)      case "$usethreads" in
17222                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17223                 esac
17224                 d_setnetent_r=undef
17225                 setnetent_r_proto=0
17226                 ;;
17227         esac
17228         ;;
17229 *)      setnetent_r_proto=0
17230         ;;
17231 esac
17232
17233 : see if setprotoent exists
17234 set setprotoent d_setpent
17235 eval $inlibc
17236
17237 : see if setpgid exists
17238 set setpgid d_setpgid
17239 eval $inlibc
17240
17241 : see if setpgrp2 exists
17242 set setpgrp2 d_setpgrp2
17243 eval $inlibc
17244
17245 : see if setpriority exists
17246 set setpriority d_setprior
17247 eval $inlibc
17248
17249 : see if setproctitle exists
17250 set setproctitle d_setproctitle
17251 eval $inlibc
17252
17253 : see if setprotoent_r exists
17254 set setprotoent_r d_setprotoent_r
17255 eval $inlibc
17256 case "$d_setprotoent_r" in
17257 "$define")
17258         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17259         case "$d_setprotoent_r_proto:$usethreads" in
17260         ":define")      d_setprotoent_r_proto=define
17261                 set d_setprotoent_r_proto setprotoent_r $hdrs
17262                 eval $hasproto ;;
17263         *)      ;;
17264         esac
17265         case "$d_setprotoent_r_proto" in
17266         define)
17267         case "$setprotoent_r_proto" in
17268         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17269         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17270         esac
17271         case "$setprotoent_r_proto" in
17272         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17273         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17274         esac
17275         case "$setprotoent_r_proto" in
17276         ''|0)   d_setprotoent_r=undef
17277                 setprotoent_r_proto=0
17278                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17279         * )     case "$setprotoent_r_proto" in
17280                 REENTRANT_PROTO*) ;;
17281                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17282                 esac
17283                 echo "Prototype: $try" ;;
17284         esac
17285         ;;
17286         *)      case "$usethreads" in
17287                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17288                 esac
17289                 d_setprotoent_r=undef
17290                 setprotoent_r_proto=0
17291                 ;;
17292         esac
17293         ;;
17294 *)      setprotoent_r_proto=0
17295         ;;
17296 esac
17297
17298 : see if setpwent exists
17299 set setpwent d_setpwent
17300 eval $inlibc
17301
17302 : see if setpwent_r exists
17303 set setpwent_r d_setpwent_r
17304 eval $inlibc
17305 case "$d_setpwent_r" in
17306 "$define")
17307         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17308         case "$d_setpwent_r_proto:$usethreads" in
17309         ":define")      d_setpwent_r_proto=define
17310                 set d_setpwent_r_proto setpwent_r $hdrs
17311                 eval $hasproto ;;
17312         *)      ;;
17313         esac
17314         case "$d_setpwent_r_proto" in
17315         define)
17316         case "$setpwent_r_proto" in
17317         ''|0) try='int setpwent_r(FILE**);'
17318         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17319         esac
17320         case "$setpwent_r_proto" in
17321         ''|0) try='void setpwent_r(FILE**);'
17322         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17323         esac
17324         case "$setpwent_r_proto" in
17325         ''|0)   d_setpwent_r=undef
17326                 setpwent_r_proto=0
17327                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17328         * )     case "$setpwent_r_proto" in
17329                 REENTRANT_PROTO*) ;;
17330                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17331                 esac
17332                 echo "Prototype: $try" ;;
17333         esac
17334         ;;
17335         *)      case "$usethreads" in
17336                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17337                 esac
17338                 d_setpwent_r=undef
17339                 setpwent_r_proto=0
17340                 ;;
17341         esac
17342         ;;
17343 *)      setpwent_r_proto=0
17344         ;;
17345 esac
17346
17347 : see if setregid exists
17348 set setregid d_setregid
17349 eval $inlibc
17350 set setresgid d_setresgid
17351 eval $inlibc
17352
17353 : see if setreuid exists
17354 set setreuid d_setreuid
17355 eval $inlibc
17356 set setresuid d_setresuid
17357 eval $inlibc
17358
17359 : see if setrgid exists
17360 set setrgid d_setrgid
17361 eval $inlibc
17362
17363 : see if setruid exists
17364 set setruid d_setruid
17365 eval $inlibc
17366
17367 : see if setservent exists
17368 set setservent d_setsent
17369 eval $inlibc
17370
17371 : see if setservent_r exists
17372 set setservent_r d_setservent_r
17373 eval $inlibc
17374 case "$d_setservent_r" in
17375 "$define")
17376         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17377         case "$d_setservent_r_proto:$usethreads" in
17378         ":define")      d_setservent_r_proto=define
17379                 set d_setservent_r_proto setservent_r $hdrs
17380                 eval $hasproto ;;
17381         *)      ;;
17382         esac
17383         case "$d_setservent_r_proto" in
17384         define)
17385         case "$setservent_r_proto" in
17386         ''|0) try='int setservent_r(int, struct servent_data*);'
17387         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17388         esac
17389         case "$setservent_r_proto" in
17390         ''|0) try='void setservent_r(int, struct servent_data*);'
17391         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17392         esac
17393         case "$setservent_r_proto" in
17394         ''|0)   d_setservent_r=undef
17395                 setservent_r_proto=0
17396                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17397         * )     case "$setservent_r_proto" in
17398                 REENTRANT_PROTO*) ;;
17399                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17400                 esac
17401                 echo "Prototype: $try" ;;
17402         esac
17403         ;;
17404         *)      case "$usethreads" in
17405                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17406                 esac
17407                 d_setservent_r=undef
17408                 setservent_r_proto=0
17409                 ;;
17410         esac
17411         ;;
17412 *)      setservent_r_proto=0
17413         ;;
17414 esac
17415
17416 : see if setsid exists
17417 set setsid d_setsid
17418 eval $inlibc
17419
17420 : see if setvbuf exists
17421 set setvbuf d_setvbuf
17422 eval $inlibc
17423
17424 : see if sfio.h is available
17425 set sfio.h i_sfio
17426 eval $inhdr
17427
17428 : see if sfio library is available
17429 case "$i_sfio" in
17430 $define)
17431         val=''
17432         set sfreserve val
17433         eval $inlibc
17434         ;;
17435 *)
17436         val="$undef"
17437         ;;
17438 esac
17439 : Ok, but do we want to use it.
17440 case "$val" in
17441 $define)
17442         case "$usesfio" in
17443         true|$define|[yY]*) dflt='y';;
17444         *) dflt='n';;
17445         esac
17446         echo "$package can use the sfio library, but it is experimental."
17447         rp="You seem to have sfio available, do you want to try using it?"
17448         . ./myread
17449         case "$ans" in
17450         y|Y)    echo "Ok, turning on sfio then."
17451                 val="$define"
17452                 ;;
17453         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17454                 val="$undef"
17455                 ;;
17456         esac
17457         ;;
17458 *)      case "$usesfio" in
17459         true|$define|[yY]*)
17460                 echo "Sorry, cannot find sfio on this machine." >&4
17461                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17462                 val="$undef"
17463                 ;;
17464         esac
17465         ;;
17466 esac
17467 set d_sfio
17468 eval $setvar
17469 case "$d_sfio" in
17470 $define) usesfio='true';;
17471 *) usesfio='false';;
17472 esac
17473 case "$d_sfio" in
17474 $define) ;;
17475 *)      : Remove sfio from list of libraries to use
17476         case "$libs" in
17477         *-lsfio*)
17478                 echo "Removing unneeded -lsfio from library list" >&4
17479                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17480                 shift
17481                 libs="$*"
17482                 echo "libs = $libs" >&4
17483                 ;;
17484         esac
17485 ;;
17486 esac
17487
17488
17489 : see if shmctl exists
17490 set shmctl d_shmctl
17491 eval $inlibc
17492
17493 : see if shmget exists
17494 set shmget d_shmget
17495 eval $inlibc
17496
17497 : see if shmat exists
17498 set shmat d_shmat
17499 eval $inlibc
17500 : see what shmat returns
17501 case "$d_shmat" in
17502 "$define")
17503         $cat >shmat.c <<'END'
17504 #include <sys/shm.h>
17505 void *shmat();
17506 END
17507         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17508                 shmattype='void *'
17509         else
17510                 shmattype='char *'
17511         fi
17512         echo "and it returns ($shmattype)." >&4
17513         : see if a prototype for shmat is available
17514         xxx=`./findhdr sys/shm.h`
17515         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17516         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17517                 val="$define"
17518         else
17519                 val="$undef"
17520         fi
17521         $rm -f shmat.[co]
17522         ;;
17523 *)
17524         val="$undef"
17525         ;;
17526 esac
17527 set d_shmatprototype
17528 eval $setvar
17529
17530 : see if shmdt exists
17531 set shmdt d_shmdt
17532 eval $inlibc
17533
17534 : see how much of the 'shm*(2)' library is present.
17535 h_shm=true
17536 echo " "
17537 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17538 *"$undef"*) h_shm=false;;
17539 esac
17540 case "$osname" in
17541 freebsd)
17542     case "`ipcs 2>&1`" in
17543     "SVID shared memory"*"not configured"*)
17544         echo "Your $osname does not have the shm*(2) configured." >&4
17545         h_shm=false
17546         val="$undef"
17547         set shmctl d_shmctl
17548         evat $setvar
17549         set shmget d_shmget
17550         evat $setvar
17551         set shmat d_shmat
17552         evat $setvar
17553         set shmdt d_shmdt
17554         evat $setvar
17555         ;;
17556     esac
17557     ;;
17558 esac
17559 : we could also check for sys/ipc.h ...
17560 if $h_shm && $test `./findhdr sys/shm.h`; then
17561         echo "You have the full shm*(2) library." >&4
17562         val="$define"
17563 else
17564         echo "You don't have the full shm*(2) library." >&4
17565         val="$undef"
17566 fi
17567 set d_shm
17568 eval $setvar
17569
17570 : see if we have sigaction
17571 echo " "
17572 if set sigaction val -f d_sigaction; eval $csym; $val; then
17573         echo 'sigaction() found.' >&4
17574         $cat > try.c <<EOP
17575 #include <stdio.h>
17576 #include <sys/types.h>
17577 #include <signal.h>
17578 #$i_stdlib I_STDLIB
17579 #ifdef I_STDLIB
17580 #include <stdlib.h>
17581 #endif
17582 int main()
17583 {
17584     struct sigaction act, oact;
17585     act.sa_flags = 0;
17586     oact.sa_handler = 0;
17587     /* so that act and oact are used */
17588     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17589 }
17590 EOP
17591         set try
17592         if eval $compile_ok; then
17593                 val="$define"
17594         else
17595                 echo "But you don't seem to have a usable struct sigaction." >&4
17596                 val="$undef"
17597         fi
17598 else
17599         echo 'sigaction NOT found.' >&4
17600         val="$undef"
17601 fi
17602 set d_sigaction; eval $setvar
17603 $rm_try
17604
17605 : see if this is a sunmath.h system
17606 set sunmath.h i_sunmath
17607 eval $inhdr
17608
17609 : see if signbit exists
17610 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17611 $cat >try.c <<EOCP
17612 #$i_math I_MATH
17613 #$i_sunmath I_SUNMATH
17614 #ifdef I_MATH
17615 #  include <math.h>
17616 #endif
17617 #ifdef I_SUNMATH  /* Solaris special math library */
17618 #  include <sunmath.h>
17619 #endif
17620 #define NV $nvtype
17621 int main(int argc, char **argv)
17622 {
17623     NV x = 0.0;
17624     NV y = -0.0;
17625     if ((signbit(x) == 0) && (signbit(y) != 0))
17626         return 0;
17627     else
17628         return 1;
17629 }
17630 EOCP
17631 val="$undef"
17632 set try
17633 if eval $compile; then
17634     if $run ./try; then
17635         $echo "Yes." >&4
17636         val="$define"
17637     else
17638         $echo "Signbit seems to be available, but doesn't work as I expected."
17639         $echo "I won't use it." >&4
17640         val="$undef"
17641     fi
17642 else
17643     $echo "Nope." >&4
17644     dflt="$undef"
17645 fi
17646 set d_signbit
17647 eval $setvar
17648 $rm_try
17649
17650 : see if sigprocmask exists
17651 set sigprocmask d_sigprocmask
17652 eval $inlibc
17653
17654 : see if sigsetjmp exists
17655 echo " "
17656 case "$d_sigsetjmp" in
17657 '')
17658         $cat >try.c <<EOP
17659 #include <setjmp.h>
17660 #$i_stdlib I_STDLIB
17661 #ifdef I_STDLIB
17662 #include <stdlib.h>
17663 #endif
17664 sigjmp_buf env;
17665 int set = 1;
17666 int main()
17667 {
17668         if (sigsetjmp(env,1))
17669                 exit(set);
17670         set = 0;
17671         siglongjmp(env, 1);
17672         exit(1);
17673 }
17674 EOP
17675         set try
17676         if eval $compile; then
17677                 if $run ./try >/dev/null 2>&1; then
17678                         echo "POSIX sigsetjmp found." >&4
17679                         val="$define"
17680                 else
17681                         $cat >&4 <<EOM
17682 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17683 I'll ignore them.
17684 EOM
17685                         val="$undef"
17686                 fi
17687         else
17688                 echo "sigsetjmp not found." >&4
17689                 val="$undef"
17690         fi
17691         ;;
17692 *) val="$d_sigsetjmp"
17693         case "$d_sigsetjmp" in
17694         $define) echo "POSIX sigsetjmp found." >&4;;
17695         $undef) echo "sigsetjmp not found." >&4;;
17696         esac
17697         ;;
17698 esac
17699 set d_sigsetjmp
17700 eval $setvar
17701 $rm_try
17702
17703 : see if snprintf exists
17704 set snprintf d_snprintf
17705 eval $inlibc
17706
17707 : see if vsnprintf exists
17708 set vsnprintf d_vsnprintf
17709 eval $inlibc
17710
17711 case "$d_snprintf-$d_vsnprintf" in
17712 "$define-$define")
17713     $cat <<EOM
17714 Checking whether your snprintf() and vsnprintf() work okay...
17715 EOM
17716     $cat >try.c <<'EOCP'
17717 /* v?snprintf testing logic courtesy of Russ Allbery.
17718  * According to C99:
17719  * - if the buffer is too short it still must be \0-terminated
17720  * - if the buffer is too short the potentially required length
17721  *   must be returned and not -1
17722  * - if the buffer is NULL the potentially required length
17723  *   must be returned and not -1 or core dump
17724  */
17725 #include <stdio.h>
17726 #include <stdarg.h>
17727
17728 char buf[2];
17729
17730 int test (char *format, ...)
17731 {
17732     va_list args;
17733     int count;
17734
17735     va_start (args, format);
17736     count = vsnprintf (buf, sizeof buf, format, args);
17737     va_end (args);
17738     return count;
17739 }
17740
17741 int main ()
17742 {
17743     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17744              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17745 }
17746 EOCP
17747     set try
17748     if eval $compile; then
17749         `$run ./try`
17750         case "$?" in
17751         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17752         *) cat <<EOM >&4
17753 Your snprintf() and snprintf() don't seem to be working okay.
17754 EOM
17755            d_snprintf="$undef"
17756            d_vsnprintf="$undef"
17757            ;;
17758         esac
17759     else
17760         echo "(I can't seem to compile the test program--assuming they don't)"
17761         d_snprintf="$undef"
17762         d_vsnprintf="$undef"
17763     fi
17764     $rm_try
17765     ;;
17766 esac
17767
17768 : see if sockatmark exists
17769 set sockatmark d_sockatmark
17770 eval $inlibc
17771
17772 : see if prototype for sockatmark is available
17773 echo " "
17774 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17775 eval $hasproto
17776
17777 : see if socks5_init exists
17778 set socks5_init d_socks5_init
17779 eval $inlibc
17780
17781 : see if sprintf returns the length of the string in the buffer as per ANSI
17782 $echo "Checking whether sprintf returns the length of the string..." >&4
17783 $cat <<EOP >try.c
17784 #include <stdio.h>
17785 #$i_stdlib I_STDLIB
17786 #ifdef I_STDLIB
17787 #include <stdlib.h>
17788 #endif
17789 #$i_string I_STRING
17790 #ifdef I_STRING
17791 #  include <string.h>
17792 #else
17793 #  include <strings.h>
17794 #endif
17795 #$i_math I_MATH
17796 #ifdef I_MATH
17797 #include <math.h>
17798 #endif
17799
17800 char buffer[256];
17801
17802 int check (size_t expect, int test) {
17803   size_t got = strlen(buffer);
17804   if (expect == got)
17805     return 0;
17806
17807   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17808        test, buffer);
17809   exit (test);
17810 }
17811
17812 int main(int argc, char **argv) {
17813   int test = 0;
17814
17815   check(sprintf(buffer, ""), ++test);
17816   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17817   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17818
17819   return 0;
17820 }
17821 EOP
17822 set try
17823
17824 if eval $compile; then
17825     xxx="`$run ./try`"
17826     case "$?" in
17827         0) cat >&4 <<EOM
17828 sprintf returns the length of the string (as ANSI says it should)
17829 EOM
17830         d_sprintf_returns_strlen="$define"
17831         ;;
17832         *) cat >&4 <<EOM
17833 sprintf does not return the length of the string (how old is this system?)
17834 EOM
17835         d_sprintf_returns_strlen="$undef"
17836         ;;
17837     esac
17838 else
17839     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17840     d_sprintf_returns_strlen="$undef"
17841 fi
17842 $rm_try
17843
17844 : see if srand48_r exists
17845 set srand48_r d_srand48_r
17846 eval $inlibc
17847 case "$d_srand48_r" in
17848 "$define")
17849         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17850         case "$d_srand48_r_proto:$usethreads" in
17851         ":define")      d_srand48_r_proto=define
17852                 set d_srand48_r_proto srand48_r $hdrs
17853                 eval $hasproto ;;
17854         *)      ;;
17855         esac
17856         case "$d_srand48_r_proto" in
17857         define)
17858         case "$srand48_r_proto" in
17859         ''|0) try='int srand48_r(long, struct drand48_data*);'
17860         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17861         esac
17862         case "$srand48_r_proto" in
17863         ''|0)   d_srand48_r=undef
17864                 srand48_r_proto=0
17865                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17866         * )     case "$srand48_r_proto" in
17867                 REENTRANT_PROTO*) ;;
17868                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17869                 esac
17870                 echo "Prototype: $try" ;;
17871         esac
17872         ;;
17873         *)      case "$usethreads" in
17874                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17875                 esac
17876                 d_srand48_r=undef
17877                 srand48_r_proto=0
17878                 ;;
17879         esac
17880         ;;
17881 *)      srand48_r_proto=0
17882         ;;
17883 esac
17884
17885 : see if srandom_r exists
17886 set srandom_r d_srandom_r
17887 eval $inlibc
17888 case "$d_srandom_r" in
17889 "$define")
17890         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17891         case "$d_srandom_r_proto:$usethreads" in
17892         ":define")      d_srandom_r_proto=define
17893                 set d_srandom_r_proto srandom_r $hdrs
17894                 eval $hasproto ;;
17895         *)      ;;
17896         esac
17897         case "$d_srandom_r_proto" in
17898         define)
17899         case "$srandom_r_proto" in
17900         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17901         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17902         esac
17903         case "$srandom_r_proto" in
17904         ''|0)   d_srandom_r=undef
17905                 srandom_r_proto=0
17906                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17907         * )     case "$srandom_r_proto" in
17908                 REENTRANT_PROTO*) ;;
17909                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17910                 esac
17911                 echo "Prototype: $try" ;;
17912         esac
17913         ;;
17914         *)      case "$usethreads" in
17915                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17916                 esac
17917                 d_srandom_r=undef
17918                 srandom_r_proto=0
17919                 ;;
17920         esac
17921         ;;
17922 *)      srandom_r_proto=0
17923         ;;
17924 esac
17925
17926 : see if prototype for setresgid is available
17927 echo " "
17928 set d_sresgproto setresgid $i_unistd unistd.h
17929 eval $hasproto
17930
17931 : see if prototype for setresuid is available
17932 echo " "
17933 set d_sresuproto setresuid $i_unistd unistd.h
17934 eval $hasproto
17935
17936 : see if sys/stat.h is available
17937 set sys/stat.h i_sysstat
17938 eval $inhdr
17939
17940 : see if stat knows about block sizes
17941 echo " "
17942 echo "Checking to see if your struct stat has st_blocks field..." >&4
17943 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17944 eval $hasfield
17945
17946 : see if this is a sys/vfs.h system
17947 set sys/vfs.h i_sysvfs
17948 eval $inhdr
17949
17950 : see if this is a sys/statfs.h system
17951 set sys/statfs.h i_sysstatfs
17952 eval $inhdr
17953
17954 : Check for statfs_s
17955 echo " "
17956 echo "Checking to see if your system supports struct statfs..." >&4
17957 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
17958 eval $hasstruct
17959 case "$d_statfs_s" in
17960 "$define")      echo "Yes, it does."   ;;
17961 *)              echo "No, it doesn't." ;;
17962 esac
17963
17964
17965 : see if struct statfs knows about f_flags
17966 case "$d_statfs_s" in
17967 define)
17968         echo " "
17969         echo "Checking to see if your struct statfs has f_flags field..." >&4
17970         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
17971         eval $hasfield
17972         ;;
17973 *)      val="$undef"
17974         set d_statfs_f_flags
17975         eval $setvar
17976         ;;
17977 esac
17978 case "$d_statfs_f_flags" in
17979 "$define")      echo "Yes, it does."   ;;
17980 *)              echo "No, it doesn't." ;;
17981 esac
17982
17983 : see what flavor, if any, of static inline is supported
17984 echo " "
17985 echo "Checking to see if your system supports static inline..."
17986 $cat > try.c <<'EOCP'
17987 #include <stdlib.h>
17988 extern int f_via_a(int x);
17989 extern int f_via_b(int x);
17990 int main(int argc, char **argv)
17991 {
17992     int y;
17993
17994     y = f_via_a(0);
17995 #ifdef USE_B
17996     y = f_via_b(0);
17997 #endif
17998     if (y == 42) {
17999         return EXIT_SUCCESS;
18000     }
18001     else {
18002         return EXIT_FAILURE;
18003     }
18004 }
18005 EOCP
18006 $cat > a.c <<'EOCP'
18007 static INLINE int f(int x) {
18008     int y;
18009     y = x + 42;
18010     return y;
18011 }
18012
18013 int f_via_a(int x)
18014 {
18015     return f(x);
18016 }
18017 EOCP
18018 $cat > b.c <<'EOCP'
18019 extern int f(int x);
18020
18021 int f_via_b(int x)
18022 {
18023     return f(x);
18024 }
18025 EOCP
18026
18027 # Respect a hint (or previous) value for perl_static_inline, if there is one.
18028 case "$perl_static_inline" in
18029 '')     # Check the various possibilities, and break out on success.
18030         # For gcc, prefer __inline__, which will still permit
18031         # cflags.SH to add in -ansi.
18032         case "$gccversion" in
18033                 '') xxx="inline __inline__ __inline _inline";;
18034                 *)  xxx="__inline__ inline __inline _inline";;
18035         esac
18036         for inline in $xxx; do
18037                 set try -DINLINE=$inline a.c
18038                 if eval $compile && $run ./try; then
18039                         # Now make sure there is no external linkage of static
18040                         # functions
18041                         set try -DINLINE=$inline -DUSE_B a.c b.c
18042                         if eval $compile && $run ./try; then
18043                                 $echo "Your compiler supports static $inline, " >&4
18044                                 $echo "but it also creates an external definition," >&4
18045                                 $echo "so I won't use it." >&4
18046                                 val=$undef
18047                         else
18048                                 $echo "Your compiler supports static $inline." >&4
18049                                 val=$define
18050                                 perl_static_inline="static $inline";
18051                                 break;
18052                         fi
18053                 else
18054                         $echo "Your compiler does NOT support static $inline." >&4
18055                         val="$undef"
18056                 fi
18057         done
18058         ;;
18059 *inline*) # Some variant of inline exists.
18060         echo "Keeping your $hint value of $perl_static_inline."
18061         val=$define
18062         ;;
18063 static)  # No inline capabilities
18064         echo "Keeping your $hint value of $perl_static_inline."
18065         val=$undef
18066         ;;
18067 *)  # Unrecognized previous value -- blindly trust the supplied
18068         # value and hope it makes sense.  Use old value for
18069         # d_static_inline, if there is one.
18070         echo "Keeping your $hint value of $perl_static_inline."
18071         case "$d_static_inline" in
18072                 '') val=$define ;;
18073                 *)  val=$d_static_inline ;;
18074         esac
18075         ;;
18076 esac
18077 # Fallback to plain 'static' if nothing worked.
18078 case "$perl_static_inline" in
18079 '')
18080         perl_static_inline="static"
18081         val=$undef
18082         ;;
18083 esac
18084 set d_static_inline
18085 eval $setvar
18086 $rm -f a.[co] b.[co]
18087 $rm_try
18088
18089 : Check stream access
18090 $cat >&4 <<EOM
18091 Checking how to access stdio streams by file descriptor number...
18092 EOM
18093 case "$stdio_stream_array" in
18094 '')     $cat >try.c <<EOCP
18095 #include <stdio.h>
18096 int main() {
18097   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18098     printf("yes\n");
18099 }
18100 EOCP
18101         for s in _iob __iob __sF
18102         do
18103                 set try -DSTDIO_STREAM_ARRAY=$s
18104                 if eval $compile; then
18105                         case "`$run ./try`" in
18106                         yes)    stdio_stream_array=$s; break ;;
18107                         esac
18108                 fi
18109         done
18110         $rm_try
18111 esac
18112 case "$stdio_stream_array" in
18113 '')     $cat >&4 <<EOM
18114 I can't figure out how to access stdio streams by file descriptor number.
18115 EOM
18116         d_stdio_stream_array="$undef"
18117         ;;
18118 *)      $cat >&4 <<EOM
18119 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18120 EOM
18121         d_stdio_stream_array="$define"
18122         ;;
18123 esac
18124
18125 : see if strcoll exists
18126 set strcoll d_strcoll
18127 eval $inlibc
18128
18129 : check for structure copying
18130 echo " "
18131 echo "Checking to see if your C compiler can copy structs..." >&4
18132 $cat >try.c <<'EOCP'
18133 int main()
18134 {
18135         struct blurfl {
18136                 int dyick;
18137         } foo, bar;
18138
18139         foo = bar;
18140 }
18141 EOCP
18142 if $cc -c try.c >/dev/null 2>&1 ; then
18143         val="$define"
18144         echo "Yup, it can."
18145 else
18146         val="$undef"
18147         echo "Nope, it can't."
18148 fi
18149 set d_strctcpy
18150 eval $setvar
18151 $rm_try
18152
18153 : see if strerror and/or sys_errlist[] exist
18154 echo " "
18155 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18156     if set strerror val -f d_strerror; eval $csym; $val; then
18157                 echo 'strerror() found.' >&4
18158                 d_strerror="$define"
18159                 d_strerrm='strerror(e)'
18160                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18161                         echo "(You also have sys_errlist[], so we could roll our own strerror.)"
18162                         d_syserrlst="$define"
18163                 else
18164                         echo "(Since you don't have sys_errlist[], strerror() is welcome.)"
18165                         d_syserrlst="$undef"
18166                 fi
18167     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18168                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18169                 echo 'strerror() found in string header.' >&4
18170                 d_strerror="$define"
18171                 d_strerrm='strerror(e)'
18172                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18173                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18174                                 d_syserrlst="$define"
18175                 else
18176                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18177                         d_syserrlst="$undef"
18178                 fi
18179     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18180                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18181                 d_strerror="$undef"
18182                 d_syserrlst="$define"
18183                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18184     else
18185                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18186                 d_strerror="$undef"
18187                 d_syserrlst="$undef"
18188                 d_strerrm='"unknown"'
18189     fi
18190 fi
18191
18192 : see if strerror_r exists
18193 set strerror_r d_strerror_r
18194 eval $inlibc
18195 case "$d_strerror_r" in
18196 "$define")
18197         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18198         case "$d_strerror_r_proto:$usethreads" in
18199         ":define")      d_strerror_r_proto=define
18200                 set d_strerror_r_proto strerror_r $hdrs
18201                 eval $hasproto ;;
18202         *)      ;;
18203         esac
18204         case "$d_strerror_r_proto" in
18205         define)
18206         case "$strerror_r_proto" in
18207         ''|0) try='int strerror_r(int, char*, size_t);'
18208         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18209         esac
18210         case "$strerror_r_proto" in
18211         ''|0) try='int strerror_r(int, char*, int);'
18212         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18213         esac
18214         case "$strerror_r_proto" in
18215         ''|0) try='char* strerror_r(int, char*, size_t);'
18216         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18217         esac
18218         case "$strerror_r_proto" in
18219         ''|0)   d_strerror_r=undef
18220                 strerror_r_proto=0
18221                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18222         * )     case "$strerror_r_proto" in
18223                 REENTRANT_PROTO*) ;;
18224                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18225                 esac
18226                 echo "Prototype: $try" ;;
18227         esac
18228         ;;
18229         *)      case "$usethreads" in
18230                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18231                 esac
18232                 d_strerror_r=undef
18233                 strerror_r_proto=0
18234                 ;;
18235         esac
18236         ;;
18237 *)      strerror_r_proto=0
18238         ;;
18239 esac
18240
18241 : see if strftime exists
18242 set strftime d_strftime
18243 eval $inlibc
18244
18245 : see if strlcat exists
18246 set strlcat d_strlcat
18247 eval $inlibc
18248
18249 : see if strlcpy exists
18250 set strlcpy d_strlcpy
18251 eval $inlibc
18252
18253 : see if strtod exists
18254 set strtod d_strtod
18255 eval $inlibc
18256
18257 : see if strtol exists
18258 set strtol d_strtol
18259 eval $inlibc
18260
18261 : see if strtold exists
18262 set strtold d_strtold
18263 eval $inlibc
18264
18265 : see if strtoll exists
18266 set strtoll d_strtoll
18267 eval $inlibc
18268
18269 case "$d_longlong-$d_strtoll" in
18270 "$define-$define")
18271         $cat <<EOM
18272 Checking whether your strtoll() works okay...
18273 EOM
18274         $cat >try.c <<'EOCP'
18275 #include <errno.h>
18276 #ifdef __hpux
18277 #define strtoll __strtoll
18278 #endif
18279 #ifdef __EMX__
18280 #define strtoll _strtoll
18281 #endif
18282 #include <stdio.h>
18283 extern long long int strtoll(char *s, char **, int);
18284 static int bad = 0;
18285 int check(char *s, long long ell, int een) {
18286         long long gll;
18287         errno = 0;
18288         gll = strtoll(s, 0, 10);
18289         if (!((gll == ell) && (errno == een)))
18290                 bad++;
18291 }
18292 int main() {
18293         check(" 1",                                      1LL, 0);
18294         check(" 0",                                      0LL, 0);
18295         check("-1",                                     -1LL, 0);
18296         check("-9223372036854775808", -9223372036854775808LL, 0);
18297         check("-9223372036854775808", -9223372036854775808LL, 0);
18298         check(" 9223372036854775807",  9223372036854775807LL, 0);
18299         check("-9223372036854775808", -9223372036854775808LL, 0);
18300         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18301         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18302         if (!bad)
18303                 printf("ok\n");
18304 }
18305 EOCP
18306         set try
18307         if eval $compile; then
18308                 yyy=`$run ./try`
18309                 case "$yyy" in
18310                 ok) echo "Your strtoll() seems to be working okay." ;;
18311                 *) cat <<EOM >&4
18312 Your strtoll() doesn't seem to be working okay.
18313 EOM
18314                    d_strtoll="$undef"
18315                    ;;
18316                 esac
18317         else
18318                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18319                 d_strtoll="$undef"
18320         fi
18321         ;;
18322 esac
18323
18324 : see if strtoq exists
18325 set strtoq d_strtoq
18326 eval $inlibc
18327
18328 : see if strtoul exists
18329 set strtoul d_strtoul
18330 eval $inlibc
18331
18332 case "$d_strtoul" in
18333 "$define")
18334         $cat <<EOM
18335 Checking whether your strtoul() works okay...
18336 EOM
18337         $cat >try.c <<'EOCP'
18338 #include <errno.h>
18339 #include <stdio.h>
18340 extern unsigned long int strtoul(char *s, char **, int);
18341 static int bad = 0;
18342 void check(char *s, unsigned long eul, int een) {
18343         unsigned long gul;
18344         errno = 0;
18345         gul = strtoul(s, 0, 10);
18346         if (!((gul == eul) && (errno == een)))
18347                 bad++;
18348 }
18349 int main() {
18350         check(" 1", 1L, 0);
18351         check(" 0", 0L, 0);
18352 EOCP
18353         case "$longsize" in
18354         8)
18355             $cat >>try.c <<'EOCP'
18356         check("18446744073709551615", 18446744073709551615UL, 0);
18357         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18358 #if 0 /* strtoul() for /^-/ strings is undefined. */
18359         check("-1", 18446744073709551615UL, 0);
18360         check("-18446744073709551614", 2, 0);
18361         check("-18446744073709551615", 1, 0);
18362         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18363         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18364 #endif
18365 EOCP
18366                 ;;
18367         4)
18368                     $cat >>try.c <<'EOCP'
18369         check("4294967295", 4294967295UL, 0);
18370         check("4294967296", 4294967295UL, ERANGE);
18371 #if 0 /* strtoul() for /^-/ strings is undefined. */
18372         check("-1", 4294967295UL, 0);
18373         check("-4294967294", 2, 0);
18374         check("-4294967295", 1, 0);
18375         check("-4294967296", 4294967295UL, ERANGE);
18376         check("-4294967297", 4294967295UL, ERANGE);
18377 #endif
18378 EOCP
18379                 ;;
18380         *)
18381 : Should we write these tests to be more portable by sprintf-ing
18382 : ~0 and then manipulating that char string as input for strtol?
18383                 ;;
18384         esac
18385         $cat >>try.c <<'EOCP'
18386         if (!bad)
18387                 printf("ok\n");
18388         return 0;
18389 }
18390 EOCP
18391         set try
18392         if eval $compile; then
18393                 case "`$run ./try`" in
18394                 ok) echo "Your strtoul() seems to be working okay." ;;
18395                 *) cat <<EOM >&4
18396 Your strtoul() doesn't seem to be working okay.
18397 EOM
18398                    d_strtoul="$undef"
18399                    ;;
18400                 esac
18401         else
18402                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18403                 d_strtoul="$undef"
18404         fi
18405         ;;
18406 esac
18407
18408 : see if strtoull exists
18409 set strtoull d_strtoull
18410 eval $inlibc
18411
18412 case "$d_longlong-$d_strtoull" in
18413 "$define-$define")
18414         $cat <<EOM
18415 Checking whether your strtoull() works okay...
18416 EOM
18417         $cat >try.c <<'EOCP'
18418 #include <errno.h>
18419 #ifdef __hpux
18420 #define strtoull __strtoull
18421 #endif
18422 #include <stdio.h>
18423 extern unsigned long long int strtoull(char *s, char **, int);
18424 static int bad = 0;
18425 int check(char *s, long long eull, int een) {
18426         long long gull;
18427         errno = 0;
18428         gull = strtoull(s, 0, 10);
18429         if (!((gull == eull) && (errno == een)))
18430                 bad++;
18431 }
18432 int main() {
18433         check(" 1",                                        1LL, 0);
18434         check(" 0",                                        0LL, 0);
18435         check("18446744073709551615",  18446744073709551615ULL, 0);
18436         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18437 #if 0 /* strtoull() for /^-/ strings is undefined. */
18438         check("-1",                    18446744073709551615ULL, 0);
18439         check("-18446744073709551614",                     2LL, 0);
18440         check("-18446744073709551615",                     1LL, 0);
18441         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18442         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18443 #endif
18444         if (!bad)
18445                 printf("ok\n");
18446 }
18447 EOCP
18448         set try
18449         if eval $compile; then
18450                 case "`$run ./try`" in
18451                 ok) echo "Your strtoull() seems to be working okay." ;;
18452                 *) cat <<EOM >&4
18453 Your strtoull() doesn't seem to be working okay.
18454 EOM
18455                    d_strtoull="$undef"
18456                    ;;
18457                 esac
18458         else
18459                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18460                 d_strtoull="$undef"
18461         fi
18462         ;;
18463 esac
18464
18465 : see if strtouq exists
18466 set strtouq d_strtouq
18467 eval $inlibc
18468
18469 case "$d_strtouq" in
18470 "$define")
18471         $cat <<EOM
18472 Checking whether your strtouq() works okay...
18473 EOM
18474         $cat >try.c <<'EOCP'
18475 #include <errno.h>
18476 #include <stdio.h>
18477 extern unsigned long long int strtouq(char *s, char **, int);
18478 static int bad = 0;
18479 void check(char *s, unsigned long long eull, int een) {
18480         unsigned long long gull;
18481         errno = 0;
18482         gull = strtouq(s, 0, 10);
18483         if (!((gull == eull) && (errno == een)))
18484                 bad++;
18485 }
18486 int main() {
18487         check(" 1",                                        1LL, 0);
18488         check(" 0",                                        0LL, 0);
18489         check("18446744073709551615",  18446744073709551615ULL, 0);
18490         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18491 #if 0 /* strtouq() for /^-/ strings is undefined. */
18492         check("-1",                    18446744073709551615ULL, 0);
18493         check("-18446744073709551614",                     2LL, 0);
18494         check("-18446744073709551615",                     1LL, 0);
18495         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18496         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18497 #endif
18498         if (!bad)
18499                 printf("ok\n");
18500         return 0;
18501 }
18502 EOCP
18503         set try
18504         if eval $compile; then
18505                 case "`$run ./try`" in
18506                 ok) echo "Your strtouq() seems to be working okay." ;;
18507                 *) cat <<EOM >&4
18508 Your strtouq() doesn't seem to be working okay.
18509 EOM
18510                    d_strtouq="$undef"
18511                    ;;
18512                 esac
18513         else
18514                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18515                 d_strtouq="$undef"
18516         fi
18517         ;;
18518 esac
18519
18520 : see if strxfrm exists
18521 set strxfrm d_strxfrm
18522 eval $inlibc
18523
18524 : see if symlink exists
18525 set symlink d_symlink
18526 eval $inlibc
18527
18528 : see if syscall exists
18529 set syscall d_syscall
18530 eval $inlibc
18531
18532 : see if prototype for syscall is available
18533 echo " "
18534 set d_syscallproto syscall $i_unistd unistd.h
18535 eval $hasproto
18536
18537 : see if sysconf exists
18538 set sysconf d_sysconf
18539 eval $inlibc
18540
18541 : see if system exists
18542 set system d_system
18543 eval $inlibc
18544
18545 : see if tcgetpgrp exists
18546 set tcgetpgrp d_tcgetpgrp
18547 eval $inlibc
18548
18549 : see if tcsetpgrp exists
18550 set tcsetpgrp d_tcsetpgrp
18551 eval $inlibc
18552
18553 : see if prototype for telldir is available
18554 echo " "
18555 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18556 eval $hasproto
18557
18558 : see if time exists
18559 echo " "
18560 if test "X$d_time" = X -o X"$timetype" = X; then
18561     if set time val -f d_time; eval $csym; $val; then
18562                 echo 'time() found.' >&4
18563                 val="$define"
18564                 rp="What is the type returned by time() on this system?"
18565                 set time_t timetype long stdio.h sys/types.h
18566                 eval $typedef_ask
18567     else
18568                 echo 'time() not found, hope that will do.' >&4
18569                 val="$undef"
18570                 timetype='int';
18571     fi
18572     set d_time
18573     eval $setvar
18574 fi
18575
18576 : see if timegm exists
18577 set timegm d_timegm
18578 eval $inlibc
18579
18580 : see if this is a sys/times.h system
18581 set sys/times.h i_systimes
18582 eval $inhdr
18583
18584 : see if times exists
18585 echo " "
18586 if set times val -f d_times; eval $csym; $val; then
18587         echo 'times() found.' >&4
18588         d_times="$define"
18589         inc=''
18590         case "$i_systimes" in
18591         "$define") inc='sys/times.h';;
18592         esac
18593         rp="What is the type returned by times() on this system?"
18594         set clock_t clocktype long stdio.h sys/types.h $inc
18595         eval $typedef_ask
18596 else
18597         echo 'times() NOT found, hope that will do.' >&4
18598         d_times="$undef"
18599         clocktype='int'
18600 fi
18601
18602 : see if tmpnam_r exists
18603 set tmpnam_r d_tmpnam_r
18604 eval $inlibc
18605 case "$d_tmpnam_r" in
18606 "$define")
18607         hdrs="$i_systypes sys/types.h define stdio.h "
18608         case "$d_tmpnam_r_proto:$usethreads" in
18609         ":define")      d_tmpnam_r_proto=define
18610                 set d_tmpnam_r_proto tmpnam_r $hdrs
18611                 eval $hasproto ;;
18612         *)      ;;
18613         esac
18614         case "$d_tmpnam_r_proto" in
18615         define)
18616         case "$tmpnam_r_proto" in
18617         ''|0) try='char* tmpnam_r(char*);'
18618         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18619         esac
18620         case "$tmpnam_r_proto" in
18621         ''|0)   d_tmpnam_r=undef
18622                 tmpnam_r_proto=0
18623                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18624         * )     case "$tmpnam_r_proto" in
18625                 REENTRANT_PROTO*) ;;
18626                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18627                 esac
18628                 echo "Prototype: $try" ;;
18629         esac
18630         ;;
18631         *)      case "$usethreads" in
18632                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18633                 esac
18634                 d_tmpnam_r=undef
18635                 tmpnam_r_proto=0
18636                 ;;
18637         esac
18638         ;;
18639 *)      tmpnam_r_proto=0
18640         ;;
18641 esac
18642
18643 : see if truncate exists
18644 set truncate d_truncate
18645 eval $inlibc
18646
18647 : see if ttyname_r exists
18648 set ttyname_r d_ttyname_r
18649 eval $inlibc
18650 case "$d_ttyname_r" in
18651 "$define")
18652         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18653         case "$d_ttyname_r_proto:$usethreads" in
18654         ":define")      d_ttyname_r_proto=define
18655                 set d_ttyname_r_proto ttyname_r $hdrs
18656                 eval $hasproto ;;
18657         *)      ;;
18658         esac
18659         case "$d_ttyname_r_proto" in
18660         define)
18661         case "$ttyname_r_proto" in
18662         ''|0) try='int ttyname_r(int, char*, size_t);'
18663         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18664         esac
18665         case "$ttyname_r_proto" in
18666         ''|0) try='int ttyname_r(int, char*, int);'
18667         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18668         esac
18669         case "$ttyname_r_proto" in
18670         ''|0) try='char* ttyname_r(int, char*, int);'
18671         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18672         esac
18673         case "$ttyname_r_proto" in
18674         ''|0)   d_ttyname_r=undef
18675                 ttyname_r_proto=0
18676                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18677         * )     case "$ttyname_r_proto" in
18678                 REENTRANT_PROTO*) ;;
18679                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18680                 esac
18681                 echo "Prototype: $try" ;;
18682         esac
18683         ;;
18684         *)      case "$usethreads" in
18685                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18686                 esac
18687                 d_ttyname_r=undef
18688                 ttyname_r_proto=0
18689                 ;;
18690         esac
18691         ;;
18692 *)      ttyname_r_proto=0
18693         ;;
18694 esac
18695
18696 : see if tzname[] exists
18697 echo " "
18698 if set tzname val -a d_tzname; eval $csym; $val; then
18699         val="$define"
18700         echo 'tzname[] found.' >&4
18701 else
18702         val="$undef"
18703         echo 'tzname[] NOT found.' >&4
18704 fi
18705 set d_tzname
18706 eval $setvar
18707
18708 : Check if is a multiplatform env
18709 case "$osname" in
18710 next|darwin) multiarch="$define" ;;
18711 esac
18712 case "$multiarch" in
18713 ''|[nN]*) multiarch="$undef" ;;
18714 esac
18715
18716 : check for ordering of bytes in a UV
18717 echo " "
18718 case "$usecrosscompile$multiarch" in
18719 *$define*)
18720         $cat <<EOM
18721 You seem to be either cross-compiling or doing a multiarchitecture build,
18722 skipping the byteorder check.
18723
18724 EOM
18725         byteorder='ffff'
18726         ;;
18727 *)
18728         case "$byteorder" in
18729         '')
18730                 $cat <<'EOM'
18731 In the following, larger digits indicate more significance.  A big-endian
18732 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18733 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18734 machines may have weird orders like 3412.  A Cray will report 87654321,
18735 an Alpha will report 12345678. If the test program works the default is
18736 probably right.
18737 I'm now running the test program...
18738 EOM
18739                 $cat >try.c <<EOCP
18740 #include <stdio.h>
18741 #$i_stdlib I_STDLIB
18742 #ifdef I_STDLIB
18743 #include <stdlib.h>
18744 #endif
18745 #include <sys/types.h>
18746 typedef $uvtype UV;
18747 int main()
18748 {
18749         int i;
18750         union {
18751                 UV l;
18752                 char c[$uvsize];
18753         } u;
18754
18755         if ($uvsize > 4)
18756                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18757         else
18758                 u.l = (UV)0x04030201;
18759         for (i = 0; i < $uvsize; i++)
18760                 printf("%c", u.c[i]+'0');
18761         printf("\n");
18762         exit(0);
18763 }
18764 EOCP
18765                 xxx_prompt=y
18766                 set try
18767                 if eval $compile && $run ./try > /dev/null; then
18768                         dflt=`$run ./try`
18769                         case "$dflt" in
18770                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18771                                 echo "(The test program ran ok.)"
18772                                 echo "byteorder=$dflt"
18773                                 xxx_prompt=n
18774                         ;;
18775                         ????|????????) echo "(The test program ran ok.)" ;;
18776                         *) echo "(The test program didn't run right for some reason.)" ;;
18777                         esac
18778                 else
18779                         dflt='4321'
18780                         cat <<'EOM'
18781 (I can't seem to compile the test program.  Guessing big-endian...)
18782 EOM
18783                 fi
18784                 case "$xxx_prompt" in
18785                 y)
18786                         rp="What is the order of bytes in $uvtype?"
18787                         . ./myread
18788                         byteorder="$ans"
18789                         ;;
18790                 *)      byteorder=$dflt
18791                         ;;
18792                 esac
18793                 ;;
18794         esac
18795         $rm_try
18796         ;;
18797 esac
18798
18799 : Checking 32bit alignedness
18800 $cat <<EOM
18801
18802 Checking to see whether you can access character data unalignedly...
18803 EOM
18804 case "$d_u32align" in
18805 '')   $cat >try.c <<EOCP
18806 #include <stdio.h>
18807 #$i_stdlib I_STDLIB
18808 #ifdef I_STDLIB
18809 #include <stdlib.h>
18810 #endif
18811 #define U32 $u32type
18812 #define BYTEORDER 0x$byteorder
18813 #define U8 $u8type
18814 #include <signal.h>
18815 #ifdef SIGBUS
18816 $signal_t bletch(int s) { exit(4); }
18817 #endif
18818 int main() {
18819 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18820     volatile U8 buf[8];
18821     volatile U32 *up;
18822     int i;
18823
18824     if (sizeof(U32) != 4) {
18825         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18826         exit(1);
18827     }
18828
18829     fflush(stdout);
18830
18831 #ifdef SIGBUS
18832     signal(SIGBUS, bletch);
18833 #endif
18834
18835     buf[0] = 0;
18836     buf[1] = 0;
18837     buf[2] = 0;
18838     buf[3] = 1;
18839     buf[4] = 0;
18840     buf[5] = 0;
18841     buf[6] = 0;
18842     buf[7] = 1;
18843
18844     for (i = 0; i < 4; i++) {
18845         up = (U32*)(buf + i);
18846         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18847                (*up == 1 << (8*(3-i)))  /* little-endian */
18848               )
18849            )
18850         {
18851             printf("read failed (%x)\n", *up);
18852             exit(2);
18853         }
18854     }
18855
18856     /* write test */
18857     for (i = 0; i < 4; i++) {
18858         up = (U32*)(buf + i);
18859         *up = 0xBeef;
18860         if (*up != 0xBeef) {
18861             printf("write failed (%x)\n", *up);
18862             exit(3);
18863         }
18864     }
18865
18866     exit(0);
18867 #else
18868     printf("1\n");
18869     exit(1);
18870 #endif
18871     return 0;
18872 }
18873 EOCP
18874 set try
18875 if eval $compile_ok; then
18876         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18877         $run ./try 2>&1 >/dev/null
18878         case "$?" in
18879         0)      cat >&4 <<EOM
18880 You can access character data pretty unalignedly.
18881 EOM
18882                 d_u32align="$undef"
18883                 ;;
18884         *)      cat >&4 <<EOM
18885 It seems that you must access character data in an aligned manner.
18886 EOM
18887                 d_u32align="$define"
18888                 ;;
18889         esac
18890 else
18891         rp='Can you access character data at unaligned addresses?'
18892         dflt='n'
18893         . ./myread
18894         case "$ans" in
18895         [yY]*)  d_u32align="$undef"  ;;
18896         *)      d_u32align="$define" ;;
18897         esac
18898 fi
18899 $rm_try
18900 ;;
18901 esac
18902
18903 : see if ualarm exists
18904 set ualarm d_ualarm
18905 eval $inlibc
18906
18907 : see if umask exists
18908 set umask d_umask
18909 eval $inlibc
18910
18911 : see if unordered exists
18912 set unordered d_unordered
18913 eval $inlibc
18914
18915 : see if unsetenv exists
18916 set unsetenv d_unsetenv
18917 eval $inlibc
18918
18919 : see if usleep exists
18920 set usleep d_usleep
18921 eval $inlibc
18922
18923 : see if prototype for usleep is available
18924 echo " "
18925 set d_usleepproto usleep $i_unistd unistd.h
18926 eval $hasproto
18927
18928 : see if ustat exists
18929 set ustat d_ustat
18930 eval $inlibc
18931
18932 : see if closedir exists
18933 set closedir d_closedir
18934 eval $inlibc
18935
18936 case "$d_closedir" in
18937 "$define")
18938         echo " "
18939         echo "Checking whether closedir() returns a status..." >&4
18940         cat > try.c <<EOM
18941 #$i_dirent I_DIRENT             /**/
18942 #$i_sysdir I_SYS_DIR            /**/
18943 #$i_sysndir I_SYS_NDIR          /**/
18944 #$i_systypes I_SYS_TYPES        /**/
18945
18946 #if defined(I_SYS_TYPES)
18947 #include <sys/types.h>
18948 #endif
18949 #if defined(I_DIRENT)
18950 #include <dirent.h>
18951 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18952 #include <sys/dir.h>
18953 #endif
18954 #else
18955 #ifdef I_SYS_NDIR
18956 #include <sys/ndir.h>
18957 #else
18958 #ifdef I_SYS_DIR
18959 #ifdef hp9000s500
18960 #include <ndir.h>       /* may be wrong in the future */
18961 #else
18962 #include <sys/dir.h>
18963 #endif
18964 #endif
18965 #endif
18966 #endif
18967 int main() { return closedir(opendir(".")); }
18968 EOM
18969         set try
18970         if eval $compile_ok; then
18971                 if $run ./try > /dev/null 2>&1 ; then
18972                         echo "Yes, it does."
18973                         val="$undef"
18974                 else
18975                         echo "No, it doesn't."
18976                         val="$define"
18977                 fi
18978         else
18979                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18980                 val="$define"
18981         fi
18982         ;;
18983 *)
18984         val="$undef";
18985         ;;
18986 esac
18987 set d_void_closedir
18988 eval $setvar
18989 $rm_try
18990
18991 : see if there is a wait4
18992 set wait4 d_wait4
18993 eval $inlibc
18994
18995 : see if waitpid exists
18996 set waitpid d_waitpid
18997 eval $inlibc
18998
18999 : see if wcstombs exists
19000 set wcstombs d_wcstombs
19001 eval $inlibc
19002
19003 : see if wctomb exists
19004 set wctomb d_wctomb
19005 eval $inlibc
19006
19007 : see if writev exists
19008 set writev d_writev
19009 eval $inlibc
19010
19011 : preserve RCS keywords in files with variable substitution, grrr
19012 Date='$Date'
19013 Id='$Id'
19014 Log='$Log'
19015 RCSfile='$RCSfile'
19016 Revision='$Revision'
19017
19018 : check for alignment requirements
19019 echo " "
19020 case "$usecrosscompile" in
19021 *$define*)
19022         $cat <<EOM
19023 You seem to be cross-compiling.  Skipping the memory alignment check.
19024
19025 EOM
19026         case "$alignbytes" in
19027         '') alignbytes=8 ;;
19028         esac
19029         ;;
19030 *)
19031         case "$alignbytes" in
19032         '') echo "Checking alignment constraints..." >&4
19033                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
19034                         $cat >try.c <<'EOCP'
19035 typedef long double NV;
19036 EOCP
19037                 else
19038                         $cat >try.c <<'EOCP'
19039 typedef double NV;
19040 EOCP
19041                 fi
19042                 $cat >>try.c <<'EOCP'
19043 #include <stdio.h>
19044 struct foobar {
19045         char foo;
19046         NV bar;
19047 } try_algn;
19048 int main()
19049 {
19050     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
19051     return(0);
19052 }
19053 EOCP
19054                 set try
19055                 if eval $compile_ok; then
19056                         dflt=`$run ./try`
19057                 else
19058                         dflt='8'
19059                         echo "(I can't seem to compile the test program...)"
19060                 fi
19061                 case "$multiarch" in
19062                 *$define*)
19063                         : The usual safe value is 8, but Darwin with -Duselongdouble
19064                         : needs 16.  Hence, we will take 8 as a minimum, but allow
19065                         : Configure to pick a larger value if needed.
19066                         if $test "$dflt" -lt 8; then
19067                             dflt='8'
19068                                 echo "Setting alignment to 8 for multiarch support.">&4
19069                         fi
19070                         ;;
19071                 esac
19072                 ;;
19073         *) dflt="$alignbytes"
19074                 ;;
19075         esac
19076         rp="Doubles must be aligned on a how-many-byte boundary?"
19077         . ./myread
19078         alignbytes="$ans"
19079         $rm_try
19080         ;;
19081 esac
19082
19083
19084 : set the base revision
19085 baserev=5.0
19086
19087 : Determine if this is an EBCDIC system
19088 echo " "
19089 echo "Determining whether or not we are on an EBCDIC system..." >&4
19090 $cat >try.c <<'EOM'
19091 int main()
19092 {
19093   if ('M'==0xd4) return 0;
19094   return 1;
19095 }
19096 EOM
19097
19098 case "$BOOTSTRAP_CHARSET" in
19099     Y|y|define) bootstrap_charset=$define       ;;
19100     *)          bootstrap_charset=$undef        ;;
19101 esac
19102
19103 val=$undef
19104 set try
19105 if eval $compile_ok; then
19106         if $run ./try; then
19107                 echo "You seem to speak EBCDIC." >&4
19108                 val="$define"
19109         else
19110                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19111         fi
19112 else
19113         echo "I'm unable to compile the test program." >&4
19114         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19115 fi
19116 $rm_try
19117 set ebcdic
19118 eval $setvar
19119
19120 : length of character in bytes. Is always 1, otherwise it is not C
19121 : This used to be a test using sizeof
19122 charsize=1
19123
19124 : Check for the number of bits in a character
19125 case "$charbits" in
19126 '')     echo "Checking how long a character is (in bits)..." >&4
19127         $cat >try.c <<EOCP
19128 #include <stdio.h>
19129 int main ()
19130 {
19131     int n;
19132     unsigned char c;
19133     for (c = 1, n = 0; c; c <<= 1, n++) ;
19134     printf ("%d\n", n);
19135     return (0);
19136     }
19137 EOCP
19138         set try
19139         if eval $compile_ok; then
19140                 dflt=`$run ./try`
19141         else
19142                 dflt='8'
19143                 echo "(I can't seem to compile the test program.  Guessing...)"
19144         fi
19145         ;;
19146 *)
19147         dflt="$charbits"
19148         ;;
19149 esac
19150 rp="What is the length of a character (in bits)?"
19151 . ./myread
19152 charbits="$ans"
19153 $rm_try
19154 case "$charbits" in
19155 8)      ;;
19156 *)      cat >&4 << EOM
19157 Your system has an unsigned character size of $charbits bits, which
19158 is rather unusual (normally it is 8 bits).  Perl likely will not work
19159 correctly on your system, with subtle bugs in various places.
19160 EOM
19161         rp='Do you really want to continue?'
19162         dflt='n'
19163         . ./myread
19164         case "$ans" in
19165                 [yY])   echo >&4 "Okay, continuing."    ;;
19166                 *)      exit 1                          ;;
19167         esac
19168 esac
19169
19170 : how do we concatenate cpp tokens here?
19171 echo " "
19172 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19173 $cat >cpp_stuff.c <<'EOCP'
19174 #define RCAT(a,b)a/**/b
19175 #define ACAT(a,b)a ## b
19176 RCAT(Rei,ser)
19177 ACAT(Cir,cus)
19178 EOCP
19179 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19180 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19181         echo "Oh!  Smells like ANSI's been here." >&4
19182         echo "We can catify or stringify, separately or together!"
19183         cpp_stuff=42
19184 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19185         echo "Ah, yes!  The good old days!" >&4
19186         echo "However, in the good old days we don't know how to stringify and"
19187         echo "catify at the same time."
19188         cpp_stuff=1
19189 else
19190         $cat >&4 <<EOM
19191 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19192 You're going to have to edit the values of CAT[2-5] in config.h...
19193 EOM
19194         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19195 fi
19196 $rm -f cpp_stuff.*
19197
19198 : see if this is a db.h system
19199 set db.h i_db
19200 eval $inhdr
19201
19202 case "$i_db" in
19203 $define)
19204         : Check db version.
19205         echo " "
19206         echo "Checking Berkeley DB version ..." >&4
19207         $cat >try.c <<EOCP
19208 #$d_const HASCONST
19209 #ifndef HASCONST
19210 #define const
19211 #endif
19212 #include <sys/types.h>
19213 #include <stdio.h>
19214 #$i_stdlib I_STDLIB
19215 #ifdef I_STDLIB
19216 #include <stdlib.h>
19217 #endif
19218 #include <db.h>
19219 int main(int argc, char *argv[])
19220 {
19221 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19222     int Major, Minor, Patch ;
19223     unsigned long Version ;
19224     (void)db_version(&Major, &Minor, &Patch) ;
19225     if (argc == 2) {
19226         printf("%d %d %d %d %d %d\n",
19227                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19228                Major, Minor, Patch);
19229         exit(0);
19230     }
19231     printf("You have Berkeley DB Version 2 or greater.\n");
19232
19233     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19234                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19235     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19236                 Major, Minor, Patch) ;
19237
19238     /* check that db.h & libdb are compatible */
19239     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19240         printf("db.h and libdb are incompatible.\n") ;
19241         exit(3);
19242     }
19243
19244     printf("db.h and libdb are compatible.\n") ;
19245
19246     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19247                 + DB_VERSION_PATCH ;
19248
19249     /* needs to be >= 2.3.4 */
19250     if (Version < 2003004) {
19251     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19252         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19253         exit(2);
19254     }
19255
19256     exit(0);
19257 #else
19258 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19259     if (argc == 2) {
19260         printf("1 0 0\n");
19261         exit(0);
19262     }
19263     printf("You have Berkeley DB Version 1.\n");
19264     exit(0);    /* DB version < 2: the coast is clear. */
19265 #else
19266     exit(1);    /* <db.h> not Berkeley DB? */
19267 #endif
19268 #endif
19269 }
19270 EOCP
19271         set try
19272         if eval $compile_ok && $run ./try; then
19273                 echo 'Looks OK.' >&4
19274                 set `$run ./try 1`
19275                 db_version_major=$1
19276                 db_version_minor=$2
19277                 db_version_patch=$3
19278         else
19279                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19280                 i_db=$undef
19281                 case " $libs " in
19282                 *"-ldb "*)
19283                         : Remove db from list of libraries to use
19284                         echo "Removing unusable -ldb from library list" >&4
19285                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19286                         shift
19287                         libs="$*"
19288                         echo "libs = $libs" >&4
19289                         ;;
19290                 esac
19291         fi
19292         $rm_try
19293         ;;
19294 esac
19295
19296 case "$i_db" in
19297 define)
19298         : Check the return type needed for hash
19299         echo " "
19300         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19301         $cat >try.c <<EOCP
19302 #$d_const HASCONST
19303 #ifndef HASCONST
19304 #define const
19305 #endif
19306 #include <sys/types.h>
19307 #include <db.h>
19308
19309 #ifndef DB_VERSION_MAJOR
19310 u_int32_t hash_cb (ptr, size)
19311 const void *ptr;
19312 size_t size;
19313 {
19314 }
19315 HASHINFO info;
19316 int main()
19317 {
19318         info.hash = hash_cb;
19319 }
19320 #endif
19321 EOCP
19322         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19323                 if $contains warning try.out >>/dev/null 2>&1 ; then
19324                         db_hashtype='int'
19325                 else
19326                         db_hashtype='u_int32_t'
19327                 fi
19328         else
19329                 : XXX Maybe we should just give up here.
19330                 db_hashtype=u_int32_t
19331                 $cat try.out >&4
19332                 echo "Help:  I can't seem to compile the db test program." >&4
19333                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19334         fi
19335         $rm_try
19336         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19337         ;;
19338 *)      db_hashtype=u_int32_t
19339         ;;
19340 esac
19341 case "$i_db" in
19342 define)
19343         : Check the return type needed for prefix
19344         echo " "
19345         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19346         cat >try.c <<EOCP
19347 #$d_const HASCONST
19348 #ifndef HASCONST
19349 #define const
19350 #endif
19351 #include <sys/types.h>
19352 #include <db.h>
19353
19354 #ifndef DB_VERSION_MAJOR
19355 size_t prefix_cb (key1, key2)
19356 const DBT *key1;
19357 const DBT *key2;
19358 {
19359 }
19360 BTREEINFO info;
19361 int main()
19362 {
19363         info.prefix = prefix_cb;
19364 }
19365 #endif
19366 EOCP
19367         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19368                 if $contains warning try.out >>/dev/null 2>&1 ; then
19369                         db_prefixtype='int'
19370                 else
19371                         db_prefixtype='size_t'
19372                 fi
19373         else
19374                 db_prefixtype='size_t'
19375                 : XXX Maybe we should just give up here.
19376                 $cat try.out >&4
19377                 echo "Help:  I can't seem to compile the db test program." >&4
19378                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19379         fi
19380         $rm_try
19381         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19382         ;;
19383 *)      db_prefixtype='size_t'
19384         ;;
19385 esac
19386
19387 : How can we generate normalized random numbers ?
19388 echo " "
19389 echo "Using our internal random number implementation..." >&4
19390
19391 case "$ccflags" in
19392 *-Dmy_rand=*|*-Dmy_srand=*)
19393         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19394         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19395         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19396         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19397         ;;
19398 esac
19399
19400 randfunc=Perl_drand48
19401 drand01="Perl_drand48()"
19402 seedfunc="Perl_drand48_init"
19403 randbits=48
19404 randseedtype=U32
19405
19406 : Check how to flush
19407 echo " "
19408 $cat >&4 <<EOM
19409 Checking how to flush all pending stdio output...
19410 EOM
19411 # I only know how to find the first 32 possibly open files on SunOS.
19412 # See also hints/sunos_4_1.sh and util.c  --AD
19413 case "$osname" in
19414 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19415 esac
19416 $cat >>try.c <<EOCP
19417 #include <stdio.h>
19418 #$i_stdlib I_STDLIB
19419 #ifdef I_STDLIB
19420 #include <stdlib.h>
19421 #endif
19422 #$i_unistd I_UNISTD
19423 #ifdef I_UNISTD
19424 # include <unistd.h>
19425 #endif
19426 #$d_sysconf HAS_SYSCONF
19427 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19428 #ifdef HAS_STDIO_STREAM_ARRAY
19429 # define STDIO_STREAM_ARRAY $stdio_stream_array
19430 #endif
19431 int main() {
19432   FILE* p;
19433   unlink("try.out");
19434   p = fopen("try.out", "w");
19435 #ifdef TRY_FPUTC
19436   fputc('x', p);
19437 #else
19438 # ifdef TRY_FPRINTF
19439   fprintf(p, "x");
19440 # endif
19441 #endif
19442 #ifdef TRY_FFLUSH_NULL
19443   fflush(NULL);
19444 #endif
19445 #ifdef TRY_FFLUSH_ALL
19446   {
19447     long open_max = -1;
19448 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19449     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19450 # else
19451 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19452     open_max = sysconf(_SC_OPEN_MAX);
19453 #  else
19454 #   ifdef FOPEN_MAX
19455     open_max = FOPEN_MAX;
19456 #   else
19457 #    ifdef OPEN_MAX
19458     open_max = OPEN_MAX;
19459 #    else
19460 #     ifdef _NFILE
19461     open_max = _NFILE;
19462 #     endif
19463 #    endif
19464 #   endif
19465 #  endif
19466 # endif
19467 # ifdef HAS_STDIO_STREAM_ARRAY
19468     if (open_max > 0) {
19469       long i;
19470       for (i = 0; i < open_max; i++)
19471             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19472                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19473                 STDIO_STREAM_ARRAY[i]._flag)
19474                 fflush(&STDIO_STREAM_ARRAY[i]);
19475     }
19476   }
19477 # endif
19478 #endif
19479   _exit(42);
19480 }
19481 EOCP
19482 : first we have to find out how _not_ to flush
19483 $to try.c
19484 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19485     output=''
19486     set try -DTRY_FPUTC
19487     if eval $compile; then
19488             $run ./try 2>/dev/null
19489             code="$?"
19490             $from try.out
19491             if $test ! -s try.out -a "X$code" = X42; then
19492                 output=-DTRY_FPUTC
19493             fi
19494     fi
19495     case "$output" in
19496     '')
19497             set try -DTRY_FPRINTF
19498             if eval $compile; then
19499                     $run ./try 2>/dev/null
19500                     code="$?"
19501                     $from try.out
19502                     if $test ! -s try.out -a "X$code" = X42; then
19503                         output=-DTRY_FPRINTF
19504                     fi
19505             fi
19506         ;;
19507     esac
19508 fi
19509 : check for fflush NULL behavior
19510 case "$fflushNULL" in
19511 '')     set try -DTRY_FFLUSH_NULL $output
19512         if eval $compile; then
19513                 $run ./try 2>/dev/null
19514                 code="$?"
19515                 $from try.out
19516                 if $test -s try.out -a "X$code" = X42; then
19517                         fflushNULL="`$cat try.out`"
19518                 else
19519                         if $test "X$code" != X42; then
19520                                 $cat >&4 <<EOM
19521 (If this test failed, don't worry, we'll try another method shortly.)
19522 EOM
19523                         fi
19524                 fi
19525         fi
19526         $rm -f core try.core core.try.*
19527         case "$fflushNULL" in
19528         x)      $cat >&4 <<EOM
19529 Your fflush(NULL) works okay for output streams.
19530 Let's see if it clobbers input pipes...
19531 EOM
19532 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19533 # bug that improperly flushes the input end of pipes.  So we avoid the
19534 # autoflush on fork/system/exec support for now. :-(
19535 $cat >tryp.c <<EOCP
19536 #include <stdio.h>
19537 int
19538 main(int argc, char **argv)
19539 {
19540     char buf[1024];
19541     int i;
19542     char *bp = buf;
19543     while (1) {
19544         while ((i = getc(stdin)) != -1
19545                && (*bp++ = i) != '\n'
19546                && bp < &buf[1024])
19547         /* DO NOTHING */ ;
19548         *bp = '\0';
19549         fprintf(stdout, "%s", buf);
19550         fflush(NULL);
19551         if (i == -1)
19552             return 0;
19553         bp = buf;
19554     }
19555 }
19556 EOCP
19557                 fflushNULL="$define"
19558                 set tryp
19559                 if eval $compile; then
19560                     $rm -f tryp.out
19561                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19562                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19563                        $cat >&4 <<EOM
19564 fflush(NULL) seems to behave okay with input streams.
19565 EOM
19566                         fflushNULL="$define"
19567                     else
19568                         $cat >&4 <<EOM
19569 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19570 EOM
19571                         fflushNULL="$undef"
19572                     fi
19573                 fi
19574                 $rm -f core tryp.c tryp.core core.tryp.*
19575                 ;;
19576         '')     $cat >&4 <<EOM
19577 Your fflush(NULL) isn't working (contrary to ANSI C).
19578 EOM
19579                 fflushNULL="$undef"
19580                 ;;
19581         *)      $cat >&4 <<EOM
19582 Cannot figure out whether your fflush(NULL) works or not.
19583 I'm assuming it doesn't (contrary to ANSI C).
19584 EOM
19585                 fflushNULL="$undef"
19586                 ;;
19587         esac
19588         ;;
19589 $define|true|[yY]*)
19590         fflushNULL="$define"
19591         ;;
19592 *)
19593         fflushNULL="$undef"
19594         ;;
19595 esac
19596 : check explicit looping only if NULL did not work, and if the pipe
19597 : bug does not show up on an explicit flush too
19598 case "$fflushNULL" in
19599 "$undef")
19600         $cat >tryp.c <<EOCP
19601 #include <stdio.h>
19602 int
19603 main(int argc, char **argv)
19604 {
19605     char buf[1024];
19606     int i;
19607     char *bp = buf;
19608     while (1) {
19609         while ((i = getc(stdin)) != -1
19610                && (*bp++ = i) != '\n'
19611                && bp < &buf[1024])
19612         /* DO NOTHING */ ;
19613         *bp = '\0';
19614         fprintf(stdout, "%s", buf);
19615         fflush(stdin);
19616         if (i == -1)
19617             return 0;
19618         bp = buf;
19619     }
19620 }
19621 EOCP
19622         set tryp
19623         if eval $compile; then
19624             $rm -f tryp.out
19625             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19626             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19627                $cat >&4 <<EOM
19628 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19629 EOM
19630                 : now check for fflushall behaviour
19631                 case "$fflushall" in
19632                 '')     set try -DTRY_FFLUSH_ALL $output
19633                         if eval $compile; then
19634                                 $cat >&4 <<EOM
19635 (Now testing the other method--but note that this also may fail.)
19636 EOM
19637                                 $run ./try 2>/dev/null
19638                                 code=$?
19639                                 $from try.out
19640                                 if $test -s try.out -a "X$code" = X42; then
19641                                         fflushall="`$cat try.out`"
19642                                 fi
19643                         fi
19644                         $rm_try
19645                         case "$fflushall" in
19646                         x)      $cat >&4 <<EOM
19647 Whew. Flushing explicitly all the stdio streams works.
19648 EOM
19649                                 fflushall="$define"
19650                                 ;;
19651                         '')     $cat >&4 <<EOM
19652 Sigh. Flushing explicitly all the stdio streams doesn't work.
19653 EOM
19654                                 fflushall="$undef"
19655                                 ;;
19656                         *)      $cat >&4 <<EOM
19657 Cannot figure out whether flushing stdio streams explicitly works or not.
19658 I'm assuming it doesn't.
19659 EOM
19660                                 fflushall="$undef"
19661                                 ;;
19662                         esac
19663                         ;;
19664                 "$define"|true|[yY]*)
19665                         fflushall="$define"
19666                         ;;
19667                 *)
19668                         fflushall="$undef"
19669                         ;;
19670                 esac
19671             else
19672                 $cat >&4 <<EOM
19673 All is futile.  Even fflush(stdin) clobbers input pipes!
19674 EOM
19675                 fflushall="$undef"
19676             fi
19677         else
19678             fflushall="$undef"
19679         fi
19680         $rm -f core tryp.c tryp.core core.tryp.*
19681         ;;
19682 *)      fflushall="$undef"
19683         ;;
19684 esac
19685
19686 case "$fflushNULL$fflushall" in
19687 undefundef)
19688         $cat <<EOM
19689 OK, I give up.  I cannot figure out how to flush pending stdio output.
19690 We won't be flushing handles at all before fork/exec/popen.
19691 EOM
19692         ;;
19693 esac
19694 $rm_try tryp
19695
19696 : Store the full pathname to the ar program for use in the C program
19697 : Respect a hint or command line value for full_ar.
19698 case "$full_ar" in
19699 '') full_ar=$ar ;;
19700 esac
19701
19702 : Store the full pathname to the sed program for use in the C program
19703 full_sed=$sed
19704
19705 : see what type gids are declared as in the kernel
19706 echo " "
19707 echo "Looking for the type for group ids returned by getgid()."
19708 set gid_t gidtype xxx stdio.h sys/types.h
19709 eval $typedef
19710 case "$gidtype" in
19711 xxx)
19712         xxx=`./findhdr sys/user.h`
19713         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19714         case $1 in
19715         unsigned) dflt="$1 $2" ;;
19716         *) dflt="$1" ;;
19717         esac
19718         ;;
19719 *) dflt="$gidtype";;
19720 esac
19721 case "$gidtype" in
19722 gid_t) echo "gid_t found." ;;
19723 *)      rp="What is the type for group ids returned by getgid()?"
19724         . ./myread
19725         gidtype="$ans"
19726         ;;
19727 esac
19728
19729 : Check the size of GID
19730 echo " "
19731 case "$gidtype" in
19732 *_t) zzz="$gidtype"     ;;
19733 *)   zzz="gid"          ;;
19734 esac
19735 echo "Checking the size of $zzz..." >&4
19736 cat > try.c <<EOCP
19737 #include <sys/types.h>
19738 #include <stdio.h>
19739 #$i_stdlib I_STDLIB
19740 #ifdef I_STDLIB
19741 #include <stdlib.h>
19742 #endif
19743 int main() {
19744     printf("%d\n", (int)sizeof($gidtype));
19745     exit(0);
19746 }
19747 EOCP
19748 set try
19749 if eval $compile_ok; then
19750         yyy=`$run ./try`
19751         case "$yyy" in
19752         '')     gidsize=4
19753                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19754                 ;;
19755         *)      gidsize=$yyy
19756                 echo "Your $zzz is $gidsize bytes long."
19757                 ;;
19758         esac
19759 else
19760         gidsize=4
19761         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19762 fi
19763
19764
19765 : Check if GID is signed
19766 echo " "
19767 case "$gidtype" in
19768 *_t) zzz="$gidtype"     ;;
19769 *)   zzz="gid"          ;;
19770 esac
19771 echo "Checking the sign of $zzz..." >&4
19772 cat > try.c <<EOCP
19773 #include <sys/types.h>
19774 #include <stdio.h>
19775 int main() {
19776         $gidtype foo = -1;
19777         if (foo < 0)
19778                 printf("-1\n");
19779         else
19780                 printf("1\n");
19781 }
19782 EOCP
19783 set try
19784 if eval $compile; then
19785         yyy=`$run ./try`
19786         case "$yyy" in
19787         '')     gidsign=1
19788                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19789                 ;;
19790         *)      gidsign=$yyy
19791                 case "$gidsign" in
19792                  1) echo "Your $zzz is unsigned." ;;
19793                 -1) echo "Your $zzz is signed."   ;;
19794                 esac
19795                 ;;
19796         esac
19797 else
19798         gidsign=1
19799         echo "(I can't compile the test program--guessing unsigned.)" >&4
19800 fi
19801
19802
19803 : Check 64bit sizes
19804 echo " "
19805
19806 if $test X"$quadtype" != X; then
19807
19808 echo "Checking how to print 64-bit integers..." >&4
19809
19810 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19811         $cat >try.c <<'EOCP'
19812 #include <sys/types.h>
19813 #include <stdio.h>
19814 int main() {
19815   int q = 12345678901;
19816   printf("%ld\n", q);
19817 }
19818 EOCP
19819         set try
19820         if eval $compile; then
19821                 yyy=`$run ./try`
19822                 case "$yyy" in
19823                 12345678901)
19824                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19825                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19826                         echo "We will use %d."
19827                         ;;
19828                 esac
19829         fi
19830 fi
19831
19832 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19833         $cat >try.c <<'EOCP'
19834 #include <sys/types.h>
19835 #include <stdio.h>
19836 int main() {
19837   long q = 12345678901;
19838   printf("%ld\n", q);
19839 }
19840 EOCP
19841         set try
19842         if eval $compile; then
19843                 yyy=`$run ./try`
19844                 case "$yyy" in
19845                 12345678901)
19846                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19847                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19848                         echo "We will use %ld."
19849                         ;;
19850                 esac
19851         fi
19852 fi
19853
19854 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19855         $cat >try.c <<'EOCP'
19856 #include <sys/types.h>
19857 #include <inttypes.h>
19858 #include <stdio.h>
19859 int main() {
19860   int64_t q = 12345678901;
19861   printf("%" PRId64 "\n", q);
19862 }
19863 EOCP
19864         set try
19865         if eval $compile; then
19866                 yyy=`$run ./try`
19867                 case "$yyy" in
19868                 12345678901)
19869                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19870                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19871                         echo "We will use the C9X style."
19872                         ;;
19873                 esac
19874         fi
19875 fi
19876
19877 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19878         $cat >try.c <<EOCP
19879 #include <sys/types.h>
19880 #include <stdio.h>
19881 int main() {
19882   $quadtype q = 12345678901;
19883   printf("%Ld\n", q);
19884 }
19885 EOCP
19886         set try
19887         if eval $compile; then
19888                 yyy=`$run ./try`
19889                 case "$yyy" in
19890                 12345678901)
19891                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19892                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19893                         echo "We will use %Ld."
19894                         ;;
19895                 esac
19896         fi
19897 fi
19898
19899 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19900         $cat >try.c <<'EOCP'
19901 #include <sys/types.h>
19902 #include <stdio.h>
19903 int main() {
19904   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19905   printf("%lld\n", q);
19906 }
19907 EOCP
19908         set try
19909         if eval $compile; then
19910                 yyy=`$run ./try`
19911                 case "$yyy" in
19912                 12345678901)
19913                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19914                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19915                         echo "We will use the %lld style."
19916                         ;;
19917                 esac
19918         fi
19919 fi
19920
19921 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19922         $cat >try.c <<EOCP
19923 #include <sys/types.h>
19924 #include <stdio.h>
19925 int main() {
19926   $quadtype q = 12345678901;
19927   printf("%qd\n", q);
19928 }
19929 EOCP
19930         set try
19931         if eval $compile; then
19932                 yyy=`$run ./try`
19933                 case "$yyy" in
19934                 12345678901)
19935                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19936                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19937                         echo "We will use %qd."
19938                         ;;
19939                 esac
19940         fi
19941 fi
19942
19943 if $test X"$sPRId64" = X; then
19944         echo "Cannot figure out how to print 64-bit integers." >&4
19945 fi
19946 $rm_try
19947
19948 fi
19949
19950 case "$sPRId64" in
19951 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19952         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19953         ;;
19954 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19955         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19956         ;;
19957 esac
19958
19959 : Check format strings for internal types
19960 echo " "
19961 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19962
19963 if $test X"$ivsize" = X8; then
19964         ivdformat="$sPRId64"
19965         uvuformat="$sPRIu64"
19966         uvoformat="$sPRIo64"
19967         uvxformat="$sPRIx64"
19968         uvXUformat="$sPRIXU64"
19969 else
19970         if $test X"$ivsize" = X"$longsize"; then
19971                 ivdformat='"ld"'
19972                 uvuformat='"lu"'
19973                 uvoformat='"lo"'
19974                 uvxformat='"lx"'
19975                 uvXUformat='"lX"'
19976         else
19977                 if $test X"$ivsize" = X"$intsize"; then
19978                         ivdformat='"d"'
19979                         uvuformat='"u"'
19980                         uvoformat='"o"'
19981                         uvxformat='"x"'
19982                         uvXUformat='"X"'
19983                 else
19984                         : far out
19985                         if $test X"$ivsize" = X"$shortsize"; then
19986                                 ivdformat='"hd"'
19987                                 uvuformat='"hu"'
19988                                 uvoformat='"ho"'
19989                                 uvxformat='"hx"'
19990                                 uvXUformat='"hX"'
19991                         fi
19992                 fi
19993         fi
19994 fi
19995
19996 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19997         nveformat="$sPRIeldbl"
19998         nvfformat="$sPRIfldbl"
19999         nvgformat="$sPRIgldbl"
20000         nvEUformat="$sPRIEUldbl"
20001         nvFUformat="$sPRIFUldbl"
20002         nvGUformat="$sPRIGUldbl"
20003 else
20004         nveformat='"e"'
20005         nvfformat='"f"'
20006         nvgformat='"g"'
20007         nvEUformat='"E"'
20008         nvFUformat='"F"'
20009         nvGUformat='"G"'
20010 fi
20011
20012 case "$ivdformat" in
20013 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20014     exit 1
20015     ;;
20016 esac
20017
20018 : Check format string for GID
20019
20020 echo " "
20021 $echo "Checking the format string to be used for gids..." >&4
20022
20023 case "$gidsign" in
20024 -1)     if $test X"$gidsize" = X"$ivsize"; then
20025                 gidformat="$ivdformat"
20026         else
20027                 if $test X"$gidsize" = X"$longsize"; then
20028                         gidformat='"ld"'
20029                 else
20030                         if $test X"$gidsize" = X"$intsize"; then
20031                                 gidformat='"d"'
20032                         else
20033                                 if $test X"$gidsize" = X"$shortsize"; then
20034                                         gidformat='"hd"'
20035                                 fi
20036                         fi
20037                 fi
20038         fi
20039         ;;
20040 *)      if $test X"$gidsize" = X"$uvsize"; then
20041                 gidformat="$uvuformat"
20042         else
20043                 if $test X"$gidsize" = X"$longsize"; then
20044                         gidformat='"lu"'
20045                 else
20046                         if $test X"$gidsize" = X"$intsize"; then
20047                                 gidformat='"u"'
20048                         else
20049                                 if $test X"$gidsize" = X"$shortsize"; then
20050                                         gidformat='"hu"'
20051                                 fi
20052                         fi
20053                 fi
20054         fi
20055         ;;
20056 esac
20057
20058 : see if getgroups exists
20059 set getgroups d_getgrps
20060 eval $inlibc
20061
20062 : see if setgroups exists
20063 set setgroups d_setgrps
20064 eval $inlibc
20065
20066 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20067 echo " "
20068 case "$d_getgrps$d_setgrps" in
20069 *define*)
20070         case "$groupstype" in
20071         '') dflt="$gidtype" ;;
20072         *)  dflt="$groupstype" ;;
20073         esac
20074         $cat <<EOM
20075 What type of pointer is the second argument to getgroups() and setgroups()?
20076 Usually this is the same as group ids, $gidtype, but not always.
20077
20078 EOM
20079         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20080         . ./myread
20081         groupstype="$ans"
20082         ;;
20083 *)  groupstype="$gidtype";;
20084 esac
20085
20086 : MAD = Misc Attribute Definition
20087
20088 if $test $patchlevel -lt 9; then
20089 : MAD is not available in 5.8.x or earlier.
20090     ans=n;
20091 else
20092     case "$mad" in
20093     $define|true|[yY]*) dflt='y' ;;
20094     *)                  dflt='n' ;;
20095     esac
20096     cat <<EOM
20097
20098 Would you like to build with Misc Attribute Decoration? This is development
20099 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20100 overhead on the interpreter.
20101
20102 If this doesn't make any sense to you, just accept the default '$dflt'.
20103 EOM
20104     rp='Build Perl with MAD?'
20105     . ./myread
20106 fi
20107 case "$ans" in
20108 y|Y)    val="$define"
20109         madlyh='madly.h madly.act madly.tab'
20110         madlysrc='madly.c'
20111         madlyobj="madly$_o" ;;
20112 *)      val="$undef"
20113         madlyh=''
20114         madlysrc=''
20115         madlyobj='' ;;
20116 esac
20117 set mad
20118 eval $setvar
20119
20120 : check whether make sets MAKE
20121 echo " "
20122 echo "Checking if your $make program sets \$(MAKE)..." >&4
20123 case "$make_set_make" in
20124 '')
20125         $sed 's/^X //' > testmake.mak << 'EOF'
20126 Xall:
20127 X       @echo 'maketemp="$(MAKE)"'
20128 EOF
20129         case "`$make -f testmake.mak 2>/dev/null`" in
20130         *maketemp=*) make_set_make='#' ;;
20131         *)      make_set_make="MAKE=$make" ;;
20132         esac
20133         $rm -f testmake.mak
20134         ;;
20135 esac
20136 case "$make_set_make" in
20137 '#') echo "Yup, it does.";;
20138 *) echo "Nope, it doesn't.";;
20139 esac
20140
20141 : see what type is used for mode_t
20142 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20143 set mode_t modetype int stdio.h sys/types.h
20144 eval $typedef_ask
20145
20146 : see if we need va_copy
20147 echo " "
20148 case "$i_stdarg" in
20149 "$define")
20150         $cat >try.c <<EOCP
20151 #include <stdarg.h>
20152 #include <stdio.h>
20153 #$i_stdlib I_STDLIB
20154 #ifdef I_STDLIB
20155 #include <stdlib.h>
20156 #endif
20157 #include <signal.h>
20158
20159 int
20160 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20161 {
20162   return vfprintf(f, fmt, *valp);
20163 }
20164
20165 int
20166 myvfprintf(FILE *f, const  char *fmt, va_list val)
20167 {
20168   return ivfprintf(f, fmt, &val);
20169 }
20170
20171 int
20172 myprintf(char *fmt, ...)
20173 {
20174   va_list val;
20175   va_start(val, fmt);
20176   return myvfprintf(stdout, fmt, val);
20177 }
20178
20179 int
20180 main(int ac, char **av)
20181 {
20182   signal(SIGSEGV, exit);
20183
20184   myprintf("%s%cs all right, then\n", "that", '\'');
20185   exit(0);
20186 }
20187 EOCP
20188         set try
20189         if eval $compile && $run ./try 2>&1 >/dev/null; then
20190                 case "`$run ./try`" in
20191                 "that's all right, then")
20192                         okay=yes
20193                         ;;
20194                 esac
20195         fi
20196         case "$okay" in
20197         yes)    echo "It seems that you don't need va_copy()." >&4
20198                 need_va_copy="$undef"
20199                 ;;
20200         *)      echo "It seems that va_copy() or similar will be needed." >&4
20201                 need_va_copy="$define"
20202                 ;;
20203         esac
20204         $rm_try
20205         ;;
20206 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20207         need_va_copy="$undef"
20208         ;;
20209 esac
20210
20211 : see what type is used for size_t
20212 rp="What is the type used for the length parameter for string functions?"
20213 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20214 eval $typedef_ask
20215
20216 : check for type of arguments to gethostbyaddr. 
20217 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20218         case "$d_gethbyaddr" in
20219         $define)
20220                 $cat <<EOM
20221
20222 Checking to see what type of arguments are accepted by gethostbyaddr().
20223 EOM
20224                 hdrs="$define sys/types.h
20225                         $d_socket sys/socket.h 
20226                         $i_niin netinet/in.h 
20227                         $i_netdb netdb.h
20228                         $i_unistd unistd.h"
20229                 : The first arg can 'char *' or 'void *'
20230                 : The second arg is some of integral type
20231                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20232                         for yyy in size_t long int; do
20233                                 case "$netdb_host_type" in
20234                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20235                                         if ./protochk "$try" $hdrs; then
20236                                                 echo "Your system accepts $xxx for the first arg."
20237                                                 echo "...and $yyy for the second arg."
20238                                                 netdb_host_type="$xxx"
20239                                                 netdb_hlen_type="$yyy"
20240                                         fi
20241                                         ;;
20242                                 esac
20243                         done
20244                 done
20245                 : In case none of those worked, prompt the user.
20246                 case "$netdb_host_type" in
20247                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20248                         dflt='char *'
20249                         . ./myread
20250                         netdb_host_type=$ans
20251                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20252                         dflt="$sizetype"
20253                         . ./myread
20254                         netdb_hlen_type=$ans
20255                         ;;
20256                 esac
20257                 ;;
20258         *)      : no gethostbyaddr, so pick harmless defaults
20259                 netdb_host_type='char *'
20260                 netdb_hlen_type="$sizetype"
20261                 ;;
20262         esac
20263         # Remove the "const" if needed. -- but then we'll have a 
20264         # prototype clash!
20265         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20266 fi
20267
20268 : check for type of argument to gethostbyname. 
20269 if test "X$netdb_name_type" = X ; then
20270         case "$d_gethbyname" in
20271         $define)
20272                 $cat <<EOM
20273
20274 Checking to see what type of argument is accepted by gethostbyname().
20275 EOM
20276                 hdrs="$define sys/types.h
20277                         $d_socket sys/socket.h 
20278                         $i_niin netinet/in.h 
20279                         $i_netdb netdb.h
20280                         $i_unistd unistd.h"
20281                 for xxx in "const char *" "char *"; do
20282                         case "$netdb_name_type" in
20283                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20284                                 if ./protochk "$try" $hdrs; then
20285                                         echo "Your system accepts $xxx."
20286                                         netdb_name_type="$xxx"
20287                                 fi
20288                                 ;;
20289                         esac
20290                 done
20291                 : In case none of those worked, prompt the user.
20292                 case "$netdb_name_type" in
20293                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20294                         dflt='char *'
20295                         . ./myread
20296                         netdb_name_type=$ans
20297                         ;;
20298                 esac
20299                 ;;
20300         *)      : no gethostbyname, so pick harmless default
20301                 netdb_name_type='char *'
20302                 ;;
20303         esac
20304 fi
20305
20306 : check for type of 1st argument to getnetbyaddr. 
20307 if test "X$netdb_net_type" = X ; then
20308         case "$d_getnbyaddr" in
20309         $define)
20310                 $cat <<EOM
20311
20312 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20313 EOM
20314                 hdrs="$define sys/types.h
20315                         $d_socket sys/socket.h 
20316                         $i_niin netinet/in.h 
20317                         $i_netdb netdb.h
20318                         $i_unistd unistd.h"
20319                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20320                         case "$netdb_net_type" in
20321                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20322                                 if ./protochk "$try" $hdrs; then
20323                                         echo "Your system accepts $xxx."
20324                                         netdb_net_type="$xxx"
20325                                 fi
20326                                 ;;
20327                         esac
20328                 done
20329                 : In case none of those worked, prompt the user.
20330                 case "$netdb_net_type" in
20331                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20332                         dflt='long'
20333                         . ./myread
20334                         netdb_net_type=$ans
20335                         ;;
20336                 esac
20337                 ;;
20338         *)      : no getnetbyaddr, so pick harmless default
20339                 netdb_net_type='long'
20340                 ;;
20341         esac
20342 fi
20343 : locate the preferred pager for this system
20344 fn=f/
20345 case "$pager" in
20346 '')
20347         dflt=''
20348         case "$pg" in
20349         /*) dflt=$pg;;
20350         [a-zA-Z]:/*) dflt=$pg;;
20351         esac
20352         case "$more" in
20353         /*) dflt=$more;;
20354         [a-zA-Z]:/*) dflt=$more;;
20355         esac
20356         case "$less" in
20357         /*) dflt=$less;;
20358         [a-zA-Z]:/*) dflt=$less;;
20359         esac
20360         case "$dflt" in
20361         '') dflt=/usr/ucb/more;;
20362         esac
20363         ;;
20364 *)      dflt="$pager"
20365         ;;
20366 esac
20367 fn="f/($dflt)"
20368 echo " "
20369 rp='What pager is used on your system?'
20370 . ./getfile
20371 pager="$ans"
20372
20373 : see what type pids are declared as in the kernel
20374 rp="What is the type of process ids on this system?"
20375 set pid_t pidtype int stdio.h sys/types.h
20376 eval $typedef_ask
20377
20378 : see if ar generates random libraries by itself
20379 echo " "
20380 echo "Checking how to generate random libraries on your machine..." >&4
20381 echo 'int bar1() { return bar2(); }' > bar1.c
20382 echo 'int bar2() { return 2; }' > bar2.c
20383 $cat > foo.c <<EOP
20384 #$i_stdlib I_STDLIB
20385 #ifdef I_STDLIB
20386 #include <stdlib.h>
20387 #endif
20388 int main() { printf("%d\n", bar1()); exit(0); }
20389 EOP
20390 $cc $ccflags -c bar1.c >/dev/null 2>&1
20391 $cc $ccflags -c bar2.c >/dev/null 2>&1
20392 $cc $ccflags -c foo.c >/dev/null 2>&1
20393 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20394 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20395         $run ./foobar >/dev/null 2>&1; then
20396         echo "$ar appears to generate random libraries itself."
20397         orderlib=false
20398         if [ "X$ranlib" = "X" ]; then
20399             ranlib=":"
20400         fi
20401 elif $ar s bar$_a >/dev/null 2>&1 &&
20402         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20403         $run ./foobar >/dev/null 2>&1; then
20404                 echo "a table of contents needs to be added with '$ar s'."
20405                 orderlib=false
20406                 ranlib="$ar s"
20407 elif $ar ts bar$_a >/dev/null 2>&1 &&
20408         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20409         $run ./foobar >/dev/null 2>&1; then
20410                 echo "a table of contents needs to be added with '$ar ts'."
20411                 orderlib=false
20412                 ranlib="$ar ts"
20413 else
20414         case "$ranlib" in
20415         :) ranlib='';;
20416         '')
20417                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20418                 $test -f $ranlib || ranlib=''
20419                 ;;
20420         esac
20421         if $test -n "$ranlib"; then
20422                 echo "your system has '$ranlib'; we'll use that."
20423                 orderlib=false
20424         else
20425                 echo "your system doesn't seem to support random libraries"
20426                 echo "so we'll use lorder and tsort to order the libraries."
20427                 orderlib=true
20428                 ranlib=":"
20429         fi
20430 fi
20431 $rm -f foo* bar*
20432
20433 : see if this is a values.h system
20434 set values.h i_values
20435 eval $inhdr
20436
20437 : Check the max offset that gmtime and localtime accept
20438 echo "Checking max offsets that gmtime () accepts"
20439
20440 case $i_values in
20441     define) yyy="#include <values.h>" ;;
20442     *)      yyy="" ;;
20443     esac
20444
20445 case "$sGMTIME_min/$sGMTIME_max" in
20446     0/0|/)
20447         $cat >try.c <<EOCP
20448 #include <sys/types.h>
20449 #include <stdio.h>
20450 #include <time.h>
20451 $yyy
20452
20453 int i;
20454 struct tm *tmp;
20455 time_t pt;
20456
20457 void gm_check (time_t t, int min_year, int max_year)
20458 {
20459     tmp = gmtime (&t);
20460     if ( tmp == NULL ||
20461         /* Check tm_year overflow */
20462          tmp->tm_year < min_year || tmp->tm_year > max_year)
20463         tmp = NULL;
20464     else
20465         pt = t;
20466     } /* gm_check */
20467
20468 int check_max ()
20469 {
20470     tmp = NULL;
20471     pt  = 0;
20472 #ifdef MAXLONG
20473     gm_check (MAXLONG, 69, 0x7fffffff);
20474 #endif
20475     if (tmp == NULL || tmp->tm_year < 0) {
20476         for (i = 63; i >= 0; i--) {
20477             time_t x = pt | ((time_t)1 << i);
20478             if (x < 0 || x < pt) continue;
20479             gm_check (x, 69, 0x7fffffff);
20480             }
20481         }
20482     printf ("sGMTIME_max=%ld\n", pt);
20483     return (0);
20484     } /* check_max */
20485
20486 int check_min ()
20487 {
20488     tmp = NULL;
20489     pt  = 0;
20490 #ifdef MINLONG
20491     gm_check (MINLONG, -1900, 70);
20492 #endif
20493     if (tmp == NULL) {
20494         for (i = 36; i >= 0; i--) {
20495             time_t x = pt - ((time_t)1 << i);
20496             if (x > 0) continue;
20497             gm_check (x, -1900, 70);
20498             }
20499         }
20500     printf ("sGMTIME_min=%ld\n", pt);
20501     return (0);
20502     } /* check_min */
20503
20504 int main (int argc, char *argv[])
20505 {
20506     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20507     check_max ();
20508     check_min ();
20509     return (0);
20510     } /* main */
20511 EOCP
20512         set try
20513         if eval $compile; then
20514             eval `$run ./try`
20515         else
20516             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20517             fi
20518         $rm_try
20519         ;;
20520     esac
20521
20522 echo "Checking max offsets that localtime () accepts"
20523
20524 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20525     0/0|/)
20526         $cat >try.c <<EOCP
20527 #include <sys/types.h>
20528 #include <stdio.h>
20529 #include <time.h>
20530 $yyy
20531
20532 int i;
20533 struct tm *tmp;
20534 time_t pt;
20535
20536 void local_check (time_t t, int min_year, int max_year)
20537 {
20538     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20539         tmp = NULL;
20540     else
20541         tmp = localtime (&t);
20542     if ( tmp == NULL ||
20543         /* Check tm_year overflow */
20544          tmp->tm_year < min_year || tmp->tm_year > max_year)
20545         tmp = NULL;
20546     else
20547         pt = t;
20548     } /* local_check */
20549
20550 int check_max ()
20551 {
20552     tmp = NULL;
20553     pt  = 0;
20554 #ifdef MAXLONG
20555     local_check (MAXLONG, 69, 0x7fffffff);
20556 #endif
20557     if (tmp == NULL || tmp->tm_year < 0) {
20558         for (i = 63; i >= 0; i--) {
20559             time_t x = pt | ((time_t)1 << i);
20560             if (x < 0 || x < pt) continue;
20561             local_check (x, 69, 0x7fffffff);
20562             }
20563         }
20564     printf ("sLOCALTIME_max=%ld\n", pt);
20565     return (0);
20566    } /* check_max */
20567
20568 int check_min ()
20569 {
20570     tmp = NULL;
20571     pt  = 0;
20572 #ifdef MINLONG
20573     local_check (MINLONG, -1900, 70);
20574 #endif
20575     if (tmp == NULL) {
20576         for (i = 36; i >= 0; i--) {
20577             time_t x = pt - ((time_t)1 << i);
20578             if (x > 0) continue;
20579             local_check (x, -1900, 70);
20580             }
20581         }
20582     printf ("sLOCALTIME_min=%ld\n", pt);
20583     return (0);
20584     } /* check_min */
20585
20586 int main (int argc, char *argv[])
20587 {
20588     check_max ();
20589     check_min ();
20590     return (0);
20591     } /* main */
20592 EOCP
20593         set try
20594         if eval $compile; then
20595             eval `$run ./try`
20596         else
20597             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20598             fi
20599         $rm_try
20600         ;;
20601     esac
20602
20603 : check for type of arguments to select.
20604 case "$selecttype" in
20605 '') case "$d_select" in
20606         $define)
20607                 echo " "
20608                 $cat <<EOM
20609 Checking to see what type of arguments are accepted by select().
20610 EOM
20611                 hdrs="$define sys/types.h
20612                         $i_systime sys/time.h
20613                         $i_sysselct sys/select.h
20614                         $d_socket sys/socket.h"
20615                 : The first arg can be int, unsigned, or size_t
20616                 : The last arg may or may not be 'const'
20617                 val=''
20618                 : void pointer has been seen but using that
20619                 : breaks the selectminbits test
20620                 for xxx in 'fd_set *' 'int *'; do
20621                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20622                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20623                                         case "$val" in
20624                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20625                                                 if ./protochk "$try" $hdrs; then
20626                                                         echo "Your system accepts $xxx."
20627                                                         val="$xxx"
20628                                                 fi
20629                                                 ;;
20630                                         esac
20631                                 done
20632                         done
20633                 done
20634                 case "$val" in
20635                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20636                         case "$d_fd_set" in
20637                                 $define) dflt="fd_set *" ;;
20638                                 *)              dflt="int *" ;;
20639                         esac
20640                         . ./myread
20641                         val=$ans
20642                         ;;
20643                 esac
20644                 selecttype="$val"
20645                 ;;
20646         *)      : no select, so pick a harmless default
20647                 selecttype='int *'
20648                 ;;
20649         esac
20650         ;;
20651 esac
20652
20653 : check for the select 'width'
20654 case "$selectminbits" in
20655 '') safebits=`expr $ptrsize \* 8`
20656     case "$d_select" in
20657         $define)
20658                 $cat <<EOM
20659
20660 Checking to see on how many bits at a time your select() operates...
20661 EOM
20662                 $cat >try.c <<EOCP
20663 #include <sys/types.h>
20664 #$i_time I_TIME
20665 #$i_systime I_SYS_TIME
20666 #$i_systimek I_SYS_TIME_KERNEL
20667 #ifdef I_TIME
20668 #   include <time.h>
20669 #endif
20670 #ifdef I_SYS_TIME
20671 #   ifdef I_SYS_TIME_KERNEL
20672 #       define KERNEL
20673 #   endif
20674 #   include <sys/time.h>
20675 #   ifdef I_SYS_TIME_KERNEL
20676 #       undef KERNEL
20677 #   endif
20678 #endif
20679 #$i_sysselct I_SYS_SELECT
20680 #ifdef I_SYS_SELECT
20681 #include <sys/select.h>
20682 #endif
20683 #$d_socket HAS_SOCKET
20684 #ifdef HAS_SOCKET
20685 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20686 #endif
20687 #include <stdio.h>
20688 #$i_stdlib I_STDLIB
20689 #ifdef I_STDLIB
20690 #include <stdlib.h>
20691 #endif
20692 $selecttype b;
20693 #define S sizeof(*(b))
20694 #define MINBITS 64
20695 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20696 #define NBITS  (NBYTES * 8)
20697 int main() {
20698     char *s = (char *)malloc(NBYTES);
20699     struct timeval t;
20700     int i;
20701     FILE* fp;
20702     int fd;
20703
20704     if (!s)
20705         exit(1);
20706     fclose(stdin);
20707     fp = fopen("try.c", "r");
20708     if (fp == 0)
20709       exit(2);
20710     fd = fileno(fp);
20711     if (fd < 0)
20712       exit(3);
20713     b = ($selecttype)s;
20714     for (i = 0; i < NBITS; i++)
20715         FD_SET(i, b);
20716     t.tv_sec  = 0;
20717     t.tv_usec = 0;
20718     select(fd + 1, b, 0, 0, &t);
20719     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20720     free(s);
20721     printf("%d\n", i + 1);
20722     return 0;
20723 }
20724 EOCP
20725                 set try
20726                 if eval $compile_ok; then
20727                         selectminbits=`$run ./try`
20728                         case "$selectminbits" in
20729                         '')     cat >&4 <<EOM
20730 Cannot figure out on how many bits at a time your select() operates.
20731 I'll play safe and guess it is $safebits bits.
20732 EOM
20733                                 selectminbits=$safebits
20734                                 bits="$safebits bits"
20735                                 ;;
20736                         1)      bits="1 bit" ;;
20737                         *)      bits="$selectminbits bits" ;;
20738                         esac
20739                         echo "Your select() operates on $bits at a time." >&4
20740                 else
20741                         rp='What is the minimum number of bits your select() operates on?'
20742                         case "$byteorder" in
20743                         12345678)       dflt=64 ;;
20744                         1234)           dflt=32 ;;
20745                         *)              dflt=1  ;;
20746                         esac
20747                         . ./myread
20748                         val=$ans
20749                         selectminbits="$val"
20750                 fi
20751                 $rm_try
20752                 ;;
20753         *)      : no select, so pick a harmless default
20754                 selectminbits=$safebits
20755                 ;;
20756         esac
20757         ;;
20758 esac
20759
20760 : Trace out the files included by signal.h, then look for SIGxxx names.
20761 if [ "X$fieldn" = X ]; then
20762         : Just make some guesses.  We check them later.
20763         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20764 else
20765         xxx=`echo '#include <signal.h>' |
20766         $cppstdin $cppminus $cppflags 2>/dev/null |
20767         $grep '^[       ]*#.*include' |
20768         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20769                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20770 fi
20771 xxxfiles=''
20772 for xx in $xxx /dev/null ; do
20773         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20774 done
20775 case "$xxxfiles" in
20776 '')     xxxfiles=`./findhdr signal.h` ;;
20777 esac
20778 xxx=`awk '
20779 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20780         print substr($2, 4, 20)
20781 }
20782 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20783         print substr($3, 4, 20)
20784 }' $xxxfiles`
20785 : Append some common names just in case the awk scan failed.
20786 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20787 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20788 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20789 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20790 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20791
20792 : generate a few handy files for later
20793 $cat > signal.c <<EOCP
20794 #include <sys/types.h>
20795 #include <signal.h>
20796 #$i_stdlib I_STDLIB
20797 #ifdef I_STDLIB
20798 #include <stdlib.h>
20799 #endif
20800 #include <stdio.h>
20801 int main() {
20802
20803 /* Strange style to avoid deeply-nested #if/#else/#endif */
20804 #ifndef NSIG
20805 #  ifdef _NSIG
20806 #    define NSIG (_NSIG)
20807 #  endif
20808 #endif
20809
20810 #ifndef NSIG
20811 #  ifdef SIGMAX
20812 #    define NSIG (SIGMAX+1)
20813 #  endif
20814 #endif
20815
20816 #ifndef NSIG
20817 #  ifdef SIG_MAX
20818 #    define NSIG (SIG_MAX+1)
20819 #  endif
20820 #endif
20821
20822 #ifndef NSIG
20823 #  ifdef _SIG_MAX
20824 #    define NSIG (_SIG_MAX+1)
20825 #  endif
20826 #endif
20827
20828 #ifndef NSIG
20829 #  ifdef MAXSIG
20830 #    define NSIG (MAXSIG+1)
20831 #  endif
20832 #endif
20833
20834 #ifndef NSIG
20835 #  ifdef MAX_SIG
20836 #    define NSIG (MAX_SIG+1)
20837 #  endif
20838 #endif
20839
20840 #ifndef NSIG
20841 #  ifdef SIGARRAYSIZE
20842 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20843 #  endif
20844 #endif
20845
20846 #ifndef NSIG
20847 #  ifdef _sys_nsig
20848 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20849 #  endif
20850 #endif
20851
20852 /* Default to some arbitrary number that's big enough to get most
20853    of the common signals.
20854 */
20855 #ifndef NSIG
20856 #    define NSIG 50
20857 #endif
20858
20859 printf("NSIG %d\n", NSIG);
20860
20861 #ifndef JUST_NSIG
20862
20863 EOCP
20864
20865 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20866 {
20867         printf "#ifdef SIG"; printf $1; printf "\n"
20868         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20869         printf $1; printf ");\n"
20870         printf "#endif\n"
20871 }
20872 END {
20873         printf "#endif /* JUST_NSIG */\n";
20874         printf "exit(0);\n}\n";
20875 }
20876 ' >>signal.c
20877 $cat >signal.awk <<'EOP'
20878 BEGIN { ndups = 0 }
20879 $1 ~ /^NSIG$/ { nsig = $2 }
20880 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20881     if ($2 > maxsig) { maxsig = $2 }
20882     if (sig_name[$2]) {
20883         dup_name[ndups] = $1
20884         dup_num[ndups] = $2
20885         ndups++
20886     }
20887     else {
20888         sig_name[$2] = $1
20889         sig_num[$2] = $2
20890     }
20891 }
20892 END {
20893     if (nsig == 0) {
20894         nsig = maxsig + 1
20895     }
20896     printf("NSIG %d\n", nsig);
20897     for (n = 1; n < nsig; n++) {
20898         if (sig_name[n]) {
20899             printf("%s %d\n", sig_name[n], sig_num[n])
20900         }
20901         else {
20902             printf("NUM%d %d\n", n, n)
20903         }
20904     }
20905     for (n = 0; n < ndups; n++) {
20906         printf("%s %d\n", dup_name[n], dup_num[n])
20907     }
20908 }
20909 EOP
20910 $cat >signal_cmd <<EOS
20911 $startsh
20912 if $test -s signal.lst; then
20913     echo "Using your existing signal.lst file"
20914         exit 0
20915 fi
20916 xxx="$xxx"
20917 EOS
20918 $cat >>signal_cmd <<'EOS'
20919
20920 set signal
20921 if eval $compile_ok; then
20922         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20923                 $uniq | $awk -f signal.awk >signal.lst
20924 else
20925         echo "(I can't seem be able to compile the whole test program)" >&4
20926         echo "(I'll try it in little pieces.)" >&4
20927         set signal -DJUST_NSIG
20928         if eval $compile_ok; then
20929                 $run ./signal$_exe > signal.nsg
20930                 $cat signal.nsg
20931         else
20932                 echo "I can't seem to figure out how many signals you have." >&4
20933                 echo "Guessing 50." >&4
20934                 echo 'NSIG 50' > signal.nsg
20935         fi
20936         : Now look at all the signal names, one at a time.
20937         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20938                 $cat > signal.c <<EOCP
20939 #include <sys/types.h>
20940 #include <signal.h>
20941 #include <stdio.h>
20942 int main() {
20943 printf("$xx %d\n", SIG${xx});
20944 return 0;
20945 }
20946 EOCP
20947                 set signal
20948                 if eval $compile; then
20949                         echo "SIG${xx} found."
20950                         $run ./signal$_exe  >> signal.ls1
20951                 else
20952                         echo "SIG${xx} NOT found."
20953                 fi
20954         done
20955         if $test -s signal.ls1; then
20956                 $cat signal.nsg signal.ls1 |
20957                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20958         fi
20959
20960 fi
20961 if $test -s signal.lst; then
20962         :
20963 else
20964         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20965         echo 'kill -l' >signal
20966         set X `csh -f <signal`
20967         $rm -f signal
20968         shift
20969         case $# in
20970         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20971         esac
20972         echo $@ | $tr ' ' $trnl | \
20973             $awk '{ printf "%s %d\n", $1, ++s; }
20974                   END { printf "NSIG %d\n", ++s }' >signal.lst
20975 fi
20976 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20977 EOS
20978 chmod a+x signal_cmd
20979 $eunicefix signal_cmd
20980
20981 : generate list of signal names
20982 echo " "
20983 case "$sig_name_init" in
20984 '') doinit=yes ;;
20985 *)  case "$sig_num_init" in
20986     ''|*,*) doinit=yes ;;
20987     esac ;;
20988 esac
20989 case "$doinit" in
20990 yes)
20991         echo "Generating a list of signal names and numbers..." >&4
20992         . ./signal_cmd
20993         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20994         sig_name=`$awk 'BEGIN { printf "ZERO " }
20995                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20996         sig_num=`$awk  'BEGIN { printf "0 " }
20997                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20998         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20999                              !/^NSIG/   { printf "\"%s\", ", $1 }
21000                              END        { printf "0\n" }' signal.lst`
21001         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21002                              !/^NSIG/   { printf "%d, ", $2}
21003                              END        { printf "0\n"}' signal.lst`
21004         ;;
21005 esac
21006 echo "The following $sig_count signals are available:"
21007 echo " "
21008 echo $sig_name | $awk \
21009 'BEGIN { linelen = 0 }
21010 {
21011         for (i = 1; i <= NF; i++) {
21012                 name = "SIG" $i " "
21013                 linelen = linelen + length(name)
21014                 if (linelen > 70) {
21015                         printf "\n"
21016                         linelen = length(name)
21017                 }
21018                 printf "%s", name
21019         }
21020         printf "\n"
21021 }'
21022 sig_size=`echo $sig_name | awk '{print NF}'`
21023 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21024
21025 : Check size of size
21026 echo " "
21027 case "$sizetype" in
21028 *_t) zzz="$sizetype"    ;;
21029 *)   zzz="filesize"     ;;
21030 esac
21031 echo "Checking the size of $zzz..." >&4
21032 cat > try.c <<EOCP
21033 #include <sys/types.h>
21034 #include <stdio.h>
21035 #$i_stdlib I_STDLIB
21036 #ifdef I_STDLIB
21037 #include <stdlib.h>
21038 #endif
21039 int main() {
21040     printf("%d\n", (int)sizeof($sizetype));
21041     exit(0);
21042 }
21043 EOCP
21044 set try
21045 if eval $compile_ok; then
21046         yyy=`$run ./try`
21047         case "$yyy" in
21048         '')     sizesize=4
21049                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21050                 ;;
21051         *)      sizesize=$yyy
21052                 echo "Your $zzz size is $sizesize bytes."
21053                 ;;
21054         esac
21055 else
21056         sizesize=4
21057         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21058 fi
21059
21060
21061 : check for socklen_t
21062 echo " "
21063 echo "Checking to see if you have socklen_t..." >&4
21064 $cat >try.c <<EOCP
21065 #include <sys/types.h>
21066 #$d_socket HAS_SOCKET
21067 #ifdef HAS_SOCKET
21068 #include <sys/socket.h>
21069 #endif
21070 int main() { socklen_t x = 16; }
21071 EOCP
21072 set try
21073 if eval $compile; then
21074         val="$define"
21075         echo "You have socklen_t."
21076 else
21077         val="$undef"
21078         echo "You do not have socklen_t."
21079         case "$sizetype" in
21080         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21081         esac
21082 fi
21083 $rm_try
21084 set d_socklen_t
21085 eval $setvar
21086
21087 : see if this is a socks.h system
21088 set socks.h i_socks
21089 eval $inhdr
21090
21091 : check for type of the size argument to socket calls
21092 case "$d_socket" in
21093 "$define")
21094         $cat <<EOM
21095
21096 Checking to see what type is the last argument of accept().
21097 EOM
21098         yyy=''
21099         case "$d_socklen_t" in
21100         "$define") yyy="$yyy socklen_t"
21101         esac
21102         yyy="$yyy $sizetype int long unsigned"
21103         for xxx in $yyy; do
21104                 case "$socksizetype" in
21105                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21106                         case "$usesocks" in
21107                         "$define")
21108                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21109                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21110                                         socksizetype="$xxx"
21111                                 fi
21112                                 ;;
21113                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21114                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21115                                         socksizetype="$xxx"
21116                                 fi
21117                                 ;;
21118                         esac
21119                         ;;
21120                 esac
21121         done
21122 : In case none of those worked, prompt the user.
21123         case "$socksizetype" in
21124         '')     rp='What is the type for socket address structure sizes?'
21125                 dflt='int'
21126                 . ./myread
21127                 socksizetype=$ans
21128                 ;;
21129         esac
21130         ;;
21131 *)      : no sockets, so pick relatively harmless default
21132         socksizetype='int'
21133         ;;
21134 esac
21135
21136 : see what type is used for signed size_t
21137 set ssize_t ssizetype int stdio.h sys/types.h
21138 eval $typedef
21139 dflt="$ssizetype"
21140 $cat > try.c <<EOM
21141 #include <stdio.h>
21142 #$i_stdlib I_STDLIB
21143 #ifdef I_STDLIB
21144 #include <stdlib.h>
21145 #endif
21146 #include <sys/types.h>
21147 #define Size_t $sizetype
21148 #define SSize_t $dflt
21149 int main()
21150 {
21151         if (sizeof(Size_t) == sizeof(SSize_t))
21152                 printf("$dflt\n");
21153         else if (sizeof(Size_t) == sizeof(int))
21154                 printf("int\n");
21155         else
21156                 printf("long\n");
21157         exit(0);
21158 }
21159 EOM
21160 echo " "
21161 set try
21162 if eval $compile_ok && $run ./try > /dev/null; then
21163         ssizetype=`$run ./try`
21164         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21165 else
21166         $cat >&4 <<EOM
21167 Help! I can't compile and run the ssize_t test program: please enlighten me!
21168 (This is probably a misconfiguration in your system or libraries, and
21169 you really ought to fix it.  Still, I'll try anyway.)
21170
21171 I need a type that is the same size as $sizetype, but is guaranteed to
21172 be signed.  Common values are ssize_t, int and long.
21173
21174 EOM
21175         rp="What signed type is the same size as $sizetype?"
21176         . ./myread
21177         ssizetype="$ans"
21178 fi
21179 $rm_try
21180
21181 : Check the size of st_ino
21182 $echo " "
21183 $echo "Checking the size of st_ino..." >&4
21184 $cat > try.c <<EOCP
21185 #include <sys/stat.h>
21186 #include <stdio.h>
21187 #$i_stdlib I_STDLIB
21188 #ifdef I_STDLIB
21189 #include <stdlib.h>
21190 #endif
21191 int main() {
21192     struct stat st;
21193     printf("%d\n", (int)sizeof(st.st_ino));
21194     exit(0);
21195 }
21196 EOCP
21197 set try
21198 if eval $compile_ok; then
21199         val=`$run ./try`
21200         case "$val" in
21201         '')     st_ino_size=4
21202                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21203                 ;;
21204         *)      st_ino_size=$val
21205                 $echo "Your st_ino is $st_ino_size bytes long."
21206                 ;;
21207         esac
21208 else
21209         st_ino_size=4
21210         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21211 fi
21212 $rm_try
21213
21214 : Check if st_ino is signed
21215 $echo " "
21216 $echo "Checking the sign of st_ino..." >&4
21217 $cat > try.c <<EOCP
21218 #include <sys/stat.h>
21219 #include <stdio.h>
21220 int main() {
21221         struct stat foo;
21222         foo.st_ino = -1;
21223         if (foo.st_ino < 0)
21224                 printf("-1\n");
21225         else
21226                 printf("1\n");
21227 }
21228 EOCP
21229 set try
21230 if eval $compile; then
21231         val=`$run ./try`
21232         case "$val" in
21233         '')     st_ino_sign=1
21234                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21235                 ;;
21236         *)      st_ino_sign=$val
21237                 case "$st_ino_sign" in
21238                  1) $echo "Your st_ino is unsigned." ;;
21239                 -1) $echo "Your st_ino is signed."   ;;
21240                 esac
21241                 ;;
21242         esac
21243 else
21244         st_ino_sign=1
21245         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21246 fi
21247 $rm_try
21248
21249 : see what type of char stdio uses.
21250 echo " "
21251 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21252 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21253         echo "Your stdio uses unsigned chars." >&4
21254         stdchar="unsigned char"
21255 else
21256         echo "Your stdio uses signed chars." >&4
21257         stdchar="char"
21258 fi
21259 $rm -f stdioh
21260
21261 : see what type uids are declared as in the kernel
21262 echo " "
21263 echo "Looking for the type for user ids returned by getuid()."
21264 set uid_t uidtype xxx stdio.h sys/types.h
21265 eval $typedef
21266 case "$uidtype" in
21267 xxx)
21268         xxx=`./findhdr sys/user.h`
21269         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21270         case $1 in
21271         unsigned) dflt="$1 $2" ;;
21272         *) dflt="$1" ;;
21273         esac
21274         ;;
21275 *) dflt="$uidtype";;
21276 esac
21277 case "$uidtype" in
21278 uid_t)  echo "uid_t found." ;;
21279 *)      rp="What is the type for user ids returned by getuid()?"
21280         . ./myread
21281         uidtype="$ans"
21282         ;;
21283 esac
21284
21285 : Check size of UID
21286 echo " "
21287 case "$uidtype" in
21288 *_t) zzz="$uidtype"     ;;
21289 *)   zzz="uid"          ;;
21290 esac
21291 echo "Checking the size of $zzz..." >&4
21292 cat > try.c <<EOCP
21293 #include <sys/types.h>
21294 #include <stdio.h>
21295 #$i_stdlib I_STDLIB
21296 #ifdef I_STDLIB
21297 #include <stdlib.h>
21298 #endif
21299 int main() {
21300     printf("%d\n", (int)sizeof($uidtype));
21301     exit(0);
21302 }
21303 EOCP
21304 set try
21305 if eval $compile_ok; then
21306         yyy=`$run ./try`
21307         case "$yyy" in
21308         '')     uidsize=4
21309                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21310                 ;;
21311         *)      uidsize=$yyy
21312                 echo "Your $zzz is $uidsize bytes long."
21313                 ;;
21314         esac
21315 else
21316         uidsize=4
21317         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21318 fi
21319
21320 : Check if UID is signed
21321 echo " "
21322 case "$uidtype" in
21323 *_t) zzz="$uidtype"     ;;
21324 *)   zzz="uid"          ;;
21325 esac
21326 echo "Checking the sign of $zzz..." >&4
21327 cat > try.c <<EOCP
21328 #include <sys/types.h>
21329 #include <stdio.h>
21330 int main() {
21331         $uidtype foo = -1;
21332         if (foo < 0)
21333                 printf("-1\n");
21334         else
21335                 printf("1\n");
21336 }
21337 EOCP
21338 set try
21339 if eval $compile; then
21340         yyy=`$run ./try`
21341         case "$yyy" in
21342         '')     uidsign=1
21343                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21344                 ;;
21345         *)      uidsign=$yyy
21346                 case "$uidsign" in
21347                  1) echo "Your $zzz is unsigned." ;;
21348                 -1) echo "Your $zzz is signed."   ;;
21349                 esac
21350                 ;;
21351         esac
21352 else
21353         uidsign=1
21354         echo "(I can't compile the test program--guessing unsigned.)" >&4
21355 fi
21356
21357
21358 : Check format string for UID
21359 echo " "
21360 $echo "Checking the format string to be used for uids..." >&4
21361
21362 case "$uidsign" in
21363 -1)     if $test X"$uidsize" = X"$ivsize"; then
21364                 uidformat="$ivdformat"
21365         else
21366                 if $test X"$uidsize" = X"$longsize"; then
21367                         uidformat='"ld"'
21368                 else
21369                         if $test X"$uidsize" = X"$intsize"; then
21370                                 uidformat='"d"'
21371                         else
21372                                 if $test X"$uidsize" = X"$shortsize"; then
21373                                         uidformat='"hd"'
21374                                 fi
21375                         fi
21376                 fi
21377         fi
21378         ;;
21379 *)      if $test X"$uidsize" = X"$uvsize"; then
21380                 uidformat="$uvuformat"
21381         else
21382                 if $test X"$uidsize" = X"$longsize"; then
21383                         uidformat='"lu"'
21384                 else
21385                         if $test X"$uidsize" = X"$intsize"; then
21386                                 uidformat='"u"'
21387                         else
21388                                 if $test X"$uidsize" = X"$shortsize"; then
21389                                         uidformat='"hu"'
21390                                 fi
21391                         fi
21392                 fi
21393         fi
21394         ;;
21395 esac
21396
21397 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21398 echo " "
21399 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21400 $cat >try.c <<'EOM'
21401 /* Intentionally a long probe as I'd like to sanity check that the exact
21402    approach is going to work, as thinking it will work, but only having it
21403    part working at runtime is worse than not having it.  */
21404
21405 #include <sys/types.h>
21406 #include <sys/sysctl.h>
21407 #include <sys/param.h>
21408 #include <stdio.h>
21409 #include <string.h>
21410 #include <stdlib.h>
21411 #include <unistd.h>
21412
21413 int
21414 main(int argc, char **argv) {
21415     char *buffer;
21416     char *argv_leaf = strrchr(argv[0], '/');
21417     char *buffer_leaf;
21418     size_t size = 0;
21419     int mib[4];
21420
21421     mib[0] = CTL_KERN;
21422     mib[1] = KERN_PROC;
21423     mib[2] = KERN_PROC_PATHNAME;
21424     mib[3] = -1;
21425
21426     if (!argv_leaf) {
21427         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21428         return 1;
21429     }
21430
21431     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21432         perror("sysctl");
21433         return 2;
21434     }
21435
21436     if (size < strlen(argv_leaf) + 1) {
21437         fprintf(stderr, "size %lu is too short for a path\n",
21438                 (unsigned long) size);
21439         return 3;
21440     }
21441
21442     if (size > MAXPATHLEN * MAXPATHLEN) {
21443         fprintf(stderr, "size %lu is too long for a path\n",
21444                 (unsigned long) size);
21445         return 4;
21446     }
21447
21448     buffer = malloc(size);
21449     if (!buffer) {
21450         perror("malloc");
21451         return 5;
21452     }
21453
21454     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21455         perror("sysctl");
21456         return 6;
21457     }
21458
21459     if (strlen(buffer) + 1 != size) {
21460         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21461                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21462         return 7;
21463     }
21464
21465
21466     if (*buffer != '/') {
21467         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21468         return 8;
21469     }
21470
21471     if (strstr(buffer, "/./")) {
21472         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21473         return 9;
21474     }
21475
21476     if (strstr(buffer, "/../")) {
21477         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21478         return 10;
21479     }
21480
21481     buffer_leaf = strrchr(buffer, '/');
21482     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21483         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21484         return 11;
21485     }
21486
21487     free(buffer);
21488
21489     return 0;
21490 }
21491 EOM
21492
21493 val=$undef
21494 set try
21495 if eval $compile; then
21496         if $run ./try; then
21497                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21498                 val="$define"
21499         else
21500                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21501                 val="$undef"
21502         fi
21503 else
21504         echo "I'm unable to compile the test program." >&4
21505         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21506         val="$undef"
21507 fi
21508 $rm_try
21509 set usekernprocpathname
21510 eval $setvar
21511
21512 : Determine if we can use _NSGetExecutablePath to find executing program
21513 echo " "
21514 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21515 $cat >try.c <<'EOM'
21516 /* Intentionally a long probe as I'd like to sanity check that the exact
21517    approach is going to work, as thinking it will work, but only having it
21518    part working at runtime is worse than not having it.  */
21519 #include <mach-o/dyld.h>
21520 #include <stdio.h>
21521 #include <stdlib.h>
21522 #include <sys/param.h>
21523 #include <string.h>
21524
21525 int
21526 main(int argc, char **argv) {
21527     char buf[1];
21528     uint32_t size = sizeof(buf);
21529     int result;
21530     char *buffer;
21531     char *tidied;
21532     char *argv_leaf = strrchr(argv[0], '/');
21533     char *tidied_leaf;
21534
21535     if (!argv_leaf) {
21536         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21537         return 1;
21538     }
21539
21540     _NSGetExecutablePath(buf, &size);
21541     if (size > MAXPATHLEN * MAXPATHLEN) {
21542         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21543                 (unsigned int) size);
21544         return 2;
21545     }
21546
21547     buffer = malloc(size);
21548     if (!buffer) {
21549         perror("malloc");
21550         return 3;
21551     }
21552
21553     result = _NSGetExecutablePath(buffer, &size);
21554     if (result != 0) {
21555         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21556                 result, (unsigned int) size);
21557         return 4;
21558     }
21559
21560     tidied = realpath(buffer, NULL);
21561     if (!tidied) {
21562         perror("realpath");
21563         return 5;
21564     }
21565
21566     free(buffer);
21567
21568     if (*tidied != '/') {
21569         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21570         return 6;
21571     }
21572
21573     if (strstr(tidied, "/./")) {
21574         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21575         return 7;
21576     }
21577
21578     if (strstr(tidied, "/../")) {
21579         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21580         return 8;
21581     }
21582
21583     tidied_leaf = strrchr(tidied, '/');
21584     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21585         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21586         return 9;
21587     }
21588
21589     free(tidied);
21590
21591     return 0;
21592 }
21593 EOM
21594
21595 val=$undef
21596 set try
21597 if eval $compile; then
21598         if $run ./try; then
21599                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21600                 val="$define"
21601         else
21602                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21603         fi
21604 else
21605         echo "I'm unable to compile the test program." >&4
21606         echo "I'll assume no _NSGetExecutablePath here." >&4
21607 fi
21608 $rm_try
21609 set usensgetexecutablepath
21610 eval $setvar
21611
21612 : Check if site customization support was requested
21613 case "$usesitecustomize" in
21614     $define|true|[Yy]*)
21615         usesitecustomize="$define"
21616         ;;
21617     *)
21618         usesitecustomize="$undef"
21619         ;;
21620     esac
21621
21622 : see if prototypes support variable argument declarations
21623 echo " "
21624 case "$prototype$i_stdarg" in
21625 $define$define)
21626         echo "It appears we'll be able to prototype varargs functions." >&4
21627         val="$define"
21628         ;;
21629 *)
21630         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21631         val="$undef"
21632         ;;
21633 esac
21634 set vaproto
21635 eval $setvar
21636
21637 : determine compiler compiler
21638 case "$yacc" in
21639 '')
21640         dflt=yacc;;
21641 *)
21642         dflt="$yacc";;
21643 esac
21644 echo " "
21645 comp='yacc'
21646 if $test -f "$byacc$_exe"; then
21647         dflt="$byacc"
21648         comp="byacc or $comp"
21649 fi
21650 if $test -f "$bison$_exe"; then
21651         comp="$comp or bison -y"
21652 fi
21653 rp="Which compiler compiler ($comp) shall I use?"
21654 . ./myread
21655 yacc="$ans"
21656 case "$yacc" in
21657 *bis*)
21658         case "$yacc" in
21659         *-y*) ;;
21660         *)
21661                 yacc="$yacc -y"
21662                 echo "(Adding -y option to bison to get yacc-compatible behavior.)"
21663                 ;;
21664         esac
21665         ;;
21666 esac
21667
21668 : see if this is a assert.h system
21669 set assert.h i_assert
21670 eval $inhdr
21671
21672 : see if this is a fp.h system
21673 set fp.h i_fp
21674 eval $inhdr
21675
21676 : see if this is a fp_class.h system
21677 set fp_class.h i_fp_class
21678 eval $inhdr
21679
21680 : see if gdbm.h is available
21681 set gdbm.h t_gdbm
21682 eval $inhdr
21683 case "$t_gdbm" in
21684 $define)
21685         : see if gdbm_open exists
21686         set gdbm_open d_gdbm_open
21687         eval $inlibc
21688         case "$d_gdbm_open" in
21689         $undef)
21690                 t_gdbm="$undef"
21691                 echo "We won't be including <gdbm.h>"
21692                 ;;
21693         esac
21694         ;;
21695 esac
21696 val="$t_gdbm"
21697 set i_gdbm
21698 eval $setvar
21699
21700 : see if this is a ieeefp.h system
21701 case "$i_ieeefp" in
21702 '' ) set ieeefp.h i_ieeefp
21703      eval $inhdr
21704      ;;
21705 esac
21706
21707 : see if this is a libutil.h system
21708 set libutil.h i_libutil
21709 eval $inhdr
21710
21711 : see if mach cthreads are available
21712 if test "X$usethreads" = "X$define"; then
21713         set mach/cthreads.h i_machcthr
21714         eval $inhdr
21715 else
21716         i_machcthr="$undef"
21717 fi
21718
21719 : see if this is a mntent.h system
21720 set mntent.h i_mntent
21721 eval $inhdr
21722
21723 : see if net/errno.h is available
21724 val=''
21725 set net/errno.h val
21726 eval $inhdr
21727
21728 : Unfortunately, it causes problems on some systems.  Arrgh.
21729 case "$val" in
21730 $define)
21731         cat > try.c <<'EOM'
21732 #include <stdio.h>
21733 #include <errno.h>
21734 #include <net/errno.h>
21735 int func()
21736 {
21737         return ENOTSOCK;
21738 }
21739 EOM
21740         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21741                 echo "We'll be including <net/errno.h>." >&4
21742         else
21743                 echo "We won't be including <net/errno.h>." >&4
21744                 val="$undef"
21745         fi
21746         $rm_try
21747         ;;
21748 esac
21749 set i_neterrno
21750 eval $setvar
21751
21752 : see if netinet/tcp.h is available
21753 set netinet/tcp.h i_netinettcp
21754 eval $inhdr
21755
21756 : see if this is a poll.h system
21757 set poll.h i_poll
21758 eval $inhdr
21759
21760 : see if this is a prot.h system
21761 set prot.h i_prot
21762 eval $inhdr
21763
21764 : Preprocessor symbols
21765 echo " "
21766 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21767 $cat <<'EOSH' > Cppsym.know
21768 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21769 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21770 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21771 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21772 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21773 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21774 bull c cadmus clipper CMU COFF COMPILER_VERSION
21775 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21776 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21777 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21778 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21779 GLIBC GLIBC_MINOR
21780 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21781 H3050R H3050RX hbullx20 hcx host_mips
21782 hp200 hp300 hp700 HP700 hp800 hp9000
21783 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21784 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21785 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21786 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21787 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21788 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21789 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21790 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21791 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21792 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21793 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21794 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21795 MATH_HAS_NO_SIDE_EFFECTS
21796 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21797 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21798 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21799 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21800 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21801 NetBSD news1500 news1700 news1800 news1900 news3700
21802 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21803 ns32016 ns32332 ns32k nsc32000
21804 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21805 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21806 pc532 pdp11 PGC PIC plexus PORTAR posix
21807 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21808 POSIX_C_SOURCE POSIX_SOURCE POWER
21809 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21810 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21811 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21812 sony sony_news sonyrisc sparc sparclite spectrum
21813 stardent stdc STDC_EXT stratos sun sun3 sun386
21814 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21815 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21816 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21817 sysV68 sysV88 Tek4132 Tek4300 titan
21818 TM3200 TM5400 TM5600
21819 tower tower32 tower32_200 tower32_600 tower32_700
21820 tower32_800 tower32_850 tss
21821 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21822 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21823 unix UNIX95 UNIX99 unixpc unos
21824 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21825 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21826 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21827 USGr4 USGr4_2
21828 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21829 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21830 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21831 z8000
21832 EOSH
21833 # Maybe put other stuff here too.
21834 cat <<EOSH >>Cppsym.know
21835 $osname
21836 EOSH
21837 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21838 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21839 $cat Cppsym.know > Cppsym.c
21840 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21841 $rm -f Cppsym.a Cppsym.b Cppsym.c
21842 cat <<EOSH > Cppsym
21843 $startsh
21844 if $test \$# -gt 0; then
21845     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21846     if $test -s Cppsym.got; then
21847         $rm -f Cppsym.got
21848         exit 0
21849     fi
21850     $rm -f Cppsym.got
21851     exit 1
21852 else
21853     $tr " " "$trnl" | ./Cppsym.try
21854     exit 0
21855 fi
21856 EOSH
21857 chmod +x Cppsym
21858 $eunicefix Cppsym
21859 cat <<EOSH > Cppsym.try
21860 $startsh
21861 cat <<'EOCP' > try.c
21862 #include <stdio.h>
21863 #if cpp_stuff == 1
21864 #define STRINGIFY(a)    "a"
21865 #endif
21866 #if cpp_stuff == 42
21867 #define StGiFy(a)  #a
21868 #define STRINGIFY(a)    StGiFy(a)
21869 #endif
21870 #if $cpp_stuff != 1 && $cpp_stuff != 42
21871 #   include "Bletch: How does this C preprocessor stringify macros?"
21872 #endif
21873 int main() {
21874 EOCP
21875 $awk \\
21876 EOSH
21877 cat <<'EOSH' >> Cppsym.try
21878 'length($1) > 0 {
21879     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21880     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21881     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21882     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21883 }'       >> try.c
21884 echo 'return 0;}' >> try.c
21885 EOSH
21886 cat <<EOSH >> Cppsym.try
21887 ccflags="$ccflags"
21888 case "$osname-$gccversion" in
21889 irix-) ccflags="\$ccflags -woff 1178" ;;
21890 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21891 esac
21892 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21893 EOSH
21894 chmod +x Cppsym.try
21895 $eunicefix Cppsym.try
21896 ./Cppsym < Cppsym.know | $sort | $uniq > Cppsym.true
21897 : Add in any Linux cpp "predefined macros":
21898 case "$osname::$gccversion" in
21899   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21900     tHdrH=_tmpHdr
21901     rm -f $tHdrH'.h' $tHdrH
21902     touch $tHdrH'.h'
21903     # Filter out macro arguments, such as Linux's __INT8_C(c)
21904     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21905        sed -e 's/#define[\ \  ]*//;s/[\ \     ].*$//' -e 's/(.*//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21906        if [ -s $tHdrH'_cppsym.real' ]; then
21907           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21908        fi
21909     fi
21910     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21911   ;;
21912 esac
21913 : now check the C compiler for additional symbols
21914 postprocess_cc_v=''
21915 case "$osname" in
21916 aix) postprocess_cc_v="|$tr , ' '" ;;
21917 esac
21918 $cat >ccsym <<EOS
21919 $startsh
21920 $cat >tmp.c <<EOF
21921 extern int foo;
21922 EOF
21923 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21924 do
21925         case "\$i" in
21926         -D*) echo "\$i" | $sed 's/^-D//';;
21927         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21928         esac
21929 done
21930 $rm_try
21931 EOS
21932 postprocess_cc_v=''
21933 chmod +x ccsym
21934 $eunicefix ccsym
21935 ./ccsym > ccsym1.raw
21936 if $test -s ccsym1.raw; then
21937        $sort ccsym1.raw | $uniq >ccsym.raw
21938 else
21939        mv ccsym1.raw ccsym.raw
21940 fi
21941
21942 $awk '/\=/ { print $0; next }
21943         { print $0"=1" }' ccsym.raw >ccsym.list
21944 $comm -13 Cppsym.true ccsym.list >ccsym.own
21945 $comm -12 Cppsym.true ccsym.list >ccsym.com
21946 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21947 also=''
21948 if $test -z ccsym.raw; then
21949         echo "Your C compiler doesn't seem to define any symbols!" >&4
21950         echo " "
21951         echo "However, your C preprocessor defines the following symbols:"
21952         $cat Cppsym.true
21953         ccsymbols=''
21954         cppsymbols=`$cat Cppsym.true`
21955         cppsymbols=`echo $cppsymbols`
21956         cppccsymbols="$cppsymbols"
21957 else
21958         if $test -s ccsym.com; then
21959                 echo "Your C compiler and pre-processor define these symbols:"
21960                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21961                 also='also '
21962                 symbols='ones'
21963                 cppccsymbols=`$cat ccsym.com`
21964                 cppccsymbols=`echo $cppccsymbols`
21965                 $test "$silent" || sleep 1
21966         fi
21967         if $test -s ccsym.cpp; then
21968                 $test "$also" && echo " "
21969                 echo "Your C pre-processor ${also}defines the following symbols:"
21970                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21971                 also='further '
21972                 cppsymbols=`$cat ccsym.cpp`
21973                 cppsymbols=`echo $cppsymbols`
21974                 $test "$silent" || sleep 1
21975         fi
21976         if $test -s ccsym.own; then
21977                 $test "$also" && echo " "
21978                 echo "Your C compiler ${also}defines the following cpp symbols:"
21979                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21980                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21981                 ccsymbols=`$cat ccsym.own`
21982                 ccsymbols=`echo $ccsymbols`
21983                 $test "$silent" || sleep 1
21984         fi
21985 fi
21986
21987 : see if this is a termio system
21988 val="$undef"
21989 val2="$undef"
21990 val3="$undef"
21991 if $test `./findhdr termios.h`; then
21992         set tcsetattr i_termios
21993         eval $inlibc
21994         val3="$i_termios"
21995 fi
21996 echo " "
21997 case "$val3" in
21998 "$define") echo "You have POSIX termios.h... good!" >&4;;
21999 *) if ./Cppsym pyr; then
22000                 case "`/bin/universe`" in
22001                 ucb) if $test `./findhdr sgtty.h`; then
22002                                 val2="$define"
22003                                 echo "<sgtty.h> found." >&4
22004                         else
22005                                 echo "System is pyramid with BSD universe."
22006                                 ./warn "<sgtty.h> not found--you could have problems."
22007                         fi;;
22008                 *) if $test `./findhdr termio.h`; then
22009                                 val="$define"
22010                                 echo "<termio.h> found." >&4
22011                         else
22012                                 echo "System is pyramid with USG universe."
22013                                 ./warn "<termio.h> not found--you could have problems."
22014                         fi;;
22015                 esac
22016         elif ./usg; then
22017                 if $test `./findhdr termio.h`; then
22018                         echo "<termio.h> found." >&4
22019                         val="$define"
22020                 elif $test `./findhdr sgtty.h`; then
22021                         echo "<sgtty.h> found." >&4
22022                         val2="$define"
22023                 else
22024                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22025                 fi
22026         else
22027                 if $test `./findhdr sgtty.h`; then
22028                         echo "<sgtty.h> found." >&4
22029                         val2="$define"
22030                 elif $test `./findhdr termio.h`; then
22031                         echo "<termio.h> found." >&4
22032                         val="$define"
22033                 else
22034                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22035                 fi
22036         fi;;
22037 esac
22038 set i_termio; eval $setvar
22039 val=$val2; set i_sgtty; eval $setvar
22040 val=$val3; set i_termios; eval $setvar
22041
22042 : see if stdbool is available
22043 : we want a real compile instead of Inhdr because some Solaris systems
22044 : have stdbool.h, but it can only be used if the compiler indicates it
22045 : is sufficiently c99-compliant.
22046 echo " "
22047 $cat >try.c <<EOCP
22048 #include <stdio.h>
22049 #include <stdbool.h>
22050 int func(bool x)
22051 {
22052     return x ? 1 : 0;
22053 }
22054 int main(int argc, char **argv)
22055 {
22056     return func(0);
22057 }
22058 EOCP
22059 set try
22060 if eval $compile; then
22061         echo "<stdbool.h> found." >&4
22062         val="$define"
22063 else
22064         echo "<stdbool.h> NOT found." >&4
22065         val="$undef"
22066 fi
22067 $rm_try
22068 set i_stdbool
22069 eval $setvar
22070
22071 : see if stddef is available
22072 set stddef.h i_stddef
22073 eval $inhdr
22074
22075 : see if sys/access.h is available
22076 set sys/access.h i_sysaccess
22077 eval $inhdr
22078
22079 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22080 set sys/filio.h i_sysfilio
22081 eval $inhdr
22082 echo " "
22083 if $test `./findhdr sys/ioctl.h`; then
22084         val="$define"
22085         echo '<sys/ioctl.h> found.' >&4
22086 else
22087         val="$undef"
22088         if $test $i_sysfilio = "$define"; then
22089             echo '<sys/ioctl.h> NOT found.' >&4
22090         else
22091                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22092                 $test $i_termio = "$define" && xxx="termio.h"
22093                 $test $i_termios = "$define" && xxx="termios.h"
22094 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22095         fi
22096 fi
22097 set i_sysioctl
22098 eval $setvar
22099
22100 : see if socket ioctl defs are in sys/sockio.h
22101 echo " "
22102 xxx=`./findhdr sys/sockio.h`
22103 if $test "$xxx"; then
22104         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22105                 val="$define"
22106                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22107         else
22108                 val="$undef"
22109                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22110         fi
22111 else
22112         val="$undef"
22113         $cat <<EOM
22114 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22115 EOM
22116 fi
22117 set i_syssockio
22118 eval $setvar
22119
22120 : see if this is a syslog.h system
22121 set syslog.h i_syslog
22122 eval $inhdr
22123
22124 : see if this is a sys/mode.h system
22125 set sys/mode.h i_sysmode
22126 eval $inhdr
22127
22128 : see if there is a sys/poll.h file
22129 set sys/poll.h i_syspoll
22130 eval $inhdr
22131
22132 : see if sys/resource.h has to be included
22133 set sys/resource.h i_sysresrc
22134 eval $inhdr
22135
22136 : see if sys/security.h is available
22137 set sys/security.h i_syssecrt
22138 eval $inhdr
22139
22140 : see if this is a sys/statvfs.h system
22141 set sys/statvfs.h i_sysstatvfs
22142 eval $inhdr
22143
22144 : see if this is a sys/un.h system
22145 set sys/un.h i_sysun
22146 eval $inhdr
22147
22148 : see if this is a sys/utsname.h system
22149 set sys/utsname.h i_sysutsname
22150 eval $inhdr
22151
22152 : see if this is a syswait system
22153 set sys/wait.h i_syswait
22154 eval $inhdr
22155
22156 : see if this is a ustat.h system
22157 set ustat.h i_ustat
22158 eval $inhdr
22159
22160 : see if this is an utime system
22161 set utime.h i_utime
22162 eval $inhdr
22163
22164 : see if this is a vfork system
22165 case "$d_vfork" in
22166 "$define")
22167         set vfork.h i_vfork
22168         eval $inhdr
22169         ;;
22170 *)
22171         i_vfork="$undef"
22172         ;;
22173 esac
22174
22175 : Check extensions
22176 echo " "
22177 echo "Looking for extensions..." >&4
22178 : If we are using the old config.sh, nonxs_extensions and xs_extensions may
22179 : contain old or inaccurate or duplicate values.
22180 nonxs_extensions=''
22181 xs_extensions=''
22182 : We do not use find because it might not be available.
22183 : We do not just use MANIFEST because the user may have dropped
22184 : some additional extensions into the source tree and expect them
22185 : to be built.
22186
22187 : Function to recursively find available extensions, ignoring DynaLoader
22188 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22189 : In 5.10.1 and later, extensions are stored in directories
22190 : like File-Glob instead of the older File/Glob/.
22191 find_extensions='
22192     for xxx in *; do
22193         case "$xxx" in
22194             DynaLoader|dynaload) ;;
22195             *)
22196             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22197             echo " $xs_extensions $nonxs_extensions" > $$.tmp;
22198             if $contains " $this_ext " $$.tmp; then
22199                 echo >&4;
22200                 echo "Duplicate directories detected for extension $xxx" >&4;
22201                 echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22202                 case "$knowitall" in
22203                 "") dflt=y;;
22204                 *) dflt=n;;
22205                 esac;
22206                 . ../UU/myread;
22207                 case "$ans" in
22208                 n*|N*) ;;
22209                 *) echo >&4;
22210                     echo "Ok.  Stopping Configure." >&4;
22211                     echo "Please remove the duplicate directory (e.g. using git clean) and then re-run Configure" >&4;
22212                     exit 1;;
22213                 esac;
22214                 echo "Ok.  You will need to correct config.sh before running make." >&4;
22215             fi;
22216             $ls -1 $xxx > $$.tmp;
22217             if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22218                 xs_extensions="$xs_extensions $this_ext";
22219             elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22220                 xs_extensions="$xs_extensions $this_ext";
22221             elif $test -d $xxx; then
22222                 nonxs_extensions="$nonxs_extensions $this_ext";
22223             fi;
22224             $rm -f $$.tmp;
22225             ;;
22226         esac;
22227     done'
22228 tdir=`pwd`
22229 cd "$rsrc/cpan"
22230 set X
22231 shift
22232 eval $find_extensions
22233 cd "$rsrc/dist"
22234 set X
22235 shift
22236 eval $find_extensions
22237 cd "$rsrc/ext"
22238 set X
22239 shift
22240 eval $find_extensions
22241 set X $xs_extensions
22242 shift
22243 xs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22244 set X $nonxs_extensions
22245 shift
22246 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22247 cd "$tdir"
22248 known_extensions=`echo $nonxs_extensions $xs_extensions  | tr ' ' $trnl | $sort | tr $trnl ' '`
22249
22250 : Now see which are supported on this system.
22251 avail_ext=''
22252 for xxx in $xs_extensions ; do
22253         case "$xxx" in
22254         DB_File|db_file)
22255                 case "$i_db" in
22256                 $define) avail_ext="$avail_ext $xxx" ;;
22257                 esac
22258                 ;;
22259         GDBM_File|gdbm_fil)
22260                 case "$i_gdbm" in
22261                 $define) avail_ext="$avail_ext $xxx" ;;
22262                 esac
22263                 ;;
22264         I18N/Langinfo|i18n_lan)
22265                 case "$i_langinfo$d_nl_langinfo" in
22266                 $define$define) avail_ext="$avail_ext $xxx" ;;
22267                 esac
22268                 ;;
22269         IPC/SysV|ipc/sysv)
22270                 : XXX Do we need a useipcsysv variable here
22271                 case "${d_msg}${d_sem}${d_shm}" in
22272                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22273                 esac
22274                 ;;
22275         NDBM_File|ndbm_fil)
22276                 case "$d_ndbm" in
22277                 $define)
22278                     case "$osname-$use64bitint" in
22279                     hpux-define)
22280                         case "$libs" in
22281                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22282                         esac
22283                         ;;
22284                     *) avail_ext="$avail_ext $xxx" ;;
22285                     esac
22286                     ;;
22287                 esac
22288                 ;;
22289         ODBM_File|odbm_fil)
22290                 case "${i_dbm}${i_rpcsvcdbm}" in
22291                 *"${define}"*)
22292                     case "$d_cplusplus" in
22293                     define) ;; # delete as a function name will not work
22294                     *)  case "$osname-$use64bitint" in
22295                         hpux-define)
22296                             case "$libs" in
22297                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22298                             esac
22299                             ;;
22300                         *) avail_ext="$avail_ext $xxx" ;;
22301                         esac
22302                         ;;
22303                     esac
22304                     ;;
22305                 esac
22306                 ;;
22307         Opcode|opcode)
22308                 case "$useopcode" in
22309                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22310                 esac
22311                 ;;
22312         POSIX|posix)
22313                 case "$useposix" in
22314                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22315                 esac
22316                 ;;
22317         Socket|socket)
22318                 case "$d_socket" in
22319                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22320                 esac
22321                 ;;
22322         Sys/Syslog|sys/syslog)
22323                 : XXX syslog requires socket
22324                 case "$d_socket" in
22325                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22326                 esac
22327                 ;;
22328         Thread|thread)
22329                 case "$usethreads" in
22330                 true|$define|y)
22331                         case "$use5005threads" in
22332                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22333                         esac
22334                 esac
22335                 ;;
22336         threads|threads/shared)
22337                 # threads and threads::shared are special cases.
22338                 # To stop people from asking "Perl 5.8.0 was supposed
22339                 # to have this new fancy threads implementation but my
22340                 # perl doesn't have it" and from people trying to
22341                 # (re)install the threads module using CPAN.pm and
22342                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22343                 # the threads.pm and threads/shared.pm will always be
22344                 # there, croaking informatively ("you need to rebuild
22345                 # all of Perl with threads, sorry") when threads haven't
22346                 # been compiled in.
22347                 # --jhi
22348                 avail_ext="$avail_ext $xxx"
22349                 ;;
22350         VMS*)
22351                 ;;
22352         Win32*)
22353                 case "$osname" in
22354                 cygwin) avail_ext="$avail_ext $xxx" ;;
22355                 esac
22356                 ;;
22357         XS/APItest|xs/apitest)
22358                 # This is just for testing.  Skip it unless we have dynamic loading.
22359
22360                 case "$usedl" in
22361                 $define) avail_ext="$avail_ext $xxx" ;;
22362                 esac
22363                 ;;
22364         XS/Typemap|xs/typemap)
22365                 # This is just for testing.  Skip it unless we have dynamic loading.
22366                 case "$usedl" in
22367                 $define) avail_ext="$avail_ext $xxx" ;;
22368                 esac
22369                 ;;
22370         *)      avail_ext="$avail_ext $xxx"
22371                 ;;
22372         esac
22373 done
22374
22375 set X $avail_ext
22376 shift
22377 avail_ext="$*"
22378
22379 case "$onlyextensions" in
22380 '') ;;
22381 *)  keepextensions=''
22382     echo "You have requested that only certain extensions be included..." >&4
22383     for i in $onlyextensions; do
22384         case " $avail_ext " in
22385         *" $i "*)
22386             echo "Keeping extension $i."
22387             keepextensions="$keepextensions $i"
22388             ;;
22389         *) echo "Ignoring extension $i." ;;
22390         esac
22391     done
22392     avail_ext="$keepextensions"
22393     ;;
22394 esac
22395
22396 case "$noextensions" in
22397 '') ;;
22398 *)  keepextensions=''
22399     echo "You have requested that certain extensions be ignored..." >&4
22400     for i in $avail_ext; do
22401         case " $noextensions " in
22402         *" $i "*) echo "Ignoring extension $i." ;;
22403         *) echo "Keeping extension $i.";
22404            keepextensions="$keepextensions $i"
22405            ;;
22406         esac
22407     done
22408     avail_ext="$keepextensions"
22409     ;;
22410 esac
22411
22412 : Now see which nonxs extensions are supported on this system.
22413 : For now assume all are.
22414 nonxs_ext=''
22415 for xxx in $nonxs_extensions ; do
22416         case "$xxx" in
22417         VMS*)
22418                 ;;
22419         *)      nonxs_ext="$nonxs_ext $xxx"
22420                 ;;
22421         esac
22422 done
22423
22424 set X $nonxs_ext
22425 shift
22426 nonxs_ext="$*"
22427
22428 case $usedl in
22429 $define)
22430         $cat <<EOM
22431 A number of extensions are supplied with $package.  You may choose to
22432 compile these extensions for dynamic loading (the default), compile
22433 them into the $package executable (static loading), or not include
22434 them at all.  Answer "none" to include no extensions.
22435 Note that DynaLoader is always built and need not be mentioned here.
22436
22437 EOM
22438         case "$dynamic_ext" in
22439         '')
22440                 : Exclude those listed in static_ext
22441                 dflt=''
22442                 for xxx in $avail_ext; do
22443                         case " $static_ext " in
22444                         *" $xxx "*) ;;
22445                         *) dflt="$dflt $xxx" ;;
22446                         esac
22447                 done
22448                 set X $dflt
22449                 shift
22450                 dflt="$*"
22451                 ;;
22452         *)      dflt="$dynamic_ext"
22453                 # Perhaps we are reusing an old out-of-date config.sh.
22454                 case "$hint" in
22455                 previous)
22456                         if test X"$dynamic_ext" != X"$avail_ext"; then
22457                                 $cat <<EOM
22458 NOTICE:  Your previous config.sh list may be incorrect.
22459 The extensions now available to you are
22460         ${avail_ext}
22461 but the default list from your previous config.sh is
22462         ${dynamic_ext}
22463
22464 EOM
22465                         fi
22466                         ;;
22467                 esac
22468                 ;;
22469         esac
22470         case "$dflt" in
22471         '')     dflt=none;;
22472         esac
22473         rp="What extensions do you wish to load dynamically?"
22474         . ./myread
22475         case "$ans" in
22476         none) dynamic_ext=' ' ;;
22477         *) dynamic_ext="$ans" ;;
22478         esac
22479
22480         case "$static_ext" in
22481         '')
22482                 : Exclude those already listed in dynamic linking
22483                 dflt=''
22484                 for xxx in $avail_ext; do
22485                         case " $dynamic_ext " in
22486                         *" $xxx "*) ;;
22487                         *) dflt="$dflt $xxx" ;;
22488                         esac
22489                 done
22490                 set X $dflt
22491                 shift
22492                 dflt="$*"
22493                 ;;
22494         *)  dflt="$static_ext"
22495                 ;;
22496         esac
22497
22498         case "$dflt" in
22499         '')     dflt=none;;
22500         esac
22501         rp="What extensions do you wish to load statically?"
22502         . ./myread
22503         case "$ans" in
22504         none) static_ext=' ' ;;
22505         *) static_ext="$ans" ;;
22506         esac
22507         ;;
22508 *)
22509         $cat <<EOM
22510 A number of extensions are supplied with $package.  Answer "none"
22511 to include no extensions.
22512 Note that DynaLoader is always built and need not be mentioned here.
22513
22514 EOM
22515         case "$static_ext" in
22516         '') dflt="$avail_ext" ;;
22517         *)      dflt="$static_ext"
22518                 # Perhaps we are reusing an old out-of-date config.sh.
22519                 case "$hint" in
22520                 previous)
22521                         if test X"$static_ext" != X"$avail_ext"; then
22522                                 $cat <<EOM
22523 NOTICE:  Your previous config.sh list may be incorrect.
22524 The extensions now available to you are
22525         ${avail_ext}
22526 but the default list from your previous config.sh is
22527         ${static_ext}
22528
22529 EOM
22530                         fi
22531                         ;;
22532                 esac
22533                 ;;
22534         esac
22535         : Exclude those that are not xs extensions
22536         case "$dflt" in
22537         '')     dflt=none;;
22538         esac
22539         rp="What extensions do you wish to include?"
22540         . ./myread
22541         case "$ans" in
22542         none) static_ext=' ' ;;
22543         *) static_ext="$ans" ;;
22544         esac
22545         ;;
22546 esac
22547 #
22548 # Encode is a special case.  If we are building Encode as a static
22549 # extension, we need to explicitly list its subextensions as well.
22550 # For other nested extensions, this is handled automatically by
22551 # the appropriate Makefile.PL.
22552 case " $static_ext " in
22553         *" Encode "*) # Add the subextensions of Encode
22554         cd "$rsrc/cpan"
22555         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22556                 static_ext="$static_ext Encode/$xxx"
22557                 known_extensions="$known_extensions Encode/$xxx"
22558         done
22559         cd "$tdir"
22560         ;;
22561 esac
22562
22563 set X $dynamic_ext $static_ext $nonxs_ext
22564 shift
22565 extensions="$*"
22566
22567 # Sanity check:  We require an extension suitable for use with
22568 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22569 # should show up as failures in the test suite, but it's helpful to
22570 # catch them now.) The 'extensions' list is normally sorted
22571 # alphabetically, so we need to accept either
22572 #    DB_File ... Fcntl ... IO  ....
22573 # or something like
22574 #    Fcntl ... NDBM_File ... IO  ....
22575 case " $extensions"  in
22576 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22577 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22578 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22579 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22580    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22581    ;;
22582 esac
22583
22584 : Remove libraries needed only for extensions
22585 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22586 : The exception is SunOS 4.x, which needs them.
22587 case "${osname}X${osvers}" in
22588 sunos*X4*)
22589     perllibs="$libs"
22590     ;;
22591 *) case "$usedl" in
22592     $define|true|[yY]*)
22593             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'`
22594             shift
22595             perllibs="$*"
22596             ;;
22597     *)  perllibs="$libs"
22598             ;;
22599     esac
22600     ;;
22601 esac
22602
22603 : Remove build directory name from cppstdin so it can be used from
22604 : either the present location or the final installed location.
22605 echo " "
22606 : Get out of the UU directory to get correct path name.
22607 cd ..
22608 case "$cppstdin" in
22609 `pwd`/cppstdin)
22610         echo "Stripping down cppstdin path name"
22611         cppstdin=cppstdin
22612         ;;
22613 esac
22614 cd UU
22615
22616 : end of configuration questions
22617 echo " "
22618 echo "End of configuration questions."
22619 echo " "
22620
22621 : back to where it started
22622 if test -d ../UU; then
22623         cd ..
22624 fi
22625
22626 : configuration may be unconditionally patched via a 'config.arch' file
22627 if $test -f config.arch; then
22628         echo "I see a config.arch file, loading it." >&4
22629         . ./config.arch
22630 fi
22631
22632 : configuration may be patched via a 'config.over' file
22633 if $test -f config.over; then
22634         echo " "
22635         dflt=y
22636         rp='I see a config.over file.  Do you wish to load it?'
22637         . UU/myread
22638         case "$ans" in
22639         n*) echo "OK, I'll ignore it.";;
22640         *)      . ./config.over
22641                 echo "Configuration override changes have been loaded."
22642                 ;;
22643         esac
22644 fi
22645
22646 : in case they want portability, strip down executable paths
22647 case "$d_portable" in
22648 "$define")
22649         echo " "
22650         echo "Stripping down executable paths..." >&4
22651         for file in $loclist $trylist; do
22652                 eval temp=\$$file
22653                 eval $file=`basename $temp`
22654         done
22655         ;;
22656 esac
22657
22658 : create config.sh file
22659 echo " "
22660 echo "Creating config.sh..." >&4
22661 $spitshell <<EOT >config.sh
22662 $startsh
22663 #
22664 # This file was produced by running the Configure script. It holds all the
22665 # definitions figured out by Configure. Should you modify one of these values,
22666 # do not forget to propagate your changes by running "Configure -der". You may
22667 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22668 #
22669
22670 # Package name      : $package
22671 # Source directory  : $src
22672 # Configuration time: $cf_time
22673 # Configured by     : $cf_by
22674 # Target system     : $myuname
22675
22676 EOT
22677 : Add in command line options if available
22678 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22679
22680 $spitshell <<EOT >>config.sh
22681
22682 Author='$Author'
22683 Date='$Date'
22684 Header='$Header'
22685 Id='$Id'
22686 Locker='$Locker'
22687 Log='$Log'
22688 RCSfile='$RCSfile'
22689 Revision='$Revision'
22690 Source='$Source'
22691 State='$State'
22692 _a='$_a'
22693 _exe='$_exe'
22694 _o='$_o'
22695 afs='$afs'
22696 afsroot='$afsroot'
22697 alignbytes='$alignbytes'
22698 ansi2knr='$ansi2knr'
22699 aphostname='$aphostname'
22700 api_revision='$api_revision'
22701 api_subversion='$api_subversion'
22702 api_version='$api_version'
22703 api_versionstring='$api_versionstring'
22704 ar='$ar'
22705 archlib='$archlib'
22706 archlibexp='$archlibexp'
22707 archname64='$archname64'
22708 archname='$archname'
22709 archobjs='$archobjs'
22710 asctime_r_proto='$asctime_r_proto'
22711 awk='$awk'
22712 baserev='$baserev'
22713 bash='$bash'
22714 bin='$bin'
22715 bin_ELF='$bin_ELF'
22716 binexp='$binexp'
22717 bison='$bison'
22718 bootstrap_charset='$bootstrap_charset'
22719 byacc='$byacc'
22720 byteorder='$byteorder'
22721 c='$c'
22722 castflags='$castflags'
22723 cat='$cat'
22724 cc='$cc'
22725 cccdlflags='$cccdlflags'
22726 ccdlflags='$ccdlflags'
22727 ccflags='$ccflags'
22728 ccflags_uselargefiles='$ccflags_uselargefiles'
22729 ccname='$ccname'
22730 ccsymbols='$ccsymbols'
22731 ccversion='$ccversion'
22732 cf_by='$cf_by'
22733 cf_email='$cf_email'
22734 cf_time='$cf_time'
22735 charbits='$charbits'
22736 charsize='$charsize'
22737 chgrp='$chgrp'
22738 chmod='$chmod'
22739 chown='$chown'
22740 clocktype='$clocktype'
22741 comm='$comm'
22742 compress='$compress'
22743 contains='$contains'
22744 cp='$cp'
22745 cpio='$cpio'
22746 cpp='$cpp'
22747 cpp_stuff='$cpp_stuff'
22748 cppccsymbols='$cppccsymbols'
22749 cppflags='$cppflags'
22750 cpplast='$cpplast'
22751 cppminus='$cppminus'
22752 cpprun='$cpprun'
22753 cppstdin='$cppstdin'
22754 cppsymbols='$cppsymbols'
22755 crypt_r_proto='$crypt_r_proto'
22756 cryptlib='$cryptlib'
22757 csh='$csh'
22758 ctermid_r_proto='$ctermid_r_proto'
22759 ctime_r_proto='$ctime_r_proto'
22760 d_Gconvert='$d_Gconvert'
22761 d_PRIEUldbl='$d_PRIEUldbl'
22762 d_PRIFUldbl='$d_PRIFUldbl'
22763 d_PRIGUldbl='$d_PRIGUldbl'
22764 d_PRIXU64='$d_PRIXU64'
22765 d_PRId64='$d_PRId64'
22766 d_PRIeldbl='$d_PRIeldbl'
22767 d_PRIfldbl='$d_PRIfldbl'
22768 d_PRIgldbl='$d_PRIgldbl'
22769 d_PRIi64='$d_PRIi64'
22770 d_PRIo64='$d_PRIo64'
22771 d_PRIu64='$d_PRIu64'
22772 d_PRIx64='$d_PRIx64'
22773 d_SCNfldbl='$d_SCNfldbl'
22774 d__fwalk='$d__fwalk'
22775 d_access='$d_access'
22776 d_accessx='$d_accessx'
22777 d_aintl='$d_aintl'
22778 d_alarm='$d_alarm'
22779 d_archlib='$d_archlib'
22780 d_asctime64='$d_asctime64'
22781 d_asctime_r='$d_asctime_r'
22782 d_atolf='$d_atolf'
22783 d_atoll='$d_atoll'
22784 d_attribute_deprecated='$d_attribute_deprecated'
22785 d_attribute_format='$d_attribute_format'
22786 d_attribute_malloc='$d_attribute_malloc'
22787 d_attribute_nonnull='$d_attribute_nonnull'
22788 d_attribute_noreturn='$d_attribute_noreturn'
22789 d_attribute_pure='$d_attribute_pure'
22790 d_attribute_unused='$d_attribute_unused'
22791 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22792 d_bcmp='$d_bcmp'
22793 d_bcopy='$d_bcopy'
22794 d_bsd='$d_bsd'
22795 d_bsdgetpgrp='$d_bsdgetpgrp'
22796 d_bsdsetpgrp='$d_bsdsetpgrp'
22797 d_builtin_choose_expr='$d_builtin_choose_expr'
22798 d_builtin_expect='$d_builtin_expect'
22799 d_bzero='$d_bzero'
22800 d_c99_variadic_macros='$d_c99_variadic_macros'
22801 d_casti32='$d_casti32'
22802 d_castneg='$d_castneg'
22803 d_charvspr='$d_charvspr'
22804 d_chown='$d_chown'
22805 d_chroot='$d_chroot'
22806 d_chsize='$d_chsize'
22807 d_class='$d_class'
22808 d_clearenv='$d_clearenv'
22809 d_closedir='$d_closedir'
22810 d_cmsghdr_s='$d_cmsghdr_s'
22811 d_const='$d_const'
22812 d_copysignl='$d_copysignl'
22813 d_cplusplus='$d_cplusplus'
22814 d_crypt='$d_crypt'
22815 d_crypt_r='$d_crypt_r'
22816 d_csh='$d_csh'
22817 d_ctermid='$d_ctermid'
22818 d_ctermid_r='$d_ctermid_r'
22819 d_ctime64='$d_ctime64'
22820 d_ctime_r='$d_ctime_r'
22821 d_cuserid='$d_cuserid'
22822 d_dbl_dig='$d_dbl_dig'
22823 d_dbminitproto='$d_dbminitproto'
22824 d_difftime64='$d_difftime64'
22825 d_difftime='$d_difftime'
22826 d_dir_dd_fd='$d_dir_dd_fd'
22827 d_dirfd='$d_dirfd'
22828 d_dirnamlen='$d_dirnamlen'
22829 d_dlerror='$d_dlerror'
22830 d_dlopen='$d_dlopen'
22831 d_dlsymun='$d_dlsymun'
22832 d_dosuid='$d_dosuid'
22833 d_drand48_r='$d_drand48_r'
22834 d_drand48proto='$d_drand48proto'
22835 d_dup2='$d_dup2'
22836 d_eaccess='$d_eaccess'
22837 d_endgrent='$d_endgrent'
22838 d_endgrent_r='$d_endgrent_r'
22839 d_endhent='$d_endhent'
22840 d_endhostent_r='$d_endhostent_r'
22841 d_endnent='$d_endnent'
22842 d_endnetent_r='$d_endnetent_r'
22843 d_endpent='$d_endpent'
22844 d_endprotoent_r='$d_endprotoent_r'
22845 d_endpwent='$d_endpwent'
22846 d_endpwent_r='$d_endpwent_r'
22847 d_endsent='$d_endsent'
22848 d_endservent_r='$d_endservent_r'
22849 d_eofnblk='$d_eofnblk'
22850 d_eunice='$d_eunice'
22851 d_faststdio='$d_faststdio'
22852 d_fchdir='$d_fchdir'
22853 d_fchmod='$d_fchmod'
22854 d_fchown='$d_fchown'
22855 d_fcntl='$d_fcntl'
22856 d_fcntl_can_lock='$d_fcntl_can_lock'
22857 d_fd_macros='$d_fd_macros'
22858 d_fd_set='$d_fd_set'
22859 d_fds_bits='$d_fds_bits'
22860 d_fgetpos='$d_fgetpos'
22861 d_finite='$d_finite'
22862 d_finitel='$d_finitel'
22863 d_flexfnam='$d_flexfnam'
22864 d_flock='$d_flock'
22865 d_flockproto='$d_flockproto'
22866 d_fork='$d_fork'
22867 d_fp_class='$d_fp_class'
22868 d_fpathconf='$d_fpathconf'
22869 d_fpclass='$d_fpclass'
22870 d_fpclassify='$d_fpclassify'
22871 d_fpclassl='$d_fpclassl'
22872 d_fpos64_t='$d_fpos64_t'
22873 d_frexpl='$d_frexpl'
22874 d_fs_data_s='$d_fs_data_s'
22875 d_fseeko='$d_fseeko'
22876 d_fsetpos='$d_fsetpos'
22877 d_fstatfs='$d_fstatfs'
22878 d_fstatvfs='$d_fstatvfs'
22879 d_fsync='$d_fsync'
22880 d_ftello='$d_ftello'
22881 d_ftime='$d_ftime'
22882 d_futimes='$d_futimes'
22883 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22884 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22885 d_getaddrinfo='$d_getaddrinfo'
22886 d_getcwd='$d_getcwd'
22887 d_getespwnam='$d_getespwnam'
22888 d_getfsstat='$d_getfsstat'
22889 d_getgrent='$d_getgrent'
22890 d_getgrent_r='$d_getgrent_r'
22891 d_getgrgid_r='$d_getgrgid_r'
22892 d_getgrnam_r='$d_getgrnam_r'
22893 d_getgrps='$d_getgrps'
22894 d_gethbyaddr='$d_gethbyaddr'
22895 d_gethbyname='$d_gethbyname'
22896 d_gethent='$d_gethent'
22897 d_gethname='$d_gethname'
22898 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22899 d_gethostbyname_r='$d_gethostbyname_r'
22900 d_gethostent_r='$d_gethostent_r'
22901 d_gethostprotos='$d_gethostprotos'
22902 d_getitimer='$d_getitimer'
22903 d_getlogin='$d_getlogin'
22904 d_getlogin_r='$d_getlogin_r'
22905 d_getmnt='$d_getmnt'
22906 d_getmntent='$d_getmntent'
22907 d_getnameinfo='$d_getnameinfo'
22908 d_getnbyaddr='$d_getnbyaddr'
22909 d_getnbyname='$d_getnbyname'
22910 d_getnent='$d_getnent'
22911 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22912 d_getnetbyname_r='$d_getnetbyname_r'
22913 d_getnetent_r='$d_getnetent_r'
22914 d_getnetprotos='$d_getnetprotos'
22915 d_getpagsz='$d_getpagsz'
22916 d_getpbyname='$d_getpbyname'
22917 d_getpbynumber='$d_getpbynumber'
22918 d_getpent='$d_getpent'
22919 d_getpgid='$d_getpgid'
22920 d_getpgrp2='$d_getpgrp2'
22921 d_getpgrp='$d_getpgrp'
22922 d_getppid='$d_getppid'
22923 d_getprior='$d_getprior'
22924 d_getprotobyname_r='$d_getprotobyname_r'
22925 d_getprotobynumber_r='$d_getprotobynumber_r'
22926 d_getprotoent_r='$d_getprotoent_r'
22927 d_getprotoprotos='$d_getprotoprotos'
22928 d_getprpwnam='$d_getprpwnam'
22929 d_getpwent='$d_getpwent'
22930 d_getpwent_r='$d_getpwent_r'
22931 d_getpwnam_r='$d_getpwnam_r'
22932 d_getpwuid_r='$d_getpwuid_r'
22933 d_getsbyname='$d_getsbyname'
22934 d_getsbyport='$d_getsbyport'
22935 d_getsent='$d_getsent'
22936 d_getservbyname_r='$d_getservbyname_r'
22937 d_getservbyport_r='$d_getservbyport_r'
22938 d_getservent_r='$d_getservent_r'
22939 d_getservprotos='$d_getservprotos'
22940 d_getspnam='$d_getspnam'
22941 d_getspnam_r='$d_getspnam_r'
22942 d_gettimeod='$d_gettimeod'
22943 d_gmtime64='$d_gmtime64'
22944 d_gmtime_r='$d_gmtime_r'
22945 d_gnulibc='$d_gnulibc'
22946 d_grpasswd='$d_grpasswd'
22947 d_hasmntopt='$d_hasmntopt'
22948 d_htonl='$d_htonl'
22949 d_ilogbl='$d_ilogbl'
22950 d_inc_version_list='$d_inc_version_list'
22951 d_index='$d_index'
22952 d_inetaton='$d_inetaton'
22953 d_inetntop='$d_inetntop'
22954 d_inetpton='$d_inetpton'
22955 d_int64_t='$d_int64_t'
22956 d_ip_mreq='$d_ip_mreq'
22957 d_ip_mreq_source='$d_ip_mreq_source'
22958 d_ipv6_mreq='$d_ipv6_mreq'
22959 d_ipv6_mreq_source='$d_ipv6_mreq_source'
22960 d_isascii='$d_isascii'
22961 d_isblank='$d_isblank'
22962 d_isfinite='$d_isfinite'
22963 d_isinf='$d_isinf'
22964 d_isnan='$d_isnan'
22965 d_isnanl='$d_isnanl'
22966 d_killpg='$d_killpg'
22967 d_lchown='$d_lchown'
22968 d_ldbl_dig='$d_ldbl_dig'
22969 d_libm_lib_version='$d_libm_lib_version'
22970 d_link='$d_link'
22971 d_localtime64='$d_localtime64'
22972 d_localtime_r='$d_localtime_r'
22973 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
22974 d_locconv='$d_locconv'
22975 d_lockf='$d_lockf'
22976 d_longdbl='$d_longdbl'
22977 d_longlong='$d_longlong'
22978 d_lseekproto='$d_lseekproto'
22979 d_lstat='$d_lstat'
22980 d_madvise='$d_madvise'
22981 d_malloc_good_size='$d_malloc_good_size'
22982 d_malloc_size='$d_malloc_size'
22983 d_mblen='$d_mblen'
22984 d_mbstowcs='$d_mbstowcs'
22985 d_mbtowc='$d_mbtowc'
22986 d_memchr='$d_memchr'
22987 d_memcmp='$d_memcmp'
22988 d_memcpy='$d_memcpy'
22989 d_memmove='$d_memmove'
22990 d_memset='$d_memset'
22991 d_mkdir='$d_mkdir'
22992 d_mkdtemp='$d_mkdtemp'
22993 d_mkfifo='$d_mkfifo'
22994 d_mkstemp='$d_mkstemp'
22995 d_mkstemps='$d_mkstemps'
22996 d_mktime64='$d_mktime64'
22997 d_mktime='$d_mktime'
22998 d_mmap='$d_mmap'
22999 d_modfl='$d_modfl'
23000 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23001 d_modflproto='$d_modflproto'
23002 d_mprotect='$d_mprotect'
23003 d_msg='$d_msg'
23004 d_msg_ctrunc='$d_msg_ctrunc'
23005 d_msg_dontroute='$d_msg_dontroute'
23006 d_msg_oob='$d_msg_oob'
23007 d_msg_peek='$d_msg_peek'
23008 d_msg_proxy='$d_msg_proxy'
23009 d_msgctl='$d_msgctl'
23010 d_msgget='$d_msgget'
23011 d_msghdr_s='$d_msghdr_s'
23012 d_msgrcv='$d_msgrcv'
23013 d_msgsnd='$d_msgsnd'
23014 d_msync='$d_msync'
23015 d_munmap='$d_munmap'
23016 d_mymalloc='$d_mymalloc'
23017 d_ndbm='$d_ndbm'
23018 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23019 d_nice='$d_nice'
23020 d_nl_langinfo='$d_nl_langinfo'
23021 d_nv_preserves_uv='$d_nv_preserves_uv'
23022 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23023 d_off64_t='$d_off64_t'
23024 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23025 d_oldpthreads='$d_oldpthreads'
23026 d_oldsock='$d_oldsock'
23027 d_open3='$d_open3'
23028 d_pathconf='$d_pathconf'
23029 d_pause='$d_pause'
23030 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23031 d_phostname='$d_phostname'
23032 d_pipe='$d_pipe'
23033 d_poll='$d_poll'
23034 d_portable='$d_portable'
23035 d_prctl='$d_prctl'
23036 d_prctl_set_name='$d_prctl_set_name'
23037 d_printf_format_null='$d_printf_format_null'
23038 d_procselfexe='$d_procselfexe'
23039 d_pseudofork='$d_pseudofork'
23040 d_pthread_atfork='$d_pthread_atfork'
23041 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23042 d_pthread_yield='$d_pthread_yield'
23043 d_pwage='$d_pwage'
23044 d_pwchange='$d_pwchange'
23045 d_pwclass='$d_pwclass'
23046 d_pwcomment='$d_pwcomment'
23047 d_pwexpire='$d_pwexpire'
23048 d_pwgecos='$d_pwgecos'
23049 d_pwpasswd='$d_pwpasswd'
23050 d_pwquota='$d_pwquota'
23051 d_qgcvt='$d_qgcvt'
23052 d_quad='$d_quad'
23053 d_random_r='$d_random_r'
23054 d_readdir64_r='$d_readdir64_r'
23055 d_readdir='$d_readdir'
23056 d_readdir_r='$d_readdir_r'
23057 d_readlink='$d_readlink'
23058 d_readv='$d_readv'
23059 d_recvmsg='$d_recvmsg'
23060 d_rename='$d_rename'
23061 d_rewinddir='$d_rewinddir'
23062 d_rmdir='$d_rmdir'
23063 d_safebcpy='$d_safebcpy'
23064 d_safemcpy='$d_safemcpy'
23065 d_sanemcmp='$d_sanemcmp'
23066 d_sbrkproto='$d_sbrkproto'
23067 d_scalbnl='$d_scalbnl'
23068 d_sched_yield='$d_sched_yield'
23069 d_scm_rights='$d_scm_rights'
23070 d_seekdir='$d_seekdir'
23071 d_select='$d_select'
23072 d_sem='$d_sem'
23073 d_semctl='$d_semctl'
23074 d_semctl_semid_ds='$d_semctl_semid_ds'
23075 d_semctl_semun='$d_semctl_semun'
23076 d_semget='$d_semget'
23077 d_semop='$d_semop'
23078 d_sendmsg='$d_sendmsg'
23079 d_setegid='$d_setegid'
23080 d_seteuid='$d_seteuid'
23081 d_setgrent='$d_setgrent'
23082 d_setgrent_r='$d_setgrent_r'
23083 d_setgrps='$d_setgrps'
23084 d_sethent='$d_sethent'
23085 d_sethostent_r='$d_sethostent_r'
23086 d_setitimer='$d_setitimer'
23087 d_setlinebuf='$d_setlinebuf'
23088 d_setlocale='$d_setlocale'
23089 d_setlocale_r='$d_setlocale_r'
23090 d_setnent='$d_setnent'
23091 d_setnetent_r='$d_setnetent_r'
23092 d_setpent='$d_setpent'
23093 d_setpgid='$d_setpgid'
23094 d_setpgrp2='$d_setpgrp2'
23095 d_setpgrp='$d_setpgrp'
23096 d_setprior='$d_setprior'
23097 d_setproctitle='$d_setproctitle'
23098 d_setprotoent_r='$d_setprotoent_r'
23099 d_setpwent='$d_setpwent'
23100 d_setpwent_r='$d_setpwent_r'
23101 d_setregid='$d_setregid'
23102 d_setresgid='$d_setresgid'
23103 d_setresuid='$d_setresuid'
23104 d_setreuid='$d_setreuid'
23105 d_setrgid='$d_setrgid'
23106 d_setruid='$d_setruid'
23107 d_setsent='$d_setsent'
23108 d_setservent_r='$d_setservent_r'
23109 d_setsid='$d_setsid'
23110 d_setvbuf='$d_setvbuf'
23111 d_sfio='$d_sfio'
23112 d_shm='$d_shm'
23113 d_shmat='$d_shmat'
23114 d_shmatprototype='$d_shmatprototype'
23115 d_shmctl='$d_shmctl'
23116 d_shmdt='$d_shmdt'
23117 d_shmget='$d_shmget'
23118 d_sigaction='$d_sigaction'
23119 d_signbit='$d_signbit'
23120 d_sigprocmask='$d_sigprocmask'
23121 d_sigsetjmp='$d_sigsetjmp'
23122 d_sin6_scope_id='$d_sin6_scope_id'
23123 d_sitearch='$d_sitearch'
23124 d_snprintf='$d_snprintf'
23125 d_sockaddr_in6='$d_sockaddr_in6'
23126 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23127 d_sockatmark='$d_sockatmark'
23128 d_sockatmarkproto='$d_sockatmarkproto'
23129 d_socket='$d_socket'
23130 d_socklen_t='$d_socklen_t'
23131 d_sockpair='$d_sockpair'
23132 d_socks5_init='$d_socks5_init'
23133 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23134 d_sqrtl='$d_sqrtl'
23135 d_srand48_r='$d_srand48_r'
23136 d_srandom_r='$d_srandom_r'
23137 d_sresgproto='$d_sresgproto'
23138 d_sresuproto='$d_sresuproto'
23139 d_statblks='$d_statblks'
23140 d_statfs_f_flags='$d_statfs_f_flags'
23141 d_statfs_s='$d_statfs_s'
23142 d_static_inline='$d_static_inline'
23143 d_statvfs='$d_statvfs'
23144 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23145 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23146 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23147 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23148 d_stdio_stream_array='$d_stdio_stream_array'
23149 d_stdiobase='$d_stdiobase'
23150 d_stdstdio='$d_stdstdio'
23151 d_strchr='$d_strchr'
23152 d_strcoll='$d_strcoll'
23153 d_strctcpy='$d_strctcpy'
23154 d_strerrm='$d_strerrm'
23155 d_strerror='$d_strerror'
23156 d_strerror_r='$d_strerror_r'
23157 d_strftime='$d_strftime'
23158 d_strlcat='$d_strlcat'
23159 d_strlcpy='$d_strlcpy'
23160 d_strtod='$d_strtod'
23161 d_strtol='$d_strtol'
23162 d_strtold='$d_strtold'
23163 d_strtoll='$d_strtoll'
23164 d_strtoq='$d_strtoq'
23165 d_strtoul='$d_strtoul'
23166 d_strtoull='$d_strtoull'
23167 d_strtouq='$d_strtouq'
23168 d_strxfrm='$d_strxfrm'
23169 d_suidsafe='$d_suidsafe'
23170 d_symlink='$d_symlink'
23171 d_syscall='$d_syscall'
23172 d_syscallproto='$d_syscallproto'
23173 d_sysconf='$d_sysconf'
23174 d_sysernlst='$d_sysernlst'
23175 d_syserrlst='$d_syserrlst'
23176 d_system='$d_system'
23177 d_tcgetpgrp='$d_tcgetpgrp'
23178 d_tcsetpgrp='$d_tcsetpgrp'
23179 d_telldir='$d_telldir'
23180 d_telldirproto='$d_telldirproto'
23181 d_time='$d_time'
23182 d_timegm='$d_timegm'
23183 d_times='$d_times'
23184 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23185 d_tm_tm_zone='$d_tm_tm_zone'
23186 d_tmpnam_r='$d_tmpnam_r'
23187 d_truncate='$d_truncate'
23188 d_ttyname_r='$d_ttyname_r'
23189 d_tzname='$d_tzname'
23190 d_u32align='$d_u32align'
23191 d_ualarm='$d_ualarm'
23192 d_umask='$d_umask'
23193 d_uname='$d_uname'
23194 d_union_semun='$d_union_semun'
23195 d_unordered='$d_unordered'
23196 d_unsetenv='$d_unsetenv'
23197 d_usleep='$d_usleep'
23198 d_usleepproto='$d_usleepproto'
23199 d_ustat='$d_ustat'
23200 d_vendorarch='$d_vendorarch'
23201 d_vendorbin='$d_vendorbin'
23202 d_vendorlib='$d_vendorlib'
23203 d_vendorscript='$d_vendorscript'
23204 d_vfork='$d_vfork'
23205 d_void_closedir='$d_void_closedir'
23206 d_voidsig='$d_voidsig'
23207 d_voidtty='$d_voidtty'
23208 d_volatile='$d_volatile'
23209 d_vprintf='$d_vprintf'
23210 d_vsnprintf='$d_vsnprintf'
23211 d_wait4='$d_wait4'
23212 d_waitpid='$d_waitpid'
23213 d_wcstombs='$d_wcstombs'
23214 d_wctomb='$d_wctomb'
23215 d_writev='$d_writev'
23216 d_xenix='$d_xenix'
23217 date='$date'
23218 db_hashtype='$db_hashtype'
23219 db_prefixtype='$db_prefixtype'
23220 db_version_major='$db_version_major'
23221 db_version_minor='$db_version_minor'
23222 db_version_patch='$db_version_patch'
23223 direntrytype='$direntrytype'
23224 dlext='$dlext'
23225 dlsrc='$dlsrc'
23226 doublesize='$doublesize'
23227 drand01='$drand01'
23228 drand48_r_proto='$drand48_r_proto'
23229 dtrace='$dtrace'
23230 dynamic_ext='$dynamic_ext'
23231 eagain='$eagain'
23232 ebcdic='$ebcdic'
23233 echo='$echo'
23234 egrep='$egrep'
23235 emacs='$emacs'
23236 endgrent_r_proto='$endgrent_r_proto'
23237 endhostent_r_proto='$endhostent_r_proto'
23238 endnetent_r_proto='$endnetent_r_proto'
23239 endprotoent_r_proto='$endprotoent_r_proto'
23240 endpwent_r_proto='$endpwent_r_proto'
23241 endservent_r_proto='$endservent_r_proto'
23242 eunicefix='$eunicefix'
23243 exe_ext='$exe_ext'
23244 expr='$expr'
23245 extensions='$extensions'
23246 extern_C='$extern_C'
23247 extras='$extras'
23248 fflushNULL='$fflushNULL'
23249 fflushall='$fflushall'
23250 find='$find'
23251 firstmakefile='$firstmakefile'
23252 flex='$flex'
23253 fpossize='$fpossize'
23254 fpostype='$fpostype'
23255 freetype='$freetype'
23256 from='$from'
23257 full_ar='$full_ar'
23258 full_csh='$full_csh'
23259 full_sed='$full_sed'
23260 gccansipedantic='$gccansipedantic'
23261 gccosandvers='$gccosandvers'
23262 gccversion='$gccversion'
23263 getgrent_r_proto='$getgrent_r_proto'
23264 getgrgid_r_proto='$getgrgid_r_proto'
23265 getgrnam_r_proto='$getgrnam_r_proto'
23266 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23267 gethostbyname_r_proto='$gethostbyname_r_proto'
23268 gethostent_r_proto='$gethostent_r_proto'
23269 getlogin_r_proto='$getlogin_r_proto'
23270 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23271 getnetbyname_r_proto='$getnetbyname_r_proto'
23272 getnetent_r_proto='$getnetent_r_proto'
23273 getprotobyname_r_proto='$getprotobyname_r_proto'
23274 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23275 getprotoent_r_proto='$getprotoent_r_proto'
23276 getpwent_r_proto='$getpwent_r_proto'
23277 getpwnam_r_proto='$getpwnam_r_proto'
23278 getpwuid_r_proto='$getpwuid_r_proto'
23279 getservbyname_r_proto='$getservbyname_r_proto'
23280 getservbyport_r_proto='$getservbyport_r_proto'
23281 getservent_r_proto='$getservent_r_proto'
23282 getspnam_r_proto='$getspnam_r_proto'
23283 gidformat='$gidformat'
23284 gidsign='$gidsign'
23285 gidsize='$gidsize'
23286 gidtype='$gidtype'
23287 glibpth='$glibpth'
23288 gmake='$gmake'
23289 gmtime_r_proto='$gmtime_r_proto'
23290 gnulibc_version='$gnulibc_version'
23291 grep='$grep'
23292 groupcat='$groupcat'
23293 groupstype='$groupstype'
23294 gzip='$gzip'
23295 h_fcntl='$h_fcntl'
23296 h_sysfile='$h_sysfile'
23297 hint='$hint'
23298 hostcat='$hostcat'
23299 html1dir='$html1dir'
23300 html1direxp='$html1direxp'
23301 html3dir='$html3dir'
23302 html3direxp='$html3direxp'
23303 i16size='$i16size'
23304 i16type='$i16type'
23305 i32size='$i32size'
23306 i32type='$i32type'
23307 i64size='$i64size'
23308 i64type='$i64type'
23309 i8size='$i8size'
23310 i8type='$i8type'
23311 i_arpainet='$i_arpainet'
23312 i_assert='$i_assert'
23313 i_bsdioctl='$i_bsdioctl'
23314 i_crypt='$i_crypt'
23315 i_db='$i_db'
23316 i_dbm='$i_dbm'
23317 i_dirent='$i_dirent'
23318 i_dlfcn='$i_dlfcn'
23319 i_fcntl='$i_fcntl'
23320 i_float='$i_float'
23321 i_fp='$i_fp'
23322 i_fp_class='$i_fp_class'
23323 i_gdbm='$i_gdbm'
23324 i_gdbm_ndbm='$i_gdbm_ndbm'
23325 i_gdbmndbm='$i_gdbmndbm'
23326 i_grp='$i_grp'
23327 i_ieeefp='$i_ieeefp'
23328 i_inttypes='$i_inttypes'
23329 i_langinfo='$i_langinfo'
23330 i_libutil='$i_libutil'
23331 i_limits='$i_limits'
23332 i_locale='$i_locale'
23333 i_machcthr='$i_machcthr'
23334 i_malloc='$i_malloc'
23335 i_mallocmalloc='$i_mallocmalloc'
23336 i_math='$i_math'
23337 i_memory='$i_memory'
23338 i_mntent='$i_mntent'
23339 i_ndbm='$i_ndbm'
23340 i_netdb='$i_netdb'
23341 i_neterrno='$i_neterrno'
23342 i_netinettcp='$i_netinettcp'
23343 i_niin='$i_niin'
23344 i_poll='$i_poll'
23345 i_prot='$i_prot'
23346 i_pthread='$i_pthread'
23347 i_pwd='$i_pwd'
23348 i_rpcsvcdbm='$i_rpcsvcdbm'
23349 i_sfio='$i_sfio'
23350 i_sgtty='$i_sgtty'
23351 i_shadow='$i_shadow'
23352 i_socks='$i_socks'
23353 i_stdarg='$i_stdarg'
23354 i_stdbool='$i_stdbool'
23355 i_stddef='$i_stddef'
23356 i_stdlib='$i_stdlib'
23357 i_string='$i_string'
23358 i_sunmath='$i_sunmath'
23359 i_sysaccess='$i_sysaccess'
23360 i_sysdir='$i_sysdir'
23361 i_sysfile='$i_sysfile'
23362 i_sysfilio='$i_sysfilio'
23363 i_sysin='$i_sysin'
23364 i_sysioctl='$i_sysioctl'
23365 i_syslog='$i_syslog'
23366 i_sysmman='$i_sysmman'
23367 i_sysmode='$i_sysmode'
23368 i_sysmount='$i_sysmount'
23369 i_sysndir='$i_sysndir'
23370 i_sysparam='$i_sysparam'
23371 i_syspoll='$i_syspoll'
23372 i_sysresrc='$i_sysresrc'
23373 i_syssecrt='$i_syssecrt'
23374 i_sysselct='$i_sysselct'
23375 i_syssockio='$i_syssockio'
23376 i_sysstat='$i_sysstat'
23377 i_sysstatfs='$i_sysstatfs'
23378 i_sysstatvfs='$i_sysstatvfs'
23379 i_systime='$i_systime'
23380 i_systimek='$i_systimek'
23381 i_systimes='$i_systimes'
23382 i_systypes='$i_systypes'
23383 i_sysuio='$i_sysuio'
23384 i_sysun='$i_sysun'
23385 i_sysutsname='$i_sysutsname'
23386 i_sysvfs='$i_sysvfs'
23387 i_syswait='$i_syswait'
23388 i_termio='$i_termio'
23389 i_termios='$i_termios'
23390 i_time='$i_time'
23391 i_unistd='$i_unistd'
23392 i_ustat='$i_ustat'
23393 i_utime='$i_utime'
23394 i_values='$i_values'
23395 i_varargs='$i_varargs'
23396 i_varhdr='$i_varhdr'
23397 i_vfork='$i_vfork'
23398 ignore_versioned_solibs='$ignore_versioned_solibs'
23399 inc_version_list='$inc_version_list'
23400 inc_version_list_init='$inc_version_list_init'
23401 incpath='$incpath'
23402 inews='$inews'
23403 initialinstalllocation='$initialinstalllocation'
23404 installarchlib='$installarchlib'
23405 installbin='$installbin'
23406 installhtml1dir='$installhtml1dir'
23407 installhtml3dir='$installhtml3dir'
23408 installman1dir='$installman1dir'
23409 installman3dir='$installman3dir'
23410 installprefix='$installprefix'
23411 installprefixexp='$installprefixexp'
23412 installprivlib='$installprivlib'
23413 installscript='$installscript'
23414 installsitearch='$installsitearch'
23415 installsitebin='$installsitebin'
23416 installsitehtml1dir='$installsitehtml1dir'
23417 installsitehtml3dir='$installsitehtml3dir'
23418 installsitelib='$installsitelib'
23419 installsiteman1dir='$installsiteman1dir'
23420 installsiteman3dir='$installsiteman3dir'
23421 installsitescript='$installsitescript'
23422 installstyle='$installstyle'
23423 installusrbinperl='$installusrbinperl'
23424 installvendorarch='$installvendorarch'
23425 installvendorbin='$installvendorbin'
23426 installvendorhtml1dir='$installvendorhtml1dir'
23427 installvendorhtml3dir='$installvendorhtml3dir'
23428 installvendorlib='$installvendorlib'
23429 installvendorman1dir='$installvendorman1dir'
23430 installvendorman3dir='$installvendorman3dir'
23431 installvendorscript='$installvendorscript'
23432 intsize='$intsize'
23433 issymlink='$issymlink'
23434 ivdformat='$ivdformat'
23435 ivsize='$ivsize'
23436 ivtype='$ivtype'
23437 known_extensions='$known_extensions'
23438 ksh='$ksh'
23439 ld='$ld'
23440 ld_can_script='$ld_can_script'
23441 lddlflags='$lddlflags'
23442 ldflags='$ldflags'
23443 ldflags_uselargefiles='$ldflags_uselargefiles'
23444 ldlibpthname='$ldlibpthname'
23445 less='$less'
23446 lib_ext='$lib_ext'
23447 libc='$libc'
23448 libperl='$libperl'
23449 libpth='$libpth'
23450 libs='$libs'
23451 libsdirs='$libsdirs'
23452 libsfiles='$libsfiles'
23453 libsfound='$libsfound'
23454 libspath='$libspath'
23455 libswanted='$libswanted'
23456 libswanted_uselargefiles='$libswanted_uselargefiles'
23457 line='$line'
23458 lint='$lint'
23459 lkflags='$lkflags'
23460 ln='$ln'
23461 lns='$lns'
23462 localtime_r_proto='$localtime_r_proto'
23463 locincpth='$locincpth'
23464 loclibpth='$loclibpth'
23465 longdblsize='$longdblsize'
23466 longlongsize='$longlongsize'
23467 longsize='$longsize'
23468 lp='$lp'
23469 lpr='$lpr'
23470 ls='$ls'
23471 lseeksize='$lseeksize'
23472 lseektype='$lseektype'
23473 mad='$mad'
23474 madlyh='$madlyh'
23475 madlyobj='$madlyobj'
23476 madlysrc='$madlysrc'
23477 mail='$mail'
23478 mailx='$mailx'
23479 make='$make'
23480 make_set_make='$make_set_make'
23481 mallocobj='$mallocobj'
23482 mallocsrc='$mallocsrc'
23483 malloctype='$malloctype'
23484 man1dir='$man1dir'
23485 man1direxp='$man1direxp'
23486 man1ext='$man1ext'
23487 man3dir='$man3dir'
23488 man3direxp='$man3direxp'
23489 man3ext='$man3ext'
23490 mips_type='$mips_type'
23491 mistrustnm='$mistrustnm'
23492 mkdir='$mkdir'
23493 mmaptype='$mmaptype'
23494 modetype='$modetype'
23495 more='$more'
23496 multiarch='$multiarch'
23497 mv='$mv'
23498 myarchname='$myarchname'
23499 mydomain='$mydomain'
23500 myhostname='$myhostname'
23501 myuname='$myuname'
23502 n='$n'
23503 need_va_copy='$need_va_copy'
23504 netdb_hlen_type='$netdb_hlen_type'
23505 netdb_host_type='$netdb_host_type'
23506 netdb_name_type='$netdb_name_type'
23507 netdb_net_type='$netdb_net_type'
23508 nm='$nm'
23509 nm_opt='$nm_opt'
23510 nm_so_opt='$nm_so_opt'
23511 nonxs_ext='$nonxs_ext'
23512 nroff='$nroff'
23513 nvEUformat='$nvEUformat'
23514 nvFUformat='$nvFUformat'
23515 nvGUformat='$nvGUformat'
23516 nv_overflows_integers_at='$nv_overflows_integers_at'
23517 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23518 nveformat='$nveformat'
23519 nvfformat='$nvfformat'
23520 nvgformat='$nvgformat'
23521 nvsize='$nvsize'
23522 nvtype='$nvtype'
23523 o_nonblock='$o_nonblock'
23524 obj_ext='$obj_ext'
23525 old_pthread_create_joinable='$old_pthread_create_joinable'
23526 optimize='$optimize'
23527 orderlib='$orderlib'
23528 osname='$osname'
23529 osvers='$osvers'
23530 otherlibdirs='$otherlibdirs'
23531 package='$package'
23532 pager='$pager'
23533 passcat='$passcat'
23534 patchlevel='$patchlevel'
23535 path_sep='$path_sep'
23536 perl5='$perl5'
23537 perl='$perl'
23538 perl_patchlevel='$perl_patchlevel'
23539 perl_static_inline='$perl_static_inline'
23540 perladmin='$perladmin'
23541 perllibs='$perllibs'
23542 perlpath='$perlpath'
23543 pg='$pg'
23544 phostname='$phostname'
23545 pidtype='$pidtype'
23546 plibpth='$plibpth'
23547 pmake='$pmake'
23548 pr='$pr'
23549 prefix='$prefix'
23550 prefixexp='$prefixexp'
23551 privlib='$privlib'
23552 privlibexp='$privlibexp'
23553 procselfexe='$procselfexe'
23554 prototype='$prototype'
23555 ptrsize='$ptrsize'
23556 quadkind='$quadkind'
23557 quadtype='$quadtype'
23558 randbits='$randbits'
23559 randfunc='$randfunc'
23560 random_r_proto='$random_r_proto'
23561 randseedtype='$randseedtype'
23562 ranlib='$ranlib'
23563 rd_nodata='$rd_nodata'
23564 readdir64_r_proto='$readdir64_r_proto'
23565 readdir_r_proto='$readdir_r_proto'
23566 revision='$revision'
23567 rm='$rm'
23568 rm_try='$rm_try'
23569 rmail='$rmail'
23570 run='$run'
23571 runnm='$runnm'
23572 sGMTIME_max='$sGMTIME_max'
23573 sGMTIME_min='$sGMTIME_min'
23574 sLOCALTIME_max='$sLOCALTIME_max'
23575 sLOCALTIME_min='$sLOCALTIME_min'
23576 sPRIEUldbl='$sPRIEUldbl'
23577 sPRIFUldbl='$sPRIFUldbl'
23578 sPRIGUldbl='$sPRIGUldbl'
23579 sPRIXU64='$sPRIXU64'
23580 sPRId64='$sPRId64'
23581 sPRIeldbl='$sPRIeldbl'
23582 sPRIfldbl='$sPRIfldbl'
23583 sPRIgldbl='$sPRIgldbl'
23584 sPRIi64='$sPRIi64'
23585 sPRIo64='$sPRIo64'
23586 sPRIu64='$sPRIu64'
23587 sPRIx64='$sPRIx64'
23588 sSCNfldbl='$sSCNfldbl'
23589 sched_yield='$sched_yield'
23590 scriptdir='$scriptdir'
23591 scriptdirexp='$scriptdirexp'
23592 sed='$sed'
23593 seedfunc='$seedfunc'
23594 selectminbits='$selectminbits'
23595 selecttype='$selecttype'
23596 sendmail='$sendmail'
23597 setgrent_r_proto='$setgrent_r_proto'
23598 sethostent_r_proto='$sethostent_r_proto'
23599 setlocale_r_proto='$setlocale_r_proto'
23600 setnetent_r_proto='$setnetent_r_proto'
23601 setprotoent_r_proto='$setprotoent_r_proto'
23602 setpwent_r_proto='$setpwent_r_proto'
23603 setservent_r_proto='$setservent_r_proto'
23604 sh='$sh'
23605 shar='$shar'
23606 sharpbang='$sharpbang'
23607 shmattype='$shmattype'
23608 shortsize='$shortsize'
23609 shrpenv='$shrpenv'
23610 shsharp='$shsharp'
23611 sig_count='$sig_count'
23612 sig_name='$sig_name'
23613 sig_name_init='$sig_name_init'
23614 sig_num='$sig_num'
23615 sig_num_init='$sig_num_init'
23616 sig_size='$sig_size'
23617 signal_t='$signal_t'
23618 sitearch='$sitearch'
23619 sitearchexp='$sitearchexp'
23620 sitebin='$sitebin'
23621 sitebinexp='$sitebinexp'
23622 sitehtml1dir='$sitehtml1dir'
23623 sitehtml1direxp='$sitehtml1direxp'
23624 sitehtml3dir='$sitehtml3dir'
23625 sitehtml3direxp='$sitehtml3direxp'
23626 sitelib='$sitelib'
23627 sitelib_stem='$sitelib_stem'
23628 sitelibexp='$sitelibexp'
23629 siteman1dir='$siteman1dir'
23630 siteman1direxp='$siteman1direxp'
23631 siteman3dir='$siteman3dir'
23632 siteman3direxp='$siteman3direxp'
23633 siteprefix='$siteprefix'
23634 siteprefixexp='$siteprefixexp'
23635 sitescript='$sitescript'
23636 sitescriptexp='$sitescriptexp'
23637 sizesize='$sizesize'
23638 sizetype='$sizetype'
23639 sleep='$sleep'
23640 smail='$smail'
23641 so='$so'
23642 sockethdr='$sockethdr'
23643 socketlib='$socketlib'
23644 socksizetype='$socksizetype'
23645 sort='$sort'
23646 spackage='$spackage'
23647 spitshell='$spitshell'
23648 srand48_r_proto='$srand48_r_proto'
23649 srandom_r_proto='$srandom_r_proto'
23650 src='$src'
23651 ssizetype='$ssizetype'
23652 st_ino_sign='$st_ino_sign'
23653 st_ino_size='$st_ino_size'
23654 startperl='$startperl'
23655 startsh='$startsh'
23656 static_ext='$static_ext'
23657 stdchar='$stdchar'
23658 stdio_base='$stdio_base'
23659 stdio_bufsiz='$stdio_bufsiz'
23660 stdio_cnt='$stdio_cnt'
23661 stdio_filbuf='$stdio_filbuf'
23662 stdio_ptr='$stdio_ptr'
23663 stdio_stream_array='$stdio_stream_array'
23664 strerror_r_proto='$strerror_r_proto'
23665 strings='$strings'
23666 submit='$submit'
23667 subversion='$subversion'
23668 sysman='$sysman'
23669 tail='$tail'
23670 tar='$tar'
23671 targetarch='$targetarch'
23672 tbl='$tbl'
23673 tee='$tee'
23674 test='$test'
23675 timeincl='$timeincl'
23676 timetype='$timetype'
23677 tmpnam_r_proto='$tmpnam_r_proto'
23678 to='$to'
23679 touch='$touch'
23680 tr='$tr'
23681 trnl='$trnl'
23682 troff='$troff'
23683 ttyname_r_proto='$ttyname_r_proto'
23684 u16size='$u16size'
23685 u16type='$u16type'
23686 u32size='$u32size'
23687 u32type='$u32type'
23688 u64size='$u64size'
23689 u64type='$u64type'
23690 u8size='$u8size'
23691 u8type='$u8type'
23692 uidformat='$uidformat'
23693 uidsign='$uidsign'
23694 uidsize='$uidsize'
23695 uidtype='$uidtype'
23696 uname='$uname'
23697 uniq='$uniq'
23698 uquadtype='$uquadtype'
23699 use5005threads='$use5005threads'
23700 use64bitall='$use64bitall'
23701 use64bitint='$use64bitint'
23702 usecrosscompile='$usecrosscompile'
23703 usedevel='$usedevel'
23704 usedl='$usedl'
23705 usedtrace='$usedtrace'
23706 usefaststdio='$usefaststdio'
23707 useithreads='$useithreads'
23708 usekernprocpathname='$usekernprocpathname'
23709 uselargefiles='$uselargefiles'
23710 uselongdouble='$uselongdouble'
23711 usemallocwrap='$usemallocwrap'
23712 usemorebits='$usemorebits'
23713 usemultiplicity='$usemultiplicity'
23714 usemymalloc='$usemymalloc'
23715 usenm='$usenm'
23716 usensgetexecutablepath='$usensgetexecutablepath'
23717 useopcode='$useopcode'
23718 useperlio='$useperlio'
23719 useposix='$useposix'
23720 usereentrant='$usereentrant'
23721 userelocatableinc='$userelocatableinc'
23722 usesfio='$usesfio'
23723 useshrplib='$useshrplib'
23724 usesitecustomize='$usesitecustomize'
23725 usesocks='$usesocks'
23726 usethreads='$usethreads'
23727 usevendorprefix='$usevendorprefix'
23728 useversionedarchname='$useversionedarchname'
23729 usevfork='$usevfork'
23730 usrinc='$usrinc'
23731 uuname='$uuname'
23732 uvXUformat='$uvXUformat'
23733 uvoformat='$uvoformat'
23734 uvsize='$uvsize'
23735 uvtype='$uvtype'
23736 uvuformat='$uvuformat'
23737 uvxformat='$uvxformat'
23738 vaproto='$vaproto'
23739 vendorarch='$vendorarch'
23740 vendorarchexp='$vendorarchexp'
23741 vendorbin='$vendorbin'
23742 vendorbinexp='$vendorbinexp'
23743 vendorhtml1dir='$vendorhtml1dir'
23744 vendorhtml1direxp='$vendorhtml1direxp'
23745 vendorhtml3dir='$vendorhtml3dir'
23746 vendorhtml3direxp='$vendorhtml3direxp'
23747 vendorlib='$vendorlib'
23748 vendorlib_stem='$vendorlib_stem'
23749 vendorlibexp='$vendorlibexp'
23750 vendorman1dir='$vendorman1dir'
23751 vendorman1direxp='$vendorman1direxp'
23752 vendorman3dir='$vendorman3dir'
23753 vendorman3direxp='$vendorman3direxp'
23754 vendorprefix='$vendorprefix'
23755 vendorprefixexp='$vendorprefixexp'
23756 vendorscript='$vendorscript'
23757 vendorscriptexp='$vendorscriptexp'
23758 version='$version'
23759 version_patchlevel_string='$version_patchlevel_string'
23760 versiononly='$versiononly'
23761 vi='$vi'
23762 xlibpth='$xlibpth'
23763 yacc='$yacc'
23764 yaccflags='$yaccflags'
23765 zcat='$zcat'
23766 zip='$zip'
23767 EOT
23768
23769 : add special variables
23770 $test -f $src/patchlevel.h && \
23771 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23772 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23773 echo "PERL_CONFIG_SH=true" >>config.sh
23774
23775 : propagate old symbols
23776 if $test -f UU/config.sh; then
23777         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23778         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23779                 config.sh config.sh UU/oldconfig.sh |\
23780                 $sort | $uniq -u >UU/oldsyms
23781         set X `$cat UU/oldsyms`
23782         shift
23783         case $# in
23784         0) ;;
23785         *)
23786                 $cat <<EOM
23787 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23788 EOM
23789                 echo ": Variables propagated from previous config.sh file." >>config.sh
23790                 for sym in `$cat UU/oldsyms`; do
23791                         echo "    Propagating $hint variable "'$'"$sym..."
23792                         eval 'tmp="$'"${sym}"'"'
23793                         echo "$tmp" | \
23794                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23795                 done
23796                 ;;
23797         esac
23798 fi
23799
23800 : Finish up by extracting the .SH files
23801 case "$alldone" in
23802 exit)
23803         $rm -rf UU
23804         echo "Extraction done."
23805         exit 0
23806         ;;
23807 cont)
23808         ;;
23809 '')
23810         dflt=''
23811         nostick=true
23812         $cat <<EOM
23813
23814 If you'd like to make any changes to the config.sh file before I begin
23815 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23816
23817 EOM
23818         rp="Press return or use a shell escape to edit config.sh:"
23819         . UU/myread
23820         nostick=''
23821         case "$ans" in
23822         '') ;;
23823         *) : in case they cannot read
23824                 sh 1>&4 -c "$ans";;
23825         esac
23826         ;;
23827 esac
23828
23829 : if this fails, just run all the .SH files by hand
23830 . ./config.sh
23831
23832 echo " "
23833 exec 1>&4
23834 pwd=`pwd`
23835 . ./UU/extract
23836 cd "$pwd"
23837
23838 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23839         dflt=y
23840         case "$silent" in
23841         true) ;;
23842         *)
23843                 $cat <<EOM
23844
23845 Now you need to generate make dependencies by running "$make depend".
23846 You might prefer to run it in background: "$make depend > makedepend.out &"
23847 It can take a while, so you might not want to run it right now.
23848
23849 EOM
23850                 ;;
23851         esac
23852         rp="Run $make depend now?"
23853         . UU/myread
23854         case "$ans" in
23855         y*)
23856                 $make depend && echo "Now you must run '$make'."
23857                 ;;
23858         *)
23859                 echo "You must run '$make depend' then '$make'."
23860                 ;;
23861         esac
23862 elif test -f [Mm]akefile; then
23863         echo " "
23864         echo "Now you must run a $make."
23865 else
23866         echo "Configure done."
23867 fi
23868
23869 if $test -f Policy.sh; then
23870     $cat <<EOM
23871
23872 If you compile $package on a different machine or from a different object
23873 directory, copy the Policy.sh file from this object directory to the
23874 new one before you run Configure -- this will help you with most of
23875 the policy defaults.
23876
23877 EOM
23878 fi
23879 if $test -f config.msg; then
23880     echo "Hmm.  I also noted the following information while running:"
23881     echo " "
23882     $cat config.msg >&4
23883     $rm -f config.msg
23884 fi
23885 $rm -f kit*isdone ark*isdone
23886 $rm -rf UU
23887
23888 : End of Configure
23889