This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [patch] perlhack.pod
[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-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Tue Aug 21 15:53:52 CEST 2007 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 if test ! -c /dev/null ; then
69         cat >&4 <<EOF
70 ***
71 *** I'm sorry, but /dev/null appears to be a file rather than a device.
72 *** Please consult your operating sytem's notes for making a device
73 *** in /dev.
74 *** Cannot continue, aborting.
75 ***
76 EOF
77         exit 1
78 fi
79
80 : compute my invocation name
81 me=$0
82 case "$0" in
83 */*)
84         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85         test "$me" || me=$0
86         ;;
87 esac
88
89 : Proper separator for the PATH environment variable
90 p_=:
91 : On OS/2 this directory should exist if this is not floppy only system :-]
92 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
93     if test -n "$OS2_SHELL"; then
94                 p_=\;
95                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
97                 is_os2=yes
98         elif test -n "$DJGPP"; then
99                 case "X${MACHTYPE:-nonesuchmach}" in
100                 *cygwin) ;;
101                 *) p_=\; ;;
102                 esac
103         fi
104 fi
105
106 : Proper PATH setting
107 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
108 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
109 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
110 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
111 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
112 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
113 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114 paths="$paths /sbin /usr/sbin /usr/libexec"
115 paths="$paths /system/gnu_library/bin"
116
117 for p in $paths
118 do
119         case "$p_$PATH$p_" in
120         *$p_$p$p_*) ;;
121         *) test -d $p && PATH=$PATH$p_$p ;;
122         esac
123 done
124
125 PATH=.$p_$PATH
126 export PATH
127
128 : shall we be using ksh?
129 inksh=''
130 needksh=''
131 avoidksh=''
132 newsh=/bin/ksh
133 changesh=''
134 if (PATH=.; alias -x) >/dev/null 2>&1; then
135                 inksh=true
136 fi
137 if test -f /hp-ux -a -f /bin/ksh; then
138         needksh='to avoid sh bug in "here document" expansion'
139 fi
140 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141         if test X`/usr/bin/uname -v` = X4; then
142                 avoidksh="to avoid AIX 4's /bin/sh"
143                 newsh=/usr/bin/bsh
144         fi
145 fi
146 if test -f /osf_boot -a -f /usr/sbin/setld; then
147         if test X`/usr/bin/uname -s` = XOSF1; then
148                 avoidksh="to avoid Digital UNIX' ksh"
149                 newsh=/bin/sh
150                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151         fi
152 fi
153 case "$inksh/$needksh" in
154 /[a-z]*)
155                 ENV=''
156                 changesh=true
157                 reason="$needksh"
158         ;;
159 esac
160 case "$inksh/$avoidksh" in
161 true/[a-z]*)
162         changesh=true
163         reason="$avoidksh"
164         ;;
165 esac
166 case "$inksh/$needksh-$avoidksh-" in
167 true/--)
168                 cat <<EOM
169 (I see you are using the Korn shell.  Some ksh's blow up on $me,
170 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
171 EOM
172         ;;
173 esac
174 case "$changesh" in
175 true)
176         export newsh
177         echo "(Feeding myself to $newsh $reason.)"
178         case "$0" in
179         Configure|*/Configure) exec $newsh $0 "$@";;
180         *) exec $newsh Configure "$@";;
181         esac
182         ;;
183 esac
184 test -x "${newsh}" || unset newsh
185
186 : if needed set CDPATH to a harmless value that is not chatty
187 : avoid bash 2.02 problems with empty CDPATH.
188 case "$CDPATH" in
189 '')     ;;
190 *)      case "$SHELL" in
191         *bash*) CDPATH='.' ;;
192         *)              CDPATH='' ;;
193         esac
194         ;;
195 esac
196 : Configure runs within the UU subdirectory
197 test -d UU || mkdir UU
198 cd UU && rm -f ./*
199
200 ccname=''
201 ccversion=''
202 ccsymbols=''
203 cppccsymbols=''
204 cppsymbols=''
205 from=''
206 run=''
207 targetarch=''
208 to=''
209 usecrosscompile=''
210 mistrustnm=''
211 perllibs=''
212 dynamic_ext=''
213 extensions=''
214 known_extensions=''
215 nonxs_ext=''
216 static_ext=''
217 useopcode=''
218 useposix=''
219 extras=''
220 d_bsd=''
221 d_eunice=''
222 d_xenix=''
223 eunicefix=''
224 Mcc=''
225 ar=''
226 awk=''
227 bash=''
228 bison=''
229 byacc=''
230 cat=''
231 chgrp=''
232 chmod=''
233 chown=''
234 comm=''
235 compress=''
236 cp=''
237 cpio=''
238 cpp=''
239 csh=''
240 date=''
241 echo=''
242 egrep=''
243 emacs=''
244 expr=''
245 find=''
246 flex=''
247 gmake=''
248 grep=''
249 gzip=''
250 inews=''
251 ksh=''
252 less=''
253 line=''
254 lint=''
255 ln=''
256 lp=''
257 lpr=''
258 ls=''
259 mail=''
260 mailx=''
261 make=''
262 mkdir=''
263 more=''
264 mv=''
265 nm=''
266 nroff=''
267 perl=''
268 pg=''
269 pmake=''
270 pr=''
271 rm=''
272 rmail=''
273 sed=''
274 sendmail=''
275 shar=''
276 sleep=''
277 smail=''
278 sort=''
279 submit=''
280 tail=''
281 tar=''
282 tbl=''
283 tee=''
284 test=''
285 touch=''
286 tr=''
287 troff=''
288 uname=''
289 uniq=''
290 uuname=''
291 vi=''
292 zcat=''
293 zip=''
294 full_ar=''
295 full_sed=''
296 libswanted=''
297 hint=''
298 myuname=''
299 osname=''
300 osvers=''
301 Author=''
302 Date=''
303 Header=''
304 Id=''
305 Locker=''
306 Log=''
307 RCSfile=''
308 Revision=''
309 Source=''
310 State=''
311 _a=''
312 _exe=''
313 _o=''
314 archobjs=''
315 exe_ext=''
316 firstmakefile=''
317 lib_ext=''
318 obj_ext=''
319 path_sep=''
320 rm_try=''
321 afs=''
322 afsroot=''
323 alignbytes=''
324 ansi2knr=''
325 archlib=''
326 archlibexp=''
327 d_archlib=''
328 installarchlib=''
329 archname=''
330 myarchname=''
331 d_atolf=''
332 d_atoll=''
333 baserev=''
334 bin=''
335 binexp=''
336 initialinstalllocation=''
337 installbin=''
338 userelocatableinc=''
339 byteorder=''
340 cc=''
341 ccflags=''
342 cppflags=''
343 ldflags=''
344 lkflags=''
345 locincpth=''
346 optimize=''
347 cf_email=''
348 cf_by=''
349 cf_time=''
350 contains=''
351 cpp_stuff=''
352 cpplast=''
353 cppminus=''
354 cpprun=''
355 cppstdin=''
356 d__fwalk=''
357 d_access=''
358 d_accessx=''
359 d_aintl=''
360 d_alarm=''
361 asctime_r_proto=''
362 d_asctime_r=''
363 d_attribute_format=''
364 d_attribute_malloc=''
365 d_attribute_nonnull=''
366 d_attribute_noreturn=''
367 d_attribute_pure=''
368 d_attribute_unused=''
369 d_attribute_warn_unused_result=''
370 d_printf_format_null=''
371 d_bcmp=''
372 d_bcopy=''
373 d_builtin_choose_expr=''
374 d_builtin_expect=''
375 d_bzero=''
376 d_c99_variadic_macros=''
377 d_casti32=''
378 castflags=''
379 d_castneg=''
380 d_chown=''
381 d_chroot=''
382 d_chsize=''
383 d_class=''
384 d_clearenv=''
385 d_closedir=''
386 d_void_closedir=''
387 d_cmsghdr_s=''
388 d_const=''
389 d_copysignl=''
390 d_cplusplus=''
391 cryptlib=''
392 d_crypt=''
393 crypt_r_proto=''
394 d_crypt_r=''
395 d_csh=''
396 full_csh=''
397 d_ctermid=''
398 ctermid_r_proto=''
399 d_ctermid_r=''
400 ctime_r_proto=''
401 d_ctime_r=''
402 d_cuserid=''
403 d_dbl_dig=''
404 d_dbminitproto=''
405 d_difftime=''
406 d_dir_dd_fd=''
407 d_dirfd=''
408 d_dlerror=''
409 d_dlopen=''
410 d_dlsymun=''
411 d_dosuid=''
412 d_suidsafe=''
413 d_drand48_r=''
414 drand48_r_proto=''
415 d_drand48proto=''
416 d_dup2=''
417 d_eaccess=''
418 d_endgrent=''
419 d_endgrent_r=''
420 endgrent_r_proto=''
421 d_endhent=''
422 d_endhostent_r=''
423 endhostent_r_proto=''
424 d_endnent=''
425 d_endnetent_r=''
426 endnetent_r_proto=''
427 d_endpent=''
428 d_endprotoent_r=''
429 endprotoent_r_proto=''
430 d_endpwent=''
431 d_endpwent_r=''
432 endpwent_r_proto=''
433 d_endsent=''
434 d_endservent_r=''
435 endservent_r_proto=''
436 d_faststdio=''
437 d_fchdir=''
438 d_fchmod=''
439 d_fchown=''
440 d_fcntl=''
441 d_fcntl_can_lock=''
442 d_fd_macros=''
443 d_fd_set=''
444 d_fds_bits=''
445 d_fgetpos=''
446 d_finite=''
447 d_finitel=''
448 d_flexfnam=''
449 d_flock=''
450 d_flockproto=''
451 d_fork=''
452 d_fp_class=''
453 d_fpclass=''
454 d_fpclassify=''
455 d_fpclassl=''
456 d_fpos64_t=''
457 d_frexpl=''
458 d_fs_data_s=''
459 d_fseeko=''
460 d_fsetpos=''
461 d_fstatfs=''
462 d_fsync=''
463 d_ftello=''
464 d_ftime=''
465 d_gettimeod=''
466 d_futimes=''
467 d_Gconvert=''
468 d_getcwd=''
469 d_getespwnam=''
470 d_getfsstat=''
471 d_getgrent=''
472 d_getgrent_r=''
473 getgrent_r_proto=''
474 d_getgrgid_r=''
475 getgrgid_r_proto=''
476 d_getgrnam_r=''
477 getgrnam_r_proto=''
478 d_getgrps=''
479 d_gethbyaddr=''
480 d_gethbyname=''
481 d_gethent=''
482 aphostname=''
483 d_gethname=''
484 d_phostname=''
485 d_uname=''
486 d_gethostbyaddr_r=''
487 gethostbyaddr_r_proto=''
488 d_gethostbyname_r=''
489 gethostbyname_r_proto=''
490 d_gethostent_r=''
491 gethostent_r_proto=''
492 d_gethostprotos=''
493 d_getitimer=''
494 d_getlogin=''
495 d_getlogin_r=''
496 getlogin_r_proto=''
497 d_getmnt=''
498 d_getmntent=''
499 d_getnbyaddr=''
500 d_getnbyname=''
501 d_getnent=''
502 d_getnetbyaddr_r=''
503 getnetbyaddr_r_proto=''
504 d_getnetbyname_r=''
505 getnetbyname_r_proto=''
506 d_getnetent_r=''
507 getnetent_r_proto=''
508 d_getnetprotos=''
509 d_getpagsz=''
510 d_getpent=''
511 d_getpgid=''
512 d_getpgrp2=''
513 d_bsdgetpgrp=''
514 d_getpgrp=''
515 d_getppid=''
516 d_getprior=''
517 d_getpbyname=''
518 d_getpbynumber=''
519 d_getprotobyname_r=''
520 getprotobyname_r_proto=''
521 d_getprotobynumber_r=''
522 getprotobynumber_r_proto=''
523 d_getprotoent_r=''
524 getprotoent_r_proto=''
525 d_getprotoprotos=''
526 d_getprpwnam=''
527 d_getpwent=''
528 d_getpwent_r=''
529 getpwent_r_proto=''
530 d_getpwnam_r=''
531 getpwnam_r_proto=''
532 d_getpwuid_r=''
533 getpwuid_r_proto=''
534 d_getsent=''
535 d_getservbyname_r=''
536 getservbyname_r_proto=''
537 d_getservbyport_r=''
538 getservbyport_r_proto=''
539 d_getservent_r=''
540 getservent_r_proto=''
541 d_getservprotos=''
542 d_getspnam=''
543 d_getspnam_r=''
544 getspnam_r_proto=''
545 d_getsbyname=''
546 d_getsbyport=''
547 d_gmtime_r=''
548 gmtime_r_proto=''
549 d_gnulibc=''
550 gnulibc_version=''
551 d_hasmntopt=''
552 d_htonl=''
553 d_ilogbl=''
554 d_inetaton=''
555 d_int64_t=''
556 d_isascii=''
557 d_isfinite=''
558 d_isinf=''
559 d_isnan=''
560 d_isnanl=''
561 d_killpg=''
562 d_lchown=''
563 d_ldbl_dig=''
564 d_libm_lib_version=''
565 d_link=''
566 d_localtime_r=''
567 d_localtime_r_needs_tzset=''
568 localtime_r_proto=''
569 d_locconv=''
570 d_lockf=''
571 d_longdbl=''
572 longdblsize=''
573 d_longlong=''
574 longlongsize=''
575 d_lseekproto=''
576 d_lstat=''
577 d_madvise=''
578 d_malloc_good_size=''
579 d_malloc_size=''
580 d_mblen=''
581 d_mbstowcs=''
582 d_mbtowc=''
583 d_memchr=''
584 d_memcmp=''
585 d_memcpy=''
586 d_memmove=''
587 d_memset=''
588 d_mkdir=''
589 d_mkdtemp=''
590 d_mkfifo=''
591 d_mkstemp=''
592 d_mkstemps=''
593 d_mktime=''
594 d_mmap=''
595 mmaptype=''
596 d_modfl=''
597 d_modfl_pow32_bug=''
598 d_modflproto=''
599 d_mprotect=''
600 d_msg=''
601 d_msgctl=''
602 d_msgget=''
603 d_msghdr_s=''
604 d_msgrcv=''
605 d_msgsnd=''
606 d_msync=''
607 d_munmap=''
608 d_nice=''
609 d_nl_langinfo=''
610 d_off64_t=''
611 d_open3=''
612 d_fpathconf=''
613 d_pathconf=''
614 d_pause=''
615 d_pipe=''
616 d_poll=''
617 d_portable=''
618 d_procselfexe=''
619 procselfexe=''
620 d_old_pthread_create_joinable=''
621 old_pthread_create_joinable=''
622 d_pthread_atfork=''
623 d_pthread_attr_setscope=''
624 d_pthread_yield=''
625 d_sched_yield=''
626 sched_yield=''
627 d_qgcvt=''
628 d_random_r=''
629 random_r_proto=''
630 d_readdir64_r=''
631 readdir64_r_proto=''
632 d_readdir=''
633 d_rewinddir=''
634 d_seekdir=''
635 d_telldir=''
636 d_readdir_r=''
637 readdir_r_proto=''
638 d_readlink=''
639 d_readv=''
640 d_recvmsg=''
641 d_rename=''
642 d_rmdir=''
643 d_safebcpy=''
644 d_safemcpy=''
645 d_sanemcmp=''
646 d_sbrkproto=''
647 d_scalbnl=''
648 d_select=''
649 d_sem=''
650 d_semctl=''
651 d_semget=''
652 d_semop=''
653 d_sendmsg=''
654 d_setegid=''
655 d_seteuid=''
656 d_setgrent=''
657 d_setgrent_r=''
658 setgrent_r_proto=''
659 d_setgrps=''
660 d_sethent=''
661 d_sethostent_r=''
662 sethostent_r_proto=''
663 d_setitimer=''
664 d_setlinebuf=''
665 d_setlocale=''
666 d_setlocale_r=''
667 setlocale_r_proto=''
668 d_setnent=''
669 d_setnetent_r=''
670 setnetent_r_proto=''
671 d_setpent=''
672 d_setpgid=''
673 d_setpgrp2=''
674 d_bsdsetpgrp=''
675 d_setpgrp=''
676 d_setprior=''
677 d_setproctitle=''
678 d_setprotoent_r=''
679 setprotoent_r_proto=''
680 d_setpwent=''
681 d_setpwent_r=''
682 setpwent_r_proto=''
683 d_setregid=''
684 d_setresgid=''
685 d_setresuid=''
686 d_setreuid=''
687 d_setrgid=''
688 d_setruid=''
689 d_setsent=''
690 d_setservent_r=''
691 setservent_r_proto=''
692 d_setsid=''
693 d_setvbuf=''
694 d_sfio=''
695 usesfio=''
696 d_shm=''
697 d_shmat=''
698 d_shmatprototype=''
699 shmattype=''
700 d_shmctl=''
701 d_shmdt=''
702 d_shmget=''
703 d_sigaction=''
704 d_signbit=''
705 d_sigprocmask=''
706 d_sigsetjmp=''
707 usesitecustomize=''
708 d_snprintf=''
709 d_vsnprintf=''
710 d_sockatmark=''
711 d_sockatmarkproto=''
712 d_msg_ctrunc=''
713 d_msg_dontroute=''
714 d_msg_oob=''
715 d_msg_peek=''
716 d_msg_proxy=''
717 d_oldsock=''
718 d_scm_rights=''
719 d_socket=''
720 d_sockpair=''
721 sockethdr=''
722 socketlib=''
723 d_socklen_t=''
724 d_socks5_init=''
725 d_sprintf_returns_strlen=''
726 d_sqrtl=''
727 d_srand48_r=''
728 srand48_r_proto=''
729 d_srandom_r=''
730 srandom_r_proto=''
731 d_sresgproto=''
732 d_sresuproto=''
733 d_statblks=''
734 d_statfs_f_flags=''
735 d_statfs_s=''
736 d_fstatvfs=''
737 d_statvfs=''
738 d_stdio_cnt_lval=''
739 d_stdio_ptr_lval=''
740 d_stdio_ptr_lval_nochange_cnt=''
741 d_stdio_ptr_lval_sets_cnt=''
742 d_stdiobase=''
743 d_stdstdio=''
744 stdio_base=''
745 stdio_bufsiz=''
746 stdio_cnt=''
747 stdio_filbuf=''
748 stdio_ptr=''
749 d_index=''
750 d_strchr=''
751 d_strcoll=''
752 d_strctcpy=''
753 d_strerrm=''
754 d_strerror=''
755 d_sysernlst=''
756 d_syserrlst=''
757 d_strerror_r=''
758 strerror_r_proto=''
759 d_strftime=''
760 d_strlcat=''
761 d_strlcpy=''
762 d_strtod=''
763 d_strtol=''
764 d_strtold=''
765 d_strtoll=''
766 d_strtoq=''
767 d_strtoul=''
768 d_strtoull=''
769 d_strtouq=''
770 d_strxfrm=''
771 d_symlink=''
772 d_syscall=''
773 d_syscallproto=''
774 d_sysconf=''
775 d_system=''
776 d_tcgetpgrp=''
777 d_tcsetpgrp=''
778 d_telldirproto=''
779 d_time=''
780 timetype=''
781 clocktype=''
782 d_times=''
783 d_tmpnam_r=''
784 tmpnam_r_proto=''
785 d_truncate=''
786 d_ttyname_r=''
787 ttyname_r_proto=''
788 d_tzname=''
789 d_u32align=''
790 d_ualarm=''
791 d_umask=''
792 d_semctl_semid_ds=''
793 d_semctl_semun=''
794 d_union_semun=''
795 d_unordered=''
796 d_unsetenv=''
797 d_usleep=''
798 d_usleepproto=''
799 d_ustat=''
800 d_pseudofork=''
801 d_vfork=''
802 usevfork=''
803 d_voidsig=''
804 signal_t=''
805 d_volatile=''
806 d_charvspr=''
807 d_vprintf=''
808 d_wait4=''
809 d_waitpid=''
810 d_wcstombs=''
811 d_wctomb=''
812 d_writev=''
813 dlext=''
814 cccdlflags=''
815 ccdlflags=''
816 dlsrc=''
817 ld=''
818 lddlflags=''
819 usedl=''
820 doublesize=''
821 ebcdic=''
822 fflushNULL=''
823 fflushall=''
824 fpossize=''
825 fpostype=''
826 gccansipedantic=''
827 gccosandvers=''
828 gccversion=''
829 gidformat=''
830 gidsign=''
831 gidsize=''
832 gidtype=''
833 groupstype=''
834 h_fcntl=''
835 h_sysfile=''
836 html1dir=''
837 html1direxp=''
838 installhtml1dir=''
839 html3dir=''
840 html3direxp=''
841 installhtml3dir=''
842 i_arpainet=''
843 i_crypt=''
844 db_hashtype=''
845 db_prefixtype=''
846 db_version_major=''
847 db_version_minor=''
848 db_version_patch=''
849 i_db=''
850 i_dbm=''
851 i_rpcsvcdbm=''
852 d_dirnamlen=''
853 direntrytype=''
854 i_dirent=''
855 i_dld=''
856 i_dlfcn=''
857 i_fcntl=''
858 i_float=''
859 i_fp=''
860 i_fp_class=''
861 i_gdbm=''
862 d_grpasswd=''
863 i_grp=''
864 i_ieeefp=''
865 i_inttypes=''
866 i_langinfo=''
867 i_libutil=''
868 i_limits=''
869 i_locale=''
870 i_machcthr=''
871 i_malloc=''
872 i_math=''
873 i_memory=''
874 i_mntent=''
875 i_ndbm=''
876 i_netdb=''
877 i_neterrno=''
878 i_netinettcp=''
879 i_niin=''
880 i_sysin=''
881 i_poll=''
882 i_prot=''
883 i_pthread=''
884 d_pwage=''
885 d_pwchange=''
886 d_pwclass=''
887 d_pwcomment=''
888 d_pwexpire=''
889 d_pwgecos=''
890 d_pwpasswd=''
891 d_pwquota=''
892 i_pwd=''
893 i_sfio=''
894 i_shadow=''
895 i_socks=''
896 i_stddef=''
897 i_stdlib=''
898 i_string=''
899 strings=''
900 i_sunmath=''
901 i_sysaccess=''
902 i_sysdir=''
903 i_sysfile=''
904 d_voidtty=''
905 i_bsdioctl=''
906 i_sysfilio=''
907 i_sysioctl=''
908 i_syssockio=''
909 i_syslog=''
910 i_sysmman=''
911 i_sysmode=''
912 i_sysmount=''
913 i_sysndir=''
914 i_sysparam=''
915 i_sysresrc=''
916 i_syssecrt=''
917 i_sysselct=''
918 i_sysstat=''
919 i_sysstatfs=''
920 i_sysstatvfs=''
921 i_systimes=''
922 i_systypes=''
923 i_sysuio=''
924 i_sysun=''
925 i_sysutsname=''
926 i_sysvfs=''
927 i_syswait=''
928 i_sgtty=''
929 i_termio=''
930 i_termios=''
931 d_tm_tm_gmtoff=''
932 d_tm_tm_zone=''
933 i_systime=''
934 i_systimek=''
935 i_time=''
936 timeincl=''
937 i_unistd=''
938 i_ustat=''
939 i_utime=''
940 i_values=''
941 i_stdarg=''
942 i_varargs=''
943 i_varhdr=''
944 i_vfork=''
945 d_inc_version_list=''
946 inc_version_list=''
947 inc_version_list_init=''
948 installprefix=''
949 installprefixexp=''
950 installstyle=''
951 installusrbinperl=''
952 intsize=''
953 longsize=''
954 shortsize=''
955 issymlink=''
956 libc=''
957 ldlibpthname=''
958 libperl=''
959 shrpenv=''
960 useshrplib=''
961 glibpth=''
962 libpth=''
963 loclibpth=''
964 plibpth=''
965 xlibpth=''
966 ignore_versioned_solibs=''
967 libs=''
968 libsdirs=''
969 libsfiles=''
970 libsfound=''
971 libspath=''
972 lns=''
973 d_PRIEUldbl=''
974 d_PRIFUldbl=''
975 d_PRIGUldbl=''
976 d_PRIeldbl=''
977 d_PRIfldbl=''
978 d_PRIgldbl=''
979 d_SCNfldbl=''
980 sPRIEUldbl=''
981 sPRIFUldbl=''
982 sPRIGUldbl=''
983 sPRIeldbl=''
984 sPRIfldbl=''
985 sPRIgldbl=''
986 sSCNfldbl=''
987 lseeksize=''
988 lseektype=''
989 mad=''
990 madlyh=''
991 madlyobj=''
992 madlysrc=''
993 make_set_make=''
994 d_mymalloc=''
995 freetype=''
996 mallocobj=''
997 mallocsrc=''
998 malloctype=''
999 usemallocwrap=''
1000 usemymalloc=''
1001 installman1dir=''
1002 man1dir=''
1003 man1direxp=''
1004 man1ext=''
1005 installman3dir=''
1006 man3dir=''
1007 man3direxp=''
1008 man3ext=''
1009 modetype=''
1010 multiarch=''
1011 mydomain=''
1012 myhostname=''
1013 phostname=''
1014 c=''
1015 n=''
1016 d_eofnblk=''
1017 eagain=''
1018 o_nonblock=''
1019 rd_nodata=''
1020 need_va_copy=''
1021 netdb_hlen_type=''
1022 netdb_host_type=''
1023 netdb_name_type=''
1024 netdb_net_type=''
1025 groupcat=''
1026 hostcat=''
1027 passcat=''
1028 orderlib=''
1029 ranlib=''
1030 d_perl_otherlibdirs=''
1031 otherlibdirs=''
1032 package=''
1033 spackage=''
1034 pager=''
1035 api_revision=''
1036 api_subversion=''
1037 api_version=''
1038 api_versionstring=''
1039 patchlevel=''
1040 perl_patchlevel=''
1041 revision=''
1042 subversion=''
1043 version=''
1044 version_patchlevel_string=''
1045 perl5=''
1046 perladmin=''
1047 perlpath=''
1048 d_nv_preserves_uv=''
1049 d_nv_zero_is_allbits_zero=''
1050 i16size=''
1051 i16type=''
1052 i32size=''
1053 i32type=''
1054 i64size=''
1055 i64type=''
1056 i8size=''
1057 i8type=''
1058 ivsize=''
1059 ivtype=''
1060 nv_preserves_uv_bits=''
1061 nvsize=''
1062 nvtype=''
1063 u16size=''
1064 u16type=''
1065 u32size=''
1066 u32type=''
1067 u64size=''
1068 u64type=''
1069 u8size=''
1070 u8type=''
1071 uvsize=''
1072 uvtype=''
1073 ivdformat=''
1074 nvEUformat=''
1075 nvFUformat=''
1076 nvGUformat=''
1077 nveformat=''
1078 nvfformat=''
1079 nvgformat=''
1080 uvXUformat=''
1081 uvoformat=''
1082 uvuformat=''
1083 uvxformat=''
1084 pidtype=''
1085 prefix=''
1086 prefixexp=''
1087 installprivlib=''
1088 privlib=''
1089 privlibexp=''
1090 prototype=''
1091 ptrsize=''
1092 d_PRIXU64=''
1093 d_PRId64=''
1094 d_PRIi64=''
1095 d_PRIo64=''
1096 d_PRIu64=''
1097 d_PRIx64=''
1098 sPRIXU64=''
1099 sPRId64=''
1100 sPRIi64=''
1101 sPRIo64=''
1102 sPRIu64=''
1103 sPRIx64=''
1104 d_quad=''
1105 quadkind=''
1106 quadtype=''
1107 uquadtype=''
1108 drand01=''
1109 randbits=''
1110 randfunc=''
1111 randseedtype=''
1112 seedfunc=''
1113 installscript=''
1114 scriptdir=''
1115 scriptdirexp=''
1116 selectminbits=''
1117 selecttype=''
1118 sh=''
1119 sig_count=''
1120 sig_name=''
1121 sig_name_init=''
1122 sig_num=''
1123 sig_num_init=''
1124 sig_size=''
1125 d_sitearch=''
1126 installsitearch=''
1127 sitearch=''
1128 sitearchexp=''
1129 installsitebin=''
1130 sitebin=''
1131 sitebinexp=''
1132 installsitehtml1dir=''
1133 sitehtml1dir=''
1134 sitehtml1direxp=''
1135 installsitehtml3dir=''
1136 sitehtml3dir=''
1137 sitehtml3direxp=''
1138 installsitelib=''
1139 sitelib=''
1140 sitelib_stem=''
1141 sitelibexp=''
1142 installsiteman1dir=''
1143 siteman1dir=''
1144 siteman1direxp=''
1145 installsiteman3dir=''
1146 siteman3dir=''
1147 siteman3direxp=''
1148 siteprefix=''
1149 siteprefixexp=''
1150 installsitescript=''
1151 sitescript=''
1152 sitescriptexp=''
1153 sizesize=''
1154 sizetype=''
1155 so=''
1156 socksizetype=''
1157 sharpbang=''
1158 shsharp=''
1159 spitshell=''
1160 src=''
1161 ssizetype=''
1162 startperl=''
1163 startsh=''
1164 stdchar=''
1165 d_stdio_stream_array=''
1166 stdio_stream_array=''
1167 sysman=''
1168 trnl=''
1169 uidformat=''
1170 uidsign=''
1171 uidsize=''
1172 uidtype=''
1173 archname64=''
1174 use64bitall=''
1175 use64bitint=''
1176 usefaststdio=''
1177 ccflags_uselargefiles=''
1178 ldflags_uselargefiles=''
1179 libswanted_uselargefiles=''
1180 uselargefiles=''
1181 uselongdouble=''
1182 usemorebits=''
1183 usemultiplicity=''
1184 nm_opt=''
1185 nm_so_opt=''
1186 runnm=''
1187 usenm=''
1188 useperlio=''
1189 usesocks=''
1190 d_oldpthreads=''
1191 use5005threads=''
1192 useithreads=''
1193 usereentrant=''
1194 usethreads=''
1195 incpath=''
1196 mips_type=''
1197 usrinc=''
1198 d_vendorarch=''
1199 installvendorarch=''
1200 vendorarch=''
1201 vendorarchexp=''
1202 d_vendorbin=''
1203 installvendorbin=''
1204 vendorbin=''
1205 vendorbinexp=''
1206 installvendorhtml1dir=''
1207 vendorhtml1dir=''
1208 vendorhtml1direxp=''
1209 installvendorhtml3dir=''
1210 vendorhtml3dir=''
1211 vendorhtml3direxp=''
1212 d_vendorlib=''
1213 installvendorlib=''
1214 vendorlib=''
1215 vendorlib_stem=''
1216 vendorlibexp=''
1217 installvendorman1dir=''
1218 vendorman1dir=''
1219 vendorman1direxp=''
1220 installvendorman3dir=''
1221 vendorman3dir=''
1222 vendorman3direxp=''
1223 usevendorprefix=''
1224 vendorprefix=''
1225 vendorprefixexp=''
1226 d_vendorscript=''
1227 installvendorscript=''
1228 vendorscript=''
1229 vendorscriptexp=''
1230 versiononly=''
1231 defvoidused=''
1232 voidflags=''
1233 yacc=''
1234 yaccflags=''
1235 CONFIG=''
1236
1237 define='define'
1238 undef='undef'
1239 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1240 rmlist=''
1241
1242 : We must find out about Eunice early
1243 eunicefix=':'
1244 if test -f /etc/unixtovms; then
1245         eunicefix=/etc/unixtovms
1246 fi
1247 if test -f /etc/unixtovms.exe; then
1248         eunicefix=/etc/unixtovms.exe
1249 fi
1250
1251 : Set executable suffix now -- needed before hints available
1252 if test -f "/libs/version.library"; then
1253 : Amiga OS
1254     _exe=""
1255 elif test -f "/system/gnu_library/bin/ar.pm"; then
1256 : Stratus VOS
1257     _exe=".pm"
1258 elif test -n "$DJGPP"; then
1259 : DOS DJGPP
1260     _exe=".exe"
1261 elif test -d c:/. -o -n "$is_os2" ; then
1262 : OS/2 or cygwin
1263     _exe=".exe"
1264 fi
1265
1266 i_whoami=''
1267 : Trailing extension.  Override this in a hint file, if needed.
1268 : Extra object files, if any, needed on this platform.
1269 archobjs=''
1270 archname=''
1271 groupstype=''
1272 libnames=''
1273 : change the next line if compiling for Xenix/286 on Xenix/386
1274 xlibpth='/usr/lib/386 /lib/386'
1275 : Possible local library directories to search.
1276 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1277 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1278
1279 : general looking path for locating libraries
1280 glibpth="/lib /usr/lib $xlibpth"
1281 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1282 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1283 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1284 test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
1285
1286 : Private path used by Configure to find libraries.  Its value
1287 : is prepended to libpth. This variable takes care of special
1288 : machines, like the mips.  Usually, it should be empty.
1289 plibpth=''
1290
1291 : default library list
1292 libswanted=''
1293 : some systems want to use only the non-versioned libso:s
1294 ignore_versioned_solibs=''
1295 siteman1dir=''
1296 siteman3dir=''
1297 sitescript=''
1298 : set usethreads on the Configure command line to enable threads.
1299 usereentrant='undef'
1300 : full support for void wanted by default
1301 defvoidused=15
1302
1303 : Possible local include directories to search.
1304 : Set locincpth to "" in a hint file to defeat local include searches.
1305 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1306 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1307 :
1308 : no include file wanted by default
1309 inclwanted=''
1310
1311 : Enable -DEBUGGING and -DDEBUGGING from the command line
1312 EBUGGING=''
1313 DEBUGGING=old
1314
1315 ccname=''
1316 ccversion=''
1317 perllibs=''
1318 : set useposix=false in your hint file to disable the POSIX extension.
1319 useposix=true
1320 : set useopcode=false in your hint file to disable the Opcode extension.
1321 useopcode=true
1322 archname64=''
1323 ccflags_uselargefiles=''
1324 ldflags_uselargefiles=''
1325 libswanted_uselargefiles=''
1326 : set usemultiplicity on the Configure command line to enable multiplicity.
1327 : set usesocks on the Configure command line to enable socks.
1328 : List of libraries we want.
1329 : If anyone needs extra -lxxx, put those in a hint file.
1330 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1331 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1332 : We probably want to search /usr/shlib before most other libraries.
1333 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1334 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1335 glibpth="/usr/shlib $glibpth"
1336 : Do not use vfork unless overridden by a hint file.
1337 usevfork=false
1338
1339 : Find the basic shell for Bourne shell scripts
1340 case "$sh" in
1341 '')
1342         case "$SYSTYPE" in
1343         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1344         *) xxx='/bin/sh';;
1345         esac
1346         if test -f "$xxx"; then
1347                 sh="$xxx"
1348         else
1349                 : Build up a list and do a single loop so we can 'break' out.
1350                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1351                 for xxx in sh bash ksh pdksh ash; do
1352                         for p in $pth; do
1353                                 try="$try ${p}/${xxx}"
1354                         done
1355                 done
1356                 for xxx in $try; do
1357                         if test -f "$xxx"; then
1358                                 sh="$xxx";
1359                                 break
1360                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1361                                 sh="$xxx";
1362                                 break
1363                         elif test -f "$xxx.exe"; then
1364                                 sh="$xxx";
1365                                 break
1366                         fi
1367                 done
1368         fi
1369         ;;
1370 esac
1371
1372 case "$sh" in
1373 '')     cat >&2 <<EOM
1374 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1375
1376 Usually it's in /bin/sh.  How did you even get this far?
1377 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1378 we'll try to straighten this all out.
1379 EOM
1380         exit 1
1381         ;;
1382 esac
1383
1384 : see if sh knows # comments
1385 if `$sh -c '#' >/dev/null 2>&1`; then
1386         shsharp=true
1387         spitshell=cat
1388         xcat=/bin/cat
1389         test -f $xcat$_exe || xcat=/usr/bin/cat
1390         if test ! -f $xcat$_exe; then
1391                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1392                         if test -f $p/cat$_exe; then
1393                                 xcat=$p/cat
1394                                 break
1395                         fi
1396                 done
1397                 if test ! -f $xcat$_exe; then
1398                         echo "Can't find cat anywhere!"
1399                         exit 1
1400                 fi
1401         fi
1402         echo "#!$xcat" >sharp
1403         $eunicefix sharp
1404         chmod +x sharp
1405         ./sharp > today
1406         if test -s today; then
1407                 sharpbang='#!'
1408         else
1409                 echo "#! $xcat" > sharp
1410                 $eunicefix sharp
1411                 chmod +x sharp
1412                 ./sharp > today
1413                 if test -s today; then
1414                         sharpbang='#! '
1415                 else
1416                         sharpbang=': use '
1417                 fi
1418         fi
1419 else
1420         echo " "
1421         echo "Your $sh doesn't grok # comments--I will strip them later on."
1422         shsharp=false
1423         cd ..
1424         echo "exec grep -v '^[  ]*#'" >spitshell
1425         chmod +x spitshell
1426         $eunicefix spitshell
1427         spitshell=`pwd`/spitshell
1428         cd UU
1429         echo "I presume that if # doesn't work, #! won't work either!"
1430         sharpbang=': use '
1431 fi
1432 rm -f sharp today
1433
1434 : figure out how to guarantee sh startup
1435 case "$startsh" in
1436 '') startsh=${sharpbang}${sh} ;;
1437 *)
1438 esac
1439 cat >sharp <<EOSS
1440 $startsh
1441 set abc
1442 test "$?abc" != 1
1443 EOSS
1444
1445 chmod +x sharp
1446 $eunicefix sharp
1447 if ./sharp; then
1448         : echo "Yup, it does."
1449 else
1450         echo "Hmm... '$startsh' does not guarantee sh startup..."
1451         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1452 fi
1453 rm -f sharp
1454
1455
1456 : Save command line options in file UU/cmdline.opt for later use in
1457 : generating config.sh.
1458 cat > cmdline.opt <<EOSH
1459 # Configure command line arguments.
1460 config_arg0='$0'
1461 config_args='$*'
1462 config_argc=$#
1463 EOSH
1464 argn=1
1465 args_exp=''
1466 args_sep=''
1467 for arg in "$@"; do
1468         cat >>cmdline.opt <<EOSH
1469 config_arg$argn='$arg'
1470 EOSH
1471         # Extreme backslashitis: replace each ' by '"'"'
1472         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1473 $arg
1474 EOC
1475         arg_exp=`cat cmdl.opt`
1476         args_exp="$args_exp$args_sep'$arg_exp'"
1477         argn=`expr $argn + 1`
1478         args_sep=' '
1479 done
1480 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1481 # used by ./hints/os2.sh
1482 rm -f cmdl.opt
1483
1484 : produce awk script to parse command line options
1485 cat >options.awk <<'EOF'
1486 BEGIN {
1487         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1488
1489         len = length(optstr);
1490         for (i = 1; i <= len; i++) {
1491                 c = substr(optstr, i, 1);
1492                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1493                 if (a == ":") {
1494                         arg[c] = 1;
1495                         i++;
1496                 }
1497                 opt[c] = 1;
1498         }
1499 }
1500 {
1501         expect = 0;
1502         str = $0;
1503         if (substr(str, 1, 1) != "-") {
1504                 printf("'%s'\n", str);
1505                 next;
1506         }
1507         len = length($0);
1508         for (i = 2; i <= len; i++) {
1509                 c = substr(str, i, 1);
1510                 if (!opt[c]) {
1511                         printf("-%s\n", substr(str, i));
1512                         next;
1513                 }
1514                 printf("-%s\n", c);
1515                 if (arg[c]) {
1516                         if (i < len)
1517                                 printf("'%s'\n", substr(str, i + 1));
1518                         else
1519                                 expect = 1;
1520                         next;
1521                 }
1522         }
1523 }
1524 END {
1525         if (expect)
1526                 print "?";
1527 }
1528 EOF
1529
1530 : process the command line options
1531 set X `for arg in "$@"; do echo "X$arg"; done |
1532         sed -e s/X// | awk -f options.awk`
1533 eval "set $*"
1534 shift
1535 rm -f options.awk
1536
1537 : set up default values
1538 fastread=''
1539 reuseval=false
1540 config_sh=''
1541 alldone=''
1542 error=''
1543 silent=''
1544 extractsh=''
1545 override=''
1546 knowitall=''
1547 rm -f optdef.sh posthint.sh
1548 cat >optdef.sh <<EOS
1549 $startsh
1550 EOS
1551
1552
1553 : option parsing
1554 while test $# -gt 0; do
1555         case "$1" in
1556         -d) shift; fastread=yes;;
1557         -e) shift; alldone=cont;;
1558         -f)
1559                 shift
1560                 cd ..
1561                 if test -r "$1"; then
1562                         config_sh="$1"
1563                 else
1564                         echo "$me: cannot read config file $1." >&2
1565                         error=true
1566                 fi
1567                 cd UU
1568                 shift;;
1569         --help|\
1570         -h) shift; error=true;;
1571         -r) shift; reuseval=true;;
1572         -s) shift; silent=true; realsilent=true;;
1573         -E) shift; alldone=exit;;
1574         -K) shift; knowitall=true;;
1575         -O) shift; override=true;;
1576         -S) shift; silent=true; extractsh=true;;
1577         -D)
1578                 shift
1579                 case "$1" in
1580                 *=)
1581                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1582                         echo "$me: ignoring -D $1" >&2
1583                         ;;
1584                 *=*) echo "$1" | \
1585                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1586                 *) echo "$1='define'" >> optdef.sh;;
1587                 esac
1588                 shift
1589                 ;;
1590         -U)
1591                 shift
1592                 case "$1" in
1593                 *=) echo "$1" >> optdef.sh;;
1594                 *=*)
1595                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1596                         echo "$me: ignoring -U $1" >&2
1597                         ;;
1598                 *) echo "$1='undef'" >> optdef.sh;;
1599                 esac
1600                 shift
1601                 ;;
1602         -A)
1603             shift
1604             xxx=''
1605             yyy="$1"
1606             zzz=''
1607             uuu=undef
1608             case "$yyy" in
1609             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1610                  case "$zzz" in
1611                  *:*) zzz='' ;;
1612                  *)   xxx=append
1613                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1614                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1615                  esac
1616                  ;;
1617             esac
1618             case "$xxx" in
1619             '')  case "$yyy" in
1620                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1621                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1622                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1623                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1624                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1625                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1626                  esac
1627                  ;;       
1628             esac
1629             case "$xxx" in
1630             append)
1631                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1632             clear)
1633                 echo "$yyy=''"                  >> posthint.sh ;;
1634             define)
1635                 case "$zzz" in
1636                 '') zzz=define ;;
1637                 esac
1638                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1639             eval)
1640                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1641             prepend)
1642                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1643             undef)
1644                 case "$zzz" in
1645                 '') zzz="$uuu" ;;
1646                 esac
1647                 echo "$yyy=$zzz"                >> posthint.sh ;;
1648             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1649             esac
1650             shift
1651             ;;
1652         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1653             exit 0;;
1654         --) break;;
1655         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1656         *) break;;
1657         esac
1658 done
1659
1660 case "$error" in
1661 true)
1662         cat >&2 <<EOM
1663 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1664                  [-U symbol] [-U symbol=] [-A command:symbol...]
1665   -d : use defaults for all answers.
1666   -e : go on without questioning past the production of config.sh.
1667   -f : specify an alternate default configuration file.
1668   -h : print this help message and exit (with an error status).
1669   -r : reuse C symbols value if possible (skips costly nm extraction).
1670   -s : silent mode, only echoes questions and essential information.
1671   -D : define symbol to have some value:
1672          -D symbol         symbol gets the value 'define'
1673          -D symbol=value   symbol gets the value 'value'
1674        common used examples (see INSTALL for more info):
1675          -Duse64bitint            use 64bit integers
1676          -Duse64bitall            use 64bit integers and pointers
1677          -Dusethreads             use thread support
1678          -Dinc_version_list=none  do not include older perl trees in @INC
1679          -DEBUGGING=none          DEBUGGING options
1680          -Dcc=gcc                 choose your compiler
1681          -Dprefix=/opt/perl5      choose your destination
1682   -E : stop at the end of questions, after having produced config.sh.
1683   -K : do not use unless you know what you are doing.
1684   -O : let -D and -U override definitions from loaded configuration file.
1685   -S : perform variable substitutions on all .SH files (can mix with -f)
1686   -U : undefine symbol:
1687          -U symbol    symbol gets the value 'undef'
1688          -U symbol=   symbol gets completely empty
1689        e.g.:  -Uversiononly
1690   -A : manipulate symbol after the platform specific hints have been applied:
1691          -A append:symbol=value   append value to symbol
1692          -A symbol=value          like append:, but with a separating space
1693          -A define:symbol=value   define symbol to have value
1694          -A clear:symbol          define symbol to be ''
1695          -A define:symbol         define symbol to be 'define'
1696          -A eval:symbol=value     define symbol to be eval of value
1697          -A prepend:symbol=value  prepend value to symbol
1698          -A undef:symbol          define symbol to be 'undef'
1699          -A undef:symbol=         define symbol to be ''
1700        e.g.:  -A prepend:libswanted='cl pthread '
1701               -A ccflags=-DSOME_MACRO
1702   -V : print version number and exit (with a zero status).
1703 EOM
1704         exit 1
1705         ;;
1706 esac
1707
1708 : Sanity checks
1709 case "$fastread$alldone" in
1710 yescont|yesexit) ;;
1711 *)
1712         case "$extractsh" in
1713         true) ;;
1714         *)
1715                 if test ! -t 0; then
1716                         echo "Say 'sh Configure', not 'sh <Configure'"
1717                         exit 1
1718                 fi
1719                 ;;
1720         esac
1721         ;;
1722 esac
1723
1724 exec 4>&1
1725 case "$silent" in
1726 true) exec 1>/dev/null;;
1727 esac
1728
1729 : run the defines and the undefines, if any, but leave the file out there...
1730 touch optdef.sh
1731 . ./optdef.sh
1732 : create the posthint manipulation script and leave the file out there...
1733 touch posthint.sh
1734
1735 : set package name
1736 package=perl5
1737 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1738 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1739 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1740 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1741 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1742 esac
1743
1744 : Some greps do not return status, grrr.
1745 echo "grimblepritz" >grimble
1746 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1747         contains=contains
1748 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1749         contains=grep
1750 else
1751         contains=contains
1752 fi
1753 rm -f grimble
1754 : the following should work in any shell
1755 case "$contains" in
1756 contains*)
1757         echo " "
1758         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1759         cat >contains <<'EOSS'
1760 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1761 EOSS
1762 chmod +x contains
1763 esac
1764
1765 : Find the path to the source tree
1766 case "$src" in
1767 '') case "$0" in
1768     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1769          case "$src" in
1770          /*)    ;;
1771          .)     ;;
1772          *)     src=`cd ../$src && pwd` ;;
1773          esac
1774          ;;
1775     *)   src='.';;
1776     esac;;
1777 esac
1778 case "$src" in
1779 '')     src=/
1780         rsrc=/
1781         ;;
1782 /*) rsrc="$src";;
1783 *) rsrc="../$src";;
1784 esac
1785 if test -f $rsrc/Configure && \
1786         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1787 then
1788    : found it, so we are ok.
1789 else
1790         rsrc=''
1791         for src in . .. ../.. ../../.. ../../../..; do
1792                 if test -f ../$src/Configure && \
1793                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1794                 then
1795                         rsrc=../$src
1796                         break
1797                 fi
1798         done
1799 fi
1800 case "$rsrc" in
1801 '')
1802         cat <<EOM >&4
1803
1804 Sorry, I can't seem to locate the source dir for $package.  Please start
1805 Configure with an explicit path -- i.e. /some/path/Configure.
1806
1807 EOM
1808         exit 1
1809         ;;
1810 ../.)   rsrc='..';;
1811 *)
1812         echo " "
1813         echo "Sources for $package found in \"$src\"." >&4
1814         ;;
1815 esac
1816
1817 : script used to extract .SH files with variable substitutions
1818 cat >extract <<'EOS'
1819 PERL_CONFIG_SH=true
1820 echo "Doing variable substitutions on .SH files..."
1821 if test -f MANIFEST; then
1822         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1823 else
1824         echo "(Looking for .SH files under the source directory.)"
1825         set x `(cd "$src"; find . -name "*.SH" -print)`
1826 fi
1827 shift
1828 case $# in
1829 0) set x `(cd "$src"; echo *.SH)`; shift;;
1830 esac
1831 if test ! -f "$src/$1"; then
1832         shift
1833 fi
1834 mkdir_p='
1835 name=$1;
1836 create="";
1837 while test $name; do
1838         if test ! -d "$name"; then
1839                 create="$name $create";
1840                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1841                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1842         else
1843                 name="";
1844         fi;
1845 done;
1846 for file in $create; do
1847         mkdir $file;
1848 done
1849 '
1850 for file in $*; do
1851         case "$src" in
1852         ".")
1853                 case "$file" in
1854                 */*)
1855                         dir=`expr X$file : 'X\(.*\)/'`
1856                         file=`expr X$file : 'X.*/\(.*\)'`
1857                         (cd "$dir" && . ./$file)
1858                         ;;
1859                 *)
1860                         . ./$file
1861                         ;;
1862                 esac
1863                 ;;
1864         *)
1865                 case "$file" in
1866                 */*)
1867                         dir=`expr X$file : 'X\(.*\)/'`
1868                         file=`expr X$file : 'X.*/\(.*\)'`
1869                         (set x $dir; shift; eval $mkdir_p)
1870                         sh <"$src/$dir/$file"
1871                         ;;
1872                 *)
1873                         sh <"$src/$file"
1874                         ;;
1875                 esac
1876                 ;;
1877         esac
1878 done
1879 if test -f "$src/config_h.SH"; then
1880         if test ! -f config.h; then
1881         : oops, they left it out of MANIFEST, probably, so do it anyway.
1882         . "$src/config_h.SH"
1883         fi
1884 fi
1885 EOS
1886
1887 : extract files and exit if asked to do so
1888 case "$extractsh" in
1889 true)
1890         case "$realsilent" in
1891         true) ;;
1892         *) exec 1>&4;;
1893         esac
1894         case "$config_sh" in
1895         '') config_sh='config.sh';;
1896         esac
1897         echo " "
1898         echo "Fetching answers from $config_sh..."
1899         cd ..
1900         . $config_sh
1901         test "$override" && . ./optdef.sh
1902         echo " "
1903         . UU/extract
1904         rm -rf UU
1905         echo "Extraction done."
1906         exit 0
1907         ;;
1908 esac
1909
1910 : Eunice requires " " instead of "", can you believe it
1911 echo " "
1912 : Here we go...
1913 echo "Beginning of configuration questions for $package."
1914
1915 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1916
1917 : first determine how to suppress newline on echo command
1918 echo " "
1919 echo "Checking echo to see how to suppress newlines..."
1920 (echo "hi there\c" ; echo " ") >.echotmp
1921 if $contains c .echotmp >/dev/null 2>&1 ; then
1922         echo "...using -n."
1923         n='-n'
1924         c=''
1925 else
1926         cat <<'EOM'
1927 ...using \c
1928 EOM
1929         n=''
1930         c='\c'
1931 fi
1932 echo $n "The star should be here-->$c"
1933 echo '*'
1934 rm -f .echotmp
1935
1936 : Now test for existence of everything in MANIFEST
1937 echo " "
1938 if test -f "$rsrc/MANIFEST"; then
1939         echo "First let's make sure your kit is complete.  Checking..." >&4
1940         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1941         rm -f missing
1942         tmppwd=`pwd`
1943         for filelist in x??; do
1944                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1945         done
1946         if test -s missing; then
1947                 cat missing >&4
1948                 cat >&4 <<'EOM'
1949
1950 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1951
1952 You have the option of continuing the configuration process, despite the
1953 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1954 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1955 and contact the author (perlbug@perl.org).
1956
1957 EOM
1958                 echo $n "Continue? [n] $c" >&4
1959                 read ans
1960                 case "$ans" in
1961                 y*)
1962                         echo "Continuing..." >&4
1963                         rm -f missing
1964                         ;;
1965                 *)
1966                         echo "ABORTING..." >&4
1967                         kill $$
1968                         ;;
1969                 esac
1970         else
1971                 echo "Looks good..."
1972         fi
1973 else
1974         echo "There is no MANIFEST file.  I hope your kit is complete !"
1975 fi
1976 rm -f missing x??
1977
1978 echo " "
1979 : Find the appropriate value for a newline for tr
1980 if test -n "$DJGPP"; then
1981        trnl='\012'
1982 fi
1983 if test X"$trnl" = X; then
1984         case "`echo foo|tr '\n' x 2>/dev/null`" in
1985         foox) trnl='\n' ;;
1986         esac
1987 fi
1988 if test X"$trnl" = X; then
1989         case "`echo foo|tr '\012' x 2>/dev/null`" in
1990         foox) trnl='\012' ;;
1991         esac
1992 fi
1993 if test X"$trnl" = X; then
1994        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1995        fooxy) trnl='\n\r' ;;
1996        esac
1997 fi
1998 if test X"$trnl" = X; then
1999         cat <<EOM >&2
2000
2001 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
2002
2003 EOM
2004         exit 1
2005 fi
2006
2007 : compute the number of columns on the terminal for proper question formatting
2008 case "$COLUMNS" in
2009 '') COLUMNS='80';;
2010 esac
2011
2012 : set up the echo used in my read
2013 myecho="case \"\$xxxm\" in
2014 '') echo $n \"\$rp $c\" >&4;;
2015 *) case \"\$rp\" in
2016         '') echo $n \"[\$xxxm] $c\";;
2017         *)
2018                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2019                         echo \"\$rp\" >&4
2020                         echo $n \"[\$xxxm] $c\" >&4
2021                 else
2022                         echo $n \"\$rp [\$xxxm] $c\" >&4
2023                 fi
2024                 ;;
2025         esac;;
2026 esac"
2027
2028 : now set up to do reads with possible shell escape and default assignment
2029 cat <<EOSC >myread
2030 $startsh
2031 xxxm=\$dflt
2032 $myecho
2033 ans='!'
2034 case "\$fastread" in
2035 yes) case "\$dflt" in
2036         '') ;;
2037         *) ans='';
2038                 case "\$silent-\$rp" in
2039                 true-) ;;
2040                 *) echo " " >&4;;
2041                 esac;;
2042         esac;;
2043 *) case "\$silent" in
2044         true) case "\$rp" in
2045                 '') ans='';;
2046                 esac;;
2047         esac;;
2048 esac
2049 while expr "X\$ans" : "X!" >/dev/null; do
2050         read answ
2051         set x \$xxxm
2052         shift
2053         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2054         case  "\$answ" in
2055         "!")
2056                 sh 1>&4
2057                 echo " "
2058                 $myecho
2059                 ;;
2060         !*)
2061                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2062                 shift
2063                 sh 1>&4 -c "\$*"
2064                 echo " "
2065                 $myecho
2066                 ;;
2067         "\$ans")
2068                 case "\$ans" in
2069                 \\&*)
2070                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2071                         shift
2072                         case "\$1" in
2073                         -d)
2074                                 fastread=yes
2075                                 echo "(OK, I'll run with -d after this question.)" >&4
2076                                 ;;
2077                         -*)
2078                                 echo "*** Sorry, \$1 not supported yet." >&4
2079                                 ;;
2080                         esac
2081                         $myecho
2082                         ans=!
2083                         ;;
2084                 esac;;
2085         *)
2086                 case "\$aok" in
2087                 y)
2088                         echo "*** Substitution done -- please confirm."
2089                         xxxm="\$ans"
2090                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2091                         xxxm="\$ans"
2092                         ans=!
2093                         ;;
2094                 *)
2095                         echo "*** Error -- try again."
2096                         ans=!
2097                         ;;
2098                 esac
2099                 $myecho
2100                 ;;
2101         esac
2102         case "\$ans\$xxxm\$nostick" in
2103         '')
2104                 ans=!
2105                 $myecho
2106                 ;;
2107         esac
2108 done
2109 case "\$ans" in
2110 '') ans="\$xxxm";;
2111 esac
2112 EOSC
2113
2114 : create .config dir to save info across Configure sessions
2115 test -d ../.config || mkdir ../.config
2116 cat >../.config/README <<EOF
2117 This directory created by Configure to save information that should
2118 persist across sessions for $package.
2119
2120 You may safely delete it if you wish.
2121 EOF
2122
2123 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2124 case "$usedevel" in
2125 $define|true|[yY]*) ;;
2126 *) case "$xversion" in
2127    *[13579])
2128         cat >&4 <<EOH
2129 *** WHOA THERE!!! ***
2130
2131     This is an UNSTABLE DEVELOPMENT release.
2132     The version of this $package distribution is $xversion, that is, odd,
2133     (as opposed to even) and that signifies a development release.
2134     If you want a maintenance release, you want an even-numbered version.
2135
2136     Do ***NOT*** install this into production use.
2137     Data corruption and crashes are possible.
2138
2139     It is most seriously suggested that you do not continue any further
2140     unless you want to help in developing and debugging Perl.
2141
2142     If you *still* want to build perl, you can answer 'y' now,
2143     or pass -Dusedevel to Configure.
2144
2145 EOH
2146         rp='Do you really want to continue?'
2147         dflt='n'
2148         . ./myread
2149         case "$ans" in
2150         [yY]) echo >&4 "Okay, continuing."
2151               usedevel="$define" ;;
2152         *) echo >&4 "Okay, bye."
2153            exit 1
2154            ;;
2155         esac
2156         ;;
2157     esac
2158     ;;
2159 esac
2160 case "$usedevel" in
2161 $define|true|[yY]*)
2162         case "$versiononly" in
2163         '') versiononly="$define" ;;
2164         esac
2165         case "$installusrbinperl" in
2166         '') installusrbinperl="$undef" ;;
2167         esac
2168         ;;
2169 esac
2170
2171 : general instructions
2172 needman=true
2173 firsttime=true
2174 user=`(logname) 2>/dev/null`
2175 case "$user" in
2176 '') user=`whoami 2>&1`;;
2177 esac
2178 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2179         firsttime=false
2180         echo " "
2181         rp='Would you like to see the instructions?'
2182         dflt=n
2183         . ./myread
2184         case "$ans" in
2185         [yY]*) ;;
2186         *) needman=false;;
2187         esac
2188 fi
2189 if $needman; then
2190         cat <<EOH
2191
2192 This installation shell script will examine your system and ask you questions
2193 to determine how the perl5 package should be installed. If you get
2194 stuck on a question, you may use a ! shell escape to start a subshell or
2195 execute a command.  Many of the questions will have default answers in square
2196 brackets; typing carriage return will give you the default.
2197
2198 On some of the questions which ask for file or directory names you are allowed
2199 to use the ~name construct to specify the login directory belonging to "name",
2200 even if you don't have a shell which knows about that.  Questions where this is
2201 allowed will be marked "(~name ok)".
2202
2203 EOH
2204         rp=''
2205         dflt='Type carriage return to continue'
2206         . ./myread
2207         cat <<'EOH'
2208
2209 The prompter used in this script allows you to use shell variables and
2210 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2211 in the default answer, as if the default line was a set of arguments given to a
2212 script shell.  This means you may also use $* to repeat the whole default line,
2213 so you do not have to re-type everything to add something to the default.
2214
2215 Everytime there is a substitution, you will have to confirm.  If there is an
2216 error (e.g. an unmatched backtick), the default answer will remain unchanged
2217 and you will be prompted again.
2218
2219 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2220 the questions and use the computed defaults (or the previous answers if there
2221 was already a config.sh file). Type 'Configure -h' for a list of options.
2222 You may also start interactively and then answer '& -d' at any prompt to turn
2223 on the non-interactive behaviour for the remainder of the execution.
2224
2225 EOH
2226         . ./myread
2227         cat <<EOH
2228
2229 Much effort has been expended to ensure that this shell script will run on any
2230 Unix system.  If despite that it blows up on yours, your best bet is to edit
2231 Configure and run it again.  If you can't run Configure for some reason,
2232 you'll have to generate a config.sh file by hand.  Whatever problems you
2233 have, let me (perlbug@perl.org) know how I blew it.
2234
2235 This installation script affects things in two ways:
2236
2237 1) it may do direct variable substitutions on some of the files included
2238    in this kit.
2239 2) it builds a config.h file for inclusion in C programs.  You may edit
2240    any of these files as the need arises after running this script.
2241
2242 If you make a mistake on a question, there is no easy way to back up to it
2243 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2244 files.  Configure will offer to let you do this before it runs the SH files.
2245
2246 EOH
2247         dflt='Type carriage return to continue'
2248         . ./myread
2249         case "$firsttime" in
2250         true) echo $user >>../.config/instruct;;
2251         esac
2252 fi
2253
2254 : find out where common programs are
2255 echo " "
2256 echo "Locating common programs..." >&4
2257 cat <<EOSC >loc
2258 $startsh
2259 case \$# in
2260 0) exit 1;;
2261 esac
2262 thing=\$1
2263 shift
2264 dflt=\$1
2265 shift
2266 for dir in \$*; do
2267         case "\$thing" in
2268         .)
2269         if test -d \$dir/\$thing; then
2270                 echo \$dir
2271                 exit 0
2272         fi
2273         ;;
2274         *)
2275         for thisthing in \$dir/\$thing; do
2276                 : just loop through to pick last item
2277         done
2278         if test -f \$thisthing; then
2279                 echo \$thisthing
2280                 exit 0
2281         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2282                 echo \$thisthing
2283                 exit 0
2284         elif test -f \$dir/\$thing.exe; then
2285                 if test -n "$DJGPP"; then
2286                         echo \$dir/\$thing.exe
2287                 elif test "$eunicefix" != ":"; then
2288                         : on Eunice apparently
2289                         echo \$dir/\$thing
2290                         exit 0
2291                 fi
2292                 exit 0
2293         fi
2294         ;;
2295         esac
2296 done
2297 echo \$dflt
2298 exit 1
2299 EOSC
2300 chmod +x loc
2301 $eunicefix loc
2302 loclist="
2303 awk
2304 cat
2305 chmod
2306 comm
2307 cp
2308 echo
2309 expr
2310 grep
2311 ls
2312 mkdir
2313 rm
2314 sed
2315 sort
2316 touch
2317 tr
2318 uniq
2319 "
2320 trylist="
2321 Mcc
2322 ar
2323 bison
2324 byacc
2325 cpp
2326 csh
2327 date
2328 egrep
2329 gmake
2330 gzip
2331 less
2332 ln
2333 make
2334 more
2335 nm
2336 nroff
2337 pg
2338 test
2339 uname
2340 zip
2341 "
2342 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2343 pth="$pth /lib /usr/lib"
2344 for file in $loclist; do
2345         eval xxx=\$$file
2346         case "$xxx" in
2347         /*|?:[\\/]*)
2348                 if test -f "$xxx"; then
2349                         : ok
2350                 else
2351                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352                         xxx=`./loc $file $file $pth`
2353                 fi
2354                 ;;
2355         '') xxx=`./loc $file $file $pth`;;
2356         *) xxx=`./loc $xxx $xxx $pth`;;
2357         esac
2358         eval $file=$xxx$_exe
2359         eval _$file=$xxx
2360         case "$xxx" in
2361         /*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         ?:[\\/]*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         *)
2368                 echo "I don't know where '$file' is, and my life depends on it." >&4
2369                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2370                 exit 1
2371                 ;;
2372         esac
2373 done
2374 echo " "
2375 echo "Don't worry if any of the following aren't found..."
2376 say=offhand
2377 for file in $trylist; do
2378         eval xxx=\$$file
2379         case "$xxx" in
2380         /*|?:[\\/]*)
2381                 if test -f "$xxx"; then
2382                         : ok
2383                 else
2384                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2385                         xxx=`./loc $file $file $pth`
2386                 fi
2387                 ;;
2388         '') xxx=`./loc $file $file $pth`;;
2389         *) xxx=`./loc $xxx $xxx $pth`;;
2390         esac
2391         eval $file=$xxx$_exe
2392         eval _$file=$xxx
2393         case "$xxx" in
2394         /*)
2395                 echo $file is in $xxx.
2396                 ;;
2397         ?:[\\/]*)
2398                 echo $file is in $xxx.
2399                 ;;
2400         *)
2401                 echo "I don't see $file out there, $say."
2402                 say=either
2403                 ;;
2404         esac
2405 done
2406 case "$egrep" in
2407 egrep)
2408         echo "Substituting grep for egrep."
2409         egrep=$grep
2410         _egrep=$grep
2411         ;;
2412 esac
2413 case "$ln" in
2414 ln)
2415         echo "Substituting cp for ln."
2416         ln=$cp
2417         _ln=$cp
2418         ;;
2419 esac
2420 case "$make" in
2421 make)   
2422         case "$gmake" in
2423         gmake)
2424         echo "I can't find make or gmake, and my life depends on it." >&4
2425         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2426         exit 1
2427         ;;
2428         esac
2429         ;;
2430 esac    
2431 case "$gmake" in
2432 gmake)  ;;
2433 *)      # We can't have osname yet.
2434         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2435                 # Assume that gmake, if found, is definitely GNU make
2436                 # and prefer it over the system make.
2437                 echo "Substituting gmake for make."
2438                 make=$gmake
2439                 _make=$gmake
2440         fi
2441         ;;
2442 esac
2443 case "$test" in
2444 test)
2445         echo "Hopefully test is built into your sh."
2446         ;;
2447 *)
2448         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2449                 echo "Using the test built into your sh."
2450                 test=test
2451                 _test=test
2452         fi
2453         ;;
2454 esac
2455 case "$echo" in
2456 echo)
2457         echo "Hopefully echo is built into your sh."
2458         ;;
2459 '') ;;
2460 *)
2461         echo " "
2462 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2463         $echo $n "hi there$c" >foo1
2464         echo $n "hi there$c" >foo2
2465         if cmp foo1 foo2 >/dev/null 2>&1; then
2466                 echo "They are compatible.  In fact, they may be identical."
2467         else
2468                 case "$n" in
2469                 '-n') n='' c='\c';;
2470                 *) n='-n' c='';;
2471                 esac
2472                 cat <<FOO
2473 They are not compatible!  You are probably running ksh on a non-USG system.
2474 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2475 have echo built in and we may have to run some Bourne shell scripts.  That
2476 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2477
2478 FOO
2479                 $echo $n "The star should be here-->$c"
2480                 $echo "*"
2481         fi
2482         $rm -f foo1 foo2
2483         ;;
2484 esac
2485
2486 cat <<EOS >trygcc
2487 $startsh
2488 EOS
2489 cat <<'EOSC' >>trygcc
2490 case "$cc" in
2491 '') ;;
2492 *)  $rm -f try try.*
2493     $cat >try.c <<EOM
2494 int main(int argc, char *argv[]) {
2495   return 0;
2496 }
2497 EOM
2498     if $cc -o try $ccflags $ldflags try.c; then
2499        :
2500     else
2501         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2502         despair=yes
2503         trygcc=yes
2504         case "$cc" in
2505         *gcc*) trygcc=no ;;
2506         esac
2507         # Skip this test because it gives a false match on output like:
2508         #    ./trygcc: line 23: cc: command not found
2509         # case "`$cc -v -c try.c 2>&1`" in
2510         # *gcc*) trygcc=no ;;
2511         # esac
2512         if $test X"$trygcc" = Xyes; then
2513             if gcc -o try -c try.c; then
2514                 echo " "
2515                 echo "You seem to have a working gcc, though." >&4
2516                 # Switching compilers may undo the work of hints files.
2517                 # The most common problem is -D_REENTRANT for threads.
2518                 # This heuristic catches that case, but gets false positives
2519                 # if -Dusethreads was not actually specified.  Better to
2520                 # bail out here with a useful message than fail 
2521                 # mysteriously later. Should we perhaps just try to
2522                 # re-invoke Configure -Dcc=gcc config_args ?
2523                 if $test -f usethreads.cbu; then
2524                         $cat >&4 <<EOM 
2525
2526 *** However, any setting of the C compiler flags (e.g. for thread support)
2527 *** will be lost.  It may be necessary for you to restart Configure and
2528 *** add -Dcc=gcc to your Configure command line.
2529
2530 EOM
2531                         rp="Would you like to go ahead and try gcc anyway?"
2532                         dflt=n
2533                 else
2534                         rp="Would you like to use it?"
2535                         dflt=y
2536                 fi
2537                 if $test -f myread; then
2538                     . ./myread
2539                 else
2540                     if $test -f UU/myread; then
2541                         . ./UU/myread
2542                     else
2543                         echo "Cannot find myread, sorry.  Aborting." >&2
2544                         exit 1
2545                     fi
2546                 fi  
2547                 case "$ans" in
2548                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2549                 esac
2550             fi
2551         fi
2552     fi
2553     $rm -f try try.*
2554     ;;
2555 esac
2556 EOSC
2557
2558 cat <<EOS >checkcc
2559 $startsh
2560 EOS
2561 cat <<'EOSC' >>checkcc
2562 case "$cc" in        
2563 '') ;;
2564 *)  $rm -f try try.*              
2565     $cat >try.c <<EOM
2566 int main(int argc, char *argv[]) {
2567   return 0;
2568 }
2569 EOM
2570     if $cc -o try $ccflags $ldflags try.c; then
2571        :
2572     else
2573         if $test X"$despair" = Xyes; then
2574            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2575         fi
2576         $cat >&4 <<EOM         
2577 You need to find a working C compiler.
2578 Either (purchase and) install the C compiler supplied by your OS vendor,
2579 or for a free C compiler try http://gcc.gnu.org/
2580 I cannot continue any further, aborting.
2581 EOM
2582         exit 1
2583     fi
2584     $rm -f try try.*
2585     ;;
2586 esac
2587 EOSC
2588
2589 : determine whether symbolic links are supported
2590 echo " "
2591 $touch blurfl
2592 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2593         echo "Symbolic links are supported." >&4
2594         lns="$ln -s"
2595 else
2596         echo "Symbolic links are NOT supported." >&4
2597         lns="$ln"
2598 fi
2599 $rm -f blurfl sym
2600
2601 : determine whether symbolic links are supported
2602 echo " "
2603 case "$lns" in
2604 *"ln"*" -s")
2605         echo "Checking how to test for symbolic links..." >&4
2606         $lns blurfl sym
2607         if $test "X$issymlink" = X; then
2608                 case "$newsh" in
2609                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2610                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2611                 esac
2612                 if test $? = 0; then
2613                         issymlink="test -h"
2614                 else
2615                         echo "Your builtin 'test -h' may be broken." >&4
2616                         case "$test" in
2617                         /*)     ;;
2618                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2619                                 for p in $pth
2620                                 do
2621                                         if test -f "$p/$test"; then
2622                                                 test="$p/$test"
2623                                                 break
2624                                         fi
2625                                 done
2626                                 ;;
2627                         esac
2628                         case "$test" in
2629                         /*)
2630                                 echo "Trying external '$test -h'." >&4
2631                                 issymlink="$test -h"
2632                                 if $test ! -h sym >/dev/null 2>&1; then
2633                                         echo "External '$test -h' is broken, too." >&4
2634                                         issymlink=''
2635                                 fi
2636                                 ;;
2637                         *)      issymlink='' ;;
2638                         esac
2639                 fi              
2640         fi
2641         if $test "X$issymlink" = X; then
2642                 if $test -L sym 2>/dev/null; then
2643                         issymlink="$test -L"
2644                         echo "The builtin '$test -L' worked." >&4
2645                 fi
2646         fi
2647         if $test "X$issymlink" != X; then
2648                 echo "You can test for symbolic links with '$issymlink'." >&4
2649         else
2650                 echo "I do not know how you can test for symbolic links." >&4
2651         fi
2652         $rm -f blurfl sym
2653         ;;
2654 *)      echo "No symbolic links, so not testing for their testing..." >&4
2655         ;;
2656 esac
2657 echo " "
2658
2659
2660 case "$mksymlinks" in
2661 $define|true|[yY]*)
2662         case "$src" in
2663         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2664                 exit 1
2665                 ;;
2666         *)      case "$lns:$issymlink" in
2667                 *"ln"*" -s:"*"test -"?)
2668                         echo "Creating the symbolic links..." >&4
2669                         echo "(First creating the subdirectories...)" >&4
2670                         cd ..
2671                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2672                                 read directory
2673                                 test -z "$directory" && break
2674                                 mkdir -p $directory
2675                         done
2676                         # Sanity check 1.
2677                         if test ! -d t/base; then
2678                                 echo "Failed to create the subdirectories.  Aborting." >&4
2679                                 exit 1
2680                         fi
2681                         echo "(Then creating the symlinks...)" >&4
2682                         awk '{print $1}' $src/MANIFEST | while true; do
2683                                 read filename
2684                                 test -z "$filename" && break
2685                                 if test -f $filename; then
2686                                         if $issymlink $filename; then
2687                                                 rm -f $filename
2688                                         fi
2689                                 fi
2690                                 if test -f $filename; then
2691                                         echo "$filename already exists, not symlinking."
2692                                 else
2693                                         ln -s $src/$filename $filename
2694                                 fi
2695                         done
2696                         # Sanity check 2.
2697                         if test ! -f t/base/lex.t; then
2698                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2699                                 exit 1
2700                         fi
2701                         cd UU
2702                         ;;
2703                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2704                         ;;
2705                 esac
2706                 ;;
2707         esac
2708         ;;
2709 esac
2710
2711
2712 case "$usecrosscompile" in
2713 $define|true|[yY]*)
2714         $echo "Cross-compiling..."
2715         croak=''
2716         case "$cc" in
2717         *-*-gcc) # A cross-compiling gcc, probably.
2718             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2719             ar=$targetarch-ar
2720             # leave out ld, choosing it is more complex
2721             nm=$targetarch-nm
2722             ranlib=$targetarch-ranlib
2723             $echo 'extern int foo;' > try.c
2724             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2725             shift
2726             if $test $# -gt 0; then
2727                 incpth="$incpth $*"
2728                 incpth="`$echo $incpth|$sed 's/^ //'`"
2729                 echo "Guessing incpth '$incpth'." >&4
2730                 for i in $*; do
2731                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2732                     if $test -d $j; then
2733                         libpth="$libpth $j"
2734                     fi
2735                 done   
2736                 libpth="`$echo $libpth|$sed 's/^ //'`"
2737                 echo "Guessing libpth '$libpth'." >&4
2738             fi
2739             $rm -f try.c
2740             ;;
2741         esac
2742         case "$targetarch" in
2743         '') echo "Targetarch not defined." >&4; croak=y ;;
2744         *)  echo "Using targetarch $targetarch." >&4 ;;
2745         esac
2746         case "$incpth" in
2747         '') echo "Incpth not defined." >&4; croak=y ;;
2748         *)  echo "Using incpth '$incpth'." >&4 ;;
2749         esac
2750         case "$libpth" in
2751         '') echo "Libpth not defined." >&4; croak=y ;;
2752         *)  echo "Using libpth '$libpth'." >&4 ;;
2753         esac
2754         case "$usrinc" in
2755         '') for i in $incpth; do
2756                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2757                     usrinc=$i
2758                     echo "Guessing usrinc $usrinc." >&4
2759                     break
2760                 fi
2761             done
2762             case "$usrinc" in
2763             '') echo "Usrinc not defined." >&4; croak=y ;;
2764             esac
2765             ;;
2766         *)  echo "Using usrinc $usrinc." >&4 ;;
2767         esac
2768         case "$targethost" in
2769         '') echo "Targethost not defined." >&4; croak=y ;;
2770         *)  echo "Using targethost $targethost." >&4
2771         esac
2772         locincpth=' '
2773         loclibpth=' '
2774         case "$croak" in
2775         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2776         esac
2777         case "$src" in
2778         /*) run=$src/Cross/run
2779             targetmkdir=$src/Cross/mkdir
2780             to=$src/Cross/to
2781             from=$src/Cross/from
2782             ;;
2783         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2784             run=$pwd/Cross/run
2785             targetmkdir=$pwd/Cross/mkdir
2786             to=$pwd/Cross/to
2787             from=$pwd/Cross/from
2788             ;;
2789         esac
2790         case "$targetrun" in
2791         '') targetrun=ssh ;;
2792         esac
2793         case "$targetto" in
2794         '') targetto=scp ;;
2795         esac
2796         case "$targetfrom" in
2797         '') targetfrom=scp ;;
2798         esac
2799         run=$run-$targetrun
2800         to=$to-$targetto
2801         from=$from-$targetfrom
2802         case "$targetdir" in
2803         '')  targetdir=/tmp
2804              echo "Guessing targetdir $targetdir." >&4
2805              ;;
2806         esac
2807         case "$targetuser" in
2808         '')  targetuser=root
2809              echo "Guessing targetuser $targetuser." >&4
2810              ;;
2811         esac
2812         case "$targetfrom" in
2813         scp)    q=-q ;;
2814         *)      q='' ;;
2815         esac
2816         case "$targetrun" in
2817         ssh|rsh)
2818             cat >$run <<EOF
2819 #!/bin/sh
2820 case "\$1" in
2821 -cwd)
2822   shift
2823   cwd=\$1
2824   shift
2825   ;;
2826 esac
2827 case "\$cwd" in
2828 '') cwd=$targetdir ;;
2829 esac
2830 exe=\$1
2831 shift
2832 if $test ! -f \$exe.xok; then
2833   $to \$exe
2834   $touch \$exe.xok
2835 fi
2836 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2837 EOF
2838             ;;
2839         *)  echo "Unknown targetrun '$targetrun'" >&4
2840             exit 1
2841             ;;
2842         esac
2843         case "$targetmkdir" in
2844         */Cross/mkdir)
2845             cat >$targetmkdir <<EOF
2846 #!/bin/sh
2847 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2848 EOF
2849             $chmod a+rx $targetmkdir
2850             ;;
2851         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2852             exit 1
2853             ;;
2854         esac
2855         case "$targetto" in
2856         scp|rcp)
2857             cat >$to <<EOF
2858 #!/bin/sh
2859 for f in \$@
2860 do
2861   case "\$f" in
2862   /*)
2863     $targetmkdir \`dirname \$f\`
2864     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2865     ;;
2866   *)
2867     $targetmkdir $targetdir/\`dirname \$f\`
2868     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2869     ;;
2870   esac
2871 done
2872 exit 0
2873 EOF
2874             ;;
2875         cp) cat >$to <<EOF
2876 #!/bin/sh
2877 for f in \$@
2878 do
2879   case "\$f" in
2880   /*)
2881     $mkdir -p $targetdir/\`dirname \$f\`
2882     $cp \$f $targetdir/\$f || exit 1
2883     ;;
2884   *)
2885     $targetmkdir $targetdir/\`dirname \$f\`
2886     $cp \$f $targetdir/\$f || exit 1
2887     ;;
2888   esac
2889 done
2890 exit 0
2891 EOF
2892             ;;
2893         *)  echo "Unknown targetto '$targetto'" >&4
2894             exit 1
2895             ;;
2896         esac
2897         case "$targetfrom" in
2898         scp|rcp)
2899           cat >$from <<EOF
2900 #!/bin/sh
2901 for f in \$@
2902 do
2903   $rm -f \$f
2904   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2905 done
2906 exit 0
2907 EOF
2908             ;;
2909         cp) cat >$from <<EOF
2910 #!/bin/sh
2911 for f in \$@
2912 do
2913   $rm -f \$f
2914   cp $targetdir/\$f . || exit 1
2915 done
2916 exit 0
2917 EOF
2918             ;;
2919         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2920             exit 1
2921             ;;
2922         esac
2923         if $test ! -f $run; then
2924             echo "Target 'run' script '$run' not found." >&4
2925         else
2926             $chmod a+rx $run
2927         fi
2928         if $test ! -f $to; then
2929             echo "Target 'to' script '$to' not found." >&4
2930         else
2931             $chmod a+rx $to
2932         fi
2933         if $test ! -f $from; then
2934             echo "Target 'from' script '$from' not found." >&4
2935         else
2936             $chmod a+rx $from
2937         fi
2938         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2939             exit 1
2940         fi
2941         cat >&4 <<EOF
2942 Using '$run' for remote execution,
2943 and '$from' and '$to'
2944 for remote file transfer.
2945 EOF
2946         ;;
2947 *)      run=''
2948         to=:
2949         from=:
2950         usecrosscompile='undef'
2951         targetarch=''
2952         ;;
2953 esac
2954
2955 : see whether [:lower:] and [:upper:] are supported character classes
2956 echo " "
2957 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2958 ABYZ)
2959         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2960         up='[:upper:]'
2961         low='[:lower:]'
2962         ;;
2963 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2964         # (0xd9 and 0xe2), therefore that is a nice testing point.
2965         if test "X$up" = X -o "X$low" = X; then
2966             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2967             rs) up='[A-Z]'
2968                 low='[a-z]'
2969                 ;;
2970             esac
2971         fi
2972         if test "X$up" = X -o "X$low" = X; then
2973             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2974             rs) up='A-Z'
2975                 low='a-z'
2976                 ;;
2977             esac
2978         fi
2979         if test "X$up" = X -o "X$low" = X; then
2980             case "`echo RS | od -x 2>/dev/null`" in
2981             *D9E2*|*d9e2*)
2982                 echo "Hey, this might be EBCDIC." >&4
2983                 if test "X$up" = X -o "X$low" = X; then
2984                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2985                     rs) up='[A-IJ-RS-Z]'
2986                         low='[a-ij-rs-z]'
2987                         ;;
2988                     esac
2989                 fi
2990                 if test "X$up" = X -o "X$low" = X; then
2991                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2992                     rs) up='A-IJ-RS-Z'
2993                         low='a-ij-rs-z'
2994                         ;;
2995                     esac
2996                 fi
2997                 ;;
2998             esac
2999         fi
3000 esac
3001 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
3002 rs)
3003     echo "Using $up and $low to convert case." >&4
3004     ;;
3005 *)
3006     echo "I don't know how to translate letters from upper to lower case." >&4
3007     echo "Your tr is not acting any way I know of." >&4
3008     exit 1
3009     ;;
3010 esac
3011 : set up the translation script tr, must be called with ./tr of course
3012 cat >tr <<EOSC
3013 $startsh
3014 case "\$1\$2" in
3015 '[A-Z][a-z]') exec $tr '$up' '$low';;
3016 '[a-z][A-Z]') exec $tr '$low' '$up';;
3017 esac
3018 exec $tr "\$@"
3019 EOSC
3020 chmod +x tr
3021 $eunicefix tr
3022
3023 : Try to determine whether config.sh was made on this system
3024 case "$config_sh" in
3025 '')
3026 myuname=`$uname -a 2>/dev/null`
3027 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3028 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3029 # because the A-Z/a-z are not consecutive.
3030 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \
3031         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3032 newmyuname="$myuname"
3033 dflt=n
3034 case "$knowitall" in
3035 '')
3036         if test -f ../config.sh; then
3037                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3038                         eval "`grep myuname= ../config.sh`"
3039                 fi
3040                 if test "X$myuname" = "X$newmyuname"; then
3041                         dflt=y
3042                 fi
3043         fi
3044         ;;
3045 *) dflt=y;;
3046 esac
3047
3048 : Get old answers from old config file if Configure was run on the
3049 : same system, otherwise use the hints.
3050 hint=default
3051 cd ..
3052 if test -f config.sh; then
3053         echo " "
3054         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3055         . UU/myread
3056         case "$ans" in
3057         n*|N*) echo "OK, I'll ignore it."
3058                 mv config.sh config.sh.old
3059                 myuname="$newmyuname"
3060                 ;;
3061         *)  echo "Fetching default answers from your old config.sh file..." >&4
3062                 tmp_n="$n"
3063                 tmp_c="$c"
3064                 tmp_sh="$sh"
3065                 . ./config.sh
3066                 cp config.sh UU
3067                 n="$tmp_n"
3068                 c="$tmp_c"
3069                 : Older versions did not always set $sh.  Catch re-use of such
3070                 : an old config.sh.
3071                 case "$sh" in
3072                 '') sh="$tmp_sh" ;;
3073                 esac
3074                 hint=previous
3075                 ;;
3076         esac
3077 fi
3078 . ./UU/checkcc
3079 if test ! -f config.sh; then
3080         $cat <<EOM
3081
3082 First time through, eh?  I have some defaults handy for some systems
3083 that need some extra help getting the Configure answers right:
3084
3085 EOM
3086         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3087         dflt=''
3088         : Half the following guesses are probably wrong... If you have better
3089         : tests or hints, please send them to perlbug@perl.org
3090         : The metaconfig authors would also appreciate a copy...
3091         $test -f /irix && osname=irix
3092         $test -f /xenix && osname=sco_xenix
3093         $test -f /dynix && osname=dynix
3094         $test -f /dnix && osname=dnix
3095         $test -f /lynx.os && osname=lynxos
3096         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3097         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3098         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3099         $test -f /bin/mips && /bin/mips && osname=mips
3100         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3101                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3102         $test -d /usr/apollo/bin && osname=apollo
3103         $test -f /etc/saf/_sactab && osname=svr4
3104         $test -d /usr/include/minix && osname=minix
3105         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3106         if $test -d /MachTen -o -d /MachTen_Folder; then
3107                 osname=machten
3108                 if $test -x /sbin/version; then
3109                         osvers=`/sbin/version | $awk '{print $2}' |
3110                         $sed -e 's/[A-Za-z]$//'`
3111                 elif $test -x /usr/etc/version; then
3112                         osvers=`/usr/etc/version | $awk '{print $2}' |
3113                         $sed -e 's/[A-Za-z]$//'`
3114                 else
3115                         osvers="$2.$3"
3116                 fi
3117         fi
3118
3119         $test -f /sys/posix.dll &&
3120                 $test -f /usr/bin/what &&
3121                 set X `/usr/bin/what /sys/posix.dll` &&
3122                 $test "$3" = UWIN &&
3123                 osname=uwin &&
3124                 osvers="$5"
3125
3126         if $test -f $uname; then
3127                 set X $myuname
3128                 shift
3129
3130                 case "$5" in
3131                 fps*) osname=fps ;;
3132                 mips*)
3133                         case "$4" in
3134                         umips) osname=umips ;;
3135                         *) osname=mips ;;
3136                         esac;;
3137                 [23]100) osname=mips ;;
3138                 next*) osname=next ;;
3139                 i386*)
3140                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3141                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3142                                 osname='sco'
3143                                 osvers=$tmp
3144                         elif $test -f /etc/kconfig; then
3145                                 osname=isc
3146                                 if test "$lns" = "$ln -s"; then
3147                                         osvers=4
3148                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3149                                         osvers=3
3150                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3151                                         osvers=2
3152                                 fi
3153                         fi
3154                         tmp=''
3155                         ;;
3156                 pc*)
3157                         if test -n "$DJGPP"; then
3158                                 osname=dos
3159                                 osvers=djgpp
3160                         fi
3161                         ;;
3162                 esac
3163
3164                 case "$1" in
3165                 aix) osname=aix
3166                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3167                         case "$tmp" in
3168                         # oslevel can fail with:
3169                         # oslevel: Unable to acquire lock.
3170                         *not\ found) osvers="$4"."$3" ;;
3171                         '<3240'|'<>3240') osvers=3.2.0 ;;
3172                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3173                         '=3250'|'>3250') osvers=3.2.5 ;;
3174                         *) osvers=$tmp;;
3175                         esac
3176                         ;;
3177                 bsd386) osname=bsd386
3178                         osvers=`$uname -r`
3179                         ;;
3180                 cygwin*) osname=cygwin
3181                         osvers="$3"
3182                         ;;
3183                 *dc.osx) osname=dcosx
3184                         osvers="$3"
3185                         ;;
3186                 dnix) osname=dnix
3187                         osvers="$3"
3188                         ;;
3189                 domainos) osname=apollo
3190                         osvers="$3"
3191                         ;;
3192                 dgux)   osname=dgux
3193                         osvers="$3"
3194                         ;;
3195                 dragonfly) osname=dragonfly
3196                         osvers="$3"
3197                         ;;
3198                 dynixptx*) osname=dynixptx
3199                         osvers=`echo "$4"|sed 's/^v//'`
3200                         ;;
3201                 freebsd) osname=freebsd
3202                         osvers="$3" ;;
3203                 genix)  osname=genix ;;
3204                 gnu)    osname=gnu
3205                         osvers="$3" ;;
3206                 hp*)    osname=hpux
3207                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3208                         ;;
3209                 irix*)  osname=irix
3210                         case "$3" in
3211                         4*) osvers=4 ;;
3212                         5*) osvers=5 ;;
3213                         *)      osvers="$3" ;;
3214                         esac
3215                         ;;
3216                 linux)  osname=linux
3217                         case "$3" in
3218                         *)      osvers="$3" ;;
3219                         esac
3220                         ;;
3221                 MiNT)   osname=mint
3222                         ;;
3223                 netbsd*) osname=netbsd
3224                         osvers="$3"
3225                         ;;
3226                 news-os) osvers="$3"
3227                         case "$3" in
3228                         4*) osname=newsos4 ;;
3229                         *) osname=newsos ;;
3230                         esac
3231                         ;;
3232                 next*) osname=next ;;
3233                 nonstop-ux) osname=nonstopux ;;
3234                 openbsd) osname=openbsd
3235                         osvers="$3"
3236                         ;;
3237                 os2)    osname=os2
3238                         osvers="$4"
3239                         ;;
3240                 POSIX-BC | posix-bc ) osname=posix-bc
3241                         osvers="$3"
3242                         ;;
3243                 powerux | power_ux | powermax_os | powermaxos | \
3244                 powerunix | power_unix) osname=powerux
3245                         osvers="$3"
3246                         ;;
3247                 qnx) osname=qnx
3248                         osvers="$4"
3249                         ;;
3250                 solaris) osname=solaris
3251                         case "$3" in
3252                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3253                         *)      osvers="$3" ;;
3254                         esac
3255                         ;;
3256                 sunos) osname=sunos
3257                         case "$3" in
3258                         5*) osname=solaris
3259                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3260                         *)      osvers="$3" ;;
3261                         esac
3262                         ;;
3263                 titanos) osname=titanos
3264                         case "$3" in
3265                         1*) osvers=1 ;;
3266                         2*) osvers=2 ;;
3267                         3*) osvers=3 ;;
3268                         4*) osvers=4 ;;
3269                         *)      osvers="$3" ;;
3270                         esac
3271                         ;;
3272                 ultrix) osname=ultrix
3273                         osvers="$3"
3274                         ;;
3275                 osf1|mls+)      case "$5" in
3276                                 alpha)
3277                                         osname=dec_osf
3278                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3279                                         case "$osvers" in
3280                                         [1-9].[0-9]*) ;;
3281                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3282                                         esac
3283                                         ;;
3284                         hp*)    osname=hp_osf1  ;;
3285                         mips)   osname=mips_osf1 ;;
3286                         esac
3287                         ;;
3288                 # UnixWare 7.1.2 is known as Open UNIX 8
3289                 openunix|unixware) osname=svr5
3290                         osvers="$4"
3291                         ;;
3292                 uts)    osname=uts
3293                         osvers="$3"
3294                         ;;
3295                 vos) osvers="$3"
3296                         ;;
3297                 $2) case "$osname" in
3298                         *isc*) ;;
3299                         *freebsd*) ;;
3300                         svr*)
3301                                 : svr4.x or possibly later
3302                                 case "svr$3" in
3303                                 ${osname}*)
3304                                         osname=svr$3
3305                                         osvers=$4
3306                                         ;;
3307                                 esac
3308                                 case "$osname" in
3309                                 svr4.0)
3310                                         : Check for ESIX
3311                                         if test -f /stand/boot ; then
3312                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3313                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3314                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3315                                                         if test -n "$isesix"; then
3316                                                                 osname=esix4
3317                                                         fi
3318                                                 fi
3319                                         fi
3320                                         ;;
3321                                 esac
3322                                 ;;
3323                         *)      if test -f /etc/systemid; then
3324                                         osname=sco
3325                                         set `echo $3 | $sed 's/\./ /g'` $4
3326                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3327                                                 osvers=$1.$2.$3
3328                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3329                                                 osvers=$1.$2
3330                                         elif $test -f $src/hints/sco_$1.sh; then
3331                                                 osvers=$1
3332                                         fi
3333                                 else
3334                                         case "$osname" in
3335                                         '') : Still unknown.  Probably a generic Sys V.
3336                                                 osname="sysv"
3337                                                 osvers="$3"
3338                                                 ;;
3339                                         esac
3340                                 fi
3341                                 ;;
3342                         esac
3343                         ;;
3344                 *)      case "$osname" in
3345                         '') : Still unknown.  Probably a generic BSD.
3346                                 osname="$1"
3347                                 osvers="$3"
3348                                 ;;
3349                         esac
3350                         ;;
3351                 esac
3352         else
3353                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3354                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3355                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3356                                 osname=news_os
3357                         fi
3358                         $rm -f UU/kernel.what
3359                 elif test -d c:/. -o -n "$is_os2" ; then
3360                         set X $myuname
3361                         osname=os2
3362                         osvers="$5"
3363                 fi
3364         fi
3365
3366         case "$targetarch" in
3367         '') ;;
3368         *)  hostarch=$osname
3369             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3370             osvers=''
3371             ;;
3372         esac
3373
3374         : Now look for a hint file osname_osvers, unless one has been
3375         : specified already.
3376         case "$hintfile" in
3377         ''|' ')
3378                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3379                 : Also try without trailing minor version numbers.
3380                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3381                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3382                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3383                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3384                 case "$file" in
3385                 '') dflt=none ;;
3386                 *)  case "$osvers" in
3387                         '') dflt=$file
3388                                 ;;
3389                         *)  if $test -f $src/hints/$file.sh ; then
3390                                         dflt=$file
3391                                 elif $test -f $src/hints/$xfile.sh ; then
3392                                         dflt=$xfile
3393                                 elif $test -f $src/hints/$xxfile.sh ; then
3394                                         dflt=$xxfile
3395                                 elif $test -f $src/hints/$xxxfile.sh ; then
3396                                         dflt=$xxxfile
3397                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3398                                         dflt=$xxxxfile
3399                                 elif $test -f "$src/hints/${osname}.sh" ; then
3400                                         dflt="${osname}"
3401                                 else
3402                                         dflt=none
3403                                 fi
3404                                 ;;
3405                         esac
3406                         ;;
3407                 esac
3408                 if $test -f Policy.sh ; then
3409                         case "$dflt" in
3410                         *Policy*) ;;
3411                         none) dflt="Policy" ;;
3412                         *) dflt="Policy $dflt" ;;
3413                         esac
3414                 fi
3415                 ;;
3416         *)
3417                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3418                 ;;
3419         esac
3420
3421         if $test -f Policy.sh ; then
3422                 $cat <<EOM
3423
3424 There's also a Policy hint file available, which should make the
3425 site-specific (policy) questions easier to answer.
3426 EOM
3427
3428         fi
3429
3430         $cat <<EOM
3431
3432 You may give one or more space-separated answers, or "none" if appropriate.
3433 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3434 previous run of Configure, you may specify it as well as or instead of
3435 OS-specific hints.  If hints are provided for your OS, you should use them:
3436 although Perl can probably be built without hints on many platforms, using
3437 hints often improve performance and may enable features that Configure can't
3438 set up on its own. If there are no hints that match your OS, specify "none";
3439 DO NOT give a wrong version or a wrong OS.
3440
3441 EOM
3442
3443         rp="Which of these apply, if any?"
3444         . UU/myread
3445         tans=$ans
3446         for file in $tans; do
3447                 if $test X$file = XPolicy -a -f Policy.sh; then
3448                         . Policy.sh
3449                         $cat Policy.sh >> UU/config.sh
3450                 elif $test -f $src/hints/$file.sh; then
3451                         . $src/hints/$file.sh
3452                         $cat $src/hints/$file.sh >> UU/config.sh
3453                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3454                         : nothing
3455                 else
3456                         : Give one chance to correct a possible typo.
3457                         echo "$file.sh does not exist"
3458                         dflt=$file
3459                         rp="hint to use instead?"
3460                         . UU/myread
3461                         for file in $ans; do
3462                                 if $test -f "$src/hints/$file.sh"; then
3463                                         . $src/hints/$file.sh
3464                                         $cat $src/hints/$file.sh >> UU/config.sh
3465                                 elif $test X$ans = X -o X$ans = Xnone ; then
3466                                         : nothing
3467                                 else
3468                                         echo "$file.sh does not exist -- ignored."
3469                                 fi
3470                         done
3471                 fi
3472         done
3473
3474         hint=recommended
3475         : Remember our hint file for later.
3476         if $test -f "$src/hints/$file.sh" ; then
3477                 hintfile="$file"
3478         else
3479                 hintfile=''
3480         fi
3481 fi
3482 cd UU
3483 ;;
3484 *)
3485         echo " "
3486         echo "Fetching default answers from $config_sh..." >&4
3487         tmp_n="$n"
3488         tmp_c="$c"
3489         cd ..
3490         cp $config_sh config.sh 2>/dev/null
3491         chmod +w config.sh
3492         . ./config.sh
3493         cd UU
3494         cp ../config.sh .
3495         n="$tmp_n"
3496         c="$tmp_c"
3497         hint=previous
3498         ;;
3499 esac
3500 test "$override" && . ./optdef.sh
3501
3502 : Restore computed paths
3503 for file in $loclist $trylist; do
3504         eval $file="\$_$file"
3505 done
3506
3507 cat << EOM
3508
3509 Configure uses the operating system name and version to set some defaults.
3510 The default value is probably right if the name rings a bell. Otherwise,
3511 since spelling matters for me, either accept the default or answer "none"
3512 to leave it blank.
3513
3514 EOM
3515 case "$osname" in
3516         ''|' ')
3517                 case "$hintfile" in
3518                 ''|' '|none) dflt=none ;;
3519                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3520                 esac
3521                 ;;
3522         *) dflt="$osname" ;;
3523 esac
3524 rp="Operating system name?"
3525 . ./myread
3526 case "$ans" in
3527 none)  osname='' ;;
3528 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3529 esac
3530 echo " "
3531 case "$osvers" in
3532         ''|' ')
3533                 case "$hintfile" in
3534                 ''|' '|none) dflt=none ;;
3535                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3536                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3537                         case "$dflt" in
3538                         ''|' ') dflt=none ;;
3539                         esac
3540                         ;;
3541                 esac
3542                 ;;
3543         *) dflt="$osvers" ;;
3544 esac
3545 rp="Operating system version?"
3546 . ./myread
3547 case "$ans" in
3548 none)  osvers='' ;;
3549 *) osvers="$ans" ;;
3550 esac
3551
3552
3553 . ./posthint.sh
3554
3555 : who configured the system
3556 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3557 case "$cf_by" in
3558 "")
3559         cf_by=`(logname) 2>/dev/null`
3560         case "$cf_by" in
3561         "")
3562                 cf_by=`(whoami) 2>/dev/null`
3563                 case "$cf_by" in
3564                 "") cf_by=unknown ;;
3565                 esac ;;
3566         esac ;;
3567 esac
3568
3569 : decide how portable to be.  Allow command line overrides.
3570 case "$d_portable" in
3571 "$undef") ;;
3572 *)      d_portable="$define" ;;
3573 esac
3574
3575 : set up shell script to do ~ expansion
3576 cat >filexp <<EOSS
3577 $startsh
3578 : expand filename
3579 case "\$1" in
3580  ~/*|~)
3581         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3582         ;;
3583  ~*)
3584         if $test -f /bin/csh; then
3585                 /bin/csh -f -c "glob \$1"
3586                 failed=\$?
3587                 echo ""
3588                 exit \$failed
3589         else
3590                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3591                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3592                 if $test ! -d "\$dir"; then
3593                         me=\`basename \$0\`
3594                         echo "\$me: can't locate home directory for: \$name" >&2
3595                         exit 1
3596                 fi
3597                 case "\$1" in
3598                 */*)
3599                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3600                         ;;
3601                 *)
3602                         echo \$dir
3603                         ;;
3604                 esac
3605         fi
3606         ;;
3607 *)
3608         echo \$1
3609         ;;
3610 esac
3611 EOSS
3612 chmod +x filexp
3613 $eunicefix filexp
3614
3615 : now set up to get a file name
3616 cat <<EOS >getfile
3617 $startsh
3618 EOS
3619 cat <<'EOSC' >>getfile
3620 tilde=''
3621 fullpath=''
3622 already=''
3623 skip=''
3624 none_ok=''
3625 exp_file=''
3626 nopath_ok=''
3627 orig_rp="$rp"
3628 orig_dflt="$dflt"
3629 case "$gfpth" in
3630 '') gfpth='.' ;;
3631 esac
3632
3633 case "$fn" in
3634 *\(*)
3635         : getfile will accept an answer from the comma-separated list
3636         : enclosed in parentheses even if it does not meet other criteria.
3637         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3638         fn=`echo $fn | sed 's/(.*)//'`
3639         ;;
3640 esac
3641
3642 case "$fn" in
3643 *:*)
3644         loc_file=`expr $fn : '.*:\(.*\)'`
3645         fn=`expr $fn : '\(.*\):.*'`
3646         ;;
3647 esac
3648
3649 case "$fn" in
3650 *~*) tilde=true;;
3651 esac
3652 case "$fn" in
3653 */*) fullpath=true;;
3654 esac
3655 case "$fn" in
3656 *+*) skip=true;;
3657 esac
3658 case "$fn" in
3659 *n*) none_ok=true;;
3660 esac
3661 case "$fn" in
3662 *e*) exp_file=true;;
3663 esac
3664 case "$fn" in
3665 *p*) nopath_ok=true;;
3666 esac
3667
3668 case "$fn" in
3669 *f*) type='File';;
3670 *d*) type='Directory';;
3671 *l*) type='Locate';;
3672 esac
3673
3674 what="$type"
3675 case "$what" in
3676 Locate) what='File';;
3677 esac
3678
3679 case "$exp_file" in
3680 '')
3681         case "$d_portable" in
3682         "$define") ;;
3683         *) exp_file=true;;
3684         esac
3685         ;;
3686 esac
3687
3688 cd ..
3689 while test "$type"; do
3690         redo=''
3691         rp="$orig_rp"
3692         dflt="$orig_dflt"
3693         case "$tilde" in
3694         true) rp="$rp (~name ok)";;
3695         esac
3696         . UU/myread
3697         if test -f UU/getfile.ok && \
3698                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3699         then
3700                 value="$ans"
3701                 ansexp="$ans"
3702                 break
3703         fi
3704         case "$ans" in
3705         none)
3706                 value=''
3707                 ansexp=''
3708                 case "$none_ok" in
3709                 true) type='';;
3710                 esac
3711                 ;;
3712         *)
3713                 case "$tilde" in
3714                 '') value="$ans"
3715                         ansexp="$ans";;
3716                 *)
3717                         value=`UU/filexp $ans`
3718                         case $? in
3719                         0)
3720                                 if test "$ans" != "$value"; then
3721                                         echo "(That expands to $value on this system.)"
3722                                 fi
3723                                 ;;
3724                         *) value="$ans";;
3725                         esac
3726                         ansexp="$value"
3727                         case "$exp_file" in
3728                         '') value="$ans";;
3729                         esac
3730                         ;;
3731                 esac
3732                 case "$fullpath" in
3733                 true)
3734                         case "$ansexp" in
3735                         /*) value="$ansexp" ;;
3736                         [a-zA-Z]:/*) value="$ansexp" ;;
3737                         *)
3738                                 redo=true
3739                                 case "$already" in
3740                                 true)
3741                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3742                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3743                                         ;;
3744                                 *)
3745                                 echo "Please give a full path name, starting with slash." >&4
3746                                         case "$tilde" in
3747                                         true)
3748                                 echo "Note that using ~name is ok provided it expands well." >&4
3749                                                 already=true
3750                                                 ;;
3751                                         esac
3752                                 esac
3753                                 ;;
3754                         esac
3755                         ;;
3756                 esac
3757                 case "$redo" in
3758                 '')
3759                         case "$type" in
3760                         File)
3761                                 for fp in $gfpth; do
3762                                         if test "X$fp" = X.; then
3763                                             pf="$ansexp"
3764                                         else    
3765                                             pf="$fp/$ansexp"
3766                                         fi
3767                                         if test -f "$pf"; then
3768                                                 type=''
3769                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3770                                         then
3771                                                 echo "($value is not a plain file, but that's ok.)"
3772                                                 type=''
3773                                         fi
3774                                         if test X"$type" = X; then
3775                                             value="$pf"
3776                                             break
3777                                         fi
3778                                 done
3779                                 ;;
3780                         Directory)
3781                                 for fp in $gfpth; do
3782                                         if test "X$fp" = X.; then
3783                                             dir="$ans"
3784                                             direxp="$ansexp"
3785                                         else    
3786                                             dir="$fp/$ansexp"
3787                                             direxp="$fp/$ansexp"
3788                                         fi
3789                                         if test -d "$direxp"; then
3790                                                 type=''
3791                                                 value="$dir"
3792                                                 break
3793                                         fi
3794                                 done
3795                                 ;;
3796                         Locate)
3797                                 if test -d "$ansexp"; then
3798                                         echo "(Looking for $loc_file in directory $value.)"
3799                                         value="$value/$loc_file"
3800                                         ansexp="$ansexp/$loc_file"
3801                                 fi
3802                                 if test -f "$ansexp"; then
3803                                         type=''
3804                                 fi
3805                                 case "$nopath_ok" in
3806                                 true)   case "$value" in
3807                                         */*) ;;
3808                                         *)      echo "Assuming $value will be in people's path."
3809                                                 type=''
3810                                                 ;;
3811                                         esac
3812                                         ;;
3813                                 esac
3814                                 ;;
3815                         esac
3816
3817                         case "$skip" in
3818                         true) type='';
3819                         esac
3820
3821                         case "$type" in
3822                         '') ;;
3823                         *)
3824                                 if test "$fastread" = yes; then
3825                                         dflt=y
3826                                 else
3827                                         dflt=n
3828                                 fi
3829                                 rp="$what $value doesn't exist.  Use that name anyway?"
3830                                 . UU/myread
3831                                 dflt=''
3832                                 case "$ans" in
3833                                 y*) type='';;
3834                                 *) echo " ";;
3835                                 esac
3836                                 ;;
3837                         esac
3838                         ;;
3839                 esac
3840                 ;;
3841         esac
3842 done
3843 cd UU
3844 ans="$value"
3845 rp="$orig_rp"
3846 dflt="$orig_dflt"
3847 rm -f getfile.ok
3848 test "X$gfpthkeep" != Xy && gfpth=""
3849 EOSC
3850
3851 : determine root of directory hierarchy where package will be installed.
3852 case "$prefix" in
3853 '')
3854         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3855         ;;
3856 *?/)
3857         dflt=`echo "$prefix" | sed 's/.$//'`
3858         ;;
3859 *)
3860         dflt="$prefix"
3861         ;;
3862 esac
3863 $cat <<EOM
3864
3865 By default, $package will be installed in $dflt/bin, manual pages
3866 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3867 installation directories. Typically this is something like /usr/local.
3868 If you wish to have binaries under /usr/bin but other parts of the
3869 installation under /usr/local, that's ok: you will be prompted
3870 separately for each of the installation directories, the prefix being
3871 only used to set the defaults.
3872
3873 EOM
3874 fn=d~
3875 rp='Installation prefix to use?'
3876 . ./getfile
3877 oldprefix=''
3878 case "$prefix" in
3879 '') ;;
3880 *)
3881         case "$ans" in
3882         "$prefix") ;;
3883         *) oldprefix="$prefix";;
3884         esac
3885         ;;
3886 esac
3887 prefix="$ans"
3888 prefixexp="$ansexp"
3889
3890 case "$afsroot" in
3891 '')     afsroot=/afs ;;
3892 *)      afsroot=$afsroot ;;
3893 esac
3894
3895 : is AFS running?
3896 echo " "
3897 case "$afs" in
3898 $define|true)   afs=true ;;
3899 $undef|false)   afs=false ;;
3900 *)      if test -d $afsroot; then
3901                 afs=true
3902         else
3903                 afs=false
3904         fi
3905         ;;
3906 esac
3907 if $afs; then
3908         echo "AFS may be running... I'll be extra cautious then..." >&4
3909 else
3910         echo "AFS does not seem to be running..." >&4
3911 fi
3912
3913 : determine installation prefix for where package is to be installed.
3914 if $afs; then 
3915 $cat <<EOM
3916
3917 Since you are running AFS, I need to distinguish the directory in which
3918 files will reside from the directory in which they are installed (and from
3919 which they are presumably copied to the former directory by occult means).
3920
3921 EOM
3922         case "$installprefix" in
3923         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3924         *) dflt="$installprefix";;
3925         esac
3926 else
3927 $cat <<EOM
3928
3929 In some special cases, particularly when building $package for distribution,
3930 it is convenient to distinguish the directory in which files should be
3931 installed from the directory ($prefix) in which they will
3932 eventually reside.  For most users, these two directories are the same.
3933
3934 EOM
3935         case "$installprefix" in
3936         '') dflt=$prefix ;;
3937         *) dflt=$installprefix;;
3938         esac
3939 fi
3940 fn=d~
3941 rp='What installation prefix should I use for installing files?'
3942 . ./getfile
3943 installprefix="$ans"
3944 installprefixexp="$ansexp"
3945
3946 : Perform the prefixexp/installprefixexp correction if necessary
3947 cat <<EOS >installprefix
3948 $startsh
3949 EOS
3950 cat <<'EOSC' >>installprefix
3951 : Change installation prefix, if necessary.
3952 if $test X"$prefix" != X"$installprefix"; then
3953     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3954 else
3955     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3956 fi
3957 EOSC
3958 chmod +x installprefix
3959 $eunicefix installprefix
3960
3961 : Set variables such as privlib and privlibexp from the output of ./getfile
3962 : performing the prefixexp/installprefixexp correction if necessary.
3963 cat <<EOS >setprefixvar
3964 $startsh
3965 EOS
3966 cat <<'EOSC' >>setprefixvar
3967 eval "${prefixvar}=\"\$ans\""
3968 eval "${prefixvar}exp=\"\$ansexp\""
3969 . ./installprefix
3970 EOSC
3971 chmod +x setprefixvar
3972 $eunicefix setprefixvar
3973
3974 : set up the script used to warn in case of inconsistency
3975 cat <<EOS >whoa
3976 $startsh
3977 EOS
3978 cat <<'EOSC' >>whoa
3979 dflt=y
3980 case "$hint" in
3981     recommended)
3982         case "$hintfile" in
3983         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3984                 ;;
3985         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3986                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3987                 ;;
3988         esac
3989         ;;
3990     *)  echo " "
3991         echo "*** WHOA THERE!!! ***" >&4
3992         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3993         ;;
3994 esac
3995 rp="    Keep the $hint value?"
3996 . ./myread
3997 case "$ans" in
3998 y) td=$was; tu=$was;;
3999 esac
4000 EOSC
4001
4002 : function used to set $1 to $val
4003 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
4004 case "$val$was" in
4005 $define$undef) . ./whoa; eval "$var=\$td";;
4006 $undef$define) . ./whoa; eval "$var=\$tu";;
4007 *) eval "$var=$val";;
4008 esac'
4009
4010 case "$usesocks" in
4011 $define|true|[yY]*)     dflt='y';;
4012 *) dflt='n';;
4013 esac
4014 cat <<EOM
4015
4016 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4017 Configure must be run with -Dusesocks.  If you use SOCKS you also need
4018 to use the PerlIO abstraction layer, this will be implicitly selected.
4019
4020 If this doesn't make any sense to you, just accept the default '$dflt'.
4021 EOM
4022 rp='Build Perl for SOCKS?'
4023 . ./myread
4024 case "$ans" in
4025 y|Y)    val="$define" ;;     
4026 *)      val="$undef" ;;
4027 esac
4028 set usesocks
4029 eval $setvar
4030
4031 case "$usesocks" in
4032 $define|true|[yY]*) useperlio="$define";;
4033 esac
4034
4035 case "$useperlio" in
4036 $define|true|[yY]*|'')  dflt='y';;
4037 *) dflt='n';;
4038 esac
4039 cat <<EOM
4040
4041 Previous version of $package used the standard IO mechanisms as
4042 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4043 alternate IO mechanisms via the PerlIO abstraction layer, but the
4044 stdio mechanism is still available if needed.  The abstraction layer
4045 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4046 Using PerlIO with sfio may cause problems with some extension modules.
4047
4048 If this doesn't make any sense to you, just accept the default '$dflt'.
4049 EOM
4050 rp='Use the PerlIO abstraction layer?'
4051 . ./myread
4052 case "$ans" in
4053 y|Y) 
4054         val="$define"
4055         ;;
4056 *)      
4057         echo "Ok, doing things the stdio way."
4058         val="$undef"
4059         ;;
4060 esac
4061 set useperlio
4062 eval $setvar 
4063
4064 case "$usesocks" in
4065 $define|true|[yY]*)
4066         case "$useperlio" in
4067         $define|true|[yY]*) ;;
4068         *)      cat >&4 <<EOM
4069
4070 You are using the SOCKS proxy protocol library which means that you
4071 should also use the PerlIO layer.  You may be headed for trouble.
4072
4073 EOM
4074                 ;;
4075         esac
4076         ;;
4077 esac
4078
4079         
4080 : get the patchlevel
4081 echo " "
4082 echo "Getting the current patchlevel..." >&4
4083 if $test -r $rsrc/patchlevel.h;then
4084         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4085         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4086         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4087         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4088         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4089         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4090         perl_patchlevel=`egrep ',"(MAINT|SMOKE)[0-9][0-9]*"' $rsrc/patchlevel.h|tail -1|sed 's/[^0-9]//g'`
4091 else
4092         revision=0
4093         patchlevel=0
4094         subversion=0
4095         api_revision=0
4096         api_version=0
4097         api_subversion=0
4098         perl_patchlevel=0
4099         $echo "(You do not have patchlevel.h.  Eek.)"
4100 fi
4101 if $test -r $rsrc/.patch ; then
4102         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4103                 perl_patchlevel=`cat $rsrc/.patch`
4104         fi
4105 fi
4106 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4107 version_patchlevel_string="version $patchlevel subversion $subversion"
4108 case "$perl_patchlevel" in
4109 0|'') ;;
4110 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4111 esac
4112
4113 $echo "(You have $package $version_patchlevel_string.)"
4114
4115 case "$osname" in
4116 dos|vms)
4117         : XXX Should be a Configure test for double-dots in filenames.
4118         version=`echo $revision $patchlevel $subversion | \
4119                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4120         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4121                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4122         ;;
4123 *)
4124         version=`echo $revision $patchlevel $subversion | \
4125                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4126         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4127                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4128         ;;
4129 esac
4130 : Special case the 5.005_xx maintenance series, which used 5.005
4131 : without any subversion label as a subdirectory in $sitelib
4132 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4133         api_versionstring='5.005'
4134 fi
4135
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*)      
4142                 case "$useperlio" in
4143                 "$define")      dflt='y' ;;
4144                 *)              dflt='n' ;;
4145                 esac
4146                 ;;
4147        *)       dflt='n';;
4148        esac
4149        ;;
4150 esac
4151 cat <<EOM
4152
4153 Perl can be built to take advantage of threads on some systems.
4154 To do so, Configure can be run with -Dusethreads.
4155
4156 Note that Perl built with threading support runs slightly slower
4157 and uses more memory than plain Perl. The current implementation
4158 is believed to be stable, but it is fairly new, and so should be
4159 treated with caution.
4160
4161 If this doesn't make any sense to you, just accept the default '$dflt'.
4162 EOM
4163 rp='Build a threading Perl?'
4164 . ./myread
4165 case "$ans" in
4166 y|Y)    val="$define" ;;
4167 *)      val="$undef" ;;
4168 esac
4169 set usethreads
4170 eval $setvar
4171
4172 if $test $patchlevel -lt 9; then
4173     case "$usethreads" in
4174     $define)
4175         $cat <<EOM
4176
4177 Since release 5.6, Perl has had two different threading implementations,
4178 the newer interpreter-based version (ithreads) with one interpreter per
4179 thread, and the older 5.005 version (5005threads).
4180 The 5005threads version is effectively unmaintained and will probably be
4181 removed in Perl 5.10, so there should be no need to build a Perl using it
4182 unless needed for backwards compatibility with some existing 5.005threads
4183 code.
4184
4185 EOM
4186         : Default to ithreads unless overridden on command line or with
4187         : old config.sh
4188         dflt='y'
4189         case "$use5005threads" in
4190                 $define|true|[yY]*) dflt='n';;
4191         esac
4192         case "$useithreads" in
4193                 $undef|false|[nN]*) dflt='n';;
4194         esac
4195         rp='Use the newer interpreter-based ithreads?'
4196         . ./myread
4197         case "$ans" in
4198         y|Y)    val="$define" ;;
4199         *)      val="$undef" ;;
4200         esac
4201         set useithreads
4202         eval $setvar
4203         : Now set use5005threads to the opposite value.
4204         case "$useithreads" in
4205         $define) val="$undef" ;;
4206         *) val="$define" ;;
4207         esac
4208         set use5005threads
4209         eval $setvar
4210         ;;
4211     *)
4212         useithreads="$undef"
4213         use5005threads="$undef"
4214         ;;
4215     esac
4216
4217     case "$useithreads$use5005threads" in
4218     "$define$define")
4219         $cat >&4 <<EOM
4220
4221 You cannot have both the ithreads and the 5.005 threads enabled
4222 at the same time.  Disabling the 5.005 threads since they are
4223 much less stable than the ithreads.
4224
4225 EOM
4226         use5005threads="$undef"
4227         ;;
4228     esac
4229
4230 else
4231 : perl-5.9.x and later
4232
4233     if test X"$usethreads" = "X$define"; then
4234         case "$use5005threads" in
4235             $define|true|[yY]*)
4236                 $cat >&4 <<EOM
4237
4238 5.005 threads has been removed for 5.10.  Perl will be built using ithreads.
4239
4240 EOM
4241             ;;
4242         esac
4243     fi
4244
4245     use5005threads="$undef"
4246     useithreads="$usethreads"
4247 fi
4248
4249 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4250         cat >&4 <<EOF
4251 ***
4252 *** To build with ithreads you must also use the PerlIO layer.
4253 *** Cannot continue, aborting.
4254 ***
4255 EOF
4256         exit 1
4257 fi
4258
4259 case "$d_oldpthreads" in
4260 '')     : Configure tests would be welcome here.  For now, assume undef.
4261         val="$undef" ;;
4262 *)      val="$d_oldpthreads" ;;
4263 esac
4264 set d_oldpthreads
4265 eval $setvar
4266
4267
4268 : Look for a hint-file generated 'call-back-unit'.  If the
4269 : user has specified that a threading perl is to be built,
4270 : we may need to set or change some other defaults.
4271 if $test -f usethreads.cbu; then
4272     echo "Your platform has some specific hints regarding threaded builds, using them..."
4273     . ./usethreads.cbu
4274 else
4275     case "$usethreads" in
4276         "$define"|true|[yY]*)
4277                 $cat <<EOM
4278 (Your platform does not have any specific hints for threaded builds.
4279  Assuming POSIX threads, then.)
4280 EOM
4281         ;;
4282     esac
4283 fi
4284
4285 cat <<EOM
4286
4287 Perl can be built so that multiple Perl interpreters can coexist
4288 within the same Perl executable.
4289 EOM
4290
4291 case "$useithreads" in
4292 $define)
4293         cat <<EOM
4294 This multiple interpreter support is required for interpreter-based threads.
4295 EOM
4296         val="$define"
4297         ;;
4298 *)      case "$usemultiplicity" in
4299         $define|true|[yY]*)     dflt='y';;
4300         *) dflt='n';;
4301         esac
4302         echo " "
4303         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4304         rp='Build Perl for multiplicity?'
4305         . ./myread
4306         case "$ans" in
4307         y|Y)    val="$define" ;;
4308         *)      val="$undef" ;;
4309         esac
4310         ;;
4311 esac
4312 set usemultiplicity
4313 eval $setvar
4314
4315
4316 case "$usemorebits" in
4317 "$define"|true|[yY]*)
4318         use64bitint="$define"
4319         uselongdouble="$define"
4320         usemorebits="$define"
4321         ;;
4322 *)      usemorebits="$undef"
4323         ;;
4324 esac
4325
4326 : make some quick guesses about what we are up against
4327 echo " "
4328 $echo $n "Hmm...  $c"
4329 echo exit 1 >bsd
4330 echo exit 1 >usg
4331 echo exit 1 >v7
4332 echo exit 1 >osf1
4333 echo exit 1 >eunice
4334 echo exit 1 >xenix
4335 echo exit 1 >venix
4336 echo exit 1 >os2
4337 d_bsd="$undef"
4338 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4339 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4340 then
4341         echo "Looks kind of like an OSF/1 system, but we'll see..."
4342         echo exit 0 >osf1
4343 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4344         xxx=`./loc addbib blurfl $pth`
4345         if $test -f $xxx; then
4346         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4347                 echo exit 0 >bsd
4348                 echo exit 0 >usg
4349         else
4350                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4351                         echo "Looks kind of like an extended USG system, but we'll see..."
4352                 else
4353                         echo "Looks kind of like a USG system, but we'll see..."
4354                 fi
4355                 echo exit 0 >usg
4356         fi
4357 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4358         echo "Looks kind of like a BSD system, but we'll see..."
4359         d_bsd="$define"
4360         echo exit 0 >bsd
4361 else
4362         echo "Looks kind of like a Version 7 system, but we'll see..."
4363         echo exit 0 >v7
4364 fi
4365 case "$eunicefix" in
4366 *unixtovms*)
4367         $cat <<'EOI'
4368 There is, however, a strange, musty smell in the air that reminds me of
4369 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4370 EOI
4371         echo exit 0 >eunice
4372         d_eunice="$define"
4373 : it so happens the Eunice I know will not run shell scripts in Unix format
4374         ;;
4375 *)
4376         echo " "
4377         echo "Congratulations.  You aren't running Eunice."
4378         d_eunice="$undef"
4379         ;;
4380 esac
4381 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4382 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4383 : semicolon as a patch separator
4384 case "$p_" in
4385 :) ;;
4386 *)
4387         $cat <<'EOI'
4388 I have the feeling something is not exactly right, however...don't tell me...
4389 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4390 (Or you may be running DOS with DJGPP.)
4391 EOI
4392         echo exit 0 >os2
4393         ;;
4394 esac
4395 if test -f /xenix; then
4396         echo "Actually, this looks more like a XENIX system..."
4397         echo exit 0 >xenix
4398         d_xenix="$define"
4399 else
4400         echo " "
4401         echo "It's not Xenix..."
4402         d_xenix="$undef"
4403 fi
4404 chmod +x xenix
4405 $eunicefix xenix
4406 if test -f /venix; then
4407         echo "Actually, this looks more like a VENIX system..."
4408         echo exit 0 >venix
4409 else
4410         echo " "
4411         if ./xenix; then
4412                 : null
4413         else
4414                 echo "Nor is it Venix..."
4415         fi
4416 fi
4417 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4418 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4419 $rm -f foo
4420
4421 case "$cc" in
4422 '') dflt=cc;;
4423 *) dflt="$cc";;
4424 esac
4425 rp="Use which C compiler?"
4426 . ./myread
4427 cc="$ans"
4428
4429 : See if they have not cc but they do have gcc
4430 . ./trygcc
4431 : Look for a hint-file generated 'call-back-unit'.  Now that the
4432 : user has specified the compiler, we may need to set or change some
4433 : other defaults.
4434 if $test -f cc.cbu; then
4435     . ./cc.cbu
4436 fi
4437 . ./checkcc
4438
4439 echo " "
4440 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4441 $cat >try.c <<EOM
4442 #include <stdio.h>
4443 int main() {
4444 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4445 #ifdef __VERSION__
4446         printf("%s\n", __VERSION__);
4447 #else
4448         printf("%s\n", "1");
4449 #endif
4450 #endif
4451         return(0);
4452 }
4453 EOM
4454 if $cc -o try $ccflags $ldflags try.c; then
4455         gccversion=`$run ./try`
4456         case "$gccversion" in
4457         '') echo "You are not using GNU cc." ;;
4458         *)  echo "You are using GNU cc $gccversion."
4459             ccname=gcc
4460             ;;
4461         esac
4462 else
4463         echo " "
4464         echo "*** WHOA THERE!!! ***" >&4
4465         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4466         case "$knowitall" in
4467         '')
4468         echo "    You'd better start hunting for one and let me know about it." >&4
4469                 exit 1
4470                 ;;
4471         esac
4472 fi
4473 $rm -f try try.*
4474 case "$gccversion" in
4475 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4476 esac
4477 case "$gccversion" in
4478 '') gccosandvers='' ;;
4479 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4480    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4481    gccshortvers=''
4482    case "$gccosandvers" in
4483    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4484    $osname$osvers) ;; # looking good
4485    $osname*) cat <<EOM >&4
4486
4487 *** WHOA THERE!!! ***
4488
4489     Your gcc has not been compiled for the exact release of
4490     your operating system ($gccosandvers versus $osname$osvers).
4491
4492     In general it is a good idea to keep gcc synchronized with
4493     the operating system because otherwise serious problems
4494     may ensue when trying to compile software, like Perl.
4495
4496     I'm trying to be optimistic here, though, and will continue.
4497     If later during the configuration and build icky compilation
4498     problems appear (headerfile conflicts being the most common
4499     manifestation), I suggest reinstalling the gcc to match
4500     your operating system release.
4501
4502 EOM
4503       ;;
4504    *) gccosandvers='' ;; # failed to parse, better be silent
4505    esac
4506    ;;
4507 esac
4508 case "$ccname" in
4509 '') ccname="$cc" ;;
4510 esac
4511
4512 # gcc 3.* complain about adding -Idirectories that they already know about,
4513 # so we will take those off from locincpth.
4514 case "$gccversion" in
4515 3*)
4516     echo "main(){}">try.c
4517     for incdir in $locincpth; do
4518        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4519              grep '^c[cp]p*[01]: warning: changing search order '`
4520        if test "X$warn" != X; then
4521            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4522        fi
4523     done
4524     $rm -f try try.*
4525 esac
4526
4527 : What should the include directory be ?
4528 echo " "
4529 $echo $n "Hmm...  $c"
4530 dflt='/usr/include'
4531 incpath=''
4532 mips_type=''
4533 if $test -f /bin/mips && /bin/mips; then
4534         echo "Looks like a MIPS system..."
4535         $cat >usr.c <<'EOCP'
4536 #ifdef SYSTYPE_BSD43
4537 /bsd43
4538 #endif
4539 EOCP
4540         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4541                 dflt='/bsd43/usr/include'
4542                 incpath='/bsd43'
4543                 mips_type='BSD 4.3'
4544         else
4545                 mips_type='System V'
4546         fi
4547         $rm -f usr.c usr.out
4548         echo "and you're compiling with the $mips_type compiler and libraries."
4549         xxx_prompt=y
4550         echo "exit 0" >mips
4551 else
4552         echo "Doesn't look like a MIPS system."
4553         xxx_prompt=n
4554         echo "exit 1" >mips
4555 fi
4556 chmod +x mips
4557 $eunicefix mips
4558 case "$usrinc" in
4559 '') ;;
4560 *) dflt="$usrinc";;
4561 esac
4562 case "$xxx_prompt" in
4563 y)      fn=d/
4564         echo " "
4565         rp='Where are the include files you want to use?'
4566         . ./getfile
4567         usrinc="$ans"
4568         ;;
4569 *)      usrinc="$dflt"
4570         ;;
4571 esac
4572
4573 : see how we invoke the C preprocessor
4574 echo " "
4575 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4576 cat <<'EOT' >testcpp.c
4577 #define ABC abc
4578 #define XYZ xyz
4579 ABC.XYZ
4580 EOT
4581 cd ..
4582 if test ! -f cppstdin; then
4583         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4584                 # AIX cc -E doesn't show the absolute headerfile
4585                 # locations but we'll cheat by using the -M flag.
4586                 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
4587         else
4588                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4589         fi
4590 else
4591         echo "Keeping your $hint cppstdin wrapper."
4592 fi
4593 chmod 755 cppstdin
4594 wrapper=`pwd`/cppstdin
4595 ok='false'
4596 cd UU
4597
4598 if $test "X$cppstdin" != "X" && \
4599         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4600         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4601 then
4602         echo "You used to use $cppstdin $cppminus so we'll use that again."
4603         case "$cpprun" in
4604         '') echo "But let's see if we can live without a wrapper..." ;;
4605         *)
4606                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4607                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4608                 then
4609                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4610                         ok='true'
4611                 else
4612                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4613                 fi
4614                 ;;
4615         esac
4616 else
4617         case "$cppstdin" in
4618         '') ;;
4619         *)
4620                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4621                 ;;
4622         esac
4623 fi
4624
4625 if $ok; then
4626         : nothing
4627 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4628         $cc -E <testcpp.c >testcpp.out 2>&1; \
4629         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4630         echo "Yup, it does."
4631         x_cpp="$cc -E"
4632         x_minus='';
4633 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4634         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4635         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4636         echo "Yup, it does."
4637         x_cpp="$cc -E"
4638         x_minus='-';
4639 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4640         $cc -P <testcpp.c >testcpp.out 2>&1; \
4641         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4642         echo "Yipee, that works!"
4643         x_cpp="$cc -P"
4644         x_minus='';
4645 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4646         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4647         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4648         echo "At long last!"
4649         x_cpp="$cc -P"
4650         x_minus='-';
4651 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4652         $cpp <testcpp.c >testcpp.out 2>&1; \
4653         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4654         echo "It works!"
4655         x_cpp="$cpp"
4656         x_minus='';
4657 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4658         $cpp - <testcpp.c >testcpp.out 2>&1; \
4659         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4660         echo "Hooray, it works!  I was beginning to wonder."
4661         x_cpp="$cpp"
4662         x_minus='-';
4663 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4664         $wrapper <testcpp.c >testcpp.out 2>&1; \
4665         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4666         x_cpp="$wrapper"
4667         x_minus=''
4668         echo "Eureka!"
4669 else
4670         dflt=''
4671         rp="No dice.  I can't find a C preprocessor.  Name one:"
4672         . ./myread
4673         x_cpp="$ans"
4674         x_minus=''
4675         $x_cpp <testcpp.c >testcpp.out 2>&1
4676         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4677                 echo "OK, that will do." >&4
4678         else
4679 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4680                 exit 1
4681         fi
4682 fi
4683
4684 case "$ok" in
4685 false)
4686         cppstdin="$x_cpp"
4687         cppminus="$x_minus"
4688         cpprun="$x_cpp"
4689         cpplast="$x_minus"
4690         set X $x_cpp
4691         shift
4692         case "$1" in
4693         "$cpp")
4694                 echo "Perhaps can we force $cc -E using a wrapper..."
4695                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4696                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4697                 then
4698                         echo "Yup, we can."
4699                         cppstdin="$wrapper"
4700                         cppminus='';
4701                 else
4702                         echo "Nope, we'll have to live without it..."
4703                 fi
4704                 ;;
4705         esac
4706         case "$cpprun" in
4707         "$wrapper")
4708                 cpprun=''
4709                 cpplast=''
4710                 ;;
4711         esac
4712         ;;
4713 esac
4714
4715 case "$cppstdin" in
4716 "$wrapper"|'cppstdin') ;;
4717 *) $rm -f $wrapper;;
4718 esac
4719 $rm -f testcpp.c testcpp.out
4720
4721 : Set private lib path
4722 case "$plibpth" in
4723 '') if ./mips; then
4724                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4725         fi;;
4726 esac
4727 case "$libpth" in
4728 ' ') dlist='';;
4729 '') dlist="$loclibpth $plibpth $glibpth";;
4730 *) dlist="$libpth";;
4731 esac
4732
4733 : Now check and see which directories actually exist, avoiding duplicates
4734 libpth=''
4735 for xxx in $dlist
4736 do
4737     if $test -d $xxx; then
4738                 case " $libpth " in
4739                 *" $xxx "*) ;;
4740                 *) libpth="$libpth $xxx";;
4741                 esac
4742     fi
4743 done
4744 $cat <<'EOM'
4745
4746 Some systems have incompatible or broken versions of libraries.  Among
4747 the directories listed in the question below, please remove any you
4748 know not to be holding relevant libraries, and add any that are needed.
4749 Say "none" for none.
4750
4751 EOM
4752 case "$libpth" in
4753 '') dflt='none';;
4754 *)
4755         set X $libpth
4756         shift
4757         dflt=${1+"$@"}
4758         ;;
4759 esac
4760 rp="Directories to use for library searches?"
4761 . ./myread
4762 case "$ans" in
4763 none) libpth=' ';;
4764 *) libpth="$ans";;
4765 esac
4766
4767 : compute shared library extension
4768 case "$so" in
4769 '')
4770         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4771                 dflt='sl'
4772         else
4773                 dflt='so'
4774         fi
4775         ;;
4776 *) dflt="$so";;
4777 esac
4778 $cat <<EOM
4779
4780 On some systems, shared libraries may be available.  Answer 'none' if
4781 you want to suppress searching of shared libraries for the remainder
4782 of this configuration.
4783
4784 EOM
4785 rp='What is the file extension used for shared libraries?'
4786 . ./myread
4787 so="$ans"
4788
4789 : Define several unixisms.
4790 : Hints files or command line option can be used to override them.
4791 : The convoluted testing is in case hints files set either the old
4792 : or the new name.
4793 case "$_exe" in
4794 '')     case "$exe_ext" in
4795         '')     ;;
4796         *)      _exe="$exe_ext" ;;
4797         esac
4798         ;;
4799 esac
4800 case "$_a" in
4801 '')     case "$lib_ext" in
4802     '') _a='.a';;
4803         *)      _a="$lib_ext" ;;
4804         esac
4805         ;;
4806 esac
4807 case "$_o" in
4808 '') case "$obj_ext" in
4809         '')     _o='.o';;
4810         *)      _o="$obj_ext";;
4811         esac
4812         ;;
4813 esac
4814 case "$p_" in
4815 '') case "$path_sep" in
4816         '')     p_=':';;
4817         *)      p_="$path_sep";;
4818         esac
4819         ;;
4820 esac
4821 exe_ext=$_exe
4822 lib_ext=$_a
4823 obj_ext=$_o
4824 path_sep=$p_
4825
4826 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
4827
4828 : Which makefile gets called first.  This is used by make depend.
4829 case "$firstmakefile" in
4830 '') firstmakefile='makefile';;
4831 esac
4832
4833 case "$ccflags" in
4834 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4835 esac
4836
4837 case "$uselongdouble" in
4838 $define|true|[yY]*)     dflt='y';;
4839 *) dflt='n';;
4840 esac
4841 cat <<EOM
4842
4843 Perl can be built to take advantage of long doubles which
4844 (if available) may give more accuracy and range for floating point numbers.
4845
4846 If this doesn't make any sense to you, just accept the default '$dflt'.
4847 EOM
4848 rp='Try to use long doubles if available?'
4849 . ./myread
4850 case "$ans" in
4851 y|Y)    val="$define"   ;;
4852 *)      val="$undef"    ;;
4853 esac
4854 set uselongdouble
4855 eval $setvar
4856
4857 case "$uselongdouble" in
4858 true|[yY]*) uselongdouble="$define" ;;
4859 esac
4860
4861 : Look for a hint-file generated 'call-back-unit'.  If the
4862 : user has specified that long doubles should be used,
4863 : we may need to set or change some other defaults.
4864 if $test -f uselongdouble.cbu; then
4865     echo "Your platform has some specific hints regarding long doubles, using them..."
4866     . ./uselongdouble.cbu
4867 else
4868     case "$uselongdouble" in
4869         $define)
4870                 $cat <<EOM
4871 (Your platform does not have any specific hints for long doubles.)
4872 EOM
4873         ;;
4874     esac
4875 fi
4876
4877 : Looking for optional libraries
4878 echo " "
4879 echo "Checking for optional libraries..." >&4
4880 case "$libs" in
4881 ' '|'') dflt='';;
4882 *) dflt="$libs";;
4883 esac
4884 case "$libswanted" in
4885 '') libswanted='c_s';;
4886 esac
4887 case "$usesocks" in
4888 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4889 esac
4890 libsfound=''
4891 libsfiles=''
4892 libsdirs=''
4893 libspath=''
4894 for thisdir in $libpth $xlibpth; do
4895   test -d $thisdir && libspath="$libspath $thisdir"
4896 done
4897 for thislib in $libswanted; do
4898         for thisdir in $libspath; do
4899             xxx=''
4900             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4901                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4902                 $test -f "$xxx" && eval $libscheck
4903                 $test -f "$xxx" && libstyle=shared
4904             fi
4905             if test ! -f "$xxx"; then
4906                 xxx=$thisdir/lib$thislib.$so
4907                 $test -f "$xxx" && eval $libscheck
4908                 $test -f "$xxx" && libstyle=shared
4909             fi  
4910             if test ! -f "$xxx"; then
4911                 xxx=$thisdir/lib$thislib$_a
4912                 $test -f "$xxx" && eval $libscheck
4913                 $test -f "$xxx" && libstyle=static
4914             fi
4915             if test ! -f "$xxx"; then
4916                 xxx=$thisdir/$thislib$_a
4917                 $test -f "$xxx" && eval $libscheck
4918                 $test -f "$xxx" && libstyle=static
4919             fi
4920             if test ! -f "$xxx"; then
4921                 xxx=$thisdir/lib${thislib}_s$_a
4922                 $test -f "$xxx" && eval $libscheck
4923                 $test -f "$xxx" && libstyle=static
4924                 $test -f "$xxx" && thislib=${thislib}_s
4925             fi
4926             if test ! -f "$xxx"; then
4927                 xxx=$thisdir/Slib$thislib$_a
4928                 $test -f "$xxx" && eval $libscheck
4929                 $test -f "$xxx" && libstyle=static
4930             fi
4931             if $test -f "$xxx"; then
4932                 case "$libstyle" in
4933                 shared) echo "Found -l$thislib (shared)." ;;
4934                 static) echo "Found -l$thislib." ;;
4935                 *)      echo "Found -l$thislib ($libstyle)." ;;
4936                 esac
4937                 case " $dflt " in
4938                 *"-l$thislib "*);;
4939                 *) dflt="$dflt -l$thislib"
4940                    libsfound="$libsfound $xxx"
4941                    yyy=`basename $xxx`
4942                    libsfiles="$libsfiles $yyy"
4943                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4944                    case " $libsdirs " in
4945                    *" $yyy "*) ;;
4946                    *) libsdirs="$libsdirs $yyy" ;;
4947                    esac
4948                    ;;
4949                 esac
4950                 break
4951             fi  
4952         done
4953         if $test ! -f "$xxx"; then
4954             echo "No -l$thislib."
4955         fi
4956 done
4957 set X $dflt
4958 shift
4959 dflt="$*"
4960 case "$libs" in
4961 '') dflt="$dflt";;
4962 *) dflt="$libs";;
4963 esac
4964 case "$dflt" in
4965 ' '|'') dflt='none';;
4966 esac
4967
4968 $cat <<EOM
4969
4970 In order to compile $package on your machine, a number of libraries
4971 are usually needed.  Include any other special libraries here as well.
4972 Say "none" for none.  The default list is almost always right.
4973 EOM
4974
4975 echo " "
4976 rp="What libraries to use?"
4977 . ./myread
4978 case "$ans" in
4979 none) libs=' ';;
4980 *) libs="$ans";;
4981 esac
4982
4983 : determine optimization, if desired, or use for debug flag also
4984 case "$optimize" in
4985 ' '|$undef) dflt='none';;
4986 '') dflt='-O';;
4987 *) dflt="$optimize";;
4988 esac
4989 $cat <<EOH
4990
4991 By default, $package compiles with the -O flag to use the optimizer.
4992 Alternately, you might want to use the symbolic debugger, which uses
4993 the -g flag (on traditional Unix systems).  Either flag can be
4994 specified here.  To use neither flag, specify the word "none".
4995
4996 EOH
4997 rp="What optimizer/debugger flag should be used?"
4998 . ./myread
4999 optimize="$ans"
5000 case "$optimize" in
5001 'none') optimize=" ";;
5002 esac
5003
5004 : Check what DEBUGGING is required from the command line
5005 : -DEBUGGING      or -DDEBUGGING or
5006 : -DEBUGGING=both                       = -g + -DDEBUGGING
5007 : -DEBUGGING=-g   or -Doptimize=-g      = -g
5008 : -DEBUGGING=none or -UDEBUGGING        =
5009 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
5010 case "$EBUGGING" in
5011 '')     ;;
5012 *)      DEBUGGING=$EBUGGING ;;
5013 esac
5014
5015 case "$DEBUGGING" in
5016 -g|both|$define)
5017     case "$optimize" in
5018         *-g*) ;;
5019         *)    optimize="$optimize -g" ;;
5020     esac ;;
5021 none|$undef)
5022     case "$optimize" in
5023         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5024                 shift
5025                 optimize="$*"
5026                 ;;
5027     esac ;;
5028 esac
5029
5030 dflt=''
5031 case "$DEBUGGING" in
5032 both|$define) dflt='-DDEBUGGING'
5033 esac
5034
5035 : We will not override a previous value, but we might want to
5036 : augment a hint file
5037 case "$hint" in
5038 default|recommended)
5039         case "$gccversion" in
5040         1*) dflt="$dflt -fpcc-struct-return" ;;
5041         esac
5042         case "$optimize:$DEBUGGING" in
5043         *-g*:old) dflt="$dflt -DDEBUGGING";;
5044         esac
5045         case "$gccversion" in
5046         2*) if test -d /etc/conf/kconfig.d &&
5047                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5048                 then
5049                         # Interactive Systems (ISC) POSIX mode.
5050                         dflt="$dflt -posix"
5051                 fi
5052                 ;;
5053         esac
5054         case "$gccversion" in
5055         1*) ;;
5056         2.[0-8]*) ;;
5057         ?*)     echo " "
5058                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5059                 echo 'int main(void) { return 0; }' > gcctest.c
5060                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5061                         echo "Yes, it does." 2>&1
5062                         case "$ccflags" in
5063                         *strict-aliasing*)
5064                                 echo "Leaving current flags $ccflags alone." 2>&1
5065                                 ;;
5066                         *) dflt="$dflt -fno-strict-aliasing" ;;
5067                         esac
5068                 else
5069                         echo "Nope, it doesn't, but that's ok." 2>&1
5070                 fi
5071                 ;;
5072         esac
5073         # For gcc, adding -pipe speeds up compilations for some, but apparently
5074         # some assemblers can't read from stdin.  (It also slows down compilations
5075         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5076         case "$gccversion" in
5077         ?*)     echo " "
5078                 echo "Checking if your compiler accepts -pipe" 2>&1
5079                 echo 'int main(void) { return 0; }' > gcctest.c
5080                 if $cc -pipe -o gcctest gcctest.c; then
5081                         echo "Yes, it does." 2>&1
5082                         case "$ccflags" in
5083                         *-pipe*)
5084                                 echo "Leaving current flags $ccflags alone." 2>&1
5085                                 ;;
5086                         *) dflt="$dflt -pipe" ;;
5087                         esac
5088                 else
5089                         echo "Nope, it doesn't, but that's ok." 2>&1
5090                 fi
5091                 ;;
5092         esac
5093         ;;
5094 esac
5095
5096 case "$mips_type" in
5097 *BSD*|'') inclwanted="$locincpth $usrinc";;
5098 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5099 esac
5100 for thisincl in $inclwanted; do
5101         if $test -d $thisincl; then
5102                 if $test x$thisincl != x$usrinc; then
5103                         case "$dflt" in
5104                         *" -I$thisincl "*);;
5105                         *) dflt="$dflt -I$thisincl ";;
5106                         esac
5107                 fi
5108         fi
5109 done
5110
5111 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5112         xxx=true;
5113 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5114         xxx=true;
5115 else
5116         xxx=false;
5117 fi;
5118 if $xxx; then
5119         case "$dflt" in
5120         *$2*);;
5121         *) dflt="$dflt -D$2";;
5122         esac;
5123 fi'
5124
5125 set signal.h LANGUAGE_C; eval $inctest
5126
5127 case "$usesocks" in
5128 $define)
5129         ccflags="$ccflags -DSOCKS"
5130         ;;
5131 esac
5132
5133 case "$hint" in
5134 default|recommended) dflt="$ccflags $dflt" ;;
5135 *) dflt="$ccflags";;
5136 esac
5137
5138 case "$dflt" in
5139 ''|' ') dflt=none;;
5140 esac
5141
5142 $cat <<EOH
5143
5144 Your C compiler may want other flags.  For this question you should include
5145 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5146 but you should NOT include libraries or ld flags like -lwhatever.  If you
5147 want $package to honor its debug switch, you should include -DDEBUGGING here.
5148 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5149
5150 To use no flags, specify the word "none".
5151
5152 EOH
5153 set X $dflt
5154 shift
5155 dflt=${1+"$@"}
5156 rp="Any additional cc flags?"
5157 . ./myread
5158 case "$ans" in
5159 none) ccflags='';;
5160 *) ccflags="$ans";;
5161 esac
5162
5163 : the following weeds options from ccflags that are of no interest to cpp
5164 case "$cppflags" in
5165 '') cppflags="$ccflags" ;;
5166 *)  cppflags="$cppflags $ccflags" ;;
5167 esac
5168 case "$gccversion" in
5169 1*) cppflags="$cppflags -D__GNUC__"
5170 esac
5171 case "$mips_type" in
5172 '');;
5173 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5174 esac
5175 case "$cppflags" in
5176 '');;
5177 *)
5178         echo " "
5179         echo "Let me guess what the preprocessor flags are..." >&4
5180         set X $cppflags
5181         shift
5182         cppflags=''
5183         $cat >cpp.c <<'EOM'
5184 #define BLURFL foo
5185
5186 BLURFL xx LFRULB
5187 EOM
5188         previous=''
5189         for flag in $*
5190         do
5191                 case "$flag" in
5192                 -*) ftry="$flag";;
5193                 *) ftry="$previous $flag";;
5194                 esac
5195                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5196                         >cpp1.out 2>/dev/null && \
5197                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5198                         >cpp2.out 2>/dev/null && \
5199                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5200                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5201                 then
5202                         cppflags="$cppflags $ftry"
5203                         previous=''
5204                 else
5205                         previous="$flag"
5206                 fi
5207         done
5208         set X $cppflags
5209         shift
5210         cppflags=${1+"$@"}
5211         case "$cppflags" in
5212         *-*)  echo "They appear to be: $cppflags";;
5213         esac
5214         $rm -f cpp.c cpp?.out
5215         ;;
5216 esac
5217
5218 : flags used in final linking phase
5219 case "$ldflags" in
5220 '') if ./venix; then
5221                 dflt='-i -z'
5222         else
5223                 dflt=''
5224         fi
5225         case "$ccflags" in
5226         *-posix*) dflt="$dflt -posix" ;;
5227         esac
5228         ;;
5229 *) dflt="$ldflags";;
5230 esac
5231
5232 : Try to guess additional flags to pick up local libraries.
5233 for thislibdir in $libpth; do
5234         case " $loclibpth " in
5235         *" $thislibdir "*)
5236                 case "$dflt " in
5237                 *"-L$thislibdir "*) ;;
5238                 *)  dflt="$dflt -L$thislibdir" ;;
5239                 esac
5240                 ;;
5241         esac
5242 done
5243
5244 case "$dflt" in
5245 '') dflt='none' ;;
5246 esac
5247
5248 $cat <<EOH
5249
5250 Your C linker may need flags.  For this question you should
5251 include -L/whatever and any other flags used by the C linker, but you
5252 should NOT include libraries like -lwhatever.
5253
5254 Make sure you include the appropriate -L/path flags if your C linker
5255 does not normally search all of the directories you specified above,
5256 namely
5257         $libpth
5258 To use no flags, specify the word "none".
5259
5260 EOH
5261
5262 rp="Any additional ld flags (NOT including libraries)?"
5263 . ./myread
5264 case "$ans" in
5265 none) ldflags='';;
5266 *) ldflags="$ans";;
5267 esac
5268 rmlist="$rmlist pdp11"
5269
5270 : coherency check
5271 echo " "
5272 echo "Checking your choice of C compiler and flags for coherency..." >&4
5273 $cat > try.c <<'EOF'
5274 #include <stdio.h>
5275 int main() { printf("Ok\n"); return(0); }
5276 EOF
5277 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5278 shift
5279 $cat >try.msg <<'EOM'
5280 I've tried to compile and run the following simple program:
5281
5282 EOM
5283 $cat try.c >> try.msg
5284
5285 $cat >> try.msg <<EOM
5286
5287 I used the command:
5288
5289         $*
5290         $run ./try
5291
5292 and I got the following output:
5293
5294 EOM
5295 dflt=y
5296 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5297         if $sh -c "$run ./try" >>try.msg 2>&1; then
5298                 xxx=`$run ./try`
5299                 case "$xxx" in
5300                 "Ok") dflt=n ;;
5301                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5302                         case " $libs " in
5303                         *" -lsfio "*)
5304                                 cat >> try.msg <<'EOQS'
5305 If $libs contains -lsfio, and sfio is mis-configured, then it
5306 sometimes (apparently) runs and exits with a 0 status, but with no
5307 output!  It may have to do with sfio's use of _exit vs. exit.
5308
5309 EOQS
5310                                 rp="You have a big problem.  Shall I abort Configure"
5311                                 dflt=y
5312                                 ;;
5313                         esac
5314                         ;;
5315                 esac
5316         else
5317                 echo "The program compiled OK, but exited with status $?." >>try.msg
5318                 rp="You have a problem.  Shall I abort Configure"
5319                 dflt=y
5320         fi
5321 else
5322         echo "I can't compile the test program." >>try.msg
5323         rp="You have a BIG problem.  Shall I abort Configure"
5324         dflt=y
5325 fi
5326 case "$dflt" in
5327 y)
5328         $cat try.msg >&4
5329         case "$knowitall" in
5330         '')
5331                 echo "(The supplied flags or libraries might be incorrect.)"
5332                 ;;
5333         *) dflt=n;;
5334         esac
5335         echo " "
5336         . ./myread
5337         case "$ans" in
5338         n*|N*) ;;
5339         *)      echo "Ok.  Stopping Configure." >&4
5340                 exit 1
5341                 ;;
5342         esac
5343         ;;
5344 n) echo "OK, that should do.";;
5345 esac
5346 $rm_try
5347
5348 : define a shorthand compile call
5349 compile='
5350 mc_file=$1;
5351 shift;
5352 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5353 : define a shorthand compile call for compilations that should be ok.
5354 compile_ok='
5355 mc_file=$1;
5356 shift;
5357 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5358
5359 : determine filename position in cpp output
5360 echo " "
5361 echo "Computing filename position in cpp output for #include directives..." >&4
5362 case "$osname" in
5363 vos) testaccess=-e ;;
5364 *)   testaccess=-r ;;
5365 esac
5366 echo '#include <stdio.h>' > foo.c
5367 $cat >fieldn <<EOF
5368 $startsh
5369 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5370 $grep '^[       ]*#.*stdio\.h' | \
5371 while read cline; do
5372         pos=1
5373         set \$cline
5374         while $test \$# -gt 0; do
5375                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5376                         echo "\$pos"
5377                         exit 0
5378                 fi
5379                 shift
5380                 pos=\`expr \$pos + 1\`
5381         done
5382 done
5383 EOF
5384 chmod +x fieldn
5385 fieldn=`./fieldn`
5386 $rm -f foo.c fieldn
5387 case $fieldn in
5388 '') pos='???';;
5389 1) pos=first;;
5390 2) pos=second;;
5391 3) pos=third;;
5392 *) pos="${fieldn}th";;
5393 esac
5394 echo "Your cpp writes the filename in the $pos field of the line."
5395
5396 case "$osname" in
5397 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5398 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5399 *)   cppfilter='' ;;
5400 esac
5401 : locate header file
5402 $cat >findhdr <<EOF
5403 $startsh
5404 wanted=\$1
5405 name=''
5406 for usrincdir in $usrinc
5407 do
5408         if test -f \$usrincdir/\$wanted; then
5409                 echo "\$usrincdir/\$wanted"
5410                 exit 0
5411         fi
5412 done
5413 awkprg='{ print \$$fieldn }'
5414 echo "#include <\$wanted>" > foo\$\$.c
5415 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5416 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5417 while read cline; do
5418         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5419         case "\$name" in
5420         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5421         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5422         *) exit 2;;
5423         esac;
5424 done;
5425 #
5426 # status = 0: grep returned 0 lines, case statement not executed
5427 # status = 1: headerfile found
5428 # status = 2: while loop executed, no headerfile found
5429 #
5430 status=\$?
5431 $rm -f foo\$\$.c;
5432 if test \$status -eq 1; then
5433         exit 0;
5434 fi
5435 exit 1
5436 EOF
5437 chmod +x findhdr
5438
5439 : define an alternate in-header-list? function
5440 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5441 cont=true; xxf="echo \"<\$1> found.\" >&4";
5442 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5443 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5444 esac;
5445 case $# in 4) instead=instead;; *) instead="at last";; esac;
5446 while $test "$cont"; do
5447         xxx=`./findhdr $1`
5448         var=$2; eval "was=\$$2";
5449         if $test "$xxx" && $test -r "$xxx";
5450         then eval $xxf;
5451         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5452                 cont="";
5453         else eval $xxnf;
5454         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5455         set $yyy; shift; shift; yyy=$@;
5456         case $# in 0) cont="";;
5457         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5458                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5459         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5460                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5461         esac;
5462 done;
5463 while $test "$yyy";
5464 do set $yyy; var=$2; eval "was=\$$2";
5465         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5466         set $yyy; shift; shift; yyy=$@;
5467 done'
5468
5469 : see if stdlib is available
5470 set stdlib.h i_stdlib
5471 eval $inhdr
5472
5473 : check for lengths of integral types
5474 echo " "
5475 case "$intsize" in
5476 '')
5477         echo "Checking to see how big your integers are..." >&4
5478         $cat >try.c <<EOCP
5479 #include <stdio.h>
5480 #$i_stdlib I_STDLIB
5481 #ifdef I_STDLIB
5482 #include <stdlib.h>
5483 #endif
5484 int main()
5485 {
5486         printf("intsize=%d;\n", (int)sizeof(int));
5487         printf("longsize=%d;\n", (int)sizeof(long));
5488         printf("shortsize=%d;\n", (int)sizeof(short));
5489         exit(0);
5490 }
5491 EOCP
5492         set try
5493         if eval $compile_ok && $run ./try > /dev/null; then
5494                 eval `$run ./try`
5495                 echo "Your integers are $intsize bytes long."
5496                 echo "Your long integers are $longsize bytes long."
5497                 echo "Your short integers are $shortsize bytes long."
5498         else
5499                 $cat >&4 <<EOM
5500 !
5501 Help! I can't compile and run the intsize test program: please enlighten me!
5502 (This is probably a misconfiguration in your system or libraries, and
5503 you really ought to fix it.  Still, I'll try anyway.)
5504 !
5505 EOM
5506                 dflt=4
5507                 rp="What is the size of an integer (in bytes)?"
5508                 . ./myread
5509                 intsize="$ans"
5510                 dflt=$intsize
5511                 rp="What is the size of a long integer (in bytes)?"
5512                 . ./myread
5513                 longsize="$ans"
5514                 dflt=2
5515                 rp="What is the size of a short integer (in bytes)?"
5516                 . ./myread
5517                 shortsize="$ans"
5518         fi
5519         ;;
5520 esac
5521 $rm_try
5522
5523 : check for long long
5524 echo " "
5525 echo "Checking to see if you have long long..." >&4
5526 echo 'int main() { long long x = 7; return 0; }' > try.c
5527 set try
5528 if eval $compile; then
5529         val="$define"
5530         echo "You have long long."
5531 else
5532         val="$undef"
5533         echo "You do not have long long."
5534 fi
5535 $rm_try
5536 set d_longlong
5537 eval $setvar
5538
5539 : check for length of long long
5540 case "${d_longlong}${longlongsize}" in
5541 $define)
5542         echo " "
5543         echo "Checking to see how big your long longs are..." >&4
5544         $cat >try.c <<'EOCP'
5545 #include <stdio.h>
5546 int main()
5547 {
5548     printf("%d\n", (int)sizeof(long long));
5549     return(0);
5550 }
5551 EOCP
5552         set try
5553         if eval $compile_ok; then
5554                 longlongsize=`$run ./try`
5555                 echo "Your long longs are $longlongsize bytes long."
5556         else
5557                 dflt='8'
5558                 echo " "
5559                 echo "(I can't seem to compile the test program.  Guessing...)"
5560                 rp="What is the size of a long long (in bytes)?"
5561                 . ./myread
5562                 longlongsize="$ans"
5563         fi
5564         if $test "X$longsize" = "X$longlongsize"; then
5565                 echo "(That isn't any different from an ordinary long.)"
5566         fi
5567         ;;
5568 esac
5569 $rm_try
5570
5571 : see if inttypes.h is available
5572 : we want a real compile instead of Inhdr because some systems
5573 : have an inttypes.h which includes non-existent headers
5574 echo " "
5575 $cat >try.c <<EOCP
5576 #include <inttypes.h>
5577 int main() {
5578         static int32_t foo32 = 0x12345678;
5579 }
5580 EOCP
5581 set try
5582 if eval $compile; then
5583         echo "<inttypes.h> found." >&4
5584         val="$define"
5585 else
5586         echo "<inttypes.h> NOT found." >&4
5587         val="$undef"
5588 fi
5589 $rm_try
5590 set i_inttypes
5591 eval $setvar
5592
5593 : check for int64_t
5594 echo " "
5595 echo "Checking to see if you have int64_t..." >&4
5596 $cat >try.c <<EOCP
5597 #include <sys/types.h>
5598 #$i_inttypes I_INTTYPES
5599 #ifdef I_INTTYPES
5600 #include <inttypes.h>
5601 #endif
5602 int main() { int64_t x = 7; }
5603 EOCP
5604 set try
5605 if eval $compile; then
5606         val="$define"
5607         echo "You have int64_t."
5608 else
5609         val="$undef"
5610         echo "You do not have int64_t."
5611 fi
5612 $rm_try
5613 set d_int64_t
5614 eval $setvar
5615
5616
5617 echo " "
5618 echo "Checking which 64-bit integer type we could use..." >&4
5619
5620 case "$intsize" in
5621 8) val=int
5622    set quadtype
5623    eval $setvar
5624    val='"unsigned int"'
5625    set uquadtype
5626    eval $setvar
5627    quadkind=1
5628    ;;
5629 *) case "$longsize" in
5630    8) val=long
5631       set quadtype
5632       eval $setvar
5633       val='"unsigned long"'
5634       set uquadtype
5635       eval $setvar
5636       quadkind=2
5637       ;;
5638    *) case "$d_longlong:$longlongsize" in
5639       define:8)
5640         val='"long long"'
5641         set quadtype
5642         eval $setvar
5643         val='"unsigned long long"'
5644         set uquadtype
5645         eval $setvar
5646         quadkind=3
5647         ;;
5648       *) case "$d_int64_t" in
5649          define)
5650            val=int64_t
5651            set quadtype
5652            eval $setvar
5653            val=uint64_t
5654            set uquadtype
5655            eval $setvar
5656            quadkind=4
5657            ;;
5658          esac
5659          ;;
5660       esac
5661       ;;
5662    esac
5663    ;;
5664 esac
5665
5666 case "$quadtype" in
5667 '')     echo "Alas, no 64-bit integer types in sight." >&4
5668         d_quad="$undef"
5669         ;;
5670 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5671         d_quad="$define"
5672         ;;
5673 esac
5674
5675
5676 case "$uselonglong" in
5677 "$define"|true|[yY]*)
5678         cat <<EOM >&4
5679
5680 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5681 EOM
5682         use64bitint="$define"
5683         ;;
5684 esac                          
5685 case "$use64bits" in
5686 "$define"|true|[yY]*)
5687         cat <<EOM >&4
5688
5689 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5690 EOM
5691         use64bitint="$define"
5692         ;;
5693 esac                          
5694 case "$use64bitints" in
5695 "$define"|true|[yY]*)
5696         cat <<EOM >&4
5697
5698 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5699 EOM
5700         use64bitint="$define"
5701         ;;
5702 esac                          
5703 case "$use64bitsint" in
5704 "$define"|true|[yY]*)
5705         cat <<EOM >&4
5706
5707 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5708 EOM
5709         use64bitint="$define"
5710         ;;
5711 esac                          
5712 case "$uselonglongs" in
5713 "$define"|true|[yY]*)
5714         cat <<EOM >&4
5715
5716 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5717 EOM
5718         use64bitint="$define"
5719         ;;
5720 esac                          
5721 case "$use64bitsall" in
5722 "$define"|true|[yY]*)
5723         cat <<EOM >&4
5724
5725 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5726 EOM
5727         use64bitall="$define"
5728         ;;
5729 esac                          
5730
5731 case "$ccflags" in
5732 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5733 esac
5734 case "$use64bitall" in
5735 "$define"|true|[yY]*) use64bitint="$define" ;;
5736 esac
5737
5738 case "$longsize" in
5739 8) cat <<EOM
5740
5741 You have natively 64-bit long integers.
5742 EOM
5743    val="$define"
5744    ;;
5745 *) case "$use64bitint" in
5746    "$define"|true|[yY]*) dflt='y';;
5747    *) dflt='n';;
5748    esac
5749    case "$d_quad" in
5750    "$define") ;;
5751    *) dflt='n' ;;
5752    esac
5753    cat <<EOM
5754
5755 Perl can be built to take advantage of 64-bit integer types
5756 on some systems.  To do so, Configure can be run with -Duse64bitint.
5757 Choosing this option will most probably introduce binary incompatibilities.
5758
5759 If this doesn't make any sense to you, just accept the default '$dflt'.
5760 (The default has been chosen based on your configuration.)
5761 EOM
5762    rp='Try to use 64-bit integers, if available?'
5763    . ./myread
5764    case "$ans" in
5765    [yY]*) val="$define" ;;
5766    *)     val="$undef"  ;;
5767    esac
5768    ;;
5769 esac
5770 set use64bitint
5771 eval $setvar
5772
5773 case "$use64bitall" in
5774 "$define"|true|[yY]*) dflt='y' ;;
5775 *) case "$longsize" in
5776    8) dflt='y' ;;
5777    *) dflt='n' ;;
5778    esac
5779    ;;
5780 esac    
5781 cat <<EOM
5782
5783 You may also choose to try maximal 64-bitness.  It means using as much
5784 64-bitness as possible on the platform.  This in turn means even more
5785 binary incompatibilities.  On the other hand, your platform may not
5786 have any more 64-bitness available than what you already have chosen.
5787
5788 If this doesn't make any sense to you, just accept the default '$dflt'.
5789 (The default has been chosen based on your configuration.)
5790 EOM
5791 rp='Try to use maximal 64-bit support, if available?'
5792 . ./myread
5793 case "$ans" in
5794 [yY]*) val="$define" ;;
5795 *)     val="$undef"  ;;
5796 esac
5797 set use64bitall
5798 eval $setvar
5799 case "$use64bitall" in
5800 "$define")
5801         case "$use64bitint" in
5802         "$undef")
5803                 cat <<EOM
5804
5805 Since you have chosen a maximally 64-bit build, I'm also turning on
5806 the use of 64-bit integers.
5807 EOM
5808                 use64bitint="$define" ;;
5809         esac
5810         ;;
5811 esac
5812
5813 : Look for a hint-file generated 'call-back-unit'.  If the
5814 : user has specified that a 64-bit perl is to be built,
5815 : we may need to set or change some other defaults.
5816 if $test -f use64bitint.cbu; then
5817         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5818         . ./use64bitint.cbu
5819 fi
5820 case "$use64bitint" in
5821 "$define"|true|[yY]*)
5822         case "$longsize" in
5823         4) case "$archname64" in
5824            '') archname64=64int ;;
5825            esac
5826            ;;
5827         esac
5828         ;;
5829 esac
5830
5831 : Look for a hint-file generated 'call-back-unit'.  If the
5832 : user has specified that a maximally 64-bit perl is to be built,
5833 : we may need to set or change some other defaults.
5834 if $test -f use64bitall.cbu; then
5835         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5836         . ./use64bitall.cbu
5837 fi
5838 case "$use64bitall" in
5839 "$define"|true|[yY]*)
5840         case "$longsize" in
5841         4) case "$archname64" in
5842            ''|64int) archname64=64all ;;
5843            esac
5844            ;;
5845         esac
5846         ;;
5847 esac
5848
5849 case "$d_quad:$use64bitint" in
5850 $undef:$define)
5851         cat >&4 <<EOF
5852
5853 *** You have chosen to use 64-bit integers,
5854 *** but none can be found.
5855 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5856 *** Cannot continue, aborting.
5857
5858 EOF
5859         exit 1
5860         ;;
5861 esac
5862
5863 : check for length of double
5864 echo " "
5865 case "$doublesize" in
5866 '')
5867         echo "Checking to see how big your double precision numbers are..." >&4
5868         $cat >try.c <<EOCP
5869 #include <stdio.h>
5870 #$i_stdlib I_STDLIB
5871 #ifdef I_STDLIB
5872 #include <stdlib.h>
5873 #endif
5874 int main()
5875 {
5876     printf("%d\n", (int)sizeof(double));
5877     exit(0);
5878 }
5879 EOCP
5880         set try
5881         if eval $compile_ok; then
5882                 doublesize=`$run ./try`
5883                 echo "Your double is $doublesize bytes long."
5884         else
5885                 dflt='8'
5886                 echo "(I can't seem to compile the test program.  Guessing...)"
5887                 rp="What is the size of a double precision number (in bytes)?"
5888                 . ./myread
5889                 doublesize="$ans"
5890         fi
5891         ;;
5892 esac
5893 $rm_try
5894
5895 : check for long doubles
5896 echo " "
5897 echo "Checking to see if you have long double..." >&4
5898 echo 'int main() { long double x = 7.0; }' > try.c
5899 set try
5900 if eval $compile; then
5901         val="$define"
5902         echo "You have long double."
5903 else
5904         val="$undef"
5905         echo "You do not have long double."
5906 fi
5907 $rm_try
5908 set d_longdbl
5909 eval $setvar
5910
5911 : check for length of long double
5912 case "${d_longdbl}${longdblsize}" in
5913 $define)
5914         echo " "
5915         echo "Checking to see how big your long doubles are..." >&4
5916         $cat >try.c <<'EOCP'
5917 #include <stdio.h>
5918 int main()
5919 {
5920         printf("%d\n", sizeof(long double));
5921 }
5922 EOCP
5923         set try
5924         set try
5925         if eval $compile; then
5926                 longdblsize=`$run ./try`
5927                 echo "Your long doubles are $longdblsize bytes long."
5928         else
5929                 dflt='8'
5930                 echo " "
5931                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5932                 rp="What is the size of a long double (in bytes)?"
5933                 . ./myread
5934                 longdblsize="$ans"
5935         fi
5936         if $test "X$doublesize" = "X$longdblsize"; then
5937                 echo "That isn't any different from an ordinary double."
5938                 echo "I'll keep your setting anyway, but you may see some"
5939                 echo "harmless compilation warnings."
5940         fi
5941         ;;
5942 esac
5943 $rm_try
5944
5945 : determine the architecture name
5946 echo " "
5947 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5948         tarch=`arch`"-$osname"
5949 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5950         if uname -m > tmparch 2>&1 ; then
5951                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5952                         -e 's/$/'"-$osname/" tmparch`
5953         else
5954                 tarch="$osname"
5955         fi
5956         $rm -f tmparch
5957 else
5958         tarch="$osname"
5959 fi
5960 case "$myarchname" in
5961 ''|"$tarch") ;;
5962 *)
5963         echo "(Your architecture name used to be $myarchname.)"
5964         archname=''
5965         ;;
5966 esac
5967 case "$targetarch" in
5968 '') ;;
5969 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5970 esac
5971 myarchname="$tarch"
5972 case "$archname" in
5973 '') dflt="$tarch";;
5974 *) dflt="$archname";;
5975 esac
5976 rp='What is your architecture name'
5977 . ./myread
5978 archname="$ans"
5979 case "$usethreads" in
5980 $define)
5981         echo "Threads selected." >&4
5982         case "$archname" in
5983         *-thread*) echo "...and architecture name already has -thread." >&4
5984                 ;;
5985         *)      archname="$archname-thread"
5986                 echo "...setting architecture name to $archname." >&4
5987                 ;;
5988         esac
5989         ;;
5990 esac
5991 case "$usemultiplicity" in
5992 $define)
5993         echo "Multiplicity selected." >&4
5994         case "$archname" in
5995         *-multi*) echo "...and architecture name already has -multi." >&4
5996                 ;;
5997         *)      archname="$archname-multi"
5998                 echo "...setting architecture name to $archname." >&4
5999                 ;;
6000         esac
6001         ;;
6002 esac
6003 case "$use64bitint$use64bitall" in
6004 *"$define"*)
6005         case "$archname64" in
6006         '')
6007                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6008                 ;;
6009         *)
6010                 case "$use64bitint" in
6011                 "$define") echo "64 bit integers selected." >&4 ;;
6012                 esac
6013                 case "$use64bitall" in
6014                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6015                 esac
6016                 case "$archname" in
6017                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6018                         ;;
6019                 *)      archname="$archname-$archname64"
6020                         echo "...setting architecture name to $archname." >&4
6021                         ;;
6022                 esac
6023                 ;;
6024         esac
6025 esac
6026 case "$uselongdouble" in
6027 $define)
6028         echo "Long doubles selected." >&4
6029         case "$longdblsize" in
6030         $doublesize)
6031                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6032                 ;;
6033         *)
6034                 case "$archname" in
6035                 *-ld*) echo "...and architecture name already has -ld." >&4
6036                         ;;
6037                 *)      archname="$archname-ld"
6038                         echo "...setting architecture name to $archname." >&4
6039                         ;;
6040                 esac
6041                 ;;
6042         esac
6043         ;;
6044 esac
6045 case "$useperlio" in
6046 $define)
6047         echo "Perlio selected." >&4
6048         ;;
6049 *)
6050         echo "Perlio not selected, using stdio." >&4
6051         case "$archname" in
6052         *-stdio*) echo "...and architecture name already has -stdio." >&4
6053                 ;;
6054         *)      archname="$archname-stdio"
6055                 echo "...setting architecture name to $archname." >&4
6056                 ;;
6057         esac
6058         ;;
6059 esac
6060 if $test -f archname.cbu; then
6061         echo "Your platform has some specific hints for architecture name, using them..."
6062         . ./archname.cbu
6063 fi
6064
6065 : set the prefixit variable, to compute a suitable default value
6066 prefixit='case "$3" in
6067 ""|none)
6068         case "$oldprefix" in
6069         "") eval "$1=\"\$$2\"";;
6070         *)
6071                 case "$3" in
6072                 "") eval "$1=";;
6073                 none)
6074                         eval "tp=\"\$$2\"";
6075                         case "$tp" in
6076                         ""|" ") eval "$1=\"\$$2\"";;
6077                         *) eval "$1=";;
6078                         esac;;
6079                 esac;;
6080         esac;;
6081 *)
6082         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6083         case "$tp" in
6084         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6085         /*-$oldprefix/*|\~*-$oldprefix/*)
6086                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6087         *) eval "$1=\"\$$2\"";;
6088         esac;;
6089 esac'
6090
6091 : determine installation style
6092 : For now, try to deduce it from prefix unless it is already set.
6093 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6094 case "$installstyle" in
6095 '')     case "$prefix" in
6096                 *perl*) dflt='lib';;
6097                 *) dflt='lib/perl5' ;;
6098         esac
6099         ;;
6100 *)      dflt="$installstyle" ;;
6101 esac
6102 : Probably not worth prompting for this since we prompt for all
6103 : the directories individually, and the prompt would be too long and
6104 : confusing anyway.
6105 installstyle=$dflt
6106
6107 : determine where public executables go
6108 echo " "
6109 set dflt bin bin
6110 eval $prefixit
6111 fn=d~
6112 rp='Pathname where the public executables will reside?'
6113 . ./getfile
6114 if $test "X$ansexp" != "X$binexp"; then
6115         installbin=''
6116 fi
6117 prefixvar=bin
6118 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6119 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6120 :     this via initialinstalllocation
6121 . ./setprefixvar
6122
6123 case "$userelocatableinc" in
6124 $define|true|[yY]*)     dflt='y' ;;
6125 *)                      dflt='n' ;;
6126 esac
6127 cat <<EOM
6128
6129 Would you like to build Perl so that the installation is relocatable, so that
6130 library paths in @INC are determined relative to the path of the perl binary?
6131 This is not advised for system Perl installs, or if you need to run setid
6132 scripts or scripts under taint mode.
6133
6134 If this doesn't make any sense to you, just accept the default '$dflt'.
6135 EOM
6136 rp='Use relocatable @INC?'
6137 . ./myread
6138 case "$ans" in
6139 y|Y)    val="$define" ;;
6140 *)      val="$undef"  ;;
6141 esac
6142 set userelocatableinc
6143 eval $setvar
6144
6145 initialinstalllocation="$binexp"
6146 : Default prefix is now "up one level from where the binaries are"
6147 case "$userelocatableinc" in
6148 $define|true|[yY]*)
6149     bin=".../"
6150     binexp=".../"
6151     prefix=".../.."
6152     prefixexp=".../.."
6153     installprefixexp=".../.."
6154     ;;
6155 esac
6156
6157 : determine where private library files go
6158 : Usual default is /usr/local/lib/perl5/$version.
6159 : Also allow things like /opt/perl/lib/$version, since
6160 : /opt/perl/lib/perl5... would be redundant.
6161 : The default "style" setting is made in installstyle.U
6162 case "$installstyle" in
6163 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6164 *)       set dflt privlib lib/$version ;;
6165 esac
6166 eval $prefixit
6167 $cat <<EOM
6168
6169 There are some auxiliary files for $package that need to be put into a
6170 private library directory that is accessible by everyone.
6171
6172 EOM
6173 fn=$binexp
6174 fn=d~+
6175 rp='Pathname where the private library files will reside?'
6176 . ./getfile
6177 prefixvar=privlib
6178 . ./setprefixvar
6179
6180 : set the prefixup variable, to restore leading tilda escape
6181 prefixup='case "$prefixexp" in
6182 "$prefix") ;;
6183 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6184 esac'
6185
6186 : determine where public architecture dependent libraries go
6187 set archlib archlib
6188 eval $prefixit
6189 : privlib default is /usr/local/lib/$package/$version
6190 : archlib default is /usr/local/lib/$package/$version/$archname
6191 : privlib may have an optional trailing /share.
6192 tdflt=`echo $privlib | $sed 's,/share$,,'`
6193 tdflt=$tdflt/$archname
6194 case "$archlib" in
6195 '')     dflt=$tdflt
6196         ;;
6197 *)      dflt="$archlib"
6198     ;;
6199 esac
6200 $cat <<EOM
6201
6202 $spackage contains architecture-dependent library files.  If you are
6203 sharing libraries in a heterogeneous environment, you might store
6204 these files in a separate location.  Otherwise, you can just include
6205 them with the rest of the public library files.
6206
6207 EOM
6208 fn=$binexp
6209 fn=d+~
6210 rp='Where do you want to put the public architecture-dependent libraries?'
6211 . ./getfile
6212 prefixvar=archlib
6213 . ./setprefixvar
6214 if $test X"$archlib" = X"$privlib"; then
6215         d_archlib="$undef"
6216 else
6217         d_archlib="$define"
6218 fi
6219
6220 : see if setuid scripts can be secure
6221 $cat <<EOM
6222
6223 Some kernels have a bug that prevents setuid #! scripts from being
6224 secure.  Some sites have disabled setuid #! scripts because of this.
6225
6226 First let's decide if your kernel supports secure setuid #! scripts.
6227 (If setuid #! scripts would be secure but have been disabled anyway,
6228 don't say that they are secure if asked.)
6229
6230 EOM
6231
6232 val="$undef"
6233 if $test -d /dev/fd; then
6234         echo "#!$ls" >reflect
6235         chmod +x,u+s reflect
6236         ./reflect >flect 2>&1
6237         if $contains "/dev/fd" flect >/dev/null; then
6238                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6239                 val="$define"
6240         else
6241                 $cat <<EOM
6242 If you are not sure if they are secure, I can check but I'll need a
6243 username and password different from the one you are using right now.
6244 If you don't have such a username or don't want me to test, simply
6245 enter 'none'.
6246
6247 EOM
6248                 rp='Other username to test security of setuid scripts with?'
6249                 dflt='none'
6250                 . ./myread
6251                 case "$ans" in
6252                 n|none)
6253                         case "$d_suidsafe" in
6254                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6255                                 dflt=n;;
6256                         "$undef")
6257                                 echo "Well, the $hint value is *not* secure." >&4
6258                                 dflt=n;;
6259                         *)      echo "Well, the $hint value *is* secure." >&4
6260                                 dflt=y;;
6261                         esac
6262                         ;;
6263                 *)
6264                         $rm -f reflect flect
6265                         echo "#!$ls" >reflect
6266                         chmod +x,u+s reflect
6267                         echo >flect
6268                         chmod a+w flect
6269                         echo '"su" will (probably) prompt you for '"$ans's password."
6270                         su $ans -c './reflect >flect'
6271                         if $contains "/dev/fd" flect >/dev/null; then
6272                                 echo "Okay, it looks like setuid scripts are secure." >&4
6273                                 dflt=y
6274                         else
6275                                 echo "I don't think setuid scripts are secure." >&4
6276                                 dflt=n
6277                         fi
6278                         ;;
6279                 esac
6280                 rp='Does your kernel have *secure* setuid scripts?'
6281                 . ./myread
6282                 case "$ans" in
6283                 [yY]*)  val="$define";;
6284                 *)      val="$undef";;
6285                 esac
6286         fi
6287 else
6288         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6289         echo "(That's for file descriptors, not floppy disks.)"
6290         val="$undef"
6291 fi
6292 set d_suidsafe
6293 eval $setvar
6294
6295 $rm -f reflect flect
6296
6297 : now see if they want to do setuid emulation
6298 echo " "
6299 val="$undef"
6300 case "$d_suidsafe" in
6301 "$define")
6302         val="$undef"
6303         echo "No need to emulate SUID scripts since they are secure here." >&4
6304         ;;
6305 *)
6306         $cat <<EOM
6307 Some systems have disabled setuid scripts, especially systems where
6308 setuid scripts cannot be secure.  On systems where setuid scripts have
6309 been disabled, the setuid/setgid bits on scripts are currently
6310 useless.  It is possible for $package to detect those bits and emulate
6311 setuid/setgid in a secure fashion.  This emulation will only work if
6312 setuid scripts have been disabled in your kernel.
6313
6314 EOM
6315         case "$d_dosuid" in
6316         "$define") dflt=y ;;
6317         *) dflt=n ;;
6318         esac
6319         rp="Do you want to do setuid/setgid emulation?"
6320         . ./myread
6321         case "$ans" in
6322         [yY]*)  val="$define";;
6323         *)      val="$undef";;
6324         esac
6325         ;;
6326 esac
6327 set d_dosuid
6328 eval $setvar
6329
6330 : Find perl5.005 or later.
6331 echo "Looking for a previously installed perl5.005 or later... "
6332 case "$perl5" in
6333 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6334                 : Check if this perl is recent and can load a simple module
6335                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6336                         perl5=$tdir/perl
6337                         break;
6338                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6339                         perl5=$tdir/perl5
6340                         break;
6341                 fi
6342         done
6343         ;;
6344 *)      perl5="$perl5"
6345         ;;
6346 esac
6347 case "$perl5" in
6348 '')     echo "None found.  That's ok.";;
6349 *)      echo "Using $perl5." ;;
6350 esac
6351
6352 $cat <<EOM
6353
6354 After $package is installed, you may wish to install various
6355 add-on modules and utilities.  Typically, these add-ons will
6356 be installed under $prefix with the rest
6357 of this package.  However, you may wish to install such add-ons
6358 elsewhere under a different prefix.
6359
6360 If you do not wish to put everything under a single prefix, that's
6361 ok.  You will be prompted for the individual locations; this siteprefix
6362 is only used to suggest the defaults.
6363
6364 The default should be fine for most people.
6365
6366 EOM
6367 fn=d~+
6368 rp='Installation prefix to use for add-on modules and utilities?'
6369 : XXX Here might be another good place for an installstyle setting.
6370 case "$siteprefix" in
6371 '') dflt=$prefix ;;
6372 *)  dflt=$siteprefix ;;
6373 esac
6374 . ./getfile
6375 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6376 oldsiteprefix=''
6377 case "$siteprefix" in
6378 '') ;;
6379 *)      case "$ans" in
6380         "$prefix") ;;
6381         *) oldsiteprefix="$prefix";;
6382         esac
6383         ;;
6384 esac
6385 siteprefix="$ans"
6386 siteprefixexp="$ansexp"
6387
6388 : determine where site specific libraries go.
6389 : Usual default is /usr/local/lib/perl5/site_perl/$version
6390 : The default "style" setting is made in installstyle.U
6391 : XXX No longer works with Prefixit stuff.
6392 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6393 case "$sitelib" in
6394 '') case "$installstyle" in
6395         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6396         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6397         esac
6398         ;;
6399 *)      dflt="$sitelib"
6400         ;;
6401 esac
6402 $cat <<EOM
6403
6404 The installation process will create a directory for
6405 site-specific extensions and modules.  Most users find it convenient
6406 to place all site-specific files in this directory rather than in the
6407 main distribution directory.
6408
6409 EOM
6410 fn=d~+
6411 rp='Pathname for the site-specific library files?'
6412 . ./getfile
6413 prefixvar=sitelib
6414 . ./setprefixvar
6415 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6416
6417 : Determine list of previous versions to include in @INC
6418 $cat > getverlist <<EOPL
6419 #!$perl5 -w
6420 use File::Basename;
6421 \$api_versionstring = "$api_versionstring";
6422 \$version = "$version";
6423 \$stem = "$sitelib_stem";
6424 \$archname = "$archname";
6425 EOPL
6426         $cat >> getverlist <<'EOPL'
6427 # The list found is store twice for each entry: the original name, and
6428 # the binary broken down version as pack "sss", so sorting is easy and
6429 # unambiguous. This will work for all versions that have a maximum of
6430 # three digit groups, separate by '.'s or '_'s. Names are extended with
6431 # ".0.0" to ensure at least three elements for the pack.
6432 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6433
6434 # Can't have leading @ because metaconfig interprets it as a command!
6435 ;@inc_version_list=();
6436 # XXX Redo to do opendir/readdir?
6437 if (-d $stem) {
6438     chdir($stem);
6439     ;@candidates = map {
6440         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6441 }
6442 else {
6443     ;@candidates = ();
6444 }
6445
6446 ($pversion, $aversion, $vsn5005) = map {
6447     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6448 foreach $d (@candidates) {
6449     if ($d->[1] lt $pversion) {
6450         if ($d->[1] ge $aversion) {
6451             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6452         }
6453         elsif ($d->[1] ge $vsn5005) {
6454             unshift(@inc_version_list, grep { -d } $d->[0]);
6455         }
6456     }
6457     else {
6458         # Skip newer version.  I.e. don't look in
6459         # 5.7.0 if we're installing 5.6.1.
6460     }
6461 }
6462
6463 if (@inc_version_list) {
6464     print join(' ', @inc_version_list);
6465 }
6466 else {
6467     # Blank space to preserve value for next Configure run.
6468     print " ";
6469 }
6470 EOPL
6471 chmod +x getverlist
6472 case "$inc_version_list" in
6473 '')     if test -x "$perl5$exe_ext"; then
6474                 dflt=`$perl5 getverlist`
6475         else
6476                 dflt='none'
6477         fi
6478         ;;
6479 $undef) dflt='none' ;;
6480 *)  eval dflt=\"$inc_version_list\" ;;
6481 esac
6482 case "$dflt" in
6483 ''|' ') dflt=none ;;
6484 esac
6485 case "$dflt" in
6486 5.005) dflt=none ;;
6487 esac
6488 $cat <<EOM
6489
6490 In order to ease the process of upgrading, this version of perl
6491 can be configured to use modules built and installed with earlier
6492 versions of perl that were installed under $prefix.  Specify here
6493 the list of earlier versions that this version of perl should check.
6494 If Configure detected no earlier versions of perl installed under
6495 $prefix, then the list will be empty.  Answer 'none' to tell perl
6496 to not search earlier versions.
6497
6498 The default should almost always be sensible, so if you're not sure,
6499 just accept the default.
6500 EOM
6501
6502 rp='List of earlier versions to include in @INC?'
6503 . ./myread
6504 case "$ans" in
6505 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6506 *) inc_version_list="$ans" ;;
6507 esac
6508 case "$inc_version_list" in
6509 ''|' ')
6510         inc_version_list_init='0'
6511         d_inc_version_list="$undef"
6512         ;;
6513 *)      inc_version_list_init=`echo $inc_version_list |
6514                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6515         d_inc_version_list="$define"
6516         ;;
6517 esac
6518 $rm -f getverlist
6519
6520 : see if this is a malloc.h system
6521 : we want a real compile instead of Inhdr because some systems have a
6522 : malloc.h that just gives a compile error saying to use stdlib.h instead
6523 echo " "
6524 $cat >try.c <<EOCP
6525 #include <stdlib.h>
6526 #include <malloc.h>
6527 int main () { return 0; }
6528 EOCP
6529 set try
6530 if eval $compile; then
6531     echo "<malloc.h> found." >&4
6532     val="$define"
6533 else
6534     echo "<malloc.h> NOT found." >&4
6535     val="$undef"
6536 fi
6537 $rm_try
6538 set i_malloc
6539 eval $setvar
6540
6541 : check for void type
6542 echo " "
6543 echo "Checking to see how well your C compiler groks the void type..." >&4
6544 case "$voidflags" in
6545 '')
6546         $cat >try.c <<EOCP
6547 #$i_stdlib I_STDLIB
6548 #ifdef I_STDLIB
6549 #include <stdlib.h>
6550 #endif
6551 #if TRY & 1
6552 void sub() {
6553 #else
6554 sub() {
6555 #endif
6556         extern void moo();      /* function returning void */
6557         void (*goo)();          /* ptr to func returning void */
6558 #if TRY & 8
6559         void *hue;              /* generic ptr */
6560 #endif
6561 #if TRY & 2
6562         void (*foo[10])();
6563 #endif
6564
6565 #if TRY & 4
6566         if(goo == moo) {
6567                 exit(0);
6568         }
6569 #endif
6570         exit(0);
6571 }
6572 int main() { sub(); }
6573 EOCP
6574         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6575                 voidflags=$defvoidused
6576         echo "Good.  It appears to support void to the level $package wants.">&4
6577                 if $contains warning .out >/dev/null 2>&1; then
6578                         echo "However, you might get some warnings that look like this:"
6579                         $cat .out
6580                 fi
6581         else
6582 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6583                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6584                         echo "It supports 1..."
6585                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6586                                 echo "It also supports 2..."
6587                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6588                                         voidflags=7
6589                                         echo "And it supports 4 but not 8 definitely."
6590                                 else
6591                                         echo "It doesn't support 4..."
6592                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6593                                                 voidflags=11
6594                                                 echo "But it supports 8."
6595                                         else
6596                                                 voidflags=3
6597                                                 echo "Neither does it support 8."
6598                                         fi
6599                                 fi
6600                         else
6601                                 echo "It does not support 2..."
6602                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6603                                         voidflags=13
6604                                         echo "But it supports 4 and 8."
6605                                 else
6606                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6607                                                 voidflags=5
6608                                                 echo "And it supports 4 but has not heard about 8."
6609                                         else
6610                                                 echo "However it supports 8 but not 4."
6611                                         fi
6612                                 fi
6613                         fi
6614                 else
6615                         echo "There is no support at all for void."
6616                         voidflags=0
6617                 fi
6618         fi
6619 esac
6620 case "$voidflags" in
6621 "$defvoidused") ;;
6622 *)      $cat >&4 <<'EOM'
6623   Support flag bits are:
6624     1: basic void declarations.
6625     2: arrays of pointers to functions returning void.
6626     4: operations between pointers to and addresses of void functions.
6627     8: generic void pointers.
6628 EOM
6629         dflt="$voidflags";
6630         rp="Your void support flags add up to what?"
6631         . ./myread
6632         voidflags="$ans"
6633         ;;
6634 esac
6635 $rm_try
6636
6637 : check for length of pointer
6638 echo " "
6639 case "$ptrsize" in
6640 '')
6641         echo "Checking to see how big your pointers are..." >&4
6642         if test "$voidflags" -gt 7; then
6643                 echo '#define VOID_PTR char *' > try.c
6644         else
6645                 echo '#define VOID_PTR void *' > try.c
6646         fi
6647         $cat >>try.c <<EOCP
6648 #include <stdio.h>
6649 #$i_stdlib I_STDLIB
6650 #ifdef I_STDLIB
6651 #include <stdlib.h>
6652 #endif
6653 int main()
6654 {
6655     printf("%d\n", (int)sizeof(VOID_PTR));
6656     exit(0);
6657 }
6658 EOCP
6659         set try
6660         if eval $compile_ok; then
6661                 ptrsize=`$run ./try`
6662                 echo "Your pointers are $ptrsize bytes long."
6663         else
6664                 dflt='4'
6665                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6666                 rp="What is the size of a pointer (in bytes)?"
6667                 . ./myread
6668                 ptrsize="$ans"
6669         fi
6670         ;;
6671 esac
6672 $rm_try
6673 case "$use64bitall" in
6674 "$define"|true|[yY]*)
6675         case "$ptrsize" in
6676         4)      cat <<EOM >&4
6677
6678 *** You have chosen a maximally 64-bit build,
6679 *** but your pointers are only 4 bytes wide.
6680 *** Please rerun Configure without -Duse64bitall.
6681 EOM
6682                 case "$d_quad" in
6683                 define)
6684                         cat <<EOM >&4
6685 *** Since you have quads, you could possibly try with -Duse64bitint.
6686 EOM
6687                         ;;
6688                 esac
6689                 cat <<EOM >&4
6690 *** Cannot continue, aborting.
6691
6692 EOM
6693
6694                 exit 1
6695                 ;;
6696         esac
6697         ;;
6698 esac
6699
6700
6701 : determine whether to use malloc wrapping
6702 echo " "
6703 case "$usemallocwrap" in
6704 [yY]*|true|$define)     dflt='y' ;;
6705 [nN]*|false|$undef)     dflt='n' ;;
6706 *)      case "$usedevel" in
6707         [yY]*|true|$define)     dflt='y' ;;
6708         *) dflt='n' ;;
6709         esac
6710         ;;
6711 esac
6712 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6713 . ./myread
6714 usemallocwrap="$ans"
6715 case "$ans" in
6716 y*|true)
6717         usemallocwrap="$define" ;;
6718 *)
6719         usemallocwrap="$undef" ;;
6720 esac
6721
6722 : determine which malloc to compile in
6723 echo " "
6724 case "$usemymalloc" in
6725 [yY]*|true|$define)     dflt='y' ;;
6726 [nN]*|false|$undef)     dflt='n' ;;
6727 *)      case "$ptrsize" in
6728         4) dflt='y' ;;
6729         *) dflt='n' ;;
6730         esac
6731         ;;
6732 esac
6733 rp="Do you wish to attempt to use the malloc that comes with $package?"
6734 . ./myread
6735 usemymalloc="$ans"
6736 case "$ans" in
6737 y*|true)
6738         usemymalloc='y'
6739         mallocsrc='malloc.c'
6740         mallocobj="malloc$_o"
6741         d_mymalloc="$define"
6742         case "$libs" in
6743         *-lmalloc*)
6744                 : Remove malloc from list of libraries to use
6745                 echo "Removing unneeded -lmalloc from library list" >&4
6746                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6747                 shift
6748                 libs="$*"
6749                 echo "libs = $libs" >&4
6750                 ;;
6751         esac
6752         ;;
6753 *)
6754         usemymalloc='n'
6755         mallocsrc=''
6756         mallocobj=''
6757         d_mymalloc="$undef"
6758         ;;
6759 esac
6760
6761 : compute the return types of malloc and free
6762 echo " "
6763 $cat >malloc.c <<END
6764 #$i_malloc I_MALLOC
6765 #$i_stdlib I_STDLIB
6766 #include <stdio.h>
6767 #include <sys/types.h>
6768 #ifdef I_MALLOC
6769 #include <malloc.h>
6770 #endif
6771 #ifdef I_STDLIB
6772 #include <stdlib.h>
6773 #endif
6774 #ifdef TRY_MALLOC
6775 void *malloc();
6776 #endif
6777 #ifdef TRY_FREE
6778 void free();
6779 #endif
6780 END
6781 case "$malloctype" in
6782 '')
6783         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6784                 malloctype='void *'
6785         else
6786                 malloctype='char *'
6787         fi
6788         ;;
6789 esac
6790 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6791
6792 case "$freetype" in
6793 '')
6794         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6795                 freetype='void'
6796         else
6797                 freetype='int'
6798         fi
6799         ;;
6800 esac
6801 echo "Your system uses $freetype free(), it would seem." >&4
6802 $rm -f malloc.[co]
6803 : determine where site specific architecture-dependent libraries go.
6804 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6805 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6806 : sitelib may have an optional trailing /share.
6807 case "$sitearch" in
6808 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6809         dflt="$dflt/$archname"
6810         ;;
6811 *)      dflt="$sitearch"
6812         ;;
6813 esac
6814 set sitearch sitearch none
6815 eval $prefixit
6816 $cat <<EOM
6817
6818 The installation process will also create a directory for
6819 architecture-dependent site-specific extensions and modules.
6820
6821 EOM
6822 fn=d~+
6823 rp='Pathname for the site-specific architecture-dependent library files?'
6824 . ./getfile
6825 prefixvar=sitearch
6826 . ./setprefixvar
6827 if $test X"$sitearch" = X"$sitelib"; then
6828         d_sitearch="$undef"
6829 else
6830         d_sitearch="$define"
6831 fi
6832
6833 $cat <<EOM
6834
6835 The installation process will also create a directory for
6836 vendor-supplied add-ons.  Vendors who supply perl with their system
6837 may find it convenient to place all vendor-supplied files in this
6838 directory rather than in the main distribution directory.  This will
6839 ease upgrades between binary-compatible maintenance versions of perl.
6840
6841 Of course you may also use these directories in whatever way you see
6842 fit.  For example, you might use them to access modules shared over a
6843 company-wide network.
6844
6845 The default answer should be fine for most people.
6846 This causes further questions about vendor add-ons to be skipped
6847 and no vendor-specific directories will be configured for perl.
6848
6849 EOM
6850 rp='Do you want to configure vendor-specific add-on directories?'
6851 case "$usevendorprefix" in
6852 define|true|[yY]*) dflt=y ;;
6853 *)      : User may have set vendorprefix directly on Configure command line.
6854         case "$vendorprefix" in
6855         ''|' ') dflt=n ;;
6856         *)      dflt=y ;;
6857         esac
6858         ;;
6859 esac
6860 . ./myread
6861 case "$ans" in
6862 [yY]*)  fn=d~+
6863         rp='Installation prefix to use for vendor-supplied add-ons?'
6864         case "$vendorprefix" in
6865         '') dflt='' ;;
6866         *)  dflt=$vendorprefix ;;
6867         esac
6868         . ./getfile
6869         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6870         oldvendorprefix=''
6871         case "$vendorprefix" in
6872         '') ;;
6873         *)      case "$ans" in
6874                 "$prefix") ;;
6875                 *) oldvendorprefix="$prefix";;
6876                 esac
6877                 ;;
6878         esac
6879         usevendorprefix="$define"
6880         vendorprefix="$ans"
6881         vendorprefixexp="$ansexp"
6882         ;;
6883 *)      usevendorprefix="$undef"
6884         vendorprefix=''
6885         vendorprefixexp=''
6886         ;;
6887 esac
6888
6889 case "$vendorprefix" in
6890 '')     d_vendorlib="$undef"
6891         vendorlib=''
6892         vendorlibexp=''
6893         ;;
6894 *)      d_vendorlib="$define"
6895         : determine where vendor-supplied modules go.
6896         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6897         case "$vendorlib" in
6898         '')
6899                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6900                 case "$installstyle" in
6901                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6902                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6903                 esac
6904                 ;;
6905         *)      dflt="$vendorlib"
6906                 ;;
6907         esac
6908         fn=d~+
6909         rp='Pathname for the vendor-supplied library files?'
6910         . ./getfile
6911         vendorlib="$ans"
6912         vendorlibexp="$ansexp"
6913         ;;
6914 esac
6915 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6916 prefixvar=vendorlib
6917 . ./installprefix
6918
6919 case "$vendorprefix" in
6920 '')     d_vendorarch="$undef"
6921         vendorarch=''
6922         vendorarchexp=''
6923         ;;
6924 *)      d_vendorarch="$define"
6925         : determine where vendor-supplied architecture-dependent libraries go.
6926         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6927         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6928         : vendorlib may have an optional trailing /share.
6929         case "$vendorarch" in
6930         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6931                 dflt="$dflt/$archname"
6932                 ;;
6933         *)      dflt="$vendorarch" ;;
6934         esac
6935         fn=d~+
6936         rp='Pathname for vendor-supplied architecture-dependent files?'
6937         . ./getfile
6938         vendorarch="$ans"
6939         vendorarchexp="$ansexp"
6940         ;;
6941 esac
6942 prefixvar=vendorarch
6943 . ./installprefix
6944
6945 : Final catch-all directories to search
6946 $cat <<EOM
6947
6948 Lastly, you can have perl look in other directories for extensions and
6949 modules in addition to those already specified.
6950 These directories will be searched after 
6951         $sitearch 
6952         $sitelib 
6953 EOM
6954 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6955 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6956 echo ' '
6957 case "$otherlibdirs" in
6958 ''|' ') dflt='none' ;;
6959 *)      dflt="$otherlibdirs" ;;
6960 esac
6961 $cat <<EOM
6962 Enter a colon-separated set of extra paths to include in perl's @INC
6963 search path, or enter 'none' for no extra paths.
6964
6965 EOM
6966
6967 rp='Colon-separated list of additional directories for perl to search?'
6968 . ./myread
6969 case "$ans" in
6970 ' '|''|none)    otherlibdirs=' ' ;;     
6971 *)      otherlibdirs="$ans" ;;
6972 esac
6973 case "$otherlibdirs" in
6974 ' ') val=$undef ;;
6975 *)      val=$define ;;
6976 esac
6977 set d_perl_otherlibdirs
6978 eval $setvar
6979
6980 : Cruising for prototypes
6981 echo " "
6982 echo "Checking out function prototypes..." >&4
6983 $cat >prototype.c <<EOCP
6984 #$i_stdlib I_STDLIB
6985 #ifdef I_STDLIB
6986 #include <stdlib.h>
6987 #endif
6988 int main(int argc, char *argv[]) {
6989         exit(0);}
6990 EOCP
6991 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6992         echo "Your C compiler appears to support function prototypes."
6993         val="$define"
6994 else
6995         echo "Your C compiler doesn't seem to understand function prototypes."
6996         val="$undef"
6997 fi
6998 set prototype
6999 eval $setvar
7000 $rm -f prototype*
7001
7002 case "$prototype" in
7003 "$define") ;;
7004 *)      ansi2knr='ansi2knr'
7005         echo " "
7006         cat <<EOM >&4
7007
7008 $me:  FATAL ERROR:
7009 This version of $package can only be compiled by a compiler that 
7010 understands function prototypes.  Unfortunately, your C compiler 
7011         $cc $ccflags
7012 doesn't seem to understand them.  Sorry about that.
7013
7014 If GNU cc is available for your system, perhaps you could try that instead.  
7015
7016 Eventually, we hope to support building Perl with pre-ANSI compilers.
7017 If you would like to help in that effort, please contact <perlbug@perl.org>.
7018
7019 Aborting Configure now.
7020 EOM
7021         exit 2
7022         ;;
7023 esac
7024
7025 echo " "
7026 case "$extras" in
7027 '') dflt='n';;
7028 *) dflt='y';;
7029 esac
7030 cat <<EOM
7031 Perl can be built with extra modules or bundles of modules which
7032 will be fetched from the CPAN and installed alongside Perl.
7033
7034 Notice that you will need access to the CPAN; either via the Internet,
7035 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7036 be asked later to configure the CPAN.pm module which will in turn do
7037 the installation of the rest of the extra modules or bundles.)
7038
7039 Notice also that if the modules require any external software such as
7040 libraries and headers (the libz library and the zlib.h header for the
7041 Compress::Zlib module, for example) you MUST have any such software
7042 already installed, this configuration process will NOT install such
7043 things for you.
7044
7045 If this doesn't make any sense to you, just accept the default '$dflt'.
7046 EOM
7047 rp='Install any extra modules (y or n)?'
7048 . ./myread
7049 case "$ans" in
7050 y|Y)
7051         cat <<EOM
7052
7053 Please list any extra modules or bundles to be installed from CPAN,
7054 with spaces between the names.  The names can be in any format the
7055 'install' command of CPAN.pm will understand.  (Answer 'none',
7056 without the quotes, to install no extra modules or bundles.)
7057 EOM
7058         rp='Extras?'
7059         dflt="$extras"
7060         . ./myread
7061         extras="$ans"
7062 esac
7063 case "$extras" in
7064 ''|'none')
7065         val=''
7066         $rm -f ../extras.lst
7067         ;;
7068 *)      echo "(Saving the list of extras for later...)"
7069         echo "$extras" > ../extras.lst
7070         val="'$extras'"
7071         ;;
7072 esac
7073 set extras
7074 eval $setvar
7075 echo " "
7076
7077 : determine where html pages for programs go
7078 set html1dir html1dir none
7079 eval $prefixit
7080 $cat <<EOM
7081
7082 If you wish to install html files for programs in $spackage, indicate
7083 the appropriate directory here.  To skip installing html files,
7084 answer "none".
7085 EOM
7086 case "$html1dir" in
7087 ''|none|$undef|' ') dflt=none ;;
7088 *) dflt=$html1dir ;;
7089 esac
7090 fn=dn+~
7091 rp="Directory for the main $spackage html pages?"
7092 . ./getfile
7093 prefixvar=html1dir
7094 . ./setprefixvar
7095 : Use ' ' for none so value is preserved next time through Configure
7096 $test X"$html1dir" = "X" && html1dir=' '
7097
7098 : determine where html pages for libraries and modules go
7099 set html3dir html3dir none
7100 eval $prefixit
7101 $cat <<EOM
7102
7103 If you wish to install html files for modules associated with $spackage,
7104 indicate the appropriate directory here.  To skip installing html files,
7105 answer "none".
7106 EOM
7107 : There is no obvious default.  If they have specified html1dir, then
7108 : try to key off that, possibly changing .../html1 into .../html3.
7109 case "$html3dir" in
7110 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7111 *) dflt=$html3dir ;;
7112 esac
7113 fn=dn+~
7114 rp="Directory for the $spackage module html pages?"
7115 . ./getfile
7116 prefixvar=html3dir
7117 . ./setprefixvar
7118 : Use ' ' for none so value is preserved next time through Configure
7119 $test X"$html3dir" = "X" && html3dir=' '
7120
7121 : determine whether to install perl also as /usr/bin/perl
7122
7123 echo " "
7124 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7125         $cat <<EOM
7126 Many scripts expect perl to be installed as /usr/bin/perl.
7127
7128 If you want to, I can install the perl you are about to compile
7129 as /usr/bin/perl (in addition to $bin/perl).
7130 EOM
7131         if test -f /usr/bin/perl; then
7132             $cat <<EOM
7133
7134 However, please note that because you already have a /usr/bin/perl,
7135 overwriting that with a new Perl would very probably cause problems.
7136 Therefore I'm assuming you don't want to do that (unless you insist).
7137
7138 EOM
7139             case "$installusrbinperl" in
7140             "$define"|[yY]*)    dflt='y';;
7141             *)                  dflt='n';;
7142             esac
7143         else
7144             $cat <<EOM
7145
7146 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7147
7148 EOM
7149             case "$installusrbinperl" in
7150             "$undef"|[nN]*)     dflt='n';;
7151             *)                  dflt='y';;
7152             esac
7153         fi
7154         rp="Do you want to install perl as /usr/bin/perl?"
7155         . ./myread
7156         case "$ans" in
7157         [yY]*)  val="$define";;
7158         *)      val="$undef" ;;
7159         esac
7160 else
7161         val="$undef"
7162 fi
7163 set installusrbinperl
7164 eval $setvar
7165
7166 echo " "
7167 echo "Checking for GNU C Library..." >&4
7168 cat >try.c <<'EOCP'
7169 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7170    alone are insufficient to distinguish different versions, such as
7171    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7172    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7173 */
7174 #include <stdio.h>
7175 int main(void)
7176 {
7177 #ifdef __GLIBC__
7178 #   ifdef __GLIBC_MINOR__
7179 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7180 #           include <gnu/libc-version.h>
7181             printf("%s\n",  gnu_get_libc_version());
7182 #       else
7183             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7184 #       endif
7185 #   else
7186         printf("%d\n",  __GLIBC__);
7187 #   endif
7188     return 0;
7189 #else
7190     return 1;
7191 #endif
7192 }
7193 EOCP
7194 set try
7195 if eval $compile_ok && $run ./try > glibc.ver; then
7196         val="$define"
7197         gnulibc_version=`$cat glibc.ver`
7198         echo "You are using the GNU C Library version $gnulibc_version"
7199 else
7200         val="$undef"
7201         gnulibc_version=''
7202         echo "You are not using the GNU C Library"
7203 fi
7204 $rm_try glibc.ver
7205 set d_gnulibc
7206 eval $setvar
7207
7208 : see if nm is to be used to determine whether a symbol is defined or not
7209 case "$usenm" in
7210 '')
7211         dflt=''
7212         case "$d_gnulibc" in
7213         "$define")
7214                 echo " "
7215                 echo "nm probably won't work on the GNU C Library." >&4
7216                 dflt=n
7217                 ;;
7218         esac
7219         case "$dflt" in
7220         '') 
7221                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7222                         echo " "
7223                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7224                         echo "'nm' won't be sufficient on this sytem." >&4
7225                         dflt=n
7226                 fi
7227                 ;;
7228         esac
7229         case "$dflt" in
7230         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7231                 if $test $dflt -gt 20; then
7232                         dflt=y
7233                 else
7234                         dflt=n
7235                 fi
7236                 ;;
7237         esac
7238         ;;
7239 *)
7240         case "$usenm" in
7241         true|$define) dflt=y;;
7242         *) dflt=n;;
7243         esac
7244         ;;
7245 esac
7246 $cat <<EOM
7247
7248 I can use $nm to extract the symbols from your C libraries. This
7249 is a time consuming task which may generate huge output on the disk (up
7250 to 3 megabytes) but that should make the symbols extraction faster. The
7251 alternative is to skip the 'nm' extraction part and to compile a small
7252 test program instead to determine whether each symbol is present. If
7253 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7254 this may be the best solution.
7255
7256 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7257
7258 EOM
7259 rp="Shall I use $nm to extract C symbols from the libraries?"
7260 . ./myread
7261 case "$ans" in
7262 [Nn]*) usenm=false;;
7263 *) usenm=true;;
7264 esac
7265
7266 runnm=$usenm
7267 case "$reuseval" in
7268 true) runnm=false;;
7269 esac
7270
7271 : nm options which may be necessary
7272 case "$nm_opt" in
7273 '') if $test -f /mach_boot; then
7274                 nm_opt=''       # Mach
7275         elif $test -d /usr/ccs/lib; then
7276                 nm_opt='-p'     # Solaris (and SunOS?)
7277         elif $test -f /dgux; then
7278                 nm_opt='-p'     # DG-UX
7279         elif $test -f /lib64/rld; then
7280                 nm_opt='-p'     # 64-bit Irix
7281         else
7282                 nm_opt=''
7283         fi;;
7284 esac
7285
7286 : nm options which may be necessary for shared libraries but illegal
7287 : for archive libraries.  Thank you, Linux.
7288 case "$nm_so_opt" in
7289 '')     case "$myuname" in
7290         *linux*|gnu*)
7291                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7292                         nm_so_opt='--dynamic'
7293                 fi
7294                 ;;
7295         esac
7296         ;;
7297 esac
7298
7299 case "$runnm" in
7300 true)
7301 : get list of predefined functions in a handy place
7302 echo " "
7303 case "$libc" in
7304 '') libc=unknown
7305         case "$libs" in
7306         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7307         esac
7308         ;;
7309 esac
7310 case "$libs" in
7311 '') ;;
7312 *)  for thislib in $libs; do
7313         case "$thislib" in
7314         -lc|-lc_s)
7315                 : Handle C library specially below.
7316                 ;;
7317         -l*)
7318                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7319                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7320                         :
7321                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7322                         :
7323                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7324                         :
7325                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7326                         :
7327                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7328                         :
7329                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7330                         :
7331                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7332                         :
7333                 else
7334                         try=''
7335                 fi
7336                 libnames="$libnames $try"
7337                 ;;
7338         *) libnames="$libnames $thislib" ;;
7339         esac
7340         done
7341         ;;
7342 esac
7343 xxx=normal
7344 case "$libc" in
7345 unknown)
7346         set /lib/libc.$so
7347         for xxx in $libpth; do
7348                 $test -r $1 || set $xxx/libc.$so
7349                 : The messy sed command sorts on library version numbers.
7350                 $test -r $1 || \
7351                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7352                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7353                                 h
7354                                 s/[0-9][0-9]*/0000&/g
7355                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7356                                 G
7357                                 s/\n/ /' | \
7358                          $sort | $sed -e 's/^.* //'`
7359                 eval set \$$#
7360         done
7361         $test -r $1 || set /usr/ccs/lib/libc.$so
7362         $test -r $1 || set /lib/libsys_s$_a
7363         ;;
7364 *)
7365         set blurfl
7366         ;;
7367 esac
7368 if $test -r "$1"; then
7369         echo "Your (shared) C library seems to be in $1."
7370         libc="$1"
7371 elif $test -r /lib/libc && $test -r /lib/clib; then
7372         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7373         xxx=apollo
7374         libc='/lib/clib /lib/libc'
7375         if $test -r /lib/syslib; then
7376                 echo "(Your math library is in /lib/syslib.)"
7377                 libc="$libc /lib/syslib"
7378         fi
7379 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7380         echo "Your C library seems to be in $libc, as you said before."
7381 elif $test -r $incpath/usr/lib/libc$_a; then
7382         libc=$incpath/usr/lib/libc$_a;
7383         echo "Your C library seems to be in $libc.  That's fine."
7384 elif $test -r /lib/libc$_a; then
7385         libc=/lib/libc$_a;
7386         echo "Your C library seems to be in $libc.  You're normal."
7387 else
7388         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7389                 :
7390         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7391                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7392         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7393                 :
7394         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7395                 :
7396         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7397                 :
7398         else
7399                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7400         fi
7401         if $test -r "$tans"; then
7402                 echo "Your C library seems to be in $tans, of all places."
7403                 libc=$tans
7404         else
7405                 libc='blurfl'
7406         fi
7407 fi
7408 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7409         dflt="$libc"
7410         cat <<EOM
7411
7412 If the guess above is wrong (which it might be if you're using a strange
7413 compiler, or your machine supports multiple models), you can override it here.
7414
7415 EOM
7416 else
7417         dflt=''
7418         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7419         cat >&4 <<EOM
7420 I can't seem to find your C library.  I've looked in the following places:
7421
7422 EOM
7423         $sed 's/^/      /' libpath
7424         cat <<EOM
7425
7426 None of these seems to contain your C library. I need to get its name...
7427
7428 EOM
7429 fi
7430 fn=f
7431 rp='Where is your C library?'
7432 . ./getfile
7433 libc="$ans"
7434
7435 echo " "
7436 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7437 set X `cat libnames`
7438 shift
7439 xxx=files
7440 case $# in 1) xxx=file; esac
7441 echo "Extracting names from the following $xxx for later perusal:" >&4
7442 echo " "
7443 $sed 's/^/      /' libnames >&4
7444 echo " "
7445 $echo $n "This may take a while...$c" >&4
7446
7447 for file in $*; do
7448         case $file in
7449         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7450         *) $nm $nm_opt $file 2>/dev/null;;
7451         esac
7452 done >libc.tmp
7453
7454 $echo $n ".$c"
7455 $grep fprintf libc.tmp > libc.ptf
7456 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7457 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7458 xxx='[ADTSIW]'
7459 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7460         eval $xscan;\
7461         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7462                 eval $xrun
7463 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7464         eval $xscan;\
7465         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7466                 eval $xrun
7467 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7468         eval $xscan;\
7469         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7470                 eval $xrun
7471 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7472         eval $xscan;\
7473         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7474                 eval $xrun
7475 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7476         eval $xscan;\
7477         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7478                 eval $xrun
7479 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7480         eval $xscan;\
7481         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7482                 eval $xrun
7483 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7484                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7485         eval $xscan;\
7486         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7487                 eval $xrun
7488 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7489         eval $xscan;\
7490         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7491                 eval $xrun
7492 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7493         eval $xscan;\
7494         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7495                 eval $xrun
7496 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7497         eval $xscan;\
7498         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7499                 eval $xrun
7500 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7501         eval $xscan;\
7502         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7503                 eval $xrun
7504 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7505         eval $xscan;\
7506         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7507                 eval $xrun
7508 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7509         eval $xscan;\
7510         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7511                 eval $xrun
7512 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7513         eval $xscan;\
7514         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7515                 eval $xrun
7516 else
7517         $nm -p $* 2>/dev/null >libc.tmp
7518         $grep fprintf libc.tmp > libc.ptf
7519         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7520                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7521         then
7522                 nm_opt='-p'
7523                 eval $xrun
7524         else
7525                 echo " "
7526                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7527                 com=''
7528                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7529                         for thisname in $libnames $libc; do
7530                                 $ar t $thisname >>libc.tmp
7531                         done
7532                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7533                         echo "Ok." >&4
7534                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7535                         # Repeat libc to extract forwarders to DLL entries too
7536                         for thisname in $libnames $libc; do
7537                                 $ar tv $thisname >>libc.tmp
7538                                 # Revision 50 of EMX has bug in $ar.
7539                                 # it will not extract forwarders to DLL entries
7540                                 # Use emximp which will extract exactly them.
7541                                 emximp -o tmp.imp $thisname \
7542                                     2>/dev/null && \
7543                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7544                                     < tmp.imp >>libc.tmp
7545                                 $rm tmp.imp
7546                         done
7547                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7548                         echo "Ok." >&4
7549                 else
7550                         echo "$ar didn't seem to work right." >&4
7551                         echo "Maybe this is a Cray...trying bld instead..." >&4
7552                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7553                         then
7554                                 for thisname in $libnames; do
7555                                         bld t $libnames | \
7556                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7557                                         $ar t $thisname >>libc.tmp
7558                                 done
7559                                 echo "Ok." >&4
7560                         else
7561                                 echo "That didn't work either.  Giving up." >&4
7562                                 exit 1
7563                         fi
7564                 fi
7565         fi
7566 fi
7567 nm_extract="$com"
7568 case "$PASE" in
7569 define)
7570     echo " "
7571     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7572     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7573     ;;
7574 *)  if $test -f /lib/syscalls.exp; then
7575         echo " "
7576         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7577         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7578     fi
7579     ;;
7580 esac
7581 ;;
7582 esac
7583 $rm -f libnames libpath
7584
7585 : see if dld is available
7586 set dld.h i_dld
7587 eval $inhdr
7588
7589
7590 echo " "
7591 echo "Checking for C++..." >&4
7592 $cat >try.c <<'EOCP'
7593 #include <stdio.h>
7594 int main(void)
7595 {
7596 #ifdef __cplusplus
7597     return 0;
7598 #else
7599     return 1;
7600 #endif
7601 }
7602 EOCP
7603 set try
7604 if eval $compile_ok && $run ./try; then
7605         val="$define"
7606         echo "You are using a C++ compiler."
7607 else
7608         val="$undef"
7609         echo "You are not using a C++ compiler."
7610 fi
7611 $rm_try cplusplus$$
7612 set d_cplusplus
7613 eval $setvar
7614
7615 : is a C symbol defined?
7616 csym='tlook=$1;
7617 case "$3" in
7618 -v) tf=libc.tmp; tdc="";;
7619 -a) tf=libc.tmp; tdc="[]";;
7620 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7621 esac;
7622 tx=yes;
7623 case "$reuseval-$4" in
7624 true-) ;;
7625 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7626 esac;
7627 case "$tx" in
7628 yes)
7629         tval=false;
7630         case "$d_cplusplus" in
7631                 $define) extern_C=\"C\";;
7632         esac;
7633         if $test "$runnm" = true; then
7634                 if $contains $tlook $tf >/dev/null 2>&1; then
7635                         tval=true;
7636                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7637                         echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7638                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7639                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7640                         $rm_try;
7641                 fi;
7642         else
7643                 echo "extern $extern_C void *$1$tdc; void *(*(p()))$tdc { return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7644                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7645                 $rm_try;
7646         fi;
7647         ;;
7648 *)
7649         case "$tval" in
7650         $define) tval=true;;
7651         *) tval=false;;
7652         esac;
7653         ;;
7654 esac;
7655 eval "$2=$tval"'
7656
7657 : define an is-in-libc? function
7658 inlibc='echo " "; td=$define; tu=$undef;
7659 sym=$1; var=$2; eval "was=\$$2";
7660 tx=yes;
7661 case "$reuseval$was" in
7662 true) ;;
7663 true*) tx=no;;
7664 esac;
7665 case "$tx" in
7666 yes)
7667         set $sym tres -f;
7668         eval $csym;
7669         case "$tres" in
7670         true)
7671                 echo "$sym() found." >&4;
7672                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7673         *)
7674                 echo "$sym() NOT found." >&4;
7675                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7676         esac;;
7677 *)
7678         case "$was" in
7679         $define) echo "$sym() found." >&4;;
7680         *) echo "$sym() NOT found." >&4;;
7681         esac;;
7682 esac'
7683
7684 : see if dlopen exists
7685 xxx_runnm="$runnm"
7686 xxx_ccflags="$ccflags"
7687 runnm=false
7688 : with g++ one needs -shared to get is-in-libc to work for dlopen
7689 case "$gccversion" in
7690 '')     ;;
7691 *)      case "$d_cplusplus" in
7692         "$define") ccflags="$ccflags -shared" ;;
7693         esac
7694         ;;
7695 esac
7696 set dlopen d_dlopen
7697 eval $inlibc
7698 runnm="$xxx_runnm"
7699 ccflags="$xxx_ccflags"
7700
7701 : see if this is a unistd.h system
7702 set unistd.h i_unistd
7703 eval $inhdr
7704
7705 : determine which dynamic loading, if any, to compile in
7706 echo " "
7707 dldir="ext/DynaLoader"
7708 case "$usedl" in
7709 $define|y|true)
7710         dflt='y'
7711         usedl="$define"
7712         ;;
7713 $undef|n|false)
7714         dflt='n'
7715         usedl="$undef"
7716         ;;
7717 *)
7718         dflt='n'
7719         case "$d_dlopen" in
7720             $define) dflt='y' ;;
7721         esac
7722         case "$i_dld" in
7723             $define) dflt='y' ;;
7724         esac
7725         : Does a dl_xxx.xs file exist for this operating system
7726         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7727         ;;
7728 esac
7729 rp="Do you wish to use dynamic loading?"
7730 . ./myread
7731 usedl="$ans"
7732 case "$ans" in
7733 y*) usedl="$define"
7734         case "$dlsrc" in
7735         '')
7736                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7737                         dflt="$dldir/dl_${osname}.xs"
7738                 elif $test "$d_dlopen" = "$define" ; then
7739                         dflt="$dldir/dl_dlopen.xs"
7740                 elif $test "$i_dld" = "$define" ; then
7741                         dflt="$dldir/dl_dld.xs"
7742                 else
7743                         dflt=''
7744                 fi
7745                 ;;
7746         *)      dflt="$dldir/$dlsrc"
7747                 ;;
7748         esac
7749     echo "The following dynamic loading files are available:"
7750         : Can not go over to $dldir because getfile has path hard-coded in.
7751         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7752         rp="Source file to use for dynamic loading"
7753         fn="fne"
7754         gfpth="$src"
7755         . ./getfile
7756         usedl="$define"
7757         : emulate basename
7758         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7759
7760         $cat << EOM
7761
7762 Some systems may require passing special flags to $cc -c to
7763 compile modules that will be used to create a shared library.
7764 To use no flags, say "none".
7765
7766 EOM
7767     case "$cccdlflags" in
7768     '') case "$gccversion" in
7769                 '') case "$osname" in
7770                         hpux)   dflt='+z' ;;
7771                         next)   dflt='none' ;;
7772                         irix*)  dflt='-KPIC' ;;
7773                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7774                         sunos)  dflt='-pic' ;;
7775                         *)      dflt='none' ;;
7776                     esac
7777                         ;;
7778                 *)  case "$osname" in
7779                         darwin) dflt='none' ;;
7780                         linux*|svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7781                         *)      dflt='-fpic' ;;
7782                     esac ;;
7783             esac ;;
7784         ' ') dflt='none' ;;
7785     *)  dflt="$cccdlflags" ;;
7786     esac
7787     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7788     . ./myread
7789     case "$ans" in
7790     none) cccdlflags=' ' ;;
7791     *) cccdlflags="$ans" ;;
7792     esac
7793
7794     cat << EOM
7795
7796 Some systems use ld to create libraries that can be dynamically loaded,
7797 while other systems (such as those using ELF) use $cc.
7798
7799 EOM
7800         case "$ld" in
7801         '')     $cat >try.c <<EOM
7802 /* Test for whether ELF binaries are produced */
7803 #include <fcntl.h>
7804 #$i_stdlib I_STDLIB
7805 #ifdef I_STDLIB
7806 #include <stdlib.h>
7807 #endif
7808 #$i_unistd I_UNISTD
7809 #ifdef I_UNISTD
7810 #include <unistd.h>
7811 #endif
7812 int main() {
7813         char b[4];
7814         int i = open("a.out",O_RDONLY);
7815         if(i == -1)
7816                 exit(1); /* fail */
7817         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7818                 exit(0); /* succeed (yes, it's ELF) */
7819         else
7820                 exit(1); /* fail */
7821 }
7822 EOM
7823                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7824                         cat <<EOM
7825 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7826 EOM
7827                         dflt="$cc"
7828                 else
7829                         echo "I'll use ld to build dynamic libraries."
7830                         dflt='ld'
7831                 fi
7832                 $rm_try
7833                 ;;
7834         *)      dflt="$ld"
7835                 ;;
7836         esac
7837
7838     rp="What command should be used to create dynamic libraries?"
7839     . ./myread
7840         ld="$ans"
7841
7842     cat << EOM
7843
7844 Some systems may require passing special flags to $ld to create a
7845 library that can be dynamically loaded.  If your ld flags include
7846 -L/other/path options to locate libraries outside your loader's normal
7847 search path, you may need to specify those -L options here as well.  To
7848 use no flags, say "none".
7849
7850 EOM
7851     case "$lddlflags" in
7852     '') case "$osname" in
7853                         beos) dflt='-nostart' ;;
7854                         hpux) dflt='-b';
7855                               case "$gccversion" in
7856                               '') dflt="$dflt +vnocompatwarnings" ;;
7857                               esac
7858                               ;;
7859                         linux|irix*|gnu*)  dflt="-shared $optimize" ;;
7860                         next)  dflt='none' ;;
7861                         solaris) dflt='-G' ;;
7862                         sunos) dflt='-assert nodefinitions' ;;
7863                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7864                 *)     dflt='none' ;;
7865                         esac
7866                         ;;
7867     *) dflt="$lddlflags" ;;
7868     esac
7869
7870         : Try to guess additional flags to pick up local libraries.
7871         : Be careful not to append to a plain 'none'
7872         case "$dflt" in
7873         none) dflt='' ;;
7874         esac
7875         for thisflag in $ldflags; do
7876                 case "$thisflag" in
7877                 -L*|-R*|-Wl,-R*)
7878                         case " $dflt " in
7879                         *" $thisflag "*) ;;
7880                         *) dflt="$dflt $thisflag" ;;
7881                         esac
7882                         ;;
7883                 esac
7884         done
7885
7886         case "$dflt" in
7887         ''|' ') dflt='none' ;;
7888         esac
7889
7890     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7891     . ./myread
7892     case "$ans" in
7893     none) lddlflags=' ' ;;
7894     *) lddlflags="$ans" ;;
7895     esac
7896
7897         cat <<EOM
7898
7899 Some systems may require passing special flags to $cc to indicate that
7900 the resulting executable will use dynamic linking.  To use no flags,
7901 say "none".
7902
7903 EOM
7904     case "$ccdlflags" in
7905     '') case "$osname" in
7906             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7907             next|sunos) dflt='none' ;;
7908             *)          dflt='none' ;;
7909             esac ;;
7910     ' ')  dflt='none' ;;
7911     *)  dflt="$ccdlflags" ;;
7912     esac
7913     rp="Any special flags to pass to $cc to use dynamic linking?"
7914     . ./myread
7915     case "$ans" in
7916     none) ccdlflags=' ' ;;
7917     *) ccdlflags="$ans" ;;
7918     esac
7919     ;;
7920 *)  usedl="$undef"
7921         ld='ld'
7922     dlsrc='dl_none.xs'
7923     lddlflags=''
7924     ccdlflags=''
7925     ;;
7926 esac
7927
7928 also=''
7929 case "$usedl" in
7930 $undef)
7931         # No dynamic loading being used, so don't bother even to prompt.
7932         useshrplib='false'
7933         ;;
7934 *)      case "$useshrplib" in
7935         '')     case "$osname" in
7936                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7937                         dflt=y
7938                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7939                         ;;
7940                 next*)
7941                         case "$osvers" in
7942                         4*)     dflt=y
7943                                 also='Building a shared libperl is needed for MAB support.'
7944                                 ;;
7945                         *)      dflt=n
7946                                 ;;
7947                         esac
7948                         ;;
7949                 *)      dflt=n
7950                         ;;
7951                 esac
7952                 ;;
7953         $define|true|[Yy]*)
7954                 dflt=y
7955                 ;;
7956         *)      dflt=n
7957                 ;;
7958         esac
7959         $cat << EOM
7960
7961 The perl executable is normally obtained by linking perlmain.c with
7962 libperl${_a}, any static extensions (usually just DynaLoader), and
7963 any other libraries needed on this system (such as -lm, etc.).  Since
7964 your system supports dynamic loading, it is probably possible to build
7965 a shared libperl.$so.  If you will have more than one executable linked
7966 to libperl.$so, this will significantly reduce the size of each
7967 executable, but it may have a noticeable effect on performance.  The
7968 default is probably sensible for your system.
7969 $also
7970
7971 EOM
7972         rp="Build a shared libperl.$so (y/n)"
7973         . ./myread
7974         case "$ans" in
7975         true|$define|[Yy]*)
7976                 useshrplib='true'  ;;
7977         *)      useshrplib='false' ;;
7978         esac
7979         ;;
7980 esac
7981
7982 case "$useshrplib" in
7983 true)
7984         case "$libperl" in
7985         '')
7986                 # Figure out a good name for libperl.so.  Since it gets stored in
7987                 # a version-specific architecture-dependent library, the version
7988                 # number isn't really that important, except for making cc/ld happy.
7989                 #
7990                 # A name such as libperl.so.3.1
7991                 majmin="libperl.$so.$patchlevel.$subversion"
7992                 # A name such as libperl.so.301
7993                 majonly=`echo $patchlevel $subversion |
7994                         $awk '{printf "%d%02d", $1, $2}'`
7995                 majonly=libperl.$so.$majonly
7996                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7997                 # rely on figuring it out from the naming of libc.
7998                 case "${osname}${osvers}" in
7999                 next4*)
8000                         dflt=libperl.5.$so
8001                         # XXX How handle the --version stuff for MAB?
8002                         ;;
8003                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
8004                         dflt=libperl.$so
8005                         ;;
8006                 cygwin*) # ld links against an importlib
8007                         dflt=libperl$lib_ext
8008                         ;;
8009                 *)      # Try to guess based on whether libc has major.minor.
8010                         case "$libc" in
8011                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
8012                         *libc.$so.[0-9]*) dflt=$majonly ;;
8013                         *)      dflt=libperl.$so ;;
8014                         esac
8015                         ;;
8016                 esac
8017                 ;;
8018         *)      dflt=$libperl
8019                 ;;
8020         esac
8021         cat << EOM
8022
8023 I need to select a good name for the shared libperl.  If your system uses
8024 library names with major and minor numbers, then you might want something
8025 like $majmin.  Alternatively, if your system uses a single version
8026 number for shared libraries, then you might want to use $majonly.
8027 Or, your system might be quite happy with a simple libperl.$so.
8028
8029 Since the shared libperl will get installed into a version-specific
8030 architecture-dependent directory, the version number of the shared perl
8031 library probably isn't important, so the default should be o.k.
8032
8033 EOM
8034         rp='What name do you want to give to the shared libperl?'
8035         . ./myread
8036         libperl=$ans
8037         echo "Ok, I'll use $libperl"
8038         ;;
8039 *)
8040         libperl="libperl${_a}"
8041         ;;
8042 esac
8043
8044 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8045 case "$shrpdir" in
8046 '') ;;
8047 *)      $cat >&4 <<EOM
8048 WARNING:  Use of the shrpdir variable for the installation location of
8049 the shared $libperl is not supported.  It was never documented and
8050 will not work in this version.  Let me (perlbug@perl.org)
8051 know of any problems this may cause.
8052
8053 EOM
8054         case "$shrpdir" in
8055         "$archlibexp/CORE")
8056                 $cat >&4 <<EOM
8057 But your current setting of $shrpdir is
8058 the default anyway, so it's harmless.
8059 EOM
8060                 ;;
8061         *)
8062                 $cat >&4 <<EOM
8063 Further, your current attempted setting of $shrpdir
8064 conflicts with the value of $archlibexp/CORE
8065 that installperl will use.
8066 EOM
8067                 ;;
8068         esac
8069         ;;
8070 esac
8071
8072 # How will the perl executable find the installed shared $libperl?
8073 # Add $xxx to ccdlflags.
8074 # If we can't figure out a command-line option, use $shrpenv to
8075 # set env LD_RUN_PATH.  The main perl makefile uses this.
8076 shrpdir=$archlibexp/CORE
8077 xxx=''
8078 tmp_shrpenv=''
8079 if "$useshrplib"; then
8080     case "$osname" in 
8081         aix)
8082                 # We'll set it in Makefile.SH...
8083                 ;;
8084         solaris)
8085                 xxx="-R $shrpdir"
8086                 ;;
8087         freebsd|netbsd|openbsd|interix|dragonfly)
8088                 xxx="-Wl,-R$shrpdir"
8089                 ;;
8090         bsdos|linux|irix*|dec_osf|gnu*)
8091                 xxx="-Wl,-rpath,$shrpdir"
8092                 ;;
8093         next)
8094                 # next doesn't like the default...
8095                 ;;
8096         beos)
8097                 # beos doesn't like the default, either.
8098                 ;;
8099         hpux*)
8100                 # hpux doesn't like the default, either.
8101                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8102                 ;;
8103         *)
8104                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8105                 ;;
8106         esac
8107         case "$xxx" in
8108         '') ;;
8109         *)      
8110                 # Only add $xxx if it isn't already in ccdlflags.
8111                 case " $ccdlflags " in
8112                 *" $xxx "*)     ;;
8113                 *)      ccdlflags="$ccdlflags $xxx"
8114                         cat <<EOM >&4
8115
8116 Adding $xxx to the flags
8117 passed to $ld so that the perl executable will find the 
8118 installed shared $libperl.
8119
8120 EOM
8121                         ;;
8122                 esac
8123                 ;;
8124         esac
8125 fi
8126 # Fix ccdlflags in AIX for building external extensions.
8127 # (For building Perl itself bare -bE:perl.exp is needed,
8128 #  Makefile.SH takes care of this.)
8129 case "$osname" in
8130 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8131 esac
8132 # Respect a hint or command-line value.
8133 case "$shrpenv" in
8134 '') shrpenv="$tmp_shrpenv" ;;
8135 esac
8136 case "$ldlibpthname" in
8137 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8138 none)   ldlibpthname='' ;;
8139 esac
8140
8141 : determine where manual pages are on this system
8142 echo " "
8143 case "$sysman" in
8144 '') 
8145         syspath='/usr/share/man/man1 /usr/man/man1'
8146         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8147         syspath="$syspath /usr/man/u_man/man1"
8148         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8149         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8150         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8151         sysman=`./loc . /usr/man/man1 $syspath`
8152         ;;
8153 esac
8154 if $test -d "$sysman"; then
8155         echo "System manual is in $sysman." >&4
8156 else
8157         echo "Could not find manual pages in source form." >&4
8158 fi
8159
8160 : determine where manual pages go
8161 set man1dir man1dir none
8162 eval $prefixit
8163 $cat <<EOM
8164
8165 $spackage has manual pages available in source form.
8166 EOM
8167 case "$nroff" in
8168 nroff)
8169         echo "However, you don't have nroff, so they're probably useless to you."
8170         case "$man1dir" in
8171         '') man1dir="none";;
8172         esac;;
8173 esac
8174 echo "If you don't want the manual sources installed, answer 'none'."
8175 case "$man1dir" in
8176 ' ') dflt=none
8177         ;;
8178 '')
8179         lookpath="$prefixexp/share/man/man1"
8180         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8181         lookpath="$lookpath $prefixexp/man/p_man/man1"
8182         lookpath="$lookpath $prefixexp/man/u_man/man1"
8183         lookpath="$lookpath $prefixexp/man/man.1"
8184         case "$sysman" in
8185         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8186         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8187         esac
8188         set dflt
8189         eval $prefixup
8190         ;;
8191 *)  dflt="$man1dir"
8192         ;;
8193 esac
8194 echo " "
8195 fn=dn+~
8196 rp="Where do the main $spackage manual pages (source) go?"
8197 . ./getfile
8198 if $test "X$man1direxp" != "X$ansexp"; then
8199         installman1dir=''
8200 fi
8201 prefixvar=man1dir
8202 . ./setprefixvar
8203
8204 case "$man1dir" in
8205 '')     man1dir=' '
8206         installman1dir='';;
8207 esac
8208
8209 : What suffix to use on installed man pages
8210
8211 case "$man1dir" in
8212 ' ')
8213         man1ext='0'
8214         ;;
8215 *)
8216         rp="What suffix should be used for the main $spackage man pages?"
8217         case "$man1ext" in
8218         '')     case "$man1dir" in
8219                 *1)  dflt=1 ;;
8220                 *1p) dflt=1p ;;
8221                 *1pm) dflt=1pm ;;
8222                 *l) dflt=l;;
8223                 *n) dflt=n;;
8224                 *o) dflt=o;;
8225                 *p) dflt=p;;
8226                 *C) dflt=C;;
8227                 *L) dflt=L;;
8228                 *L1) dflt=L1;;
8229                 *) dflt=1;;
8230                 esac
8231                 ;;
8232         *)      dflt="$man1ext";;
8233         esac
8234         . ./myread
8235         man1ext="$ans"
8236         ;;
8237 esac
8238
8239 : see if we can have long filenames
8240 echo " "
8241 first=123456789abcdef
8242 $rm -f $first
8243 if (echo hi >$first) 2>/dev/null; then
8244         if $test -f 123456789abcde; then
8245                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8246                 val="$undef"
8247         else
8248                 echo 'You can have filenames longer than 14 characters.'>&4
8249                 val="$define"
8250         fi
8251 else
8252         $cat <<'EOM'
8253 You can't have filenames longer than 14 chars.
8254 You can't even think about them!
8255 EOM
8256         val="$undef"
8257 fi 
8258 set d_flexfnam
8259 eval $setvar
8260 $rm -rf 123456789abcde*
8261
8262 : determine where library module manual pages go
8263 set man3dir man3dir none
8264 eval $prefixit
8265 $cat <<EOM
8266
8267 $spackage has manual pages for many of the library modules.
8268 EOM
8269
8270 case "$nroff" in
8271 nroff)
8272         $cat <<'EOM'
8273 However, you don't have nroff, so they're probably useless to you.
8274 EOM
8275         case "$man3dir" in
8276         '') man3dir="none";;
8277         esac;;
8278 esac
8279
8280 case "$d_flexfnam" in
8281 undef)
8282         $cat <<'EOM'
8283 However, your system can't handle the long file names like File::Basename.3.
8284 EOM
8285         case "$man3dir" in
8286         '') man3dir="none";;
8287         esac;;
8288 esac
8289
8290 echo "If you don't want the manual sources installed, answer 'none'."
8291 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8292 case "$man3dir" in
8293 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8294         if $test -d "$privlib/man/man3"; then
8295                 cat <<EOM >&4
8296
8297 WARNING:  Previous versions of perl installed man3 pages into
8298 $privlib/man/man3.  This version will suggest a
8299 new default of $dflt.
8300 EOM
8301                 tdflt=$dflt
8302                 dflt='n'
8303                 rp='Do you wish to preserve the old behavior?(y/n)'
8304                 . ./myread
8305                 case "$ans" in
8306                 y*) dflt="$privlib/man/man3" ;;
8307                 *)  dflt=$tdflt ;;
8308                 esac
8309     fi
8310         ;;
8311 *)      dflt="$man3dir" ;;
8312 esac
8313 case "$dflt" in
8314 ' ') dflt=none ;;
8315 esac
8316 echo " "
8317 fn=dn+~
8318 rp="Where do the $package library man pages (source) go?"
8319 . ./getfile
8320 prefixvar=man3dir
8321 . ./setprefixvar
8322
8323 case "$man3dir" in
8324 '')     man3dir=' '
8325         installman3dir='';;
8326 esac
8327
8328 : What suffix to use on installed man pages
8329 case "$man3dir" in
8330 ' ')
8331         man3ext='0'
8332         ;;
8333 *)
8334         rp="What suffix should be used for the $package library man pages?"
8335         case "$man3ext" in
8336         '')     case "$man3dir" in
8337                 *3)  dflt=3 ;;
8338                 *3p) dflt=3p ;;
8339                 *3pm) dflt=3pm ;;
8340                 *l) dflt=l;;
8341                 *n) dflt=n;;
8342                 *o) dflt=o;;
8343                 *p) dflt=p;;
8344                 *C) dflt=C;;
8345                 *L) dflt=L;;
8346                 *L3) dflt=L3;;
8347                 *) dflt=3;;
8348                 esac
8349                 ;;
8350         *)      dflt="$man3ext";;
8351         esac
8352         . ./myread
8353         man3ext="$ans"
8354         ;;
8355 esac
8356
8357 : see if we have to deal with yellow pages, now NIS.
8358 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8359         if $test -f /usr/etc/nibindd; then
8360                 echo " "
8361                 echo "I'm fairly confident you're on a NeXT."
8362                 echo " "
8363                 rp='Do you get the hosts file via NetInfo?'
8364                 dflt=y
8365                 case "$hostcat" in
8366                 nidump*) ;;
8367                 '') ;;
8368                 *) dflt=n;;
8369                 esac
8370                 . ./myread
8371                 case "$ans" in
8372                 y*) hostcat='nidump hosts .';;
8373                 *)      case "$hostcat" in
8374                         nidump*) hostcat='';;
8375                         esac
8376                         ;;
8377                 esac
8378         fi
8379         case "$hostcat" in
8380         nidump*) ;;
8381         *)
8382                 case "$hostcat" in
8383                 *ypcat*) dflt=y;;
8384                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8385                                 dflt=y
8386                         else
8387                                 dflt=n
8388                         fi;;
8389                 *) dflt=n;;
8390                 esac
8391                 echo " "
8392                 rp='Are you getting the hosts file via yellow pages?'
8393                 . ./myread
8394                 case "$ans" in
8395                 y*) hostcat='ypcat hosts';;
8396                 *) hostcat='cat /etc/hosts';;
8397                 esac
8398                 ;;
8399         esac
8400 fi
8401 case "$hostcat" in
8402 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8403 esac
8404 case "$groupcat" in
8405 '') test -f /etc/group && groupcat='cat /etc/group';;
8406 esac
8407 case "$passcat" in
8408 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8409 esac
8410
8411 : now get the host name
8412 echo " "
8413 echo "Figuring out host name..." >&4
8414 case "$myhostname" in
8415 '') cont=true
8416         echo 'Maybe "hostname" will work...'
8417         if tans=`sh -c hostname 2>&1` ; then
8418                 myhostname=$tans
8419                 phostname=hostname
8420                 cont=''
8421         fi
8422         ;;
8423 *) cont='';;
8424 esac
8425 if $test "$cont"; then
8426         if ./xenix; then
8427                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8428                 if tans=`cat /etc/systemid 2>&1` ; then
8429                         myhostname=$tans
8430                         phostname='cat /etc/systemid'
8431                         echo "Whadyaknow.  Xenix always was a bit strange..."
8432                         cont=''
8433                 fi
8434         elif $test -r /etc/systemid; then
8435                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8436         fi
8437 fi
8438 if $test "$cont"; then
8439         echo 'No, maybe "uuname -l" will work...'
8440         if tans=`sh -c 'uuname -l' 2>&1` ; then
8441                 myhostname=$tans
8442                 phostname='uuname -l'
8443         else
8444                 echo 'Strange.  Maybe "uname -n" will work...'
8445                 if tans=`sh -c 'uname -n' 2>&1` ; then
8446                         myhostname=$tans
8447                         phostname='uname -n'
8448                 else
8449                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8450                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8451                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8452                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8453                         else
8454                                 case "$myhostname" in
8455                                 '') echo "Does this machine have an identity crisis or something?"
8456                                         phostname='';;
8457                                 *)
8458                                         echo "Well, you said $myhostname before..."
8459                                         phostname='echo $myhostname';;
8460                                 esac
8461                         fi
8462                 fi
8463         fi
8464 fi
8465 case "$myhostname" in
8466 '') myhostname=noname ;;
8467 esac
8468 : you do not want to know about this
8469 set $myhostname
8470 myhostname=$1
8471
8472 : verify guess
8473 if $test "$myhostname" ; then
8474         dflt=y
8475         rp='Your host name appears to be "'$myhostname'".'" Right?"
8476         . ./myread
8477         case "$ans" in
8478         y*) ;;
8479         *) myhostname='';;
8480         esac
8481 fi
8482
8483 : bad guess or no guess
8484 while $test "X$myhostname" = X ; do
8485         dflt=''
8486         rp="Please type the (one word) name of your host:"
8487         . ./myread
8488         myhostname="$ans"
8489 done
8490
8491 : translate upper to lower if necessary
8492 case "$myhostname" in
8493 *[A-Z]*)
8494         echo "(Normalizing case in your host name)"
8495         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8496         ;;
8497 esac
8498
8499 case "$myhostname" in
8500 *.*)
8501         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8502         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8503         echo "(Trimming domain name from host name--host name is now $myhostname)"
8504         ;;
8505 *) case "$mydomain" in
8506         '')
8507                 {
8508                         test "X$hostcat" = "Xypcat hosts" &&
8509                         ypmatch "$myhostname" hosts 2>/dev/null |\
8510                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8511                         $test -s hosts
8512                 } || {
8513                         test "X$hostcat" != "X" &&
8514                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8515                                         /[       ]$myhostname[  . ]/p" > hosts
8516                 }
8517                 tmp_re="[       . ]"
8518                 if $test -f hosts; then
8519                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8520                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8521                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8522                                 hosts | $sort | $uniq | \
8523                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8524                         case `$echo X$dflt` in
8525                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8526                                 dflt=.
8527                                 ;;
8528                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8529                                 ;;
8530                         esac
8531                 else
8532                         echo "(I cannot locate a hosts database anywhere)"
8533                         dflt=.
8534                 fi
8535                 case "$dflt" in
8536                 .)
8537                         tans=`./loc resolv.conf X /etc /usr/etc`
8538                         if $test -f "$tans"; then
8539                                 echo "(Attempting domain name extraction from $tans)"
8540                                 dflt=.`$sed -n -e 's/   / /g' \
8541                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8542                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8543                                 case "$dflt" in
8544                                 .) dflt=.`$sed -n -e 's/        / /g' \
8545                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8546                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8547                                         ;;
8548                                 esac
8549                         fi
8550                         ;;
8551                 esac
8552                 case "$dflt" in
8553                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8554                         dflt=.`sh -c domainname 2>/dev/null`
8555                         case "$dflt" in
8556                         '') dflt='.';;
8557                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8558                         esac
8559                         ;;
8560                 esac
8561                 case "$dflt$osname" in
8562                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8563                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8564                         ;;
8565                 esac
8566                 case "$dflt" in
8567                 .) echo "(Lost all hope -- silly guess then)"
8568                         dflt='.nonet'
8569                         ;;
8570                 esac
8571                 $rm -f hosts
8572                 ;;
8573         *) dflt="$mydomain";;
8574         esac;;
8575 esac
8576 echo " "
8577 rp="What is your domain name?"
8578 . ./myread
8579 tans="$ans"
8580 case "$ans" in
8581 '') ;;
8582 .*) ;;
8583 *) tans=".$tans";;
8584 esac
8585 mydomain="$tans"
8586
8587 : translate upper to lower if necessary
8588 case "$mydomain" in
8589 *[A-Z]*)
8590         echo "(Normalizing case in your domain name)"
8591         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8592         ;;
8593 esac
8594
8595 : a little sanity check here
8596 case "$phostname" in
8597 '') ;;
8598 *)
8599         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8600         $myhostname$mydomain|$myhostname) ;;
8601         *)
8602                 case "$phostname" in
8603                 sed*)
8604                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8605                         ;;
8606                 *)
8607                         echo "(That doesn't agree with your $phostname command, by the way.)"
8608                         ;;
8609                 esac
8610         ;;
8611         esac
8612         ;;
8613 esac
8614
8615 $cat <<EOM
8616
8617 I need to get your e-mail address in Internet format if possible, i.e.
8618 something like user@host.domain. Please answer accurately since I have
8619 no easy means to double check it. The default value provided below
8620 is most probably close to reality but may not be valid from outside
8621 your organization...
8622
8623 EOM
8624 cont=x
8625 while test "$cont"; do
8626         case "$cf_email" in
8627         '') dflt="$cf_by@$myhostname$mydomain";;
8628         *) dflt="$cf_email";;
8629         esac
8630         rp='What is your e-mail address?'
8631         . ./myread
8632         cf_email="$ans"
8633         case "$cf_email" in
8634         *@*.*) cont='' ;;
8635         *)
8636                 rp='Address does not look like an Internet one.  Use it anyway?'
8637                 case "$fastread" in
8638                 yes) dflt=y ;;
8639                 *) dflt=n ;;
8640                 esac
8641                 . ./myread
8642                 case "$ans" in
8643                 y*) cont='' ;;
8644                 *) echo " " ;;
8645                 esac
8646                 ;;
8647         esac
8648 done
8649
8650 $cat <<EOM
8651
8652 If you or somebody else will be maintaining perl at your site, please
8653 fill in the correct e-mail address here so that they may be contacted
8654 if necessary. Currently, the "perlbug" program included with perl
8655 will send mail to this address in addition to perlbug@perl.org. You may
8656 enter "none" for no administrator.
8657
8658 EOM
8659 case "$perladmin" in
8660 '') dflt="$cf_email";;
8661 *) dflt="$perladmin";;
8662 esac
8663 rp='Perl administrator e-mail address'
8664 . ./myread
8665 perladmin="$ans"
8666
8667 : determine whether to only install version-specific parts.
8668 echo " "
8669 $cat <<EOM
8670 Do you want to install only the version-specific parts of the perl
8671 distribution?  Usually you do *not* want to do this.
8672 EOM
8673 case "$versiononly" in
8674 "$define"|[Yy]*|true) dflt='y' ;;
8675 *) dflt='n';
8676 esac
8677 rp="Do you want to install only the version-specific parts of perl?"
8678 . ./myread
8679 case "$ans" in
8680 [yY]*)  val="$define";;
8681 *)      val="$undef" ;;
8682 esac
8683 set versiononly
8684 eval $setvar
8685
8686 case "$versiononly" in
8687 "$define") inc_version_list=''
8688            inc_version_list_init=0
8689            ;;
8690 esac
8691
8692 : figure out how to guarantee perl startup
8693 : XXX Note that this currently takes advantage of the bug that binexp ignores
8694 :     the Configure -Dinstallprefix setting, which in turn means that under
8695 :     relocatable @INC, initialinstalllocation is what binexp started as.
8696 case "$startperl" in
8697 '')
8698         case "$sharpbang" in
8699         *!)
8700                 $cat <<EOH
8701
8702 I can use the #! construct to start perl on your system. This will
8703 make startup of perl scripts faster, but may cause problems if you
8704 want to share those scripts and perl is not in a standard place
8705 ($initialinstalllocation/perl) on all your platforms. The alternative
8706 is to force a shell by starting the script with a single ':' character.
8707
8708 EOH
8709                 case "$versiononly" in
8710                 "$define")      dflt="$initialinstalllocation/perl$version";;
8711                 *)              dflt="$initialinstalllocation/perl";;
8712                 esac
8713                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8714                 . ./myread
8715                 case "$ans" in
8716                 none)   startperl=": # use perl";;
8717                 *)      startperl="#!$ans"
8718                         if $test 30 -lt `echo "$ans" | wc -c`; then
8719                                 $cat >&4 <<EOM
8720
8721 WARNING:  Some systems limit the #! command to 32 characters.
8722 If you experience difficulty running Perl scripts with #!, try
8723 installing Perl in a directory with a shorter pathname.
8724
8725 EOM
8726                         fi ;;
8727                 esac
8728                 ;;
8729         *) startperl=": # use perl"
8730                 ;;
8731         esac
8732         ;;
8733 esac
8734 echo "I'll use $startperl to start perl scripts."
8735
8736 : figure best path for perl in scripts
8737 case "$perlpath" in
8738 '')
8739         case "$versiononly" in
8740         "$define")      perlpath="$initialinstalllocation/perl$version";;
8741         *)              perlpath="$initialinstalllocation/perl";;
8742         esac
8743         case "$startperl" in
8744         *!*) ;;
8745         *)
8746                 $cat <<EOH
8747
8748 I will use the "eval 'exec'" idiom to start Perl on your system.
8749 I can use the full path of your Perl binary for this purpose, but
8750 doing so may cause problems if you want to share those scripts and
8751 Perl is not always in a standard place ($initialinstalllocation/perl).
8752
8753 EOH
8754                 dflt="$initialinstalllocation/perl"
8755                 rp="What path shall I use in \"eval 'exec'\"?"
8756                 . ./myread
8757                 perlpath="$ans"
8758                 ;;
8759         esac
8760         ;;
8761 esac
8762 case "$startperl" in
8763 *!*)    ;;
8764 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8765 esac
8766
8767 : determine where public executable scripts go
8768 set scriptdir scriptdir
8769 eval $prefixit
8770 case "$scriptdir" in
8771 '')
8772         dflt="$bin"
8773         : guess some guesses
8774         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8775         $test -d /usr/share/bin     && dflt=/usr/share/bin
8776         $test -d /usr/local/script  && dflt=/usr/local/script
8777         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8778         $test -d $prefixexp/script  && dflt=$prefixexp/script
8779         set dflt
8780         eval $prefixup
8781         ;;
8782 *)  dflt="$scriptdir"
8783         ;;
8784 esac
8785 $cat <<EOM
8786
8787 Some installations have a separate directory just for executable scripts so
8788 that they can mount it across multiple architectures but keep the scripts in
8789 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8790 Or you might just lump your scripts in with all your other executables.
8791
8792 EOM
8793 fn=d~
8794 rp='Where do you keep publicly executable scripts?'
8795 . ./getfile
8796 if $test "X$ansexp" != "X$scriptdirexp"; then
8797         installscript=''
8798 fi
8799 installscriptdir=''
8800 prefixvar=scriptdir
8801 . ./setprefixvar
8802 : A little fix up for an irregularly named variable.
8803 installscript="$installscriptdir"
8804
8805 : determine where add-on public executables go
8806 case "$sitebin" in
8807 '')     dflt=$siteprefix/bin ;;
8808 *)      dflt=$sitebin ;;
8809 esac
8810 fn=d~
8811 rp='Pathname where the add-on public executables should be installed?'
8812 . ./getfile
8813 prefixvar=sitebin
8814 . ./setprefixvar
8815
8816 : determine where add-on html pages go
8817 : There is no standard location, so try to copy the previously-selected
8818 : directory structure for the core html pages.
8819 case "$sitehtml1dir" in
8820 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8821 *)     dflt=$sitehtml1dir ;;
8822 esac
8823 case "$dflt" in
8824 ''|' ') dflt=none ;;
8825 esac
8826 fn=dn+~
8827 rp='Pathname where the site-specific html pages should be installed?'
8828 . ./getfile
8829 prefixvar=sitehtml1dir
8830 . ./setprefixvar
8831
8832 : determine where add-on library html pages go
8833 : There is no standard location, so try to copy the previously-selected
8834 : directory structure for the core html pages.
8835 case "$sitehtml3dir" in
8836 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8837 *)     dflt=$sitehtml3dir ;;
8838 esac
8839 case "$dflt" in
8840 ''|' ') dflt=none ;;
8841 esac
8842 fn=dn+~
8843 rp='Pathname where the site-specific library html pages should be installed?'
8844 . ./getfile
8845 prefixvar=sitehtml3dir
8846 . ./setprefixvar
8847
8848 : determine where add-on manual pages go
8849 case "$siteman1dir" in
8850 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8851 *)      dflt=$siteman1dir ;;
8852 esac
8853 case "$dflt" in
8854 ''|' ') dflt=none ;;
8855 esac
8856 fn=dn+~
8857 rp='Pathname where the site-specific manual pages should be installed?'
8858 . ./getfile
8859 prefixvar=siteman1dir
8860 . ./setprefixvar
8861
8862 : determine where add-on library man pages go
8863 case "$siteman3dir" in
8864 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8865 *)      dflt=$siteman3dir ;;
8866 esac
8867 case "$dflt" in
8868 ''|' ') dflt=none ;;
8869 esac
8870 fn=dn+~
8871 rp='Pathname where the site-specific library manual pages should be installed?'
8872 . ./getfile
8873 prefixvar=siteman3dir
8874 . ./setprefixvar
8875
8876 : determine where add-on public executable scripts go
8877 case "$sitescript" in
8878 '')     dflt=$siteprefix/script
8879         $test -d $dflt || dflt=$sitebin ;;
8880 *)  dflt="$sitescript" ;;
8881 esac
8882 fn=d~+
8883 rp='Pathname where add-on public executable scripts should be installed?'
8884 . ./getfile
8885 prefixvar=sitescript
8886 . ./setprefixvar
8887
8888 case "$usefaststdio" in
8889 $define|true|[yY]*|'')
8890         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8891         case "$xversion" in
8892         [68])   dflt='y' ;;
8893         *)      dflt='n' ;;
8894         esac
8895         ;;
8896 *) dflt='n';;
8897 esac
8898 cat <<EOM
8899
8900 Perl can be built to use 'fast stdio', which means using the stdio
8901 library but also directly manipulating the stdio buffers to enable
8902 faster I/O.  Using stdio is better for backward compatibility (especially
8903 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8904 interface has been preferred instead of stdio.
8905
8906 If this doesn't make any sense to you, just accept the default '$dflt'.
8907 EOM
8908 rp='Use the "fast stdio" if available?'
8909 . ./myread
8910 case "$ans" in
8911 y|Y)    val="$define" ;;     
8912 *)      val="$undef" ;;
8913 esac
8914 set usefaststdio
8915 eval $setvar
8916
8917
8918 : define an is-a-typedef? function
8919 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8920 case "$inclist" in
8921 "") inclist="sys/types.h";;
8922 esac;
8923 eval "varval=\$$var";
8924 case "$varval" in
8925 "")
8926         $rm -f temp.c;
8927         for inc in $inclist; do
8928                 echo "#include <$inc>" >>temp.c;
8929         done;
8930         echo "#ifdef $type" >> temp.c;
8931         echo "printf(\"We have $type\");" >> temp.c;
8932         echo "#endif" >> temp.c;
8933         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8934         if $contains $type temp.E >/dev/null 2>&1; then
8935                 eval "$var=\$type";
8936         else
8937                 eval "$var=\$def";
8938         fi;
8939         $rm -f temp.?;;
8940 *) eval "$var=\$varval";;
8941 esac'
8942
8943 : define an is-a-typedef? function that prompts if the type is not available.
8944 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8945 case "$inclist" in
8946 "") inclist="sys/types.h";;
8947 esac;
8948 eval "varval=\$$var";
8949 case "$varval" in
8950 "")
8951         $rm -f temp.c;
8952         for inc in $inclist; do
8953                 echo "#include <$inc>" >>temp.c;
8954         done;
8955         echo "#ifdef $type" >> temp.c;
8956         echo "printf(\"We have $type\");" >> temp.c;
8957         echo "#endif" >> temp.c;
8958         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8959         echo " " ;
8960         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8961         if $contains $type temp.E >/dev/null 2>&1; then
8962                 echo "$type found." >&4;
8963                 eval "$var=\$type";
8964         else
8965                 echo "$type NOT found." >&4;
8966                 dflt="$def";
8967                 . ./myread ;
8968                 eval "$var=\$ans";
8969         fi;
8970         $rm -f temp.?;;
8971 *) eval "$var=\$varval";;
8972 esac'
8973
8974 : see what type lseek is declared as in the kernel
8975 rp="What is the type used for lseek's offset on this system?"
8976 set off_t lseektype long stdio.h sys/types.h
8977 eval $typedef_ask
8978
8979 echo " "
8980 echo "Checking to see how big your file offsets are..." >&4
8981 $cat >try.c <<EOCP
8982 #include <sys/types.h>
8983 #include <stdio.h>
8984 int main()
8985 {
8986     printf("%d\n", (int)sizeof($lseektype));
8987     return(0);
8988 }
8989 EOCP
8990 set try
8991 if eval $compile_ok; then
8992         lseeksize=`$run ./try`
8993         echo "Your file offsets are $lseeksize bytes long."
8994 else
8995         dflt=$longsize
8996         echo " "
8997         echo "(I can't seem to compile the test program.  Guessing...)"
8998         rp="What is the size of your file offsets (in bytes)?"
8999         . ./myread
9000         lseeksize="$ans"
9001 fi
9002 $rm_try
9003
9004 : see what type file positions are declared as in the library
9005 rp="What is the type for file position used by fsetpos()?"
9006 set fpos_t fpostype long stdio.h sys/types.h
9007 eval $typedef_ask
9008
9009 echo " "
9010 case "$fpostype" in
9011 *_t) zzz="$fpostype"    ;;
9012 *)   zzz="fpos_t"       ;;
9013 esac
9014 echo "Checking the size of $zzz..." >&4 
9015 cat > try.c <<EOCP
9016 #include <sys/types.h>
9017 #include <stdio.h>
9018 #$i_stdlib I_STDLIB
9019 #ifdef I_STDLIB
9020 #include <stdlib.h>
9021 #endif
9022 int main() {
9023     printf("%d\n", (int)sizeof($fpostype));
9024     exit(0);
9025 }
9026 EOCP
9027 set try
9028 if eval $compile_ok; then
9029         yyy=`$run ./try`
9030         case "$yyy" in
9031         '')     fpossize=4
9032                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9033                 ;;
9034         *)      fpossize=$yyy
9035                 echo "Your $zzz is $fpossize bytes long."
9036                 ;;
9037         esac
9038 else
9039         dflt="$longsize"
9040         echo " " >&4
9041         echo "(I can't compile the test program.  Guessing...)" >&4
9042         rp="What is the size of your file positions (in bytes)?"
9043         . ./myread
9044         fpossize="$ans"
9045 fi
9046
9047 # Backward compatibility (uselfs is deprecated).
9048 case "$uselfs" in
9049 "$define"|true|[yY]*)
9050         cat <<EOM >&4
9051
9052 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9053 EOM
9054         uselargefiles="$define"
9055         ;;
9056 esac
9057
9058 case "$lseeksize:$fpossize" in
9059 8:8) cat <<EOM
9060
9061 You can have files larger than 2 gigabytes.
9062 EOM
9063    val="$define" ;;
9064 *)    case "$uselargefiles" in
9065    "$undef"|false|[nN]*) dflt='n' ;;
9066    *)   dflt='y' ;;
9067    esac
9068    cat <<EOM
9069
9070 Perl can be built to understand large files (files larger than 2 gigabytes)
9071 on some systems.  To do so, Configure can be run with -Duselargefiles.
9072
9073 If this doesn't make any sense to you, just accept the default '$dflt'.
9074 EOM
9075    rp='Try to understand large files, if available?'
9076    . ./myread
9077    case "$ans" in
9078    y|Y)         val="$define" ;;
9079    *)           val="$undef"  ;;
9080    esac
9081    ;;
9082 esac
9083 set uselargefiles
9084 eval $setvar
9085 : Look for a hint-file generated 'call-back-unit'.  If the
9086 : user has specified that a large files perl is to be built,
9087 : we may need to set or change some other defaults.
9088 if $test -f uselargefiles.cbu; then
9089         echo "Your platform has some specific hints regarding large file builds, using them..."
9090         . ./uselargefiles.cbu
9091 fi
9092 case "$uselargefiles" in
9093 "$define")
9094         if $test -f uselargefiles.cbu; then
9095                 echo " "
9096                 echo "Rechecking to see how big your file offsets are..." >&4
9097                 $cat >try.c <<EOCP
9098 #include <sys/types.h>
9099 #include <stdio.h>
9100 int main()
9101 {
9102     printf("%d\n", (int)sizeof($lseektype));
9103     return(0);
9104 }
9105 EOCP
9106                 set try
9107                 if eval $compile_ok; then
9108                         lseeksize=`$run ./try`
9109                         $echo "Your file offsets are now $lseeksize bytes long."
9110                 else
9111                         dflt="$lseeksize"
9112                         echo " "
9113                         echo "(I can't seem to compile the test program.  Guessing...)"
9114                         rp="What is the size of your file offsets (in bytes)?"
9115                         . ./myread
9116                         lseeksize="$ans"
9117                 fi
9118                 case "$fpostype" in
9119                 *_t) zzz="$fpostype"    ;;
9120                 *)   zzz="fpos_t"       ;;
9121                 esac
9122                 $echo $n "Rechecking the size of $zzz...$c" >&4
9123                 $cat > try.c <<EOCP
9124 #include <sys/types.h>
9125 #include <stdio.h>
9126 #$i_stdlib I_STDLIB
9127 #ifdef I_STDLIB
9128 #include <stdlib.h>
9129 #endif
9130 int main() {
9131     printf("%d\n", (int)sizeof($fpostype));
9132     return(0);
9133 }
9134 EOCP
9135                 set try
9136                 if eval $compile_ok; then
9137                         yyy=`$run ./try`
9138                         dflt="$lseeksize"
9139                         case "$yyy" in
9140                         '')     echo " "
9141                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9142                                 ;;
9143                         *)      fpossize=$yyy
9144                                 echo " $fpossize bytes." >&4
9145                                 ;;
9146                         esac
9147                 else
9148                         dflt="$fpossize"
9149                         echo " "
9150                         echo "(I can't compile the test program.  Guessing...)" >&4
9151                         rp="What is the size of your file positions (in bytes)?"
9152                         . ./myread
9153                         fpossize="$ans"
9154                 fi
9155                 $rm_try
9156         fi
9157         ;;
9158 esac
9159
9160 case "$vendorprefix" in
9161 '')     d_vendorbin="$undef"
9162         vendorbin=''
9163         vendorbinexp=''
9164         ;;
9165 *)      d_vendorbin="$define"
9166         : determine where vendor-supplied executables go.
9167         case "$vendorbin" in
9168         '') dflt=$vendorprefix/bin ;;
9169         *)      dflt="$vendorbin" ;;
9170         esac
9171         fn=d~+
9172         rp='Pathname for the vendor-supplied executables directory?'
9173         . ./getfile
9174         vendorbin="$ans"
9175         vendorbinexp="$ansexp"
9176         ;;
9177 esac
9178 prefixvar=vendorbin
9179 . ./installprefix
9180
9181 case "$vendorprefix" in
9182 '')     vendorhtml1dir=''
9183         vendorhtml1direxp=''
9184         ;;
9185 *)      : determine where vendor-supplied html pages go.
9186         : There is no standard location, so try to copy the previously-selected
9187         : directory structure for the core html pages.
9188         : XXX Better default suggestions would be welcome.
9189         case "$vendorhtml1dir" in
9190         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9191         *)      dflt=$vendorhtml1dir ;;
9192         esac
9193         case "$dflt" in
9194         ''|' ') dflt=none ;;
9195         esac
9196         fn=dn+~
9197         rp='Pathname for the vendor-supplied html pages?'
9198         . ./getfile
9199         vendorhtml1dir="$ans"
9200         vendorhtml1direxp="$ansexp"
9201         ;;
9202 esac
9203 : Use ' ' for none so value is preserved next time through Configure
9204 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9205 prefixvar=vendorhtml1dir
9206 . ./installprefix
9207
9208 case "$vendorprefix" in
9209 '')     vendorhtml3dir=''
9210         vendorhtml3direxp=''
9211         ;;
9212 *)      : determine where vendor-supplied module html pages go.
9213         : There is no standard location, so try to copy the previously-selected
9214         : directory structure for the core html pages.
9215         : XXX Better default suggestions would be welcome.
9216         case "$vendorhtml3dir" in
9217         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9218         *)      dflt=$vendorhtml3dir ;;
9219         esac
9220         case "$dflt" in
9221         ''|' ') dflt=none ;;
9222         esac
9223         fn=dn+~
9224         rp='Pathname for the vendor-supplied html pages?'
9225         . ./getfile
9226         vendorhtml3dir="$ans"
9227         vendorhtml3direxp="$ansexp"
9228         ;;
9229 esac
9230 : Use ' ' for none so value is preserved next time through Configure
9231 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9232 prefixvar=vendorhtml3dir
9233 . ./installprefix
9234
9235 case "$vendorprefix" in
9236 '')     vendorman1dir=''
9237         vendorman1direxp=''
9238         ;;
9239 *)      : determine where vendor-supplied manual pages go.
9240         case "$vendorman1dir" in
9241         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9242         *)      dflt=$vendorman1dir ;;
9243         esac
9244         case "$dflt" in
9245         ''|' ') dflt=none ;;
9246         esac
9247         fn=nd~+
9248         rp='Pathname for the vendor-supplied manual section 1 pages?'
9249         . ./getfile
9250         vendorman1dir="$ans"
9251         vendorman1direxp="$ansexp"
9252         ;;
9253 esac
9254 : Use ' ' for none so value is preserved next time through Configure
9255 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9256 prefixvar=vendorman1dir
9257 . ./installprefix
9258
9259 case "$vendorprefix" in
9260 '')     vendorman3dir=''
9261         vendorman3direxp=''
9262         ;;
9263 *)      : determine where vendor-supplied module manual pages go.
9264         case "$vendorman3dir" in
9265         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9266         *)      dflt=$vendorman3dir ;;
9267         esac
9268         case "$dflt" in
9269         ''|' ') dflt=none ;;
9270         esac
9271         fn=nd~+
9272         rp='Pathname for the vendor-supplied manual section 3 pages?'
9273         . ./getfile
9274         vendorman3dir="$ans"
9275         vendorman3direxp="$ansexp"
9276         ;;
9277 esac
9278 : Use ' ' for none so value is preserved next time through Configure
9279 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9280 prefixvar=vendorman3dir
9281 . ./installprefix
9282
9283 case "$vendorprefix" in
9284 '')     d_vendorscript="$undef"
9285         vendorscript=''
9286         vendorscriptexp=''
9287         ;;
9288 *)      d_vendorscript="$define"
9289         : determine where vendor-supplied scripts go.
9290         case "$vendorscript" in
9291         '')     dflt=$vendorprefix/script
9292                 $test -d $dflt || dflt=$vendorbin ;;
9293         *)  dflt="$vendorscript" ;;
9294         esac
9295         $cat <<EOM
9296
9297 The installation process will create a directory for
9298 vendor-supplied scripts.
9299
9300 EOM
9301         fn=d~+
9302         rp='Pathname for the vendor-supplied scripts directory?'
9303         . ./getfile
9304         vendorscript="$ans"
9305         vendorscriptexp="$ansexp"
9306         ;;
9307 esac
9308 prefixvar=vendorscript
9309 . ./installprefix
9310
9311 : see if qgcvt exists
9312 set qgcvt d_qgcvt
9313 eval $inlibc
9314
9315 echo " "
9316
9317 if $test X"$d_longdbl" = X"$define"; then
9318
9319 echo "Checking how to print long doubles..." >&4
9320
9321 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9322         $cat >try.c <<'EOCP'
9323 #include <sys/types.h>
9324 #include <stdio.h>
9325 int main() {
9326   double d = 123.456;
9327   printf("%.3f\n", d);
9328 }
9329 EOCP
9330         set try
9331         if eval $compile; then
9332                 yyy=`$run ./try`
9333                 case "$yyy" in
9334                 123.456)
9335                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9336                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9337                         echo "We will use %f."
9338                         ;;
9339                 esac
9340         fi
9341 fi
9342
9343 if $test X"$sPRIfldbl" = X; then
9344         $cat >try.c <<'EOCP'
9345 #include <sys/types.h>
9346 #include <stdio.h>
9347 int main() {
9348   long double d = 123.456;
9349   printf("%.3Lf\n", d);
9350 }
9351 EOCP
9352         set try
9353         if eval $compile; then
9354                 yyy=`$run ./try`
9355                 case "$yyy" in
9356                 123.456)
9357                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9358                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9359                         echo "We will use %Lf."
9360                         ;;
9361                 esac
9362         fi
9363 fi
9364
9365 if $test X"$sPRIfldbl" = X; then
9366         $cat >try.c <<'EOCP'
9367 #include <sys/types.h>
9368 #include <stdio.h>
9369 int main() {
9370   long double d = 123.456;
9371   printf("%.3llf\n", d);
9372 }
9373 EOCP
9374         set try
9375         if eval $compile; then
9376                 yyy=`$run ./try`
9377                 case "$yyy" in
9378                 123.456)
9379                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9380                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9381                         echo "We will use %llf."
9382                         ;;
9383                 esac
9384         fi
9385 fi
9386
9387 if $test X"$sPRIfldbl" = X; then
9388         $cat >try.c <<'EOCP'
9389 #include <sys/types.h>
9390 #include <stdio.h>
9391 int main() {
9392   long double d = 123.456;
9393   printf("%.3lf\n", d);
9394 }
9395 EOCP
9396         set try
9397         if eval $compile; then
9398                 yyy=`$run ./try`
9399                 case "$yyy" in
9400                 123.456)
9401                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9402                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9403                         echo "We will use %lf."
9404                         ;;
9405                 esac
9406         fi
9407 fi
9408
9409 if $test X"$sPRIfldbl" = X; then
9410         echo "Cannot figure out how to print long doubles." >&4
9411 else
9412         sSCNfldbl=$sPRIfldbl    # expect consistency
9413 fi
9414
9415 $rm_try
9416
9417 fi # d_longdbl
9418
9419 case "$sPRIfldbl" in
9420 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
9421         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
9422         d_SCNfldbl="$undef";
9423         ;;
9424 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
9425         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
9426         d_SCNfldbl="$define";
9427         ;;
9428 esac
9429
9430 : Check how to convert floats to strings.
9431
9432 if test "X$d_Gconvert" = X; then
9433
9434 echo " "
9435 echo "Checking for an efficient way to convert floats to strings."
9436 echo " " > try.c
9437 case "$uselongdouble" in
9438 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9439 esac
9440 case "$d_longdbl" in
9441 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9442 esac
9443 case "$d_PRIgldbl" in
9444 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9445 esac
9446 $cat >>try.c <<EOP
9447 #ifdef TRY_gconvert
9448 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9449 char *myname = "gconvert";
9450 #endif
9451 #ifdef TRY_gcvt
9452 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9453 char *myname = "gcvt";
9454 #endif
9455 #ifdef TRY_qgcvt
9456 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9457 char *myname = "qgcvt";
9458 #define DOUBLETYPE long double
9459 #endif
9460 #ifdef TRY_sprintf
9461 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9462 #ifdef HAS_PRIgldbl
9463 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9464 #else
9465 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9466 #endif
9467 #else
9468 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9469 #endif
9470 char *myname = "sprintf";
9471 #endif
9472
9473 #ifndef DOUBLETYPE
9474 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9475 #define DOUBLETYPE long double
9476 #else
9477 #define DOUBLETYPE double
9478 #endif
9479 #endif
9480
9481 #include <stdio.h>
9482
9483 #define I_STDLIB $i_stdlib
9484 #ifdef I_STDLIB
9485 #include <stdlib.h>
9486 #endif
9487
9488 int
9489 checkit(expect, got)
9490 char *expect;
9491 char *got;
9492 {
9493     if (strcmp(expect, got)) {
9494                 printf("%s oddity:  Expected %s, got %s\n",
9495                         myname, expect, got);
9496                 exit(1);
9497         }
9498 }
9499
9500 int main()
9501 {
9502         char buf[64];
9503         buf[63] = '\0';
9504
9505         /* This must be 1st test on (which?) platform */
9506         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9507         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9508         checkit("0.1", buf);
9509
9510         Gconvert((DOUBLETYPE)0.01, 8, 0, buf);
9511         checkit("0.01", buf);
9512
9513         Gconvert((DOUBLETYPE)0.001, 8, 0, buf);
9514         checkit("0.001", buf);
9515
9516         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf);
9517         checkit("0.0001", buf);
9518
9519         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9520         if (strlen(buf) > 5)
9521             checkit("9e-005", buf); /* for Microsoft ?? */
9522         else
9523             checkit("9e-05", buf);
9524
9525         Gconvert((DOUBLETYPE)1.0, 8, 0, buf);
9526         checkit("1", buf);
9527
9528         Gconvert((DOUBLETYPE)1.1, 8, 0, buf);
9529         checkit("1.1", buf);
9530
9531         Gconvert((DOUBLETYPE)1.01, 8, 0, buf);
9532         checkit("1.01", buf);
9533
9534         Gconvert((DOUBLETYPE)1.001, 8, 0, buf);
9535         checkit("1.001", buf);
9536
9537         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf);
9538         checkit("1.0001", buf);
9539
9540         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf);
9541         checkit("1.00001", buf);
9542
9543         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf);
9544         checkit("1.000001", buf);
9545
9546         Gconvert((DOUBLETYPE)0.0, 8, 0, buf);
9547         checkit("0", buf);
9548
9549         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf);
9550         checkit("-1", buf);
9551
9552         /* Some Linux gcvt's give 1.e+5 here. */
9553         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf);
9554         checkit("100000", buf);
9555
9556         /* Some Linux gcvt's give -1.e+5 here. */
9557         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf);
9558         checkit("-100000", buf);
9559
9560         Gconvert((DOUBLETYPE)123.456, 8, 0, buf);
9561         checkit("123.456", buf);
9562
9563         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9564         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9565         /* 34 should be enough to scare even long double
9566          * places into using the e notation. */
9567         if (strlen(buf) > 5)
9568             checkit("1e+034", buf); /* for Microsoft */
9569         else
9570             checkit("1e+34", buf);
9571
9572         /* For Perl, if you add additional tests here, also add them to
9573          * t/base/num.t for benefit of platforms not using Configure or
9574          * overriding d_Gconvert */
9575
9576         exit(0);
9577 }
9578 EOP
9579 : first add preferred functions to our list
9580 xxx_list=""
9581 for xxx_convert in $gconvert_preference; do
9582     case $xxx_convert in
9583     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9584     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9585     esac
9586 done
9587 : then add any others
9588 for xxx_convert in gconvert gcvt sprintf; do
9589     case "$xxx_list" in
9590     *$xxx_convert*) ;;
9591     *) xxx_list="$xxx_list $xxx_convert" ;;
9592     esac
9593 done
9594
9595 case "$d_longdbl$uselongdouble" in
9596 "$define$define")
9597     : again, add prefered functions to our list first
9598     xxx_ld_list=""
9599     for xxx_convert in $gconvert_ld_preference; do
9600         case $xxx_convert in
9601         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9602         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9603         esac
9604     done
9605     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9606     for xxx_convert in qgcvt sprintf $xxx_list; do
9607         case "$xxx_ld_list" in
9608         $xxx_convert*|*" $xxx_convert"*) ;;
9609         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9610         esac
9611     done
9612     : if sprintf cannot do long doubles, move it to the end
9613     if test "$d_PRIgldbl" != "$define"; then
9614         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9615     fi
9616     : if no qgcvt, remove it
9617     if test "$d_qgcvt" != "$define"; then
9618         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9619     fi
9620     : use the ld_list
9621     xxx_list="$xxx_ld_list"
9622     ;;
9623 esac
9624
9625 for xxx_convert in $xxx_list; do
9626         echo "Trying $xxx_convert..."
9627         $rm -f try try$_o core
9628         set try -DTRY_$xxx_convert
9629         if eval $compile; then
9630                 echo "$xxx_convert() found." >&4
9631                 if $run ./try; then
9632                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9633                         break;
9634                 else
9635                         echo "...But $xxx_convert didn't work as I expected."
9636                         xxx_convert=''
9637                 fi
9638         else
9639                 echo "$xxx_convert NOT found." >&4
9640         fi
9641 done
9642
9643 if test X$xxx_convert = X; then
9644     echo "*** WHOA THERE!!! ***" >&4
9645     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9646     xxx_convert=sprintf
9647 fi
9648
9649 case "$xxx_convert" in
9650 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9651 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9652 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9653 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9654    "$define$define$define")
9655       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9656    "$define$define$undef")
9657       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9658    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9659    esac
9660    ;;
9661 esac
9662
9663 fi
9664 $rm_try
9665
9666 : see if _fwalk exists
9667 set fwalk d__fwalk
9668 eval $inlibc
9669
9670 : Initialize h_fcntl
9671 h_fcntl=false
9672
9673 : Initialize h_sysfile
9674 h_sysfile=false
9675
9676 : access call always available on UNIX
9677 set access d_access
9678 eval $inlibc
9679
9680 : locate the flags for 'access()'
9681 case "$d_access" in
9682 "$define")
9683         echo " "
9684         $cat >access.c <<EOCP
9685 #include <sys/types.h>
9686 #ifdef I_FCNTL
9687 #include <fcntl.h>
9688 #endif
9689 #ifdef I_SYS_FILE
9690 #include <sys/file.h>
9691 #endif
9692 #ifdef I_UNISTD
9693 #include <unistd.h>
9694 #endif
9695 #$i_stdlib I_STDLIB
9696 #ifdef I_STDLIB
9697 #include <stdlib.h>
9698 #endif
9699 int main() {
9700         exit(R_OK);
9701 }
9702 EOCP
9703         : check sys/file.h first, no particular reason here
9704         if $test `./findhdr sys/file.h` && \
9705                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9706                 h_sysfile=true;
9707                 echo "<sys/file.h> defines the *_OK access constants." >&4
9708         elif $test `./findhdr fcntl.h` && \
9709                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9710                 h_fcntl=true;
9711                 echo "<fcntl.h> defines the *_OK access constants." >&4
9712         elif $test `./findhdr unistd.h` && \
9713                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9714                 echo "<unistd.h> defines the *_OK access constants." >&4
9715         else
9716                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9717         fi
9718         ;;
9719 esac
9720 $rm -f access*
9721
9722 : see if accessx exists
9723 set accessx d_accessx
9724 eval $inlibc
9725
9726 : see if aintl exists
9727 set aintl d_aintl
9728 eval $inlibc
9729
9730 : see if alarm exists
9731 set alarm d_alarm
9732 eval $inlibc
9733
9734 : see if POSIX threads are available
9735 set pthread.h i_pthread
9736 eval $inhdr
9737
9738 : define a fucntion to check prototypes
9739 $cat > protochk <<EOSH
9740 $startsh
9741 cc="$cc"
9742 optimize="$optimize"
9743 ccflags="$ccflags"
9744 prototype="$prototype"
9745 define="$define"
9746 rm_try="$rm_try"
9747 usethreads=$usethreads
9748 i_pthread=$i_pthread
9749 pthread_h_first=$pthread_h_first
9750 EOSH
9751
9752 $cat >> protochk <<'EOSH'
9753
9754 $rm_try
9755 foo="$1"
9756 shift
9757 while test $# -ge 2; do
9758         case "$1" in
9759                 $define) echo "#include <$2>" >> try.c ;;
9760                 literal) echo "$2" >> try.c ;;
9761         esac
9762     # Extra magic for the benefit of systems that need pthread.h
9763     # to be included early to correctly detect threadsafe functions.
9764     # Such functions must guarantee themselves, though, that the usethreads
9765     # and i_pthread have been defined, before calling protochk.
9766     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9767         echo "#include <pthread.h>" >> try.c
9768         pthread_h_done=yes
9769     fi
9770     shift 2
9771 done
9772 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9773 cat >> try.c <<'EOCP'
9774 #ifdef CAN_PROTOTYPE
9775 #define _(args) args
9776 #else
9777 #define _(args) ()
9778 #endif
9779 EOCP
9780 echo "$foo" >> try.c
9781 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9782 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9783 status=$?
9784 $rm_try
9785 exit $status
9786 EOSH
9787 chmod +x protochk
9788 $eunicefix protochk
9789
9790 hasproto='varname=$1; func=$2; shift; shift;
9791 while $test $# -ge 2; do
9792         case "$1" in
9793         $define) echo "#include <$2>";;
9794         esac ;
9795     shift 2;
9796 done > try.c;
9797 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9798 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9799         echo "$func() prototype found.";
9800         val="$define";
9801 else
9802         echo "$func() prototype NOT found.";
9803         val="$undef";
9804 fi;
9805 set $varname;
9806 eval $setvar;
9807 $rm_try tryout.c'
9808
9809 : see if sys/types.h has to be included
9810 set sys/types.h i_systypes
9811 eval $inhdr
9812
9813 : see if sys/select.h has to be included
9814 set sys/select.h i_sysselct
9815 eval $inhdr
9816
9817 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9818 while $test $# -ge 2; do
9819         case "$1" in
9820         $define) echo "#include <$2>";;
9821         esac ;
9822     shift 2;
9823 done > try.c;
9824 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9825 set try;
9826 if eval $compile; then
9827         val="$define";
9828 else
9829         val="$undef";
9830 fi;
9831 set $varname;
9832 eval $setvar;
9833 $rm_try'
9834
9835 : see if we should include time.h, sys/time.h, or both
9836 echo " "
9837 if test "X$timeincl" = X; then
9838         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9839         $echo $n "I'm now running the test program...$c"
9840         $cat >try.c <<EOCP
9841 #include <sys/types.h>
9842 #ifdef I_TIME
9843 #include <time.h>
9844 #endif
9845 #ifdef I_SYSTIME
9846 #ifdef SYSTIMEKERNEL
9847 #define KERNEL
9848 #endif
9849 #include <sys/time.h>
9850 #endif
9851 #ifdef I_SYSSELECT
9852 #include <sys/select.h>
9853 #endif
9854 #$i_stdlib I_STDLIB
9855 #ifdef I_STDLIB
9856 #include <stdlib.h>
9857 #endif
9858 int main()
9859 {
9860         struct tm foo;
9861 #ifdef S_TIMEVAL
9862         struct timeval bar;
9863 #endif
9864 #ifdef S_TIMEZONE
9865         struct timezone tzp;
9866 #endif
9867         if (foo.tm_sec == foo.tm_sec)
9868                 exit(0);
9869 #ifdef S_TIMEVAL
9870         if (bar.tv_sec == bar.tv_sec)
9871                 exit(0);
9872 #endif
9873         exit(1);
9874 }
9875 EOCP
9876         flags=''
9877         for s_timezone in '-DS_TIMEZONE' ''; do
9878         sysselect=''
9879         for s_timeval in '-DS_TIMEVAL' ''; do
9880         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9881         for i_time in '' '-DI_TIME'; do
9882         for i_systime in '-DI_SYSTIME' ''; do
9883                 case "$flags" in
9884                 '') $echo $n ".$c"
9885                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9886                         if eval $compile; then
9887                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9888                                 shift
9889                                 flags="$*"
9890                                 echo " "
9891                                 $echo $n "Succeeded with $flags$c"
9892                         fi
9893                         ;;
9894                 esac
9895         done
9896         done
9897         done
9898         done
9899         done
9900         timeincl=''
9901         echo " "
9902         case "$flags" in
9903         *SYSTIMEKERNEL*) i_systimek="$define"
9904                 timeincl=`./findhdr sys/time.h`
9905                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9906         *) i_systimek="$undef";;
9907         esac
9908         case "$flags" in
9909         *I_TIME*) i_time="$define"
9910                 timeincl=`./findhdr time.h`" $timeincl"
9911                 echo "We'll include <time.h>." >&4;;
9912         *) i_time="$undef";;
9913         esac
9914         case "$flags" in
9915         *I_SYSTIME*) i_systime="$define"
9916                 timeincl=`./findhdr sys/time.h`" $timeincl"
9917                 echo "We'll include <sys/time.h>." >&4;;
9918         *) i_systime="$undef";;
9919         esac
9920         $rm_try
9921 fi
9922 : see if struct tm knows about tm_zone
9923 case "$i_systime$i_time" in
9924 *$define*)
9925         echo " "
9926         echo "Checking to see if your struct tm has tm_zone field..." >&4
9927         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9928         eval $hasfield
9929         ;;
9930 *)      val="$undef"
9931         set d_tm_tm_zone
9932         eval $setvar
9933         ;;
9934 esac
9935 case "$d_tm_tm_zone" in
9936 "$define")      echo "Yes, it does."   ;;
9937 *)              echo "No, it doesn't." ;;
9938 esac
9939 : see if struct tm knows about tm_gmtoff
9940 case "$i_systime$i_time" in
9941 *$define*)
9942         echo " "
9943         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9944         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9945         eval $hasfield
9946         ;;
9947 *)      val="$undef"
9948         set d_tm_tm_gmtoff
9949         eval $setvar
9950         ;;
9951 esac
9952 case "$d_tm_tm_gmtoff" in
9953 "$define")      echo "Yes, it does."   ;;
9954 *)              echo "No, it doesn't." ;;
9955 esac
9956
9957 : see if asctime_r exists
9958 set asctime_r d_asctime_r
9959 eval $inlibc
9960 case "$d_asctime_r" in
9961 "$define")
9962         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9963         case "$d_asctime_r_proto:$usethreads" in
9964         ":define")      d_asctime_r_proto=define
9965                 set d_asctime_r_proto asctime_r $hdrs
9966                 eval $hasproto ;;
9967         *)      ;;
9968         esac
9969         case "$d_asctime_r_proto" in
9970         define)
9971         case "$asctime_r_proto" in
9972         ''|0) try='char* asctime_r(const struct tm*, char*);'
9973         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9974         esac
9975         case "$asctime_r_proto" in
9976         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9977         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9978         esac
9979         case "$asctime_r_proto" in
9980         ''|0) try='int asctime_r(const struct tm*, char*);'
9981         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9982         esac
9983         case "$asctime_r_proto" in
9984         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9985         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9986         esac
9987         case "$asctime_r_proto" in
9988         ''|0)   d_asctime_r=undef
9989                 asctime_r_proto=0
9990                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9991         * )     case "$asctime_r_proto" in
9992                 REENTRANT_PROTO*) ;;
9993                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9994                 esac
9995                 echo "Prototype: $try" ;;
9996         esac
9997         ;;
9998         *)      case "$usethreads" in
9999                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
10000                 esac
10001                 d_asctime_r=undef
10002                 asctime_r_proto=0
10003                 ;;
10004         esac
10005         ;;
10006 *)      asctime_r_proto=0
10007         ;;
10008 esac
10009
10010 : see if atolf exists
10011 set atolf d_atolf
10012 eval $inlibc
10013
10014 : see if atoll exists
10015 set atoll d_atoll
10016 eval $inlibc
10017
10018 : Look for GCC-style attribute format
10019 case "$d_attribute_format" in
10020 '')
10021 echo " "
10022 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10023 $cat >attrib.c <<'EOCP'
10024 #include <stdio.h>
10025 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10026 EOCP
10027 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10028         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10029                 echo "Your C compiler doesn't support __attribute__((format))."
10030                 val="$undef"
10031         else
10032                 echo "Your C compiler supports __attribute__((format))."
10033                 val="$define"
10034         fi
10035 else
10036         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10037         val="$undef"
10038 fi
10039 ;;
10040 *) val="$d_attribute_format" ;;
10041 esac
10042 set d_attribute_format
10043 eval $setvar
10044 $rm -f attrib*
10045
10046 : Look for GCC-style attribute format with null format allowed
10047 case "$d_printf_format_null" in
10048 '') case "$d_attribute_format" in
10049     $define)
10050         echo " "
10051         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10052 $cat >attrib.c <<EOCP
10053 #include <stdio.h>
10054 #$i_stdlib I_STDLIB
10055 #ifdef I_STDLIB
10056 #include <stdlib.h>
10057 #endif
10058 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10059 int null_printf (char* pat,...) { return (int)pat; }
10060 int main () { exit(null_printf(NULL)); }
10061 EOCP
10062         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10063             : run the executable in case it produces a run-time warning
10064             if $run ./attrib >>attrib.out 2>&1; then
10065                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10066                     echo "Your C compiler doesn't allow __printf__ format to be null."
10067                     val="$undef"
10068                 else
10069                     echo "Your C compiler allows __printf__ format to be null."
10070                     val="$define"
10071                 fi
10072             else
10073             echo "Your C compiler executable failed with __printf__ format null."
10074             val="$undef"
10075         fi
10076     else
10077         echo "Your C compiler fails with __printf__ format null."
10078         val="$undef"
10079     fi
10080     ;;
10081     *)  val="$undef" ;;
10082     esac
10083 ;;
10084 *)  val="$d_printf_format_null" ;;
10085 esac
10086 set d_printf_format_null
10087 eval $setvar
10088 $rm -f attrib*
10089
10090 : Look for GCC-style attribute malloc
10091 case "$d_attribute_malloc" in
10092 '')
10093 echo " "
10094 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10095 $cat >attrib.c <<'EOCP'
10096 #include <stdio.h>
10097 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10098 EOCP
10099 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10100         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10101                 echo "Your C compiler doesn't support __attribute__((malloc))."
10102                 val="$undef"
10103         else
10104                 echo "Your C compiler supports __attribute__((malloc))."
10105                 val="$define"
10106         fi
10107 else
10108         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10109         val="$undef"
10110 fi
10111 ;;
10112 *) val="$d_attribute_malloc" ;;
10113 esac
10114 set d_attribute_malloc
10115 eval $setvar
10116 $rm -f attrib*
10117
10118 : Look for GCC-style attribute nonnull
10119 case "$d_attribute_nonnull" in
10120 '')
10121 echo " "
10122 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10123 $cat >attrib.c <<'EOCP'
10124 #include <stdio.h>
10125 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10126 EOCP
10127 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10128         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10129                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10130                 val="$undef"
10131         else
10132                 echo "Your C compiler supports __attribute__((nonnull))."
10133                 val="$define"
10134         fi
10135 else
10136         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10137         val="$undef"
10138 fi
10139 ;;
10140 *) val="$d_attribute_nonnull" ;;
10141 esac
10142 set d_attribute_nonnull
10143 eval $setvar
10144 $rm -f attrib*
10145
10146 : Look for GCC-style attribute noreturn
10147 case "$d_attribute_noreturn" in
10148 '')
10149 echo " "
10150 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10151 $cat >attrib.c <<'EOCP'
10152 #include <stdio.h>
10153 void fall_over_dead( void ) __attribute__((noreturn));
10154 EOCP
10155 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10156         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10157                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10158                 val="$undef"
10159         else
10160                 echo "Your C compiler supports __attribute__((noreturn))."
10161                 val="$define"
10162         fi
10163 else
10164         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10165         val="$undef"
10166 fi
10167 ;;
10168 *) val="$d_attribute_noreturn" ;;
10169 esac
10170 set d_attribute_noreturn
10171 eval $setvar
10172 $rm -f attrib*
10173
10174 : Look for GCC-style attribute pure
10175 case "$d_attribute_pure" in
10176 '')
10177 echo " "
10178 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10179 $cat >attrib.c <<'EOCP'
10180 #include <stdio.h>
10181 int square( int n ) __attribute__((pure));
10182 EOCP
10183 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10184         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10185                 echo "Your C compiler doesn't support __attribute__((pure))."
10186                 val="$undef"
10187         else
10188                 echo "Your C compiler supports __attribute__((pure))."
10189                 val="$define"
10190         fi
10191 else
10192         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10193         val="$undef"
10194 fi
10195 ;;
10196 *) val="$d_attribute_pure" ;;
10197 esac
10198 set d_attribute_pure
10199 eval $setvar
10200 $rm -f attrib*
10201
10202 : Look for GCC-style attribute unused
10203 case "$d_attribute_unused" in
10204 '')
10205 echo " "
10206 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10207 $cat >attrib.c <<'EOCP'
10208 #include <stdio.h>
10209 int do_something( int dummy __attribute__((unused)), int n );
10210 EOCP
10211 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10212         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10213                 echo "Your C compiler doesn't support __attribute__((unused))."
10214                 val="$undef"
10215         else
10216                 echo "Your C compiler supports __attribute__((unused))."
10217                 val="$define"
10218         fi
10219 else
10220         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10221         val="$undef"
10222 fi
10223 ;;
10224 *) val="$d_attribute_unused" ;;
10225 esac
10226 set d_attribute_unused
10227 eval $setvar
10228 $rm -f attrib*
10229
10230 : Look for GCC-style attribute warn_unused_result
10231 case "$d_attribute_warn_unused_result" in
10232 '')
10233 echo " "
10234 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10235 $cat >attrib.c <<'EOCP'
10236 #include <stdio.h>
10237 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10238 EOCP
10239 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10240         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10241                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10242                 val="$undef"
10243         else
10244                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10245                 val="$define"
10246         fi
10247 else
10248         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10249         val="$undef"
10250 fi
10251 ;;
10252 *) val="$d_attribute_warn_unused_result" ;;
10253 esac
10254 set d_attribute_warn_unused_result
10255 eval $setvar
10256 $rm -f attrib*
10257
10258 : see if bcmp exists
10259 set bcmp d_bcmp
10260 eval $inlibc
10261
10262 : see if bcopy exists
10263 set bcopy d_bcopy
10264 eval $inlibc
10265
10266 : see if getpgrp exists
10267 set getpgrp d_getpgrp
10268 eval $inlibc
10269
10270 case "$d_getpgrp" in
10271 "$define")
10272         echo " "
10273         echo "Checking to see which flavor of getpgrp is in use..."
10274         $cat >try.c <<EOP
10275 #$i_unistd I_UNISTD
10276 #include <sys/types.h>
10277 #ifdef I_UNISTD
10278 #  include <unistd.h>
10279 #endif
10280 #$i_stdlib I_STDLIB
10281 #ifdef I_STDLIB
10282 #include <stdlib.h>
10283 #endif
10284 int main()
10285 {
10286         if (getuid() == 0) {
10287                 printf("(I see you are running Configure as super-user...)\n");
10288                 setuid(1);
10289         }
10290 #ifdef TRY_BSD_PGRP
10291         if (getpgrp(1) == 0)
10292                 exit(0);
10293 #else
10294         if (getpgrp() > 0)
10295                 exit(0);
10296 #endif
10297         exit(1);
10298 }
10299 EOP
10300         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10301                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10302                 val="$define"
10303         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10304                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10305                 val="$undef"
10306         else
10307                 echo "I can't seem to compile and run the test program."
10308                 if ./usg; then
10309                         xxx="a USG one, i.e. you use getpgrp()."
10310                 else
10311                         # SVR4 systems can appear rather BSD-ish.
10312                         case "$i_unistd" in
10313                         $undef)
10314                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10315                                 val="$define"
10316                                 ;;
10317                         $define)
10318                                 xxx="probably a USG one, i.e. you use getpgrp()."
10319                                 val="$undef"
10320                                 ;;
10321                         esac
10322                 fi
10323                 echo "Assuming your getpgrp is $xxx" >&4
10324         fi
10325         ;;
10326 *) val="$undef";;
10327 esac
10328 set d_bsdgetpgrp
10329 eval $setvar
10330 $rm_try
10331
10332 : see if setpgrp exists
10333 set setpgrp d_setpgrp
10334 eval $inlibc
10335
10336 case "$d_setpgrp" in
10337 "$define")
10338         echo " "
10339         echo "Checking to see which flavor of setpgrp is in use..."
10340         $cat >try.c <<EOP
10341 #$i_unistd I_UNISTD
10342 #include <sys/types.h>
10343 #ifdef I_UNISTD
10344 #  include <unistd.h>
10345 #endif
10346 #$i_stdlib I_STDLIB
10347 #ifdef I_STDLIB
10348 #include <stdlib.h>
10349 #endif
10350 int main()
10351 {
10352         if (getuid() == 0) {
10353                 printf("(I see you are running Configure as super-user...)\n");
10354                 setuid(1);
10355         }
10356 #ifdef TRY_BSD_PGRP
10357         if (-1 == setpgrp(1, 1))
10358                 exit(0);
10359 #else
10360         if (setpgrp() != -1)
10361                 exit(0);
10362 #endif
10363         exit(1);
10364 }
10365 EOP
10366         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10367                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10368                 val="$define"
10369         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10370                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10371                 val="$undef"
10372         else
10373                 echo "(I can't seem to compile and run the test program.)"
10374                 if ./usg; then
10375                         xxx="a USG one, i.e. you use setpgrp()."
10376                 else
10377                         # SVR4 systems can appear rather BSD-ish.
10378                         case "$i_unistd" in
10379                         $undef)
10380                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10381                                 val="$define"
10382                                 ;;
10383                         $define)
10384                                 xxx="probably a USG one, i.e. you use setpgrp()."
10385                                 val="$undef"
10386                                 ;;
10387                         esac
10388                 fi
10389                 echo "Assuming your setpgrp is $xxx" >&4
10390         fi
10391         ;;
10392 *) val="$undef";;
10393 esac
10394 set d_bsdsetpgrp
10395 eval $setvar
10396 $rm_try
10397
10398 : Look for GCC-style __builtin_choose_expr
10399 case "$d_builtin_choose_expr" in
10400 '')
10401     echo " "
10402     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10403     $cat >try.c <<'EOCP'
10404 #include <assert.h>
10405 #include <stdlib.h>
10406 #include <stdio.h>
10407
10408 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10409
10410 int main(void) {
10411     assert( SYRINX(1) == 2112 );
10412     assert( SYRINX(1) != 5150 );
10413     assert( SYRINX(0) == 5150 );
10414     assert( SYRINX(0) != 2112 );
10415     puts( "All good!" );
10416     exit(0);
10417 }
10418
10419 EOCP
10420     set try
10421     if eval $compile; then
10422         echo "Your C compiler supports __builtin_choose_expr."
10423         val="$define"
10424     else
10425         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10426         val="$undef"
10427     fi
10428 ;;
10429 *) val="$d_builtin_choose_expr" ;;
10430 esac
10431
10432 set d_builtin_choose_expr
10433 eval $setvar
10434 $rm_try
10435
10436 : Look for GCC-style __builtin_expect
10437 case "$d_builtin_expect" in
10438 '')
10439     echo " "
10440     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10441     $cat >builtin.c <<'EOCP'
10442 int main(void) {
10443     int n = 50;
10444     if ( __builtin_expect(n, 0) ) n = 1;
10445 }
10446 EOCP
10447     set try
10448     if eval $compile; then
10449         echo "Your C compiler supports __builtin_choose_expr."
10450         val="$define"
10451     else
10452         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10453         val="$undef"
10454     fi
10455     ;;
10456 *) val="$d_builtin_expect" ;;
10457 esac
10458
10459 set d_builtin_expect
10460 eval $setvar
10461 $rm_try
10462
10463 : see if bzero exists
10464 set bzero d_bzero
10465 eval $inlibc
10466
10467 : see if stdarg is available
10468 echo " "
10469 if $test `./findhdr stdarg.h`; then
10470         echo "<stdarg.h> found." >&4
10471         valstd="$define"
10472 else
10473         echo "<stdarg.h> NOT found." >&4
10474         valstd="$undef"
10475 fi
10476
10477 : see if varags is available
10478 echo " "
10479 if $test `./findhdr varargs.h`; then
10480         echo "<varargs.h> found." >&4
10481 else
10482         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10483 fi
10484
10485 : set up the varargs testing programs
10486 $cat > varargs.c <<EOP
10487 #ifdef I_STDARG
10488 #include <stdarg.h>
10489 #endif
10490 #ifdef I_VARARGS
10491 #include <varargs.h>
10492 #endif
10493
10494 #ifdef I_STDARG
10495 int f(char *p, ...)
10496 #else
10497 int f(va_alist)
10498 va_dcl
10499 #endif
10500 {
10501         va_list ap;
10502 #ifndef I_STDARG
10503         char *p;
10504 #endif
10505 #ifdef I_STDARG
10506         va_start(ap,p);
10507 #else
10508         va_start(ap);
10509         p = va_arg(ap, char *);
10510 #endif
10511         va_end(ap);
10512         return 0;
10513 }
10514 EOP
10515 $cat > varargs <<EOP
10516 $startsh
10517 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10518         echo "true"
10519 else
10520         echo "false"
10521 fi
10522 $rm -f varargs$_o
10523 EOP
10524 chmod +x varargs
10525
10526 : now check which varargs header should be included
10527 echo " "
10528 i_varhdr=''
10529 case "$valstd" in
10530 "$define")
10531         if `./varargs I_STDARG`; then
10532                 val='stdarg.h'
10533         elif `./varargs I_VARARGS`; then
10534                 val='varargs.h'
10535         fi
10536         ;;
10537 *)
10538         if `./varargs I_VARARGS`; then
10539                 val='varargs.h'
10540         fi
10541         ;;
10542 esac
10543 case "$val" in
10544 '')
10545 echo "I could not find the definition for va_dcl... You have problems..." >&4
10546         val="$undef"; set i_stdarg; eval $setvar
10547         val="$undef"; set i_varargs; eval $setvar
10548         ;;
10549 *) 
10550         set i_varhdr
10551         eval $setvar
10552         case "$i_varhdr" in
10553         stdarg.h)
10554                 val="$define"; set i_stdarg; eval $setvar
10555                 val="$undef"; set i_varargs; eval $setvar
10556                 ;;
10557         varargs.h)
10558                 val="$undef"; set i_stdarg; eval $setvar
10559                 val="$define"; set i_varargs; eval $setvar
10560                 ;;
10561         esac
10562         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10563 esac
10564 $rm -f varargs*
10565
10566 : see if the Compiler supports C99 variadic macros
10567 case "$i_stdarg$i_stdlib" in
10568     "$define$define")
10569     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10570     $cat >try.c <<EOCP
10571 #include <stdio.h>
10572 #include <stdarg.h>
10573
10574 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10575
10576 int main() {
10577   char buf[20];
10578   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10579   puts(buf);
10580   return 0;
10581 }
10582 EOCP
10583     set try
10584     if eval $compile && $run ./try 2>&1 >/dev/null; then
10585         case "`$run ./try`" in
10586             "123 456 789")
10587             echo "You have C99 variadic macros." >&4
10588             d_c99_variadic_macros="$define"
10589             ;;
10590             *)
10591             echo "You don't have functional C99 variadic macros." >&4
10592             d_c99_variadic_macros="$undef"
10593             ;;
10594         esac
10595     else
10596         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10597         d_c99_variadic_macros="$undef"
10598     fi
10599     $rm_try
10600     ;;
10601     *)
10602     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10603     d_c99_variadic_macros="$undef"
10604     ;;
10605 esac
10606
10607 : see if signal is declared as pointer to function returning int or void
10608 echo " "
10609 xxx=`./findhdr signal.h`
10610 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10611 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10612         echo "You have int (*signal())() instead of void." >&4
10613         val="$undef"
10614 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10615         echo "You have void (*signal())()." >&4
10616         val="$define"
10617 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10618         echo "You have int (*signal())() instead of void." >&4
10619         val="$undef"
10620 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10621         echo "You have void (*signal())()." >&4
10622         val="$define"
10623 else
10624         case "$d_voidsig" in
10625         '')
10626         echo "I can't determine whether signal handler returns void or int..." >&4
10627                 dflt=void
10628                 rp="What type does your signal handler return?"
10629                 . ./myread
10630                 case "$ans" in
10631                 v*) val="$define";;
10632                 *) val="$undef";;
10633                 esac;;
10634         "$define")
10635                 echo "As you already told me, signal handler returns void." >&4
10636                 val="$define"
10637                 ;;
10638         *)      echo "As you already told me, signal handler returns int." >&4
10639                 val="$undef"
10640                 ;;
10641         esac
10642 fi
10643 set d_voidsig
10644 eval $setvar
10645 case "$d_voidsig" in
10646 "$define") signal_t="void";;
10647 *) signal_t="int";;
10648 esac
10649 $rm -f $$.tmp
10650
10651 : check for ability to cast large floats to 32-bit ints.
10652 echo " "
10653 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10654 if $test "$intsize" -ge 4; then
10655         xxx=int
10656 else
10657         xxx=long
10658 fi
10659 $cat >try.c <<EOCP
10660 #include <stdio.h>
10661 #$i_stdlib I_STDLIB
10662 #ifdef I_STDLIB
10663 #include <stdlib.h>
10664 #endif
10665 #include <sys/types.h>
10666 #include <signal.h>
10667 $signal_t blech(int s) { exit(3); }
10668 int main()
10669 {
10670         $xxx i32;
10671         double f, g;
10672         int result = 0;
10673         char str[16];
10674         signal(SIGFPE, blech);
10675
10676         /* Don't let compiler optimize the test away.  Store the number
10677            in a writable string for gcc to pass to sscanf under HP/UX.
10678         */
10679         sprintf(str, "2147483647");
10680         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10681         g = 10 * f;
10682         i32  = ($xxx) g;
10683
10684         /* x86 processors will probably give 0x8000 0000, which is a
10685            sign change.  We don't want that.  We want to mimic SPARC
10686            behavior here, which is to preserve the sign and give
10687            back 0x7fff ffff.
10688         */
10689         if (i32 != ($xxx) f)
10690                 result |= 1;
10691         exit(result);
10692 }
10693 EOCP
10694 set try
10695 if eval $compile_ok; then
10696         $run ./try
10697         yyy=$?
10698 else
10699         echo "(I can't seem to compile the test program--assuming it can't)"
10700         yyy=1
10701 fi
10702 case "$yyy" in
10703 0)      val="$define"
10704         echo "Yup, it can."
10705         ;;
10706 *)      val="$undef"
10707         echo "Nope, it can't."
10708         ;;
10709 esac
10710 set d_casti32
10711 eval $setvar
10712 $rm_try
10713
10714 : check for ability to cast negative floats to unsigned
10715 echo " "
10716 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10717 $cat >try.c <<EOCP
10718 #include <stdio.h>
10719 #$i_stdlib I_STDLIB
10720 #ifdef I_STDLIB
10721 #include <stdlib.h>
10722 #endif
10723 #include <sys/types.h>
10724 #include <signal.h>
10725 $signal_t blech(int s) { exit(7); }
10726 $signal_t blech_in_list(int s) { exit(4); }
10727 unsigned long dummy_long(unsigned long p) { return p; }
10728 unsigned int dummy_int(unsigned int p) { return p; }
10729 unsigned short dummy_short(unsigned short p) { return p; }
10730 int main()
10731 {
10732         double f;
10733         unsigned long along;
10734         unsigned int aint;
10735         unsigned short ashort;
10736         int result = 0;
10737         char str[16];
10738
10739         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10740            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10741            optimized the whole file away
10742         */
10743         /* Store the number in a writable string for gcc to pass to
10744            sscanf under HP/UX.
10745         */
10746         sprintf(str, "-123");
10747         sscanf(str, "%lf", &f);  /* f = -123.; */
10748
10749         signal(SIGFPE, blech);
10750         along = (unsigned long)f;
10751         aint = (unsigned int)f;
10752         ashort = (unsigned short)f;
10753         if (along != (unsigned long)-123)
10754                 result |= 1;
10755         if (aint != (unsigned int)-123)
10756                 result |= 1;
10757         if (ashort != (unsigned short)-123)
10758                 result |= 1;
10759         sprintf(str, "1073741824.");
10760         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10761         f = f + f;
10762         along = 0;
10763         along = (unsigned long)f;
10764         if (along != 0x80000000)
10765                 result |= 2;
10766         f -= 1.;
10767         along = 0;
10768         along = (unsigned long)f;
10769         if (along != 0x7fffffff)
10770                 result |= 1;
10771         f += 2.;
10772         along = 0;
10773         along = (unsigned long)f;
10774         if (along != 0x80000001)
10775                 result |= 2;
10776         if (result)
10777                 exit(result);
10778         signal(SIGFPE, blech_in_list);
10779         sprintf(str, "123.");
10780         sscanf(str, "%lf", &f);  /* f = 123.; */
10781         along = dummy_long((unsigned long)f);
10782         aint = dummy_int((unsigned int)f);
10783         ashort = dummy_short((unsigned short)f);
10784         if (along != (unsigned long)123)
10785                 result |= 4;
10786         if (aint != (unsigned int)123)
10787                 result |= 4;
10788         if (ashort != (unsigned short)123)
10789                 result |= 4;
10790         exit(result);
10791
10792 }
10793 EOCP
10794 set try
10795 if eval $compile_ok; then
10796         $run ./try
10797         castflags=$?
10798 else
10799         echo "(I can't seem to compile the test program--assuming it can't)"
10800         castflags=7
10801 fi
10802 case "$castflags" in
10803 0)      val="$define"
10804         echo "Yup, it can."
10805         ;;
10806 *)      val="$undef"
10807         echo "Nope, it can't."
10808         ;;
10809 esac
10810 set d_castneg
10811 eval $setvar
10812 $rm_try
10813
10814 : see if vprintf exists
10815 echo " "
10816 if set vprintf val -f d_vprintf; eval $csym; $val; then
10817         echo 'vprintf() found.' >&4
10818         val="$define"
10819         $cat >try.c <<EOF
10820 #$i_stdarg I_STDARG  /* Only one of these can be defined by i_varhrd */
10821 #$i_varargs I_VARARGS
10822
10823 #$i_stdlib I_STDLIB
10824 #$i_unistd I_UNISTD
10825
10826 #ifdef I_STDARG
10827 #  include <stdarg.h>
10828 #else /* I_VARARGS */
10829 #  include <varargs.h>
10830 #endif
10831
10832 #ifdef I_UNISTD
10833 #  include <unistd.h>
10834 #endif
10835
10836 #ifdef I_STDLIB
10837 #  include <stdlib.h>
10838 #endif
10839
10840 #include <stdio.h> /* vsprintf prototype */
10841
10842 #ifdef I_STDARG
10843 void xxx(int n, ...)
10844 {
10845     va_list args;
10846     char buf[10];
10847     va_start(args, n);
10848     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10849 }
10850 int main() { xxx(1, "foo"); }
10851
10852 #else /* I_VARARGS */
10853
10854 xxx(va_alist)
10855 va_dcl
10856 {
10857     va_list args;
10858     char buf[10];
10859     va_start(args);
10860     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10861 }
10862 int main() { xxx("foo"); }
10863
10864 #endif
10865
10866 EOF
10867         set try
10868         if eval $compile_ok; then
10869                 if $run ./try; then
10870                         echo "Your vsprintf() returns (int)." >&4
10871                         val2="$undef"
10872                 else
10873                         echo "Your vsprintf() returns (char*)." >&4
10874                         val2="$define"
10875                 fi
10876         else
10877                 echo 'I am unable to compile the vsprintf() test program.' >&4
10878                 # We shouldn't get here.  If we do, assume the standard signature,
10879                 # not the old BSD one.
10880                 echo 'Guessing that vsprintf() returns (int).' >&4
10881                 val2="$undef"
10882         fi
10883 else
10884         echo 'vprintf() NOT found.' >&4
10885         val="$undef"
10886         val2="$undef"
10887 fi
10888 $rm_try
10889 set d_vprintf
10890 eval $setvar
10891 val=$val2
10892 set d_charvspr
10893 eval $setvar
10894
10895 : see if chown exists
10896 set chown d_chown
10897 eval $inlibc
10898
10899 : see if chroot exists
10900 set chroot d_chroot
10901 eval $inlibc
10902
10903 : see if chsize exists
10904 set chsize d_chsize
10905 eval $inlibc
10906
10907 : see if class exists
10908 set class d_class
10909 eval $inlibc
10910
10911 : see if clearenv exists
10912 set clearenv d_clearenv
10913 eval $inlibc
10914
10915 hasstruct='varname=$1; struct=$2; shift; shift;
10916 while $test $# -ge 2; do
10917         case "$1" in
10918         $define) echo "#include <$2>";;
10919         esac ;
10920     shift 2;
10921 done > try.c;
10922 echo "int main () { struct $struct foo; }" >> try.c;
10923 set try;
10924 if eval $compile; then
10925         val="$define";
10926 else
10927         val="$undef";
10928 fi;
10929 set $varname;
10930 eval $setvar;
10931 $rm_try'
10932
10933 socketlib=''
10934 sockethdr=''
10935 : see whether socket exists
10936 echo " "
10937 $echo $n "Hmm... $c" >&4
10938 if set socket val -f d_socket; eval $csym; $val; then
10939         echo "Looks like you have Berkeley networking support." >&4
10940         d_socket="$define"
10941         if set setsockopt val -f; eval $csym; $val; then
10942                 d_oldsock="$undef"
10943         else
10944                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10945                 d_oldsock="$define"
10946         fi
10947 else
10948         if $contains socklib libc.list >/dev/null 2>&1; then
10949                 echo "Looks like you have Berkeley networking support." >&4
10950                 d_socket="$define"
10951                 : we will have to assume that it supports the 4.2 BSD interface
10952                 d_oldsock="$undef"
10953         else
10954                 echo "You don't have Berkeley networking in libc$_a..." >&4
10955                 if test "X$d_socket" = "X$define"; then
10956                    echo "...but you seem to believe that you have sockets." >&4
10957                 else
10958                         for net in net socket
10959                         do
10960                                 if test -f /usr/lib/lib$net$_a; then
10961                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10962                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10963                                         if $contains socket libc.list >/dev/null 2>&1; then
10964                                                 d_socket="$define"
10965                                                 socketlib="-l$net"
10966                                                 case "$net" in
10967                                                 net)
10968                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10969                                                         sockethdr="-I/usr/netinclude"
10970                                                         ;;
10971                                                 esac
10972                                                 echo "Found Berkeley sockets interface in lib$net." >&4
10973                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10974                                                         d_oldsock="$undef"
10975                                                 else
10976                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10977                                                         d_oldsock="$define"
10978                                                 fi
10979                                                 break
10980                                         fi
10981                                 fi
10982                         done
10983                         if test "X$d_socket" != "X$define"; then
10984                            echo "or anywhere else I see." >&4
10985                            d_socket="$undef"
10986                            d_oldsock="$undef"
10987                         fi
10988                 fi
10989         fi
10990 fi
10991
10992 : see if socketpair exists
10993 set socketpair d_sockpair
10994 eval $inlibc
10995
10996
10997 echo " "
10998 echo "Checking the availability of certain socket constants..." >&4
10999 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
11000         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
11001         $cat >try.c <<EOF
11002 #include <sys/types.h>
11003 #include <sys/socket.h>
11004 int main() {
11005     int i = $ENUM;
11006 }
11007 EOF
11008         val="$undef"
11009         set try; if eval $compile; then
11010                 val="$define"
11011         fi
11012         set d_${enum}; eval $setvar
11013         $rm_try
11014 done
11015
11016 : see if this is a sys/uio.h system
11017 set sys/uio.h i_sysuio
11018 eval $inhdr
11019
11020
11021 echo " "
11022 echo "Checking to see if your system supports struct cmsghdr..." >&4
11023 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
11024 eval $hasstruct
11025 case "$d_cmsghdr_s" in
11026 "$define")      echo "Yes, it does."   ;;
11027 *)              echo "No, it doesn't." ;;
11028 esac
11029
11030
11031 : check for const keyword
11032 echo " "
11033 echo 'Checking to see if your C compiler knows about "const"...' >&4
11034 $cat >const.c <<'EOCP'
11035 typedef struct spug { int drokk; } spug;
11036 int main()
11037 {
11038         const char *foo;
11039         const spug y = { 0 };
11040 }
11041 EOCP
11042 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
11043         val="$define"
11044         echo "Yup, it does."
11045 else
11046         val="$undef"
11047         echo "Nope, it doesn't."
11048 fi
11049 set d_const
11050 eval $setvar
11051
11052 : see if copysignl exists
11053 set copysignl d_copysignl
11054 eval $inlibc
11055
11056 : see if crypt exists
11057 echo " "
11058 set crypt d_crypt
11059 eval $inlibc
11060 case "$d_crypt" in
11061 $define) cryptlib='' ;;
11062 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11063                 echo 'crypt() found.' >&4
11064                 val="$define"
11065                 cryptlib=''
11066         else
11067                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11068                 if $test -z "$cryptlib"; then
11069                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11070                 else
11071                         cryptlib=-lcrypt
11072                 fi
11073                 if $test -z "$cryptlib"; then
11074                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11075                 else
11076                         cryptlib=-lcrypt
11077                 fi
11078                 if $test -z "$cryptlib"; then
11079                         cryptlib=`./loc libcrypt$_a "" $libpth`
11080                 else
11081                         cryptlib=-lcrypt
11082                 fi
11083                 if $test -z "$cryptlib"; then
11084                         echo 'crypt() NOT found.' >&4
11085                         val="$undef"
11086                 else
11087                         val="$define"
11088                 fi
11089         fi
11090         set d_crypt
11091         eval $setvar
11092         ;;
11093 esac
11094
11095 : see if this is a crypt.h system
11096 set crypt.h i_crypt
11097 eval $inhdr
11098
11099 : see if crypt_r exists
11100 set crypt_r d_crypt_r
11101 eval $inlibc
11102 case "$d_crypt_r" in
11103 "$define")
11104         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11105         case "$d_crypt_r_proto:$usethreads" in
11106         ":define")      d_crypt_r_proto=define
11107                 set d_crypt_r_proto crypt_r $hdrs
11108                 eval $hasproto ;;
11109         *)      ;;
11110         esac
11111         case "$d_crypt_r_proto" in
11112         define)
11113         case "$crypt_r_proto" in
11114         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11115         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11116         esac
11117         case "$crypt_r_proto" in
11118         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11119         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11120         esac
11121         case "$crypt_r_proto" in
11122         ''|0)   d_crypt_r=undef
11123                 crypt_r_proto=0
11124                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11125         * )     case "$crypt_r_proto" in
11126                 REENTRANT_PROTO*) ;;
11127                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11128                 esac
11129                 echo "Prototype: $try" ;;
11130         esac
11131         ;;
11132         *)      case "$usethreads" in
11133                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11134                 esac
11135                 d_crypt_r=undef
11136                 crypt_r_proto=0
11137                 ;;
11138         esac
11139         ;;
11140 *)      crypt_r_proto=0
11141         ;;
11142 esac
11143
11144 : get csh whereabouts
11145 case "$csh" in
11146 'csh') val="$undef" ;;
11147 *) val="$define" ;;
11148 esac
11149 set d_csh
11150 eval $setvar
11151 : Respect a hint or command line value for full_csh.
11152 case "$full_csh" in
11153 '') full_csh=$csh ;;
11154 esac
11155
11156 : see if ctermid exists
11157 set ctermid d_ctermid
11158 eval $inlibc
11159
11160 : see if ctermid_r exists
11161 set ctermid_r d_ctermid_r
11162 eval $inlibc
11163 case "$d_ctermid_r" in
11164 "$define")
11165         hdrs="$i_systypes sys/types.h define stdio.h "
11166         case "$d_ctermid_r_proto:$usethreads" in
11167         ":define")      d_ctermid_r_proto=define
11168                 set d_ctermid_r_proto ctermid_r $hdrs
11169                 eval $hasproto ;;
11170         *)      ;;
11171         esac
11172         case "$d_ctermid_r_proto" in
11173         define)
11174         case "$ctermid_r_proto" in
11175         ''|0) try='char* ctermid_r(char*);'
11176         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11177         esac
11178         case "$ctermid_r_proto" in
11179         ''|0)   d_ctermid_r=undef
11180                 ctermid_r_proto=0
11181                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11182         * )     case "$ctermid_r_proto" in
11183                 REENTRANT_PROTO*) ;;
11184                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11185                 esac
11186                 echo "Prototype: $try" ;;
11187         esac
11188         ;;
11189         *)      case "$usethreads" in
11190                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11191                 esac
11192                 d_ctermid_r=undef
11193                 ctermid_r_proto=0
11194                 ;;
11195         esac
11196         ;;
11197 *)      ctermid_r_proto=0
11198         ;;
11199 esac
11200
11201 : see if ctime_r exists
11202 set ctime_r d_ctime_r
11203 eval $inlibc
11204 case "$d_ctime_r" in
11205 "$define")
11206         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11207         case "$d_ctime_r_proto:$usethreads" in
11208         ":define")      d_ctime_r_proto=define
11209                 set d_ctime_r_proto ctime_r $hdrs
11210                 eval $hasproto ;;
11211         *)      ;;
11212         esac
11213         case "$d_ctime_r_proto" in
11214         define)
11215         case "$ctime_r_proto" in
11216         ''|0) try='char* ctime_r(const time_t*, char*);'
11217         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11218         esac
11219         case "$ctime_r_proto" in
11220         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11221         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11222         esac
11223         case "$ctime_r_proto" in
11224         ''|0) try='int ctime_r(const time_t*, char*);'
11225         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11226         esac
11227         case "$ctime_r_proto" in
11228         ''|0) try='int ctime_r(const time_t*, char*, int);'
11229         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11230         esac
11231         case "$ctime_r_proto" in
11232         ''|0)   d_ctime_r=undef
11233                 ctime_r_proto=0
11234                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11235         * )     case "$ctime_r_proto" in
11236                 REENTRANT_PROTO*) ;;
11237                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11238                 esac
11239                 echo "Prototype: $try" ;;
11240         esac
11241         ;;
11242         *)      case "$usethreads" in
11243                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11244                 esac
11245                 d_ctime_r=undef
11246                 ctime_r_proto=0
11247                 ;;
11248         esac
11249         ;;
11250 *)      ctime_r_proto=0
11251         ;;
11252 esac
11253
11254 : see if cuserid exists
11255 set cuserid d_cuserid
11256 eval $inlibc
11257
11258 : see if this is a limits.h system
11259 set limits.h i_limits
11260 eval $inhdr
11261
11262 : see if this is a float.h system
11263 set float.h i_float
11264 eval $inhdr
11265
11266 : See if number of significant digits in a double precision number is known
11267 echo " "
11268 $cat >dbl_dig.c <<EOM
11269 #$i_limits I_LIMITS
11270 #$i_float I_FLOAT
11271 #ifdef I_LIMITS
11272 #include <limits.h>
11273 #endif
11274 #ifdef I_FLOAT
11275 #include <float.h>
11276 #endif
11277 #ifdef DBL_DIG
11278 printf("Contains DBL_DIG");
11279 #endif
11280 EOM
11281 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11282 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11283         echo "DBL_DIG found." >&4
11284         val="$define"
11285 else
11286         echo "DBL_DIG NOT found." >&4
11287         val="$undef"
11288 fi
11289 $rm -f dbl_dig.?
11290 set d_dbl_dig
11291 eval $setvar
11292
11293 : see if dbm.h is available
11294 : see if dbmclose exists
11295 set dbmclose d_dbmclose
11296 eval $inlibc
11297
11298 case "$d_dbmclose" in
11299 $define)
11300         set dbm.h i_dbm
11301         eval $inhdr
11302         case "$i_dbm" in
11303         $define)
11304                 val="$undef"
11305                 set i_rpcsvcdbm
11306                 eval $setvar
11307                 ;;
11308         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11309                 eval $inhdr
11310                 ;;
11311         esac
11312         ;;
11313 *)      echo "We won't be including <dbm.h>"
11314         val="$undef"
11315         set i_dbm
11316         eval $setvar
11317         val="$undef"
11318         set i_rpcsvcdbm
11319         eval $setvar
11320         ;;
11321 esac
11322
11323 : see if prototype for dbminit is available
11324 echo " "
11325 set d_dbminitproto dbminit $i_dbm dbm.h
11326 eval $hasproto
11327
11328 : see if difftime exists
11329 set difftime d_difftime
11330 eval $inlibc
11331
11332 : see if this is a dirent system
11333 echo " "
11334 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11335         val="$define"
11336         echo "<dirent.h> found." >&4
11337 else
11338         val="$undef"
11339         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11340                 echo "<sys/dir.h> found." >&4
11341                 echo " "
11342         else
11343                 xinc=`./findhdr sys/ndir.h`
11344         fi
11345         echo "<dirent.h> NOT found." >&4
11346 fi
11347 set i_dirent
11348 eval $setvar
11349
11350 : Look for type of directory structure.
11351 echo " "
11352 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11353
11354 case "$direntrytype" in
11355 ''|' ')
11356         case "$i_dirent" in
11357         $define) guess1='struct dirent' ;;
11358         *) guess1='struct direct'  ;;
11359         esac
11360         ;;
11361 *)      guess1="$direntrytype"
11362         ;;
11363 esac
11364
11365 case "$guess1" in
11366 'struct dirent') guess2='struct direct' ;;
11367 *) guess2='struct dirent' ;;
11368 esac
11369
11370 if $contains "$guess1" try.c >/dev/null 2>&1; then
11371         direntrytype="$guess1"
11372         echo "Your directory entries are $direntrytype." >&4
11373 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11374         direntrytype="$guess2"
11375         echo "Your directory entries seem to be $direntrytype." >&4
11376 else
11377         echo "I don't recognize your system's directory entries." >&4
11378         rp="What type is used for directory entries on this system?"
11379         dflt="$guess1"
11380         . ./myread
11381         direntrytype="$ans"
11382 fi
11383 $rm_try
11384
11385 : see if the directory entry stores field length
11386 echo " "
11387 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11388 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11389         echo "Good, your directory entry keeps length information in d_namlen." >&4
11390         val="$define"
11391 else
11392         echo "Your directory entry does not know about the d_namlen field." >&4
11393         val="$undef"
11394 fi
11395 set d_dirnamlen
11396 eval $setvar
11397 $rm_try
11398
11399 : Look for DIR.dd_fd
11400 case "$i_dirent" in
11401 "$define")
11402     echo "Checking to see if DIR has a dd_fd member variable" >&4
11403     $cat >try.c <<EOCP
11404 #$i_stdlib I_STDLIB
11405 #ifdef I_STDLIB
11406 #include <stdlib.h>
11407 #endif
11408 #include <dirent.h>
11409
11410 int main() {
11411     DIR dir;
11412     dir.dd_fd = 1;
11413     return 0;
11414 }
11415 EOCP
11416     val=$undef
11417     set try
11418     if eval $compile; then
11419         echo "Yes, it does."
11420         val="$define"
11421     else
11422         echo "No, it does not."
11423         val="$undef"
11424     fi
11425     ;;
11426 *)
11427     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11428     val="$undef"
11429     ;;
11430 esac
11431 set d_dir_dd_fd
11432 eval $setvar
11433 $rm_try
11434
11435 : see if this is an sysdir system
11436 set sys/dir.h i_sysdir
11437 eval $inhdr
11438
11439 : see if this is an sysndir system
11440 set sys/ndir.h i_sysndir
11441 eval $inhdr
11442
11443 : Look for dirfd
11444 echo " "
11445 $cat >dirfd.c <<EOM
11446 #include <stdio.h>
11447 #$i_stdlib I_STDLIB
11448 #ifdef I_STDLIB
11449 #include <stdlib.h>
11450 #endif
11451 #$i_dirent I_DIRENT             /**/
11452 #$i_sysdir I_SYS_DIR            /**/
11453 #$i_sysndir I_SYS_NDIR          /**/
11454 #$i_systypes I_SYS_TYPES        /**/
11455 #if defined(I_SYS_TYPES)
11456 #include <sys/types.h>
11457 #endif
11458 #if defined(I_DIRENT)
11459 #include <dirent.h>
11460 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11461 #include <sys/dir.h>
11462 #endif
11463 #else
11464 #ifdef I_SYS_NDIR
11465 #include <sys/ndir.h>
11466 #else
11467 #ifdef I_SYS_DIR
11468 #ifdef hp9000s500
11469 #include <ndir.h>       /* may be wrong in the future */
11470 #else
11471 #include <sys/dir.h>
11472 #endif
11473 #endif
11474 #endif
11475 #endif 
11476 int main() {
11477         DIR *dirp = opendir(".");
11478         if (dirfd(dirp) >= 0)
11479                 exit(0);
11480         else
11481                 exit(1);
11482 }
11483 EOM
11484 val=$undef
11485 set dirfd
11486 if eval $compile; then
11487         val="$define"
11488 fi
11489 case "$val" in
11490 $define)        echo "dirfd() found." >&4       ;;
11491 *)              echo "dirfd() NOT found." >&4   ;;
11492 esac
11493 set d_dirfd
11494 eval $setvar
11495 $rm -f dirfd*
11496
11497 : see if dlerror exists
11498 xxx_runnm="$runnm"
11499 runnm=false
11500 set dlerror d_dlerror
11501 eval $inlibc
11502 runnm="$xxx_runnm"
11503
11504 : see if dlfcn is available
11505 set dlfcn.h i_dlfcn
11506 eval $inhdr
11507
11508 case "$usedl" in
11509 $define|y|true)
11510         $cat << EOM
11511
11512 On a few systems, the dynamically loaded modules that perl generates and uses
11513 will need a different extension than shared libs. The default will probably
11514 be appropriate.
11515
11516 EOM
11517         case "$dlext" in
11518         '')     dflt="$so" ;;
11519         *)      dflt="$dlext" ;;
11520         esac
11521         rp='What is the extension of dynamically loaded modules'
11522         . ./myread
11523         dlext="$ans"
11524         ;;
11525 *)
11526         dlext="none"
11527         ;;
11528 esac
11529
11530 : Check if dlsym need a leading underscore
11531 echo " "
11532 val="$undef"
11533
11534 case "$dlsrc" in
11535 dl_dlopen.xs)
11536         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11537         $cat >dyna.c <<'EOM'
11538 fred () { }
11539 EOM
11540
11541 $cat >fred.c<<EOM
11542
11543 #include <stdio.h>
11544 #$i_stdlib I_STDLIB
11545 #ifdef I_STDLIB
11546 #include <stdlib.h>
11547 #endif
11548 #$i_dlfcn I_DLFCN
11549 #ifdef I_DLFCN
11550 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11551 #else
11552 #include <sys/types.h>
11553 #include <nlist.h>
11554 #include <link.h>
11555 #endif
11556
11557 extern int fred() ;
11558
11559 int main()
11560 {
11561     void * handle ;
11562     void * symbol ;
11563 #ifndef RTLD_LAZY
11564     int mode = 1 ;
11565 #else
11566     int mode = RTLD_LAZY ;
11567 #endif
11568     handle = dlopen("./dyna.$dlext", mode) ;
11569     if (handle == NULL) {
11570         printf ("1\n") ;
11571         fflush (stdout) ;
11572         exit(0);
11573     }
11574     symbol = dlsym(handle, "fred") ;
11575     if (symbol == NULL) {
11576         /* try putting a leading underscore */
11577         symbol = dlsym(handle, "_fred") ;
11578         if (symbol == NULL) {
11579             printf ("2\n") ;
11580             fflush (stdout) ;
11581             exit(0);
11582         }
11583         printf ("3\n") ;
11584     }
11585     else
11586         printf ("4\n") ;
11587     fflush (stdout) ;
11588     exit(0);
11589 }
11590 EOM
11591         : Call the object file tmp-dyna.o in case dlext=o.
11592         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11593                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11594                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11595                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11596                 xxx=`$run ./fred`
11597                 case $xxx in
11598                 1)      echo "Test program failed using dlopen." >&4
11599                         echo "Perhaps you should not use dynamic loading." >&4;;
11600                 2)      echo "Test program failed using dlsym." >&4
11601                         echo "Perhaps you should not use dynamic loading." >&4;;
11602                 3)      echo "dlsym needs a leading underscore" >&4
11603                         val="$define" ;;
11604                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11605                 esac
11606         else
11607                 echo "I can't compile and run the test program." >&4
11608                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11609         fi
11610         ;;
11611 esac
11612                 
11613 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11614
11615 set d_dlsymun
11616 eval $setvar
11617
11618 : see if drand48_r exists
11619 set drand48_r d_drand48_r
11620 eval $inlibc
11621 case "$d_drand48_r" in
11622 "$define")
11623         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11624         case "$d_drand48_r_proto:$usethreads" in
11625         ":define")      d_drand48_r_proto=define
11626                 set d_drand48_r_proto drand48_r $hdrs
11627                 eval $hasproto ;;
11628         *)      ;;
11629         esac
11630         case "$d_drand48_r_proto" in
11631         define)
11632         case "$drand48_r_proto" in
11633         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11634         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11635         esac
11636         case "$drand48_r_proto" in
11637         ''|0)   d_drand48_r=undef
11638                 drand48_r_proto=0
11639                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11640         * )     case "$drand48_r_proto" in
11641                 REENTRANT_PROTO*) ;;
11642                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11643                 esac
11644                 echo "Prototype: $try" ;;
11645         esac
11646         ;;
11647         *)      case "$usethreads" in
11648                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11649                 esac
11650                 d_drand48_r=undef
11651                 drand48_r_proto=0
11652                 ;;
11653         esac
11654         ;;
11655 *)      drand48_r_proto=0
11656         ;;
11657 esac
11658
11659 : see if prototype for drand48 is available
11660 echo " "
11661 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11662 eval $hasproto
11663
11664 : see if dup2 exists
11665 set dup2 d_dup2
11666 eval $inlibc
11667
11668 : see if eaccess exists
11669 set eaccess d_eaccess
11670 eval $inlibc
11671
11672 : see if endgrent exists
11673 set endgrent d_endgrent
11674 eval $inlibc
11675
11676 : see if this is an grp system
11677 set grp.h i_grp
11678 eval $inhdr
11679
11680 case "$i_grp" in
11681 $define)
11682         xxx=`./findhdr grp.h`
11683         $cppstdin $cppflags $cppminus < $xxx >$$.h
11684
11685         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11686                 val="$define"
11687         else
11688                 val="$undef"
11689         fi
11690         set d_grpasswd
11691         eval $setvar
11692
11693         $rm -f $$.h
11694         ;;
11695 *)
11696         val="$undef";
11697         set d_grpasswd; eval $setvar
11698         ;;
11699 esac
11700
11701 : see if endgrent_r exists
11702 set endgrent_r d_endgrent_r
11703 eval $inlibc
11704 case "$d_endgrent_r" in
11705 "$define")
11706         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11707         case "$d_endgrent_r_proto:$usethreads" in
11708         ":define")      d_endgrent_r_proto=define
11709                 set d_endgrent_r_proto endgrent_r $hdrs
11710                 eval $hasproto ;;
11711         *)      ;;
11712         esac
11713         case "$d_endgrent_r_proto" in
11714         define)
11715         case "$endgrent_r_proto" in
11716         ''|0) try='int endgrent_r(FILE**);'
11717         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11718         esac
11719         case "$endgrent_r_proto" in
11720         ''|0) try='void endgrent_r(FILE**);'
11721         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11722         esac
11723         case "$endgrent_r_proto" in
11724         ''|0)   d_endgrent_r=undef
11725                 endgrent_r_proto=0
11726                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11727         * )     case "$endgrent_r_proto" in
11728                 REENTRANT_PROTO*) ;;
11729                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11730                 esac
11731                 echo "Prototype: $try" ;;
11732         esac
11733         ;;
11734         *)      case "$usethreads" in
11735                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11736                 esac
11737                 d_endgrent_r=undef
11738                 endgrent_r_proto=0
11739                 ;;
11740         esac
11741         ;;
11742 *)      endgrent_r_proto=0
11743         ;;
11744 esac
11745
11746 : see if endhostent exists
11747 set endhostent d_endhent
11748 eval $inlibc
11749
11750 : see if this is a netdb.h system
11751 set netdb.h i_netdb
11752 eval $inhdr
11753
11754 : see if endhostent_r exists
11755 set endhostent_r d_endhostent_r
11756 eval $inlibc
11757 case "$d_endhostent_r" in
11758 "$define")
11759         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11760         case "$d_endhostent_r_proto:$usethreads" in
11761         ":define")      d_endhostent_r_proto=define
11762                 set d_endhostent_r_proto endhostent_r $hdrs
11763                 eval $hasproto ;;
11764         *)      ;;
11765         esac
11766         case "$d_endhostent_r_proto" in
11767         define)
11768         case "$endhostent_r_proto" in
11769         ''|0) try='int endhostent_r(struct hostent_data*);'
11770         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11771         esac
11772         case "$endhostent_r_proto" in
11773         ''|0) try='void endhostent_r(struct hostent_data*);'
11774         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11775         esac
11776         case "$endhostent_r_proto" in
11777         ''|0)   d_endhostent_r=undef
11778                 endhostent_r_proto=0
11779                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11780         * )     case "$endhostent_r_proto" in
11781                 REENTRANT_PROTO*) ;;
11782                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11783                 esac
11784                 echo "Prototype: $try" ;;
11785         esac
11786         ;;
11787         *)      case "$usethreads" in
11788                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11789                 esac
11790                 d_endhostent_r=undef
11791                 endhostent_r_proto=0
11792                 ;;
11793         esac
11794         ;;
11795 *)      endhostent_r_proto=0
11796         ;;
11797 esac
11798
11799 : see if endnetent exists
11800 set endnetent d_endnent
11801 eval $inlibc
11802
11803 : see if endnetent_r exists
11804 set endnetent_r d_endnetent_r
11805 eval $inlibc
11806 case "$d_endnetent_r" in
11807 "$define")
11808         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11809         case "$d_endnetent_r_proto:$usethreads" in
11810         ":define")      d_endnetent_r_proto=define
11811                 set d_endnetent_r_proto endnetent_r $hdrs
11812                 eval $hasproto ;;
11813         *)      ;;
11814         esac
11815         case "$d_endnetent_r_proto" in
11816         define)
11817         case "$endnetent_r_proto" in
11818         ''|0) try='int endnetent_r(struct netent_data*);'
11819         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11820         esac
11821         case "$endnetent_r_proto" in
11822         ''|0) try='void endnetent_r(struct netent_data*);'
11823         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11824         esac
11825         case "$endnetent_r_proto" in
11826         ''|0)   d_endnetent_r=undef
11827                 endnetent_r_proto=0
11828                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11829         * )     case "$endnetent_r_proto" in
11830                 REENTRANT_PROTO*) ;;
11831                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11832                 esac
11833                 echo "Prototype: $try" ;;
11834         esac
11835         ;;
11836         *)      case "$usethreads" in
11837                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11838                 esac
11839                 d_endnetent_r=undef
11840                 endnetent_r_proto=0
11841                 ;;
11842         esac
11843         ;;
11844 *)      endnetent_r_proto=0
11845         ;;
11846 esac
11847
11848 : see if endprotoent exists
11849 set endprotoent d_endpent
11850 eval $inlibc
11851
11852 : see if endprotoent_r exists
11853 set endprotoent_r d_endprotoent_r
11854 eval $inlibc
11855 case "$d_endprotoent_r" in
11856 "$define")
11857         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11858         case "$d_endprotoent_r_proto:$usethreads" in
11859         ":define")      d_endprotoent_r_proto=define
11860                 set d_endprotoent_r_proto endprotoent_r $hdrs
11861                 eval $hasproto ;;
11862         *)      ;;
11863         esac
11864         case "$d_endprotoent_r_proto" in
11865         define)
11866         case "$endprotoent_r_proto" in
11867         ''|0) try='int endprotoent_r(struct protoent_data*);'
11868         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11869         esac
11870         case "$endprotoent_r_proto" in
11871         ''|0) try='void endprotoent_r(struct protoent_data*);'
11872         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11873         esac
11874         case "$endprotoent_r_proto" in
11875         ''|0)   d_endprotoent_r=undef
11876                 endprotoent_r_proto=0
11877                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11878         * )     case "$endprotoent_r_proto" in
11879                 REENTRANT_PROTO*) ;;
11880                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11881                 esac
11882                 echo "Prototype: $try" ;;
11883         esac
11884         ;;
11885         *)      case "$usethreads" in
11886                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11887                 esac
11888                 d_endprotoent_r=undef
11889                 endprotoent_r_proto=0
11890                 ;;
11891         esac
11892         ;;
11893 *)      endprotoent_r_proto=0
11894         ;;
11895 esac
11896
11897 : see if endpwent exists
11898 set endpwent d_endpwent
11899 eval $inlibc
11900
11901 : see if this is a pwd.h system
11902 set pwd.h i_pwd
11903 eval $inhdr
11904
11905 case "$i_pwd" in
11906 $define)
11907         xxx=`./findhdr pwd.h`
11908         $cppstdin $cppflags $cppminus < $xxx >$$.h
11909
11910         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11911                 val="$define"
11912         else
11913                 val="$undef"
11914         fi
11915         set d_pwquota
11916         eval $setvar
11917
11918         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11919                 val="$define"
11920         else
11921                 val="$undef"
11922         fi
11923         set d_pwage
11924         eval $setvar
11925
11926         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11927                 val="$define"
11928         else
11929                 val="$undef"
11930         fi
11931         set d_pwchange
11932         eval $setvar
11933
11934         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11935                 val="$define"
11936         else
11937                 val="$undef"
11938         fi
11939         set d_pwclass
11940         eval $setvar
11941
11942         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11943                 val="$define"
11944         else
11945                 val="$undef"
11946         fi
11947         set d_pwexpire
11948         eval $setvar
11949
11950         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11951                 val="$define"
11952         else
11953                 val="$undef"
11954         fi
11955         set d_pwcomment
11956         eval $setvar
11957
11958         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11959                 val="$define"
11960         else
11961                 val="$undef"
11962         fi
11963         set d_pwgecos
11964         eval $setvar
11965
11966         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11967                 val="$define"
11968         else
11969                 val="$undef"
11970         fi
11971         set d_pwpasswd
11972         eval $setvar
11973
11974         $rm -f $$.h
11975         ;;
11976 *)
11977         val="$undef"; 
11978         set d_pwquota; eval $setvar
11979         set d_pwage; eval $setvar
11980         set d_pwchange; eval $setvar
11981         set d_pwclass; eval $setvar
11982         set d_pwexpire; eval $setvar
11983         set d_pwcomment; eval $setvar
11984         set d_pwgecos; eval $setvar
11985         set d_pwpasswd; eval $setvar
11986         ;;
11987 esac
11988
11989 : see if endpwent_r exists
11990 set endpwent_r d_endpwent_r
11991 eval $inlibc
11992 case "$d_endpwent_r" in
11993 "$define")
11994         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11995         case "$d_endpwent_r_proto:$usethreads" in
11996         ":define")      d_endpwent_r_proto=define
11997                 set d_endpwent_r_proto endpwent_r $hdrs
11998                 eval $hasproto ;;
11999         *)      ;;
12000         esac
12001         case "$d_endpwent_r_proto" in
12002         define)
12003         case "$endpwent_r_proto" in
12004         ''|0) try='int endpwent_r(FILE**);'
12005         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
12006         esac
12007         case "$endpwent_r_proto" in
12008         ''|0) try='void endpwent_r(FILE**);'
12009         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
12010         esac
12011         case "$endpwent_r_proto" in
12012         ''|0)   d_endpwent_r=undef
12013                 endpwent_r_proto=0
12014                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
12015         * )     case "$endpwent_r_proto" in
12016                 REENTRANT_PROTO*) ;;
12017                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
12018                 esac
12019                 echo "Prototype: $try" ;;
12020         esac
12021         ;;
12022         *)      case "$usethreads" in
12023                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
12024                 esac
12025                 d_endpwent_r=undef
12026                 endpwent_r_proto=0
12027                 ;;
12028         esac
12029         ;;
12030 *)      endpwent_r_proto=0
12031         ;;
12032 esac
12033
12034 : see if endservent exists
12035 set endservent d_endsent
12036 eval $inlibc
12037
12038 : see if endservent_r exists
12039 set endservent_r d_endservent_r
12040 eval $inlibc
12041 case "$d_endservent_r" in
12042 "$define")
12043         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12044         case "$d_endservent_r_proto:$usethreads" in
12045         ":define")      d_endservent_r_proto=define
12046                 set d_endservent_r_proto endservent_r $hdrs
12047                 eval $hasproto ;;
12048         *)      ;;
12049         esac
12050         case "$d_endservent_r_proto" in
12051         define)
12052         case "$endservent_r_proto" in
12053         ''|0) try='int endservent_r(struct servent_data*);'
12054         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
12055         esac
12056         case "$endservent_r_proto" in
12057         ''|0) try='void endservent_r(struct servent_data*);'
12058         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
12059         esac
12060         case "$endservent_r_proto" in
12061         ''|0)   d_endservent_r=undef
12062                 endservent_r_proto=0
12063                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12064         * )     case "$endservent_r_proto" in
12065                 REENTRANT_PROTO*) ;;
12066                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12067                 esac
12068                 echo "Prototype: $try" ;;
12069         esac
12070         ;;
12071         *)      case "$usethreads" in
12072                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12073                 esac
12074                 d_endservent_r=undef
12075                 endservent_r_proto=0
12076                 ;;
12077         esac
12078         ;;
12079 *)      endservent_r_proto=0
12080         ;;
12081 esac
12082
12083 : Locate the flags for 'open()'
12084 echo " "
12085 $cat >try.c <<EOCP
12086 #include <sys/types.h>
12087 #ifdef I_FCNTL
12088 #include <fcntl.h>
12089 #endif
12090 #ifdef I_SYS_FILE
12091 #include <sys/file.h>
12092 #endif
12093 #$i_stdlib I_STDLIB
12094 #ifdef I_STDLIB
12095 #include <stdlib.h>
12096 #endif
12097 int main() {
12098         if(O_RDONLY);
12099 #ifdef O_TRUNC
12100         exit(0);
12101 #else
12102         exit(1);
12103 #endif
12104 }
12105 EOCP
12106 : check sys/file.h first to get FREAD on Sun
12107 if $test `./findhdr sys/file.h` && \
12108                 set try -DI_SYS_FILE && eval $compile; then
12109         h_sysfile=true;
12110         echo "<sys/file.h> defines the O_* constants..." >&4
12111         if $run ./try; then
12112                 echo "and you have the 3 argument form of open()." >&4
12113                 val="$define"
12114         else
12115                 echo "but not the 3 argument form of open().  Oh, well." >&4
12116                 val="$undef"
12117         fi
12118 elif $test `./findhdr fcntl.h` && \
12119                 set try -DI_FCNTL && eval $compile; then
12120         h_fcntl=true;
12121         echo "<fcntl.h> defines the O_* constants..." >&4
12122         if $run ./try; then
12123                 echo "and you have the 3 argument form of open()." >&4
12124                 val="$define"
12125         else
12126                 echo "but not the 3 argument form of open().  Oh, well." >&4
12127                 val="$undef"
12128         fi
12129 else
12130         val="$undef"
12131         echo "I can't find the O_* constant definitions!  You got problems." >&4
12132 fi
12133 set d_open3
12134 eval $setvar
12135 $rm_try
12136
12137 : see which of string.h or strings.h is needed
12138 echo " "
12139 strings=`./findhdr string.h`
12140 if $test "$strings" && $test -r "$strings"; then
12141         echo "Using <string.h> instead of <strings.h>." >&4
12142         val="$define"
12143 else
12144         val="$undef"
12145         strings=`./findhdr strings.h`
12146         if $test "$strings" && $test -r "$strings"; then
12147                 echo "Using <strings.h> instead of <string.h>." >&4
12148         else
12149                 echo "No string header found -- You'll surely have problems." >&4
12150         fi
12151 fi
12152 set i_string
12153 eval $setvar
12154 case "$i_string" in
12155 "$undef") strings=`./findhdr strings.h`;;
12156 *)        strings=`./findhdr string.h`;;
12157 esac
12158
12159 : see if this is a sys/file.h system
12160 val=''
12161 set sys/file.h val
12162 eval $inhdr
12163
12164 : do we need to include sys/file.h ?
12165 case "$val" in
12166 "$define")
12167         echo " "
12168         if $h_sysfile; then
12169                 val="$define"
12170                 echo "We'll be including <sys/file.h>." >&4
12171         else
12172                 val="$undef"
12173                 echo "We won't be including <sys/file.h>." >&4
12174         fi
12175         ;;
12176 *)
12177         h_sysfile=false
12178         ;;
12179 esac
12180 set i_sysfile
12181 eval $setvar
12182
12183 : see if fcntl.h is there
12184 val=''
12185 set fcntl.h val
12186 eval $inhdr
12187
12188 : see if we can include fcntl.h
12189 case "$val" in
12190 "$define")
12191         echo " "
12192         if $h_fcntl; then
12193                 val="$define"
12194                 echo "We'll be including <fcntl.h>." >&4
12195         else
12196                 val="$undef"
12197                 if $h_sysfile; then
12198         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12199                 else
12200                         echo "We won't be including <fcntl.h>." >&4
12201                 fi
12202         fi
12203         ;;
12204 *)
12205         h_fcntl=false
12206         val="$undef"
12207         ;;
12208 esac
12209 set i_fcntl
12210 eval $setvar
12211
12212 : see if fork exists
12213 set fork d_fork
12214 eval $inlibc
12215
12216 : see if pipe exists
12217 set pipe d_pipe
12218 eval $inlibc
12219
12220 : check for non-blocking I/O stuff
12221 case "$h_sysfile" in
12222 true) echo "#include <sys/file.h>" > head.c;;
12223 *)
12224        case "$h_fcntl" in
12225        true) echo "#include <fcntl.h>" > head.c;;
12226        *) echo "#include <sys/fcntl.h>" > head.c;;
12227        esac
12228        ;;
12229 esac
12230 echo " "
12231 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12232 case "$o_nonblock" in
12233 '')
12234         $cat head.c > try.c
12235         $cat >>try.c <<EOCP
12236 #include <stdio.h>
12237 #$i_stdlib I_STDLIB
12238 #ifdef I_STDLIB
12239 #include <stdlib.h>
12240 #endif
12241 #$i_fcntl I_FCNTL
12242 #ifdef I_FCNTL
12243 #include <fcntl.h>
12244 #endif
12245 int main() {
12246 #ifdef O_NONBLOCK
12247         printf("O_NONBLOCK\n");
12248         exit(0);
12249 #endif
12250 #ifdef O_NDELAY
12251         printf("O_NDELAY\n");
12252         exit(0);
12253 #endif
12254 #ifdef FNDELAY
12255         printf("FNDELAY\n");
12256         exit(0);
12257 #endif
12258         exit(0);
12259 }
12260 EOCP
12261         set try
12262         if eval $compile_ok; then
12263                 o_nonblock=`$run ./try`
12264                 case "$o_nonblock" in
12265                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12266                 *) echo "Seems like we can use $o_nonblock.";;
12267                 esac
12268         else
12269                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12270         fi
12271         ;;
12272 *) echo "Using $hint value $o_nonblock.";;
12273 esac
12274 $rm_try
12275
12276 echo " "
12277 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12278 case "$eagain" in
12279 '')
12280         case "$d_fork:$d_pipe" in
12281         define:define)
12282         $cat head.c > try.c
12283         $cat >>try.c <<EOCP
12284 #include <errno.h>
12285 #include <sys/types.h>
12286 #include <signal.h>
12287 #include <stdio.h>
12288 #$i_stdlib I_STDLIB
12289 #ifdef I_STDLIB
12290 #include <stdlib.h>
12291 #endif
12292 #$i_fcntl I_FCNTL
12293 #ifdef I_FCNTL
12294 #include <fcntl.h>
12295 #endif
12296 #define MY_O_NONBLOCK $o_nonblock
12297 #ifndef errno  /* XXX need better Configure test */
12298 extern int errno;
12299 #endif
12300 #$i_unistd I_UNISTD
12301 #ifdef I_UNISTD
12302 #include <unistd.h>
12303 #endif
12304 #$i_string I_STRING
12305 #ifdef I_STRING
12306 #include <string.h>
12307 #else
12308 #include <strings.h>
12309 #endif
12310 $signal_t blech(int x) { exit(3); }
12311 EOCP
12312         $cat >> try.c <<'EOCP'
12313 int main()
12314 {
12315         int pd[2];
12316         int pu[2];
12317         char buf[1];
12318         char string[100];
12319
12320         pipe(pd);       /* Down: child -> parent */
12321         pipe(pu);       /* Up: parent -> child */
12322         if (0 != fork()) {
12323                 int ret;
12324                 close(pd[1]);   /* Parent reads from pd[0] */
12325                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12326 #ifdef F_SETFL
12327                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12328                         exit(1);
12329 #else
12330                 exit(4);
12331 #endif
12332                 signal(SIGALRM, blech);
12333                 alarm(5);
12334                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12335                         exit(2);
12336                 sprintf(string, "%d\n", ret);
12337                 write(2, string, strlen(string));
12338                 alarm(0);
12339 #ifdef EAGAIN
12340                 if (errno == EAGAIN) {
12341                         printf("EAGAIN\n");
12342                         goto ok;
12343                 }
12344 #endif
12345 #ifdef EWOULDBLOCK
12346                 if (errno == EWOULDBLOCK)
12347                         printf("EWOULDBLOCK\n");
12348 #endif
12349         ok:
12350                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12351                 sleep(2);                               /* Give it time to close our pipe */
12352                 alarm(5);
12353                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12354                 alarm(0);
12355                 sprintf(string, "%d\n", ret);
12356                 write(4, string, strlen(string));
12357                 exit(0);
12358         }
12359
12360         close(pd[0]);                   /* We write to pd[1] */
12361         close(pu[1]);                   /* We read from pu[0] */
12362         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12363         close(pd[1]);                   /* Pipe pd is now fully closed! */
12364         exit(0);                                /* Bye bye, thank you for playing! */
12365 }
12366 EOCP
12367         set try
12368         if eval $compile_ok; then
12369                 echo "$startsh" >mtry
12370                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12371                 chmod +x mtry
12372                 ./mtry >/dev/null 2>&1
12373                 case $? in
12374                 0) eagain=`$cat try.out`;;
12375                 1) echo "Could not perform non-blocking setting!";;
12376                 2) echo "I did a successful read() for something that was not there!";;
12377                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12378                 4) echo "Could not find F_SETFL!";;
12379                 *) echo "Something terribly wrong happened during testing.";;
12380                 esac
12381                 rd_nodata=`$cat try.ret`
12382                 echo "A read() system call with no data present returns $rd_nodata."
12383                 case "$rd_nodata" in
12384                 0|-1) ;;
12385                 *)
12386                         echo "(That's peculiar, fixing that to be -1.)"
12387                         rd_nodata=-1
12388                         ;;
12389                 esac
12390                 case "$eagain" in
12391                 '')
12392                         echo "Forcing errno EAGAIN on read() with no data available."
12393                         eagain=EAGAIN
12394                         ;;
12395                 *)
12396                         echo "Your read() sets errno to $eagain when no data is available."
12397                         ;;
12398                 esac
12399                 status=`$cat try.err`
12400                 case "$status" in
12401                 0) echo "And it correctly returns 0 to signal EOF.";;
12402                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12403                 *) echo "However, your read() returns '$status' on EOF??";;
12404                 esac
12405                 val="$define"
12406                 if test "$status" = "$rd_nodata"; then
12407                         echo "WARNING: you can't distinguish between EOF and no data!"
12408                         val="$undef"
12409                 fi
12410         else
12411                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12412                 eagain=EAGAIN
12413         fi
12414         ;;
12415         *)      echo "Can't figure out how to test this--assuming errno EAGAIN will do."
12416                 eagain=EAGAIN
12417                 val="$define"
12418                 ;;
12419         esac
12420         set d_eofnblk
12421         eval $setvar
12422         ;;
12423 *)
12424         echo "Using $hint value $eagain."
12425         echo "Your read() returns $rd_nodata when no data is present."
12426         case "$d_eofnblk" in
12427         "$define") echo "And you can see EOF because read() returns 0.";;
12428         "$undef") echo "But you can't see EOF status from read() returned value.";;
12429         *)
12430                 echo "(Assuming you can't see EOF status from read anyway.)"
12431                 d_eofnblk=$undef
12432                 ;;
12433         esac
12434         ;;
12435 esac
12436 $rm_try head.c mtry
12437
12438 : see if _ptr and _cnt from stdio act std
12439 echo " "
12440
12441 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12442         echo "(Looks like you have stdio.h from BSD.)"
12443         case "$stdio_ptr" in
12444         '') stdio_ptr='((fp)->_p)'
12445                 ptr_lval=$define
12446                 ;;
12447         *)      ptr_lval=$d_stdio_ptr_lval;;
12448         esac
12449         case "$stdio_cnt" in
12450         '') stdio_cnt='((fp)->_r)'
12451                 cnt_lval=$define
12452                 ;;
12453         *)      cnt_lval=$d_stdio_cnt_lval;;
12454         esac
12455         case "$stdio_base" in
12456         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12457         esac
12458         case "$stdio_bufsiz" in
12459         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12460         esac
12461 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12462         echo "(Looks like you have stdio.h from Linux.)"
12463         case "$stdio_ptr" in
12464         '') stdio_ptr='((fp)->_IO_read_ptr)'
12465                 ptr_lval=$define
12466                 ;;
12467         *)      ptr_lval=$d_stdio_ptr_lval;;
12468         esac
12469         case "$stdio_cnt" in
12470         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12471                 cnt_lval=$undef
12472                 ;;
12473         *)      cnt_lval=$d_stdio_cnt_lval;;
12474         esac
12475         case "$stdio_base" in
12476         '') stdio_base='((fp)->_IO_read_base)';;
12477         esac
12478         case "$stdio_bufsiz" in
12479         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12480         esac
12481 else
12482         case "$stdio_ptr" in
12483         '') stdio_ptr='((fp)->_ptr)'
12484                 ptr_lval=$define
12485                 ;;
12486         *)      ptr_lval=$d_stdio_ptr_lval;;
12487         esac
12488         case "$stdio_cnt" in
12489         '') stdio_cnt='((fp)->_cnt)'
12490                 cnt_lval=$define
12491                 ;;
12492         *)      cnt_lval=$d_stdio_cnt_lval;;
12493         esac
12494         case "$stdio_base" in
12495         '') stdio_base='((fp)->_base)';;
12496         esac
12497         case "$stdio_bufsiz" in
12498         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12499         esac
12500 fi
12501
12502 : test whether _ptr and _cnt really work
12503 echo "Checking how std your stdio is..." >&4
12504 $cat >try.c <<EOP
12505 #include <stdio.h>
12506 #$i_stdlib I_STDLIB
12507 #ifdef I_STDLIB
12508 #include <stdlib.h>
12509 #endif
12510 #define FILE_ptr(fp)    $stdio_ptr
12511 #define FILE_cnt(fp)    $stdio_cnt
12512 int main() {
12513         FILE *fp = fopen("try.c", "r");
12514         char c = getc(fp);
12515         if (
12516                 18 <= FILE_cnt(fp) &&
12517                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12518         )
12519                 exit(0);
12520         exit(1);
12521 }
12522 EOP
12523 val="$undef"
12524 set try
12525 if eval $compile && $to try.c; then
12526         if $run ./try; then
12527                 echo "Your stdio acts pretty std."
12528                 val="$define"
12529         else
12530                 echo "Your stdio isn't very std."
12531         fi
12532 else
12533         echo "Your stdio doesn't appear very std."
12534 fi
12535 $rm_try
12536
12537 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12538 # direct buffer manipulation no longer works.  The Configure tests
12539 # should be changed to correctly detect this, but until then,
12540 # the following check should at least let perl compile and run.
12541 # (This quick fix should be updated before 5.8.1.)
12542 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12543 # A. Dougherty, June 3, 2002.
12544 case "$d_gnulibc" in
12545 $define)
12546         case "$gnulibc_version" in
12547         2.[01]*)  ;;
12548         2.2) ;;
12549         2.2.[0-9]) ;;
12550         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12551                 val="$undef"
12552                 ;;
12553         esac
12554         ;;
12555 esac
12556 set d_stdstdio
12557 eval $setvar
12558
12559 : Can _ptr be used as an lvalue?
12560 case "$d_stdstdio$ptr_lval" in
12561 $define$define) val=$define ;;
12562 *) val=$undef ;;
12563 esac
12564 set d_stdio_ptr_lval
12565 eval $setvar
12566
12567 : Can _cnt be used as an lvalue?
12568 case "$d_stdstdio$cnt_lval" in
12569 $define$define) val=$define ;;
12570 *) val=$undef ;;
12571 esac
12572 set d_stdio_cnt_lval
12573 eval $setvar
12574
12575
12576 : test whether setting _ptr sets _cnt as a side effect
12577 d_stdio_ptr_lval_sets_cnt="$undef"
12578 d_stdio_ptr_lval_nochange_cnt="$undef"
12579 case "$d_stdio_ptr_lval$d_stdstdio" in
12580 $define$define)
12581         echo "Checking to see what happens if we set the stdio ptr..." >&4
12582 $cat >try.c <<EOP
12583 #include <stdio.h>
12584 /* Can we scream? */
12585 /* Eat dust sed :-) */
12586 /* In the buffer space, no one can hear you scream. */
12587 #$i_stdlib I_STDLIB
12588 #ifdef I_STDLIB
12589 #include <stdlib.h>
12590 #endif
12591 #define FILE_ptr(fp)    $stdio_ptr
12592 #define FILE_cnt(fp)    $stdio_cnt
12593 #include <sys/types.h>
12594 int main() {
12595         FILE *fp = fopen("try.c", "r");
12596         int c;
12597         char *ptr;
12598         size_t cnt;
12599         if (!fp) {
12600             puts("Fail even to read");
12601             exit(1);
12602         }
12603         c = getc(fp); /* Read away the first # */
12604         if (c == EOF) {
12605             puts("Fail even to read");
12606             exit(1);
12607         }
12608         if (!(
12609                 18 <= FILE_cnt(fp) &&
12610                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12611         )) {
12612                 puts("Fail even to read");
12613                 exit (1);
12614         }
12615         ptr = (char*) FILE_ptr(fp);
12616         cnt = (size_t)FILE_cnt(fp);
12617
12618         FILE_ptr(fp) += 42;
12619
12620         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12621                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12622                 exit (1);
12623         }
12624         if (FILE_cnt(fp) <= 20) {
12625                 printf ("Fail (<20 chars to test)");
12626                 exit (1);
12627         }
12628         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12629                 puts("Fail compare");
12630                 exit (1);
12631         }
12632         if (cnt == FILE_cnt(fp)) {
12633                 puts("Pass_unchanged");
12634                 exit (0);
12635         }
12636         if (FILE_cnt(fp) == (cnt - 42)) {
12637                 puts("Pass_changed");
12638                 exit (0);
12639         }
12640         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12641         return 1;
12642
12643 }
12644 EOP
12645         set try
12646         if eval $compile && $to try.c; then
12647                 case `$run ./try` in
12648                 Pass_changed)
12649                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12650                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12651                 Pass_unchanged)
12652                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12653                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12654                 Fail*)
12655                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12656                 *)
12657                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12658         esac
12659         else
12660                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12661         fi
12662         $rm_try
12663         ;;
12664 esac
12665
12666 : see if _base is also standard
12667 val="$undef"
12668 case "$d_stdstdio" in
12669 $define)
12670         $cat >try.c <<EOP
12671 #include <stdio.h>
12672 #$i_stdlib I_STDLIB
12673 #ifdef I_STDLIB
12674 #include <stdlib.h>
12675 #endif
12676 #define FILE_base(fp)   $stdio_base
12677 #define FILE_bufsiz(fp) $stdio_bufsiz
12678 int main() {
12679         FILE *fp = fopen("try.c", "r");
12680         char c = getc(fp);
12681         if (
12682                 19 <= FILE_bufsiz(fp) &&
12683                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12684         )
12685                 exit(0);
12686         exit(1);
12687 }
12688 EOP
12689         set try
12690         if eval $compile && $to try.c; then
12691                 if $run ./try; then
12692                         echo "And its _base field acts std."
12693                         val="$define"
12694                 else
12695                         echo "But its _base field isn't std."
12696                 fi
12697         else
12698                 echo "However, it seems to be lacking the _base field."
12699         fi
12700         $rm_try
12701         ;;
12702 esac
12703 set d_stdiobase
12704 eval $setvar
12705
12706 : see if fast_stdio exists
12707 val="$undef"
12708 case "$d_stdstdio:$d_stdio_ptr_lval" in
12709 "$define:$define")
12710         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12711         *$define*)
12712                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12713                 val="$define"
12714                 ;;
12715         esac
12716         ;;
12717 esac
12718 set d_faststdio
12719 eval $setvar
12720
12721
12722
12723 : see if fchdir exists
12724 set fchdir d_fchdir
12725 eval $inlibc
12726
12727 : see if fchmod exists
12728 set fchmod d_fchmod
12729 eval $inlibc
12730
12731 : see if fchown exists
12732 set fchown d_fchown
12733 eval $inlibc
12734
12735 : see if this is an fcntl system
12736 set fcntl d_fcntl
12737 eval $inlibc
12738
12739 echo " "
12740 : See if fcntl-based locking works.
12741 $cat >try.c <<EOCP
12742 #$i_stdlib I_STDLIB
12743 #ifdef I_STDLIB
12744 #include <stdlib.h>
12745 #endif
12746 #include <unistd.h>
12747 #include <fcntl.h>
12748 #include <signal.h>
12749 $signal_t blech(int x) { exit(3); }
12750 int main() {
12751 #if defined(F_SETLK) && defined(F_SETLKW)
12752      struct flock flock;
12753      int retval, fd;
12754      fd = open("try.c", O_RDONLY);
12755      flock.l_type = F_RDLCK;
12756      flock.l_whence = SEEK_SET;
12757      flock.l_start = flock.l_len = 0;
12758      signal(SIGALRM, blech);
12759      alarm(10);
12760      retval = fcntl(fd, F_SETLK, &flock);
12761      close(fd);
12762      (retval < 0 ? exit(2) : exit(0));
12763 #else
12764      exit(2);
12765 #endif
12766 }
12767 EOCP
12768 echo "Checking if fcntl-based file locking works... "
12769 case "$d_fcntl" in
12770 "$define")
12771         set try
12772         if eval $compile_ok; then
12773                 if $run ./try; then
12774                         echo "Yes, it seems to work."
12775                         val="$define"
12776                 else
12777                         echo "Nope, it didn't work."
12778                         val="$undef"
12779                         case "$?" in
12780                         3) $cat >&4 <<EOM
12781 ***
12782 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12783 *** This is (almost) impossible.
12784 *** If your NFS lock daemons are not feeling well, something like
12785 *** this may happen, please investigate.  Cannot continue, aborting.
12786 ***
12787 EOM
12788                                 exit 1
12789                                 ;;
12790                         esac
12791                 fi
12792         else
12793                 echo "I'm unable to compile the test program, so I'll assume not."
12794                 val="$undef"
12795         fi
12796         ;;
12797 *) val="$undef";
12798         echo "Nope, since you don't even have fcntl()."
12799         ;;
12800 esac
12801 set d_fcntl_can_lock
12802 eval $setvar
12803 $rm_try
12804
12805 : check for fd_set items
12806 $cat <<EOM
12807
12808 Checking to see how well your C compiler handles fd_set and friends ...
12809 EOM
12810 $cat >try.c <<EOCP
12811 #$i_stdlib I_STDLIB
12812 #ifdef I_STDLIB
12813 #include <stdlib.h>
12814 #endif
12815 #$i_systime I_SYS_TIME
12816 #$i_sysselct I_SYS_SELECT
12817 #$d_socket HAS_SOCKET
12818 #include <sys/types.h>
12819 #ifdef HAS_SOCKET
12820 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12821 #endif
12822 #ifdef I_SYS_TIME
12823 #include <sys/time.h>
12824 #endif
12825 #ifdef I_SYS_SELECT
12826 #include <sys/select.h>
12827 #endif
12828 int main() {
12829         fd_set fds;
12830
12831 #ifdef TRYBITS
12832         if(fds.fds_bits);
12833 #endif
12834
12835 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12836         exit(0);
12837 #else
12838         exit(1);
12839 #endif
12840 }
12841 EOCP
12842 set try -DTRYBITS
12843 if eval $compile; then
12844         d_fds_bits="$define"
12845         d_fd_set="$define"
12846         echo "Well, your system knows about the normal fd_set typedef..." >&4
12847         if $run ./try; then
12848                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12849                 d_fd_macros="$define"
12850         else
12851                 $cat >&4 <<'EOM'
12852 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12853 EOM
12854                 d_fd_macros="$undef"
12855         fi
12856 else
12857         $cat <<'EOM'
12858 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12859 EOM
12860         set try
12861         if eval $compile; then
12862                 d_fds_bits="$undef"
12863                 d_fd_set="$define"
12864                 echo "Well, your system has some sort of fd_set available..." >&4
12865                 if $run ./try; then
12866                         echo "and you have the normal fd_set macros." >&4
12867                         d_fd_macros="$define"
12868                 else
12869                         $cat <<'EOM'
12870 but not the normal fd_set macros!  Gross!  More work for me...
12871 EOM
12872                         d_fd_macros="$undef"
12873                 fi
12874         else
12875         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12876                 d_fd_set="$undef"
12877                 d_fds_bits="$undef"
12878                 d_fd_macros="$undef"
12879         fi
12880 fi
12881 $rm_try
12882
12883 : see if fgetpos exists
12884 set fgetpos d_fgetpos
12885 eval $inlibc
12886
12887 : see if finite exists
12888 set finite d_finite
12889 eval $inlibc
12890
12891 : see if finitel exists
12892 set finitel d_finitel
12893 eval $inlibc
12894
12895 : see if flock exists
12896 set flock d_flock
12897 eval $inlibc
12898
12899 : see if prototype for flock is available
12900 echo " "
12901 set d_flockproto flock $i_sysfile sys/file.h
12902 eval $hasproto
12903
12904 : see if fp_class exists
12905 set fp_class d_fp_class
12906 eval $inlibc
12907
12908 : see if pathconf exists
12909 set pathconf d_pathconf
12910 eval $inlibc
12911
12912 : see if fpathconf exists
12913 set fpathconf d_fpathconf
12914 eval $inlibc
12915
12916 : see if fpclass exists
12917 set fpclass d_fpclass
12918 eval $inlibc
12919
12920 : see if fpclassify exists
12921 set fpclassify d_fpclassify
12922 eval $inlibc
12923
12924 : see if fpclassl exists
12925 set fpclassl d_fpclassl
12926 eval $inlibc
12927
12928
12929 : check for fpos64_t
12930 echo " "
12931 echo "Checking to see if you have fpos64_t..." >&4
12932 $cat >try.c <<EOCP
12933 #include <stdio.h>
12934 int main() { fpos64_t x = 7; }
12935 EOCP
12936 set try
12937 if eval $compile; then
12938         val="$define"
12939         echo "You have fpos64_t."
12940 else
12941         val="$undef"
12942         echo "You do not have fpos64_t."
12943         case "$fpossize" in
12944         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12945         esac
12946 fi
12947 $rm_try
12948 set d_fpos64_t
12949 eval $setvar
12950
12951 : see if frexpl exists
12952 set frexpl d_frexpl
12953 eval $inlibc
12954
12955 : see if this is a sys/param system
12956 set sys/param.h i_sysparam
12957 eval $inhdr
12958
12959 : see if this is a sys/mount.h system
12960 set sys/mount.h i_sysmount
12961 eval $inhdr
12962
12963
12964 echo " "
12965 echo "Checking to see if your system supports struct fs_data..." >&4
12966 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12967 eval $hasstruct
12968 case "$d_fs_data_s" in
12969 "$define")      echo "Yes, it does."   ;;
12970 *)              echo "No, it doesn't." ;;
12971 esac
12972
12973 : see if fseeko exists
12974 set fseeko d_fseeko
12975 eval $inlibc
12976 case "$longsize" in
12977 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12978 esac
12979
12980 : see if fsetpos exists
12981 set fsetpos d_fsetpos
12982 eval $inlibc
12983
12984
12985 : see if fstatfs exists
12986 set fstatfs d_fstatfs
12987 eval $inlibc
12988
12989
12990 : see if statvfs exists
12991 set statvfs d_statvfs
12992 eval $inlibc
12993
12994 : see if fstatvfs exists
12995 set fstatvfs d_fstatvfs
12996 eval $inlibc
12997
12998
12999 : see if fsync exists
13000 set fsync d_fsync
13001 eval $inlibc
13002
13003 : see if ftello exists
13004 set ftello d_ftello
13005 eval $inlibc
13006 case "$longsize" in
13007 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
13008 esac
13009
13010 d_futimes="$undef"
13011 : check for a working futimes
13012 echo " "
13013 echo "Checking if you have a working futimes()" >&4
13014 $cat >try.c <<EOCP
13015 #include <stdio.h>
13016 #include <sys/time.h>
13017 #include <errno.h>
13018 #include <fcntl.h>
13019
13020 int main ()
13021 {
13022     int fd, rv;
13023     fd = open ("try.c", O_RDWR);
13024     if (-1 == fd) exit (1);
13025     rv = futimes (fd, NULL);
13026     exit (rv == -1 ? errno : 0);
13027 }
13028 EOCP
13029 set try
13030 if eval $compile; then
13031     `$run ./try`
13032     rc=$?
13033     case "$rc" in
13034         0)  echo "Yes, you have" >&4
13035             d_futimes="$define"
13036             ;;
13037         *)  echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4
13038             ;;
13039     esac
13040 else
13041     echo "No, it does not (probably harmless)" >&4
13042 fi
13043 $rm_try
13044
13045 : see if getcwd exists
13046 set getcwd d_getcwd
13047 eval $inlibc
13048
13049 : see if getespwnam exists
13050 set getespwnam d_getespwnam
13051 eval $inlibc
13052
13053
13054 : see if getfsstat exists
13055 set getfsstat d_getfsstat
13056 eval $inlibc
13057
13058 : see if getgrent exists
13059 set getgrent d_getgrent
13060 eval $inlibc
13061
13062 : see if getgrent_r exists
13063 set getgrent_r d_getgrent_r
13064 eval $inlibc
13065 case "$d_getgrent_r" in
13066 "$define")
13067         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13068         case "$d_getgrent_r_proto:$usethreads" in
13069         ":define")      d_getgrent_r_proto=define
13070                 set d_getgrent_r_proto getgrent_r $hdrs
13071                 eval $hasproto ;;
13072         *)      ;;
13073         esac
13074         case "$d_getgrent_r_proto" in
13075         define)
13076         case "$getgrent_r_proto" in
13077         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13078         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13079         esac
13080         case "$getgrent_r_proto" in
13081         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13082         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13083         esac
13084         case "$getgrent_r_proto" in
13085         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13086         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13087         esac
13088         case "$getgrent_r_proto" in
13089         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13090         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13091         esac
13092         case "$getgrent_r_proto" in
13093         ''|0) try='int getgrent_r(struct group*, char*, int);'
13094         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13095         esac
13096         case "$getgrent_r_proto" in
13097         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13098         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13099         esac
13100         case "$getgrent_r_proto" in
13101         ''|0)   d_getgrent_r=undef
13102                 getgrent_r_proto=0
13103                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13104         * )     case "$getgrent_r_proto" in
13105                 REENTRANT_PROTO*) ;;
13106                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13107                 esac
13108                 echo "Prototype: $try" ;;
13109         esac
13110         ;;
13111         *)      case "$usethreads" in
13112                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13113                 esac
13114                 d_getgrent_r=undef
13115                 getgrent_r_proto=0
13116                 ;;
13117         esac
13118         ;;
13119 *)      getgrent_r_proto=0
13120         ;;
13121 esac
13122
13123 : see if getgrgid_r exists
13124 set getgrgid_r d_getgrgid_r
13125 eval $inlibc
13126 case "$d_getgrgid_r" in
13127 "$define")
13128         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13129         case "$d_getgrgid_r_proto:$usethreads" in
13130         ":define")      d_getgrgid_r_proto=define
13131                 set d_getgrgid_r_proto getgrgid_r $hdrs
13132                 eval $hasproto ;;
13133         *)      ;;
13134         esac
13135         case "$d_getgrgid_r_proto" in
13136         define)
13137         case "$getgrgid_r_proto" in
13138         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13139         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13140         esac
13141         case "$getgrgid_r_proto" in
13142         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13143         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13144         esac
13145         case "$getgrgid_r_proto" in
13146         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13147         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13148         esac
13149         case "$getgrgid_r_proto" in
13150         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13151         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13152         esac
13153         case "$getgrgid_r_proto" in
13154         ''|0)   d_getgrgid_r=undef
13155                 getgrgid_r_proto=0
13156                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13157         * )     case "$getgrgid_r_proto" in
13158                 REENTRANT_PROTO*) ;;
13159                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13160                 esac
13161                 echo "Prototype: $try" ;;
13162         esac
13163         ;;
13164         *)      case "$usethreads" in
13165                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13166                 esac
13167                 d_getgrgid_r=undef
13168                 getgrgid_r_proto=0
13169                 ;;
13170         esac
13171         ;;
13172 *)      getgrgid_r_proto=0
13173         ;;
13174 esac
13175
13176 : see if getgrnam_r exists
13177 set getgrnam_r d_getgrnam_r
13178 eval $inlibc
13179 case "$d_getgrnam_r" in
13180 "$define")
13181         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13182         case "$d_getgrnam_r_proto:$usethreads" in
13183         ":define")      d_getgrnam_r_proto=define
13184                 set d_getgrnam_r_proto getgrnam_r $hdrs
13185                 eval $hasproto ;;
13186         *)      ;;
13187         esac
13188         case "$d_getgrnam_r_proto" in
13189         define)
13190         case "$getgrnam_r_proto" in
13191         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13192         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13193         esac
13194         case "$getgrnam_r_proto" in
13195         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13196         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13197         esac
13198         case "$getgrnam_r_proto" in
13199         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13200         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13201         esac
13202         case "$getgrnam_r_proto" in
13203         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13204         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13205         esac
13206         case "$getgrnam_r_proto" in
13207         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13208         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13209         esac
13210         case "$getgrnam_r_proto" in
13211         ''|0)   d_getgrnam_r=undef
13212                 getgrnam_r_proto=0
13213                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13214         * )     case "$getgrnam_r_proto" in
13215                 REENTRANT_PROTO*) ;;
13216                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13217                 esac
13218                 echo "Prototype: $try" ;;
13219         esac
13220         ;;
13221         *)      case "$usethreads" in
13222                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13223                 esac
13224                 d_getgrnam_r=undef
13225                 getgrnam_r_proto=0
13226                 ;;
13227         esac
13228         ;;
13229 *)      getgrnam_r_proto=0
13230         ;;
13231 esac
13232
13233 : see if gethostbyaddr exists
13234 set gethostbyaddr d_gethbyaddr
13235 eval $inlibc
13236
13237 : see if gethostbyname exists
13238 set gethostbyname d_gethbyname
13239 eval $inlibc
13240
13241 : see if gethostent exists
13242 set gethostent d_gethent
13243 eval $inlibc
13244
13245 : see how we will look up host name
13246 echo " "
13247 call=''
13248 if set gethostname val -f d_gethname; eval $csym; $val; then
13249         echo 'gethostname() found.' >&4
13250         d_gethname="$define"
13251         call=gethostname
13252 fi
13253 if set uname val -f d_uname; eval $csym; $val; then
13254         if ./xenix; then
13255                 $cat <<'EOM'
13256 uname() was found, but you're running xenix, and older versions of xenix
13257 have a broken uname(). If you don't really know whether your xenix is old
13258 enough to have a broken system call, use the default answer.
13259
13260 EOM
13261                 dflt=y
13262                 case "$d_uname" in
13263                 "$define") dflt=n;;
13264                 esac
13265                 rp='Is your uname() broken?'
13266                 . ./myread
13267                 case "$ans" in
13268                 n*) d_uname="$define"; call=uname;;
13269                 esac
13270         else
13271                 echo 'uname() found.' >&4
13272                 d_uname="$define"
13273                 case "$call" in
13274                 '') call=uname ;;
13275                 esac
13276         fi
13277 fi
13278 case "$d_gethname" in
13279 '') d_gethname="$undef";;
13280 esac
13281 case "$d_uname" in
13282 '') d_uname="$undef";;
13283 esac
13284 case "$d_uname$d_gethname" in
13285 *define*)
13286         dflt=n
13287         cat <<EOM
13288  
13289 Every now and then someone has a $call() that lies about the hostname
13290 but can't be fixed for political or economic reasons.  If you wish, I can
13291 pretend $call() isn't there and maybe compute hostname at run-time
13292 thanks to the '$phostname' command.
13293
13294 EOM
13295         rp="Shall I ignore $call() from now on?"
13296         . ./myread
13297         case "$ans" in
13298         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13299         esac;;
13300 esac
13301 case "$phostname" in
13302 '') aphostname='';;
13303 *) case "$aphostname" in
13304         /*) ;;
13305         *) set X $phostname
13306                 shift
13307                 file=$1
13308                 shift
13309                 file=`./loc $file $file $pth`
13310                 aphostname=`echo $file $*`
13311                 ;;
13312         esac
13313         ;;
13314 esac
13315 case "$d_uname$d_gethname" in
13316 *define*) ;;
13317 *)
13318         case "$phostname" in
13319         '')
13320                 echo "There will be no way for $package to get your hostname." >&4;;
13321         *)
13322         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13323                 ;;
13324         esac;;
13325 esac
13326 case "$d_phostname" in
13327 '') d_phostname="$undef";;
13328 esac
13329
13330 : see if gethostbyaddr_r exists
13331 set gethostbyaddr_r d_gethostbyaddr_r
13332 eval $inlibc
13333 case "$d_gethostbyaddr_r" in
13334 "$define")
13335         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13336         case "$d_gethostbyaddr_r_proto:$usethreads" in
13337         ":define")      d_gethostbyaddr_r_proto=define
13338                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13339                 eval $hasproto ;;
13340         *)      ;;
13341         esac
13342         case "$d_gethostbyaddr_r_proto" in
13343         define)
13344         case "$gethostbyaddr_r_proto" in
13345         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13346         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13347         esac
13348         case "$gethostbyaddr_r_proto" in
13349         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13350         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13351         esac
13352         case "$gethostbyaddr_r_proto" in
13353         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13354         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13355         esac
13356         case "$gethostbyaddr_r_proto" in
13357         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13358         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13359         esac
13360         case "$gethostbyaddr_r_proto" in
13361         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13362         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13363         esac
13364         case "$gethostbyaddr_r_proto" in
13365         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13366         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13367         esac
13368         case "$gethostbyaddr_r_proto" in
13369         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13370         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13371         esac
13372         case "$gethostbyaddr_r_proto" in
13373         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13374         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13375         esac
13376         case "$gethostbyaddr_r_proto" in
13377         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13378         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13379         esac
13380         case "$gethostbyaddr_r_proto" in
13381         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13382         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13383         esac
13384         case "$gethostbyaddr_r_proto" in
13385         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13386         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13387         esac
13388         case "$gethostbyaddr_r_proto" in
13389         ''|0)   d_gethostbyaddr_r=undef
13390                 gethostbyaddr_r_proto=0
13391                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13392         * )     case "$gethostbyaddr_r_proto" in
13393                 REENTRANT_PROTO*) ;;
13394                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13395                 esac
13396                 echo "Prototype: $try" ;;
13397         esac
13398         ;;
13399         *)      case "$usethreads" in
13400                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13401                 esac
13402                 d_gethostbyaddr_r=undef
13403                 gethostbyaddr_r_proto=0
13404                 ;;
13405         esac
13406         ;;
13407 *)      gethostbyaddr_r_proto=0
13408         ;;
13409 esac
13410
13411 : see if gethostbyname_r exists
13412 set gethostbyname_r d_gethostbyname_r
13413 eval $inlibc
13414 case "$d_gethostbyname_r" in
13415 "$define")
13416         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13417         case "$d_gethostbyname_r_proto:$usethreads" in
13418         ":define")      d_gethostbyname_r_proto=define
13419                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13420                 eval $hasproto ;;
13421         *)      ;;
13422         esac
13423         case "$d_gethostbyname_r_proto" in
13424         define)
13425         case "$gethostbyname_r_proto" in
13426         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13427         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13428         esac
13429         case "$gethostbyname_r_proto" in
13430         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13431         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13432         esac
13433         case "$gethostbyname_r_proto" in
13434         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13435         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13436         esac
13437         case "$gethostbyname_r_proto" in
13438         ''|0)   d_gethostbyname_r=undef
13439                 gethostbyname_r_proto=0
13440                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13441         * )     case "$gethostbyname_r_proto" in
13442                 REENTRANT_PROTO*) ;;
13443                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13444                 esac
13445                 echo "Prototype: $try" ;;
13446         esac
13447         ;;
13448         *)      case "$usethreads" in
13449                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13450                 esac
13451                 d_gethostbyname_r=undef
13452                 gethostbyname_r_proto=0
13453                 ;;
13454         esac
13455         ;;
13456 *)      gethostbyname_r_proto=0
13457         ;;
13458 esac
13459
13460 : see if gethostent_r exists
13461 set gethostent_r d_gethostent_r
13462 eval $inlibc
13463 case "$d_gethostent_r" in
13464 "$define")
13465         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13466         case "$d_gethostent_r_proto:$usethreads" in
13467         ":define")      d_gethostent_r_proto=define
13468                 set d_gethostent_r_proto gethostent_r $hdrs
13469                 eval $hasproto ;;
13470         *)      ;;
13471         esac
13472         case "$d_gethostent_r_proto" in
13473         define)
13474         case "$gethostent_r_proto" in
13475         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13476         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13477         esac
13478         case "$gethostent_r_proto" in
13479         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13480         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13481         esac
13482         case "$gethostent_r_proto" in
13483         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13484         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13485         esac
13486         case "$gethostent_r_proto" in
13487         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13488         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13489         esac
13490         case "$gethostent_r_proto" in
13491         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13492         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13493         esac
13494         case "$gethostent_r_proto" in
13495         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13496         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13497         esac
13498         case "$gethostent_r_proto" in
13499         ''|0)   d_gethostent_r=undef
13500                 gethostent_r_proto=0
13501                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13502         * )     case "$gethostent_r_proto" in
13503                 REENTRANT_PROTO*) ;;
13504                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13505                 esac
13506                 echo "Prototype: $try" ;;
13507         esac
13508         ;;
13509         *)      case "$usethreads" in
13510                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13511                 esac
13512                 d_gethostent_r=undef
13513                 gethostent_r_proto=0
13514                 ;;
13515         esac
13516         ;;
13517 *)      gethostent_r_proto=0
13518         ;;
13519 esac
13520
13521 : see if prototypes for various gethostxxx netdb.h functions are available
13522 echo " "
13523 set d_gethostprotos gethostent $i_netdb netdb.h
13524 eval $hasproto
13525
13526 : see if getitimer exists
13527 set getitimer d_getitimer
13528 eval $inlibc
13529
13530 : see if getlogin exists
13531 set getlogin d_getlogin
13532 eval $inlibc
13533
13534 : see if getlogin_r exists
13535 set getlogin_r d_getlogin_r
13536 eval $inlibc
13537 case "$d_getlogin_r" in
13538 "$define")
13539         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13540         case "$d_getlogin_r_proto:$usethreads" in
13541         ":define")      d_getlogin_r_proto=define
13542                 set d_getlogin_r_proto getlogin_r $hdrs
13543                 eval $hasproto ;;
13544         *)      ;;
13545         esac
13546         case "$d_getlogin_r_proto" in
13547         define)
13548         case "$getlogin_r_proto" in
13549         ''|0) try='int getlogin_r(char*, size_t);'
13550         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13551         esac
13552         case "$getlogin_r_proto" in
13553         ''|0) try='int getlogin_r(char*, int);'
13554         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13555         esac
13556         case "$getlogin_r_proto" in
13557         ''|0) try='char* getlogin_r(char*, size_t);'
13558         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13559         esac
13560         case "$getlogin_r_proto" in
13561         ''|0) try='char* getlogin_r(char*, int);'
13562         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13563         esac
13564         case "$getlogin_r_proto" in
13565         ''|0)   d_getlogin_r=undef
13566                 getlogin_r_proto=0
13567                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13568         * )     case "$getlogin_r_proto" in
13569                 REENTRANT_PROTO*) ;;
13570                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13571                 esac
13572                 echo "Prototype: $try" ;;
13573         esac
13574         ;;
13575         *)      case "$usethreads" in
13576                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13577                 esac
13578                 d_getlogin_r=undef
13579                 getlogin_r_proto=0
13580                 ;;
13581         esac
13582         ;;
13583 *)      getlogin_r_proto=0
13584         ;;
13585 esac
13586
13587 : see if getmnt exists
13588 set getmnt d_getmnt
13589 eval $inlibc
13590
13591 : see if getmntent exists
13592 set getmntent d_getmntent
13593 eval $inlibc
13594
13595 : see if getnetbyaddr exists
13596 set getnetbyaddr d_getnbyaddr
13597 eval $inlibc
13598
13599 : see if getnetbyname exists
13600 set getnetbyname d_getnbyname
13601 eval $inlibc
13602
13603 : see if getnetent exists
13604 set getnetent d_getnent
13605 eval $inlibc
13606
13607 : see if getnetbyaddr_r exists
13608 set getnetbyaddr_r d_getnetbyaddr_r
13609 eval $inlibc
13610 case "$d_getnetbyaddr_r" in
13611 "$define")
13612         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13613         case "$d_getnetbyaddr_r_proto:$usethreads" in
13614         ":define")      d_getnetbyaddr_r_proto=define
13615                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13616                 eval $hasproto ;;
13617         *)      ;;
13618         esac
13619         case "$d_getnetbyaddr_r_proto" in
13620         define)
13621         case "$getnetbyaddr_r_proto" in
13622         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13623         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13624         esac
13625         case "$getnetbyaddr_r_proto" in
13626         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13627         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13628         esac
13629         case "$getnetbyaddr_r_proto" in
13630         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13631         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13632         esac
13633         case "$getnetbyaddr_r_proto" in
13634         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13635         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13636         esac
13637         case "$getnetbyaddr_r_proto" in
13638         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13639         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13640         esac
13641         case "$getnetbyaddr_r_proto" in
13642         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13643         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13644         esac
13645         case "$getnetbyaddr_r_proto" in
13646         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13647         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13648         esac
13649         case "$getnetbyaddr_r_proto" in
13650         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13651         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13652         esac
13653         case "$getnetbyaddr_r_proto" in
13654         ''|0)   d_getnetbyaddr_r=undef
13655                 getnetbyaddr_r_proto=0
13656                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13657         * )     case "$getnetbyaddr_r_proto" in
13658                 REENTRANT_PROTO*) ;;
13659                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13660                 esac
13661                 echo "Prototype: $try" ;;
13662         esac
13663         ;;
13664         *)      case "$usethreads" in
13665                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13666                 esac
13667                 d_getnetbyaddr_r=undef
13668                 getnetbyaddr_r_proto=0
13669                 ;;
13670         esac
13671         ;;
13672 *)      getnetbyaddr_r_proto=0
13673         ;;
13674 esac
13675
13676 : see if getnetbyname_r exists
13677 set getnetbyname_r d_getnetbyname_r
13678 eval $inlibc
13679 case "$d_getnetbyname_r" in
13680 "$define")
13681         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13682         case "$d_getnetbyname_r_proto:$usethreads" in
13683         ":define")      d_getnetbyname_r_proto=define
13684                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13685                 eval $hasproto ;;
13686         *)      ;;
13687         esac
13688         case "$d_getnetbyname_r_proto" in
13689         define)
13690         case "$getnetbyname_r_proto" in
13691         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13692         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13693         esac
13694         case "$getnetbyname_r_proto" in
13695         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13696         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13697         esac
13698         case "$getnetbyname_r_proto" in
13699         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13700         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13701         esac
13702         case "$getnetbyname_r_proto" in
13703         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13704         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13705         esac
13706         case "$getnetbyname_r_proto" in
13707         ''|0)   d_getnetbyname_r=undef
13708                 getnetbyname_r_proto=0
13709                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13710         * )     case "$getnetbyname_r_proto" in
13711                 REENTRANT_PROTO*) ;;
13712                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13713                 esac
13714                 echo "Prototype: $try" ;;
13715         esac
13716         ;;
13717         *)      case "$usethreads" in
13718                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13719                 esac
13720                 d_getnetbyname_r=undef
13721                 getnetbyname_r_proto=0
13722                 ;;
13723         esac
13724         ;;
13725 *)      getnetbyname_r_proto=0
13726         ;;
13727 esac
13728
13729 : see if getnetent_r exists
13730 set getnetent_r d_getnetent_r
13731 eval $inlibc
13732 case "$d_getnetent_r" in
13733 "$define")
13734         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13735         case "$d_getnetent_r_proto:$usethreads" in
13736         ":define")      d_getnetent_r_proto=define
13737                 set d_getnetent_r_proto getnetent_r $hdrs
13738                 eval $hasproto ;;
13739         *)      ;;
13740         esac
13741         case "$d_getnetent_r_proto" in
13742         define)
13743         case "$getnetent_r_proto" in
13744         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13745         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13746         esac
13747         case "$getnetent_r_proto" in
13748         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13749         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13750         esac
13751         case "$getnetent_r_proto" in
13752         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13753         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13754         esac
13755         case "$getnetent_r_proto" in
13756         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13757         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13758         esac
13759         case "$getnetent_r_proto" in
13760         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13761         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13762         esac
13763         case "$getnetent_r_proto" in
13764         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13765         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13766         esac
13767         case "$getnetent_r_proto" in
13768         ''|0)   d_getnetent_r=undef
13769                 getnetent_r_proto=0
13770                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13771         * )     case "$getnetent_r_proto" in
13772                 REENTRANT_PROTO*) ;;
13773                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13774                 esac
13775                 echo "Prototype: $try" ;;
13776         esac
13777         ;;
13778         *)      case "$usethreads" in
13779                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13780                 esac
13781                 d_getnetent_r=undef
13782                 getnetent_r_proto=0
13783                 ;;
13784         esac
13785         ;;
13786 *)      getnetent_r_proto=0
13787         ;;
13788 esac
13789
13790 : see if prototypes for various getnetxxx netdb.h functions are available
13791 echo " "
13792 set d_getnetprotos getnetent $i_netdb netdb.h
13793 eval $hasproto
13794
13795 : see if getpagesize exists
13796 set getpagesize d_getpagsz
13797 eval $inlibc
13798
13799
13800 : see if getprotobyname exists
13801 set getprotobyname d_getpbyname
13802 eval $inlibc
13803
13804 : see if getprotobynumber exists
13805 set getprotobynumber d_getpbynumber
13806 eval $inlibc
13807
13808 : see if getprotoent exists
13809 set getprotoent d_getpent
13810 eval $inlibc
13811
13812 : see if getpgid exists
13813 set getpgid d_getpgid
13814 eval $inlibc
13815
13816 : see if getpgrp2 exists
13817 set getpgrp2 d_getpgrp2
13818 eval $inlibc
13819
13820 : see if getppid exists
13821 set getppid d_getppid
13822 eval $inlibc
13823
13824 : see if getpriority exists
13825 set getpriority d_getprior
13826 eval $inlibc
13827
13828 : see if getprotobyname_r exists
13829 set getprotobyname_r d_getprotobyname_r
13830 eval $inlibc
13831 case "$d_getprotobyname_r" in
13832 "$define")
13833         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13834         case "$d_getprotobyname_r_proto:$usethreads" in
13835         ":define")      d_getprotobyname_r_proto=define
13836                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13837                 eval $hasproto ;;
13838         *)      ;;
13839         esac
13840         case "$d_getprotobyname_r_proto" in
13841         define)
13842         case "$getprotobyname_r_proto" in
13843         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13844         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13845         esac
13846         case "$getprotobyname_r_proto" in
13847         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13848         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13849         esac
13850         case "$getprotobyname_r_proto" in
13851         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13852         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13853         esac
13854         case "$getprotobyname_r_proto" in
13855         ''|0)   d_getprotobyname_r=undef
13856                 getprotobyname_r_proto=0
13857                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13858         * )     case "$getprotobyname_r_proto" in
13859                 REENTRANT_PROTO*) ;;
13860                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13861                 esac
13862                 echo "Prototype: $try" ;;
13863         esac
13864         ;;
13865         *)      case "$usethreads" in
13866                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13867                 esac
13868                 d_getprotobyname_r=undef
13869                 getprotobyname_r_proto=0
13870                 ;;
13871         esac
13872         ;;
13873 *)      getprotobyname_r_proto=0
13874         ;;
13875 esac
13876
13877 : see if getprotobynumber_r exists
13878 set getprotobynumber_r d_getprotobynumber_r
13879 eval $inlibc
13880 case "$d_getprotobynumber_r" in
13881 "$define")
13882         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13883         case "$d_getprotobynumber_r_proto:$usethreads" in
13884         ":define")      d_getprotobynumber_r_proto=define
13885                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13886                 eval $hasproto ;;
13887         *)      ;;
13888         esac
13889         case "$d_getprotobynumber_r_proto" in
13890         define)
13891         case "$getprotobynumber_r_proto" in
13892         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13893         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13894         esac
13895         case "$getprotobynumber_r_proto" in
13896         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13897         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13898         esac
13899         case "$getprotobynumber_r_proto" in
13900         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13901         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13902         esac
13903         case "$getprotobynumber_r_proto" in
13904         ''|0)   d_getprotobynumber_r=undef
13905                 getprotobynumber_r_proto=0
13906                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13907         * )     case "$getprotobynumber_r_proto" in
13908                 REENTRANT_PROTO*) ;;
13909                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13910                 esac
13911                 echo "Prototype: $try" ;;
13912         esac
13913         ;;
13914         *)      case "$usethreads" in
13915                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13916                 esac
13917                 d_getprotobynumber_r=undef
13918                 getprotobynumber_r_proto=0
13919                 ;;
13920         esac
13921         ;;
13922 *)      getprotobynumber_r_proto=0
13923         ;;
13924 esac
13925
13926 : see if getprotoent_r exists
13927 set getprotoent_r d_getprotoent_r
13928 eval $inlibc
13929 case "$d_getprotoent_r" in
13930 "$define")
13931         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13932         case "$d_getprotoent_r_proto:$usethreads" in
13933         ":define")      d_getprotoent_r_proto=define
13934                 set d_getprotoent_r_proto getprotoent_r $hdrs
13935                 eval $hasproto ;;
13936         *)      ;;
13937         esac
13938         case "$d_getprotoent_r_proto" in
13939         define)
13940         case "$getprotoent_r_proto" in
13941         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13942         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13943         esac
13944         case "$getprotoent_r_proto" in
13945         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13946         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13947         esac
13948         case "$getprotoent_r_proto" in
13949         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13950         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13951         esac
13952         case "$getprotoent_r_proto" in
13953         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13954         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13955         esac
13956         case "$getprotoent_r_proto" in
13957         ''|0)   d_getprotoent_r=undef
13958                 getprotoent_r_proto=0
13959                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13960         * )     case "$getprotoent_r_proto" in
13961                 REENTRANT_PROTO*) ;;
13962                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13963                 esac
13964                 echo "Prototype: $try" ;;
13965         esac
13966         ;;
13967         *)      case "$usethreads" in
13968                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13969                 esac
13970                 d_getprotoent_r=undef
13971                 getprotoent_r_proto=0
13972                 ;;
13973         esac
13974         ;;
13975 *)      getprotoent_r_proto=0
13976         ;;
13977 esac
13978
13979 : see if prototypes for various getprotoxxx netdb.h functions are available
13980 echo " "
13981 set d_getprotoprotos getprotoent $i_netdb netdb.h
13982 eval $hasproto
13983
13984 : see if getprpwnam exists
13985 set getprpwnam d_getprpwnam
13986 eval $inlibc
13987
13988 : see if getpwent exists
13989 set getpwent d_getpwent
13990 eval $inlibc
13991
13992 : see if getpwent_r exists
13993 set getpwent_r d_getpwent_r
13994 eval $inlibc
13995 case "$d_getpwent_r" in
13996 "$define")
13997         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13998         case "$d_getpwent_r_proto:$usethreads" in
13999         ":define")      d_getpwent_r_proto=define
14000                 set d_getpwent_r_proto getpwent_r $hdrs
14001                 eval $hasproto ;;
14002         *)      ;;
14003         esac
14004         case "$d_getpwent_r_proto" in
14005         define)
14006         case "$getpwent_r_proto" in
14007         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
14008         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
14009         esac
14010         case "$getpwent_r_proto" in
14011         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
14012         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
14013         esac
14014         case "$getpwent_r_proto" in
14015         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
14016         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
14017         esac
14018         case "$getpwent_r_proto" in
14019         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
14020         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
14021         esac
14022         case "$getpwent_r_proto" in
14023         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
14024         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
14025         esac
14026         case "$getpwent_r_proto" in
14027         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
14028         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
14029         esac
14030         case "$getpwent_r_proto" in
14031         ''|0)   d_getpwent_r=undef
14032                 getpwent_r_proto=0
14033                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
14034         * )     case "$getpwent_r_proto" in
14035                 REENTRANT_PROTO*) ;;
14036                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
14037                 esac
14038                 echo "Prototype: $try" ;;
14039         esac
14040         ;;
14041         *)      case "$usethreads" in
14042                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
14043                 esac
14044                 d_getpwent_r=undef
14045                 getpwent_r_proto=0
14046                 ;;
14047         esac
14048         ;;
14049 *)      getpwent_r_proto=0
14050         ;;
14051 esac
14052
14053 : see if getpwnam_r exists
14054 set getpwnam_r d_getpwnam_r
14055 eval $inlibc
14056 case "$d_getpwnam_r" in
14057 "$define")
14058         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14059         case "$d_getpwnam_r_proto:$usethreads" in
14060         ":define")      d_getpwnam_r_proto=define
14061                 set d_getpwnam_r_proto getpwnam_r $hdrs
14062                 eval $hasproto ;;
14063         *)      ;;
14064         esac
14065         case "$d_getpwnam_r_proto" in
14066         define)
14067         case "$getpwnam_r_proto" in
14068         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
14069         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
14070         esac
14071         case "$getpwnam_r_proto" in
14072         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14073         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14074         esac
14075         case "$getpwnam_r_proto" in
14076         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14077         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14078         esac
14079         case "$getpwnam_r_proto" in
14080         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14081         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14082         esac
14083         case "$getpwnam_r_proto" in
14084         ''|0)   d_getpwnam_r=undef
14085                 getpwnam_r_proto=0
14086                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14087         * )     case "$getpwnam_r_proto" in
14088                 REENTRANT_PROTO*) ;;
14089                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14090                 esac
14091                 echo "Prototype: $try" ;;
14092         esac
14093         ;;
14094         *)      case "$usethreads" in
14095                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14096                 esac
14097                 d_getpwnam_r=undef
14098                 getpwnam_r_proto=0
14099                 ;;
14100         esac
14101         ;;
14102 *)      getpwnam_r_proto=0
14103         ;;
14104 esac
14105
14106 : see if getpwuid_r exists
14107 set getpwuid_r d_getpwuid_r
14108 eval $inlibc
14109 case "$d_getpwuid_r" in
14110 "$define")
14111         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14112         case "$d_getpwuid_r_proto:$usethreads" in
14113         ":define")      d_getpwuid_r_proto=define
14114                 set d_getpwuid_r_proto getpwuid_r $hdrs
14115                 eval $hasproto ;;
14116         *)      ;;
14117         esac
14118         case "$d_getpwuid_r_proto" in
14119         define)
14120         case "$getpwuid_r_proto" in
14121         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14122         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14123         esac
14124         case "$getpwuid_r_proto" in
14125         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14126         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14127         esac
14128         case "$getpwuid_r_proto" in
14129         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14130         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14131         esac
14132         case "$getpwuid_r_proto" in
14133         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14134         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14135         esac
14136         case "$getpwuid_r_proto" in
14137         ''|0)   d_getpwuid_r=undef
14138                 getpwuid_r_proto=0
14139                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14140         * )     case "$getpwuid_r_proto" in
14141                 REENTRANT_PROTO*) ;;
14142                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14143                 esac
14144                 echo "Prototype: $try" ;;
14145         esac
14146         ;;
14147         *)      case "$usethreads" in
14148                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14149                 esac
14150                 d_getpwuid_r=undef
14151                 getpwuid_r_proto=0
14152                 ;;
14153         esac
14154         ;;
14155 *)      getpwuid_r_proto=0
14156         ;;
14157 esac
14158
14159
14160 : see if getservbyname exists
14161 set getservbyname d_getsbyname
14162 eval $inlibc
14163
14164 : see if getservbyport exists
14165 set getservbyport d_getsbyport
14166 eval $inlibc
14167
14168 : see if getservent exists
14169 set getservent d_getsent
14170 eval $inlibc
14171
14172 : see if getservbyname_r exists
14173 set getservbyname_r d_getservbyname_r
14174 eval $inlibc
14175 case "$d_getservbyname_r" in
14176 "$define")
14177         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14178         case "$d_getservbyname_r_proto:$usethreads" in
14179         ":define")      d_getservbyname_r_proto=define
14180                 set d_getservbyname_r_proto getservbyname_r $hdrs
14181                 eval $hasproto ;;
14182         *)      ;;
14183         esac
14184         case "$d_getservbyname_r_proto" in
14185         define)
14186         case "$getservbyname_r_proto" in
14187         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14188         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14189         esac
14190         case "$getservbyname_r_proto" in
14191         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14192         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14193         esac
14194         case "$getservbyname_r_proto" in
14195         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14196         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14197         esac
14198         case "$getservbyname_r_proto" in
14199         ''|0)   d_getservbyname_r=undef
14200                 getservbyname_r_proto=0
14201                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14202         * )     case "$getservbyname_r_proto" in
14203                 REENTRANT_PROTO*) ;;
14204                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14205                 esac
14206                 echo "Prototype: $try" ;;
14207         esac
14208         ;;
14209         *)      case "$usethreads" in
14210                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14211                 esac
14212                 d_getservbyname_r=undef
14213                 getservbyname_r_proto=0
14214                 ;;
14215         esac
14216         ;;
14217 *)      getservbyname_r_proto=0
14218         ;;
14219 esac
14220
14221 : see if getservbyport_r exists
14222 set getservbyport_r d_getservbyport_r
14223 eval $inlibc
14224 case "$d_getservbyport_r" in
14225 "$define")
14226         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14227         case "$d_getservbyport_r_proto:$usethreads" in
14228         ":define")      d_getservbyport_r_proto=define
14229                 set d_getservbyport_r_proto getservbyport_r $hdrs
14230                 eval $hasproto ;;
14231         *)      ;;
14232         esac
14233         case "$d_getservbyport_r_proto" in
14234         define)
14235         case "$getservbyport_r_proto" in
14236         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14237         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14238         esac
14239         case "$getservbyport_r_proto" in
14240         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14241         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14242         esac
14243         case "$getservbyport_r_proto" in
14244         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14245         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14246         esac
14247         case "$getservbyport_r_proto" in
14248         ''|0)   d_getservbyport_r=undef
14249                 getservbyport_r_proto=0
14250                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14251         * )     case "$getservbyport_r_proto" in
14252                 REENTRANT_PROTO*) ;;
14253                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14254                 esac
14255                 echo "Prototype: $try" ;;
14256         esac
14257         ;;
14258         *)      case "$usethreads" in
14259                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14260                 esac
14261                 d_getservbyport_r=undef
14262                 getservbyport_r_proto=0
14263                 ;;
14264         esac
14265         ;;
14266 *)      getservbyport_r_proto=0
14267         ;;
14268 esac
14269
14270 : see if getservent_r exists
14271 set getservent_r d_getservent_r
14272 eval $inlibc
14273 case "$d_getservent_r" in
14274 "$define")
14275         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14276         case "$d_getservent_r_proto:$usethreads" in
14277         ":define")      d_getservent_r_proto=define
14278                 set d_getservent_r_proto getservent_r $hdrs
14279                 eval $hasproto ;;
14280         *)      ;;
14281         esac
14282         case "$d_getservent_r_proto" in
14283         define)
14284         case "$getservent_r_proto" in
14285         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14286         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14287         esac
14288         case "$getservent_r_proto" in
14289         ''|0) try='int getservent_r(struct servent*, char*, int);'
14290         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14291         esac
14292         case "$getservent_r_proto" in
14293         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14294         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14295         esac
14296         case "$getservent_r_proto" in
14297         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14298         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14299         esac
14300         case "$getservent_r_proto" in
14301         ''|0)   d_getservent_r=undef
14302                 getservent_r_proto=0
14303                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14304         * )     case "$getservent_r_proto" in
14305                 REENTRANT_PROTO*) ;;
14306                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14307                 esac
14308                 echo "Prototype: $try" ;;
14309         esac
14310         ;;
14311         *)      case "$usethreads" in
14312                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14313                 esac
14314                 d_getservent_r=undef
14315                 getservent_r_proto=0
14316                 ;;
14317         esac
14318         ;;
14319 *)      getservent_r_proto=0
14320         ;;
14321 esac
14322
14323 : see if prototypes for various getservxxx netdb.h functions are available
14324 echo " "
14325 set d_getservprotos getservent $i_netdb netdb.h
14326 eval $hasproto
14327
14328 : see if getspnam exists
14329 set getspnam d_getspnam
14330 eval $inlibc
14331
14332 : see if this is a shadow.h system
14333 set shadow.h i_shadow
14334 eval $inhdr
14335
14336 : see if getspnam_r exists
14337 set getspnam_r d_getspnam_r
14338 eval $inlibc
14339 case "$d_getspnam_r" in
14340 "$define")
14341         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14342         case "$d_getspnam_r_proto:$usethreads" in
14343         ":define")      d_getspnam_r_proto=define
14344                 set d_getspnam_r_proto getspnam_r $hdrs
14345                 eval $hasproto ;;
14346         *)      ;;
14347         esac
14348         case "$d_getspnam_r_proto" in
14349         define)
14350         case "$getspnam_r_proto" in
14351         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14352         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14353         esac
14354         case "$getspnam_r_proto" in
14355         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14356         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14357         esac
14358         case "$getspnam_r_proto" in
14359         ''|0)   d_getspnam_r=undef
14360                 getspnam_r_proto=0
14361                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14362         * )     case "$getspnam_r_proto" in
14363                 REENTRANT_PROTO*) ;;
14364                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14365                 esac
14366                 echo "Prototype: $try" ;;
14367         esac
14368         ;;
14369         *)      case "$usethreads" in
14370                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14371                 esac
14372                 d_getspnam_r=undef
14373                 getspnam_r_proto=0
14374                 ;;
14375         esac
14376         ;;
14377 *)      getspnam_r_proto=0
14378         ;;
14379 esac
14380
14381 : see if gettimeofday or ftime exists
14382 set gettimeofday d_gettimeod
14383 eval $inlibc
14384 case "$d_gettimeod" in
14385 "$undef")
14386         set ftime d_ftime 
14387         eval $inlibc
14388         ;;
14389 *)
14390         val="$undef"; set d_ftime; eval $setvar
14391         ;;
14392 esac
14393 case "$d_gettimeod$d_ftime" in
14394 "$undef$undef")
14395         echo " "
14396         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14397         ;;
14398 esac
14399
14400 : see if gmtime_r exists
14401 set gmtime_r d_gmtime_r
14402 eval $inlibc
14403 case "$d_gmtime_r" in
14404 "$define")
14405         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14406         case "$d_gmtime_r_proto:$usethreads" in
14407         ":define")      d_gmtime_r_proto=define
14408                 set d_gmtime_r_proto gmtime_r $hdrs
14409                 eval $hasproto ;;
14410         *)      ;;
14411         esac
14412         case "$d_gmtime_r_proto" in
14413         define)
14414         case "$gmtime_r_proto" in
14415         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14416         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14417         esac
14418         case "$gmtime_r_proto" in
14419         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14420         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14421         esac
14422         case "$gmtime_r_proto" in
14423         ''|0)   d_gmtime_r=undef
14424                 gmtime_r_proto=0
14425                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14426         * )     case "$gmtime_r_proto" in
14427                 REENTRANT_PROTO*) ;;
14428                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14429                 esac
14430                 echo "Prototype: $try" ;;
14431         esac
14432         ;;
14433         *)      case "$usethreads" in
14434                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14435                 esac
14436                 d_gmtime_r=undef
14437                 gmtime_r_proto=0
14438                 ;;
14439         esac
14440         ;;
14441 *)      gmtime_r_proto=0
14442         ;;
14443 esac
14444
14445 : see if hasmntopt exists
14446 set hasmntopt d_hasmntopt
14447 eval $inlibc
14448
14449 : see if this is a netinet/in.h or sys/in.h system
14450 set netinet/in.h i_niin sys/in.h i_sysin
14451 eval $inhdr
14452
14453 : see if arpa/inet.h has to be included
14454 set arpa/inet.h i_arpainet
14455 eval $inhdr
14456
14457 : see if htonl --and friends-- exists
14458 val=''
14459 set htonl val
14460 eval $inlibc
14461
14462 : Maybe they are macros.
14463 case "$val" in
14464 $undef)
14465         $cat >htonl.c <<EOM
14466 #include <stdio.h>
14467 #include <sys/types.h>
14468 #$i_niin I_NETINET_IN
14469 #$i_sysin I_SYS_IN
14470 #$i_arpainet I_ARPA_INET
14471 #ifdef I_NETINET_IN
14472 #include <netinet/in.h>
14473 #endif
14474 #ifdef I_SYS_IN
14475 #include <sys/in.h>
14476 #endif
14477 #ifdef I_ARPA_INET
14478 #include <arpa/inet.h>
14479 #endif
14480 #ifdef htonl
14481 printf("Defined as a macro.");
14482 #endif
14483 EOM
14484         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14485         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14486                 val="$define"
14487                 echo "But it seems to be defined as a macro." >&4
14488         fi
14489         $rm -f htonl.?
14490         ;;
14491 esac
14492 set d_htonl
14493 eval $setvar
14494
14495 : see if ilogbl exists
14496 set ilogbl d_ilogbl
14497 eval $inlibc
14498
14499 : index or strchr
14500 echo " "
14501 if set index val -f; eval $csym; $val; then
14502         if set strchr val -f d_strchr; eval $csym; $val; then
14503                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14504                         val="$define"
14505                         vali="$undef"
14506                         echo "strchr() found." >&4
14507                 else
14508                         val="$undef"
14509                         vali="$define"
14510                         echo "index() found." >&4
14511                 fi
14512         else
14513                 val="$undef"
14514                 vali="$define"
14515                 echo "index() found." >&4
14516         fi
14517 else
14518         if set strchr val -f d_strchr; eval $csym; $val; then
14519                 val="$define"
14520                 vali="$undef"
14521                 echo "strchr() found." >&4
14522         else
14523                 echo "No index() or strchr() found!" >&4
14524                 val="$undef"
14525                 vali="$undef"
14526         fi
14527 fi
14528 set d_strchr; eval $setvar
14529 val="$vali"
14530 set d_index; eval $setvar
14531
14532 : check whether inet_aton exists
14533 set inet_aton d_inetaton
14534 eval $inlibc
14535
14536 : Look for isascii
14537 echo " "
14538 $cat >isascii.c <<EOCP
14539 #include <stdio.h>
14540 #include <ctype.h>
14541 #$i_stdlib I_STDLIB
14542 #ifdef I_STDLIB
14543 #include <stdlib.h>
14544 #endif
14545 int main() {
14546         int c = 'A';
14547         if (isascii(c))
14548                 exit(0);
14549         else
14550                 exit(1);
14551 }
14552 EOCP
14553 set isascii
14554 if eval $compile; then
14555         echo "isascii() found." >&4
14556         val="$define"
14557 else
14558         echo "isascii() NOT found." >&4
14559         val="$undef"
14560 fi
14561 set d_isascii
14562 eval $setvar
14563 $rm -f isascii*
14564
14565 : see if isfinite exists
14566 set isfinite d_isfinite
14567 eval $inlibc
14568
14569 : see if isinf exists
14570 set isinf d_isinf
14571 eval $inlibc
14572
14573 : see if isnan exists
14574 set isnan d_isnan
14575 eval $inlibc
14576
14577 : see if isnanl exists
14578 set isnanl d_isnanl
14579 eval $inlibc
14580
14581 : see if killpg exists
14582 set killpg d_killpg
14583 eval $inlibc
14584
14585 : see if lchown exists
14586 echo " "
14587 $cat > try.c <<'EOCP'
14588 /* System header to define __stub macros and hopefully few prototypes,
14589     which can conflict with char lchown(); below.  */
14590 #include <assert.h>
14591 /* Override any gcc2 internal prototype to avoid an error.  */
14592 /* We use char because int might match the return type of a gcc2
14593    builtin and then its argument prototype would still apply.  */
14594 char lchown();
14595 int main() {
14596     /*  The GNU C library defines this for functions which it implements
14597         to always fail with ENOSYS.  Some functions are actually named
14598         something starting with __ and the normal name is an alias.  */
14599 #if defined (__stub_lchown) || defined (__stub___lchown)
14600 choke me
14601 #else
14602 lchown();
14603 #endif
14604 ; return 0; }
14605 EOCP
14606 set try
14607 if eval $compile; then
14608     $echo "lchown() found." >&4
14609     val="$define"
14610 else
14611     $echo "lchown() NOT found." >&4
14612     val="$undef"
14613 fi
14614 set d_lchown
14615 eval $setvar
14616
14617 : See if number of significant digits in a double precision number is known
14618 echo " "
14619 $cat >ldbl_dig.c <<EOM
14620 #$i_limits I_LIMITS
14621 #$i_float I_FLOAT
14622 #ifdef I_LIMITS
14623 #include <limits.h>
14624 #endif
14625 #ifdef I_FLOAT
14626 #include <float.h>
14627 #endif
14628 #ifdef LDBL_DIG
14629 printf("Contains LDBL_DIG");
14630 #endif
14631 EOM
14632 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14633 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14634         echo "LDBL_DIG found." >&4
14635         val="$define"
14636 else
14637         echo "LDBL_DIG NOT found." >&4
14638         val="$undef"
14639 fi
14640 $rm -f ldbl_dig.?
14641 set d_ldbl_dig
14642 eval $setvar
14643
14644 : see if this is a math.h system
14645 set math.h i_math
14646 eval $inhdr
14647
14648 d_libm_lib_version="$undef"
14649 case $i_math in
14650     $define)
14651         : check to see if math.h defines _LIB_VERSION
14652         echo " "
14653         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14654         $cat >try.c <<EOCP
14655 #include <unistd.h>
14656 #include <math.h>
14657 int main (int argc, char *argv[])
14658 {
14659     printf ("%d\n", _LIB_VERSION);
14660     return (0);
14661     } /* main */
14662 EOCP
14663         set try
14664         if eval $compile; then
14665             foo=`$run ./try`
14666             echo "Yes, it does ($foo)" >&4
14667             d_libm_lib_version="$define"
14668         else
14669             echo "No, it does not (probably harmless)" >&4
14670             fi
14671         $rm_try
14672         ;;
14673
14674     esac
14675
14676 : see if link exists
14677 set link d_link
14678 eval $inlibc
14679
14680 : see if localtime_r exists
14681 set localtime_r d_localtime_r
14682 eval $inlibc
14683 case "$d_localtime_r" in
14684 "$define")
14685         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14686         case "$d_localtime_r_proto:$usethreads" in
14687         ":define")      d_localtime_r_proto=define
14688                 set d_localtime_r_proto localtime_r $hdrs
14689                 eval $hasproto ;;
14690         *)      ;;
14691         esac
14692         case "$d_localtime_r_proto" in
14693         define)
14694         case "$localtime_r_proto" in
14695         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14696         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14697         esac
14698         case "$localtime_r_proto" in
14699         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14700         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14701         esac
14702         case "$localtime_r_proto" in
14703         ''|0)   d_localtime_r=undef
14704                 localtime_r_proto=0
14705                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14706         * )     case "$localtime_r_proto" in
14707                 REENTRANT_PROTO*) ;;
14708                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14709                 esac
14710                 echo "Prototype: $try" ;;
14711         esac
14712         ;;
14713         *)      case "$usethreads" in
14714                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14715                 esac
14716                 d_localtime_r=undef
14717                 localtime_r_proto=0
14718                 ;;
14719         esac
14720         ;;
14721 *)      localtime_r_proto=0
14722         ;;
14723 esac
14724
14725 : see if localtime_r calls tzset
14726 case "$localtime_r_proto" in
14727 REENTRANT_PROTO*)
14728         $cat >try.c <<EOCP
14729 /*  Does our libc's localtime_r call tzset ?
14730  *  return 0 if so, 1 otherwise.
14731  */
14732 #include <sys/types.h>
14733 #include <unistd.h>
14734 #include <time.h>
14735 #include <string.h>
14736 #include <malloc.h>
14737 int main()
14738 {
14739     time_t t = time(0L);
14740     char w_tz[]="TZ" "=GMT+5",
14741          e_tz[]="TZ" "=GMT-5",
14742         *tz_e = (char*)malloc(16),
14743         *tz_w = (char*)malloc(16);
14744     struct tm tm_e, tm_w;
14745     memset(&tm_e,'\0',sizeof(struct tm));
14746     memset(&tm_w,'\0',sizeof(struct tm));
14747     strcpy(tz_e,e_tz);
14748     strcpy(tz_w,w_tz);
14749
14750     putenv(tz_e);
14751     localtime_r(&t, &tm_e);
14752
14753     putenv(tz_w);
14754     localtime_r(&t, &tm_w);
14755
14756     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14757         return 1;
14758     return 0;
14759 }
14760 EOCP
14761         set try
14762         if eval $compile; then
14763             if $run ./try; then
14764                 d_localtime_r_needs_tzset=undef;
14765             else
14766                 d_localtime_r_needs_tzset=define;
14767             fi;
14768         else
14769             d_localtime_r_needs_tzset=undef;
14770         fi;
14771      ;;
14772   *)
14773      d_localtime_r_needs_tzset=undef;
14774      ;;
14775 esac
14776 $rm_try
14777
14778 : see if localeconv exists
14779 set localeconv d_locconv
14780 eval $inlibc
14781
14782 : see if lockf exists
14783 set lockf d_lockf
14784 eval $inlibc
14785
14786 : see if prototype for lseek is available
14787 echo " "
14788 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14789 eval $hasproto
14790
14791 : see if lstat exists
14792 set lstat d_lstat
14793 eval $inlibc
14794
14795 : see if madvise exists
14796 set madvise d_madvise
14797 eval $inlibc
14798
14799 : see if malloc_size exists
14800 set malloc_size d_malloc_size
14801 eval $inlibc
14802
14803 : see if malloc_size_good exists
14804 set malloc_good_size d_malloc_good_size
14805 eval $inlibc
14806
14807 : see if mblen exists
14808 set mblen d_mblen
14809 eval $inlibc
14810
14811 : see if mbstowcs exists
14812 set mbstowcs d_mbstowcs
14813 eval $inlibc
14814
14815 : see if mbtowc exists
14816 set mbtowc d_mbtowc
14817 eval $inlibc
14818
14819 : see if memchr exists
14820 set memchr d_memchr
14821 eval $inlibc
14822
14823 : see if memcmp exists
14824 set memcmp d_memcmp
14825 eval $inlibc
14826
14827 : see if memcpy exists
14828 set memcpy d_memcpy
14829 eval $inlibc
14830
14831 : see if memmove exists
14832 set memmove d_memmove
14833 eval $inlibc
14834
14835 : see if memset exists
14836 set memset d_memset
14837 eval $inlibc
14838
14839 : see if mkdir exists
14840 set mkdir d_mkdir
14841 eval $inlibc
14842
14843 : see if mkdtemp exists
14844 set mkdtemp d_mkdtemp
14845 eval $inlibc
14846
14847 : see if mkfifo exists
14848 set mkfifo d_mkfifo
14849 eval $inlibc
14850
14851 : see if mkstemp exists
14852 set mkstemp d_mkstemp
14853 eval $inlibc
14854
14855 : see if mkstemps exists
14856 set mkstemps d_mkstemps
14857 eval $inlibc
14858
14859 : see if mktime exists
14860 set mktime d_mktime
14861 eval $inlibc
14862
14863 : see if this is a sys/mman.h system
14864 set sys/mman.h i_sysmman
14865 eval $inhdr
14866
14867 : see if mmap exists
14868 set mmap d_mmap
14869 eval $inlibc
14870 : see what shmat returns
14871 : default to something harmless
14872 mmaptype='void *'
14873 case "$i_sysmman$d_mmap" in
14874 "$define$define")
14875         $cat >mmap.c <<'END'
14876 #include <sys/mman.h>
14877 void *mmap();
14878 END
14879         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14880                 mmaptype='void *'
14881         else
14882                 mmaptype='caddr_t'
14883         fi
14884         echo "and it returns ($mmaptype)." >&4
14885         ;;
14886 esac
14887
14888
14889
14890 : see if sqrtl exists
14891 set sqrtl d_sqrtl
14892 eval $inlibc
14893
14894 : see if scalbnl exists
14895 set scalbnl d_scalbnl
14896 eval $inlibc
14897
14898 : see if modfl exists
14899 set modfl d_modfl
14900 eval $inlibc
14901
14902 : see if prototype for modfl is available
14903 echo " "
14904 set d_modflproto modfl $i_math math.h
14905 eval $hasproto
14906
14907 d_modfl_pow32_bug="$undef"
14908
14909 case "$d_longdbl$d_modfl" in
14910 $define$define)
14911         $cat <<EOM
14912 Checking to see whether your modfl() is okay for large values...
14913 EOM
14914 $cat >try.c <<EOCP
14915 #include <math.h>
14916 #include <stdio.h>
14917 EOCP
14918 if $test "X$d_modflproto" != "X$define"; then
14919         $cat >>try.c <<EOCP
14920 /* Sigh. many current glibcs provide the function, but do not prototype it. */
14921 long double modfl (long double, long double *);
14922 EOCP
14923 fi
14924 $cat >>try.c <<EOCP
14925 int main() {
14926     long double nv = 4294967303.15;
14927     long double v, w;
14928     v = modfl(nv, &w);
14929 #ifdef __GLIBC__
14930     printf("glibc");
14931 #endif
14932     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14933     return 0;
14934 }
14935 EOCP
14936         case "$osname:$gccversion" in
14937         aix:)   saveccflags="$ccflags"
14938                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14939         esac
14940         set try
14941         if eval $compile; then
14942                 foo=`$run ./try`
14943                 case "$foo" in
14944                 *" 4294967303.150000 1.150000 4294967302.000000")
14945                         echo >&4 "Your modfl() is broken for large values."
14946                         d_modfl_pow32_bug="$define"
14947                         case "$foo" in
14948                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14949                         ;;
14950                         esac
14951                         ;;
14952                 *" 4294967303.150000 0.150000 4294967303.000000")
14953                         echo >&4 "Your modfl() seems okay for large values."
14954                         ;;
14955                 *)      echo >&4 "I don't understand your modfl() at all."
14956                         d_modfl="$undef"
14957                         ;;
14958                 esac
14959                 $rm_try
14960         else
14961                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14962                 d_modfl="$undef"
14963         fi
14964         case "$osname:$gccversion" in
14965         aix:)   ccflags="$saveccflags" ;; # restore
14966         esac
14967         ;;
14968 esac
14969
14970 if $test "$uselongdouble" = "$define"; then
14971     message=""
14972     if $test "$d_sqrtl" != "$define"; then
14973         message="$message sqrtl"
14974     fi
14975     if $test "$d_modfl" != "$define"; then
14976         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14977             echo "You have both aintl and copysignl, so I can emulate modfl."
14978         else
14979             message="$message modfl"
14980         fi
14981     fi
14982     if $test "$d_frexpl" != "$define"; then
14983         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14984             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14985         else
14986             message="$message frexpl"
14987         fi
14988     fi
14989
14990     if $test "$message" != ""; then
14991         $cat <<EOM >&4
14992
14993 *** You requested the use of long doubles but you do not seem to have
14994 *** the following mathematical functions needed for long double support:
14995 ***    $message
14996 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14997 *** Cannot continue, aborting.
14998
14999 EOM
15000
15001         exit 1
15002     fi
15003 fi
15004
15005 : see if mprotect exists
15006 set mprotect d_mprotect
15007 eval $inlibc
15008
15009 : see if msgctl exists
15010 set msgctl d_msgctl
15011 eval $inlibc
15012
15013 : see if msgget exists
15014 set msgget d_msgget
15015 eval $inlibc
15016
15017 : see if msgsnd exists
15018 set msgsnd d_msgsnd
15019 eval $inlibc
15020
15021 : see if msgrcv exists
15022 set msgrcv d_msgrcv
15023 eval $inlibc
15024
15025 : see how much of the 'msg*(2)' library is present.
15026 h_msg=true
15027 echo " "
15028 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
15029 *"$undef"*) h_msg=false;;
15030 esac
15031 case "$osname" in
15032 freebsd)
15033     case "`ipcs 2>&1`" in
15034     "SVID messages"*"not configured"*)
15035         echo "Your $osname does not have the msg*(2) configured." >&4
15036         h_msg=false
15037         val="$undef"
15038         set msgctl d_msgctl
15039         eval $setvar
15040         set msgget d_msgget
15041         eval $setvar
15042         set msgsnd d_msgsnd
15043         eval $setvar
15044         set msgrcv d_msgrcv
15045         eval $setvar
15046         ;;
15047     esac
15048     ;;
15049 esac
15050 : we could also check for sys/ipc.h ...
15051 if $h_msg && $test `./findhdr sys/msg.h`; then
15052         echo "You have the full msg*(2) library." >&4
15053         val="$define"
15054 else
15055         echo "You don't have the full msg*(2) library." >&4
15056         val="$undef"
15057 fi
15058 set d_msg
15059 eval $setvar
15060
15061
15062 echo " "
15063 echo "Checking to see if your system supports struct msghdr..." >&4
15064 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
15065 eval $hasstruct
15066 case "$d_msghdr_s" in
15067 "$define")      echo "Yes, it does."   ;;
15068 *)              echo "No, it doesn't." ;;
15069 esac
15070
15071
15072 : see if msync exists
15073 set msync d_msync
15074 eval $inlibc
15075
15076 : see if munmap exists
15077 set munmap d_munmap
15078 eval $inlibc
15079
15080 : see if nice exists
15081 set nice d_nice
15082 eval $inlibc
15083
15084 : see if this is a langinfo.h system
15085 set langinfo.h i_langinfo
15086 eval $inhdr
15087
15088 : see if nl_langinfo exists
15089 set nl_langinfo d_nl_langinfo
15090 eval $inlibc
15091
15092 : check for volatile keyword
15093 echo " "
15094 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15095 $cat >try.c <<'EOCP'
15096 int main()
15097 {
15098         typedef struct _goo_struct goo_struct;
15099         goo_struct * volatile goo = ((goo_struct *)0);
15100         struct _goo_struct {
15101                 long long_int;
15102                 int reg_int;
15103                 char char_var;
15104         };
15105         typedef unsigned short foo_t;
15106         char *volatile foo;
15107         volatile int bar;
15108         volatile foo_t blech;
15109         foo = foo;
15110 }
15111 EOCP
15112 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15113         val="$define"
15114         echo "Yup, it does."
15115 else
15116         val="$undef"
15117         echo "Nope, it doesn't."
15118 fi
15119 set d_volatile
15120 eval $setvar
15121 $rm_try
15122
15123
15124 echo " "
15125 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15126
15127 case "$use64bitint:$d_quad:$quadtype" in
15128 define:define:?*)
15129         ivtype="$quadtype"
15130         uvtype="$uquadtype"
15131         ivsize=8
15132         uvsize=8
15133         ;;
15134 *)      ivtype="long"
15135         uvtype="unsigned long"
15136         ivsize=$longsize
15137         uvsize=$longsize
15138         ;;
15139 esac
15140
15141 case "$uselongdouble:$d_longdbl" in
15142 define:define)
15143         nvtype="long double"
15144         nvsize=$longdblsize
15145         ;;
15146 *)      nvtype=double
15147         nvsize=$doublesize
15148         ;;
15149 esac
15150
15151 $echo "(IV will be "$ivtype", $ivsize bytes)"
15152 $echo "(UV will be "$uvtype", $uvsize bytes)"
15153 $echo "(NV will be "$nvtype", $nvsize bytes)"
15154
15155 $cat >try.c <<EOCP
15156 #$i_inttypes I_INTTYPES
15157 #ifdef I_INTTYPES
15158 #include <inttypes.h>
15159 #endif
15160 #include <stdio.h>
15161 int main() {
15162 #ifdef INT8
15163    int8_t i =  INT8_MAX;
15164   uint8_t u = UINT8_MAX;
15165   printf("int8_t\n");
15166 #endif
15167 #ifdef INT16
15168    int16_t i =  INT16_MAX;
15169   uint16_t i = UINT16_MAX;
15170   printf("int16_t\n");
15171 #endif
15172 #ifdef INT32
15173    int32_t i =  INT32_MAX;
15174   uint32_t u = UINT32_MAX;
15175   printf("int32_t\n");
15176 #endif
15177 }
15178 EOCP
15179
15180 i8type=char
15181 u8type="unsigned char"
15182 i8size=1
15183 u8size=1
15184
15185 case "$i16type" in
15186 '')     case "$shortsize" in
15187         2)      i16type=short
15188                 u16type="unsigned short"
15189                 i16size=$shortsize
15190                 u16size=$shortsize
15191                 ;;
15192         esac
15193         ;;
15194 esac
15195 case "$i16type" in
15196 '')     set try -DINT16
15197         if eval $compile; then
15198                 case "`$run ./try`" in
15199                 int16_t)
15200                         i16type=int16_t
15201                         u16type=uint16_t
15202                         i16size=2
15203                         u16size=2
15204                         ;;
15205                 esac
15206         fi
15207         ;;
15208 esac
15209 case "$i16type" in
15210 '')     if $test $shortsize -ge 2; then
15211                 i16type=short
15212                 u16type="unsigned short"
15213                 i16size=$shortsize
15214                 u16size=$shortsize
15215         fi
15216         ;;
15217 esac
15218
15219 case "$i32type" in
15220 '')     case "$longsize" in
15221         4)      i32type=long
15222                 u32type="unsigned long"
15223                 i32size=$longsize
15224                 u32size=$longsize
15225                 ;;
15226         *)      case "$intsize" in
15227                 4)      i32type=int
15228                         u32type="unsigned int"
15229                         i32size=$intsize
15230                         u32size=$intsize
15231                         ;;
15232                 esac
15233                 ;;
15234         esac
15235         ;;
15236 esac
15237 case "$i32type" in
15238 '')     set try -DINT32
15239         if eval $compile; then
15240                 case "`$run ./try`" in
15241                 int32_t)
15242                         i32type=int32_t
15243                         u32type=uint32_t
15244                         i32size=4
15245                         u32size=4
15246                         ;;
15247                 esac
15248         fi
15249         ;;
15250 esac
15251 case "$i32type" in
15252 '')     if $test $intsize -ge 4; then
15253                 i32type=int
15254                 u32type="unsigned int"
15255                 i32size=$intsize
15256                 u32size=$intsize
15257         fi
15258         ;;
15259 esac
15260
15261 case "$i64type" in
15262 '')     case "$d_quad:$quadtype" in
15263         define:?*)
15264                 i64type="$quadtype"
15265                 u64type="$uquadtype"
15266                 i64size=8
15267                 u64size=8
15268                 ;;
15269         esac
15270         ;;
15271 esac
15272
15273 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15274 : volatile so that the compiler has to store it out to memory.
15275 if test X"$d_volatile" = X"$define"; then
15276         volatile=volatile
15277 fi
15278 $cat <<EOP >try.c
15279 #include <stdio.h>
15280 #$i_stdlib I_STDLIB
15281 #ifdef I_STDLIB
15282 #include <stdlib.h>
15283 #endif
15284 #include <sys/types.h>
15285 #include <signal.h>
15286 #ifdef SIGFPE
15287 $volatile int bletched = 0;
15288 $signal_t blech(int s) { bletched = 1; }
15289 #endif
15290 int main() {
15291     $uvtype u = 0;
15292     $nvtype d;
15293     int     n = 8 * $uvsize;
15294     int     i;
15295 #ifdef SIGFPE
15296     signal(SIGFPE, blech);
15297 #endif
15298
15299     for (i = 0; i < n; i++) {
15300       u = u << 1 | ($uvtype)1;
15301       d = ($nvtype)u;
15302       if (($uvtype)d != u)
15303         break;
15304       if (d <= 0)
15305         break;
15306       d = ($nvtype)(u - 1);
15307       if (($uvtype)d != (u - 1))
15308         break;
15309 #ifdef SIGFPE
15310       if (bletched)
15311         break;
15312 #endif
15313     }
15314     printf("%d\n", ((i == n) ? -n : i));
15315     exit(0);
15316 }
15317 EOP
15318 set try
15319
15320 d_nv_preserves_uv="$undef"
15321 if eval $compile; then
15322         nv_preserves_uv_bits="`$run ./try`"
15323 fi
15324 case "$nv_preserves_uv_bits" in
15325 \-[1-9]*)
15326         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15327         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15328         d_nv_preserves_uv="$define"
15329         ;;
15330 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15331         d_nv_preserves_uv="$undef" ;;
15332 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15333         nv_preserves_uv_bits="0" ;;
15334 esac
15335 $rm_try
15336
15337 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15338 : volatile so that the compiler has to store it out to memory.
15339 if test X"$d_volatile" = X"$define"; then
15340         volatile=volatile
15341 fi
15342 $cat <<EOP >try.c
15343 #include <stdio.h>
15344 #$i_stdlib I_STDLIB
15345 #ifdef I_STDLIB
15346 #include <stdlib.h>
15347 #endif
15348 #$i_string I_STRING
15349 #ifdef I_STRING
15350 #  include <string.h>
15351 #else
15352 #  include <strings.h>
15353 #endif
15354 #include <sys/types.h>
15355 #include <signal.h>
15356 #ifdef SIGFPE
15357 $volatile int bletched = 0;
15358 $signal_t blech(int s) { bletched = 1; }
15359 #endif
15360
15361 int checkit($nvtype d, char *where) {
15362     unsigned char *p = (char *)&d;
15363     unsigned char *end = p + sizeof(d);
15364     int fail = 0;
15365
15366     while (p < end)
15367         fail += *p++;
15368
15369     if (!fail)
15370         return 0;
15371
15372     p = (char *)&d;
15373     printf("No - %s: 0x", where);
15374     while (p < end)
15375         printf ("%02X", *p++);
15376     printf("\n");
15377     return 1;
15378 }
15379
15380 int main(int argc, char **argv) {
15381     $nvtype d = 0.0;
15382     int fail = 0;
15383     fail += checkit(d, "0.0");
15384
15385     /* The compiler shouldn't be assuming that bletched is 0  */
15386     d = bletched;
15387
15388     fail += checkit(d, "bleched");
15389
15390 #ifdef SIGFPE
15391     signal(SIGFPE, blech);
15392 #endif
15393
15394     /* Paranoia - the compiler should have no way of knowing that ANSI says
15395        that argv[argc] will always be NULL.  Actually, if it did assume this it
15396        would be buggy, as this is C and main() can be called from elsewhere in
15397        the program.  */
15398     d = argv[argc] ? 1 : 0;
15399
15400     if (d) {
15401         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15402     }
15403
15404     fail += checkit(d, "ternary");
15405
15406     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15407
15408     if (d != 0.0) {
15409         printf("No - memset doesn't give 0.0\n");
15410         /* This might just blow up:  */
15411         printf("(gives %g)\n", d);
15412         return 1;
15413     }
15414
15415 #ifdef SIGFPE
15416     if (bletched) {
15417         printf("No - something bleched\n");
15418         return 1;
15419     }
15420 #endif
15421     if (fail) {
15422       printf("No - %d fail(s)\n", fail);
15423       return 1;
15424     }
15425     printf("Yes\n");
15426     return 0;
15427 }
15428 EOP
15429 set try
15430
15431 d_nv_zero_is_allbits_zero="$undef"
15432 if eval $compile; then
15433     xxx="`$run ./try`"
15434     case "$?" in
15435         0)
15436             case "$xxx" in
15437                 Yes)  cat >&4 <<EOM
15438 0.0 is represented as all bits zero in memory
15439 EOM
15440                     d_nv_zero_is_allbits_zero="$define"
15441                     ;;
15442                 *)  cat >&4 <<EOM
15443 0.0 is not represented as all bits zero in memory
15444 EOM
15445                     d_nv_zero_is_allbits_zero="$undef"
15446                     ;;
15447             esac
15448             ;;
15449         *)  cat >&4 <<EOM
15450 0.0 is not represented as all bits zero in memory
15451 EOM
15452             d_nv_zero_is_allbits_zero="$undef"
15453             ;;
15454     esac
15455 fi
15456 $rm_try
15457
15458 : check for off64_t
15459 echo " "
15460 echo "Checking to see if you have off64_t..." >&4
15461 $cat >try.c <<EOCP
15462 #include <sys/types.h>
15463 #include <unistd.h>
15464 int main() { off64_t x = 7; }
15465 EOCP
15466 set try
15467 if eval $compile; then
15468         val="$define"
15469         echo "You have off64_t."
15470 else
15471         val="$undef"
15472         echo "You do not have off64_t."
15473         case "$lseeksize" in
15474         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15475         esac
15476 fi
15477 $rm_try
15478 set d_off64_t
15479 eval $setvar
15480
15481 : how to create joinable pthreads
15482 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15483         echo " "
15484         echo "Checking what constant to use for creating joinable pthreads..." >&4
15485         $cat >try.c <<'EOCP'
15486 #include <pthread.h>
15487 int main() {
15488     int detachstate = JOINABLE;
15489 }
15490 EOCP
15491         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15492         if eval $compile; then
15493                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15494                 val="$undef" # Yes, undef.
15495                 set d_old_pthread_create_joinable
15496                 eval $setvar
15497                 val=""
15498                 set old_pthread_create_joinable
15499                 eval $setvar
15500         else
15501                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15502                 if eval $compile; then
15503                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15504                         val="$define"
15505                         set d_old_pthread_create_joinable
15506                         eval $setvar
15507                         val=PTHREAD_CREATE_UNDETACHED
15508                         set old_pthread_create_joinable
15509                         eval $setvar
15510                 else
15511                         set try -DJOINABLE=__UNDETACHED
15512                         if eval $compile; then
15513                                 echo "You seem to use __UNDETACHED." >&4
15514                                 val="$define"
15515                                 set d_old_pthread_create_joinable
15516                                 eval $setvar
15517                                 val=__UNDETACHED
15518                                 set old_pthread_create_joinable
15519                                 eval $setvar
15520                         else
15521                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15522                                 val="$define"
15523                                 set d_old_pthread_create_joinable
15524                                 eval $setvar
15525                                 val=0
15526                                 set old_pthread_create_joinable
15527                                 eval $setvar
15528                         fi
15529                 fi
15530         fi
15531         $rm_try
15532 else
15533     d_old_pthread_create_joinable="$undef"
15534     old_pthread_create_joinable=""
15535 fi
15536
15537 : see if pause exists
15538 set pause d_pause
15539 eval $inlibc
15540
15541 : see if poll exists
15542 set poll d_poll
15543 eval $inlibc
15544
15545 : see if readlink exists
15546 set readlink d_readlink
15547 eval $inlibc
15548
15549 echo " "
15550 procselfexe=''
15551 val="$undef"
15552 case "$d_readlink" in
15553 "$define")
15554         if $issymlink /proc/self/exe ; then
15555                 $ls -l /proc/self/exe > reflect
15556                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15557                         echo "You have Linux-like /proc/self/exe."
15558                         procselfexe='"/proc/self/exe"'
15559                         val="$define"
15560                 fi
15561         fi
15562         if $issymlink /proc/curproc/file ; then
15563                 $ls -l /proc/curproc/file > reflect
15564                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15565                         echo "You have BSD-like /proc/curproc/file."
15566                         procselfexe='"/proc/curproc/file"'
15567                         val="$define"
15568                 fi
15569         fi
15570         ;;
15571 esac
15572 $rm -f reflect
15573 set d_procselfexe
15574 eval $setvar
15575
15576 : backward compatibility for d_hvfork
15577 if test X$d_hvfork != X; then
15578         d_vfork="$d_hvfork"
15579         d_hvfork=''
15580 fi
15581 : see if there is a vfork
15582 val=''
15583 set vfork val
15584 eval $inlibc
15585
15586 d_pseudofork=$undef
15587
15588 : Ok, but do we want to use it. vfork is reportedly unreliable in
15589 : perl on Solaris 2.x, and probably elsewhere.
15590 case "$val" in
15591 $define)
15592         echo " "
15593         case "$usevfork" in
15594         false) dflt='n';;
15595         *) dflt='y';;
15596         esac
15597         cat <<'EOM'
15598
15599 Perl can only use a vfork() that doesn't suffer from strict
15600 restrictions on calling functions or modifying global data in
15601 the child.  For example, glibc-2.1 contains such a vfork()
15602 that is unsuitable.  If your system provides a proper fork()
15603 call, chances are that you do NOT want perl to use vfork().
15604
15605 EOM
15606         rp="Do you still want to use vfork()?"
15607         . ./myread
15608         case "$ans" in
15609         y|Y) ;;
15610         *)
15611                 echo "Ok, we won't use vfork()."
15612                 val="$undef"
15613                 ;;
15614         esac
15615         ;;
15616 esac
15617 set d_vfork
15618 eval $setvar
15619 case "$d_vfork" in
15620 $define) usevfork='true';;
15621 *) usevfork='false';;
15622 esac
15623
15624 : see whether the pthread_atfork exists
15625 $cat >try.c <<EOP
15626 #include <pthread.h>
15627 #include <stdio.h>
15628 int main() {
15629 #ifdef  PTHREAD_ATFORK
15630         pthread_atfork(NULL,NULL,NULL);
15631 #endif
15632 }
15633 EOP
15634
15635 : see if pthread_atfork exists
15636 set try -DPTHREAD_ATFORK
15637 if eval $compile; then
15638     val="$define"
15639 else
15640     val="$undef"
15641 fi
15642 case "$usethreads" in
15643 $define)
15644         case "$val" in
15645         $define) echo 'pthread_atfork found.' >&4        ;;
15646         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15647         esac
15648 esac
15649 set d_pthread_atfork
15650 eval $setvar
15651
15652 : see if pthread_attr_setscope exists
15653 set pthread_attr_setscope d_pthread_attr_setscope
15654 eval $inlibc
15655
15656
15657 : see whether the various POSIXish _yields exist
15658 $cat >try.c <<EOP
15659 #include <pthread.h>
15660 #include <stdio.h>
15661 int main() {
15662 #ifdef SCHED_YIELD
15663         sched_yield();
15664 #else
15665 #ifdef PTHREAD_YIELD
15666         pthread_yield();
15667 #else
15668 #ifdef PTHREAD_YIELD_NULL
15669         pthread_yield(NULL);
15670 #endif
15671 #endif
15672 #endif
15673 }
15674 EOP
15675 : see if sched_yield exists
15676 set try -DSCHED_YIELD
15677 if eval $compile; then
15678     val="$define"
15679     sched_yield='sched_yield()'
15680 else
15681     val="$undef"
15682 fi
15683 case "$usethreads" in
15684 $define)
15685         case "$val" in
15686         $define) echo 'sched_yield() found.' >&4        ;;
15687         *)       echo 'sched_yield() NOT found.' >&4    ;;
15688         esac
15689 esac
15690 set d_sched_yield
15691 eval $setvar
15692
15693 : see if pthread_yield exists
15694 set try -DPTHREAD_YIELD
15695 if eval $compile; then
15696     val="$define"
15697     case "$sched_yield" in
15698     '') sched_yield='pthread_yield()' ;;
15699     esac
15700 else
15701     set try -DPTHREAD_YIELD_NULL
15702     if eval $compile; then
15703         val="$define"
15704         case "$sched_yield" in
15705         '') sched_yield='pthread_yield(NULL)' ;;
15706         esac
15707     else
15708         val="$undef"
15709     fi
15710 fi
15711 case "$usethreads" in
15712 $define)
15713         case "$val" in
15714         $define) echo 'pthread_yield() found.' >&4      ;;
15715         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15716         esac
15717         ;;
15718 esac
15719 set d_pthread_yield
15720 eval $setvar
15721 case "$sched_yield" in
15722 '') sched_yield=undef ;;
15723 esac
15724 $rm_try
15725
15726 : see if random_r exists
15727 set random_r d_random_r
15728 eval $inlibc
15729 case "$d_random_r" in
15730 "$define")
15731         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15732         case "$d_random_r_proto:$usethreads" in
15733         ":define")      d_random_r_proto=define
15734                 set d_random_r_proto random_r $hdrs
15735                 eval $hasproto ;;
15736         *)      ;;
15737         esac
15738         case "$d_random_r_proto" in
15739         define)
15740         case "$random_r_proto" in
15741         ''|0) try='int random_r(int*, struct random_data*);'
15742         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15743         esac
15744         case "$random_r_proto" in
15745         ''|0) try='int random_r(long*, struct random_data*);'
15746         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15747         esac
15748         case "$random_r_proto" in
15749         ''|0) try='int random_r(struct random_data*, int32_t*);'
15750         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15751         esac
15752         case "$random_r_proto" in
15753         ''|0)   d_random_r=undef
15754                 random_r_proto=0
15755                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15756         * )     case "$random_r_proto" in
15757                 REENTRANT_PROTO*) ;;
15758                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15759                 esac
15760                 echo "Prototype: $try" ;;
15761         esac
15762         ;;
15763         *)      case "$usethreads" in
15764                 define) echo "random_r has no prototype, not using it." >&4 ;;
15765                 esac
15766                 d_random_r=undef
15767                 random_r_proto=0
15768                 ;;
15769         esac
15770         ;;
15771 *)      random_r_proto=0
15772         ;;
15773 esac
15774
15775 : see if readdir and friends exist
15776 set readdir d_readdir
15777 eval $inlibc
15778 set seekdir d_seekdir
15779 eval $inlibc
15780 set telldir d_telldir
15781 eval $inlibc
15782 set rewinddir d_rewinddir
15783 eval $inlibc
15784
15785 : see if readdir64_r exists
15786 set readdir64_r d_readdir64_r
15787 eval $inlibc
15788 case "$d_readdir64_r" in
15789 "$define")
15790         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15791         case "$d_readdir64_r_proto:$usethreads" in
15792         ":define")      d_readdir64_r_proto=define
15793                 set d_readdir64_r_proto readdir64_r $hdrs
15794                 eval $hasproto ;;
15795         *)      ;;
15796         esac
15797         case "$d_readdir64_r_proto" in
15798         define)
15799         case "$readdir64_r_proto" in
15800         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15801         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15802         esac
15803         case "$readdir64_r_proto" in
15804         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15805         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15806         esac
15807         case "$readdir64_r_proto" in
15808         ''|0)   d_readdir64_r=undef
15809                 readdir64_r_proto=0
15810                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15811         * )     case "$readdir64_r_proto" in
15812                 REENTRANT_PROTO*) ;;
15813                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15814                 esac
15815                 echo "Prototype: $try" ;;
15816         esac
15817         ;;
15818         *)      case "$usethreads" in
15819                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15820                 esac
15821                 d_readdir64_r=undef
15822                 readdir64_r_proto=0
15823                 ;;
15824         esac
15825         ;;
15826 *)      readdir64_r_proto=0
15827         ;;
15828 esac
15829
15830 : see if readdir_r exists
15831 set readdir_r d_readdir_r
15832 eval $inlibc
15833 case "$d_readdir_r" in
15834 "$define")
15835         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15836         case "$d_readdir_r_proto:$usethreads" in
15837         ":define")      d_readdir_r_proto=define
15838                 set d_readdir_r_proto readdir_r $hdrs
15839                 eval $hasproto ;;
15840         *)      ;;
15841         esac
15842         case "$d_readdir_r_proto" in
15843         define)
15844         case "$readdir_r_proto" in
15845         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15846         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15847         esac
15848         case "$readdir_r_proto" in
15849         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15850         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15851         esac
15852         case "$readdir_r_proto" in
15853         ''|0)   d_readdir_r=undef
15854                 readdir_r_proto=0
15855                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15856         * )     case "$readdir_r_proto" in
15857                 REENTRANT_PROTO*) ;;
15858                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15859                 esac
15860                 echo "Prototype: $try" ;;
15861         esac
15862         ;;
15863         *)      case "$usethreads" in
15864                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15865                 esac
15866                 d_readdir_r=undef
15867                 readdir_r_proto=0
15868                 ;;
15869         esac
15870         ;;
15871 *)      readdir_r_proto=0
15872         ;;
15873 esac
15874
15875 : see if readv exists
15876 set readv d_readv
15877 eval $inlibc
15878
15879 : see if recvmsg exists
15880 set recvmsg d_recvmsg
15881 eval $inlibc
15882
15883 : see if rename exists
15884 set rename d_rename
15885 eval $inlibc
15886
15887 : see if rmdir exists
15888 set rmdir d_rmdir
15889 eval $inlibc
15890
15891 : see if memory.h is available.
15892 val=''
15893 set memory.h val
15894 eval $inhdr
15895
15896 : See if it conflicts with string.h
15897 case "$val" in
15898 $define)
15899         case "$strings" in
15900         '') ;;
15901         *)
15902                 $cppstdin $cppflags $cppminus < $strings > mem.h
15903                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15904                         echo " "
15905                         echo "We won't be including <memory.h>."
15906                         val="$undef"
15907                 fi
15908                 $rm -f mem.h
15909                 ;;
15910         esac
15911 esac
15912 set i_memory
15913 eval $setvar
15914
15915 : can bcopy handle overlapping blocks?
15916 echo " "
15917 val="$undef"
15918 case "$d_memmove" in
15919 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15920 *)      case "$d_bcopy" in
15921         "$define")
15922                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15923                 $cat >try.c <<EOCP
15924 #$i_memory I_MEMORY
15925 #$i_stdlib I_STDLIB
15926 #$i_string I_STRING
15927 #$i_unistd I_UNISTD
15928 EOCP
15929         $cat >>try.c <<'EOCP'
15930 #include <stdio.h>
15931 #ifdef I_MEMORY
15932 #  include <memory.h>
15933 #endif
15934 #ifdef I_STDLIB
15935 #  include <stdlib.h>
15936 #endif
15937 #ifdef I_STRING
15938 #  include <string.h>
15939 #else
15940 #  include <strings.h>
15941 #endif
15942 #ifdef I_UNISTD
15943 #  include <unistd.h>  /* Needed for NetBSD */
15944 #endif
15945 int main()
15946 {
15947 char buf[128], abc[128];
15948 char *b;
15949 int len;
15950 int off;
15951 int align;
15952
15953 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15954    try to store the string in read-only memory. */
15955 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15956
15957 for (align = 7; align >= 0; align--) {
15958         for (len = 36; len; len--) {
15959                 b = buf+align;
15960                 bcopy(abc, b, len);
15961                 for (off = 1; off <= len; off++) {
15962                         bcopy(b, b+off, len);
15963                         bcopy(b+off, b, len);
15964                         if (bcmp(b, abc, len))
15965                                 exit(1);
15966                 }
15967         }
15968 }
15969 exit(0);
15970 }
15971 EOCP
15972                 set try
15973                 if eval $compile_ok; then
15974                         if $run ./try 2>/dev/null; then
15975                                 echo "Yes, it can."
15976                                 val="$define"
15977                         else
15978                                 echo "It can't, sorry."
15979                         fi
15980                 else
15981                         echo "(I can't compile the test program, so we'll assume not...)"
15982                 fi
15983                 ;;
15984         esac
15985         $rm_try
15986         ;;
15987 esac
15988 set d_safebcpy
15989 eval $setvar
15990
15991 : can memcpy handle overlapping blocks?
15992 echo " "
15993 val="$undef"
15994 case "$d_memmove" in
15995 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15996 *)      case "$d_memcpy" in
15997         "$define")
15998                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15999                 $cat >try.c <<EOCP
16000 #$i_memory I_MEMORY
16001 #$i_stdlib I_STDLIB
16002 #$i_string I_STRING
16003 #$i_unistd I_UNISTD
16004 EOCP
16005         $cat >>try.c <<'EOCP'
16006 #include <stdio.h>
16007 #ifdef I_MEMORY
16008 #  include <memory.h>
16009 #endif
16010 #ifdef I_STDLIB
16011 #  include <stdlib.h>
16012 #endif
16013 #ifdef I_STRING
16014 #  include <string.h>
16015 #else
16016 #  include <strings.h>
16017 #endif
16018 #ifdef I_UNISTD
16019 #  include <unistd.h>  /* Needed for NetBSD */
16020 #endif
16021 int main()
16022 {
16023 char buf[128], abc[128];
16024 char *b;
16025 int len;
16026 int off;
16027 int align;
16028
16029 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16030    try to store the string in read-only memory. */
16031 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16032
16033 for (align = 7; align >= 0; align--) {
16034         for (len = 36; len; len--) {
16035                 b = buf+align;
16036                 memcpy(b, abc, len);
16037                 for (off = 1; off <= len; off++) {
16038                         memcpy(b+off, b, len);
16039                         memcpy(b, b+off, len);
16040                         if (memcmp(b, abc, len))
16041                                 exit(1);
16042                 }
16043         }
16044 }
16045 exit(0);
16046 }
16047 EOCP
16048                 set try
16049                 if eval $compile_ok; then
16050                         if $run ./try 2>/dev/null; then
16051                                 echo "Yes, it can."
16052                                 val="$define"
16053                         else
16054                                 echo "It can't, sorry."
16055                         fi
16056                 else
16057                         echo "(I can't compile the test program, so we'll assume not...)"
16058                 fi
16059                 ;;
16060         esac
16061         $rm_try
16062         ;;
16063 esac
16064 set d_safemcpy
16065 eval $setvar
16066
16067 : can memcmp be trusted to compare relative magnitude?
16068 val="$undef"
16069 case "$d_memcmp" in
16070 "$define")
16071         echo " "
16072         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16073         $cat >try.c <<EOCP
16074 #$i_memory I_MEMORY
16075 #$i_stdlib I_STDLIB
16076 #$i_string I_STRING
16077 #$i_unistd I_UNISTD
16078 EOCP
16079         $cat >>try.c <<'EOCP'
16080 #include <stdio.h>
16081 #ifdef I_MEMORY
16082 #  include <memory.h>
16083 #endif
16084 #ifdef I_STDLIB
16085 #  include <stdlib.h>
16086 #endif
16087 #ifdef I_STRING
16088 #  include <string.h>
16089 #else
16090 #  include <strings.h>
16091 #endif
16092 #ifdef I_UNISTD
16093 #  include <unistd.h>  /* Needed for NetBSD */
16094 #endif
16095 int main()
16096 {
16097 char a = -1;
16098 char b = 0;
16099 if ((a < b) && memcmp(&a, &b, 1) < 0)
16100         exit(1);
16101 exit(0);
16102 }
16103 EOCP
16104         set try
16105         if eval $compile_ok; then
16106                 if $run ./try 2>/dev/null; then
16107                         echo "Yes, it can."
16108                         val="$define"
16109                 else
16110                         echo "No, it can't (it uses signed chars)."
16111                 fi
16112         else
16113                 echo "(I can't compile the test program, so we'll assume not...)"
16114         fi
16115         ;;
16116 esac
16117 $rm_try
16118 set d_sanemcmp
16119 eval $setvar
16120
16121 : see if prototype for sbrk is available
16122 echo " "
16123 set d_sbrkproto sbrk $i_unistd unistd.h
16124 eval $hasproto
16125
16126 : see if select exists
16127 set select d_select
16128 eval $inlibc
16129
16130 : see if semctl exists
16131 set semctl d_semctl
16132 eval $inlibc
16133
16134 : see if semget exists
16135 set semget d_semget
16136 eval $inlibc
16137
16138 : see if semop exists
16139 set semop d_semop
16140 eval $inlibc
16141
16142 : see how much of the 'sem*(2)' library is present.
16143 h_sem=true
16144 echo " "
16145 case "$d_semctl$d_semget$d_semop" in
16146 *"$undef"*) h_sem=false;;
16147 esac
16148 case "$osname" in
16149 freebsd)
16150     case "`ipcs 2>&1`" in
16151     "SVID messages"*"not configured"*)
16152         echo "Your $osname does not have the sem*(2) configured." >&4
16153         h_sem=false
16154         val="$undef"
16155         set semctl d_semctl
16156         eval $setvar
16157         set semget d_semget
16158         eval $setvar
16159         set semop d_semop
16160         eval $setvar
16161         ;;
16162     esac
16163     ;;
16164 esac
16165 : we could also check for sys/ipc.h ...
16166 if $h_sem && $test `./findhdr sys/sem.h`; then
16167         echo "You have the full sem*(2) library." >&4
16168         val="$define"
16169 else
16170         echo "You don't have the full sem*(2) library." >&4
16171         val="$undef"
16172 fi
16173 set d_sem
16174 eval $setvar
16175
16176 : see whether sys/sem.h defines union semun
16177 echo " "
16178 $cat > try.c <<'END'
16179 #include <sys/types.h>
16180 #include <sys/ipc.h>
16181 #include <sys/sem.h>
16182 int main () { union semun semun; semun.buf = 0; }
16183 END
16184 set try
16185 if eval $compile; then
16186     echo "You have union semun in <sys/sem.h>." >&4
16187     val="$define"
16188 else
16189     echo "You do not have union semun in <sys/sem.h>." >&4
16190     val="$undef"
16191 fi
16192 $rm_try
16193 set d_union_semun
16194 eval $setvar
16195
16196 : see how to do semctl IPC_STAT
16197 case "$d_sem" in
16198 $define)
16199     echo " "
16200     $cat > tryh.h <<END
16201 #ifndef S_IRUSR
16202 #   ifdef S_IREAD
16203 #       define S_IRUSR S_IREAD
16204 #       define S_IWUSR S_IWRITE
16205 #       define S_IXUSR S_IEXEC
16206 #   else
16207 #       define S_IRUSR 0400
16208 #       define S_IWUSR 0200
16209 #       define S_IXUSR 0100
16210 #   endif
16211 #   define S_IRGRP (S_IRUSR>>3)
16212 #   define S_IWGRP (S_IWUSR>>3)
16213 #   define S_IXGRP (S_IXUSR>>3)
16214 #   define S_IROTH (S_IRUSR>>6)
16215 #   define S_IWOTH (S_IWUSR>>6)
16216 #   define S_IXOTH (S_IXUSR>>6)
16217 #endif
16218 #ifndef S_IRWXU
16219 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16220 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16221 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16222 #endif
16223 END
16224     : see whether semctl IPC_STAT can use union semun
16225     case "$d_semctl_semun" in
16226     '')
16227       val="$undef"
16228       $cat > try.c <<END
16229 #include <sys/types.h>
16230 #include <sys/ipc.h>
16231 #include <sys/sem.h>
16232 #include <sys/stat.h>
16233 #include <stdio.h>
16234 #include <errno.h>
16235 #include "tryh.h"
16236 #ifndef errno
16237 extern int errno;
16238 #endif
16239 #$d_union_semun HAS_UNION_SEMUN
16240 int main() {
16241     union semun
16242 #ifndef HAS_UNION_SEMUN
16243     {
16244         int val;
16245         struct semid_ds *buf;
16246         unsigned short *array;
16247     }
16248 #endif
16249     arg;
16250     int sem, st;
16251
16252 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16253     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16254     if (sem > -1) {
16255         struct semid_ds argbuf;
16256         arg.buf = &argbuf;
16257 #       ifdef IPC_STAT
16258         st = semctl(sem, 0, IPC_STAT, arg);
16259         if (st == 0)
16260             printf("semun\n");
16261         else
16262 #       endif /* IPC_STAT */
16263             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16264 #       ifdef IPC_RMID
16265         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16266 #       endif /* IPC_RMID */
16267             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16268     } else
16269 #endif /* IPC_PRIVATE && ... */
16270         printf("semget failed: errno = %d\n", errno);
16271   return 0;
16272 }
16273 END
16274       set try
16275       if eval $compile; then
16276           xxx=`$run ./try`
16277           case "$xxx" in
16278           semun) val="$define" ;;
16279           esac
16280       fi
16281       $rm_try
16282       set d_semctl_semun
16283       eval $setvar
16284       ;;
16285     esac
16286     case "$d_semctl_semun" in
16287     $define)
16288         echo "You can use union semun for semctl IPC_STAT." >&4
16289         also='also'
16290         ;;
16291     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16292         also=''
16293         ;;
16294     esac
16295
16296     : see whether semctl IPC_STAT can use struct semid_ds pointer
16297     case "$d_semctl_semid_ds" in
16298     '')
16299       val="$undef"
16300       $cat > try.c <<'END'
16301 #include <sys/types.h>
16302 #include <sys/ipc.h>
16303 #include <sys/sem.h>
16304 #include <sys/stat.h>
16305 #include "tryh.h"
16306 #include <stdio.h>
16307 #include <errno.h>
16308 #ifndef errno
16309 extern int errno;
16310 #endif
16311 int main() {
16312     struct semid_ds arg;
16313     int sem, st;
16314
16315 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16316     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16317     if (sem > -1) {
16318 #       ifdef IPC_STAT
16319         st = semctl(sem, 0, IPC_STAT, &arg);
16320         if (st == 0)
16321             printf("semid_ds\n");
16322         else
16323 #       endif /* IPC_STAT */
16324             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16325 #       ifdef IPC_RMID
16326         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16327 #       endif /* IPC_RMID */
16328             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16329     } else
16330 #endif /* IPC_PRIVATE && ... */
16331         printf("semget failed: errno = %d\n", errno);
16332
16333     return 0;
16334 }
16335 END
16336       set try
16337       if eval $compile; then
16338           xxx=`$run ./try`
16339           case "$xxx" in
16340           semid_ds) val="$define" ;;
16341           esac
16342       fi
16343       $rm_try
16344       set d_semctl_semid_ds
16345       eval $setvar
16346       ;;
16347     esac
16348     case "$d_semctl_semid_ds" in
16349     $define)
16350         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16351         ;;
16352     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16353         ;;
16354     esac
16355     ;;
16356 *)  val="$undef"
16357
16358     # We do not have the full sem*(2) library, so assume we can not
16359     # use either.
16360
16361     set d_semctl_semun
16362     eval $setvar
16363
16364     set d_semctl_semid_ds
16365     eval $setvar
16366     ;;
16367 esac
16368 $rm_try tryh.h
16369
16370 : see if sendmsg exists
16371 set sendmsg d_sendmsg
16372 eval $inlibc
16373
16374 : see if setegid exists
16375 set setegid d_setegid
16376 eval $inlibc
16377
16378 : see if seteuid exists
16379 set seteuid d_seteuid
16380 eval $inlibc
16381
16382 : see if setgrent exists
16383 set setgrent d_setgrent
16384 eval $inlibc
16385
16386 : see if setgrent_r exists
16387 set setgrent_r d_setgrent_r
16388 eval $inlibc
16389 case "$d_setgrent_r" in
16390 "$define")
16391         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16392         case "$d_setgrent_r_proto:$usethreads" in
16393         ":define")      d_setgrent_r_proto=define
16394                 set d_setgrent_r_proto setgrent_r $hdrs
16395                 eval $hasproto ;;
16396         *)      ;;
16397         esac
16398         case "$d_setgrent_r_proto" in
16399         define)
16400         case "$setgrent_r_proto" in
16401         ''|0) try='int setgrent_r(FILE**);'
16402         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16403         esac
16404         case "$setgrent_r_proto" in
16405         ''|0) try='void setgrent_r(FILE**);'
16406         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16407         esac
16408         case "$setgrent_r_proto" in
16409         ''|0)   d_setgrent_r=undef
16410                 setgrent_r_proto=0
16411                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16412         * )     case "$setgrent_r_proto" in
16413                 REENTRANT_PROTO*) ;;
16414                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16415                 esac
16416                 echo "Prototype: $try" ;;
16417         esac
16418         ;;
16419         *)      case "$usethreads" in
16420                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16421                 esac
16422                 d_setgrent_r=undef
16423                 setgrent_r_proto=0
16424                 ;;
16425         esac
16426         ;;
16427 *)      setgrent_r_proto=0
16428         ;;
16429 esac
16430
16431 : see if sethostent exists
16432 set sethostent d_sethent
16433 eval $inlibc
16434
16435 : see if sethostent_r exists
16436 set sethostent_r d_sethostent_r
16437 eval $inlibc
16438 case "$d_sethostent_r" in
16439 "$define")
16440         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16441         case "$d_sethostent_r_proto:$usethreads" in
16442         ":define")      d_sethostent_r_proto=define
16443                 set d_sethostent_r_proto sethostent_r $hdrs
16444                 eval $hasproto ;;
16445         *)      ;;
16446         esac
16447         case "$d_sethostent_r_proto" in
16448         define)
16449         case "$sethostent_r_proto" in
16450         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16451         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16452         esac
16453         case "$sethostent_r_proto" in
16454         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16455         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16456         esac
16457         case "$sethostent_r_proto" in
16458         ''|0)   d_sethostent_r=undef
16459                 sethostent_r_proto=0
16460                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16461         * )     case "$sethostent_r_proto" in
16462                 REENTRANT_PROTO*) ;;
16463                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16464                 esac
16465                 echo "Prototype: $try" ;;
16466         esac
16467         ;;
16468         *)      case "$usethreads" in
16469                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16470                 esac
16471                 d_sethostent_r=undef
16472                 sethostent_r_proto=0
16473                 ;;
16474         esac
16475         ;;
16476 *)      sethostent_r_proto=0
16477         ;;
16478 esac
16479
16480 : see if setitimer exists
16481 set setitimer d_setitimer
16482 eval $inlibc
16483
16484 : see if setlinebuf exists
16485 set setlinebuf d_setlinebuf
16486 eval $inlibc
16487
16488 : see if setlocale exists
16489 set setlocale d_setlocale
16490 eval $inlibc
16491
16492 : see if locale.h is available
16493 set locale.h i_locale
16494 eval $inhdr
16495
16496 : see if setlocale_r exists
16497 set setlocale_r d_setlocale_r
16498 eval $inlibc
16499 case "$d_setlocale_r" in
16500 "$define")
16501         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16502         case "$d_setlocale_r_proto:$usethreads" in
16503         ":define")      d_setlocale_r_proto=define
16504                 set d_setlocale_r_proto setlocale_r $hdrs
16505                 eval $hasproto ;;
16506         *)      ;;
16507         esac
16508         case "$d_setlocale_r_proto" in
16509         define)
16510         case "$setlocale_r_proto" in
16511         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16512         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16513         esac
16514         case "$setlocale_r_proto" in
16515         ''|0)   d_setlocale_r=undef
16516                 setlocale_r_proto=0
16517                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16518         * )     case "$setlocale_r_proto" in
16519                 REENTRANT_PROTO*) ;;
16520                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16521                 esac
16522                 echo "Prototype: $try" ;;
16523         esac
16524         ;;
16525         *)      case "$usethreads" in
16526                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16527                 esac
16528                 d_setlocale_r=undef
16529                 setlocale_r_proto=0
16530                 ;;
16531         esac
16532         ;;
16533 *)      setlocale_r_proto=0
16534         ;;
16535 esac
16536
16537 : see if setnetent exists
16538 set setnetent d_setnent
16539 eval $inlibc
16540
16541 : see if setnetent_r exists
16542 set setnetent_r d_setnetent_r
16543 eval $inlibc
16544 case "$d_setnetent_r" in
16545 "$define")
16546         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16547         case "$d_setnetent_r_proto:$usethreads" in
16548         ":define")      d_setnetent_r_proto=define
16549                 set d_setnetent_r_proto setnetent_r $hdrs
16550                 eval $hasproto ;;
16551         *)      ;;
16552         esac
16553         case "$d_setnetent_r_proto" in
16554         define)
16555         case "$setnetent_r_proto" in
16556         ''|0) try='int setnetent_r(int, struct netent_data*);'
16557         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16558         esac
16559         case "$setnetent_r_proto" in
16560         ''|0) try='void setnetent_r(int, struct netent_data*);'
16561         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16562         esac
16563         case "$setnetent_r_proto" in
16564         ''|0)   d_setnetent_r=undef
16565                 setnetent_r_proto=0
16566                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16567         * )     case "$setnetent_r_proto" in
16568                 REENTRANT_PROTO*) ;;
16569                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16570                 esac
16571                 echo "Prototype: $try" ;;
16572         esac
16573         ;;
16574         *)      case "$usethreads" in
16575                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16576                 esac
16577                 d_setnetent_r=undef
16578                 setnetent_r_proto=0
16579                 ;;
16580         esac
16581         ;;
16582 *)      setnetent_r_proto=0
16583         ;;
16584 esac
16585
16586 : see if setprotoent exists
16587 set setprotoent d_setpent
16588 eval $inlibc
16589
16590 : see if setpgid exists
16591 set setpgid d_setpgid
16592 eval $inlibc
16593
16594 : see if setpgrp2 exists
16595 set setpgrp2 d_setpgrp2
16596 eval $inlibc
16597
16598 : see if setpriority exists
16599 set setpriority d_setprior
16600 eval $inlibc
16601
16602 : see if setproctitle exists
16603 set setproctitle d_setproctitle
16604 eval $inlibc
16605
16606 : see if setprotoent_r exists
16607 set setprotoent_r d_setprotoent_r
16608 eval $inlibc
16609 case "$d_setprotoent_r" in
16610 "$define")
16611         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16612         case "$d_setprotoent_r_proto:$usethreads" in
16613         ":define")      d_setprotoent_r_proto=define
16614                 set d_setprotoent_r_proto setprotoent_r $hdrs
16615                 eval $hasproto ;;
16616         *)      ;;
16617         esac
16618         case "$d_setprotoent_r_proto" in
16619         define)
16620         case "$setprotoent_r_proto" in
16621         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16622         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16623         esac
16624         case "$setprotoent_r_proto" in
16625         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16626         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16627         esac
16628         case "$setprotoent_r_proto" in
16629         ''|0)   d_setprotoent_r=undef
16630                 setprotoent_r_proto=0
16631                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16632         * )     case "$setprotoent_r_proto" in
16633                 REENTRANT_PROTO*) ;;
16634                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16635                 esac
16636                 echo "Prototype: $try" ;;
16637         esac
16638         ;;
16639         *)      case "$usethreads" in
16640                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16641                 esac
16642                 d_setprotoent_r=undef
16643                 setprotoent_r_proto=0
16644                 ;;
16645         esac
16646         ;;
16647 *)      setprotoent_r_proto=0
16648         ;;
16649 esac
16650
16651 : see if setpwent exists
16652 set setpwent d_setpwent
16653 eval $inlibc
16654
16655 : see if setpwent_r exists
16656 set setpwent_r d_setpwent_r
16657 eval $inlibc
16658 case "$d_setpwent_r" in
16659 "$define")
16660         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16661         case "$d_setpwent_r_proto:$usethreads" in
16662         ":define")      d_setpwent_r_proto=define
16663                 set d_setpwent_r_proto setpwent_r $hdrs
16664                 eval $hasproto ;;
16665         *)      ;;
16666         esac
16667         case "$d_setpwent_r_proto" in
16668         define)
16669         case "$setpwent_r_proto" in
16670         ''|0) try='int setpwent_r(FILE**);'
16671         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16672         esac
16673         case "$setpwent_r_proto" in
16674         ''|0) try='void setpwent_r(FILE**);'
16675         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16676         esac
16677         case "$setpwent_r_proto" in
16678         ''|0)   d_setpwent_r=undef
16679                 setpwent_r_proto=0
16680                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16681         * )     case "$setpwent_r_proto" in
16682                 REENTRANT_PROTO*) ;;
16683                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16684                 esac
16685                 echo "Prototype: $try" ;;
16686         esac
16687         ;;
16688         *)      case "$usethreads" in
16689                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16690                 esac
16691                 d_setpwent_r=undef
16692                 setpwent_r_proto=0
16693                 ;;
16694         esac
16695         ;;
16696 *)      setpwent_r_proto=0
16697         ;;
16698 esac
16699
16700 : see if setregid exists
16701 set setregid d_setregid
16702 eval $inlibc
16703 set setresgid d_setresgid
16704 eval $inlibc
16705
16706 : see if setreuid exists
16707 set setreuid d_setreuid
16708 eval $inlibc
16709 set setresuid d_setresuid
16710 eval $inlibc
16711
16712 : see if setrgid exists
16713 set setrgid d_setrgid
16714 eval $inlibc
16715
16716 : see if setruid exists
16717 set setruid d_setruid
16718 eval $inlibc
16719
16720 : see if setservent exists
16721 set setservent d_setsent
16722 eval $inlibc
16723
16724 : see if setservent_r exists
16725 set setservent_r d_setservent_r
16726 eval $inlibc
16727 case "$d_setservent_r" in
16728 "$define")
16729         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16730         case "$d_setservent_r_proto:$usethreads" in
16731         ":define")      d_setservent_r_proto=define
16732                 set d_setservent_r_proto setservent_r $hdrs
16733                 eval $hasproto ;;
16734         *)      ;;
16735         esac
16736         case "$d_setservent_r_proto" in
16737         define)
16738         case "$setservent_r_proto" in
16739         ''|0) try='int setservent_r(int, struct servent_data*);'
16740         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16741         esac
16742         case "$setservent_r_proto" in
16743         ''|0) try='void setservent_r(int, struct servent_data*);'
16744         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16745         esac
16746         case "$setservent_r_proto" in
16747         ''|0)   d_setservent_r=undef
16748                 setservent_r_proto=0
16749                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16750         * )     case "$setservent_r_proto" in
16751                 REENTRANT_PROTO*) ;;
16752                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16753                 esac
16754                 echo "Prototype: $try" ;;
16755         esac
16756         ;;
16757         *)      case "$usethreads" in
16758                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16759                 esac
16760                 d_setservent_r=undef
16761                 setservent_r_proto=0
16762                 ;;
16763         esac
16764         ;;
16765 *)      setservent_r_proto=0
16766         ;;
16767 esac
16768
16769 : see if setsid exists
16770 set setsid d_setsid
16771 eval $inlibc
16772
16773 : see if setvbuf exists
16774 set setvbuf d_setvbuf
16775 eval $inlibc
16776
16777 : see if sfio.h is available
16778 set sfio.h i_sfio
16779 eval $inhdr
16780
16781
16782 : see if sfio library is available
16783 case "$i_sfio" in
16784 $define)
16785         val=''
16786         set sfreserve val
16787         eval $inlibc
16788         ;;
16789 *)
16790         val="$undef"
16791         ;;
16792 esac
16793 : Ok, but do we want to use it.
16794 case "$val" in
16795 $define)
16796         case "$usesfio" in
16797         true|$define|[yY]*) dflt='y';;
16798         *) dflt='n';;
16799         esac
16800         echo "$package can use the sfio library, but it is experimental."
16801         case "$useperlio" in
16802         "$undef")
16803             echo "For sfio also the PerlIO abstraction layer is needed."
16804             echo "Earlier you said you wouldn't want that."
16805             ;;
16806         esac
16807         rp="You seem to have sfio available, do you want to try using it?"
16808         . ./myread
16809         case "$ans" in
16810         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16811                 useperlio="$define"
16812                 val="$define"
16813                 ;;
16814         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16815                 val="$undef"
16816                 ;;
16817         esac
16818         ;;
16819 *)      case "$usesfio" in
16820         true|$define|[yY]*)
16821                 echo "Sorry, cannot find sfio on this machine." >&4
16822                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16823                 val="$undef"
16824                 ;;
16825         esac
16826         ;;
16827 esac
16828 set d_sfio
16829 eval $setvar
16830 case "$d_sfio" in
16831 $define) usesfio='true';;
16832 *) usesfio='false';;
16833 esac
16834 case "$d_sfio" in
16835 $define) ;;
16836 *)      : Remove sfio from list of libraries to use
16837         case "$libs" in
16838         *-lsfio*)
16839                 echo "Removing unneeded -lsfio from library list" >&4
16840                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16841                 shift
16842                 libs="$*"
16843                 echo "libs = $libs" >&4
16844                 ;;
16845         esac
16846 ;;
16847 esac
16848
16849
16850 : see if shmctl exists
16851 set shmctl d_shmctl
16852 eval $inlibc
16853
16854 : see if shmget exists
16855 set shmget d_shmget
16856 eval $inlibc
16857
16858 : see if shmat exists
16859 set shmat d_shmat
16860 eval $inlibc
16861 : see what shmat returns
16862 case "$d_shmat" in
16863 "$define")
16864         $cat >shmat.c <<'END'
16865 #include <sys/shm.h>
16866 void *shmat();
16867 END
16868         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16869                 shmattype='void *'
16870         else
16871                 shmattype='char *'
16872         fi
16873         echo "and it returns ($shmattype)." >&4
16874         : see if a prototype for shmat is available
16875         xxx=`./findhdr sys/shm.h`
16876         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16877         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16878                 val="$define"
16879         else
16880                 val="$undef"
16881         fi
16882         $rm -f shmat.[co]
16883         ;;
16884 *)
16885         val="$undef"
16886         ;;
16887 esac
16888 set d_shmatprototype
16889 eval $setvar
16890
16891 : see if shmdt exists
16892 set shmdt d_shmdt
16893 eval $inlibc
16894
16895 : see how much of the 'shm*(2)' library is present.
16896 h_shm=true
16897 echo " "
16898 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16899 *"$undef"*) h_shm=false;;
16900 esac
16901 case "$osname" in
16902 freebsd)
16903     case "`ipcs 2>&1`" in
16904     "SVID shared memory"*"not configured"*)
16905         echo "Your $osname does not have the shm*(2) configured." >&4
16906         h_shm=false
16907         val="$undef"
16908         set shmctl d_shmctl
16909         evat $setvar
16910         set shmget d_shmget
16911         evat $setvar
16912         set shmat d_shmat
16913         evat $setvar
16914         set shmdt d_shmdt
16915         evat $setvar
16916         ;;
16917     esac
16918     ;;
16919 esac
16920 : we could also check for sys/ipc.h ...
16921 if $h_shm && $test `./findhdr sys/shm.h`; then
16922         echo "You have the full shm*(2) library." >&4
16923         val="$define"
16924 else
16925         echo "You don't have the full shm*(2) library." >&4
16926         val="$undef"
16927 fi
16928 set d_shm
16929 eval $setvar
16930
16931 echo " "
16932 : see if we have sigaction
16933 if set sigaction val -f d_sigaction; eval $csym; $val; then
16934         echo 'sigaction() found.' >&4
16935         $cat > try.c <<EOP
16936 #include <stdio.h>
16937 #include <sys/types.h>
16938 #include <signal.h>
16939 #$i_stdlib I_STDLIB
16940 #ifdef I_STDLIB
16941 #include <stdlib.h>
16942 #endif
16943 int main()
16944 {
16945     struct sigaction act, oact;
16946     act.sa_flags = 0;
16947     oact.sa_handler = 0;
16948     /* so that act and oact are used */
16949     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16950 }
16951 EOP
16952         set try
16953         if eval $compile_ok; then
16954                 val="$define"
16955         else
16956                 echo "But you don't seem to have a useable struct sigaction." >&4
16957                 val="$undef"
16958         fi
16959 else
16960         echo 'sigaction NOT found.' >&4
16961         val="$undef"
16962 fi
16963 set d_sigaction; eval $setvar
16964 $rm_try
16965
16966 : see if this is a sunmath.h system
16967 set sunmath.h i_sunmath
16968 eval $inhdr
16969
16970 : see if signbit exists
16971 $echo $n "Checking to see if you have signbit() available to work on $nvtype... $c" >&4
16972 $cat >try.c <<EOCP
16973 #$i_math I_MATH
16974 #$i_sunmath I_SUNMATH
16975 #ifdef I_MATH
16976 #  include <math.h>
16977 #endif
16978 #ifdef I_SUNMATH  /* Solaris special math library */
16979 #  include <sunmath.h>
16980 #endif
16981 #define NV $nvtype
16982 int main(int argc, char **argv)
16983 {
16984     NV x = 0.0;
16985     NV y = -0.0;
16986     if ((signbit(x) == 0) && (signbit(y) != 0))
16987         return 0;
16988     else
16989         return 1;
16990 }
16991 EOCP
16992 val="$undef"
16993 set try
16994 if eval $compile; then
16995     if $run ./try; then
16996         $echo "Yes." >&4
16997         val="$define"
16998     else
16999         $echo "Signbit seems to be available, but doesn't work as I expected."
17000         $echo "I won't use it." >&4
17001         val="$undef"
17002     fi
17003 else
17004     $echo "Nope." >&4
17005     dflt="$undef"
17006 fi
17007 set d_signbit
17008 eval $setvar
17009 $rm_try
17010
17011 : see if sigprocmask exists
17012 set sigprocmask d_sigprocmask
17013 eval $inlibc
17014
17015 : see if sigsetjmp exists
17016 echo " "
17017 case "$d_sigsetjmp" in
17018 '')
17019         $cat >try.c <<EOP
17020 #include <setjmp.h>
17021 #$i_stdlib I_STDLIB
17022 #ifdef I_STDLIB
17023 #include <stdlib.h>
17024 #endif
17025 sigjmp_buf env;
17026 int set = 1;
17027 int main()
17028 {
17029         if (sigsetjmp(env,1))
17030                 exit(set);
17031         set = 0;
17032         siglongjmp(env, 1);
17033         exit(1);
17034 }
17035 EOP
17036         set try
17037         if eval $compile; then
17038                 if $run ./try >/dev/null 2>&1; then
17039                         echo "POSIX sigsetjmp found." >&4
17040                         val="$define"
17041                 else
17042                         $cat >&4 <<EOM
17043 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17044 I'll ignore them.
17045 EOM
17046                         val="$undef"
17047                 fi
17048         else
17049                 echo "sigsetjmp not found." >&4
17050                 val="$undef"
17051         fi
17052         ;;
17053 *) val="$d_sigsetjmp"
17054         case "$d_sigsetjmp" in
17055         $define) echo "POSIX sigsetjmp found." >&4;;
17056         $undef) echo "sigsetjmp not found." >&4;;
17057         esac
17058         ;;
17059 esac
17060 set d_sigsetjmp
17061 eval $setvar
17062 $rm_try
17063
17064 : see if snprintf exists
17065 set snprintf d_snprintf
17066 eval $inlibc
17067
17068 : see if vsnprintf exists
17069 set vsnprintf d_vsnprintf
17070 eval $inlibc
17071
17072 case "$d_snprintf-$d_vsnprintf" in
17073 "$define-$define")
17074     $cat <<EOM
17075 Checking whether your snprintf() and vsnprintf() work okay...
17076 EOM
17077     $cat >try.c <<'EOCP'
17078 /* v?snprintf testing logic courtesy of Russ Allbery.
17079  * According to C99:
17080  * - if the buffer is too short it still must be \0-terminated
17081  * - if the buffer is too short the potentially required length
17082  *   must be returned and not -1
17083  * - if the buffer is NULL the potentially required length
17084  *   must be returned and not -1 or core dump
17085  */
17086 #include <stdio.h>
17087 #include <stdarg.h>
17088
17089 char buf[2];
17090
17091 int test (char *format, ...)
17092 {
17093     va_list args;
17094     int count;
17095
17096     va_start (args, format);
17097     count = vsnprintf (buf, sizeof buf, format, args);
17098     va_end (args);
17099     return count;
17100 }
17101
17102 int main ()
17103 {
17104     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17105              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17106 }
17107 EOCP
17108     set try
17109     if eval $compile; then
17110         `$run ./try`
17111         case "$?" in
17112         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17113         *) cat <<EOM >&4
17114 Your snprintf() and snprintf() don't seem to be working okay.
17115 EOM
17116            d_snprintf="$undef"
17117            d_vsnprintf="$undef"
17118            ;;
17119         esac
17120     else
17121         echo "(I can't seem to compile the test program--assuming they don't)"
17122         d_snprintf="$undef"
17123         d_vsnprintf="$undef"
17124     fi
17125     $rm_try
17126     ;;
17127 esac
17128
17129 : see if sockatmark exists
17130 set sockatmark d_sockatmark
17131 eval $inlibc
17132
17133 : see if prototype for sockatmark is available
17134 echo " "
17135 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17136 eval $hasproto
17137
17138 : see if socks5_init exists
17139 set socks5_init d_socks5_init
17140 eval $inlibc
17141
17142 : see if sprintf returns the length of the string in the buffer as per ANSI
17143 $echo "Checking whether sprintf returns the length of the string..." >&4
17144 $cat <<EOP >try.c
17145 #include <stdio.h>
17146 #$i_stdlib I_STDLIB
17147 #ifdef I_STDLIB
17148 #include <stdlib.h>
17149 #endif
17150 #$i_string I_STRING
17151 #ifdef I_STRING
17152 #  include <string.h>
17153 #else
17154 #  include <strings.h>
17155 #endif
17156 #$i_math I_MATH
17157 #ifdef I_MATH
17158 #include <math.h>
17159 #endif
17160
17161 char buffer[256];
17162
17163 int check (size_t expect, int test) {
17164   size_t got = strlen(buffer);
17165   if (expect == got)
17166     return 0;
17167
17168   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17169        test, buffer);
17170   exit (test);
17171 }
17172
17173 int main(int argc, char **argv) {
17174   int test = 0;
17175
17176   check(sprintf(buffer, ""), ++test);
17177   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17178   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17179
17180   return 0;
17181 }
17182 EOP
17183 set try
17184
17185 d_sprintf_returns_strlen="$undef"
17186 if eval $compile; then
17187     xxx="`$run ./try`"
17188     case "$?" in
17189         0) cat >&4 <<EOM
17190 sprintf returns the length of the string (as ANSI says it should)
17191 EOM
17192         d_sprintf_returns_strlen="$define"
17193         ;;
17194         *) cat >&4 <<EOM
17195 sprintf does not return the length of the string (how old is this system?)
17196 EOM
17197         d_sprintf_returns_strlen="$undef"
17198         ;;
17199     esac
17200 fi
17201 $rm_try
17202
17203 : see if srand48_r exists
17204 set srand48_r d_srand48_r
17205 eval $inlibc
17206 case "$d_srand48_r" in
17207 "$define")
17208         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17209         case "$d_srand48_r_proto:$usethreads" in
17210         ":define")      d_srand48_r_proto=define
17211                 set d_srand48_r_proto srand48_r $hdrs
17212                 eval $hasproto ;;
17213         *)      ;;
17214         esac
17215         case "$d_srand48_r_proto" in
17216         define)
17217         case "$srand48_r_proto" in
17218         ''|0) try='int srand48_r(long, struct drand48_data*);'
17219         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17220         esac
17221         case "$srand48_r_proto" in
17222         ''|0)   d_srand48_r=undef
17223                 srand48_r_proto=0
17224                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17225         * )     case "$srand48_r_proto" in
17226                 REENTRANT_PROTO*) ;;
17227                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17228                 esac
17229                 echo "Prototype: $try" ;;
17230         esac
17231         ;;
17232         *)      case "$usethreads" in
17233                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17234                 esac
17235                 d_srand48_r=undef
17236                 srand48_r_proto=0
17237                 ;;
17238         esac
17239         ;;
17240 *)      srand48_r_proto=0
17241         ;;
17242 esac
17243
17244 : see if srandom_r exists
17245 set srandom_r d_srandom_r
17246 eval $inlibc
17247 case "$d_srandom_r" in
17248 "$define")
17249         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17250         case "$d_srandom_r_proto:$usethreads" in
17251         ":define")      d_srandom_r_proto=define
17252                 set d_srandom_r_proto srandom_r $hdrs
17253                 eval $hasproto ;;
17254         *)      ;;
17255         esac
17256         case "$d_srandom_r_proto" in
17257         define)
17258         case "$srandom_r_proto" in
17259         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17260         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17261         esac
17262         case "$srandom_r_proto" in
17263         ''|0)   d_srandom_r=undef
17264                 srandom_r_proto=0
17265                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17266         * )     case "$srandom_r_proto" in
17267                 REENTRANT_PROTO*) ;;
17268                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17269                 esac
17270                 echo "Prototype: $try" ;;
17271         esac
17272         ;;
17273         *)      case "$usethreads" in
17274                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17275                 esac
17276                 d_srandom_r=undef
17277                 srandom_r_proto=0
17278                 ;;
17279         esac
17280         ;;
17281 *)      srandom_r_proto=0
17282         ;;
17283 esac
17284
17285 : see if prototype for setresgid is available
17286 echo " "
17287 set d_sresgproto setresgid $i_unistd unistd.h
17288 eval $hasproto
17289
17290 : see if prototype for setresuid is available
17291 echo " "
17292 set d_sresuproto setresuid $i_unistd unistd.h
17293 eval $hasproto
17294
17295 : see if sys/stat.h is available
17296 set sys/stat.h i_sysstat
17297 eval $inhdr
17298
17299
17300 : see if stat knows about block sizes
17301 echo " "
17302 echo "Checking to see if your struct stat has st_blocks field..." >&4
17303 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17304 eval $hasfield
17305
17306
17307 : see if this is a sys/vfs.h system
17308 set sys/vfs.h i_sysvfs
17309 eval $inhdr
17310
17311
17312 : see if this is a sys/statfs.h system
17313 set sys/statfs.h i_sysstatfs
17314 eval $inhdr
17315
17316
17317 echo " "
17318 echo "Checking to see if your system supports struct statfs..." >&4
17319 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
17320 eval $hasstruct
17321 case "$d_statfs_s" in
17322 "$define")      echo "Yes, it does."   ;;
17323 *)              echo "No, it doesn't." ;;
17324 esac
17325
17326
17327
17328 : see if struct statfs knows about f_flags
17329 case "$d_statfs_s" in
17330 define) 
17331         echo " "
17332         echo "Checking to see if your struct statfs has f_flags field..." >&4
17333         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
17334         eval $hasfield
17335         ;;
17336 *)      val="$undef"
17337         set d_statfs_f_flags
17338         eval $setvar
17339         ;;
17340 esac
17341 case "$d_statfs_f_flags" in
17342 "$define")      echo "Yes, it does."   ;;
17343 *)              echo "No, it doesn't." ;;
17344 esac
17345
17346 $cat >&4 <<EOM
17347 Checking how to access stdio streams by file descriptor number...
17348 EOM
17349 case "$stdio_stream_array" in
17350 '')     $cat >try.c <<EOCP
17351 #include <stdio.h>
17352 int main() {
17353   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17354     printf("yes\n");
17355 }
17356 EOCP
17357         for s in _iob __iob __sF
17358         do
17359                 set try -DSTDIO_STREAM_ARRAY=$s
17360                 if eval $compile; then
17361                         case "`$run ./try`" in
17362                         yes)    stdio_stream_array=$s; break ;;
17363                         esac
17364                 fi
17365         done
17366         $rm_try
17367 esac
17368 case "$stdio_stream_array" in
17369 '')     $cat >&4 <<EOM
17370 I can't figure out how to access stdio streams by file descriptor number.
17371 EOM
17372         d_stdio_stream_array="$undef"
17373         ;;
17374 *)      $cat >&4 <<EOM
17375 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17376 EOM
17377         d_stdio_stream_array="$define"
17378         ;;
17379 esac
17380
17381 : see if strcoll exists
17382 set strcoll d_strcoll
17383 eval $inlibc
17384
17385 : check for structure copying
17386 echo " "
17387 echo "Checking to see if your C compiler can copy structs..." >&4
17388 $cat >try.c <<'EOCP'
17389 int main()
17390 {
17391         struct blurfl {
17392                 int dyick;
17393         } foo, bar;
17394
17395         foo = bar;
17396 }
17397 EOCP
17398 if $cc -c try.c >/dev/null 2>&1 ; then
17399         val="$define"
17400         echo "Yup, it can."
17401 else
17402         val="$undef"
17403         echo "Nope, it can't."
17404 fi
17405 set d_strctcpy
17406 eval $setvar
17407 $rm_try
17408
17409 : see if strerror and/or sys_errlist[] exist
17410 echo " "
17411 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17412     if set strerror val -f d_strerror; eval $csym; $val; then
17413                 echo 'strerror() found.' >&4
17414                 d_strerror="$define"
17415                 d_strerrm='strerror(e)'
17416                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17417                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17418                         d_syserrlst="$define"
17419                 else
17420                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17421                         d_syserrlst="$undef"
17422                 fi
17423     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17424                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17425                 echo 'strerror() found in string header.' >&4
17426                 d_strerror="$define"
17427                 d_strerrm='strerror(e)'
17428                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17429                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17430                                 d_syserrlst="$define"
17431                 else
17432                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17433                         d_syserrlst="$undef"
17434                 fi
17435     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17436                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17437                 d_strerror="$undef"
17438                 d_syserrlst="$define"
17439                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17440     else
17441                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17442                 d_strerror="$undef"
17443                 d_syserrlst="$undef"
17444                 d_strerrm='"unknown"'
17445     fi
17446 fi
17447
17448 : see if strerror_r exists
17449 set strerror_r d_strerror_r
17450 eval $inlibc
17451 case "$d_strerror_r" in
17452 "$define")
17453         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17454         case "$d_strerror_r_proto:$usethreads" in
17455         ":define")      d_strerror_r_proto=define
17456                 set d_strerror_r_proto strerror_r $hdrs
17457                 eval $hasproto ;;
17458         *)      ;;
17459         esac
17460         case "$d_strerror_r_proto" in
17461         define)
17462         case "$strerror_r_proto" in
17463         ''|0) try='int strerror_r(int, char*, size_t);'
17464         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17465         esac
17466         case "$strerror_r_proto" in
17467         ''|0) try='int strerror_r(int, char*, int);'
17468         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17469         esac
17470         case "$strerror_r_proto" in
17471         ''|0) try='char* strerror_r(int, char*, size_t);'
17472         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17473         esac
17474         case "$strerror_r_proto" in
17475         ''|0)   d_strerror_r=undef
17476                 strerror_r_proto=0
17477                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17478         * )     case "$strerror_r_proto" in
17479                 REENTRANT_PROTO*) ;;
17480                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17481                 esac
17482                 echo "Prototype: $try" ;;
17483         esac
17484         ;;
17485         *)      case "$usethreads" in
17486                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17487                 esac
17488                 d_strerror_r=undef
17489                 strerror_r_proto=0
17490                 ;;
17491         esac
17492         ;;
17493 *)      strerror_r_proto=0
17494         ;;
17495 esac
17496
17497 : see if strftime exists
17498 set strftime d_strftime
17499 eval $inlibc
17500
17501 : see if strlcat exists
17502 set strlcat d_strlcat
17503 eval $inlibc
17504
17505 : see if strlcpy exists
17506 set strlcpy d_strlcpy
17507 eval $inlibc
17508
17509 : see if strtod exists
17510 set strtod d_strtod
17511 eval $inlibc
17512
17513 : see if strtol exists
17514 set strtol d_strtol
17515 eval $inlibc
17516
17517 : see if strtold exists
17518 set strtold d_strtold
17519 eval $inlibc
17520
17521 : see if strtoll exists
17522 set strtoll d_strtoll
17523 eval $inlibc
17524
17525 case "$d_longlong-$d_strtoll" in
17526 "$define-$define")
17527         $cat <<EOM
17528 Checking whether your strtoll() works okay...
17529 EOM
17530         $cat >try.c <<'EOCP'
17531 #include <errno.h>
17532 #ifdef __hpux
17533 #define strtoll __strtoll
17534 #endif
17535 #ifdef __EMX__
17536 #define strtoll _strtoll
17537 #endif
17538 #include <stdio.h>
17539 extern long long int strtoll(char *s, char **, int); 
17540 static int bad = 0;
17541 int check(char *s, long long ell, int een) {
17542         long long gll;
17543         errno = 0;
17544         gll = strtoll(s, 0, 10);
17545         if (!((gll == ell) && (errno == een)))
17546                 bad++;
17547 }
17548 int main() {
17549         check(" 1",                                      1LL, 0);
17550         check(" 0",                                      0LL, 0);
17551         check("-1",                                     -1LL, 0);
17552         check("-9223372036854775808", -9223372036854775808LL, 0);
17553         check("-9223372036854775808", -9223372036854775808LL, 0);
17554         check(" 9223372036854775807",  9223372036854775807LL, 0);
17555         check("-9223372036854775808", -9223372036854775808LL, 0);
17556         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17557         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17558         if (!bad)
17559                 printf("ok\n");
17560 }
17561 EOCP
17562         set try
17563         if eval $compile; then
17564                 yyy=`$run ./try`
17565                 case "$yyy" in
17566                 ok) echo "Your strtoll() seems to be working okay." ;;
17567                 *) cat <<EOM >&4
17568 Your strtoll() doesn't seem to be working okay.
17569 EOM
17570                    d_strtoll="$undef"
17571                    ;;
17572                 esac
17573         else
17574                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17575                 d_strtoll="$undef"
17576         fi
17577         ;;
17578 esac
17579
17580 : see if strtoq exists
17581 set strtoq d_strtoq
17582 eval $inlibc
17583
17584 : see if strtoul exists
17585 set strtoul d_strtoul
17586 eval $inlibc
17587
17588 case "$d_strtoul" in
17589 "$define")
17590         $cat <<EOM
17591 Checking whether your strtoul() works okay...
17592 EOM
17593         $cat >try.c <<'EOCP'
17594 #include <errno.h>
17595 #include <stdio.h>
17596 extern unsigned long int strtoul(char *s, char **, int); 
17597 static int bad = 0;
17598 void check(char *s, unsigned long eul, int een) {
17599         unsigned long gul;
17600         errno = 0;
17601         gul = strtoul(s, 0, 10);
17602         if (!((gul == eul) && (errno == een)))
17603                 bad++;
17604 }
17605 int main() {
17606         check(" 1", 1L, 0);
17607         check(" 0", 0L, 0);
17608 EOCP
17609         case "$longsize" in
17610         8)
17611             $cat >>try.c <<'EOCP'
17612         check("18446744073709551615", 18446744073709551615UL, 0);
17613         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17614 #if 0 /* strtoul() for /^-/ strings is undefined. */
17615         check("-1", 18446744073709551615UL, 0);
17616         check("-18446744073709551614", 2, 0);
17617         check("-18446744073709551615", 1, 0);
17618         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17619         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17620 #endif
17621 EOCP
17622                 ;;
17623         4)
17624                     $cat >>try.c <<'EOCP'
17625         check("4294967295", 4294967295UL, 0);
17626         check("4294967296", 4294967295UL, ERANGE);
17627 #if 0 /* strtoul() for /^-/ strings is undefined. */
17628         check("-1", 4294967295UL, 0);
17629         check("-4294967294", 2, 0);
17630         check("-4294967295", 1, 0);
17631         check("-4294967296", 4294967295UL, ERANGE);
17632         check("-4294967297", 4294967295UL, ERANGE);
17633 #endif
17634 EOCP
17635                 ;;
17636         *)
17637 : Should we write these tests to be more portable by sprintf-ing
17638 : ~0 and then manipulating that char string as input for strtol?
17639                 ;;
17640         esac
17641         $cat >>try.c <<'EOCP'
17642         if (!bad)
17643                 printf("ok\n");
17644         return 0;
17645 }
17646 EOCP
17647         set try
17648         if eval $compile; then
17649                 case "`$run ./try`" in
17650                 ok) echo "Your strtoul() seems to be working okay." ;;
17651                 *) cat <<EOM >&4
17652 Your strtoul() doesn't seem to be working okay.
17653 EOM
17654                    d_strtoul="$undef"
17655                    ;;
17656                 esac
17657         else
17658                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17659                 d_strtoul="$undef"
17660         fi
17661         ;;
17662 esac
17663
17664 : see if strtoull exists
17665 set strtoull d_strtoull
17666 eval $inlibc
17667
17668 case "$d_longlong-$d_strtoull" in
17669 "$define-$define")
17670         $cat <<EOM
17671 Checking whether your strtoull() works okay...
17672 EOM
17673         $cat >try.c <<'EOCP'
17674 #include <errno.h>
17675 #ifdef __hpux
17676 #define strtoull __strtoull
17677 #endif
17678 #include <stdio.h>
17679 extern unsigned long long int strtoull(char *s, char **, int); 
17680 static int bad = 0;
17681 int check(char *s, long long eull, int een) {
17682         long long gull;
17683         errno = 0;
17684         gull = strtoull(s, 0, 10);
17685         if (!((gull == eull) && (errno == een)))
17686                 bad++;
17687 }
17688 int main() {
17689         check(" 1",                                        1LL, 0);
17690         check(" 0",                                        0LL, 0);
17691         check("18446744073709551615",  18446744073709551615ULL, 0);
17692         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17693 #if 0 /* strtoull() for /^-/ strings is undefined. */
17694         check("-1",                    18446744073709551615ULL, 0);
17695         check("-18446744073709551614",                     2LL, 0);
17696         check("-18446744073709551615",                     1LL, 0);
17697         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17698         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17699 #endif
17700         if (!bad)
17701                 printf("ok\n");
17702 }
17703 EOCP
17704         set try
17705         if eval $compile; then
17706                 case "`$run ./try`" in
17707                 ok) echo "Your strtoull() seems to be working okay." ;;
17708                 *) cat <<EOM >&4
17709 Your strtoull() doesn't seem to be working okay.
17710 EOM
17711                    d_strtoull="$undef"
17712                    ;;
17713                 esac
17714         else
17715                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17716                 d_strtoull="$undef"
17717         fi
17718         ;;
17719 esac
17720
17721 : see if strtouq exists
17722 set strtouq d_strtouq
17723 eval $inlibc
17724
17725 case "$d_strtouq" in
17726 "$define")
17727         $cat <<EOM
17728 Checking whether your strtouq() works okay...
17729 EOM
17730         $cat >try.c <<'EOCP'
17731 #include <errno.h>
17732 #include <stdio.h>
17733 extern unsigned long long int strtouq(char *s, char **, int); 
17734 static int bad = 0;
17735 void check(char *s, unsigned long long eull, int een) {
17736         unsigned long long gull;
17737         errno = 0;
17738         gull = strtouq(s, 0, 10);
17739         if (!((gull == eull) && (errno == een)))
17740                 bad++;
17741 }
17742 int main() {
17743         check(" 1",                                        1LL, 0);
17744         check(" 0",                                        0LL, 0);
17745         check("18446744073709551615",  18446744073709551615ULL, 0);
17746         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17747 #if 0 /* strtouq() for /^-/ strings is undefined. */
17748         check("-1",                    18446744073709551615ULL, 0);
17749         check("-18446744073709551614",                     2LL, 0);
17750         check("-18446744073709551615",                     1LL, 0);
17751         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17752         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17753 #endif
17754         if (!bad)
17755                 printf("ok\n");
17756         return 0;
17757 }
17758 EOCP
17759         set try
17760         if eval $compile; then
17761                 case "`$run ./try`" in
17762                 ok) echo "Your strtouq() seems to be working okay." ;;
17763                 *) cat <<EOM >&4
17764 Your strtouq() doesn't seem to be working okay.
17765 EOM
17766                    d_strtouq="$undef"
17767                    ;;
17768                 esac
17769         else
17770                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17771                 d_strtouq="$undef"
17772         fi
17773         ;;
17774 esac
17775
17776 : see if strxfrm exists
17777 set strxfrm d_strxfrm
17778 eval $inlibc
17779
17780 : see if symlink exists
17781 set symlink d_symlink
17782 eval $inlibc
17783
17784 : see if syscall exists
17785 set syscall d_syscall
17786 eval $inlibc
17787
17788 : see if prototype for syscall is available
17789 echo " "
17790 set d_syscallproto syscall $i_unistd unistd.h
17791 eval $hasproto
17792
17793 : see if sysconf exists
17794 set sysconf d_sysconf
17795 eval $inlibc
17796
17797 : see if system exists
17798 set system d_system
17799 eval $inlibc
17800
17801 : see if tcgetpgrp exists
17802 set tcgetpgrp d_tcgetpgrp
17803 eval $inlibc
17804
17805 : see if tcsetpgrp exists
17806 set tcsetpgrp d_tcsetpgrp
17807 eval $inlibc
17808
17809 : see if prototype for telldir is available
17810 echo " "
17811 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17812 eval $hasproto
17813
17814 : see if time exists
17815 echo " "
17816 if test "X$d_time" = X -o X"$timetype" = X; then
17817     if set time val -f d_time; eval $csym; $val; then
17818                 echo 'time() found.' >&4
17819                 val="$define"
17820                 rp="What is the type returned by time() on this system?"
17821                 set time_t timetype long stdio.h sys/types.h
17822                 eval $typedef_ask
17823     else
17824                 echo 'time() not found, hope that will do.' >&4
17825                 val="$undef"
17826                 timetype='int';
17827     fi
17828     set d_time
17829     eval $setvar
17830 fi
17831
17832 : see if this is a sys/times.h system
17833 set sys/times.h i_systimes
17834 eval $inhdr
17835
17836 : see if times exists
17837 echo " "
17838 if set times val -f d_times; eval $csym; $val; then
17839         echo 'times() found.' >&4
17840         d_times="$define"
17841         inc=''
17842         case "$i_systimes" in
17843         "$define") inc='sys/times.h';;
17844         esac
17845         rp="What is the type returned by times() on this system?"
17846         set clock_t clocktype long stdio.h sys/types.h $inc
17847         eval $typedef_ask
17848 else
17849         echo 'times() NOT found, hope that will do.' >&4
17850         d_times="$undef"
17851         clocktype='int'
17852 fi
17853
17854 : see if tmpnam_r exists
17855 set tmpnam_r d_tmpnam_r
17856 eval $inlibc
17857 case "$d_tmpnam_r" in
17858 "$define")
17859         hdrs="$i_systypes sys/types.h define stdio.h "
17860         case "$d_tmpnam_r_proto:$usethreads" in
17861         ":define")      d_tmpnam_r_proto=define
17862                 set d_tmpnam_r_proto tmpnam_r $hdrs
17863                 eval $hasproto ;;
17864         *)      ;;
17865         esac
17866         case "$d_tmpnam_r_proto" in
17867         define)
17868         case "$tmpnam_r_proto" in
17869         ''|0) try='char* tmpnam_r(char*);'
17870         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17871         esac
17872         case "$tmpnam_r_proto" in
17873         ''|0)   d_tmpnam_r=undef
17874                 tmpnam_r_proto=0
17875                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17876         * )     case "$tmpnam_r_proto" in
17877                 REENTRANT_PROTO*) ;;
17878                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17879                 esac
17880                 echo "Prototype: $try" ;;
17881         esac
17882         ;;
17883         *)      case "$usethreads" in
17884                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17885                 esac
17886                 d_tmpnam_r=undef
17887                 tmpnam_r_proto=0
17888                 ;;
17889         esac
17890         ;;
17891 *)      tmpnam_r_proto=0
17892         ;;
17893 esac
17894
17895 : see if truncate exists
17896 set truncate d_truncate
17897 eval $inlibc
17898
17899 : see if ttyname_r exists
17900 set ttyname_r d_ttyname_r
17901 eval $inlibc
17902 case "$d_ttyname_r" in
17903 "$define")
17904         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17905         case "$d_ttyname_r_proto:$usethreads" in
17906         ":define")      d_ttyname_r_proto=define
17907                 set d_ttyname_r_proto ttyname_r $hdrs
17908                 eval $hasproto ;;
17909         *)      ;;
17910         esac
17911         case "$d_ttyname_r_proto" in
17912         define)
17913         case "$ttyname_r_proto" in
17914         ''|0) try='int ttyname_r(int, char*, size_t);'
17915         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17916         esac
17917         case "$ttyname_r_proto" in
17918         ''|0) try='int ttyname_r(int, char*, int);'
17919         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17920         esac
17921         case "$ttyname_r_proto" in
17922         ''|0) try='char* ttyname_r(int, char*, int);'
17923         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17924         esac
17925         case "$ttyname_r_proto" in
17926         ''|0)   d_ttyname_r=undef
17927                 ttyname_r_proto=0
17928                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17929         * )     case "$ttyname_r_proto" in
17930                 REENTRANT_PROTO*) ;;
17931                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17932                 esac
17933                 echo "Prototype: $try" ;;
17934         esac
17935         ;;
17936         *)      case "$usethreads" in
17937                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17938                 esac
17939                 d_ttyname_r=undef
17940                 ttyname_r_proto=0
17941                 ;;
17942         esac
17943         ;;
17944 *)      ttyname_r_proto=0
17945         ;;
17946 esac
17947
17948 : see if tzname[] exists
17949 echo " "
17950 if set tzname val -a d_tzname; eval $csym; $val; then
17951         val="$define"
17952         echo 'tzname[] found.' >&4
17953 else
17954         val="$undef"
17955         echo 'tzname[] NOT found.' >&4
17956 fi
17957 set d_tzname
17958 eval $setvar
17959
17960 case "$osname" in
17961 next|rhapsody|darwin) multiarch="$define" ;;
17962 esac
17963 case "$multiarch" in
17964 ''|[nN]*) multiarch="$undef" ;;
17965 esac
17966
17967 : check for ordering of bytes in a UV
17968 echo " "
17969 case "$usecrosscompile$multiarch" in
17970 *$define*)
17971         $cat <<EOM
17972 You seem to be either cross-compiling or doing a multiarchitecture build,
17973 skipping the byteorder check.
17974
17975 EOM
17976         byteorder='ffff'
17977         ;;
17978 *)
17979         case "$byteorder" in
17980         '')
17981                 $cat <<'EOM'
17982 In the following, larger digits indicate more significance.  A big-endian
17983 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17984 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17985 machines may have weird orders like 3412.  A Cray will report 87654321,
17986 an Alpha will report 12345678. If the test program works the default is
17987 probably right.
17988 I'm now running the test program...
17989 EOM
17990                 $cat >try.c <<EOCP
17991 #include <stdio.h>
17992 #$i_stdlib I_STDLIB
17993 #ifdef I_STDLIB
17994 #include <stdlib.h>
17995 #endif
17996 #include <sys/types.h>
17997 typedef $uvtype UV;
17998 int main()
17999 {
18000         int i;
18001         union {
18002                 UV l;
18003                 char c[$uvsize];
18004         } u;
18005
18006         if ($uvsize > 4)
18007                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
18008         else
18009                 u.l = (UV)0x04030201;
18010         for (i = 0; i < $uvsize; i++)
18011                 printf("%c", u.c[i]+'0');
18012         printf("\n");
18013         exit(0);
18014 }
18015 EOCP
18016                 xxx_prompt=y
18017                 set try
18018                 if eval $compile && $run ./try > /dev/null; then
18019                         dflt=`$run ./try`
18020                         case "$dflt" in
18021                         [1-4][1-4][1-4][1-4]|12345678|87654321)
18022                                 echo "(The test program ran ok.)"
18023                                 echo "byteorder=$dflt"
18024                                 xxx_prompt=n
18025                         ;;
18026                         ????|????????) echo "(The test program ran ok.)" ;;
18027                         *) echo "(The test program didn't run right for some reason.)" ;;
18028                         esac
18029                 else
18030                         dflt='4321'
18031                         cat <<'EOM'
18032 (I can't seem to compile the test program.  Guessing big-endian...)
18033 EOM
18034                 fi
18035                 case "$xxx_prompt" in
18036                 y)
18037                         rp="What is the order of bytes in $uvtype?"
18038                         . ./myread
18039                         byteorder="$ans"
18040                         ;;
18041                 *)      byteorder=$dflt
18042                         ;;
18043                 esac
18044                 ;;
18045         esac
18046         $rm_try
18047         ;;
18048 esac
18049
18050 $cat <<EOM
18051
18052 Checking to see whether you can access character data unalignedly...
18053 EOM
18054 case "$d_u32align" in
18055 '')   $cat >try.c <<EOCP
18056 #include <stdio.h>
18057 #$i_stdlib I_STDLIB
18058 #ifdef I_STDLIB
18059 #include <stdlib.h>
18060 #endif
18061 #define U32 $u32type
18062 #define BYTEORDER 0x$byteorder
18063 #define U8 $u8type
18064 #include <signal.h>
18065 #ifdef SIGBUS
18066 $signal_t bletch(int s) { exit(4); }
18067 #endif
18068 int main() {
18069 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18070     U8 buf[8];
18071     U32 *up;
18072     int i;
18073
18074     if (sizeof(U32) != 4) {
18075         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18076         exit(1);
18077     }
18078
18079     fflush(stdout);
18080
18081 #ifdef SIGBUS
18082     signal(SIGBUS, bletch);
18083 #endif
18084
18085     buf[0] = 0;
18086     buf[1] = 0;
18087     buf[2] = 0;
18088     buf[3] = 1;
18089     buf[4] = 0;
18090     buf[5] = 0;
18091     buf[6] = 0;
18092     buf[7] = 1;
18093
18094     for (i = 0; i < 4; i++) {
18095         up = (U32*)(buf + i);
18096         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18097                (*up == 1 << (8*(3-i)))  /* little-endian */
18098               )
18099            )
18100         {
18101             printf("read failed (%x)\n", *up);
18102             exit(2);
18103         }
18104     }
18105
18106     /* write test */
18107     for (i = 0; i < 4; i++) {
18108         up = (U32*)(buf + i);
18109         *up = 0xBeef;
18110         if (*up != 0xBeef) {
18111             printf("write failed (%x)\n", *up);
18112             exit(3);
18113         }
18114     }
18115
18116     exit(0);
18117 #else
18118     printf("1\n");
18119     exit(1);
18120 #endif
18121     return 0;
18122 }
18123 EOCP
18124 set try
18125 if eval $compile_ok; then
18126         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18127         $run ./try 2>&1 >/dev/null
18128         case "$?" in
18129         0)      cat >&4 <<EOM
18130 You can access character data pretty unalignedly.
18131 EOM
18132                 d_u32align="$undef"
18133                 ;;
18134         *)      cat >&4 <<EOM
18135 It seems that you must access character data in an aligned manner.
18136 EOM
18137                 d_u32align="$define"
18138                 ;;
18139         esac
18140 else
18141         rp='Can you access character data at unaligned addresses?'
18142         dflt='n'
18143         . ./myread
18144         case "$ans" in
18145         [yY]*)  d_u32align="$undef"  ;;
18146         *)      d_u32align="$define" ;;
18147         esac
18148 fi
18149 $rm_try
18150 ;;
18151 esac
18152
18153 : see if ualarm exists
18154 set ualarm d_ualarm
18155 eval $inlibc
18156
18157 : see if umask exists
18158 set umask d_umask
18159 eval $inlibc
18160
18161 : see if unordered exists
18162 set unordered d_unordered
18163 eval $inlibc
18164
18165 : see if unsetenv exists
18166 set unsetenv d_unsetenv
18167 eval $inlibc
18168
18169 : see if usleep exists
18170 set usleep d_usleep
18171 eval $inlibc
18172
18173 : see if prototype for usleep is available
18174 echo " "
18175 set d_usleepproto usleep $i_unistd unistd.h
18176 eval $hasproto
18177
18178 : see if ustat exists
18179 set ustat d_ustat
18180 eval $inlibc
18181
18182 : see if closedir exists
18183 set closedir d_closedir
18184 eval $inlibc
18185
18186 case "$d_closedir" in
18187 "$define")
18188         echo " "
18189         echo "Checking whether closedir() returns a status..." >&4
18190         cat > try.c <<EOM
18191 #$i_dirent I_DIRENT             /**/
18192 #$i_sysdir I_SYS_DIR            /**/
18193 #$i_sysndir I_SYS_NDIR          /**/
18194 #$i_systypes I_SYS_TYPES        /**/
18195
18196 #if defined(I_SYS_TYPES)
18197 #include <sys/types.h>
18198 #endif
18199 #if defined(I_DIRENT)
18200 #include <dirent.h>
18201 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18202 #include <sys/dir.h>
18203 #endif
18204 #else
18205 #ifdef I_SYS_NDIR
18206 #include <sys/ndir.h>
18207 #else
18208 #ifdef I_SYS_DIR
18209 #ifdef hp9000s500
18210 #include <ndir.h>       /* may be wrong in the future */
18211 #else
18212 #include <sys/dir.h>
18213 #endif
18214 #endif
18215 #endif
18216 #endif
18217 int main() { return closedir(opendir(".")); }
18218 EOM
18219         set try
18220         if eval $compile_ok; then
18221                 if $run ./try > /dev/null 2>&1 ; then
18222                         echo "Yes, it does."
18223                         val="$undef"
18224                 else
18225                         echo "No, it doesn't."
18226                         val="$define"
18227                 fi
18228         else
18229                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18230                 val="$define"
18231         fi
18232         ;;
18233 *)
18234         val="$undef";
18235         ;;
18236 esac
18237 set d_void_closedir
18238 eval $setvar
18239 $rm_try
18240
18241 : see if there is a wait4
18242 set wait4 d_wait4
18243 eval $inlibc
18244
18245 : see if waitpid exists
18246 set waitpid d_waitpid
18247 eval $inlibc
18248
18249 : see if wcstombs exists
18250 set wcstombs d_wcstombs
18251 eval $inlibc
18252
18253 : see if wctomb exists
18254 set wctomb d_wctomb
18255 eval $inlibc
18256
18257 : see if writev exists
18258 set writev d_writev
18259 eval $inlibc
18260
18261 : preserve RCS keywords in files with variable substitution, grrr
18262 Date='$Date'
18263 Id='$Id'
18264 Log='$Log'
18265 RCSfile='$RCSfile'
18266 Revision='$Revision'
18267
18268 : check for alignment requirements
18269 echo " "
18270 case "$usecrosscompile$multiarch" in
18271 *$define*)
18272         $cat <<EOM
18273 You seem to be either cross-compiling or doing a multiarchitecture build,
18274 skipping the memory alignment check.
18275
18276 EOM
18277         case "$alignbytes" in
18278         '') alignbytes=8 ;;
18279         esac
18280         ;;
18281 *)
18282         case "$alignbytes" in
18283         '') echo "Checking alignment constraints..." >&4
18284                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18285                         $cat >try.c <<'EOCP'
18286 typedef long double NV;
18287 EOCP
18288                 else
18289                         $cat >try.c <<'EOCP'
18290 typedef double NV;
18291 EOCP
18292                 fi
18293                 $cat >>try.c <<'EOCP'
18294 #include <stdio.h>
18295 struct foobar {
18296         char foo;
18297         NV bar;
18298 } try_algn;
18299 int main()
18300 {
18301     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18302     return(0);
18303 }
18304 EOCP
18305                 set try
18306                 if eval $compile_ok; then
18307                         dflt=`$run ./try`
18308                 else
18309                         dflt='8'
18310                         echo "(I can't seem to compile the test program...)"
18311                 fi
18312                 ;;
18313         *) dflt="$alignbytes"
18314                 ;;
18315         esac
18316         rp="Doubles must be aligned on a how-many-byte boundary?"
18317         . ./myread
18318         alignbytes="$ans"
18319         $rm_try
18320         ;;
18321 esac
18322
18323
18324 : set the base revision
18325 baserev=5.0
18326
18327 : how do we concatenate cpp tokens here?
18328 echo " "
18329 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18330 $cat >cpp_stuff.c <<'EOCP'
18331 #define RCAT(a,b)a/**/b
18332 #define ACAT(a,b)a ## b
18333 RCAT(Rei,ser)
18334 ACAT(Cir,cus)
18335 EOCP
18336 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18337 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18338         echo "Oh!  Smells like ANSI's been here." >&4
18339         echo "We can catify or stringify, separately or together!"
18340         cpp_stuff=42
18341 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18342         echo "Ah, yes!  The good old days!" >&4
18343         echo "However, in the good old days we don't know how to stringify and"
18344         echo "catify at the same time."
18345         cpp_stuff=1
18346 else
18347         $cat >&4 <<EOM
18348 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18349 You're going to have to edit the values of CAT[2-5] in config.h...
18350 EOM
18351         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18352 fi
18353 $rm -f cpp_stuff.*
18354
18355 : see if this is a db.h system
18356 set db.h i_db
18357 eval $inhdr
18358
18359 case "$i_db" in
18360 $define)
18361         : Check db version.
18362         echo " "
18363         echo "Checking Berkeley DB version ..." >&4
18364         $cat >try.c <<EOCP
18365 #$d_const HASCONST
18366 #ifndef HASCONST
18367 #define const
18368 #endif
18369 #include <sys/types.h>
18370 #include <stdio.h>
18371 #$i_stdlib I_STDLIB
18372 #ifdef I_STDLIB
18373 #include <stdlib.h>
18374 #endif
18375 #include <db.h>
18376 int main(int argc, char *argv[])
18377 {
18378 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18379     int Major, Minor, Patch ;
18380     unsigned long Version ;
18381     (void)db_version(&Major, &Minor, &Patch) ;
18382     if (argc == 2) {
18383         printf("%d %d %d %d %d %d\n",
18384                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18385                Major, Minor, Patch);
18386         exit(0);
18387     }
18388     printf("You have Berkeley DB Version 2 or greater.\n");
18389
18390     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18391                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18392     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18393                 Major, Minor, Patch) ;
18394
18395     /* check that db.h & libdb are compatible */
18396     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18397         printf("db.h and libdb are incompatible.\n") ;
18398         exit(3);
18399     }
18400
18401     printf("db.h and libdb are compatible.\n") ;
18402
18403     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18404                 + DB_VERSION_PATCH ;
18405
18406     /* needs to be >= 2.3.4 */
18407     if (Version < 2003004) {
18408     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18409         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18410         exit(2);
18411     }
18412
18413     exit(0);
18414 #else
18415 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18416     if (argc == 2) {
18417         printf("1 0 0\n");
18418         exit(0);
18419     }
18420     printf("You have Berkeley DB Version 1.\n");
18421     exit(0);    /* DB version < 2: the coast is clear. */
18422 #else
18423     exit(1);    /* <db.h> not Berkeley DB? */
18424 #endif
18425 #endif
18426 }
18427 EOCP
18428         set try
18429         if eval $compile_ok && $run ./try; then
18430                 echo 'Looks OK.' >&4
18431                 set `$run ./try 1`
18432                 db_version_major=$1
18433                 db_version_minor=$2
18434                 db_version_patch=$3
18435         else
18436                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18437                 i_db=$undef
18438                 case " $libs " in
18439                 *"-ldb "*)
18440                         : Remove db from list of libraries to use
18441                         echo "Removing unusable -ldb from library list" >&4
18442                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18443                         shift
18444                         libs="$*"
18445                         echo "libs = $libs" >&4
18446                         ;;
18447                 esac
18448         fi
18449         $rm_try
18450         ;;
18451 esac
18452
18453 case "$i_db" in
18454 define)
18455         : Check the return type needed for hash
18456         echo " "
18457         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18458         $cat >try.c <<EOCP
18459 #$d_const HASCONST
18460 #ifndef HASCONST
18461 #define const
18462 #endif
18463 #include <sys/types.h>
18464 #include <db.h>
18465
18466 #ifndef DB_VERSION_MAJOR
18467 u_int32_t hash_cb (ptr, size)
18468 const void *ptr;
18469 size_t size;
18470 {
18471 }
18472 HASHINFO info;
18473 int main()
18474 {
18475         info.hash = hash_cb;
18476 }
18477 #endif
18478 EOCP
18479         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18480                 if $contains warning try.out >>/dev/null 2>&1 ; then
18481                         db_hashtype='int'
18482                 else
18483                         db_hashtype='u_int32_t'
18484                 fi
18485         else
18486                 : XXX Maybe we should just give up here.
18487                 db_hashtype=u_int32_t
18488                 $cat try.out >&4
18489                 echo "Help:  I can't seem to compile the db test program." >&4
18490                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18491         fi
18492         $rm_try
18493         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18494         ;;
18495 *)      db_hashtype=u_int32_t
18496         ;;
18497 esac
18498 case "$i_db" in
18499 define)
18500         : Check the return type needed for prefix
18501         echo " "
18502         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18503         cat >try.c <<EOCP
18504 #$d_const HASCONST
18505 #ifndef HASCONST
18506 #define const
18507 #endif
18508 #include <sys/types.h>
18509 #include <db.h>
18510
18511 #ifndef DB_VERSION_MAJOR
18512 size_t prefix_cb (key1, key2)
18513 const DBT *key1;
18514 const DBT *key2;
18515 {
18516 }
18517 BTREEINFO info;
18518 int main()
18519 {
18520         info.prefix = prefix_cb;
18521 }
18522 #endif
18523 EOCP
18524         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18525                 if $contains warning try.out >>/dev/null 2>&1 ; then
18526                         db_prefixtype='int'
18527                 else
18528                         db_prefixtype='size_t'
18529                 fi
18530         else
18531                 db_prefixtype='size_t'
18532                 : XXX Maybe we should just give up here.
18533                 $cat try.out >&4
18534                 echo "Help:  I can't seem to compile the db test program." >&4
18535                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18536         fi
18537         $rm_try
18538         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18539         ;;
18540 *)      db_prefixtype='size_t'
18541         ;;
18542 esac
18543
18544 : How can we generate normalized random numbers ?
18545 echo " "
18546 echo "Looking for a random number function..." >&4
18547 case "$randfunc" in
18548 '')
18549         if set drand48 val -f; eval $csym; $val; then
18550                 dflt="drand48"
18551                 echo "Good, found drand48()." >&4
18552         elif set random val -f; eval $csym; $val; then
18553                 dflt="random"
18554                 echo "OK, found random()." >&4
18555         else
18556                 dflt="rand"
18557                 echo "Yick, looks like I have to use rand()." >&4
18558         fi
18559         echo " "
18560         ;;
18561 *)
18562         dflt="$randfunc"
18563         ;;
18564 esac
18565 cont=true
18566
18567 case "$ccflags" in
18568 *-Dmy_rand=*|*-Dmy_srand=*)
18569         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18570         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18571         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18572         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18573         ;;
18574 esac
18575
18576 while $test "$cont"; do
18577         rp="Use which function to generate random numbers?"
18578         . ./myread
18579         if $test "$ans" = "$dflt"; then
18580                 : null
18581         else
18582                 randbits=''
18583         fi
18584         randfunc="$ans"
18585         if set $ans val -f; eval $csym; $val; then
18586                 cont=''
18587         else
18588                 dflt=y
18589                 rp="I cannot find function $ans. Use that name anyway?"
18590                 . ./myread
18591                 dflt=rand
18592                 case "$ans" in
18593                         [yY]*) cont='';;
18594                 esac
18595         fi
18596         case "$cont" in
18597         '')
18598                 case "$randfunc" in
18599                 drand48)
18600                         drand01="drand48()"
18601                         seedfunc="srand48"
18602                         randbits=48
18603                         randseedtype=long
18604                         ;;
18605                 rand|random)
18606                         case "$randbits" in
18607                         '')
18608 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18609                                 $cat >try.c <<EOCP
18610 #$i_unistd I_UNISTD
18611 #$i_stdlib I_STDLIB
18612 #include <stdio.h>
18613 #ifdef I_UNISTD
18614 #  include <unistd.h>
18615 #endif
18616 #ifdef I_STDLIB
18617 #  include <stdlib.h>
18618 #endif
18619 int main()
18620 {
18621         register int i;
18622         register unsigned long tmp;
18623         register unsigned long max = 0L;
18624
18625         for (i = 1000; i; i--) {
18626                 tmp = (unsigned long) $randfunc();
18627                 if (tmp > max) max = tmp;
18628         }
18629         for (i = 0; max; i++)
18630                 max /= 2;
18631         printf("%d\n",i);
18632 }
18633 EOCP
18634                                 set try
18635                                 if eval $compile_ok; then
18636                                         dflt=`try`
18637                                 else
18638                                         dflt='?'
18639                                         echo "(I can't seem to compile the test program...)"
18640                                 fi
18641                                 ;;
18642                         *)
18643                                 dflt="$randbits"
18644                                 ;;
18645                         esac
18646                         rp="How many bits does your $randfunc() function produce?"
18647                         . ./myread
18648                         randbits="$ans"
18649                         $rm_try
18650                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18651                         seedfunc="s$randfunc"
18652                         randseedtype=unsigned
18653                         ;;
18654                 *)
18655                         dflt="31"
18656                         rp="How many bits does your $randfunc() function produce?"
18657                         . ./myread
18658                         randbits="$ans"
18659                         seedfunc="s$randfunc"
18660                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18661                         if set $seedfunc val -f; eval $csym; $val; then
18662                                 echo "(Using $seedfunc() to seed random generator)"
18663                         else
18664                                 echo "(Warning: no $seedfunc() to seed random generator)"
18665                                 seedfunc=rand
18666                         fi
18667                         randseedtype=unsigned
18668                         ;;
18669                 esac
18670                 ;;
18671         esac
18672 done
18673
18674 echo " "
18675 echo "Determining whether or not we are on an EBCDIC system..." >&4
18676 $cat >try.c <<'EOM'
18677 int main()
18678 {
18679   if ('M'==0xd4) return 0;
18680   return 1;
18681 }
18682 EOM
18683
18684 val=$undef
18685 set try
18686 if eval $compile_ok; then
18687         if $run ./try; then
18688                 echo "You seem to speak EBCDIC." >&4
18689                 val="$define"
18690         else
18691                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18692         fi
18693 else
18694         echo "I'm unable to compile the test program." >&4
18695         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18696 fi
18697 $rm_try
18698 set ebcdic
18699 eval $setvar
18700
18701 echo " "
18702 $cat >&4 <<EOM
18703 Checking how to flush all pending stdio output...
18704 EOM
18705 # I only know how to find the first 32 possibly open files on SunOS.
18706 # See also hints/sunos_4_1.sh and util.c  --AD
18707 case "$osname" in
18708 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18709 esac
18710 $cat >>try.c <<EOCP
18711 #include <stdio.h>
18712 #$i_stdlib I_STDLIB
18713 #ifdef I_STDLIB
18714 #include <stdlib.h>
18715 #endif
18716 #$i_unistd I_UNISTD
18717 #ifdef I_UNISTD
18718 # include <unistd.h>
18719 #endif
18720 #$d_sysconf HAS_SYSCONF
18721 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18722 #ifdef HAS_STDIO_STREAM_ARRAY
18723 # define STDIO_STREAM_ARRAY $stdio_stream_array
18724 #endif
18725 int main() {
18726   FILE* p;
18727   unlink("try.out");
18728   p = fopen("try.out", "w");
18729 #ifdef TRY_FPUTC
18730   fputc('x', p);
18731 #else
18732 # ifdef TRY_FPRINTF
18733   fprintf(p, "x");
18734 # endif
18735 #endif
18736 #ifdef TRY_FFLUSH_NULL
18737   fflush(NULL);
18738 #endif
18739 #ifdef TRY_FFLUSH_ALL
18740   {
18741     long open_max = -1;
18742 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18743     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18744 # else
18745 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18746     open_max = sysconf(_SC_OPEN_MAX);
18747 #  else
18748 #   ifdef FOPEN_MAX
18749     open_max = FOPEN_MAX;
18750 #   else
18751 #    ifdef OPEN_MAX
18752     open_max = OPEN_MAX;
18753 #    else
18754 #     ifdef _NFILE
18755     open_max = _NFILE;
18756 #     endif
18757 #    endif
18758 #   endif
18759 #  endif
18760 # endif
18761 # ifdef HAS_STDIO_STREAM_ARRAY
18762     if (open_max > 0) {
18763       long i;
18764       for (i = 0; i < open_max; i++)
18765             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18766                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18767                 STDIO_STREAM_ARRAY[i]._flag)
18768                 fflush(&STDIO_STREAM_ARRAY[i]);
18769     }
18770   }
18771 # endif
18772 #endif
18773   _exit(42);
18774 }
18775 EOCP
18776 : first we have to find out how _not_ to flush
18777 $to try.c
18778 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18779     output=''
18780     set try -DTRY_FPUTC
18781     if eval $compile; then
18782             $run ./try 2>/dev/null
18783             code="$?"
18784             $from try.out
18785             if $test ! -s try.out -a "X$code" = X42; then
18786                 output=-DTRY_FPUTC
18787             fi
18788     fi
18789     case "$output" in
18790     '')
18791             set try -DTRY_FPRINTF
18792             if eval $compile; then
18793                     $run ./try 2>/dev/null
18794                     code="$?"
18795                     $from try.out
18796                     if $test ! -s try.out -a "X$code" = X42; then
18797                         output=-DTRY_FPRINTF
18798                     fi
18799             fi
18800         ;;
18801     esac
18802 fi
18803 : check for fflush NULL behaviour
18804 case "$fflushNULL" in
18805 '')     set try -DTRY_FFLUSH_NULL $output
18806         if eval $compile; then
18807                 $run ./try 2>/dev/null
18808                 code="$?"
18809                 $from try.out
18810                 if $test -s try.out -a "X$code" = X42; then
18811                         fflushNULL="`$cat try.out`"
18812                 else
18813                         if $test "X$code" != X42; then
18814                                 $cat >&4 <<EOM
18815 (If this test failed, don't worry, we'll try another method shortly.)
18816 EOM
18817                         fi
18818                 fi
18819         fi
18820         $rm_try
18821         case "$fflushNULL" in
18822         x)      $cat >&4 <<EOM
18823 Your fflush(NULL) works okay for output streams.
18824 Let's see if it clobbers input pipes...
18825 EOM
18826 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18827 # bug that improperly flushes the input end of pipes.  So we avoid the
18828 # autoflush on fork/system/exec support for now. :-(
18829 $cat >tryp.c <<EOCP
18830 #include <stdio.h>
18831 int
18832 main(int argc, char **argv)
18833 {
18834     char buf[1024];
18835     int i;
18836     char *bp = buf;
18837     while (1) {
18838         while ((i = getc(stdin)) != -1
18839                && (*bp++ = i) != '\n'
18840                && bp < &buf[1024])
18841         /* DO NOTHING */ ;
18842         *bp = '\0';
18843         fprintf(stdout, "%s", buf);
18844         fflush(NULL);
18845         if (i == -1)
18846             return 0;
18847         bp = buf;
18848     }
18849 }
18850 EOCP
18851                 fflushNULL="$define"
18852                 set tryp
18853                 if eval $compile; then
18854                     $rm -f tryp.out
18855                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18856                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18857                        $cat >&4 <<EOM
18858 fflush(NULL) seems to behave okay with input streams.
18859 EOM
18860                         fflushNULL="$define"
18861                     else
18862                         $cat >&4 <<EOM
18863 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18864 EOM
18865                         fflushNULL="$undef"
18866                     fi
18867                 fi
18868                 $rm -f core tryp.c tryp.core core.tryp.*
18869                 ;;
18870         '')     $cat >&4 <<EOM
18871 Your fflush(NULL) isn't working (contrary to ANSI C).
18872 EOM
18873                 fflushNULL="$undef"
18874                 ;;
18875         *)      $cat >&4 <<EOM
18876 Cannot figure out whether your fflush(NULL) works or not.
18877 I'm assuming it doesn't (contrary to ANSI C).
18878 EOM
18879                 fflushNULL="$undef"
18880                 ;;
18881         esac
18882         ;;
18883 $define|true|[yY]*)
18884         fflushNULL="$define"
18885         ;;
18886 *)
18887         fflushNULL="$undef"
18888         ;;
18889 esac
18890 : check explicit looping only if NULL did not work, and if the pipe
18891 : bug does not show up on an explicit flush too
18892 case "$fflushNULL" in
18893 "$undef")
18894         $cat >tryp.c <<EOCP
18895 #include <stdio.h>
18896 int
18897 main(int argc, char **argv)
18898 {
18899     char buf[1024];
18900     int i;
18901     char *bp = buf;
18902     while (1) {
18903         while ((i = getc(stdin)) != -1
18904                && (*bp++ = i) != '\n'
18905                && bp < &buf[1024])
18906         /* DO NOTHING */ ;
18907         *bp = '\0';
18908         fprintf(stdout, "%s", buf);
18909         fflush(stdin);
18910         if (i == -1)
18911             return 0;
18912         bp = buf;
18913     }
18914 }
18915 EOCP
18916         set tryp
18917         if eval $compile; then
18918             $rm -f tryp.out
18919             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18920             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18921                $cat >&4 <<EOM
18922 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18923 EOM
18924                 : now check for fflushall behaviour
18925                 case "$fflushall" in
18926                 '')     set try -DTRY_FFLUSH_ALL $output
18927                         if eval $compile; then
18928                                 $cat >&4 <<EOM
18929 (Now testing the other method--but note that this also may fail.)
18930 EOM
18931                                 $run ./try 2>/dev/null
18932                                 code=$?
18933                                 $from try.out
18934                                 if $test -s try.out -a "X$code" = X42; then
18935                                         fflushall="`$cat try.out`"
18936                                 fi
18937                         fi
18938                         $rm_try
18939                         case "$fflushall" in
18940                         x)      $cat >&4 <<EOM
18941 Whew. Flushing explicitly all the stdio streams works.
18942 EOM
18943                                 fflushall="$define"
18944                                 ;;
18945                         '')     $cat >&4 <<EOM
18946 Sigh. Flushing explicitly all the stdio streams doesn't work.
18947 EOM
18948                                 fflushall="$undef"
18949                                 ;;
18950                         *)      $cat >&4 <<EOM
18951 Cannot figure out whether flushing stdio streams explicitly works or not.
18952 I'm assuming it doesn't.
18953 EOM
18954                                 fflushall="$undef"
18955                                 ;;
18956                         esac
18957                         ;;
18958                 "$define"|true|[yY]*)
18959                         fflushall="$define"
18960                         ;;
18961                 *)
18962                         fflushall="$undef"
18963                         ;;
18964                 esac
18965             else
18966                 $cat >&4 <<EOM
18967 All is futile.  Even fflush(stdin) clobbers input pipes!
18968 EOM
18969                 fflushall="$undef"
18970             fi
18971         else
18972             fflushall="$undef"
18973         fi
18974         $rm -f core tryp.c tryp.core core.tryp.*
18975         ;;
18976 *)      fflushall="$undef"
18977         ;;
18978 esac
18979
18980 case "$fflushNULL$fflushall" in
18981 undefundef)
18982         $cat <<EOM
18983 OK, I give up.  I cannot figure out how to flush pending stdio output.
18984 We won't be flushing handles at all before fork/exec/popen.
18985 EOM
18986         ;;
18987 esac
18988 $rm_try
18989
18990 : Store the full pathname to the ar program for use in the C program
18991 : Respect a hint or command line value for full_ar.
18992 case "$full_ar" in
18993 '') full_ar=$ar ;;
18994 esac
18995
18996 : Store the full pathname to the sed program for use in the C program
18997 full_sed=$sed
18998
18999 : see what type gids are declared as in the kernel
19000 echo " "
19001 echo "Looking for the type for group ids returned by getgid()."
19002 set gid_t gidtype xxx stdio.h sys/types.h
19003 eval $typedef
19004 case "$gidtype" in
19005 xxx)
19006         xxx=`./findhdr sys/user.h`
19007         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
19008         case $1 in
19009         unsigned) dflt="$1 $2" ;;
19010         *) dflt="$1" ;;
19011         esac
19012         ;;
19013 *) dflt="$gidtype";;
19014 esac
19015 case "$gidtype" in
19016 gid_t) echo "gid_t found." ;;
19017 *)      rp="What is the type for group ids returned by getgid()?"
19018         . ./myread
19019         gidtype="$ans"
19020         ;;
19021 esac
19022
19023 echo " "
19024 case "$gidtype" in
19025 *_t) zzz="$gidtype"     ;;
19026 *)   zzz="gid"          ;;
19027 esac
19028 echo "Checking the size of $zzz..." >&4 
19029 cat > try.c <<EOCP
19030 #include <sys/types.h>
19031 #include <stdio.h>
19032 #$i_stdlib I_STDLIB
19033 #ifdef I_STDLIB
19034 #include <stdlib.h>
19035 #endif
19036 int main() {
19037     printf("%d\n", (int)sizeof($gidtype));
19038     exit(0);
19039 }
19040 EOCP
19041 set try
19042 if eval $compile_ok; then
19043         yyy=`$run ./try`
19044         case "$yyy" in
19045         '')     gidsize=4
19046                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
19047                 ;;
19048         *)      gidsize=$yyy
19049                 echo "Your $zzz is $gidsize bytes long."
19050                 ;;
19051         esac
19052 else
19053         gidsize=4
19054         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19055 fi
19056
19057
19058 echo " "
19059 case "$gidtype" in
19060 *_t) zzz="$gidtype"     ;;
19061 *)   zzz="gid"          ;;
19062 esac
19063 echo "Checking the sign of $zzz..." >&4 
19064 cat > try.c <<EOCP
19065 #include <sys/types.h>
19066 #include <stdio.h>
19067 int main() {
19068         $gidtype foo = -1;
19069         if (foo < 0)
19070                 printf("-1\n");
19071         else
19072                 printf("1\n");
19073 }
19074 EOCP
19075 set try
19076 if eval $compile; then
19077         yyy=`$run ./try`
19078         case "$yyy" in
19079         '')     gidsign=1
19080                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19081                 ;;
19082         *)      gidsign=$yyy
19083                 case "$gidsign" in
19084                  1) echo "Your $zzz is unsigned." ;;
19085                 -1) echo "Your $zzz is signed."   ;;
19086                 esac
19087                 ;;
19088         esac
19089 else
19090         gidsign=1
19091         echo "(I can't compile the test program--guessing unsigned.)" >&4
19092 fi
19093
19094
19095 echo " "
19096
19097 if $test X"$quadtype" != X; then
19098
19099 echo "Checking how to print 64-bit integers..." >&4
19100
19101 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19102         $cat >try.c <<'EOCP'
19103 #include <sys/types.h>
19104 #include <stdio.h>
19105 int main() {
19106   int q = 12345678901;
19107   printf("%ld\n", q);
19108 }
19109 EOCP
19110         set try
19111         if eval $compile; then
19112                 yyy=`$run ./try`
19113                 case "$yyy" in
19114                 12345678901)
19115                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19116                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19117                         echo "We will use %d."
19118                         ;;
19119                 esac
19120         fi
19121 fi
19122
19123 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19124         $cat >try.c <<'EOCP'
19125 #include <sys/types.h>
19126 #include <stdio.h>
19127 int main() {
19128   long q = 12345678901;
19129   printf("%ld\n", q);
19130 }
19131 EOCP
19132         set try
19133         if eval $compile; then
19134                 yyy=`$run ./try`
19135                 case "$yyy" in
19136                 12345678901)
19137                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19138                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19139                         echo "We will use %ld."
19140                         ;;
19141                 esac
19142         fi
19143 fi
19144
19145 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19146         $cat >try.c <<'EOCP'
19147 #include <sys/types.h>
19148 #include <inttypes.h>
19149 #include <stdio.h>
19150 int main() {
19151   int64_t q = 12345678901;
19152   printf("%" PRId64 "\n", q);
19153 }
19154 EOCP
19155         set try
19156         if eval $compile; then
19157                 yyy=`$run ./try`
19158                 case "$yyy" in
19159                 12345678901)
19160                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19161                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19162                         echo "We will use the C9X style."
19163                         ;;
19164                 esac
19165         fi
19166 fi
19167
19168 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19169         $cat >try.c <<EOCP
19170 #include <sys/types.h>
19171 #include <stdio.h>
19172 int main() {
19173   $quadtype q = 12345678901;
19174   printf("%Ld\n", q);
19175 }
19176 EOCP
19177         set try
19178         if eval $compile; then
19179                 yyy=`$run ./try`
19180                 case "$yyy" in
19181                 12345678901)
19182                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19183                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19184                         echo "We will use %Ld."
19185                         ;;
19186                 esac
19187         fi
19188 fi
19189
19190 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19191         $cat >try.c <<'EOCP'
19192 #include <sys/types.h>
19193 #include <stdio.h>
19194 int main() {
19195   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19196   printf("%lld\n", q);
19197 }
19198 EOCP
19199         set try
19200         if eval $compile; then
19201                 yyy=`$run ./try`
19202                 case "$yyy" in
19203                 12345678901)
19204                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19205                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19206                         echo "We will use the %lld style."
19207                         ;;
19208                 esac
19209         fi
19210 fi
19211
19212 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19213         $cat >try.c <<EOCP
19214 #include <sys/types.h>
19215 #include <stdio.h>
19216 int main() {
19217   $quadtype q = 12345678901;
19218   printf("%qd\n", q);
19219 }
19220 EOCP
19221         set try
19222         if eval $compile; then
19223                 yyy=`$run ./try`
19224                 case "$yyy" in
19225                 12345678901)
19226                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19227                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19228                         echo "We will use %qd."
19229                         ;;
19230                 esac
19231         fi
19232 fi
19233
19234 if $test X"$sPRId64" = X; then
19235         echo "Cannot figure out how to print 64-bit integers." >&4
19236 fi
19237 $rm_try
19238
19239 fi
19240
19241 case "$sPRId64" in
19242 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
19243         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
19244         ;;
19245 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
19246         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
19247         ;;
19248 esac
19249
19250
19251 echo " "
19252 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19253
19254 if $test X"$ivsize" = X8; then
19255         ivdformat="$sPRId64"
19256         uvuformat="$sPRIu64"
19257         uvoformat="$sPRIo64"
19258         uvxformat="$sPRIx64"
19259         uvXUformat="$sPRIXU64"
19260 else
19261         if $test X"$ivsize" = X"$longsize"; then
19262                 ivdformat='"ld"'
19263                 uvuformat='"lu"'
19264                 uvoformat='"lo"'
19265                 uvxformat='"lx"'
19266                 uvXUformat='"lX"'
19267         else
19268                 if $test X"$ivsize" = X"$intsize"; then
19269                         ivdformat='"d"'
19270                         uvuformat='"u"'
19271                         uvoformat='"o"'
19272                         uvxformat='"x"'
19273                         uvXUformat='"X"'
19274                 else
19275                         : far out
19276                         if $test X"$ivsize" = X"$shortsize"; then
19277                                 ivdformat='"hd"'
19278                                 uvuformat='"hu"'
19279                                 uvoformat='"ho"'
19280                                 uvxformat='"hx"'
19281                                 uvXUformat='"hX"'
19282                         fi
19283                 fi
19284         fi
19285 fi
19286
19287 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19288         nveformat="$sPRIeldbl"
19289         nvfformat="$sPRIfldbl"
19290         nvgformat="$sPRIgldbl"
19291         nvEUformat="$sPRIEUldbl"
19292         nvFUformat="$sPRIFUldbl"
19293         nvGUformat="$sPRIGUldbl"
19294 else
19295         nveformat='"e"'
19296         nvfformat='"f"'
19297         nvgformat='"g"'
19298         nvEUformat='"E"'
19299         nvFUformat='"F"'
19300         nvGUformat='"G"'
19301 fi
19302
19303 case "$ivdformat" in
19304 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19305     exit 1
19306     ;;
19307 esac
19308
19309
19310 echo " "
19311 $echo "Checking the format string to be used for gids..." >&4
19312
19313 case "$gidsign" in
19314 -1)     if $test X"$gidsize" = X"$ivsize"; then
19315                 gidformat="$ivdformat"
19316         else
19317                 if $test X"$gidsize" = X"$longsize"; then
19318                         gidformat='"ld"'
19319                 else
19320                         if $test X"$gidsize" = X"$intsize"; then
19321                                 gidformat='"d"'
19322                         else
19323                                 if $test X"$gidsize" = X"$shortsize"; then
19324                                         gidformat='"hd"'
19325                                 fi
19326                         fi
19327                 fi
19328         fi
19329         ;;
19330 *)      if $test X"$gidsize" = X"$uvsize"; then
19331                 gidformat="$uvuformat"
19332         else
19333                 if $test X"$gidsize" = X"$longsize"; then
19334                         gidformat='"lu"'
19335                 else
19336                         if $test X"$gidsize" = X"$intsize"; then
19337                                 gidformat='"u"'
19338                         else
19339                                 if $test X"$gidsize" = X"$shortsize"; then
19340                                         gidformat='"hu"'
19341                                 fi
19342                         fi
19343                 fi
19344         fi
19345         ;;
19346 esac
19347
19348 : see if getgroups exists
19349 set getgroups d_getgrps
19350 eval $inlibc
19351
19352 : see if setgroups exists
19353 set setgroups d_setgrps
19354 eval $inlibc
19355
19356
19357 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19358 echo " "
19359 case "$d_getgrps$d_setgrps" in
19360 *define*)
19361         case "$groupstype" in
19362         '') dflt="$gidtype" ;;
19363         *)  dflt="$groupstype" ;;
19364         esac
19365         $cat <<EOM
19366 What type of pointer is the second argument to getgroups() and setgroups()?
19367 Usually this is the same as group ids, $gidtype, but not always.
19368
19369 EOM
19370         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19371         . ./myread
19372         groupstype="$ans"
19373         ;;
19374 *)  groupstype="$gidtype";;
19375 esac
19376
19377
19378 if $test $patchlevel -lt 9; then
19379 : MAD is not available in 5.8.x or earlier.
19380     ans=n;
19381 else
19382     case "$mad" in
19383     $define|true|[yY]*) dflt='y' ;;
19384     *)                  dflt='n' ;;
19385     esac
19386     cat <<EOM
19387
19388 Would you like to build with Misc Attribute Decoration? This is development
19389 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19390 overhead on the interpreter.
19391
19392 If this doesn't make any sense to you, just accept the default '$dflt'.
19393 EOM
19394     rp='Build Perl with MAD?'
19395     . ./myread
19396 fi
19397 case "$ans" in
19398 y|Y)    val="$define"
19399         madlyh='madly.h madly.act madly.tab'
19400         madlysrc='madly.c'
19401         madlyobj="madly$_o" ;;
19402 *)      val="$undef"
19403         madlyh=''
19404         madlysrc=''
19405         madlyobj='' ;;
19406 esac
19407 set mad
19408 eval $setvar
19409
19410 echo " "
19411 echo "Checking if your $make program sets \$(MAKE)..." >&4
19412 case "$make_set_make" in
19413 '')
19414         $sed 's/^X //' > testmake.mak << 'EOF'
19415 Xall:
19416 X       @echo 'maketemp="$(MAKE)"'
19417 EOF
19418         case "`$make -f testmake.mak 2>/dev/null`" in
19419         *maketemp=*) make_set_make='#' ;;
19420         *)      make_set_make="MAKE=$make" ;;
19421         esac
19422         $rm -f testmake.mak
19423         ;;
19424 esac
19425 case "$make_set_make" in
19426 '#') echo "Yup, it does.";;
19427 *) echo "Nope, it doesn't.";;
19428 esac
19429
19430 : see what type is used for mode_t
19431 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19432 set mode_t modetype int stdio.h sys/types.h
19433 eval $typedef_ask
19434
19435 : see if we need va_copy
19436 echo " "
19437 case "$i_stdarg" in
19438 "$define")
19439         $cat >try.c <<EOCP
19440 #include <stdarg.h>
19441 #include <stdio.h>
19442 #$i_stdlib I_STDLIB
19443 #ifdef I_STDLIB
19444 #include <stdlib.h>
19445 #endif
19446 #include <signal.h>
19447
19448 int
19449 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19450 {
19451   return vfprintf(f, fmt, *valp);
19452 }
19453
19454 int
19455 myvfprintf(FILE *f, const  char *fmt, va_list val)
19456 {
19457   return ivfprintf(f, fmt, &val);
19458 }
19459
19460 int
19461 myprintf(char *fmt, ...)
19462 {
19463   va_list val;
19464   va_start(val, fmt);
19465   return myvfprintf(stdout, fmt, val);
19466 }
19467
19468 int
19469 main(int ac, char **av)
19470 {
19471   signal(SIGSEGV, exit);
19472
19473   myprintf("%s%cs all right, then\n", "that", '\'');
19474   exit(0);
19475 }
19476 EOCP
19477         set try
19478         if eval $compile && $run ./try 2>&1 >/dev/null; then
19479                 case "`$run ./try`" in
19480                 "that's all right, then")
19481                         okay=yes
19482                         ;;
19483                 esac
19484         fi
19485         case "$okay" in
19486         yes)    echo "It seems that you don't need va_copy()." >&4
19487                 need_va_copy="$undef"
19488                 ;;
19489         *)      echo "It seems that va_copy() or similar will be needed." >&4
19490                 need_va_copy="$define"
19491                 ;;
19492         esac
19493         $rm_try
19494         ;;
19495 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19496         ;;
19497 esac
19498
19499 : see what type is used for size_t
19500 rp="What is the type used for the length parameter for string functions?"
19501 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19502 eval $typedef_ask
19503
19504 : check for type of arguments to gethostbyaddr. 
19505 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19506         case "$d_gethbyaddr" in
19507         $define)
19508                 $cat <<EOM
19509
19510 Checking to see what type of arguments are accepted by gethostbyaddr().
19511 EOM
19512                 hdrs="$define sys/types.h
19513                         $d_socket sys/socket.h 
19514                         $i_niin netinet/in.h 
19515                         $i_netdb netdb.h
19516                         $i_unistd unistd.h"
19517                 : The first arg can 'char *' or 'void *'
19518                 : The second arg is some of integral type
19519                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19520                         for yyy in size_t long int; do
19521                                 case "$netdb_host_type" in
19522                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19523                                         if ./protochk "$try" $hdrs; then
19524                                                 echo "Your system accepts $xxx for the first arg."
19525                                                 echo "...and $yyy for the second arg."
19526                                                 netdb_host_type="$xxx"
19527                                                 netdb_hlen_type="$yyy"
19528                                         fi
19529                                         ;;
19530                                 esac
19531                         done
19532                 done
19533                 : In case none of those worked, prompt the user.
19534                 case "$netdb_host_type" in
19535                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19536                         dflt='char *'
19537                         . ./myread
19538                         netdb_host_type=$ans
19539                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19540                         dflt="$sizetype"
19541                         . ./myread
19542                         netdb_hlen_type=$ans
19543                         ;;
19544                 esac
19545                 ;;
19546         *)      : no gethostbyaddr, so pick harmless defaults
19547                 netdb_host_type='char *'
19548                 netdb_hlen_type="$sizetype"
19549                 ;;
19550         esac
19551         # Remove the "const" if needed. -- but then we'll have a 
19552         # prototype clash!
19553         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19554 fi
19555
19556 : check for type of argument to gethostbyname. 
19557 if test "X$netdb_name_type" = X ; then
19558         case "$d_gethbyname" in
19559         $define)
19560                 $cat <<EOM
19561
19562 Checking to see what type of argument is accepted by gethostbyname().
19563 EOM
19564                 hdrs="$define sys/types.h
19565                         $d_socket sys/socket.h 
19566                         $i_niin netinet/in.h 
19567                         $i_netdb netdb.h
19568                         $i_unistd unistd.h"
19569                 for xxx in "const char *" "char *"; do
19570                         case "$netdb_name_type" in
19571                         '')     try="extern struct hostent *gethostbyname($xxx);"
19572                                 if ./protochk "$try" $hdrs; then
19573                                         echo "Your system accepts $xxx."
19574                                         netdb_name_type="$xxx"
19575                                 fi
19576                                 ;;
19577                         esac
19578                 done
19579                 : In case none of those worked, prompt the user.
19580                 case "$netdb_name_type" in
19581                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19582                         dflt='char *'
19583                         . ./myread
19584                         netdb_name_type=$ans
19585                         ;;
19586                 esac
19587                 ;;
19588         *)      : no gethostbyname, so pick harmless default
19589                 netdb_name_type='char *'
19590                 ;;
19591         esac
19592 fi
19593
19594 : check for type of 1st argument to getnetbyaddr. 
19595 if test "X$netdb_net_type" = X ; then
19596         case "$d_getnbyaddr" in
19597         $define)
19598                 $cat <<EOM
19599
19600 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19601 EOM
19602                 hdrs="$define sys/types.h
19603                         $d_socket sys/socket.h 
19604                         $i_niin netinet/in.h 
19605                         $i_netdb netdb.h
19606                         $i_unistd unistd.h"
19607                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19608                         case "$netdb_net_type" in
19609                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19610                                 if ./protochk "$try" $hdrs; then
19611                                         echo "Your system accepts $xxx."
19612                                         netdb_net_type="$xxx"
19613                                 fi
19614                                 ;;
19615                         esac
19616                 done
19617                 : In case none of those worked, prompt the user.
19618                 case "$netdb_net_type" in
19619                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19620                         dflt='long'
19621                         . ./myread
19622                         netdb_net_type=$ans
19623                         ;;
19624                 esac
19625                 ;;
19626         *)      : no getnetbyaddr, so pick harmless default
19627                 netdb_net_type='long'
19628                 ;;
19629         esac
19630 fi
19631 : locate the preferred pager for this system
19632 fn=f/
19633 case "$pager" in
19634 '')
19635         dflt=''
19636         case "$pg" in
19637         /*) dflt=$pg;;
19638         [a-zA-Z]:/*) dflt=$pg;;
19639         esac
19640         case "$more" in
19641         /*) dflt=$more;;
19642         [a-zA-Z]:/*) dflt=$more;;
19643         esac
19644         case "$less" in
19645         /*) dflt=$less;;
19646         [a-zA-Z]:/*) dflt=$less;;
19647         esac
19648         case "$dflt" in
19649         '') dflt=/usr/ucb/more;;
19650         esac
19651         ;;
19652 *)      dflt="$pager"
19653         : Instruct ./getfile to trust the hinted or previous pager value,
19654         : even if it does not begin with a slash.  For example, on os2,
19655         : pager might be cmd /c more.  See comments in UU/getfile.
19656         fn="f/($pager)"
19657         ;;
19658 esac
19659 echo " "
19660 rp='What pager is used on your system?'
19661 . ./getfile
19662 pager="$ans"
19663
19664 : see what type pids are declared as in the kernel
19665 rp="What is the type of process ids on this system?"
19666 set pid_t pidtype int stdio.h sys/types.h
19667 eval $typedef_ask
19668
19669 : see if ar generates random libraries by itself
19670 echo " "
19671 echo "Checking how to generate random libraries on your machine..." >&4
19672 echo 'int bar1() { return bar2(); }' > bar1.c
19673 echo 'int bar2() { return 2; }' > bar2.c
19674 $cat > foo.c <<EOP
19675 #$i_stdlib I_STDLIB
19676 #ifdef I_STDLIB
19677 #include <stdlib.h>
19678 #endif
19679 int main() { printf("%d\n", bar1()); exit(0); }
19680 EOP
19681 $cc $ccflags -c bar1.c >/dev/null 2>&1
19682 $cc $ccflags -c bar2.c >/dev/null 2>&1
19683 $cc $ccflags -c foo.c >/dev/null 2>&1
19684 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19685 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19686         $run ./foobar >/dev/null 2>&1; then
19687         echo "$ar appears to generate random libraries itself."
19688         orderlib=false
19689         if [ "X$ranlib" = "X" ]; then
19690             ranlib=":"
19691         fi
19692 elif $ar s bar$_a >/dev/null 2>&1 &&
19693         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19694         $run ./foobar >/dev/null 2>&1; then
19695                 echo "a table of contents needs to be added with '$ar s'."
19696                 orderlib=false
19697                 ranlib="$ar s"
19698 elif $ar ts bar$_a >/dev/null 2>&1 &&
19699         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19700         $run ./foobar >/dev/null 2>&1; then
19701                 echo "a table of contents needs to be added with '$ar ts'."
19702                 orderlib=false
19703                 ranlib="$ar ts"
19704 else
19705         case "$ranlib" in
19706         :) ranlib='';;
19707         '')
19708                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19709                 $test -f $ranlib || ranlib=''
19710                 ;;
19711         esac
19712         if $test -n "$ranlib"; then
19713                 echo "your system has '$ranlib'; we'll use that."
19714                 orderlib=false
19715         else
19716                 echo "your system doesn't seem to support random libraries"
19717                 echo "so we'll use lorder and tsort to order the libraries."
19718                 orderlib=true
19719                 ranlib=":"
19720         fi
19721 fi
19722 $rm -f foo* bar*
19723
19724 : check for type of arguments to select. 
19725 case "$selecttype" in
19726 '') case "$d_select" in
19727         $define)
19728                 echo " "
19729                 $cat <<EOM
19730 Checking to see what type of arguments are accepted by select().
19731 EOM
19732                 hdrs="$define sys/types.h
19733                         $i_systime sys/time.h 
19734                         $i_sysselct sys/select.h
19735                         $d_socket sys/socket.h"
19736                 : The first arg can be int, unsigned, or size_t
19737                 : The last arg may or may not be 'const'
19738                 val=''
19739                 : void pointer has been seen but using that
19740                 : breaks the selectminbits test
19741                 for xxx in 'fd_set *' 'int *'; do
19742                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19743                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19744                                         case "$val" in
19745                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19746                                                 if ./protochk "$try" $hdrs; then
19747                                                         echo "Your system accepts $xxx."
19748                                                         val="$xxx"
19749                                                 fi
19750                                                 ;;
19751                                         esac
19752                                 done
19753                         done
19754                 done
19755                 case "$val" in
19756                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19757                         case "$d_fd_set" in
19758                                 $define) dflt="fd_set *" ;;
19759                                 *)              dflt="int *" ;;
19760                         esac
19761                         . ./myread
19762                         val=$ans
19763                         ;;
19764                 esac
19765                 selecttype="$val"
19766                 ;;
19767         *)      : no select, so pick a harmless default
19768                 selecttype='int *'
19769                 ;;
19770         esac
19771         ;;
19772 esac
19773
19774 : check for the select 'width'
19775 case "$selectminbits" in
19776 '') safebits=`expr $ptrsize \* 8`
19777     case "$d_select" in
19778         $define)
19779                 $cat <<EOM
19780
19781 Checking to see on how many bits at a time your select() operates...
19782 EOM
19783                 $cat >try.c <<EOCP
19784 #include <sys/types.h>
19785 #$i_time I_TIME
19786 #$i_systime I_SYS_TIME
19787 #$i_systimek I_SYS_TIME_KERNEL
19788 #ifdef I_TIME
19789 #   include <time.h>
19790 #endif
19791 #ifdef I_SYS_TIME
19792 #   ifdef I_SYS_TIME_KERNEL
19793 #       define KERNEL
19794 #   endif
19795 #   include <sys/time.h>
19796 #   ifdef I_SYS_TIME_KERNEL
19797 #       undef KERNEL
19798 #   endif
19799 #endif
19800 #$i_sysselct I_SYS_SELECT
19801 #ifdef I_SYS_SELECT
19802 #include <sys/select.h>
19803 #endif
19804 #$d_socket HAS_SOCKET
19805 #ifdef HAS_SOCKET
19806 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19807 #endif
19808 #include <stdio.h>
19809 #$i_stdlib I_STDLIB
19810 #ifdef I_STDLIB
19811 #include <stdlib.h>
19812 #endif
19813 $selecttype b;
19814 #define S sizeof(*(b))
19815 #define MINBITS 64
19816 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19817 #define NBITS  (NBYTES * 8)
19818 int main() {
19819     char *s = (char *)malloc(NBYTES);
19820     struct timeval t;
19821     int i;
19822     FILE* fp;
19823     int fd;
19824
19825     if (!s)
19826         exit(1);
19827     fclose(stdin);
19828     fp = fopen("try.c", "r");
19829     if (fp == 0)
19830       exit(2);
19831     fd = fileno(fp);
19832     if (fd < 0)
19833       exit(3);
19834     b = ($selecttype)s;
19835     for (i = 0; i < NBITS; i++)
19836         FD_SET(i, b);
19837     t.tv_sec  = 0;
19838     t.tv_usec = 0;
19839     select(fd + 1, b, 0, 0, &t);
19840     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19841     free(s);
19842     printf("%d\n", i + 1);
19843     return 0;
19844 }
19845 EOCP
19846                 set try
19847                 if eval $compile_ok; then
19848                         selectminbits=`$run ./try`
19849                         case "$selectminbits" in
19850                         '')     cat >&4 <<EOM
19851 Cannot figure out on how many bits at a time your select() operates.
19852 I'll play safe and guess it is $safebits bits.
19853 EOM
19854                                 selectminbits=$safebits
19855                                 bits="$safebits bits"
19856                                 ;;
19857                         1)      bits="1 bit" ;;
19858                         *)      bits="$selectminbits bits" ;;
19859                         esac
19860                         echo "Your select() operates on $bits at a time." >&4
19861                 else
19862                         rp='What is the minimum number of bits your select() operates on?'
19863                         case "$byteorder" in
19864                         12345678)       dflt=64 ;;
19865                         1234)           dflt=32 ;;
19866                         *)              dflt=1  ;;
19867                         esac
19868                         . ./myread
19869                         val=$ans
19870                         selectminbits="$val"
19871                 fi
19872                 $rm_try
19873                 ;;
19874         *)      : no select, so pick a harmless default
19875                 selectminbits=$safebits
19876                 ;;
19877         esac
19878         ;;
19879 esac
19880
19881 : Trace out the files included by signal.h, then look for SIGxxx names.
19882 : Remove SIGARRAYSIZE used by HPUX.
19883 : Remove SIGSTKSIZE used by Linux.
19884 : Remove SIGSTKSZ used by Posix.
19885 : Remove SIGTYP void lines used by OS2.
19886 : Some cpps, like os390, dont give the file name anywhere
19887 if [ "X$fieldn" = X ]; then
19888         : Just make some guesses.  We check them later.
19889         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19890 else
19891         xxx=`echo '#include <signal.h>' |
19892         $cppstdin $cppminus $cppflags 2>/dev/null |
19893         $grep '^[       ]*#.*include' | 
19894         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19895 fi
19896 : Check this list of files to be sure we have parsed the cpp output ok.
19897 : This will also avoid potentially non-existent files, such 
19898 : as ../foo/bar.h
19899 xxxfiles=''
19900 for xx in $xxx /dev/null ; do
19901         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19902 done
19903 : If we have found no files, at least try signal.h
19904 case "$xxxfiles" in
19905 '')     xxxfiles=`./findhdr signal.h` ;;
19906 esac
19907 xxx=`awk '
19908 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19909         print substr($2, 4, 20)
19910 }
19911 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19912         print substr($3, 4, 20)
19913 }' $xxxfiles`
19914 : Append some common names just in case the awk scan failed.
19915 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19916 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19917 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19918 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19919 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19920
19921 : generate a few handy files for later
19922 $cat > signal.c <<EOCP
19923 #include <sys/types.h>
19924 #include <signal.h>
19925 #$i_stdlib I_STDLIB
19926 #ifdef I_STDLIB
19927 #include <stdlib.h>
19928 #endif
19929 #include <stdio.h>
19930 int main() {
19931
19932 /* Strange style to avoid deeply-nested #if/#else/#endif */
19933 #ifndef NSIG
19934 #  ifdef _NSIG
19935 #    define NSIG (_NSIG)
19936 #  endif
19937 #endif
19938
19939 #ifndef NSIG
19940 #  ifdef SIGMAX
19941 #    define NSIG (SIGMAX+1)
19942 #  endif
19943 #endif
19944
19945 #ifndef NSIG
19946 #  ifdef SIG_MAX
19947 #    define NSIG (SIG_MAX+1)
19948 #  endif
19949 #endif
19950
19951 #ifndef NSIG
19952 #  ifdef _SIG_MAX
19953 #    define NSIG (_SIG_MAX+1)
19954 #  endif
19955 #endif
19956
19957 #ifndef NSIG
19958 #  ifdef MAXSIG
19959 #    define NSIG (MAXSIG+1)
19960 #  endif
19961 #endif
19962
19963 #ifndef NSIG
19964 #  ifdef MAX_SIG
19965 #    define NSIG (MAX_SIG+1)
19966 #  endif
19967 #endif
19968
19969 #ifndef NSIG
19970 #  ifdef SIGARRAYSIZE
19971 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19972 #  endif
19973 #endif
19974
19975 #ifndef NSIG
19976 #  ifdef _sys_nsig
19977 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19978 #  endif
19979 #endif
19980
19981 /* Default to some arbitrary number that's big enough to get most
19982    of the common signals.
19983 */
19984 #ifndef NSIG
19985 #    define NSIG 50
19986 #endif
19987
19988 printf("NSIG %d\n", NSIG);
19989
19990 #ifndef JUST_NSIG
19991
19992 EOCP
19993
19994 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19995 {
19996         printf "#ifdef SIG"; printf $1; printf "\n"
19997         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19998         printf $1; printf ");\n"
19999         printf "#endif\n"
20000 }
20001 END {
20002         printf "#endif /* JUST_NSIG */\n";
20003         printf "exit(0);\n}\n";
20004 }
20005 ' >>signal.c
20006 $cat >signal.awk <<'EOP'
20007 BEGIN { ndups = 0 }
20008 $1 ~ /^NSIG$/ { nsig = $2 }
20009 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
20010     if ($2 > maxsig) { maxsig = $2 }
20011     if (sig_name[$2]) {
20012         dup_name[ndups] = $1
20013         dup_num[ndups] = $2
20014         ndups++ 
20015     }
20016     else {
20017         sig_name[$2] = $1
20018         sig_num[$2] = $2
20019     }
20020 }
20021 END { 
20022     if (nsig == 0) {
20023         nsig = maxsig + 1
20024     }
20025     printf("NSIG %d\n", nsig);
20026     for (n = 1; n < nsig; n++) {
20027         if (sig_name[n]) {
20028             printf("%s %d\n", sig_name[n], sig_num[n])
20029         }
20030         else {
20031             printf("NUM%d %d\n", n, n) 
20032         }
20033     }
20034     for (n = 0; n < ndups; n++) {
20035         printf("%s %d\n", dup_name[n], dup_num[n])
20036     }
20037 }
20038 EOP
20039 $cat >signal_cmd <<EOS
20040 $startsh
20041 if $test -s signal.lst; then
20042     echo "Using your existing signal.lst file"
20043         exit 0
20044 fi
20045 xxx="$xxx"
20046 EOS
20047 $cat >>signal_cmd <<'EOS'
20048
20049 set signal
20050 if eval $compile_ok; then
20051         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20052 else
20053         echo "(I can't seem be able to compile the whole test program)" >&4
20054         echo "(I'll try it in little pieces.)" >&4
20055         set signal -DJUST_NSIG
20056         if eval $compile_ok; then
20057                 $run ./signal$_exe > signal.nsg
20058                 $cat signal.nsg
20059         else
20060                 echo "I can't seem to figure out how many signals you have." >&4
20061                 echo "Guessing 50." >&4
20062                 echo 'NSIG 50' > signal.nsg
20063         fi
20064         : Now look at all the signal names, one at a time.
20065         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20066                 $cat > signal.c <<EOCP
20067 #include <sys/types.h>
20068 #include <signal.h>
20069 #include <stdio.h>
20070 int main() {
20071 printf("$xx %d\n", SIG${xx});
20072 return 0;
20073 }
20074 EOCP
20075                 set signal
20076                 if eval $compile; then
20077                         echo "SIG${xx} found."
20078                         $run ./signal$_exe  >> signal.ls1
20079                 else
20080                         echo "SIG${xx} NOT found."
20081                 fi
20082         done
20083         if $test -s signal.ls1; then
20084                 $cat signal.nsg signal.ls1 |
20085                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20086         fi
20087
20088 fi
20089 if $test -s signal.lst; then
20090         :
20091 else
20092         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20093         echo 'kill -l' >signal
20094         set X `csh -f <signal`
20095         $rm -f signal
20096         shift
20097         case $# in
20098         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20099         esac
20100         echo $@ | $tr ' ' $trnl | \
20101             $awk '{ printf "%s %d\n", $1, ++s; }
20102                   END { printf "NSIG %d\n", ++s }' >signal.lst
20103 fi
20104 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20105 EOS
20106 chmod a+x signal_cmd
20107 $eunicefix signal_cmd
20108
20109 : generate list of signal names
20110 echo " "
20111 case "$sig_name_init" in
20112 '') doinit=yes ;;
20113 *)  case "$sig_num_init" in
20114     ''|*,*) doinit=yes ;;
20115     esac ;;
20116 esac
20117 case "$doinit" in
20118 yes)
20119         echo "Generating a list of signal names and numbers..." >&4
20120         . ./signal_cmd
20121         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20122         sig_name=`$awk 'BEGIN { printf "ZERO " }
20123                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20124         sig_num=`$awk  'BEGIN { printf "0 " }
20125                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20126         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20127                              !/^NSIG/   { printf "\"%s\", ", $1 }
20128                              END        { printf "0\n" }' signal.lst`
20129         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20130                              !/^NSIG/   { printf "%d, ", $2}
20131                              END        { printf "0\n"}' signal.lst`
20132         ;;
20133 esac
20134 echo "The following $sig_count signals are available:"
20135 echo " "
20136 echo $sig_name | $awk \
20137 'BEGIN { linelen = 0 }
20138 {
20139         for (i = 1; i <= NF; i++) {
20140                 name = "SIG" $i " "
20141                 linelen = linelen + length(name)
20142                 if (linelen > 70) {
20143                         printf "\n"
20144                         linelen = length(name)
20145                 }
20146                 printf "%s", name
20147         }
20148         printf "\n"
20149 }'
20150 sig_size=`echo $sig_name | awk '{print NF}'`
20151 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20152
20153 echo " "
20154 case "$sizetype" in
20155 *_t) zzz="$sizetype"    ;;
20156 *)   zzz="filesize"     ;;
20157 esac
20158 echo "Checking the size of $zzz..." >&4 
20159 cat > try.c <<EOCP
20160 #include <sys/types.h>
20161 #include <stdio.h>
20162 #$i_stdlib I_STDLIB
20163 #ifdef I_STDLIB
20164 #include <stdlib.h>
20165 #endif
20166 int main() {
20167     printf("%d\n", (int)sizeof($sizetype));
20168     exit(0);
20169 }
20170 EOCP
20171 set try
20172 if eval $compile_ok; then
20173         yyy=`$run ./try`
20174         case "$yyy" in
20175         '')     sizesize=4
20176                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20177                 ;;
20178         *)      sizesize=$yyy
20179                 echo "Your $zzz size is $sizesize bytes."
20180                 ;;
20181         esac
20182 else
20183         sizesize=4
20184         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20185 fi
20186
20187
20188 : check for socklen_t
20189 echo " "
20190 echo "Checking to see if you have socklen_t..." >&4
20191 $cat >try.c <<EOCP
20192 #include <sys/types.h>
20193 #$d_socket HAS_SOCKET
20194 #ifdef HAS_SOCKET
20195 #include <sys/socket.h>
20196 #endif
20197 int main() { socklen_t x = 16; }
20198 EOCP
20199 set try
20200 if eval $compile; then
20201         val="$define"
20202         echo "You have socklen_t."
20203 else
20204         val="$undef"
20205         echo "You do not have socklen_t."
20206         case "$sizetype" in
20207         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20208         esac
20209 fi
20210 $rm_try
20211 set d_socklen_t
20212 eval $setvar
20213
20214 : see if this is a socks.h system
20215 set socks.h i_socks
20216 eval $inhdr
20217
20218 : check for type of the size argument to socket calls
20219 case "$d_socket" in
20220 "$define")
20221         $cat <<EOM
20222
20223 Checking to see what type is the last argument of accept().
20224 EOM
20225         yyy=''
20226         case "$d_socklen_t" in
20227         "$define") yyy="$yyy socklen_t"
20228         esac
20229         yyy="$yyy $sizetype int long unsigned"
20230         for xxx in $yyy; do
20231                 case "$socksizetype" in
20232                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20233                         case "$usesocks" in
20234                         "$define")
20235                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20236                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20237                                         socksizetype="$xxx"
20238                                 fi
20239                                 ;;
20240                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20241                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20242                                         socksizetype="$xxx"
20243                                 fi
20244                                 ;;
20245                         esac
20246                         ;;
20247                 esac
20248         done
20249 : In case none of those worked, prompt the user.
20250         case "$socksizetype" in
20251         '')     rp='What is the type for socket address structure sizes?'
20252                 dflt='int'
20253                 . ./myread
20254                 socksizetype=$ans
20255                 ;;
20256         esac
20257         ;;
20258 *)      : no sockets, so pick relatively harmless default
20259         socksizetype='int'
20260         ;;
20261 esac
20262
20263 : see what type is used for signed size_t
20264 set ssize_t ssizetype int stdio.h sys/types.h
20265 eval $typedef
20266 dflt="$ssizetype"
20267 $cat > try.c <<EOM
20268 #include <stdio.h>
20269 #$i_stdlib I_STDLIB
20270 #ifdef I_STDLIB
20271 #include <stdlib.h>
20272 #endif
20273 #include <sys/types.h>
20274 #define Size_t $sizetype
20275 #define SSize_t $dflt
20276 int main()
20277 {
20278         if (sizeof(Size_t) == sizeof(SSize_t))
20279                 printf("$dflt\n");
20280         else if (sizeof(Size_t) == sizeof(int))
20281                 printf("int\n");
20282         else
20283                 printf("long\n");
20284         exit(0);
20285 }
20286 EOM
20287 echo " "
20288 set try
20289 if eval $compile_ok && $run ./try > /dev/null; then
20290         ssizetype=`$run ./try`
20291         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20292 else
20293         $cat >&4 <<EOM
20294 Help! I can't compile and run the ssize_t test program: please enlighten me!
20295 (This is probably a misconfiguration in your system or libraries, and
20296 you really ought to fix it.  Still, I'll try anyway.)
20297
20298 I need a type that is the same size as $sizetype, but is guaranteed to
20299 be signed.  Common values are ssize_t, int and long.
20300
20301 EOM
20302         rp="What signed type is the same size as $sizetype?"
20303         . ./myread
20304         ssizetype="$ans"
20305 fi
20306 $rm_try
20307
20308 : see what type of char stdio uses.
20309 echo " "
20310 echo '#include <stdio.h>' > stdio.c
20311 $cppstdin $cppminus < stdio.c > stdioh
20312 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20313         echo "Your stdio uses unsigned chars." >&4
20314         stdchar="unsigned char"
20315 else
20316         echo "Your stdio uses signed chars." >&4
20317         stdchar="char"
20318 fi
20319 $rm -f stdio.* stdioh
20320
20321 : see what type uids are declared as in the kernel
20322 echo " "
20323 echo "Looking for the type for user ids returned by getuid()."
20324 set uid_t uidtype xxx stdio.h sys/types.h
20325 eval $typedef
20326 case "$uidtype" in
20327 xxx)
20328         xxx=`./findhdr sys/user.h`
20329         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20330         case $1 in
20331         unsigned) dflt="$1 $2" ;;
20332         *) dflt="$1" ;;
20333         esac
20334         ;;
20335 *) dflt="$uidtype";;
20336 esac
20337 case "$uidtype" in
20338 uid_t)  echo "uid_t found." ;;
20339 *)      rp="What is the type for user ids returned by getuid()?"
20340         . ./myread
20341         uidtype="$ans"
20342         ;;
20343 esac
20344
20345 echo " "
20346 case "$uidtype" in
20347 *_t) zzz="$uidtype"     ;;
20348 *)   zzz="uid"          ;;
20349 esac
20350 echo "Checking the size of $zzz..." >&4 
20351 cat > try.c <<EOCP
20352 #include <sys/types.h>
20353 #include <stdio.h>
20354 #$i_stdlib I_STDLIB
20355 #ifdef I_STDLIB
20356 #include <stdlib.h>
20357 #endif
20358 int main() {
20359     printf("%d\n", (int)sizeof($uidtype));
20360     exit(0);
20361 }
20362 EOCP
20363 set try
20364 if eval $compile_ok; then
20365         yyy=`$run ./try`
20366         case "$yyy" in
20367         '')     uidsize=4
20368                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20369                 ;;
20370         *)      uidsize=$yyy
20371                 echo "Your $zzz is $uidsize bytes long."
20372                 ;;
20373         esac
20374 else
20375         uidsize=4
20376         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20377 fi
20378
20379 echo " "
20380 case "$uidtype" in
20381 *_t) zzz="$uidtype"     ;;
20382 *)   zzz="uid"          ;;
20383 esac
20384 echo "Checking the sign of $zzz..." >&4
20385 cat > try.c <<EOCP
20386 #include <sys/types.h>
20387 #include <stdio.h>
20388 int main() {
20389         $uidtype foo = -1;
20390         if (foo < 0)
20391                 printf("-1\n");
20392         else
20393                 printf("1\n");
20394 }
20395 EOCP
20396 set try
20397 if eval $compile; then
20398         yyy=`$run ./try`
20399         case "$yyy" in
20400         '')     uidsign=1
20401                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20402                 ;;
20403         *)      uidsign=$yyy
20404                 case "$uidsign" in
20405                  1) echo "Your $zzz is unsigned." ;;
20406                 -1) echo "Your $zzz is signed."   ;;
20407                 esac
20408                 ;;
20409         esac
20410 else
20411         uidsign=1
20412         echo "(I can't compile the test program--guessing unsigned.)" >&4
20413 fi
20414
20415
20416
20417 echo " "
20418 $echo "Checking the format string to be used for uids..." >&4
20419
20420 case "$uidsign" in
20421 -1)     if $test X"$uidsize" = X"$ivsize"; then
20422                 uidformat="$ivdformat"
20423         else
20424                 if $test X"$uidsize" = X"$longsize"; then
20425                         uidformat='"ld"'
20426                 else
20427                         if $test X"$uidsize" = X"$intsize"; then
20428                                 uidformat='"d"'
20429                         else
20430                                 if $test X"$uidsize" = X"$shortsize"; then
20431                                         uidformat='"hd"'
20432                                 fi
20433                         fi
20434                 fi
20435         fi
20436         ;;
20437 *)      if $test X"$uidsize" = X"$uvsize"; then
20438                 uidformat="$uvuformat"
20439         else
20440                 if $test X"$uidsize" = X"$longsize"; then
20441                         uidformat='"lu"'
20442                 else
20443                         if $test X"$uidsize" = X"$intsize"; then
20444                                 uidformat='"u"'
20445                         else
20446                                 if $test X"$uidsize" = X"$shortsize"; then
20447                                         uidformat='"hu"'
20448                                 fi
20449                         fi
20450                 fi
20451         fi
20452         ;;
20453 esac
20454
20455
20456 case "$usesitecustomize" in
20457     $define|true|[Yy]*)
20458         usesitecustomize="$define"
20459         ;;
20460     *)
20461         usesitecustomize="$undef"
20462         ;;
20463     esac
20464
20465 : determine compiler compiler
20466 case "$yacc" in
20467 '')
20468         dflt=yacc;;
20469 *)
20470         dflt="$yacc";;
20471 esac
20472 echo " "
20473 comp='yacc'
20474 if $test -f "$byacc$_exe"; then
20475         dflt="$byacc"
20476         comp="byacc or $comp"
20477 fi
20478 if $test -f "$bison$_exe"; then
20479         comp="$comp or bison -y"
20480 fi
20481 rp="Which compiler compiler ($comp) shall I use?"
20482 . ./myread
20483 yacc="$ans"
20484 case "$yacc" in
20485 *bis*)
20486         case "$yacc" in
20487         *-y*) ;;
20488         *)
20489                 yacc="$yacc -y"
20490                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20491                 ;;
20492         esac
20493         ;;
20494 esac
20495
20496 : see if this is a fp.h system
20497 set fp.h i_fp
20498 eval $inhdr
20499
20500 : see if this is a fp_class.h system
20501 set fp_class.h i_fp_class
20502 eval $inhdr
20503
20504 : see if gdbm.h is available
20505 set gdbm.h t_gdbm
20506 eval $inhdr
20507 case "$t_gdbm" in
20508 $define)
20509         : see if gdbm_open exists
20510         set gdbm_open d_gdbm_open
20511         eval $inlibc
20512         case "$d_gdbm_open" in
20513         $undef)
20514                 t_gdbm="$undef"
20515                 echo "We won't be including <gdbm.h>"
20516                 ;;
20517         esac
20518         ;;
20519 esac
20520 val="$t_gdbm"
20521 set i_gdbm
20522 eval $setvar
20523
20524 : see if this is a ieeefp.h system
20525 case "$i_ieeefp" in
20526 '' ) set ieeefp.h i_ieeefp
20527      eval $inhdr
20528      ;;
20529 esac
20530
20531 : see if this is a libutil.h system
20532 set libutil.h i_libutil
20533 eval $inhdr
20534
20535 : see if mach cthreads are available
20536 if test "X$usethreads" = "X$define"; then
20537         set mach/cthreads.h i_machcthr
20538         eval $inhdr
20539 else
20540         i_machcthr="$undef"
20541 fi
20542
20543
20544
20545 : see if this is a mntent.h system
20546 set mntent.h i_mntent
20547 eval $inhdr
20548
20549 : see if ndbm.h is available
20550 set ndbm.h t_ndbm
20551 eval $inhdr
20552
20553 case "$t_ndbm" in
20554 $undef)
20555     # Some Linux distributions such as RedHat 7.1 put the
20556     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20557     if $test -f /usr/include/gdbm/ndbm.h; then
20558         echo '<gdbm/ndbm.h> found.'
20559         ccflags="$ccflags -I/usr/include/gdbm"
20560         cppflags="$cppflags -I/usr/include/gdbm"
20561         t_ndbm=$define
20562     fi
20563     ;;
20564 esac
20565
20566 case "$t_ndbm" in
20567 $define)
20568         : see if dbm_open exists
20569         set dbm_open d_dbm_open
20570         eval $inlibc
20571         case "$d_dbm_open" in
20572         $undef)
20573                 t_ndbm="$undef"
20574                 echo "We won't be including <ndbm.h>"
20575                 ;;
20576         esac
20577         ;;
20578 esac
20579 val="$t_ndbm"
20580 set i_ndbm
20581 eval $setvar
20582
20583 : see if net/errno.h is available
20584 val=''
20585 set net/errno.h val
20586 eval $inhdr
20587
20588 : Unfortunately, it causes problems on some systems.  Arrgh.
20589 case "$val" in
20590 $define)
20591         cat > try.c <<'EOM'
20592 #include <stdio.h>
20593 #include <errno.h>
20594 #include <net/errno.h>
20595 int func()
20596 {
20597         return ENOTSOCK;
20598 }
20599 EOM
20600         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20601                 echo "We'll be including <net/errno.h>." >&4
20602         else
20603                 echo "We won't be including <net/errno.h>." >&4
20604                 val="$undef"
20605         fi
20606         $rm_try
20607         ;;
20608 esac
20609 set i_neterrno
20610 eval $setvar
20611
20612 : see if netinet/tcp.h is available
20613 set netinet/tcp.h i_netinettcp
20614 eval $inhdr
20615
20616 : see if this is a poll.h system
20617 set poll.h i_poll
20618 eval $inhdr
20619
20620 : see if this is a prot.h system
20621 set prot.h i_prot
20622 eval $inhdr
20623
20624 echo " "
20625 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20626 $cat <<'EOSH' > Cppsym.know
20627 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20628 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20629 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20630 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20631 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20632 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20633 bull c cadmus clipper CMU COFF COMPILER_VERSION
20634 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20635 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20636 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20637 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20638 GLIBC GLIBC_MINOR
20639 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20640 H3050R H3050RX hbullx20 hcx host_mips
20641 hp200 hp300 hp700 HP700 hp800 hp9000
20642 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20643 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20644 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20645 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20646 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20647 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20648 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20649 LIBCATAMOUNT Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20650 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20651 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20652 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20653 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20654 MATH_HAS_NO_SIDE_EFFECTS
20655 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20656 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20657 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20658 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20659 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20660 NetBSD news1500 news1700 news1800 news1900 news3700
20661 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20662 ns32016 ns32332 ns32k nsc32000
20663 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20664 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20665 pc532 pdp11 PGC PIC plexus PORTAR posix
20666 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20667 POSIX_C_SOURCE POSIX_SOURCE POWER
20668 PROTOTYPES PWB pyr QNX QK_USER R3000 REENTRANT RES Rhapsody RISC6000
20669 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20670 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20671 sony sony_news sonyrisc sparc sparclite spectrum
20672 stardent stdc STDC_EXT stratos sun sun3 sun386
20673 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20674 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20675 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20676 sysV68 sysV88 Tek4132 Tek4300 titan
20677 TM3200 TM5400 TM5600
20678 tower tower32 tower32_200 tower32_600 tower32_700
20679 tower32_800 tower32_850 tss
20680 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20681 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20682 unix UNIX95 UNIX99 unixpc unos
20683 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20684 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20685 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20686 USGr4 USGr4_2
20687 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20688 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20689 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20690 z8000
20691 EOSH
20692 # Maybe put other stuff here too.
20693 cat <<EOSH >>Cppsym.know
20694 $osname
20695 EOSH
20696 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20697 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20698 $cat Cppsym.know > Cppsym.c
20699 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20700 $rm -f Cppsym.a Cppsym.b Cppsym.c
20701 cat <<EOSH > Cppsym
20702 $startsh
20703 if $test \$# -gt 0; then
20704     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20705     if $test -s Cppsym.got; then
20706         $rm -f Cppsym.got
20707         exit 0
20708     fi
20709     $rm -f Cppsym.got
20710     exit 1
20711 else
20712     $tr " " "$trnl" | ./Cppsym.try
20713     exit 0
20714 fi
20715 EOSH
20716 chmod +x Cppsym
20717 $eunicefix Cppsym
20718 cat <<EOSH > Cppsym.try
20719 $startsh
20720 cat <<'EOCP' > try.c
20721 #include <stdio.h>
20722 #if cpp_stuff == 1
20723 #define STRINGIFY(a)    "a"
20724 #endif
20725 #if cpp_stuff == 42
20726 #define StGiFy(a)  #a
20727 #define STRINGIFY(a)    StGiFy(a)
20728 #endif
20729 #if $cpp_stuff != 1 && $cpp_stuff != 42
20730 #   include "Bletch: How does this C preprocessor stringify macros?"
20731 #endif
20732 int main() {
20733 EOCP
20734 $awk \\
20735 EOSH
20736 cat <<'EOSH' >> Cppsym.try
20737 'length($1) > 0 {
20738     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20739     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20740     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20741     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20742 }'       >> try.c
20743 echo 'return 0;}' >> try.c
20744 EOSH
20745 cat <<EOSH >> Cppsym.try
20746 ccflags="$ccflags"
20747 case "$osname-$gccversion" in
20748 irix-) ccflags="\$ccflags -woff 1178" ;;
20749 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20750 esac
20751 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20752 EOSH
20753 chmod +x Cppsym.try
20754 $eunicefix Cppsym.try
20755 ./Cppsym < Cppsym.know > Cppsym.true
20756 : Add in any linux cpp "predefined macros":
20757 case "$osname::$gccversion" in
20758   *linux*::*.*)
20759     tHdrH=_tmpHdr
20760     rm -f $tHdrH'.h' $tHdrH
20761     touch $tHdrH'.h'
20762     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20763        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20764        if [ -s $tHdrH'_cppsym.real' ]; then
20765           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20766        fi
20767     fi
20768     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20769   ;;
20770 esac
20771 : now check the C compiler for additional symbols
20772 postprocess_cc_v=''
20773 case "$osname" in
20774 aix) postprocess_cc_v="|$tr , ' '" ;;
20775 esac
20776 $cat >ccsym <<EOS
20777 $startsh
20778 $cat >tmp.c <<EOF
20779 extern int foo;
20780 EOF
20781 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20782 do
20783         case "\$i" in
20784         -D*) echo "\$i" | $sed 's/^-D//';;
20785         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20786         esac
20787 done
20788 $rm_try
20789 EOS
20790 postprocess_cc_v=''
20791 chmod +x ccsym
20792 $eunicefix ccsym
20793 ./ccsym > ccsym1.raw
20794 if $test -s ccsym1.raw; then
20795        $sort ccsym1.raw | $uniq >ccsym.raw
20796 else
20797        mv ccsym1.raw ccsym.raw
20798 fi
20799
20800 $awk '/\=/ { print $0; next }
20801         { print $0"=1" }' ccsym.raw >ccsym.list
20802 $comm -13 Cppsym.true ccsym.list >ccsym.own
20803 $comm -12 Cppsym.true ccsym.list >ccsym.com
20804 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20805 also=''
20806 if $test -z ccsym.raw; then
20807         echo "Your C compiler doesn't seem to define any symbols!" >&4
20808         echo " "
20809         echo "However, your C preprocessor defines the following symbols:"
20810         $cat Cppsym.true
20811         ccsymbols=''
20812         cppsymbols=`$cat Cppsym.true`
20813         cppsymbols=`echo $cppsymbols`
20814         cppccsymbols="$cppsymbols"
20815 else
20816         if $test -s ccsym.com; then
20817                 echo "Your C compiler and pre-processor define these symbols:"
20818                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20819                 also='also '
20820                 symbols='ones'
20821                 cppccsymbols=`$cat ccsym.com`
20822                 cppccsymbols=`echo $cppccsymbols`
20823                 $test "$silent" || sleep 1
20824         fi
20825         if $test -s ccsym.cpp; then
20826                 $test "$also" && echo " "
20827                 echo "Your C pre-processor ${also}defines the following symbols:"
20828                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20829                 also='further '
20830                 cppsymbols=`$cat ccsym.cpp`
20831                 cppsymbols=`echo $cppsymbols`
20832                 $test "$silent" || sleep 1
20833         fi
20834         if $test -s ccsym.own; then
20835                 $test "$also" && echo " "
20836                 echo "Your C compiler ${also}defines the following cpp symbols:"
20837                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20838                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20839                 ccsymbols=`$cat ccsym.own`
20840                 ccsymbols=`echo $ccsymbols`
20841                 $test "$silent" || sleep 1
20842         fi
20843 fi
20844
20845 : see if this is a termio system
20846 val="$undef"
20847 val2="$undef"
20848 val3="$undef"
20849 if $test `./findhdr termios.h`; then
20850         set tcsetattr i_termios
20851         eval $inlibc
20852         val3="$i_termios"
20853 fi
20854 echo " "
20855 case "$val3" in
20856 "$define") echo "You have POSIX termios.h... good!" >&4;;
20857 *) if ./Cppsym pyr; then
20858                 case "`/bin/universe`" in
20859                 ucb) if $test `./findhdr sgtty.h`; then
20860                                 val2="$define"
20861                                 echo "<sgtty.h> found." >&4
20862                         else
20863                                 echo "System is pyramid with BSD universe."
20864                                 echo "<sgtty.h> not found--you could have problems." >&4
20865                         fi;;
20866                 *) if $test `./findhdr termio.h`; then
20867                                 val="$define"
20868                                 echo "<termio.h> found." >&4
20869                         else
20870                                 echo "System is pyramid with USG universe."
20871                                 echo "<termio.h> not found--you could have problems." >&4
20872                         fi;;
20873                 esac
20874         elif ./usg; then
20875                 if $test `./findhdr termio.h`; then
20876                         echo "<termio.h> found." >&4
20877                         val="$define"
20878                 elif $test `./findhdr sgtty.h`; then
20879                         echo "<sgtty.h> found." >&4
20880                         val2="$define"
20881                 else
20882 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20883                 fi
20884         else
20885                 if $test `./findhdr sgtty.h`; then
20886                         echo "<sgtty.h> found." >&4
20887                         val2="$define"
20888                 elif $test `./findhdr termio.h`; then
20889                         echo "<termio.h> found." >&4
20890                         val="$define"
20891                 else
20892 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20893                 fi
20894         fi;;
20895 esac
20896 set i_termio; eval $setvar
20897 val=$val2; set i_sgtty; eval $setvar
20898 val=$val3; set i_termios; eval $setvar
20899
20900 : see if stddef is available
20901 set stddef.h i_stddef
20902 eval $inhdr
20903
20904 : see if sys/access.h is available
20905 set sys/access.h i_sysaccess
20906 eval $inhdr
20907
20908 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20909 set sys/filio.h i_sysfilio
20910 eval $inhdr
20911 echo " "
20912 if $test `./findhdr sys/ioctl.h`; then
20913         val="$define"
20914         echo '<sys/ioctl.h> found.' >&4
20915 else
20916         val="$undef"
20917         if $test $i_sysfilio = "$define"; then
20918             echo '<sys/ioctl.h> NOT found.' >&4
20919         else
20920                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20921                 $test $i_termio = "$define" && xxx="termio.h"
20922                 $test $i_termios = "$define" && xxx="termios.h"
20923 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20924         fi
20925 fi
20926 set i_sysioctl
20927 eval $setvar
20928
20929 : see if socket ioctl defs are in sys/sockio.h
20930 echo " "
20931 xxx=`./findhdr sys/sockio.h`
20932 if $test "$xxx"; then
20933         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20934                 val="$define"
20935                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20936         else
20937                 val="$undef"
20938                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20939         fi
20940 else
20941         val="$undef"
20942         $cat <<EOM
20943 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20944 EOM
20945 fi
20946 set i_syssockio
20947 eval $setvar
20948
20949
20950 : see if this is a syslog.h system
20951 set syslog.h i_syslog
20952 eval $inhdr
20953
20954
20955 : see if this is a sys/mode.h system
20956 set sys/mode.h i_sysmode
20957 eval $inhdr
20958
20959 : see if sys/resource.h has to be included
20960 set sys/resource.h i_sysresrc
20961 eval $inhdr
20962
20963 : see if sys/security.h is available
20964 set sys/security.h i_syssecrt
20965 eval $inhdr
20966
20967 : see if this is a sys/statvfs.h system
20968 set sys/statvfs.h i_sysstatvfs
20969 eval $inhdr
20970
20971 : see if this is a sys/un.h system
20972 set sys/un.h i_sysun
20973 eval $inhdr
20974
20975
20976 : see if this is a sys/utsname.h system
20977 set sys/utsname.h i_sysutsname
20978 eval $inhdr
20979
20980 : see if this is a syswait system
20981 set sys/wait.h i_syswait
20982 eval $inhdr
20983
20984 : see if this is a ustat.h system
20985 set ustat.h i_ustat
20986 eval $inhdr
20987
20988 : see if this is an utime system
20989 set utime.h i_utime
20990 eval $inhdr
20991
20992 : see if this is a values.h system
20993 set values.h i_values
20994 eval $inhdr
20995
20996 : see if this is a vfork system
20997 case "$d_vfork" in
20998 "$define")
20999         set vfork.h i_vfork
21000         eval $inhdr
21001         ;;
21002 *)
21003         i_vfork="$undef"
21004         ;;
21005 esac
21006
21007 echo " "
21008 echo "Looking for extensions..." >&4
21009 : If we are using the old config.sh, known_extensions may contain
21010 : old or inaccurate or duplicate values.
21011 known_extensions=''
21012 nonxs_extensions=''
21013 : We do not use find because it might not be available.
21014 : We do not just use MANIFEST because the user may have dropped
21015 : some additional extensions into the source tree and expect them
21016 : to be built.
21017
21018 : Function to recursively find available extensions, ignoring DynaLoader
21019 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
21020 find_extensions='
21021     for xxx in *; do
21022         case "$xxx" in
21023             DynaLoader|dynaload) ;;
21024             *)
21025             if $test -f $xxx/$xxx.xs -o -f $xxx/$xxx.c; then
21026                 known_extensions="$known_extensions $1$xxx";
21027             elif $test -f $xxx/Makefile.PL; then
21028                 nonxs_extensions="$nonxs_extensions $1$xxx";
21029             else
21030                 if $test -d $xxx -a $# -lt 10; then
21031                     set $1$xxx/ $*;
21032                     cd "$xxx";
21033                     eval $find_extensions;
21034                     cd ..;
21035                     shift;
21036                 fi;
21037             fi
21038             ;;
21039         esac;
21040     done'
21041 tdir=`pwd`
21042 cd "$rsrc/ext"
21043 set X
21044 shift
21045 eval $find_extensions
21046 # Special case:  Add in threads/shared since it is not picked up by the
21047 # recursive find above (and adding in general recursive finding breaks
21048 # SDBM_File/sdbm).  A.D.  10/25/2001.
21049 known_extensions="$known_extensions threads/shared"
21050 set X $known_extensions
21051 shift
21052 known_extensions="$*"
21053 set X $nonxs_extensions
21054 shift
21055 nonxs_extensions="$*"
21056 cd "$tdir"
21057
21058 : Now see which are supported on this system.
21059 avail_ext=''
21060 for xxx in $known_extensions ; do
21061         case "$xxx" in
21062         DB_File|db_file)
21063                 case "$i_db" in
21064                 $define) avail_ext="$avail_ext $xxx" ;;
21065                 esac
21066                 ;;
21067         GDBM_File|gdbm_fil)
21068                 case "$i_gdbm" in
21069                 $define) avail_ext="$avail_ext $xxx" ;;
21070                 esac
21071                 ;;
21072         I18N/Langinfo|i18n_lan)
21073                 case "$i_langinfo$d_nl_langinfo" in
21074                 $define$define) avail_ext="$avail_ext $xxx" ;;
21075                 esac
21076                 ;;
21077         IPC/SysV|ipc/sysv)
21078                 : XXX Do we need a useipcsysv variable here
21079                 case "${d_msg}${d_sem}${d_shm}" in
21080                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21081                 esac
21082                 ;;
21083         NDBM_File|ndbm_fil)
21084                 case "$i_ndbm" in
21085                 $define)
21086                     case "$osname-$use64bitint" in
21087                     hpux-define)
21088                         case "$libs" in
21089                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21090                         esac
21091                         ;;
21092                     *) avail_ext="$avail_ext $xxx" ;;
21093                     esac
21094                     ;;
21095                 esac
21096                 ;;
21097         ODBM_File|odbm_fil)
21098                 case "${i_dbm}${i_rpcsvcdbm}" in
21099                 *"${define}"*)
21100                     case "$d_cplusplus" in
21101                     define) ;; # delete as a function name will not work
21102                     *)  case "$osname-$use64bitint" in
21103                         hpux-define)
21104                             case "$libs" in
21105                             *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21106                             esac
21107                             ;;
21108                         *) avail_ext="$avail_ext $xxx" ;;
21109                         esac
21110                         ;;
21111                     esac
21112                     ;;
21113                 esac
21114                 ;;
21115         Opcode|opcode)
21116                 case "$useopcode" in
21117                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21118                 esac
21119                 ;;
21120         POSIX|posix)
21121                 case "$useposix" in
21122                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21123                 esac
21124                 ;;
21125         Socket|socket)
21126                 case "$d_socket" in
21127                 true|$define|y)
21128                     case "$osname" in
21129                     beos) ;; # not unless BONE
21130                     *) avail_ext="$avail_ext $xxx" ;;
21131                     esac
21132                     ;;
21133                 esac
21134                 ;;
21135         Sys/Syslog|sys/syslog)
21136                 : XXX syslog requires socket
21137                 case "$d_socket" in
21138                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21139                 esac
21140                 ;;
21141         Thread|thread)
21142                 case "$usethreads" in
21143                 true|$define|y)
21144                         case "$use5005threads" in
21145                         $define|true|[yY]*) avail_ext="$avail_ext $xxx" ;;
21146                         esac
21147                 esac
21148                 ;;
21149         threads|threads/shared)
21150                 # threads and threads::shared are special cases.
21151                 # To stop people from asking "Perl 5.8.0 was supposed
21152                 # to have this new fancy threads implementation but my
21153                 # perl doesn't have it" and from people trying to
21154                 # (re)install the threads module using CPAN.pm and
21155                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21156                 # the threads.pm and threads/shared.pm will always be
21157                 # there, croaking informatively ("you need to rebuild
21158                 # all of Perl with threads, sorry") when threads haven't
21159                 # been compiled in.
21160                 # --jhi
21161                 avail_ext="$avail_ext $xxx"
21162                 ;;
21163         Win32*)
21164                 case "$osname" in
21165                 cygwin) avail_ext="$avail_ext $xxx" ;;
21166                 esac
21167                 ;;
21168         XS/APItest|xs/apitest)
21169                 # This is just for testing.  Skip it unless we have dynamic loading.
21170
21171                 case "$usedl" in
21172                 $define) avail_ext="$avail_ext $xxx" ;;
21173                 esac
21174                 ;;
21175         XS/Typemap|xs/typemap)
21176                 # This is just for testing.  Skip it unless we have dynamic loading.
21177                 case "$usedl" in
21178                 $define) avail_ext="$avail_ext $xxx" ;;
21179                 esac
21180                 ;;
21181         *)      avail_ext="$avail_ext $xxx"
21182                 ;;
21183         esac
21184 done
21185
21186 set X $avail_ext
21187 shift
21188 avail_ext="$*"
21189
21190 case "$onlyextensions" in
21191 '') ;;
21192 *)  keepextensions=''
21193     echo "You have requested that only certains extensions be included..." >&4
21194     for i in $onlyextensions; do
21195         case " $avail_ext " in
21196         *" $i "*)
21197             echo "Keeping extension $i."
21198             keepextensions="$keepextensions $i"
21199             ;;
21200         *) echo "Ignoring extension $i." ;;
21201         esac
21202     done
21203     avail_ext="$keepextensions"
21204     ;;
21205 esac
21206
21207 case "$noextensions" in
21208 '') ;;
21209 *)  keepextensions=''
21210     echo "You have requested that certain extensions be ignored..." >&4
21211     for i in $avail_ext; do
21212         case " $noextensions " in
21213         *" $i "*) echo "Ignoring extension $i." ;;
21214         *) echo "Keeping extension $i.";
21215            keepextensions="$keepextensions $i"
21216            ;;
21217         esac
21218     done
21219     avail_ext="$keepextensions"
21220     ;;
21221 esac
21222
21223 : Now see which nonxs extensions are supported on this system.
21224 : For now assume all are.
21225 nonxs_ext=''
21226 for xxx in $nonxs_extensions ; do
21227         case "$xxx" in
21228         *)      nonxs_ext="$nonxs_ext $xxx"
21229                 ;;
21230         esac
21231 done
21232
21233 set X $nonxs_ext
21234 shift
21235 nonxs_ext="$*"
21236
21237 case $usedl in
21238 $define)
21239         $cat <<EOM
21240 A number of extensions are supplied with $package.  You may choose to
21241 compile these extensions for dynamic loading (the default), compile
21242 them into the $package executable (static loading), or not include
21243 them at all.  Answer "none" to include no extensions.
21244 Note that DynaLoader is always built and need not be mentioned here.
21245
21246 EOM
21247         case "$dynamic_ext" in
21248         '')
21249                 : Exclude those listed in static_ext
21250                 dflt=''
21251                 for xxx in $avail_ext; do
21252                         case " $static_ext " in
21253                         *" $xxx "*) ;;
21254                         *) dflt="$dflt $xxx" ;;
21255                         esac
21256                 done
21257                 set X $dflt
21258                 shift
21259                 dflt="$*"
21260                 ;;
21261         *)      dflt="$dynamic_ext"
21262                 # Perhaps we are reusing an old out-of-date config.sh.
21263                 case "$hint" in
21264                 previous)
21265                         if test X"$dynamic_ext" != X"$avail_ext"; then
21266                                 $cat <<EOM
21267 NOTICE:  Your previous config.sh list may be incorrect.
21268 The extensions now available to you are
21269         ${avail_ext}
21270 but the default list from your previous config.sh is
21271         ${dynamic_ext}
21272
21273 EOM
21274                         fi
21275                         ;;
21276                 esac
21277                 ;;
21278         esac
21279         case "$dflt" in
21280         '')     dflt=none;;
21281         esac
21282         rp="What extensions do you wish to load dynamically?"
21283         . ./myread
21284         case "$ans" in
21285         none) dynamic_ext=' ' ;;
21286         *) dynamic_ext="$ans" ;;
21287         esac
21288
21289         case "$static_ext" in
21290         '')
21291                 : Exclude those already listed in dynamic linking
21292                 dflt=''
21293                 for xxx in $avail_ext; do
21294                         case " $dynamic_ext " in
21295                         *" $xxx "*) ;;
21296                         *) dflt="$dflt $xxx" ;;
21297                         esac
21298                 done
21299                 set X $dflt
21300                 shift
21301                 dflt="$*"
21302                 ;;
21303         *)  dflt="$static_ext"
21304                 ;;
21305         esac
21306
21307         case "$dflt" in
21308         '')     dflt=none;;
21309         esac
21310         rp="What extensions do you wish to load statically?"
21311         . ./myread
21312         case "$ans" in
21313         none) static_ext=' ' ;;
21314         *) static_ext="$ans" ;;
21315         esac
21316         ;;
21317 *)
21318         $cat <<EOM
21319 A number of extensions are supplied with $package.  Answer "none"
21320 to include no extensions.
21321 Note that DynaLoader is always built and need not be mentioned here.
21322
21323 EOM
21324         case "$static_ext" in
21325         '') dflt="$avail_ext" ;;
21326         *)      dflt="$static_ext"
21327                 # Perhaps we are reusing an old out-of-date config.sh.
21328                 case "$hint" in
21329                 previous)
21330                         if test X"$static_ext" != X"$avail_ext"; then
21331                                 $cat <<EOM
21332 NOTICE:  Your previous config.sh list may be incorrect.
21333 The extensions now available to you are
21334         ${avail_ext}
21335 but the default list from your previous config.sh is
21336         ${static_ext}
21337
21338 EOM
21339                         fi
21340                         ;;
21341                 esac
21342                 ;;
21343         esac
21344         : Exclude those that are not xs extensions
21345         case "$dflt" in
21346         '')     dflt=none;;
21347         esac
21348         rp="What extensions do you wish to include?"
21349         . ./myread
21350         case "$ans" in
21351         none) static_ext=' ' ;;
21352         *) static_ext="$ans" ;;
21353         esac
21354         ;;
21355 esac
21356 #
21357 # Encode is a special case.  If we are building Encode as a static
21358 # extension, we need to explicitly list its subextensions as well.
21359 # For other nested extensions, this is handled automatically by
21360 # the appropriate Makefile.PL.
21361 case " $static_ext " in
21362         *" Encode "*) # Add the subextensions of Encode
21363         cd "$rsrc/ext"
21364         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21365                 static_ext="$static_ext Encode/$xxx"
21366         done
21367         cd "$tdir"
21368         ;;
21369 esac
21370
21371 set X $dynamic_ext $static_ext $nonxs_ext
21372 shift
21373 extensions="$*"
21374
21375 # Sanity check:  We require an extension suitable for use with
21376 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21377 # should show up as failures in the test suite, but it's helpful to
21378 # catch them now.) The 'extensions' list is normally sorted
21379 # alphabetically, so we need to accept either
21380 #    DB_File ... Fcntl ... IO  ....
21381 # or something like
21382 #    Fcntl ... NDBM_File ... IO  ....
21383 case " $extensions"  in
21384 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21385 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21386 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21387 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21388    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21389    ;;
21390 esac
21391
21392 : Remove libraries needed only for extensions
21393 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21394 : The exception is SunOS 4.x, which needs them.
21395 case "${osname}X${osvers}" in
21396 sunos*X4*)
21397     perllibs="$libs"
21398     ;;
21399 *) case "$usedl" in
21400     $define|true|[yY]*)
21401             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21402             shift
21403             perllibs="$*"
21404             ;;
21405     *)  perllibs="$libs"
21406             ;;
21407     esac
21408     ;;
21409 esac
21410
21411 : Remove build directory name from cppstdin so it can be used from
21412 : either the present location or the final installed location.
21413 echo " "
21414 : Get out of the UU directory to get correct path name.
21415 cd ..
21416 case "$cppstdin" in
21417 `pwd`/cppstdin)
21418         echo "Stripping down cppstdin path name"
21419         cppstdin=cppstdin
21420         ;;
21421 esac
21422 cd UU
21423
21424 : end of configuration questions
21425 echo " "
21426 echo "End of configuration questions."
21427 echo " "
21428
21429 : back to where it started
21430 if test -d ../UU; then
21431         cd ..
21432 fi
21433
21434 : configuration may be patched via a 'config.arch' file
21435 if $test -f config.arch; then
21436         echo "I see a config.arch file, loading it."
21437         . ./config.arch
21438 fi
21439
21440 : configuration may be patched via a 'config.over' file
21441 if $test -f config.over; then
21442         echo " "
21443         dflt=y
21444         rp='I see a config.over file.  Do you wish to load it?'
21445         . UU/myread
21446         case "$ans" in
21447         n*) echo "OK, I'll ignore it.";;
21448         *)      . ./config.over
21449                 echo "Configuration override changes have been loaded."
21450                 ;;
21451         esac
21452 fi
21453
21454 : in case they want portability, strip down executable paths
21455 case "$d_portable" in
21456 "$define")
21457         echo " "
21458         echo "Stripping down executable paths..." >&4
21459         for file in $loclist $trylist; do
21460                 eval temp=\$$file
21461                 eval $file=`basename $temp`
21462         done
21463         ;;
21464 esac
21465
21466 : create config.sh file
21467 echo " "
21468 echo "Creating config.sh..." >&4
21469 $spitshell <<EOT >config.sh
21470 $startsh
21471 #
21472 # This file was produced by running the Configure script. It holds all the
21473 # definitions figured out by Configure. Should you modify one of these values,
21474 # do not forget to propagate your changes by running "Configure -der". You may
21475 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21476 #
21477
21478 # Package name      : $package
21479 # Source directory  : $src
21480 # Configuration time: $cf_time
21481 # Configured by     : $cf_by
21482 # Target system     : $myuname
21483
21484 Author='$Author'
21485 Date='$Date'
21486 Header='$Header'
21487 Id='$Id'
21488 Locker='$Locker'
21489 Log='$Log'
21490 Mcc='$Mcc'
21491 RCSfile='$RCSfile'
21492 Revision='$Revision'
21493 Source='$Source'
21494 State='$State'
21495 _a='$_a'
21496 _exe='$_exe'
21497 _o='$_o'
21498 afs='$afs'
21499 afsroot='$afsroot'
21500 alignbytes='$alignbytes'
21501 ansi2knr='$ansi2knr'
21502 aphostname='$aphostname'
21503 api_revision='$api_revision'
21504 api_subversion='$api_subversion'
21505 api_version='$api_version'
21506 api_versionstring='$api_versionstring'
21507 ar='$ar'
21508 archlib='$archlib'
21509 archlibexp='$archlibexp'
21510 archname64='$archname64'
21511 archname='$archname'
21512 archobjs='$archobjs'
21513 asctime_r_proto='$asctime_r_proto'
21514 awk='$awk'
21515 baserev='$baserev'
21516 bash='$bash'
21517 bin='$bin'
21518 binexp='$binexp'
21519 bison='$bison'
21520 byacc='$byacc'
21521 byteorder='$byteorder'
21522 c='$c'
21523 castflags='$castflags'
21524 cat='$cat'
21525 cc='$cc'
21526 cccdlflags='$cccdlflags'
21527 ccdlflags='$ccdlflags'
21528 ccflags='$ccflags'
21529 ccflags_uselargefiles='$ccflags_uselargefiles'
21530 ccname='$ccname'
21531 ccsymbols='$ccsymbols'
21532 ccversion='$ccversion'
21533 cf_by='$cf_by'
21534 cf_email='$cf_email'
21535 cf_time='$cf_time'
21536 chgrp='$chgrp'
21537 chmod='$chmod'
21538 chown='$chown'
21539 clocktype='$clocktype'
21540 comm='$comm'
21541 compress='$compress'
21542 contains='$contains'
21543 cp='$cp'
21544 cpio='$cpio'
21545 cpp='$cpp'
21546 cpp_stuff='$cpp_stuff'
21547 cppccsymbols='$cppccsymbols'
21548 cppflags='$cppflags'
21549 cpplast='$cpplast'
21550 cppminus='$cppminus'
21551 cpprun='$cpprun'
21552 cppstdin='$cppstdin'
21553 cppsymbols='$cppsymbols'
21554 crypt_r_proto='$crypt_r_proto'
21555 cryptlib='$cryptlib'
21556 csh='$csh'
21557 ctermid_r_proto='$ctermid_r_proto'
21558 ctime_r_proto='$ctime_r_proto'
21559 d_Gconvert='$d_Gconvert'
21560 d_PRIEUldbl='$d_PRIEUldbl'
21561 d_PRIFUldbl='$d_PRIFUldbl'
21562 d_PRIGUldbl='$d_PRIGUldbl'
21563 d_PRIXU64='$d_PRIXU64'
21564 d_PRId64='$d_PRId64'
21565 d_PRIeldbl='$d_PRIeldbl'
21566 d_PRIfldbl='$d_PRIfldbl'
21567 d_PRIgldbl='$d_PRIgldbl'
21568 d_PRIi64='$d_PRIi64'
21569 d_PRIo64='$d_PRIo64'
21570 d_PRIu64='$d_PRIu64'
21571 d_PRIx64='$d_PRIx64'
21572 d_SCNfldbl='$d_SCNfldbl'
21573 d__fwalk='$d__fwalk'
21574 d_access='$d_access'
21575 d_accessx='$d_accessx'
21576 d_aintl='$d_aintl'
21577 d_alarm='$d_alarm'
21578 d_archlib='$d_archlib'
21579 d_asctime_r='$d_asctime_r'
21580 d_atolf='$d_atolf'
21581 d_atoll='$d_atoll'
21582 d_attribute_format='$d_attribute_format'
21583 d_attribute_malloc='$d_attribute_malloc'
21584 d_attribute_nonnull='$d_attribute_nonnull'
21585 d_attribute_noreturn='$d_attribute_noreturn'
21586 d_attribute_pure='$d_attribute_pure'
21587 d_attribute_unused='$d_attribute_unused'
21588 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21589 d_bcmp='$d_bcmp'
21590 d_bcopy='$d_bcopy'
21591 d_bsd='$d_bsd'
21592 d_bsdgetpgrp='$d_bsdgetpgrp'
21593 d_bsdsetpgrp='$d_bsdsetpgrp'
21594 d_builtin_choose_expr='$d_builtin_choose_expr'
21595 d_builtin_expect='$d_builtin_expect'
21596 d_bzero='$d_bzero'
21597 d_c99_variadic_macros='$d_c99_variadic_macros'
21598 d_casti32='$d_casti32'
21599 d_castneg='$d_castneg'
21600 d_charvspr='$d_charvspr'
21601 d_chown='$d_chown'
21602 d_chroot='$d_chroot'
21603 d_chsize='$d_chsize'
21604 d_class='$d_class'
21605 d_clearenv='$d_clearenv'
21606 d_closedir='$d_closedir'
21607 d_cmsghdr_s='$d_cmsghdr_s'
21608 d_const='$d_const'
21609 d_copysignl='$d_copysignl'
21610 d_cplusplus='$d_cplusplus'
21611 d_crypt='$d_crypt'
21612 d_crypt_r='$d_crypt_r'
21613 d_csh='$d_csh'
21614 d_ctermid='$d_ctermid'
21615 d_ctermid_r='$d_ctermid_r'
21616 d_ctime_r='$d_ctime_r'
21617 d_cuserid='$d_cuserid'
21618 d_dbl_dig='$d_dbl_dig'
21619 d_dbminitproto='$d_dbminitproto'
21620 d_difftime='$d_difftime'
21621 d_dir_dd_fd='$d_dir_dd_fd'
21622 d_dirfd='$d_dirfd'
21623 d_dirnamlen='$d_dirnamlen'
21624 d_dlerror='$d_dlerror'
21625 d_dlopen='$d_dlopen'
21626 d_dlsymun='$d_dlsymun'
21627 d_dosuid='$d_dosuid'
21628 d_drand48_r='$d_drand48_r'
21629 d_drand48proto='$d_drand48proto'
21630 d_dup2='$d_dup2'
21631 d_eaccess='$d_eaccess'
21632 d_endgrent='$d_endgrent'
21633 d_endgrent_r='$d_endgrent_r'
21634 d_endhent='$d_endhent'
21635 d_endhostent_r='$d_endhostent_r'
21636 d_endnent='$d_endnent'
21637 d_endnetent_r='$d_endnetent_r'
21638 d_endpent='$d_endpent'
21639 d_endprotoent_r='$d_endprotoent_r'
21640 d_endpwent='$d_endpwent'
21641 d_endpwent_r='$d_endpwent_r'
21642 d_endsent='$d_endsent'
21643 d_endservent_r='$d_endservent_r'
21644 d_eofnblk='$d_eofnblk'
21645 d_eunice='$d_eunice'
21646 d_faststdio='$d_faststdio'
21647 d_fchdir='$d_fchdir'
21648 d_fchmod='$d_fchmod'
21649 d_fchown='$d_fchown'
21650 d_fcntl='$d_fcntl'
21651 d_fcntl_can_lock='$d_fcntl_can_lock'
21652 d_fd_macros='$d_fd_macros'
21653 d_fd_set='$d_fd_set'
21654 d_fds_bits='$d_fds_bits'
21655 d_fgetpos='$d_fgetpos'
21656 d_finite='$d_finite'
21657 d_finitel='$d_finitel'
21658 d_flexfnam='$d_flexfnam'
21659 d_flock='$d_flock'
21660 d_flockproto='$d_flockproto'
21661 d_fork='$d_fork'
21662 d_fp_class='$d_fp_class'
21663 d_fpathconf='$d_fpathconf'
21664 d_fpclass='$d_fpclass'
21665 d_fpclassify='$d_fpclassify'
21666 d_fpclassl='$d_fpclassl'
21667 d_fpos64_t='$d_fpos64_t'
21668 d_frexpl='$d_frexpl'
21669 d_fs_data_s='$d_fs_data_s'
21670 d_fseeko='$d_fseeko'
21671 d_fsetpos='$d_fsetpos'
21672 d_fstatfs='$d_fstatfs'
21673 d_fstatvfs='$d_fstatvfs'
21674 d_fsync='$d_fsync'
21675 d_ftello='$d_ftello'
21676 d_ftime='$d_ftime'
21677 d_futimes='$d_futimes'
21678 d_getcwd='$d_getcwd'
21679 d_getespwnam='$d_getespwnam'
21680 d_getfsstat='$d_getfsstat'
21681 d_getgrent='$d_getgrent'
21682 d_getgrent_r='$d_getgrent_r'
21683 d_getgrgid_r='$d_getgrgid_r'
21684 d_getgrnam_r='$d_getgrnam_r'
21685 d_getgrps='$d_getgrps'
21686 d_gethbyaddr='$d_gethbyaddr'
21687 d_gethbyname='$d_gethbyname'
21688 d_gethent='$d_gethent'
21689 d_gethname='$d_gethname'
21690 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21691 d_gethostbyname_r='$d_gethostbyname_r'
21692 d_gethostent_r='$d_gethostent_r'
21693 d_gethostprotos='$d_gethostprotos'
21694 d_getitimer='$d_getitimer'
21695 d_getlogin='$d_getlogin'
21696 d_getlogin_r='$d_getlogin_r'
21697 d_getmnt='$d_getmnt'
21698 d_getmntent='$d_getmntent'
21699 d_getnbyaddr='$d_getnbyaddr'
21700 d_getnbyname='$d_getnbyname'
21701 d_getnent='$d_getnent'
21702 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21703 d_getnetbyname_r='$d_getnetbyname_r'
21704 d_getnetent_r='$d_getnetent_r'
21705 d_getnetprotos='$d_getnetprotos'
21706 d_getpagsz='$d_getpagsz'
21707 d_getpbyname='$d_getpbyname'
21708 d_getpbynumber='$d_getpbynumber'
21709 d_getpent='$d_getpent'
21710 d_getpgid='$d_getpgid'
21711 d_getpgrp2='$d_getpgrp2'
21712 d_getpgrp='$d_getpgrp'
21713 d_getppid='$d_getppid'
21714 d_getprior='$d_getprior'
21715 d_getprotobyname_r='$d_getprotobyname_r'
21716 d_getprotobynumber_r='$d_getprotobynumber_r'
21717 d_getprotoent_r='$d_getprotoent_r'
21718 d_getprotoprotos='$d_getprotoprotos'
21719 d_getprpwnam='$d_getprpwnam'
21720 d_getpwent='$d_getpwent'
21721 d_getpwent_r='$d_getpwent_r'
21722 d_getpwnam_r='$d_getpwnam_r'
21723 d_getpwuid_r='$d_getpwuid_r'
21724 d_getsbyname='$d_getsbyname'
21725 d_getsbyport='$d_getsbyport'
21726 d_getsent='$d_getsent'
21727 d_getservbyname_r='$d_getservbyname_r'
21728 d_getservbyport_r='$d_getservbyport_r'
21729 d_getservent_r='$d_getservent_r'
21730 d_getservprotos='$d_getservprotos'
21731 d_getspnam='$d_getspnam'
21732 d_getspnam_r='$d_getspnam_r'
21733 d_gettimeod='$d_gettimeod'
21734 d_gmtime_r='$d_gmtime_r'
21735 d_gnulibc='$d_gnulibc'
21736 d_grpasswd='$d_grpasswd'
21737 d_hasmntopt='$d_hasmntopt'
21738 d_htonl='$d_htonl'
21739 d_ilogbl='$d_ilogbl'
21740 d_inc_version_list='$d_inc_version_list'
21741 d_index='$d_index'
21742 d_inetaton='$d_inetaton'
21743 d_int64_t='$d_int64_t'
21744 d_isascii='$d_isascii'
21745 d_isfinite='$d_isfinite'
21746 d_isinf='$d_isinf'
21747 d_isnan='$d_isnan'
21748 d_isnanl='$d_isnanl'
21749 d_killpg='$d_killpg'
21750 d_lchown='$d_lchown'
21751 d_ldbl_dig='$d_ldbl_dig'
21752 d_libm_lib_version='$d_libm_lib_version'
21753 d_link='$d_link'
21754 d_localtime_r='$d_localtime_r'
21755 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21756 d_locconv='$d_locconv'
21757 d_lockf='$d_lockf'
21758 d_longdbl='$d_longdbl'
21759 d_longlong='$d_longlong'
21760 d_lseekproto='$d_lseekproto'
21761 d_lstat='$d_lstat'
21762 d_madvise='$d_madvise'
21763 d_malloc_good_size='$d_malloc_good_size'
21764 d_malloc_size='$d_malloc_size'
21765 d_mblen='$d_mblen'
21766 d_mbstowcs='$d_mbstowcs'
21767 d_mbtowc='$d_mbtowc'
21768 d_memchr='$d_memchr'
21769 d_memcmp='$d_memcmp'
21770 d_memcpy='$d_memcpy'
21771 d_memmove='$d_memmove'
21772 d_memset='$d_memset'
21773 d_mkdir='$d_mkdir'
21774 d_mkdtemp='$d_mkdtemp'
21775 d_mkfifo='$d_mkfifo'
21776 d_mkstemp='$d_mkstemp'
21777 d_mkstemps='$d_mkstemps'
21778 d_mktime='$d_mktime'
21779 d_mmap='$d_mmap'
21780 d_modfl='$d_modfl'
21781 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21782 d_modflproto='$d_modflproto'
21783 d_mprotect='$d_mprotect'
21784 d_msg='$d_msg'
21785 d_msg_ctrunc='$d_msg_ctrunc'
21786 d_msg_dontroute='$d_msg_dontroute'
21787 d_msg_oob='$d_msg_oob'
21788 d_msg_peek='$d_msg_peek'
21789 d_msg_proxy='$d_msg_proxy'
21790 d_msgctl='$d_msgctl'
21791 d_msgget='$d_msgget'
21792 d_msghdr_s='$d_msghdr_s'
21793 d_msgrcv='$d_msgrcv'
21794 d_msgsnd='$d_msgsnd'
21795 d_msync='$d_msync'
21796 d_munmap='$d_munmap'
21797 d_mymalloc='$d_mymalloc'
21798 d_nice='$d_nice'
21799 d_nl_langinfo='$d_nl_langinfo'
21800 d_nv_preserves_uv='$d_nv_preserves_uv'
21801 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21802 d_off64_t='$d_off64_t'
21803 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21804 d_oldpthreads='$d_oldpthreads'
21805 d_oldsock='$d_oldsock'
21806 d_open3='$d_open3'
21807 d_pathconf='$d_pathconf'
21808 d_pause='$d_pause'
21809 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21810 d_phostname='$d_phostname'
21811 d_pipe='$d_pipe'
21812 d_poll='$d_poll'
21813 d_portable='$d_portable'
21814 d_printf_format_null='$d_printf_format_null'
21815 d_procselfexe='$d_procselfexe'
21816 d_pseudofork='$d_pseudofork'
21817 d_pthread_atfork='$d_pthread_atfork'
21818 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21819 d_pthread_yield='$d_pthread_yield'
21820 d_pwage='$d_pwage'
21821 d_pwchange='$d_pwchange'
21822 d_pwclass='$d_pwclass'
21823 d_pwcomment='$d_pwcomment'
21824 d_pwexpire='$d_pwexpire'
21825 d_pwgecos='$d_pwgecos'
21826 d_pwpasswd='$d_pwpasswd'
21827 d_pwquota='$d_pwquota'
21828 d_qgcvt='$d_qgcvt'
21829 d_quad='$d_quad'
21830 d_random_r='$d_random_r'
21831 d_readdir64_r='$d_readdir64_r'
21832 d_readdir='$d_readdir'
21833 d_readdir_r='$d_readdir_r'
21834 d_readlink='$d_readlink'
21835 d_readv='$d_readv'
21836 d_recvmsg='$d_recvmsg'
21837 d_rename='$d_rename'
21838 d_rewinddir='$d_rewinddir'
21839 d_rmdir='$d_rmdir'
21840 d_safebcpy='$d_safebcpy'
21841 d_safemcpy='$d_safemcpy'
21842 d_sanemcmp='$d_sanemcmp'
21843 d_sbrkproto='$d_sbrkproto'
21844 d_scalbnl='$d_scalbnl'
21845 d_sched_yield='$d_sched_yield'
21846 d_scm_rights='$d_scm_rights'
21847 d_seekdir='$d_seekdir'
21848 d_select='$d_select'
21849 d_sem='$d_sem'
21850 d_semctl='$d_semctl'
21851 d_semctl_semid_ds='$d_semctl_semid_ds'
21852 d_semctl_semun='$d_semctl_semun'
21853 d_semget='$d_semget'
21854 d_semop='$d_semop'
21855 d_sendmsg='$d_sendmsg'
21856 d_setegid='$d_setegid'
21857 d_seteuid='$d_seteuid'
21858 d_setgrent='$d_setgrent'
21859 d_setgrent_r='$d_setgrent_r'
21860 d_setgrps='$d_setgrps'
21861 d_sethent='$d_sethent'
21862 d_sethostent_r='$d_sethostent_r'
21863 d_setitimer='$d_setitimer'
21864 d_setlinebuf='$d_setlinebuf'
21865 d_setlocale='$d_setlocale'
21866 d_setlocale_r='$d_setlocale_r'
21867 d_setnent='$d_setnent'
21868 d_setnetent_r='$d_setnetent_r'
21869 d_setpent='$d_setpent'
21870 d_setpgid='$d_setpgid'
21871 d_setpgrp2='$d_setpgrp2'
21872 d_setpgrp='$d_setpgrp'
21873 d_setprior='$d_setprior'
21874 d_setproctitle='$d_setproctitle'
21875 d_setprotoent_r='$d_setprotoent_r'
21876 d_setpwent='$d_setpwent'
21877 d_setpwent_r='$d_setpwent_r'
21878 d_setregid='$d_setregid'
21879 d_setresgid='$d_setresgid'
21880 d_setresuid='$d_setresuid'
21881 d_setreuid='$d_setreuid'
21882 d_setrgid='$d_setrgid'
21883 d_setruid='$d_setruid'
21884 d_setsent='$d_setsent'
21885 d_setservent_r='$d_setservent_r'
21886 d_setsid='$d_setsid'
21887 d_setvbuf='$d_setvbuf'
21888 d_sfio='$d_sfio'
21889 d_shm='$d_shm'
21890 d_shmat='$d_shmat'
21891 d_shmatprototype='$d_shmatprototype'
21892 d_shmctl='$d_shmctl'
21893 d_shmdt='$d_shmdt'
21894 d_shmget='$d_shmget'
21895 d_sigaction='$d_sigaction'
21896 d_signbit='$d_signbit'
21897 d_sigprocmask='$d_sigprocmask'
21898 d_sigsetjmp='$d_sigsetjmp'
21899 d_sitearch='$d_sitearch'
21900 d_snprintf='$d_snprintf'
21901 d_sockatmark='$d_sockatmark'
21902 d_sockatmarkproto='$d_sockatmarkproto'
21903 d_socket='$d_socket'
21904 d_socklen_t='$d_socklen_t'
21905 d_sockpair='$d_sockpair'
21906 d_socks5_init='$d_socks5_init'
21907 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21908 d_sqrtl='$d_sqrtl'
21909 d_srand48_r='$d_srand48_r'
21910 d_srandom_r='$d_srandom_r'
21911 d_sresgproto='$d_sresgproto'
21912 d_sresuproto='$d_sresuproto'
21913 d_statblks='$d_statblks'
21914 d_statfs_f_flags='$d_statfs_f_flags'
21915 d_statfs_s='$d_statfs_s'
21916 d_statvfs='$d_statvfs'
21917 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21918 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21919 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21920 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21921 d_stdio_stream_array='$d_stdio_stream_array'
21922 d_stdiobase='$d_stdiobase'
21923 d_stdstdio='$d_stdstdio'
21924 d_strchr='$d_strchr'
21925 d_strcoll='$d_strcoll'
21926 d_strctcpy='$d_strctcpy'
21927 d_strerrm='$d_strerrm'
21928 d_strerror='$d_strerror'
21929 d_strerror_r='$d_strerror_r'
21930 d_strftime='$d_strftime'
21931 d_strlcat='$d_strlcat'
21932 d_strlcpy='$d_strlcpy'
21933 d_strtod='$d_strtod'
21934 d_strtol='$d_strtol'
21935 d_strtold='$d_strtold'
21936 d_strtoll='$d_strtoll'
21937 d_strtoq='$d_strtoq'
21938 d_strtoul='$d_strtoul'
21939 d_strtoull='$d_strtoull'
21940 d_strtouq='$d_strtouq'
21941 d_strxfrm='$d_strxfrm'
21942 d_suidsafe='$d_suidsafe'
21943 d_symlink='$d_symlink'
21944 d_syscall='$d_syscall'
21945 d_syscallproto='$d_syscallproto'
21946 d_sysconf='$d_sysconf'
21947 d_sysernlst='$d_sysernlst'
21948 d_syserrlst='$d_syserrlst'
21949 d_system='$d_system'
21950 d_tcgetpgrp='$d_tcgetpgrp'
21951 d_tcsetpgrp='$d_tcsetpgrp'
21952 d_telldir='$d_telldir'
21953 d_telldirproto='$d_telldirproto'
21954 d_time='$d_time'
21955 d_times='$d_times'
21956 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21957 d_tm_tm_zone='$d_tm_tm_zone'
21958 d_tmpnam_r='$d_tmpnam_r'
21959 d_truncate='$d_truncate'
21960 d_ttyname_r='$d_ttyname_r'
21961 d_tzname='$d_tzname'
21962 d_u32align='$d_u32align'
21963 d_ualarm='$d_ualarm'
21964 d_umask='$d_umask'
21965 d_uname='$d_uname'
21966 d_union_semun='$d_union_semun'
21967 d_unordered='$d_unordered'
21968 d_unsetenv='$d_unsetenv'
21969 d_usleep='$d_usleep'
21970 d_usleepproto='$d_usleepproto'
21971 d_ustat='$d_ustat'
21972 d_vendorarch='$d_vendorarch'
21973 d_vendorbin='$d_vendorbin'
21974 d_vendorlib='$d_vendorlib'
21975 d_vendorscript='$d_vendorscript'
21976 d_vfork='$d_vfork'
21977 d_void_closedir='$d_void_closedir'
21978 d_voidsig='$d_voidsig'
21979 d_voidtty='$d_voidtty'
21980 d_volatile='$d_volatile'
21981 d_vprintf='$d_vprintf'
21982 d_vsnprintf='$d_vsnprintf'
21983 d_wait4='$d_wait4'
21984 d_waitpid='$d_waitpid'
21985 d_wcstombs='$d_wcstombs'
21986 d_wctomb='$d_wctomb'
21987 d_writev='$d_writev'
21988 d_xenix='$d_xenix'
21989 date='$date'
21990 db_hashtype='$db_hashtype'
21991 db_prefixtype='$db_prefixtype'
21992 db_version_major='$db_version_major'
21993 db_version_minor='$db_version_minor'
21994 db_version_patch='$db_version_patch'
21995 defvoidused='$defvoidused'
21996 direntrytype='$direntrytype'
21997 dlext='$dlext'
21998 dlsrc='$dlsrc'
21999 doublesize='$doublesize'
22000 drand01='$drand01'
22001 drand48_r_proto='$drand48_r_proto'
22002 dynamic_ext='$dynamic_ext'
22003 eagain='$eagain'
22004 ebcdic='$ebcdic'
22005 echo='$echo'
22006 egrep='$egrep'
22007 emacs='$emacs'
22008 endgrent_r_proto='$endgrent_r_proto'
22009 endhostent_r_proto='$endhostent_r_proto'
22010 endnetent_r_proto='$endnetent_r_proto'
22011 endprotoent_r_proto='$endprotoent_r_proto'
22012 endpwent_r_proto='$endpwent_r_proto'
22013 endservent_r_proto='$endservent_r_proto'
22014 eunicefix='$eunicefix'
22015 exe_ext='$exe_ext'
22016 expr='$expr'
22017 extensions='$extensions'
22018 extras='$extras'
22019 fflushNULL='$fflushNULL'
22020 fflushall='$fflushall'
22021 find='$find'
22022 firstmakefile='$firstmakefile'
22023 flex='$flex'
22024 fpossize='$fpossize'
22025 fpostype='$fpostype'
22026 freetype='$freetype'
22027 from='$from'
22028 full_ar='$full_ar'
22029 full_csh='$full_csh'
22030 full_sed='$full_sed'
22031 gccansipedantic='$gccansipedantic'
22032 gccosandvers='$gccosandvers'
22033 gccversion='$gccversion'
22034 getgrent_r_proto='$getgrent_r_proto'
22035 getgrgid_r_proto='$getgrgid_r_proto'
22036 getgrnam_r_proto='$getgrnam_r_proto'
22037 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
22038 gethostbyname_r_proto='$gethostbyname_r_proto'
22039 gethostent_r_proto='$gethostent_r_proto'
22040 getlogin_r_proto='$getlogin_r_proto'
22041 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
22042 getnetbyname_r_proto='$getnetbyname_r_proto'
22043 getnetent_r_proto='$getnetent_r_proto'
22044 getprotobyname_r_proto='$getprotobyname_r_proto'
22045 getprotobynumber_r_proto='$getprotobynumber_r_proto'
22046 getprotoent_r_proto='$getprotoent_r_proto'
22047 getpwent_r_proto='$getpwent_r_proto'
22048 getpwnam_r_proto='$getpwnam_r_proto'
22049 getpwuid_r_proto='$getpwuid_r_proto'
22050 getservbyname_r_proto='$getservbyname_r_proto'
22051 getservbyport_r_proto='$getservbyport_r_proto'
22052 getservent_r_proto='$getservent_r_proto'
22053 getspnam_r_proto='$getspnam_r_proto'
22054 gidformat='$gidformat'
22055 gidsign='$gidsign'
22056 gidsize='$gidsize'
22057 gidtype='$gidtype'
22058 glibpth='$glibpth'
22059 gmake='$gmake'
22060 gmtime_r_proto='$gmtime_r_proto'
22061 gnulibc_version='$gnulibc_version'
22062 grep='$grep'
22063 groupcat='$groupcat'
22064 groupstype='$groupstype'
22065 gzip='$gzip'
22066 h_fcntl='$h_fcntl'
22067 h_sysfile='$h_sysfile'
22068 hint='$hint'
22069 hostcat='$hostcat'
22070 html1dir='$html1dir'
22071 html1direxp='$html1direxp'
22072 html3dir='$html3dir'
22073 html3direxp='$html3direxp'
22074 i16size='$i16size'
22075 i16type='$i16type'
22076 i32size='$i32size'
22077 i32type='$i32type'
22078 i64size='$i64size'
22079 i64type='$i64type'
22080 i8size='$i8size'
22081 i8type='$i8type'
22082 i_arpainet='$i_arpainet'
22083 i_bsdioctl='$i_bsdioctl'
22084 i_crypt='$i_crypt'
22085 i_db='$i_db'
22086 i_dbm='$i_dbm'
22087 i_dirent='$i_dirent'
22088 i_dld='$i_dld'
22089 i_dlfcn='$i_dlfcn'
22090 i_fcntl='$i_fcntl'
22091 i_float='$i_float'
22092 i_fp='$i_fp'
22093 i_fp_class='$i_fp_class'
22094 i_gdbm='$i_gdbm'
22095 i_grp='$i_grp'
22096 i_ieeefp='$i_ieeefp'
22097 i_inttypes='$i_inttypes'
22098 i_langinfo='$i_langinfo'
22099 i_libutil='$i_libutil'
22100 i_limits='$i_limits'
22101 i_locale='$i_locale'
22102 i_machcthr='$i_machcthr'
22103 i_malloc='$i_malloc'
22104 i_math='$i_math'
22105 i_memory='$i_memory'
22106 i_mntent='$i_mntent'
22107 i_ndbm='$i_ndbm'
22108 i_netdb='$i_netdb'
22109 i_neterrno='$i_neterrno'
22110 i_netinettcp='$i_netinettcp'
22111 i_niin='$i_niin'
22112 i_poll='$i_poll'
22113 i_prot='$i_prot'
22114 i_pthread='$i_pthread'
22115 i_pwd='$i_pwd'
22116 i_rpcsvcdbm='$i_rpcsvcdbm'
22117 i_sfio='$i_sfio'
22118 i_sgtty='$i_sgtty'
22119 i_shadow='$i_shadow'
22120 i_socks='$i_socks'
22121 i_stdarg='$i_stdarg'
22122 i_stddef='$i_stddef'
22123 i_stdlib='$i_stdlib'
22124 i_string='$i_string'
22125 i_sunmath='$i_sunmath'
22126 i_sysaccess='$i_sysaccess'
22127 i_sysdir='$i_sysdir'
22128 i_sysfile='$i_sysfile'
22129 i_sysfilio='$i_sysfilio'
22130 i_sysin='$i_sysin'
22131 i_sysioctl='$i_sysioctl'
22132 i_syslog='$i_syslog'
22133 i_sysmman='$i_sysmman'
22134 i_sysmode='$i_sysmode'
22135 i_sysmount='$i_sysmount'
22136 i_sysndir='$i_sysndir'
22137 i_sysparam='$i_sysparam'
22138 i_sysresrc='$i_sysresrc'
22139 i_syssecrt='$i_syssecrt'
22140 i_sysselct='$i_sysselct'
22141 i_syssockio='$i_syssockio'
22142 i_sysstat='$i_sysstat'
22143 i_sysstatfs='$i_sysstatfs'
22144 i_sysstatvfs='$i_sysstatvfs'
22145 i_systime='$i_systime'
22146 i_systimek='$i_systimek'
22147 i_systimes='$i_systimes'
22148 i_systypes='$i_systypes'
22149 i_sysuio='$i_sysuio'
22150 i_sysun='$i_sysun'
22151 i_sysutsname='$i_sysutsname'
22152 i_sysvfs='$i_sysvfs'
22153 i_syswait='$i_syswait'
22154 i_termio='$i_termio'
22155 i_termios='$i_termios'
22156 i_time='$i_time'
22157 i_unistd='$i_unistd'
22158 i_ustat='$i_ustat'
22159 i_utime='$i_utime'
22160 i_values='$i_values'
22161 i_varargs='$i_varargs'
22162 i_varhdr='$i_varhdr'
22163 i_vfork='$i_vfork'
22164 ignore_versioned_solibs='$ignore_versioned_solibs'
22165 inc_version_list='$inc_version_list'
22166 inc_version_list_init='$inc_version_list_init'
22167 incpath='$incpath'
22168 inews='$inews'
22169 initialinstalllocation='$initialinstalllocation'
22170 installarchlib='$installarchlib'
22171 installbin='$installbin'
22172 installhtml1dir='$installhtml1dir'
22173 installhtml3dir='$installhtml3dir'
22174 installman1dir='$installman1dir'
22175 installman3dir='$installman3dir'
22176 installprefix='$installprefix'
22177 installprefixexp='$installprefixexp'
22178 installprivlib='$installprivlib'
22179 installscript='$installscript'
22180 installsitearch='$installsitearch'
22181 installsitebin='$installsitebin'
22182 installsitehtml1dir='$installsitehtml1dir'
22183 installsitehtml3dir='$installsitehtml3dir'
22184 installsitelib='$installsitelib'
22185 installsiteman1dir='$installsiteman1dir'
22186 installsiteman3dir='$installsiteman3dir'
22187 installsitescript='$installsitescript'
22188 installstyle='$installstyle'
22189 installusrbinperl='$installusrbinperl'
22190 installvendorarch='$installvendorarch'
22191 installvendorbin='$installvendorbin'
22192 installvendorhtml1dir='$installvendorhtml1dir'
22193 installvendorhtml3dir='$installvendorhtml3dir'
22194 installvendorlib='$installvendorlib'
22195 installvendorman1dir='$installvendorman1dir'
22196 installvendorman3dir='$installvendorman3dir'
22197 installvendorscript='$installvendorscript'
22198 intsize='$intsize'
22199 issymlink='$issymlink'
22200 ivdformat='$ivdformat'
22201 ivsize='$ivsize'
22202 ivtype='$ivtype'
22203 known_extensions='$known_extensions'
22204 ksh='$ksh'
22205 ld='$ld'
22206 lddlflags='$lddlflags'
22207 ldflags='$ldflags'
22208 ldflags_uselargefiles='$ldflags_uselargefiles'
22209 ldlibpthname='$ldlibpthname'
22210 less='$less'
22211 lib_ext='$lib_ext'
22212 libc='$libc'
22213 libperl='$libperl'
22214 libpth='$libpth'
22215 libs='$libs'
22216 libsdirs='$libsdirs'
22217 libsfiles='$libsfiles'
22218 libsfound='$libsfound'
22219 libspath='$libspath'
22220 libswanted='$libswanted'
22221 libswanted_uselargefiles='$libswanted_uselargefiles'
22222 line='$line'
22223 lint='$lint'
22224 lkflags='$lkflags'
22225 ln='$ln'
22226 lns='$lns'
22227 localtime_r_proto='$localtime_r_proto'
22228 locincpth='$locincpth'
22229 loclibpth='$loclibpth'
22230 longdblsize='$longdblsize'
22231 longlongsize='$longlongsize'
22232 longsize='$longsize'
22233 lp='$lp'
22234 lpr='$lpr'
22235 ls='$ls'
22236 lseeksize='$lseeksize'
22237 lseektype='$lseektype'
22238 mad='$mad'
22239 madlyh='$madlyh'
22240 madlyobj='$madlyobj'
22241 madlysrc='$madlysrc'
22242 mail='$mail'
22243 mailx='$mailx'
22244 make='$make'
22245 make_set_make='$make_set_make'
22246 mallocobj='$mallocobj'
22247 mallocsrc='$mallocsrc'
22248 malloctype='$malloctype'
22249 man1dir='$man1dir'
22250 man1direxp='$man1direxp'
22251 man1ext='$man1ext'
22252 man3dir='$man3dir'
22253 man3direxp='$man3direxp'
22254 man3ext='$man3ext'
22255 mips_type='$mips_type'
22256 mistrustnm='$mistrustnm'
22257 mkdir='$mkdir'
22258 mmaptype='$mmaptype'
22259 modetype='$modetype'
22260 more='$more'
22261 multiarch='$multiarch'
22262 mv='$mv'
22263 myarchname='$myarchname'
22264 mydomain='$mydomain'
22265 myhostname='$myhostname'
22266 myuname='$myuname'
22267 n='$n'
22268 need_va_copy='$need_va_copy'
22269 netdb_hlen_type='$netdb_hlen_type'
22270 netdb_host_type='$netdb_host_type'
22271 netdb_name_type='$netdb_name_type'
22272 netdb_net_type='$netdb_net_type'
22273 nm='$nm'
22274 nm_opt='$nm_opt'
22275 nm_so_opt='$nm_so_opt'
22276 nonxs_ext='$nonxs_ext'
22277 nroff='$nroff'
22278 nvEUformat='$nvEUformat'
22279 nvFUformat='$nvFUformat'
22280 nvGUformat='$nvGUformat'
22281 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22282 nveformat='$nveformat'
22283 nvfformat='$nvfformat'
22284 nvgformat='$nvgformat'
22285 nvsize='$nvsize'
22286 nvtype='$nvtype'
22287 o_nonblock='$o_nonblock'
22288 obj_ext='$obj_ext'
22289 old_pthread_create_joinable='$old_pthread_create_joinable'
22290 optimize='$optimize'
22291 orderlib='$orderlib'
22292 osname='$osname'
22293 osvers='$osvers'
22294 otherlibdirs='$otherlibdirs'
22295 package='$package'
22296 pager='$pager'
22297 passcat='$passcat'
22298 patchlevel='$patchlevel'
22299 path_sep='$path_sep'
22300 perl5='$perl5'
22301 perl='$perl'
22302 perl_patchlevel='$perl_patchlevel'
22303 perladmin='$perladmin'
22304 perllibs='$perllibs'
22305 perlpath='$perlpath'
22306 pg='$pg'
22307 phostname='$phostname'
22308 pidtype='$pidtype'
22309 plibpth='$plibpth'
22310 pmake='$pmake'
22311 pr='$pr'
22312 prefix='$prefix'
22313 prefixexp='$prefixexp'
22314 privlib='$privlib'
22315 privlibexp='$privlibexp'
22316 procselfexe='$procselfexe'
22317 prototype='$prototype'
22318 ptrsize='$ptrsize'
22319 quadkind='$quadkind'
22320 quadtype='$quadtype'
22321 randbits='$randbits'
22322 randfunc='$randfunc'
22323 random_r_proto='$random_r_proto'
22324 randseedtype='$randseedtype'
22325 ranlib='$ranlib'
22326 rd_nodata='$rd_nodata'
22327 readdir64_r_proto='$readdir64_r_proto'
22328 readdir_r_proto='$readdir_r_proto'
22329 revision='$revision'
22330 rm='$rm'
22331 rm_try='$rm_try'
22332 rmail='$rmail'
22333 run='$run'
22334 runnm='$runnm'
22335 sPRIEUldbl='$sPRIEUldbl'
22336 sPRIFUldbl='$sPRIFUldbl'
22337 sPRIGUldbl='$sPRIGUldbl'
22338 sPRIXU64='$sPRIXU64'
22339 sPRId64='$sPRId64'
22340 sPRIeldbl='$sPRIeldbl'
22341 sPRIfldbl='$sPRIfldbl'
22342 sPRIgldbl='$sPRIgldbl'
22343 sPRIi64='$sPRIi64'
22344 sPRIo64='$sPRIo64'
22345 sPRIu64='$sPRIu64'
22346 sPRIx64='$sPRIx64'
22347 sSCNfldbl='$sSCNfldbl'
22348 sched_yield='$sched_yield'
22349 scriptdir='$scriptdir'
22350 scriptdirexp='$scriptdirexp'
22351 sed='$sed'
22352 seedfunc='$seedfunc'
22353 selectminbits='$selectminbits'
22354 selecttype='$selecttype'
22355 sendmail='$sendmail'
22356 setgrent_r_proto='$setgrent_r_proto'
22357 sethostent_r_proto='$sethostent_r_proto'
22358 setlocale_r_proto='$setlocale_r_proto'
22359 setnetent_r_proto='$setnetent_r_proto'
22360 setprotoent_r_proto='$setprotoent_r_proto'
22361 setpwent_r_proto='$setpwent_r_proto'
22362 setservent_r_proto='$setservent_r_proto'
22363 sh='$sh'
22364 shar='$shar'
22365 sharpbang='$sharpbang'
22366 shmattype='$shmattype'
22367 shortsize='$shortsize'
22368 shrpenv='$shrpenv'
22369 shsharp='$shsharp'
22370 sig_count='$sig_count'
22371 sig_name='$sig_name'
22372 sig_name_init='$sig_name_init'
22373 sig_num='$sig_num'
22374 sig_num_init='$sig_num_init'
22375 sig_size='$sig_size'
22376 signal_t='$signal_t'
22377 sitearch='$sitearch'
22378 sitearchexp='$sitearchexp'
22379 sitebin='$sitebin'
22380 sitebinexp='$sitebinexp'
22381 sitehtml1dir='$sitehtml1dir'
22382 sitehtml1direxp='$sitehtml1direxp'
22383 sitehtml3dir='$sitehtml3dir'
22384 sitehtml3direxp='$sitehtml3direxp'
22385 sitelib='$sitelib'
22386 sitelib_stem='$sitelib_stem'
22387 sitelibexp='$sitelibexp'
22388 siteman1dir='$siteman1dir'
22389 siteman1direxp='$siteman1direxp'
22390 siteman3dir='$siteman3dir'
22391 siteman3direxp='$siteman3direxp'
22392 siteprefix='$siteprefix'
22393 siteprefixexp='$siteprefixexp'
22394 sitescript='$sitescript'
22395 sitescriptexp='$sitescriptexp'
22396 sizesize='$sizesize'
22397 sizetype='$sizetype'
22398 sleep='$sleep'
22399 smail='$smail'
22400 so='$so'
22401 sockethdr='$sockethdr'
22402 socketlib='$socketlib'
22403 socksizetype='$socksizetype'
22404 sort='$sort'
22405 spackage='$spackage'
22406 spitshell='$spitshell'
22407 srand48_r_proto='$srand48_r_proto'
22408 srandom_r_proto='$srandom_r_proto'
22409 src='$src'
22410 ssizetype='$ssizetype'
22411 startperl='$startperl'
22412 startsh='$startsh'
22413 static_ext='$static_ext'
22414 stdchar='$stdchar'
22415 stdio_base='$stdio_base'
22416 stdio_bufsiz='$stdio_bufsiz'
22417 stdio_cnt='$stdio_cnt'
22418 stdio_filbuf='$stdio_filbuf'
22419 stdio_ptr='$stdio_ptr'
22420 stdio_stream_array='$stdio_stream_array'
22421 strerror_r_proto='$strerror_r_proto'
22422 strings='$strings'
22423 submit='$submit'
22424 subversion='$subversion'
22425 sysman='$sysman'
22426 tail='$tail'
22427 tar='$tar'
22428 targetarch='$targetarch'
22429 tbl='$tbl'
22430 tee='$tee'
22431 test='$test'
22432 timeincl='$timeincl'
22433 timetype='$timetype'
22434 tmpnam_r_proto='$tmpnam_r_proto'
22435 to='$to'
22436 touch='$touch'
22437 tr='$tr'
22438 trnl='$trnl'
22439 troff='$troff'
22440 ttyname_r_proto='$ttyname_r_proto'
22441 u16size='$u16size'
22442 u16type='$u16type'
22443 u32size='$u32size'
22444 u32type='$u32type'
22445 u64size='$u64size'
22446 u64type='$u64type'
22447 u8size='$u8size'
22448 u8type='$u8type'
22449 uidformat='$uidformat'
22450 uidsign='$uidsign'
22451 uidsize='$uidsize'
22452 uidtype='$uidtype'
22453 uname='$uname'
22454 uniq='$uniq'
22455 uquadtype='$uquadtype'
22456 use5005threads='$use5005threads'
22457 use64bitall='$use64bitall'
22458 use64bitint='$use64bitint'
22459 usecrosscompile='$usecrosscompile'
22460 usedl='$usedl'
22461 usefaststdio='$usefaststdio'
22462 useithreads='$useithreads'
22463 uselargefiles='$uselargefiles'
22464 uselongdouble='$uselongdouble'
22465 usemallocwrap='$usemallocwrap'
22466 usemorebits='$usemorebits'
22467 usemultiplicity='$usemultiplicity'
22468 usemymalloc='$usemymalloc'
22469 usenm='$usenm'
22470 useopcode='$useopcode'
22471 useperlio='$useperlio'
22472 useposix='$useposix'
22473 usereentrant='$usereentrant'
22474 userelocatableinc='$userelocatableinc'
22475 usesfio='$usesfio'
22476 useshrplib='$useshrplib'
22477 usesitecustomize='$usesitecustomize'
22478 usesocks='$usesocks'
22479 usethreads='$usethreads'
22480 usevendorprefix='$usevendorprefix'
22481 usevfork='$usevfork'
22482 usrinc='$usrinc'
22483 uuname='$uuname'
22484 uvXUformat='$uvXUformat'
22485 uvoformat='$uvoformat'
22486 uvsize='$uvsize'
22487 uvtype='$uvtype'
22488 uvuformat='$uvuformat'
22489 uvxformat='$uvxformat'
22490 vendorarch='$vendorarch'
22491 vendorarchexp='$vendorarchexp'
22492 vendorbin='$vendorbin'
22493 vendorbinexp='$vendorbinexp'
22494 vendorhtml1dir='$vendorhtml1dir'
22495 vendorhtml1direxp='$vendorhtml1direxp'
22496 vendorhtml3dir='$vendorhtml3dir'
22497 vendorhtml3direxp='$vendorhtml3direxp'
22498 vendorlib='$vendorlib'
22499 vendorlib_stem='$vendorlib_stem'
22500 vendorlibexp='$vendorlibexp'
22501 vendorman1dir='$vendorman1dir'
22502 vendorman1direxp='$vendorman1direxp'
22503 vendorman3dir='$vendorman3dir'
22504 vendorman3direxp='$vendorman3direxp'
22505 vendorprefix='$vendorprefix'
22506 vendorprefixexp='$vendorprefixexp'
22507 vendorscript='$vendorscript'
22508 vendorscriptexp='$vendorscriptexp'
22509 version='$version'
22510 version_patchlevel_string='$version_patchlevel_string'
22511 versiononly='$versiononly'
22512 vi='$vi'
22513 voidflags='$voidflags'
22514 xlibpth='$xlibpth'
22515 yacc='$yacc'
22516 yaccflags='$yaccflags'
22517 zcat='$zcat'
22518 zip='$zip'
22519 EOT
22520
22521 : Add in command line options if available
22522 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22523
22524 : add special variables
22525 $test -f $src/patchlevel.h && \
22526 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22527 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22528 echo "PERL_CONFIG_SH=true" >>config.sh
22529
22530 : propagate old symbols
22531 if $test -f UU/config.sh; then
22532         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22533         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22534         $sort | $uniq -u >UU/oldsyms
22535         set X `cat UU/oldsyms`
22536         shift
22537         case $# in
22538         0) ;;
22539         *)
22540                 cat <<EOM
22541 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22542 EOM
22543                 echo "# Variables propagated from previous config.sh file." >>config.sh
22544                 for sym in `cat UU/oldsyms`; do
22545                         echo "    Propagating $hint variable "'$'"$sym..."
22546                         eval 'tmp="$'"${sym}"'"'
22547                         echo "$tmp" | \
22548                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22549                 done
22550                 ;;
22551         esac
22552 fi
22553
22554 : Finish up by extracting the .SH files
22555 case "$alldone" in
22556 exit)
22557         $rm -rf UU
22558         echo "Extraction done."
22559         exit 0
22560         ;;
22561 cont)
22562         ;;
22563 '')
22564         dflt=''
22565         nostick=true
22566         $cat <<EOM
22567
22568 If you'd like to make any changes to the config.sh file before I begin
22569 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22570
22571 EOM
22572         rp="Press return or use a shell escape to edit config.sh:"
22573         . UU/myread
22574         nostick=''
22575         case "$ans" in
22576         '') ;;
22577         *) : in case they cannot read
22578                 sh 1>&4 -c "$ans";;
22579         esac
22580         ;;
22581 esac
22582
22583 : if this fails, just run all the .SH files by hand
22584 . ./config.sh
22585
22586 echo " "
22587 exec 1>&4
22588 pwd=`pwd`
22589 . ./UU/extract
22590 cd "$pwd"
22591
22592 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22593         dflt=y
22594         case "$silent" in
22595         true) ;;
22596         *)
22597                 $cat <<EOM
22598
22599 Now you need to generate make dependencies by running "$make depend".
22600 You might prefer to run it in background: "$make depend > makedepend.out &"
22601 It can take a while, so you might not want to run it right now.
22602
22603 EOM
22604                 ;;
22605         esac
22606         rp="Run $make depend now?"
22607         . UU/myread
22608         case "$ans" in
22609         y*)
22610                 $make depend && echo "Now you must run '$make'."
22611                 ;;
22612         *)
22613                 echo "You must run '$make depend' then '$make'."
22614                 ;;
22615         esac
22616 elif test -f [Mm]akefile; then
22617         echo " "
22618         echo "Now you must run a $make."
22619 else
22620         echo "Configure done."
22621 fi
22622
22623 if $test -f Policy.sh; then
22624     $cat <<EOM
22625
22626 If you compile $package on a different machine or from a different object
22627 directory, copy the Policy.sh file from this object directory to the
22628 new one before you run Configure -- this will help you with most of
22629 the policy defaults.
22630
22631 EOM
22632 fi
22633 if $test -f config.msg; then
22634     echo "Hmm.  I also noted the following information while running:"
22635     echo " "
22636     $cat config.msg >&4
22637     $rm -f config.msg
22638 fi
22639 $rm -f kit*isdone ark*isdone
22640 $rm -rf UU
22641
22642 : End of Configure
22643