This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Move Pod::Functions from lib/ to ext/
[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.sourceforge.net/svnroot/dist/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 Thu Feb 16 16:57:30 CET 2012 [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) ;;
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 d_atolf=''
336 d_atoll=''
337 baserev=''
338 bin=''
339 binexp=''
340 initialinstalllocation=''
341 installbin=''
342 userelocatableinc=''
343 byteorder=''
344 cc=''
345 ccflags=''
346 cppflags=''
347 ldflags=''
348 lkflags=''
349 locincpth=''
350 optimize=''
351 cf_email=''
352 cf_by=''
353 cf_time=''
354 charbits=''
355 charsize=''
356 contains=''
357 cpp_stuff=''
358 cpplast=''
359 cppminus=''
360 cpprun=''
361 cppstdin=''
362 d__fwalk=''
363 d_access=''
364 d_accessx=''
365 d_aintl=''
366 d_alarm=''
367 asctime_r_proto=''
368 d_asctime_r=''
369 d_attribute_deprecated=''
370 d_attribute_format=''
371 d_attribute_malloc=''
372 d_attribute_nonnull=''
373 d_attribute_noreturn=''
374 d_attribute_pure=''
375 d_attribute_unused=''
376 d_attribute_warn_unused_result=''
377 d_printf_format_null=''
378 d_bcmp=''
379 d_bcopy=''
380 d_builtin_choose_expr=''
381 d_builtin_expect=''
382 d_bzero=''
383 d_c99_variadic_macros=''
384 d_casti32=''
385 castflags=''
386 d_castneg=''
387 d_chown=''
388 d_chroot=''
389 d_chsize=''
390 d_class=''
391 d_clearenv=''
392 d_closedir=''
393 d_void_closedir=''
394 d_cmsghdr_s=''
395 d_const=''
396 d_copysignl=''
397 d_cplusplus=''
398 cryptlib=''
399 d_crypt=''
400 crypt_r_proto=''
401 d_crypt_r=''
402 d_csh=''
403 full_csh=''
404 d_ctermid=''
405 ctermid_r_proto=''
406 d_ctermid_r=''
407 ctime_r_proto=''
408 d_ctime_r=''
409 d_cuserid=''
410 d_dbl_dig=''
411 d_dbminitproto=''
412 d_difftime=''
413 d_dir_dd_fd=''
414 d_dirfd=''
415 d_dlerror=''
416 d_dlopen=''
417 d_dlsymun=''
418 d_dosuid=''
419 d_suidsafe=''
420 d_drand48_r=''
421 drand48_r_proto=''
422 d_drand48proto=''
423 d_dup2=''
424 d_eaccess=''
425 d_endgrent=''
426 d_endgrent_r=''
427 endgrent_r_proto=''
428 d_endhent=''
429 d_endhostent_r=''
430 endhostent_r_proto=''
431 d_endnent=''
432 d_endnetent_r=''
433 endnetent_r_proto=''
434 d_endpent=''
435 d_endprotoent_r=''
436 endprotoent_r_proto=''
437 d_endpwent=''
438 d_endpwent_r=''
439 endpwent_r_proto=''
440 d_endsent=''
441 d_endservent_r=''
442 endservent_r_proto=''
443 d_faststdio=''
444 d_fchdir=''
445 d_fchmod=''
446 d_fchown=''
447 d_fcntl=''
448 d_fcntl_can_lock=''
449 d_fd_macros=''
450 d_fd_set=''
451 d_fds_bits=''
452 d_fgetpos=''
453 d_finite=''
454 d_finitel=''
455 d_flexfnam=''
456 d_flock=''
457 d_flockproto=''
458 d_fork=''
459 d_fp_class=''
460 d_fpclass=''
461 d_fpclassify=''
462 d_fpclassl=''
463 d_fpos64_t=''
464 d_frexpl=''
465 d_fs_data_s=''
466 d_fseeko=''
467 d_fsetpos=''
468 d_fstatfs=''
469 d_fsync=''
470 d_ftello=''
471 d_ftime=''
472 d_gettimeod=''
473 d_futimes=''
474 d_Gconvert=''
475 d_getaddrinfo=''
476 d_getcwd=''
477 d_getespwnam=''
478 d_getfsstat=''
479 d_getgrent=''
480 d_getgrent_r=''
481 getgrent_r_proto=''
482 d_getgrgid_r=''
483 getgrgid_r_proto=''
484 d_getgrnam_r=''
485 getgrnam_r_proto=''
486 d_getgrps=''
487 d_gethbyaddr=''
488 d_gethbyname=''
489 d_gethent=''
490 aphostname=''
491 d_gethname=''
492 d_phostname=''
493 d_uname=''
494 d_gethostbyaddr_r=''
495 gethostbyaddr_r_proto=''
496 d_gethostbyname_r=''
497 gethostbyname_r_proto=''
498 d_gethostent_r=''
499 gethostent_r_proto=''
500 d_gethostprotos=''
501 d_getitimer=''
502 d_getlogin=''
503 d_getlogin_r=''
504 getlogin_r_proto=''
505 d_getmnt=''
506 d_getmntent=''
507 d_getnameinfo=''
508 d_getnbyaddr=''
509 d_getnbyname=''
510 d_getnent=''
511 d_getnetbyaddr_r=''
512 getnetbyaddr_r_proto=''
513 d_getnetbyname_r=''
514 getnetbyname_r_proto=''
515 d_getnetent_r=''
516 getnetent_r_proto=''
517 d_getnetprotos=''
518 d_getpagsz=''
519 d_getpent=''
520 d_getpgid=''
521 d_getpgrp2=''
522 d_bsdgetpgrp=''
523 d_getpgrp=''
524 d_getppid=''
525 d_getprior=''
526 d_getpbyname=''
527 d_getpbynumber=''
528 d_getprotobyname_r=''
529 getprotobyname_r_proto=''
530 d_getprotobynumber_r=''
531 getprotobynumber_r_proto=''
532 d_getprotoent_r=''
533 getprotoent_r_proto=''
534 d_getprotoprotos=''
535 d_getprpwnam=''
536 d_getpwent=''
537 d_getpwent_r=''
538 getpwent_r_proto=''
539 d_getpwnam_r=''
540 getpwnam_r_proto=''
541 d_getpwuid_r=''
542 getpwuid_r_proto=''
543 d_getsent=''
544 d_getservbyname_r=''
545 getservbyname_r_proto=''
546 d_getservbyport_r=''
547 getservbyport_r_proto=''
548 d_getservent_r=''
549 getservent_r_proto=''
550 d_getservprotos=''
551 d_getspnam=''
552 d_getspnam_r=''
553 getspnam_r_proto=''
554 d_getsbyname=''
555 d_getsbyport=''
556 d_gmtime_r=''
557 gmtime_r_proto=''
558 d_gnulibc=''
559 gnulibc_version=''
560 d_hasmntopt=''
561 d_htonl=''
562 d_ilogbl=''
563 d_inetaton=''
564 d_inetntop=''
565 d_inetpton=''
566 d_int64_t=''
567 d_isascii=''
568 d_isblank=''
569 d_isfinite=''
570 d_isinf=''
571 d_isnan=''
572 d_isnanl=''
573 d_killpg=''
574 d_lchown=''
575 d_ldbl_dig=''
576 d_libm_lib_version=''
577 d_link=''
578 d_localtime_r=''
579 d_localtime_r_needs_tzset=''
580 localtime_r_proto=''
581 d_locconv=''
582 d_lockf=''
583 d_longdbl=''
584 longdblsize=''
585 d_longlong=''
586 longlongsize=''
587 d_lseekproto=''
588 d_lstat=''
589 d_madvise=''
590 d_malloc_good_size=''
591 d_malloc_size=''
592 d_mblen=''
593 d_mbstowcs=''
594 d_mbtowc=''
595 d_memchr=''
596 d_memcmp=''
597 d_memcpy=''
598 d_memmove=''
599 d_memset=''
600 d_mkdir=''
601 d_mkdtemp=''
602 d_mkfifo=''
603 d_mkstemp=''
604 d_mkstemps=''
605 d_mktime=''
606 d_mmap=''
607 mmaptype=''
608 d_modfl=''
609 d_modfl_pow32_bug=''
610 d_modflproto=''
611 d_mprotect=''
612 d_msg=''
613 d_msgctl=''
614 d_msgget=''
615 d_msghdr_s=''
616 d_msgrcv=''
617 d_msgsnd=''
618 d_msync=''
619 d_munmap=''
620 d_nice=''
621 d_nl_langinfo=''
622 d_off64_t=''
623 d_open3=''
624 d_fpathconf=''
625 d_pathconf=''
626 d_pause=''
627 d_pipe=''
628 d_poll=''
629 d_portable=''
630 d_prctl=''
631 d_prctl_set_name=''
632 d_procselfexe=''
633 procselfexe=''
634 d_old_pthread_create_joinable=''
635 old_pthread_create_joinable=''
636 d_pthread_atfork=''
637 d_pthread_attr_setscope=''
638 d_pthread_yield=''
639 d_sched_yield=''
640 sched_yield=''
641 d_qgcvt=''
642 d_random_r=''
643 random_r_proto=''
644 d_readdir64_r=''
645 readdir64_r_proto=''
646 d_readdir=''
647 d_rewinddir=''
648 d_seekdir=''
649 d_telldir=''
650 d_readdir_r=''
651 readdir_r_proto=''
652 d_readlink=''
653 d_readv=''
654 d_recvmsg=''
655 d_rename=''
656 d_rmdir=''
657 d_safebcpy=''
658 d_safemcpy=''
659 d_sanemcmp=''
660 d_sbrkproto=''
661 d_scalbnl=''
662 d_select=''
663 d_sem=''
664 d_semctl=''
665 d_semget=''
666 d_semop=''
667 d_sendmsg=''
668 d_setegid=''
669 d_seteuid=''
670 d_setgrent=''
671 d_setgrent_r=''
672 setgrent_r_proto=''
673 d_setgrps=''
674 d_sethent=''
675 d_sethostent_r=''
676 sethostent_r_proto=''
677 d_setitimer=''
678 d_setlinebuf=''
679 d_setlocale=''
680 d_setlocale_r=''
681 setlocale_r_proto=''
682 d_setnent=''
683 d_setnetent_r=''
684 setnetent_r_proto=''
685 d_setpent=''
686 d_setpgid=''
687 d_setpgrp2=''
688 d_bsdsetpgrp=''
689 d_setpgrp=''
690 d_setprior=''
691 d_setproctitle=''
692 d_setprotoent_r=''
693 setprotoent_r_proto=''
694 d_setpwent=''
695 d_setpwent_r=''
696 setpwent_r_proto=''
697 d_setregid=''
698 d_setresgid=''
699 d_setresuid=''
700 d_setreuid=''
701 d_setrgid=''
702 d_setruid=''
703 d_setsent=''
704 d_setservent_r=''
705 setservent_r_proto=''
706 d_setsid=''
707 d_setvbuf=''
708 d_sfio=''
709 usesfio=''
710 d_shm=''
711 d_shmat=''
712 d_shmatprototype=''
713 shmattype=''
714 d_shmctl=''
715 d_shmdt=''
716 d_shmget=''
717 d_sigaction=''
718 d_signbit=''
719 d_sigprocmask=''
720 d_sigsetjmp=''
721 usesitecustomize=''
722 d_snprintf=''
723 d_vsnprintf=''
724 d_sockatmark=''
725 d_sockatmarkproto=''
726 d_ipv6_mreq=''
727 d_msg_ctrunc=''
728 d_msg_dontroute=''
729 d_msg_oob=''
730 d_msg_peek=''
731 d_msg_proxy=''
732 d_oldsock=''
733 d_scm_rights=''
734 d_sin6_scope_id=''
735 d_sockaddr_in6=''
736 d_sockaddr_sa_len=''
737 d_socket=''
738 d_sockpair=''
739 sockethdr=''
740 socketlib=''
741 d_socklen_t=''
742 d_socks5_init=''
743 d_sprintf_returns_strlen=''
744 d_sqrtl=''
745 d_srand48_r=''
746 srand48_r_proto=''
747 d_srandom_r=''
748 srandom_r_proto=''
749 d_sresgproto=''
750 d_sresuproto=''
751 d_statblks=''
752 d_statfs_f_flags=''
753 d_statfs_s=''
754 d_static_inline=''
755 perl_static_inline=''
756 d_fstatvfs=''
757 d_statvfs=''
758 d_stdio_cnt_lval=''
759 d_stdio_ptr_lval=''
760 d_stdio_ptr_lval_nochange_cnt=''
761 d_stdio_ptr_lval_sets_cnt=''
762 d_stdiobase=''
763 d_stdstdio=''
764 stdio_base=''
765 stdio_bufsiz=''
766 stdio_cnt=''
767 stdio_filbuf=''
768 stdio_ptr=''
769 d_index=''
770 d_strchr=''
771 d_strcoll=''
772 d_strctcpy=''
773 d_strerrm=''
774 d_strerror=''
775 d_sysernlst=''
776 d_syserrlst=''
777 d_strerror_r=''
778 strerror_r_proto=''
779 d_strftime=''
780 d_strlcat=''
781 d_strlcpy=''
782 d_strtod=''
783 d_strtol=''
784 d_strtold=''
785 d_strtoll=''
786 d_strtoq=''
787 d_strtoul=''
788 d_strtoull=''
789 d_strtouq=''
790 d_strxfrm=''
791 d_symlink=''
792 d_syscall=''
793 d_syscallproto=''
794 d_sysconf=''
795 d_system=''
796 d_tcgetpgrp=''
797 d_tcsetpgrp=''
798 d_telldirproto=''
799 d_time=''
800 timetype=''
801 d_asctime64=''
802 d_ctime64=''
803 d_difftime64=''
804 d_gmtime64=''
805 d_localtime64=''
806 d_mktime64=''
807 d_timegm=''
808 clocktype=''
809 d_times=''
810 d_tmpnam_r=''
811 tmpnam_r_proto=''
812 d_truncate=''
813 d_ttyname_r=''
814 ttyname_r_proto=''
815 d_tzname=''
816 d_u32align=''
817 d_ualarm=''
818 d_umask=''
819 d_semctl_semid_ds=''
820 d_semctl_semun=''
821 d_union_semun=''
822 d_unordered=''
823 d_unsetenv=''
824 d_usleep=''
825 d_usleepproto=''
826 d_ustat=''
827 d_pseudofork=''
828 d_vfork=''
829 usevfork=''
830 d_voidsig=''
831 signal_t=''
832 d_volatile=''
833 d_charvspr=''
834 d_vprintf=''
835 d_wait4=''
836 d_waitpid=''
837 d_wcstombs=''
838 d_wctomb=''
839 d_writev=''
840 dlext=''
841 bin_ELF=''
842 cccdlflags=''
843 ccdlflags=''
844 dlsrc=''
845 ld=''
846 lddlflags=''
847 usedl=''
848 doublesize=''
849 ebcdic=''
850 fflushNULL=''
851 fflushall=''
852 fpossize=''
853 fpostype=''
854 gccansipedantic=''
855 gccosandvers=''
856 gccversion=''
857 gidformat=''
858 gidsign=''
859 gidsize=''
860 gidtype=''
861 groupstype=''
862 h_fcntl=''
863 h_sysfile=''
864 html1dir=''
865 html1direxp=''
866 installhtml1dir=''
867 html3dir=''
868 html3direxp=''
869 installhtml3dir=''
870 i_arpainet=''
871 i_assert=''
872 i_crypt=''
873 db_hashtype=''
874 db_prefixtype=''
875 db_version_major=''
876 db_version_minor=''
877 db_version_patch=''
878 i_db=''
879 i_dbm=''
880 i_rpcsvcdbm=''
881 d_dirnamlen=''
882 direntrytype=''
883 i_dirent=''
884 i_dld=''
885 i_dlfcn=''
886 i_fcntl=''
887 i_float=''
888 i_fp=''
889 i_fp_class=''
890 i_gdbm=''
891 d_grpasswd=''
892 i_grp=''
893 i_ieeefp=''
894 i_inttypes=''
895 i_langinfo=''
896 i_libutil=''
897 i_limits=''
898 i_locale=''
899 i_machcthr=''
900 i_malloc=''
901 i_mallocmalloc=''
902 i_math=''
903 i_memory=''
904 i_mntent=''
905 d_gdbm_ndbm_h_uses_prototypes=''
906 d_gdbmndbm_h_uses_prototypes=''
907 d_ndbm=''
908 d_ndbm_h_uses_prototypes=''
909 i_gdbm_ndbm=''
910 i_gdbmndbm=''
911 i_ndbm=''
912 i_netdb=''
913 i_neterrno=''
914 i_netinettcp=''
915 i_niin=''
916 i_sysin=''
917 i_poll=''
918 i_prot=''
919 i_pthread=''
920 d_pwage=''
921 d_pwchange=''
922 d_pwclass=''
923 d_pwcomment=''
924 d_pwexpire=''
925 d_pwgecos=''
926 d_pwpasswd=''
927 d_pwquota=''
928 i_pwd=''
929 i_sfio=''
930 i_shadow=''
931 i_socks=''
932 i_stdbool=''
933 i_stddef=''
934 i_stdlib=''
935 i_string=''
936 strings=''
937 i_sunmath=''
938 i_sysaccess=''
939 i_sysdir=''
940 i_sysfile=''
941 d_voidtty=''
942 i_bsdioctl=''
943 i_sysfilio=''
944 i_sysioctl=''
945 i_syssockio=''
946 i_syslog=''
947 i_sysmman=''
948 i_sysmode=''
949 i_sysmount=''
950 i_sysndir=''
951 i_sysparam=''
952 i_syspoll=''
953 i_sysresrc=''
954 i_syssecrt=''
955 i_sysselct=''
956 i_sysstat=''
957 i_sysstatfs=''
958 i_sysstatvfs=''
959 i_systimes=''
960 i_systypes=''
961 i_sysuio=''
962 i_sysun=''
963 i_sysutsname=''
964 i_sysvfs=''
965 i_syswait=''
966 i_sgtty=''
967 i_termio=''
968 i_termios=''
969 d_tm_tm_gmtoff=''
970 d_tm_tm_zone=''
971 i_systime=''
972 i_systimek=''
973 i_time=''
974 timeincl=''
975 i_unistd=''
976 i_ustat=''
977 i_utime=''
978 i_values=''
979 i_stdarg=''
980 i_varargs=''
981 i_varhdr=''
982 i_vfork=''
983 d_inc_version_list=''
984 inc_version_list=''
985 inc_version_list_init=''
986 installprefix=''
987 installprefixexp=''
988 installstyle=''
989 installusrbinperl=''
990 intsize=''
991 longsize=''
992 shortsize=''
993 issymlink=''
994 libc=''
995 ldlibpthname=''
996 libperl=''
997 shrpenv=''
998 useshrplib=''
999 glibpth=''
1000 libpth=''
1001 loclibpth=''
1002 plibpth=''
1003 xlibpth=''
1004 ignore_versioned_solibs=''
1005 libs=''
1006 libsdirs=''
1007 libsfiles=''
1008 libsfound=''
1009 libspath=''
1010 lns=''
1011 d_PRIEUldbl=''
1012 d_PRIFUldbl=''
1013 d_PRIGUldbl=''
1014 d_PRIeldbl=''
1015 d_PRIfldbl=''
1016 d_PRIgldbl=''
1017 d_SCNfldbl=''
1018 sPRIEUldbl=''
1019 sPRIFUldbl=''
1020 sPRIGUldbl=''
1021 sPRIeldbl=''
1022 sPRIfldbl=''
1023 sPRIgldbl=''
1024 sSCNfldbl=''
1025 lseeksize=''
1026 lseektype=''
1027 mad=''
1028 madlyh=''
1029 madlyobj=''
1030 madlysrc=''
1031 make_set_make=''
1032 d_mymalloc=''
1033 freetype=''
1034 mallocobj=''
1035 mallocsrc=''
1036 malloctype=''
1037 usemallocwrap=''
1038 usemymalloc=''
1039 installman1dir=''
1040 man1dir=''
1041 man1direxp=''
1042 man1ext=''
1043 installman3dir=''
1044 man3dir=''
1045 man3direxp=''
1046 man3ext=''
1047 modetype=''
1048 multiarch=''
1049 mydomain=''
1050 myhostname=''
1051 phostname=''
1052 c=''
1053 n=''
1054 d_eofnblk=''
1055 eagain=''
1056 o_nonblock=''
1057 rd_nodata=''
1058 need_va_copy=''
1059 netdb_hlen_type=''
1060 netdb_host_type=''
1061 netdb_name_type=''
1062 netdb_net_type=''
1063 groupcat=''
1064 hostcat=''
1065 passcat=''
1066 orderlib=''
1067 ranlib=''
1068 d_perl_otherlibdirs=''
1069 otherlibdirs=''
1070 package=''
1071 spackage=''
1072 pager=''
1073 api_revision=''
1074 api_subversion=''
1075 api_version=''
1076 api_versionstring=''
1077 patchlevel=''
1078 perl_patchlevel=''
1079 revision=''
1080 subversion=''
1081 version=''
1082 version_patchlevel_string=''
1083 perl5=''
1084 perladmin=''
1085 perlpath=''
1086 d_nv_preserves_uv=''
1087 d_nv_zero_is_allbits_zero=''
1088 i16size=''
1089 i16type=''
1090 i32size=''
1091 i32type=''
1092 i64size=''
1093 i64type=''
1094 i8size=''
1095 i8type=''
1096 ivsize=''
1097 ivtype=''
1098 nv_overflows_integers_at=''
1099 nv_preserves_uv_bits=''
1100 nvsize=''
1101 nvtype=''
1102 u16size=''
1103 u16type=''
1104 u32size=''
1105 u32type=''
1106 u64size=''
1107 u64type=''
1108 u8size=''
1109 u8type=''
1110 uvsize=''
1111 uvtype=''
1112 ivdformat=''
1113 nvEUformat=''
1114 nvFUformat=''
1115 nvGUformat=''
1116 nveformat=''
1117 nvfformat=''
1118 nvgformat=''
1119 uvXUformat=''
1120 uvoformat=''
1121 uvuformat=''
1122 uvxformat=''
1123 pidtype=''
1124 prefix=''
1125 prefixexp=''
1126 installprivlib=''
1127 privlib=''
1128 privlibexp=''
1129 prototype=''
1130 ptrsize=''
1131 d_PRIXU64=''
1132 d_PRId64=''
1133 d_PRIi64=''
1134 d_PRIo64=''
1135 d_PRIu64=''
1136 d_PRIx64=''
1137 sPRIXU64=''
1138 sPRId64=''
1139 sPRIi64=''
1140 sPRIo64=''
1141 sPRIu64=''
1142 sPRIx64=''
1143 d_quad=''
1144 quadkind=''
1145 quadtype=''
1146 uquadtype=''
1147 drand01=''
1148 randbits=''
1149 randfunc=''
1150 randseedtype=''
1151 seedfunc=''
1152 installscript=''
1153 scriptdir=''
1154 scriptdirexp=''
1155 selectminbits=''
1156 selecttype=''
1157 sh=''
1158 sig_count=''
1159 sig_name=''
1160 sig_name_init=''
1161 sig_num=''
1162 sig_num_init=''
1163 sig_size=''
1164 d_sitearch=''
1165 installsitearch=''
1166 sitearch=''
1167 sitearchexp=''
1168 installsitebin=''
1169 sitebin=''
1170 sitebinexp=''
1171 installsitehtml1dir=''
1172 sitehtml1dir=''
1173 sitehtml1direxp=''
1174 installsitehtml3dir=''
1175 sitehtml3dir=''
1176 sitehtml3direxp=''
1177 installsitelib=''
1178 sitelib=''
1179 sitelib_stem=''
1180 sitelibexp=''
1181 installsiteman1dir=''
1182 siteman1dir=''
1183 siteman1direxp=''
1184 installsiteman3dir=''
1185 siteman3dir=''
1186 siteman3direxp=''
1187 siteprefix=''
1188 siteprefixexp=''
1189 installsitescript=''
1190 sitescript=''
1191 sitescriptexp=''
1192 sizesize=''
1193 sizetype=''
1194 so=''
1195 socksizetype=''
1196 sharpbang=''
1197 shsharp=''
1198 spitshell=''
1199 src=''
1200 ssizetype=''
1201 st_ino_sign=''
1202 st_ino_size=''
1203 startperl=''
1204 startsh=''
1205 stdchar=''
1206 d_stdio_stream_array=''
1207 stdio_stream_array=''
1208 sysman=''
1209 sGMTIME_max=''
1210 sGMTIME_min=''
1211 sLOCALTIME_max=''
1212 sLOCALTIME_min=''
1213 trnl=''
1214 uidformat=''
1215 uidsign=''
1216 uidsize=''
1217 uidtype=''
1218 archname64=''
1219 use64bitall=''
1220 use64bitint=''
1221 dtrace=''
1222 usedtrace=''
1223 usefaststdio=''
1224 usekernprocpathname=''
1225 ccflags_uselargefiles=''
1226 ldflags_uselargefiles=''
1227 libswanted_uselargefiles=''
1228 uselargefiles=''
1229 uselongdouble=''
1230 usemorebits=''
1231 usemultiplicity=''
1232 nm_opt=''
1233 nm_so_opt=''
1234 runnm=''
1235 usenm=''
1236 usensgetexecutablepath=''
1237 useperlio=''
1238 usesocks=''
1239 d_oldpthreads=''
1240 use5005threads=''
1241 useithreads=''
1242 usereentrant=''
1243 usethreads=''
1244 incpath=''
1245 mips_type=''
1246 usrinc=''
1247 vaproto=''
1248 d_vendorarch=''
1249 installvendorarch=''
1250 vendorarch=''
1251 vendorarchexp=''
1252 d_vendorbin=''
1253 installvendorbin=''
1254 vendorbin=''
1255 vendorbinexp=''
1256 installvendorhtml1dir=''
1257 vendorhtml1dir=''
1258 vendorhtml1direxp=''
1259 installvendorhtml3dir=''
1260 vendorhtml3dir=''
1261 vendorhtml3direxp=''
1262 d_vendorlib=''
1263 installvendorlib=''
1264 vendorlib=''
1265 vendorlib_stem=''
1266 vendorlibexp=''
1267 installvendorman1dir=''
1268 vendorman1dir=''
1269 vendorman1direxp=''
1270 installvendorman3dir=''
1271 vendorman3dir=''
1272 vendorman3direxp=''
1273 usevendorprefix=''
1274 vendorprefix=''
1275 vendorprefixexp=''
1276 d_vendorscript=''
1277 installvendorscript=''
1278 vendorscript=''
1279 vendorscriptexp=''
1280 versiononly=''
1281 defvoidused=''
1282 voidflags=''
1283 yacc=''
1284 yaccflags=''
1285 CONFIG=''
1286
1287 : Detect odd OSs
1288 define='define'
1289 undef='undef'
1290 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1291 rmlist=''
1292
1293 : We must find out about Eunice early
1294 eunicefix=':'
1295 if test -f /etc/unixtovms; then
1296         eunicefix=/etc/unixtovms
1297 fi
1298 if test -f /etc/unixtovms.exe; then
1299         eunicefix=/etc/unixtovms.exe
1300 fi
1301
1302 : Set executable suffix now -- needed before hints available
1303 if test -f "/libs/version.library"; then
1304 : Amiga OS
1305     _exe=""
1306 elif test -f "/system/gnu_library/bin/ar.pm"; then
1307 : Stratus VOS
1308     _exe=".pm"
1309 elif test -n "$DJGPP"; then
1310 : DOS DJGPP
1311     _exe=".exe"
1312 elif test -d c:/. -o -n "$is_os2" ; then
1313 : OS/2 or cygwin
1314     _exe=".exe"
1315 fi
1316
1317 groupstype=''
1318 i_whoami=''
1319 : Trailing extension.  Override this in a hint file, if needed.
1320 : Extra object files, if any, needed on this platform.
1321 archobjs=''
1322 archname=''
1323 : Possible local include directories to search.
1324 : Set locincpth to "" in a hint file to defeat local include searches.
1325 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1326 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1327 :
1328 : no include file wanted by default
1329 inclwanted=''
1330
1331 : Enable -DEBUGGING and -DDEBUGGING from the command line
1332 EBUGGING=''
1333 DEBUGGING=''
1334
1335 libnames=''
1336 : change the next line if compiling for Xenix/286 on Xenix/386
1337 xlibpth='/usr/lib/386 /lib/386'
1338 : Possible local library directories to search.
1339 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1340 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1341
1342 : general looking path for locating libraries
1343 glibpth="/lib /usr/lib $xlibpth"
1344 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1345 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1346 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1347 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1348
1349 : Private path used by Configure to find libraries.  Its value
1350 : is prepended to libpth. This variable takes care of special
1351 : machines, like the mips.  Usually, it should be empty.
1352 plibpth=''
1353
1354 : default library list
1355 libswanted=''
1356 : some systems want to use only the non-versioned libso:s
1357 ignore_versioned_solibs=''
1358 : set usethreads on the Configure command line to enable threads.
1359 usereentrant='undef'
1360 : full support for void wanted by default
1361 defvoidused=15
1362
1363 ccname=''
1364 ccversion=''
1365 perllibs=''
1366 : set useposix=false in your hint file to disable the POSIX extension.
1367 useposix=true
1368 : set useopcode=false in your hint file to disable the Opcode extension.
1369 useopcode=true
1370 archname64=''
1371 ccflags_uselargefiles=''
1372 ldflags_uselargefiles=''
1373 libswanted_uselargefiles=''
1374 : set usemultiplicity on the Configure command line to enable multiplicity.
1375 : set usesocks on the Configure command line to enable socks.
1376 : List of libraries we want.
1377 : If anyone needs extra -lxxx, put those in a hint file.
1378 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1379 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1380 : We probably want to search /usr/shlib before most other libraries.
1381 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1382 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1383 glibpth="/usr/shlib $glibpth"
1384 : Do not use vfork unless overridden by a hint file.
1385 usevfork=false
1386
1387 : Find the basic shell for Bourne shell scripts
1388 case "$sh" in
1389 '')
1390         case "$SYSTYPE" in
1391         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1392         *) xxx='/bin/sh';;
1393         esac
1394         if test -f "$xxx"; then
1395                 sh="$xxx"
1396         else
1397                 : Build up a list and do a single loop so we can 'break' out.
1398                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1399                 for xxx in sh bash ksh pdksh ash; do
1400                         for p in $pth; do
1401                                 try="$try ${p}/${xxx}"
1402                         done
1403                 done
1404                 for xxx in $try; do
1405                         if test -f "$xxx"; then
1406                                 sh="$xxx";
1407                                 break
1408                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1409                                 sh="$xxx";
1410                                 break
1411                         elif test -f "$xxx.exe"; then
1412                                 sh="$xxx";
1413                                 break
1414                         fi
1415                 done
1416         fi
1417         ;;
1418 esac
1419
1420 case "$sh" in
1421 '')     cat >&2 <<EOM
1422 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1423
1424 Usually it's in /bin/sh.  How did you even get this far?
1425 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1426 we'll try to straighten this all out.
1427 EOM
1428         exit 1
1429         ;;
1430 esac
1431
1432 : see if sh knows # comments
1433 if `$sh -c '#' >/dev/null 2>&1`; then
1434         shsharp=true
1435         spitshell=cat
1436         xcat=/bin/cat
1437         test -f $xcat$_exe || xcat=/usr/bin/cat
1438         if test ! -f $xcat$_exe; then
1439                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1440                         if test -f $p/cat$_exe; then
1441                                 xcat=$p/cat
1442                                 break
1443                         fi
1444                 done
1445                 if test ! -f $xcat$_exe; then
1446                         echo "Can't find cat anywhere!"
1447                         exit 1
1448                 fi
1449         fi
1450         echo "#!$xcat" >sharp
1451         $eunicefix sharp
1452         chmod +x sharp
1453         ./sharp > today 2>/dev/null
1454         if test -s today; then
1455                 sharpbang='#!'
1456         else
1457                 echo "#! $xcat" > sharp
1458                 $eunicefix sharp
1459                 chmod +x sharp
1460                 ./sharp > today 2>/dev/null
1461                 if test -s today; then
1462                         sharpbang='#! '
1463                 else
1464                         sharpbang=': use '
1465                 fi
1466         fi
1467 else
1468         echo " "
1469         echo "Your $sh doesn't grok # comments--I will strip them later on."
1470         shsharp=false
1471         cd ..
1472         echo "exec grep -v '^[  ]*#'" >spitshell
1473         chmod +x spitshell
1474         $eunicefix spitshell
1475         spitshell=`pwd`/spitshell
1476         cd UU
1477         echo "I presume that if # doesn't work, #! won't work either!"
1478         sharpbang=': use '
1479 fi
1480 rm -f sharp today
1481
1482 : figure out how to guarantee sh startup
1483 case "$startsh" in
1484 '') startsh=${sharpbang}${sh} ;;
1485 *)
1486 esac
1487 cat >sharp <<EOSS
1488 $startsh
1489 set abc
1490 test "$?abc" != 1
1491 EOSS
1492
1493 chmod +x sharp
1494 $eunicefix sharp
1495 if ./sharp; then
1496         : echo "Yup, it does."
1497 else
1498         echo "Hmm... '$startsh' does not guarantee sh startup..."
1499         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1500 fi
1501 rm -f sharp
1502
1503 : Save command line options in file UU/cmdline.opt for later use in
1504 : generating config.sh.
1505 cat > cmdline.opt <<EOSH
1506 : Configure command line arguments.
1507 config_arg0='$0'
1508 config_args='$*'
1509 config_argc=$#
1510 EOSH
1511 argn=1
1512 args_exp=''
1513 args_sep=''
1514 for arg in "$@"; do
1515         cat >>cmdline.opt <<EOSH
1516 config_arg$argn='$arg'
1517 EOSH
1518         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1519 $arg
1520 EOC
1521         arg_exp=`cat cmdl.opt`
1522         args_exp="$args_exp$args_sep'$arg_exp'"
1523         argn=`expr $argn + 1`
1524         args_sep=' '
1525 done
1526 rm -f cmdl.opt
1527
1528 : produce awk script to parse command line options
1529 cat >options.awk <<'EOF'
1530 BEGIN {
1531         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1532
1533         len = length(optstr);
1534         for (i = 1; i <= len; i++) {
1535                 c = substr(optstr, i, 1);
1536                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1537                 if (a == ":") {
1538                         arg[c] = 1;
1539                         i++;
1540                 }
1541                 opt[c] = 1;
1542         }
1543 }
1544 {
1545         expect = 0;
1546         str = $0;
1547         if (substr(str, 1, 1) != "-") {
1548                 printf("'%s'\n", str);
1549                 next;
1550         }
1551         len = length($0);
1552         for (i = 2; i <= len; i++) {
1553                 c = substr(str, i, 1);
1554                 if (!opt[c]) {
1555                         printf("-%s\n", substr(str, i));
1556                         next;
1557                 }
1558                 printf("-%s\n", c);
1559                 if (arg[c]) {
1560                         if (i < len)
1561                                 printf("'%s'\n", substr(str, i + 1));
1562                         else
1563                                 expect = 1;
1564                         next;
1565                 }
1566         }
1567 }
1568 END {
1569         if (expect)
1570                 print "?";
1571 }
1572 EOF
1573
1574 : process the command line options
1575 set X `for arg in "$@"; do echo "X$arg"; done |
1576         sed -e s/X// | awk -f options.awk`
1577 eval "set $*"
1578 shift
1579 rm -f options.awk
1580
1581 : set up default values
1582 fastread=''
1583 reuseval=false
1584 config_sh=''
1585 alldone=''
1586 error=''
1587 silent=''
1588 extractsh=''
1589 override=''
1590 knowitall=''
1591 rm -f optdef.sh posthint.sh
1592 cat >optdef.sh <<EOS
1593 $startsh
1594 EOS
1595
1596
1597 : option parsing
1598 while test $# -gt 0; do
1599         case "$1" in
1600         -d) shift; fastread=yes;;
1601         -e) shift; alldone=cont;;
1602         -f)
1603                 shift
1604                 cd ..
1605                 if test -r "$1"; then
1606                         config_sh="$1"
1607                 else
1608                         echo "$me: cannot read config file $1." >&2
1609                         error=true
1610                 fi
1611                 cd UU
1612                 shift;;
1613         --help|\
1614         -h) shift; error=true;;
1615         -r) shift; reuseval=true;;
1616         -s) shift; silent=true; realsilent=true;;
1617         -E) shift; alldone=exit;;
1618         -K) shift; knowitall=true;;
1619         -O) shift; override=true;;
1620         -S) shift; silent=true; extractsh=true;;
1621         -D)
1622                 shift
1623                 case "$1" in
1624                 *=)
1625                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1626                         echo "$me: ignoring -D $1" >&2
1627                         ;;
1628                 *=*) echo "$1" | \
1629                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1630                 *) echo "$1='define'" >> optdef.sh;;
1631                 esac
1632                 shift
1633                 ;;
1634         -U)
1635                 shift
1636                 case "$1" in
1637                 *=) echo "$1" >> optdef.sh;;
1638                 *=*)
1639                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1640                         echo "$me: ignoring -U $1" >&2
1641                         ;;
1642                 *) echo "$1='undef'" >> optdef.sh;;
1643                 esac
1644                 shift
1645                 ;;
1646         -A)
1647             shift
1648             xxx=''
1649             yyy="$1"
1650             zzz=''
1651             uuu=undef
1652             case "$yyy" in
1653             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1654                  case "$zzz" in
1655                  *:*) zzz='' ;;
1656                  *)   xxx=append
1657                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
1658                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1659                  esac
1660                  ;;
1661             esac
1662             case "$xxx" in
1663             '')  case "$yyy" in
1664                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1665                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1666                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1667                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1668                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1669                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1670                  esac
1671                  ;;
1672             esac
1673             case "$xxx" in
1674             append)
1675                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1676             clear)
1677                 echo "$yyy=''"                  >> posthint.sh ;;
1678             define)
1679                 case "$zzz" in
1680                 '') zzz=define ;;
1681                 esac
1682                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1683             eval)
1684                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1685             prepend)
1686                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1687             undef)
1688                 case "$zzz" in
1689                 '') zzz="$uuu" ;;
1690                 esac
1691                 echo "$yyy=$zzz"                >> posthint.sh ;;
1692             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1693             esac
1694             shift
1695             ;;
1696         -V) echo "$me generated by metaconfig 3.5 PL0." >&2
1697             exit 0;;
1698         --) break;;
1699         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1700         *) break;;
1701         esac
1702 done
1703
1704 case "$error" in
1705 true)
1706         cat >&2 <<EOM
1707 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1708                  [-U symbol] [-U symbol=] [-A command:symbol...]
1709   -d : use defaults for all answers.
1710   -e : go on without questioning past the production of config.sh.
1711   -f : specify an alternate default configuration file.
1712   -h : print this help message and exit (with an error status).
1713   -r : reuse C symbols value if possible (skips costly nm extraction).
1714   -s : silent mode, only echoes questions and essential information.
1715   -D : define symbol to have some value:
1716          -D symbol         symbol gets the value 'define'
1717          -D symbol=value   symbol gets the value 'value'
1718        common used examples (see INSTALL for more info):
1719          -Duse64bitint            use 64bit integers
1720          -Duse64bitall            use 64bit integers and pointers
1721          -Dusethreads             use thread support
1722          -Dinc_version_list=none  do not include older perl trees in @INC
1723          -DEBUGGING=none          DEBUGGING options
1724          -Dcc=gcc                 choose your compiler
1725          -Dprefix=/opt/perl5      choose your destination
1726   -E : stop at the end of questions, after having produced config.sh.
1727   -K : do not use unless you know what you are doing.
1728   -O : let -D and -U override definitions from loaded configuration file.
1729   -S : perform variable substitutions on all .SH files (can mix with -f)
1730   -U : undefine symbol:
1731          -U symbol    symbol gets the value 'undef'
1732          -U symbol=   symbol gets completely empty
1733        e.g.:  -Uversiononly
1734   -A : manipulate symbol after the platform specific hints have been applied:
1735          -A append:symbol=value   append value to symbol
1736          -A symbol=value          like append:, but with a separating space
1737          -A define:symbol=value   define symbol to have value
1738          -A clear:symbol          define symbol to be ''
1739          -A define:symbol         define symbol to be 'define'
1740          -A eval:symbol=value     define symbol to be eval of value
1741          -A prepend:symbol=value  prepend value to symbol
1742          -A undef:symbol          define symbol to be 'undef'
1743          -A undef:symbol=         define symbol to be ''
1744        e.g.:  -A prepend:libswanted='cl pthread '
1745               -A ccflags=-DSOME_MACRO
1746   -V : print version number and exit (with a zero status).
1747 EOM
1748         exit 1
1749         ;;
1750 esac
1751
1752 : Sanity checks
1753 case "$fastread$alldone" in
1754 yescont|yesexit) ;;
1755 *)
1756         case "$extractsh" in
1757         true) ;;
1758         *)
1759                 if test ! -t 0; then
1760                         echo "Say 'sh Configure', not 'sh <Configure'"
1761                         exit 1
1762                 fi
1763                 ;;
1764         esac
1765         ;;
1766 esac
1767
1768 exec 4>&1
1769 case "$silent" in
1770 true) exec 1>/dev/null;;
1771 esac
1772
1773 : run the defines and the undefines, if any, but leave the file out there...
1774 touch optdef.sh
1775 . ./optdef.sh
1776 : create the posthint manipulation script and leave the file out there...
1777 touch posthint.sh
1778
1779 : set package name
1780 package='perl5'
1781 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1782 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1783 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1784 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1785 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1786 esac
1787
1788 : Some greps do not return status, grrr.
1789 echo "grimblepritz" >grimble
1790 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1791         contains=contains
1792 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1793         contains=grep
1794 else
1795         contains=contains
1796 fi
1797 rm -f grimble
1798 : the following should work in any shell
1799 case "$contains" in
1800 contains*)
1801         echo " "
1802         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1803         cat >contains <<'EOSS'
1804 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1805 EOSS
1806 chmod +x contains
1807 esac
1808
1809 : Find the path to the source tree
1810 case "$src" in
1811 '') case "$0" in
1812     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1813          case "$src" in
1814          /*)    ;;
1815          .)     ;;
1816          *)     src=`cd ../$src && pwd` ;;
1817          esac
1818          ;;
1819     *)   src='.';;
1820     esac;;
1821 esac
1822 case "$src" in
1823 '')     src=/
1824         rsrc=/
1825         ;;
1826 /*)     rsrc="$src";;
1827 *)      rsrc="../$src";;
1828 esac
1829 if test -f $rsrc/Configure && \
1830         $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
1831 then
1832    : found it, so we are ok.
1833 else
1834         rsrc=''
1835         for src in . .. ../.. ../../.. ../../../..; do
1836                 if test -f ../$src/Configure && \
1837                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1838                 then
1839                         rsrc=../$src
1840                         break
1841                 fi
1842         done
1843 fi
1844 case "$rsrc" in
1845 '')
1846         cat <<EOM >&4
1847
1848 Sorry, I can't seem to locate the source dir for $package.  Please start
1849 Configure with an explicit path -- i.e. /some/path/Configure.
1850
1851 EOM
1852         exit 1
1853         ;;
1854 ../.)   rsrc='..';;
1855 *)
1856         echo " "
1857         echo "Sources for $package found in \"$src\"." >&4
1858         ;;
1859 esac
1860
1861 : script used to extract .SH files with variable substitutions
1862 cat >extract <<'EOS'
1863 PERL_CONFIG_SH=true
1864 echo "Doing variable substitutions on .SH files..."
1865 if test -f MANIFEST; then
1866         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1867 else
1868         echo "(Looking for .SH files under the source directory.)"
1869         set x `(cd "$src"; find . -name "*.SH" -print)`
1870 fi
1871 shift
1872 case $# in
1873 0) set x `(cd "$src"; echo *.SH)`; shift;;
1874 esac
1875 if test ! -f "$src/$1"; then
1876         shift
1877 fi
1878 mkdir_p='
1879 name=$1;
1880 create="";
1881 while test $name; do
1882         if test ! -d "$name"; then
1883                 create="$name $create";
1884                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1885                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1886         else
1887                 name="";
1888         fi;
1889 done;
1890 for file in $create; do
1891         mkdir $file;
1892 done
1893 '
1894 for file in $*; do
1895         case "$src" in
1896         ".")
1897                 case "$file" in
1898                 */*)
1899                         dir=`expr X$file : 'X\(.*\)/'`
1900                         file=`expr X$file : 'X.*/\(.*\)'`
1901                         (cd "$dir" && . ./$file)
1902                         ;;
1903                 *)
1904                         . ./$file
1905                         ;;
1906                 esac
1907                 ;;
1908         *)
1909                 case "$file" in
1910                 */*)
1911                         dir=`expr X$file : 'X\(.*\)/'`
1912                         file=`expr X$file : 'X.*/\(.*\)'`
1913                         (set x $dir; shift; eval $mkdir_p)
1914                         sh <"$src/$dir/$file"
1915                         ;;
1916                 *)
1917                         sh <"$src/$file"
1918                         ;;
1919                 esac
1920                 ;;
1921         esac
1922 done
1923 if test -f "$src/config_h.SH"; then
1924         if test ! -f config.h; then
1925         : oops, they left it out of MANIFEST, probably, so do it anyway.
1926         . "$src/config_h.SH"
1927         fi
1928 fi
1929 EOS
1930
1931 : extract files and exit if asked to do so
1932 case "$extractsh" in
1933 true)
1934         case "$realsilent" in
1935         true) ;;
1936         *) exec 1>&4;;
1937         esac
1938         case "$config_sh" in
1939         '') config_sh='config.sh';;
1940         esac
1941         echo " "
1942         echo "Fetching answers from $config_sh..."
1943         cd ..
1944         . $config_sh
1945         test "$override" && . ./optdef.sh
1946         echo " "
1947         . UU/extract
1948         rm -rf UU
1949         echo "Extraction done."
1950         exit 0
1951         ;;
1952 esac
1953
1954 : Eunice requires " " instead of "", can you believe it
1955 echo " "
1956 : Here we go...
1957 echo "Beginning of configuration questions for $package."
1958
1959 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1960
1961 : first determine how to suppress newline on echo command
1962 echo " "
1963 echo "Checking echo to see how to suppress newlines..."
1964 (echo "hi there\c" ; echo " ") >.echotmp
1965 if $contains c .echotmp >/dev/null 2>&1 ; then
1966         echo "...using -n."
1967         n='-n'
1968         c=''
1969 else
1970         cat <<'EOM'
1971 ...using \c
1972 EOM
1973         n=''
1974         c='\c'
1975 fi
1976 echo $n "The star should be here-->$c"
1977 echo '*'
1978 rm -f .echotmp
1979
1980 : Now test for existence of everything in MANIFEST
1981 echo " "
1982 if test -f "$rsrc/MANIFEST"; then
1983         echo "First let's make sure your kit is complete.  Checking..." >&4
1984         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1985                 (split -l 50 2>/dev/null || split -50)
1986         rm -f missing
1987         tmppwd=`pwd`
1988         for filelist in x??; do
1989                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1990                         >/dev/null 2>>"$tmppwd/missing")
1991         done
1992         if test -s missing; then
1993                 cat missing >&4
1994                 cat >&4 <<'EOM'
1995
1996 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1997
1998 You have the option of continuing the configuration process, despite the
1999 distinct possibility that your kit is damaged, by typing 'y'es.  If you
2000 do, don't blame me if something goes wrong.  I advise you to type 'n'o
2001 and contact the author (perlbug@perl.org).
2002
2003 EOM
2004                 echo $n "Continue? [n] $c" >&4
2005                 read ans
2006                 case "$ans" in
2007                 y*)
2008                         echo "Continuing..." >&4
2009                         rm -f missing
2010                         ;;
2011                 *)
2012                         echo "ABORTING..." >&4
2013                         kill $$
2014                         ;;
2015                 esac
2016         else
2017                 echo "Looks good..."
2018         fi
2019 else
2020         echo "There is no MANIFEST file.  I hope your kit is complete !"
2021 fi
2022 rm -f missing x??
2023
2024 : Find the appropriate value for a newline for tr
2025 echo " "
2026 if test -n "$DJGPP"; then
2027        trnl='\012'
2028 fi
2029 if test X"$trnl" = X; then
2030         case "`echo foo|tr '\n' x 2>/dev/null`" in
2031         foox) trnl='\n' ;;
2032         esac
2033 fi
2034 if test X"$trnl" = X; then
2035         case "`echo foo|tr '\012' x 2>/dev/null`" in
2036         foox) trnl='\012' ;;
2037         esac
2038 fi
2039 if test X"$trnl" = X; then
2040        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
2041        fooxy) trnl='\n\r' ;;
2042        esac
2043 fi
2044 if test X"$trnl" = X; then
2045         cat <<EOM >&2
2046
2047 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2048
2049 EOM
2050         exit 1
2051 fi
2052
2053 : compute the number of columns on the terminal for proper question formatting
2054 case "$COLUMNS" in
2055 '') COLUMNS='80';;
2056 esac
2057
2058 : set up the echo used in my read
2059 myecho="case \"\$xxxm\" in
2060 '') echo $n \"\$rp $c\" >&4;;
2061 *) case \"\$rp\" in
2062         '') echo $n \"[\$xxxm] $c\";;
2063         *)
2064                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2065                         echo \"\$rp\" >&4
2066                         echo $n \"[\$xxxm] $c\" >&4
2067                 else
2068                         echo $n \"\$rp [\$xxxm] $c\" >&4
2069                 fi
2070                 ;;
2071         esac;;
2072 esac"
2073
2074 : now set up to do reads with possible shell escape and default assignment
2075 cat <<EOSC >myread
2076 $startsh
2077 xxxm=\$dflt
2078 $myecho
2079 ans='!'
2080 case "\$fastread" in
2081 yes) case "\$dflt" in
2082         '') ;;
2083         *) ans='';
2084                 case "\$silent-\$rp" in
2085                 true-) ;;
2086                 *) echo " " >&4;;
2087                 esac;;
2088         esac;;
2089 *) case "\$silent" in
2090         true) case "\$rp" in
2091                 '') ans='';;
2092                 esac;;
2093         esac;;
2094 esac
2095 while expr "X\$ans" : "X!" >/dev/null; do
2096         read answ
2097         set x \$xxxm
2098         shift
2099         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2100         case  "\$answ" in
2101         "!")
2102                 sh 1>&4
2103                 echo " "
2104                 $myecho
2105                 ;;
2106         !*)
2107                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2108                 shift
2109                 sh 1>&4 -c "\$*"
2110                 echo " "
2111                 $myecho
2112                 ;;
2113         "\$ans")
2114                 case "\$ans" in
2115                 \\&*)
2116                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2117                         shift
2118                         case "\$1" in
2119                         -d)
2120                                 fastread=yes
2121                                 echo "(OK, I'll run with -d after this question.)" >&4
2122                                 ;;
2123                         -*)
2124                                 echo "*** Sorry, \$1 not supported yet." >&4
2125                                 ;;
2126                         esac
2127                         $myecho
2128                         ans=!
2129                         ;;
2130                 esac;;
2131         *)
2132                 case "\$aok" in
2133                 y)
2134                         echo "*** Substitution done -- please confirm."
2135                         xxxm="\$ans"
2136                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2137                         xxxm="\$ans"
2138                         ans=!
2139                         ;;
2140                 *)
2141                         echo "*** Error -- try again."
2142                         ans=!
2143                         ;;
2144                 esac
2145                 $myecho
2146                 ;;
2147         esac
2148         case "\$ans\$xxxm\$nostick" in
2149         '')
2150                 ans=!
2151                 $myecho
2152                 ;;
2153         esac
2154 done
2155 case "\$ans" in
2156 '') ans="\$xxxm";;
2157 esac
2158 EOSC
2159
2160 : create .config dir to save info across Configure sessions
2161 test -d ../.config || mkdir ../.config
2162 cat >../.config/README <<EOF
2163 This directory created by Configure to save information that should
2164 persist across sessions for $package.
2165
2166 You may safely delete it if you wish.
2167 EOF
2168
2169 : See if we are using a devel version and want that
2170 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2171 case "$usedevel" in
2172 $define|true|[yY]*)
2173     usedevel="$define" ;;
2174 *) case "$xversion" in
2175    *[13579])
2176         cat >&4 <<EOH
2177 *** WHOA THERE!!! ***
2178
2179     This is an UNSTABLE DEVELOPMENT release.
2180     The version of this $package distribution is $xversion, that is, odd,
2181     (as opposed to even) and that signifies a development release.
2182     If you want a maintenance release, you want an even-numbered version.
2183
2184     Do ***NOT*** install this into production use.
2185     Data corruption and crashes are possible.
2186
2187     It is most seriously suggested that you do not continue any further
2188     unless you want to help in developing and debugging Perl.
2189
2190     If you *still* want to build perl, you can answer 'y' now,
2191     or pass -Dusedevel to Configure.
2192
2193 EOH
2194         rp='Do you really want to continue?'
2195         dflt='n'
2196         . ./myread
2197         case "$ans" in
2198         [yY]) echo >&4 "Okay, continuing."
2199               usedevel="$define" ;;
2200         *) echo >&4 "Okay, bye."
2201            exit 1
2202            ;;
2203         esac
2204         ;;
2205     esac
2206     usedevel="$undef"
2207     ;;
2208 esac
2209 case "$usedevel" in
2210 $define|true|[yY]*)
2211         case "$versiononly" in
2212         '') versiononly="$define" ;;
2213         esac
2214         case "$installusrbinperl" in
2215         '') installusrbinperl="$undef" ;;
2216         esac
2217         ;;
2218 esac
2219
2220 : general instructions
2221 needman=true
2222 firsttime=true
2223 user=`(logname) 2>/dev/null`
2224 case "$user" in
2225 '') user=`whoami 2>&1`;;
2226 esac
2227 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2228         firsttime=false
2229         echo " "
2230         rp='Would you like to see the instructions?'
2231         dflt=n
2232         . ./myread
2233         case "$ans" in
2234         [yY]*) ;;
2235         *) needman=false;;
2236         esac
2237 fi
2238 if $needman; then
2239         cat <<EOH
2240
2241 This installation shell script will examine your system and ask you questions
2242 to determine how the perl5 package should be installed. If you get
2243 stuck on a question, you may use a ! shell escape to start a subshell or
2244 execute a command.  Many of the questions will have default answers in square
2245 brackets; typing carriage return will give you the default.
2246
2247 On some of the questions which ask for file or directory names you are allowed
2248 to use the ~name construct to specify the login directory belonging to "name",
2249 even if you don't have a shell which knows about that.  Questions where this is
2250 allowed will be marked "(~name ok)".
2251
2252 EOH
2253         rp=''
2254         dflt='Type carriage return to continue'
2255         . ./myread
2256         cat <<'EOH'
2257
2258 The prompter used in this script allows you to use shell variables and
2259 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2260 in the default answer, as if the default line was a set of arguments given to a
2261 script shell.  This means you may also use $* to repeat the whole default line,
2262 so you do not have to re-type everything to add something to the default.
2263
2264 Every time there is a substitution, you will have to confirm.  If there is an
2265 error (e.g. an unmatched backtick), the default answer will remain unchanged
2266 and you will be prompted again.
2267
2268 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2269 the questions and use the computed defaults (or the previous answers if there
2270 was already a config.sh file). Type 'Configure -h' for a list of options.
2271 You may also start interactively and then answer '& -d' at any prompt to turn
2272 on the non-interactive behaviour for the remainder of the execution.
2273
2274 EOH
2275         . ./myread
2276         cat <<EOH
2277
2278 Much effort has been expended to ensure that this shell script will run on any
2279 Unix system.  If despite that it blows up on yours, your best bet is to edit
2280 Configure and run it again.  If you can't run Configure for some reason,
2281 you'll have to generate a config.sh file by hand.  Whatever problems you
2282 have, let me (perlbug@perl.org) know how I blew it.
2283
2284 This installation script affects things in two ways:
2285
2286 1) it may do direct variable substitutions on some of the files included
2287    in this kit.
2288 2) it builds a config.h file for inclusion in C programs.  You may edit
2289    any of these files as the need arises after running this script.
2290
2291 If you make a mistake on a question, there is no easy way to back up to it
2292 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2293 files.  Configure will offer to let you do this before it runs the SH files.
2294
2295 EOH
2296         dflt='Type carriage return to continue'
2297         . ./myread
2298         case "$firsttime" in
2299         true) echo $user >>../.config/instruct;;
2300         esac
2301 fi
2302
2303 : find out where common programs are
2304 echo " "
2305 echo "Locating common programs..." >&4
2306 cat <<EOSC >loc
2307 $startsh
2308 case \$# in
2309 0) exit 1;;
2310 esac
2311 thing=\$1
2312 shift
2313 dflt=\$1
2314 shift
2315 for dir in \$*; do
2316         case "\$thing" in
2317         .)
2318         if test -d \$dir/\$thing; then
2319                 echo \$dir
2320                 exit 0
2321         fi
2322         ;;
2323         *)
2324         for thisthing in \$dir/\$thing; do
2325                 : just loop through to pick last item
2326         done
2327         if test -f \$thisthing; then
2328                 echo \$thisthing
2329                 exit 0
2330         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2331                 echo \$thisthing
2332                 exit 0
2333         elif test -f \$dir/\$thing.exe; then
2334                 if test -n "$DJGPP"; then
2335                         echo \$dir/\$thing.exe
2336                 elif test "$eunicefix" != ":"; then
2337                         : on Eunice apparently
2338                         echo \$dir/\$thing
2339                 fi
2340                 exit 0
2341         fi
2342         ;;
2343         esac
2344 done
2345 echo \$dflt
2346 exit 1
2347 EOSC
2348 chmod +x loc
2349 $eunicefix loc
2350 loclist="
2351 awk
2352 cat
2353 chmod
2354 comm
2355 cp
2356 echo
2357 expr
2358 grep
2359 ls
2360 mkdir
2361 rm
2362 sed
2363 sort
2364 touch
2365 tr
2366 uniq
2367 "
2368 trylist="
2369 ar
2370 bison
2371 byacc
2372 cpp
2373 csh
2374 date
2375 egrep
2376 gmake
2377 gzip
2378 less
2379 ln
2380 make
2381 more
2382 nm
2383 nroff
2384 perl
2385 pg
2386 test
2387 uname
2388 zip
2389 "
2390 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2391 pth="$pth /lib /usr/lib"
2392 for file in $loclist; do
2393         eval xxx=\$$file
2394         case "$xxx" in
2395         /*|?:[\\/]*)
2396                 if test -f "$xxx"; then
2397                         : ok
2398                 else
2399                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2400                         xxx=`./loc $file $file $pth`
2401                 fi
2402                 ;;
2403         '') xxx=`./loc $file $file $pth`;;
2404         *) xxx=`./loc $xxx $xxx $pth`;;
2405         esac
2406         eval $file=$xxx$_exe
2407         eval _$file=$xxx
2408         case "$xxx" in
2409         /*)
2410                 echo $file is in $xxx.
2411                 ;;
2412         ?:[\\/]*)
2413                 echo $file is in $xxx.
2414                 ;;
2415         *)
2416                 echo "I don't know where '$file' is, and my life depends on it." >&4
2417                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2418                 exit 1
2419                 ;;
2420         esac
2421 done
2422 echo " "
2423 echo "Don't worry if any of the following aren't found..."
2424 say=offhand
2425 for file in $trylist; do
2426         eval xxx=\$$file
2427         case "$xxx" in
2428         /*|?:[\\/]*)
2429                 if test -f "$xxx"; then
2430                         : ok
2431                 else
2432                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2433                         xxx=`./loc $file $file $pth`
2434                 fi
2435                 ;;
2436         '') xxx=`./loc $file $file $pth`;;
2437         *) xxx=`./loc $xxx $xxx $pth`;;
2438         esac
2439         eval $file=$xxx$_exe
2440         eval _$file=$xxx
2441         case "$xxx" in
2442         /*)
2443                 echo $file is in $xxx.
2444                 ;;
2445         ?:[\\/]*)
2446                 echo $file is in $xxx.
2447                 ;;
2448         *)
2449                 echo "I don't see $file out there, $say."
2450                 say=either
2451                 ;;
2452         esac
2453 done
2454 case "$egrep" in
2455 egrep)
2456         echo "Substituting grep for egrep."
2457         egrep=$grep
2458         _egrep=$grep
2459         ;;
2460 esac
2461 case "$less" in
2462 '')     ;;
2463 *)      if $less -R </dev/null >/dev/null; then
2464                echo "Substituting less -R for less."
2465                less="$less -R"
2466                _less=$less
2467         fi
2468         ;;
2469 esac
2470 case "$ln" in
2471 ln)
2472         echo "Substituting cp for ln."
2473         ln=$cp
2474         _ln=$cp
2475         ;;
2476 esac
2477 case "$make" in
2478 make)
2479         case "$gmake" in
2480         gmake)
2481         echo "I can't find make or gmake, and my life depends on it." >&4
2482         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2483         exit 1
2484         ;;
2485         esac
2486         ;;
2487 esac
2488 case "$gmake" in
2489 gmake)  ;;
2490 *)      # We can't have osname yet.
2491         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2492                 # Assume that gmake, if found, is definitely GNU make
2493                 # and prefer it over the system make.
2494                 echo "Substituting gmake for make."
2495                 make=$gmake
2496                 _make=$gmake
2497         fi
2498         ;;
2499 esac
2500 case "$test" in
2501 test)
2502         echo "Hopefully test is built into your sh."
2503         ;;
2504 *)
2505         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2506                 echo "Using the test built into your sh."
2507                 test=test
2508                 _test=test
2509         fi
2510         ;;
2511 esac
2512 case "$echo" in
2513 echo)
2514         echo "Hopefully echo is built into your sh."
2515         ;;
2516 '') ;;
2517 *)
2518         echo " "
2519 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2520         $echo $n "hi there$c" >foo1
2521         echo $n "hi there$c" >foo2
2522         if cmp foo1 foo2 >/dev/null 2>&1; then
2523                 echo "They are compatible.  In fact, they may be identical."
2524         else
2525                 case "$n" in
2526                 '-n') n='' c='\c';;
2527                 *) n='-n' c='';;
2528                 esac
2529                 cat <<FOO
2530 They are not compatible!  You are probably running ksh on a non-USG system.
2531 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2532 have echo built in and we may have to run some Bourne shell scripts.  That
2533 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2534
2535 FOO
2536                 $echo $n "The star should be here-->$c"
2537                 $echo "*"
2538         fi
2539         $rm -f foo1 foo2
2540         ;;
2541 esac
2542
2543 # This question was auctioned at YAPC::Europe-2007 in Vienna
2544 # I never promised you could answer it. I only auctioned the question.
2545 cat <<FOO
2546 The following message is sponsored by
2547
2548   Dresden.pm<--The stars should be here.
2549
2550 Dear Perl user, system administrator or package
2551 maintainer, the Perl community sends greetings to
2552 you. Do you (emblematical) greet back [Y/n]? n
2553
2554 FOO
2555
2556 : Check what type of C compiler we use
2557 cat <<EOS >trygcc
2558 $startsh
2559 EOS
2560 cat <<'EOSC' >>trygcc
2561 case "$cc" in
2562 '') ;;
2563 *)  $rm -f try try.*
2564     $cat >try.c <<EOM
2565 int main(int argc, char *argv[]) {
2566   return 0;
2567 }
2568 EOM
2569     if $cc -o try $ccflags $ldflags try.c; then
2570        :
2571     else
2572         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2573         despair=yes
2574         trygcc=yes
2575         case "$cc" in
2576         *gcc*) trygcc=no ;;
2577         esac
2578         # Skip this test because it gives a false match on output like:
2579         #    ./trygcc: line 23: cc: command not found
2580         # case "`$cc -v -c try.c 2>&1`" in
2581         # *gcc*) trygcc=no ;;
2582         # esac
2583         if $test X"$trygcc" = Xyes; then
2584             if gcc -o try -c try.c; then
2585                 echo " "
2586                 echo "You seem to have a working gcc, though." >&4
2587                 # Switching compilers may undo the work of hints files.
2588                 # The most common problem is -D_REENTRANT for threads.
2589                 # This heuristic catches that case, but gets false positives
2590                 # if -Dusethreads was not actually specified.  Better to
2591                 # bail out here with a useful message than fail 
2592                 # mysteriously later. Should we perhaps just try to
2593                 # re-invoke Configure -Dcc=gcc config_args ?
2594                 if $test -f usethreads.cbu; then
2595                         $cat >&4 <<EOM 
2596
2597 *** However, any setting of the C compiler flags (e.g. for thread support)
2598 *** will be lost.  It may be necessary for you to restart Configure and
2599 *** add -Dcc=gcc to your Configure command line.
2600
2601 EOM
2602                         rp="Would you like to go ahead and try gcc anyway?"
2603                         dflt=n
2604                 else
2605                         rp="Would you like to use it?"
2606                         dflt=y
2607                 fi
2608                 if $test -f myread; then
2609                     . ./myread
2610                 else
2611                     if $test -f UU/myread; then
2612                         . ./UU/myread
2613                     else
2614                         echo "Cannot find myread, sorry.  Aborting." >&2
2615                         exit 1
2616                     fi
2617                 fi  
2618                 case "$ans" in
2619                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2620                 esac
2621             fi
2622         fi
2623     fi
2624     $rm -f try try.*
2625     ;;
2626 esac
2627 EOSC
2628
2629 cat <<EOS >checkcc
2630 $startsh
2631 EOS
2632 cat <<'EOSC' >>checkcc
2633 case "$cc" in        
2634 '') ;;
2635 *)  $rm -f try try.*              
2636     $cat >try.c <<EOM
2637 int main(int argc, char *argv[]) {
2638   return 0;
2639 }
2640 EOM
2641     if $cc -o try $ccflags $ldflags try.c; then
2642        :
2643     else
2644         if $test X"$despair" = Xyes; then
2645            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2646         fi
2647         $cat >&4 <<EOM         
2648 You need to find a working C compiler.
2649 Either (purchase and) install the C compiler supplied by your OS vendor,
2650 or for a free C compiler try http://gcc.gnu.org/
2651 I cannot continue any further, aborting.
2652 EOM
2653         exit 1
2654     fi
2655     $rm -f try try.*
2656     ;;
2657 esac
2658 EOSC
2659
2660 : determine whether symbolic links are supported
2661 echo " "
2662 $touch blurfl
2663 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2664         echo "Symbolic links are supported." >&4
2665         lns="$ln -s"
2666 else
2667         echo "Symbolic links are NOT supported." >&4
2668         lns="$ln"
2669 fi
2670 $rm -f blurfl sym
2671
2672 : determine whether symbolic links are supported
2673 echo " "
2674 case "$lns" in
2675 *"ln"*" -s")
2676         echo "Checking how to test for symbolic links..." >&4
2677         $lns blurfl sym
2678         if $test "X$issymlink" = X; then
2679                 case "$newsh" in
2680                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2681                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2682                 esac
2683                 if test $? = 0; then
2684                         issymlink="test -h"
2685                 else
2686                         echo "Your builtin 'test -h' may be broken." >&4
2687                         case "$test" in
2688                         /*)     ;;
2689                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2690                                 for p in $pth
2691                                 do
2692                                         if test -f "$p/$test"; then
2693                                                 test="$p/$test"
2694                                                 break
2695                                         fi
2696                                 done
2697                                 ;;
2698                         esac
2699                         case "$test" in
2700                         /*)
2701                                 echo "Trying external '$test -h'." >&4
2702                                 issymlink="$test -h"
2703                                 if $test ! -h sym >/dev/null 2>&1; then
2704                                         echo "External '$test -h' is broken, too." >&4
2705                                         issymlink=''
2706                                 fi
2707                                 ;;
2708                         *)      issymlink='' ;;
2709                         esac
2710                 fi              
2711         fi
2712         if $test "X$issymlink" = X; then
2713                 if $test -L sym 2>/dev/null; then
2714                         issymlink="$test -L"
2715                         echo "The builtin '$test -L' worked." >&4
2716                 fi
2717         fi
2718         if $test "X$issymlink" != X; then
2719                 echo "You can test for symbolic links with '$issymlink'." >&4
2720         else
2721                 echo "I do not know how you can test for symbolic links." >&4
2722         fi
2723         $rm -f blurfl sym
2724         ;;
2725 *)      echo "No symbolic links, so not testing for their testing..." >&4
2726         ;;
2727 esac
2728 echo " "
2729
2730 : Make symlinks util
2731 case "$mksymlinks" in
2732 $define|true|[yY]*)
2733         case "$src" in
2734         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2735                 exit 1
2736                 ;;
2737         *)      case "$lns:$issymlink" in
2738                 *"ln"*" -s:"*"test -"?)
2739                         echo "Creating the symbolic links..." >&4
2740                         echo "(First creating the subdirectories...)" >&4
2741                         cd ..
2742                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2743                                 read directory
2744                                 test -z "$directory" && break
2745                                 mkdir -p $directory
2746                         done
2747                         # Sanity check 1.
2748                         if test ! -d t/base; then
2749                                 echo "Failed to create the subdirectories.  Aborting." >&4
2750                                 exit 1
2751                         fi
2752                         echo "(Then creating the symlinks...)" >&4
2753                         awk '{print $1}' $src/MANIFEST | while true; do
2754                                 read filename
2755                                 test -z "$filename" && break
2756                                 if test -f $filename; then
2757                                         if $issymlink $filename; then
2758                                                 rm -f $filename
2759                                         fi
2760                                 fi
2761                                 if test -f $filename; then
2762                                         echo "$filename already exists, not symlinking."
2763                                 else
2764                                         ln -s $src/$filename $filename
2765                                 fi
2766                         done
2767                         # Sanity check 2.
2768                         if test ! -f t/base/lex.t; then
2769                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2770                                 exit 1
2771                         fi
2772                         cd UU
2773                         ;;
2774                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2775                         ;;
2776                 esac
2777                 ;;
2778         esac
2779         ;;
2780 esac
2781
2782 : Check for Cross-Compilation
2783 case "$usecrosscompile" in
2784 $define|true|[yY]*)
2785         $echo "Cross-compiling..."
2786         croak=''
2787         case "$cc" in
2788         *-*-gcc) # A cross-compiling gcc, probably.
2789             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2790             ar=$targetarch-ar
2791             # leave out ld, choosing it is more complex
2792             nm=$targetarch-nm
2793             ranlib=$targetarch-ranlib
2794             $echo 'extern int foo;' > try.c
2795             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2796             shift
2797             if $test $# -gt 0; then
2798                 incpth="$incpth $*"
2799                 incpth="`$echo $incpth|$sed 's/^ //'`"
2800                 echo "Guessing incpth '$incpth'." >&4
2801                 for i in $*; do
2802                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2803                     if $test -d $j; then
2804                         libpth="$libpth $j"
2805                     fi
2806                 done   
2807                 libpth="`$echo $libpth|$sed 's/^ //'`"
2808                 echo "Guessing libpth '$libpth'." >&4
2809             fi
2810             $rm -f try.c
2811             ;;
2812         esac
2813         case "$targetarch" in
2814         '') echo "Targetarch not defined." >&4; croak=y ;;
2815         *)  echo "Using targetarch $targetarch." >&4 ;;
2816         esac
2817         case "$incpth" in
2818         '') echo "Incpth not defined." >&4; croak=y ;;
2819         *)  echo "Using incpth '$incpth'." >&4 ;;
2820         esac
2821         case "$libpth" in
2822         '') echo "Libpth not defined." >&4; croak=y ;;
2823         *)  echo "Using libpth '$libpth'." >&4 ;;
2824         esac
2825         case "$usrinc" in
2826         '') for i in $incpth; do
2827                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2828                     usrinc=$i
2829                     echo "Guessing usrinc $usrinc." >&4
2830                     break
2831                 fi
2832             done
2833             case "$usrinc" in
2834             '') echo "Usrinc not defined." >&4; croak=y ;;
2835             esac
2836             ;;
2837         *)  echo "Using usrinc $usrinc." >&4 ;;
2838         esac
2839         case "$targethost" in
2840         '') echo "Targethost not defined." >&4; croak=y ;;
2841         *)  echo "Using targethost $targethost." >&4
2842         esac
2843         locincpth=' '
2844         loclibpth=' '
2845         case "$croak" in
2846         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2847         esac
2848         case "$src" in
2849         /*) run=$src/Cross/run
2850             targetmkdir=$src/Cross/mkdir
2851             to=$src/Cross/to
2852             from=$src/Cross/from
2853             ;;
2854         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2855             run=$pwd/Cross/run
2856             targetmkdir=$pwd/Cross/mkdir
2857             to=$pwd/Cross/to
2858             from=$pwd/Cross/from
2859             ;;
2860         esac
2861         case "$targetrun" in
2862         '') targetrun=ssh ;;
2863         esac
2864         case "$targetto" in
2865         '') targetto=scp ;;
2866         esac
2867         case "$targetfrom" in
2868         '') targetfrom=scp ;;
2869         esac
2870         run=$run-$targetrun
2871         to=$to-$targetto
2872         from=$from-$targetfrom
2873         case "$targetdir" in
2874         '')  targetdir=/tmp
2875              echo "Guessing targetdir $targetdir." >&4
2876              ;;
2877         esac
2878         case "$targetuser" in
2879         '')  targetuser=root
2880              echo "Guessing targetuser $targetuser." >&4
2881              ;;
2882         esac
2883         case "$targetfrom" in
2884         scp)    q=-q ;;
2885         *)      q='' ;;
2886         esac
2887         case "$targetrun" in
2888         ssh|rsh)
2889             cat >$run <<EOF
2890 #!/bin/sh
2891 case "\$1" in
2892 -cwd)
2893   shift
2894   cwd=\$1
2895   shift
2896   ;;
2897 esac
2898 case "\$cwd" in
2899 '') cwd=$targetdir ;;
2900 esac
2901 exe=\$1
2902 shift
2903 if $test ! -f \$exe.xok; then
2904   $to \$exe
2905   $touch \$exe.xok
2906 fi
2907 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2908 EOF
2909             ;;
2910         *)  echo "Unknown targetrun '$targetrun'" >&4
2911             exit 1
2912             ;;
2913         esac
2914         case "$targetmkdir" in
2915         */Cross/mkdir)
2916             cat >$targetmkdir <<EOF
2917 #!/bin/sh
2918 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2919 EOF
2920             $chmod a+rx $targetmkdir
2921             ;;
2922         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2923             exit 1
2924             ;;
2925         esac
2926         case "$targetto" in
2927         scp|rcp)
2928             cat >$to <<EOF
2929 #!/bin/sh
2930 for f in \$@
2931 do
2932   case "\$f" in
2933   /*)
2934     $targetmkdir \`dirname \$f\`
2935     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2936     ;;
2937   *)
2938     $targetmkdir $targetdir/\`dirname \$f\`
2939     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2940     ;;
2941   esac
2942 done
2943 exit 0
2944 EOF
2945             ;;
2946         cp) cat >$to <<EOF
2947 #!/bin/sh
2948 for f in \$@
2949 do
2950   case "\$f" in
2951   /*)
2952     $mkdir -p $targetdir/\`dirname \$f\`
2953     $cp \$f $targetdir/\$f || exit 1
2954     ;;
2955   *)
2956     $targetmkdir $targetdir/\`dirname \$f\`
2957     $cp \$f $targetdir/\$f || exit 1
2958     ;;
2959   esac
2960 done
2961 exit 0
2962 EOF
2963             ;;
2964         *)  echo "Unknown targetto '$targetto'" >&4
2965             exit 1
2966             ;;
2967         esac
2968         case "$targetfrom" in
2969         scp|rcp)
2970           cat >$from <<EOF
2971 #!/bin/sh
2972 for f in \$@
2973 do
2974   $rm -f \$f
2975   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2976 done
2977 exit 0
2978 EOF
2979             ;;
2980         cp) cat >$from <<EOF
2981 #!/bin/sh
2982 for f in \$@
2983 do
2984   $rm -f \$f
2985   cp $targetdir/\$f . || exit 1
2986 done
2987 exit 0
2988 EOF
2989             ;;
2990         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2991             exit 1
2992             ;;
2993         esac
2994         if $test ! -f $run; then
2995             echo "Target 'run' script '$run' not found." >&4
2996         else
2997             $chmod a+rx $run
2998         fi
2999         if $test ! -f $to; then
3000             echo "Target 'to' script '$to' not found." >&4
3001         else
3002             $chmod a+rx $to
3003         fi
3004         if $test ! -f $from; then
3005             echo "Target 'from' script '$from' not found." >&4
3006         else
3007             $chmod a+rx $from
3008         fi
3009         if $test ! -f $run -o ! -f $to -o ! -f $from; then
3010             exit 1
3011         fi
3012         cat >&4 <<EOF
3013 Using '$run' for remote execution,
3014 and '$from' and '$to'
3015 for remote file transfer.
3016 EOF
3017         ;;
3018 *)      run=''
3019         to=:
3020         from=:
3021         usecrosscompile='undef'
3022         targetarch=''
3023         ;;
3024 esac
3025
3026 : see whether [:lower:] and [:upper:] are supported character classes
3027 echo " "
3028 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
3029 ABYZ)
3030         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
3031         up='[:upper:]'
3032         low='[:lower:]'
3033         ;;
3034 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
3035         # (0xd9 and 0xe2), therefore that is a nice testing point.
3036         if test "X$up" = X -o "X$low" = X; then
3037             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
3038             rs) up='[A-Z]'
3039                 low='[a-z]'
3040                 ;;
3041             esac
3042         fi
3043         if test "X$up" = X -o "X$low" = X; then
3044             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
3045             rs) up='A-Z'
3046                 low='a-z'
3047                 ;;
3048             esac
3049         fi
3050         if test "X$up" = X -o "X$low" = X; then
3051             case "`echo RS | od -x 2>/dev/null`" in
3052             *D9E2*|*d9e2*)
3053                 echo "Hey, this might be EBCDIC." >&4
3054                 if test "X$up" = X -o "X$low" = X; then
3055                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
3056                     rs) up='[A-IJ-RS-Z]'
3057                         low='[a-ij-rs-z]'
3058                         ;;
3059                     esac
3060                 fi
3061                 if test "X$up" = X -o "X$low" = X; then
3062                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
3063                     rs) up='A-IJ-RS-Z'
3064                         low='a-ij-rs-z'
3065                         ;;
3066                     esac
3067                 fi
3068                 ;;
3069             esac
3070         fi
3071 esac
3072 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3073 rs)
3074     echo "Using $up and $low to convert case." >&4
3075     ;;
3076 *)
3077     echo "I don't know how to translate letters from upper to lower case." >&4
3078     echo "Your tr is not acting any way I know of." >&4
3079     exit 1
3080     ;;
3081 esac
3082 : set up the translation script tr, must be called with ./tr of course
3083 cat >tr <<EOSC
3084 $startsh
3085 case "\$1\$2" in
3086 '[A-Z][a-z]') exec $tr '$up' '$low';;
3087 '[a-z][A-Z]') exec $tr '$low' '$up';;
3088 esac
3089 exec $tr "\$@"
3090 EOSC
3091 chmod +x tr
3092 $eunicefix tr
3093
3094 : Try to determine whether config.sh was made on this system
3095 case "$config_sh" in
3096 '')
3097 myuname=`$uname -a 2>/dev/null`
3098 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3099 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3100 # because the A-Z/a-z are not consecutive.
3101 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3102         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3103 newmyuname="$myuname"
3104 dflt=n
3105 case "$knowitall" in
3106 '')
3107         if test -f ../config.sh; then
3108                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3109                         eval "`grep myuname= ../config.sh`"
3110                 fi
3111                 if test "X$myuname" = "X$newmyuname"; then
3112                         dflt=y
3113                 fi
3114         fi
3115         ;;
3116 *) dflt=y;;
3117 esac
3118
3119 : Get old answers from old config file if Configure was run on the
3120 : same system, otherwise use the hints.
3121 hint=default
3122 cd ..
3123 if test -f config.sh; then
3124         echo " "
3125         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3126         . UU/myread
3127         case "$ans" in
3128         n*|N*) echo "OK, I'll ignore it."
3129                 mv config.sh config.sh.old
3130                 myuname="$newmyuname"
3131                 ;;
3132         *)  echo "Fetching default answers from your old config.sh file..." >&4
3133                 tmp_n="$n"
3134                 tmp_c="$c"
3135                 tmp_sh="$sh"
3136                 . ./config.sh
3137                 cp config.sh UU
3138                 n="$tmp_n"
3139                 c="$tmp_c"
3140                 : Older versions did not always set $sh.  Catch re-use of such
3141                 : an old config.sh.
3142                 case "$sh" in
3143                 '') sh="$tmp_sh" ;;
3144                 esac
3145                 hint=previous
3146                 ;;
3147         esac
3148 fi
3149 . ./UU/checkcc
3150 if test ! -f config.sh; then
3151         $cat <<EOM
3152
3153 First time through, eh?  I have some defaults handy for some systems
3154 that need some extra help getting the Configure answers right:
3155
3156 EOM
3157         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3158         dflt=''
3159         : Half the following guesses are probably wrong... If you have better
3160         : tests or hints, please send them to perlbug@perl.org
3161         : The metaconfig authors would also appreciate a copy...
3162         $test -f /irix && osname=irix
3163         $test -f /xenix && osname=sco_xenix
3164         $test -f /dynix && osname=dynix
3165         $test -f /dnix && osname=dnix
3166         $test -f /lynx.os && osname=lynxos
3167         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3168         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3169         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3170         $test -f /bin/mips && /bin/mips && osname=mips
3171         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3172                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3173         $test -d /usr/apollo/bin && osname=apollo
3174         $test -f /etc/saf/_sactab && osname=svr4
3175         $test -d /usr/include/minix && osname=minix
3176         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3177         if $test -d /MachTen -o -d /MachTen_Folder; then
3178                 osname=machten
3179                 if $test -x /sbin/version; then
3180                         osvers=`/sbin/version | $awk '{print $2}' |
3181                         $sed -e 's/[A-Za-z]$//'`
3182                 elif $test -x /usr/etc/version; then
3183                         osvers=`/usr/etc/version | $awk '{print $2}' |
3184                         $sed -e 's/[A-Za-z]$//'`
3185                 else
3186                         osvers="$2.$3"
3187                 fi
3188         fi
3189
3190         $test -f /sys/posix.dll &&
3191                 $test -f /usr/bin/what &&
3192                 set X `/usr/bin/what /sys/posix.dll` &&
3193                 $test "$3" = UWIN &&
3194                 osname=uwin &&
3195                 osvers="$5"
3196
3197         if $test -f $uname; then
3198                 set X $myuname
3199                 shift
3200
3201                 case "$5" in
3202                 fps*) osname=fps ;;
3203                 mips*)
3204                         case "$4" in
3205                         umips) osname=umips ;;
3206                         *) osname=mips ;;
3207                         esac;;
3208                 [23]100) osname=mips ;;
3209                 next*) osname=next ;;
3210                 i386*)
3211                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3212                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3213                                 osname='sco'
3214                                 osvers=$tmp
3215                         elif $test -f /etc/kconfig; then
3216                                 osname=isc
3217                                 if test "$lns" = "$ln -s"; then
3218                                         osvers=4
3219                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3220                                         osvers=3
3221                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3222                                         osvers=2
3223                                 fi
3224                         fi
3225                         tmp=''
3226                         ;;
3227                 pc*)
3228                         if test -n "$DJGPP"; then
3229                                 osname=dos
3230                                 osvers=djgpp
3231                         fi
3232                         ;;
3233                 esac
3234
3235                 case "$1" in
3236                 aix) osname=aix
3237                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3238                         case "$tmp" in
3239                         # oslevel can fail with:
3240                         # oslevel: Unable to acquire lock.
3241                         *not\ found) osvers="$4"."$3" ;;
3242                         '<3240'|'<>3240') osvers=3.2.0 ;;
3243                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3244                         '=3250'|'>3250') osvers=3.2.5 ;;
3245                         *) osvers=$tmp;;
3246                         esac
3247                         ;;
3248                 bsd386) osname=bsd386
3249                         osvers=`$uname -r`
3250                         ;;
3251                 cygwin*) osname=cygwin
3252                         osvers="$3"
3253                         ;;
3254                 *dc.osx) osname=dcosx
3255                         osvers="$3"
3256                         ;;
3257                 dnix) osname=dnix
3258                         osvers="$3"
3259                         ;;
3260                 domainos) osname=apollo
3261                         osvers="$3"
3262                         ;;
3263                 dgux)   osname=dgux
3264                         osvers="$3"
3265                         ;;
3266                 dragonfly) osname=dragonfly
3267                         osvers="$3"
3268                         ;;
3269                 dynixptx*) osname=dynixptx
3270                         osvers=`echo "$4"|sed 's/^v//'`
3271                         ;;
3272                 freebsd) osname=freebsd
3273                         osvers="$3" ;;
3274                 genix)  osname=genix ;;
3275                 gnu)    osname=gnu
3276                         osvers="$3" ;;
3277                 hp*)    osname=hpux
3278                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3279                         ;;
3280                 irix*)  osname=irix
3281                         case "$3" in
3282                         4*) osvers=4 ;;
3283                         5*) osvers=5 ;;
3284                         *)      osvers="$3" ;;
3285                         esac
3286                         ;;
3287                 linux)  osname=linux
3288                         case "$3" in
3289                         *)      osvers="$3" ;;
3290                         esac
3291                         ;;
3292                 MiNT)   osname=mint
3293                         ;;
3294                 netbsd*) osname=netbsd
3295                         osvers="$3"
3296                         ;;
3297                 news-os) osvers="$3"
3298                         case "$3" in
3299                         4*) osname=newsos4 ;;
3300                         *) osname=newsos ;;
3301                         esac
3302                         ;;
3303                 next*) osname=next ;;
3304                 nonstop-ux) osname=nonstopux ;;
3305                 openbsd) osname=openbsd
3306                         osvers="$3"
3307                         ;;
3308                 os2)    osname=os2
3309                         osvers="$4"
3310                         ;;
3311                 POSIX-BC | posix-bc ) osname=posix-bc
3312                         osvers="$3"
3313                         ;;
3314                 powerux | power_ux | powermax_os | powermaxos | \
3315                 powerunix | power_unix) osname=powerux
3316                         osvers="$3"
3317                         ;;
3318                 qnx) osname=qnx
3319                         osvers="$4"
3320                         ;;
3321                 solaris) osname=solaris
3322                         case "$3" in
3323                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3324                         *)      osvers="$3" ;;
3325                         esac
3326                         ;;
3327                 sunos) osname=sunos
3328                         case "$3" in
3329                         5*) osname=solaris
3330                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3331                         *)      osvers="$3" ;;
3332                         esac
3333                         ;;
3334                 titanos) osname=titanos
3335                         case "$3" in
3336                         1*) osvers=1 ;;
3337                         2*) osvers=2 ;;
3338                         3*) osvers=3 ;;
3339                         4*) osvers=4 ;;
3340                         *)      osvers="$3" ;;
3341                         esac
3342                         ;;
3343                 ultrix) osname=ultrix
3344                         osvers="$3"
3345                         ;;
3346                 osf1|mls+)      case "$5" in
3347                                 alpha)
3348                                         osname=dec_osf
3349                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3350                                         case "$osvers" in
3351                                         [1-9].[0-9]*) ;;
3352                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3353                                         esac
3354                                         ;;
3355                         hp*)    osname=hp_osf1  ;;
3356                         mips)   osname=mips_osf1 ;;
3357                         esac
3358                         ;;
3359                 # UnixWare 7.1.2 is known as Open UNIX 8
3360                 openunix|unixware) osname=svr5
3361                         osvers="$4"
3362                         ;;
3363                 uts)    osname=uts
3364                         osvers="$3"
3365                         ;;
3366                 vos) osvers="$3"
3367                         ;;
3368                 $2) case "$osname" in
3369                         *isc*) ;;
3370                         *freebsd*) ;;
3371                         svr*)
3372                                 : svr4.x or possibly later
3373                                 case "svr$3" in
3374                                 ${osname}*)
3375                                         osname=svr$3
3376                                         osvers=$4
3377                                         ;;
3378                                 esac
3379                                 case "$osname" in
3380                                 svr4.0)
3381                                         : Check for ESIX
3382                                         if test -f /stand/boot ; then
3383                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3384                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3385                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3386                                                         if test -n "$isesix"; then
3387                                                                 osname=esix4
3388                                                         fi
3389                                                 fi
3390                                         fi
3391                                         ;;
3392                                 esac
3393                                 ;;
3394                         *)      if test -f /etc/systemid; then
3395                                         osname=sco
3396                                         set `echo $3 | $sed 's/\./ /g'` $4
3397                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3398                                                 osvers=$1.$2.$3
3399                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3400                                                 osvers=$1.$2
3401                                         elif $test -f $src/hints/sco_$1.sh; then
3402                                                 osvers=$1
3403                                         fi
3404                                 else
3405                                         case "$osname" in
3406                                         '') : Still unknown.  Probably a generic Sys V.
3407                                                 osname="sysv"
3408                                                 osvers="$3"
3409                                                 ;;
3410                                         esac
3411                                 fi
3412                                 ;;
3413                         esac
3414                         ;;
3415                 *)      case "$osname" in
3416                         '') : Still unknown.  Probably a generic BSD.
3417                                 osname="$1"
3418                                 osvers="$3"
3419                                 ;;
3420                         esac
3421                         ;;
3422                 esac
3423         else
3424                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3425                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3426                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3427                                 osname=news_os
3428                         fi
3429                         $rm -f UU/kernel.what
3430                 elif test -d c:/. -o -n "$is_os2" ; then
3431                         set X $myuname
3432                         osname=os2
3433                         osvers="$5"
3434                 fi
3435         fi
3436
3437         case "$targetarch" in
3438         '') ;;
3439         *)  hostarch=$osname
3440             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3441             osvers=''
3442             ;;
3443         esac
3444
3445         : Now look for a hint file osname_osvers, unless one has been
3446         : specified already.
3447         case "$hintfile" in
3448         ''|' ')
3449                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3450                 : Also try without trailing minor version numbers.
3451                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3452                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3453                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3454                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3455                 case "$file" in
3456                 '') dflt=none ;;
3457                 *)  case "$osvers" in
3458                         '') dflt=$file
3459                                 ;;
3460                         *)  if $test -f $src/hints/$file.sh ; then
3461                                         dflt=$file
3462                                 elif $test -f $src/hints/$xfile.sh ; then
3463                                         dflt=$xfile
3464                                 elif $test -f $src/hints/$xxfile.sh ; then
3465                                         dflt=$xxfile
3466                                 elif $test -f $src/hints/$xxxfile.sh ; then
3467                                         dflt=$xxxfile
3468                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3469                                         dflt=$xxxxfile
3470                                 elif $test -f "$src/hints/${osname}.sh" ; then
3471                                         dflt="${osname}"
3472                                 else
3473                                         dflt=none
3474                                 fi
3475                                 ;;
3476                         esac
3477                         ;;
3478                 esac
3479                 if $test -f Policy.sh ; then
3480                         case "$dflt" in
3481                         *Policy*) ;;
3482                         none) dflt="Policy" ;;
3483                         *) dflt="Policy $dflt" ;;
3484                         esac
3485                 fi
3486                 ;;
3487         *)
3488                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3489                 ;;
3490         esac
3491
3492         if $test -f Policy.sh ; then
3493                 $cat <<EOM
3494
3495 There's also a Policy hint file available, which should make the
3496 site-specific (policy) questions easier to answer.
3497 EOM
3498
3499         fi
3500
3501         $cat <<EOM
3502
3503 You may give one or more space-separated answers, or "none" if appropriate.
3504 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3505 previous run of Configure, you may specify it as well as or instead of
3506 OS-specific hints.  If hints are provided for your OS, you should use them:
3507 although Perl can probably be built without hints on many platforms, using
3508 hints often improve performance and may enable features that Configure can't
3509 set up on its own. If there are no hints that match your OS, specify "none";
3510 DO NOT give a wrong version or a wrong OS.
3511
3512 EOM
3513
3514         rp="Which of these apply, if any?"
3515         . UU/myread
3516         tans=$ans
3517         for file in $tans; do
3518                 if $test X$file = XPolicy -a -f Policy.sh; then
3519                         . Policy.sh
3520                         $cat Policy.sh >> UU/config.sh
3521                 elif $test -f $src/hints/$file.sh; then
3522                         . $src/hints/$file.sh
3523                         $cat $src/hints/$file.sh >> UU/config.sh
3524                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3525                         : nothing
3526                 else
3527                         : Give one chance to correct a possible typo.
3528                         echo "$file.sh does not exist"
3529                         dflt=$file
3530                         rp="hint to use instead?"
3531                         . UU/myread
3532                         for file in $ans; do
3533                                 if $test -f "$src/hints/$file.sh"; then
3534                                         . $src/hints/$file.sh
3535                                         $cat $src/hints/$file.sh >> UU/config.sh
3536                                 elif $test X$ans = X -o X$ans = Xnone ; then
3537                                         : nothing
3538                                 else
3539                                         echo "$file.sh does not exist -- ignored."
3540                                 fi
3541                         done
3542                 fi
3543         done
3544
3545         hint=recommended
3546         : Remember our hint file for later.
3547         if $test -f "$src/hints/$file.sh" ; then
3548                 hintfile="$file"
3549         else
3550                 hintfile=''
3551         fi
3552 fi
3553 cd UU
3554 ;;
3555 *)
3556         echo " "
3557         echo "Fetching default answers from $config_sh..." >&4
3558         tmp_n="$n"
3559         tmp_c="$c"
3560         cd ..
3561         cp $config_sh config.sh 2>/dev/null
3562         chmod +w config.sh
3563         . ./config.sh
3564         cd UU
3565         cp ../config.sh .
3566         n="$tmp_n"
3567         c="$tmp_c"
3568         hint=previous
3569         ;;
3570 esac
3571 test "$override" && . ./optdef.sh
3572
3573 : Restore computed paths
3574 for file in $loclist $trylist; do
3575         eval $file="\$_$file"
3576 done
3577
3578 cat << EOM
3579
3580 Configure uses the operating system name and version to set some defaults.
3581 The default value is probably right if the name rings a bell. Otherwise,
3582 since spelling matters for me, either accept the default or answer "none"
3583 to leave it blank.
3584
3585 EOM
3586 case "$osname" in
3587         ''|' ')
3588                 case "$hintfile" in
3589                 ''|' '|none) dflt=none ;;
3590                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3591                 esac
3592                 ;;
3593         *) dflt="$osname" ;;
3594 esac
3595 rp="Operating system name?"
3596 . ./myread
3597 case "$ans" in
3598 none)  osname='' ;;
3599 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3600 esac
3601 echo " "
3602 case "$osvers" in
3603         ''|' ')
3604                 case "$hintfile" in
3605                 ''|' '|none) dflt=none ;;
3606                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3607                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3608                         case "$dflt" in
3609                         ''|' ') dflt=none ;;
3610                         esac
3611                         ;;
3612                 esac
3613                 ;;
3614         *) dflt="$osvers" ;;
3615 esac
3616 rp="Operating system version?"
3617 . ./myread
3618 case "$ans" in
3619 none)  osvers='' ;;
3620 *) osvers="$ans" ;;
3621 esac
3622
3623
3624 . ./posthint.sh
3625
3626 : who configured the system
3627 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3628 case "$cf_by" in
3629 "")
3630         cf_by=`(logname) 2>/dev/null`
3631         case "$cf_by" in
3632         "")
3633                 cf_by=`(whoami) 2>/dev/null`
3634                 case "$cf_by" in
3635                 "") cf_by=unknown ;;
3636                 esac ;;
3637         esac ;;
3638 esac
3639
3640 : decide how portable to be.  Allow command line overrides.
3641 case "$d_portable" in
3642 "$undef") ;;
3643 *)      d_portable="$define" ;;
3644 esac
3645
3646 : set up shell script to do ~ expansion
3647 cat >filexp <<EOSS
3648 $startsh
3649 : expand filename
3650 case "\$1" in
3651  \~/*|\~)
3652         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3653         ;;
3654  \~*)
3655         if $test -f /bin/csh; then
3656                 /bin/csh -f -c "glob \$1"
3657                 failed=\$?
3658                 echo ""
3659                 exit \$failed
3660         else
3661                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3662                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3663                 if $test ! -d "\$dir"; then
3664                         me=\`basename \$0\`
3665                         echo "\$me: can't locate home directory for: \$name" >&2
3666                         exit 1
3667                 fi
3668                 case "\$1" in
3669                 */*)
3670                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3671                         ;;
3672                 *)
3673                         echo \$dir
3674                         ;;
3675                 esac
3676         fi
3677         ;;
3678 *)
3679         echo \$1
3680         ;;
3681 esac
3682 EOSS
3683 chmod +x filexp
3684 $eunicefix filexp
3685
3686 : now set up to get a file name
3687 cat <<EOS >getfile
3688 $startsh
3689 EOS
3690 cat <<'EOSC' >>getfile
3691 tilde=''
3692 fullpath=''
3693 already=''
3694 skip=''
3695 none_ok=''
3696 exp_file=''
3697 nopath_ok=''
3698 orig_rp="$rp"
3699 orig_dflt="$dflt"
3700 case "$gfpth" in
3701 '') gfpth='.' ;;
3702 esac
3703
3704 case "$fn" in
3705 *\(*)
3706         : getfile will accept an answer from the comma-separated list
3707         : enclosed in parentheses even if it does not meet other criteria.
3708         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3709         fn=`echo $fn | sed 's/(.*)//'`
3710         ;;
3711 esac
3712
3713 case "$fn" in
3714 *:*)
3715         loc_file=`expr $fn : '.*:\(.*\)'`
3716         fn=`expr $fn : '\(.*\):.*'`
3717         ;;
3718 esac
3719
3720 case "$fn" in
3721 *~*) tilde=true;;
3722 esac
3723 case "$fn" in
3724 */*) fullpath=true;;
3725 esac
3726 case "$fn" in
3727 *+*) skip=true;;
3728 esac
3729 case "$fn" in
3730 *n*) none_ok=true;;
3731 esac
3732 case "$fn" in
3733 *e*) exp_file=true;;
3734 esac
3735 case "$fn" in
3736 *p*) nopath_ok=true;;
3737 esac
3738
3739 case "$fn" in
3740 *f*) type='File';;
3741 *d*) type='Directory';;
3742 *l*) type='Locate';;
3743 esac
3744
3745 what="$type"
3746 case "$what" in
3747 Locate) what='File';;
3748 esac
3749
3750 case "$exp_file" in
3751 '')
3752         case "$d_portable" in
3753         "$define") ;;
3754         *) exp_file=true;;
3755         esac
3756         ;;
3757 esac
3758
3759 cd ..
3760 while test "$type"; do
3761         redo=''
3762         rp="$orig_rp"
3763         dflt="$orig_dflt"
3764         case "$tilde" in
3765         true) rp="$rp (~name ok)";;
3766         esac
3767         . UU/myread
3768         if test -f UU/getfile.ok && \
3769                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3770         then
3771                 value="$ans"
3772                 ansexp="$ans"
3773                 break
3774         fi
3775         case "$ans" in
3776         none)
3777                 value=''
3778                 ansexp=''
3779                 case "$none_ok" in
3780                 true) type='';;
3781                 esac
3782                 ;;
3783         *)
3784                 case "$tilde" in
3785                 '') value="$ans"
3786                         ansexp="$ans";;
3787                 *)
3788                         value=`UU/filexp $ans`
3789                         case $? in
3790                         0)
3791                                 if test "$ans" != "$value"; then
3792                                         echo "(That expands to $value on this system.)"
3793                                 fi
3794                                 ;;
3795                         *) value="$ans";;
3796                         esac
3797                         ansexp="$value"
3798                         case "$exp_file" in
3799                         '') value="$ans";;
3800                         esac
3801                         ;;
3802                 esac
3803                 case "$fullpath" in
3804                 true)
3805                         case "$ansexp" in
3806                         /*) value="$ansexp" ;;
3807                         [a-zA-Z]:/*) value="$ansexp" ;;
3808                         *)
3809                                 redo=true
3810                                 case "$already" in
3811                                 true)
3812                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3813                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3814                                         ;;
3815                                 *)
3816                                 echo "Please give a full path name, starting with slash." >&4
3817                                         case "$tilde" in
3818                                         true)
3819                                 echo "Note that using ~name is ok provided it expands well." >&4
3820                                                 already=true
3821                                                 ;;
3822                                         esac
3823                                 esac
3824                                 ;;
3825                         esac
3826                         ;;
3827                 esac
3828                 case "$redo" in
3829                 '')
3830                         case "$type" in
3831                         File)
3832                                 for fp in $gfpth; do
3833                                         if test "X$fp" = X.; then
3834                                             pf="$ansexp"
3835                                         else    
3836                                             pf="$fp/$ansexp"
3837                                         fi
3838                                         if test -f "$pf"; then
3839                                                 type=''
3840                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3841                                         then
3842                                                 echo "($value is not a plain file, but that's ok.)"
3843                                                 type=''
3844                                         fi
3845                                         if test X"$type" = X; then
3846                                             value="$pf"
3847                                             break
3848                                         fi
3849                                 done
3850                                 ;;
3851                         Directory)
3852                                 for fp in $gfpth; do
3853                                         if test "X$fp" = X.; then
3854                                             dir="$ans"
3855                                             direxp="$ansexp"
3856                                         else    
3857                                             dir="$fp/$ansexp"
3858                                             direxp="$fp/$ansexp"
3859                                         fi
3860                                         if test -d "$direxp"; then
3861                                                 type=''
3862                                                 value="$dir"
3863                                                 break
3864                                         fi
3865                                 done
3866                                 ;;
3867                         Locate)
3868                                 if test -d "$ansexp"; then
3869                                         echo "(Looking for $loc_file in directory $value.)"
3870                                         value="$value/$loc_file"
3871                                         ansexp="$ansexp/$loc_file"
3872                                 fi
3873                                 if test -f "$ansexp"; then
3874                                         type=''
3875                                 fi
3876                                 case "$nopath_ok" in
3877                                 true)   case "$value" in
3878                                         */*) ;;
3879                                         *)      echo "Assuming $value will be in people's path."
3880                                                 type=''
3881                                                 ;;
3882                                         esac
3883                                         ;;
3884                                 esac
3885                                 ;;
3886                         esac
3887
3888                         case "$skip" in
3889                         true) type='';
3890                         esac
3891
3892                         case "$type" in
3893                         '') ;;
3894                         *)
3895                                 if test "$fastread" = yes; then
3896                                         dflt=y
3897                                 else
3898                                         dflt=n
3899                                 fi
3900                                 rp="$what $value doesn't exist.  Use that name anyway?"
3901                                 . UU/myread
3902                                 dflt=''
3903                                 case "$ans" in
3904                                 y*) type='';;
3905                                 *) echo " ";;
3906                                 esac
3907                                 ;;
3908                         esac
3909                         ;;
3910                 esac
3911                 ;;
3912         esac
3913 done
3914 cd UU
3915 ans="$value"
3916 rp="$orig_rp"
3917 dflt="$orig_dflt"
3918 rm -f getfile.ok
3919 test "X$gfpthkeep" != Xy && gfpth=""
3920 EOSC
3921
3922 : determine root of directory hierarchy where package will be installed.
3923 case "$prefix" in
3924 '')
3925         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3926         ;;
3927 *?/)
3928         dflt=`echo "$prefix" | sed 's/.$//'`
3929         ;;
3930 *)
3931         dflt="$prefix"
3932         ;;
3933 esac
3934 $cat <<EOM
3935
3936 By default, $package will be installed in $dflt/bin, manual pages
3937 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3938 installation directories. Typically this is something like /usr/local.
3939 If you wish to have binaries under /usr/bin but other parts of the
3940 installation under /usr/local, that's ok: you will be prompted
3941 separately for each of the installation directories, the prefix being
3942 only used to set the defaults.
3943
3944 EOM
3945 fn=d~
3946 rp='Installation prefix to use?'
3947 . ./getfile
3948 oldprefix=''
3949 case "$prefix" in
3950 '') ;;
3951 *)
3952         case "$ans" in
3953         "$prefix") ;;
3954         *) oldprefix="$prefix";;
3955         esac
3956         ;;
3957 esac
3958 prefix="$ans"
3959 prefixexp="$ansexp"
3960
3961 : allow them to override the AFS root
3962 case "$afsroot" in
3963 '')     afsroot=/afs ;;
3964 *)      afsroot=$afsroot ;;
3965 esac
3966
3967 : is AFS running?
3968 echo " "
3969 case "$afs" in
3970 $define|true)   afs=true ;;
3971 $undef|false)   afs=false ;;
3972 *)      if $test -d $afsroot; then
3973                 afs=true
3974         else
3975                 afs=false
3976         fi
3977         ;;
3978 esac
3979 if $afs; then
3980         echo "AFS may be running... I'll be extra cautious then..." >&4
3981 else
3982         echo "AFS does not seem to be running..." >&4
3983 fi
3984
3985 : determine installation prefix for where package is to be installed.
3986 if $afs; then 
3987 $cat <<EOM
3988
3989 Since you are running AFS, I need to distinguish the directory in which
3990 files will reside from the directory in which they are installed (and from
3991 which they are presumably copied to the former directory by occult means).
3992
3993 EOM
3994         case "$installprefix" in
3995         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3996         *) dflt="$installprefix";;
3997         esac
3998 else
3999 $cat <<EOM
4000
4001 In some special cases, particularly when building $package for distribution,
4002 it is convenient to distinguish the directory in which files should be
4003 installed from the directory ($prefix) in which they will
4004 eventually reside.  For most users, these two directories are the same.
4005
4006 EOM
4007         case "$installprefix" in
4008         '') dflt=$prefix ;;
4009         *) dflt=$installprefix;;
4010         esac
4011 fi
4012 fn=d~
4013 rp='What installation prefix should I use for installing files?'
4014 . ./getfile
4015 installprefix="$ans"
4016 installprefixexp="$ansexp"
4017
4018 : Perform the prefixexp/installprefixexp correction if necessary
4019 cat <<EOS >installprefix
4020 $startsh
4021 EOS
4022 cat <<'EOSC' >>installprefix
4023 : Change installation prefix, if necessary.
4024 if $test X"$prefix" != X"$installprefix"; then
4025     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
4026 else
4027     eval "install${prefixvar}=\"\$${prefixvar}exp\""
4028 fi
4029 EOSC
4030 chmod +x installprefix
4031 $eunicefix installprefix
4032
4033 : Set variables such as privlib and privlibexp from the output of ./getfile
4034 : performing the prefixexp/installprefixexp correction if necessary.
4035 cat <<EOS >setprefixvar
4036 $startsh
4037 EOS
4038 cat <<'EOSC' >>setprefixvar
4039 eval "${prefixvar}=\"\$ans\""
4040 eval "${prefixvar}exp=\"\$ansexp\""
4041 . ./installprefix
4042 EOSC
4043 chmod +x setprefixvar
4044 $eunicefix setprefixvar
4045
4046 : set up the script used to warn in case of inconsistency
4047 cat <<EOS >whoa
4048 $startsh
4049 EOS
4050 cat <<'EOSC' >>whoa
4051 dflt=y
4052 case "$hint" in
4053     recommended)
4054         case "$hintfile" in
4055         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
4056                 ;;
4057         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
4058                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
4059                 ;;
4060         esac
4061         ;;
4062     *)  echo " "
4063         echo "*** WHOA THERE!!! ***" >&4
4064         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
4065         ;;
4066 esac
4067 rp="    Keep the $hint value?"
4068 . ./myread
4069 case "$ans" in
4070 y) td=$was; tu=$was;;
4071 esac
4072 EOSC
4073
4074 : function used to set '$1' to '$val'
4075 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4076 case "$val$was" in
4077 $define$undef) . ./whoa; eval "$var=\$td";;
4078 $undef$define) . ./whoa; eval "$var=\$tu";;
4079 *) eval "$var=$val";;
4080 esac'
4081
4082 : get the patchlevel
4083 echo " "
4084 echo "Getting the current patchlevel..." >&4
4085 if $test -r $rsrc/patchlevel.h;then
4086         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4087         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4088         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4089         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4090         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4091         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4092         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4093 else
4094         revision=0
4095         patchlevel=0
4096         subversion=0
4097         api_revision=0
4098         api_version=0
4099         api_subversion=0
4100         perl_patchlevel=0
4101         $echo "(You do not have patchlevel.h.  Eek.)"
4102 fi
4103 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4104 version_patchlevel_string="version $patchlevel subversion $subversion"
4105 case "$perl_patchlevel" in
4106 0|'') ;;
4107 *)  perl_patchlevel=`echo $perl_patchlevel | sed 's/.* //'`
4108     version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel"
4109     ;;
4110 esac
4111
4112 $echo "(You have $package $version_patchlevel_string.)"
4113
4114 case "$osname" in
4115 dos|vms)
4116         : XXX Should be a Configure test for double-dots in filenames.
4117         version=`echo $revision $patchlevel $subversion | \
4118                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4119         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4120                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4121         ;;
4122 *)
4123         version=`echo $revision $patchlevel $subversion | \
4124                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4125         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4126                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4127         ;;
4128 esac
4129 : Special case the 5.005_xx maintenance series, which used 5.005
4130 : without any subversion label as a subdirectory in $sitelib
4131 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4132         api_versionstring='5.005'
4133 fi
4134
4135 : Do we want threads support and if so, what type
4136 case "$usethreads" in
4137 $define|true|[yY]*)     dflt='y';;
4138 *)     # Catch case where user specified ithreads or 5005threads but
4139        # forgot -Dusethreads (A.D. 4/2002)
4140        case "$useithreads$use5005threads" in
4141        *$define*)       dflt='y';;
4142        *)               dflt='n';;
4143        esac
4144        ;;
4145 esac
4146 cat <<EOM
4147
4148 Perl can be built to take advantage of threads on some systems.
4149 To do so, Configure can be run with -Dusethreads.
4150
4151 Note that Perl built with threading support runs slightly slower
4152 and uses more memory than plain Perl. The current implementation
4153 is believed to be stable, but it is fairly new, and so should be
4154 treated with caution.
4155
4156 If this doesn't make any sense to you, just accept the default '$dflt'.
4157 EOM
4158 rp='Build a threading Perl?'
4159 . ./myread
4160 case "$ans" in
4161 y|Y)    val="$define" ;;
4162 *)      val="$undef" ;;
4163 esac
4164 set usethreads
4165 eval $setvar
4166
4167 if $test $patchlevel -lt 9; then
4168     case "$usethreads" in
4169     $define)
4170         $cat <<EOM
4171
4172 Since release 5.6, Perl has had two different threading implementations,
4173 the newer interpreter-based version (ithreads) with one interpreter per
4174 thread, and the older 5.005 version (5005threads).
4175 The 5005threads version is effectively unmaintained and will probably be
4176 removed in Perl 5.10, so there should be no need to build a Perl using it
4177 unless needed for backwards compatibility with some existing 5.005threads
4178 code.
4179
4180 EOM
4181         : Default to ithreads unless overridden on command line or with
4182         : old config.sh
4183         dflt='y'
4184         case "$use5005threads" in
4185                 $define|true|[yY]*) dflt='n';;
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         case "$longsize" in
5860         4) case "$archname64" in
5861            '') archname64=64int ;;
5862            esac
5863            ;;
5864         esac
5865         ;;
5866 esac
5867
5868 : Look for a hint-file generated 'call-back-unit'.  If the
5869 : user has specified that a maximally 64-bit perl is to be built,
5870 : we may need to set or change some other defaults.
5871 if $test -f use64bitall.cbu; then
5872         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5873         . ./use64bitall.cbu
5874 fi
5875 case "$use64bitall" in
5876 "$define"|true|[yY]*)
5877         case "$longsize" in
5878         4) case "$archname64" in
5879            ''|64int) archname64=64all ;;
5880            esac
5881            ;;
5882         esac
5883         ;;
5884 esac
5885
5886 case "$d_quad:$use64bitint" in
5887 $undef:$define)
5888         cat >&4 <<EOF
5889
5890 *** You have chosen to use 64-bit integers,
5891 *** but none can be found.
5892 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5893 *** Cannot continue, aborting.
5894
5895 EOF
5896         exit 1
5897         ;;
5898 esac
5899
5900 : check for length of double
5901 echo " "
5902 case "$doublesize" in
5903 '')
5904         echo "Checking to see how big your double precision numbers are..." >&4
5905         $cat >try.c <<EOCP
5906 #include <stdio.h>
5907 #$i_stdlib I_STDLIB
5908 #ifdef I_STDLIB
5909 #include <stdlib.h>
5910 #endif
5911 int main()
5912 {
5913     printf("%d\n", (int)sizeof(double));
5914     exit(0);
5915 }
5916 EOCP
5917         set try
5918         if eval $compile_ok; then
5919                 doublesize=`$run ./try`
5920                 echo "Your double is $doublesize bytes long."
5921         else
5922                 dflt='8'
5923                 echo "(I can't seem to compile the test program.  Guessing...)"
5924                 rp="What is the size of a double precision number (in bytes)?"
5925                 . ./myread
5926                 doublesize="$ans"
5927         fi
5928         ;;
5929 esac
5930 $rm_try
5931
5932 : check for long doubles
5933 echo " "
5934 echo "Checking to see if you have long double..." >&4
5935 echo 'int main() { long double x = 7.0; }' > try.c
5936 set try
5937 if eval $compile; then
5938         val="$define"
5939         echo "You have long double."
5940 else
5941         val="$undef"
5942         echo "You do not have long double."
5943 fi
5944 $rm_try
5945 set d_longdbl
5946 eval $setvar
5947
5948 : check for length of long double
5949 case "${d_longdbl}${longdblsize}" in
5950 $define)
5951         echo " "
5952         echo "Checking to see how big your long doubles are..." >&4
5953         $cat >try.c <<'EOCP'
5954 #include <stdio.h>
5955 int main()
5956 {
5957         printf("%d\n", sizeof(long double));
5958 }
5959 EOCP
5960         set try
5961         set try
5962         if eval $compile; then
5963                 longdblsize=`$run ./try`
5964                 echo "Your long doubles are $longdblsize bytes long."
5965         else
5966                 dflt='8'
5967                 echo " "
5968                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5969                 rp="What is the size of a long double (in bytes)?"
5970                 . ./myread
5971                 longdblsize="$ans"
5972         fi
5973         if $test "X$doublesize" = "X$longdblsize"; then
5974                 echo "That isn't any different from an ordinary double."
5975                 echo "I'll keep your setting anyway, but you may see some"
5976                 echo "harmless compilation warnings."
5977         fi
5978         ;;
5979 esac
5980 $rm_try
5981
5982 : determine the architecture name
5983 echo " "
5984 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5985         tarch=`arch`"-$osname"
5986 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5987         if uname -m > tmparch 2>&1 ; then
5988                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5989                         -e 's/$/'"-$osname/" tmparch`
5990         else
5991                 tarch="$osname"
5992         fi
5993         $rm -f tmparch
5994 else
5995         tarch="$osname"
5996 fi
5997 case "$myarchname" in
5998 ''|"$tarch") ;;
5999 *)
6000         echo "(Your architecture name used to be $myarchname.)"
6001         archname=''
6002         ;;
6003 esac
6004 case "$targetarch" in
6005 '') ;;
6006 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6007 esac
6008 myarchname="$tarch"
6009 case "$archname" in
6010 '') dflt="$tarch";;
6011 *) dflt="$archname";;
6012 esac
6013 rp='What is your architecture name'
6014 . ./myread
6015 archname="$ans"
6016 case "$usethreads" in
6017 $define)
6018         echo "Threads selected." >&4
6019         case "$archname" in
6020         *-thread*) echo "...and architecture name already has -thread." >&4
6021                 ;;
6022         *)      archname="$archname-thread"
6023                 echo "...setting architecture name to $archname." >&4
6024                 ;;
6025         esac
6026         ;;
6027 esac
6028 case "$usemultiplicity" in
6029 $define)
6030         echo "Multiplicity selected." >&4
6031         case "$archname" in
6032         *-multi*) echo "...and architecture name already has -multi." >&4
6033                 ;;
6034         *)      archname="$archname-multi"
6035                 echo "...setting architecture name to $archname." >&4
6036                 ;;
6037         esac
6038         ;;
6039 esac
6040 case "$use64bitint$use64bitall" in
6041 *"$define"*)
6042         case "$archname64" in
6043         '')
6044                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6045                 ;;
6046         *)
6047                 case "$use64bitint" in
6048                 "$define") echo "64 bit integers selected." >&4 ;;
6049                 esac
6050                 case "$use64bitall" in
6051                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6052                 esac
6053                 case "$archname" in
6054                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6055                         ;;
6056                 *)      archname="$archname-$archname64"
6057                         echo "...setting architecture name to $archname." >&4
6058                         ;;
6059                 esac
6060                 ;;
6061         esac
6062 esac
6063 case "$uselongdouble" in
6064 $define)
6065         echo "Long doubles selected." >&4
6066         case "$longdblsize" in
6067         $doublesize)
6068                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6069                 ;;
6070         *)
6071                 case "$archname" in
6072                 *-ld*) echo "...and architecture name already has -ld." >&4
6073                         ;;
6074                 *)      archname="$archname-ld"
6075                         echo "...setting architecture name to $archname." >&4
6076                         ;;
6077                 esac
6078                 ;;
6079         esac
6080         ;;
6081 esac
6082 if $test -f archname.cbu; then
6083         echo "Your platform has some specific hints for architecture name, using them..."
6084         . ./archname.cbu
6085 fi
6086
6087 : set the prefixit variable, to compute a suitable default value
6088 prefixit='case "$3" in
6089 ""|none)
6090         case "$oldprefix" in
6091         "") eval "$1=\"\$$2\"";;
6092         *)
6093                 case "$3" in
6094                 "") eval "$1=";;
6095                 none)
6096                         eval "tp=\"\$$2\"";
6097                         case "$tp" in
6098                         ""|" ") eval "$1=\"\$$2\"";;
6099                         *) eval "$1=";;
6100                         esac;;
6101                 esac;;
6102         esac;;
6103 *)
6104         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6105         case "$tp" in
6106         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6107         /*-$oldprefix/*|\~*-$oldprefix/*)
6108                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6109         *) eval "$1=\"\$$2\"";;
6110         esac;;
6111 esac'
6112
6113 : determine installation style
6114 : For now, try to deduce it from prefix unless it is already set.
6115 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6116 case "$installstyle" in
6117 '')     case "$prefix" in
6118                 *perl*) dflt='lib';;
6119                 *) dflt='lib/perl5' ;;
6120         esac
6121         ;;
6122 *)      dflt="$installstyle" ;;
6123 esac
6124 : Probably not worth prompting for this since we prompt for all
6125 : the directories individually, and the prompt would be too long and
6126 : confusing anyway.
6127 installstyle=$dflt
6128
6129 : determine where public executables go
6130 echo " "
6131 set dflt bin bin
6132 eval $prefixit
6133 fn=d~
6134 rp='Pathname where the public executables will reside?'
6135 . ./getfile
6136 if $test "X$ansexp" != "X$binexp"; then
6137         installbin=''
6138 fi
6139 prefixvar=bin
6140 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6141 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6142 :     this via initialinstalllocation
6143 . ./setprefixvar
6144
6145 case "$userelocatableinc" in
6146 $define|true|[yY]*)     dflt='y' ;;
6147 *)                      dflt='n' ;;
6148 esac
6149 cat <<EOM
6150
6151 Would you like to build Perl so that the installation is relocatable, so that
6152 library paths in @INC are determined relative to the path of the perl binary?
6153 This is not advised for system Perl installs, or if you need to run setid
6154 scripts or scripts under taint mode.
6155
6156 If this doesn't make any sense to you, just accept the default '$dflt'.
6157 EOM
6158 rp='Use relocatable @INC?'
6159 . ./myread
6160 case "$ans" in
6161 y|Y)    val="$define" ;;
6162 *)      val="$undef"  ;;
6163 esac
6164 set userelocatableinc
6165 eval $setvar
6166
6167 initialinstalllocation="$binexp"
6168 : Default prefix is now "up one level from where the binaries are"
6169 case "$userelocatableinc" in
6170 $define|true|[yY]*)
6171     bin=".../"
6172     binexp=".../"
6173     prefix=".../.."
6174     prefixexp=".../.."
6175     installprefixexp=".../.."
6176     ;;
6177 esac
6178
6179 : determine where private library files go
6180 : Usual default is /usr/local/lib/perl5/$version.
6181 : Also allow things like /opt/perl/lib/$version, since
6182 : /opt/perl/lib/perl5... would be redundant.
6183 : The default "style" setting is made in installstyle.U
6184 case "$installstyle" in
6185 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6186 *)       set dflt privlib lib/$version ;;
6187 esac
6188 eval $prefixit
6189 $cat <<EOM
6190
6191 There are some auxiliary files for $package that need to be put into a
6192 private library directory that is accessible by everyone.
6193
6194 EOM
6195 fn=$binexp
6196 fn=d~+
6197 rp='Pathname where the private library files will reside?'
6198 . ./getfile
6199 prefixvar=privlib
6200 . ./setprefixvar
6201
6202 : set the prefixup variable, to restore leading tilda escape
6203 prefixup='case "$prefixexp" in
6204 "$prefix") ;;
6205 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6206 esac'
6207
6208 : determine where public architecture dependent libraries go
6209 set archlib archlib
6210 eval $prefixit
6211 : privlib default is /usr/local/lib/$package/$version
6212 : archlib default is /usr/local/lib/$package/$version/$archname
6213 : privlib may have an optional trailing /share.
6214 tdflt=`echo $privlib | $sed 's,/share$,,'`
6215 tdflt=$tdflt/$archname
6216 case "$archlib" in
6217 '')     dflt=$tdflt
6218         ;;
6219 *)      dflt="$archlib"
6220     ;;
6221 esac
6222 $cat <<EOM
6223
6224 $spackage contains architecture-dependent library files.  If you are
6225 sharing libraries in a heterogeneous environment, you might store
6226 these files in a separate location.  Otherwise, you can just include
6227 them with the rest of the public library files.
6228
6229 EOM
6230 fn=$binexp
6231 fn=d+~
6232 rp='Where do you want to put the public architecture-dependent libraries?'
6233 . ./getfile
6234 prefixvar=archlib
6235 . ./setprefixvar
6236 if $test X"$archlib" = X"$privlib"; then
6237         d_archlib="$undef"
6238 else
6239         d_archlib="$define"
6240 fi
6241
6242 : see if setuid scripts can be secure
6243 $cat <<EOM
6244
6245 Some kernels have a bug that prevents setuid #! scripts from being
6246 secure.  Some sites have disabled setuid #! scripts because of this.
6247
6248 First let's decide if your kernel supports secure setuid #! scripts.
6249 (If setuid #! scripts would be secure but have been disabled anyway,
6250 don't say that they are secure if asked.)
6251
6252 EOM
6253
6254 val="$undef"
6255 if $test -d /dev/fd; then
6256         echo "#!$ls" >reflect
6257         chmod +x,u+s reflect
6258         ./reflect >flect 2>&1
6259         if $contains "/dev/fd" flect >/dev/null; then
6260                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6261                 val="$define"
6262         else
6263                 $cat <<EOM
6264 If you are not sure if they are secure, I can check but I'll need a
6265 username and password different from the one you are using right now.
6266 If you don't have such a username or don't want me to test, simply
6267 enter 'none'.
6268
6269 EOM
6270                 rp='Other username to test security of setuid scripts with?'
6271                 dflt='none'
6272                 . ./myread
6273                 case "$ans" in
6274                 n|none)
6275                         case "$d_suidsafe" in
6276                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6277                                 dflt=n;;
6278                         "$undef")
6279                                 echo "Well, the $hint value is *not* secure." >&4
6280                                 dflt=n;;
6281                         *)      echo "Well, the $hint value *is* secure." >&4
6282                                 dflt=y;;
6283                         esac
6284                         ;;
6285                 *)
6286                         $rm -f reflect flect
6287                         echo "#!$ls" >reflect
6288                         chmod +x,u+s reflect
6289                         echo >flect
6290                         chmod a+w flect
6291                         echo '"su" will (probably) prompt you for '"$ans's password."
6292                         su $ans -c './reflect >flect'
6293                         if $contains "/dev/fd" flect >/dev/null; then
6294                                 echo "Okay, it looks like setuid scripts are secure." >&4
6295                                 dflt=y
6296                         else
6297                                 echo "I don't think setuid scripts are secure." >&4
6298                                 dflt=n
6299                         fi
6300                         ;;
6301                 esac
6302                 rp='Does your kernel have *secure* setuid scripts?'
6303                 . ./myread
6304                 case "$ans" in
6305                 [yY]*)  val="$define";;
6306                 *)      val="$undef";;
6307                 esac
6308         fi
6309 else
6310         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6311         echo "(That's for file descriptors, not floppy disks.)"
6312         val="$undef"
6313 fi
6314 set d_suidsafe
6315 eval $setvar
6316
6317 $rm -f reflect flect
6318
6319 : now see if they want to do setuid emulation
6320 if $test $patchlevel -lt 11; then
6321 echo " "
6322 val="$undef"
6323 case "$d_suidsafe" in
6324 "$define")
6325         val="$undef"
6326         echo "No need to emulate SUID scripts since they are secure here." >&4
6327         ;;
6328 *)
6329         $cat <<EOM
6330 Some systems have disabled setuid scripts, especially systems where
6331 setuid scripts cannot be secure.  On systems where setuid scripts have
6332 been disabled, the setuid/setgid bits on scripts are currently
6333 useless.  It is possible for $package to detect those bits and emulate
6334 setuid/setgid in a secure fashion.  This emulation will only work if
6335 setuid scripts have been disabled in your kernel.
6336
6337 EOM
6338         case "$d_dosuid" in
6339         "$define") dflt=y ;;
6340         *) dflt=n ;;
6341         esac
6342         rp="Do you want to do setuid/setgid emulation?"
6343         . ./myread
6344         case "$ans" in
6345         [yY]*)  val="$define";;
6346         *)      val="$undef";;
6347         esac
6348         ;;
6349 esac
6350 set d_dosuid
6351 eval $setvar
6352 else
6353     case "$d_dosuid" in
6354         "$define")
6355         cat >&4 <<EOH
6356
6357 SUID emulation has been removed for 5.12
6358 Please re-run Configure without -Dd_dosuid
6359
6360 EOH
6361         exit 1;
6362         ;;
6363     esac
6364     d_dosuid=undef
6365 fi
6366
6367 : Find perl5.005 or later.
6368 echo "Looking for a previously installed perl5.005 or later... "
6369 case "$perl5" in
6370 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6371                 : Check if this perl is recent and can load a simple module
6372                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6373                         perl5=$tdir/perl
6374                         break;
6375                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6376                         perl5=$tdir/perl5
6377                         break;
6378                 fi
6379         done
6380         ;;
6381 *)      perl5="$perl5"
6382         ;;
6383 esac
6384 case "$perl5" in
6385 '')     echo "None found.  That's ok.";;
6386 *)      echo "Using $perl5." ;;
6387 esac
6388
6389 : Set the siteprefix variables
6390 $cat <<EOM
6391
6392 After $package is installed, you may wish to install various
6393 add-on modules and utilities.  Typically, these add-ons will
6394 be installed under $prefix with the rest
6395 of this package.  However, you may wish to install such add-ons
6396 elsewhere under a different prefix.
6397
6398 If you do not wish to put everything under a single prefix, that's
6399 ok.  You will be prompted for the individual locations; this siteprefix
6400 is only used to suggest the defaults.
6401
6402 The default should be fine for most people.
6403
6404 EOM
6405 fn=d~+
6406 rp='Installation prefix to use for add-on modules and utilities?'
6407 : XXX Here might be another good place for an installstyle setting.
6408 case "$siteprefix" in
6409 '') dflt=$prefix ;;
6410 *)  dflt=$siteprefix ;;
6411 esac
6412 . ./getfile
6413 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6414 oldsiteprefix=''
6415 case "$siteprefix" in
6416 '') ;;
6417 *)      case "$ans" in
6418         "$prefix") ;;
6419         *) oldsiteprefix="$prefix";;
6420         esac
6421         ;;
6422 esac
6423 siteprefix="$ans"
6424 siteprefixexp="$ansexp"
6425
6426 : determine where site specific libraries go.
6427 : Usual default is /usr/local/lib/perl5/site_perl/$version
6428 : The default "style" setting is made in installstyle.U
6429 : XXX No longer works with Prefixit stuff.
6430 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6431 case "$sitelib" in
6432 '') case "$installstyle" in
6433         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6434         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6435         esac
6436         ;;
6437 *)      dflt="$sitelib"
6438         ;;
6439 esac
6440 $cat <<EOM
6441
6442 The installation process will create a directory for
6443 site-specific extensions and modules.  Most users find it convenient
6444 to place all site-specific files in this directory rather than in the
6445 main distribution directory.
6446
6447 EOM
6448 fn=d~+
6449 rp='Pathname for the site-specific library files?'
6450 . ./getfile
6451 prefixvar=sitelib
6452 . ./setprefixvar
6453 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6454
6455 : Determine list of previous versions to include in @INC
6456 $cat > getverlist <<EOPL
6457 #!$perl5 -w
6458 use File::Basename;
6459 \$api_versionstring = "$api_versionstring";
6460 \$version = "$version";
6461 \$stem = "$sitelib_stem";
6462 \$archname = "$archname";
6463 EOPL
6464         $cat >> getverlist <<'EOPL'
6465 # The list found is store twice for each entry: the original name, and
6466 # the binary broken down version as pack "sss", so sorting is easy and
6467 # unambiguous. This will work for all versions that have a maximum of
6468 # three digit groups, separate by '.'s or '_'s. Names are extended with
6469 # ".0.0" to ensure at least three elements for the pack.
6470 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6471
6472 # Can't have leading @ because metaconfig interprets it as a command!
6473 ;@inc_version_list=();
6474 # XXX Redo to do opendir/readdir?
6475 if (-d $stem) {
6476     chdir($stem);
6477     ;@candidates = map {
6478         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6479     ;@candidates = sort { $a->[1] cmp $b->[1]} @candidates;
6480 }
6481 else {
6482     ;@candidates = ();
6483 }
6484
6485 ($pversion, $aversion, $vsn5005) = map {
6486     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6487 foreach $d (@candidates) {
6488     if ($d->[1] lt $pversion) {
6489         if ($d->[1] ge $aversion) {
6490             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6491         }
6492         elsif ($d->[1] ge $vsn5005) {
6493             unshift(@inc_version_list, grep { -d } $d->[0]);
6494         }
6495     }
6496     else {
6497         # Skip newer version.  I.e. don't look in
6498         # 5.7.0 if we're installing 5.6.1.
6499     }
6500 }
6501
6502 if (@inc_version_list) {
6503     print join(' ', @inc_version_list);
6504 }
6505 else {
6506     # Blank space to preserve value for next Configure run.
6507     print " ";
6508 }
6509 EOPL
6510 chmod +x getverlist
6511 case "$inc_version_list" in
6512 '')     if test -x "$perl5$exe_ext"; then
6513                 dflt=`$perl5 getverlist`
6514         else
6515                 dflt='none'
6516         fi
6517         ;;
6518 $undef) dflt='none' ;;
6519 *)  eval dflt=\"$inc_version_list\" ;;
6520 esac
6521 case "$dflt" in
6522 ''|' ') dflt=none ;;
6523 esac
6524 case "$dflt" in
6525 5.005) dflt=none ;;
6526 esac
6527 $cat <<EOM
6528
6529 In order to ease the process of upgrading, this version of perl
6530 can be configured to use modules built and installed with earlier
6531 versions of perl that were installed under $prefix.  Specify here
6532 the list of earlier versions that this version of perl should check.
6533 If Configure detected no earlier versions of perl installed under
6534 $prefix, then the list will be empty.  Answer 'none' to tell perl
6535 to not search earlier versions.
6536
6537 The default should almost always be sensible, so if you're not sure,
6538 just accept the default.
6539 EOM
6540
6541 rp='List of earlier versions to include in @INC?'
6542 . ./myread
6543 case "$ans" in
6544 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6545 *) inc_version_list="$ans" ;;
6546 esac
6547 case "$inc_version_list" in
6548 ''|' ')
6549         inc_version_list_init='0'
6550         d_inc_version_list="$undef"
6551         ;;
6552 *)      inc_version_list_init=`echo $inc_version_list |
6553                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6554         d_inc_version_list="$define"
6555         ;;
6556 esac
6557 $rm -f getverlist
6558
6559 : see if malloc/malloc.h has to be included
6560 set malloc/malloc.h i_mallocmalloc
6561 eval $inhdr
6562
6563 : see if this is a malloc.h system
6564 : we want a real compile instead of Inhdr because some systems have a
6565 : malloc.h that just gives a compile error saying to use stdlib.h instead
6566 echo " "
6567 $cat >try.c <<EOCP
6568 #include <stdlib.h>
6569 #include <malloc.h>
6570 #$i_mallocmalloc I_MALLOCMALLOC
6571 #ifdef I_MALLOCMALLOC
6572 # include <malloc/malloc.h>
6573 #endif
6574
6575 int main () { return 0; }
6576 EOCP
6577 set try
6578 if eval $compile; then
6579     echo "<malloc.h> found." >&4
6580     val="$define"
6581 else
6582     echo "<malloc.h> NOT found." >&4
6583     val="$undef"
6584 fi
6585 $rm_try
6586 set i_malloc
6587 eval $setvar
6588
6589 : check for void type
6590 echo " "
6591 echo "Checking to see how well your C compiler groks the void type..." >&4
6592 case "$voidflags" in
6593 '')
6594         $cat >try.c <<EOCP
6595 #$i_stdlib I_STDLIB
6596 #ifdef I_STDLIB
6597 #include <stdlib.h>
6598 #endif
6599 #if TRY & 1
6600 void sub() {
6601 #else
6602 sub() {
6603 #endif
6604         extern void moo();      /* function returning void */
6605         void (*goo)();          /* ptr to func returning void */
6606 #if TRY & 8
6607         void *hue;              /* generic ptr */
6608 #endif
6609 #if TRY & 2
6610         void (*foo[10])();
6611 #endif
6612
6613 #if TRY & 4
6614         if(goo == moo) {
6615                 exit(0);
6616         }
6617 #endif
6618         exit(0);
6619 }
6620 int main() { sub(); }
6621 EOCP
6622         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6623                 voidflags=$defvoidused
6624         echo "Good.  It appears to support void to the level $package wants.">&4
6625                 if $contains warning .out >/dev/null 2>&1; then
6626                         echo "However, you might get some warnings that look like this:"
6627                         $cat .out
6628                 fi
6629         else
6630 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6631                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6632                         echo "It supports 1..."
6633                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6634                                 echo "It also supports 2..."
6635                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6636                                         voidflags=7
6637                                         echo "And it supports 4 but not 8 definitely."
6638                                 else
6639                                         echo "It doesn't support 4..."
6640                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6641                                                 voidflags=11
6642                                                 echo "But it supports 8."
6643                                         else
6644                                                 voidflags=3
6645                                                 echo "Neither does it support 8."
6646                                         fi
6647                                 fi
6648                         else
6649                                 echo "It does not support 2..."
6650                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6651                                         voidflags=13
6652                                         echo "But it supports 4 and 8."
6653                                 else
6654                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6655                                                 voidflags=5
6656                                                 echo "And it supports 4 but has not heard about 8."
6657                                         else
6658                                                 echo "However it supports 8 but not 4."
6659                                         fi
6660                                 fi
6661                         fi
6662                 else
6663                         echo "There is no support at all for void."
6664                         voidflags=0
6665                 fi
6666         fi
6667 esac
6668 case "$voidflags" in
6669 "$defvoidused") ;;
6670 *)      $cat >&4 <<'EOM'
6671   Support flag bits are:
6672     1: basic void declarations.
6673     2: arrays of pointers to functions returning void.
6674     4: operations between pointers to and addresses of void functions.
6675     8: generic void pointers.
6676 EOM
6677         dflt="$voidflags";
6678         rp="Your void support flags add up to what?"
6679         . ./myread
6680         voidflags="$ans"
6681         ;;
6682 esac
6683 $rm_try
6684
6685 : check for length of pointer
6686 echo " "
6687 case "$ptrsize" in
6688 '')
6689         echo "Checking to see how big your pointers are..." >&4
6690         if test "$voidflags" -gt 7; then
6691                 echo '#define VOID_PTR char *' > try.c
6692         else
6693                 echo '#define VOID_PTR void *' > try.c
6694         fi
6695         $cat >>try.c <<EOCP
6696 #include <stdio.h>
6697 #$i_stdlib I_STDLIB
6698 #ifdef I_STDLIB
6699 #include <stdlib.h>
6700 #endif
6701 int main()
6702 {
6703     printf("%d\n", (int)sizeof(VOID_PTR));
6704     exit(0);
6705 }
6706 EOCP
6707         set try
6708         if eval $compile_ok; then
6709                 ptrsize=`$run ./try`
6710                 echo "Your pointers are $ptrsize bytes long."
6711         else
6712                 dflt='4'
6713                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6714                 rp="What is the size of a pointer (in bytes)?"
6715                 . ./myread
6716                 ptrsize="$ans"
6717         fi
6718         ;;
6719 esac
6720 $rm_try
6721 case "$use64bitall" in
6722 "$define"|true|[yY]*)
6723         case "$ptrsize" in
6724         4)      cat <<EOM >&4
6725
6726 *** You have chosen a maximally 64-bit build,
6727 *** but your pointers are only 4 bytes wide.
6728 *** Please rerun Configure without -Duse64bitall.
6729 EOM
6730                 case "$d_quad" in
6731                 define)
6732                         cat <<EOM >&4
6733 *** Since you have quads, you could possibly try with -Duse64bitint.
6734 EOM
6735                         ;;
6736                 esac
6737                 cat <<EOM >&4
6738 *** Cannot continue, aborting.
6739
6740 EOM
6741
6742                 exit 1
6743                 ;;
6744         esac
6745         ;;
6746 esac
6747
6748
6749 : determine whether to use malloc wrapping
6750 echo " "
6751 case "$usemallocwrap" in
6752 [yY]*|true|$define)     dflt='y' ;;
6753 [nN]*|false|$undef)     dflt='n' ;;
6754 *)      case "$usedevel" in
6755         [yY]*|true|$define)     dflt='y' ;;
6756         *) dflt='n' ;;
6757         esac
6758         ;;
6759 esac
6760 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6761 . ./myread
6762 usemallocwrap="$ans"
6763 case "$ans" in
6764 y*|true)
6765         usemallocwrap="$define" ;;
6766 *)
6767         usemallocwrap="$undef" ;;
6768 esac
6769
6770 : determine which malloc to compile in
6771 echo " "
6772 case "$usemymalloc" in
6773 [yY]*|true|$define)     dflt='y' ;;
6774 [nN]*|false|$undef)     dflt='n' ;;
6775 *)      case "$ptrsize" in
6776         4) dflt='y' ;;
6777         *) dflt='n' ;;
6778         esac
6779         if test "$useithreads" = "$define"; then dflt='n'; fi
6780         ;;
6781 esac
6782 rp="Do you wish to attempt to use the malloc that comes with $package?"
6783 . ./myread
6784 usemymalloc="$ans"
6785 case "$ans" in
6786 y*|true)
6787         usemymalloc='y'
6788         mallocsrc='malloc.c'
6789         mallocobj="malloc$_o"
6790         d_mymalloc="$define"
6791         case "$libs" in
6792         *-lmalloc*)
6793                 : Remove malloc from list of libraries to use
6794                 echo "Removing unneeded -lmalloc from library list" >&4
6795                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6796                 shift
6797                 libs="$*"
6798                 echo "libs = $libs" >&4
6799                 ;;
6800         esac
6801         ;;
6802 *)
6803         usemymalloc='n'
6804         mallocsrc=''
6805         mallocobj=''
6806         d_mymalloc="$undef"
6807         ;;
6808 esac
6809
6810 : compute the return types of malloc and free
6811 echo " "
6812 $cat >malloc.c <<END
6813 #$i_malloc I_MALLOC
6814 #$i_stdlib I_STDLIB
6815 #include <stdio.h>
6816 #include <sys/types.h>
6817 #ifdef I_MALLOC
6818 #include <malloc.h>
6819 #endif
6820 #ifdef I_STDLIB
6821 #include <stdlib.h>
6822 #endif
6823 #ifdef TRY_MALLOC
6824 void *malloc();
6825 #endif
6826 #ifdef TRY_FREE
6827 void free();
6828 #endif
6829 END
6830 case "$malloctype" in
6831 '')
6832         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6833                 malloctype='void *'
6834         else
6835                 malloctype='char *'
6836         fi
6837         ;;
6838 esac
6839 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6840
6841 case "$freetype" in
6842 '')
6843         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6844                 freetype='void'
6845         else
6846                 freetype='int'
6847         fi
6848         ;;
6849 esac
6850 echo "Your system uses $freetype free(), it would seem." >&4
6851 $rm -f malloc.[co]
6852 : determine where site specific architecture-dependent libraries go.
6853 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6854 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6855 : sitelib may have an optional trailing /share.
6856 case "$sitearch" in
6857 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6858         dflt="$dflt/$archname"
6859         ;;
6860 *)      dflt="$sitearch"
6861         ;;
6862 esac
6863 set sitearch sitearch none
6864 eval $prefixit
6865 $cat <<EOM
6866
6867 The installation process will also create a directory for
6868 architecture-dependent site-specific extensions and modules.
6869
6870 EOM
6871 fn=d~+
6872 rp='Pathname for the site-specific architecture-dependent library files?'
6873 . ./getfile
6874 prefixvar=sitearch
6875 . ./setprefixvar
6876 if $test X"$sitearch" = X"$sitelib"; then
6877         d_sitearch="$undef"
6878 else
6879         d_sitearch="$define"
6880 fi
6881
6882 : Set the vendorprefix variables
6883 $cat <<EOM
6884
6885 The installation process will also create a directory for
6886 vendor-supplied add-ons.  Vendors who supply perl with their system
6887 may find it convenient to place all vendor-supplied files in this
6888 directory rather than in the main distribution directory.  This will
6889 ease upgrades between binary-compatible maintenance versions of perl.
6890
6891 Of course you may also use these directories in whatever way you see
6892 fit.  For example, you might use them to access modules shared over a
6893 company-wide network.
6894
6895 The default answer should be fine for most people.
6896 This causes further questions about vendor add-ons to be skipped
6897 and no vendor-specific directories will be configured for perl.
6898
6899 EOM
6900 rp='Do you want to configure vendor-specific add-on directories?'
6901 case "$usevendorprefix" in
6902 define|true|[yY]*) dflt=y ;;
6903 *)      : User may have set vendorprefix directly on Configure command line.
6904         case "$vendorprefix" in
6905         ''|' ') dflt=n ;;
6906         *)      dflt=y ;;
6907         esac
6908         ;;
6909 esac
6910 . ./myread
6911 case "$ans" in
6912 [yY]*)  fn=d~+
6913         rp='Installation prefix to use for vendor-supplied add-ons?'
6914         case "$vendorprefix" in
6915         '') dflt='' ;;
6916         *)  dflt=$vendorprefix ;;
6917         esac
6918         . ./getfile
6919         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6920         oldvendorprefix=''
6921         case "$vendorprefix" in
6922         '') ;;
6923         *)      case "$ans" in
6924                 "$prefix") ;;
6925                 *) oldvendorprefix="$prefix";;
6926                 esac
6927                 ;;
6928         esac
6929         usevendorprefix="$define"
6930         vendorprefix="$ans"
6931         vendorprefixexp="$ansexp"
6932         ;;
6933 *)      usevendorprefix="$undef"
6934         vendorprefix=''
6935         vendorprefixexp=''
6936         ;;
6937 esac
6938
6939 : Set the vendorlib variables
6940 case "$vendorprefix" in
6941 '')     d_vendorlib="$undef"
6942         vendorlib=''
6943         vendorlibexp=''
6944         ;;
6945 *)      d_vendorlib="$define"
6946         : determine where vendor-supplied modules go.
6947         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6948         case "$vendorlib" in
6949         '')
6950                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6951                 case "$installstyle" in
6952                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6953                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6954                 esac
6955                 ;;
6956         *)      dflt="$vendorlib"
6957                 ;;
6958         esac
6959         fn=d~+
6960         rp='Pathname for the vendor-supplied library files?'
6961         . ./getfile
6962         vendorlib="$ans"
6963         vendorlibexp="$ansexp"
6964         ;;
6965 esac
6966 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6967 prefixvar=vendorlib
6968 . ./installprefix
6969
6970 : Set the vendorarch variables
6971 case "$vendorprefix" in
6972 '')     d_vendorarch="$undef"
6973         vendorarch=''
6974         vendorarchexp=''
6975         ;;
6976 *)      d_vendorarch="$define"
6977         : determine where vendor-supplied architecture-dependent libraries go.
6978         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6979         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6980         : vendorlib may have an optional trailing /share.
6981         case "$vendorarch" in
6982         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6983                 dflt="$dflt/$archname"
6984                 ;;
6985         *)      dflt="$vendorarch" ;;
6986         esac
6987         fn=d~+
6988         rp='Pathname for vendor-supplied architecture-dependent files?'
6989         . ./getfile
6990         vendorarch="$ans"
6991         vendorarchexp="$ansexp"
6992         ;;
6993 esac
6994 prefixvar=vendorarch
6995 . ./installprefix
6996 if $test X"$vendorarch" = X"$vendorlib"; then
6997         d_vendorarch="$undef"
6998 else
6999         d_vendorarch="$define"
7000 fi
7001
7002 : Final catch-all directories to search
7003 $cat <<EOM
7004
7005 Lastly, you can have perl look in other directories for extensions and
7006 modules in addition to those already specified.
7007 These directories will be searched after 
7008         $sitearch 
7009         $sitelib 
7010 EOM
7011 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7012 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7013 echo ' '
7014 case "$otherlibdirs" in
7015 ''|' ') dflt='none' ;;
7016 *)      dflt="$otherlibdirs" ;;
7017 esac
7018 $cat <<EOM
7019 Enter a colon-separated set of extra paths to include in perl's @INC
7020 search path, or enter 'none' for no extra paths.
7021
7022 EOM
7023
7024 rp='Colon-separated list of additional directories for perl to search?'
7025 . ./myread
7026 case "$ans" in
7027 ' '|''|none)    otherlibdirs=' ' ;;     
7028 *)      otherlibdirs="$ans" ;;
7029 esac
7030 case "$otherlibdirs" in
7031 ' ') val=$undef ;;
7032 *)      val=$define ;;
7033 esac
7034 set d_perl_otherlibdirs
7035 eval $setvar
7036
7037 : Cruising for prototypes
7038 echo " "
7039 echo "Checking out function prototypes..." >&4
7040 $cat >prototype.c <<EOCP
7041 #$i_stdlib I_STDLIB
7042 #ifdef I_STDLIB
7043 #include <stdlib.h>
7044 #endif
7045 int main(int argc, char *argv[]) {
7046         exit(0);}
7047 EOCP
7048 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7049         echo "Your C compiler appears to support function prototypes."
7050         val="$define"
7051 else
7052         echo "Your C compiler doesn't seem to understand function prototypes."
7053         val="$undef"
7054 fi
7055 set prototype
7056 eval $setvar
7057 $rm -f prototype*
7058
7059 : Check if ansi2knr is required
7060 case "$prototype" in
7061 "$define") ;;
7062 *)      ansi2knr='ansi2knr'
7063         echo " "
7064         cat <<EOM >&4
7065
7066 $me:  FATAL ERROR:
7067 This version of $package can only be compiled by a compiler that 
7068 understands function prototypes.  Unfortunately, your C compiler 
7069         $cc $ccflags
7070 doesn't seem to understand them.  Sorry about that.
7071
7072 If GNU cc is available for your system, perhaps you could try that instead.  
7073
7074 Eventually, we hope to support building Perl with pre-ANSI compilers.
7075 If you would like to help in that effort, please contact <perlbug@perl.org>.
7076
7077 Aborting Configure now.
7078 EOM
7079         exit 2
7080         ;;
7081 esac
7082
7083 : DTrace support
7084 dflt_dtrace='/usr/sbin/dtrace'
7085 $test -x /usr/bin/dtrace && dflt_dtrace='/usr/bin/dtrace'
7086
7087 cat <<EOM
7088
7089 Perl can be built to support DTrace on platforms that support it.
7090 DTrace is a diagnosis and performance analysis tool from Sun.
7091
7092 If this doesn't make any sense to you, just accept the default '$dflt'.
7093 EOM
7094
7095 while $test 1 ; do
7096         case "$usedtrace" in
7097         $define|true|[yY]*)
7098                 dflt='y'
7099                 ;;
7100         ?*)
7101                 dflt='y'
7102                 dflt_dtrace=$usedtrace
7103                 ;;
7104         *)
7105                 dflt='n'
7106                 ;;
7107         esac
7108
7109         rp='Support DTrace if available?'
7110         . ./myread
7111         case "$ans" in
7112         y|Y)    val="$define" ;;
7113         *)      val="$undef" ;;
7114         esac
7115         set usedtrace
7116         eval $setvar
7117
7118         test "X$usedtrace" != "X$define" && break
7119
7120         echo " "
7121         rp='Where is the dtrace executable?'
7122         dflt=$dflt_dtrace
7123         . ./getfile
7124         val="$ans"
7125         set dtrace
7126         eval $setvar
7127
7128         if $test -f $dtrace
7129         then
7130                 if $dtrace -h -s ../perldtrace.d \
7131                         -o perldtrace.tmp >/dev/null 2>&1 \
7132                         && rm -f perldtrace.tmp
7133                 then
7134                         echo " "
7135                         echo "Good: your $dtrace knows about the -h flag."
7136                 else
7137                         cat >&2 <<EOM
7138
7139 *** $me:  Fatal Error:  $dtrace doesn't support -h flag
7140 ***
7141 *** Your installed dtrace doesn't support the -h switch to compile a D
7142 *** program into a C header. Can't continue.
7143
7144 EOM
7145                         exit 1
7146                 fi
7147                 break;
7148         fi
7149
7150         case "$fastread" in
7151         yes)
7152                 cat >&2 <<EOM
7153
7154 *** $me:  Fatal Error:  $dtrace not found.
7155 *** Can't continue.
7156
7157 EOM
7158                 exit 1
7159                 ;;
7160         *)
7161                 echo "*** $dtrace was not found."
7162                 echo " "
7163                 ;;
7164         esac
7165 done
7166
7167 : See if we want extra modules installed
7168 echo " "
7169 case "$extras" in
7170 '') dflt='n';;
7171 *) dflt='y';;
7172 esac
7173 cat <<EOM
7174 Perl can be built with extra modules or bundles of modules which
7175 will be fetched from the CPAN and installed alongside Perl.
7176
7177 Notice that you will need access to the CPAN; either via the Internet,
7178 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7179 be asked later to configure the CPAN.pm module which will in turn do
7180 the installation of the rest of the extra modules or bundles.)
7181
7182 Notice also that if the modules require any external software such as
7183 libraries and headers (the libz library and the zlib.h header for the
7184 Compress::Zlib module, for example) you MUST have any such software
7185 already installed, this configuration process will NOT install such
7186 things for you.
7187
7188 If this doesn't make any sense to you, just accept the default '$dflt'.
7189 EOM
7190 rp='Install any extra modules (y or n)?'
7191 . ./myread
7192 case "$ans" in
7193 y|Y)
7194         cat <<EOM
7195
7196 Please list any extra modules or bundles to be installed from CPAN,
7197 with spaces between the names.  The names can be in any format the
7198 'install' command of CPAN.pm will understand.  (Answer 'none',
7199 without the quotes, to install no extra modules or bundles.)
7200 EOM
7201         rp='Extras?'
7202         dflt="$extras"
7203         . ./myread
7204         extras="$ans"
7205 esac
7206 case "$extras" in
7207 ''|'none')
7208         val=''
7209         $rm -f ../extras.lst
7210         ;;
7211 *)      echo "(Saving the list of extras for later...)"
7212         echo "$extras" > ../extras.lst
7213         val="'$extras'"
7214         ;;
7215 esac
7216 set extras
7217 eval $setvar
7218 echo " "
7219
7220 : determine where html pages for programs go
7221 set html1dir html1dir none
7222 eval $prefixit
7223 $cat <<EOM
7224
7225 If you wish to install html files for programs in $spackage, indicate
7226 the appropriate directory here.  To skip installing html files,
7227 answer "none".
7228 EOM
7229 case "$html1dir" in
7230 ''|none|$undef|' ') dflt=none ;;
7231 *) dflt=$html1dir ;;
7232 esac
7233 fn=dn+~
7234 rp="Directory for the main $spackage html pages?"
7235 . ./getfile
7236 prefixvar=html1dir
7237 . ./setprefixvar
7238 : Use ' ' for none so value is preserved next time through Configure
7239 $test X"$html1dir" = "X" && html1dir=' '
7240
7241 : determine where html pages for libraries and modules go
7242 set html3dir html3dir none
7243 eval $prefixit
7244 $cat <<EOM
7245
7246 If you wish to install html files for modules associated with $spackage,
7247 indicate the appropriate directory here.  To skip installing html files,
7248 answer "none".
7249 EOM
7250 : There is no obvious default.  If they have specified html1dir, then
7251 : try to key off that, possibly changing .../html1 into .../html3.
7252 case "$html3dir" in
7253 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7254 *) dflt=$html3dir ;;
7255 esac
7256 fn=dn+~
7257 rp="Directory for the $spackage module html pages?"
7258 . ./getfile
7259 prefixvar=html3dir
7260 . ./setprefixvar
7261 : Use ' ' for none so value is preserved next time through Configure
7262 $test X"$html3dir" = "X" && html3dir=' '
7263
7264 : determine whether to install perl also as /usr/bin/perl
7265
7266 echo " "
7267 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7268         $cat <<EOM
7269 Many scripts expect perl to be installed as /usr/bin/perl.
7270
7271 If you want to, I can install the perl you are about to compile
7272 as /usr/bin/perl (in addition to $bin/perl).
7273 EOM
7274         if test -f /usr/bin/perl; then
7275             $cat <<EOM
7276
7277 However, please note that because you already have a /usr/bin/perl,
7278 overwriting that with a new Perl would very probably cause problems.
7279 Therefore I'm assuming you don't want to do that (unless you insist).
7280
7281 EOM
7282             case "$installusrbinperl" in
7283             "$define"|[yY]*)    dflt='y';;
7284             *)                  dflt='n';;
7285             esac
7286         else
7287             $cat <<EOM
7288
7289 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7290
7291 EOM
7292             case "$installusrbinperl" in
7293             "$undef"|[nN]*)     dflt='n';;
7294             *)                  dflt='y';;
7295             esac
7296         fi
7297         rp="Do you want to install perl as /usr/bin/perl?"
7298         . ./myread
7299         case "$ans" in
7300         [yY]*)  val="$define";;
7301         *)      val="$undef" ;;
7302         esac
7303 else
7304         val="$undef"
7305 fi
7306 set installusrbinperl
7307 eval $setvar
7308
7309 : Check if we are using the GNU C library
7310 echo " "
7311 echo "Checking for GNU C Library..." >&4
7312 cat >try.c <<'EOCP'
7313 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7314    alone are insufficient to distinguish different versions, such as
7315    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7316    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7317 */
7318 #include <stdio.h>
7319 int main(void)
7320 {
7321 #ifdef __GLIBC__
7322 #   ifdef __GLIBC_MINOR__
7323 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7324 #           include <gnu/libc-version.h>
7325             printf("%s\n",  gnu_get_libc_version());
7326 #       else
7327             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7328 #       endif
7329 #   else
7330         printf("%d\n",  __GLIBC__);
7331 #   endif
7332     return 0;
7333 #else
7334     return 1;
7335 #endif
7336 }
7337 EOCP
7338 set try
7339 if eval $compile_ok && $run ./try > glibc.ver; then
7340         val="$define"
7341         gnulibc_version=`$cat glibc.ver`
7342         echo "You are using the GNU C Library version $gnulibc_version"
7343 else
7344         val="$undef"
7345         gnulibc_version=''
7346         echo "You are not using the GNU C Library"
7347 fi
7348 $rm_try glibc.ver
7349 set d_gnulibc
7350 eval $setvar
7351
7352 : see if nm is to be used to determine whether a symbol is defined or not
7353 case "$usenm" in
7354 '')
7355         dflt=''
7356         case "$d_gnulibc" in
7357         "$define")
7358                 echo " "
7359                 echo "nm probably won't work on the GNU C Library." >&4
7360                 dflt=n
7361                 ;;
7362         esac
7363         case "$dflt" in
7364         '') 
7365                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7366                         echo " "
7367                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7368                         echo "'nm' won't be sufficient on this sytem." >&4
7369                         dflt=n
7370                 fi
7371                 ;;
7372         esac
7373         case "$dflt" in
7374         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7375                 if $test $dflt -gt 20; then
7376                         dflt=y
7377                 else
7378                         dflt=n
7379                 fi
7380                 ;;
7381         esac
7382         ;;
7383 *)
7384         case "$usenm" in
7385         true|$define) dflt=y;;
7386         *) dflt=n;;
7387         esac
7388         ;;
7389 esac
7390 $cat <<EOM
7391
7392 I can use $nm to extract the symbols from your C libraries. This
7393 is a time consuming task which may generate huge output on the disk (up
7394 to 3 megabytes) but that should make the symbols extraction faster. The
7395 alternative is to skip the 'nm' extraction part and to compile a small
7396 test program instead to determine whether each symbol is present. If
7397 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7398 this may be the best solution.
7399
7400 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7401
7402 EOM
7403 rp="Shall I use $nm to extract C symbols from the libraries?"
7404 . ./myread
7405 case "$ans" in
7406 [Nn]*) usenm=false;;
7407 *) usenm=true;;
7408 esac
7409
7410 runnm=$usenm
7411 case "$reuseval" in
7412 true) runnm=false;;
7413 esac
7414
7415 : nm options which may be necessary
7416 case "$nm_opt" in
7417 '') if $test -f /mach_boot; then
7418                 nm_opt=''       # Mach
7419         elif $test -d /usr/ccs/lib; then
7420                 nm_opt='-p'     # Solaris (and SunOS?)
7421         elif $test -f /dgux; then
7422                 nm_opt='-p'     # DG-UX
7423         elif $test -f /lib64/rld; then
7424                 nm_opt='-p'     # 64-bit Irix
7425         else
7426                 nm_opt=''
7427         fi;;
7428 esac
7429
7430 : nm options which may be necessary for shared libraries but illegal
7431 : for archive libraries.  Thank you, Linux.
7432 case "$nm_so_opt" in
7433 '')     case "$myuname" in
7434         *linux*|gnu*)
7435                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7436                         nm_so_opt='--dynamic'
7437                 fi
7438                 ;;
7439         esac
7440         ;;
7441 esac
7442
7443 : Figure out where the libc is located
7444 case "$runnm" in
7445 true)
7446 : get list of predefined functions in a handy place
7447 echo " "
7448 case "$libc" in
7449 '') libc=unknown
7450         case "$libs" in
7451         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7452         esac
7453         ;;
7454 esac
7455 case "$libs" in
7456 '') ;;
7457 *)  for thislib in $libs; do
7458         case "$thislib" in
7459         -lc|-lc_s)
7460                 : Handle C library specially below.
7461                 ;;
7462         -l*)
7463                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7464                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7465                         :
7466                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7467                         :
7468                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7469                         :
7470                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7471                         :
7472                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7473                         :
7474                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7475                         :
7476                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7477                         :
7478                 else
7479                         try=''
7480                 fi
7481                 libnames="$libnames $try"
7482                 ;;
7483         *) libnames="$libnames $thislib" ;;
7484         esac
7485         done
7486         ;;
7487 esac
7488 xxx=normal
7489 case "$libc" in
7490 unknown)
7491         set /lib/libc.$so
7492         for xxx in $libpth; do
7493                 $test -r $1 || set $xxx/libc.$so
7494                 : The messy sed command sorts on library version numbers.
7495                 $test -r $1 || \
7496                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7497                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7498                                 h
7499                                 s/[0-9][0-9]*/0000&/g
7500                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7501                                 G
7502                                 s/\n/ /' | \
7503                          $sort | $sed -e 's/^.* //'`
7504                 eval set \$$#
7505         done
7506         $test -r $1 || set /usr/ccs/lib/libc.$so
7507         $test -r $1 || set /lib/libsys_s$_a
7508         ;;
7509 *)
7510         set blurfl
7511         ;;
7512 esac
7513 if $test -r "$1"; then
7514         echo "Your (shared) C library seems to be in $1."
7515         libc="$1"
7516 elif $test -r /lib/libc && $test -r /lib/clib; then
7517         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7518         xxx=apollo
7519         libc='/lib/clib /lib/libc'
7520         if $test -r /lib/syslib; then
7521                 echo "(Your math library is in /lib/syslib.)"
7522                 libc="$libc /lib/syslib"
7523         fi
7524 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7525         echo "Your C library seems to be in $libc, as you said before."
7526 elif $test -r $incpath/usr/lib/libc$_a; then
7527         libc=$incpath/usr/lib/libc$_a;
7528         echo "Your C library seems to be in $libc.  That's fine."
7529 elif $test -r /lib/libc$_a; then
7530         libc=/lib/libc$_a;
7531         echo "Your C library seems to be in $libc.  You're normal."
7532 else
7533         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7534                 :
7535         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7536                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7537         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7538                 :
7539         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7540                 :
7541         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7542                 :
7543         else
7544                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7545         fi
7546         if $test -r "$tans"; then
7547                 echo "Your C library seems to be in $tans, of all places."
7548                 libc=$tans
7549         else
7550                 libc='blurfl'
7551         fi
7552 fi
7553 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7554         dflt="$libc"
7555         cat <<EOM
7556
7557 If the guess above is wrong (which it might be if you're using a strange
7558 compiler, or your machine supports multiple models), you can override it here.
7559
7560 EOM
7561 else
7562         dflt=''
7563         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7564         cat >&4 <<EOM
7565 I can't seem to find your C library.  I've looked in the following places:
7566
7567 EOM
7568         $sed 's/^/      /' libpath
7569         cat <<EOM
7570
7571 None of these seems to contain your C library. I need to get its name...
7572
7573 EOM
7574 fi
7575 fn=f
7576 rp='Where is your C library?'
7577 . ./getfile
7578 libc="$ans"
7579
7580 echo " "
7581 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7582 set X `cat libnames`
7583 shift
7584 xxx=files
7585 case $# in 1) xxx=file; esac
7586 echo "Extracting names from the following $xxx for later perusal:" >&4
7587 echo " "
7588 $sed 's/^/      /' libnames >&4
7589 echo " "
7590 $echo $n "This may take a while...$c" >&4
7591
7592 for file in $*; do
7593         case $file in
7594         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7595         *) $nm $nm_opt $file 2>/dev/null;;
7596         esac
7597 done >libc.tmp
7598
7599 $echo $n ".$c"
7600 $grep fprintf libc.tmp > libc.ptf
7601 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7602 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7603 xxx='[ADTSIWi]'
7604 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7605         eval $xscan;\
7606         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7607                 eval $xrun
7608 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7609         eval $xscan;\
7610         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7611                 eval $xrun
7612 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7613         eval $xscan;\
7614         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7615                 eval $xrun
7616 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7617         eval $xscan;\
7618         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7619                 eval $xrun
7620 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7621         eval $xscan;\
7622         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7623                 eval $xrun
7624 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7625         eval $xscan;\
7626         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7627                 eval $xrun
7628 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7629                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7630         eval $xscan;\
7631         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7632                 eval $xrun
7633 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7634         eval $xscan;\
7635         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7636                 eval $xrun
7637 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7638         eval $xscan;\
7639         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7640                 eval $xrun
7641 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7642         eval $xscan;\
7643         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7644                 eval $xrun
7645 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7646         eval $xscan;\
7647         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7648                 eval $xrun
7649 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7650         eval $xscan;\
7651         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7652                 eval $xrun
7653 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7654         eval $xscan;\
7655         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7656                 eval $xrun
7657 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7658         eval $xscan;\
7659         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7660                 eval $xrun
7661 else
7662         $nm -p $* 2>/dev/null >libc.tmp
7663         $grep fprintf libc.tmp > libc.ptf
7664         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7665                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7666         then
7667                 nm_opt='-p'
7668                 eval $xrun
7669         else
7670                 echo " "
7671                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7672                 com=''
7673                 if $ar t $libc > libc.tmp && \
7674                         $contains '^fprintf$' libc.tmp >/dev/null 2>&1
7675                 then
7676                         for thisname in $libnames $libc; do
7677                                 $ar t $thisname >>libc.tmp
7678                         done
7679                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7680                         echo "Ok." >&4
7681                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7682                         for thisname in $libnames $libc; do
7683                                 $ar tv $thisname >>libc.tmp
7684                                 emximp -o tmp.imp $thisname \
7685                                     2>/dev/null && \
7686                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7687                                     < tmp.imp >>libc.tmp
7688                                 $rm -f tmp.imp
7689                         done
7690                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7691                         echo "Ok." >&4
7692                 else
7693                         echo "$ar didn't seem to work right." >&4
7694                         echo "Maybe this is a Cray...trying bld instead..." >&4
7695                         if  bld t $libc | \
7696                                 $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list &&
7697                                 $test -s libc.list
7698                         then
7699                                 for thisname in $libnames; do
7700                                         bld t $libnames | \
7701                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7702                                         $ar t $thisname >>libc.tmp
7703                                 done
7704                                 echo "Ok." >&4
7705                         else
7706                                 echo "That didn't work either.  Giving up." >&4
7707                                 exit 1
7708                         fi
7709                 fi
7710         fi
7711 fi
7712 nm_extract="$com"
7713 case "$PASE" in
7714 define)
7715     echo " "
7716     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7717     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7718     ;;
7719 *)  if $test -f /lib/syscalls.exp; then
7720         echo " "
7721         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7722         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' \
7723                 /lib/syscalls.exp >>libc.list
7724     fi
7725     ;;
7726 esac
7727 ;;
7728 esac
7729 $rm -f libnames libpath
7730
7731 : see if dld is available
7732 set dld.h i_dld
7733 eval $inhdr
7734
7735 : Check if we are using C++
7736 echo " "
7737 echo "Checking for C++..." >&4
7738 $cat >try.c <<'EOCP'
7739 #include <stdio.h>
7740 int main(void)
7741 {
7742 #ifdef __cplusplus
7743     return 0;
7744 #else
7745     return 1;
7746 #endif
7747 }
7748 EOCP
7749 set try
7750 if eval $compile_ok && $run ./try; then
7751         val="$define"
7752         echo "You are using a C++ compiler."
7753 else
7754         val="$undef"
7755         echo "You are not using a C++ compiler."
7756 fi
7757 $rm_try cplusplus$$
7758 set d_cplusplus
7759 eval $setvar
7760
7761 : is a C symbol defined?
7762 csym='tlook=$1;
7763 case "$3" in
7764 -v) tf=libc.tmp; tdc="";;
7765 -a) tf=libc.tmp; tdc="[]";;
7766 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7767 esac;
7768 case "$d_cplusplus" in
7769     $define)    extern_C="extern \"C\"" ;;
7770     *)          extern_C="extern"       ;;
7771 esac;
7772 tx=yes;
7773 case "$reuseval-$4" in
7774 true-) ;;
7775 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7776 esac;
7777 case "$tx" in
7778 yes)
7779         tval=false;
7780         if $test "$runnm" = true; then
7781                 if $contains $tlook $tf >/dev/null 2>&1; then
7782                         tval=true;
7783                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7784                         echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7785                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7786                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7787                         $rm_try;
7788                 fi;
7789         else
7790                 echo "$extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7791                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7792                 $rm_try;
7793         fi;
7794         ;;
7795 *)
7796         case "$tval" in
7797         $define) tval=true;;
7798         *) tval=false;;
7799         esac;
7800         ;;
7801 esac;
7802 eval "$2=$tval"'
7803
7804 : define an is-in-libc? function
7805 inlibc='echo " "; td=$define; tu=$undef;
7806 sym=$1; var=$2; eval "was=\$$2";
7807 tx=yes;
7808 case "$reuseval$was" in
7809 true) ;;
7810 true*) tx=no;;
7811 esac;
7812 case "$tx" in
7813 yes)
7814         set $sym tres -f;
7815         eval $csym;
7816         case "$tres" in
7817         true)
7818                 echo "$sym() found." >&4;
7819                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7820         *)
7821                 echo "$sym() NOT found." >&4;
7822                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7823         esac;;
7824 *)
7825         case "$was" in
7826         $define) echo "$sym() found." >&4;;
7827         *) echo "$sym() NOT found." >&4;;
7828         esac;;
7829 esac'
7830
7831 : see if dlopen exists
7832 xxx_runnm="$runnm"
7833 xxx_ccflags="$ccflags"
7834 runnm=false
7835 : with g++ one needs -shared to get is-in-libc to work for dlopen
7836 case "$gccversion" in
7837 '')     ;;
7838 *)      case "$d_cplusplus" in
7839         "$define") ccflags="$ccflags -shared" ;;
7840         esac
7841         ;;
7842 esac
7843 set dlopen d_dlopen
7844 eval $inlibc
7845 runnm="$xxx_runnm"
7846 ccflags="$xxx_ccflags"
7847
7848 : see if this is a unistd.h system
7849 set unistd.h i_unistd
7850 eval $inhdr
7851
7852 : determine which dynamic loading, if any, to compile in
7853 echo " "
7854 dldir="ext/DynaLoader"
7855 case "$usedl" in
7856 $define|y|true)
7857         dflt='y'
7858         usedl="$define"
7859         ;;
7860 $undef|n|false)
7861         dflt='n'
7862         usedl="$undef"
7863         ;;
7864 *)
7865         dflt='n'
7866         case "$d_dlopen" in
7867             $define) dflt='y' ;;
7868         esac
7869         case "$i_dld" in
7870             $define) dflt='y' ;;
7871         esac
7872         : Does a dl_xxx.xs file exist for this operating system
7873         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7874         ;;
7875 esac
7876 rp="Do you wish to use dynamic loading?"
7877 . ./myread
7878 usedl="$ans"
7879 bin_ELF="$undef"
7880 case "$ans" in
7881 y*) usedl="$define"
7882         case "$dlsrc" in
7883         '')
7884                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7885                         dflt="$dldir/dl_${osname}.xs"
7886                 elif $test "$d_dlopen" = "$define" ; then
7887                         dflt="$dldir/dl_dlopen.xs"
7888                 elif $test "$i_dld" = "$define" ; then
7889                         dflt="$dldir/dl_dld.xs"
7890                 else
7891                         dflt=''
7892                 fi
7893                 ;;
7894         *)      dflt="$dldir/$dlsrc"
7895                 ;;
7896         esac
7897     echo "The following dynamic loading files are available:"
7898         : Can not go over to $dldir because getfile has path hard-coded in.
7899         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7900         rp="Source file to use for dynamic loading"
7901         fn="fne"
7902         gfpth="$src"
7903         . ./getfile
7904         usedl="$define"
7905         : emulate basename
7906         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7907
7908         $cat << EOM
7909
7910 Some systems may require passing special flags to $cc -c to
7911 compile modules that will be used to create a shared library.
7912 To use no flags, say "none".
7913
7914 EOM
7915     case "$cccdlflags" in
7916     '') case "$gccversion" in
7917                 '') case "$osname" in
7918                         hpux)   dflt='+z' ;;
7919                         next)   dflt='none' ;;
7920                         irix*)  dflt='-KPIC' ;;
7921                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7922                         sunos)  dflt='-pic' ;;
7923                         *)      dflt='none' ;;
7924                     esac
7925                         ;;
7926                 *)  case "$osname" in
7927                         darwin) dflt='none' ;;
7928                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7929                         *)      dflt='-fpic' ;;
7930                     esac ;;
7931             esac ;;
7932         ' ') dflt='none' ;;
7933     *)  dflt="$cccdlflags" ;;
7934     esac
7935     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7936     . ./myread
7937     case "$ans" in
7938     none) cccdlflags=' ' ;;
7939     *) cccdlflags="$ans" ;;
7940     esac
7941
7942     cat << EOM
7943
7944 Some systems use ld to create libraries that can be dynamically loaded,
7945 while other systems (such as those using ELF) use $cc.
7946
7947 EOM
7948         case "$ld" in
7949         '')     $cat >try.c <<EOM
7950 /* Test for whether ELF binaries are produced */
7951 #include <fcntl.h>
7952 #$i_stdlib I_STDLIB
7953 #ifdef I_STDLIB
7954 #include <stdlib.h>
7955 #endif
7956 #$i_unistd I_UNISTD
7957 #ifdef I_UNISTD
7958 #include <unistd.h>
7959 #endif
7960 int main() {
7961         char b[4];
7962         int i = open("a.out",O_RDONLY);
7963         if(i == -1)
7964                 exit(1); /* fail */
7965         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7966                 exit(0); /* succeed (yes, it's ELF) */
7967         else
7968                 exit(1); /* fail */
7969 }
7970 EOM
7971                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7972                         cat <<EOM
7973 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7974 EOM
7975                         dflt="$cc"
7976                         bin_ELF="$define"
7977                 else
7978                         echo "I'll use ld to build dynamic libraries."
7979                         dflt='ld'
7980                 fi
7981                 $rm_try
7982                 ;;
7983         *)      dflt="$ld"
7984                 ;;
7985         esac
7986
7987     rp="What command should be used to create dynamic libraries?"
7988     . ./myread
7989         ld="$ans"
7990
7991     cat << EOM
7992
7993 Some systems may require passing special flags to $ld to create a
7994 library that can be dynamically loaded.  If your ld flags include
7995 -L/other/path options to locate libraries outside your loader's normal
7996 search path, you may need to specify those -L options here as well.  To
7997 use no flags, say "none".
7998
7999 EOM
8000     case "$lddlflags" in
8001     '') case "$osname" in
8002                         beos) dflt='-nostart' ;;
8003                         haiku) dflt='-shared' ;;
8004                         hpux) dflt='-b';
8005                               case "$gccversion" in
8006                               '') dflt="$dflt +vnocompatwarnings" ;;
8007                               esac
8008                               ;;
8009                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
8010                         next)  dflt='none' ;;
8011                         solaris) dflt='-G' ;;
8012                         sunos) dflt='-assert nodefinitions' ;;
8013                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
8014                 *)     dflt='none' ;;
8015                         esac
8016                         ;;
8017     *) dflt="$lddlflags" ;;
8018     esac
8019
8020         : Try to guess additional flags to pick up local libraries.
8021         : Be careful not to append to a plain 'none'
8022         case "$dflt" in
8023         none) dflt='' ;;
8024         esac
8025         for thisflag in $ldflags; do
8026                 case "$thisflag" in
8027                 -L*|-R*|-Wl,-R*)
8028                         case " $dflt " in
8029                         *" $thisflag "*) ;;
8030                         *) dflt="$dflt $thisflag" ;;
8031                         esac
8032                         ;;
8033                 esac
8034         done
8035
8036         case "$dflt" in
8037         ''|' ') dflt='none' ;;
8038         esac
8039
8040         case "$ldflags" in
8041         *-fstack-protector*)
8042             case "$dflt" in
8043                         *-fstack-protector*) ;; # Don't add it again
8044                         *) dflt="$dflt -fstack-protector" ;; 
8045                 esac
8046                 ;;
8047         esac
8048
8049
8050     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
8051     . ./myread
8052     case "$ans" in
8053     none) lddlflags=' ' ;;
8054     *) lddlflags="$ans" ;;
8055     esac
8056
8057         cat <<EOM
8058
8059 Some systems may require passing special flags to $cc to indicate that
8060 the resulting executable will use dynamic linking.  To use no flags,
8061 say "none".
8062
8063 EOM
8064     case "$ccdlflags" in
8065     '') case "$osname" in
8066             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
8067             next|sunos) dflt='none' ;;
8068             *)          dflt='none' ;;
8069             esac ;;
8070     ' ')  dflt='none' ;;
8071     *)  dflt="$ccdlflags" ;;
8072     esac
8073     rp="Any special flags to pass to $cc to use dynamic linking?"
8074     . ./myread
8075     case "$ans" in
8076     none) ccdlflags=' ' ;;
8077     *) ccdlflags="$ans" ;;
8078     esac
8079     ;;
8080 *)  usedl="$undef"
8081         ld='ld'
8082     dlsrc='dl_none.xs'
8083     lddlflags=''
8084     ccdlflags=''
8085     ;;
8086 esac
8087
8088 : Do we want a shared libperl?
8089 also=''
8090 case "$usedl" in
8091 $undef)
8092         # No dynamic loading being used, so don't bother even to prompt.
8093         useshrplib='false'
8094         ;;
8095 *)      case "$useshrplib" in
8096         '')     case "$osname" in
8097                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|haiku|cygwin*)
8098                         dflt=y
8099                         also='Building a shared libperl is required for dynamic loading to work on your system.'
8100                         ;;
8101                 next*)
8102                         case "$osvers" in
8103                         4*)     dflt=y
8104                                 also='Building a shared libperl is needed for MAB support.'
8105                                 ;;
8106                         *)      dflt=n
8107                                 ;;
8108                         esac
8109                         ;;
8110                 *)      dflt=n
8111                         ;;
8112                 esac
8113                 ;;
8114         $define|true|[Yy]*)
8115                 dflt=y
8116                 ;;
8117         *)      dflt=n
8118                 ;;
8119         esac
8120         $cat << EOM
8121
8122 The perl executable is normally obtained by linking perlmain.c with
8123 libperl${_a}, any static extensions (usually just DynaLoader), and
8124 any other libraries needed on this system (such as -lm, etc.).  Since
8125 your system supports dynamic loading, it is probably possible to build
8126 a shared libperl.$so.  If you will have more than one executable linked
8127 to libperl.$so, this will significantly reduce the size of each
8128 executable, but it may have a noticeable effect on performance.  The
8129 default is probably sensible for your system.
8130 $also
8131
8132 EOM
8133         rp="Build a shared libperl.$so (y/n)"
8134         . ./myread
8135         case "$ans" in
8136         true|$define|[Yy]*)
8137                 useshrplib='true'  ;;
8138         *)      useshrplib='false' ;;
8139         esac
8140         ;;
8141 esac
8142
8143 case "$useshrplib" in
8144 true)
8145         case "$userelocatableinc" in
8146         true|define)
8147                 echo "Cannot build with both -Duserelocatableinc and -Duseshrplib" >&4
8148                 echo "See INSTALL for an explanation why that won't work." >&4
8149                 exit 4
8150                 ;;
8151         esac
8152         case "$libperl" in
8153         '')
8154                 # Figure out a good name for libperl.so.  Since it gets stored in
8155                 # a version-specific architecture-dependent library, the version
8156                 # number isn't really that important, except for making cc/ld happy.
8157                 #
8158                 # A name such as libperl.so.10.1
8159                 majmin="libperl.$so.$patchlevel.$subversion"
8160                 # A name such as libperl.so.100
8161                 majonly=`echo $patchlevel $subversion |
8162                         $awk '{printf "%d%02d", $1, $2}'`
8163                 majonly=libperl.$so.$majonly
8164                 # I'd prefer to keep the os-specific stuff here to a minimum, and
8165                 # rely on figuring it out from the naming of libc.
8166                 case "${osname}${osvers}" in
8167                 next4*)
8168                         dflt=libperl.5.$so
8169                         # XXX How handle the --version stuff for MAB?
8170                         ;;
8171                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8172                         dflt=libperl.$so
8173                         ;;
8174                 cygwin*) # ld links now against the dll directly
8175                         majmin="cygperl5_${patchlevel}_${subversion}.${so}"
8176                         majonly=`echo $patchlevel $subversion |
8177                                 $awk '{printf "%03d%03d", $1, $2}'`
8178                         majonly=cygperl5.$majonly.$so
8179                         dflt=$majmin
8180                         ;;
8181                 *)      # Try to guess based on whether libc has major.minor.
8182                         case "$libc" in
8183                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8184                         *libc.$so.[0-9]*) dflt=$majonly ;;
8185                         *)      dflt=libperl.$so ;;
8186                         esac
8187                         ;;
8188                 esac
8189                 ;;
8190         *)      dflt=$libperl
8191                 ;;
8192         esac
8193         cat << EOM
8194
8195 I need to select a good name for the shared libperl.  If your system uses
8196 library names with major and minor numbers, then you might want something
8197 like $majmin.  Alternatively, if your system uses a single version
8198 number for shared libraries, then you might want to use $majonly.
8199 Or, your system might be quite happy with a simple libperl.$so.
8200
8201 Since the shared libperl will get installed into a version-specific
8202 architecture-dependent directory, the version number of the shared perl
8203 library probably isn't important, so the default should be o.k.
8204
8205 EOM
8206         rp='What name do you want to give to the shared libperl?'
8207         . ./myread
8208         libperl=$ans
8209         echo "Ok, I'll use $libperl"
8210         ;;
8211 *)
8212         libperl="libperl${_a}"
8213         ;;
8214 esac
8215
8216 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8217 case "$shrpdir" in
8218 '') ;;
8219 *)      $cat >&4 <<EOM
8220 WARNING:  Use of the shrpdir variable for the installation location of
8221 the shared $libperl is not supported.  It was never documented and
8222 will not work in this version.  Let me (perlbug@perl.org)
8223 know of any problems this may cause.
8224
8225 EOM
8226         case "$shrpdir" in
8227         "$archlibexp/CORE")
8228                 $cat >&4 <<EOM
8229 But your current setting of $shrpdir is
8230 the default anyway, so it's harmless.
8231 EOM
8232                 ;;
8233         *)
8234                 $cat >&4 <<EOM
8235 Further, your current attempted setting of $shrpdir
8236 conflicts with the value of $archlibexp/CORE
8237 that installperl will use.
8238 EOM
8239                 ;;
8240         esac
8241         ;;
8242 esac
8243
8244 # How will the perl executable find the installed shared $libperl?
8245 # Add $xxx to ccdlflags.
8246 # If we can't figure out a command-line option, use $shrpenv to
8247 # set env LD_RUN_PATH.  The main perl makefile uses this.
8248 shrpdir=$archlibexp/CORE
8249 xxx=''
8250 tmp_shrpenv=''
8251 if "$useshrplib"; then
8252     case "$osname" in
8253         aix)
8254                 # We'll set it in Makefile.SH...
8255                 ;;
8256         solaris)
8257                 xxx="-R $shrpdir"
8258                 ;;
8259         freebsd|mirbsd|netbsd|openbsd|interix|dragonfly)
8260                 xxx="-Wl,-R$shrpdir"
8261                 ;;
8262         bsdos|linux|irix*|dec_osf|gnu*)
8263                 xxx="-Wl,-rpath,$shrpdir"
8264                 ;;
8265         next)
8266                 # next doesn't like the default...
8267                 ;;
8268         beos)
8269                 # beos doesn't like the default, either.
8270                 ;;
8271         haiku)
8272                 # Haiku doesn't like the default, either.
8273                 ;;
8274         hpux*)
8275                 # hpux doesn't like the default, either.
8276                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8277                 ;;
8278         cygwin)
8279                 # cygwin needs only ldlibpth
8280                 ;;
8281         *)
8282                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8283                 ;;
8284         esac
8285         case "$xxx" in
8286         '') ;;
8287         *)
8288                 # Only add $xxx if it isn't already in ccdlflags.
8289                 case " $ccdlflags " in
8290                 *" $xxx "*)     ;;
8291                 *)      ccdlflags="$ccdlflags $xxx"
8292                         cat <<EOM >&4
8293
8294 Adding $xxx to the flags
8295 passed to $ld so that the perl executable will find the
8296 installed shared $libperl.
8297
8298 EOM
8299                         ;;
8300                 esac
8301                 ;;
8302         esac
8303 fi
8304 # Fix ccdlflags in AIX for building external extensions.
8305 # (For building Perl itself bare -bE:perl.exp is needed,
8306 #  Makefile.SH takes care of this.)
8307 case "$osname" in
8308 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8309 esac
8310 # Respect a hint or command-line value.
8311 case "$shrpenv" in
8312 '') shrpenv="$tmp_shrpenv" ;;
8313 esac
8314 case "$ldlibpthname" in
8315 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8316 none)   ldlibpthname='' ;;
8317 esac
8318
8319 : determine where manual pages are on this system
8320 echo " "
8321 case "$sysman" in
8322 '') 
8323         syspath='/usr/share/man/man1 /usr/man/man1'
8324         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8325         syspath="$syspath /usr/man/u_man/man1"
8326         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8327         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8328         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8329         sysman=`./loc . /usr/man/man1 $syspath`
8330         ;;
8331 esac
8332 if $test -d "$sysman"; then
8333         echo "System manual is in $sysman." >&4
8334 else
8335         echo "Could not find manual pages in source form." >&4
8336 fi
8337
8338 : determine where manual pages go
8339 set man1dir man1dir none
8340 eval $prefixit
8341 $cat <<EOM
8342
8343 $spackage has manual pages available in source form.
8344 EOM
8345 case "$nroff" in
8346 nroff)
8347         echo "However, you don't have nroff, so they're probably useless to you."
8348         case "$man1dir" in
8349         '') man1dir="none";;
8350         esac;;
8351 esac
8352 echo "If you don't want the manual sources installed, answer 'none'."
8353 case "$man1dir" in
8354 ' ') dflt=none
8355         ;;
8356 '')
8357         lookpath="$prefixexp/share/man/man1"
8358         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8359         lookpath="$lookpath $prefixexp/man/p_man/man1"
8360         lookpath="$lookpath $prefixexp/man/u_man/man1"
8361         lookpath="$lookpath $prefixexp/man/man.1"
8362         case "$sysman" in
8363         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8364         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8365         esac
8366         set dflt
8367         eval $prefixup
8368         ;;
8369 *)  dflt="$man1dir"
8370         ;;
8371 esac
8372 echo " "
8373 fn=dn+~
8374 rp="Where do the main $spackage manual pages (source) go?"
8375 . ./getfile
8376 if $test "X$man1direxp" != "X$ansexp"; then
8377         installman1dir=''
8378 fi
8379 prefixvar=man1dir
8380 . ./setprefixvar
8381
8382 case "$man1dir" in
8383 '')     man1dir=' '
8384         installman1dir='';;
8385 esac
8386
8387 : What suffix to use on installed man pages
8388
8389 case "$man1dir" in
8390 ' ')
8391         man1ext='0'
8392         ;;
8393 *)
8394         rp="What suffix should be used for the main $spackage man pages?"
8395         case "$man1ext" in
8396         '')     case "$man1dir" in
8397                 *1)  dflt=1 ;;
8398                 *1p) dflt=1p ;;
8399                 *1pm) dflt=1pm ;;
8400                 *l) dflt=l;;
8401                 *n) dflt=n;;
8402                 *o) dflt=o;;
8403                 *p) dflt=p;;
8404                 *C) dflt=C;;
8405                 *L) dflt=L;;
8406                 *L1) dflt=L1;;
8407                 *) dflt=1;;
8408                 esac
8409                 ;;
8410         *)      dflt="$man1ext";;
8411         esac
8412         . ./myread
8413         man1ext="$ans"
8414         ;;
8415 esac
8416
8417 : see if we can have long filenames
8418 echo " "
8419 first=123456789abcdef
8420 $rm -f $first
8421 if (echo hi >$first) 2>/dev/null; then
8422         if $test -f 123456789abcde; then
8423                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8424                 val="$undef"
8425         else
8426                 echo 'You can have filenames longer than 14 characters.'>&4
8427                 val="$define"
8428         fi
8429 else
8430         $cat <<'EOM'
8431 You can't have filenames longer than 14 chars.
8432 You can't even think about them!
8433 EOM
8434         val="$undef"
8435 fi
8436 set d_flexfnam
8437 eval $setvar
8438 $rm -rf 123456789abcde*
8439
8440 : determine where library module manual pages go
8441 set man3dir man3dir none
8442 eval $prefixit
8443 $cat <<EOM
8444
8445 $spackage has manual pages for many of the library modules.
8446 EOM
8447
8448 case "$nroff" in
8449 nroff)
8450         $cat <<'EOM'
8451 However, you don't have nroff, so they're probably useless to you.
8452 EOM
8453         case "$man3dir" in
8454         '') man3dir="none";;
8455         esac;;
8456 esac
8457
8458 case "$d_flexfnam" in
8459 undef)
8460         $cat <<'EOM'
8461 However, your system can't handle the long file names like File::Basename.3.
8462 EOM
8463         case "$man3dir" in
8464         '') man3dir="none";;
8465         esac;;
8466 esac
8467
8468 echo "If you don't want the manual sources installed, answer 'none'."
8469 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8470 case "$man3dir" in
8471 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8472         if $test -d "$privlib/man/man3"; then
8473                 cat <<EOM >&4
8474
8475 WARNING:  Previous versions of perl installed man3 pages into
8476 $privlib/man/man3.  This version will suggest a
8477 new default of $dflt.
8478 EOM
8479                 tdflt=$dflt
8480                 dflt='n'
8481                 rp='Do you wish to preserve the old behavior?(y/n)'
8482                 . ./myread
8483                 case "$ans" in
8484                 y*) dflt="$privlib/man/man3" ;;
8485                 *)  dflt=$tdflt ;;
8486                 esac
8487     fi
8488         ;;
8489 *)      dflt="$man3dir" ;;
8490 esac
8491 case "$dflt" in
8492 ' ') dflt=none ;;
8493 esac
8494 echo " "
8495 fn=dn+~
8496 rp="Where do the $package library man pages (source) go?"
8497 . ./getfile
8498 prefixvar=man3dir
8499 . ./setprefixvar
8500
8501 case "$man3dir" in
8502 '')     man3dir=' '
8503         installman3dir='';;
8504 esac
8505
8506 : What suffix to use on installed man pages
8507 case "$man3dir" in
8508 ' ')
8509         man3ext='0'
8510         ;;
8511 *)
8512         rp="What suffix should be used for the $package library man pages?"
8513         case "$man3ext" in
8514         '')     case "$man3dir" in
8515                 *3)  dflt=3 ;;
8516                 *3p) dflt=3p ;;
8517                 *3pm) dflt=3pm ;;
8518                 *l) dflt=l;;
8519                 *n) dflt=n;;
8520                 *o) dflt=o;;
8521                 *p) dflt=p;;
8522                 *C) dflt=C;;
8523                 *L) dflt=L;;
8524                 *L3) dflt=L3;;
8525                 *) dflt=3;;
8526                 esac
8527                 ;;
8528         *)      dflt="$man3ext";;
8529         esac
8530         . ./myread
8531         man3ext="$ans"
8532         ;;
8533 esac
8534
8535 : see if we have to deal with yellow pages, now NIS.
8536 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8537         if $test -f /usr/etc/nibindd; then
8538                 echo " "
8539                 echo "I'm fairly confident you're on a NeXT."
8540                 echo " "
8541                 rp='Do you get the hosts file via NetInfo?'
8542                 dflt=y
8543                 case "$hostcat" in
8544                 nidump*) ;;
8545                 '') ;;
8546                 *) dflt=n;;
8547                 esac
8548                 . ./myread
8549                 case "$ans" in
8550                 y*) hostcat='nidump hosts .';;
8551                 *)      case "$hostcat" in
8552                         nidump*) hostcat='';;
8553                         esac
8554                         ;;
8555                 esac
8556         fi
8557         case "$hostcat" in
8558         nidump*) ;;
8559         *)
8560                 case "$hostcat" in
8561                 *ypcat*) dflt=y;;
8562                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8563                                 dflt=y
8564                         else
8565                                 dflt=n
8566                         fi;;
8567                 *) dflt=n;;
8568                 esac
8569                 echo " "
8570                 rp='Are you getting the hosts file via yellow pages?'
8571                 . ./myread
8572                 case "$ans" in
8573                 y*) hostcat='ypcat hosts';;
8574                 *) hostcat='cat /etc/hosts';;
8575                 esac
8576                 ;;
8577         esac
8578 fi
8579 case "$hostcat" in
8580 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8581 esac
8582 case "$groupcat" in
8583 '') test -f /etc/group && groupcat='cat /etc/group';;
8584 esac
8585 case "$passcat" in
8586 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8587 esac
8588
8589 : now get the host name
8590 echo " "
8591 echo "Figuring out host name..." >&4
8592 case "$myhostname" in
8593 '') cont=true
8594         echo 'Maybe "hostname" will work...'
8595         if tans=`sh -c hostname 2>&1` ; then
8596                 myhostname=$tans
8597                 phostname=hostname
8598                 cont=''
8599         fi
8600         ;;
8601 *) cont='';;
8602 esac
8603 if $test "$cont"; then
8604         if ./xenix; then
8605                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8606                 if tans=`cat /etc/systemid 2>&1` ; then
8607                         myhostname=$tans
8608                         phostname='cat /etc/systemid'
8609                         echo "Whadyaknow.  Xenix always was a bit strange..."
8610                         cont=''
8611                 fi
8612         elif $test -r /etc/systemid; then
8613                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8614         fi
8615 fi
8616 if $test "$cont"; then
8617         echo 'No, maybe "uuname -l" will work...'
8618         if tans=`sh -c 'uuname -l' 2>&1` ; then
8619                 myhostname=$tans
8620                 phostname='uuname -l'
8621         else
8622                 echo 'Strange.  Maybe "uname -n" will work...'
8623                 if tans=`sh -c 'uname -n' 2>&1` ; then
8624                         myhostname=$tans
8625                         phostname='uname -n'
8626                 else
8627                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8628                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8629                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8630                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8631                         else
8632                                 case "$myhostname" in
8633                                 '') echo "Does this machine have an identity crisis or something?"
8634                                         phostname='';;
8635                                 *)
8636                                         echo "Well, you said $myhostname before..."
8637                                         phostname='echo $myhostname';;
8638                                 esac
8639                         fi
8640                 fi
8641         fi
8642 fi
8643 case "$myhostname" in
8644 '') myhostname=noname ;;
8645 esac
8646 : you do not want to know about this
8647 set $myhostname
8648 myhostname=$1
8649
8650 : verify guess
8651 if $test "$myhostname" ; then
8652         dflt=y
8653         rp='Your host name appears to be "'$myhostname'".'" Right?"
8654         . ./myread
8655         case "$ans" in
8656         y*) ;;
8657         *) myhostname='';;
8658         esac
8659 fi
8660
8661 : bad guess or no guess
8662 while $test "X$myhostname" = X ; do
8663         dflt=''
8664         rp="Please type the (one word) name of your host:"
8665         . ./myread
8666         myhostname="$ans"
8667 done
8668
8669 : translate upper to lower if necessary
8670 case "$myhostname" in
8671 *[A-Z]*)
8672         echo "(Normalizing case in your host name)"
8673         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8674         ;;
8675 esac
8676
8677 case "$myhostname" in
8678 *.*)
8679         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8680         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8681         echo "(Trimming domain name from host name--host name is now $myhostname)"
8682         ;;
8683 *) case "$mydomain" in
8684         '')
8685                 {
8686                         test "X$hostcat" = "Xypcat hosts" &&
8687                         ypmatch "$myhostname" hosts 2>/dev/null |\
8688                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8689                         $test -s hosts
8690                 } || {
8691                         test "X$hostcat" != "X" &&
8692                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8693                                         /[       ]$myhostname[  . ]/p" > hosts
8694                 }
8695                 tmp_re="[       . ]"
8696                 if $test -f hosts; then
8697                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8698                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8699                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8700                                 hosts | $sort | $uniq | \
8701                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8702                         case `$echo X$dflt` in
8703                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8704                                 dflt=.
8705                                 ;;
8706                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8707                                 ;;
8708                         esac
8709                 else
8710                         echo "(I cannot locate a hosts database anywhere)"
8711                         dflt=.
8712                 fi
8713                 case "$dflt" in
8714                 .)
8715                         tans=`./loc resolv.conf X /etc /usr/etc`
8716                         if $test -f "$tans"; then
8717                                 echo "(Attempting domain name extraction from $tans)"
8718                                 dflt=.`$sed -n -e 's/   / /g' \
8719                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8720                                   -e 1q 2>/dev/null`
8721                                 case "$dflt" in
8722                                 .) dflt=.`$sed -n -e 's/        / /g' \
8723                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8724                                      -e 1q 2>/dev/null`
8725                                         ;;
8726                                 esac
8727                         fi
8728                         ;;
8729                 esac
8730                 case "$dflt" in
8731                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8732                         dflt=.`sh -c domainname 2>/dev/null`
8733                         case "$dflt" in
8734                         '') dflt='.';;
8735                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8736                         esac
8737                         ;;
8738                 esac
8739                 case "$dflt$osname" in
8740                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8741                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8742                         ;;
8743                 esac
8744                 case "$dflt" in
8745                 .) echo "(Lost all hope -- silly guess then)"
8746                         dflt='.nonet'
8747                         ;;
8748                 esac
8749                 $rm -f hosts
8750                 ;;
8751         *) dflt="$mydomain";;
8752         esac;;
8753 esac
8754 echo " "
8755 rp="What is your domain name?"
8756 . ./myread
8757 tans="$ans"
8758 case "$ans" in
8759 '') ;;
8760 .*) ;;
8761 *) tans=".$tans";;
8762 esac
8763 mydomain="$tans"
8764
8765 : translate upper to lower if necessary
8766 case "$mydomain" in
8767 *[A-Z]*)
8768         echo "(Normalizing case in your domain name)"
8769         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8770         ;;
8771 esac
8772
8773 : a little sanity check here
8774 case "$phostname" in
8775 '') ;;
8776 *)
8777         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8778         $myhostname$mydomain|$myhostname) ;;
8779         *)
8780                 case "$phostname" in
8781                 sed*)
8782                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8783                         ;;
8784                 *)
8785                         echo "(That doesn't agree with your $phostname command, by the way.)"
8786                         ;;
8787                 esac
8788         ;;
8789         esac
8790         ;;
8791 esac
8792
8793 : determine the e-mail address of the user who is running us
8794 $cat <<EOM
8795
8796 I need to get your e-mail address in Internet format if possible, i.e.
8797 something like user@host.domain. Please answer accurately since I have
8798 no easy means to double check it. The default value provided below
8799 is most probably close to reality but may not be valid from outside
8800 your organization...
8801
8802 EOM
8803 cont=x
8804 while test "$cont"; do
8805         case "$cf_email" in
8806         '') dflt="$cf_by@$myhostname$mydomain";;
8807         *) dflt="$cf_email";;
8808         esac
8809         rp='What is your e-mail address?'
8810         . ./myread
8811         cf_email="$ans"
8812         case "$cf_email" in
8813         *@*.*) cont='' ;;
8814         *)
8815                 rp='Address does not look like an Internet one.  Use it anyway?'
8816                 case "$fastread" in
8817                 yes) dflt=y ;;
8818                 *) dflt=n ;;
8819                 esac
8820                 . ./myread
8821                 case "$ans" in
8822                 y*) cont='' ;;
8823                 *) echo " " ;;
8824                 esac
8825                 ;;
8826         esac
8827 done
8828
8829 : Ask e-mail of administrator
8830 $cat <<EOM
8831
8832 If you or somebody else will be maintaining perl at your site, please
8833 fill in the correct e-mail address here so that they may be contacted
8834 if necessary. Currently, the "perlbug" program included with perl
8835 will send mail to this address in addition to perlbug@perl.org. You may
8836 enter "none" for no administrator.
8837
8838 EOM
8839 case "$perladmin" in
8840 '') dflt="$cf_email";;
8841 *) dflt="$perladmin";;
8842 esac
8843 rp='Perl administrator e-mail address'
8844 . ./myread
8845 perladmin="$ans"
8846
8847 : determine whether to only install version-specific parts.
8848 echo " "
8849 $cat <<EOM
8850 Do you want to install only the version-specific parts of the perl
8851 distribution?  Usually you do *not* want to do this.
8852 EOM
8853 case "$versiononly" in
8854 "$define"|[Yy]*|true) dflt='y' ;;
8855 *) dflt='n';
8856 esac
8857 rp="Do you want to install only the version-specific parts of perl?"
8858 . ./myread
8859 case "$ans" in
8860 [yY]*)  val="$define";;
8861 *)      val="$undef" ;;
8862 esac
8863 set versiononly
8864 eval $setvar
8865
8866 case "$versiononly" in
8867 "$define") inc_version_list=''
8868            inc_version_list_init=0
8869            ;;
8870 esac
8871
8872 : figure out how to guarantee perl startup
8873 : XXX Note that this currently takes advantage of the bug that binexp ignores
8874 :     the Configure -Dinstallprefix setting, which in turn means that under
8875 :     relocatable @INC, initialinstalllocation is what binexp started as.
8876 case "$startperl" in
8877 '')
8878         case "$sharpbang" in
8879         *!)
8880                 $cat <<EOH
8881
8882 I can use the #! construct to start perl on your system. This will
8883 make startup of perl scripts faster, but may cause problems if you
8884 want to share those scripts and perl is not in a standard place
8885 ($initialinstalllocation/perl) on all your platforms. The alternative
8886 is to force a shell by starting the script with a single ':' character.
8887
8888 EOH
8889                 case "$versiononly" in
8890                 "$define")      dflt="$initialinstalllocation/perl$version";;
8891                 *)              dflt="$initialinstalllocation/perl";;
8892                 esac
8893                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8894                 . ./myread
8895                 case "$ans" in
8896                 none)   startperl=": # use perl";;
8897                 *)      startperl="#!$ans"
8898                         if $test 30 -lt `echo "$ans" | wc -c`; then
8899                                 $cat >&4 <<EOM
8900
8901 WARNING:  Some systems limit the #! command to 32 characters.
8902 If you experience difficulty running Perl scripts with #!, try
8903 installing Perl in a directory with a shorter pathname.
8904
8905 EOM
8906                         fi ;;
8907                 esac
8908                 ;;
8909         *) startperl=": # use perl"
8910                 ;;
8911         esac
8912         ;;
8913 esac
8914 echo "I'll use $startperl to start perl scripts."
8915
8916 : figure best path for perl in scripts
8917 case "$perlpath" in
8918 '')
8919         case "$versiononly" in
8920         "$define")      perlpath="$initialinstalllocation/perl$version";;
8921         *)              perlpath="$initialinstalllocation/perl";;
8922         esac
8923         case "$startperl" in
8924         *!*) ;;
8925         *)
8926                 $cat <<EOH
8927
8928 I will use the "eval 'exec'" idiom to start Perl on your system.
8929 I can use the full path of your Perl binary for this purpose, but
8930 doing so may cause problems if you want to share those scripts and
8931 Perl is not always in a standard place ($initialinstalllocation/perl).
8932
8933 EOH
8934                 dflt="$initialinstalllocation/perl"
8935                 rp="What path shall I use in \"eval 'exec'\"?"
8936                 . ./myread
8937                 perlpath="$ans"
8938                 ;;
8939         esac
8940         ;;
8941 esac
8942 case "$startperl" in
8943 *!*)    ;;
8944 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8945 esac
8946
8947 : determine where public executable scripts go
8948 set scriptdir scriptdir
8949 eval $prefixit
8950 case "$scriptdir" in
8951 '')
8952         dflt="$bin"
8953         : guess some guesses
8954         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8955         $test -d /usr/share/bin     && dflt=/usr/share/bin
8956         $test -d /usr/local/script  && dflt=/usr/local/script
8957         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8958         $test -d $prefixexp/script  && dflt=$prefixexp/script
8959         set dflt
8960         eval $prefixup
8961         ;;
8962 *)  dflt="$scriptdir"
8963         ;;
8964 esac
8965 $cat <<EOM
8966
8967 Some installations have a separate directory just for executable scripts so
8968 that they can mount it across multiple architectures but keep the scripts in
8969 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8970 Or you might just lump your scripts in with all your other executables.
8971
8972 EOM
8973 fn=d~
8974 rp='Where do you keep publicly executable scripts?'
8975 . ./getfile
8976 if $test "X$ansexp" != "X$scriptdirexp"; then
8977         installscript=''
8978 fi
8979 installscriptdir=''
8980 prefixvar=scriptdir
8981 . ./setprefixvar
8982 : A little fix up for an irregularly named variable.
8983 installscript="$installscriptdir"
8984
8985 : determine where add-on public executables go
8986 case "$sitebin" in
8987 '')     dflt=$siteprefix/bin ;;
8988 *)      dflt=$sitebin ;;
8989 esac
8990 fn=d~
8991 rp='Pathname where the add-on public executables should be installed?'
8992 . ./getfile
8993 prefixvar=sitebin
8994 . ./setprefixvar
8995
8996 : determine where add-on html pages go
8997 : There is no standard location, so try to copy the previously-selected
8998 : directory structure for the core html pages.
8999 case "$sitehtml1dir" in
9000 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9001 *)     dflt=$sitehtml1dir ;;
9002 esac
9003 case "$dflt" in
9004 ''|' ') dflt=none ;;
9005 esac
9006 fn=dn+~
9007 rp='Pathname where the site-specific html pages should be installed?'
9008 . ./getfile
9009 prefixvar=sitehtml1dir
9010 . ./setprefixvar
9011
9012 : determine where add-on library html pages go
9013 : There is no standard location, so try to copy the previously-selected
9014 : directory structure for the core html pages.
9015 case "$sitehtml3dir" in
9016 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
9017 *)     dflt=$sitehtml3dir ;;
9018 esac
9019 case "$dflt" in
9020 ''|' ') dflt=none ;;
9021 esac
9022 fn=dn+~
9023 rp='Pathname where the site-specific library html pages should be installed?'
9024 . ./getfile
9025 prefixvar=sitehtml3dir
9026 . ./setprefixvar
9027
9028 : determine where add-on manual pages go
9029 case "$siteman1dir" in
9030 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
9031 *)      dflt=$siteman1dir ;;
9032 esac
9033 case "$dflt" in
9034 ''|' ') dflt=none ;;
9035 esac
9036 fn=dn+~
9037 rp='Pathname where the site-specific manual pages should be installed?'
9038 . ./getfile
9039 prefixvar=siteman1dir
9040 . ./setprefixvar
9041
9042 : determine where add-on library man pages go
9043 case "$siteman3dir" in
9044 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
9045 *)      dflt=$siteman3dir ;;
9046 esac
9047 case "$dflt" in
9048 ''|' ') dflt=none ;;
9049 esac
9050 fn=dn+~
9051 rp='Pathname where the site-specific library manual pages should be installed?'
9052 . ./getfile
9053 prefixvar=siteman3dir
9054 . ./setprefixvar
9055
9056 : determine where add-on public executable scripts go
9057 case "$sitescript" in
9058 '')     dflt=$siteprefix/script
9059         $test -d $dflt || dflt=$sitebin ;;
9060 *)  dflt="$sitescript" ;;
9061 esac
9062 fn=d~+
9063 rp='Pathname where add-on public executable scripts should be installed?'
9064 . ./getfile
9065 prefixvar=sitescript
9066 . ./setprefixvar
9067
9068 : Check if faststdio is requested and available
9069 case "$usefaststdio" in
9070 $define|true|[yY]*|'')
9071         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
9072         case "$xversion" in
9073         [68])   dflt='y' ;;
9074         *)      dflt='n' ;;
9075         esac
9076         ;;
9077 *) dflt='n';;
9078 esac
9079 cat <<EOM
9080
9081 Perl can be built to use 'fast stdio', which means using the stdio
9082 library but also directly manipulating the stdio buffers to enable
9083 faster I/O.  Using stdio is better for backward compatibility (especially
9084 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
9085 interface has been preferred instead of stdio.
9086
9087 If this doesn't make any sense to you, just accept the default '$dflt'.
9088 EOM
9089 rp='Use the "fast stdio" if available?'
9090 . ./myread
9091 case "$ans" in
9092 y|Y)    val="$define" ;;
9093 *)      val="$undef" ;;
9094 esac
9095 set usefaststdio
9096 eval $setvar
9097
9098
9099 : define an is-a-typedef? function
9100 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9101 case "$inclist" in
9102 "") inclist="sys/types.h";;
9103 esac;
9104 eval "varval=\$$var";
9105 case "$varval" in
9106 "")
9107         $rm -f temp.c;
9108         for inc in $inclist; do
9109                 echo "#include <$inc>" >>temp.c;
9110         done;
9111         echo "#ifdef $type" >> temp.c;
9112         echo "printf(\"We have $type\");" >> temp.c;
9113         echo "#endif" >> temp.c;
9114         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9115         if $contains $type temp.E >/dev/null 2>&1; then
9116                 eval "$var=\$type";
9117         else
9118                 eval "$var=\$def";
9119         fi;
9120         $rm -f temp.?;;
9121 *) eval "$var=\$varval";;
9122 esac'
9123
9124 : define an is-a-typedef? function that prompts if the type is not available.
9125 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
9126 case "$inclist" in
9127 "") inclist="sys/types.h";;
9128 esac;
9129 eval "varval=\$$var";
9130 case "$varval" in
9131 "")
9132         $rm -f temp.c;
9133         for inc in $inclist; do
9134                 echo "#include <$inc>" >>temp.c;
9135         done;
9136         echo "#ifdef $type" >> temp.c;
9137         echo "printf(\"We have $type\");" >> temp.c;
9138         echo "#endif" >> temp.c;
9139         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
9140         echo " " ;
9141         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
9142         if $contains $type temp.E >/dev/null 2>&1; then
9143                 echo "$type found." >&4;
9144                 eval "$var=\$type";
9145         else
9146                 echo "$type NOT found." >&4;
9147                 dflt="$def";
9148                 . ./myread ;
9149                 eval "$var=\$ans";
9150         fi;
9151         $rm -f temp.?;;
9152 *) eval "$var=\$varval";;
9153 esac'
9154
9155 : see what type lseek is declared as in the kernel
9156 rp="What is the type used for lseek's offset on this system?"
9157 set off_t lseektype long stdio.h sys/types.h
9158 eval $typedef_ask
9159
9160 echo " "
9161 echo "Checking to see how big your file offsets are..." >&4
9162 $cat >try.c <<EOCP
9163 #include <sys/types.h>
9164 #include <stdio.h>
9165 int main()
9166 {
9167     printf("%d\n", (int)sizeof($lseektype));
9168     return(0);
9169 }
9170 EOCP
9171 set try
9172 if eval $compile_ok; then
9173         lseeksize=`$run ./try`
9174         echo "Your file offsets are $lseeksize bytes long."
9175 else
9176         dflt=$longsize
9177         echo " "
9178         echo "(I can't seem to compile the test program.  Guessing...)"
9179         rp="What is the size of your file offsets (in bytes)?"
9180         . ./myread
9181         lseeksize="$ans"
9182 fi
9183 $rm_try
9184
9185 : see what type file positions are declared as in the library
9186 rp="What is the type for file position used by fsetpos()?"
9187 set fpos_t fpostype long stdio.h sys/types.h
9188 eval $typedef_ask
9189
9190 : Check size for Fpos_t
9191 echo " "
9192 case "$fpostype" in
9193 *_t) zzz="$fpostype"    ;;
9194 *)   zzz="fpos_t"       ;;
9195 esac
9196 echo "Checking the size of $zzz..." >&4
9197 cat > try.c <<EOCP
9198 #include <sys/types.h>
9199 #include <stdio.h>
9200 #$i_stdlib I_STDLIB
9201 #ifdef I_STDLIB
9202 #include <stdlib.h>
9203 #endif
9204 int main() {
9205     printf("%d\n", (int)sizeof($fpostype));
9206     exit(0);
9207 }
9208 EOCP
9209 set try
9210 if eval $compile_ok; then
9211         yyy=`$run ./try`
9212         case "$yyy" in
9213         '')     fpossize=4
9214                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9215                 ;;
9216         *)      fpossize=$yyy
9217                 echo "Your $zzz is $fpossize bytes long."
9218                 ;;
9219         esac
9220 else
9221         dflt="$longsize"
9222         echo " " >&4
9223         echo "(I can't compile the test program.  Guessing...)" >&4
9224         rp="What is the size of your file positions (in bytes)?"
9225         . ./myread
9226         fpossize="$ans"
9227 fi
9228
9229 : Check for large file support
9230 # Backward compatibility (uselfs is deprecated).
9231 case "$uselfs" in
9232 "$define"|true|[yY]*)
9233         cat <<EOM >&4
9234
9235 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9236 EOM
9237         uselargefiles="$define"
9238         ;;
9239 esac
9240
9241 case "$lseeksize:$fpossize" in
9242 8:8) cat <<EOM
9243
9244 You can have files larger than 2 gigabytes.
9245 EOM
9246    val="$define" ;;
9247 *)    case "$uselargefiles" in
9248    "$undef"|false|[nN]*) dflt='n' ;;
9249    *)   dflt='y' ;;
9250    esac
9251    cat <<EOM
9252
9253 Perl can be built to understand large files (files larger than 2 gigabytes)
9254 on some systems.  To do so, Configure can be run with -Duselargefiles.
9255
9256 If this doesn't make any sense to you, just accept the default '$dflt'.
9257 EOM
9258    rp='Try to understand large files, if available?'
9259    . ./myread
9260    case "$ans" in
9261    y|Y)         val="$define" ;;
9262    *)           val="$undef"  ;;
9263    esac
9264    ;;
9265 esac
9266 set uselargefiles
9267 eval $setvar
9268 : Look for a hint-file generated 'call-back-unit'.  If the
9269 : user has specified that a large files perl is to be built,
9270 : we may need to set or change some other defaults.
9271 if $test -f uselargefiles.cbu; then
9272         echo "Your platform has some specific hints regarding large file builds, using them..."
9273         . ./uselargefiles.cbu
9274 fi
9275 case "$uselargefiles" in
9276 "$define")
9277         if $test -f uselargefiles.cbu; then
9278                 echo " "
9279                 echo "Rechecking to see how big your file offsets are..." >&4
9280                 $cat >try.c <<EOCP
9281 #include <sys/types.h>
9282 #include <stdio.h>
9283 int main()
9284 {
9285     printf("%d\n", (int)sizeof($lseektype));
9286     return(0);
9287 }
9288 EOCP
9289                 set try
9290                 if eval $compile_ok; then
9291                         lseeksize=`$run ./try`
9292                         $echo "Your file offsets are now $lseeksize bytes long."
9293                 else
9294                         dflt="$lseeksize"
9295                         echo " "
9296                         echo "(I can't seem to compile the test program.  Guessing...)"
9297                         rp="What is the size of your file offsets (in bytes)?"
9298                         . ./myread
9299                         lseeksize="$ans"
9300                 fi
9301                 case "$fpostype" in
9302                 *_t) zzz="$fpostype"    ;;
9303                 *)   zzz="fpos_t"       ;;
9304                 esac
9305                 $echo $n "Rechecking the size of $zzz...$c" >&4
9306                 $cat > try.c <<EOCP
9307 #include <sys/types.h>
9308 #include <stdio.h>
9309 #$i_stdlib I_STDLIB
9310 #ifdef I_STDLIB
9311 #include <stdlib.h>
9312 #endif
9313 int main() {
9314     printf("%d\n", (int)sizeof($fpostype));
9315     return(0);
9316 }
9317 EOCP
9318                 set try
9319                 if eval $compile_ok; then
9320                         yyy=`$run ./try`
9321                         dflt="$lseeksize"
9322                         case "$yyy" in
9323                         '')     echo " "
9324                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9325                                 ;;
9326                         *)      fpossize=$yyy
9327                                 echo " $fpossize bytes." >&4
9328                                 ;;
9329                         esac
9330                 else
9331                         dflt="$fpossize"
9332                         echo " "
9333                         echo "(I can't compile the test program.  Guessing...)" >&4
9334                         rp="What is the size of your file positions (in bytes)?"
9335                         . ./myread
9336                         fpossize="$ans"
9337                 fi
9338                 $rm_try
9339         fi
9340         ;;
9341 esac
9342
9343 : Check if we want perlio
9344 useperlio="$define"
9345
9346 : Set the vendorbin variables
9347 case "$vendorprefix" in
9348 '')     d_vendorbin="$undef"
9349         vendorbin=''
9350         vendorbinexp=''
9351         ;;
9352 *)      d_vendorbin="$define"
9353         : determine where vendor-supplied executables go.
9354         case "$vendorbin" in
9355         '') dflt=$vendorprefix/bin ;;
9356         *)      dflt="$vendorbin" ;;
9357         esac
9358         fn=d~+
9359         rp='Pathname for the vendor-supplied executables directory?'
9360         . ./getfile
9361         vendorbin="$ans"
9362         vendorbinexp="$ansexp"
9363         ;;
9364 esac
9365 prefixvar=vendorbin
9366 . ./installprefix
9367
9368 : Set the vendorhtml1dir variables
9369 case "$vendorprefix" in
9370 '')     vendorhtml1dir=''
9371         vendorhtml1direxp=''
9372         ;;
9373 *)      : determine where vendor-supplied html pages go.
9374         : There is no standard location, so try to copy the previously-selected
9375         : directory structure for the core html pages.
9376         : XXX Better default suggestions would be welcome.
9377         case "$vendorhtml1dir" in
9378         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9379         *)      dflt=$vendorhtml1dir ;;
9380         esac
9381         case "$dflt" in
9382         ''|' ') dflt=none ;;
9383         esac
9384         fn=dn+~
9385         rp='Pathname for the vendor-supplied html pages?'
9386         . ./getfile
9387         vendorhtml1dir="$ans"
9388         vendorhtml1direxp="$ansexp"
9389         ;;
9390 esac
9391 : Use ' ' for none so value is preserved next time through Configure
9392 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9393 prefixvar=vendorhtml1dir
9394 . ./installprefix
9395
9396 : Set the vendorhtml3dir variables
9397 case "$vendorprefix" in
9398 '')     vendorhtml3dir=''
9399         vendorhtml3direxp=''
9400         ;;
9401 *)      : determine where vendor-supplied module html pages go.
9402         : There is no standard location, so try to copy the previously-selected
9403         : directory structure for the core html pages.
9404         : XXX Better default suggestions would be welcome.
9405         case "$vendorhtml3dir" in
9406         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9407         *)      dflt=$vendorhtml3dir ;;
9408         esac
9409         case "$dflt" in
9410         ''|' ') dflt=none ;;
9411         esac
9412         fn=dn+~
9413         rp='Pathname for the vendor-supplied html pages?'
9414         . ./getfile
9415         vendorhtml3dir="$ans"
9416         vendorhtml3direxp="$ansexp"
9417         ;;
9418 esac
9419 : Use ' ' for none so value is preserved next time through Configure
9420 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9421 prefixvar=vendorhtml3dir
9422 . ./installprefix
9423
9424 : Set the vendorman1dir variables
9425 case "$vendorprefix" in
9426 '')     vendorman1dir=''
9427         vendorman1direxp=''
9428         ;;
9429 *)      : determine where vendor-supplied manual pages go.
9430         case "$vendorman1dir" in
9431         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9432         *)      dflt=$vendorman1dir ;;
9433         esac
9434         case "$dflt" in
9435         ''|' ') dflt=none ;;
9436         esac
9437         fn=nd~+
9438         rp='Pathname for the vendor-supplied manual section 1 pages?'
9439         . ./getfile
9440         vendorman1dir="$ans"
9441         vendorman1direxp="$ansexp"
9442         ;;
9443 esac
9444 : Use ' ' for none so value is preserved next time through Configure
9445 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9446 prefixvar=vendorman1dir
9447 . ./installprefix
9448
9449 : Set the vendorman3dir variables
9450 case "$vendorprefix" in
9451 '')     vendorman3dir=''
9452         vendorman3direxp=''
9453         ;;
9454 *)      : determine where vendor-supplied module manual pages go.
9455         case "$vendorman3dir" in
9456         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9457         *)      dflt=$vendorman3dir ;;
9458         esac
9459         case "$dflt" in
9460         ''|' ') dflt=none ;;
9461         esac
9462         fn=nd~+
9463         rp='Pathname for the vendor-supplied manual section 3 pages?'
9464         . ./getfile
9465         vendorman3dir="$ans"
9466         vendorman3direxp="$ansexp"
9467         ;;
9468 esac
9469 : Use ' ' for none so value is preserved next time through Configure
9470 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9471 prefixvar=vendorman3dir
9472 . ./installprefix
9473
9474 : Set the vendorscript variables
9475 case "$vendorprefix" in
9476 '')     d_vendorscript="$undef"
9477         vendorscript=''
9478         vendorscriptexp=''
9479         ;;
9480 *)      d_vendorscript="$define"
9481         : determine where vendor-supplied scripts go.
9482         case "$vendorscript" in
9483         '')     dflt=$vendorprefix/script
9484                 $test -d $dflt || dflt=$vendorbin ;;
9485         *)  dflt="$vendorscript" ;;
9486         esac
9487         $cat <<EOM
9488
9489 The installation process will create a directory for
9490 vendor-supplied scripts.
9491
9492 EOM
9493         fn=d~+
9494         rp='Pathname for the vendor-supplied scripts directory?'
9495         . ./getfile
9496         vendorscript="$ans"
9497         vendorscriptexp="$ansexp"
9498         ;;
9499 esac
9500 prefixvar=vendorscript
9501 . ./installprefix
9502
9503 : script used to emit important warnings
9504 cat >warn <<EOS
9505 $startsh
9506 if test \$# -gt 0; then
9507         echo "\$@" >msg
9508 else
9509         cat >msg
9510 fi
9511 echo "*** WARNING:" >&4
9512 sed -e 's/^/*** /' <msg >&4
9513 echo "*** " >&4
9514 cat msg >>config.msg
9515 echo " " >>config.msg
9516 rm -f msg
9517 EOS
9518 chmod +x warn
9519 $eunicefix warn
9520
9521 : see which of string.h or strings.h is needed
9522 echo " "
9523 strings=`./findhdr string.h`
9524 if $test "$strings" && $test -r "$strings"; then
9525         echo "Using <string.h> instead of <strings.h>." >&4
9526         val="$define"
9527 else
9528         val="$undef"
9529         strings=`./findhdr strings.h`
9530         if $test "$strings" && $test -r "$strings"; then
9531                 echo "Using <strings.h> instead of <string.h>." >&4
9532         else
9533                 ./warn "No string header found -- You'll surely have problems."
9534         fi
9535 fi
9536 set i_string
9537 eval $setvar
9538 case "$i_string" in
9539 "$undef") strings=`./findhdr strings.h`;;
9540 *)        strings=`./findhdr string.h`;;
9541 esac
9542
9543 : see if qgcvt exists
9544 set qgcvt d_qgcvt
9545 eval $inlibc
9546
9547 : Check print/scan long double stuff
9548 echo " "
9549
9550 if $test X"$d_longdbl" = X"$define"; then
9551
9552 echo "Checking how to print long doubles..." >&4
9553
9554 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9555         $cat >try.c <<'EOCP'
9556 #include <sys/types.h>
9557 #include <stdio.h>
9558 int main() {
9559   double d = 123.456;
9560   printf("%.3f\n", d);
9561 }
9562 EOCP
9563         set try
9564         if eval $compile; then
9565                 yyy=`$run ./try`
9566                 case "$yyy" in
9567                 123.456)
9568                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9569                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9570                         echo "We will use %f."
9571                         ;;
9572                 esac
9573         fi
9574 fi
9575
9576 if $test X"$sPRIfldbl" = X; then
9577         $cat >try.c <<'EOCP'
9578 #include <sys/types.h>
9579 #include <stdio.h>
9580 int main() {
9581   long double d = 123.456;
9582   printf("%.3Lf\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='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9591                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9592                         echo "We will use %Lf."
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("%.3llf\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='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9613                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9614                         echo "We will use %llf."
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("%.3lf\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='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9635                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9636                         echo "We will use %lf."
9637                         ;;
9638                 esac
9639         fi
9640 fi
9641
9642 if $test X"$sPRIfldbl" = X; then
9643         echo "Cannot figure out how to print long doubles." >&4
9644 else
9645         sSCNfldbl=$sPRIfldbl    # expect consistency
9646 fi
9647
9648 $rm_try
9649
9650 fi # d_longdbl
9651
9652 case "$sPRIfldbl" in
9653 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9654         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9655         d_SCNfldbl="$undef";
9656         ;;
9657 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9658         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9659         d_SCNfldbl="$define";
9660         ;;
9661 esac
9662
9663 : Check how to convert floats to strings.
9664
9665 if test "X$d_Gconvert" = X; then
9666
9667 echo " "
9668 echo "Checking for an efficient way to convert floats to strings."
9669 echo " " > try.c
9670 case "$uselongdouble" in
9671 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9672 esac
9673 case "$d_longdbl" in
9674 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9675 esac
9676 case "$d_PRIgldbl" in
9677 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9678 esac
9679 $cat >>try.c <<EOP
9680 #ifdef TRY_gconvert
9681 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9682 char *myname = "gconvert";
9683 #endif
9684 #ifdef TRY_gcvt
9685 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9686 char *myname = "gcvt";
9687 #endif
9688 #ifdef TRY_qgcvt
9689 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9690 char *myname = "qgcvt";
9691 #define DOUBLETYPE long double
9692 #endif
9693 #ifdef TRY_sprintf
9694 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9695 #ifdef HAS_PRIgldbl
9696 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9697 #else
9698 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9699 #endif
9700 #else
9701 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9702 #endif
9703 char *myname = "sprintf";
9704 #endif
9705
9706 #ifndef DOUBLETYPE
9707 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9708 #define DOUBLETYPE long double
9709 #else
9710 #define DOUBLETYPE double
9711 #endif
9712 #endif
9713
9714 #include <stdio.h>
9715
9716 #$i_stdlib I_STDLIB
9717 #ifdef I_STDLIB
9718 #include <stdlib.h>
9719 #endif
9720 #$i_string I_STRING
9721 #ifdef I_STRING
9722 #  include <string.h>
9723 #else
9724 #  include <strings.h>
9725 #endif
9726
9727 int checkit(char *expect, char *got)
9728 {
9729     if (strcmp(expect, got)) {
9730                 printf("%s oddity:  Expected %s, got %s\n",
9731                         myname, expect, got);
9732                 exit(1);
9733         }
9734 }
9735
9736 int main()
9737 {
9738         char buf[64];
9739         buf[63] = '\0';
9740
9741         /* This must be 1st test on (which?) platform */
9742         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9743         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9744         checkit("0.1", buf);
9745
9746         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9747         checkit("0.01", buf);
9748
9749         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9750         checkit("0.001", buf);
9751
9752         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9753         checkit("0.0001", buf);
9754
9755         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9756         if (strlen(buf) > 5)
9757             checkit("9e-005", buf); /* for Microsoft ?? */
9758         else
9759             checkit("9e-05", buf);
9760
9761         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9762         checkit("1", buf);
9763
9764         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9765         checkit("1.1", buf);
9766
9767         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9768         checkit("1.01", buf);
9769
9770         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9771         checkit("1.001", buf);
9772
9773         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9774         checkit("1.0001", buf);
9775
9776         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9777         checkit("1.00001", buf);
9778
9779         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9780         checkit("1.000001", buf);
9781
9782         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9783         checkit("0", buf);
9784
9785         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9786         checkit("-1", buf);
9787
9788         /* Some Linux gcvt's give 1.e+5 here. */
9789         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9790         checkit("100000", buf);
9791
9792         /* Some Linux gcvt's give -1.e+5 here. */
9793         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9794         checkit("-100000", buf);
9795
9796         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9797         checkit("123.456", buf);
9798
9799         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9800         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9801         /* 34 should be enough to scare even long double
9802          * places into using the e notation. */
9803         if (strlen(buf) > 5)
9804             checkit("1e+034", buf); /* for Microsoft */
9805         else
9806             checkit("1e+34", buf);
9807
9808         /* For Perl, if you add additional tests here, also add them to
9809          * t/base/num.t for benefit of platforms not using Configure or
9810          * overriding d_Gconvert */
9811
9812         exit(0);
9813 }
9814 EOP
9815 : first add preferred functions to our list
9816 xxx_list=""
9817 for xxx_convert in $gconvert_preference; do
9818     case $xxx_convert in
9819     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9820     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9821     esac
9822 done
9823 : then add any others
9824 for xxx_convert in gconvert gcvt sprintf; do
9825     case "$xxx_list" in
9826     *$xxx_convert*) ;;
9827     *) xxx_list="$xxx_list $xxx_convert" ;;
9828     esac
9829 done
9830
9831 case "$d_longdbl$uselongdouble" in
9832 "$define$define")
9833     : again, add preferred functions to our list first
9834     xxx_ld_list=""
9835     for xxx_convert in $gconvert_ld_preference; do
9836         case $xxx_convert in
9837         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9838         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9839         esac
9840     done
9841     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9842     for xxx_convert in qgcvt sprintf $xxx_list; do
9843         case "$xxx_ld_list" in
9844         $xxx_convert*|*" $xxx_convert"*) ;;
9845         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9846         esac
9847     done
9848     : if sprintf cannot do long doubles, move it to the end
9849     if test "$d_PRIgldbl" != "$define"; then
9850         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9851     fi
9852     : if no qgcvt, remove it
9853     if test "$d_qgcvt" != "$define"; then
9854         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9855     fi
9856     : use the ld_list
9857     xxx_list="$xxx_ld_list"
9858     ;;
9859 esac
9860
9861 for xxx_convert in $xxx_list; do
9862         echo "Trying $xxx_convert..."
9863         $rm -f try try$_o core
9864         set try -DTRY_$xxx_convert
9865         if eval $compile; then
9866                 echo "$xxx_convert() found." >&4
9867                 if $run ./try; then
9868                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9869                         break;
9870                 else
9871                         echo "...But $xxx_convert didn't work as I expected."
9872                         xxx_convert=''
9873                 fi
9874         else
9875                 echo "$xxx_convert NOT found." >&4
9876         fi
9877 done
9878
9879 if test X$xxx_convert = X; then
9880     echo "*** WHOA THERE!!! ***" >&4
9881     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9882     xxx_convert=sprintf
9883 fi
9884
9885 case "$xxx_convert" in
9886 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9887 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9888 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9889 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9890    "$define$define$define")
9891       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9892    "$define$define$undef")
9893       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9894    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9895    esac
9896    ;;
9897 esac
9898
9899 fi
9900 $rm_try
9901
9902 : see if _fwalk exists
9903 set fwalk d__fwalk
9904 eval $inlibc
9905
9906 : Initialize h_fcntl
9907 h_fcntl=false
9908
9909 : Initialize h_sysfile
9910 h_sysfile=false
9911
9912 : access call always available on UNIX
9913 set access d_access
9914 eval $inlibc
9915
9916 : locate the flags for 'access()'
9917 case "$d_access" in
9918 "$define")
9919         echo " "
9920         $cat >access.c <<EOCP
9921 #include <sys/types.h>
9922 #ifdef I_FCNTL
9923 #include <fcntl.h>
9924 #endif
9925 #ifdef I_SYS_FILE
9926 #include <sys/file.h>
9927 #endif
9928 #ifdef I_UNISTD
9929 #include <unistd.h>
9930 #endif
9931 #$i_stdlib I_STDLIB
9932 #ifdef I_STDLIB
9933 #include <stdlib.h>
9934 #endif
9935 int main() {
9936         exit(R_OK);
9937 }
9938 EOCP
9939         : check sys/file.h first, no particular reason here
9940         if $test `./findhdr sys/file.h` && \
9941                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9942                 h_sysfile=true;
9943                 echo "<sys/file.h> defines the *_OK access constants." >&4
9944         elif $test `./findhdr fcntl.h` && \
9945                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9946                 h_fcntl=true;
9947                 echo "<fcntl.h> defines the *_OK access constants." >&4
9948         elif $test `./findhdr unistd.h` && \
9949                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9950                 echo "<unistd.h> defines the *_OK access constants." >&4
9951         else
9952                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9953         fi
9954         ;;
9955 esac
9956 $rm -f access*
9957
9958 : see if accessx exists
9959 set accessx d_accessx
9960 eval $inlibc
9961
9962 : see if aintl exists
9963 set aintl d_aintl
9964 eval $inlibc
9965
9966 : see if alarm exists
9967 set alarm d_alarm
9968 eval $inlibc
9969
9970 : see if 64bit time functions exists
9971
9972 set ctime64 d_ctime64
9973 eval $inlibc
9974
9975 set localtime64 d_localtime64
9976 eval $inlibc
9977
9978 set gmtime64 d_gmtime64
9979 eval $inlibc
9980
9981 set mktime64 d_mktime64
9982 eval $inlibc
9983
9984 set difftime64 d_difftime64
9985 eval $inlibc
9986
9987 set asctime64 d_asctime64
9988 eval $inlibc
9989
9990 : see if POSIX threads are available
9991 set pthread.h i_pthread
9992 eval $inhdr
9993
9994 : define a function to check prototypes
9995 $cat > protochk <<EOSH
9996 $startsh
9997 cc="$cc"
9998 optimize="$optimize"
9999 ccflags="$ccflags"
10000 prototype="$prototype"
10001 define="$define"
10002 rm_try="$rm_try"
10003 usethreads=$usethreads
10004 i_pthread=$i_pthread
10005 pthread_h_first=$pthread_h_first
10006 EOSH
10007
10008 $cat >> protochk <<'EOSH'
10009
10010 $rm_try
10011 foo="$1"
10012 shift
10013 while test $# -ge 2; do
10014         case "$1" in
10015                 $define) echo "#include <$2>" >> try.c ;;
10016                 literal) echo "$2" >> try.c ;;
10017         esac
10018     # Extra magic for the benefit of systems that need pthread.h
10019     # to be included early to correctly detect threadsafe functions.
10020     # Such functions must guarantee themselves, though, that the usethreads
10021     # and i_pthread have been defined, before calling protochk.
10022     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
10023         echo "#include <pthread.h>" >> try.c
10024         pthread_h_done=yes
10025     fi
10026     shift 2
10027 done
10028 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10029 cat >> try.c <<'EOCP'
10030 #ifdef CAN_PROTOTYPE
10031 #define _(args) args
10032 #else
10033 #define _(args) ()
10034 #endif
10035 EOCP
10036 echo "$foo" >> try.c
10037 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10038 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10039 status=$?
10040 $rm_try
10041 exit $status
10042 EOSH
10043 chmod +x protochk
10044 $eunicefix protochk
10045
10046 : Define hasproto macro for Configure internal use
10047 hasproto='varname=$1; func=$2; shift; shift;
10048 while $test $# -ge 2; do
10049         case "$1" in
10050         $define) echo "#include <$2>";;
10051         esac ;
10052     shift 2;
10053 done > try.c;
10054 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
10055 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
10056         echo "$func() prototype found.";
10057         val="$define";
10058 else
10059         echo "$func() prototype NOT found.";
10060         val="$undef";
10061 fi;
10062 set $varname;
10063 eval $setvar;
10064 $rm_try tryout.c'
10065
10066 : see if sys/types.h has to be included
10067 set sys/types.h i_systypes
10068 eval $inhdr
10069
10070 : see if sys/select.h has to be included
10071 set sys/select.h i_sysselct
10072 eval $inhdr
10073
10074 : Define hasfield macro for Configure internal use
10075 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
10076 while $test $# -ge 2; do
10077         case "$1" in
10078         $define) echo "#include <$2>";;
10079         esac ;
10080     shift 2;
10081 done > try.c;
10082 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
10083 set try;
10084 if eval $compile; then
10085         val="$define";
10086 else
10087         val="$undef";
10088 fi;
10089 set $varname;
10090 eval $setvar;
10091 $rm_try'
10092
10093 : see if we should include time.h, sys/time.h, or both
10094 echo " "
10095 if test "X$timeincl" = X; then
10096         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
10097         $echo $n "I'm now running the test program...$c"
10098         $cat >try.c <<EOCP
10099 #include <sys/types.h>
10100 #ifdef I_TIME
10101 #include <time.h>
10102 #endif
10103 #ifdef I_SYSTIME
10104 #ifdef SYSTIMEKERNEL
10105 #define KERNEL
10106 #endif
10107 #include <sys/time.h>
10108 #endif
10109 #ifdef I_SYSSELECT
10110 #include <sys/select.h>
10111 #endif
10112 #$i_stdlib I_STDLIB
10113 #ifdef I_STDLIB
10114 #include <stdlib.h>
10115 #endif
10116 int main()
10117 {
10118         struct tm foo;
10119 #ifdef S_TIMEVAL
10120         struct timeval bar;
10121 #endif
10122 #ifdef S_TIMEZONE
10123         struct timezone tzp;
10124 #endif
10125         if (foo.tm_sec == foo.tm_sec)
10126                 exit(0);
10127 #ifdef S_TIMEVAL
10128         if (bar.tv_sec == bar.tv_sec)
10129                 exit(0);
10130 #endif
10131         exit(1);
10132 }
10133 EOCP
10134         flags=''
10135         for s_timezone in '-DS_TIMEZONE' ''; do
10136         sysselect=''
10137         for s_timeval in '-DS_TIMEVAL' ''; do
10138         for i_systimek in '' '-DSYSTIMEKERNEL'; do
10139         for i_time in '' '-DI_TIME'; do
10140         for i_systime in '-DI_SYSTIME' ''; do
10141                 case "$flags" in
10142                 '') $echo $n ".$c"
10143                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
10144                         if eval $compile; then
10145                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
10146                                 shift
10147                                 flags="$*"
10148                                 echo " "
10149                                 $echo $n "Succeeded with $flags$c"
10150                         fi
10151                         ;;
10152                 esac
10153         done
10154         done
10155         done
10156         done
10157         done
10158         timeincl=''
10159         echo " "
10160         case "$flags" in
10161         *SYSTIMEKERNEL*) i_systimek="$define"
10162                 timeincl=`./findhdr sys/time.h`
10163                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
10164         *) i_systimek="$undef";;
10165         esac
10166         case "$flags" in
10167         *I_TIME*) i_time="$define"
10168                 timeincl=`./findhdr time.h`" $timeincl"
10169                 echo "We'll include <time.h>." >&4;;
10170         *) i_time="$undef";;
10171         esac
10172         case "$flags" in
10173         *I_SYSTIME*) i_systime="$define"
10174                 timeincl=`./findhdr sys/time.h`" $timeincl"
10175                 echo "We'll include <sys/time.h>." >&4;;
10176         *) i_systime="$undef";;
10177         esac
10178         $rm_try
10179 fi
10180 : see if struct tm knows about tm_zone
10181 case "$i_systime$i_time" in
10182 *$define*)
10183         echo " "
10184         echo "Checking to see if your struct tm has tm_zone field..." >&4
10185         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
10186         eval $hasfield
10187         ;;
10188 *)      val="$undef"
10189         set d_tm_tm_zone
10190         eval $setvar
10191         ;;
10192 esac
10193 case "$d_tm_tm_zone" in
10194 "$define")      echo "Yes, it does."   ;;
10195 *)              echo "No, it doesn't." ;;
10196 esac
10197 : see if struct tm knows about tm_gmtoff
10198 case "$i_systime$i_time" in
10199 *$define*)
10200         echo " "
10201         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
10202         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
10203         eval $hasfield
10204         ;;
10205 *)      val="$undef"
10206         set d_tm_tm_gmtoff
10207         eval $setvar
10208         ;;
10209 esac
10210 case "$d_tm_tm_gmtoff" in
10211 "$define")      echo "Yes, it does."   ;;
10212 *)              echo "No, it doesn't." ;;
10213 esac
10214
10215 : see if asctime_r exists
10216 set asctime_r d_asctime_r
10217 eval $inlibc
10218 case "$d_asctime_r" in
10219 "$define")
10220         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10221         case "$d_asctime_r_proto:$usethreads" in
10222         ":define")      d_asctime_r_proto=define
10223                 set d_asctime_r_proto asctime_r $hdrs
10224                 eval $hasproto ;;
10225         *)      ;;
10226         esac
10227         case "$d_asctime_r_proto" in
10228         define)
10229         case "$asctime_r_proto" in
10230         ''|0) try='char* asctime_r(const struct tm*, char*);'
10231         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SB ;;
10232         esac
10233         case "$asctime_r_proto" in
10234         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
10235         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=B_SBI ;;
10236         esac
10237         case "$asctime_r_proto" in
10238         ''|0) try='int asctime_r(const struct tm*, char*);'
10239         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SB ;;
10240         esac
10241         case "$asctime_r_proto" in
10242         ''|0) try='int asctime_r(const struct tm*, char*, int);'
10243         ./protochk "$extern_C $try" $hdrs && asctime_r_proto=I_SBI ;;
10244         esac
10245         case "$asctime_r_proto" in
10246         ''|0)   d_asctime_r=undef
10247                 asctime_r_proto=0
10248                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
10249         * )     case "$asctime_r_proto" in
10250                 REENTRANT_PROTO*) ;;
10251                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
10252                 esac
10253                 echo "Prototype: $try" ;;
10254         esac
10255         ;;
10256         *)      case "$usethreads" in
10257                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10258                 esac
10259                 d_asctime_r=undef
10260                 asctime_r_proto=0
10261                 ;;
10262         esac
10263         ;;
10264 *)      asctime_r_proto=0
10265         ;;
10266 esac
10267
10268 : see if atolf exists
10269 set atolf d_atolf
10270 eval $inlibc
10271
10272 : see if atoll exists
10273 set atoll d_atoll
10274 eval $inlibc
10275
10276 : Look for GCC-style attribute format
10277 case "$d_attribute_format" in
10278 '')
10279 echo " "
10280 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10281 $cat >attrib.c <<'EOCP'
10282 #include <stdio.h>
10283 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10284 EOCP
10285 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10286         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10287                 echo "Your C compiler doesn't support __attribute__((format))."
10288                 val="$undef"
10289         else
10290                 echo "Your C compiler supports __attribute__((format))."
10291                 val="$define"
10292         fi
10293 else
10294         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10295         val="$undef"
10296 fi
10297 ;;
10298 *) val="$d_attribute_format" ;;
10299 esac
10300 set d_attribute_format
10301 eval $setvar
10302 $rm -f attrib*
10303
10304 : Look for GCC-style attribute format with null format allowed
10305 case "$d_printf_format_null" in
10306 '') case "$d_attribute_format" in
10307     $define)
10308         echo " "
10309         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10310 $cat >attrib.c <<EOCP
10311 #include <stdio.h>
10312 #$i_stdlib I_STDLIB
10313 #ifdef I_STDLIB
10314 #include <stdlib.h>
10315 #endif
10316 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10317 int null_printf (char* pat,...) { return (int)pat; }
10318 int main () { exit(null_printf(NULL)); }
10319 EOCP
10320         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10321             : run the executable in case it produces a run-time warning
10322             if $run ./attrib >>attrib.out 2>&1; then
10323                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10324                     echo "Your C compiler doesn't allow __printf__ format to be null."
10325                     val="$undef"
10326                 else
10327                     echo "Your C compiler allows __printf__ format to be null."
10328                     val="$define"
10329                 fi
10330             else
10331             echo "Your C compiler executable failed with __printf__ format null."
10332             val="$undef"
10333         fi
10334     else
10335         echo "Your C compiler fails with __printf__ format null."
10336         val="$undef"
10337     fi
10338     ;;
10339     *)  val="$undef" ;;
10340     esac
10341 ;;
10342 *)  val="$d_printf_format_null" ;;
10343 esac
10344 set d_printf_format_null
10345 eval $setvar
10346 $rm -f attrib*
10347
10348 : Look for GCC-style attribute malloc
10349 case "$d_attribute_malloc" in
10350 '')
10351 echo " "
10352 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10353 $cat >attrib.c <<'EOCP'
10354 #include <stdio.h>
10355 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10356 EOCP
10357 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10358         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10359                 echo "Your C compiler doesn't support __attribute__((malloc))."
10360                 val="$undef"
10361         else
10362                 echo "Your C compiler supports __attribute__((malloc))."
10363                 val="$define"
10364         fi
10365 else
10366         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10367         val="$undef"
10368 fi
10369 ;;
10370 *) val="$d_attribute_malloc" ;;
10371 esac
10372 set d_attribute_malloc
10373 eval $setvar
10374 $rm -f attrib*
10375
10376 : Look for GCC-style attribute nonnull
10377 case "$d_attribute_nonnull" in
10378 '')
10379 echo " "
10380 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10381 $cat >attrib.c <<'EOCP'
10382 #include <stdio.h>
10383 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10384 EOCP
10385 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10386         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10387                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10388                 val="$undef"
10389         else
10390                 echo "Your C compiler supports __attribute__((nonnull))."
10391                 val="$define"
10392         fi
10393 else
10394         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10395         val="$undef"
10396 fi
10397 ;;
10398 *) val="$d_attribute_nonnull" ;;
10399 esac
10400 set d_attribute_nonnull
10401 eval $setvar
10402 $rm -f attrib*
10403
10404 : Look for GCC-style attribute noreturn
10405 case "$d_attribute_noreturn" in
10406 '')
10407 echo " "
10408 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10409 $cat >attrib.c <<'EOCP'
10410 #include <stdio.h>
10411 void fall_over_dead( void ) __attribute__((noreturn));
10412 EOCP
10413 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10414         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10415                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10416                 val="$undef"
10417         else
10418                 echo "Your C compiler supports __attribute__((noreturn))."
10419                 val="$define"
10420         fi
10421 else
10422         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10423         val="$undef"
10424 fi
10425 ;;
10426 *) val="$d_attribute_noreturn" ;;
10427 esac
10428 set d_attribute_noreturn
10429 eval $setvar
10430 $rm -f attrib*
10431
10432 : Look for GCC-style attribute pure
10433 case "$d_attribute_pure" in
10434 '')
10435 echo " "
10436 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10437 $cat >attrib.c <<'EOCP'
10438 #include <stdio.h>
10439 int square( int n ) __attribute__((pure));
10440 EOCP
10441 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10442         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10443                 echo "Your C compiler doesn't support __attribute__((pure))."
10444                 val="$undef"
10445         else
10446                 echo "Your C compiler supports __attribute__((pure))."
10447                 val="$define"
10448         fi
10449 else
10450         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10451         val="$undef"
10452 fi
10453 ;;
10454 *) val="$d_attribute_pure" ;;
10455 esac
10456 set d_attribute_pure
10457 eval $setvar
10458 $rm -f attrib*
10459
10460 : Look for GCC-style attribute unused
10461 case "$d_attribute_unused" in
10462 '')
10463 echo " "
10464 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10465 $cat >attrib.c <<'EOCP'
10466 #include <stdio.h>
10467 int do_something( int dummy __attribute__((unused)), int n );
10468 EOCP
10469 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10470         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10471                 echo "Your C compiler doesn't support __attribute__((unused))."
10472                 val="$undef"
10473         else
10474                 echo "Your C compiler supports __attribute__((unused))."
10475                 val="$define"
10476         fi
10477 else
10478         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10479         val="$undef"
10480 fi
10481 ;;
10482 *) val="$d_attribute_unused" ;;
10483 esac
10484 set d_attribute_unused
10485 eval $setvar
10486 $rm -f attrib*
10487
10488 : Look for GCC-style attribute deprecated
10489 case "$d_attribute_deprecated" in
10490 '')
10491 echo " "
10492 echo "Checking whether your compiler can handle __attribute__((deprecated)) ..." >&4
10493 $cat >attrib.c <<'EOCP'
10494 #include <stdio.h>
10495 int I_am_deprecated(void) __attribute__((deprecated));
10496 EOCP
10497 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10498         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10499                 echo "Your C compiler doesn't support __attribute__((deprecated))."
10500                 val="$undef"
10501         else
10502                 echo "Your C compiler supports __attribute__((deprecated))."
10503                 val="$define"
10504         fi
10505 else
10506         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10507         val="$undef"
10508 fi
10509 ;;
10510 *) val="$d_attribute_deprecated" ;;
10511 esac
10512 set d_attribute_deprecated
10513 eval $setvar
10514 $rm -f attrib*
10515
10516 : Look for GCC-style attribute warn_unused_result
10517 case "$d_attribute_warn_unused_result" in
10518 '')
10519 echo " "
10520 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10521 $cat >attrib.c <<'EOCP'
10522 #include <stdio.h>
10523 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10524 EOCP
10525 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10526         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10527                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10528                 val="$undef"
10529         else
10530                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10531                 val="$define"
10532         fi
10533 else
10534         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10535         val="$undef"
10536 fi
10537 ;;
10538 *) val="$d_attribute_warn_unused_result" ;;
10539 esac
10540 set d_attribute_warn_unused_result
10541 eval $setvar
10542 $rm -f attrib*
10543
10544 : see if bcmp exists
10545 set bcmp d_bcmp
10546 eval $inlibc
10547
10548 : see if bcopy exists
10549 set bcopy d_bcopy
10550 eval $inlibc
10551
10552 : see if getpgrp exists
10553 set getpgrp d_getpgrp
10554 eval $inlibc
10555
10556 case "$d_getpgrp" in
10557 "$define")
10558         echo " "
10559         echo "Checking to see which flavor of getpgrp is in use..."
10560         $cat >try.c <<EOP
10561 #$i_unistd I_UNISTD
10562 #include <sys/types.h>
10563 #ifdef I_UNISTD
10564 #  include <unistd.h>
10565 #endif
10566 #$i_stdlib I_STDLIB
10567 #ifdef I_STDLIB
10568 #include <stdlib.h>
10569 #endif
10570 int main()
10571 {
10572         if (getuid() == 0) {
10573                 printf("(I see you are running Configure as super-user...)\n");
10574                 setuid(1);
10575         }
10576 #ifdef TRY_BSD_PGRP
10577         if (getpgrp(1) == 0)
10578                 exit(0);
10579 #else
10580         if (getpgrp() > 0)
10581                 exit(0);
10582 #endif
10583         exit(1);
10584 }
10585 EOP
10586         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10587                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10588                 val="$define"
10589         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10590                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10591                 val="$undef"
10592         else
10593                 echo "I can't seem to compile and run the test program."
10594                 if ./usg; then
10595                         xxx="a USG one, i.e. you use getpgrp()."
10596                 else
10597                         # SVR4 systems can appear rather BSD-ish.
10598                         case "$i_unistd" in
10599                         $undef)
10600                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10601                                 val="$define"
10602                                 ;;
10603                         $define)
10604                                 xxx="probably a USG one, i.e. you use getpgrp()."
10605                                 val="$undef"
10606                                 ;;
10607                         esac
10608                 fi
10609                 echo "Assuming your getpgrp is $xxx" >&4
10610         fi
10611         ;;
10612 *) val="$undef";;
10613 esac
10614 set d_bsdgetpgrp
10615 eval $setvar
10616 $rm_try
10617
10618 : see if setpgrp exists
10619 set setpgrp d_setpgrp
10620 eval $inlibc
10621
10622 case "$d_setpgrp" in
10623 "$define")
10624         echo " "
10625         echo "Checking to see which flavor of setpgrp is in use..."
10626         $cat >try.c <<EOP
10627 #$i_unistd I_UNISTD
10628 #include <sys/types.h>
10629 #ifdef I_UNISTD
10630 #  include <unistd.h>
10631 #endif
10632 #$i_stdlib I_STDLIB
10633 #ifdef I_STDLIB
10634 #include <stdlib.h>
10635 #endif
10636 int main()
10637 {
10638         if (getuid() == 0) {
10639                 printf("(I see you are running Configure as super-user...)\n");
10640                 setuid(1);
10641         }
10642 #ifdef TRY_BSD_PGRP
10643         if (-1 == setpgrp(1, 1))
10644                 exit(0);
10645 #else
10646         if (setpgrp() != -1)
10647                 exit(0);
10648 #endif
10649         exit(1);
10650 }
10651 EOP
10652         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10653                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10654                 val="$define"
10655         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10656                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10657                 val="$undef"
10658         else
10659                 echo "(I can't seem to compile and run the test program.)"
10660                 if ./usg; then
10661                         xxx="a USG one, i.e. you use setpgrp()."
10662                 else
10663                         # SVR4 systems can appear rather BSD-ish.
10664                         case "$i_unistd" in
10665                         $undef)
10666                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10667                                 val="$define"
10668                                 ;;
10669                         $define)
10670                                 xxx="probably a USG one, i.e. you use setpgrp()."
10671                                 val="$undef"
10672                                 ;;
10673                         esac
10674                 fi
10675                 echo "Assuming your setpgrp is $xxx" >&4
10676         fi
10677         ;;
10678 *) val="$undef";;
10679 esac
10680 set d_bsdsetpgrp
10681 eval $setvar
10682 $rm_try
10683
10684 : Look for GCC-style __builtin_choose_expr
10685 case "$d_builtin_choose_expr" in
10686 '')
10687     echo " "
10688     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10689     $cat >try.c <<'EOCP'
10690 #include <assert.h>
10691 #include <stdlib.h>
10692 #include <stdio.h>
10693
10694 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10695
10696 int main(void) {
10697     assert( SYRINX(1) == 2112 );
10698     assert( SYRINX(1) != 5150 );
10699     assert( SYRINX(0) == 5150 );
10700     assert( SYRINX(0) != 2112 );
10701     puts( "All good!" );
10702     exit(0);
10703 }
10704
10705 EOCP
10706     set try
10707     if eval $compile && $run ./try; then
10708         echo "Your C compiler supports __builtin_choose_expr."
10709         val="$define"
10710     else
10711         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10712         val="$undef"
10713     fi
10714 ;;
10715 *) val="$d_builtin_choose_expr" ;;
10716 esac
10717
10718 set d_builtin_choose_expr
10719 eval $setvar
10720 $rm_try
10721
10722 : Look for GCC-style __builtin_expect
10723 case "$d_builtin_expect" in
10724 '')
10725     echo " "
10726     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10727     $cat >try.c <<'EOCP'
10728 int main(void) {
10729     int n = 50;
10730     if ( __builtin_expect(n, 0) ) n = 1;
10731     /* Remember shell exit code truth is 0, C truth is non-zero */
10732     return !(n == 1);
10733 }
10734 EOCP
10735     set try
10736     if eval $compile && $run ./try; then
10737         echo "Your C compiler supports __builtin_expect."
10738         val="$define"
10739     else
10740         echo "Your C compiler doesn't seem to understand __builtin_expect."
10741         val="$undef"
10742     fi
10743     ;;
10744 *) val="$d_builtin_expect" ;;
10745 esac
10746
10747 set d_builtin_expect
10748 eval $setvar
10749 $rm_try
10750
10751 : see if bzero exists
10752 set bzero d_bzero
10753 eval $inlibc
10754
10755 : see if stdarg is available
10756 echo " "
10757 if $test `./findhdr stdarg.h`; then
10758         echo "<stdarg.h> found." >&4
10759         valstd="$define"
10760 else
10761         echo "<stdarg.h> NOT found." >&4
10762         valstd="$undef"
10763 fi
10764
10765 : see if varags is available
10766 echo " "
10767 if $test `./findhdr varargs.h`; then
10768         echo "<varargs.h> found." >&4
10769 else
10770         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10771 fi
10772
10773 : set up the varargs testing programs
10774 $cat > varargs.c <<EOP
10775 #ifdef I_STDARG
10776 #include <stdarg.h>
10777 #endif
10778 #ifdef I_VARARGS
10779 #include <varargs.h>
10780 #endif
10781
10782 #ifdef I_STDARG
10783 int f(char *p, ...)
10784 #else
10785 int f(va_alist)
10786 va_dcl
10787 #endif
10788 {
10789         va_list ap;
10790 #ifndef I_STDARG
10791         char *p;
10792 #endif
10793 #ifdef I_STDARG
10794         va_start(ap,p);
10795 #else
10796         va_start(ap);
10797         p = va_arg(ap, char *);
10798 #endif
10799         va_end(ap);
10800         return 0;
10801 }
10802 EOP
10803 $cat > varargs <<EOP
10804 $startsh
10805 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10806         echo "true"
10807 else
10808         echo "false"
10809 fi
10810 $rm -f varargs$_o
10811 EOP
10812 chmod +x varargs
10813
10814 : now check which varargs header should be included
10815 echo " "
10816 i_varhdr=''
10817 case "$valstd" in
10818 "$define")
10819         if `./varargs I_STDARG`; then
10820                 val='stdarg.h'
10821         elif `./varargs I_VARARGS`; then
10822                 val='varargs.h'
10823         fi
10824         ;;
10825 *)
10826         if `./varargs I_VARARGS`; then
10827                 val='varargs.h'
10828         fi
10829         ;;
10830 esac
10831 case "$val" in
10832 '')
10833 echo "I could not find the definition for va_dcl... You have problems..." >&4
10834         val="$undef"; set i_stdarg; eval $setvar
10835         val="$undef"; set i_varargs; eval $setvar
10836         ;;
10837 *)
10838         set i_varhdr
10839         eval $setvar
10840         case "$i_varhdr" in
10841         stdarg.h)
10842                 val="$define"; set i_stdarg; eval $setvar
10843                 val="$undef"; set i_varargs; eval $setvar
10844                 ;;
10845         varargs.h)
10846                 val="$undef"; set i_stdarg; eval $setvar
10847                 val="$define"; set i_varargs; eval $setvar
10848                 ;;
10849         esac
10850         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10851 esac
10852 $rm -f varargs*
10853
10854 : see if the Compiler supports C99 variadic macros
10855 case "$i_stdarg$i_stdlib" in
10856     "$define$define")
10857     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10858     $cat >try.c <<EOCP
10859 #include <stdio.h>
10860 #include <stdarg.h>
10861
10862 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10863
10864 int main() {
10865   char buf[20];
10866   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10867   puts(buf);
10868   return 0;
10869 }
10870 EOCP
10871     set try
10872     if eval $compile && $run ./try 2>&1 >/dev/null; then
10873         case "`$run ./try`" in
10874             "123 456 789")
10875             echo "You have C99 variadic macros." >&4
10876             d_c99_variadic_macros="$define"
10877             ;;
10878             *)
10879             echo "You don't have functional C99 variadic macros." >&4
10880             d_c99_variadic_macros="$undef"
10881             ;;
10882         esac
10883     else
10884         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10885         d_c99_variadic_macros="$undef"
10886     fi
10887     $rm_try
10888     ;;
10889     *)
10890     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10891     d_c99_variadic_macros="$undef"
10892     ;;
10893 esac
10894
10895 : see if signal is declared as pointer to function returning int or void
10896 echo " "
10897 xxx=`./findhdr signal.h`
10898 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10899 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10900         echo "You have int (*signal())() instead of void." >&4
10901         val="$undef"
10902 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10903         echo "You have void (*signal())()." >&4
10904         val="$define"
10905 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10906         echo "You have int (*signal())() instead of void." >&4
10907         val="$undef"
10908 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10909         echo "You have void (*signal())()." >&4
10910         val="$define"
10911 else
10912         case "$d_voidsig" in
10913         '')
10914         echo "I can't determine whether signal handler returns void or int..." >&4
10915                 dflt=void
10916                 rp="What type does your signal handler return?"
10917                 . ./myread
10918                 case "$ans" in
10919                 v*) val="$define";;
10920                 *) val="$undef";;
10921                 esac;;
10922         "$define")
10923                 echo "As you already told me, signal handler returns void." >&4
10924                 val="$define"
10925                 ;;
10926         *)      echo "As you already told me, signal handler returns int." >&4
10927                 val="$undef"
10928                 ;;
10929         esac
10930 fi
10931 set d_voidsig
10932 eval $setvar
10933 case "$d_voidsig" in
10934 "$define") signal_t="void";;
10935 *) signal_t="int";;
10936 esac
10937 $rm -f $$.tmp
10938
10939 : check for ability to cast large floats to 32-bit ints.
10940 echo " "
10941 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10942 if $test "$intsize" -ge 4; then
10943         xxx=int
10944 else
10945         xxx=long
10946 fi
10947 $cat >try.c <<EOCP
10948 #include <stdio.h>
10949 #$i_stdlib I_STDLIB
10950 #ifdef I_STDLIB
10951 #include <stdlib.h>
10952 #endif
10953 #include <sys/types.h>
10954 #include <signal.h>
10955 $signal_t blech(int s) { exit(3); }
10956 int main()
10957 {
10958         $xxx i32;
10959         double f, g;
10960         int result = 0;
10961         char str[16];
10962         signal(SIGFPE, blech);
10963
10964         /* Don't let compiler optimize the test away.  Store the number
10965            in a writable string for gcc to pass to sscanf under HP-UX.
10966         */
10967         sprintf(str, "2147483647");
10968         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10969         g = 10 * f;
10970         i32  = ($xxx) g;
10971
10972         /* x86 processors will probably give 0x8000 0000, which is a
10973            sign change.  We don't want that.  We want to mimic SPARC
10974            behavior here, which is to preserve the sign and give
10975            back 0x7fff ffff.
10976         */
10977         if (i32 != ($xxx) f)
10978                 result |= 1;
10979         exit(result);
10980 }
10981 EOCP
10982 set try
10983 if eval $compile_ok; then
10984         $run ./try
10985         yyy=$?
10986 else
10987         echo "(I can't seem to compile the test program--assuming it can't)"
10988         yyy=1
10989 fi
10990 case "$yyy" in
10991 0)      val="$define"
10992         echo "Yup, it can."
10993         ;;
10994 *)      val="$undef"
10995         echo "Nope, it can't."
10996         ;;
10997 esac
10998 set d_casti32
10999 eval $setvar
11000 $rm_try
11001
11002 : check for ability to cast negative floats to unsigned
11003 echo " "
11004 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
11005 $cat >try.c <<EOCP
11006 #include <stdio.h>
11007 #$i_stdlib I_STDLIB
11008 #ifdef I_STDLIB
11009 #include <stdlib.h>
11010 #endif
11011 #include <sys/types.h>
11012 #include <signal.h>
11013 $signal_t blech(int s) { exit(7); }
11014 $signal_t blech_in_list(int s) { exit(4); }
11015 unsigned long dummy_long(unsigned long p) { return p; }
11016 unsigned int dummy_int(unsigned int p) { return p; }
11017 unsigned short dummy_short(unsigned short p) { return p; }
11018 int main()
11019 {
11020         double f;
11021         unsigned long along;
11022         unsigned int aint;
11023         unsigned short ashort;
11024         int result = 0;
11025         char str[16];
11026
11027         /* Frustrate gcc-2.7.2's optimizer which failed this test with
11028            a direct f = -123. assignment.  gcc-2.8.0 reportedly
11029            optimized the whole file away
11030         */
11031         /* Store the number in a writable string for gcc to pass to
11032            sscanf under HP-UX.
11033         */
11034         sprintf(str, "-123");
11035         sscanf(str, "%lf", &f);  /* f = -123.; */
11036
11037         signal(SIGFPE, blech);
11038         along = (unsigned long)f;
11039         aint = (unsigned int)f;
11040         ashort = (unsigned short)f;
11041         if (along != (unsigned long)-123)
11042                 result |= 1;
11043         if (aint != (unsigned int)-123)
11044                 result |= 1;
11045         if (ashort != (unsigned short)-123)
11046                 result |= 1;
11047         sprintf(str, "1073741824.");
11048         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
11049         f = f + f;
11050         along = 0;
11051         along = (unsigned long)f;
11052         if (along != 0x80000000)
11053                 result |= 2;
11054         f -= 1.;
11055         along = 0;
11056         along = (unsigned long)f;
11057         if (along != 0x7fffffff)
11058                 result |= 1;
11059         f += 2.;
11060         along = 0;
11061         along = (unsigned long)f;
11062         if (along != 0x80000001)
11063                 result |= 2;
11064         if (result)
11065                 exit(result);
11066         signal(SIGFPE, blech_in_list);
11067         sprintf(str, "123.");
11068         sscanf(str, "%lf", &f);  /* f = 123.; */
11069         along = dummy_long((unsigned long)f);
11070         aint = dummy_int((unsigned int)f);
11071         ashort = dummy_short((unsigned short)f);
11072         if (along != (unsigned long)123)
11073                 result |= 4;
11074         if (aint != (unsigned int)123)
11075                 result |= 4;
11076         if (ashort != (unsigned short)123)
11077                 result |= 4;
11078         exit(result);
11079
11080 }
11081 EOCP
11082 set try
11083 if eval $compile_ok; then
11084         $run ./try
11085         castflags=$?
11086 else
11087         echo "(I can't seem to compile the test program--assuming it can't)"
11088         castflags=7
11089 fi
11090 case "$castflags" in
11091 0)      val="$define"
11092         echo "Yup, it can."
11093         ;;
11094 *)      val="$undef"
11095         echo "Nope, it can't."
11096         ;;
11097 esac
11098 set d_castneg
11099 eval $setvar
11100 $rm_try
11101
11102 : see if vprintf exists
11103 echo " "
11104 if set vprintf val -f d_vprintf; eval $csym; $val; then
11105         echo 'vprintf() found.' >&4
11106         val="$define"
11107         $cat >try.c <<EOF
11108 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
11109 #$i_varargs I_VARARGS
11110
11111 #$i_stdlib I_STDLIB
11112 #$i_unistd I_UNISTD
11113
11114 #ifdef I_STDARG
11115 #  include <stdarg.h>
11116 #else /* I_VARARGS */
11117 #  include <varargs.h>
11118 #endif
11119
11120 #ifdef I_UNISTD
11121 #  include <unistd.h>
11122 #endif
11123
11124 #ifdef I_STDLIB
11125 #  include <stdlib.h>
11126 #endif
11127
11128 #include <stdio.h> /* vsprintf prototype */
11129
11130 #ifdef I_STDARG
11131 void xxx(int n, ...)
11132 {
11133     va_list args;
11134     char buf[10];
11135     va_start(args, n);
11136     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11137 }
11138 int main() { xxx(1, "foo"); }
11139
11140 #else /* I_VARARGS */
11141
11142 xxx(va_alist)
11143 va_dcl
11144 {
11145     va_list args;
11146     char buf[10];
11147     va_start(args);
11148     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
11149 }
11150 int main() { xxx("foo"); }
11151
11152 #endif
11153
11154 EOF
11155         set try
11156         if eval $compile_ok; then
11157                 if $run ./try; then
11158                         echo "Your vsprintf() returns (int)." >&4
11159                         val2="$undef"
11160                 else
11161                         echo "Your vsprintf() returns (char*)." >&4
11162                         val2="$define"
11163                 fi
11164         else
11165                 echo 'I am unable to compile the vsprintf() test program.' >&4
11166                 # We shouldn't get here.  If we do, assume the standard signature,
11167                 # not the old BSD one.
11168                 echo 'Guessing that vsprintf() returns (int).' >&4
11169                 val2="$undef"
11170         fi
11171 else
11172         echo 'vprintf() NOT found.' >&4
11173         val="$undef"
11174         val2="$undef"
11175 fi
11176 $rm_try
11177 set d_vprintf
11178 eval $setvar
11179 val=$val2
11180 set d_charvspr
11181 eval $setvar
11182
11183 : see if chown exists
11184 set chown d_chown
11185 eval $inlibc
11186
11187 : see if chroot exists
11188 set chroot d_chroot
11189 eval $inlibc
11190
11191 : see if chsize exists
11192 set chsize d_chsize
11193 eval $inlibc
11194
11195 : see if class exists
11196 set class d_class
11197 eval $inlibc
11198
11199 : see if clearenv exists
11200 set clearenv d_clearenv
11201 eval $inlibc
11202
11203 : Define hasstruct macro for Configure internal use
11204 hasstruct='varname=$1; struct=$2; shift; shift;
11205 while $test $# -ge 2; do
11206         case "$1" in
11207         $define) echo "#include <$2>";;
11208         esac ;
11209     shift 2;
11210 done > try.c;
11211 echo "int main () { struct $struct foo; }" >> try.c;
11212 set try;
11213 if eval $compile; then
11214         val="$define";
11215 else
11216         val="$undef";
11217 fi;
11218 set $varname;
11219 eval $setvar;
11220 $rm_try'
11221
11222 : see whether socket exists
11223 socketlib=''
11224 sockethdr=''
11225 echo " "
11226 $echo $n "Hmm... $c" >&4
11227 if set socket val -f d_socket; eval $csym; $val; then
11228         echo "Looks like you have Berkeley networking support." >&4
11229         d_socket="$define"
11230         if set setsockopt val -f; eval $csym; $val; then
11231                 d_oldsock="$undef"
11232         else
11233                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
11234                 d_oldsock="$define"
11235         fi
11236 else
11237         if $contains socklib libc.list >/dev/null 2>&1; then
11238                 echo "Looks like you have Berkeley networking support." >&4
11239                 d_socket="$define"
11240                 : we will have to assume that it supports the 4.2 BSD interface
11241                 d_oldsock="$undef"
11242         else
11243                 echo "You don't have Berkeley networking in libc$_a..." >&4
11244                 if test "X$d_socket" = "X$define"; then
11245                    echo "...but you seem to believe that you have sockets." >&4
11246                 else
11247                         for net in net socket
11248                         do
11249                                 if test -f /usr/lib/lib$net$_a; then
11250                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
11251                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
11252                                         if $contains socket libc.list >/dev/null 2>&1; then
11253                                                 d_socket="$define"
11254                                                 socketlib="-l$net"
11255                                                 case "$net" in
11256                                                 net)
11257                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
11258                                                         sockethdr="-I/usr/netinclude"
11259                                                         ;;
11260                                                 esac
11261                                                 echo "Found Berkeley sockets interface in lib$net." >&4
11262                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
11263                                                         d_oldsock="$undef"
11264                                                 else
11265                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
11266                                                         d_oldsock="$define"
11267                                                 fi
11268                                                 break
11269                                         fi
11270                                 fi
11271                         done
11272                         if test "X$d_socket" != "X$define"; then
11273                            echo "or anywhere else I see." >&4
11274                            d_socket="$undef"
11275                            d_oldsock="$undef"
11276                         fi
11277                 fi
11278         fi
11279 fi
11280
11281 : see if socketpair exists
11282 set socketpair d_sockpair
11283 eval $inlibc
11284
11285
11286 echo " "
11287 echo "Checking the availability sa_len in the sock struct ..." >&4
11288 $cat >try.c <<EOF
11289 #include <sys/types.h>
11290 #include <sys/socket.h>
11291 int main() {
11292 struct sockaddr sa;
11293 return (sa.sa_len);
11294 }
11295 EOF
11296 val="$undef"
11297 set try; if eval $compile; then
11298         val="$define"
11299 fi
11300 set d_sockaddr_sa_len; eval $setvar
11301 $rm_try
11302
11303 echo " "
11304 echo "Checking the availability struct sockaddr_in6 ..." >&4
11305 $cat >try.c <<EOF
11306 #include <sys/types.h>
11307 #include <sys/socket.h>
11308 #include <netinet/in.h>
11309 int main() {
11310 struct sockaddr_in6 sin6;
11311 return (sin6.sin6_family);
11312 }
11313 EOF
11314 val="$undef"
11315 set try; if eval $compile; then
11316         val="$define"
11317 fi
11318 set d_sockaddr_in6; eval $setvar
11319 $rm_try
11320
11321 echo " "
11322 echo "Checking the availability sin6_scope_id in struct sockaddr_in6 ..." >&4
11323 $cat >try.c <<EOF
11324 #include <sys/types.h>
11325 #include <sys/socket.h>
11326 #include <netinet/in.h>
11327 int main() {
11328 struct sockaddr_in6 sin6;
11329 return (sin6.sin6_scope_id);
11330 }
11331 EOF
11332 val="$undef"
11333 set try; if eval $compile; then
11334         val="$define"
11335 fi
11336 set d_sin6_scope_id; eval $setvar
11337 $rm_try
11338
11339 echo " "
11340 echo "Checking the availability struct ipv6_mreq ..." >&4
11341 $cat >try.c <<EOF
11342 #include <sys/types.h>
11343 #include <sys/socket.h>
11344 #include <netinet/in.h>
11345 int main() {
11346 struct ipv6_mreq mreq;
11347 return (mreq.ipv6mr_interface);
11348 }
11349 EOF
11350 val="$undef"
11351 set try; if eval $compile; then
11352         val="$define"
11353 fi
11354 set d_ipv6_mreq; eval $setvar
11355 $rm_try
11356
11357 echo " "
11358 echo "Checking the availability of certain socket constants..." >&4
11359 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11360         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11361         $cat >try.c <<EOF
11362 #include <sys/types.h>
11363 #include <sys/socket.h>
11364 int main() {
11365     int i = $ENUM;
11366 }
11367 EOF
11368         val="$undef"
11369         set try; if eval $compile; then
11370                 val="$define"
11371         fi
11372         set d_${enum}; eval $setvar
11373         $rm_try
11374 done
11375
11376 : see if this is a sys/uio.h system
11377 set sys/uio.h i_sysuio
11378 eval $inhdr
11379
11380 : Check for cmsghdr support
11381 echo " "
11382 echo "Checking to see if your system supports struct cmsghdr..." >&4
11383 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11384 eval $hasstruct
11385 case "$d_cmsghdr_s" in
11386 "$define")      echo "Yes, it does."   ;;
11387 *)              echo "No, it doesn't." ;;
11388 esac
11389
11390
11391 : check for const keyword
11392 echo " "
11393 echo 'Checking to see if your C compiler knows about "const"...' >&4
11394 $cat >const.c <<'EOCP'
11395 typedef struct spug { int drokk; } spug;
11396 int main()
11397 {
11398         const char *foo;
11399         const spug y = { 0 };
11400 }
11401 EOCP
11402 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11403         val="$define"
11404         echo "Yup, it does."
11405 else
11406         val="$undef"
11407         echo "Nope, it doesn't."
11408 fi
11409 set d_const
11410 eval $setvar
11411
11412 : see if copysignl exists
11413 set copysignl d_copysignl
11414 eval $inlibc
11415
11416 : see if crypt exists
11417 echo " "
11418 set crypt d_crypt
11419 eval $inlibc
11420 case "$d_crypt" in
11421 $define) cryptlib='' ;;
11422 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11423                 echo 'crypt() found.' >&4
11424                 val="$define"
11425                 cryptlib=''
11426         else
11427                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11428                 if $test -z "$cryptlib"; then
11429                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11430                 else
11431                         cryptlib=-lcrypt
11432                 fi
11433                 if $test -z "$cryptlib"; then
11434                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11435                 else
11436                         cryptlib=-lcrypt
11437                 fi
11438                 if $test -z "$cryptlib"; then
11439                         cryptlib=`./loc libcrypt$_a "" $libpth`
11440                 else
11441                         cryptlib=-lcrypt
11442                 fi
11443                 if $test -z "$cryptlib"; then
11444                         echo 'crypt() NOT found.' >&4
11445                         val="$undef"
11446                 else
11447                         val="$define"
11448                 fi
11449         fi
11450         set d_crypt
11451         eval $setvar
11452         ;;
11453 esac
11454
11455 : see if this is a crypt.h system
11456 set crypt.h i_crypt
11457 eval $inhdr
11458
11459 : see if crypt_r exists
11460 set crypt_r d_crypt_r
11461 eval $inlibc
11462 case "$d_crypt_r" in
11463 "$define")
11464         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11465         case "$d_crypt_r_proto:$usethreads" in
11466         ":define")      d_crypt_r_proto=define
11467                 set d_crypt_r_proto crypt_r $hdrs
11468                 eval $hasproto ;;
11469         *)      ;;
11470         esac
11471         case "$d_crypt_r_proto" in
11472         define)
11473         case "$crypt_r_proto" in
11474         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11475         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCS ;;
11476         esac
11477         case "$crypt_r_proto" in
11478         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11479         ./protochk "$extern_C $try" $hdrs && crypt_r_proto=B_CCD ;;
11480         esac
11481         case "$crypt_r_proto" in
11482         ''|0)   d_crypt_r=undef
11483                 crypt_r_proto=0
11484                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11485         * )     case "$crypt_r_proto" in
11486                 REENTRANT_PROTO*) ;;
11487                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11488                 esac
11489                 echo "Prototype: $try" ;;
11490         esac
11491         ;;
11492         *)      case "$usethreads" in
11493                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11494                 esac
11495                 d_crypt_r=undef
11496                 crypt_r_proto=0
11497                 ;;
11498         esac
11499         ;;
11500 *)      crypt_r_proto=0
11501         ;;
11502 esac
11503
11504 : get csh whereabouts
11505 case "$csh" in
11506 'csh') val="$undef" ;;
11507 *) val="$define" ;;
11508 esac
11509 set d_csh
11510 eval $setvar
11511 : Respect a hint or command line value for full_csh.
11512 case "$full_csh" in
11513 '') full_csh=$csh ;;
11514 esac
11515
11516 : see if ctermid exists
11517 set ctermid d_ctermid
11518 eval $inlibc
11519
11520 : see if ctermid_r exists
11521 set ctermid_r d_ctermid_r
11522 eval $inlibc
11523 case "$d_ctermid_r" in
11524 "$define")
11525         hdrs="$i_systypes sys/types.h define stdio.h "
11526         case "$d_ctermid_r_proto:$usethreads" in
11527         ":define")      d_ctermid_r_proto=define
11528                 set d_ctermid_r_proto ctermid_r $hdrs
11529                 eval $hasproto ;;
11530         *)      ;;
11531         esac
11532         case "$d_ctermid_r_proto" in
11533         define)
11534         case "$ctermid_r_proto" in
11535         ''|0) try='char* ctermid_r(char*);'
11536         ./protochk "$extern_C $try" $hdrs && ctermid_r_proto=B_B ;;
11537         esac
11538         case "$ctermid_r_proto" in
11539         ''|0)   d_ctermid_r=undef
11540                 ctermid_r_proto=0
11541                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11542         * )     case "$ctermid_r_proto" in
11543                 REENTRANT_PROTO*) ;;
11544                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11545                 esac
11546                 echo "Prototype: $try" ;;
11547         esac
11548         ;;
11549         *)      case "$usethreads" in
11550                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11551                 esac
11552                 d_ctermid_r=undef
11553                 ctermid_r_proto=0
11554                 ;;
11555         esac
11556         ;;
11557 *)      ctermid_r_proto=0
11558         ;;
11559 esac
11560
11561 : see if ctime_r exists
11562 set ctime_r d_ctime_r
11563 eval $inlibc
11564 case "$d_ctime_r" in
11565 "$define")
11566         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11567         case "$d_ctime_r_proto:$usethreads" in
11568         ":define")      d_ctime_r_proto=define
11569                 set d_ctime_r_proto ctime_r $hdrs
11570                 eval $hasproto ;;
11571         *)      ;;
11572         esac
11573         case "$d_ctime_r_proto" in
11574         define)
11575         case "$ctime_r_proto" in
11576         ''|0) try='char* ctime_r(const time_t*, char*);'
11577         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SB ;;
11578         esac
11579         case "$ctime_r_proto" in
11580         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11581         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=B_SBI ;;
11582         esac
11583         case "$ctime_r_proto" in
11584         ''|0) try='int ctime_r(const time_t*, char*);'
11585         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SB ;;
11586         esac
11587         case "$ctime_r_proto" in
11588         ''|0) try='int ctime_r(const time_t*, char*, int);'
11589         ./protochk "$extern_C $try" $hdrs && ctime_r_proto=I_SBI ;;
11590         esac
11591         case "$ctime_r_proto" in
11592         ''|0)   d_ctime_r=undef
11593                 ctime_r_proto=0
11594                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11595         * )     case "$ctime_r_proto" in
11596                 REENTRANT_PROTO*) ;;
11597                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11598                 esac
11599                 echo "Prototype: $try" ;;
11600         esac
11601         ;;
11602         *)      case "$usethreads" in
11603                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11604                 esac
11605                 d_ctime_r=undef
11606                 ctime_r_proto=0
11607                 ;;
11608         esac
11609         ;;
11610 *)      ctime_r_proto=0
11611         ;;
11612 esac
11613
11614 : see if cuserid exists
11615 set cuserid d_cuserid
11616 eval $inlibc
11617
11618 : see if this is a limits.h system
11619 set limits.h i_limits
11620 eval $inhdr
11621
11622 : see if this is a float.h system
11623 set float.h i_float
11624 eval $inhdr
11625
11626 : See if number of significant digits in a double precision number is known
11627 echo " "
11628 $cat >dbl_dig.c <<EOM
11629 #$i_limits I_LIMITS
11630 #$i_float I_FLOAT
11631 #ifdef I_LIMITS
11632 #include <limits.h>
11633 #endif
11634 #ifdef I_FLOAT
11635 #include <float.h>
11636 #endif
11637 #ifdef DBL_DIG
11638 printf("Contains DBL_DIG");
11639 #endif
11640 EOM
11641 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11642 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11643         echo "DBL_DIG found." >&4
11644         val="$define"
11645 else
11646         echo "DBL_DIG NOT found." >&4
11647         val="$undef"
11648 fi
11649 $rm -f dbl_dig.?
11650 set d_dbl_dig
11651 eval $setvar
11652
11653 : see if dbm.h is available
11654 : see if dbmclose exists
11655 set dbmclose d_dbmclose
11656 eval $inlibc
11657
11658 case "$d_dbmclose" in
11659 $define)
11660         set dbm.h i_dbm
11661         eval $inhdr
11662         case "$i_dbm" in
11663         $define)
11664                 val="$undef"
11665                 set i_rpcsvcdbm
11666                 eval $setvar
11667                 ;;
11668         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11669                 eval $inhdr
11670                 ;;
11671         esac
11672         ;;
11673 *)      echo "We won't be including <dbm.h>"
11674         val="$undef"
11675         set i_dbm
11676         eval $setvar
11677         val="$undef"
11678         set i_rpcsvcdbm
11679         eval $setvar
11680         ;;
11681 esac
11682
11683 : see if prototype for dbminit is available
11684 echo " "
11685 set d_dbminitproto dbminit $i_dbm dbm.h
11686 eval $hasproto
11687
11688 : see if difftime exists
11689 set difftime d_difftime
11690 eval $inlibc
11691
11692 : see if this is a dirent system
11693 echo " "
11694 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11695         val="$define"
11696         echo "<dirent.h> found." >&4
11697 else
11698         val="$undef"
11699         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11700                 echo "<sys/dir.h> found." >&4
11701                 echo " "
11702         else
11703                 xinc=`./findhdr sys/ndir.h`
11704         fi
11705         echo "<dirent.h> NOT found." >&4
11706 fi
11707 set i_dirent
11708 eval $setvar
11709
11710 : Look for type of directory structure.
11711 echo " "
11712 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11713
11714 case "$direntrytype" in
11715 ''|' ')
11716         case "$i_dirent" in
11717         $define) guess1='struct dirent' ;;
11718         *) guess1='struct direct'  ;;
11719         esac
11720         ;;
11721 *)      guess1="$direntrytype"
11722         ;;
11723 esac
11724
11725 case "$guess1" in
11726 'struct dirent') guess2='struct direct' ;;
11727 *) guess2='struct dirent' ;;
11728 esac
11729
11730 if $contains "$guess1" try.c >/dev/null 2>&1; then
11731         direntrytype="$guess1"
11732         echo "Your directory entries are $direntrytype." >&4
11733 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11734         direntrytype="$guess2"
11735         echo "Your directory entries seem to be $direntrytype." >&4
11736 else
11737         echo "I don't recognize your system's directory entries." >&4
11738         rp="What type is used for directory entries on this system?"
11739         dflt="$guess1"
11740         . ./myread
11741         direntrytype="$ans"
11742 fi
11743 $rm_try
11744
11745 : see if the directory entry stores field length
11746 echo " "
11747 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11748 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11749         echo "Good, your directory entry keeps length information in d_namlen." >&4
11750         val="$define"
11751 else
11752         echo "Your directory entry does not know about the d_namlen field." >&4
11753         val="$undef"
11754 fi
11755 set d_dirnamlen
11756 eval $setvar
11757 $rm_try
11758
11759 : Look for DIR.dd_fd
11760 case "$i_dirent" in
11761 "$define")
11762     echo "Checking to see if DIR has a dd_fd member variable" >&4
11763     $cat >try.c <<EOCP
11764 #$i_stdlib I_STDLIB
11765 #ifdef I_STDLIB
11766 #include <stdlib.h>
11767 #endif
11768 #include <dirent.h>
11769
11770 int main() {
11771     DIR dir;
11772     dir.dd_fd = 1;
11773     return 0;
11774 }
11775 EOCP
11776     val=$undef
11777     set try
11778     if eval $compile; then
11779         echo "Yes, it does."
11780         val="$define"
11781     else
11782         echo "No, it does not."
11783         val="$undef"
11784     fi
11785     ;;
11786 *)
11787     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11788     val="$undef"
11789     ;;
11790 esac
11791 set d_dir_dd_fd
11792 eval $setvar
11793 $rm_try
11794
11795 : see if this is an sysdir system
11796 set sys/dir.h i_sysdir
11797 eval $inhdr
11798
11799 : see if this is an sysndir system
11800 set sys/ndir.h i_sysndir
11801 eval $inhdr
11802
11803 : Look for dirfd
11804 echo " "
11805 $cat >dirfd.c <<EOM
11806 #include <stdio.h>
11807 #$i_stdlib I_STDLIB
11808 #ifdef I_STDLIB
11809 #include <stdlib.h>
11810 #endif
11811 #$i_dirent I_DIRENT             /**/
11812 #$i_sysdir I_SYS_DIR            /**/
11813 #$i_sysndir I_SYS_NDIR          /**/
11814 #$i_systypes I_SYS_TYPES        /**/
11815 #if defined(I_SYS_TYPES)
11816 #include <sys/types.h>
11817 #endif
11818 #if defined(I_DIRENT)
11819 #include <dirent.h>
11820 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11821 #include <sys/dir.h>
11822 #endif
11823 #else
11824 #ifdef I_SYS_NDIR
11825 #include <sys/ndir.h>
11826 #else
11827 #ifdef I_SYS_DIR
11828 #ifdef hp9000s500
11829 #include <ndir.h>       /* may be wrong in the future */
11830 #else
11831 #include <sys/dir.h>
11832 #endif
11833 #endif
11834 #endif
11835 #endif 
11836 int main() {
11837         DIR *dirp = opendir(".");
11838         if (dirfd(dirp) >= 0)
11839                 exit(0);
11840         else
11841                 exit(1);
11842 }
11843 EOM
11844 val=$undef
11845 set dirfd
11846 if eval $compile; then
11847         val="$define"
11848 fi
11849 case "$val" in
11850 $define)        echo "dirfd() found." >&4       ;;
11851 *)              echo "dirfd() NOT found." >&4   ;;
11852 esac
11853 set d_dirfd
11854 eval $setvar
11855 $rm -f dirfd*
11856
11857 : see if dlerror exists
11858 xxx_runnm="$runnm"
11859 runnm=false
11860 set dlerror d_dlerror
11861 eval $inlibc
11862 runnm="$xxx_runnm"
11863
11864 : see if dlfcn is available
11865 set dlfcn.h i_dlfcn
11866 eval $inhdr
11867
11868 : Check what extension to use for shared libs
11869 case "$usedl" in
11870 $define|y|true)
11871         $cat << EOM
11872
11873 On a few systems, the dynamically loaded modules that perl generates and uses
11874 will need a different extension than shared libs. The default will probably
11875 be appropriate.
11876
11877 EOM
11878         case "$dlext" in
11879         '')     dflt="$so" ;;
11880         *)      dflt="$dlext" ;;
11881         esac
11882         rp='What is the extension of dynamically loaded modules'
11883         . ./myread
11884         dlext="$ans"
11885         ;;
11886 *)
11887         dlext="none"
11888         ;;
11889 esac
11890
11891 : Check if dlsym need a leading underscore
11892 echo " "
11893 val="$undef"
11894
11895 case "$dlsrc" in
11896 dl_dlopen.xs)
11897         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11898         $cat >dyna.c <<'EOM'
11899 fred () { }
11900 EOM
11901
11902 $cat >fred.c<<EOM
11903
11904 #include <stdio.h>
11905 #$i_stdlib I_STDLIB
11906 #ifdef I_STDLIB
11907 #include <stdlib.h>
11908 #endif
11909 #$i_dlfcn I_DLFCN
11910 #ifdef I_DLFCN
11911 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11912 #else
11913 #include <sys/types.h>
11914 #include <nlist.h>
11915 #include <link.h>
11916 #endif
11917
11918 extern int fred() ;
11919
11920 int main()
11921 {
11922     void * handle ;
11923     void * symbol ;
11924 #ifndef RTLD_LAZY
11925     int mode = 1 ;
11926 #else
11927     int mode = RTLD_LAZY ;
11928 #endif
11929     handle = dlopen("./dyna.$dlext", mode) ;
11930     if (handle == NULL) {
11931         printf ("1\n") ;
11932         fflush (stdout) ;
11933         exit(0);
11934     }
11935     symbol = dlsym(handle, "fred") ;
11936     if (symbol == NULL) {
11937         /* try putting a leading underscore */
11938         symbol = dlsym(handle, "_fred") ;
11939         if (symbol == NULL) {
11940             printf ("2\n") ;
11941             fflush (stdout) ;
11942             exit(0);
11943         }
11944         printf ("3\n") ;
11945     }
11946     else
11947         printf ("4\n") ;
11948     fflush (stdout) ;
11949     exit(0);
11950 }
11951 EOM
11952         : Call the object file tmp-dyna.o in case dlext=o.
11953         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
11954                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 &&
11955                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 &&
11956                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11957                 xxx=`$run ./fred`
11958                 case $xxx in
11959                 1)      echo "Test program failed using dlopen." >&4
11960                         echo "Perhaps you should not use dynamic loading." >&4;;
11961                 2)      echo "Test program failed using dlsym." >&4
11962                         echo "Perhaps you should not use dynamic loading." >&4;;
11963                 3)      echo "dlsym needs a leading underscore" >&4
11964                         val="$define" ;;
11965                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11966                 esac
11967         else
11968                 echo "I can't compile and run the test program." >&4
11969                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11970         fi
11971         ;;
11972 esac
11973
11974 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11975
11976 set d_dlsymun
11977 eval $setvar
11978
11979 : see if drand48_r exists
11980 set drand48_r d_drand48_r
11981 eval $inlibc
11982 case "$d_drand48_r" in
11983 "$define")
11984         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11985         case "$d_drand48_r_proto:$usethreads" in
11986         ":define")      d_drand48_r_proto=define
11987                 set d_drand48_r_proto drand48_r $hdrs
11988                 eval $hasproto ;;
11989         *)      ;;
11990         esac
11991         case "$d_drand48_r_proto" in
11992         define)
11993         case "$drand48_r_proto" in
11994         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11995         ./protochk "$extern_C $try" $hdrs && drand48_r_proto=I_ST ;;
11996         esac
11997         case "$drand48_r_proto" in
11998         ''|0)   d_drand48_r=undef
11999                 drand48_r_proto=0
12000                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
12001         * )     case "$drand48_r_proto" in
12002                 REENTRANT_PROTO*) ;;
12003                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
12004                 esac
12005                 echo "Prototype: $try" ;;
12006         esac
12007         ;;
12008         *)      case "$usethreads" in
12009                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
12010                 esac
12011                 d_drand48_r=undef
12012                 drand48_r_proto=0
12013                 ;;
12014         esac
12015         ;;
12016 *)      drand48_r_proto=0
12017         ;;
12018 esac
12019
12020 : see if prototype for drand48 is available
12021 echo " "
12022 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
12023 eval $hasproto
12024
12025 : see if dup2 exists
12026 set dup2 d_dup2
12027 eval $inlibc
12028
12029 : see if eaccess exists
12030 set eaccess d_eaccess
12031 eval $inlibc
12032
12033 : see if endgrent exists
12034 set endgrent d_endgrent
12035 eval $inlibc
12036
12037 : see if this is an grp system
12038 set grp.h i_grp
12039 eval $inhdr
12040
12041 case "$i_grp" in
12042 $define)
12043         xxx=`./findhdr grp.h`
12044         $cppstdin $cppflags $cppminus < $xxx >$$.h
12045
12046         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
12047                 val="$define"
12048         else
12049                 val="$undef"
12050         fi
12051         set d_grpasswd
12052         eval $setvar
12053
12054         $rm -f $$.h
12055         ;;
12056 *)
12057         val="$undef";
12058         set d_grpasswd; eval $setvar
12059         ;;
12060 esac
12061
12062 : see if endgrent_r exists
12063 set endgrent_r d_endgrent_r
12064 eval $inlibc
12065 case "$d_endgrent_r" in
12066 "$define")
12067         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12068         case "$d_endgrent_r_proto:$usethreads" in
12069         ":define")      d_endgrent_r_proto=define
12070                 set d_endgrent_r_proto endgrent_r $hdrs
12071                 eval $hasproto ;;
12072         *)      ;;
12073         esac
12074         case "$d_endgrent_r_proto" in
12075         define)
12076         case "$endgrent_r_proto" in
12077         ''|0) try='int endgrent_r(FILE**);'
12078         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=I_H ;;
12079         esac
12080         case "$endgrent_r_proto" in
12081         ''|0) try='void endgrent_r(FILE**);'
12082         ./protochk "$extern_C $try" $hdrs && endgrent_r_proto=V_H ;;
12083         esac
12084         case "$endgrent_r_proto" in
12085         ''|0)   d_endgrent_r=undef
12086                 endgrent_r_proto=0
12087                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
12088         * )     case "$endgrent_r_proto" in
12089                 REENTRANT_PROTO*) ;;
12090                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
12091                 esac
12092                 echo "Prototype: $try" ;;
12093         esac
12094         ;;
12095         *)      case "$usethreads" in
12096                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
12097                 esac
12098                 d_endgrent_r=undef
12099                 endgrent_r_proto=0
12100                 ;;
12101         esac
12102         ;;
12103 *)      endgrent_r_proto=0
12104         ;;
12105 esac
12106
12107 : see if endhostent exists
12108 set endhostent d_endhent
12109 eval $inlibc
12110
12111 : see if this is a netdb.h system
12112 set netdb.h i_netdb
12113 eval $inhdr
12114
12115 : see if endhostent_r exists
12116 set endhostent_r d_endhostent_r
12117 eval $inlibc
12118 case "$d_endhostent_r" in
12119 "$define")
12120         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12121         case "$d_endhostent_r_proto:$usethreads" in
12122         ":define")      d_endhostent_r_proto=define
12123                 set d_endhostent_r_proto endhostent_r $hdrs
12124                 eval $hasproto ;;
12125         *)      ;;
12126         esac
12127         case "$d_endhostent_r_proto" in
12128         define)
12129         case "$endhostent_r_proto" in
12130         ''|0) try='int endhostent_r(struct hostent_data*);'
12131         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=I_D ;;
12132         esac
12133         case "$endhostent_r_proto" in
12134         ''|0) try='void endhostent_r(struct hostent_data*);'
12135         ./protochk "$extern_C $try" $hdrs && endhostent_r_proto=V_D ;;
12136         esac
12137         case "$endhostent_r_proto" in
12138         ''|0)   d_endhostent_r=undef
12139                 endhostent_r_proto=0
12140                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
12141         * )     case "$endhostent_r_proto" in
12142                 REENTRANT_PROTO*) ;;
12143                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
12144                 esac
12145                 echo "Prototype: $try" ;;
12146         esac
12147         ;;
12148         *)      case "$usethreads" in
12149                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
12150                 esac
12151                 d_endhostent_r=undef
12152                 endhostent_r_proto=0
12153                 ;;
12154         esac
12155         ;;
12156 *)      endhostent_r_proto=0
12157         ;;
12158 esac
12159
12160 : see if endnetent exists
12161 set endnetent d_endnent
12162 eval $inlibc
12163
12164 : see if endnetent_r exists
12165 set endnetent_r d_endnetent_r
12166 eval $inlibc
12167 case "$d_endnetent_r" in
12168 "$define")
12169         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12170         case "$d_endnetent_r_proto:$usethreads" in
12171         ":define")      d_endnetent_r_proto=define
12172                 set d_endnetent_r_proto endnetent_r $hdrs
12173                 eval $hasproto ;;
12174         *)      ;;
12175         esac
12176         case "$d_endnetent_r_proto" in
12177         define)
12178         case "$endnetent_r_proto" in
12179         ''|0) try='int endnetent_r(struct netent_data*);'
12180         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=I_D ;;
12181         esac
12182         case "$endnetent_r_proto" in
12183         ''|0) try='void endnetent_r(struct netent_data*);'
12184         ./protochk "$extern_C $try" $hdrs && endnetent_r_proto=V_D ;;
12185         esac
12186         case "$endnetent_r_proto" in
12187         ''|0)   d_endnetent_r=undef
12188                 endnetent_r_proto=0
12189                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
12190         * )     case "$endnetent_r_proto" in
12191                 REENTRANT_PROTO*) ;;
12192                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
12193                 esac
12194                 echo "Prototype: $try" ;;
12195         esac
12196         ;;
12197         *)      case "$usethreads" in
12198                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
12199                 esac
12200                 d_endnetent_r=undef
12201                 endnetent_r_proto=0
12202                 ;;
12203         esac
12204         ;;
12205 *)      endnetent_r_proto=0
12206         ;;
12207 esac
12208
12209 : see if endprotoent exists
12210 set endprotoent d_endpent
12211 eval $inlibc
12212
12213 : see if endprotoent_r exists
12214 set endprotoent_r d_endprotoent_r
12215 eval $inlibc
12216 case "$d_endprotoent_r" in
12217 "$define")
12218         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12219         case "$d_endprotoent_r_proto:$usethreads" in
12220         ":define")      d_endprotoent_r_proto=define
12221                 set d_endprotoent_r_proto endprotoent_r $hdrs
12222                 eval $hasproto ;;
12223         *)      ;;
12224         esac
12225         case "$d_endprotoent_r_proto" in
12226         define)
12227         case "$endprotoent_r_proto" in
12228         ''|0) try='int endprotoent_r(struct protoent_data*);'
12229         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=I_D ;;
12230         esac
12231         case "$endprotoent_r_proto" in
12232         ''|0) try='void endprotoent_r(struct protoent_data*);'
12233         ./protochk "$extern_C $try" $hdrs && endprotoent_r_proto=V_D ;;
12234         esac
12235         case "$endprotoent_r_proto" in
12236         ''|0)   d_endprotoent_r=undef
12237                 endprotoent_r_proto=0
12238                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
12239         * )     case "$endprotoent_r_proto" in
12240                 REENTRANT_PROTO*) ;;
12241                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
12242                 esac
12243                 echo "Prototype: $try" ;;
12244         esac
12245         ;;
12246         *)      case "$usethreads" in
12247                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
12248                 esac
12249                 d_endprotoent_r=undef
12250                 endprotoent_r_proto=0
12251                 ;;
12252         esac
12253         ;;
12254 *)      endprotoent_r_proto=0
12255         ;;
12256 esac
12257
12258 : see if endpwent exists
12259 set endpwent d_endpwent
12260 eval $inlibc
12261
12262 : see if this is a pwd.h system
12263 set pwd.h i_pwd
12264 eval $inhdr
12265
12266 case "$i_pwd" in
12267 $define)
12268         xxx=`./findhdr pwd.h`
12269         $cppstdin $cppflags $cppminus < $xxx >$$.h
12270
12271         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
12272                 val="$define"
12273         else
12274                 val="$undef"
12275         fi
12276         set d_pwquota
12277         eval $setvar
12278
12279         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
12280                 val="$define"
12281         else
12282                 val="$undef"
12283         fi
12284         set d_pwage
12285         eval $setvar
12286
12287         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
12288                 val="$define"
12289         else
12290                 val="$undef"
12291         fi
12292         set d_pwchange
12293         eval $setvar
12294
12295         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
12296                 val="$define"
12297         else
12298                 val="$undef"
12299         fi
12300         set d_pwclass
12301         eval $setvar
12302
12303         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
12304                 val="$define"
12305         else
12306                 val="$undef"
12307         fi
12308         set d_pwexpire
12309         eval $setvar
12310
12311         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
12312                 val="$define"
12313         else
12314                 val="$undef"
12315         fi
12316         set d_pwcomment
12317         eval $setvar
12318
12319         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
12320                 val="$define"
12321         else
12322                 val="$undef"
12323         fi
12324         set d_pwgecos
12325         eval $setvar
12326
12327         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
12328                 val="$define"
12329         else
12330                 val="$undef"
12331         fi
12332         set d_pwpasswd
12333         eval $setvar
12334
12335         $rm -f $$.h
12336         ;;
12337 *)
12338         val="$undef"; 
12339         set d_pwquota; eval $setvar
12340         set d_pwage; eval $setvar
12341         set d_pwchange; eval $setvar
12342         set d_pwclass; eval $setvar
12343         set d_pwexpire; eval $setvar
12344         set d_pwcomment; eval $setvar
12345         set d_pwgecos; eval $setvar
12346         set d_pwpasswd; eval $setvar
12347         ;;
12348 esac
12349
12350 : see if endpwent_r exists
12351 set endpwent_r d_endpwent_r
12352 eval $inlibc
12353 case "$d_endpwent_r" in
12354 "$define")
12355         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12356         case "$d_endpwent_r_proto:$usethreads" in
12357         ":define")      d_endpwent_r_proto=define
12358                 set d_endpwent_r_proto endpwent_r $hdrs
12359                 eval $hasproto ;;
12360         *)      ;;
12361         esac
12362         case "$d_endpwent_r_proto" in
12363         define)
12364         case "$endpwent_r_proto" in
12365         ''|0) try='int endpwent_r(FILE**);'
12366         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=I_H ;;
12367         esac
12368         case "$endpwent_r_proto" in
12369         ''|0) try='void endpwent_r(FILE**);'
12370         ./protochk "$extern_C $try" $hdrs && endpwent_r_proto=V_H ;;
12371         esac
12372         case "$endpwent_r_proto" in
12373         ''|0)   d_endpwent_r=undef
12374                 endpwent_r_proto=0
12375                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12376         * )     case "$endpwent_r_proto" in
12377                 REENTRANT_PROTO*) ;;
12378                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12379                 esac
12380                 echo "Prototype: $try" ;;
12381         esac
12382         ;;
12383         *)      case "$usethreads" in
12384                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12385                 esac
12386                 d_endpwent_r=undef
12387                 endpwent_r_proto=0
12388                 ;;
12389         esac
12390         ;;
12391 *)      endpwent_r_proto=0
12392         ;;
12393 esac
12394
12395 : see if endservent exists
12396 set endservent d_endsent
12397 eval $inlibc
12398
12399 : see if endservent_r exists
12400 set endservent_r d_endservent_r
12401 eval $inlibc
12402 case "$d_endservent_r" in
12403 "$define")
12404         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12405         case "$d_endservent_r_proto:$usethreads" in
12406         ":define")      d_endservent_r_proto=define
12407                 set d_endservent_r_proto endservent_r $hdrs
12408                 eval $hasproto ;;
12409         *)      ;;
12410         esac
12411         case "$d_endservent_r_proto" in
12412         define)
12413         case "$endservent_r_proto" in
12414         ''|0) try='int endservent_r(struct servent_data*);'
12415         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=I_D ;;
12416         esac
12417         case "$endservent_r_proto" in
12418         ''|0) try='void endservent_r(struct servent_data*);'
12419         ./protochk "$extern_C $try" $hdrs && endservent_r_proto=V_D ;;
12420         esac
12421         case "$endservent_r_proto" in
12422         ''|0)   d_endservent_r=undef
12423                 endservent_r_proto=0
12424                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12425         * )     case "$endservent_r_proto" in
12426                 REENTRANT_PROTO*) ;;
12427                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12428                 esac
12429                 echo "Prototype: $try" ;;
12430         esac
12431         ;;
12432         *)      case "$usethreads" in
12433                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12434                 esac
12435                 d_endservent_r=undef
12436                 endservent_r_proto=0
12437                 ;;
12438         esac
12439         ;;
12440 *)      endservent_r_proto=0
12441         ;;
12442 esac
12443
12444 : Locate the flags for 'open()'
12445 echo " "
12446 $cat >try.c <<EOCP
12447 #include <sys/types.h>
12448 #ifdef I_FCNTL
12449 #include <fcntl.h>
12450 #endif
12451 #ifdef I_SYS_FILE
12452 #include <sys/file.h>
12453 #endif
12454 #$i_stdlib I_STDLIB
12455 #ifdef I_STDLIB
12456 #include <stdlib.h>
12457 #endif
12458 int main() {
12459         if(O_RDONLY);
12460 #ifdef O_TRUNC
12461         exit(0);
12462 #else
12463         exit(1);
12464 #endif
12465 }
12466 EOCP
12467 : check sys/file.h first to get FREAD on Sun
12468 if $test `./findhdr sys/file.h` && \
12469                 set try -DI_SYS_FILE && eval $compile; then
12470         h_sysfile=true;
12471         echo "<sys/file.h> defines the O_* constants..." >&4
12472         if $run ./try; then
12473                 echo "and you have the 3 argument form of open()." >&4
12474                 val="$define"
12475         else
12476                 echo "but not the 3 argument form of open().  Oh, well." >&4
12477                 val="$undef"
12478         fi
12479 elif $test `./findhdr fcntl.h` && \
12480                 set try -DI_FCNTL && eval $compile; then
12481         h_fcntl=true;
12482         echo "<fcntl.h> defines the O_* constants..." >&4
12483         if $run ./try; then
12484                 echo "and you have the 3 argument form of open()." >&4
12485                 val="$define"
12486         else
12487                 echo "but not the 3 argument form of open().  Oh, well." >&4
12488                 val="$undef"
12489         fi
12490 else
12491         val="$undef"
12492         echo "I can't find the O_* constant definitions!  You got problems." >&4
12493 fi
12494 set d_open3
12495 eval $setvar
12496 $rm_try
12497
12498 : see if this is a sys/file.h system
12499 val=''
12500 set sys/file.h val
12501 eval $inhdr
12502
12503 : do we need to include sys/file.h ?
12504 case "$val" in
12505 "$define")
12506         echo " "
12507         if $h_sysfile; then
12508                 val="$define"
12509                 echo "We'll be including <sys/file.h>." >&4
12510         else
12511                 val="$undef"
12512                 echo "We won't be including <sys/file.h>." >&4
12513         fi
12514         ;;
12515 *)
12516         h_sysfile=false
12517         ;;
12518 esac
12519 set i_sysfile
12520 eval $setvar
12521
12522 : see if fcntl.h is there
12523 val=''
12524 set fcntl.h val
12525 eval $inhdr
12526
12527 : see if we can include fcntl.h
12528 case "$val" in
12529 "$define")
12530         echo " "
12531         if $h_fcntl; then
12532                 val="$define"
12533                 echo "We'll be including <fcntl.h>." >&4
12534         else
12535                 val="$undef"
12536                 if $h_sysfile; then
12537         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12538                 else
12539                         echo "We won't be including <fcntl.h>." >&4
12540                 fi
12541         fi
12542         ;;
12543 *)
12544         h_fcntl=false
12545         val="$undef"
12546         ;;
12547 esac
12548 set i_fcntl
12549 eval $setvar
12550
12551 : see if fork exists
12552 set fork d_fork
12553 eval $inlibc
12554
12555 : see if pipe exists
12556 set pipe d_pipe
12557 eval $inlibc
12558
12559 : check for non-blocking I/O stuff
12560 case "$h_sysfile" in
12561 true) echo "#include <sys/file.h>" > head.c;;
12562 *)
12563        case "$h_fcntl" in
12564        true) echo "#include <fcntl.h>" > head.c;;
12565        *) echo "#include <sys/fcntl.h>" > head.c;;
12566        esac
12567        ;;
12568 esac
12569 echo " "
12570 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12571 case "$o_nonblock" in
12572 '')
12573         $cat head.c > try.c
12574         $cat >>try.c <<EOCP
12575 #include <stdio.h>
12576 #$i_stdlib I_STDLIB
12577 #ifdef I_STDLIB
12578 #include <stdlib.h>
12579 #endif
12580 #$i_fcntl I_FCNTL
12581 #ifdef I_FCNTL
12582 #include <fcntl.h>
12583 #endif
12584 int main() {
12585 #ifdef O_NONBLOCK
12586         printf("O_NONBLOCK\n");
12587         exit(0);
12588 #endif
12589 #ifdef O_NDELAY
12590         printf("O_NDELAY\n");
12591         exit(0);
12592 #endif
12593 #ifdef FNDELAY
12594         printf("FNDELAY\n");
12595         exit(0);
12596 #endif
12597         exit(0);
12598 }
12599 EOCP
12600         set try
12601         if eval $compile_ok; then
12602                 o_nonblock=`$run ./try`
12603                 case "$o_nonblock" in
12604                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12605                 *) echo "Seems like we can use $o_nonblock.";;
12606                 esac
12607         else
12608                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12609         fi
12610         ;;
12611 *) echo "Using $hint value $o_nonblock.";;
12612 esac
12613 $rm_try
12614
12615 echo " "
12616 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12617 case "$eagain" in
12618 '')
12619         case "$d_fork:$d_pipe" in
12620         define:define)
12621         $cat head.c > try.c
12622         $cat >>try.c <<EOCP
12623 #include <errno.h>
12624 #include <sys/types.h>
12625 #include <signal.h>
12626 #include <stdio.h>
12627 #$i_stdlib I_STDLIB
12628 #ifdef I_STDLIB
12629 #include <stdlib.h>
12630 #endif
12631 #$i_fcntl I_FCNTL
12632 #ifdef I_FCNTL
12633 #include <fcntl.h>
12634 #endif
12635 #define MY_O_NONBLOCK $o_nonblock
12636 #ifndef errno  /* XXX need better Configure test */
12637 extern int errno;
12638 #endif
12639 #$i_unistd I_UNISTD
12640 #ifdef I_UNISTD
12641 #include <unistd.h>
12642 #endif
12643 #$i_string I_STRING
12644 #ifdef I_STRING
12645 #include <string.h>
12646 #else
12647 #include <strings.h>
12648 #endif
12649 $signal_t blech(int x) { exit(3); }
12650 EOCP
12651         $cat >> try.c <<'EOCP'
12652 int main()
12653 {
12654         int pd[2];
12655         int pu[2];
12656         char buf[1];
12657         char string[100];
12658
12659         pipe(pd);       /* Down: child -> parent */
12660         pipe(pu);       /* Up: parent -> child */
12661         if (0 != fork()) {
12662                 int ret;
12663                 close(pd[1]);   /* Parent reads from pd[0] */
12664                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12665 #ifdef F_SETFL
12666                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12667                         exit(1);
12668 #else
12669                 exit(4);
12670 #endif
12671                 signal(SIGALRM, blech);
12672                 alarm(5);
12673                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12674                         exit(2);
12675                 sprintf(string, "%d\n", ret);
12676                 write(2, string, strlen(string));
12677                 alarm(0);
12678 #ifdef EAGAIN
12679                 if (errno == EAGAIN) {
12680                         printf("EAGAIN\n");
12681                         goto ok;
12682                 }
12683 #endif
12684 #ifdef EWOULDBLOCK
12685                 if (errno == EWOULDBLOCK)
12686                         printf("EWOULDBLOCK\n");
12687 #endif
12688         ok:
12689                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12690                 sleep(2);                               /* Give it time to close our pipe */
12691                 alarm(5);
12692                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12693                 alarm(0);
12694                 sprintf(string, "%d\n", ret);
12695                 write(4, string, strlen(string));
12696                 exit(0);
12697         }
12698
12699         close(pd[0]);                   /* We write to pd[1] */
12700         close(pu[1]);                   /* We read from pu[0] */
12701         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12702         close(pd[1]);                   /* Pipe pd is now fully closed! */
12703         exit(0);                                /* Bye bye, thank you for playing! */
12704 }
12705 EOCP
12706         set try
12707         if eval $compile_ok; then
12708                 echo "$startsh" >mtry
12709                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12710                 chmod +x mtry
12711                 ./mtry >/dev/null 2>&1
12712                 case $? in
12713                 0) eagain=`$cat try.out`;;
12714                 1) echo "Could not perform non-blocking setting!";;
12715                 2) echo "I did a successful read() for something that was not there!";;
12716                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12717                 4) echo "Could not find F_SETFL!";;
12718                 *) echo "Something terribly wrong happened during testing.";;
12719                 esac
12720                 rd_nodata=`$cat try.ret`
12721                 echo "A read() system call with no data present returns $rd_nodata."
12722                 case "$rd_nodata" in
12723                 0|-1) ;;
12724                 *)
12725                         echo "(That's peculiar, fixing that to be -1.)"
12726                         rd_nodata=-1
12727                         ;;
12728                 esac
12729                 case "$eagain" in
12730                 '')
12731                         echo "Forcing errno EAGAIN on read() with no data available."
12732                         eagain=EAGAIN
12733                         ;;
12734                 *)
12735                         echo "Your read() sets errno to $eagain when no data is available."
12736                         ;;
12737                 esac
12738                 status=`$cat try.err`
12739                 case "$status" in
12740                 0) echo "And it correctly returns 0 to signal EOF.";;
12741                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12742                 *) echo "However, your read() returns '$status' on EOF??";;
12743                 esac
12744                 val="$define"
12745                 if test "$status" = "$rd_nodata"; then
12746                         echo "WARNING: you can't distinguish between EOF and no data!"
12747                         val="$undef"
12748                 fi
12749         else
12750                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12751                 eagain=EAGAIN
12752         fi
12753         ;;
12754         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12755                 eagain=EAGAIN
12756                 val="$define"
12757                 ;;
12758         esac
12759         set d_eofnblk
12760         eval $setvar
12761         ;;
12762 *)
12763         echo "Using $hint value $eagain."
12764         echo "Your read() returns $rd_nodata when no data is present."
12765         case "$d_eofnblk" in
12766         "$define") echo "And you can see EOF because read() returns 0.";;
12767         "$undef") echo "But you can't see EOF status from read() returned value.";;
12768         *)
12769                 echo "(Assuming you can't see EOF status from read anyway.)"
12770                 d_eofnblk=$undef
12771                 ;;
12772         esac
12773         ;;
12774 esac
12775 $rm_try head.c mtry
12776
12777 : see if _ptr and _cnt from stdio act std
12778 echo " "
12779
12780 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12781         echo "(Looks like you have stdio.h from BSD.)"
12782         case "$stdio_ptr" in
12783         '') stdio_ptr='((fp)->_p)'
12784                 ptr_lval=$define
12785                 ;;
12786         *)      ptr_lval=$d_stdio_ptr_lval;;
12787         esac
12788         case "$stdio_cnt" in
12789         '') stdio_cnt='((fp)->_r)'
12790                 cnt_lval=$define
12791                 ;;
12792         *)      cnt_lval=$d_stdio_cnt_lval;;
12793         esac
12794         case "$stdio_base" in
12795         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12796         esac
12797         case "$stdio_bufsiz" in
12798         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12799         esac
12800 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12801         echo "(Looks like you have stdio.h from Linux.)"
12802         case "$stdio_ptr" in
12803         '') stdio_ptr='((fp)->_IO_read_ptr)'
12804                 ptr_lval=$define
12805                 ;;
12806         *)      ptr_lval=$d_stdio_ptr_lval;;
12807         esac
12808         case "$stdio_cnt" in
12809         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12810                 cnt_lval=$undef
12811                 ;;
12812         *)      cnt_lval=$d_stdio_cnt_lval;;
12813         esac
12814         case "$stdio_base" in
12815         '') stdio_base='((fp)->_IO_read_base)';;
12816         esac
12817         case "$stdio_bufsiz" in
12818         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12819         esac
12820 else
12821         case "$stdio_ptr" in
12822         '') stdio_ptr='((fp)->_ptr)'
12823                 ptr_lval=$define
12824                 ;;
12825         *)      ptr_lval=$d_stdio_ptr_lval;;
12826         esac
12827         case "$stdio_cnt" in
12828         '') stdio_cnt='((fp)->_cnt)'
12829                 cnt_lval=$define
12830                 ;;
12831         *)      cnt_lval=$d_stdio_cnt_lval;;
12832         esac
12833         case "$stdio_base" in
12834         '') stdio_base='((fp)->_base)';;
12835         esac
12836         case "$stdio_bufsiz" in
12837         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12838         esac
12839 fi
12840
12841 : test whether _ptr and _cnt really work
12842 echo "Checking how std your stdio is..." >&4
12843 $cat >try.c <<EOP
12844 #include <stdio.h>
12845 #$i_stdlib I_STDLIB
12846 #ifdef I_STDLIB
12847 #include <stdlib.h>
12848 #endif
12849 #define FILE_ptr(fp)    $stdio_ptr
12850 #define FILE_cnt(fp)    $stdio_cnt
12851 int main() {
12852         FILE *fp = fopen("try.c", "r");
12853         char c = getc(fp);
12854         if (
12855                 18 <= FILE_cnt(fp) &&
12856                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12857         )
12858                 exit(0);
12859         exit(1);
12860 }
12861 EOP
12862 val="$undef"
12863 set try
12864 if eval $compile && $to try.c; then
12865         if $run ./try; then
12866                 echo "Your stdio acts pretty std."
12867                 val="$define"
12868         else
12869                 echo "Your stdio isn't very std."
12870         fi
12871 else
12872         echo "Your stdio doesn't appear very std."
12873 fi
12874 $rm_try
12875
12876 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12877 # direct buffer manipulation no longer works.  The Configure tests
12878 # should be changed to correctly detect this, but until then,
12879 # the following check should at least let perl compile and run.
12880 # (This quick fix should be updated before 5.8.1.)
12881 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12882 # A. Dougherty, June 3, 2002.
12883 case "$d_gnulibc" in
12884 $define)
12885         case "$gnulibc_version" in
12886         2.[01]*)  ;;
12887         2.2) ;;
12888         2.2.[0-9]) ;;
12889         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12890                 val="$undef"
12891                 ;;
12892         esac
12893         ;;
12894 esac
12895 set d_stdstdio
12896 eval $setvar
12897
12898 : Can _ptr be used as an lvalue?
12899 case "$d_stdstdio$ptr_lval" in
12900 $define$define) val=$define ;;
12901 *) val=$undef ;;
12902 esac
12903 set d_stdio_ptr_lval
12904 eval $setvar
12905
12906 : Can _cnt be used as an lvalue?
12907 case "$d_stdstdio$cnt_lval" in
12908 $define$define) val=$define ;;
12909 *) val=$undef ;;
12910 esac
12911 set d_stdio_cnt_lval
12912 eval $setvar
12913
12914
12915 : test whether setting _ptr sets _cnt as a side effect
12916 d_stdio_ptr_lval_sets_cnt="$undef"
12917 d_stdio_ptr_lval_nochange_cnt="$undef"
12918 case "$d_stdio_ptr_lval$d_stdstdio" in
12919 $define$define)
12920         echo "Checking to see what happens if we set the stdio ptr..." >&4
12921 $cat >try.c <<EOP
12922 #include <stdio.h>
12923 /* Can we scream? */
12924 /* Eat dust sed :-) */
12925 /* In the buffer space, no one can hear you scream. */
12926 #$i_stdlib I_STDLIB
12927 #ifdef I_STDLIB
12928 #include <stdlib.h>
12929 #endif
12930 #define FILE_ptr(fp)    $stdio_ptr
12931 #define FILE_cnt(fp)    $stdio_cnt
12932 #include <sys/types.h>
12933 int main() {
12934         FILE *fp = fopen("try.c", "r");
12935         int c;
12936         char *ptr;
12937         size_t cnt;
12938         if (!fp) {
12939             puts("Fail even to read");
12940             exit(1);
12941         }
12942         c = getc(fp); /* Read away the first # */
12943         if (c == EOF) {
12944             puts("Fail even to read");
12945             exit(1);
12946         }
12947         if (!(
12948                 18 <= FILE_cnt(fp) &&
12949                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12950         )) {
12951                 puts("Fail even to read");
12952                 exit (1);
12953         }
12954         ptr = (char*) FILE_ptr(fp);
12955         cnt = (size_t)FILE_cnt(fp);
12956
12957         FILE_ptr(fp) += 42;
12958
12959         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12960                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12961                 exit (1);
12962         }
12963         if (FILE_cnt(fp) <= 20) {
12964                 printf ("Fail (<20 chars to test)");
12965                 exit (1);
12966         }
12967         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12968                 puts("Fail compare");
12969                 exit (1);
12970         }
12971         if (cnt == FILE_cnt(fp)) {
12972                 puts("Pass_unchanged");
12973                 exit (0);
12974         }
12975         if (FILE_cnt(fp) == (cnt - 42)) {
12976                 puts("Pass_changed");
12977                 exit (0);
12978         }
12979         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12980         return 1;
12981
12982 }
12983 EOP
12984         set try
12985         if eval $compile && $to try.c; then
12986                 case `$run ./try` in
12987                 Pass_changed)
12988                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12989                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12990                 Pass_unchanged)
12991                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12992                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12993                 Fail*)
12994                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12995                 *)
12996                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12997         esac
12998         else
12999                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
13000         fi
13001         $rm_try
13002         ;;
13003 esac
13004
13005 : see if _base is also standard
13006 val="$undef"
13007 case "$d_stdstdio" in
13008 $define)
13009         $cat >try.c <<EOP
13010 #include <stdio.h>
13011 #$i_stdlib I_STDLIB
13012 #ifdef I_STDLIB
13013 #include <stdlib.h>
13014 #endif
13015 #define FILE_base(fp)   $stdio_base
13016 #define FILE_bufsiz(fp) $stdio_bufsiz
13017 int main() {
13018         FILE *fp = fopen("try.c", "r");
13019         char c = getc(fp);
13020         if (
13021                 19 <= FILE_bufsiz(fp) &&
13022                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
13023         )
13024                 exit(0);
13025         exit(1);
13026 }
13027 EOP
13028         set try
13029         if eval $compile && $to try.c; then
13030                 if $run ./try; then
13031                         echo "And its _base field acts std."
13032                         val="$define"
13033                 else
13034                         echo "But its _base field isn't std."
13035                 fi
13036         else
13037                 echo "However, it seems to be lacking the _base field."
13038         fi
13039         $rm_try
13040         ;;
13041 esac
13042 set d_stdiobase
13043 eval $setvar
13044
13045 : see if fast_stdio exists
13046 val="$undef"
13047 case "$d_stdstdio:$d_stdio_ptr_lval" in
13048 "$define:$define")
13049         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
13050         *$define*)
13051                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
13052                 val="$define"
13053                 ;;
13054         esac
13055         ;;
13056 esac
13057 set d_faststdio
13058 eval $setvar
13059
13060
13061
13062 : see if fchdir exists
13063 set fchdir d_fchdir
13064 eval $inlibc
13065
13066 : see if fchmod exists
13067 set fchmod d_fchmod
13068 eval $inlibc
13069
13070 : see if fchown exists
13071 set fchown d_fchown
13072 eval $inlibc
13073
13074 : see if this is an fcntl system
13075 set fcntl d_fcntl
13076 eval $inlibc
13077
13078 : See if fcntl-based locking works.
13079 echo " "
13080 $cat >try.c <<EOCP
13081 #$i_stdlib I_STDLIB
13082 #ifdef I_STDLIB
13083 #include <stdlib.h>
13084 #endif
13085 #include <unistd.h>
13086 #include <fcntl.h>
13087 #include <signal.h>
13088 $signal_t blech(int x) { exit(3); }
13089 int main() {
13090 #if defined(F_SETLK) && defined(F_SETLKW)
13091      struct flock flock;
13092      int retval, fd;
13093      fd = open("try.c", O_RDONLY);
13094      flock.l_type = F_RDLCK;
13095      flock.l_whence = SEEK_SET;
13096      flock.l_start = flock.l_len = 0;
13097      signal(SIGALRM, blech);
13098      alarm(10);
13099      retval = fcntl(fd, F_SETLK, &flock);
13100      close(fd);
13101      (retval < 0 ? exit(2) : exit(0));
13102 #else
13103      exit(2);
13104 #endif
13105 }
13106 EOCP
13107 echo "Checking if fcntl-based file locking works... "
13108 case "$d_fcntl" in
13109 "$define")
13110         set try
13111         if eval $compile_ok; then
13112                 if $run ./try; then
13113                         echo "Yes, it seems to work."
13114                         val="$define"
13115                 else
13116                         echo "Nope, it didn't work."
13117                         val="$undef"
13118                         case "$?" in
13119                         3) $cat >&4 <<EOM
13120 ***
13121 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
13122 *** This is (almost) impossible.
13123 *** If your NFS lock daemons are not feeling well, something like
13124 *** this may happen, please investigate.  Cannot continue, aborting.
13125 ***
13126 EOM
13127                                 exit 1
13128                                 ;;
13129                         esac
13130                 fi
13131         else
13132                 echo "I'm unable to compile the test program, so I'll assume not."
13133                 val="$undef"
13134         fi
13135         ;;
13136 *) val="$undef";
13137         echo "Nope, since you don't even have fcntl()."
13138         ;;
13139 esac
13140 set d_fcntl_can_lock
13141 eval $setvar
13142 $rm_try
13143
13144 : check for fd_set items
13145 $cat <<EOM
13146
13147 Checking to see how well your C compiler handles fd_set and friends ...
13148 EOM
13149 $cat >try.c <<EOCP
13150 #$i_stdlib I_STDLIB
13151 #ifdef I_STDLIB
13152 #include <stdlib.h>
13153 #endif
13154 #$i_systime I_SYS_TIME
13155 #$i_sysselct I_SYS_SELECT
13156 #$d_socket HAS_SOCKET
13157 #include <sys/types.h>
13158 #ifdef HAS_SOCKET
13159 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
13160 #endif
13161 #ifdef I_SYS_TIME
13162 #include <sys/time.h>
13163 #endif
13164 #ifdef I_SYS_SELECT
13165 #include <sys/select.h>
13166 #endif
13167 int main() {
13168         fd_set fds;
13169
13170 #ifdef TRYBITS
13171         if(fds.fds_bits);
13172 #endif
13173
13174 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
13175         exit(0);
13176 #else
13177         exit(1);
13178 #endif
13179 }
13180 EOCP
13181 set try -DTRYBITS
13182 if eval $compile; then
13183         d_fds_bits="$define"
13184         d_fd_set="$define"
13185         echo "Well, your system knows about the normal fd_set typedef..." >&4
13186         if $run ./try; then
13187                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
13188                 d_fd_macros="$define"
13189         else
13190                 $cat >&4 <<'EOM'
13191 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
13192 EOM
13193                 d_fd_macros="$undef"
13194         fi
13195 else
13196         $cat <<'EOM'
13197 Hmm, your compiler has some difficulty with fd_set.  Checking further...
13198 EOM
13199         set try
13200         if eval $compile; then
13201                 d_fds_bits="$undef"
13202                 d_fd_set="$define"
13203                 echo "Well, your system has some sort of fd_set available..." >&4
13204                 if $run ./try; then
13205                         echo "and you have the normal fd_set macros." >&4
13206                         d_fd_macros="$define"
13207                 else
13208                         $cat <<'EOM'
13209 but not the normal fd_set macros!  Gross!  More work for me...
13210 EOM
13211                         d_fd_macros="$undef"
13212                 fi
13213         else
13214         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
13215                 d_fd_set="$undef"
13216                 d_fds_bits="$undef"
13217                 d_fd_macros="$undef"
13218         fi
13219 fi
13220 $rm_try
13221
13222 : see if fgetpos exists
13223 set fgetpos d_fgetpos
13224 eval $inlibc
13225
13226 : see if finite exists
13227 set finite d_finite
13228 eval $inlibc
13229
13230 : see if finitel exists
13231 set finitel d_finitel
13232 eval $inlibc
13233
13234 : see if flock exists
13235 set flock d_flock
13236 eval $inlibc
13237
13238 : see if prototype for flock is available
13239 echo " "
13240 set d_flockproto flock $i_sysfile sys/file.h
13241 eval $hasproto
13242
13243 : see if fp_class exists
13244 set fp_class d_fp_class
13245 eval $inlibc
13246
13247 : see if pathconf exists
13248 set pathconf d_pathconf
13249 eval $inlibc
13250
13251 : see if fpathconf exists
13252 set fpathconf d_fpathconf
13253 eval $inlibc
13254
13255 : see if fpclass exists
13256 set fpclass d_fpclass
13257 eval $inlibc
13258
13259 : see if fpclassify exists
13260 set fpclassify d_fpclassify
13261 eval $inlibc
13262
13263 : see if fpclassl exists
13264 set fpclassl d_fpclassl
13265 eval $inlibc
13266
13267 : check for fpos64_t
13268 echo " "
13269 echo "Checking to see if you have fpos64_t..." >&4
13270 $cat >try.c <<EOCP
13271 #include <stdio.h>
13272 int main() { fpos64_t x = 7; }
13273 EOCP
13274 set try
13275 if eval $compile; then
13276         val="$define"
13277         echo "You have fpos64_t."
13278 else
13279         val="$undef"
13280         echo "You do not have fpos64_t."
13281         case "$fpossize" in
13282         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
13283         esac
13284 fi
13285 $rm_try
13286 set d_fpos64_t
13287 eval $setvar
13288
13289 : see if frexpl exists
13290 set frexpl d_frexpl
13291 eval $inlibc
13292
13293 : see if this is a sys/param system
13294 set sys/param.h i_sysparam
13295 eval $inhdr
13296
13297 : see if this is a sys/mount.h system
13298 set sys/mount.h i_sysmount
13299 eval $inhdr
13300
13301 : Check for fs_data_s
13302 echo " "
13303 echo "Checking to see if your system supports struct fs_data..." >&4
13304 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
13305 eval $hasstruct
13306 case "$d_fs_data_s" in
13307 "$define")      echo "Yes, it does."   ;;
13308 *)              echo "No, it doesn't." ;;
13309 esac
13310
13311 : see if fseeko exists
13312 set fseeko d_fseeko
13313 eval $inlibc
13314 case "$longsize" in
13315 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
13316 esac
13317
13318 : see if fsetpos exists
13319 set fsetpos d_fsetpos
13320 eval $inlibc
13321
13322 : see if fstatfs exists
13323 set fstatfs d_fstatfs
13324 eval $inlibc
13325
13326 : see if statvfs exists
13327 set statvfs d_statvfs
13328 eval $inlibc
13329
13330 : see if fstatvfs exists
13331 set fstatvfs d_fstatvfs
13332 eval $inlibc
13333
13334
13335 : see if fsync exists
13336 set fsync d_fsync
13337 eval $inlibc
13338
13339 : see if ftello exists
13340 set ftello d_ftello
13341 eval $inlibc
13342 case "$longsize" in
13343 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13344 esac
13345
13346 : check for a working futimes
13347 d_futimes="$undef"
13348 echo " "
13349 echo "Checking if you have a working futimes()" >&4
13350 $cat >try.c <<EOCP
13351 #include <stdio.h>
13352 #include <sys/time.h>
13353 #include <errno.h>
13354 #include <fcntl.h>
13355
13356 int main ()
13357 {
13358     int fd, rv;
13359     fd = open ("try.c", O_RDWR);
13360     if (-1 == fd) exit (1);
13361     rv = futimes (fd, NULL);
13362     exit (rv == -1 ? errno : 0);
13363 }
13364 EOCP
13365 set try
13366 if eval $compile; then
13367     `$run ./try`
13368     rc=$?
13369     case "$rc" in
13370         0)  echo "Yes, you have" >&4
13371             d_futimes="$define"
13372             ;;
13373         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13374             ;;
13375     esac
13376 else
13377     echo "No, it does not (probably harmless)" >&4
13378 fi
13379 $rm_try
13380
13381 : see if ndbm.h is available
13382 set ndbm.h i_ndbm
13383 eval $inhdr
13384 : Compatibility location for RedHat 7.1
13385 set gdbm/ndbm.h i_gdbmndbm
13386 eval $inhdr
13387 : Compatibility location for Debian 4.0
13388 set gdbm-ndbm.h i_gdbm_ndbm
13389 eval $inhdr
13390
13391 val="$undef"
13392 if $test "$i_ndbm" = "$define" -o "$i_gdbmndbm" = "$define" -o "$i_gdbm_ndbm" = "$define"; then
13393         : see if dbm_open exists
13394         set dbm_open d_dbm_open
13395         eval $inlibc
13396         case "$d_dbm_open" in
13397         $undef)
13398                 i_ndbm="$undef"
13399                 i_gdbmndbm="$undef"
13400                 i_gdbm_ndbm="$undef"
13401                 echo "We won't be including <ndbm.h>"
13402                 val="$undef"
13403                 ;;
13404         *) val="$define"
13405            ;;
13406         esac
13407 fi
13408 set d_ndbm
13409 eval $setvar
13410
13411 ndbm_hdr_protochk='name=$1; hdr=$2;
13412 eval "ihdr=\$""i_$name";
13413 val="$undef";
13414 if $test "$ihdr" = "$define"; then
13415         $echo "Checking if your <$hdr> uses prototypes..." >&4;
13416         case "$d_cplusplus" in
13417         $define) ./protochk "$extern_C void dbm_close(DBM *);" literal "extern \"C\" {" $ihdr $hdr literal "}" && val="$define" ;;
13418         *) ./protochk "$extern_C void dbm_close(int, int);" $ihdr $hdr || val="$define" ;;
13419         esac;
13420         case "$val" in
13421         $define) $echo "Your <$hdr> seems to have prototypes";;
13422         *) $echo "Your <$hdr> does not seem to have prototypes";;
13423         esac;
13424 fi;
13425 set "d_${name}_h_uses_prototypes";
13426 eval $setvar'
13427
13428 set ndbm ndbm.h
13429 eval $ndbm_hdr_protochk
13430 set gdbmndbm gdbm/ndbm.h
13431 eval $ndbm_hdr_protochk
13432 set gdbm_ndbm gdbm-ndbm.h
13433 eval $ndbm_hdr_protochk
13434
13435 : see if getaddrinfo exists
13436 set getaddrinfo d_getaddrinfo
13437 eval $inlibc
13438
13439 : see if getcwd exists
13440 set getcwd d_getcwd
13441 eval $inlibc
13442
13443 : see if getespwnam exists
13444 set getespwnam d_getespwnam
13445 eval $inlibc
13446
13447 : see if getfsstat exists
13448 set getfsstat d_getfsstat
13449 eval $inlibc
13450
13451 : see if getgrent exists
13452 set getgrent d_getgrent
13453 eval $inlibc
13454
13455 : see if getgrent_r exists
13456 set getgrent_r d_getgrent_r
13457 eval $inlibc
13458 case "$d_getgrent_r" in
13459 "$define")
13460         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13461         case "$d_getgrent_r_proto:$usethreads" in
13462         ":define")      d_getgrent_r_proto=define
13463                 set d_getgrent_r_proto getgrent_r $hdrs
13464                 eval $hasproto ;;
13465         *)      ;;
13466         esac
13467         case "$d_getgrent_r_proto" in
13468         define)
13469         case "$getgrent_r_proto" in
13470         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13471         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13472         esac
13473         case "$getgrent_r_proto" in
13474         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13475         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13476         esac
13477         case "$getgrent_r_proto" in
13478         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13479         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBW ;;
13480         esac
13481         case "$getgrent_r_proto" in
13482         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13483         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=S_SBI ;;
13484         esac
13485         case "$getgrent_r_proto" in
13486         ''|0) try='int getgrent_r(struct group*, char*, int);'
13487         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBI ;;
13488         esac
13489         case "$getgrent_r_proto" in
13490         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13491         ./protochk "$extern_C $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13492         esac
13493         case "$getgrent_r_proto" in
13494         ''|0)   d_getgrent_r=undef
13495                 getgrent_r_proto=0
13496                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13497         * )     case "$getgrent_r_proto" in
13498                 REENTRANT_PROTO*) ;;
13499                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13500                 esac
13501                 echo "Prototype: $try" ;;
13502         esac
13503         ;;
13504         *)      case "$usethreads" in
13505                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13506                 esac
13507                 d_getgrent_r=undef
13508                 getgrent_r_proto=0
13509                 ;;
13510         esac
13511         ;;
13512 *)      getgrent_r_proto=0
13513         ;;
13514 esac
13515
13516 : see if getgrgid_r exists
13517 set getgrgid_r d_getgrgid_r
13518 eval $inlibc
13519 case "$d_getgrgid_r" in
13520 "$define")
13521         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13522         case "$d_getgrgid_r_proto:$usethreads" in
13523         ":define")      d_getgrgid_r_proto=define
13524                 set d_getgrgid_r_proto getgrgid_r $hdrs
13525                 eval $hasproto ;;
13526         *)      ;;
13527         esac
13528         case "$d_getgrgid_r_proto" in
13529         define)
13530         case "$getgrgid_r_proto" in
13531         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13532         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13533         esac
13534         case "$getgrgid_r_proto" in
13535         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13536         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13537         esac
13538         case "$getgrgid_r_proto" in
13539         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13540         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13541         esac
13542         case "$getgrgid_r_proto" in
13543         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13544         ./protochk "$extern_C $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13545         esac
13546         case "$getgrgid_r_proto" in
13547         ''|0)   d_getgrgid_r=undef
13548                 getgrgid_r_proto=0
13549                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13550         * )     case "$getgrgid_r_proto" in
13551                 REENTRANT_PROTO*) ;;
13552                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13553                 esac
13554                 echo "Prototype: $try" ;;
13555         esac
13556         ;;
13557         *)      case "$usethreads" in
13558                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13559                 esac
13560                 d_getgrgid_r=undef
13561                 getgrgid_r_proto=0
13562                 ;;
13563         esac
13564         ;;
13565 *)      getgrgid_r_proto=0
13566         ;;
13567 esac
13568
13569 : see if getgrnam_r exists
13570 set getgrnam_r d_getgrnam_r
13571 eval $inlibc
13572 case "$d_getgrnam_r" in
13573 "$define")
13574         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13575         case "$d_getgrnam_r_proto:$usethreads" in
13576         ":define")      d_getgrnam_r_proto=define
13577                 set d_getgrnam_r_proto getgrnam_r $hdrs
13578                 eval $hasproto ;;
13579         *)      ;;
13580         esac
13581         case "$d_getgrnam_r_proto" in
13582         define)
13583         case "$getgrnam_r_proto" in
13584         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13585         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13586         esac
13587         case "$getgrnam_r_proto" in
13588         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13589         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13590         esac
13591         case "$getgrnam_r_proto" in
13592         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13593         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13594         esac
13595         case "$getgrnam_r_proto" in
13596         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13597         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13598         esac
13599         case "$getgrnam_r_proto" in
13600         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13601         ./protochk "$extern_C $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13602         esac
13603         case "$getgrnam_r_proto" in
13604         ''|0)   d_getgrnam_r=undef
13605                 getgrnam_r_proto=0
13606                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13607         * )     case "$getgrnam_r_proto" in
13608                 REENTRANT_PROTO*) ;;
13609                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13610                 esac
13611                 echo "Prototype: $try" ;;
13612         esac
13613         ;;
13614         *)      case "$usethreads" in
13615                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13616                 esac
13617                 d_getgrnam_r=undef
13618                 getgrnam_r_proto=0
13619                 ;;
13620         esac
13621         ;;
13622 *)      getgrnam_r_proto=0
13623         ;;
13624 esac
13625
13626 : see if gethostbyaddr exists
13627 set gethostbyaddr d_gethbyaddr
13628 eval $inlibc
13629
13630 : see if gethostbyname exists
13631 set gethostbyname d_gethbyname
13632 eval $inlibc
13633
13634 : see if gethostent exists
13635 set gethostent d_gethent
13636 eval $inlibc
13637
13638 : see how we will look up host name
13639 echo " "
13640 call=''
13641 if set gethostname val -f d_gethname; eval $csym; $val; then
13642         echo 'gethostname() found.' >&4
13643         d_gethname="$define"
13644         call=gethostname
13645 fi
13646 if set uname val -f d_uname; eval $csym; $val; then
13647         if ./xenix; then
13648                 $cat <<'EOM'
13649 uname() was found, but you're running xenix, and older versions of xenix
13650 have a broken uname(). If you don't really know whether your xenix is old
13651 enough to have a broken system call, use the default answer.
13652
13653 EOM
13654                 dflt=y
13655                 case "$d_uname" in
13656                 "$define") dflt=n;;
13657                 esac
13658                 rp='Is your uname() broken?'
13659                 . ./myread
13660                 case "$ans" in
13661                 n*) d_uname="$define"; call=uname;;
13662                 esac
13663         else
13664                 echo 'uname() found.' >&4
13665                 d_uname="$define"
13666                 case "$call" in
13667                 '') call=uname ;;
13668                 esac
13669         fi
13670 fi
13671 case "$d_gethname" in
13672 '') d_gethname="$undef";;
13673 esac
13674 case "$d_uname" in
13675 '') d_uname="$undef";;
13676 esac
13677 case "$d_uname$d_gethname" in
13678 *define*)
13679         dflt=n
13680         cat <<EOM
13681
13682 Every now and then someone has a $call() that lies about the hostname
13683 but can't be fixed for political or economic reasons.  If you wish, I can
13684 pretend $call() isn't there and maybe compute hostname at run-time
13685 thanks to the '$phostname' command.
13686
13687 EOM
13688         rp="Shall I ignore $call() from now on?"
13689         . ./myread
13690         case "$ans" in
13691         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13692         esac;;
13693 esac
13694 case "$phostname" in
13695 '') aphostname='';;
13696 *) case "$aphostname" in
13697         /*) ;;
13698         *) set X $phostname
13699                 shift
13700                 file=$1
13701                 shift
13702                 file=`./loc $file $file $pth`
13703                 aphostname=`echo $file $*`
13704                 ;;
13705         esac
13706         ;;
13707 esac
13708 case "$d_uname$d_gethname" in
13709 *define*) ;;
13710 *)
13711         case "$phostname" in
13712         '')
13713                 echo "There will be no way for $package to get your hostname." >&4;;
13714         *)
13715         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13716                 ;;
13717         esac;;
13718 esac
13719 case "$d_phostname" in
13720 '') d_phostname="$undef";;
13721 esac
13722
13723 : see if gethostbyaddr_r exists
13724 set gethostbyaddr_r d_gethostbyaddr_r
13725 eval $inlibc
13726 case "$d_gethostbyaddr_r" in
13727 "$define")
13728         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13729         case "$d_gethostbyaddr_r_proto:$usethreads" in
13730         ":define")      d_gethostbyaddr_r_proto=define
13731                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13732                 eval $hasproto ;;
13733         *)      ;;
13734         esac
13735         case "$d_gethostbyaddr_r_proto" in
13736         define)
13737         case "$gethostbyaddr_r_proto" in
13738         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13739         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13740         esac
13741         case "$gethostbyaddr_r_proto" in
13742         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13743         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13744         esac
13745         case "$gethostbyaddr_r_proto" in
13746         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13747         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13748         esac
13749         case "$gethostbyaddr_r_proto" in
13750         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13751         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13752         esac
13753         case "$gethostbyaddr_r_proto" in
13754         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13755         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13756         esac
13757         case "$gethostbyaddr_r_proto" in
13758         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13759         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13760         esac
13761         case "$gethostbyaddr_r_proto" in
13762         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13763         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13764         esac
13765         case "$gethostbyaddr_r_proto" in
13766         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13767         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13768         esac
13769         case "$gethostbyaddr_r_proto" in
13770         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13771         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13772         esac
13773         case "$gethostbyaddr_r_proto" in
13774         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13775         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13776         esac
13777         case "$gethostbyaddr_r_proto" in
13778         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13779         ./protochk "$extern_C $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13780         esac
13781         case "$gethostbyaddr_r_proto" in
13782         ''|0)   d_gethostbyaddr_r=undef
13783                 gethostbyaddr_r_proto=0
13784                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13785         * )     case "$gethostbyaddr_r_proto" in
13786                 REENTRANT_PROTO*) ;;
13787                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13788                 esac
13789                 echo "Prototype: $try" ;;
13790         esac
13791         ;;
13792         *)      case "$usethreads" in
13793                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13794                 esac
13795                 d_gethostbyaddr_r=undef
13796                 gethostbyaddr_r_proto=0
13797                 ;;
13798         esac
13799         ;;
13800 *)      gethostbyaddr_r_proto=0
13801         ;;
13802 esac
13803
13804 : see if gethostbyname_r exists
13805 set gethostbyname_r d_gethostbyname_r
13806 eval $inlibc
13807 case "$d_gethostbyname_r" in
13808 "$define")
13809         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13810         case "$d_gethostbyname_r_proto:$usethreads" in
13811         ":define")      d_gethostbyname_r_proto=define
13812                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13813                 eval $hasproto ;;
13814         *)      ;;
13815         esac
13816         case "$d_gethostbyname_r_proto" in
13817         define)
13818         case "$gethostbyname_r_proto" in
13819         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13820         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13821         esac
13822         case "$gethostbyname_r_proto" in
13823         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13824         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13825         esac
13826         case "$gethostbyname_r_proto" in
13827         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13828         ./protochk "$extern_C $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13829         esac
13830         case "$gethostbyname_r_proto" in
13831         ''|0)   d_gethostbyname_r=undef
13832                 gethostbyname_r_proto=0
13833                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13834         * )     case "$gethostbyname_r_proto" in
13835                 REENTRANT_PROTO*) ;;
13836                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13837                 esac
13838                 echo "Prototype: $try" ;;
13839         esac
13840         ;;
13841         *)      case "$usethreads" in
13842                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13843                 esac
13844                 d_gethostbyname_r=undef
13845                 gethostbyname_r_proto=0
13846                 ;;
13847         esac
13848         ;;
13849 *)      gethostbyname_r_proto=0
13850         ;;
13851 esac
13852
13853 : see if gethostent_r exists
13854 set gethostent_r d_gethostent_r
13855 eval $inlibc
13856 case "$d_gethostent_r" in
13857 "$define")
13858         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13859         case "$d_gethostent_r_proto:$usethreads" in
13860         ":define")      d_gethostent_r_proto=define
13861                 set d_gethostent_r_proto gethostent_r $hdrs
13862                 eval $hasproto ;;
13863         *)      ;;
13864         esac
13865         case "$d_gethostent_r_proto" in
13866         define)
13867         case "$gethostent_r_proto" in
13868         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13869         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13870         esac
13871         case "$gethostent_r_proto" in
13872         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13873         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13874         esac
13875         case "$gethostent_r_proto" in
13876         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13877         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13878         esac
13879         case "$gethostent_r_proto" in
13880         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13881         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=S_SBI ;;
13882         esac
13883         case "$gethostent_r_proto" in
13884         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13885         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SBI ;;
13886         esac
13887         case "$gethostent_r_proto" in
13888         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13889         ./protochk "$extern_C $try" $hdrs && gethostent_r_proto=I_SD ;;
13890         esac
13891         case "$gethostent_r_proto" in
13892         ''|0)   d_gethostent_r=undef
13893                 gethostent_r_proto=0
13894                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13895         * )     case "$gethostent_r_proto" in
13896                 REENTRANT_PROTO*) ;;
13897                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13898                 esac
13899                 echo "Prototype: $try" ;;
13900         esac
13901         ;;
13902         *)      case "$usethreads" in
13903                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13904                 esac
13905                 d_gethostent_r=undef
13906                 gethostent_r_proto=0
13907                 ;;
13908         esac
13909         ;;
13910 *)      gethostent_r_proto=0
13911         ;;
13912 esac
13913
13914 : see if prototypes for various gethostxxx netdb.h functions are available
13915 echo " "
13916 set d_gethostprotos gethostent $i_netdb netdb.h
13917 eval $hasproto
13918
13919 : see if getitimer exists
13920 set getitimer d_getitimer
13921 eval $inlibc
13922
13923 : see if getlogin exists
13924 set getlogin d_getlogin
13925 eval $inlibc
13926
13927 : see if getlogin_r exists
13928 set getlogin_r d_getlogin_r
13929 eval $inlibc
13930 case "$d_getlogin_r" in
13931 "$define")
13932         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13933         case "$d_getlogin_r_proto:$usethreads" in
13934         ":define")      d_getlogin_r_proto=define
13935                 set d_getlogin_r_proto getlogin_r $hdrs
13936                 eval $hasproto ;;
13937         *)      ;;
13938         esac
13939         case "$d_getlogin_r_proto" in
13940         define)
13941         case "$getlogin_r_proto" in
13942         ''|0) try='int getlogin_r(char*, size_t);'
13943         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BW ;;
13944         esac
13945         case "$getlogin_r_proto" in
13946         ''|0) try='int getlogin_r(char*, int);'
13947         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=I_BI ;;
13948         esac
13949         case "$getlogin_r_proto" in
13950         ''|0) try='char* getlogin_r(char*, size_t);'
13951         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BW ;;
13952         esac
13953         case "$getlogin_r_proto" in
13954         ''|0) try='char* getlogin_r(char*, int);'
13955         ./protochk "$extern_C $try" $hdrs && getlogin_r_proto=B_BI ;;
13956         esac
13957         case "$getlogin_r_proto" in
13958         ''|0)   d_getlogin_r=undef
13959                 getlogin_r_proto=0
13960                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13961         * )     case "$getlogin_r_proto" in
13962                 REENTRANT_PROTO*) ;;
13963                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13964                 esac
13965                 echo "Prototype: $try" ;;
13966         esac
13967         ;;
13968         *)      case "$usethreads" in
13969                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13970                 esac
13971                 d_getlogin_r=undef
13972                 getlogin_r_proto=0
13973                 ;;
13974         esac
13975         ;;
13976 *)      getlogin_r_proto=0
13977         ;;
13978 esac
13979
13980 : see if getmnt exists
13981 set getmnt d_getmnt
13982 eval $inlibc
13983
13984 : see if getmntent exists
13985 set getmntent d_getmntent
13986 eval $inlibc
13987
13988 : see if getnameinfo exists
13989 set getnameinfo d_getnameinfo
13990 eval $inlibc
13991
13992 : see if getnetbyaddr exists
13993 set getnetbyaddr d_getnbyaddr
13994 eval $inlibc
13995
13996 : see if getnetbyname exists
13997 set getnetbyname d_getnbyname
13998 eval $inlibc
13999
14000 : see if getnetent exists
14001 set getnetent d_getnent
14002 eval $inlibc
14003
14004 : see if getnetbyaddr_r exists
14005 set getnetbyaddr_r d_getnetbyaddr_r
14006 eval $inlibc
14007 case "$d_getnetbyaddr_r" in
14008 "$define")
14009         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14010         case "$d_getnetbyaddr_r_proto:$usethreads" in
14011         ":define")      d_getnetbyaddr_r_proto=define
14012                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
14013                 eval $hasproto ;;
14014         *)      ;;
14015         esac
14016         case "$d_getnetbyaddr_r_proto" in
14017         define)
14018         case "$getnetbyaddr_r_proto" in
14019         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
14020         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
14021         esac
14022         case "$getnetbyaddr_r_proto" in
14023         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
14024         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
14025         esac
14026         case "$getnetbyaddr_r_proto" in
14027         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
14028         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
14029         esac
14030         case "$getnetbyaddr_r_proto" in
14031         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
14032         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
14033         esac
14034         case "$getnetbyaddr_r_proto" in
14035         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
14036         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
14037         esac
14038         case "$getnetbyaddr_r_proto" in
14039         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
14040         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
14041         esac
14042         case "$getnetbyaddr_r_proto" in
14043         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
14044         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
14045         esac
14046         case "$getnetbyaddr_r_proto" in
14047         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
14048         ./protochk "$extern_C $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
14049         esac
14050         case "$getnetbyaddr_r_proto" in
14051         ''|0)   d_getnetbyaddr_r=undef
14052                 getnetbyaddr_r_proto=0
14053                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
14054         * )     case "$getnetbyaddr_r_proto" in
14055                 REENTRANT_PROTO*) ;;
14056                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
14057                 esac
14058                 echo "Prototype: $try" ;;
14059         esac
14060         ;;
14061         *)      case "$usethreads" in
14062                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
14063                 esac
14064                 d_getnetbyaddr_r=undef
14065                 getnetbyaddr_r_proto=0
14066                 ;;
14067         esac
14068         ;;
14069 *)      getnetbyaddr_r_proto=0
14070         ;;
14071 esac
14072
14073 : see if getnetbyname_r exists
14074 set getnetbyname_r d_getnetbyname_r
14075 eval $inlibc
14076 case "$d_getnetbyname_r" in
14077 "$define")
14078         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14079         case "$d_getnetbyname_r_proto:$usethreads" in
14080         ":define")      d_getnetbyname_r_proto=define
14081                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
14082                 eval $hasproto ;;
14083         *)      ;;
14084         esac
14085         case "$d_getnetbyname_r_proto" in
14086         define)
14087         case "$getnetbyname_r_proto" in
14088         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
14089         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
14090         esac
14091         case "$getnetbyname_r_proto" in
14092         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
14093         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
14094         esac
14095         case "$getnetbyname_r_proto" in
14096         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
14097         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
14098         esac
14099         case "$getnetbyname_r_proto" in
14100         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
14101         ./protochk "$extern_C $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
14102         esac
14103         case "$getnetbyname_r_proto" in
14104         ''|0)   d_getnetbyname_r=undef
14105                 getnetbyname_r_proto=0
14106                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
14107         * )     case "$getnetbyname_r_proto" in
14108                 REENTRANT_PROTO*) ;;
14109                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
14110                 esac
14111                 echo "Prototype: $try" ;;
14112         esac
14113         ;;
14114         *)      case "$usethreads" in
14115                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
14116                 esac
14117                 d_getnetbyname_r=undef
14118                 getnetbyname_r_proto=0
14119                 ;;
14120         esac
14121         ;;
14122 *)      getnetbyname_r_proto=0
14123         ;;
14124 esac
14125
14126 : see if getnetent_r exists
14127 set getnetent_r d_getnetent_r
14128 eval $inlibc
14129 case "$d_getnetent_r" in
14130 "$define")
14131         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14132         case "$d_getnetent_r_proto:$usethreads" in
14133         ":define")      d_getnetent_r_proto=define
14134                 set d_getnetent_r_proto getnetent_r $hdrs
14135                 eval $hasproto ;;
14136         *)      ;;
14137         esac
14138         case "$d_getnetent_r_proto" in
14139         define)
14140         case "$getnetent_r_proto" in
14141         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
14142         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
14143         esac
14144         case "$getnetent_r_proto" in
14145         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
14146         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBIE ;;
14147         esac
14148         case "$getnetent_r_proto" in
14149         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
14150         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBIE ;;
14151         esac
14152         case "$getnetent_r_proto" in
14153         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
14154         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=S_SBI ;;
14155         esac
14156         case "$getnetent_r_proto" in
14157         ''|0) try='int getnetent_r(struct netent*, char*, int);'
14158         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SBI ;;
14159         esac
14160         case "$getnetent_r_proto" in
14161         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
14162         ./protochk "$extern_C $try" $hdrs && getnetent_r_proto=I_SD ;;
14163         esac
14164         case "$getnetent_r_proto" in
14165         ''|0)   d_getnetent_r=undef
14166                 getnetent_r_proto=0
14167                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
14168         * )     case "$getnetent_r_proto" in
14169                 REENTRANT_PROTO*) ;;
14170                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
14171                 esac
14172                 echo "Prototype: $try" ;;
14173         esac
14174         ;;
14175         *)      case "$usethreads" in
14176                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
14177                 esac
14178                 d_getnetent_r=undef
14179                 getnetent_r_proto=0
14180                 ;;
14181         esac
14182         ;;
14183 *)      getnetent_r_proto=0
14184         ;;
14185 esac
14186
14187 : see if prototypes for various getnetxxx netdb.h functions are available
14188 echo " "
14189 set d_getnetprotos getnetent $i_netdb netdb.h
14190 eval $hasproto
14191
14192 : see if getpagesize exists
14193 set getpagesize d_getpagsz
14194 eval $inlibc
14195
14196 : Optional checks for getprotobyname and getprotobynumber
14197
14198 : see if getprotobyname exists
14199 set getprotobyname d_getpbyname
14200 eval $inlibc
14201
14202 : see if getprotobynumber exists
14203 set getprotobynumber d_getpbynumber
14204 eval $inlibc
14205
14206 : see if getprotoent exists
14207 set getprotoent d_getpent
14208 eval $inlibc
14209
14210 : see if getpgid exists
14211 set getpgid d_getpgid
14212 eval $inlibc
14213
14214 : see if getpgrp2 exists
14215 set getpgrp2 d_getpgrp2
14216 eval $inlibc
14217
14218 : see if getppid exists
14219 set getppid d_getppid
14220 eval $inlibc
14221
14222 : see if getpriority exists
14223 set getpriority d_getprior
14224 eval $inlibc
14225
14226 : see if getprotobyname_r exists
14227 set getprotobyname_r d_getprotobyname_r
14228 eval $inlibc
14229 case "$d_getprotobyname_r" in
14230 "$define")
14231         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14232         case "$d_getprotobyname_r_proto:$usethreads" in
14233         ":define")      d_getprotobyname_r_proto=define
14234                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
14235                 eval $hasproto ;;
14236         *)      ;;
14237         esac
14238         case "$d_getprotobyname_r_proto" in
14239         define)
14240         case "$getprotobyname_r_proto" in
14241         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
14242         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
14243         esac
14244         case "$getprotobyname_r_proto" in
14245         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
14246         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
14247         esac
14248         case "$getprotobyname_r_proto" in
14249         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
14250         ./protochk "$extern_C $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
14251         esac
14252         case "$getprotobyname_r_proto" in
14253         ''|0)   d_getprotobyname_r=undef
14254                 getprotobyname_r_proto=0
14255                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
14256         * )     case "$getprotobyname_r_proto" in
14257                 REENTRANT_PROTO*) ;;
14258                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
14259                 esac
14260                 echo "Prototype: $try" ;;
14261         esac
14262         ;;
14263         *)      case "$usethreads" in
14264                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
14265                 esac
14266                 d_getprotobyname_r=undef
14267                 getprotobyname_r_proto=0
14268                 ;;
14269         esac
14270         ;;
14271 *)      getprotobyname_r_proto=0
14272         ;;
14273 esac
14274
14275 : see if getprotobynumber_r exists
14276 set getprotobynumber_r d_getprotobynumber_r
14277 eval $inlibc
14278 case "$d_getprotobynumber_r" in
14279 "$define")
14280         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14281         case "$d_getprotobynumber_r_proto:$usethreads" in
14282         ":define")      d_getprotobynumber_r_proto=define
14283                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
14284                 eval $hasproto ;;
14285         *)      ;;
14286         esac
14287         case "$d_getprotobynumber_r_proto" in
14288         define)
14289         case "$getprotobynumber_r_proto" in
14290         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
14291         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
14292         esac
14293         case "$getprotobynumber_r_proto" in
14294         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
14295         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
14296         esac
14297         case "$getprotobynumber_r_proto" in
14298         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
14299         ./protochk "$extern_C $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
14300         esac
14301         case "$getprotobynumber_r_proto" in
14302         ''|0)   d_getprotobynumber_r=undef
14303                 getprotobynumber_r_proto=0
14304                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
14305         * )     case "$getprotobynumber_r_proto" in
14306                 REENTRANT_PROTO*) ;;
14307                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
14308                 esac
14309                 echo "Prototype: $try" ;;
14310         esac
14311         ;;
14312         *)      case "$usethreads" in
14313                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
14314                 esac
14315                 d_getprotobynumber_r=undef
14316                 getprotobynumber_r_proto=0
14317                 ;;
14318         esac
14319         ;;
14320 *)      getprotobynumber_r_proto=0
14321         ;;
14322 esac
14323
14324 : see if getprotoent_r exists
14325 set getprotoent_r d_getprotoent_r
14326 eval $inlibc
14327 case "$d_getprotoent_r" in
14328 "$define")
14329         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14330         case "$d_getprotoent_r_proto:$usethreads" in
14331         ":define")      d_getprotoent_r_proto=define
14332                 set d_getprotoent_r_proto getprotoent_r $hdrs
14333                 eval $hasproto ;;
14334         *)      ;;
14335         esac
14336         case "$d_getprotoent_r_proto" in
14337         define)
14338         case "$getprotoent_r_proto" in
14339         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
14340         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
14341         esac
14342         case "$getprotoent_r_proto" in
14343         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
14344         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SBI ;;
14345         esac
14346         case "$getprotoent_r_proto" in
14347         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
14348         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=S_SBI ;;
14349         esac
14350         case "$getprotoent_r_proto" in
14351         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
14352         ./protochk "$extern_C $try" $hdrs && getprotoent_r_proto=I_SD ;;
14353         esac
14354         case "$getprotoent_r_proto" in
14355         ''|0)   d_getprotoent_r=undef
14356                 getprotoent_r_proto=0
14357                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
14358         * )     case "$getprotoent_r_proto" in
14359                 REENTRANT_PROTO*) ;;
14360                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
14361                 esac
14362                 echo "Prototype: $try" ;;
14363         esac
14364         ;;
14365         *)      case "$usethreads" in
14366                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
14367                 esac
14368                 d_getprotoent_r=undef
14369                 getprotoent_r_proto=0
14370                 ;;
14371         esac
14372         ;;
14373 *)      getprotoent_r_proto=0
14374         ;;
14375 esac
14376
14377 : see if prototypes for various getprotoxxx netdb.h functions are available
14378 echo " "
14379 set d_getprotoprotos getprotoent $i_netdb netdb.h
14380 eval $hasproto
14381
14382 : see if getprpwnam exists
14383 set getprpwnam d_getprpwnam
14384 eval $inlibc
14385
14386 : see if getpwent exists
14387 set getpwent d_getpwent
14388 eval $inlibc
14389
14390 : see if getpwent_r exists
14391 set getpwent_r d_getpwent_r
14392 eval $inlibc
14393 case "$d_getpwent_r" in
14394 "$define")
14395         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14396         case "$d_getpwent_r_proto:$usethreads" in
14397         ":define")      d_getpwent_r_proto=define
14398                 set d_getpwent_r_proto getpwent_r $hdrs
14399                 eval $hasproto ;;
14400         *)      ;;
14401         esac
14402         case "$d_getpwent_r_proto" in
14403         define)
14404         case "$getpwent_r_proto" in
14405         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14406         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14407         esac
14408         case "$getpwent_r_proto" in
14409         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14410         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14411         esac
14412         case "$getpwent_r_proto" in
14413         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14414         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBW ;;
14415         esac
14416         case "$getpwent_r_proto" in
14417         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14418         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=S_SBI ;;
14419         esac
14420         case "$getpwent_r_proto" in
14421         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14422         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBI ;;
14423         esac
14424         case "$getpwent_r_proto" in
14425         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14426         ./protochk "$extern_C $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14427         esac
14428         case "$getpwent_r_proto" in
14429         ''|0)   d_getpwent_r=undef
14430                 getpwent_r_proto=0
14431                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14432         * )     case "$getpwent_r_proto" in
14433                 REENTRANT_PROTO*) ;;
14434                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14435                 esac
14436                 echo "Prototype: $try" ;;
14437         esac
14438         ;;
14439         *)      case "$usethreads" in
14440                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14441                 esac
14442                 d_getpwent_r=undef
14443                 getpwent_r_proto=0
14444                 ;;
14445         esac
14446         ;;
14447 *)      getpwent_r_proto=0
14448         ;;
14449 esac
14450
14451 : see if getpwnam_r exists
14452 set getpwnam_r d_getpwnam_r
14453 eval $inlibc
14454 case "$d_getpwnam_r" in
14455 "$define")
14456         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14457         case "$d_getpwnam_r_proto:$usethreads" in
14458         ":define")      d_getpwnam_r_proto=define
14459                 set d_getpwnam_r_proto getpwnam_r $hdrs
14460                 eval $hasproto ;;
14461         *)      ;;
14462         esac
14463         case "$d_getpwnam_r_proto" in
14464         define)
14465         case "$getpwnam_r_proto" in
14466         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14467         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14468         esac
14469         case "$getpwnam_r_proto" in
14470         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14471         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14472         esac
14473         case "$getpwnam_r_proto" in
14474         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14475         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14476         esac
14477         case "$getpwnam_r_proto" in
14478         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14479         ./protochk "$extern_C $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14480         esac
14481         case "$getpwnam_r_proto" in
14482         ''|0)   d_getpwnam_r=undef
14483                 getpwnam_r_proto=0
14484                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14485         * )     case "$getpwnam_r_proto" in
14486                 REENTRANT_PROTO*) ;;
14487                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14488                 esac
14489                 echo "Prototype: $try" ;;
14490         esac
14491         ;;
14492         *)      case "$usethreads" in
14493                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14494                 esac
14495                 d_getpwnam_r=undef
14496                 getpwnam_r_proto=0
14497                 ;;
14498         esac
14499         ;;
14500 *)      getpwnam_r_proto=0
14501         ;;
14502 esac
14503
14504 : see if getpwuid_r exists
14505 set getpwuid_r d_getpwuid_r
14506 eval $inlibc
14507 case "$d_getpwuid_r" in
14508 "$define")
14509         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14510         case "$d_getpwuid_r_proto:$usethreads" in
14511         ":define")      d_getpwuid_r_proto=define
14512                 set d_getpwuid_r_proto getpwuid_r $hdrs
14513                 eval $hasproto ;;
14514         *)      ;;
14515         esac
14516         case "$d_getpwuid_r_proto" in
14517         define)
14518         case "$getpwuid_r_proto" in
14519         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14520         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14521         esac
14522         case "$getpwuid_r_proto" in
14523         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14524         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14525         esac
14526         case "$getpwuid_r_proto" in
14527         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14528         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14529         esac
14530         case "$getpwuid_r_proto" in
14531         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14532         ./protochk "$extern_C $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14533         esac
14534         case "$getpwuid_r_proto" in
14535         ''|0)   d_getpwuid_r=undef
14536                 getpwuid_r_proto=0
14537                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14538         * )     case "$getpwuid_r_proto" in
14539                 REENTRANT_PROTO*) ;;
14540                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14541                 esac
14542                 echo "Prototype: $try" ;;
14543         esac
14544         ;;
14545         *)      case "$usethreads" in
14546                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14547                 esac
14548                 d_getpwuid_r=undef
14549                 getpwuid_r_proto=0
14550                 ;;
14551         esac
14552         ;;
14553 *)      getpwuid_r_proto=0
14554         ;;
14555 esac
14556
14557 : Optional checks for getsbyname and getsbyport
14558
14559 : see if getservbyname exists
14560 set getservbyname d_getsbyname
14561 eval $inlibc
14562
14563 : see if getservbyport exists
14564 set getservbyport d_getsbyport
14565 eval $inlibc
14566
14567 : see if getservent exists
14568 set getservent d_getsent
14569 eval $inlibc
14570
14571 : see if getservbyname_r exists
14572 set getservbyname_r d_getservbyname_r
14573 eval $inlibc
14574 case "$d_getservbyname_r" in
14575 "$define")
14576         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14577         case "$d_getservbyname_r_proto:$usethreads" in
14578         ":define")      d_getservbyname_r_proto=define
14579                 set d_getservbyname_r_proto getservbyname_r $hdrs
14580                 eval $hasproto ;;
14581         *)      ;;
14582         esac
14583         case "$d_getservbyname_r_proto" in
14584         define)
14585         case "$getservbyname_r_proto" in
14586         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14587         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14588         esac
14589         case "$getservbyname_r_proto" in
14590         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14591         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14592         esac
14593         case "$getservbyname_r_proto" in
14594         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14595         ./protochk "$extern_C $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14596         esac
14597         case "$getservbyname_r_proto" in
14598         ''|0)   d_getservbyname_r=undef
14599                 getservbyname_r_proto=0
14600                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14601         * )     case "$getservbyname_r_proto" in
14602                 REENTRANT_PROTO*) ;;
14603                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14604                 esac
14605                 echo "Prototype: $try" ;;
14606         esac
14607         ;;
14608         *)      case "$usethreads" in
14609                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14610                 esac
14611                 d_getservbyname_r=undef
14612                 getservbyname_r_proto=0
14613                 ;;
14614         esac
14615         ;;
14616 *)      getservbyname_r_proto=0
14617         ;;
14618 esac
14619
14620 : see if getservbyport_r exists
14621 set getservbyport_r d_getservbyport_r
14622 eval $inlibc
14623 case "$d_getservbyport_r" in
14624 "$define")
14625         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14626         case "$d_getservbyport_r_proto:$usethreads" in
14627         ":define")      d_getservbyport_r_proto=define
14628                 set d_getservbyport_r_proto getservbyport_r $hdrs
14629                 eval $hasproto ;;
14630         *)      ;;
14631         esac
14632         case "$d_getservbyport_r_proto" in
14633         define)
14634         case "$getservbyport_r_proto" in
14635         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14636         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14637         esac
14638         case "$getservbyport_r_proto" in
14639         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14640         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14641         esac
14642         case "$getservbyport_r_proto" in
14643         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14644         ./protochk "$extern_C $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14645         esac
14646         case "$getservbyport_r_proto" in
14647         ''|0)   d_getservbyport_r=undef
14648                 getservbyport_r_proto=0
14649                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14650         * )     case "$getservbyport_r_proto" in
14651                 REENTRANT_PROTO*) ;;
14652                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14653                 esac
14654                 echo "Prototype: $try" ;;
14655         esac
14656         ;;
14657         *)      case "$usethreads" in
14658                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14659                 esac
14660                 d_getservbyport_r=undef
14661                 getservbyport_r_proto=0
14662                 ;;
14663         esac
14664         ;;
14665 *)      getservbyport_r_proto=0
14666         ;;
14667 esac
14668
14669 : see if getservent_r exists
14670 set getservent_r d_getservent_r
14671 eval $inlibc
14672 case "$d_getservent_r" in
14673 "$define")
14674         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14675         case "$d_getservent_r_proto:$usethreads" in
14676         ":define")      d_getservent_r_proto=define
14677                 set d_getservent_r_proto getservent_r $hdrs
14678                 eval $hasproto ;;
14679         *)      ;;
14680         esac
14681         case "$d_getservent_r_proto" in
14682         define)
14683         case "$getservent_r_proto" in
14684         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14685         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBWR ;;
14686         esac
14687         case "$getservent_r_proto" in
14688         ''|0) try='int getservent_r(struct servent*, char*, int);'
14689         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SBI ;;
14690         esac
14691         case "$getservent_r_proto" in
14692         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14693         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=S_SBI ;;
14694         esac
14695         case "$getservent_r_proto" in
14696         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14697         ./protochk "$extern_C $try" $hdrs && getservent_r_proto=I_SD ;;
14698         esac
14699         case "$getservent_r_proto" in
14700         ''|0)   d_getservent_r=undef
14701                 getservent_r_proto=0
14702                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14703         * )     case "$getservent_r_proto" in
14704                 REENTRANT_PROTO*) ;;
14705                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14706                 esac
14707                 echo "Prototype: $try" ;;
14708         esac
14709         ;;
14710         *)      case "$usethreads" in
14711                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14712                 esac
14713                 d_getservent_r=undef
14714                 getservent_r_proto=0
14715                 ;;
14716         esac
14717         ;;
14718 *)      getservent_r_proto=0
14719         ;;
14720 esac
14721
14722 : see if prototypes for various getservxxx netdb.h functions are available
14723 echo " "
14724 set d_getservprotos getservent $i_netdb netdb.h
14725 eval $hasproto
14726
14727 : see if getspnam exists
14728 set getspnam d_getspnam
14729 eval $inlibc
14730
14731 : see if this is a shadow.h system
14732 set shadow.h i_shadow
14733 eval $inhdr
14734
14735 : see if getspnam_r exists
14736 set getspnam_r d_getspnam_r
14737 eval $inlibc
14738 case "$d_getspnam_r" in
14739 "$define")
14740         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14741         case "$d_getspnam_r_proto:$usethreads" in
14742         ":define")      d_getspnam_r_proto=define
14743                 set d_getspnam_r_proto getspnam_r $hdrs
14744                 eval $hasproto ;;
14745         *)      ;;
14746         esac
14747         case "$d_getspnam_r_proto" in
14748         define)
14749         case "$getspnam_r_proto" in
14750         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14751         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14752         esac
14753         case "$getspnam_r_proto" in
14754         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14755         ./protochk "$extern_C $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14756         esac
14757         case "$getspnam_r_proto" in
14758         ''|0)   d_getspnam_r=undef
14759                 getspnam_r_proto=0
14760                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14761         * )     case "$getspnam_r_proto" in
14762                 REENTRANT_PROTO*) ;;
14763                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14764                 esac
14765                 echo "Prototype: $try" ;;
14766         esac
14767         ;;
14768         *)      case "$usethreads" in
14769                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14770                 esac
14771                 d_getspnam_r=undef
14772                 getspnam_r_proto=0
14773                 ;;
14774         esac
14775         ;;
14776 *)      getspnam_r_proto=0
14777         ;;
14778 esac
14779
14780 : see if gettimeofday or ftime exists
14781 set gettimeofday d_gettimeod
14782 eval $inlibc
14783 case "$d_gettimeod" in
14784 "$undef")
14785         set ftime d_ftime 
14786         eval $inlibc
14787         ;;
14788 *)
14789         val="$undef"; set d_ftime; eval $setvar
14790         ;;
14791 esac
14792 case "$d_gettimeod$d_ftime" in
14793 "$undef$undef")
14794         echo " "
14795         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14796         ;;
14797 esac
14798
14799 : see if gmtime_r exists
14800 set gmtime_r d_gmtime_r
14801 eval $inlibc
14802 case "$d_gmtime_r" in
14803 "$define")
14804         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14805         case "$d_gmtime_r_proto:$usethreads" in
14806         ":define")      d_gmtime_r_proto=define
14807                 set d_gmtime_r_proto gmtime_r $hdrs
14808                 eval $hasproto ;;
14809         *)      ;;
14810         esac
14811         case "$d_gmtime_r_proto" in
14812         define)
14813         case "$gmtime_r_proto" in
14814         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14815         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=S_TS ;;
14816         esac
14817         case "$gmtime_r_proto" in
14818         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14819         ./protochk "$extern_C $try" $hdrs && gmtime_r_proto=I_TS ;;
14820         esac
14821         case "$gmtime_r_proto" in
14822         ''|0)   d_gmtime_r=undef
14823                 gmtime_r_proto=0
14824                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14825         * )     case "$gmtime_r_proto" in
14826                 REENTRANT_PROTO*) ;;
14827                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14828                 esac
14829                 echo "Prototype: $try" ;;
14830         esac
14831         ;;
14832         *)      case "$usethreads" in
14833                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14834                 esac
14835                 d_gmtime_r=undef
14836                 gmtime_r_proto=0
14837                 ;;
14838         esac
14839         ;;
14840 *)      gmtime_r_proto=0
14841         ;;
14842 esac
14843
14844 : see if hasmntopt exists
14845 set hasmntopt d_hasmntopt
14846 eval $inlibc
14847
14848 : see if this is a netinet/in.h or sys/in.h system
14849 set netinet/in.h i_niin sys/in.h i_sysin
14850 eval $inhdr
14851
14852 : see if arpa/inet.h has to be included
14853 set arpa/inet.h i_arpainet
14854 eval $inhdr
14855
14856 : see if htonl --and friends-- exists
14857 val=''
14858 set htonl val
14859 eval $inlibc
14860
14861 : Maybe they are macros.
14862 case "$val" in
14863 $undef)
14864         $cat >htonl.c <<EOM
14865 #include <stdio.h>
14866 #include <sys/types.h>
14867 #$i_niin I_NETINET_IN
14868 #$i_sysin I_SYS_IN
14869 #$i_arpainet I_ARPA_INET
14870 #ifdef I_NETINET_IN
14871 #include <netinet/in.h>
14872 #endif
14873 #ifdef I_SYS_IN
14874 #include <sys/in.h>
14875 #endif
14876 #ifdef I_ARPA_INET
14877 #include <arpa/inet.h>
14878 #endif
14879 #ifdef htonl
14880 printf("Defined as a macro.");
14881 #endif
14882 EOM
14883         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14884         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14885                 val="$define"
14886                 echo "But it seems to be defined as a macro." >&4
14887         fi
14888         $rm -f htonl.?
14889         ;;
14890 esac
14891 set d_htonl
14892 eval $setvar
14893
14894 : see if ilogbl exists
14895 set ilogbl d_ilogbl
14896 eval $inlibc
14897
14898 : index or strchr
14899 echo " "
14900 if set index val -f; eval $csym; $val; then
14901         if set strchr val -f d_strchr; eval $csym; $val; then
14902                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14903                         val="$define"
14904                         vali="$undef"
14905                         echo "strchr() found." >&4
14906                 else
14907                         val="$undef"
14908                         vali="$define"
14909                         echo "index() found." >&4
14910                 fi
14911         else
14912                 val="$undef"
14913                 vali="$define"
14914                 echo "index() found." >&4
14915         fi
14916 else
14917         if set strchr val -f d_strchr; eval $csym; $val; then
14918                 val="$define"
14919                 vali="$undef"
14920                 echo "strchr() found." >&4
14921         else
14922                 echo "No index() or strchr() found!" >&4
14923                 val="$undef"
14924                 vali="$undef"
14925         fi
14926 fi
14927 set d_strchr; eval $setvar
14928 val="$vali"
14929 set d_index; eval $setvar
14930
14931 : check whether inet_aton exists
14932 set inet_aton d_inetaton
14933 eval $inlibc
14934
14935 : see if inet_ntop exists
14936 set inet_ntop d_inetntop
14937 eval $inlibc
14938
14939 : see if inet_pton exists
14940 set inet_pton d_inetpton
14941 eval $inlibc
14942
14943 : Look for isascii
14944 echo " "
14945 $cat >isascii.c <<EOCP
14946 #include <stdio.h>
14947 #include <ctype.h>
14948 #$i_stdlib I_STDLIB
14949 #ifdef I_STDLIB
14950 #include <stdlib.h>
14951 #endif
14952 int main() {
14953         int c = 'A';
14954         if (isascii(c))
14955                 exit(0);
14956         else
14957                 exit(1);
14958 }
14959 EOCP
14960 set isascii
14961 if eval $compile; then
14962         echo "isascii() found." >&4
14963         val="$define"
14964 else
14965         echo "isascii() NOT found." >&4
14966         val="$undef"
14967 fi
14968 set d_isascii
14969 eval $setvar
14970 $rm -f isascii*
14971
14972 : Look for isblank
14973 echo " "
14974 $cat >isblank.c <<'EOCP'
14975 #include <stdio.h>
14976 #include <ctype.h>
14977 int main() {
14978         int c = ' ';
14979         if (isblank(c))
14980                 exit(0);
14981         else
14982                 exit(1);
14983 }
14984 EOCP
14985 if $cc $ccflags $ldflags -o isblank isblank.c $libs >/dev/null 2>&1 ; then
14986         echo "isblank() found." >&4
14987         val="$define"
14988 else
14989         echo "isblank() NOT found." >&4
14990         val="$undef"
14991 fi
14992 set d_isblank
14993 eval $setvar
14994 $rm -f isblank*
14995
14996 : see if isfinite exists
14997 set isfinite d_isfinite
14998 eval $inlibc
14999
15000 : see if isinf exists
15001 set isinf d_isinf
15002 eval $inlibc
15003
15004 : see if isnan exists
15005 set isnan d_isnan
15006 eval $inlibc
15007
15008 : see if isnanl exists
15009 set isnanl d_isnanl
15010 eval $inlibc
15011
15012 : see if killpg exists
15013 set killpg d_killpg
15014 eval $inlibc
15015
15016 : see if lchown exists
15017 echo " "
15018 $cat > try.c <<'EOCP'
15019 /* System header to define __stub macros and hopefully few prototypes,
15020     which can conflict with char lchown(); below.  */
15021 #include <assert.h>
15022 /* Override any gcc2 internal prototype to avoid an error.  */
15023 /* We use char because int might match the return type of a gcc2
15024    builtin and then its argument prototype would still apply.  */
15025 char lchown();
15026 int main() {
15027     /*  The GNU C library defines this for functions which it implements
15028         to always fail with ENOSYS.  Some functions are actually named
15029         something starting with __ and the normal name is an alias.  */
15030 #if defined (__stub_lchown) || defined (__stub___lchown)
15031 choke me
15032 #else
15033 lchown();
15034 #endif
15035 ; return 0; }
15036 EOCP
15037 set try
15038 if eval $compile; then
15039     $echo "lchown() found." >&4
15040     val="$define"
15041 else
15042     $echo "lchown() NOT found." >&4
15043     val="$undef"
15044 fi
15045 set d_lchown
15046 eval $setvar
15047
15048 : See if number of significant digits in a double precision number is known
15049 echo " "
15050 $cat >ldbl_dig.c <<EOM
15051 #$i_limits I_LIMITS
15052 #$i_float I_FLOAT
15053 #ifdef I_LIMITS
15054 #include <limits.h>
15055 #endif
15056 #ifdef I_FLOAT
15057 #include <float.h>
15058 #endif
15059 #ifdef LDBL_DIG
15060 printf("Contains LDBL_DIG");
15061 #endif
15062 EOM
15063 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
15064 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
15065         echo "LDBL_DIG found." >&4
15066         val="$define"
15067 else
15068         echo "LDBL_DIG NOT found." >&4
15069         val="$undef"
15070 fi
15071 $rm -f ldbl_dig.?
15072 set d_ldbl_dig
15073 eval $setvar
15074
15075 : see if this is a math.h system
15076 set math.h i_math
15077 eval $inhdr
15078
15079 : check to see if math.h defines _LIB_VERSION
15080 d_libm_lib_version="$undef"
15081 case $i_math in
15082     $define)
15083         echo " "
15084         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
15085         $cat >try.c <<EOCP
15086 #include <unistd.h>
15087 #include <math.h>
15088 int main (int argc, char *argv[])
15089 {
15090     printf ("%d\n", _LIB_VERSION);
15091     return (0);
15092     } /* main */
15093 EOCP
15094         set try
15095         if eval $compile; then
15096             foo=`$run ./try`
15097             echo "Yes, it does ($foo)" >&4
15098             d_libm_lib_version="$define"
15099         else
15100             echo "No, it does not (probably harmless)" >&4
15101             fi
15102         $rm_try
15103         ;;
15104
15105     esac
15106
15107 : see if link exists
15108 set link d_link
15109 eval $inlibc
15110
15111 : see if localtime_r exists
15112 set localtime_r d_localtime_r
15113 eval $inlibc
15114 case "$d_localtime_r" in
15115 "$define")
15116         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
15117         case "$d_localtime_r_proto:$usethreads" in
15118         ":define")      d_localtime_r_proto=define
15119                 set d_localtime_r_proto localtime_r $hdrs
15120                 eval $hasproto ;;
15121         *)      ;;
15122         esac
15123         case "$d_localtime_r_proto" in
15124         define)
15125         case "$localtime_r_proto" in
15126         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
15127         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=S_TS ;;
15128         esac
15129         case "$localtime_r_proto" in
15130         ''|0) try='int localtime_r(const time_t*, struct tm*);'
15131         ./protochk "$extern_C $try" $hdrs && localtime_r_proto=I_TS ;;
15132         esac
15133         case "$localtime_r_proto" in
15134         ''|0)   d_localtime_r=undef
15135                 localtime_r_proto=0
15136                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
15137         * )     case "$localtime_r_proto" in
15138                 REENTRANT_PROTO*) ;;
15139                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
15140                 esac
15141                 echo "Prototype: $try" ;;
15142         esac
15143         ;;
15144         *)      case "$usethreads" in
15145                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
15146                 esac
15147                 d_localtime_r=undef
15148                 localtime_r_proto=0
15149                 ;;
15150         esac
15151         ;;
15152 *)      localtime_r_proto=0
15153         ;;
15154 esac
15155
15156 : see if localtime_r calls tzset
15157 case "$localtime_r_proto" in
15158 REENTRANT_PROTO*)
15159         $cat >try.c <<EOCP
15160 /*  Does our libc's localtime_r call tzset ?
15161  *  return 0 if so, 1 otherwise.
15162  */
15163 #$i_systypes    I_SYS_TYPES
15164 #$i_unistd      I_UNISTD
15165 #$i_time        I_TIME
15166 #$i_stdlib      I_STDLIB
15167 #$i_string      I_STRING
15168 #$i_malloc      I_MALLOC
15169 #ifdef I_SYS_TYPES
15170 #  include <sys/types.h>
15171 #endif
15172 #ifdef I_UNISTD
15173 #  include <unistd.h>
15174 #endif
15175 #ifdef I_TIME
15176 #  include <time.h>
15177 #endif
15178 #ifdef I_STDLIB
15179 #include <stdlib.h>
15180 #endif
15181 #ifdef I_STRING
15182 #  include <string.h>
15183 #else
15184 #  include <strings.h>
15185 #endif
15186 #ifdef I_MALLOC
15187 #  include <malloc.h>
15188 #endif
15189 int main()
15190 {
15191     time_t t = time(0L);
15192     char w_tz[]="TZ" "=GMT+5",
15193          e_tz[]="TZ" "=GMT-5",
15194         *tz_e = (char*)malloc(16),
15195         *tz_w = (char*)malloc(16);
15196     struct tm tm_e, tm_w;
15197     memset(&tm_e,'\0',sizeof(struct tm));
15198     memset(&tm_w,'\0',sizeof(struct tm));
15199     strcpy(tz_e,e_tz);
15200     strcpy(tz_w,w_tz);
15201
15202     putenv(tz_e);
15203     localtime_r(&t, &tm_e);
15204
15205     putenv(tz_w);
15206     localtime_r(&t, &tm_w);
15207
15208     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
15209         return 1;
15210     return 0;
15211 }
15212 EOCP
15213         set try
15214         if eval $compile; then
15215             if $run ./try; then
15216                 d_localtime_r_needs_tzset=undef;
15217             else
15218                 d_localtime_r_needs_tzset=define;
15219             fi;
15220         else
15221             d_localtime_r_needs_tzset=undef;
15222         fi;
15223      ;;
15224   *)
15225      d_localtime_r_needs_tzset=undef;
15226      ;;
15227 esac
15228 $rm_try
15229
15230 : see if localeconv exists
15231 set localeconv d_locconv
15232 eval $inlibc
15233
15234 : see if lockf exists
15235 set lockf d_lockf
15236 eval $inlibc
15237
15238 : see if prototype for lseek is available
15239 echo " "
15240 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
15241 eval $hasproto
15242
15243 : see if lstat exists
15244 set lstat d_lstat
15245 eval $inlibc
15246
15247 : see if madvise exists
15248 set madvise d_madvise
15249 eval $inlibc
15250
15251 : see if malloc_size exists
15252 set malloc_size d_malloc_size
15253 eval $inlibc
15254
15255 : see if malloc_size_good exists
15256 set malloc_good_size d_malloc_good_size
15257 eval $inlibc
15258
15259 : see if mblen exists
15260 set mblen d_mblen
15261 eval $inlibc
15262
15263 : see if mbstowcs exists
15264 set mbstowcs d_mbstowcs
15265 eval $inlibc
15266
15267 : see if mbtowc exists
15268 set mbtowc d_mbtowc
15269 eval $inlibc
15270
15271 : see if memchr exists
15272 set memchr d_memchr
15273 eval $inlibc
15274
15275 : see if memcmp exists
15276 set memcmp d_memcmp
15277 eval $inlibc
15278
15279 : see if memcpy exists
15280 set memcpy d_memcpy
15281 eval $inlibc
15282
15283 : see if memmove exists
15284 set memmove d_memmove
15285 eval $inlibc
15286
15287 : see if memset exists
15288 set memset d_memset
15289 eval $inlibc
15290
15291 : see if mkdir exists
15292 set mkdir d_mkdir
15293 eval $inlibc
15294
15295 : see if mkdtemp exists
15296 set mkdtemp d_mkdtemp
15297 eval $inlibc
15298
15299 : see if mkfifo exists
15300 set mkfifo d_mkfifo
15301 eval $inlibc
15302
15303 : see if mkstemp exists
15304 set mkstemp d_mkstemp
15305 eval $inlibc
15306
15307 : see if mkstemps exists
15308 set mkstemps d_mkstemps
15309 eval $inlibc
15310
15311 : see if mktime exists
15312 set mktime d_mktime
15313 eval $inlibc
15314
15315 : see if this is a sys/mman.h system
15316 set sys/mman.h i_sysmman
15317 eval $inhdr
15318
15319 : see if mmap exists
15320 set mmap d_mmap
15321 eval $inlibc
15322 : see what shmat returns
15323 : default to something harmless
15324 mmaptype='void *'
15325 case "$i_sysmman$d_mmap" in
15326 "$define$define")
15327         $cat >mmap.c <<'END'
15328 #include <sys/mman.h>
15329 void *mmap();
15330 END
15331         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
15332                 mmaptype='void *'
15333         else
15334                 mmaptype='caddr_t'
15335         fi
15336         echo "and it returns ($mmaptype)." >&4
15337         ;;
15338 esac
15339
15340
15341
15342 : see if sqrtl exists
15343 set sqrtl d_sqrtl
15344 eval $inlibc
15345
15346 : see if scalbnl exists
15347 set scalbnl d_scalbnl
15348 eval $inlibc
15349
15350 : see if modfl exists
15351 set modfl d_modfl
15352 eval $inlibc
15353
15354 : see if prototype for modfl is available
15355 echo " "
15356 set d_modflproto modfl $i_math math.h
15357 eval $hasproto
15358
15359 d_modfl_pow32_bug="$undef"
15360
15361 case "$d_longdbl$d_modfl" in
15362 $define$define)
15363         $cat <<EOM
15364 Checking to see whether your modfl() is okay for large values...
15365 EOM
15366 $cat >try.c <<EOCP
15367 #include <math.h>
15368 #include <stdio.h>
15369 EOCP
15370 if $test "X$d_modflproto" != "X$define"; then
15371         $cat >>try.c <<EOCP
15372 /* Sigh. many current glibcs provide the function, but do not prototype it. */
15373 long double modfl (long double, long double *);
15374 EOCP
15375 fi
15376 $cat >>try.c <<EOCP
15377 int main() {
15378     long double nv = 4294967303.15;
15379     long double v, w;
15380     v = modfl(nv, &w);
15381 #ifdef __GLIBC__
15382     printf("glibc");
15383 #endif
15384     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
15385     return 0;
15386 }
15387 EOCP
15388         case "$osname:$gccversion" in
15389         aix:)   saveccflags="$ccflags"
15390                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
15391         esac
15392         set try
15393         if eval $compile; then
15394                 foo=`$run ./try`
15395                 case "$foo" in
15396                 *" 4294967303.150000 1.150000 4294967302.000000")
15397                         echo >&4 "Your modfl() is broken for large values."
15398                         d_modfl_pow32_bug="$define"
15399                         case "$foo" in
15400                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
15401                         ;;
15402                         esac
15403                         ;;
15404                 *" 4294967303.150000 0.150000 4294967303.000000")
15405                         echo >&4 "Your modfl() seems okay for large values."
15406                         ;;
15407                 *)      echo >&4 "I don't understand your modfl() at all."
15408                         d_modfl="$undef"
15409                         ;;
15410                 esac
15411                 $rm_try
15412         else
15413                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
15414                 d_modfl="$undef"
15415         fi
15416         case "$osname:$gccversion" in
15417         aix:)   ccflags="$saveccflags" ;; # restore
15418         esac
15419         ;;
15420 esac
15421
15422 if $test "$uselongdouble" = "$define"; then
15423     message=""
15424     if $test "$d_sqrtl" != "$define"; then
15425         message="$message sqrtl"
15426     fi
15427     if $test "$d_modfl" != "$define"; then
15428         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
15429             echo "You have both aintl and copysignl, so I can emulate modfl."
15430         else
15431             message="$message modfl"
15432         fi
15433     fi
15434     if $test "$d_frexpl" != "$define"; then
15435         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
15436             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
15437         else
15438             message="$message frexpl"
15439         fi
15440     fi
15441
15442     if $test "$message" != ""; then
15443         $cat <<EOM >&4
15444
15445 *** You requested the use of long doubles but you do not seem to have
15446 *** the following mathematical functions needed for long double support:
15447 ***    $message
15448 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
15449 *** Cannot continue, aborting.
15450
15451 EOM
15452
15453         exit 1
15454     fi
15455 fi
15456
15457 : see if mprotect exists
15458 set mprotect d_mprotect
15459 eval $inlibc
15460
15461 : see if msgctl exists
15462 set msgctl d_msgctl
15463 eval $inlibc
15464
15465 : see if msgget exists
15466 set msgget d_msgget
15467 eval $inlibc
15468
15469 : see if msgsnd exists
15470 set msgsnd d_msgsnd
15471 eval $inlibc
15472
15473 : see if msgrcv exists
15474 set msgrcv d_msgrcv
15475 eval $inlibc
15476
15477 : see how much of the 'msg*(2)' library is present.
15478 h_msg=true
15479 echo " "
15480 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15481 *"$undef"*) h_msg=false;;
15482 esac
15483 case "$osname" in
15484 freebsd)
15485     case "`ipcs 2>&1`" in
15486     "SVID messages"*"not configured"*)
15487         echo "Your $osname does not have the msg*(2) configured." >&4
15488         h_msg=false
15489         val="$undef"
15490         set msgctl d_msgctl
15491         eval $setvar
15492         set msgget d_msgget
15493         eval $setvar
15494         set msgsnd d_msgsnd
15495         eval $setvar
15496         set msgrcv d_msgrcv
15497         eval $setvar
15498         ;;
15499     esac
15500     ;;
15501 esac
15502 : we could also check for sys/ipc.h ...
15503 if $h_msg && $test `./findhdr sys/msg.h`; then
15504         echo "You have the full msg*(2) library." >&4
15505         val="$define"
15506 else
15507         echo "You don't have the full msg*(2) library." >&4
15508         val="$undef"
15509 fi
15510 set d_msg
15511 eval $setvar
15512
15513 : Check for msghdr_s
15514 echo " "
15515 echo "Checking to see if your system supports struct msghdr..." >&4
15516 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15517 eval $hasstruct
15518 case "$d_msghdr_s" in
15519 "$define")      echo "Yes, it does."   ;;
15520 *)              echo "No, it doesn't." ;;
15521 esac
15522
15523
15524 : see if msync exists
15525 set msync d_msync
15526 eval $inlibc
15527
15528 : see if munmap exists
15529 set munmap d_munmap
15530 eval $inlibc
15531
15532 : see if nice exists
15533 set nice d_nice
15534 eval $inlibc
15535
15536 : see if this is a langinfo.h system
15537 set langinfo.h i_langinfo
15538 eval $inhdr
15539
15540 : see if nl_langinfo exists
15541 set nl_langinfo d_nl_langinfo
15542 eval $inlibc
15543
15544 : check for volatile keyword
15545 echo " "
15546 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15547 $cat >try.c <<'EOCP'
15548 int main()
15549 {
15550         typedef struct _goo_struct goo_struct;
15551         goo_struct * volatile goo = ((goo_struct *)0);
15552         struct _goo_struct {
15553                 long long_int;
15554                 int reg_int;
15555                 char char_var;
15556         };
15557         typedef unsigned short foo_t;
15558         char *volatile foo;
15559         volatile int bar;
15560         volatile foo_t blech;
15561         foo = foo;
15562 }
15563 EOCP
15564 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15565         val="$define"
15566         echo "Yup, it does."
15567 else
15568         val="$undef"
15569         echo "Nope, it doesn't."
15570 fi
15571 set d_volatile
15572 eval $setvar
15573 $rm_try
15574
15575 : Check basic sizes
15576 echo " "
15577 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15578
15579 case "$use64bitint:$d_quad:$quadtype" in
15580 define:define:?*)
15581         ivtype="$quadtype"
15582         uvtype="$uquadtype"
15583         ivsize=8
15584         uvsize=8
15585         ;;
15586 *)      ivtype="long"
15587         uvtype="unsigned long"
15588         ivsize=$longsize
15589         uvsize=$longsize
15590         ;;
15591 esac
15592
15593 case "$uselongdouble:$d_longdbl" in
15594 define:define)
15595         nvtype="long double"
15596         nvsize=$longdblsize
15597         ;;
15598 *)      nvtype=double
15599         nvsize=$doublesize
15600         ;;
15601 esac
15602
15603 $echo "(IV will be "$ivtype", $ivsize bytes)"
15604 $echo "(UV will be "$uvtype", $uvsize bytes)"
15605 $echo "(NV will be "$nvtype", $nvsize bytes)"
15606
15607 $cat >try.c <<EOCP
15608 #$i_inttypes I_INTTYPES
15609 #ifdef I_INTTYPES
15610 #include <inttypes.h>
15611 #endif
15612 #include <stdio.h>
15613 int main() {
15614 #ifdef INT8
15615    int8_t i =  INT8_MAX;
15616   uint8_t u = UINT8_MAX;
15617   printf("int8_t\n");
15618 #endif
15619 #ifdef INT16
15620    int16_t i =  INT16_MAX;
15621   uint16_t i = UINT16_MAX;
15622   printf("int16_t\n");
15623 #endif
15624 #ifdef INT32
15625    int32_t i =  INT32_MAX;
15626   uint32_t u = UINT32_MAX;
15627   printf("int32_t\n");
15628 #endif
15629 }
15630 EOCP
15631
15632 i8type="signed char"
15633 u8type="unsigned char"
15634 i8size=1
15635 u8size=1
15636
15637 case "$i16type" in
15638 '')     case "$shortsize" in
15639         2)      i16type=short
15640                 u16type="unsigned short"
15641                 i16size=$shortsize
15642                 u16size=$shortsize
15643                 ;;
15644         esac
15645         ;;
15646 esac
15647 case "$i16type" in
15648 '')     set try -DINT16
15649         if eval $compile; then
15650                 case "`$run ./try`" in
15651                 int16_t)
15652                         i16type=int16_t
15653                         u16type=uint16_t
15654                         i16size=2
15655                         u16size=2
15656                         ;;
15657                 esac
15658         fi
15659         ;;
15660 esac
15661 case "$i16type" in
15662 '')     if $test $shortsize -ge 2; then
15663                 i16type=short
15664                 u16type="unsigned short"
15665                 i16size=$shortsize
15666                 u16size=$shortsize
15667         fi
15668         ;;
15669 esac
15670
15671 case "$i32type" in
15672 '')     case "$longsize" in
15673         4)      i32type=long
15674                 u32type="unsigned long"
15675                 i32size=$longsize
15676                 u32size=$longsize
15677                 ;;
15678         *)      case "$intsize" in
15679                 4)      i32type=int
15680                         u32type="unsigned int"
15681                         i32size=$intsize
15682                         u32size=$intsize
15683                         ;;
15684                 esac
15685                 ;;
15686         esac
15687         ;;
15688 esac
15689 case "$i32type" in
15690 '')     set try -DINT32
15691         if eval $compile; then
15692                 case "`$run ./try`" in
15693                 int32_t)
15694                         i32type=int32_t
15695                         u32type=uint32_t
15696                         i32size=4
15697                         u32size=4
15698                         ;;
15699                 esac
15700         fi
15701         ;;
15702 esac
15703 case "$i32type" in
15704 '')     if $test $intsize -ge 4; then
15705                 i32type=int
15706                 u32type="unsigned int"
15707                 i32size=$intsize
15708                 u32size=$intsize
15709         fi
15710         ;;
15711 esac
15712
15713 case "$i64type" in
15714 '')     case "$d_quad:$quadtype" in
15715         define:?*)
15716                 i64type="$quadtype"
15717                 u64type="$uquadtype"
15718                 i64size=8
15719                 u64size=8
15720                 ;;
15721         esac
15722         ;;
15723 esac
15724
15725 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15726 : volatile so that the compiler has to store it out to memory.
15727 if test X"$d_volatile" = X"$define"; then
15728         volatile=volatile
15729 fi
15730 $cat <<EOP >try.c
15731 #include <stdio.h>
15732 #$i_stdlib I_STDLIB
15733 #ifdef I_STDLIB
15734 #include <stdlib.h>
15735 #endif
15736 #include <sys/types.h>
15737 #include <signal.h>
15738 #ifdef SIGFPE
15739 $volatile int bletched = 0;
15740 $signal_t blech(int s) { bletched = 1; }
15741 #endif
15742 int main() {
15743     $uvtype u = 0;
15744     $nvtype d;
15745     int     n = 8 * $uvsize;
15746     int     i;
15747 #ifdef SIGFPE
15748     signal(SIGFPE, blech);
15749 #endif
15750
15751     for (i = 0; i < n; i++) {
15752       u = u << 1 | ($uvtype)1;
15753       d = ($nvtype)u;
15754       if (($uvtype)d != u)
15755         break;
15756       if (d <= 0)
15757         break;
15758       d = ($nvtype)(u - 1);
15759       if (($uvtype)d != (u - 1))
15760         break;
15761 #ifdef SIGFPE
15762       if (bletched)
15763         break;
15764 #endif
15765     }
15766     printf("%d\n", ((i == n) ? -n : i));
15767     exit(0);
15768 }
15769 EOP
15770 set try
15771
15772 d_nv_preserves_uv="$undef"
15773 if eval $compile; then
15774         nv_preserves_uv_bits="`$run ./try`"
15775 fi
15776 case "$nv_preserves_uv_bits" in
15777 \-[1-9]*)
15778         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15779         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15780         d_nv_preserves_uv="$define"
15781         ;;
15782 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15783         d_nv_preserves_uv="$undef" ;;
15784 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15785         nv_preserves_uv_bits="0" ;;
15786 esac
15787 $rm_try
15788
15789 $echo "Checking to find the largest integer value your NVs can hold..." >&4
15790 : volatile so that the compiler has to store it out to memory.
15791 if test X"$d_volatile" = X"$define"; then
15792         volatile=volatile
15793 fi
15794 $cat <<EOP >try.c
15795 #include <stdio.h>
15796
15797 typedef $nvtype NV;
15798
15799 int
15800 main() {
15801   NV value = 2;
15802   int count = 1;
15803
15804   while(count < 256) {
15805     $volatile NV up = value + 1.0;
15806     $volatile NV negated = -value;
15807     $volatile NV down = negated - 1.0;
15808     $volatile NV got_up = up - value;
15809     int up_good = got_up == 1.0;
15810     int got_down = down - negated;
15811     int down_good = got_down == -1.0;
15812
15813     if (down_good != up_good) {
15814       fprintf(stderr,
15815               "Inconsistency - up %d %f; down %d %f; for 2**%d (%.20f)\n",
15816               up_good, (double) got_up, down_good, (double) got_down,
15817               count, (double) value);
15818       return 1;
15819     }
15820     if (!up_good) {
15821       while (1) {
15822         if (count > 8) {
15823           count -= 8;
15824           fputs("256.0", stdout);
15825         } else {
15826           count--;
15827           fputs("2.0", stdout);
15828         }
15829         if (!count) {
15830           puts("");
15831           return 0;
15832         }
15833         fputs("*", stdout);
15834       }
15835     }
15836     value *= 2;
15837     ++count;
15838   }
15839   fprintf(stderr, "Cannot overflow integer range, even at 2**%d (%.20f)\n",
15840           count, (double) value);
15841   return 1;
15842 }
15843 EOP
15844 set try
15845
15846 nv_overflows_integers_at='0'
15847 if eval $compile; then
15848     xxx="`$run ./try`"
15849     case "$?" in
15850         0)
15851             case "$xxx" in
15852                 2*)  cat >&4 <<EOM
15853 The largest integer your NVs can preserve is equal to $xxx
15854 EOM
15855                     nv_overflows_integers_at="$xxx"
15856                     ;;
15857                 *)  cat >&4 <<EOM
15858 Cannot determine the largest integer value your NVs can hold, unexpected output
15859 '$xxx'
15860 EOM
15861                     ;;
15862             esac
15863             ;;
15864         *)  cat >&4 <<EOM
15865 Cannot determine the largest integer value your NVs can hold
15866 EOM
15867             ;;
15868     esac
15869 fi
15870 $rm_try
15871
15872 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15873 : volatile so that the compiler has to store it out to memory.
15874 if test X"$d_volatile" = X"$define"; then
15875         volatile=volatile
15876 fi
15877 $cat <<EOP >try.c
15878 #include <stdio.h>
15879 #$i_stdlib I_STDLIB
15880 #ifdef I_STDLIB
15881 #include <stdlib.h>
15882 #endif
15883 #$i_string I_STRING
15884 #ifdef I_STRING
15885 #  include <string.h>
15886 #else
15887 #  include <strings.h>
15888 #endif
15889 #include <sys/types.h>
15890 #include <signal.h>
15891 #ifdef SIGFPE
15892 $volatile int bletched = 0;
15893 $signal_t blech(int s) { bletched = 1; }
15894 #endif
15895
15896 int checkit($nvtype d, char *where) {
15897     unsigned char *p = (char *)&d;
15898     unsigned char *end = p + sizeof(d);
15899     int fail = 0;
15900
15901     while (p < end)
15902         fail += *p++;
15903
15904     if (!fail)
15905         return 0;
15906
15907     p = (char *)&d;
15908     printf("No - %s: 0x", where);
15909     while (p < end)
15910         printf ("%02X", *p++);
15911     printf("\n");
15912     return 1;
15913 }
15914
15915 int main(int argc, char **argv) {
15916     $nvtype d = 0.0;
15917     int fail = 0;
15918     fail += checkit(d, "0.0");
15919
15920     /* The compiler shouldn't be assuming that bletched is 0  */
15921     d = bletched;
15922
15923     fail += checkit(d, "bleched");
15924
15925 #ifdef SIGFPE
15926     signal(SIGFPE, blech);
15927 #endif
15928
15929     /* Paranoia - the compiler should have no way of knowing that ANSI says
15930        that argv[argc] will always be NULL.  Actually, if it did assume this it
15931        would be buggy, as this is C and main() can be called from elsewhere in
15932        the program.  */
15933     d = argv[argc] ? 1 : 0;
15934
15935     if (d) {
15936         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15937     }
15938
15939     fail += checkit(d, "ternary");
15940
15941     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15942
15943     if (d != 0.0) {
15944         printf("No - memset doesn't give 0.0\n");
15945         /* This might just blow up:  */
15946         printf("(gives %g)\n", d);
15947         return 1;
15948     }
15949
15950 #ifdef SIGFPE
15951     if (bletched) {
15952         printf("No - something bleched\n");
15953         return 1;
15954     }
15955 #endif
15956     if (fail) {
15957       printf("No - %d fail(s)\n", fail);
15958       return 1;
15959     }
15960     printf("Yes\n");
15961     return 0;
15962 }
15963 EOP
15964 set try
15965
15966 d_nv_zero_is_allbits_zero="$undef"
15967 if eval $compile; then
15968     xxx="`$run ./try`"
15969     case "$?" in
15970         0)
15971             case "$xxx" in
15972                 Yes)  cat >&4 <<EOM
15973 0.0 is represented as all bits zero in memory
15974 EOM
15975                     d_nv_zero_is_allbits_zero="$define"
15976                     ;;
15977                 *)  cat >&4 <<EOM
15978 0.0 is not represented as all bits zero in memory
15979 EOM
15980                     d_nv_zero_is_allbits_zero="$undef"
15981                     ;;
15982             esac
15983             ;;
15984         *)  cat >&4 <<EOM
15985 0.0 is not represented as all bits zero in memory
15986 EOM
15987             d_nv_zero_is_allbits_zero="$undef"
15988             ;;
15989     esac
15990 fi
15991 $rm_try
15992
15993 : check for off64_t
15994 echo " "
15995 echo "Checking to see if you have off64_t..." >&4
15996 $cat >try.c <<EOCP
15997 #include <sys/types.h>
15998 #include <unistd.h>
15999 int main() { off64_t x = 7; }
16000 EOCP
16001 set try
16002 if eval $compile; then
16003         val="$define"
16004         echo "You have off64_t."
16005 else
16006         val="$undef"
16007         echo "You do not have off64_t."
16008         case "$lseeksize" in
16009         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
16010         esac
16011 fi
16012 $rm_try
16013 set d_off64_t
16014 eval $setvar
16015
16016 : how to create joinable pthreads
16017 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
16018         echo " "
16019         echo "Checking what constant to use for creating joinable pthreads..." >&4
16020         $cat >try.c <<'EOCP'
16021 #include <pthread.h>
16022 int main() {
16023     int detachstate = JOINABLE;
16024 }
16025 EOCP
16026         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
16027         if eval $compile; then
16028                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
16029                 val="$undef" # Yes, undef.
16030                 set d_old_pthread_create_joinable
16031                 eval $setvar
16032                 val=""
16033                 set old_pthread_create_joinable
16034                 eval $setvar
16035         else
16036                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
16037                 if eval $compile; then
16038                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
16039                         val="$define"
16040                         set d_old_pthread_create_joinable
16041                         eval $setvar
16042                         val=PTHREAD_CREATE_UNDETACHED
16043                         set old_pthread_create_joinable
16044                         eval $setvar
16045                 else
16046                         set try -DJOINABLE=__UNDETACHED
16047                         if eval $compile; then
16048                                 echo "You seem to use __UNDETACHED." >&4
16049                                 val="$define"
16050                                 set d_old_pthread_create_joinable
16051                                 eval $setvar
16052                                 val=__UNDETACHED
16053                                 set old_pthread_create_joinable
16054                                 eval $setvar
16055                         else
16056                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
16057                                 val="$define"
16058                                 set d_old_pthread_create_joinable
16059                                 eval $setvar
16060                                 val=0
16061                                 set old_pthread_create_joinable
16062                                 eval $setvar
16063                         fi
16064                 fi
16065         fi
16066         $rm_try
16067 else
16068     d_old_pthread_create_joinable="$undef"
16069     old_pthread_create_joinable=""
16070 fi
16071
16072 : see if pause exists
16073 set pause d_pause
16074 eval $inlibc
16075
16076 : see if poll exists
16077 set poll d_poll
16078 eval $inlibc
16079
16080 : see if prctl exists
16081 set prctl d_prctl
16082 eval $inlibc
16083
16084 : see if prctl supports PR_SET_NAME
16085 d_prctl_set_name=$undef
16086 case $d_prctl in
16087     $define)
16088         $cat >try.c <<EOM
16089 #include <sys/prctl.h>
16090
16091 int main (int argc, char *argv[])
16092 {
16093     return (prctl (PR_SET_NAME, "Test"));
16094     } /* main */
16095 EOM
16096         set try
16097         if eval $compile_ok && $run ./try; then
16098             echo "Your prctl (PR_SET_NAME, ...) works"
16099             d_prctl_set_name=$define
16100             fi
16101         $rm_try
16102         ;;
16103     esac
16104
16105 : see if readlink exists
16106 set readlink d_readlink
16107 eval $inlibc
16108
16109 : Check if exe is symlink to abs path of executing program
16110 echo " "
16111 procselfexe=''
16112 val="$undef"
16113 case "$d_readlink" in
16114     "$define")
16115         : NetBSD first as /proc/self is a symlink to /proc/curproc, and it feels
16116         : more tidy to avoid an extra level of symlink
16117         set NetBSD /proc/curproc/exe Linux /proc/self/exe FreeBSD /proc/curproc/file Solaris /proc/self/path/a.out
16118         while test $# -gt 0; do
16119             type=$1; try=$2
16120             shift; shift
16121             if $issymlink $try; then
16122                 $ls -l $try > reflect
16123                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
16124                     echo "You have $type-like $try."
16125                     procselfexe='"'$try'"'
16126                     val="$define"
16127                     : This will break out of the loop
16128                     set X; shift
16129                 fi
16130             fi
16131         done
16132         ;;
16133 esac
16134 $rm -f reflect
16135 set d_procselfexe
16136 eval $setvar
16137
16138 : backward compatibility for d_hvfork
16139 if test X$d_hvfork != X; then
16140         d_vfork="$d_hvfork"
16141         d_hvfork=''
16142 fi
16143 : see if there is a vfork
16144 val=''
16145 set vfork val
16146 eval $inlibc
16147
16148 d_pseudofork=$undef
16149
16150 : Ok, but do we want to use it. vfork is reportedly unreliable in
16151 : perl on Solaris 2.x, and probably elsewhere.
16152 case "$val" in
16153 $define)
16154         echo " "
16155         case "$usevfork" in
16156         false) dflt='n';;
16157         *) dflt='y';;
16158         esac
16159         cat <<'EOM'
16160
16161 Perl can only use a vfork() that doesn't suffer from strict
16162 restrictions on calling functions or modifying global data in
16163 the child.  For example, glibc-2.1 contains such a vfork()
16164 that is unsuitable.  If your system provides a proper fork()
16165 call, chances are that you do NOT want perl to use vfork().
16166
16167 EOM
16168         rp="Do you still want to use vfork()?"
16169         . ./myread
16170         case "$ans" in
16171         y|Y) ;;
16172         *)
16173                 echo "Ok, we won't use vfork()."
16174                 val="$undef"
16175                 ;;
16176         esac
16177         ;;
16178 esac
16179 set d_vfork
16180 eval $setvar
16181 case "$d_vfork" in
16182 $define) usevfork='true';;
16183 *) usevfork='false';;
16184 esac
16185
16186 : see whether the pthread_atfork exists
16187 $cat >try.c <<EOP
16188 #include <pthread.h>
16189 #include <stdio.h>
16190 int main() {
16191 #ifdef  PTHREAD_ATFORK
16192         pthread_atfork(NULL,NULL,NULL);
16193 #endif
16194 }
16195 EOP
16196
16197 : see if pthread_atfork exists
16198 set try -DPTHREAD_ATFORK
16199 if eval $compile; then
16200     val="$define"
16201 else
16202     val="$undef"
16203 fi
16204 case "$usethreads" in
16205 $define)
16206         case "$val" in
16207         $define) echo 'pthread_atfork found.' >&4        ;;
16208         *)       echo 'pthread_atfork NOT found.' >&4    ;;
16209         esac
16210 esac
16211 set d_pthread_atfork
16212 eval $setvar
16213
16214 : see if pthread_attr_setscope exists
16215 set pthread_attr_setscope d_pthread_attr_setscope
16216 eval $inlibc
16217
16218 : see whether the various POSIXish _yields exist
16219 $cat >try.c <<EOP
16220 #include <pthread.h>
16221 #include <stdio.h>
16222 int main() {
16223 #ifdef SCHED_YIELD
16224         sched_yield();
16225 #else
16226 #ifdef PTHREAD_YIELD
16227         pthread_yield();
16228 #else
16229 #ifdef PTHREAD_YIELD_NULL
16230         pthread_yield(NULL);
16231 #endif
16232 #endif
16233 #endif
16234 }
16235 EOP
16236 : see if sched_yield exists
16237 set try -DSCHED_YIELD
16238 if eval $compile; then
16239     val="$define"
16240     sched_yield='sched_yield()'
16241 else
16242     val="$undef"
16243 fi
16244 case "$usethreads" in
16245 $define)
16246         case "$val" in
16247         $define) echo 'sched_yield() found.' >&4        ;;
16248         *)       echo 'sched_yield() NOT found.' >&4    ;;
16249         esac
16250 esac
16251 set d_sched_yield
16252 eval $setvar
16253
16254 : see if pthread_yield exists
16255 set try -DPTHREAD_YIELD
16256 if eval $compile; then
16257     val="$define"
16258     case "$sched_yield" in
16259     '') sched_yield='pthread_yield()' ;;
16260     esac
16261 else
16262     set try -DPTHREAD_YIELD_NULL
16263     if eval $compile; then
16264         val="$define"
16265         case "$sched_yield" in
16266         '') sched_yield='pthread_yield(NULL)' ;;
16267         esac
16268     else
16269         val="$undef"
16270     fi
16271 fi
16272 case "$usethreads" in
16273 $define)
16274         case "$val" in
16275         $define) echo 'pthread_yield() found.' >&4      ;;
16276         *)       echo 'pthread_yield() NOT found.' >&4  ;;
16277         esac
16278         ;;
16279 esac
16280 set d_pthread_yield
16281 eval $setvar
16282 case "$sched_yield" in
16283 '') sched_yield=undef ;;
16284 esac
16285 $rm_try
16286
16287 : see if random_r exists
16288 set random_r d_random_r
16289 eval $inlibc
16290 case "$d_random_r" in
16291 "$define")
16292         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16293         case "$d_random_r_proto:$usethreads" in
16294         ":define")      d_random_r_proto=define
16295                 set d_random_r_proto random_r $hdrs
16296                 eval $hasproto ;;
16297         *)      ;;
16298         esac
16299         case "$d_random_r_proto" in
16300         define)
16301         case "$random_r_proto" in
16302         ''|0) try='int random_r(int*, struct random_data*);'
16303         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_iS ;;
16304         esac
16305         case "$random_r_proto" in
16306         ''|0) try='int random_r(long*, struct random_data*);'
16307         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_lS ;;
16308         esac
16309         case "$random_r_proto" in
16310         ''|0) try='int random_r(struct random_data*, int32_t*);'
16311         ./protochk "$extern_C $try" $hdrs && random_r_proto=I_St ;;
16312         esac
16313         case "$random_r_proto" in
16314         ''|0)   d_random_r=undef
16315                 random_r_proto=0
16316                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
16317         * )     case "$random_r_proto" in
16318                 REENTRANT_PROTO*) ;;
16319                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
16320                 esac
16321                 echo "Prototype: $try" ;;
16322         esac
16323         ;;
16324         *)      case "$usethreads" in
16325                 define) echo "random_r has no prototype, not using it." >&4 ;;
16326                 esac
16327                 d_random_r=undef
16328                 random_r_proto=0
16329                 ;;
16330         esac
16331         ;;
16332 *)      random_r_proto=0
16333         ;;
16334 esac
16335
16336 : see if readdir and friends exist
16337 set readdir d_readdir
16338 eval $inlibc
16339 set seekdir d_seekdir
16340 eval $inlibc
16341 set telldir d_telldir
16342 eval $inlibc
16343 set rewinddir d_rewinddir
16344 eval $inlibc
16345
16346 : see if readdir64_r exists
16347 set readdir64_r d_readdir64_r
16348 eval $inlibc
16349 case "$d_readdir64_r" in
16350 "$define")
16351         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16352         case "$d_readdir64_r_proto:$usethreads" in
16353         ":define")      d_readdir64_r_proto=define
16354                 set d_readdir64_r_proto readdir64_r $hdrs
16355                 eval $hasproto ;;
16356         *)      ;;
16357         esac
16358         case "$d_readdir64_r_proto" in
16359         define)
16360         case "$readdir64_r_proto" in
16361         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
16362         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TSR ;;
16363         esac
16364         case "$readdir64_r_proto" in
16365         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
16366         ./protochk "$extern_C $try" $hdrs && readdir64_r_proto=I_TS ;;
16367         esac
16368         case "$readdir64_r_proto" in
16369         ''|0)   d_readdir64_r=undef
16370                 readdir64_r_proto=0
16371                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
16372         * )     case "$readdir64_r_proto" in
16373                 REENTRANT_PROTO*) ;;
16374                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
16375                 esac
16376                 echo "Prototype: $try" ;;
16377         esac
16378         ;;
16379         *)      case "$usethreads" in
16380                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
16381                 esac
16382                 d_readdir64_r=undef
16383                 readdir64_r_proto=0
16384                 ;;
16385         esac
16386         ;;
16387 *)      readdir64_r_proto=0
16388         ;;
16389 esac
16390
16391 : see if readdir_r exists
16392 set readdir_r d_readdir_r
16393 eval $inlibc
16394 case "$d_readdir_r" in
16395 "$define")
16396         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
16397         case "$d_readdir_r_proto:$usethreads" in
16398         ":define")      d_readdir_r_proto=define
16399                 set d_readdir_r_proto readdir_r $hdrs
16400                 eval $hasproto ;;
16401         *)      ;;
16402         esac
16403         case "$d_readdir_r_proto" in
16404         define)
16405         case "$readdir_r_proto" in
16406         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
16407         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TSR ;;
16408         esac
16409         case "$readdir_r_proto" in
16410         ''|0) try='int readdir_r(DIR*, struct dirent*);'
16411         ./protochk "$extern_C $try" $hdrs && readdir_r_proto=I_TS ;;
16412         esac
16413         case "$readdir_r_proto" in
16414         ''|0)   d_readdir_r=undef
16415                 readdir_r_proto=0
16416                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
16417         * )     case "$readdir_r_proto" in
16418                 REENTRANT_PROTO*) ;;
16419                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
16420                 esac
16421                 echo "Prototype: $try" ;;
16422         esac
16423         ;;
16424         *)      case "$usethreads" in
16425                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
16426                 esac
16427                 d_readdir_r=undef
16428                 readdir_r_proto=0
16429                 ;;
16430         esac
16431         ;;
16432 *)      readdir_r_proto=0
16433         ;;
16434 esac
16435
16436 : see if readv exists
16437 set readv d_readv
16438 eval $inlibc
16439
16440 : see if recvmsg exists
16441 set recvmsg d_recvmsg
16442 eval $inlibc
16443
16444 : see if rename exists
16445 set rename d_rename
16446 eval $inlibc
16447
16448 : see if rmdir exists
16449 set rmdir d_rmdir
16450 eval $inlibc
16451
16452 : see if memory.h is available.
16453 val=''
16454 set memory.h val
16455 eval $inhdr
16456
16457 : See if it conflicts with string.h
16458 case "$val" in
16459 $define)
16460         case "$strings" in
16461         '') ;;
16462         *)
16463                 $cppstdin $cppflags $cppminus < $strings > mem.h
16464                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
16465                         echo " "
16466                         echo "We won't be including <memory.h>."
16467                         val="$undef"
16468                 fi
16469                 $rm -f mem.h
16470                 ;;
16471         esac
16472 esac
16473 set i_memory
16474 eval $setvar
16475
16476 : can bcopy handle overlapping blocks?
16477 echo " "
16478 val="$undef"
16479 case "$d_memmove" in
16480 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
16481 *)      case "$d_bcopy" in
16482         "$define")
16483                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
16484                 $cat >try.c <<EOCP
16485 #$i_memory I_MEMORY
16486 #$i_stdlib I_STDLIB
16487 #$i_string I_STRING
16488 #$i_unistd I_UNISTD
16489 EOCP
16490         $cat >>try.c <<'EOCP'
16491 #include <stdio.h>
16492 #ifdef I_MEMORY
16493 #  include <memory.h>
16494 #endif
16495 #ifdef I_STDLIB
16496 #  include <stdlib.h>
16497 #endif
16498 #ifdef I_STRING
16499 #  include <string.h>
16500 #else
16501 #  include <strings.h>
16502 #endif
16503 #ifdef I_UNISTD
16504 #  include <unistd.h>  /* Needed for NetBSD */
16505 #endif
16506 int main()
16507 {
16508 char buf[128], abc[128];
16509 char *b;
16510 int len;
16511 int off;
16512 int align;
16513
16514 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16515    try to store the string in read-only memory. */
16516 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
16517
16518 for (align = 7; align >= 0; align--) {
16519         for (len = 36; len; len--) {
16520                 b = buf+align;
16521                 bcopy(abc, b, len);
16522                 for (off = 1; off <= len; off++) {
16523                         bcopy(b, b+off, len);
16524                         bcopy(b+off, b, len);
16525                         if (bcmp(b, abc, len))
16526                                 exit(1);
16527                 }
16528         }
16529 }
16530 exit(0);
16531 }
16532 EOCP
16533                 set try
16534                 if eval $compile_ok; then
16535                         if $run ./try 2>/dev/null; then
16536                                 echo "Yes, it can."
16537                                 val="$define"
16538                         else
16539                                 echo "It can't, sorry."
16540                         fi
16541                 else
16542                         echo "(I can't compile the test program, so we'll assume not...)"
16543                 fi
16544                 ;;
16545         esac
16546         $rm_try
16547         ;;
16548 esac
16549 set d_safebcpy
16550 eval $setvar
16551
16552 : can memcpy handle overlapping blocks?
16553 echo " "
16554 val="$undef"
16555 case "$d_memmove" in
16556 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
16557 *)      case "$d_memcpy" in
16558         "$define")
16559                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16560                 $cat >try.c <<EOCP
16561 #$i_memory I_MEMORY
16562 #$i_stdlib I_STDLIB
16563 #$i_string I_STRING
16564 #$i_unistd I_UNISTD
16565 EOCP
16566         $cat >>try.c <<'EOCP'
16567 #include <stdio.h>
16568 #ifdef I_MEMORY
16569 #  include <memory.h>
16570 #endif
16571 #ifdef I_STDLIB
16572 #  include <stdlib.h>
16573 #endif
16574 #ifdef I_STRING
16575 #  include <string.h>
16576 #else
16577 #  include <strings.h>
16578 #endif
16579 #ifdef I_UNISTD
16580 #  include <unistd.h>  /* Needed for NetBSD */
16581 #endif
16582 int main()
16583 {
16584 char buf[128], abc[128];
16585 char *b;
16586 int len;
16587 int off;
16588 int align;
16589
16590 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16591    try to store the string in read-only memory. */
16592 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16593
16594 for (align = 7; align >= 0; align--) {
16595         for (len = 36; len; len--) {
16596                 b = buf+align;
16597                 memcpy(b, abc, len);
16598                 for (off = 1; off <= len; off++) {
16599                         memcpy(b+off, b, len);
16600                         memcpy(b, b+off, len);
16601                         if (memcmp(b, abc, len))
16602                                 exit(1);
16603                 }
16604         }
16605 }
16606 exit(0);
16607 }
16608 EOCP
16609                 set try
16610                 if eval $compile_ok; then
16611                         if $run ./try 2>/dev/null; then
16612                                 echo "Yes, it can."
16613                                 val="$define"
16614                         else
16615                                 echo "It can't, sorry."
16616                         fi
16617                 else
16618                         echo "(I can't compile the test program, so we'll assume not...)"
16619                 fi
16620                 ;;
16621         esac
16622         $rm_try
16623         ;;
16624 esac
16625 set d_safemcpy
16626 eval $setvar
16627
16628 : can memcmp be trusted to compare relative magnitude?
16629 val="$undef"
16630 case "$d_memcmp" in
16631 "$define")
16632         echo " "
16633         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16634         $cat >try.c <<EOCP
16635 #$i_memory I_MEMORY
16636 #$i_stdlib I_STDLIB
16637 #$i_string I_STRING
16638 #$i_unistd I_UNISTD
16639 EOCP
16640         $cat >>try.c <<'EOCP'
16641 #include <stdio.h>
16642 #ifdef I_MEMORY
16643 #  include <memory.h>
16644 #endif
16645 #ifdef I_STDLIB
16646 #  include <stdlib.h>
16647 #endif
16648 #ifdef I_STRING
16649 #  include <string.h>
16650 #else
16651 #  include <strings.h>
16652 #endif
16653 #ifdef I_UNISTD
16654 #  include <unistd.h>  /* Needed for NetBSD */
16655 #endif
16656 int main()
16657 {
16658 char a = -1;
16659 char b = 0;
16660 if ((a < b) && memcmp(&a, &b, 1) < 0)
16661         exit(1);
16662 exit(0);
16663 }
16664 EOCP
16665         set try
16666         if eval $compile_ok; then
16667                 if $run ./try 2>/dev/null; then
16668                         echo "Yes, it can."
16669                         val="$define"
16670                 else
16671                         echo "No, it can't (it uses signed chars)."
16672                 fi
16673         else
16674                 echo "(I can't compile the test program, so we'll assume not...)"
16675         fi
16676         ;;
16677 esac
16678 $rm_try
16679 set d_sanemcmp
16680 eval $setvar
16681
16682 : see if prototype for sbrk is available
16683 echo " "
16684 set d_sbrkproto sbrk $i_unistd unistd.h
16685 eval $hasproto
16686
16687 : see if select exists
16688 set select d_select
16689 eval $inlibc
16690
16691 : see if semctl exists
16692 set semctl d_semctl
16693 eval $inlibc
16694
16695 : see if semget exists
16696 set semget d_semget
16697 eval $inlibc
16698
16699 : see if semop exists
16700 set semop d_semop
16701 eval $inlibc
16702
16703 : see how much of the 'sem*(2)' library is present.
16704 h_sem=true
16705 echo " "
16706 case "$d_semctl$d_semget$d_semop" in
16707 *"$undef"*) h_sem=false;;
16708 esac
16709 case "$osname" in
16710 freebsd)
16711     case "`ipcs 2>&1`" in
16712     "SVID messages"*"not configured"*)
16713         echo "Your $osname does not have the sem*(2) configured." >&4
16714         h_sem=false
16715         val="$undef"
16716         set semctl d_semctl
16717         eval $setvar
16718         set semget d_semget
16719         eval $setvar
16720         set semop d_semop
16721         eval $setvar
16722         ;;
16723     esac
16724     ;;
16725 esac
16726 : we could also check for sys/ipc.h ...
16727 if $h_sem && $test `./findhdr sys/sem.h`; then
16728         echo "You have the full sem*(2) library." >&4
16729         val="$define"
16730 else
16731         echo "You don't have the full sem*(2) library." >&4
16732         val="$undef"
16733 fi
16734 set d_sem
16735 eval $setvar
16736
16737 : see whether sys/sem.h defines union semun
16738 echo " "
16739 $cat > try.c <<'END'
16740 #include <sys/types.h>
16741 #include <sys/ipc.h>
16742 #include <sys/sem.h>
16743 int main () { union semun semun; semun.buf = 0; }
16744 END
16745 set try
16746 if eval $compile; then
16747     echo "You have union semun in <sys/sem.h>." >&4
16748     val="$define"
16749 else
16750     echo "You do not have union semun in <sys/sem.h>." >&4
16751     val="$undef"
16752 fi
16753 $rm_try
16754 set d_union_semun
16755 eval $setvar
16756
16757 : see how to do semctl IPC_STAT
16758 case "$d_sem" in
16759 $define)
16760     echo " "
16761     $cat > tryh.h <<END
16762 #ifndef S_IRUSR
16763 #   ifdef S_IREAD
16764 #       define S_IRUSR S_IREAD
16765 #       define S_IWUSR S_IWRITE
16766 #       define S_IXUSR S_IEXEC
16767 #   else
16768 #       define S_IRUSR 0400
16769 #       define S_IWUSR 0200
16770 #       define S_IXUSR 0100
16771 #   endif
16772 #   define S_IRGRP (S_IRUSR>>3)
16773 #   define S_IWGRP (S_IWUSR>>3)
16774 #   define S_IXGRP (S_IXUSR>>3)
16775 #   define S_IROTH (S_IRUSR>>6)
16776 #   define S_IWOTH (S_IWUSR>>6)
16777 #   define S_IXOTH (S_IXUSR>>6)
16778 #endif
16779 #ifndef S_IRWXU
16780 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16781 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16782 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16783 #endif
16784 END
16785     : see whether semctl IPC_STAT can use union semun
16786     case "$d_semctl_semun" in
16787     '')
16788       val="$undef"
16789       $cat > try.c <<END
16790 #include <sys/types.h>
16791 #include <sys/ipc.h>
16792 #include <sys/sem.h>
16793 #include <sys/stat.h>
16794 #include <stdio.h>
16795 #include <errno.h>
16796 #include "tryh.h"
16797 #ifndef errno
16798 extern int errno;
16799 #endif
16800 #$d_union_semun HAS_UNION_SEMUN
16801 int main() {
16802     union semun
16803 #ifndef HAS_UNION_SEMUN
16804     {
16805         int val;
16806         struct semid_ds *buf;
16807         unsigned short *array;
16808     }
16809 #endif
16810     arg;
16811     int sem, st;
16812
16813 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16814     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16815     if (sem > -1) {
16816         struct semid_ds argbuf;
16817         arg.buf = &argbuf;
16818 #       ifdef IPC_STAT
16819         st = semctl(sem, 0, IPC_STAT, arg);
16820         if (st == 0)
16821             printf("semun\n");
16822         else
16823 #       endif /* IPC_STAT */
16824             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16825 #       ifdef IPC_RMID
16826         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16827 #       endif /* IPC_RMID */
16828             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16829     } else
16830 #endif /* IPC_PRIVATE && ... */
16831         printf("semget failed: errno = %d\n", errno);
16832   return 0;
16833 }
16834 END
16835       set try
16836       if eval $compile; then
16837           xxx=`$run ./try`
16838           case "$xxx" in
16839           semun) val="$define" ;;
16840           esac
16841       fi
16842       $rm_try
16843       set d_semctl_semun
16844       eval $setvar
16845       ;;
16846     esac
16847     case "$d_semctl_semun" in
16848     $define)
16849         echo "You can use union semun for semctl IPC_STAT." >&4
16850         also='also'
16851         ;;
16852     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16853         also=''
16854         ;;
16855     esac
16856
16857     : see whether semctl IPC_STAT can use struct semid_ds pointer
16858     case "$d_semctl_semid_ds" in
16859     '')
16860       val="$undef"
16861       $cat > try.c <<'END'
16862 #include <sys/types.h>
16863 #include <sys/ipc.h>
16864 #include <sys/sem.h>
16865 #include <sys/stat.h>
16866 #include "tryh.h"
16867 #include <stdio.h>
16868 #include <errno.h>
16869 #ifndef errno
16870 extern int errno;
16871 #endif
16872 int main() {
16873     struct semid_ds arg;
16874     int sem, st;
16875
16876 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16877     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16878     if (sem > -1) {
16879 #       ifdef IPC_STAT
16880         st = semctl(sem, 0, IPC_STAT, &arg);
16881         if (st == 0)
16882             printf("semid_ds\n");
16883         else
16884 #       endif /* IPC_STAT */
16885             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16886 #       ifdef IPC_RMID
16887         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16888 #       endif /* IPC_RMID */
16889             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16890     } else
16891 #endif /* IPC_PRIVATE && ... */
16892         printf("semget failed: errno = %d\n", errno);
16893
16894     return 0;
16895 }
16896 END
16897       set try
16898       if eval $compile; then
16899           xxx=`$run ./try`
16900           case "$xxx" in
16901           semid_ds) val="$define" ;;
16902           esac
16903       fi
16904       $rm_try
16905       set d_semctl_semid_ds
16906       eval $setvar
16907       ;;
16908     esac
16909     case "$d_semctl_semid_ds" in
16910     $define)
16911         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16912         ;;
16913     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16914         ;;
16915     esac
16916     ;;
16917 *)  val="$undef"
16918
16919     # We do not have the full sem*(2) library, so assume we can not
16920     # use either.
16921
16922     set d_semctl_semun
16923     eval $setvar
16924
16925     set d_semctl_semid_ds
16926     eval $setvar
16927     ;;
16928 esac
16929 $rm_try tryh.h
16930
16931 : see if sendmsg exists
16932 set sendmsg d_sendmsg
16933 eval $inlibc
16934
16935 : see if setegid exists
16936 set setegid d_setegid
16937 eval $inlibc
16938
16939 : see if seteuid exists
16940 set seteuid d_seteuid
16941 eval $inlibc
16942
16943 : see if setgrent exists
16944 set setgrent d_setgrent
16945 eval $inlibc
16946
16947 : see if setgrent_r exists
16948 set setgrent_r d_setgrent_r
16949 eval $inlibc
16950 case "$d_setgrent_r" in
16951 "$define")
16952         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16953         case "$d_setgrent_r_proto:$usethreads" in
16954         ":define")      d_setgrent_r_proto=define
16955                 set d_setgrent_r_proto setgrent_r $hdrs
16956                 eval $hasproto ;;
16957         *)      ;;
16958         esac
16959         case "$d_setgrent_r_proto" in
16960         define)
16961         case "$setgrent_r_proto" in
16962         ''|0) try='int setgrent_r(FILE**);'
16963         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=I_H ;;
16964         esac
16965         case "$setgrent_r_proto" in
16966         ''|0) try='void setgrent_r(FILE**);'
16967         ./protochk "$extern_C $try" $hdrs && setgrent_r_proto=V_H ;;
16968         esac
16969         case "$setgrent_r_proto" in
16970         ''|0)   d_setgrent_r=undef
16971                 setgrent_r_proto=0
16972                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16973         * )     case "$setgrent_r_proto" in
16974                 REENTRANT_PROTO*) ;;
16975                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16976                 esac
16977                 echo "Prototype: $try" ;;
16978         esac
16979         ;;
16980         *)      case "$usethreads" in
16981                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16982                 esac
16983                 d_setgrent_r=undef
16984                 setgrent_r_proto=0
16985                 ;;
16986         esac
16987         ;;
16988 *)      setgrent_r_proto=0
16989         ;;
16990 esac
16991
16992 : see if sethostent exists
16993 set sethostent d_sethent
16994 eval $inlibc
16995
16996 : see if sethostent_r exists
16997 set sethostent_r d_sethostent_r
16998 eval $inlibc
16999 case "$d_sethostent_r" in
17000 "$define")
17001         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17002         case "$d_sethostent_r_proto:$usethreads" in
17003         ":define")      d_sethostent_r_proto=define
17004                 set d_sethostent_r_proto sethostent_r $hdrs
17005                 eval $hasproto ;;
17006         *)      ;;
17007         esac
17008         case "$d_sethostent_r_proto" in
17009         define)
17010         case "$sethostent_r_proto" in
17011         ''|0) try='int sethostent_r(int, struct hostent_data*);'
17012         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=I_ID ;;
17013         esac
17014         case "$sethostent_r_proto" in
17015         ''|0) try='void sethostent_r(int, struct hostent_data*);'
17016         ./protochk "$extern_C $try" $hdrs && sethostent_r_proto=V_ID ;;
17017         esac
17018         case "$sethostent_r_proto" in
17019         ''|0)   d_sethostent_r=undef
17020                 sethostent_r_proto=0
17021                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
17022         * )     case "$sethostent_r_proto" in
17023                 REENTRANT_PROTO*) ;;
17024                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
17025                 esac
17026                 echo "Prototype: $try" ;;
17027         esac
17028         ;;
17029         *)      case "$usethreads" in
17030                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
17031                 esac
17032                 d_sethostent_r=undef
17033                 sethostent_r_proto=0
17034                 ;;
17035         esac
17036         ;;
17037 *)      sethostent_r_proto=0
17038         ;;
17039 esac
17040
17041 : see if setitimer exists
17042 set setitimer d_setitimer
17043 eval $inlibc
17044
17045 : see if setlinebuf exists
17046 set setlinebuf d_setlinebuf
17047 eval $inlibc
17048
17049 : see if setlocale exists
17050 set setlocale d_setlocale
17051 eval $inlibc
17052
17053 : see if locale.h is available
17054 set locale.h i_locale
17055 eval $inhdr
17056
17057 : see if setlocale_r exists
17058 set setlocale_r d_setlocale_r
17059 eval $inlibc
17060 case "$d_setlocale_r" in
17061 "$define")
17062         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
17063         case "$d_setlocale_r_proto:$usethreads" in
17064         ":define")      d_setlocale_r_proto=define
17065                 set d_setlocale_r_proto setlocale_r $hdrs
17066                 eval $hasproto ;;
17067         *)      ;;
17068         esac
17069         case "$d_setlocale_r_proto" in
17070         define)
17071         case "$setlocale_r_proto" in
17072         ''|0) try='int setlocale_r(int, const char*, char*, int);'
17073         ./protochk "$extern_C $try" $hdrs && setlocale_r_proto=I_ICBI ;;
17074         esac
17075         case "$setlocale_r_proto" in
17076         ''|0)   d_setlocale_r=undef
17077                 setlocale_r_proto=0
17078                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
17079         * )     case "$setlocale_r_proto" in
17080                 REENTRANT_PROTO*) ;;
17081                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
17082                 esac
17083                 echo "Prototype: $try" ;;
17084         esac
17085         ;;
17086         *)      case "$usethreads" in
17087                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
17088                 esac
17089                 d_setlocale_r=undef
17090                 setlocale_r_proto=0
17091                 ;;
17092         esac
17093         ;;
17094 *)      setlocale_r_proto=0
17095         ;;
17096 esac
17097
17098 : see if setnetent exists
17099 set setnetent d_setnent
17100 eval $inlibc
17101
17102 : see if setnetent_r exists
17103 set setnetent_r d_setnetent_r
17104 eval $inlibc
17105 case "$d_setnetent_r" in
17106 "$define")
17107         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17108         case "$d_setnetent_r_proto:$usethreads" in
17109         ":define")      d_setnetent_r_proto=define
17110                 set d_setnetent_r_proto setnetent_r $hdrs
17111                 eval $hasproto ;;
17112         *)      ;;
17113         esac
17114         case "$d_setnetent_r_proto" in
17115         define)
17116         case "$setnetent_r_proto" in
17117         ''|0) try='int setnetent_r(int, struct netent_data*);'
17118         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=I_ID ;;
17119         esac
17120         case "$setnetent_r_proto" in
17121         ''|0) try='void setnetent_r(int, struct netent_data*);'
17122         ./protochk "$extern_C $try" $hdrs && setnetent_r_proto=V_ID ;;
17123         esac
17124         case "$setnetent_r_proto" in
17125         ''|0)   d_setnetent_r=undef
17126                 setnetent_r_proto=0
17127                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
17128         * )     case "$setnetent_r_proto" in
17129                 REENTRANT_PROTO*) ;;
17130                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
17131                 esac
17132                 echo "Prototype: $try" ;;
17133         esac
17134         ;;
17135         *)      case "$usethreads" in
17136                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
17137                 esac
17138                 d_setnetent_r=undef
17139                 setnetent_r_proto=0
17140                 ;;
17141         esac
17142         ;;
17143 *)      setnetent_r_proto=0
17144         ;;
17145 esac
17146
17147 : see if setprotoent exists
17148 set setprotoent d_setpent
17149 eval $inlibc
17150
17151 : see if setpgid exists
17152 set setpgid d_setpgid
17153 eval $inlibc
17154
17155 : see if setpgrp2 exists
17156 set setpgrp2 d_setpgrp2
17157 eval $inlibc
17158
17159 : see if setpriority exists
17160 set setpriority d_setprior
17161 eval $inlibc
17162
17163 : see if setproctitle exists
17164 set setproctitle d_setproctitle
17165 eval $inlibc
17166
17167 : see if setprotoent_r exists
17168 set setprotoent_r d_setprotoent_r
17169 eval $inlibc
17170 case "$d_setprotoent_r" in
17171 "$define")
17172         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17173         case "$d_setprotoent_r_proto:$usethreads" in
17174         ":define")      d_setprotoent_r_proto=define
17175                 set d_setprotoent_r_proto setprotoent_r $hdrs
17176                 eval $hasproto ;;
17177         *)      ;;
17178         esac
17179         case "$d_setprotoent_r_proto" in
17180         define)
17181         case "$setprotoent_r_proto" in
17182         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
17183         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=I_ID ;;
17184         esac
17185         case "$setprotoent_r_proto" in
17186         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
17187         ./protochk "$extern_C $try" $hdrs && setprotoent_r_proto=V_ID ;;
17188         esac
17189         case "$setprotoent_r_proto" in
17190         ''|0)   d_setprotoent_r=undef
17191                 setprotoent_r_proto=0
17192                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
17193         * )     case "$setprotoent_r_proto" in
17194                 REENTRANT_PROTO*) ;;
17195                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
17196                 esac
17197                 echo "Prototype: $try" ;;
17198         esac
17199         ;;
17200         *)      case "$usethreads" in
17201                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
17202                 esac
17203                 d_setprotoent_r=undef
17204                 setprotoent_r_proto=0
17205                 ;;
17206         esac
17207         ;;
17208 *)      setprotoent_r_proto=0
17209         ;;
17210 esac
17211
17212 : see if setpwent exists
17213 set setpwent d_setpwent
17214 eval $inlibc
17215
17216 : see if setpwent_r exists
17217 set setpwent_r d_setpwent_r
17218 eval $inlibc
17219 case "$d_setpwent_r" in
17220 "$define")
17221         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
17222         case "$d_setpwent_r_proto:$usethreads" in
17223         ":define")      d_setpwent_r_proto=define
17224                 set d_setpwent_r_proto setpwent_r $hdrs
17225                 eval $hasproto ;;
17226         *)      ;;
17227         esac
17228         case "$d_setpwent_r_proto" in
17229         define)
17230         case "$setpwent_r_proto" in
17231         ''|0) try='int setpwent_r(FILE**);'
17232         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=I_H ;;
17233         esac
17234         case "$setpwent_r_proto" in
17235         ''|0) try='void setpwent_r(FILE**);'
17236         ./protochk "$extern_C $try" $hdrs && setpwent_r_proto=V_H ;;
17237         esac
17238         case "$setpwent_r_proto" in
17239         ''|0)   d_setpwent_r=undef
17240                 setpwent_r_proto=0
17241                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
17242         * )     case "$setpwent_r_proto" in
17243                 REENTRANT_PROTO*) ;;
17244                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
17245                 esac
17246                 echo "Prototype: $try" ;;
17247         esac
17248         ;;
17249         *)      case "$usethreads" in
17250                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
17251                 esac
17252                 d_setpwent_r=undef
17253                 setpwent_r_proto=0
17254                 ;;
17255         esac
17256         ;;
17257 *)      setpwent_r_proto=0
17258         ;;
17259 esac
17260
17261 : see if setregid exists
17262 set setregid d_setregid
17263 eval $inlibc
17264 set setresgid d_setresgid
17265 eval $inlibc
17266
17267 : see if setreuid exists
17268 set setreuid d_setreuid
17269 eval $inlibc
17270 set setresuid d_setresuid
17271 eval $inlibc
17272
17273 : see if setrgid exists
17274 set setrgid d_setrgid
17275 eval $inlibc
17276
17277 : see if setruid exists
17278 set setruid d_setruid
17279 eval $inlibc
17280
17281 : see if setservent exists
17282 set setservent d_setsent
17283 eval $inlibc
17284
17285 : see if setservent_r exists
17286 set setservent_r d_setservent_r
17287 eval $inlibc
17288 case "$d_setservent_r" in
17289 "$define")
17290         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
17291         case "$d_setservent_r_proto:$usethreads" in
17292         ":define")      d_setservent_r_proto=define
17293                 set d_setservent_r_proto setservent_r $hdrs
17294                 eval $hasproto ;;
17295         *)      ;;
17296         esac
17297         case "$d_setservent_r_proto" in
17298         define)
17299         case "$setservent_r_proto" in
17300         ''|0) try='int setservent_r(int, struct servent_data*);'
17301         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=I_ID ;;
17302         esac
17303         case "$setservent_r_proto" in
17304         ''|0) try='void setservent_r(int, struct servent_data*);'
17305         ./protochk "$extern_C $try" $hdrs && setservent_r_proto=V_ID ;;
17306         esac
17307         case "$setservent_r_proto" in
17308         ''|0)   d_setservent_r=undef
17309                 setservent_r_proto=0
17310                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
17311         * )     case "$setservent_r_proto" in
17312                 REENTRANT_PROTO*) ;;
17313                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
17314                 esac
17315                 echo "Prototype: $try" ;;
17316         esac
17317         ;;
17318         *)      case "$usethreads" in
17319                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
17320                 esac
17321                 d_setservent_r=undef
17322                 setservent_r_proto=0
17323                 ;;
17324         esac
17325         ;;
17326 *)      setservent_r_proto=0
17327         ;;
17328 esac
17329
17330 : see if setsid exists
17331 set setsid d_setsid
17332 eval $inlibc
17333
17334 : see if setvbuf exists
17335 set setvbuf d_setvbuf
17336 eval $inlibc
17337
17338 : see if sfio.h is available
17339 set sfio.h i_sfio
17340 eval $inhdr
17341
17342 : see if sfio library is available
17343 case "$i_sfio" in
17344 $define)
17345         val=''
17346         set sfreserve val
17347         eval $inlibc
17348         ;;
17349 *)
17350         val="$undef"
17351         ;;
17352 esac
17353 : Ok, but do we want to use it.
17354 case "$val" in
17355 $define)
17356         case "$usesfio" in
17357         true|$define|[yY]*) dflt='y';;
17358         *) dflt='n';;
17359         esac
17360         echo "$package can use the sfio library, but it is experimental."
17361         rp="You seem to have sfio available, do you want to try using it?"
17362         . ./myread
17363         case "$ans" in
17364         y|Y)    echo "Ok, turning on sfio then."
17365                 val="$define"
17366                 ;;
17367         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
17368                 val="$undef"
17369                 ;;
17370         esac
17371         ;;
17372 *)      case "$usesfio" in
17373         true|$define|[yY]*)
17374                 echo "Sorry, cannot find sfio on this machine." >&4
17375                 echo "Ignoring your setting of usesfio=$usesfio." >&4
17376                 val="$undef"
17377                 ;;
17378         esac
17379         ;;
17380 esac
17381 set d_sfio
17382 eval $setvar
17383 case "$d_sfio" in
17384 $define) usesfio='true';;
17385 *) usesfio='false';;
17386 esac
17387 case "$d_sfio" in
17388 $define) ;;
17389 *)      : Remove sfio from list of libraries to use
17390         case "$libs" in
17391         *-lsfio*)
17392                 echo "Removing unneeded -lsfio from library list" >&4
17393                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
17394                 shift
17395                 libs="$*"
17396                 echo "libs = $libs" >&4
17397                 ;;
17398         esac
17399 ;;
17400 esac
17401
17402
17403 : see if shmctl exists
17404 set shmctl d_shmctl
17405 eval $inlibc
17406
17407 : see if shmget exists
17408 set shmget d_shmget
17409 eval $inlibc
17410
17411 : see if shmat exists
17412 set shmat d_shmat
17413 eval $inlibc
17414 : see what shmat returns
17415 case "$d_shmat" in
17416 "$define")
17417         $cat >shmat.c <<'END'
17418 #include <sys/shm.h>
17419 void *shmat();
17420 END
17421         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
17422                 shmattype='void *'
17423         else
17424                 shmattype='char *'
17425         fi
17426         echo "and it returns ($shmattype)." >&4
17427         : see if a prototype for shmat is available
17428         xxx=`./findhdr sys/shm.h`
17429         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
17430         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
17431                 val="$define"
17432         else
17433                 val="$undef"
17434         fi
17435         $rm -f shmat.[co]
17436         ;;
17437 *)
17438         val="$undef"
17439         ;;
17440 esac
17441 set d_shmatprototype
17442 eval $setvar
17443
17444 : see if shmdt exists
17445 set shmdt d_shmdt
17446 eval $inlibc
17447
17448 : see how much of the 'shm*(2)' library is present.
17449 h_shm=true
17450 echo " "
17451 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
17452 *"$undef"*) h_shm=false;;
17453 esac
17454 case "$osname" in
17455 freebsd)
17456     case "`ipcs 2>&1`" in
17457     "SVID shared memory"*"not configured"*)
17458         echo "Your $osname does not have the shm*(2) configured." >&4
17459         h_shm=false
17460         val="$undef"
17461         set shmctl d_shmctl
17462         evat $setvar
17463         set shmget d_shmget
17464         evat $setvar
17465         set shmat d_shmat
17466         evat $setvar
17467         set shmdt d_shmdt
17468         evat $setvar
17469         ;;
17470     esac
17471     ;;
17472 esac
17473 : we could also check for sys/ipc.h ...
17474 if $h_shm && $test `./findhdr sys/shm.h`; then
17475         echo "You have the full shm*(2) library." >&4
17476         val="$define"
17477 else
17478         echo "You don't have the full shm*(2) library." >&4
17479         val="$undef"
17480 fi
17481 set d_shm
17482 eval $setvar
17483
17484 : see if we have sigaction
17485 echo " "
17486 if set sigaction val -f d_sigaction; eval $csym; $val; then
17487         echo 'sigaction() found.' >&4
17488         $cat > try.c <<EOP
17489 #include <stdio.h>
17490 #include <sys/types.h>
17491 #include <signal.h>
17492 #$i_stdlib I_STDLIB
17493 #ifdef I_STDLIB
17494 #include <stdlib.h>
17495 #endif
17496 int main()
17497 {
17498     struct sigaction act, oact;
17499     act.sa_flags = 0;
17500     oact.sa_handler = 0;
17501     /* so that act and oact are used */
17502     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
17503 }
17504 EOP
17505         set try
17506         if eval $compile_ok; then
17507                 val="$define"
17508         else
17509                 echo "But you don't seem to have a useable struct sigaction." >&4
17510                 val="$undef"
17511         fi
17512 else
17513         echo 'sigaction NOT found.' >&4
17514         val="$undef"
17515 fi
17516 set d_sigaction; eval $setvar
17517 $rm_try
17518
17519 : see if this is a sunmath.h system
17520 set sunmath.h i_sunmath
17521 eval $inhdr
17522
17523 : see if signbit exists
17524 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
17525 $cat >try.c <<EOCP
17526 #$i_math I_MATH
17527 #$i_sunmath I_SUNMATH
17528 #ifdef I_MATH
17529 #  include <math.h>
17530 #endif
17531 #ifdef I_SUNMATH  /* Solaris special math library */
17532 #  include <sunmath.h>
17533 #endif
17534 #define NV $nvtype
17535 int main(int argc, char **argv)
17536 {
17537     NV x = 0.0;
17538     NV y = -0.0;
17539     if ((signbit(x) == 0) && (signbit(y) != 0))
17540         return 0;
17541     else
17542         return 1;
17543 }
17544 EOCP
17545 val="$undef"
17546 set try
17547 if eval $compile; then
17548     if $run ./try; then
17549         $echo "Yes." >&4
17550         val="$define"
17551     else
17552         $echo "Signbit seems to be available, but doesn't work as I expected."
17553         $echo "I won't use it." >&4
17554         val="$undef"
17555     fi
17556 else
17557     $echo "Nope." >&4
17558     dflt="$undef"
17559 fi
17560 set d_signbit
17561 eval $setvar
17562 $rm_try
17563
17564 : see if sigprocmask exists
17565 set sigprocmask d_sigprocmask
17566 eval $inlibc
17567
17568 : see if sigsetjmp exists
17569 echo " "
17570 case "$d_sigsetjmp" in
17571 '')
17572         $cat >try.c <<EOP
17573 #include <setjmp.h>
17574 #$i_stdlib I_STDLIB
17575 #ifdef I_STDLIB
17576 #include <stdlib.h>
17577 #endif
17578 sigjmp_buf env;
17579 int set = 1;
17580 int main()
17581 {
17582         if (sigsetjmp(env,1))
17583                 exit(set);
17584         set = 0;
17585         siglongjmp(env, 1);
17586         exit(1);
17587 }
17588 EOP
17589         set try
17590         if eval $compile; then
17591                 if $run ./try >/dev/null 2>&1; then
17592                         echo "POSIX sigsetjmp found." >&4
17593                         val="$define"
17594                 else
17595                         $cat >&4 <<EOM
17596 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17597 I'll ignore them.
17598 EOM
17599                         val="$undef"
17600                 fi
17601         else
17602                 echo "sigsetjmp not found." >&4
17603                 val="$undef"
17604         fi
17605         ;;
17606 *) val="$d_sigsetjmp"
17607         case "$d_sigsetjmp" in
17608         $define) echo "POSIX sigsetjmp found." >&4;;
17609         $undef) echo "sigsetjmp not found." >&4;;
17610         esac
17611         ;;
17612 esac
17613 set d_sigsetjmp
17614 eval $setvar
17615 $rm_try
17616
17617 : see if snprintf exists
17618 set snprintf d_snprintf
17619 eval $inlibc
17620
17621 : see if vsnprintf exists
17622 set vsnprintf d_vsnprintf
17623 eval $inlibc
17624
17625 case "$d_snprintf-$d_vsnprintf" in
17626 "$define-$define")
17627     $cat <<EOM
17628 Checking whether your snprintf() and vsnprintf() work okay...
17629 EOM
17630     $cat >try.c <<'EOCP'
17631 /* v?snprintf testing logic courtesy of Russ Allbery.
17632  * According to C99:
17633  * - if the buffer is too short it still must be \0-terminated
17634  * - if the buffer is too short the potentially required length
17635  *   must be returned and not -1
17636  * - if the buffer is NULL the potentially required length
17637  *   must be returned and not -1 or core dump
17638  */
17639 #include <stdio.h>
17640 #include <stdarg.h>
17641
17642 char buf[2];
17643
17644 int test (char *format, ...)
17645 {
17646     va_list args;
17647     int count;
17648
17649     va_start (args, format);
17650     count = vsnprintf (buf, sizeof buf, format, args);
17651     va_end (args);
17652     return count;
17653 }
17654
17655 int main ()
17656 {
17657     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17658              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17659 }
17660 EOCP
17661     set try
17662     if eval $compile; then
17663         `$run ./try`
17664         case "$?" in
17665         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17666         *) cat <<EOM >&4
17667 Your snprintf() and snprintf() don't seem to be working okay.
17668 EOM
17669            d_snprintf="$undef"
17670            d_vsnprintf="$undef"
17671            ;;
17672         esac
17673     else
17674         echo "(I can't seem to compile the test program--assuming they don't)"
17675         d_snprintf="$undef"
17676         d_vsnprintf="$undef"
17677     fi
17678     $rm_try
17679     ;;
17680 esac
17681
17682 : see if sockatmark exists
17683 set sockatmark d_sockatmark
17684 eval $inlibc
17685
17686 : see if prototype for sockatmark is available
17687 echo " "
17688 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17689 eval $hasproto
17690
17691 : see if socks5_init exists
17692 set socks5_init d_socks5_init
17693 eval $inlibc
17694
17695 : see if sprintf returns the length of the string in the buffer as per ANSI
17696 $echo "Checking whether sprintf returns the length of the string..." >&4
17697 $cat <<EOP >try.c
17698 #include <stdio.h>
17699 #$i_stdlib I_STDLIB
17700 #ifdef I_STDLIB
17701 #include <stdlib.h>
17702 #endif
17703 #$i_string I_STRING
17704 #ifdef I_STRING
17705 #  include <string.h>
17706 #else
17707 #  include <strings.h>
17708 #endif
17709 #$i_math I_MATH
17710 #ifdef I_MATH
17711 #include <math.h>
17712 #endif
17713
17714 char buffer[256];
17715
17716 int check (size_t expect, int test) {
17717   size_t got = strlen(buffer);
17718   if (expect == got)
17719     return 0;
17720
17721   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17722        test, buffer);
17723   exit (test);
17724 }
17725
17726 int main(int argc, char **argv) {
17727   int test = 0;
17728
17729   check(sprintf(buffer, ""), ++test);
17730   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17731   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17732
17733   return 0;
17734 }
17735 EOP
17736 set try
17737
17738 if eval $compile; then
17739     xxx="`$run ./try`"
17740     case "$?" in
17741         0) cat >&4 <<EOM
17742 sprintf returns the length of the string (as ANSI says it should)
17743 EOM
17744         d_sprintf_returns_strlen="$define"
17745         ;;
17746         *) cat >&4 <<EOM
17747 sprintf does not return the length of the string (how old is this system?)
17748 EOM
17749         d_sprintf_returns_strlen="$undef"
17750         ;;
17751     esac
17752 else
17753     echo "(I can't seem to compile the test program--assuming it doesn't)" >&4
17754     d_sprintf_returns_strlen="$undef"
17755 fi
17756 $rm_try
17757
17758 : see if srand48_r exists
17759 set srand48_r d_srand48_r
17760 eval $inlibc
17761 case "$d_srand48_r" in
17762 "$define")
17763         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17764         case "$d_srand48_r_proto:$usethreads" in
17765         ":define")      d_srand48_r_proto=define
17766                 set d_srand48_r_proto srand48_r $hdrs
17767                 eval $hasproto ;;
17768         *)      ;;
17769         esac
17770         case "$d_srand48_r_proto" in
17771         define)
17772         case "$srand48_r_proto" in
17773         ''|0) try='int srand48_r(long, struct drand48_data*);'
17774         ./protochk "$extern_C $try" $hdrs && srand48_r_proto=I_LS ;;
17775         esac
17776         case "$srand48_r_proto" in
17777         ''|0)   d_srand48_r=undef
17778                 srand48_r_proto=0
17779                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17780         * )     case "$srand48_r_proto" in
17781                 REENTRANT_PROTO*) ;;
17782                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17783                 esac
17784                 echo "Prototype: $try" ;;
17785         esac
17786         ;;
17787         *)      case "$usethreads" in
17788                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17789                 esac
17790                 d_srand48_r=undef
17791                 srand48_r_proto=0
17792                 ;;
17793         esac
17794         ;;
17795 *)      srand48_r_proto=0
17796         ;;
17797 esac
17798
17799 : see if srandom_r exists
17800 set srandom_r d_srandom_r
17801 eval $inlibc
17802 case "$d_srandom_r" in
17803 "$define")
17804         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17805         case "$d_srandom_r_proto:$usethreads" in
17806         ":define")      d_srandom_r_proto=define
17807                 set d_srandom_r_proto srandom_r $hdrs
17808                 eval $hasproto ;;
17809         *)      ;;
17810         esac
17811         case "$d_srandom_r_proto" in
17812         define)
17813         case "$srandom_r_proto" in
17814         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17815         ./protochk "$extern_C $try" $hdrs && srandom_r_proto=I_TS ;;
17816         esac
17817         case "$srandom_r_proto" in
17818         ''|0)   d_srandom_r=undef
17819                 srandom_r_proto=0
17820                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17821         * )     case "$srandom_r_proto" in
17822                 REENTRANT_PROTO*) ;;
17823                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17824                 esac
17825                 echo "Prototype: $try" ;;
17826         esac
17827         ;;
17828         *)      case "$usethreads" in
17829                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17830                 esac
17831                 d_srandom_r=undef
17832                 srandom_r_proto=0
17833                 ;;
17834         esac
17835         ;;
17836 *)      srandom_r_proto=0
17837         ;;
17838 esac
17839
17840 : see if prototype for setresgid is available
17841 echo " "
17842 set d_sresgproto setresgid $i_unistd unistd.h
17843 eval $hasproto
17844
17845 : see if prototype for setresuid is available
17846 echo " "
17847 set d_sresuproto setresuid $i_unistd unistd.h
17848 eval $hasproto
17849
17850 : see if sys/stat.h is available
17851 set sys/stat.h i_sysstat
17852 eval $inhdr
17853
17854 : see if stat knows about block sizes
17855 echo " "
17856 echo "Checking to see if your struct stat has st_blocks field..." >&4
17857 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17858 eval $hasfield
17859
17860 : see if this is a sys/vfs.h system
17861 set sys/vfs.h i_sysvfs
17862 eval $inhdr
17863
17864 : see if this is a sys/statfs.h system
17865 set sys/statfs.h i_sysstatfs
17866 eval $inhdr
17867
17868 : Check for statfs_s
17869 echo " "
17870 echo "Checking to see if your system supports struct statfs..." >&4
17871 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
17872 eval $hasstruct
17873 case "$d_statfs_s" in
17874 "$define")      echo "Yes, it does."   ;;
17875 *)              echo "No, it doesn't." ;;
17876 esac
17877
17878
17879 : see if struct statfs knows about f_flags
17880 case "$d_statfs_s" in
17881 define)
17882         echo " "
17883         echo "Checking to see if your struct statfs has f_flags field..." >&4
17884         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
17885         eval $hasfield
17886         ;;
17887 *)      val="$undef"
17888         set d_statfs_f_flags
17889         eval $setvar
17890         ;;
17891 esac
17892 case "$d_statfs_f_flags" in
17893 "$define")      echo "Yes, it does."   ;;
17894 *)              echo "No, it doesn't." ;;
17895 esac
17896
17897 : see what flavor, if any, of static inline is supported
17898 echo " "
17899 echo "Checking to see if your system supports static inline..."
17900 $cat > try.c <<'EOCP'
17901 #include <stdlib.h>
17902 extern int f_via_a(int x);
17903 extern int f_via_b(int x);
17904 int main(int argc, char **argv)
17905 {
17906     int y;
17907
17908     y = f_via_a(0);
17909 #ifdef USE_B
17910     y = f_via_b(0);
17911 #endif
17912     if (y == 42) {
17913         return EXIT_SUCCESS;
17914     }
17915     else {
17916         return EXIT_FAILURE;
17917     }
17918 }
17919 EOCP
17920 $cat > a.c <<'EOCP'
17921 static INLINE int f(int x) {
17922     int y;
17923     y = x + 42;
17924     return y;
17925 }
17926
17927 int f_via_a(int x)
17928 {
17929     return f(x);
17930 }
17931 EOCP
17932 $cat > b.c <<'EOCP'
17933 extern int f(int x);
17934
17935 int f_via_b(int x)
17936 {
17937     return f(x);
17938 }
17939 EOCP
17940
17941 # Respect a hint (or previous) value for perl_static_inline, if there is one.
17942 case "$perl_static_inline" in
17943 '')     # Check the various possibilities, and break out on success.
17944         # For gcc, prefer __inline__, which will still permit 
17945         # cflags.SH to add in -ansi.
17946         case "$gccversion" in
17947                 '') xxx="inline __inline__ __inline _inline";;
17948                 *)  xxx="__inline__ inline __inline _inline";;
17949         esac
17950         for inline in $xxx; do
17951                 set try -DINLINE=$inline a.c
17952                 if eval $compile && $run ./try; then
17953                         # Now make sure there is no external linkage of static
17954                         # functions
17955                         set try -DINLINE=$inline -DUSE_B a.c b.c
17956                         if eval $compile && $run ./try; then
17957                                 $echo "Your compiler supports static $inline, " >&4
17958                                 $echo "but it also creates an external definition," >&4
17959                                 $echo "so I won't use it." >&4
17960                                 val=$undef
17961                         else
17962                                 $echo "Your compiler supports static $inline." >&4
17963                                 val=$define
17964                                 perl_static_inline="static $inline";
17965                                 break;
17966                         fi
17967                 else
17968                         $echo "Your compiler does NOT support static $inline." >&4
17969                         val="$undef"
17970                 fi
17971         done
17972         ;;
17973 *inline*) # Some variant of inline exists.
17974         echo "Keeping your $hint value of $perl_static_inline."
17975         val=$define
17976         ;;
17977 static)  # No inline capabilities
17978         echo "Keeping your $hint value of $perl_static_inline."
17979         val=$undef
17980         ;;
17981 *)  # Unrecognized previous value -- blindly trust the supplied
17982         # value and hope it makes sense.  Use old value for
17983         # d_static_inline, if there is one.
17984         echo "Keeping your $hint value of $perl_static_inline."
17985         case "$d_static_inline" in
17986                 '') val=$define ;;
17987                 *)  val=$d_static_inline ;;
17988         esac
17989         ;;
17990 esac
17991 # Fallback to plain 'static' if nothing worked.
17992 case "$perl_static_inline" in
17993 '')
17994         perl_static_inline="static"
17995         val=$undef
17996         ;;
17997 esac
17998 set d_static_inline
17999 eval $setvar
18000 $rm -f a.[co] b.[co]
18001 $rm_try
18002
18003 : Check stream access
18004 $cat >&4 <<EOM
18005 Checking how to access stdio streams by file descriptor number...
18006 EOM
18007 case "$stdio_stream_array" in
18008 '')     $cat >try.c <<EOCP
18009 #include <stdio.h>
18010 int main() {
18011   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
18012     printf("yes\n");
18013 }
18014 EOCP
18015         for s in _iob __iob __sF
18016         do
18017                 set try -DSTDIO_STREAM_ARRAY=$s
18018                 if eval $compile; then
18019                         case "`$run ./try`" in
18020                         yes)    stdio_stream_array=$s; break ;;
18021                         esac
18022                 fi
18023         done
18024         $rm_try
18025 esac
18026 case "$stdio_stream_array" in
18027 '')     $cat >&4 <<EOM
18028 I can't figure out how to access stdio streams by file descriptor number.
18029 EOM
18030         d_stdio_stream_array="$undef"
18031         ;;
18032 *)      $cat >&4 <<EOM
18033 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
18034 EOM
18035         d_stdio_stream_array="$define"
18036         ;;
18037 esac
18038
18039 : see if strcoll exists
18040 set strcoll d_strcoll
18041 eval $inlibc
18042
18043 : check for structure copying
18044 echo " "
18045 echo "Checking to see if your C compiler can copy structs..." >&4
18046 $cat >try.c <<'EOCP'
18047 int main()
18048 {
18049         struct blurfl {
18050                 int dyick;
18051         } foo, bar;
18052
18053         foo = bar;
18054 }
18055 EOCP
18056 if $cc -c try.c >/dev/null 2>&1 ; then
18057         val="$define"
18058         echo "Yup, it can."
18059 else
18060         val="$undef"
18061         echo "Nope, it can't."
18062 fi
18063 set d_strctcpy
18064 eval $setvar
18065 $rm_try
18066
18067 : see if strerror and/or sys_errlist[] exist
18068 echo " "
18069 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
18070     if set strerror val -f d_strerror; eval $csym; $val; then
18071                 echo 'strerror() found.' >&4
18072                 d_strerror="$define"
18073                 d_strerrm='strerror(e)'
18074                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18075                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
18076                         d_syserrlst="$define"
18077                 else
18078                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
18079                         d_syserrlst="$undef"
18080                 fi
18081     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
18082                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
18083                 echo 'strerror() found in string header.' >&4
18084                 d_strerror="$define"
18085                 d_strerrm='strerror(e)'
18086                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
18087                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
18088                                 d_syserrlst="$define"
18089                 else
18090                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
18091                         d_syserrlst="$undef"
18092                 fi
18093     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
18094                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
18095                 d_strerror="$undef"
18096                 d_syserrlst="$define"
18097                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
18098     else
18099                 echo 'strerror() and sys_errlist[] NOT found.' >&4
18100                 d_strerror="$undef"
18101                 d_syserrlst="$undef"
18102                 d_strerrm='"unknown"'
18103     fi
18104 fi
18105
18106 : see if strerror_r exists
18107 set strerror_r d_strerror_r
18108 eval $inlibc
18109 case "$d_strerror_r" in
18110 "$define")
18111         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
18112         case "$d_strerror_r_proto:$usethreads" in
18113         ":define")      d_strerror_r_proto=define
18114                 set d_strerror_r_proto strerror_r $hdrs
18115                 eval $hasproto ;;
18116         *)      ;;
18117         esac
18118         case "$d_strerror_r_proto" in
18119         define)
18120         case "$strerror_r_proto" in
18121         ''|0) try='int strerror_r(int, char*, size_t);'
18122         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBW ;;
18123         esac
18124         case "$strerror_r_proto" in
18125         ''|0) try='int strerror_r(int, char*, int);'
18126         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=I_IBI ;;
18127         esac
18128         case "$strerror_r_proto" in
18129         ''|0) try='char* strerror_r(int, char*, size_t);'
18130         ./protochk "$extern_C $try" $hdrs && strerror_r_proto=B_IBW ;;
18131         esac
18132         case "$strerror_r_proto" in
18133         ''|0)   d_strerror_r=undef
18134                 strerror_r_proto=0
18135                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
18136         * )     case "$strerror_r_proto" in
18137                 REENTRANT_PROTO*) ;;
18138                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
18139                 esac
18140                 echo "Prototype: $try" ;;
18141         esac
18142         ;;
18143         *)      case "$usethreads" in
18144                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
18145                 esac
18146                 d_strerror_r=undef
18147                 strerror_r_proto=0
18148                 ;;
18149         esac
18150         ;;
18151 *)      strerror_r_proto=0
18152         ;;
18153 esac
18154
18155 : see if strftime exists
18156 set strftime d_strftime
18157 eval $inlibc
18158
18159 : see if strlcat exists
18160 set strlcat d_strlcat
18161 eval $inlibc
18162
18163 : see if strlcpy exists
18164 set strlcpy d_strlcpy
18165 eval $inlibc
18166
18167 : see if strtod exists
18168 set strtod d_strtod
18169 eval $inlibc
18170
18171 : see if strtol exists
18172 set strtol d_strtol
18173 eval $inlibc
18174
18175 : see if strtold exists
18176 set strtold d_strtold
18177 eval $inlibc
18178
18179 : see if strtoll exists
18180 set strtoll d_strtoll
18181 eval $inlibc
18182
18183 case "$d_longlong-$d_strtoll" in
18184 "$define-$define")
18185         $cat <<EOM
18186 Checking whether your strtoll() works okay...
18187 EOM
18188         $cat >try.c <<'EOCP'
18189 #include <errno.h>
18190 #ifdef __hpux
18191 #define strtoll __strtoll
18192 #endif
18193 #ifdef __EMX__
18194 #define strtoll _strtoll
18195 #endif
18196 #include <stdio.h>
18197 extern long long int strtoll(char *s, char **, int);
18198 static int bad = 0;
18199 int check(char *s, long long ell, int een) {
18200         long long gll;
18201         errno = 0;
18202         gll = strtoll(s, 0, 10);
18203         if (!((gll == ell) && (errno == een)))
18204                 bad++;
18205 }
18206 int main() {
18207         check(" 1",                                      1LL, 0);
18208         check(" 0",                                      0LL, 0);
18209         check("-1",                                     -1LL, 0);
18210         check("-9223372036854775808", -9223372036854775808LL, 0);
18211         check("-9223372036854775808", -9223372036854775808LL, 0);
18212         check(" 9223372036854775807",  9223372036854775807LL, 0);
18213         check("-9223372036854775808", -9223372036854775808LL, 0);
18214         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
18215         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
18216         if (!bad)
18217                 printf("ok\n");
18218 }
18219 EOCP
18220         set try
18221         if eval $compile; then
18222                 yyy=`$run ./try`
18223                 case "$yyy" in
18224                 ok) echo "Your strtoll() seems to be working okay." ;;
18225                 *) cat <<EOM >&4
18226 Your strtoll() doesn't seem to be working okay.
18227 EOM
18228                    d_strtoll="$undef"
18229                    ;;
18230                 esac
18231         else
18232                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18233                 d_strtoll="$undef"
18234         fi
18235         ;;
18236 esac
18237
18238 : see if strtoq exists
18239 set strtoq d_strtoq
18240 eval $inlibc
18241
18242 : see if strtoul exists
18243 set strtoul d_strtoul
18244 eval $inlibc
18245
18246 case "$d_strtoul" in
18247 "$define")
18248         $cat <<EOM
18249 Checking whether your strtoul() works okay...
18250 EOM
18251         $cat >try.c <<'EOCP'
18252 #include <errno.h>
18253 #include <stdio.h>
18254 extern unsigned long int strtoul(char *s, char **, int);
18255 static int bad = 0;
18256 void check(char *s, unsigned long eul, int een) {
18257         unsigned long gul;
18258         errno = 0;
18259         gul = strtoul(s, 0, 10);
18260         if (!((gul == eul) && (errno == een)))
18261                 bad++;
18262 }
18263 int main() {
18264         check(" 1", 1L, 0);
18265         check(" 0", 0L, 0);
18266 EOCP
18267         case "$longsize" in
18268         8)
18269             $cat >>try.c <<'EOCP'
18270         check("18446744073709551615", 18446744073709551615UL, 0);
18271         check("18446744073709551616", 18446744073709551615UL, ERANGE);
18272 #if 0 /* strtoul() for /^-/ strings is undefined. */
18273         check("-1", 18446744073709551615UL, 0);
18274         check("-18446744073709551614", 2, 0);
18275         check("-18446744073709551615", 1, 0);
18276         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
18277         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
18278 #endif
18279 EOCP
18280                 ;;
18281         4)
18282                     $cat >>try.c <<'EOCP'
18283         check("4294967295", 4294967295UL, 0);
18284         check("4294967296", 4294967295UL, ERANGE);
18285 #if 0 /* strtoul() for /^-/ strings is undefined. */
18286         check("-1", 4294967295UL, 0);
18287         check("-4294967294", 2, 0);
18288         check("-4294967295", 1, 0);
18289         check("-4294967296", 4294967295UL, ERANGE);
18290         check("-4294967297", 4294967295UL, ERANGE);
18291 #endif
18292 EOCP
18293                 ;;
18294         *)
18295 : Should we write these tests to be more portable by sprintf-ing
18296 : ~0 and then manipulating that char string as input for strtol?
18297                 ;;
18298         esac
18299         $cat >>try.c <<'EOCP'
18300         if (!bad)
18301                 printf("ok\n");
18302         return 0;
18303 }
18304 EOCP
18305         set try
18306         if eval $compile; then
18307                 case "`$run ./try`" in
18308                 ok) echo "Your strtoul() seems to be working okay." ;;
18309                 *) cat <<EOM >&4
18310 Your strtoul() doesn't seem to be working okay.
18311 EOM
18312                    d_strtoul="$undef"
18313                    ;;
18314                 esac
18315         else
18316                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18317                 d_strtoul="$undef"
18318         fi
18319         ;;
18320 esac
18321
18322 : see if strtoull exists
18323 set strtoull d_strtoull
18324 eval $inlibc
18325
18326 case "$d_longlong-$d_strtoull" in
18327 "$define-$define")
18328         $cat <<EOM
18329 Checking whether your strtoull() works okay...
18330 EOM
18331         $cat >try.c <<'EOCP'
18332 #include <errno.h>
18333 #ifdef __hpux
18334 #define strtoull __strtoull
18335 #endif
18336 #include <stdio.h>
18337 extern unsigned long long int strtoull(char *s, char **, int);
18338 static int bad = 0;
18339 int check(char *s, long long eull, int een) {
18340         long long gull;
18341         errno = 0;
18342         gull = strtoull(s, 0, 10);
18343         if (!((gull == eull) && (errno == een)))
18344                 bad++;
18345 }
18346 int main() {
18347         check(" 1",                                        1LL, 0);
18348         check(" 0",                                        0LL, 0);
18349         check("18446744073709551615",  18446744073709551615ULL, 0);
18350         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18351 #if 0 /* strtoull() for /^-/ strings is undefined. */
18352         check("-1",                    18446744073709551615ULL, 0);
18353         check("-18446744073709551614",                     2LL, 0);
18354         check("-18446744073709551615",                     1LL, 0);
18355         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18356         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18357 #endif
18358         if (!bad)
18359                 printf("ok\n");
18360 }
18361 EOCP
18362         set try
18363         if eval $compile; then
18364                 case "`$run ./try`" in
18365                 ok) echo "Your strtoull() seems to be working okay." ;;
18366                 *) cat <<EOM >&4
18367 Your strtoull() doesn't seem to be working okay.
18368 EOM
18369                    d_strtoull="$undef"
18370                    ;;
18371                 esac
18372         else
18373                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18374                 d_strtoull="$undef"
18375         fi
18376         ;;
18377 esac
18378
18379 : see if strtouq exists
18380 set strtouq d_strtouq
18381 eval $inlibc
18382
18383 case "$d_strtouq" in
18384 "$define")
18385         $cat <<EOM
18386 Checking whether your strtouq() works okay...
18387 EOM
18388         $cat >try.c <<'EOCP'
18389 #include <errno.h>
18390 #include <stdio.h>
18391 extern unsigned long long int strtouq(char *s, char **, int);
18392 static int bad = 0;
18393 void check(char *s, unsigned long long eull, int een) {
18394         unsigned long long gull;
18395         errno = 0;
18396         gull = strtouq(s, 0, 10);
18397         if (!((gull == eull) && (errno == een)))
18398                 bad++;
18399 }
18400 int main() {
18401         check(" 1",                                        1LL, 0);
18402         check(" 0",                                        0LL, 0);
18403         check("18446744073709551615",  18446744073709551615ULL, 0);
18404         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
18405 #if 0 /* strtouq() for /^-/ strings is undefined. */
18406         check("-1",                    18446744073709551615ULL, 0);
18407         check("-18446744073709551614",                     2LL, 0);
18408         check("-18446744073709551615",                     1LL, 0);
18409         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
18410         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
18411 #endif
18412         if (!bad)
18413                 printf("ok\n");
18414         return 0;
18415 }
18416 EOCP
18417         set try
18418         if eval $compile; then
18419                 case "`$run ./try`" in
18420                 ok) echo "Your strtouq() seems to be working okay." ;;
18421                 *) cat <<EOM >&4
18422 Your strtouq() doesn't seem to be working okay.
18423 EOM
18424                    d_strtouq="$undef"
18425                    ;;
18426                 esac
18427         else
18428                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18429                 d_strtouq="$undef"
18430         fi
18431         ;;
18432 esac
18433
18434 : see if strxfrm exists
18435 set strxfrm d_strxfrm
18436 eval $inlibc
18437
18438 : see if symlink exists
18439 set symlink d_symlink
18440 eval $inlibc
18441
18442 : see if syscall exists
18443 set syscall d_syscall
18444 eval $inlibc
18445
18446 : see if prototype for syscall is available
18447 echo " "
18448 set d_syscallproto syscall $i_unistd unistd.h
18449 eval $hasproto
18450
18451 : see if sysconf exists
18452 set sysconf d_sysconf
18453 eval $inlibc
18454
18455 : see if system exists
18456 set system d_system
18457 eval $inlibc
18458
18459 : see if tcgetpgrp exists
18460 set tcgetpgrp d_tcgetpgrp
18461 eval $inlibc
18462
18463 : see if tcsetpgrp exists
18464 set tcsetpgrp d_tcsetpgrp
18465 eval $inlibc
18466
18467 : see if prototype for telldir is available
18468 echo " "
18469 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
18470 eval $hasproto
18471
18472 : see if time exists
18473 echo " "
18474 if test "X$d_time" = X -o X"$timetype" = X; then
18475     if set time val -f d_time; eval $csym; $val; then
18476                 echo 'time() found.' >&4
18477                 val="$define"
18478                 rp="What is the type returned by time() on this system?"
18479                 set time_t timetype long stdio.h sys/types.h
18480                 eval $typedef_ask
18481     else
18482                 echo 'time() not found, hope that will do.' >&4
18483                 val="$undef"
18484                 timetype='int';
18485     fi
18486     set d_time
18487     eval $setvar
18488 fi
18489
18490 : see if timegm exists
18491 set timegm d_timegm
18492 eval $inlibc
18493
18494 : see if this is a sys/times.h system
18495 set sys/times.h i_systimes
18496 eval $inhdr
18497
18498 : see if times exists
18499 echo " "
18500 if set times val -f d_times; eval $csym; $val; then
18501         echo 'times() found.' >&4
18502         d_times="$define"
18503         inc=''
18504         case "$i_systimes" in
18505         "$define") inc='sys/times.h';;
18506         esac
18507         rp="What is the type returned by times() on this system?"
18508         set clock_t clocktype long stdio.h sys/types.h $inc
18509         eval $typedef_ask
18510 else
18511         echo 'times() NOT found, hope that will do.' >&4
18512         d_times="$undef"
18513         clocktype='int'
18514 fi
18515
18516 : see if tmpnam_r exists
18517 set tmpnam_r d_tmpnam_r
18518 eval $inlibc
18519 case "$d_tmpnam_r" in
18520 "$define")
18521         hdrs="$i_systypes sys/types.h define stdio.h "
18522         case "$d_tmpnam_r_proto:$usethreads" in
18523         ":define")      d_tmpnam_r_proto=define
18524                 set d_tmpnam_r_proto tmpnam_r $hdrs
18525                 eval $hasproto ;;
18526         *)      ;;
18527         esac
18528         case "$d_tmpnam_r_proto" in
18529         define)
18530         case "$tmpnam_r_proto" in
18531         ''|0) try='char* tmpnam_r(char*);'
18532         ./protochk "$extern_C $try" $hdrs && tmpnam_r_proto=B_B ;;
18533         esac
18534         case "$tmpnam_r_proto" in
18535         ''|0)   d_tmpnam_r=undef
18536                 tmpnam_r_proto=0
18537                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
18538         * )     case "$tmpnam_r_proto" in
18539                 REENTRANT_PROTO*) ;;
18540                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
18541                 esac
18542                 echo "Prototype: $try" ;;
18543         esac
18544         ;;
18545         *)      case "$usethreads" in
18546                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
18547                 esac
18548                 d_tmpnam_r=undef
18549                 tmpnam_r_proto=0
18550                 ;;
18551         esac
18552         ;;
18553 *)      tmpnam_r_proto=0
18554         ;;
18555 esac
18556
18557 : see if truncate exists
18558 set truncate d_truncate
18559 eval $inlibc
18560
18561 : see if ttyname_r exists
18562 set ttyname_r d_ttyname_r
18563 eval $inlibc
18564 case "$d_ttyname_r" in
18565 "$define")
18566         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
18567         case "$d_ttyname_r_proto:$usethreads" in
18568         ":define")      d_ttyname_r_proto=define
18569                 set d_ttyname_r_proto ttyname_r $hdrs
18570                 eval $hasproto ;;
18571         *)      ;;
18572         esac
18573         case "$d_ttyname_r_proto" in
18574         define)
18575         case "$ttyname_r_proto" in
18576         ''|0) try='int ttyname_r(int, char*, size_t);'
18577         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBW ;;
18578         esac
18579         case "$ttyname_r_proto" in
18580         ''|0) try='int ttyname_r(int, char*, int);'
18581         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=I_IBI ;;
18582         esac
18583         case "$ttyname_r_proto" in
18584         ''|0) try='char* ttyname_r(int, char*, int);'
18585         ./protochk "$extern_C $try" $hdrs && ttyname_r_proto=B_IBI ;;
18586         esac
18587         case "$ttyname_r_proto" in
18588         ''|0)   d_ttyname_r=undef
18589                 ttyname_r_proto=0
18590                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
18591         * )     case "$ttyname_r_proto" in
18592                 REENTRANT_PROTO*) ;;
18593                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
18594                 esac
18595                 echo "Prototype: $try" ;;
18596         esac
18597         ;;
18598         *)      case "$usethreads" in
18599                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
18600                 esac
18601                 d_ttyname_r=undef
18602                 ttyname_r_proto=0
18603                 ;;
18604         esac
18605         ;;
18606 *)      ttyname_r_proto=0
18607         ;;
18608 esac
18609
18610 : see if tzname[] exists
18611 echo " "
18612 if set tzname val -a d_tzname; eval $csym; $val; then
18613         val="$define"
18614         echo 'tzname[] found.' >&4
18615 else
18616         val="$undef"
18617         echo 'tzname[] NOT found.' >&4
18618 fi
18619 set d_tzname
18620 eval $setvar
18621
18622 : Check if is a multiplatform env
18623 case "$osname" in
18624 next|rhapsody|darwin) multiarch="$define" ;;
18625 esac
18626 case "$multiarch" in
18627 ''|[nN]*) multiarch="$undef" ;;
18628 esac
18629
18630 : check for ordering of bytes in a UV
18631 echo " "
18632 case "$usecrosscompile$multiarch" in
18633 *$define*)
18634         $cat <<EOM
18635 You seem to be either cross-compiling or doing a multiarchitecture build,
18636 skipping the byteorder check.
18637
18638 EOM
18639         byteorder='ffff'
18640         ;;
18641 *)
18642         case "$byteorder" in
18643         '')
18644                 $cat <<'EOM'
18645 In the following, larger digits indicate more significance.  A big-endian
18646 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
18647 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
18648 machines may have weird orders like 3412.  A Cray will report 87654321,
18649 an Alpha will report 12345678. If the test program works the default is
18650 probably right.
18651 I'm now running the test program...
18652 EOM
18653                 $cat >try.c <<EOCP
18654 #include <stdio.h>
18655 #$i_stdlib I_STDLIB
18656 #ifdef I_STDLIB
18657 #include <stdlib.h>
18658 #endif
18659 #include <sys/types.h>
18660 typedef $uvtype UV;
18661 int main()
18662 {
18663         int i;
18664         union {
18665                 UV l;
18666                 char c[$uvsize];
18667         } u;
18668
18669         if ($uvsize > 4)
18670                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18671         else
18672                 u.l = (UV)0x04030201;
18673         for (i = 0; i < $uvsize; i++)
18674                 printf("%c", u.c[i]+'0');
18675         printf("\n");
18676         exit(0);
18677 }
18678 EOCP
18679                 xxx_prompt=y
18680                 set try
18681                 if eval $compile && $run ./try > /dev/null; then
18682                         dflt=`$run ./try`
18683                         case "$dflt" in
18684                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18685                                 echo "(The test program ran ok.)"
18686                                 echo "byteorder=$dflt"
18687                                 xxx_prompt=n
18688                         ;;
18689                         ????|????????) echo "(The test program ran ok.)" ;;
18690                         *) echo "(The test program didn't run right for some reason.)" ;;
18691                         esac
18692                 else
18693                         dflt='4321'
18694                         cat <<'EOM'
18695 (I can't seem to compile the test program.  Guessing big-endian...)
18696 EOM
18697                 fi
18698                 case "$xxx_prompt" in
18699                 y)
18700                         rp="What is the order of bytes in $uvtype?"
18701                         . ./myread
18702                         byteorder="$ans"
18703                         ;;
18704                 *)      byteorder=$dflt
18705                         ;;
18706                 esac
18707                 ;;
18708         esac
18709         $rm_try
18710         ;;
18711 esac
18712
18713 : Checking 32bit alignedness
18714 $cat <<EOM
18715
18716 Checking to see whether you can access character data unalignedly...
18717 EOM
18718 case "$d_u32align" in
18719 '')   $cat >try.c <<EOCP
18720 #include <stdio.h>
18721 #$i_stdlib I_STDLIB
18722 #ifdef I_STDLIB
18723 #include <stdlib.h>
18724 #endif
18725 #define U32 $u32type
18726 #define BYTEORDER 0x$byteorder
18727 #define U8 $u8type
18728 #include <signal.h>
18729 #ifdef SIGBUS
18730 $signal_t bletch(int s) { exit(4); }
18731 #endif
18732 int main() {
18733 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18734     volatile U8 buf[8];
18735     volatile U32 *up;
18736     int i;
18737
18738     if (sizeof(U32) != 4) {
18739         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18740         exit(1);
18741     }
18742
18743     fflush(stdout);
18744
18745 #ifdef SIGBUS
18746     signal(SIGBUS, bletch);
18747 #endif
18748
18749     buf[0] = 0;
18750     buf[1] = 0;
18751     buf[2] = 0;
18752     buf[3] = 1;
18753     buf[4] = 0;
18754     buf[5] = 0;
18755     buf[6] = 0;
18756     buf[7] = 1;
18757
18758     for (i = 0; i < 4; i++) {
18759         up = (U32*)(buf + i);
18760         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18761                (*up == 1 << (8*(3-i)))  /* little-endian */
18762               )
18763            )
18764         {
18765             printf("read failed (%x)\n", *up);
18766             exit(2);
18767         }
18768     }
18769
18770     /* write test */
18771     for (i = 0; i < 4; i++) {
18772         up = (U32*)(buf + i);
18773         *up = 0xBeef;
18774         if (*up != 0xBeef) {
18775             printf("write failed (%x)\n", *up);
18776             exit(3);
18777         }
18778     }
18779
18780     exit(0);
18781 #else
18782     printf("1\n");
18783     exit(1);
18784 #endif
18785     return 0;
18786 }
18787 EOCP
18788 set try
18789 if eval $compile_ok; then
18790         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18791         $run ./try 2>&1 >/dev/null
18792         case "$?" in
18793         0)      cat >&4 <<EOM
18794 You can access character data pretty unalignedly.
18795 EOM
18796                 d_u32align="$undef"
18797                 ;;
18798         *)      cat >&4 <<EOM
18799 It seems that you must access character data in an aligned manner.
18800 EOM
18801                 d_u32align="$define"
18802                 ;;
18803         esac
18804 else
18805         rp='Can you access character data at unaligned addresses?'
18806         dflt='n'
18807         . ./myread
18808         case "$ans" in
18809         [yY]*)  d_u32align="$undef"  ;;
18810         *)      d_u32align="$define" ;;
18811         esac
18812 fi
18813 $rm_try
18814 ;;
18815 esac
18816
18817 : see if ualarm exists
18818 set ualarm d_ualarm
18819 eval $inlibc
18820
18821 : see if umask exists
18822 set umask d_umask
18823 eval $inlibc
18824
18825 : see if unordered exists
18826 set unordered d_unordered
18827 eval $inlibc
18828
18829 : see if unsetenv exists
18830 set unsetenv d_unsetenv
18831 eval $inlibc
18832
18833 : see if usleep exists
18834 set usleep d_usleep
18835 eval $inlibc
18836
18837 : see if prototype for usleep is available
18838 echo " "
18839 set d_usleepproto usleep $i_unistd unistd.h
18840 eval $hasproto
18841
18842 : see if ustat exists
18843 set ustat d_ustat
18844 eval $inlibc
18845
18846 : see if closedir exists
18847 set closedir d_closedir
18848 eval $inlibc
18849
18850 case "$d_closedir" in
18851 "$define")
18852         echo " "
18853         echo "Checking whether closedir() returns a status..." >&4
18854         cat > try.c <<EOM
18855 #$i_dirent I_DIRENT             /**/
18856 #$i_sysdir I_SYS_DIR            /**/
18857 #$i_sysndir I_SYS_NDIR          /**/
18858 #$i_systypes I_SYS_TYPES        /**/
18859
18860 #if defined(I_SYS_TYPES)
18861 #include <sys/types.h>
18862 #endif
18863 #if defined(I_DIRENT)
18864 #include <dirent.h>
18865 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18866 #include <sys/dir.h>
18867 #endif
18868 #else
18869 #ifdef I_SYS_NDIR
18870 #include <sys/ndir.h>
18871 #else
18872 #ifdef I_SYS_DIR
18873 #ifdef hp9000s500
18874 #include <ndir.h>       /* may be wrong in the future */
18875 #else
18876 #include <sys/dir.h>
18877 #endif
18878 #endif
18879 #endif
18880 #endif
18881 int main() { return closedir(opendir(".")); }
18882 EOM
18883         set try
18884         if eval $compile_ok; then
18885                 if $run ./try > /dev/null 2>&1 ; then
18886                         echo "Yes, it does."
18887                         val="$undef"
18888                 else
18889                         echo "No, it doesn't."
18890                         val="$define"
18891                 fi
18892         else
18893                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18894                 val="$define"
18895         fi
18896         ;;
18897 *)
18898         val="$undef";
18899         ;;
18900 esac
18901 set d_void_closedir
18902 eval $setvar
18903 $rm_try
18904
18905 : see if there is a wait4
18906 set wait4 d_wait4
18907 eval $inlibc
18908
18909 : see if waitpid exists
18910 set waitpid d_waitpid
18911 eval $inlibc
18912
18913 : see if wcstombs exists
18914 set wcstombs d_wcstombs
18915 eval $inlibc
18916
18917 : see if wctomb exists
18918 set wctomb d_wctomb
18919 eval $inlibc
18920
18921 : see if writev exists
18922 set writev d_writev
18923 eval $inlibc
18924
18925 : preserve RCS keywords in files with variable substitution, grrr
18926 Date='$Date'
18927 Id='$Id'
18928 Log='$Log'
18929 RCSfile='$RCSfile'
18930 Revision='$Revision'
18931
18932 : check for alignment requirements
18933 echo " "
18934 case "$usecrosscompile$multiarch" in
18935 *$define*)
18936         $cat <<EOM
18937 You seem to be either cross-compiling or doing a multiarchitecture build,
18938 skipping the memory alignment check.
18939
18940 EOM
18941         case "$alignbytes" in
18942         '') alignbytes=8 ;;
18943         esac
18944         ;;
18945 *)
18946         case "$alignbytes" in
18947         '') echo "Checking alignment constraints..." >&4
18948                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18949                         $cat >try.c <<'EOCP'
18950 typedef long double NV;
18951 EOCP
18952                 else
18953                         $cat >try.c <<'EOCP'
18954 typedef double NV;
18955 EOCP
18956                 fi
18957                 $cat >>try.c <<'EOCP'
18958 #include <stdio.h>
18959 struct foobar {
18960         char foo;
18961         NV bar;
18962 } try_algn;
18963 int main()
18964 {
18965     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18966     return(0);
18967 }
18968 EOCP
18969                 set try
18970                 if eval $compile_ok; then
18971                         dflt=`$run ./try`
18972                 else
18973                         dflt='8'
18974                         echo "(I can't seem to compile the test program...)"
18975                 fi
18976                 ;;
18977         *) dflt="$alignbytes"
18978                 ;;
18979         esac
18980         rp="Doubles must be aligned on a how-many-byte boundary?"
18981         . ./myread
18982         alignbytes="$ans"
18983         $rm_try
18984         ;;
18985 esac
18986
18987
18988 : set the base revision
18989 baserev=5.0
18990
18991 : length of character in bytes. Is always 1, otherwise it isnt C
18992 : This used to be a test using sizeof
18993 charsize=1
18994
18995 : Check for the number of bits in a character
18996 case "$charbits" in
18997 '')     echo "Checking how long a character is (in bits)..." >&4
18998         $cat >try.c <<EOCP
18999 #include <stdio.h>
19000 int main ()
19001 {
19002     int n;
19003     unsigned char c;
19004     for (c = 1, n = 0; c; c <<= 1, n++) ;
19005     printf ("%d\n", n);
19006     return (0);
19007     }
19008 EOCP
19009         set try
19010         if eval $compile_ok; then
19011                 dflt=`$run ./try`
19012         else
19013                 dflt='8'
19014                 echo "(I can't seem to compile the test program.  Guessing...)"
19015         fi
19016         ;;
19017 *)
19018         dflt="$charbits"
19019         ;;
19020 esac
19021 rp="What is the length of a character (in bits)?"
19022 . ./myread
19023 charbits="$ans"
19024 $rm_try
19025 case "$charbits" in
19026 8)      ;;
19027 *)      cat >&4 << EOM
19028 Your system has an unsigned character size of $charbits bits, which
19029 is rather unusual (normally it is 8 bits).  Perl likely will not work
19030 correctly on your system, with subtle bugs in various places.
19031 EOM
19032         rp='Do you really want to continue?'
19033         dflt='n'
19034         . ./myread
19035         case "$ans" in
19036                 [yY])   echo >&4 "Okay, continuing."    ;;
19037                 *)      exit 1                          ;;
19038         esac
19039 esac
19040
19041 : how do we concatenate cpp tokens here?
19042 echo " "
19043 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
19044 $cat >cpp_stuff.c <<'EOCP'
19045 #define RCAT(a,b)a/**/b
19046 #define ACAT(a,b)a ## b
19047 RCAT(Rei,ser)
19048 ACAT(Cir,cus)
19049 EOCP
19050 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
19051 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
19052         echo "Oh!  Smells like ANSI's been here." >&4
19053         echo "We can catify or stringify, separately or together!"
19054         cpp_stuff=42
19055 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
19056         echo "Ah, yes!  The good old days!" >&4
19057         echo "However, in the good old days we don't know how to stringify and"
19058         echo "catify at the same time."
19059         cpp_stuff=1
19060 else
19061         $cat >&4 <<EOM
19062 Hmm, I don't seem to be able to concatenate tokens with your cpp.
19063 You're going to have to edit the values of CAT[2-5] in config.h...
19064 EOM
19065         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
19066 fi
19067 $rm -f cpp_stuff.*
19068
19069 : see if this is a db.h system
19070 set db.h i_db
19071 eval $inhdr
19072
19073 case "$i_db" in
19074 $define)
19075         : Check db version.
19076         echo " "
19077         echo "Checking Berkeley DB version ..." >&4
19078         $cat >try.c <<EOCP
19079 #$d_const HASCONST
19080 #ifndef HASCONST
19081 #define const
19082 #endif
19083 #include <sys/types.h>
19084 #include <stdio.h>
19085 #$i_stdlib I_STDLIB
19086 #ifdef I_STDLIB
19087 #include <stdlib.h>
19088 #endif
19089 #include <db.h>
19090 int main(int argc, char *argv[])
19091 {
19092 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
19093     int Major, Minor, Patch ;
19094     unsigned long Version ;
19095     (void)db_version(&Major, &Minor, &Patch) ;
19096     if (argc == 2) {
19097         printf("%d %d %d %d %d %d\n",
19098                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
19099                Major, Minor, Patch);
19100         exit(0);
19101     }
19102     printf("You have Berkeley DB Version 2 or greater.\n");
19103
19104     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
19105                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
19106     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
19107                 Major, Minor, Patch) ;
19108
19109     /* check that db.h & libdb are compatible */
19110     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
19111         printf("db.h and libdb are incompatible.\n") ;
19112         exit(3);
19113     }
19114
19115     printf("db.h and libdb are compatible.\n") ;
19116
19117     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
19118                 + DB_VERSION_PATCH ;
19119
19120     /* needs to be >= 2.3.4 */
19121     if (Version < 2003004) {
19122     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
19123         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
19124         exit(2);
19125     }
19126
19127     exit(0);
19128 #else
19129 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
19130     if (argc == 2) {
19131         printf("1 0 0\n");
19132         exit(0);
19133     }
19134     printf("You have Berkeley DB Version 1.\n");
19135     exit(0);    /* DB version < 2: the coast is clear. */
19136 #else
19137     exit(1);    /* <db.h> not Berkeley DB? */
19138 #endif
19139 #endif
19140 }
19141 EOCP
19142         set try
19143         if eval $compile_ok && $run ./try; then
19144                 echo 'Looks OK.' >&4
19145                 set `$run ./try 1`
19146                 db_version_major=$1
19147                 db_version_minor=$2
19148                 db_version_patch=$3
19149         else
19150                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
19151                 i_db=$undef
19152                 case " $libs " in
19153                 *"-ldb "*)
19154                         : Remove db from list of libraries to use
19155                         echo "Removing unusable -ldb from library list" >&4
19156                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
19157                         shift
19158                         libs="$*"
19159                         echo "libs = $libs" >&4
19160                         ;;
19161                 esac
19162         fi
19163         $rm_try
19164         ;;
19165 esac
19166
19167 case "$i_db" in
19168 define)
19169         : Check the return type needed for hash
19170         echo " "
19171         echo "Checking return type needed for hash for Berkeley DB ..." >&4
19172         $cat >try.c <<EOCP
19173 #$d_const HASCONST
19174 #ifndef HASCONST
19175 #define const
19176 #endif
19177 #include <sys/types.h>
19178 #include <db.h>
19179
19180 #ifndef DB_VERSION_MAJOR
19181 u_int32_t hash_cb (ptr, size)
19182 const void *ptr;
19183 size_t size;
19184 {
19185 }
19186 HASHINFO info;
19187 int main()
19188 {
19189         info.hash = hash_cb;
19190 }
19191 #endif
19192 EOCP
19193         if $cc $ccflags -c try.c >try.out 2>&1 ; then
19194                 if $contains warning try.out >>/dev/null 2>&1 ; then
19195                         db_hashtype='int'
19196                 else
19197                         db_hashtype='u_int32_t'
19198                 fi
19199         else
19200                 : XXX Maybe we should just give up here.
19201                 db_hashtype=u_int32_t
19202                 $cat try.out >&4
19203                 echo "Help:  I can't seem to compile the db test program." >&4
19204                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
19205         fi
19206         $rm_try
19207         echo "Your version of Berkeley DB uses $db_hashtype for hash."
19208         ;;
19209 *)      db_hashtype=u_int32_t
19210         ;;
19211 esac
19212 case "$i_db" in
19213 define)
19214         : Check the return type needed for prefix
19215         echo " "
19216         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
19217         cat >try.c <<EOCP
19218 #$d_const HASCONST
19219 #ifndef HASCONST
19220 #define const
19221 #endif
19222 #include <sys/types.h>
19223 #include <db.h>
19224
19225 #ifndef DB_VERSION_MAJOR
19226 size_t prefix_cb (key1, key2)
19227 const DBT *key1;
19228 const DBT *key2;
19229 {
19230 }
19231 BTREEINFO info;
19232 int main()
19233 {
19234         info.prefix = prefix_cb;
19235 }
19236 #endif
19237 EOCP
19238         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
19239                 if $contains warning try.out >>/dev/null 2>&1 ; then
19240                         db_prefixtype='int'
19241                 else
19242                         db_prefixtype='size_t'
19243                 fi
19244         else
19245                 db_prefixtype='size_t'
19246                 : XXX Maybe we should just give up here.
19247                 $cat try.out >&4
19248                 echo "Help:  I can't seem to compile the db test program." >&4
19249                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
19250         fi
19251         $rm_try
19252         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
19253         ;;
19254 *)      db_prefixtype='size_t'
19255         ;;
19256 esac
19257
19258 : How can we generate normalized random numbers ?
19259 echo " "
19260 echo "Looking for a random number function..." >&4
19261 case "$randfunc" in
19262 '')
19263         if set drand48 val -f; eval $csym; $val; then
19264                 dflt="drand48"
19265                 echo "Good, found drand48()." >&4
19266         elif set random val -f; eval $csym; $val; then
19267                 dflt="random"
19268                 echo "OK, found random()." >&4
19269         else
19270                 dflt="rand"
19271                 echo "Yick, looks like I have to use rand()." >&4
19272         fi
19273         echo " "
19274         ;;
19275 *)
19276         dflt="$randfunc"
19277         ;;
19278 esac
19279 cont=true
19280
19281 case "$ccflags" in
19282 *-Dmy_rand=*|*-Dmy_srand=*)
19283         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
19284         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
19285         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
19286         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
19287         ;;
19288 esac
19289
19290 while $test "$cont"; do
19291         rp="Use which function to generate random numbers?"
19292         . ./myread
19293         if $test "$ans" = "$dflt"; then
19294                 : null
19295         else
19296                 randbits=''
19297         fi
19298         randfunc="$ans"
19299         if set $ans val -f; eval $csym; $val; then
19300                 cont=''
19301         else
19302                 dflt=y
19303                 rp="I cannot find function $ans. Use that name anyway?"
19304                 . ./myread
19305                 dflt=rand
19306                 case "$ans" in
19307                         [yY]*) cont='';;
19308                 esac
19309         fi
19310         case "$cont" in
19311         '')
19312                 case "$randfunc" in
19313                 drand48)
19314                         drand01="drand48()"
19315                         seedfunc="srand48"
19316                         randbits=48
19317                         randseedtype=long
19318                         ;;
19319                 rand|random)
19320                         case "$randbits" in
19321                         '')
19322 echo "Checking to see how many bits your $randfunc() function produces..." >&4
19323                                 $cat >try.c <<EOCP
19324 #$i_unistd I_UNISTD
19325 #$i_stdlib I_STDLIB
19326 #include <stdio.h>
19327 #ifdef I_UNISTD
19328 #  include <unistd.h>
19329 #endif
19330 #ifdef I_STDLIB
19331 #  include <stdlib.h>
19332 #endif
19333 int main()
19334 {
19335         register int i;
19336         register unsigned long tmp;
19337         register unsigned long max = 0L;
19338
19339         for (i = 1000; i; i--) {
19340                 tmp = (unsigned long) $randfunc();
19341                 if (tmp > max) max = tmp;
19342         }
19343         for (i = 0; max; i++)
19344                 max /= 2;
19345         printf("%d\n",i);
19346 }
19347 EOCP
19348                                 set try
19349                                 if eval $compile_ok; then
19350                                         dflt=`try`
19351                                 else
19352                                         dflt='?'
19353                                         echo "(I can't seem to compile the test program...)"
19354                                 fi
19355                                 ;;
19356                         *)
19357                                 dflt="$randbits"
19358                                 ;;
19359                         esac
19360                         rp="How many bits does your $randfunc() function produce?"
19361                         . ./myread
19362                         randbits="$ans"
19363                         $rm_try
19364                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19365                         seedfunc="s$randfunc"
19366                         randseedtype=unsigned
19367                         ;;
19368                 *)
19369                         dflt="31"
19370                         rp="How many bits does your $randfunc() function produce?"
19371                         . ./myread
19372                         randbits="$ans"
19373                         seedfunc="s$randfunc"
19374                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
19375                         if set $seedfunc val -f; eval $csym; $val; then
19376                                 echo "(Using $seedfunc() to seed random generator)"
19377                         else
19378                                 echo "(Warning: no $seedfunc() to seed random generator)"
19379                                 seedfunc=rand
19380                         fi
19381                         randseedtype=unsigned
19382                         ;;
19383                 esac
19384                 ;;
19385         esac
19386 done
19387
19388 : Determine if this is an EBCDIC system
19389 echo " "
19390 echo "Determining whether or not we are on an EBCDIC system..." >&4
19391 $cat >try.c <<'EOM'
19392 int main()
19393 {
19394   if ('M'==0xd4) return 0;
19395   return 1;
19396 }
19397 EOM
19398
19399 val=$undef
19400 set try
19401 if eval $compile_ok; then
19402         if $run ./try; then
19403                 echo "You seem to speak EBCDIC." >&4
19404                 val="$define"
19405         else
19406                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
19407         fi
19408 else
19409         echo "I'm unable to compile the test program." >&4
19410         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
19411 fi
19412 $rm_try
19413 set ebcdic
19414 eval $setvar
19415
19416 : Check how to flush
19417 echo " "
19418 $cat >&4 <<EOM
19419 Checking how to flush all pending stdio output...
19420 EOM
19421 # I only know how to find the first 32 possibly open files on SunOS.
19422 # See also hints/sunos_4_1.sh and util.c  --AD
19423 case "$osname" in
19424 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
19425 esac
19426 $cat >>try.c <<EOCP
19427 #include <stdio.h>
19428 #$i_stdlib I_STDLIB
19429 #ifdef I_STDLIB
19430 #include <stdlib.h>
19431 #endif
19432 #$i_unistd I_UNISTD
19433 #ifdef I_UNISTD
19434 # include <unistd.h>
19435 #endif
19436 #$d_sysconf HAS_SYSCONF
19437 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
19438 #ifdef HAS_STDIO_STREAM_ARRAY
19439 # define STDIO_STREAM_ARRAY $stdio_stream_array
19440 #endif
19441 int main() {
19442   FILE* p;
19443   unlink("try.out");
19444   p = fopen("try.out", "w");
19445 #ifdef TRY_FPUTC
19446   fputc('x', p);
19447 #else
19448 # ifdef TRY_FPRINTF
19449   fprintf(p, "x");
19450 # endif
19451 #endif
19452 #ifdef TRY_FFLUSH_NULL
19453   fflush(NULL);
19454 #endif
19455 #ifdef TRY_FFLUSH_ALL
19456   {
19457     long open_max = -1;
19458 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
19459     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
19460 # else
19461 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
19462     open_max = sysconf(_SC_OPEN_MAX);
19463 #  else
19464 #   ifdef FOPEN_MAX
19465     open_max = FOPEN_MAX;
19466 #   else
19467 #    ifdef OPEN_MAX
19468     open_max = OPEN_MAX;
19469 #    else
19470 #     ifdef _NFILE
19471     open_max = _NFILE;
19472 #     endif
19473 #    endif
19474 #   endif
19475 #  endif
19476 # endif
19477 # ifdef HAS_STDIO_STREAM_ARRAY
19478     if (open_max > 0) {
19479       long i;
19480       for (i = 0; i < open_max; i++)
19481             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
19482                 STDIO_STREAM_ARRAY[i]._file < open_max &&
19483                 STDIO_STREAM_ARRAY[i]._flag)
19484                 fflush(&STDIO_STREAM_ARRAY[i]);
19485     }
19486   }
19487 # endif
19488 #endif
19489   _exit(42);
19490 }
19491 EOCP
19492 : first we have to find out how _not_ to flush
19493 $to try.c
19494 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
19495     output=''
19496     set try -DTRY_FPUTC
19497     if eval $compile; then
19498             $run ./try 2>/dev/null
19499             code="$?"
19500             $from try.out
19501             if $test ! -s try.out -a "X$code" = X42; then
19502                 output=-DTRY_FPUTC
19503             fi
19504     fi
19505     case "$output" in
19506     '')
19507             set try -DTRY_FPRINTF
19508             if eval $compile; then
19509                     $run ./try 2>/dev/null
19510                     code="$?"
19511                     $from try.out
19512                     if $test ! -s try.out -a "X$code" = X42; then
19513                         output=-DTRY_FPRINTF
19514                     fi
19515             fi
19516         ;;
19517     esac
19518 fi
19519 : check for fflush NULL behaviour
19520 case "$fflushNULL" in
19521 '')     set try -DTRY_FFLUSH_NULL $output
19522         if eval $compile; then
19523                 $run ./try 2>/dev/null
19524                 code="$?"
19525                 $from try.out
19526                 if $test -s try.out -a "X$code" = X42; then
19527                         fflushNULL="`$cat try.out`"
19528                 else
19529                         if $test "X$code" != X42; then
19530                                 $cat >&4 <<EOM
19531 (If this test failed, don't worry, we'll try another method shortly.)
19532 EOM
19533                         fi
19534                 fi
19535         fi
19536         $rm -f core try.core core.try.*
19537         case "$fflushNULL" in
19538         x)      $cat >&4 <<EOM
19539 Your fflush(NULL) works okay for output streams.
19540 Let's see if it clobbers input pipes...
19541 EOM
19542 # As of mid-March 2000 all versions of Solaris appear to have a stdio
19543 # bug that improperly flushes the input end of pipes.  So we avoid the
19544 # autoflush on fork/system/exec support for now. :-(
19545 $cat >tryp.c <<EOCP
19546 #include <stdio.h>
19547 int
19548 main(int argc, char **argv)
19549 {
19550     char buf[1024];
19551     int i;
19552     char *bp = buf;
19553     while (1) {
19554         while ((i = getc(stdin)) != -1
19555                && (*bp++ = i) != '\n'
19556                && bp < &buf[1024])
19557         /* DO NOTHING */ ;
19558         *bp = '\0';
19559         fprintf(stdout, "%s", buf);
19560         fflush(NULL);
19561         if (i == -1)
19562             return 0;
19563         bp = buf;
19564     }
19565 }
19566 EOCP
19567                 fflushNULL="$define"
19568                 set tryp
19569                 if eval $compile; then
19570                     $rm -f tryp.out
19571                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19572                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
19573                        $cat >&4 <<EOM
19574 fflush(NULL) seems to behave okay with input streams.
19575 EOM
19576                         fflushNULL="$define"
19577                     else
19578                         $cat >&4 <<EOM
19579 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
19580 EOM
19581                         fflushNULL="$undef"
19582                     fi
19583                 fi
19584                 $rm -f core tryp.c tryp.core core.tryp.*
19585                 ;;
19586         '')     $cat >&4 <<EOM
19587 Your fflush(NULL) isn't working (contrary to ANSI C).
19588 EOM
19589                 fflushNULL="$undef"
19590                 ;;
19591         *)      $cat >&4 <<EOM
19592 Cannot figure out whether your fflush(NULL) works or not.
19593 I'm assuming it doesn't (contrary to ANSI C).
19594 EOM
19595                 fflushNULL="$undef"
19596                 ;;
19597         esac
19598         ;;
19599 $define|true|[yY]*)
19600         fflushNULL="$define"
19601         ;;
19602 *)
19603         fflushNULL="$undef"
19604         ;;
19605 esac
19606 : check explicit looping only if NULL did not work, and if the pipe
19607 : bug does not show up on an explicit flush too
19608 case "$fflushNULL" in
19609 "$undef")
19610         $cat >tryp.c <<EOCP
19611 #include <stdio.h>
19612 int
19613 main(int argc, char **argv)
19614 {
19615     char buf[1024];
19616     int i;
19617     char *bp = buf;
19618     while (1) {
19619         while ((i = getc(stdin)) != -1
19620                && (*bp++ = i) != '\n'
19621                && bp < &buf[1024])
19622         /* DO NOTHING */ ;
19623         *bp = '\0';
19624         fprintf(stdout, "%s", buf);
19625         fflush(stdin);
19626         if (i == -1)
19627             return 0;
19628         bp = buf;
19629     }
19630 }
19631 EOCP
19632         set tryp
19633         if eval $compile; then
19634             $rm -f tryp.out
19635             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
19636             if cmp tryp.c tryp.out >/dev/null 2>&1; then
19637                $cat >&4 <<EOM
19638 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
19639 EOM
19640                 : now check for fflushall behaviour
19641                 case "$fflushall" in
19642                 '')     set try -DTRY_FFLUSH_ALL $output
19643                         if eval $compile; then
19644                                 $cat >&4 <<EOM
19645 (Now testing the other method--but note that this also may fail.)
19646 EOM
19647                                 $run ./try 2>/dev/null
19648                                 code=$?
19649                                 $from try.out
19650                                 if $test -s try.out -a "X$code" = X42; then
19651                                         fflushall="`$cat try.out`"
19652                                 fi
19653                         fi
19654                         $rm_try
19655                         case "$fflushall" in
19656                         x)      $cat >&4 <<EOM
19657 Whew. Flushing explicitly all the stdio streams works.
19658 EOM
19659                                 fflushall="$define"
19660                                 ;;
19661                         '')     $cat >&4 <<EOM
19662 Sigh. Flushing explicitly all the stdio streams doesn't work.
19663 EOM
19664                                 fflushall="$undef"
19665                                 ;;
19666                         *)      $cat >&4 <<EOM
19667 Cannot figure out whether flushing stdio streams explicitly works or not.
19668 I'm assuming it doesn't.
19669 EOM
19670                                 fflushall="$undef"
19671                                 ;;
19672                         esac
19673                         ;;
19674                 "$define"|true|[yY]*)
19675                         fflushall="$define"
19676                         ;;
19677                 *)
19678                         fflushall="$undef"
19679                         ;;
19680                 esac
19681             else
19682                 $cat >&4 <<EOM
19683 All is futile.  Even fflush(stdin) clobbers input pipes!
19684 EOM
19685                 fflushall="$undef"
19686             fi
19687         else
19688             fflushall="$undef"
19689         fi
19690         $rm -f core tryp.c tryp.core core.tryp.*
19691         ;;
19692 *)      fflushall="$undef"
19693         ;;
19694 esac
19695
19696 case "$fflushNULL$fflushall" in
19697 undefundef)
19698         $cat <<EOM
19699 OK, I give up.  I cannot figure out how to flush pending stdio output.
19700 We won't be flushing handles at all before fork/exec/popen.
19701 EOM
19702         ;;
19703 esac
19704 $rm_try tryp
19705
19706 : Store the full pathname to the ar program for use in the C program
19707 : Respect a hint or command line value for full_ar.
19708 case "$full_ar" in
19709 '') full_ar=$ar ;;
19710 esac
19711
19712 : Store the full pathname to the sed program for use in the C program
19713 full_sed=$sed
19714
19715 : see what type gids are declared as in the kernel
19716 echo " "
19717 echo "Looking for the type for group ids returned by getgid()."
19718 set gid_t gidtype xxx stdio.h sys/types.h
19719 eval $typedef
19720 case "$gidtype" in
19721 xxx)
19722         xxx=`./findhdr sys/user.h`
19723         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19724         case $1 in
19725         unsigned) dflt="$1 $2" ;;
19726         *) dflt="$1" ;;
19727         esac
19728         ;;
19729 *) dflt="$gidtype";;
19730 esac
19731 case "$gidtype" in
19732 gid_t) echo "gid_t found." ;;
19733 *)      rp="What is the type for group ids returned by getgid()?"
19734         . ./myread
19735         gidtype="$ans"
19736         ;;
19737 esac
19738
19739 : Check the size of GID
19740 echo " "
19741 case "$gidtype" in
19742 *_t) zzz="$gidtype"     ;;
19743 *)   zzz="gid"          ;;
19744 esac
19745 echo "Checking the size of $zzz..." >&4
19746 cat > try.c <<EOCP
19747 #include <sys/types.h>
19748 #include <stdio.h>
19749 #$i_stdlib I_STDLIB
19750 #ifdef I_STDLIB
19751 #include <stdlib.h>
19752 #endif
19753 int main() {
19754     printf("%d\n", (int)sizeof($gidtype));
19755     exit(0);
19756 }
19757 EOCP
19758 set try
19759 if eval $compile_ok; then
19760         yyy=`$run ./try`
19761         case "$yyy" in
19762         '')     gidsize=4
19763                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19764                 ;;
19765         *)      gidsize=$yyy
19766                 echo "Your $zzz is $gidsize bytes long."
19767                 ;;
19768         esac
19769 else
19770         gidsize=4
19771         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19772 fi
19773
19774
19775 : Check if GID is signed
19776 echo " "
19777 case "$gidtype" in
19778 *_t) zzz="$gidtype"     ;;
19779 *)   zzz="gid"          ;;
19780 esac
19781 echo "Checking the sign of $zzz..." >&4
19782 cat > try.c <<EOCP
19783 #include <sys/types.h>
19784 #include <stdio.h>
19785 int main() {
19786         $gidtype foo = -1;
19787         if (foo < 0)
19788                 printf("-1\n");
19789         else
19790                 printf("1\n");
19791 }
19792 EOCP
19793 set try
19794 if eval $compile; then
19795         yyy=`$run ./try`
19796         case "$yyy" in
19797         '')     gidsign=1
19798                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19799                 ;;
19800         *)      gidsign=$yyy
19801                 case "$gidsign" in
19802                  1) echo "Your $zzz is unsigned." ;;
19803                 -1) echo "Your $zzz is signed."   ;;
19804                 esac
19805                 ;;
19806         esac
19807 else
19808         gidsign=1
19809         echo "(I can't compile the test program--guessing unsigned.)" >&4
19810 fi
19811
19812
19813 : Check 64bit sizes
19814 echo " "
19815
19816 if $test X"$quadtype" != X; then
19817
19818 echo "Checking how to print 64-bit integers..." >&4
19819
19820 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19821         $cat >try.c <<'EOCP'
19822 #include <sys/types.h>
19823 #include <stdio.h>
19824 int main() {
19825   int q = 12345678901;
19826   printf("%ld\n", q);
19827 }
19828 EOCP
19829         set try
19830         if eval $compile; then
19831                 yyy=`$run ./try`
19832                 case "$yyy" in
19833                 12345678901)
19834                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19835                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19836                         echo "We will use %d."
19837                         ;;
19838                 esac
19839         fi
19840 fi
19841
19842 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19843         $cat >try.c <<'EOCP'
19844 #include <sys/types.h>
19845 #include <stdio.h>
19846 int main() {
19847   long q = 12345678901;
19848   printf("%ld\n", q);
19849 }
19850 EOCP
19851         set try
19852         if eval $compile; then
19853                 yyy=`$run ./try`
19854                 case "$yyy" in
19855                 12345678901)
19856                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19857                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19858                         echo "We will use %ld."
19859                         ;;
19860                 esac
19861         fi
19862 fi
19863
19864 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19865         $cat >try.c <<'EOCP'
19866 #include <sys/types.h>
19867 #include <inttypes.h>
19868 #include <stdio.h>
19869 int main() {
19870   int64_t q = 12345678901;
19871   printf("%" PRId64 "\n", q);
19872 }
19873 EOCP
19874         set try
19875         if eval $compile; then
19876                 yyy=`$run ./try`
19877                 case "$yyy" in
19878                 12345678901)
19879                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19880                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19881                         echo "We will use the C9X style."
19882                         ;;
19883                 esac
19884         fi
19885 fi
19886
19887 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19888         $cat >try.c <<EOCP
19889 #include <sys/types.h>
19890 #include <stdio.h>
19891 int main() {
19892   $quadtype q = 12345678901;
19893   printf("%Ld\n", q);
19894 }
19895 EOCP
19896         set try
19897         if eval $compile; then
19898                 yyy=`$run ./try`
19899                 case "$yyy" in
19900                 12345678901)
19901                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19902                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19903                         echo "We will use %Ld."
19904                         ;;
19905                 esac
19906         fi
19907 fi
19908
19909 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19910         $cat >try.c <<'EOCP'
19911 #include <sys/types.h>
19912 #include <stdio.h>
19913 int main() {
19914   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19915   printf("%lld\n", q);
19916 }
19917 EOCP
19918         set try
19919         if eval $compile; then
19920                 yyy=`$run ./try`
19921                 case "$yyy" in
19922                 12345678901)
19923                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19924                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19925                         echo "We will use the %lld style."
19926                         ;;
19927                 esac
19928         fi
19929 fi
19930
19931 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19932         $cat >try.c <<EOCP
19933 #include <sys/types.h>
19934 #include <stdio.h>
19935 int main() {
19936   $quadtype q = 12345678901;
19937   printf("%qd\n", q);
19938 }
19939 EOCP
19940         set try
19941         if eval $compile; then
19942                 yyy=`$run ./try`
19943                 case "$yyy" in
19944                 12345678901)
19945                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19946                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19947                         echo "We will use %qd."
19948                         ;;
19949                 esac
19950         fi
19951 fi
19952
19953 if $test X"$sPRId64" = X; then
19954         echo "Cannot figure out how to print 64-bit integers." >&4
19955 fi
19956 $rm_try
19957
19958 fi
19959
19960 case "$sPRId64" in
19961 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19962         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19963         ;;
19964 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19965         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19966         ;;
19967 esac
19968
19969 : Check format strings for internal types
19970 echo " "
19971 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19972
19973 if $test X"$ivsize" = X8; then
19974         ivdformat="$sPRId64"
19975         uvuformat="$sPRIu64"
19976         uvoformat="$sPRIo64"
19977         uvxformat="$sPRIx64"
19978         uvXUformat="$sPRIXU64"
19979 else
19980         if $test X"$ivsize" = X"$longsize"; then
19981                 ivdformat='"ld"'
19982                 uvuformat='"lu"'
19983                 uvoformat='"lo"'
19984                 uvxformat='"lx"'
19985                 uvXUformat='"lX"'
19986         else
19987                 if $test X"$ivsize" = X"$intsize"; then
19988                         ivdformat='"d"'
19989                         uvuformat='"u"'
19990                         uvoformat='"o"'
19991                         uvxformat='"x"'
19992                         uvXUformat='"X"'
19993                 else
19994                         : far out
19995                         if $test X"$ivsize" = X"$shortsize"; then
19996                                 ivdformat='"hd"'
19997                                 uvuformat='"hu"'
19998                                 uvoformat='"ho"'
19999                                 uvxformat='"hx"'
20000                                 uvXUformat='"hX"'
20001                         fi
20002                 fi
20003         fi
20004 fi
20005
20006 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
20007         nveformat="$sPRIeldbl"
20008         nvfformat="$sPRIfldbl"
20009         nvgformat="$sPRIgldbl"
20010         nvEUformat="$sPRIEUldbl"
20011         nvFUformat="$sPRIFUldbl"
20012         nvGUformat="$sPRIGUldbl"
20013 else
20014         nveformat='"e"'
20015         nvfformat='"f"'
20016         nvgformat='"g"'
20017         nvEUformat='"E"'
20018         nvFUformat='"F"'
20019         nvGUformat='"G"'
20020 fi
20021
20022 case "$ivdformat" in
20023 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
20024     exit 1
20025     ;;
20026 esac
20027
20028 : Check format string for GID
20029
20030 echo " "
20031 $echo "Checking the format string to be used for gids..." >&4
20032
20033 case "$gidsign" in
20034 -1)     if $test X"$gidsize" = X"$ivsize"; then
20035                 gidformat="$ivdformat"
20036         else
20037                 if $test X"$gidsize" = X"$longsize"; then
20038                         gidformat='"ld"'
20039                 else
20040                         if $test X"$gidsize" = X"$intsize"; then
20041                                 gidformat='"d"'
20042                         else
20043                                 if $test X"$gidsize" = X"$shortsize"; then
20044                                         gidformat='"hd"'
20045                                 fi
20046                         fi
20047                 fi
20048         fi
20049         ;;
20050 *)      if $test X"$gidsize" = X"$uvsize"; then
20051                 gidformat="$uvuformat"
20052         else
20053                 if $test X"$gidsize" = X"$longsize"; then
20054                         gidformat='"lu"'
20055                 else
20056                         if $test X"$gidsize" = X"$intsize"; then
20057                                 gidformat='"u"'
20058                         else
20059                                 if $test X"$gidsize" = X"$shortsize"; then
20060                                         gidformat='"hu"'
20061                                 fi
20062                         fi
20063                 fi
20064         fi
20065         ;;
20066 esac
20067
20068 : see if getgroups exists
20069 set getgroups d_getgrps
20070 eval $inlibc
20071
20072 : see if setgroups exists
20073 set setgroups d_setgrps
20074 eval $inlibc
20075
20076 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
20077 echo " "
20078 case "$d_getgrps$d_setgrps" in
20079 *define*)
20080         case "$groupstype" in
20081         '') dflt="$gidtype" ;;
20082         *)  dflt="$groupstype" ;;
20083         esac
20084         $cat <<EOM
20085 What type of pointer is the second argument to getgroups() and setgroups()?
20086 Usually this is the same as group ids, $gidtype, but not always.
20087
20088 EOM
20089         rp='What type pointer is the second argument to getgroups() and setgroups()?'
20090         . ./myread
20091         groupstype="$ans"
20092         ;;
20093 *)  groupstype="$gidtype";;
20094 esac
20095
20096 : MAD = Misc Attribute Definition
20097
20098 if $test $patchlevel -lt 9; then
20099 : MAD is not available in 5.8.x or earlier.
20100     ans=n;
20101 else
20102     case "$mad" in
20103     $define|true|[yY]*) dflt='y' ;;
20104     *)                  dflt='n' ;;
20105     esac
20106     cat <<EOM
20107
20108 Would you like to build with Misc Attribute Decoration? This is development
20109 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
20110 overhead on the interpreter.
20111
20112 If this doesn't make any sense to you, just accept the default '$dflt'.
20113 EOM
20114     rp='Build Perl with MAD?'
20115     . ./myread
20116 fi
20117 case "$ans" in
20118 y|Y)    val="$define"
20119         madlyh='madly.h madly.act madly.tab'
20120         madlysrc='madly.c'
20121         madlyobj="madly$_o" ;;
20122 *)      val="$undef"
20123         madlyh=''
20124         madlysrc=''
20125         madlyobj='' ;;
20126 esac
20127 set mad
20128 eval $setvar
20129
20130 : check whether make sets MAKE
20131 echo " "
20132 echo "Checking if your $make program sets \$(MAKE)..." >&4
20133 case "$make_set_make" in
20134 '')
20135         $sed 's/^X //' > testmake.mak << 'EOF'
20136 Xall:
20137 X       @echo 'maketemp="$(MAKE)"'
20138 EOF
20139         case "`$make -f testmake.mak 2>/dev/null`" in
20140         *maketemp=*) make_set_make='#' ;;
20141         *)      make_set_make="MAKE=$make" ;;
20142         esac
20143         $rm -f testmake.mak
20144         ;;
20145 esac
20146 case "$make_set_make" in
20147 '#') echo "Yup, it does.";;
20148 *) echo "Nope, it doesn't.";;
20149 esac
20150
20151 : see what type is used for mode_t
20152 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
20153 set mode_t modetype int stdio.h sys/types.h
20154 eval $typedef_ask
20155
20156 : see if we need va_copy
20157 echo " "
20158 case "$i_stdarg" in
20159 "$define")
20160         $cat >try.c <<EOCP
20161 #include <stdarg.h>
20162 #include <stdio.h>
20163 #$i_stdlib I_STDLIB
20164 #ifdef I_STDLIB
20165 #include <stdlib.h>
20166 #endif
20167 #include <signal.h>
20168
20169 int
20170 ivfprintf(FILE *f, const char *fmt, va_list *valp)
20171 {
20172   return vfprintf(f, fmt, *valp);
20173 }
20174
20175 int
20176 myvfprintf(FILE *f, const  char *fmt, va_list val)
20177 {
20178   return ivfprintf(f, fmt, &val);
20179 }
20180
20181 int
20182 myprintf(char *fmt, ...)
20183 {
20184   va_list val;
20185   va_start(val, fmt);
20186   return myvfprintf(stdout, fmt, val);
20187 }
20188
20189 int
20190 main(int ac, char **av)
20191 {
20192   signal(SIGSEGV, exit);
20193
20194   myprintf("%s%cs all right, then\n", "that", '\'');
20195   exit(0);
20196 }
20197 EOCP
20198         set try
20199         if eval $compile && $run ./try 2>&1 >/dev/null; then
20200                 case "`$run ./try`" in
20201                 "that's all right, then")
20202                         okay=yes
20203                         ;;
20204                 esac
20205         fi
20206         case "$okay" in
20207         yes)    echo "It seems that you don't need va_copy()." >&4
20208                 need_va_copy="$undef"
20209                 ;;
20210         *)      echo "It seems that va_copy() or similar will be needed." >&4
20211                 need_va_copy="$define"
20212                 ;;
20213         esac
20214         $rm_try
20215         ;;
20216 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
20217         ;;
20218 esac
20219
20220 : see what type is used for size_t
20221 rp="What is the type used for the length parameter for string functions?"
20222 set size_t sizetype 'unsigned int' stdio.h sys/types.h
20223 eval $typedef_ask
20224
20225 : check for type of arguments to gethostbyaddr. 
20226 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
20227         case "$d_gethbyaddr" in
20228         $define)
20229                 $cat <<EOM
20230
20231 Checking to see what type of arguments are accepted by gethostbyaddr().
20232 EOM
20233                 hdrs="$define sys/types.h
20234                         $d_socket sys/socket.h 
20235                         $i_niin netinet/in.h 
20236                         $i_netdb netdb.h
20237                         $i_unistd unistd.h"
20238                 : The first arg can 'char *' or 'void *'
20239                 : The second arg is some of integral type
20240                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
20241                         for yyy in size_t long int; do
20242                                 case "$netdb_host_type" in
20243                                 '')     try="$extern_C struct hostent *gethostbyaddr($xxx, $yyy, int);"
20244                                         if ./protochk "$try" $hdrs; then
20245                                                 echo "Your system accepts $xxx for the first arg."
20246                                                 echo "...and $yyy for the second arg."
20247                                                 netdb_host_type="$xxx"
20248                                                 netdb_hlen_type="$yyy"
20249                                         fi
20250                                         ;;
20251                                 esac
20252                         done
20253                 done
20254                 : In case none of those worked, prompt the user.
20255                 case "$netdb_host_type" in
20256                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
20257                         dflt='char *'
20258                         . ./myread
20259                         netdb_host_type=$ans
20260                         rp='What is the type for the 2nd argument to gethostbyaddr?'
20261                         dflt="$sizetype"
20262                         . ./myread
20263                         netdb_hlen_type=$ans
20264                         ;;
20265                 esac
20266                 ;;
20267         *)      : no gethostbyaddr, so pick harmless defaults
20268                 netdb_host_type='char *'
20269                 netdb_hlen_type="$sizetype"
20270                 ;;
20271         esac
20272         # Remove the "const" if needed. -- but then we'll have a 
20273         # prototype clash!
20274         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
20275 fi
20276
20277 : check for type of argument to gethostbyname. 
20278 if test "X$netdb_name_type" = X ; then
20279         case "$d_gethbyname" in
20280         $define)
20281                 $cat <<EOM
20282
20283 Checking to see what type of argument is accepted by gethostbyname().
20284 EOM
20285                 hdrs="$define sys/types.h
20286                         $d_socket sys/socket.h 
20287                         $i_niin netinet/in.h 
20288                         $i_netdb netdb.h
20289                         $i_unistd unistd.h"
20290                 for xxx in "const char *" "char *"; do
20291                         case "$netdb_name_type" in
20292                         '')     try="$extern_C struct hostent *gethostbyname($xxx);"
20293                                 if ./protochk "$try" $hdrs; then
20294                                         echo "Your system accepts $xxx."
20295                                         netdb_name_type="$xxx"
20296                                 fi
20297                                 ;;
20298                         esac
20299                 done
20300                 : In case none of those worked, prompt the user.
20301                 case "$netdb_name_type" in
20302                 '')     rp='What is the type for the 1st argument to gethostbyname?'
20303                         dflt='char *'
20304                         . ./myread
20305                         netdb_name_type=$ans
20306                         ;;
20307                 esac
20308                 ;;
20309         *)      : no gethostbyname, so pick harmless default
20310                 netdb_name_type='char *'
20311                 ;;
20312         esac
20313 fi
20314
20315 : check for type of 1st argument to getnetbyaddr. 
20316 if test "X$netdb_net_type" = X ; then
20317         case "$d_getnbyaddr" in
20318         $define)
20319                 $cat <<EOM
20320
20321 Checking to see what type of 1st argument is accepted by getnetbyaddr().
20322 EOM
20323                 hdrs="$define sys/types.h
20324                         $d_socket sys/socket.h 
20325                         $i_niin netinet/in.h 
20326                         $i_netdb netdb.h
20327                         $i_unistd unistd.h"
20328                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
20329                         case "$netdb_net_type" in
20330                         '')     try="$extern_C struct netent *getnetbyaddr($xxx, int);"
20331                                 if ./protochk "$try" $hdrs; then
20332                                         echo "Your system accepts $xxx."
20333                                         netdb_net_type="$xxx"
20334                                 fi
20335                                 ;;
20336                         esac
20337                 done
20338                 : In case none of those worked, prompt the user.
20339                 case "$netdb_net_type" in
20340                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
20341                         dflt='long'
20342                         . ./myread
20343                         netdb_net_type=$ans
20344                         ;;
20345                 esac
20346                 ;;
20347         *)      : no getnetbyaddr, so pick harmless default
20348                 netdb_net_type='long'
20349                 ;;
20350         esac
20351 fi
20352 : locate the preferred pager for this system
20353 fn=f/
20354 case "$pager" in
20355 '')
20356         dflt=''
20357         case "$pg" in
20358         /*) dflt=$pg;;
20359         [a-zA-Z]:/*) dflt=$pg;;
20360         esac
20361         case "$more" in
20362         /*) dflt=$more;;
20363         [a-zA-Z]:/*) dflt=$more;;
20364         esac
20365         case "$less" in
20366         /*) dflt=$less;;
20367         [a-zA-Z]:/*) dflt=$less;;
20368         esac
20369         case "$dflt" in
20370         '') dflt=/usr/ucb/more;;
20371         esac
20372         ;;
20373 *)      dflt="$pager"
20374         fn="f/($pager)"
20375         ;;
20376 esac
20377 echo " "
20378 rp='What pager is used on your system?'
20379 . ./getfile
20380 pager="$ans"
20381
20382 : see what type pids are declared as in the kernel
20383 rp="What is the type of process ids on this system?"
20384 set pid_t pidtype int stdio.h sys/types.h
20385 eval $typedef_ask
20386
20387 : see if ar generates random libraries by itself
20388 echo " "
20389 echo "Checking how to generate random libraries on your machine..." >&4
20390 echo 'int bar1() { return bar2(); }' > bar1.c
20391 echo 'int bar2() { return 2; }' > bar2.c
20392 $cat > foo.c <<EOP
20393 #$i_stdlib I_STDLIB
20394 #ifdef I_STDLIB
20395 #include <stdlib.h>
20396 #endif
20397 int main() { printf("%d\n", bar1()); exit(0); }
20398 EOP
20399 $cc $ccflags -c bar1.c >/dev/null 2>&1
20400 $cc $ccflags -c bar2.c >/dev/null 2>&1
20401 $cc $ccflags -c foo.c >/dev/null 2>&1
20402 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
20403 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20404         $run ./foobar >/dev/null 2>&1; then
20405         echo "$ar appears to generate random libraries itself."
20406         orderlib=false
20407         if [ "X$ranlib" = "X" ]; then
20408             ranlib=":"
20409         fi
20410 elif $ar s bar$_a >/dev/null 2>&1 &&
20411         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20412         $run ./foobar >/dev/null 2>&1; then
20413                 echo "a table of contents needs to be added with '$ar s'."
20414                 orderlib=false
20415                 ranlib="$ar s"
20416 elif $ar ts bar$_a >/dev/null 2>&1 &&
20417         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
20418         $run ./foobar >/dev/null 2>&1; then
20419                 echo "a table of contents needs to be added with '$ar ts'."
20420                 orderlib=false
20421                 ranlib="$ar ts"
20422 else
20423         case "$ranlib" in
20424         :) ranlib='';;
20425         '')
20426                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
20427                 $test -f $ranlib || ranlib=''
20428                 ;;
20429         esac
20430         if $test -n "$ranlib"; then
20431                 echo "your system has '$ranlib'; we'll use that."
20432                 orderlib=false
20433         else
20434                 echo "your system doesn't seem to support random libraries"
20435                 echo "so we'll use lorder and tsort to order the libraries."
20436                 orderlib=true
20437                 ranlib=":"
20438         fi
20439 fi
20440 $rm -f foo* bar*
20441
20442 : see if this is a values.h system
20443 set values.h i_values
20444 eval $inhdr
20445
20446 : Check the max offset that gmtime and localtime accept
20447 echo "Checking max offsets that gmtime () accepts"
20448
20449 case $i_values in
20450     define) yyy="#include <values.h>" ;;
20451     *)      yyy="" ;;
20452     esac
20453
20454 case "$sGMTIME_min/$sGMTIME_max" in
20455     0/0|/)
20456         $cat >try.c <<EOCP
20457 #include <sys/types.h>
20458 #include <stdio.h>
20459 #include <time.h>
20460 $yyy
20461
20462 int i;
20463 struct tm *tmp;
20464 time_t pt;
20465
20466 void gm_check (time_t t, int min_year, int max_year)
20467 {
20468     tmp = gmtime (&t);
20469     if ( tmp == NULL ||
20470         /* Check tm_year overflow */
20471          tmp->tm_year < min_year || tmp->tm_year > max_year)
20472         tmp = NULL;
20473     else
20474         pt = t;
20475     } /* gm_check */
20476
20477 int check_max ()
20478 {
20479     tmp = NULL;
20480     pt  = 0;
20481 #ifdef MAXLONG
20482     gm_check (MAXLONG, 69, 0x7fffffff);
20483 #endif
20484     if (tmp == NULL || tmp->tm_year < 0) {
20485         for (i = 63; i >= 0; i--) {
20486             time_t x = pt | ((time_t)1 << i);
20487             if (x < 0 || x < pt) continue;
20488             gm_check (x, 69, 0x7fffffff);
20489             }
20490         }
20491     printf ("sGMTIME_max=%ld\n", pt);
20492     return (0);
20493     } /* check_max */
20494
20495 int check_min ()
20496 {
20497     tmp = NULL;
20498     pt  = 0;
20499 #ifdef MINLONG
20500     gm_check (MINLONG, -1900, 70);
20501 #endif
20502     if (tmp == NULL) {
20503         for (i = 36; i >= 0; i--) {
20504             time_t x = pt - ((time_t)1 << i);
20505             if (x > 0) continue;
20506             gm_check (x, -1900, 70);
20507             }
20508         }
20509     printf ("sGMTIME_min=%ld\n", pt);
20510     return (0);
20511     } /* check_min */
20512
20513 int main (int argc, char *argv[])
20514 {
20515     fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
20516     check_max ();
20517     check_min ();
20518     return (0);
20519     } /* main */
20520 EOCP
20521         set try
20522         if eval $compile; then
20523             eval `$run ./try`
20524         else
20525             echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4
20526             fi
20527         $rm_try
20528         ;;
20529     esac
20530
20531 echo "Checking max offsets that localtime () accepts"
20532
20533 case "$sLOCALTIME_min/$sLOCALTIME_max" in
20534     0/0|/)
20535         $cat >try.c <<EOCP
20536 #include <sys/types.h>
20537 #include <stdio.h>
20538 #include <time.h>
20539 $yyy
20540
20541 int i;
20542 struct tm *tmp;
20543 time_t pt;
20544
20545 void local_check (time_t t, int min_year, int max_year)
20546 {
20547     if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
20548         tmp = NULL;
20549     else
20550         tmp = localtime (&t);
20551     if ( tmp == NULL ||
20552         /* Check tm_year overflow */
20553          tmp->tm_year < min_year || tmp->tm_year > max_year)
20554         tmp = NULL;
20555     else
20556         pt = t;
20557     } /* local_check */
20558
20559 int check_max ()
20560 {
20561     tmp = NULL;
20562     pt  = 0;
20563 #ifdef MAXLONG
20564     local_check (MAXLONG, 69, 0x7fffffff);
20565 #endif
20566     if (tmp == NULL || tmp->tm_year < 0) {
20567         for (i = 63; i >= 0; i--) {
20568             time_t x = pt | ((time_t)1 << i);
20569             if (x < 0 || x < pt) continue;
20570             local_check (x, 69, 0x7fffffff);
20571             }
20572         }
20573     printf ("sLOCALTIME_max=%ld\n", pt);
20574     return (0);
20575    } /* check_max */
20576
20577 int check_min ()
20578 {
20579     tmp = NULL;
20580     pt  = 0;
20581 #ifdef MINLONG
20582     local_check (MINLONG, -1900, 70);
20583 #endif
20584     if (tmp == NULL) {
20585         for (i = 36; i >= 0; i--) {
20586             time_t x = pt - ((time_t)1 << i);
20587             if (x > 0) continue;
20588             local_check (x, -1900, 70);
20589             }
20590         }
20591     printf ("sLOCALTIME_min=%ld\n", pt);
20592     return (0);
20593     } /* check_min */
20594
20595 int main (int argc, char *argv[])
20596 {
20597     check_max ();
20598     check_min ();
20599     return (0);
20600     } /* main */
20601 EOCP
20602         set try
20603         if eval $compile; then
20604             eval `$run ./try`
20605         else
20606             echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4
20607             fi
20608         $rm_try
20609         ;;
20610     esac
20611
20612 : check for type of arguments to select.
20613 case "$selecttype" in
20614 '') case "$d_select" in
20615         $define)
20616                 echo " "
20617                 $cat <<EOM
20618 Checking to see what type of arguments are accepted by select().
20619 EOM
20620                 hdrs="$define sys/types.h
20621                         $i_systime sys/time.h
20622                         $i_sysselct sys/select.h
20623                         $d_socket sys/socket.h"
20624                 : The first arg can be int, unsigned, or size_t
20625                 : The last arg may or may not be 'const'
20626                 val=''
20627                 : void pointer has been seen but using that
20628                 : breaks the selectminbits test
20629                 for xxx in 'fd_set *' 'int *'; do
20630                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
20631                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
20632                                         case "$val" in
20633                                         '')     try="$extern_C select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
20634                                                 if ./protochk "$try" $hdrs; then
20635                                                         echo "Your system accepts $xxx."
20636                                                         val="$xxx"
20637                                                 fi
20638                                                 ;;
20639                                         esac
20640                                 done
20641                         done
20642                 done
20643                 case "$val" in
20644                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
20645                         case "$d_fd_set" in
20646                                 $define) dflt="fd_set *" ;;
20647                                 *)              dflt="int *" ;;
20648                         esac
20649                         . ./myread
20650                         val=$ans
20651                         ;;
20652                 esac
20653                 selecttype="$val"
20654                 ;;
20655         *)      : no select, so pick a harmless default
20656                 selecttype='int *'
20657                 ;;
20658         esac
20659         ;;
20660 esac
20661
20662 : check for the select 'width'
20663 case "$selectminbits" in
20664 '') safebits=`expr $ptrsize \* 8`
20665     case "$d_select" in
20666         $define)
20667                 $cat <<EOM
20668
20669 Checking to see on how many bits at a time your select() operates...
20670 EOM
20671                 $cat >try.c <<EOCP
20672 #include <sys/types.h>
20673 #$i_time I_TIME
20674 #$i_systime I_SYS_TIME
20675 #$i_systimek I_SYS_TIME_KERNEL
20676 #ifdef I_TIME
20677 #   include <time.h>
20678 #endif
20679 #ifdef I_SYS_TIME
20680 #   ifdef I_SYS_TIME_KERNEL
20681 #       define KERNEL
20682 #   endif
20683 #   include <sys/time.h>
20684 #   ifdef I_SYS_TIME_KERNEL
20685 #       undef KERNEL
20686 #   endif
20687 #endif
20688 #$i_sysselct I_SYS_SELECT
20689 #ifdef I_SYS_SELECT
20690 #include <sys/select.h>
20691 #endif
20692 #$d_socket HAS_SOCKET
20693 #ifdef HAS_SOCKET
20694 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
20695 #endif
20696 #include <stdio.h>
20697 #$i_stdlib I_STDLIB
20698 #ifdef I_STDLIB
20699 #include <stdlib.h>
20700 #endif
20701 $selecttype b;
20702 #define S sizeof(*(b))
20703 #define MINBITS 64
20704 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
20705 #define NBITS  (NBYTES * 8)
20706 int main() {
20707     char *s = (char *)malloc(NBYTES);
20708     struct timeval t;
20709     int i;
20710     FILE* fp;
20711     int fd;
20712
20713     if (!s)
20714         exit(1);
20715     fclose(stdin);
20716     fp = fopen("try.c", "r");
20717     if (fp == 0)
20718       exit(2);
20719     fd = fileno(fp);
20720     if (fd < 0)
20721       exit(3);
20722     b = ($selecttype)s;
20723     for (i = 0; i < NBITS; i++)
20724         FD_SET(i, b);
20725     t.tv_sec  = 0;
20726     t.tv_usec = 0;
20727     select(fd + 1, b, 0, 0, &t);
20728     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
20729     free(s);
20730     printf("%d\n", i + 1);
20731     return 0;
20732 }
20733 EOCP
20734                 set try
20735                 if eval $compile_ok; then
20736                         selectminbits=`$run ./try`
20737                         case "$selectminbits" in
20738                         '')     cat >&4 <<EOM
20739 Cannot figure out on how many bits at a time your select() operates.
20740 I'll play safe and guess it is $safebits bits.
20741 EOM
20742                                 selectminbits=$safebits
20743                                 bits="$safebits bits"
20744                                 ;;
20745                         1)      bits="1 bit" ;;
20746                         *)      bits="$selectminbits bits" ;;
20747                         esac
20748                         echo "Your select() operates on $bits at a time." >&4
20749                 else
20750                         rp='What is the minimum number of bits your select() operates on?'
20751                         case "$byteorder" in
20752                         12345678)       dflt=64 ;;
20753                         1234)           dflt=32 ;;
20754                         *)              dflt=1  ;;
20755                         esac
20756                         . ./myread
20757                         val=$ans
20758                         selectminbits="$val"
20759                 fi
20760                 $rm_try
20761                 ;;
20762         *)      : no select, so pick a harmless default
20763                 selectminbits=$safebits
20764                 ;;
20765         esac
20766         ;;
20767 esac
20768
20769 : Trace out the files included by signal.h, then look for SIGxxx names.
20770 if [ "X$fieldn" = X ]; then
20771         : Just make some guesses.  We check them later.
20772         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
20773 else
20774         xxx=`echo '#include <signal.h>' |
20775         $cppstdin $cppminus $cppflags 2>/dev/null |
20776         $grep '^[       ]*#.*include' |
20777         $awk "{print \\$$fieldn}" | $sed 's!"!!g' |\
20778                 $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
20779 fi
20780 xxxfiles=''
20781 for xx in $xxx /dev/null ; do
20782         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
20783 done
20784 case "$xxxfiles" in
20785 '')     xxxfiles=`./findhdr signal.h` ;;
20786 esac
20787 xxx=`awk '
20788 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
20789         print substr($2, 4, 20)
20790 }
20791 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
20792         print substr($3, 4, 20)
20793 }' $xxxfiles`
20794 : Append some common names just in case the awk scan failed.
20795 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
20796 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
20797 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
20798 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
20799 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
20800
20801 : generate a few handy files for later
20802 $cat > signal.c <<EOCP
20803 #include <sys/types.h>
20804 #include <signal.h>
20805 #$i_stdlib I_STDLIB
20806 #ifdef I_STDLIB
20807 #include <stdlib.h>
20808 #endif
20809 #include <stdio.h>
20810 int main() {
20811
20812 /* Strange style to avoid deeply-nested #if/#else/#endif */
20813 #ifndef NSIG
20814 #  ifdef _NSIG
20815 #    define NSIG (_NSIG)
20816 #  endif
20817 #endif
20818
20819 #ifndef NSIG
20820 #  ifdef SIGMAX
20821 #    define NSIG (SIGMAX+1)
20822 #  endif
20823 #endif
20824
20825 #ifndef NSIG
20826 #  ifdef SIG_MAX
20827 #    define NSIG (SIG_MAX+1)
20828 #  endif
20829 #endif
20830
20831 #ifndef NSIG
20832 #  ifdef _SIG_MAX
20833 #    define NSIG (_SIG_MAX+1)
20834 #  endif
20835 #endif
20836
20837 #ifndef NSIG
20838 #  ifdef MAXSIG
20839 #    define NSIG (MAXSIG+1)
20840 #  endif
20841 #endif
20842
20843 #ifndef NSIG
20844 #  ifdef MAX_SIG
20845 #    define NSIG (MAX_SIG+1)
20846 #  endif
20847 #endif
20848
20849 #ifndef NSIG
20850 #  ifdef SIGARRAYSIZE
20851 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
20852 #  endif
20853 #endif
20854
20855 #ifndef NSIG
20856 #  ifdef _sys_nsig
20857 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
20858 #  endif
20859 #endif
20860
20861 /* Default to some arbitrary number that's big enough to get most
20862    of the common signals.
20863 */
20864 #ifndef NSIG
20865 #    define NSIG 50
20866 #endif
20867
20868 printf("NSIG %d\n", NSIG);
20869
20870 #ifndef JUST_NSIG
20871
20872 EOCP
20873
20874 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
20875 {
20876         printf "#ifdef SIG"; printf $1; printf "\n"
20877         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
20878         printf $1; printf ");\n"
20879         printf "#endif\n"
20880 }
20881 END {
20882         printf "#endif /* JUST_NSIG */\n";
20883         printf "exit(0);\n}\n";
20884 }
20885 ' >>signal.c
20886 $cat >signal.awk <<'EOP'
20887 BEGIN { ndups = 0 }
20888 $1 ~ /^NSIG$/ { nsig = $2 }
20889 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20890     if ($2 > maxsig) { maxsig = $2 }
20891     if (sig_name[$2]) {
20892         dup_name[ndups] = $1
20893         dup_num[ndups] = $2
20894         ndups++
20895     }
20896     else {
20897         sig_name[$2] = $1
20898         sig_num[$2] = $2
20899     }
20900 }
20901 END {
20902     if (nsig == 0) {
20903         nsig = maxsig + 1
20904     }
20905     printf("NSIG %d\n", nsig);
20906     for (n = 1; n < nsig; n++) {
20907         if (sig_name[n]) {
20908             printf("%s %d\n", sig_name[n], sig_num[n])
20909         }
20910         else {
20911             printf("NUM%d %d\n", n, n)
20912         }
20913     }
20914     for (n = 0; n < ndups; n++) {
20915         printf("%s %d\n", dup_name[n], dup_num[n])
20916     }
20917 }
20918 EOP
20919 $cat >signal_cmd <<EOS
20920 $startsh
20921 if $test -s signal.lst; then
20922     echo "Using your existing signal.lst file"
20923         exit 0
20924 fi
20925 xxx="$xxx"
20926 EOS
20927 $cat >>signal_cmd <<'EOS'
20928
20929 set signal
20930 if eval $compile_ok; then
20931         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) |\
20932                 $uniq | $awk -f signal.awk >signal.lst
20933 else
20934         echo "(I can't seem be able to compile the whole test program)" >&4
20935         echo "(I'll try it in little pieces.)" >&4
20936         set signal -DJUST_NSIG
20937         if eval $compile_ok; then
20938                 $run ./signal$_exe > signal.nsg
20939                 $cat signal.nsg
20940         else
20941                 echo "I can't seem to figure out how many signals you have." >&4
20942                 echo "Guessing 50." >&4
20943                 echo 'NSIG 50' > signal.nsg
20944         fi
20945         : Now look at all the signal names, one at a time.
20946         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20947                 $cat > signal.c <<EOCP
20948 #include <sys/types.h>
20949 #include <signal.h>
20950 #include <stdio.h>
20951 int main() {
20952 printf("$xx %d\n", SIG${xx});
20953 return 0;
20954 }
20955 EOCP
20956                 set signal
20957                 if eval $compile; then
20958                         echo "SIG${xx} found."
20959                         $run ./signal$_exe  >> signal.ls1
20960                 else
20961                         echo "SIG${xx} NOT found."
20962                 fi
20963         done
20964         if $test -s signal.ls1; then
20965                 $cat signal.nsg signal.ls1 |
20966                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20967         fi
20968
20969 fi
20970 if $test -s signal.lst; then
20971         :
20972 else
20973         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20974         echo 'kill -l' >signal
20975         set X `csh -f <signal`
20976         $rm -f signal
20977         shift
20978         case $# in
20979         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20980         esac
20981         echo $@ | $tr ' ' $trnl | \
20982             $awk '{ printf "%s %d\n", $1, ++s; }
20983                   END { printf "NSIG %d\n", ++s }' >signal.lst
20984 fi
20985 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20986 EOS
20987 chmod a+x signal_cmd
20988 $eunicefix signal_cmd
20989
20990 : generate list of signal names
20991 echo " "
20992 case "$sig_name_init" in
20993 '') doinit=yes ;;
20994 *)  case "$sig_num_init" in
20995     ''|*,*) doinit=yes ;;
20996     esac ;;
20997 esac
20998 case "$doinit" in
20999 yes)
21000         echo "Generating a list of signal names and numbers..." >&4
21001         . ./signal_cmd
21002         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
21003         sig_name=`$awk 'BEGIN { printf "ZERO " }
21004                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
21005         sig_num=`$awk  'BEGIN { printf "0 " }
21006                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
21007         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
21008                              !/^NSIG/   { printf "\"%s\", ", $1 }
21009                              END        { printf "0\n" }' signal.lst`
21010         sig_num_init=`$awk  'BEGIN      { printf "0, " }
21011                              !/^NSIG/   { printf "%d, ", $2}
21012                              END        { printf "0\n"}' signal.lst`
21013         ;;
21014 esac
21015 echo "The following $sig_count signals are available:"
21016 echo " "
21017 echo $sig_name | $awk \
21018 'BEGIN { linelen = 0 }
21019 {
21020         for (i = 1; i <= NF; i++) {
21021                 name = "SIG" $i " "
21022                 linelen = linelen + length(name)
21023                 if (linelen > 70) {
21024                         printf "\n"
21025                         linelen = length(name)
21026                 }
21027                 printf "%s", name
21028         }
21029         printf "\n"
21030 }'
21031 sig_size=`echo $sig_name | awk '{print NF}'`
21032 $rm -f signal signal.c signal.awk signal.lst signal_cmd
21033
21034 : Check size of size
21035 echo " "
21036 case "$sizetype" in
21037 *_t) zzz="$sizetype"    ;;
21038 *)   zzz="filesize"     ;;
21039 esac
21040 echo "Checking the size of $zzz..." >&4
21041 cat > try.c <<EOCP
21042 #include <sys/types.h>
21043 #include <stdio.h>
21044 #$i_stdlib I_STDLIB
21045 #ifdef I_STDLIB
21046 #include <stdlib.h>
21047 #endif
21048 int main() {
21049     printf("%d\n", (int)sizeof($sizetype));
21050     exit(0);
21051 }
21052 EOCP
21053 set try
21054 if eval $compile_ok; then
21055         yyy=`$run ./try`
21056         case "$yyy" in
21057         '')     sizesize=4
21058                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
21059                 ;;
21060         *)      sizesize=$yyy
21061                 echo "Your $zzz size is $sizesize bytes."
21062                 ;;
21063         esac
21064 else
21065         sizesize=4
21066         echo "(I can't compile the test program--guessing $sizesize.)" >&4
21067 fi
21068
21069
21070 : check for socklen_t
21071 echo " "
21072 echo "Checking to see if you have socklen_t..." >&4
21073 $cat >try.c <<EOCP
21074 #include <sys/types.h>
21075 #$d_socket HAS_SOCKET
21076 #ifdef HAS_SOCKET
21077 #include <sys/socket.h>
21078 #endif
21079 int main() { socklen_t x = 16; }
21080 EOCP
21081 set try
21082 if eval $compile; then
21083         val="$define"
21084         echo "You have socklen_t."
21085 else
21086         val="$undef"
21087         echo "You do not have socklen_t."
21088         case "$sizetype" in
21089         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
21090         esac
21091 fi
21092 $rm_try
21093 set d_socklen_t
21094 eval $setvar
21095
21096 : see if this is a socks.h system
21097 set socks.h i_socks
21098 eval $inhdr
21099
21100 : check for type of the size argument to socket calls
21101 case "$d_socket" in
21102 "$define")
21103         $cat <<EOM
21104
21105 Checking to see what type is the last argument of accept().
21106 EOM
21107         yyy=''
21108         case "$d_socklen_t" in
21109         "$define") yyy="$yyy socklen_t"
21110         esac
21111         yyy="$yyy $sizetype int long unsigned"
21112         for xxx in $yyy; do
21113                 case "$socksizetype" in
21114                 '')     try="$extern_C int accept(int, struct sockaddr *, $xxx *);"
21115                         case "$usesocks" in
21116                         "$define")
21117                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
21118                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21119                                         socksizetype="$xxx"
21120                                 fi
21121                                 ;;
21122                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
21123                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
21124                                         socksizetype="$xxx"
21125                                 fi
21126                                 ;;
21127                         esac
21128                         ;;
21129                 esac
21130         done
21131 : In case none of those worked, prompt the user.
21132         case "$socksizetype" in
21133         '')     rp='What is the type for socket address structure sizes?'
21134                 dflt='int'
21135                 . ./myread
21136                 socksizetype=$ans
21137                 ;;
21138         esac
21139         ;;
21140 *)      : no sockets, so pick relatively harmless default
21141         socksizetype='int'
21142         ;;
21143 esac
21144
21145 : see what type is used for signed size_t
21146 set ssize_t ssizetype int stdio.h sys/types.h
21147 eval $typedef
21148 dflt="$ssizetype"
21149 $cat > try.c <<EOM
21150 #include <stdio.h>
21151 #$i_stdlib I_STDLIB
21152 #ifdef I_STDLIB
21153 #include <stdlib.h>
21154 #endif
21155 #include <sys/types.h>
21156 #define Size_t $sizetype
21157 #define SSize_t $dflt
21158 int main()
21159 {
21160         if (sizeof(Size_t) == sizeof(SSize_t))
21161                 printf("$dflt\n");
21162         else if (sizeof(Size_t) == sizeof(int))
21163                 printf("int\n");
21164         else
21165                 printf("long\n");
21166         exit(0);
21167 }
21168 EOM
21169 echo " "
21170 set try
21171 if eval $compile_ok && $run ./try > /dev/null; then
21172         ssizetype=`$run ./try`
21173         echo "I'll be using $ssizetype for functions returning a byte count." >&4
21174 else
21175         $cat >&4 <<EOM
21176 Help! I can't compile and run the ssize_t test program: please enlighten me!
21177 (This is probably a misconfiguration in your system or libraries, and
21178 you really ought to fix it.  Still, I'll try anyway.)
21179
21180 I need a type that is the same size as $sizetype, but is guaranteed to
21181 be signed.  Common values are ssize_t, int and long.
21182
21183 EOM
21184         rp="What signed type is the same size as $sizetype?"
21185         . ./myread
21186         ssizetype="$ans"
21187 fi
21188 $rm_try
21189
21190 : Check the size of st_ino
21191 $echo " "
21192 $echo "Checking the size of st_ino..." >&4
21193 $cat > try.c <<EOCP
21194 #include <sys/stat.h>
21195 #include <stdio.h>
21196 #$i_stdlib I_STDLIB
21197 #ifdef I_STDLIB
21198 #include <stdlib.h>
21199 #endif
21200 int main() {
21201     struct stat st;
21202     printf("%d\n", (int)sizeof(st.st_ino));
21203     exit(0);
21204 }
21205 EOCP
21206 set try
21207 if eval $compile_ok; then
21208         val=`$run ./try`
21209         case "$val" in
21210         '')     st_ino_size=4
21211                 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
21212                 ;;
21213         *)      st_ino_size=$val
21214                 $echo "Your st_ino is $st_ino_size bytes long."
21215                 ;;
21216         esac
21217 else
21218         st_ino_size=4
21219         $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
21220 fi
21221 $rm_try
21222
21223 : Check if st_ino is signed
21224 $echo " "
21225 $echo "Checking the sign of st_ino..." >&4
21226 $cat > try.c <<EOCP
21227 #include <sys/stat.h>
21228 #include <stdio.h>
21229 int main() {
21230         struct stat foo;
21231         foo.st_ino = -1;
21232         if (foo.st_ino < 0)
21233                 printf("-1\n");
21234         else
21235                 printf("1\n");
21236 }
21237 EOCP
21238 set try
21239 if eval $compile; then
21240         val=`$run ./try`
21241         case "$val" in
21242         '')     st_ino_sign=1
21243                 $echo "(I can't execute the test program--guessing unsigned.)" >&4
21244                 ;;
21245         *)      st_ino_sign=$val
21246                 case "$st_ino_sign" in
21247                  1) $echo "Your st_ino is unsigned." ;;
21248                 -1) $echo "Your st_ino is signed."   ;;
21249                 esac
21250                 ;;
21251         esac
21252 else
21253         st_ino_sign=1
21254         $echo "(I can't compile the test program--guessing unsigned.)" >&4
21255 fi
21256 $rm_try
21257
21258 : see what type of char stdio uses.
21259 echo " "
21260 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
21261 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
21262         echo "Your stdio uses unsigned chars." >&4
21263         stdchar="unsigned char"
21264 else
21265         echo "Your stdio uses signed chars." >&4
21266         stdchar="char"
21267 fi
21268 $rm -f stdioh
21269
21270 : see what type uids are declared as in the kernel
21271 echo " "
21272 echo "Looking for the type for user ids returned by getuid()."
21273 set uid_t uidtype xxx stdio.h sys/types.h
21274 eval $typedef
21275 case "$uidtype" in
21276 xxx)
21277         xxx=`./findhdr sys/user.h`
21278         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
21279         case $1 in
21280         unsigned) dflt="$1 $2" ;;
21281         *) dflt="$1" ;;
21282         esac
21283         ;;
21284 *) dflt="$uidtype";;
21285 esac
21286 case "$uidtype" in
21287 uid_t)  echo "uid_t found." ;;
21288 *)      rp="What is the type for user ids returned by getuid()?"
21289         . ./myread
21290         uidtype="$ans"
21291         ;;
21292 esac
21293
21294 : Check size of UID
21295 echo " "
21296 case "$uidtype" in
21297 *_t) zzz="$uidtype"     ;;
21298 *)   zzz="uid"          ;;
21299 esac
21300 echo "Checking the size of $zzz..." >&4
21301 cat > try.c <<EOCP
21302 #include <sys/types.h>
21303 #include <stdio.h>
21304 #$i_stdlib I_STDLIB
21305 #ifdef I_STDLIB
21306 #include <stdlib.h>
21307 #endif
21308 int main() {
21309     printf("%d\n", (int)sizeof($uidtype));
21310     exit(0);
21311 }
21312 EOCP
21313 set try
21314 if eval $compile_ok; then
21315         yyy=`$run ./try`
21316         case "$yyy" in
21317         '')     uidsize=4
21318                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
21319                 ;;
21320         *)      uidsize=$yyy
21321                 echo "Your $zzz is $uidsize bytes long."
21322                 ;;
21323         esac
21324 else
21325         uidsize=4
21326         echo "(I can't compile the test program--guessing $uidsize.)" >&4
21327 fi
21328
21329 : Check if UID is signed
21330 echo " "
21331 case "$uidtype" in
21332 *_t) zzz="$uidtype"     ;;
21333 *)   zzz="uid"          ;;
21334 esac
21335 echo "Checking the sign of $zzz..." >&4
21336 cat > try.c <<EOCP
21337 #include <sys/types.h>
21338 #include <stdio.h>
21339 int main() {
21340         $uidtype foo = -1;
21341         if (foo < 0)
21342                 printf("-1\n");
21343         else
21344                 printf("1\n");
21345 }
21346 EOCP
21347 set try
21348 if eval $compile; then
21349         yyy=`$run ./try`
21350         case "$yyy" in
21351         '')     uidsign=1
21352                 echo "(I can't execute the test program--guessing unsigned.)" >&4
21353                 ;;
21354         *)      uidsign=$yyy
21355                 case "$uidsign" in
21356                  1) echo "Your $zzz is unsigned." ;;
21357                 -1) echo "Your $zzz is signed."   ;;
21358                 esac
21359                 ;;
21360         esac
21361 else
21362         uidsign=1
21363         echo "(I can't compile the test program--guessing unsigned.)" >&4
21364 fi
21365
21366
21367 : Check format string for UID
21368 echo " "
21369 $echo "Checking the format string to be used for uids..." >&4
21370
21371 case "$uidsign" in
21372 -1)     if $test X"$uidsize" = X"$ivsize"; then
21373                 uidformat="$ivdformat"
21374         else
21375                 if $test X"$uidsize" = X"$longsize"; then
21376                         uidformat='"ld"'
21377                 else
21378                         if $test X"$uidsize" = X"$intsize"; then
21379                                 uidformat='"d"'
21380                         else
21381                                 if $test X"$uidsize" = X"$shortsize"; then
21382                                         uidformat='"hd"'
21383                                 fi
21384                         fi
21385                 fi
21386         fi
21387         ;;
21388 *)      if $test X"$uidsize" = X"$uvsize"; then
21389                 uidformat="$uvuformat"
21390         else
21391                 if $test X"$uidsize" = X"$longsize"; then
21392                         uidformat='"lu"'
21393                 else
21394                         if $test X"$uidsize" = X"$intsize"; then
21395                                 uidformat='"u"'
21396                         else
21397                                 if $test X"$uidsize" = X"$shortsize"; then
21398                                         uidformat='"hu"'
21399                                 fi
21400                         fi
21401                 fi
21402         fi
21403         ;;
21404 esac
21405
21406 : Determine if we can use sysctl with KERN_PROC_PATHNAME to find executing program
21407 echo " "
21408 echo "Determining whether we can use sysctl with KERN_PROC_PATHNAME to find executing program..." >&4
21409 $cat >try.c <<'EOM'
21410 /* Intentionally a long probe as I'd like to sanity check that the exact
21411    approach is going to work, as thinking it will work, but only having it
21412    part working at runtime is worse than not having it.  */
21413
21414 #include <sys/types.h>
21415 #include <sys/sysctl.h>
21416 #include <sys/param.h>
21417 #include <stdio.h>
21418 #include <string.h>
21419 #include <stdlib.h>
21420 #include <unistd.h>
21421
21422 int
21423 main(int argc, char **argv) {
21424     char *buffer;
21425     char *argv_leaf = strrchr(argv[0], '/');
21426     char *buffer_leaf;
21427     size_t size = 0;
21428     int mib[4];
21429
21430     mib[0] = CTL_KERN;
21431     mib[1] = KERN_PROC;
21432     mib[2] = KERN_PROC_PATHNAME;
21433     mib[3] = -1;
21434
21435     if (!argv_leaf) {
21436         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21437         return 1;
21438     }
21439
21440     if (sysctl(mib, 4, NULL, &size, NULL, 0)) {
21441         perror("sysctl");
21442         return 2;
21443     }
21444
21445     if (size < strlen(argv_leaf) + 1) {
21446         fprintf(stderr, "size %lu is too short for a path\n",
21447                 (unsigned long) size);
21448         return 3;
21449     }
21450
21451     if (size > MAXPATHLEN * MAXPATHLEN) {
21452         fprintf(stderr, "size %lu is too long for a path\n",
21453                 (unsigned long) size);
21454         return 4;
21455     }
21456
21457     buffer = malloc(size);
21458     if (!buffer) {
21459         perror("malloc");
21460         return 5;
21461     }
21462
21463     if (sysctl(mib, 4, buffer, &size, NULL, 0)) {
21464         perror("sysctl");
21465         return 6;
21466     }
21467
21468     if (strlen(buffer) + 1 != size) {
21469         fprintf(stderr, "size != strlen(buffer) + 1 (%lu != %lu)\n",
21470                 (unsigned long)size, (unsigned long)strlen(buffer) + 1);
21471         return 7;
21472     }
21473
21474
21475     if (*buffer != '/') {
21476         fprintf(stderr, "Not an absolute path: '%s'\n", buffer);
21477         return 8;
21478     }
21479
21480     if (strstr(buffer, "/./")) {
21481         fprintf(stderr, "Contains /./: '%s'\n", buffer);
21482         return 9;
21483     }
21484
21485     if (strstr(buffer, "/../")) {
21486         fprintf(stderr, "Contains /../: '%s'\n", buffer);
21487         return 10;
21488     }
21489
21490     buffer_leaf = strrchr(buffer, '/');
21491     if (strcmp(buffer_leaf, argv_leaf) != 0) {
21492         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], buffer);
21493         return 11;
21494     }
21495
21496     free(buffer);
21497
21498     return 0;
21499 }
21500 EOM
21501
21502 val=$undef
21503 set try
21504 if eval $compile_ok; then
21505         if $run ./try; then
21506                 echo "You can use sysctl with KERN_PROC_PATHNAME to find the executing program." >&4
21507                 val="$define"
21508         else
21509                 echo "Nope, sysctl with KERN_PROC_PATHNAME doesn't work here." >&4
21510                 val="$undef"
21511         fi
21512 else
21513         echo "I'm unable to compile the test program." >&4
21514         echo "I'll assume no sysctl with KERN_PROC_PATHNAME here." >&4
21515         val="$undef"
21516 fi
21517 $rm_try
21518 set usekernprocpathname
21519 eval $setvar
21520
21521 : Determine if we can use _NSGetExecutablePath to find executing program
21522 echo " "
21523 echo "Determining whether we can use _NSGetExecutablePath to find executing program..." >&4
21524 $cat >try.c <<'EOM'
21525 /* Intentionally a long probe as I'd like to sanity check that the exact
21526    approach is going to work, as thinking it will work, but only having it
21527    part working at runtime is worse than not having it.  */
21528 #include <mach-o/dyld.h>
21529 #include <stdio.h>
21530 #include <stdlib.h>
21531 #include <sys/param.h>
21532 #include <string.h>
21533
21534 int
21535 main(int argc, char **argv) {
21536     char buf[1];
21537     uint32_t size = sizeof(buf);
21538     int result;
21539     char *buffer;
21540     char *tidied;
21541     char *argv_leaf = strrchr(argv[0], '/');
21542     char *tidied_leaf;
21543
21544     if (!argv_leaf) {
21545         fprintf(stderr, "Can't locate / in '%s'\n", argv[0]);
21546         return 1;
21547     }
21548
21549     _NSGetExecutablePath(buf, &size);
21550     if (size > MAXPATHLEN * MAXPATHLEN) {
21551         fprintf(stderr, "_NSGetExecutablePath size %u is too long for a path\n",
21552                 (unsigned int) size);
21553         return 2;
21554     }
21555
21556     buffer = malloc(size);
21557     if (!buffer) {
21558         perror("malloc");
21559         return 3;
21560     }
21561
21562     result = _NSGetExecutablePath(buffer, &size);
21563     if (result != 0) {
21564         fprintf(stderr, "_NSGetExecutablePath returned %i for a size of %u\n",
21565                 result, (unsigned int) size);
21566         return 4;
21567     }
21568
21569     tidied = realpath(buffer, NULL);
21570     if (!tidied) {
21571         perror("realpath");
21572         return 5;
21573     }
21574
21575     free(buffer);
21576
21577     if (*tidied != '/') {
21578         fprintf(stderr, "Not an absolute path: '%s'\n", tidied);
21579         return 6;
21580     }
21581
21582     if (strstr(tidied, "/./")) {
21583         fprintf(stderr, "Contains /./: '%s'\n", tidied);
21584         return 7;
21585     }
21586
21587     if (strstr(tidied, "/../")) {
21588         fprintf(stderr, "Contains /../: '%s'\n", tidied);
21589         return 8;
21590     }
21591
21592     tidied_leaf = strrchr(tidied, '/');
21593     if (strcmp(tidied_leaf, argv_leaf) != 0) {
21594         fprintf(stderr, "Leafnames differ: '%s' vs '%s'\n", argv[0], tidied);
21595         return 9;
21596     }
21597
21598     free(tidied);
21599
21600     return 0;
21601 }
21602 EOM
21603
21604 val=$undef
21605 set try
21606 if eval $compile_ok; then
21607         if $run ./try; then
21608                 echo "You can use _NSGetExecutablePath to find the executing program." >&4
21609                 val="$define"
21610         else
21611                 echo "Nope, _NSGetExecutablePath doesn't work here." >&4
21612         fi
21613 else
21614         echo "I'm unable to compile the test program." >&4
21615         echo "I'll assume no _NSGetExecutablePath here." >&4
21616 fi
21617 $rm_try
21618 set usensgetexecutablepath
21619 eval $setvar
21620
21621 : Check if site customization support was requested
21622 case "$usesitecustomize" in
21623     $define|true|[Yy]*)
21624         usesitecustomize="$define"
21625         ;;
21626     *)
21627         usesitecustomize="$undef"
21628         ;;
21629     esac
21630
21631 : see if prototypes support variable argument declarations
21632 echo " "
21633 case "$prototype$i_stdarg" in
21634 $define$define)
21635         echo "It appears we'll be able to prototype varargs functions." >&4
21636         val="$define"
21637         ;;
21638 *)
21639         echo "Too bad... We won't be using prototyped varargs functions..." >&4
21640         val="$undef"
21641         ;;
21642 esac
21643 set vaproto
21644 eval $setvar
21645
21646 : determine compiler compiler
21647 case "$yacc" in
21648 '')
21649         dflt=yacc;;
21650 *)
21651         dflt="$yacc";;
21652 esac
21653 echo " "
21654 comp='yacc'
21655 if $test -f "$byacc$_exe"; then
21656         dflt="$byacc"
21657         comp="byacc or $comp"
21658 fi
21659 if $test -f "$bison$_exe"; then
21660         comp="$comp or bison -y"
21661 fi
21662 rp="Which compiler compiler ($comp) shall I use?"
21663 . ./myread
21664 yacc="$ans"
21665 case "$yacc" in
21666 *bis*)
21667         case "$yacc" in
21668         *-y*) ;;
21669         *)
21670                 yacc="$yacc -y"
21671                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
21672                 ;;
21673         esac
21674         ;;
21675 esac
21676
21677 : see if this is a assert.h system
21678 set assert.h i_assert
21679 eval $inhdr
21680
21681 : see if this is a fp.h system
21682 set fp.h i_fp
21683 eval $inhdr
21684
21685 : see if this is a fp_class.h system
21686 set fp_class.h i_fp_class
21687 eval $inhdr
21688
21689 : see if gdbm.h is available
21690 set gdbm.h t_gdbm
21691 eval $inhdr
21692 case "$t_gdbm" in
21693 $define)
21694         : see if gdbm_open exists
21695         set gdbm_open d_gdbm_open
21696         eval $inlibc
21697         case "$d_gdbm_open" in
21698         $undef)
21699                 t_gdbm="$undef"
21700                 echo "We won't be including <gdbm.h>"
21701                 ;;
21702         esac
21703         ;;
21704 esac
21705 val="$t_gdbm"
21706 set i_gdbm
21707 eval $setvar
21708
21709 : see if this is a ieeefp.h system
21710 case "$i_ieeefp" in
21711 '' ) set ieeefp.h i_ieeefp
21712      eval $inhdr
21713      ;;
21714 esac
21715
21716 : see if this is a libutil.h system
21717 set libutil.h i_libutil
21718 eval $inhdr
21719
21720 : see if mach cthreads are available
21721 if test "X$usethreads" = "X$define"; then
21722         set mach/cthreads.h i_machcthr
21723         eval $inhdr
21724 else
21725         i_machcthr="$undef"
21726 fi
21727
21728 : see if this is a mntent.h system
21729 set mntent.h i_mntent
21730 eval $inhdr
21731
21732 : see if net/errno.h is available
21733 val=''
21734 set net/errno.h val
21735 eval $inhdr
21736
21737 : Unfortunately, it causes problems on some systems.  Arrgh.
21738 case "$val" in
21739 $define)
21740         cat > try.c <<'EOM'
21741 #include <stdio.h>
21742 #include <errno.h>
21743 #include <net/errno.h>
21744 int func()
21745 {
21746         return ENOTSOCK;
21747 }
21748 EOM
21749         if $cc $ccflags -c try.c >/dev/null 2>&1; then
21750                 echo "We'll be including <net/errno.h>." >&4
21751         else
21752                 echo "We won't be including <net/errno.h>." >&4
21753                 val="$undef"
21754         fi
21755         $rm_try
21756         ;;
21757 esac
21758 set i_neterrno
21759 eval $setvar
21760
21761 : see if netinet/tcp.h is available
21762 set netinet/tcp.h i_netinettcp
21763 eval $inhdr
21764
21765 : see if this is a poll.h system
21766 set poll.h i_poll
21767 eval $inhdr
21768
21769 : see if this is a prot.h system
21770 set prot.h i_prot
21771 eval $inhdr
21772
21773 : Preprocessor symbols
21774 echo " "
21775 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
21776 $cat <<'EOSH' > Cppsym.know
21777 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
21778 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
21779 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
21780 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
21781 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
21782 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
21783 bull c cadmus clipper CMU COFF COMPILER_VERSION
21784 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
21785 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
21786 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
21787 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
21788 GLIBC GLIBC_MINOR
21789 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
21790 H3050R H3050RX hbullx20 hcx host_mips
21791 hp200 hp300 hp700 HP700 hp800 hp9000
21792 hp9000s200 hp9000s300 hp9000s400 hp9000s500
21793 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
21794 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
21795 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
21796 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
21797 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
21798 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
21799 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
21800 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
21801 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
21802 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
21803 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
21804 MATH_HAS_NO_SIDE_EFFECTS
21805 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
21806 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
21807 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
21808 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
21809 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
21810 NetBSD news1500 news1700 news1800 news1900 news3700
21811 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
21812 ns32016 ns32332 ns32k nsc32000
21813 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
21814 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
21815 pc532 pdp11 PGC PIC plexus PORTAR posix
21816 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
21817 POSIX_C_SOURCE POSIX_SOURCE POWER
21818 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
21819 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
21820 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
21821 sony sony_news sonyrisc sparc sparclite spectrum
21822 stardent stdc STDC_EXT stratos sun sun3 sun386
21823 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
21824 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
21825 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
21826 sysV68 sysV88 Tek4132 Tek4300 titan
21827 TM3200 TM5400 TM5600
21828 tower tower32 tower32_200 tower32_600 tower32_700
21829 tower32_800 tower32_850 tss
21830 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
21831 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
21832 unix UNIX95 UNIX99 unixpc unos
21833 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
21834 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
21835 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
21836 USGr4 USGr4_2
21837 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
21838 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
21839 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
21840 z8000
21841 EOSH
21842 # Maybe put other stuff here too.
21843 cat <<EOSH >>Cppsym.know
21844 $osname
21845 EOSH
21846 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
21847 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
21848 $cat Cppsym.know > Cppsym.c
21849 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
21850 $rm -f Cppsym.a Cppsym.b Cppsym.c
21851 cat <<EOSH > Cppsym
21852 $startsh
21853 if $test \$# -gt 0; then
21854     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
21855     if $test -s Cppsym.got; then
21856         $rm -f Cppsym.got
21857         exit 0
21858     fi
21859     $rm -f Cppsym.got
21860     exit 1
21861 else
21862     $tr " " "$trnl" | ./Cppsym.try
21863     exit 0
21864 fi
21865 EOSH
21866 chmod +x Cppsym
21867 $eunicefix Cppsym
21868 cat <<EOSH > Cppsym.try
21869 $startsh
21870 cat <<'EOCP' > try.c
21871 #include <stdio.h>
21872 #if cpp_stuff == 1
21873 #define STRINGIFY(a)    "a"
21874 #endif
21875 #if cpp_stuff == 42
21876 #define StGiFy(a)  #a
21877 #define STRINGIFY(a)    StGiFy(a)
21878 #endif
21879 #if $cpp_stuff != 1 && $cpp_stuff != 42
21880 #   include "Bletch: How does this C preprocessor stringify macros?"
21881 #endif
21882 int main() {
21883 EOCP
21884 $awk \\
21885 EOSH
21886 cat <<'EOSH' >> Cppsym.try
21887 'length($1) > 0 {
21888     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
21889     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
21890     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
21891     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
21892 }'       >> try.c
21893 echo 'return 0;}' >> try.c
21894 EOSH
21895 cat <<EOSH >> Cppsym.try
21896 ccflags="$ccflags"
21897 case "$osname-$gccversion" in
21898 irix-) ccflags="\$ccflags -woff 1178" ;;
21899 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
21900 esac
21901 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
21902 EOSH
21903 chmod +x Cppsym.try
21904 $eunicefix Cppsym.try
21905 ./Cppsym < Cppsym.know > Cppsym.true
21906 : Add in any linux cpp "predefined macros":
21907 case "$osname::$gccversion" in
21908   *linux*::*.*|*gnukfreebsd*::*.*|gnu::*.*)
21909     tHdrH=_tmpHdr
21910     rm -f $tHdrH'.h' $tHdrH
21911     touch $tHdrH'.h'
21912     if $cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
21913        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
21914        if [ -s $tHdrH'_cppsym.real' ]; then
21915           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
21916        fi
21917     fi
21918     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
21919   ;;
21920 esac
21921 : now check the C compiler for additional symbols
21922 postprocess_cc_v=''
21923 case "$osname" in
21924 aix) postprocess_cc_v="|$tr , ' '" ;;
21925 esac
21926 $cat >ccsym <<EOS
21927 $startsh
21928 $cat >tmp.c <<EOF
21929 extern int foo;
21930 EOF
21931 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
21932 do
21933         case "\$i" in
21934         -D*) echo "\$i" | $sed 's/^-D//';;
21935         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
21936         esac
21937 done
21938 $rm_try
21939 EOS
21940 postprocess_cc_v=''
21941 chmod +x ccsym
21942 $eunicefix ccsym
21943 ./ccsym > ccsym1.raw
21944 if $test -s ccsym1.raw; then
21945        $sort ccsym1.raw | $uniq >ccsym.raw
21946 else
21947        mv ccsym1.raw ccsym.raw
21948 fi
21949
21950 $awk '/\=/ { print $0; next }
21951         { print $0"=1" }' ccsym.raw >ccsym.list
21952 $comm -13 Cppsym.true ccsym.list >ccsym.own
21953 $comm -12 Cppsym.true ccsym.list >ccsym.com
21954 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
21955 also=''
21956 if $test -z ccsym.raw; then
21957         echo "Your C compiler doesn't seem to define any symbols!" >&4
21958         echo " "
21959         echo "However, your C preprocessor defines the following symbols:"
21960         $cat Cppsym.true
21961         ccsymbols=''
21962         cppsymbols=`$cat Cppsym.true`
21963         cppsymbols=`echo $cppsymbols`
21964         cppccsymbols="$cppsymbols"
21965 else
21966         if $test -s ccsym.com; then
21967                 echo "Your C compiler and pre-processor define these symbols:"
21968                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
21969                 also='also '
21970                 symbols='ones'
21971                 cppccsymbols=`$cat ccsym.com`
21972                 cppccsymbols=`echo $cppccsymbols`
21973                 $test "$silent" || sleep 1
21974         fi
21975         if $test -s ccsym.cpp; then
21976                 $test "$also" && echo " "
21977                 echo "Your C pre-processor ${also}defines the following symbols:"
21978                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
21979                 also='further '
21980                 cppsymbols=`$cat ccsym.cpp`
21981                 cppsymbols=`echo $cppsymbols`
21982                 $test "$silent" || sleep 1
21983         fi
21984         if $test -s ccsym.own; then
21985                 $test "$also" && echo " "
21986                 echo "Your C compiler ${also}defines the following cpp symbols:"
21987                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
21988                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
21989                 ccsymbols=`$cat ccsym.own`
21990                 ccsymbols=`echo $ccsymbols`
21991                 $test "$silent" || sleep 1
21992         fi
21993 fi
21994
21995 : see if this is a termio system
21996 val="$undef"
21997 val2="$undef"
21998 val3="$undef"
21999 if $test `./findhdr termios.h`; then
22000         set tcsetattr i_termios
22001         eval $inlibc
22002         val3="$i_termios"
22003 fi
22004 echo " "
22005 case "$val3" in
22006 "$define") echo "You have POSIX termios.h... good!" >&4;;
22007 *) if ./Cppsym pyr; then
22008                 case "`/bin/universe`" in
22009                 ucb) if $test `./findhdr sgtty.h`; then
22010                                 val2="$define"
22011                                 echo "<sgtty.h> found." >&4
22012                         else
22013                                 echo "System is pyramid with BSD universe."
22014                                 ./warn "<sgtty.h> not found--you could have problems."
22015                         fi;;
22016                 *) if $test `./findhdr termio.h`; then
22017                                 val="$define"
22018                                 echo "<termio.h> found." >&4
22019                         else
22020                                 echo "System is pyramid with USG universe."
22021                                 ./warn "<termio.h> not found--you could have problems."
22022                         fi;;
22023                 esac
22024         elif ./usg; then
22025                 if $test `./findhdr termio.h`; then
22026                         echo "<termio.h> found." >&4
22027                         val="$define"
22028                 elif $test `./findhdr sgtty.h`; then
22029                         echo "<sgtty.h> found." >&4
22030                         val2="$define"
22031                 else
22032                         ./warn "Neither <termio.h> nor <sgtty.h> found--cross fingers!"
22033                 fi
22034         else
22035                 if $test `./findhdr sgtty.h`; then
22036                         echo "<sgtty.h> found." >&4
22037                         val2="$define"
22038                 elif $test `./findhdr termio.h`; then
22039                         echo "<termio.h> found." >&4
22040                         val="$define"
22041                 else
22042                         ./warn "Neither <sgtty.h> nor <termio.h> found--cross fingers!"
22043                 fi
22044         fi;;
22045 esac
22046 set i_termio; eval $setvar
22047 val=$val2; set i_sgtty; eval $setvar
22048 val=$val3; set i_termios; eval $setvar
22049
22050 : see if stdbool is available
22051 : we want a real compile instead of Inhdr because some Solaris systems
22052 : have stdbool.h, but it can only be used if the compiler indicates it
22053 : is sufficiently c99-compliant.
22054 echo " "
22055 $cat >try.c <<EOCP
22056 #include <stdio.h>
22057 #include <stdbool.h>
22058 int func(bool x)
22059 {
22060     return x ? 1 : 0;
22061 }
22062 int main(int argc, char **argv)
22063 {
22064     return func(0);
22065 }
22066 EOCP
22067 set try
22068 if eval $compile; then
22069         echo "<stdbool.h> found." >&4
22070         val="$define"
22071 else
22072         echo "<stdbool.h> NOT found." >&4
22073         val="$undef"
22074 fi
22075 $rm_try
22076 set i_stdbool
22077 eval $setvar
22078
22079 : see if stddef is available
22080 set stddef.h i_stddef
22081 eval $inhdr
22082
22083 : see if sys/access.h is available
22084 set sys/access.h i_sysaccess
22085 eval $inhdr
22086
22087 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
22088 set sys/filio.h i_sysfilio
22089 eval $inhdr
22090 echo " "
22091 if $test `./findhdr sys/ioctl.h`; then
22092         val="$define"
22093         echo '<sys/ioctl.h> found.' >&4
22094 else
22095         val="$undef"
22096         if $test $i_sysfilio = "$define"; then
22097             echo '<sys/ioctl.h> NOT found.' >&4
22098         else
22099                 $test $i_sgtty = "$define" && xxx="sgtty.h"
22100                 $test $i_termio = "$define" && xxx="termio.h"
22101                 $test $i_termios = "$define" && xxx="termios.h"
22102 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
22103         fi
22104 fi
22105 set i_sysioctl
22106 eval $setvar
22107
22108 : see if socket ioctl defs are in sys/sockio.h
22109 echo " "
22110 xxx=`./findhdr sys/sockio.h`
22111 if $test "$xxx"; then
22112         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
22113                 val="$define"
22114                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
22115         else
22116                 val="$undef"
22117                 echo "No socket ioctls found in <sys/sockio.h>." >&4
22118         fi
22119 else
22120         val="$undef"
22121         $cat <<EOM
22122 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
22123 EOM
22124 fi
22125 set i_syssockio
22126 eval $setvar
22127
22128 : see if this is a syslog.h system
22129 set syslog.h i_syslog
22130 eval $inhdr
22131
22132 : see if this is a sys/mode.h system
22133 set sys/mode.h i_sysmode
22134 eval $inhdr
22135
22136 : see if there is a sys/poll.h file
22137 set sys/poll.h i_syspoll
22138 eval $inhdr
22139
22140 : see if sys/resource.h has to be included
22141 set sys/resource.h i_sysresrc
22142 eval $inhdr
22143
22144 : see if sys/security.h is available
22145 set sys/security.h i_syssecrt
22146 eval $inhdr
22147
22148 : see if this is a sys/statvfs.h system
22149 set sys/statvfs.h i_sysstatvfs
22150 eval $inhdr
22151
22152 : see if this is a sys/un.h system
22153 set sys/un.h i_sysun
22154 eval $inhdr
22155
22156 : see if this is a sys/utsname.h system
22157 set sys/utsname.h i_sysutsname
22158 eval $inhdr
22159
22160 : see if this is a syswait system
22161 set sys/wait.h i_syswait
22162 eval $inhdr
22163
22164 : see if this is a ustat.h system
22165 set ustat.h i_ustat
22166 eval $inhdr
22167
22168 : see if this is an utime system
22169 set utime.h i_utime
22170 eval $inhdr
22171
22172 : see if this is a vfork system
22173 case "$d_vfork" in
22174 "$define")
22175         set vfork.h i_vfork
22176         eval $inhdr
22177         ;;
22178 *)
22179         i_vfork="$undef"
22180         ;;
22181 esac
22182
22183 : Check extensions
22184 echo " "
22185 echo "Looking for extensions..." >&4
22186 : If we are using the old config.sh, known_extensions may contain
22187 : old or inaccurate or duplicate values.
22188 known_extensions=''
22189 nonxs_extensions=''
22190 : We do not use find because it might not be available.
22191 : We do not just use MANIFEST because the user may have dropped
22192 : some additional extensions into the source tree and expect them
22193 : to be built.
22194
22195 : Function to recursively find available extensions, ignoring DynaLoader
22196 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
22197 : In 5.10.1 and later, extensions are stored in directories
22198 : like File-Glob instead of the older File/Glob/.
22199 find_extensions='
22200     for xxx in *; do
22201         case "$xxx" in
22202             DynaLoader|dynaload) ;;
22203             *)
22204             this_ext=`echo $xxx | $sed -e s/-/\\\//g`;
22205             leaf=`echo $xxx | $sed -e s/.*-//`;
22206             if $test -d File; then
22207                 if $test -f $xxx/$leaf.xs -o -f $xxx/$leaf.c; then
22208                     known_extensions="$known_extensions $1$this_ext";
22209                 elif $test -f $xxx/Makefile.PL; then
22210                     nonxs_extensions="$nonxs_extensions $1$this_ext";
22211                 else
22212                     if $test -d $xxx -a $# -lt 10; then
22213                         set $1$xxx/ $*;
22214                         cd "$xxx";
22215                         eval $find_extensions;
22216                         cd ..;
22217                         shift;
22218                     fi;
22219                 fi;
22220             else
22221                 echo " $known_extensions $nonxs_extensions" > $$.tmp;
22222                 if $contains " $this_ext " $$.tmp; then
22223                     echo >&4;
22224                     echo "Duplicate directories detected for extension $xxx" >&4;
22225                     echo "Configure cannot correctly recover from this - shall I abort?" >&4;
22226                     case "$knowitall" in
22227                     "") dflt=y;;
22228                     *) dflt=n;;
22229                     esac;
22230                     . ../UU/myread;
22231                     case "$ans" in
22232                     n*|N*) ;;
22233                     *) echo >&4;
22234                        echo "Ok.  Stopping Configure." >&4;
22235                        echo "Please remove the duplicate directory (eg using git clean) and then re-run Configure" >&4;
22236                         exit 1;;
22237                     esac;
22238                     echo "Ok.  You will need to correct config.sh before running make." >&4;
22239                 fi;
22240                 $ls -1 $xxx > $$.tmp;
22241                 if   $contains "\.xs$" $$.tmp > /dev/null 2>&1; then
22242                     known_extensions="$known_extensions $this_ext";
22243                 elif $contains "\.c$"  $$.tmp > /dev/null 2>&1; then
22244                     known_extensions="$known_extensions $this_ext";
22245                 elif $test -d $xxx; then
22246                     nonxs_extensions="$nonxs_extensions $this_ext";
22247                 fi;
22248                 $rm -f $$.tmp;
22249             fi
22250             ;;
22251         esac;
22252     done'
22253 tdir=`pwd`
22254 cd "$rsrc/cpan"
22255 set X
22256 shift
22257 eval $find_extensions
22258 cd "$rsrc/dist"
22259 set X
22260 shift
22261 eval $find_extensions
22262 cd "$rsrc/ext"
22263 set X
22264 shift
22265 eval $find_extensions
22266 if $test -d File-Glob; then
22267     : All ext/ flattened
22268 else
22269     # Special case:  Add in modules that nest beyond the first level.
22270     # Currently threads/shared and Hash/Util/FieldHash, since they are
22271     # not picked up by the recursive find above (and adding in general
22272     # recursive finding breaks SDBM_File/sdbm).
22273     # A.D. 20011025 (SDBM), ajgough 20071008 (FieldHash)
22274     known_extensions="$known_extensions threads/shared Hash/Util/FieldHash"
22275 fi
22276 set X $known_extensions
22277 shift
22278 known_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22279 set X $nonxs_extensions
22280 shift
22281 nonxs_extensions=`echo "$*" | tr ' ' $trnl | $sort | tr $trnl ' '`
22282 cd "$tdir"
22283
22284 : Now see which are supported on this system.
22285 avail_ext=''
22286 for xxx in $known_extensions ; do
22287         case "$xxx" in
22288         DB_File|db_file)
22289                 case "$i_db" in
22290                 $define) avail_ext="$avail_ext $xxx" ;;
22291                 esac
22292                 ;;
22293         GDBM_File|gdbm_fil)
22294                 case "$i_gdbm" in
22295                 $define) avail_ext="$avail_ext $xxx" ;;
22296                 esac
22297                 ;;
22298         I18N/Langinfo|i18n_lan)
22299                 case "$i_langinfo$d_nl_langinfo" in
22300                 $define$define) avail_ext="$avail_ext $xxx" ;;
22301                 esac
22302                 ;;
22303         IPC/SysV|ipc/sysv)
22304                 : XXX Do we need a useipcsysv variable here
22305                 case "${d_msg}${d_sem}${d_shm}" in
22306                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
22307                 esac
22308                 ;;
22309         NDBM_File|ndbm_fil)
22310                 case "$d_ndbm" in
22311                 $define)
22312                     case "$osname-$use64bitint" in
22313                     hpux-define)
22314                         case "$libs" in
22315                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
22316                         esac
22317                         ;;
22318                     *) avail_ext="$avail_ext $xxx" ;;
22319                     esac
22320                     ;;
22321                 esac
22322                 ;;
22323         ODBM_File|odbm_fil)
22324                 case "${i_dbm}${i_rpcsvcdbm}" in
22325                 *"${define}"*)
22326                     case "$d_cplusplus" in
22327                     define) ;; # delete as a function name will not work
22328                     *)  case "$osname-$use64bitint" in
22329                         hpux-define)
22330                             case "$libs" in
22331                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
22332                             esac
22333                             ;;
22334                         *) avail_ext="$avail_ext $xxx" ;;
22335                         esac
22336                         ;;
22337                     esac
22338                     ;;
22339                 esac
22340                 ;;
22341         Opcode|opcode)
22342                 case "$useopcode" in
22343                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22344                 esac
22345                 ;;
22346         POSIX|posix)
22347                 case "$useposix" in
22348                 true|define|y) avail_ext="$avail_ext $xxx" ;;
22349                 esac
22350                 ;;
22351         Socket|socket)
22352                 case "$d_socket" in
22353                 true|$define|y)
22354                     case "$osname" in
22355                     beos) ;; # not unless BONE
22356                     *) avail_ext="$avail_ext $xxx" ;;
22357                     esac
22358                     ;;
22359                 esac
22360                 ;;
22361         Sys/Syslog|sys/syslog)
22362                 : XXX syslog requires socket
22363                 case "$d_socket" in
22364                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
22365                 esac
22366                 ;;
22367         Thread|thread)
22368                 case "$usethreads" in
22369                 true|$define|y)
22370                         case "$use5005threads" in
22371                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
22372                         esac
22373                 esac
22374                 ;;
22375         threads|threads/shared)
22376                 # threads and threads::shared are special cases.
22377                 # To stop people from asking "Perl 5.8.0 was supposed
22378                 # to have this new fancy threads implementation but my
22379                 # perl doesn't have it" and from people trying to
22380                 # (re)install the threads module using CPAN.pm and
22381                 # CPAN.pm then offering to reinstall Perl 5.8.0,
22382                 # the threads.pm and threads/shared.pm will always be
22383                 # there, croaking informatively ("you need to rebuild
22384                 # all of Perl with threads, sorry") when threads haven't
22385                 # been compiled in.
22386                 # --jhi
22387                 avail_ext="$avail_ext $xxx"
22388                 ;;
22389         VMS*)
22390                 ;;
22391         Win32*)
22392                 case "$osname" in
22393                 cygwin) avail_ext="$avail_ext $xxx" ;;
22394                 esac
22395                 ;;
22396         XS/APItest|xs/apitest)
22397                 # This is just for testing.  Skip it unless we have dynamic loading.
22398
22399                 case "$usedl" in
22400                 $define) avail_ext="$avail_ext $xxx" ;;
22401                 esac
22402                 ;;
22403         XS/Typemap|xs/typemap)
22404                 # This is just for testing.  Skip it unless we have dynamic loading.
22405                 case "$usedl" in
22406                 $define) avail_ext="$avail_ext $xxx" ;;
22407                 esac
22408                 ;;
22409         *)      avail_ext="$avail_ext $xxx"
22410                 ;;
22411         esac
22412 done
22413
22414 set X $avail_ext
22415 shift
22416 avail_ext="$*"
22417
22418 case "$onlyextensions" in
22419 '') ;;
22420 *)  keepextensions=''
22421     echo "You have requested that only certain extensions be included..." >&4
22422     for i in $onlyextensions; do
22423         case " $avail_ext " in
22424         *" $i "*)
22425             echo "Keeping extension $i."
22426             keepextensions="$keepextensions $i"
22427             ;;
22428         *) echo "Ignoring extension $i." ;;
22429         esac
22430     done
22431     avail_ext="$keepextensions"
22432     ;;
22433 esac
22434
22435 case "$noextensions" in
22436 '') ;;
22437 *)  keepextensions=''
22438     echo "You have requested that certain extensions be ignored..." >&4
22439     for i in $avail_ext; do
22440         case " $noextensions " in
22441         *" $i "*) echo "Ignoring extension $i." ;;
22442         *) echo "Keeping extension $i.";
22443            keepextensions="$keepextensions $i"
22444            ;;
22445         esac
22446     done
22447     avail_ext="$keepextensions"
22448     ;;
22449 esac
22450
22451 : Now see which nonxs extensions are supported on this system.
22452 : For now assume all are.
22453 nonxs_ext=''
22454 for xxx in $nonxs_extensions ; do
22455         case "$xxx" in
22456         *)      nonxs_ext="$nonxs_ext $xxx"
22457                 ;;
22458         esac
22459 done
22460
22461 set X $nonxs_ext
22462 shift
22463 nonxs_ext="$*"
22464
22465 case $usedl in
22466 $define)
22467         $cat <<EOM
22468 A number of extensions are supplied with $package.  You may choose to
22469 compile these extensions for dynamic loading (the default), compile
22470 them into the $package executable (static loading), or not include
22471 them at all.  Answer "none" to include no extensions.
22472 Note that DynaLoader is always built and need not be mentioned here.
22473
22474 EOM
22475         case "$dynamic_ext" in
22476         '')
22477                 : Exclude those listed in static_ext
22478                 dflt=''
22479                 for xxx in $avail_ext; do
22480                         case " $static_ext " in
22481                         *" $xxx "*) ;;
22482                         *) dflt="$dflt $xxx" ;;
22483                         esac
22484                 done
22485                 set X $dflt
22486                 shift
22487                 dflt="$*"
22488                 ;;
22489         *)      dflt="$dynamic_ext"
22490                 # Perhaps we are reusing an old out-of-date config.sh.
22491                 case "$hint" in
22492                 previous)
22493                         if test X"$dynamic_ext" != X"$avail_ext"; then
22494                                 $cat <<EOM
22495 NOTICE:  Your previous config.sh list may be incorrect.
22496 The extensions now available to you are
22497         ${avail_ext}
22498 but the default list from your previous config.sh is
22499         ${dynamic_ext}
22500
22501 EOM
22502                         fi
22503                         ;;
22504                 esac
22505                 ;;
22506         esac
22507         case "$dflt" in
22508         '')     dflt=none;;
22509         esac
22510         rp="What extensions do you wish to load dynamically?"
22511         . ./myread
22512         case "$ans" in
22513         none) dynamic_ext=' ' ;;
22514         *) dynamic_ext="$ans" ;;
22515         esac
22516
22517         case "$static_ext" in
22518         '')
22519                 : Exclude those already listed in dynamic linking
22520                 dflt=''
22521                 for xxx in $avail_ext; do
22522                         case " $dynamic_ext " in
22523                         *" $xxx "*) ;;
22524                         *) dflt="$dflt $xxx" ;;
22525                         esac
22526                 done
22527                 set X $dflt
22528                 shift
22529                 dflt="$*"
22530                 ;;
22531         *)  dflt="$static_ext"
22532                 ;;
22533         esac
22534
22535         case "$dflt" in
22536         '')     dflt=none;;
22537         esac
22538         rp="What extensions do you wish to load statically?"
22539         . ./myread
22540         case "$ans" in
22541         none) static_ext=' ' ;;
22542         *) static_ext="$ans" ;;
22543         esac
22544         ;;
22545 *)
22546         $cat <<EOM
22547 A number of extensions are supplied with $package.  Answer "none"
22548 to include no extensions.
22549 Note that DynaLoader is always built and need not be mentioned here.
22550
22551 EOM
22552         case "$static_ext" in
22553         '') dflt="$avail_ext" ;;
22554         *)      dflt="$static_ext"
22555                 # Perhaps we are reusing an old out-of-date config.sh.
22556                 case "$hint" in
22557                 previous)
22558                         if test X"$static_ext" != X"$avail_ext"; then
22559                                 $cat <<EOM
22560 NOTICE:  Your previous config.sh list may be incorrect.
22561 The extensions now available to you are
22562         ${avail_ext}
22563 but the default list from your previous config.sh is
22564         ${static_ext}
22565
22566 EOM
22567                         fi
22568                         ;;
22569                 esac
22570                 ;;
22571         esac
22572         : Exclude those that are not xs extensions
22573         case "$dflt" in
22574         '')     dflt=none;;
22575         esac
22576         rp="What extensions do you wish to include?"
22577         . ./myread
22578         case "$ans" in
22579         none) static_ext=' ' ;;
22580         *) static_ext="$ans" ;;
22581         esac
22582         ;;
22583 esac
22584 #
22585 # Encode is a special case.  If we are building Encode as a static
22586 # extension, we need to explicitly list its subextensions as well.
22587 # For other nested extensions, this is handled automatically by
22588 # the appropriate Makefile.PL.
22589 case " $static_ext " in
22590         *" Encode "*) # Add the subextensions of Encode
22591         cd "$rsrc/cpan"
22592         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
22593                 static_ext="$static_ext Encode/$xxx"
22594         done
22595         cd "$tdir"
22596         ;;
22597 esac
22598
22599 set X $dynamic_ext $static_ext $nonxs_ext
22600 shift
22601 extensions="$*"
22602
22603 # Sanity check:  We require an extension suitable for use with
22604 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
22605 # should show up as failures in the test suite, but it's helpful to
22606 # catch them now.) The 'extensions' list is normally sorted
22607 # alphabetically, so we need to accept either
22608 #    DB_File ... Fcntl ... IO  ....
22609 # or something like
22610 #    Fcntl ... NDBM_File ... IO  ....
22611 case " $extensions"  in
22612 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
22613 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
22614 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
22615 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
22616    echo "WARNING: The Perl you are building will be quite crippled." >& 4
22617    ;;
22618 esac
22619
22620 : Remove libraries needed only for extensions
22621 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
22622 : The exception is SunOS 4.x, which needs them.
22623 case "${osname}X${osvers}" in
22624 sunos*X4*)
22625     perllibs="$libs"
22626     ;;
22627 *) case "$usedl" in
22628     $define|true|[yY]*)
22629             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -lgdbm_compat @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
22630             shift
22631             perllibs="$*"
22632             ;;
22633     *)  perllibs="$libs"
22634             ;;
22635     esac
22636     ;;
22637 esac
22638
22639 : Remove build directory name from cppstdin so it can be used from
22640 : either the present location or the final installed location.
22641 echo " "
22642 : Get out of the UU directory to get correct path name.
22643 cd ..
22644 case "$cppstdin" in
22645 `pwd`/cppstdin)
22646         echo "Stripping down cppstdin path name"
22647         cppstdin=cppstdin
22648         ;;
22649 esac
22650 cd UU
22651
22652 : end of configuration questions
22653 echo " "
22654 echo "End of configuration questions."
22655 echo " "
22656
22657 : back to where it started
22658 if test -d ../UU; then
22659         cd ..
22660 fi
22661
22662 : configuration may be unconditionally patched via a 'config.arch' file
22663 if $test -f config.arch; then
22664         echo "I see a config.arch file, loading it." >&4
22665         . ./config.arch
22666 fi
22667
22668 : configuration may be patched via a 'config.over' file
22669 if $test -f config.over; then
22670         echo " "
22671         dflt=y
22672         rp='I see a config.over file.  Do you wish to load it?'
22673         . UU/myread
22674         case "$ans" in
22675         n*) echo "OK, I'll ignore it.";;
22676         *)      . ./config.over
22677                 echo "Configuration override changes have been loaded."
22678                 ;;
22679         esac
22680 fi
22681
22682 : in case they want portability, strip down executable paths
22683 case "$d_portable" in
22684 "$define")
22685         echo " "
22686         echo "Stripping down executable paths..." >&4
22687         for file in $loclist $trylist; do
22688                 eval temp=\$$file
22689                 eval $file=`basename $temp`
22690         done
22691         ;;
22692 esac
22693
22694 : create config.sh file
22695 echo " "
22696 echo "Creating config.sh..." >&4
22697 $spitshell <<EOT >config.sh
22698 $startsh
22699 #
22700 # This file was produced by running the Configure script. It holds all the
22701 # definitions figured out by Configure. Should you modify one of these values,
22702 # do not forget to propagate your changes by running "Configure -der". You may
22703 # instead choose to run each of the .SH files by yourself, or "Configure -S".
22704 #
22705
22706 # Package name      : $package
22707 # Source directory  : $src
22708 # Configuration time: $cf_time
22709 # Configured by     : $cf_by
22710 # Target system     : $myuname
22711
22712 EOT
22713 : Add in command line options if available
22714 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22715
22716 $spitshell <<EOT >>config.sh
22717
22718 Author='$Author'
22719 Date='$Date'
22720 Header='$Header'
22721 Id='$Id'
22722 Locker='$Locker'
22723 Log='$Log'
22724 RCSfile='$RCSfile'
22725 Revision='$Revision'
22726 Source='$Source'
22727 State='$State'
22728 _a='$_a'
22729 _exe='$_exe'
22730 _o='$_o'
22731 afs='$afs'
22732 afsroot='$afsroot'
22733 alignbytes='$alignbytes'
22734 ansi2knr='$ansi2knr'
22735 aphostname='$aphostname'
22736 api_revision='$api_revision'
22737 api_subversion='$api_subversion'
22738 api_version='$api_version'
22739 api_versionstring='$api_versionstring'
22740 ar='$ar'
22741 archlib='$archlib'
22742 archlibexp='$archlibexp'
22743 archname64='$archname64'
22744 archname='$archname'
22745 archobjs='$archobjs'
22746 asctime_r_proto='$asctime_r_proto'
22747 awk='$awk'
22748 baserev='$baserev'
22749 bash='$bash'
22750 bin='$bin'
22751 bin_ELF='$bin_ELF'
22752 binexp='$binexp'
22753 bison='$bison'
22754 byacc='$byacc'
22755 byteorder='$byteorder'
22756 c='$c'
22757 castflags='$castflags'
22758 cat='$cat'
22759 cc='$cc'
22760 cccdlflags='$cccdlflags'
22761 ccdlflags='$ccdlflags'
22762 ccflags='$ccflags'
22763 ccflags_uselargefiles='$ccflags_uselargefiles'
22764 ccname='$ccname'
22765 ccsymbols='$ccsymbols'
22766 ccversion='$ccversion'
22767 cf_by='$cf_by'
22768 cf_email='$cf_email'
22769 cf_time='$cf_time'
22770 charbits='$charbits'
22771 charsize='$charsize'
22772 chgrp='$chgrp'
22773 chmod='$chmod'
22774 chown='$chown'
22775 clocktype='$clocktype'
22776 comm='$comm'
22777 compress='$compress'
22778 contains='$contains'
22779 cp='$cp'
22780 cpio='$cpio'
22781 cpp='$cpp'
22782 cpp_stuff='$cpp_stuff'
22783 cppccsymbols='$cppccsymbols'
22784 cppflags='$cppflags'
22785 cpplast='$cpplast'
22786 cppminus='$cppminus'
22787 cpprun='$cpprun'
22788 cppstdin='$cppstdin'
22789 cppsymbols='$cppsymbols'
22790 crypt_r_proto='$crypt_r_proto'
22791 cryptlib='$cryptlib'
22792 csh='$csh'
22793 ctermid_r_proto='$ctermid_r_proto'
22794 ctime_r_proto='$ctime_r_proto'
22795 d_Gconvert='$d_Gconvert'
22796 d_PRIEUldbl='$d_PRIEUldbl'
22797 d_PRIFUldbl='$d_PRIFUldbl'
22798 d_PRIGUldbl='$d_PRIGUldbl'
22799 d_PRIXU64='$d_PRIXU64'
22800 d_PRId64='$d_PRId64'
22801 d_PRIeldbl='$d_PRIeldbl'
22802 d_PRIfldbl='$d_PRIfldbl'
22803 d_PRIgldbl='$d_PRIgldbl'
22804 d_PRIi64='$d_PRIi64'
22805 d_PRIo64='$d_PRIo64'
22806 d_PRIu64='$d_PRIu64'
22807 d_PRIx64='$d_PRIx64'
22808 d_SCNfldbl='$d_SCNfldbl'
22809 d__fwalk='$d__fwalk'
22810 d_access='$d_access'
22811 d_accessx='$d_accessx'
22812 d_aintl='$d_aintl'
22813 d_alarm='$d_alarm'
22814 d_archlib='$d_archlib'
22815 d_asctime64='$d_asctime64'
22816 d_asctime_r='$d_asctime_r'
22817 d_atolf='$d_atolf'
22818 d_atoll='$d_atoll'
22819 d_attribute_deprecated='$d_attribute_deprecated'
22820 d_attribute_format='$d_attribute_format'
22821 d_attribute_malloc='$d_attribute_malloc'
22822 d_attribute_nonnull='$d_attribute_nonnull'
22823 d_attribute_noreturn='$d_attribute_noreturn'
22824 d_attribute_pure='$d_attribute_pure'
22825 d_attribute_unused='$d_attribute_unused'
22826 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
22827 d_bcmp='$d_bcmp'
22828 d_bcopy='$d_bcopy'
22829 d_bsd='$d_bsd'
22830 d_bsdgetpgrp='$d_bsdgetpgrp'
22831 d_bsdsetpgrp='$d_bsdsetpgrp'
22832 d_builtin_choose_expr='$d_builtin_choose_expr'
22833 d_builtin_expect='$d_builtin_expect'
22834 d_bzero='$d_bzero'
22835 d_c99_variadic_macros='$d_c99_variadic_macros'
22836 d_casti32='$d_casti32'
22837 d_castneg='$d_castneg'
22838 d_charvspr='$d_charvspr'
22839 d_chown='$d_chown'
22840 d_chroot='$d_chroot'
22841 d_chsize='$d_chsize'
22842 d_class='$d_class'
22843 d_clearenv='$d_clearenv'
22844 d_closedir='$d_closedir'
22845 d_cmsghdr_s='$d_cmsghdr_s'
22846 d_const='$d_const'
22847 d_copysignl='$d_copysignl'
22848 d_cplusplus='$d_cplusplus'
22849 d_crypt='$d_crypt'
22850 d_crypt_r='$d_crypt_r'
22851 d_csh='$d_csh'
22852 d_ctermid='$d_ctermid'
22853 d_ctermid_r='$d_ctermid_r'
22854 d_ctime64='$d_ctime64'
22855 d_ctime_r='$d_ctime_r'
22856 d_cuserid='$d_cuserid'
22857 d_dbl_dig='$d_dbl_dig'
22858 d_dbminitproto='$d_dbminitproto'
22859 d_difftime64='$d_difftime64'
22860 d_difftime='$d_difftime'
22861 d_dir_dd_fd='$d_dir_dd_fd'
22862 d_dirfd='$d_dirfd'
22863 d_dirnamlen='$d_dirnamlen'
22864 d_dlerror='$d_dlerror'
22865 d_dlopen='$d_dlopen'
22866 d_dlsymun='$d_dlsymun'
22867 d_dosuid='$d_dosuid'
22868 d_drand48_r='$d_drand48_r'
22869 d_drand48proto='$d_drand48proto'
22870 d_dup2='$d_dup2'
22871 d_eaccess='$d_eaccess'
22872 d_endgrent='$d_endgrent'
22873 d_endgrent_r='$d_endgrent_r'
22874 d_endhent='$d_endhent'
22875 d_endhostent_r='$d_endhostent_r'
22876 d_endnent='$d_endnent'
22877 d_endnetent_r='$d_endnetent_r'
22878 d_endpent='$d_endpent'
22879 d_endprotoent_r='$d_endprotoent_r'
22880 d_endpwent='$d_endpwent'
22881 d_endpwent_r='$d_endpwent_r'
22882 d_endsent='$d_endsent'
22883 d_endservent_r='$d_endservent_r'
22884 d_eofnblk='$d_eofnblk'
22885 d_eunice='$d_eunice'
22886 d_faststdio='$d_faststdio'
22887 d_fchdir='$d_fchdir'
22888 d_fchmod='$d_fchmod'
22889 d_fchown='$d_fchown'
22890 d_fcntl='$d_fcntl'
22891 d_fcntl_can_lock='$d_fcntl_can_lock'
22892 d_fd_macros='$d_fd_macros'
22893 d_fd_set='$d_fd_set'
22894 d_fds_bits='$d_fds_bits'
22895 d_fgetpos='$d_fgetpos'
22896 d_finite='$d_finite'
22897 d_finitel='$d_finitel'
22898 d_flexfnam='$d_flexfnam'
22899 d_flock='$d_flock'
22900 d_flockproto='$d_flockproto'
22901 d_fork='$d_fork'
22902 d_fp_class='$d_fp_class'
22903 d_fpathconf='$d_fpathconf'
22904 d_fpclass='$d_fpclass'
22905 d_fpclassify='$d_fpclassify'
22906 d_fpclassl='$d_fpclassl'
22907 d_fpos64_t='$d_fpos64_t'
22908 d_frexpl='$d_frexpl'
22909 d_fs_data_s='$d_fs_data_s'
22910 d_fseeko='$d_fseeko'
22911 d_fsetpos='$d_fsetpos'
22912 d_fstatfs='$d_fstatfs'
22913 d_fstatvfs='$d_fstatvfs'
22914 d_fsync='$d_fsync'
22915 d_ftello='$d_ftello'
22916 d_ftime='$d_ftime'
22917 d_futimes='$d_futimes'
22918 d_gdbm_ndbm_h_uses_prototypes='$d_gdbm_ndbm_h_uses_prototypes'
22919 d_gdbmndbm_h_uses_prototypes='$d_gdbmndbm_h_uses_prototypes'
22920 d_getaddrinfo='$d_getaddrinfo'
22921 d_getcwd='$d_getcwd'
22922 d_getespwnam='$d_getespwnam'
22923 d_getfsstat='$d_getfsstat'
22924 d_getgrent='$d_getgrent'
22925 d_getgrent_r='$d_getgrent_r'
22926 d_getgrgid_r='$d_getgrgid_r'
22927 d_getgrnam_r='$d_getgrnam_r'
22928 d_getgrps='$d_getgrps'
22929 d_gethbyaddr='$d_gethbyaddr'
22930 d_gethbyname='$d_gethbyname'
22931 d_gethent='$d_gethent'
22932 d_gethname='$d_gethname'
22933 d_gethostbyaddr_r='$d_gethostbyaddr_r'
22934 d_gethostbyname_r='$d_gethostbyname_r'
22935 d_gethostent_r='$d_gethostent_r'
22936 d_gethostprotos='$d_gethostprotos'
22937 d_getitimer='$d_getitimer'
22938 d_getlogin='$d_getlogin'
22939 d_getlogin_r='$d_getlogin_r'
22940 d_getmnt='$d_getmnt'
22941 d_getmntent='$d_getmntent'
22942 d_getnameinfo='$d_getnameinfo'
22943 d_getnbyaddr='$d_getnbyaddr'
22944 d_getnbyname='$d_getnbyname'
22945 d_getnent='$d_getnent'
22946 d_getnetbyaddr_r='$d_getnetbyaddr_r'
22947 d_getnetbyname_r='$d_getnetbyname_r'
22948 d_getnetent_r='$d_getnetent_r'
22949 d_getnetprotos='$d_getnetprotos'
22950 d_getpagsz='$d_getpagsz'
22951 d_getpbyname='$d_getpbyname'
22952 d_getpbynumber='$d_getpbynumber'
22953 d_getpent='$d_getpent'
22954 d_getpgid='$d_getpgid'
22955 d_getpgrp2='$d_getpgrp2'
22956 d_getpgrp='$d_getpgrp'
22957 d_getppid='$d_getppid'
22958 d_getprior='$d_getprior'
22959 d_getprotobyname_r='$d_getprotobyname_r'
22960 d_getprotobynumber_r='$d_getprotobynumber_r'
22961 d_getprotoent_r='$d_getprotoent_r'
22962 d_getprotoprotos='$d_getprotoprotos'
22963 d_getprpwnam='$d_getprpwnam'
22964 d_getpwent='$d_getpwent'
22965 d_getpwent_r='$d_getpwent_r'
22966 d_getpwnam_r='$d_getpwnam_r'
22967 d_getpwuid_r='$d_getpwuid_r'
22968 d_getsbyname='$d_getsbyname'
22969 d_getsbyport='$d_getsbyport'
22970 d_getsent='$d_getsent'
22971 d_getservbyname_r='$d_getservbyname_r'
22972 d_getservbyport_r='$d_getservbyport_r'
22973 d_getservent_r='$d_getservent_r'
22974 d_getservprotos='$d_getservprotos'
22975 d_getspnam='$d_getspnam'
22976 d_getspnam_r='$d_getspnam_r'
22977 d_gettimeod='$d_gettimeod'
22978 d_gmtime64='$d_gmtime64'
22979 d_gmtime_r='$d_gmtime_r'
22980 d_gnulibc='$d_gnulibc'
22981 d_grpasswd='$d_grpasswd'
22982 d_hasmntopt='$d_hasmntopt'
22983 d_htonl='$d_htonl'
22984 d_ilogbl='$d_ilogbl'
22985 d_inc_version_list='$d_inc_version_list'
22986 d_index='$d_index'
22987 d_inetaton='$d_inetaton'
22988 d_inetntop='$d_inetntop'
22989 d_inetpton='$d_inetpton'
22990 d_int64_t='$d_int64_t'
22991 d_ipv6_mreq='$d_ipv6_mreq'
22992 d_isascii='$d_isascii'
22993 d_isblank='$d_isblank'
22994 d_isfinite='$d_isfinite'
22995 d_isinf='$d_isinf'
22996 d_isnan='$d_isnan'
22997 d_isnanl='$d_isnanl'
22998 d_killpg='$d_killpg'
22999 d_lchown='$d_lchown'
23000 d_ldbl_dig='$d_ldbl_dig'
23001 d_libm_lib_version='$d_libm_lib_version'
23002 d_link='$d_link'
23003 d_localtime64='$d_localtime64'
23004 d_localtime_r='$d_localtime_r'
23005 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
23006 d_locconv='$d_locconv'
23007 d_lockf='$d_lockf'
23008 d_longdbl='$d_longdbl'
23009 d_longlong='$d_longlong'
23010 d_lseekproto='$d_lseekproto'
23011 d_lstat='$d_lstat'
23012 d_madvise='$d_madvise'
23013 d_malloc_good_size='$d_malloc_good_size'
23014 d_malloc_size='$d_malloc_size'
23015 d_mblen='$d_mblen'
23016 d_mbstowcs='$d_mbstowcs'
23017 d_mbtowc='$d_mbtowc'
23018 d_memchr='$d_memchr'
23019 d_memcmp='$d_memcmp'
23020 d_memcpy='$d_memcpy'
23021 d_memmove='$d_memmove'
23022 d_memset='$d_memset'
23023 d_mkdir='$d_mkdir'
23024 d_mkdtemp='$d_mkdtemp'
23025 d_mkfifo='$d_mkfifo'
23026 d_mkstemp='$d_mkstemp'
23027 d_mkstemps='$d_mkstemps'
23028 d_mktime64='$d_mktime64'
23029 d_mktime='$d_mktime'
23030 d_mmap='$d_mmap'
23031 d_modfl='$d_modfl'
23032 d_modfl_pow32_bug='$d_modfl_pow32_bug'
23033 d_modflproto='$d_modflproto'
23034 d_mprotect='$d_mprotect'
23035 d_msg='$d_msg'
23036 d_msg_ctrunc='$d_msg_ctrunc'
23037 d_msg_dontroute='$d_msg_dontroute'
23038 d_msg_oob='$d_msg_oob'
23039 d_msg_peek='$d_msg_peek'
23040 d_msg_proxy='$d_msg_proxy'
23041 d_msgctl='$d_msgctl'
23042 d_msgget='$d_msgget'
23043 d_msghdr_s='$d_msghdr_s'
23044 d_msgrcv='$d_msgrcv'
23045 d_msgsnd='$d_msgsnd'
23046 d_msync='$d_msync'
23047 d_munmap='$d_munmap'
23048 d_mymalloc='$d_mymalloc'
23049 d_ndbm='$d_ndbm'
23050 d_ndbm_h_uses_prototypes='$d_ndbm_h_uses_prototypes'
23051 d_nice='$d_nice'
23052 d_nl_langinfo='$d_nl_langinfo'
23053 d_nv_preserves_uv='$d_nv_preserves_uv'
23054 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
23055 d_off64_t='$d_off64_t'
23056 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
23057 d_oldpthreads='$d_oldpthreads'
23058 d_oldsock='$d_oldsock'
23059 d_open3='$d_open3'
23060 d_pathconf='$d_pathconf'
23061 d_pause='$d_pause'
23062 d_perl_otherlibdirs='$d_perl_otherlibdirs'
23063 d_phostname='$d_phostname'
23064 d_pipe='$d_pipe'
23065 d_poll='$d_poll'
23066 d_portable='$d_portable'
23067 d_prctl='$d_prctl'
23068 d_prctl_set_name='$d_prctl_set_name'
23069 d_printf_format_null='$d_printf_format_null'
23070 d_procselfexe='$d_procselfexe'
23071 d_pseudofork='$d_pseudofork'
23072 d_pthread_atfork='$d_pthread_atfork'
23073 d_pthread_attr_setscope='$d_pthread_attr_setscope'
23074 d_pthread_yield='$d_pthread_yield'
23075 d_pwage='$d_pwage'
23076 d_pwchange='$d_pwchange'
23077 d_pwclass='$d_pwclass'
23078 d_pwcomment='$d_pwcomment'
23079 d_pwexpire='$d_pwexpire'
23080 d_pwgecos='$d_pwgecos'
23081 d_pwpasswd='$d_pwpasswd'
23082 d_pwquota='$d_pwquota'
23083 d_qgcvt='$d_qgcvt'
23084 d_quad='$d_quad'
23085 d_random_r='$d_random_r'
23086 d_readdir64_r='$d_readdir64_r'
23087 d_readdir='$d_readdir'
23088 d_readdir_r='$d_readdir_r'
23089 d_readlink='$d_readlink'
23090 d_readv='$d_readv'
23091 d_recvmsg='$d_recvmsg'
23092 d_rename='$d_rename'
23093 d_rewinddir='$d_rewinddir'
23094 d_rmdir='$d_rmdir'
23095 d_safebcpy='$d_safebcpy'
23096 d_safemcpy='$d_safemcpy'
23097 d_sanemcmp='$d_sanemcmp'
23098 d_sbrkproto='$d_sbrkproto'
23099 d_scalbnl='$d_scalbnl'
23100 d_sched_yield='$d_sched_yield'
23101 d_scm_rights='$d_scm_rights'
23102 d_seekdir='$d_seekdir'
23103 d_select='$d_select'
23104 d_sem='$d_sem'
23105 d_semctl='$d_semctl'
23106 d_semctl_semid_ds='$d_semctl_semid_ds'
23107 d_semctl_semun='$d_semctl_semun'
23108 d_semget='$d_semget'
23109 d_semop='$d_semop'
23110 d_sendmsg='$d_sendmsg'
23111 d_setegid='$d_setegid'
23112 d_seteuid='$d_seteuid'
23113 d_setgrent='$d_setgrent'
23114 d_setgrent_r='$d_setgrent_r'
23115 d_setgrps='$d_setgrps'
23116 d_sethent='$d_sethent'
23117 d_sethostent_r='$d_sethostent_r'
23118 d_setitimer='$d_setitimer'
23119 d_setlinebuf='$d_setlinebuf'
23120 d_setlocale='$d_setlocale'
23121 d_setlocale_r='$d_setlocale_r'
23122 d_setnent='$d_setnent'
23123 d_setnetent_r='$d_setnetent_r'
23124 d_setpent='$d_setpent'
23125 d_setpgid='$d_setpgid'
23126 d_setpgrp2='$d_setpgrp2'
23127 d_setpgrp='$d_setpgrp'
23128 d_setprior='$d_setprior'
23129 d_setproctitle='$d_setproctitle'
23130 d_setprotoent_r='$d_setprotoent_r'
23131 d_setpwent='$d_setpwent'
23132 d_setpwent_r='$d_setpwent_r'
23133 d_setregid='$d_setregid'
23134 d_setresgid='$d_setresgid'
23135 d_setresuid='$d_setresuid'
23136 d_setreuid='$d_setreuid'
23137 d_setrgid='$d_setrgid'
23138 d_setruid='$d_setruid'
23139 d_setsent='$d_setsent'
23140 d_setservent_r='$d_setservent_r'
23141 d_setsid='$d_setsid'
23142 d_setvbuf='$d_setvbuf'
23143 d_sfio='$d_sfio'
23144 d_shm='$d_shm'
23145 d_shmat='$d_shmat'
23146 d_shmatprototype='$d_shmatprototype'
23147 d_shmctl='$d_shmctl'
23148 d_shmdt='$d_shmdt'
23149 d_shmget='$d_shmget'
23150 d_sigaction='$d_sigaction'
23151 d_signbit='$d_signbit'
23152 d_sigprocmask='$d_sigprocmask'
23153 d_sigsetjmp='$d_sigsetjmp'
23154 d_sin6_scope_id='$d_sin6_scope_id'
23155 d_sitearch='$d_sitearch'
23156 d_snprintf='$d_snprintf'
23157 d_sockaddr_in6='$d_sockaddr_in6'
23158 d_sockaddr_sa_len='$d_sockaddr_sa_len'
23159 d_sockatmark='$d_sockatmark'
23160 d_sockatmarkproto='$d_sockatmarkproto'
23161 d_socket='$d_socket'
23162 d_socklen_t='$d_socklen_t'
23163 d_sockpair='$d_sockpair'
23164 d_socks5_init='$d_socks5_init'
23165 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
23166 d_sqrtl='$d_sqrtl'
23167 d_srand48_r='$d_srand48_r'
23168 d_srandom_r='$d_srandom_r'
23169 d_sresgproto='$d_sresgproto'
23170 d_sresuproto='$d_sresuproto'
23171 d_statblks='$d_statblks'
23172 d_statfs_f_flags='$d_statfs_f_flags'
23173 d_statfs_s='$d_statfs_s'
23174 d_static_inline='$d_static_inline'
23175 d_statvfs='$d_statvfs'
23176 d_stdio_cnt_lval='$d_stdio_cnt_lval'
23177 d_stdio_ptr_lval='$d_stdio_ptr_lval'
23178 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
23179 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
23180 d_stdio_stream_array='$d_stdio_stream_array'
23181 d_stdiobase='$d_stdiobase'
23182 d_stdstdio='$d_stdstdio'
23183 d_strchr='$d_strchr'
23184 d_strcoll='$d_strcoll'
23185 d_strctcpy='$d_strctcpy'
23186 d_strerrm='$d_strerrm'
23187 d_strerror='$d_strerror'
23188 d_strerror_r='$d_strerror_r'
23189 d_strftime='$d_strftime'
23190 d_strlcat='$d_strlcat'
23191 d_strlcpy='$d_strlcpy'
23192 d_strtod='$d_strtod'
23193 d_strtol='$d_strtol'
23194 d_strtold='$d_strtold'
23195 d_strtoll='$d_strtoll'
23196 d_strtoq='$d_strtoq'
23197 d_strtoul='$d_strtoul'
23198 d_strtoull='$d_strtoull'
23199 d_strtouq='$d_strtouq'
23200 d_strxfrm='$d_strxfrm'
23201 d_suidsafe='$d_suidsafe'
23202 d_symlink='$d_symlink'
23203 d_syscall='$d_syscall'
23204 d_syscallproto='$d_syscallproto'
23205 d_sysconf='$d_sysconf'
23206 d_sysernlst='$d_sysernlst'
23207 d_syserrlst='$d_syserrlst'
23208 d_system='$d_system'
23209 d_tcgetpgrp='$d_tcgetpgrp'
23210 d_tcsetpgrp='$d_tcsetpgrp'
23211 d_telldir='$d_telldir'
23212 d_telldirproto='$d_telldirproto'
23213 d_time='$d_time'
23214 d_timegm='$d_timegm'
23215 d_times='$d_times'
23216 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
23217 d_tm_tm_zone='$d_tm_tm_zone'
23218 d_tmpnam_r='$d_tmpnam_r'
23219 d_truncate='$d_truncate'
23220 d_ttyname_r='$d_ttyname_r'
23221 d_tzname='$d_tzname'
23222 d_u32align='$d_u32align'
23223 d_ualarm='$d_ualarm'
23224 d_umask='$d_umask'
23225 d_uname='$d_uname'
23226 d_union_semun='$d_union_semun'
23227 d_unordered='$d_unordered'
23228 d_unsetenv='$d_unsetenv'
23229 d_usleep='$d_usleep'
23230 d_usleepproto='$d_usleepproto'
23231 d_ustat='$d_ustat'
23232 d_vendorarch='$d_vendorarch'
23233 d_vendorbin='$d_vendorbin'
23234 d_vendorlib='$d_vendorlib'
23235 d_vendorscript='$d_vendorscript'
23236 d_vfork='$d_vfork'
23237 d_void_closedir='$d_void_closedir'
23238 d_voidsig='$d_voidsig'
23239 d_voidtty='$d_voidtty'
23240 d_volatile='$d_volatile'
23241 d_vprintf='$d_vprintf'
23242 d_vsnprintf='$d_vsnprintf'
23243 d_wait4='$d_wait4'
23244 d_waitpid='$d_waitpid'
23245 d_wcstombs='$d_wcstombs'
23246 d_wctomb='$d_wctomb'
23247 d_writev='$d_writev'
23248 d_xenix='$d_xenix'
23249 date='$date'
23250 db_hashtype='$db_hashtype'
23251 db_prefixtype='$db_prefixtype'
23252 db_version_major='$db_version_major'
23253 db_version_minor='$db_version_minor'
23254 db_version_patch='$db_version_patch'
23255 defvoidused='$defvoidused'
23256 direntrytype='$direntrytype'
23257 dlext='$dlext'
23258 dlsrc='$dlsrc'
23259 doublesize='$doublesize'
23260 drand01='$drand01'
23261 drand48_r_proto='$drand48_r_proto'
23262 dtrace='$dtrace'
23263 dynamic_ext='$dynamic_ext'
23264 eagain='$eagain'
23265 ebcdic='$ebcdic'
23266 echo='$echo'
23267 egrep='$egrep'
23268 emacs='$emacs'
23269 endgrent_r_proto='$endgrent_r_proto'
23270 endhostent_r_proto='$endhostent_r_proto'
23271 endnetent_r_proto='$endnetent_r_proto'
23272 endprotoent_r_proto='$endprotoent_r_proto'
23273 endpwent_r_proto='$endpwent_r_proto'
23274 endservent_r_proto='$endservent_r_proto'
23275 eunicefix='$eunicefix'
23276 exe_ext='$exe_ext'
23277 expr='$expr'
23278 extensions='$extensions'
23279 extern_C='$extern_C'
23280 extras='$extras'
23281 fflushNULL='$fflushNULL'
23282 fflushall='$fflushall'
23283 find='$find'
23284 firstmakefile='$firstmakefile'
23285 flex='$flex'
23286 fpossize='$fpossize'
23287 fpostype='$fpostype'
23288 freetype='$freetype'
23289 from='$from'
23290 full_ar='$full_ar'
23291 full_csh='$full_csh'
23292 full_sed='$full_sed'
23293 gccansipedantic='$gccansipedantic'
23294 gccosandvers='$gccosandvers'
23295 gccversion='$gccversion'
23296 getgrent_r_proto='$getgrent_r_proto'
23297 getgrgid_r_proto='$getgrgid_r_proto'
23298 getgrnam_r_proto='$getgrnam_r_proto'
23299 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
23300 gethostbyname_r_proto='$gethostbyname_r_proto'
23301 gethostent_r_proto='$gethostent_r_proto'
23302 getlogin_r_proto='$getlogin_r_proto'
23303 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
23304 getnetbyname_r_proto='$getnetbyname_r_proto'
23305 getnetent_r_proto='$getnetent_r_proto'
23306 getprotobyname_r_proto='$getprotobyname_r_proto'
23307 getprotobynumber_r_proto='$getprotobynumber_r_proto'
23308 getprotoent_r_proto='$getprotoent_r_proto'
23309 getpwent_r_proto='$getpwent_r_proto'
23310 getpwnam_r_proto='$getpwnam_r_proto'
23311 getpwuid_r_proto='$getpwuid_r_proto'
23312 getservbyname_r_proto='$getservbyname_r_proto'
23313 getservbyport_r_proto='$getservbyport_r_proto'
23314 getservent_r_proto='$getservent_r_proto'
23315 getspnam_r_proto='$getspnam_r_proto'
23316 gidformat='$gidformat'
23317 gidsign='$gidsign'
23318 gidsize='$gidsize'
23319 gidtype='$gidtype'
23320 glibpth='$glibpth'
23321 gmake='$gmake'
23322 gmtime_r_proto='$gmtime_r_proto'
23323 gnulibc_version='$gnulibc_version'
23324 grep='$grep'
23325 groupcat='$groupcat'
23326 groupstype='$groupstype'
23327 gzip='$gzip'
23328 h_fcntl='$h_fcntl'
23329 h_sysfile='$h_sysfile'
23330 hint='$hint'
23331 hostcat='$hostcat'
23332 html1dir='$html1dir'
23333 html1direxp='$html1direxp'
23334 html3dir='$html3dir'
23335 html3direxp='$html3direxp'
23336 i16size='$i16size'
23337 i16type='$i16type'
23338 i32size='$i32size'
23339 i32type='$i32type'
23340 i64size='$i64size'
23341 i64type='$i64type'
23342 i8size='$i8size'
23343 i8type='$i8type'
23344 i_arpainet='$i_arpainet'
23345 i_assert='$i_assert'
23346 i_bsdioctl='$i_bsdioctl'
23347 i_crypt='$i_crypt'
23348 i_db='$i_db'
23349 i_dbm='$i_dbm'
23350 i_dirent='$i_dirent'
23351 i_dld='$i_dld'
23352 i_dlfcn='$i_dlfcn'
23353 i_fcntl='$i_fcntl'
23354 i_float='$i_float'
23355 i_fp='$i_fp'
23356 i_fp_class='$i_fp_class'
23357 i_gdbm='$i_gdbm'
23358 i_gdbm_ndbm='$i_gdbm_ndbm'
23359 i_gdbmndbm='$i_gdbmndbm'
23360 i_grp='$i_grp'
23361 i_ieeefp='$i_ieeefp'
23362 i_inttypes='$i_inttypes'
23363 i_langinfo='$i_langinfo'
23364 i_libutil='$i_libutil'
23365 i_limits='$i_limits'
23366 i_locale='$i_locale'
23367 i_machcthr='$i_machcthr'
23368 i_malloc='$i_malloc'
23369 i_mallocmalloc='$i_mallocmalloc'
23370 i_math='$i_math'
23371 i_memory='$i_memory'
23372 i_mntent='$i_mntent'
23373 i_ndbm='$i_ndbm'
23374 i_netdb='$i_netdb'
23375 i_neterrno='$i_neterrno'
23376 i_netinettcp='$i_netinettcp'
23377 i_niin='$i_niin'
23378 i_poll='$i_poll'
23379 i_prot='$i_prot'
23380 i_pthread='$i_pthread'
23381 i_pwd='$i_pwd'
23382 i_rpcsvcdbm='$i_rpcsvcdbm'
23383 i_sfio='$i_sfio'
23384 i_sgtty='$i_sgtty'
23385 i_shadow='$i_shadow'
23386 i_socks='$i_socks'
23387 i_stdarg='$i_stdarg'
23388 i_stdbool='$i_stdbool'
23389 i_stddef='$i_stddef'
23390 i_stdlib='$i_stdlib'
23391 i_string='$i_string'
23392 i_sunmath='$i_sunmath'
23393 i_sysaccess='$i_sysaccess'
23394 i_sysdir='$i_sysdir'
23395 i_sysfile='$i_sysfile'
23396 i_sysfilio='$i_sysfilio'
23397 i_sysin='$i_sysin'
23398 i_sysioctl='$i_sysioctl'
23399 i_syslog='$i_syslog'
23400 i_sysmman='$i_sysmman'
23401 i_sysmode='$i_sysmode'
23402 i_sysmount='$i_sysmount'
23403 i_sysndir='$i_sysndir'
23404 i_sysparam='$i_sysparam'
23405 i_syspoll='$i_syspoll'
23406 i_sysresrc='$i_sysresrc'
23407 i_syssecrt='$i_syssecrt'
23408 i_sysselct='$i_sysselct'
23409 i_syssockio='$i_syssockio'
23410 i_sysstat='$i_sysstat'
23411 i_sysstatfs='$i_sysstatfs'
23412 i_sysstatvfs='$i_sysstatvfs'
23413 i_systime='$i_systime'
23414 i_systimek='$i_systimek'
23415 i_systimes='$i_systimes'
23416 i_systypes='$i_systypes'
23417 i_sysuio='$i_sysuio'
23418 i_sysun='$i_sysun'
23419 i_sysutsname='$i_sysutsname'
23420 i_sysvfs='$i_sysvfs'
23421 i_syswait='$i_syswait'
23422 i_termio='$i_termio'
23423 i_termios='$i_termios'
23424 i_time='$i_time'
23425 i_unistd='$i_unistd'
23426 i_ustat='$i_ustat'
23427 i_utime='$i_utime'
23428 i_values='$i_values'
23429 i_varargs='$i_varargs'
23430 i_varhdr='$i_varhdr'
23431 i_vfork='$i_vfork'
23432 ignore_versioned_solibs='$ignore_versioned_solibs'
23433 inc_version_list='$inc_version_list'
23434 inc_version_list_init='$inc_version_list_init'
23435 incpath='$incpath'
23436 inews='$inews'
23437 initialinstalllocation='$initialinstalllocation'
23438 installarchlib='$installarchlib'
23439 installbin='$installbin'
23440 installhtml1dir='$installhtml1dir'
23441 installhtml3dir='$installhtml3dir'
23442 installman1dir='$installman1dir'
23443 installman3dir='$installman3dir'
23444 installprefix='$installprefix'
23445 installprefixexp='$installprefixexp'
23446 installprivlib='$installprivlib'
23447 installscript='$installscript'
23448 installsitearch='$installsitearch'
23449 installsitebin='$installsitebin'
23450 installsitehtml1dir='$installsitehtml1dir'
23451 installsitehtml3dir='$installsitehtml3dir'
23452 installsitelib='$installsitelib'
23453 installsiteman1dir='$installsiteman1dir'
23454 installsiteman3dir='$installsiteman3dir'
23455 installsitescript='$installsitescript'
23456 installstyle='$installstyle'
23457 installusrbinperl='$installusrbinperl'
23458 installvendorarch='$installvendorarch'
23459 installvendorbin='$installvendorbin'
23460 installvendorhtml1dir='$installvendorhtml1dir'
23461 installvendorhtml3dir='$installvendorhtml3dir'
23462 installvendorlib='$installvendorlib'
23463 installvendorman1dir='$installvendorman1dir'
23464 installvendorman3dir='$installvendorman3dir'
23465 installvendorscript='$installvendorscript'
23466 intsize='$intsize'
23467 issymlink='$issymlink'
23468 ivdformat='$ivdformat'
23469 ivsize='$ivsize'
23470 ivtype='$ivtype'
23471 known_extensions='$known_extensions'
23472 ksh='$ksh'
23473 ld='$ld'
23474 lddlflags='$lddlflags'
23475 ldflags='$ldflags'
23476 ldflags_uselargefiles='$ldflags_uselargefiles'
23477 ldlibpthname='$ldlibpthname'
23478 less='$less'
23479 lib_ext='$lib_ext'
23480 libc='$libc'
23481 libperl='$libperl'
23482 libpth='$libpth'
23483 libs='$libs'
23484 libsdirs='$libsdirs'
23485 libsfiles='$libsfiles'
23486 libsfound='$libsfound'
23487 libspath='$libspath'
23488 libswanted='$libswanted'
23489 libswanted_uselargefiles='$libswanted_uselargefiles'
23490 line='$line'
23491 lint='$lint'
23492 lkflags='$lkflags'
23493 ln='$ln'
23494 lns='$lns'
23495 localtime_r_proto='$localtime_r_proto'
23496 locincpth='$locincpth'
23497 loclibpth='$loclibpth'
23498 longdblsize='$longdblsize'
23499 longlongsize='$longlongsize'
23500 longsize='$longsize'
23501 lp='$lp'
23502 lpr='$lpr'
23503 ls='$ls'
23504 lseeksize='$lseeksize'
23505 lseektype='$lseektype'
23506 mad='$mad'
23507 madlyh='$madlyh'
23508 madlyobj='$madlyobj'
23509 madlysrc='$madlysrc'
23510 mail='$mail'
23511 mailx='$mailx'
23512 make='$make'
23513 make_set_make='$make_set_make'
23514 mallocobj='$mallocobj'
23515 mallocsrc='$mallocsrc'
23516 malloctype='$malloctype'
23517 man1dir='$man1dir'
23518 man1direxp='$man1direxp'
23519 man1ext='$man1ext'
23520 man3dir='$man3dir'
23521 man3direxp='$man3direxp'
23522 man3ext='$man3ext'
23523 mips_type='$mips_type'
23524 mistrustnm='$mistrustnm'
23525 mkdir='$mkdir'
23526 mmaptype='$mmaptype'
23527 modetype='$modetype'
23528 more='$more'
23529 multiarch='$multiarch'
23530 mv='$mv'
23531 myarchname='$myarchname'
23532 mydomain='$mydomain'
23533 myhostname='$myhostname'
23534 myuname='$myuname'
23535 n='$n'
23536 need_va_copy='$need_va_copy'
23537 netdb_hlen_type='$netdb_hlen_type'
23538 netdb_host_type='$netdb_host_type'
23539 netdb_name_type='$netdb_name_type'
23540 netdb_net_type='$netdb_net_type'
23541 nm='$nm'
23542 nm_opt='$nm_opt'
23543 nm_so_opt='$nm_so_opt'
23544 nonxs_ext='$nonxs_ext'
23545 nroff='$nroff'
23546 nvEUformat='$nvEUformat'
23547 nvFUformat='$nvFUformat'
23548 nvGUformat='$nvGUformat'
23549 nv_overflows_integers_at='$nv_overflows_integers_at'
23550 nv_preserves_uv_bits='$nv_preserves_uv_bits'
23551 nveformat='$nveformat'
23552 nvfformat='$nvfformat'
23553 nvgformat='$nvgformat'
23554 nvsize='$nvsize'
23555 nvtype='$nvtype'
23556 o_nonblock='$o_nonblock'
23557 obj_ext='$obj_ext'
23558 old_pthread_create_joinable='$old_pthread_create_joinable'
23559 optimize='$optimize'
23560 orderlib='$orderlib'
23561 osname='$osname'
23562 osvers='$osvers'
23563 otherlibdirs='$otherlibdirs'
23564 package='$package'
23565 pager='$pager'
23566 passcat='$passcat'
23567 patchlevel='$patchlevel'
23568 path_sep='$path_sep'
23569 perl5='$perl5'
23570 perl='$perl'
23571 perl_patchlevel='$perl_patchlevel'
23572 perl_static_inline='$perl_static_inline'
23573 perladmin='$perladmin'
23574 perllibs='$perllibs'
23575 perlpath='$perlpath'
23576 pg='$pg'
23577 phostname='$phostname'
23578 pidtype='$pidtype'
23579 plibpth='$plibpth'
23580 pmake='$pmake'
23581 pr='$pr'
23582 prefix='$prefix'
23583 prefixexp='$prefixexp'
23584 privlib='$privlib'
23585 privlibexp='$privlibexp'
23586 procselfexe='$procselfexe'
23587 prototype='$prototype'
23588 ptrsize='$ptrsize'
23589 quadkind='$quadkind'
23590 quadtype='$quadtype'
23591 randbits='$randbits'
23592 randfunc='$randfunc'
23593 random_r_proto='$random_r_proto'
23594 randseedtype='$randseedtype'
23595 ranlib='$ranlib'
23596 rd_nodata='$rd_nodata'
23597 readdir64_r_proto='$readdir64_r_proto'
23598 readdir_r_proto='$readdir_r_proto'
23599 revision='$revision'
23600 rm='$rm'
23601 rm_try='$rm_try'
23602 rmail='$rmail'
23603 run='$run'
23604 runnm='$runnm'
23605 sGMTIME_max='$sGMTIME_max'
23606 sGMTIME_min='$sGMTIME_min'
23607 sLOCALTIME_max='$sLOCALTIME_max'
23608 sLOCALTIME_min='$sLOCALTIME_min'
23609 sPRIEUldbl='$sPRIEUldbl'
23610 sPRIFUldbl='$sPRIFUldbl'
23611 sPRIGUldbl='$sPRIGUldbl'
23612 sPRIXU64='$sPRIXU64'
23613 sPRId64='$sPRId64'
23614 sPRIeldbl='$sPRIeldbl'
23615 sPRIfldbl='$sPRIfldbl'
23616 sPRIgldbl='$sPRIgldbl'
23617 sPRIi64='$sPRIi64'
23618 sPRIo64='$sPRIo64'
23619 sPRIu64='$sPRIu64'
23620 sPRIx64='$sPRIx64'
23621 sSCNfldbl='$sSCNfldbl'
23622 sched_yield='$sched_yield'
23623 scriptdir='$scriptdir'
23624 scriptdirexp='$scriptdirexp'
23625 sed='$sed'
23626 seedfunc='$seedfunc'
23627 selectminbits='$selectminbits'
23628 selecttype='$selecttype'
23629 sendmail='$sendmail'
23630 setgrent_r_proto='$setgrent_r_proto'
23631 sethostent_r_proto='$sethostent_r_proto'
23632 setlocale_r_proto='$setlocale_r_proto'
23633 setnetent_r_proto='$setnetent_r_proto'
23634 setprotoent_r_proto='$setprotoent_r_proto'
23635 setpwent_r_proto='$setpwent_r_proto'
23636 setservent_r_proto='$setservent_r_proto'
23637 sh='$sh'
23638 shar='$shar'
23639 sharpbang='$sharpbang'
23640 shmattype='$shmattype'
23641 shortsize='$shortsize'
23642 shrpenv='$shrpenv'
23643 shsharp='$shsharp'
23644 sig_count='$sig_count'
23645 sig_name='$sig_name'
23646 sig_name_init='$sig_name_init'
23647 sig_num='$sig_num'
23648 sig_num_init='$sig_num_init'
23649 sig_size='$sig_size'
23650 signal_t='$signal_t'
23651 sitearch='$sitearch'
23652 sitearchexp='$sitearchexp'
23653 sitebin='$sitebin'
23654 sitebinexp='$sitebinexp'
23655 sitehtml1dir='$sitehtml1dir'
23656 sitehtml1direxp='$sitehtml1direxp'
23657 sitehtml3dir='$sitehtml3dir'
23658 sitehtml3direxp='$sitehtml3direxp'
23659 sitelib='$sitelib'
23660 sitelib_stem='$sitelib_stem'
23661 sitelibexp='$sitelibexp'
23662 siteman1dir='$siteman1dir'
23663 siteman1direxp='$siteman1direxp'
23664 siteman3dir='$siteman3dir'
23665 siteman3direxp='$siteman3direxp'
23666 siteprefix='$siteprefix'
23667 siteprefixexp='$siteprefixexp'
23668 sitescript='$sitescript'
23669 sitescriptexp='$sitescriptexp'
23670 sizesize='$sizesize'
23671 sizetype='$sizetype'
23672 sleep='$sleep'
23673 smail='$smail'
23674 so='$so'
23675 sockethdr='$sockethdr'
23676 socketlib='$socketlib'
23677 socksizetype='$socksizetype'
23678 sort='$sort'
23679 spackage='$spackage'
23680 spitshell='$spitshell'
23681 srand48_r_proto='$srand48_r_proto'
23682 srandom_r_proto='$srandom_r_proto'
23683 src='$src'
23684 ssizetype='$ssizetype'
23685 st_ino_sign='$st_ino_sign'
23686 st_ino_size='$st_ino_size'
23687 startperl='$startperl'
23688 startsh='$startsh'
23689 static_ext='$static_ext'
23690 stdchar='$stdchar'
23691 stdio_base='$stdio_base'
23692 stdio_bufsiz='$stdio_bufsiz'
23693 stdio_cnt='$stdio_cnt'
23694 stdio_filbuf='$stdio_filbuf'
23695 stdio_ptr='$stdio_ptr'
23696 stdio_stream_array='$stdio_stream_array'
23697 strerror_r_proto='$strerror_r_proto'
23698 strings='$strings'
23699 submit='$submit'
23700 subversion='$subversion'
23701 sysman='$sysman'
23702 tail='$tail'
23703 tar='$tar'
23704 targetarch='$targetarch'
23705 tbl='$tbl'
23706 tee='$tee'
23707 test='$test'
23708 timeincl='$timeincl'
23709 timetype='$timetype'
23710 tmpnam_r_proto='$tmpnam_r_proto'
23711 to='$to'
23712 touch='$touch'
23713 tr='$tr'
23714 trnl='$trnl'
23715 troff='$troff'
23716 ttyname_r_proto='$ttyname_r_proto'
23717 u16size='$u16size'
23718 u16type='$u16type'
23719 u32size='$u32size'
23720 u32type='$u32type'
23721 u64size='$u64size'
23722 u64type='$u64type'
23723 u8size='$u8size'
23724 u8type='$u8type'
23725 uidformat='$uidformat'
23726 uidsign='$uidsign'
23727 uidsize='$uidsize'
23728 uidtype='$uidtype'
23729 uname='$uname'
23730 uniq='$uniq'
23731 uquadtype='$uquadtype'
23732 use5005threads='$use5005threads'
23733 use64bitall='$use64bitall'
23734 use64bitint='$use64bitint'
23735 usecrosscompile='$usecrosscompile'
23736 usedevel='$usedevel'
23737 usedl='$usedl'
23738 usedtrace='$usedtrace'
23739 usefaststdio='$usefaststdio'
23740 useithreads='$useithreads'
23741 usekernprocpathname='$usekernprocpathname'
23742 uselargefiles='$uselargefiles'
23743 uselongdouble='$uselongdouble'
23744 usemallocwrap='$usemallocwrap'
23745 usemorebits='$usemorebits'
23746 usemultiplicity='$usemultiplicity'
23747 usemymalloc='$usemymalloc'
23748 usenm='$usenm'
23749 usensgetexecutablepath='$usensgetexecutablepath'
23750 useopcode='$useopcode'
23751 useperlio='$useperlio'
23752 useposix='$useposix'
23753 usereentrant='$usereentrant'
23754 userelocatableinc='$userelocatableinc'
23755 usesfio='$usesfio'
23756 useshrplib='$useshrplib'
23757 usesitecustomize='$usesitecustomize'
23758 usesocks='$usesocks'
23759 usethreads='$usethreads'
23760 usevendorprefix='$usevendorprefix'
23761 usevfork='$usevfork'
23762 usrinc='$usrinc'
23763 uuname='$uuname'
23764 uvXUformat='$uvXUformat'
23765 uvoformat='$uvoformat'
23766 uvsize='$uvsize'
23767 uvtype='$uvtype'
23768 uvuformat='$uvuformat'
23769 uvxformat='$uvxformat'
23770 vaproto='$vaproto'
23771 vendorarch='$vendorarch'
23772 vendorarchexp='$vendorarchexp'
23773 vendorbin='$vendorbin'
23774 vendorbinexp='$vendorbinexp'
23775 vendorhtml1dir='$vendorhtml1dir'
23776 vendorhtml1direxp='$vendorhtml1direxp'
23777 vendorhtml3dir='$vendorhtml3dir'
23778 vendorhtml3direxp='$vendorhtml3direxp'
23779 vendorlib='$vendorlib'
23780 vendorlib_stem='$vendorlib_stem'
23781 vendorlibexp='$vendorlibexp'
23782 vendorman1dir='$vendorman1dir'
23783 vendorman1direxp='$vendorman1direxp'
23784 vendorman3dir='$vendorman3dir'
23785 vendorman3direxp='$vendorman3direxp'
23786 vendorprefix='$vendorprefix'
23787 vendorprefixexp='$vendorprefixexp'
23788 vendorscript='$vendorscript'
23789 vendorscriptexp='$vendorscriptexp'
23790 version='$version'
23791 version_patchlevel_string='$version_patchlevel_string'
23792 versiononly='$versiononly'
23793 vi='$vi'
23794 voidflags='$voidflags'
23795 xlibpth='$xlibpth'
23796 yacc='$yacc'
23797 yaccflags='$yaccflags'
23798 zcat='$zcat'
23799 zip='$zip'
23800 EOT
23801
23802 : add special variables
23803 $test -f $src/patchlevel.h && \
23804 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
23805 echo "PERL_PATCHLEVEL='$perl_patchlevel'" >>config.sh
23806 echo "PERL_CONFIG_SH=true" >>config.sh
23807
23808 : propagate old symbols
23809 if $test -f UU/config.sh; then
23810         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
23811         $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
23812                 config.sh config.sh UU/oldconfig.sh |\
23813                 $sort | $uniq -u >UU/oldsyms
23814         set X `$cat UU/oldsyms`
23815         shift
23816         case $# in
23817         0) ;;
23818         *)
23819                 $cat <<EOM
23820 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
23821 EOM
23822                 echo ": Variables propagated from previous config.sh file." >>config.sh
23823                 for sym in `$cat UU/oldsyms`; do
23824                         echo "    Propagating $hint variable "'$'"$sym..."
23825                         eval 'tmp="$'"${sym}"'"'
23826                         echo "$tmp" | \
23827                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
23828                 done
23829                 ;;
23830         esac
23831 fi
23832
23833 : Finish up by extracting the .SH files
23834 case "$alldone" in
23835 exit)
23836         $rm -rf UU
23837         echo "Extraction done."
23838         exit 0
23839         ;;
23840 cont)
23841         ;;
23842 '')
23843         dflt=''
23844         nostick=true
23845         $cat <<EOM
23846
23847 If you'd like to make any changes to the config.sh file before I begin
23848 to configure things, do it as a shell escape now (e.g. !vi config.sh).
23849
23850 EOM
23851         rp="Press return or use a shell escape to edit config.sh:"
23852         . UU/myread
23853         nostick=''
23854         case "$ans" in
23855         '') ;;
23856         *) : in case they cannot read
23857                 sh 1>&4 -c "$ans";;
23858         esac
23859         ;;
23860 esac
23861
23862 : if this fails, just run all the .SH files by hand
23863 . ./config.sh
23864
23865 echo " "
23866 exec 1>&4
23867 pwd=`pwd`
23868 . ./UU/extract
23869 cd "$pwd"
23870
23871 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
23872         dflt=y
23873         case "$silent" in
23874         true) ;;
23875         *)
23876                 $cat <<EOM
23877
23878 Now you need to generate make dependencies by running "$make depend".
23879 You might prefer to run it in background: "$make depend > makedepend.out &"
23880 It can take a while, so you might not want to run it right now.
23881
23882 EOM
23883                 ;;
23884         esac
23885         rp="Run $make depend now?"
23886         . UU/myread
23887         case "$ans" in
23888         y*)
23889                 $make depend && echo "Now you must run '$make'."
23890                 ;;
23891         *)
23892                 echo "You must run '$make depend' then '$make'."
23893                 ;;
23894         esac
23895 elif test -f [Mm]akefile; then
23896         echo " "
23897         echo "Now you must run a $make."
23898 else
23899         echo "Configure done."
23900 fi
23901
23902 if $test -f Policy.sh; then
23903     $cat <<EOM
23904
23905 If you compile $package on a different machine or from a different object
23906 directory, copy the Policy.sh file from this object directory to the
23907 new one before you run Configure -- this will help you with most of
23908 the policy defaults.
23909
23910 EOM
23911 fi
23912 if $test -f config.msg; then
23913     echo "Hmm.  I also noted the following information while running:"
23914     echo " "
23915     $cat config.msg >&4
23916     $rm -f config.msg
23917 fi
23918 $rm -f kit*isdone ark*isdone
23919 $rm -rf UU
23920
23921 : End of Configure
23922